Revision: 200947
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 17 Dec 2009 08:52:00 +0200
changeset 0 7f85d04be362
child 1 499c41045f6d
Revision: 200947 Kit: 200951
dlnasrv_plat/group/bld.inf
dlnasrv_plat/upnp_av_objects_api/group/bld.inf
dlnasrv_plat/upnp_av_objects_api/inc/upnpattribute.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpbrowsecriteria.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpcontainer.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpcontainerlist.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpdlnaprotocolinfo.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpdlnaprotocolinfocons.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpelement.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpfiletransferevent.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpitem.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpitemlist.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpmediaserverevent.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpobject.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpobjectlist.h
dlnasrv_plat/upnp_av_objects_api/inc/upnpprotocolinfo.h
dlnasrv_plat/upnp_av_objects_api/upnp_av_objects_api.metaxml
dlnasrv_plat/upnp_avcp_api/group/bld.inf
dlnasrv_plat/upnp_avcp_api/inc/upnpavcontrolpoint.h
dlnasrv_plat/upnp_avcp_api/inc/upnpavcontrolpointobserver.h
dlnasrv_plat/upnp_avcp_api/upnp_avcp_api.metaxml
dlnasrv_plat/upnp_command_api/group/bld.inf
dlnasrv_plat/upnp_command_api/inc/upnpbrowsecommand.h
dlnasrv_plat/upnp_command_api/inc/upnpcommandobserver.h
dlnasrv_plat/upnp_command_api/inc/upnpcopycommand.h
dlnasrv_plat/upnp_command_api/inc/upnpmovecommand.h
dlnasrv_plat/upnp_command_api/inc/upnprunsetupcommand.h
dlnasrv_plat/upnp_command_api/inc/upnpshowcommand.h
dlnasrv_plat/upnp_command_api/upnp_command_api.metaxml
dlnasrv_plat/upnp_media_server_api/group/bld.inf
dlnasrv_plat/upnp_media_server_api/inc/upnpmediaserverclient.h
dlnasrv_plat/upnp_media_server_api/inc/upnpmediaservernotifier.h
dlnasrv_plat/upnp_media_server_api/inc/upnpmediaserverobserver.h
dlnasrv_plat/upnp_media_server_api/inc/upnpmediaserverstatuswatcher.h
dlnasrv_plat/upnp_media_server_api/upnp_media_server_api.metaxml
dlnasrv_plat/upnp_media_server_metadata_api/group/bld.inf
dlnasrv_plat/upnp_media_server_metadata_api/inc/upnpfilesharing.h
dlnasrv_plat/upnp_media_server_metadata_api/upnp_media_server_metadata_api.metaxml
dlnasrv_plat/upnp_media_server_settings_api/group/bld.inf
dlnasrv_plat/upnp_media_server_settings_api/inc/upnpmediaserversettings.h
dlnasrv_plat/upnp_media_server_settings_api/upnp_media_server_settings_api.metaxml
dlnasrv_plat/upnp_plugin_api/group/bld.inf
dlnasrv_plat/upnp_plugin_api/inc/upnpplugininterface.h
dlnasrv_plat/upnp_plugin_api/upnp_plugin_api.metaxml
dlnasrv_plat/upnp_security_plugin_api/group/bld.inf
dlnasrv_plat/upnp_security_plugin_api/inc/upnpsecuritymanager.h
dlnasrv_plat/upnp_security_plugin_api/upnp_security_plugin_api.metaxml
group/bld.inf
group/upnpplatformvar.hrh
homemedia/group/bld.inf
homemedia/homemedia/data/homemedia.rss
homemedia/homemedia/data/homemedia_reg.rss
homemedia/homemedia/gfx/qgn_menu_upnp_homemedia.svg
homemedia/homemedia/gfx/qgn_prop_upnp_browse_home.svg
homemedia/homemedia/gfx/qgn_prop_upnp_share_sub.svg
homemedia/homemedia/group/bld.inf
homemedia/homemedia/group/homemedia.mmp
homemedia/homemedia/help/data/xhtml.zip
homemedia/homemedia/help/group/bld.inf
homemedia/homemedia/help/inc/iupnp.hlp.hrh
homemedia/homemedia/help/rom/homemediahelps_variant.iby
homemedia/homemedia/inc/homemedia.hrh
homemedia/homemedia/inc/homemediaapplication.h
homemedia/homemedia/inc/homemediaappui.h
homemedia/homemedia/inc/homemediaappview.h
homemedia/homemedia/inc/homemediabaselistbox.h
homemedia/homemedia/inc/homemediacontainer.h
homemedia/homemedia/inc/homemediadocument.h
homemedia/homemedia/src/homemedia.cpp
homemedia/homemedia/src/homemediaapplication.cpp
homemedia/homemedia/src/homemediaappui.cpp
homemedia/homemedia/src/homemediaappview.cpp
homemedia/homemedia/src/homemediabaselistbox.cpp
homemedia/homemedia/src/homemediacontainer.cpp
homemedia/homemedia/src/homemediadocument.cpp
homemedia/install/make_upnpapplications_sis.bat
homemedia/install/make_upnpapplications_stub_sis.bat
homemedia/install/upnpapplications.pkg
homemedia/install/upnpapplications_stub.SIS
homemedia/install/upnpapplications_stub.pkg
homemedia/loc/homemedia.loc
homemedia/rom/homemedia.iby
homemedia/rom/homemediaresources.iby
homesync/conf/mediaservant.confml
homesync/conf/mediaservant_10281fab.crml
homesync/contentmanager/cmserver/cmfillmanager/bwins/cmfillmanageru.def
homesync/contentmanager/cmserver/cmfillmanager/eabi/cmfillmanageru.def
homesync/contentmanager/cmserver/cmfillmanager/group/bld.inf
homesync/contentmanager/cmserver/cmfillmanager/group/cmfillmanager.mmp
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfillmanager.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfillmanagerfactory.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmao.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmcommon.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadmngr.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadproxy.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmduplicatedetector.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfilldrivemngr.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfillrulefilleddatamngr.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfillruleobserver.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmglxnotifier.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmitemhandlerobserver.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmain.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmdeduplicatedetector.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmpxduplicatedetector.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmpxnotifier.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmtransferobserver.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmupnpactionobserver.h
homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmupnpmngr.h
homesync/contentmanager/cmserver/cmfillmanager/src/cmfillmanagerfactory.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmao.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmdownloadmngr.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmdownloadproxy.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmduplicatedetector.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmfilldrivemngr.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmfillrulefilleddatamngr.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmglxnotifier.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmain.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmdeduplicatedetector.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmpxduplicatedetector.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmpxnotifier.cpp
homesync/contentmanager/cmserver/cmfillmanager/src/cmfmupnpmngr.cpp
homesync/contentmanager/cmserver/cmmemorymanager/bwins/cmmemorymanageru.def
homesync/contentmanager/cmserver/cmmemorymanager/data/memorymanager.rss
homesync/contentmanager/cmserver/cmmemorymanager/eabi/cmmemorymanageru.def
homesync/contentmanager/cmserver/cmmemorymanager/group/bld.inf
homesync/contentmanager/cmserver/cmmemorymanager/group/cmmemorymanager.mmp
homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmimagemetadataresolver.h
homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmmain.h
homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmobserver.h
homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmquotalistener.h
homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmshrinker.h
homesync/contentmanager/cmserver/cmmemorymanager/loc/memorymanager.loc
homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmimagemetadataresolver.cpp
homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmmain.cpp
homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmquotalistener.cpp
homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmshrinker.cpp
homesync/contentmanager/cmserver/cmscheduler/bwins/cmscheduleru.def
homesync/contentmanager/cmserver/cmscheduler/eabi/cmscheduleru.def
homesync/contentmanager/cmserver/cmscheduler/group/bld.inf
homesync/contentmanager/cmserver/cmscheduler/group/cmscheduler.mmp
homesync/contentmanager/cmserver/cmscheduler/inc/cmcenrepnotifier.h
homesync/contentmanager/cmserver/cmscheduler/inc/cmcommsdbnotifier.h
homesync/contentmanager/cmserver/cmscheduler/inc/cmscheduler.h
homesync/contentmanager/cmserver/cmscheduler/src/cmcenrepnotifier.cpp
homesync/contentmanager/cmserver/cmscheduler/src/cmcommsdbnotifier.cpp
homesync/contentmanager/cmserver/cmscheduler/src/cmscheduler.cpp
homesync/contentmanager/cmserver/cmserver/bwins/cmclientu.def
homesync/contentmanager/cmserver/cmserver/data/cmserver.rss
homesync/contentmanager/cmserver/cmserver/data/cmserver_reg.rss
homesync/contentmanager/cmserver/cmserver/eabi/cmclientu.def
homesync/contentmanager/cmserver/cmserver/group/bld.inf
homesync/contentmanager/cmserver/cmserver/group/cmclient.mmp
homesync/contentmanager/cmserver/cmserver/group/cmserver.mmp
homesync/contentmanager/cmserver/cmserver/inc/client/cmactive.h
homesync/contentmanager/cmserver/cmserver/inc/client/contentmanager.h
homesync/contentmanager/cmserver/cmserver/inc/cmuids.hrh
homesync/contentmanager/cmserver/cmserver/inc/server/cmserver.h
homesync/contentmanager/cmserver/cmserver/inc/server/cmserversession.h
homesync/contentmanager/cmserver/cmserver/src/client/cmactive.cpp
homesync/contentmanager/cmserver/cmserver/src/client/cmclientsession.cpp
homesync/contentmanager/cmserver/cmserver/src/server/cmserver.cpp
homesync/contentmanager/cmserver/cmserver/src/server/cmservermain.cpp
homesync/contentmanager/cmserver/cmserver/src/server/cmserversession.cpp
homesync/contentmanager/cmserver/cmstoremanager/bwins/cmstoremanageru.def
homesync/contentmanager/cmserver/cmstoremanager/eabi/cmstoremanageru.def
homesync/contentmanager/cmserver/cmstoremanager/group/bld.inf
homesync/contentmanager/cmserver/cmstoremanager/group/cmstoremanager.mmp
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmclfmngr.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmcommon.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmcontentchangeobserver.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmfilemngr.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmfileprocessingobserver.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmiteminfo.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmain.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmsinfo.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmusicmngrobserver.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmtransferengine.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmtransferobserver.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmvideoandimagemngr.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmvideoandimagemngrobserver.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmstoremanager.h
homesync/contentmanager/cmserver/cmstoremanager/inc/cmstoremanagerfactory.h
homesync/contentmanager/cmserver/cmstoremanager/src/cmsmclfmngr.cpp
homesync/contentmanager/cmserver/cmstoremanager/src/cmsmcontentchangeobserver.cpp
homesync/contentmanager/cmserver/cmstoremanager/src/cmsmfilemngr.cpp
homesync/contentmanager/cmserver/cmstoremanager/src/cmsmiteminfo.cpp
homesync/contentmanager/cmserver/cmstoremanager/src/cmsmmain.cpp
homesync/contentmanager/cmserver/cmstoremanager/src/cmsmmsinfo.cpp
homesync/contentmanager/cmserver/cmstoremanager/src/cmsmtransferengine.cpp
homesync/contentmanager/cmserver/cmstoremanager/src/cmsmvideoandimagemngr.cpp
homesync/contentmanager/cmserver/cmstoremanager/src/cmstoremanagerfactory.cpp
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_1.svg
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_2.svg
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_3.svg
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_4.svg
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_5.svg
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_6.svg
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_7.svg
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_8.svg
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_9.svg
homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_mserv_app_menu_icon.svg
homesync/contentmanager/homesyncgsplugin/data/msgsplugin.rss
homesync/contentmanager/homesyncgsplugin/data/msgspluginsrc.rss
homesync/contentmanager/homesyncgsplugin/group/bld.inf
homesync/contentmanager/homesyncgsplugin/group/msgsplugin.mmp
homesync/contentmanager/homesyncgsplugin/inc/msgs.hrh
homesync/contentmanager/homesyncgsplugin/inc/msgs.inl
homesync/contentmanager/homesyncgsplugin/inc/msgsinterface.h
homesync/contentmanager/homesyncgsplugin/inc/msgspluginuids.h
homesync/contentmanager/homesyncgsplugin/inc/msmultiselectionpopup.h
homesync/contentmanager/homesyncgsplugin/inc/mssettingitemdevices.h
homesync/contentmanager/homesyncgsplugin/inc/mssettingitemlist.h
homesync/contentmanager/homesyncgsplugin/inc/mssettingitemmemory.h
homesync/contentmanager/homesyncgsplugin/inc/mssettingitems.h
homesync/contentmanager/homesyncgsplugin/inc/mssettingsview.h
homesync/contentmanager/homesyncgsplugin/loc/msgsplugin.loc
homesync/contentmanager/homesyncgsplugin/src/msgspluginimplementationtable.cpp
homesync/contentmanager/homesyncgsplugin/src/msmultiselectionpopup.cpp
homesync/contentmanager/homesyncgsplugin/src/mssettingitemdevices.cpp
homesync/contentmanager/homesyncgsplugin/src/mssettingitemlist.cpp
homesync/contentmanager/homesyncgsplugin/src/mssettingitemmemory.cpp
homesync/contentmanager/homesyncgsplugin/src/mssettingitems.cpp
homesync/contentmanager/homesyncgsplugin/src/mssettingsview.cpp
homesync/contentmanager/homesyncwizard/BWINS/msappwizardu.def
homesync/contentmanager/homesyncwizard/EABI/msappwizardu.def
homesync/contentmanager/homesyncwizard/bitmaps/qgn_graf_upnp_ext_renderer.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_1.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_2.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_3.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_4.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_5.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_6.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_7.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_8.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_9.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_folder_current.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_folder_locked_small.svg
homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_im_server.svg
homesync/contentmanager/homesyncwizard/data/cmsappwizard.rss
homesync/contentmanager/homesyncwizard/group/bld.inf
homesync/contentmanager/homesyncwizard/group/cmsappwizard.mmp
homesync/contentmanager/homesyncwizard/inc/cmsappwizard.h
homesync/contentmanager/homesyncwizard/inc/cmsmultiselectionpopup.h
homesync/contentmanager/homesyncwizard/inc/cmsselectionstorage.h
homesync/contentmanager/homesyncwizard/loc/cmsappwizard.loc
homesync/contentmanager/homesyncwizard/src/cmsappwizard.cpp
homesync/contentmanager/homesyncwizard/src/cmsmultiselectionpopup.cpp
homesync/contentmanager/homesyncwizard/src/cmsselectionstorage.cpp
homesync/contentmanager/mediaservant/aif/qgn_mserv_app_context_icon.svg
homesync/contentmanager/mediaservant/applicationengine/bwins/msengineu.def
homesync/contentmanager/mediaservant/applicationengine/eabi/msengineu.def
homesync/contentmanager/mediaservant/applicationengine/group/bld.inf
homesync/contentmanager/mediaservant/applicationengine/group/msengine.mmp
homesync/contentmanager/mediaservant/applicationengine/inc/msengine.h
homesync/contentmanager/mediaservant/applicationengine/inc/msengineao.h
homesync/contentmanager/mediaservant/applicationengine/inc/msengineobserver.h
homesync/contentmanager/mediaservant/applicationengine/src/msengine.cpp
homesync/contentmanager/mediaservant/applicationengine/src/msengineao.cpp
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_app_context_icon.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_app_menu_icon.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_context_from_home.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_context_icon.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_fill_small.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_from_home.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_from_home_inactive.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_image_list_small.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_music.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_music_list_small.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_other_images.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_other_videos.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_partial_icon.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_partial_note_icon.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_phone_images.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_phone_videos.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_red_check.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_red_uncheck.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_removed_small.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_skipped_small.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_store_small.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_from_home.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_full.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_stop.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_to_home.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_to_home.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_to_home_inactive.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_unavailable_small.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_video_list_small.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_white_check.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_white_uncheck.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_yellow_check.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_yellow_uncheck.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_audio.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_image.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_video.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_icon_sub.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_music.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_other_images.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_other_videos.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_phone_images.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_phone_videos.svg
homesync/contentmanager/mediaservant/bitmaps/qgn_prop_skipped.svg
homesync/contentmanager/mediaservant/data/mediaservant.rh
homesync/contentmanager/mediaservant/data/mediaservant.rss
homesync/contentmanager/mediaservant/data/mediaservant_reg.rss
homesync/contentmanager/mediaservant/group/bld.inf
homesync/contentmanager/mediaservant/group/iconlist.txt
homesync/contentmanager/mediaservant/group/mediaservant.mmp
homesync/contentmanager/mediaservant/help/data/xhtml.zip
homesync/contentmanager/mediaservant/help/group/bld.inf
homesync/contentmanager/mediaservant/help/inc/mserv.hlp.hrh
homesync/contentmanager/mediaservant/help/rom/mediaservanthelps_variant.iby
homesync/contentmanager/mediaservant/inc/mediaservant.hrh
homesync/contentmanager/mediaservant/inc/mediaservantuid.h
homesync/contentmanager/mediaservant/inc/msapp.h
homesync/contentmanager/mediaservant/inc/msappui.h
homesync/contentmanager/mediaservant/inc/msbasecontainer.h
homesync/contentmanager/mediaservant/inc/msbaseview.h
homesync/contentmanager/mediaservant/inc/msbrowsecontainer.h
homesync/contentmanager/mediaservant/inc/msbrowseview.h
homesync/contentmanager/mediaservant/inc/msconstants.h
homesync/contentmanager/mediaservant/inc/msdocument.h
homesync/contentmanager/mediaservant/inc/msfillbrowsecontainer.h
homesync/contentmanager/mediaservant/inc/msfillbrowseview.h
homesync/contentmanager/mediaservant/inc/msfillcontainer.h
homesync/contentmanager/mediaservant/inc/msfillrulecontroller.h
homesync/contentmanager/mediaservant/inc/msfillruleeditlist.h
homesync/contentmanager/mediaservant/inc/msfillruleeditview.h
homesync/contentmanager/mediaservant/inc/msfillview.h
homesync/contentmanager/mediaservant/inc/msitembrowser.h
homesync/contentmanager/mediaservant/inc/msmaincontainer.h
homesync/contentmanager/mediaservant/inc/msmainview.h
homesync/contentmanager/mediaservant/inc/msmemorycardmonitor.h
homesync/contentmanager/mediaservant/inc/msmetadatacollector.h
homesync/contentmanager/mediaservant/inc/msmultiselectiondialog.h
homesync/contentmanager/mediaservant/inc/msmultiselectionsettingpage.h
homesync/contentmanager/mediaservant/inc/msparameteragent.h
homesync/contentmanager/mediaservant/inc/mspropertywatcher.h
homesync/contentmanager/mediaservant/inc/msruleamountsetting.h
homesync/contentmanager/mediaservant/inc/msrulefilesizesetting.h
homesync/contentmanager/mediaservant/inc/msrulemultiselectionsetting.h
homesync/contentmanager/mediaservant/inc/msruleserverssetting.h
homesync/contentmanager/mediaservant/inc/mssettingitems.h
homesync/contentmanager/mediaservant/inc/msstorekeeponphonesetting.h
homesync/contentmanager/mediaservant/inc/msstorelistcontainer.h
homesync/contentmanager/mediaservant/inc/msstorelistcontroller.h
homesync/contentmanager/mediaservant/inc/msstorelistview.h
homesync/contentmanager/mediaservant/inc/msstoreserverssetting.h
homesync/contentmanager/mediaservant/inc/msstoresettingslist.h
homesync/contentmanager/mediaservant/inc/msstoresettingsview.h
homesync/contentmanager/mediaservant/loc/mediaservant.loc
homesync/contentmanager/mediaservant/plugin/data/200075DD.rss
homesync/contentmanager/mediaservant/plugin/group/bld.inf
homesync/contentmanager/mediaservant/plugin/group/mediaservantplugin.mmp
homesync/contentmanager/mediaservant/plugin/inc/mediaservantplugin.h
homesync/contentmanager/mediaservant/plugin/inc/pluginuids.h
homesync/contentmanager/mediaservant/plugin/src/mediaservantplugin.cpp
homesync/contentmanager/mediaservant/plugin/src/proxy.cpp
homesync/contentmanager/mediaservant/src/msapp.cpp
homesync/contentmanager/mediaservant/src/msappui.cpp
homesync/contentmanager/mediaservant/src/msbasecontainer.cpp
homesync/contentmanager/mediaservant/src/msbaseview.cpp
homesync/contentmanager/mediaservant/src/msbrowsecontainer.cpp
homesync/contentmanager/mediaservant/src/msbrowseview.cpp
homesync/contentmanager/mediaservant/src/msdocument.cpp
homesync/contentmanager/mediaservant/src/msfillbrowsecontainer.cpp
homesync/contentmanager/mediaservant/src/msfillbrowseview.cpp
homesync/contentmanager/mediaservant/src/msfillcontainer.cpp
homesync/contentmanager/mediaservant/src/msfillrulecontroller.cpp
homesync/contentmanager/mediaservant/src/msfillruleeditlist.cpp
homesync/contentmanager/mediaservant/src/msfillruleeditview.cpp
homesync/contentmanager/mediaservant/src/msfillview.cpp
homesync/contentmanager/mediaservant/src/msitembrowser.cpp
homesync/contentmanager/mediaservant/src/msmaincontainer.cpp
homesync/contentmanager/mediaservant/src/msmainview.cpp
homesync/contentmanager/mediaservant/src/msmemorycardmonitor.cpp
homesync/contentmanager/mediaservant/src/msmetadatacollector.cpp
homesync/contentmanager/mediaservant/src/msmultiselectiondialog.cpp
homesync/contentmanager/mediaservant/src/msmultiselectionsettingpage.cpp
homesync/contentmanager/mediaservant/src/msparameteragent.cpp
homesync/contentmanager/mediaservant/src/mspropertywatcher.cpp
homesync/contentmanager/mediaservant/src/msruleamountsetting.cpp
homesync/contentmanager/mediaservant/src/msrulefilesizesetting.cpp
homesync/contentmanager/mediaservant/src/msrulemultiselectionsetting.cpp
homesync/contentmanager/mediaservant/src/msruleserverssetting.cpp
homesync/contentmanager/mediaservant/src/mssettingitems.cpp
homesync/contentmanager/mediaservant/src/msstorekeeponphonesetting.cpp
homesync/contentmanager/mediaservant/src/msstorelistcontainer.cpp
homesync/contentmanager/mediaservant/src/msstorelistcontroller.cpp
homesync/contentmanager/mediaservant/src/msstorelistview.cpp
homesync/contentmanager/mediaservant/src/msstoreserverssetting.cpp
homesync/contentmanager/mediaservant/src/msstoresettingslist.cpp
homesync/contentmanager/mediaservant/src/msstoresettingsview.cpp
homesync/group/bld.inf
homesync/group/build_mediaservant.bat
homesync/group/clean_mediaservant.bat
homesync/group/mediaservantvariant.hrh
homesync/group/msdebug.h
homesync/install/empty.sq
homesync/install/make_mediaservant_sis.bat
homesync/install/make_mediaservant_stub_sis.bat
homesync/install/mediaservant.pkg
homesync/install/mediaservant_stub.SIS
homesync/install/mediaservant_stub.pkg
homesync/rom/mediaservant.iby
homesync/rom/mediaservantresources.iby
layers.sysdef.xml
package_definition.xml
sysdef_1_4_0.dtd
upnpavcontroller/group/bld.inf
upnpavcontroller/rom/upnpavcontroller.iby
upnpavcontroller/upnpavcontrollerclient/bwins/upnpavcontrollerclientu.def
upnpavcontroller/upnpavcontrollerclient/eabi/upnpavcontrollerclientu.def
upnpavcontroller/upnpavcontrollerclient/group/bld.inf
upnpavcontroller/upnpavcontrollerclient/group/upnpavcontrollerclient.mmp
upnpavcontroller/upnpavcontrollerclient/inc/tupnpfiletransferevent.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowserequest.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowserequest.inl
upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowserespparams.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowsingsession.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowsingsessionimpl.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowsingsessionobserver.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavconnectionactive.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontroller.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontrolleractive.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontrollerclient.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontrollerfactory.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontrollerglobals.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavdevice.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavdeviceactive.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavdevicelist.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavdeviceobserver.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpaveventactive.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavrenderingactive.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavrenderingsession.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavrenderingsessionimpl.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavrenderingsessionobserver.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavrequest.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavrequest.inl
upnpavcontroller/upnpavcontrollerclient/inc/upnpavsessionbase.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpavsessionobserverbase.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpfiledownloadsession.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpfiledownloadsessionimpl.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpfiletransferitem.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpfiletransferitem.inl
upnpavcontroller/upnpavcontrollerclient/inc/upnpfiletransfersession.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpfiletransfersessionobserver.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpfileuploadsession.h
upnpavcontroller/upnpavcontrollerclient/inc/upnpfileuploadsessionimpl.h
upnpavcontroller/upnpavcontrollerclient/src/upnpavbrowsingsessionimpl.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpavconnectionactive.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpavcontrolleractive.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpavcontrollerclient.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpavcontrollerfactory.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpavdevice.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpavdeviceactive.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpavdevicelist.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpaveventactive.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpavrenderingactive.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpavrenderingsessionimpl.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpfiledownloadsessionimpl.cpp
upnpavcontroller/upnpavcontrollerclient/src/upnpfileuploadsessionimpl.cpp
upnpavcontroller/upnpavcontrollerhelper/bwins/upnpavcontrollerhelperu.def
upnpavcontroller/upnpavcontrollerhelper/eabi/upnpavcontrollerhelperu.def
upnpavcontroller/upnpavcontrollerhelper/group/bld.inf
upnpavcontroller/upnpavcontrollerhelper/group/upnpavcontrollerhelper.mmp
upnpavcontroller/upnpavcontrollerhelper/inc/upnpabstractbrowsingsessionobserver.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpabstractrenderingsessionobserver.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpconstantdefs.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpdlnautility.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpdownloaditemresolver.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpfileutility.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpinternalfileutility.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpitemresolver.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpitemresolverfactory.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpitemresolverobserver.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpitemutility.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnplocalitemresolver.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpremoteitemresolver.h
upnpavcontroller/upnpavcontrollerhelper/inc/upnpresourceselector.h
upnpavcontroller/upnpavcontrollerhelper/src/upnpabstractbrowsingsessionobserver.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpabstractrenderingsessionobserver.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpdlnautility.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpdownloaditemresolver.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpfileutility.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpinternalfileutility.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpitemresolver.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpitemresolverfactory.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpitemutility.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnplocalitemresolver.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpremoteitemresolver.cpp
upnpavcontroller/upnpavcontrollerhelper/src/upnpresourceselector.cpp
upnpavcontroller/upnpavcontrollerserver/group/bld.inf
upnpavcontroller/upnpavcontrollerserver/group/upnpavcontrollerserver.mmp
upnpavcontroller/upnpavcontrollerserver/inc/upnpavactioninfo.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrollerimpl.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrollerserver.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrollerserver.pan
upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrollersession.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpavdeviceextended.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpavdispatcher.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpaverrorhandler.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpavtimer.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpbrowsingsession.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpdevicediscoverymessage.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpdevicerepository.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpdownloadsession.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpfilesharingactive.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpfiletransfersessionbase.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpplaybacksession.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpresourcehelper.h
upnpavcontroller/upnpavcontrollerserver/inc/upnpuploadsession.h
upnpavcontroller/upnpavcontrollerserver/src/upnpavactioninfo.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpavcontrollerimpl.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpavcontrollerserver.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpavcontrollersession.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpavdeviceextended.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpavdispatcher.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpaverrorhandler.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpavtimer.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpbrowsingsession.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpdevicediscoverymessage.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpdevicerepository.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpdownloadsession.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpfilesharingactive.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpfiletransfersessionbase.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpplaybacksession.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpresourcehelper.cpp
upnpavcontroller/upnpavcontrollerserver/src/upnpuploadsession.cpp
upnpavcontroller/upnpxmlparser/bwins/upnpxmlparseru.def
upnpavcontroller/upnpxmlparser/eabi/upnpxmlparseru.def
upnpavcontroller/upnpxmlparser/group/bld.inf
upnpavcontroller/upnpxmlparser/group/upnpxmlparser.mmp
upnpavcontroller/upnpxmlparser/inc/upnpcontainertoxml.h
upnpavcontroller/upnpxmlparser/inc/upnpitemtoxml.h
upnpavcontroller/upnpxmlparser/inc/upnpobjectlite.h
upnpavcontroller/upnpxmlparser/inc/upnpobjectstack.h
upnpavcontroller/upnpxmlparser/inc/upnpobjectstack.inl
upnpavcontroller/upnpxmlparser/inc/upnpobjectstacklite.h
upnpavcontroller/upnpxmlparser/inc/upnpobjectstacklite.inl
upnpavcontroller/upnpxmlparser/inc/upnpxmleventparser.h
upnpavcontroller/upnpxmlparser/inc/upnpxmlparser.h
upnpavcontroller/upnpxmlparser/inc/upnpxmlparserlite.h
upnpavcontroller/upnpxmlparser/inc/upnpxmlstringutility.h
upnpavcontroller/upnpxmlparser/src/upnpcontainertoxml.cpp
upnpavcontroller/upnpxmlparser/src/upnpitemtoxml.cpp
upnpavcontroller/upnpxmlparser/src/upnpobjectlite.cpp
upnpavcontroller/upnpxmlparser/src/upnpxmleventparser.cpp
upnpavcontroller/upnpxmlparser/src/upnpxmlparser.cpp
upnpavcontroller/upnpxmlparser/src/upnpxmlparserlite.cpp
upnpavcontroller/upnpxmlparser/src/upnpxmlstringutility.cpp
upnpavcontrolpoint/avcontrolframework/BWINS/AVControlFrameworkU.DEF
upnpavcontrolpoint/avcontrolframework/EABI/AVControlFrameworkU.DEF
upnpavcontrolpoint/avcontrolframework/group/avcontrolframework.mmp
upnpavcontrolpoint/avcontrolframework/group/bld.inf
upnpavcontrolpoint/avcontrolframework/inc/upnpactionresponsehandler.h
upnpavcontrolpoint/avcontrolframework/inc/upnpavcpstring.h
upnpavcontrolpoint/avcontrolframework/inc/upnpavtactionfactory.h
upnpavcontrolpoint/avcontrolframework/inc/upnpcdsactionfactory.h
upnpavcontrolpoint/avcontrolframework/inc/upnpcmactionfactory.h
upnpavcontrolpoint/avcontrolframework/inc/upnpcustomlog.h
upnpavcontrolpoint/avcontrolframework/inc/upnprcactionfactory.h
upnpavcontrolpoint/avcontrolframework/inc/upnpstateupdatehandler.h
upnpavcontrolpoint/avcontrolframework/src/upnpactionresponsehandler.cpp
upnpavcontrolpoint/avcontrolframework/src/upnpavcontrolpoint.cpp
upnpavcontrolpoint/avcontrolframework/src/upnpavtactionfactory.cpp
upnpavcontrolpoint/avcontrolframework/src/upnpcdsactionfactory.cpp
upnpavcontrolpoint/avcontrolframework/src/upnpcmactionfactory.cpp
upnpavcontrolpoint/avcontrolframework/src/upnprcactionfactory.cpp
upnpavcontrolpoint/avcontrolframework/src/upnpstateupdatehandler.cpp
upnpavcontrolpoint/avcpengine/group/avcpengine.mmp
upnpavcontrolpoint/avcpengine/group/bld.inf
upnpavcontrolpoint/avcpengine/inc/upnpavcpengine.h
upnpavcontrolpoint/avcpengine/inc/upnpavcpengine.pan
upnpavcontrolpoint/avcpengine/inc/upnpavcpenginecommon.h
upnpavcontrolpoint/avcpengine/inc/upnpavcpenginecommon.inl
upnpavcontrolpoint/avcpengine/inc/upnpavcpenginehelper.h
upnpavcontrolpoint/avcpengine/inc/upnpavcpenginesession.h
upnpavcontrolpoint/avcpengine/inc/upnpavcpmanager.h
upnpavcontrolpoint/avcpengine/inc/upnpbrowsecommand.h
upnpavcontrolpoint/avcpengine/inc/upnpcommand.h
upnpavcontrolpoint/avcpengine/inc/upnpcreatecommand.h
upnpavcontrolpoint/avcpengine/inc/upnpdeletecommand.h
upnpavcontrolpoint/avcpengine/inc/upnpdevicelistcommand.h
upnpavcontrolpoint/avcpengine/inc/upnpdownloadcommand.h
upnpavcontrolpoint/avcpengine/inc/upnpmdebug.h
upnpavcontrolpoint/avcpengine/inc/upnpmetadatacommand.h
upnpavcontrolpoint/avcpengine/inc/upnpmydebug.h
upnpavcontrolpoint/avcpengine/inc/upnppathelement.h
upnpavcontrolpoint/avcpengine/inc/upnppathresolver.h
upnpavcontrolpoint/avcpengine/inc/upnpresolvehandler.h
upnpavcontrolpoint/avcpengine/inc/upnpresolverobserver.h
upnpavcontrolpoint/avcpengine/inc/upnpresponsehandler.h
upnpavcontrolpoint/avcpengine/inc/upnpuploadcommand.h
upnpavcontrolpoint/avcpengine/src/upnpavcpengine.cpp
upnpavcontrolpoint/avcpengine/src/upnpavcpenginehelper.cpp
upnpavcontrolpoint/avcpengine/src/upnpavcpenginesession.cpp
upnpavcontrolpoint/avcpengine/src/upnpavcpmanager.cpp
upnpavcontrolpoint/avcpengine/src/upnpbrowsecommand.cpp
upnpavcontrolpoint/avcpengine/src/upnpcommand.cpp
upnpavcontrolpoint/avcpengine/src/upnpcreatecommand.cpp
upnpavcontrolpoint/avcpengine/src/upnpdeletecommand.cpp
upnpavcontrolpoint/avcpengine/src/upnpdevicelistcommand.cpp
upnpavcontrolpoint/avcpengine/src/upnpdownloadcommand.cpp
upnpavcontrolpoint/avcpengine/src/upnpmetadatacommand.cpp
upnpavcontrolpoint/avcpengine/src/upnppathelement.cpp
upnpavcontrolpoint/avcpengine/src/upnppathresolver.cpp
upnpavcontrolpoint/avcpengine/src/upnpresolvehandler.cpp
upnpavcontrolpoint/avcpengine/src/upnpuploadcommand.cpp
upnpavcontrolpoint/avcpengineclient/BWINS/AVCPEngineClientU.DEF
upnpavcontrolpoint/avcpengineclient/EABI/AVCPEngineClientU.DEF
upnpavcontrolpoint/avcpengineclient/group/avcpengineclient.mmp
upnpavcontrolpoint/avcpengineclient/group/bld.inf
upnpavcontrolpoint/avcpengineclient/inc/upnpavcpengineclient.h
upnpavcontrolpoint/avcpengineclient/inc/upnpavcpenginemsclient.h
upnpavcontrolpoint/avcpengineclient/inc/upnpavcpenginerfsclient.h
upnpavcontrolpoint/avcpengineclient/inc/upnpmetadata.h
upnpavcontrolpoint/avcpengineclient/src/upnpavcpengineclient.cpp
upnpavcontrolpoint/avcpengineclient/src/upnpavcpenginemsclient.cpp
upnpavcontrolpoint/avcpengineclient/src/upnpavcpenginerfsclient.cpp
upnpavcontrolpoint/avcpengineclient/src/upnpmetadata.cpp
upnpavcontrolpoint/group/bld.inf
upnpavcontrolpoint/rom/upnpavcontrolpoint.iby
upnpavcontrolpoint/upnpaccessplugin/data/101F9779.rss
upnpavcontrolpoint/upnpaccessplugin/group/bld.inf
upnpavcontrolpoint/upnpaccessplugin/group/upnpaccessplugin.mmp
upnpavcontrolpoint/upnpaccessplugin/inc/upnpaccess.h
upnpavcontrolpoint/upnpaccessplugin/inc/upnpmydebug.h
upnpavcontrolpoint/upnpaccessplugin/src/upnpaccess.cpp
upnpframework/group/bld.inf
upnpframework/inc/upnpframeworkfeatures_mmp.hrh
upnpframework/inc/upnplog.h
upnpframework/inc/upnplogging.h
upnpframework/inc/upnppanic.h
upnpframework/install/20007564.cre
upnpframework/install/20009cae.cre
upnpframework/install/cenrep.pkg
upnpframework/install/homesynccenrep.pkg
upnpframework/install/make_upnpframework_sis.bat
upnpframework/install/make_upnpframework_stub_sis.bat
upnpframework/install/upnpframework.pkg
upnpframework/install/upnpframework_stub.pkg
upnpframework/install/upnpframework_stub.sis
upnpframework/install/upnpframework_udeb.pkg
upnpframework/loc/upnpframework.loc
upnpframework/rom/upnpframework.iby
upnpframework/rom/upnpframeworkresources.iby
upnpframework/upnpaiwengine/bwins/upnpaiwengineU.DEF
upnpframework/upnpaiwengine/data/upnpaiwengineresources.rss
upnpframework/upnpaiwengine/eabi/upnpaiwengineU.DEF
upnpframework/upnpaiwengine/group/bld.inf
upnpframework/upnpaiwengine/group/upnpaiwengine.mmp
upnpframework/upnpaiwengine/inc/upnpaiwengine.h
upnpframework/upnpaiwengine/inc/upnpaiwengine.rh
upnpframework/upnpaiwengine/inc/upnpaiwengineobserver.h
upnpframework/upnpaiwengine/inc/upnpaiwengineuids.hrh
upnpframework/upnpaiwengine/inc/upnpaiwtimer.h
upnpframework/upnpaiwengine/inc/upnpaiwtimerobserver.h
upnpframework/upnpaiwengine/inc/upnpdrmfilter.h
upnpframework/upnpaiwengine/src/upnpaiwengine.cpp
upnpframework/upnpaiwengine/src/upnpaiwtimer.cpp
upnpframework/upnpaiwengine/src/upnpdrmfilter.cpp
upnpframework/upnpaiwprovider/data/10208a15.rss
upnpframework/upnpaiwprovider/data/upnpaiwmenuresources.rss
upnpframework/upnpaiwprovider/group/bld.inf
upnpframework/upnpaiwprovider/group/upnpaiwprovider.mmp
upnpframework/upnpaiwprovider/inc/upnpaiwcopytoexternalservice.h
upnpframework/upnpaiwprovider/inc/upnpaiwenableexternalservice.h
upnpframework/upnpaiwprovider/inc/upnpaiwmovetoexternalservice.h
upnpframework/upnpaiwprovider/inc/upnpaiwopenexternalservice.h
upnpframework/upnpaiwprovider/inc/upnpaiwplayonexternalbaseservice.h
upnpframework/upnpaiwprovider/inc/upnpaiwplayonexternalmenuservice.h
upnpframework/upnpaiwprovider/inc/upnpaiwprovideruids.hrh
upnpframework/upnpaiwprovider/src/upnpaiwcopytoexternalservice.cpp
upnpframework/upnpaiwprovider/src/upnpaiwenableexternalservice.cpp
upnpframework/upnpaiwprovider/src/upnpaiwmovetoexternalservice.cpp
upnpframework/upnpaiwprovider/src/upnpaiwopenexternalservice.cpp
upnpframework/upnpaiwprovider/src/upnpaiwplayonexternalbaseservice.cpp
upnpframework/upnpaiwprovider/src/upnpaiwplayonexternalmenuservice.cpp
upnpframework/upnpaiwprovider/src/upnpaiwprovider.cpp
upnpframework/upnpcommand/bwins/upnpcommandu.def
upnpframework/upnpcommand/data/200075DB.rss
upnpframework/upnpcommand/data/upnpcommandresources.rss
upnpframework/upnpcommand/eabi/upnpcommandu.def
upnpframework/upnpcommand/group/bld.inf
upnpframework/upnpcommand/group/upnpcommand.mmp
upnpframework/upnpcommand/group/upnpcommandplugin.mmp
upnpframework/upnpcommand/inc/loadupnpcommand.h
upnpframework/upnpcommand/inc/upnpbrowsetask.h
upnpframework/upnpcommand/inc/upnpcommand.h
upnpframework/upnpcommand/inc/upnpcommand.rh
upnpframework/upnpcommand/inc/upnpcommandcallback.h
upnpframework/upnpcommand/inc/upnpcommandcallbackadapter.h
upnpframework/upnpcommand/inc/upnpcommandcons.h
upnpframework/upnpcommand/inc/upnpcommandimplementation.h
upnpframework/upnpcommand/inc/upnpcommandmain.h
upnpframework/upnpcommand/inc/upnpcommandparameters.h
upnpframework/upnpcommand/inc/upnpcommanduids.hrh
upnpframework/upnpcommand/inc/upnpcopytask.h
upnpframework/upnpcommand/inc/upnpfilepipe.h
upnpframework/upnpcommand/inc/upnpfiletransferbasetask.h
upnpframework/upnpcommand/inc/upnpimagerenderingengine.h
upnpframework/upnpcommand/inc/upnpimagerenderingengineobserver.h
upnpframework/upnpcommand/inc/upnpmovetask.h
upnpframework/upnpcommand/inc/upnpnotehandler.h
upnpframework/upnpcommand/inc/upnprunsetuptask.h
upnpframework/upnpcommand/inc/upnpshowtask.h
upnpframework/upnpcommand/inc/upnptask.h
upnpframework/upnpcommand/inc/upnptaskhandler.h
upnpframework/upnpcommand/inc/upnptaskresourceallocator.h
upnpframework/upnpcommand/src/upnpbrowsecommand.cpp
upnpframework/upnpcommand/src/upnpbrowsetask.cpp
upnpframework/upnpcommand/src/upnpcommandcallbackadapter.cpp
upnpframework/upnpcommand/src/upnpcommandimplementation.cpp
upnpframework/upnpcommand/src/upnpcommandmain.cpp
upnpframework/upnpcommand/src/upnpcommandparameters.cpp
upnpframework/upnpcommand/src/upnpcommandproxy.cpp
upnpframework/upnpcommand/src/upnpcopycommand.cpp
upnpframework/upnpcommand/src/upnpcopytask.cpp
upnpframework/upnpcommand/src/upnpfilepipe.cpp
upnpframework/upnpcommand/src/upnpfiletransferbasetask.cpp
upnpframework/upnpcommand/src/upnpimagerenderingengine.cpp
upnpframework/upnpcommand/src/upnpmovecommand.cpp
upnpframework/upnpcommand/src/upnpmovetask.cpp
upnpframework/upnpcommand/src/upnpnotehandler.cpp
upnpframework/upnpcommand/src/upnprunsetupcommand.cpp
upnpframework/upnpcommand/src/upnprunsetuptask.cpp
upnpframework/upnpcommand/src/upnpshowcommand.cpp
upnpframework/upnpcommand/src/upnpshowtask.cpp
upnpframework/upnpcommand/src/upnptask.cpp
upnpframework/upnpcommand/src/upnptaskresourceallocator.cpp
upnpframework/upnpcommonui/BWINS/upnpcommonuiu.def
upnpframework/upnpcommonui/EABI/upnpcommonuiu.def
upnpframework/upnpcommonui/bitmaps/qgn_graf_upnp_ext_renderer.svg
upnpframework/upnpcommonui/bitmaps/qgn_graf_upnp_ext_renderer_list_icon.svg
upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_1.svg
upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_2.svg
upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_3.svg
upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_4.svg
upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_5.svg
upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_6.svg
upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_7.svg
upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_8.svg
upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_9.svg
upnpframework/upnpcommonui/bitmaps/qgn_prop_folder_current.svg
upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_folder_locked_small.svg
upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_folder_small.svg
upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_music.svg
upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_other_images.svg
upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_other_videos.svg
upnpframework/upnpcommonui/bitmaps/qgn_server_icon.svg
upnpframework/upnpcommonui/data/upnpcommonui.rss
upnpframework/upnpcommonui/group/bld.inf
upnpframework/upnpcommonui/group/upnpcommonui.mmp
upnpframework/upnpcommonui/group/upnpcommonui_uid_.cpp
upnpframework/upnpcommonui/inc/upnpadvfinddialog.h
upnpframework/upnpcommonui/inc/upnpadvfindlist.h
upnpframework/upnpcommonui/inc/upnpadvfindresultwindow.h
upnpframework/upnpcommonui/inc/upnpbrowsecacheitem.h
upnpframework/upnpcommonui/inc/upnpbrowsedialog.h
upnpframework/upnpcommonui/inc/upnpcommonui.h
upnpframework/upnpcommonui/inc/upnpcommonui.hrh
upnpframework/upnpcommonui/inc/upnpdeviceobserver.h
upnpframework/upnpcommonui/inc/upnpexternaldevicedialog.h
upnpframework/upnpcommonui/inc/upnpimageplayer.h
upnpframework/upnpcommonui/inc/upnplocalplayer.h
upnpframework/upnpcommonui/inc/upnpnavipanecontainer.h
upnpframework/upnpcommonui/inc/upnpselectiondialog.h
upnpframework/upnpcommonui/inc/upnpvideoplayerdialog.h
upnpframework/upnpcommonui/src/upnpadvfinddialog.cpp
upnpframework/upnpcommonui/src/upnpadvfindlist.cpp
upnpframework/upnpcommonui/src/upnpadvfindresultwindow.cpp
upnpframework/upnpcommonui/src/upnpbrowsecacheitem.cpp
upnpframework/upnpcommonui/src/upnpbrowsedialog.cpp
upnpframework/upnpcommonui/src/upnpcommonui.cpp
upnpframework/upnpcommonui/src/upnpexternaldevicedialog.cpp
upnpframework/upnpcommonui/src/upnpimageplayer.cpp
upnpframework/upnpcommonui/src/upnplocalplayer.cpp
upnpframework/upnpcommonui/src/upnpnavipanecontainer.cpp
upnpframework/upnpcommonui/src/upnpselectiondialog.cpp
upnpframework/upnpcommonui/src/upnpvideoplayerdialog.cpp
upnpframework/upnpextensionpluginif/bwins/upnpextensionpluginifu.def
upnpframework/upnpextensionpluginif/eabi/upnpextensionpluginifu.def
upnpframework/upnpextensionpluginif/group/bld.inf
upnpframework/upnpextensionpluginif/group/upnpextensionpluginif.mmp
upnpframework/upnpextensionpluginif/inc/upnppluginloader.h
upnpframework/upnpextensionpluginif/inc/upnppluginloaderobserver.h
upnpframework/upnpextensionpluginif/src/upnppluginloader.cpp
upnpframework/upnpfiletransferengine/bwins/upnpfiletransferengineu.def
upnpframework/upnpfiletransferengine/data/upnpfiletransferengineresources.rss
upnpframework/upnpfiletransferengine/eabi/upnpfiletransferengineU.DEF
upnpframework/upnpfiletransferengine/group/bld.inf
upnpframework/upnpfiletransferengine/group/upnpfiletransferengine.mmp
upnpframework/upnpfiletransferengine/inc/upnpdownloadhandler.h
upnpframework/upnpfiletransferengine/inc/upnpfiletransferengine.h
upnpframework/upnpfiletransferengine/inc/upnpfiletransferengine.rh
upnpframework/upnpfiletransferengine/inc/upnpfiletransferengineuids.hrh
upnpframework/upnpfiletransferengine/inc/upnpfiletransferhandler.h
upnpframework/upnpfiletransferengine/inc/upnpnotehandler.h
upnpframework/upnpfiletransferengine/inc/upnpplaylisthandler.h
upnpframework/upnpfiletransferengine/inc/upnpprogressdialogobserver.h
upnpframework/upnpfiletransferengine/inc/upnpuploadhandler.h
upnpframework/upnpfiletransferengine/src/upnpdownloadhandler.cpp
upnpframework/upnpfiletransferengine/src/upnpfiletransferengine.cpp
upnpframework/upnpfiletransferengine/src/upnpfiletransferhandler.cpp
upnpframework/upnpfiletransferengine/src/upnpnotehandler.cpp
upnpframework/upnpfiletransferengine/src/upnpplaylisthandler.cpp
upnpframework/upnpfiletransferengine/src/upnpuploadhandler.cpp
upnpframework/upnpmusicadapter/BWINS/upnpmusicadapterU.DEF
upnpframework/upnpmusicadapter/EABI/upnpmusicadapterU.DEF
upnpframework/upnpmusicadapter/group/bld.inf
upnpframework/upnpmusicadapter/group/upnpmusicadapter.mmp
upnpframework/upnpmusicadapter/inc/upnpalbumservices.h
upnpframework/upnpmusicadapter/inc/upnpbrowseplaylistfiller.h
upnpframework/upnpmusicadapter/inc/upnpbrowsetimer.h
upnpframework/upnpmusicadapter/inc/upnplitecontainerfiller.h
upnpframework/upnpmusicadapter/inc/upnplitefiller.h
upnpframework/upnpmusicadapter/inc/upnpliteselectionfiller.h
upnpframework/upnpmusicadapter/inc/upnpmpxhelper.h
upnpframework/upnpmusicadapter/inc/upnpmusicadapter.h
upnpframework/upnpmusicadapter/inc/upnpplaylistfiller.h
upnpframework/upnpmusicadapter/inc/upnpplaylistservices.h
upnpframework/upnpmusicadapter/src/upnpalbumservices.cpp
upnpframework/upnpmusicadapter/src/upnpbrowseplaylistfiller.cpp
upnpframework/upnpmusicadapter/src/upnpbrowsetimer.cpp
upnpframework/upnpmusicadapter/src/upnplitecontainerfiller.cpp
upnpframework/upnpmusicadapter/src/upnplitefiller.cpp
upnpframework/upnpmusicadapter/src/upnpliteselectionfiller.cpp
upnpframework/upnpmusicadapter/src/upnpmpxhelper.cpp
upnpframework/upnpmusicadapter/src/upnpmusicadapter.cpp
upnpframework/upnpmusicadapter/src/upnpplaylistfiller.cpp
upnpframework/upnpmusicadapter/src/upnpplaylistservices.cpp
upnpframework/upnputilities/BWINS/upnputilitiesU.DEF
upnpframework/upnputilities/EABI/upnputilitiesU.DEF
upnpframework/upnputilities/group/bld.inf
upnpframework/upnputilities/group/upnputilities.mmp
upnpframework/upnputilities/inc/upnpcdsreselementutility.h
upnpframework/upnputilities/inc/upnpcommonutils.h
upnpframework/upnputilities/inc/upnpconnectionmonitor.h
upnpframework/upnputilities/inc/upnpconnectionmonitorobserver.h
upnpframework/upnputilities/inc/upnpfileutilitytypes.h
upnpframework/upnputilities/inc/upnpgallerynotifier.h
upnpframework/upnputilities/inc/upnpmetadatafetcher.h
upnpframework/upnputilities/inc/upnpmetadatautility.h
upnpframework/upnputilities/inc/upnpperiodic.h
upnpframework/upnputilities/src/upnpcdsreselementutility.cpp
upnpframework/upnputilities/src/upnpcommonutils.cpp
upnpframework/upnputilities/src/upnpconnectionmonitor.cpp
upnpframework/upnputilities/src/upnpgallerynotifier.cpp
upnpframework/upnputilities/src/upnpmetadatafetcher.cpp
upnpframework/upnputilities/src/upnpmetadatautility.cpp
upnpframework/upnputilities/src/upnpperiodic.cpp
upnpharvester/cdssync/cdssynclib/bwins/cdssyncu.def
upnpharvester/cdssync/cdssynclib/eabi/cdssyncu.def
upnpharvester/cdssync/cdssynclib/group/cdssync.mmp
upnpharvester/cdssync/cdssynclib/inc/cdssync.h
upnpharvester/cdssync/cdssynclib/inc/cdssyncimplsql.h
upnpharvester/cdssync/cdssynclib/inc/cdssyncsqlao.h
upnpharvester/cdssync/cdssynclib/src/cdssync.cpp
upnpharvester/cdssync/cdssynclib/src/cdssyncimplsql.cpp
upnpharvester/cdssync/cdssynclib/src/cdssyncsqlao.cpp
upnpharvester/cdssync/common/bld.inf
upnpharvester/common/cmlibrary/bwins/cmcommonu.def
upnpharvester/common/cmlibrary/eabi/cmcommonu.def
upnpharvester/common/cmlibrary/group/bld.inf
upnpharvester/common/cmlibrary/group/cmlibrary.mmp
upnpharvester/common/cmlibrary/inc/cmbaselistitem.h
upnpharvester/common/cmlibrary/inc/cmcommon.h
upnpharvester/common/cmlibrary/inc/cmcommontypes.h
upnpharvester/common/cmlibrary/inc/cmcommonutils.h
upnpharvester/common/cmlibrary/inc/cmdriveinfo.h
upnpharvester/common/cmlibrary/inc/cmfilllistitem.h
upnpharvester/common/cmlibrary/inc/cmfillrule.h
upnpharvester/common/cmlibrary/inc/cmfillrulecontainer.h
upnpharvester/common/cmlibrary/inc/cmmediaserver.h
upnpharvester/common/cmlibrary/inc/cmmediaserverfull.h
upnpharvester/common/cmlibrary/inc/cmparam.h
upnpharvester/common/cmlibrary/inc/cmrule.h
upnpharvester/common/cmlibrary/inc/cmsearchresponsehash.h
upnpharvester/common/cmlibrary/inc/cmserviceobserver.h
upnpharvester/common/cmlibrary/inc/cmsqlaudioitem.h
upnpharvester/common/cmlibrary/inc/cmsqlbaseitem.h
upnpharvester/common/cmlibrary/inc/cmsqlgenericitem.h
upnpharvester/common/cmlibrary/inc/cmsqlimageitem.h
upnpharvester/common/cmlibrary/inc/cmsqlitemresource.h
upnpharvester/common/cmlibrary/inc/cmsqlpropertycollector.h
upnpharvester/common/cmlibrary/inc/cmsqlpropertycontainer.h
upnpharvester/common/cmlibrary/inc/cmsqlpropertyitem.h
upnpharvester/common/cmlibrary/inc/cmsqlresolutionpropertyitem.h
upnpharvester/common/cmlibrary/inc/cmsqlvideoitem.h
upnpharvester/common/cmlibrary/inc/cmstorelistitem.h
upnpharvester/common/cmlibrary/inc/cmstorerule.h
upnpharvester/common/cmlibrary/inc/cmstorerulecontainer.h
upnpharvester/common/cmlibrary/src/cmbaselistitem.cpp
upnpharvester/common/cmlibrary/src/cmcommonutils.cpp
upnpharvester/common/cmlibrary/src/cmdriveinfo.cpp
upnpharvester/common/cmlibrary/src/cmfilllistitem.cpp
upnpharvester/common/cmlibrary/src/cmfillrule.cpp
upnpharvester/common/cmlibrary/src/cmfillrulecontainer.cpp
upnpharvester/common/cmlibrary/src/cmmediaserver.cpp
upnpharvester/common/cmlibrary/src/cmmediaserverfull.cpp
upnpharvester/common/cmlibrary/src/cmparam.cpp
upnpharvester/common/cmlibrary/src/cmrule.cpp
upnpharvester/common/cmlibrary/src/cmsearchresponsehash.cpp
upnpharvester/common/cmlibrary/src/cmsqlaudioitem.cpp
upnpharvester/common/cmlibrary/src/cmsqlbaseitem.cpp
upnpharvester/common/cmlibrary/src/cmsqlgenericitem.cpp
upnpharvester/common/cmlibrary/src/cmsqlimageitem.cpp
upnpharvester/common/cmlibrary/src/cmsqlitemresource.cpp
upnpharvester/common/cmlibrary/src/cmsqlpropertycollector.cpp
upnpharvester/common/cmlibrary/src/cmsqlpropertycontainer.cpp
upnpharvester/common/cmlibrary/src/cmsqlpropertyitem.cpp
upnpharvester/common/cmlibrary/src/cmsqlresolutionpropertyitem.cpp
upnpharvester/common/cmlibrary/src/cmsqlvideoitem.cpp
upnpharvester/common/cmlibrary/src/cmstorelistitem.cpp
upnpharvester/common/cmlibrary/src/cmstorerule.cpp
upnpharvester/common/cmlibrary/src/cmstorerulecontainer.cpp
upnpharvester/common/cmsettings/bwins/cmsettingsengineu.def
upnpharvester/common/cmsettings/data/10281FAB.txt
upnpharvester/common/cmsettings/data/keys_mediaservant.xls
upnpharvester/common/cmsettings/eabi/cmsettingsengineu.def
upnpharvester/common/cmsettings/group/bld.inf
upnpharvester/common/cmsettings/group/cmsettingsengine.mmp
upnpharvester/common/cmsettings/inc/cmsettings.h
upnpharvester/common/cmsettings/inc/cmsettingsengine.h
upnpharvester/common/cmsettings/inc/cmsettingsfactory.h
upnpharvester/common/cmsettings/inc/contentmanagercrkeys.h
upnpharvester/common/cmsettings/src/cmsettingsengine.cpp
upnpharvester/common/cmsettings/src/cmsettingsfactory.cpp
upnpharvester/common/cmsqlwrapper/bwins/cmsqlwrapperu.def
upnpharvester/common/cmsqlwrapper/eabi/cmsqlwrapperu.def
upnpharvester/common/cmsqlwrapper/group/bld.inf
upnpharvester/common/cmsqlwrapper/group/cmsqlwrapper.mmp
upnpharvester/common/cmsqlwrapper/inc/cmsqlclausedef.h
upnpharvester/common/cmsqlwrapper/inc/cmsqlconnection.h
upnpharvester/common/cmsqlwrapper/inc/cmsqldbclause.h
upnpharvester/common/cmsqlwrapper/inc/cmsqldbmaintenance.h
upnpharvester/common/cmsqlwrapper/inc/cmsqlmain.h
upnpharvester/common/cmsqlwrapper/inc/cmsqlmainfactory.h
upnpharvester/common/cmsqlwrapper/inc/cmsqlmaintenanceclauses.h
upnpharvester/common/cmsqlwrapper/inc/mcmsqlmain.h
upnpharvester/common/cmsqlwrapper/src/cmsqlconnection.cpp
upnpharvester/common/cmsqlwrapper/src/cmsqldbclause.cpp
upnpharvester/common/cmsqlwrapper/src/cmsqldbmaintenance.cpp
upnpharvester/common/cmsqlwrapper/src/cmsqlmain.cpp
upnpharvester/common/cmsqlwrapper/src/cmsqlmainfactory.cpp
upnpharvester/common/dbmanager/bwins/cmdatabasemanageru.def
upnpharvester/common/dbmanager/eabi/cmdatabasemanageru.def
upnpharvester/common/dbmanager/group/bld.inf
upnpharvester/common/dbmanager/group/cmdatabasemanager.mmp
upnpharvester/common/dbmanager/inc/cmdmmain.h
upnpharvester/common/dbmanager/inc/cmdmsqlclausedef.h
upnpharvester/common/dbmanager/inc/cmdmsqldbmaintenance.h
upnpharvester/common/dbmanager/inc/cmdmsqliteconnection.h
upnpharvester/common/dbmanager/inc/cmdmsqlmaintenanceclauses.h
upnpharvester/common/dbmanager/src/cmdmmain.cpp
upnpharvester/common/dbmanager/src/cmdmsqldbmaintenance.cpp
upnpharvester/common/dbmanager/src/cmdmsqliteconnection.cpp
upnpharvester/group/bld.inf
upnpharvester/install/10281fab.cre
upnpharvester/install/cenrep.SIS
upnpharvester/install/cenrep.pkg
upnpharvester/install/cenrep.sisx
upnpharvester/install/make_upnpharvester_sis.bat
upnpharvester/install/make_upnpharvester_stub_sis.bat
upnpharvester/install/upnpharvester.pkg
upnpharvester/install/upnpharvester_stub.SIS
upnpharvester/install/upnpharvester_stub.pkg
upnpharvester/mdhserver/bwins/cmmdhclientu.def
upnpharvester/mdhserver/eabi/cmmdhclientu.def
upnpharvester/mdhserver/group/bld.inf
upnpharvester/mdhserver/group/mdhclient.mmp
upnpharvester/mdhserver/group/mdhserver.mmp
upnpharvester/mdhserver/inc/client/mdhclient.h
upnpharvester/mdhserver/inc/client/mdhclientfactory.h
upnpharvester/mdhserver/inc/client/mdhclientsession.h
upnpharvester/mdhserver/inc/client/mmdhclient.h
upnpharvester/mdhserver/inc/mdhcommon.h
upnpharvester/mdhserver/inc/mdhuids.hrh
upnpharvester/mdhserver/inc/server/mdhavcpadapter.h
upnpharvester/mdhserver/inc/server/mdhconnectionmonitor.h
upnpharvester/mdhserver/inc/server/mdhconnectionmonitorobserver.h
upnpharvester/mdhserver/inc/server/mdhmediaservercontainer.h
upnpharvester/mdhserver/inc/server/mdhmetadatacollector.h
upnpharvester/mdhserver/inc/server/mdhserver.h
upnpharvester/mdhserver/inc/server/mdhserversession.h
upnpharvester/mdhserver/src/client/mdhclient.cpp
upnpharvester/mdhserver/src/client/mdhclientfactory.cpp
upnpharvester/mdhserver/src/client/mdhclientsession.cpp
upnpharvester/mdhserver/src/server/mdhavcpadapter.cpp
upnpharvester/mdhserver/src/server/mdhconnectionmonitor.cpp
upnpharvester/mdhserver/src/server/mdhmediaservercontainer.cpp
upnpharvester/mdhserver/src/server/mdhmetadatacollector.cpp
upnpharvester/mdhserver/src/server/mdhserver.cpp
upnpharvester/mdhserver/src/server/mdhservermain.cpp
upnpharvester/mdhserver/src/server/mdhserversession.cpp
upnpharvester/rom/upnpharvester.iby
upnpmediaserver/avobjects/bwins/upnpavobjectsU.DEF
upnpmediaserver/avobjects/eabi/upnpavobjectsU.DEF
upnpmediaserver/avobjects/group/avobjects.mmp
upnpmediaserver/avobjects/group/bld.inf
upnpmediaserver/avobjects/inc/upnpcustomlog.h
upnpmediaserver/avobjects/inc/upnpfiletransfereventlist.h
upnpmediaserver/avobjects/inc/upnpmediaservereventlist.h
upnpmediaserver/avobjects/inc/upnpprotocolinfolocal.h
upnpmediaserver/avobjects/src/upnpattribute.cpp
upnpmediaserver/avobjects/src/upnpbrowsecriteria.cpp
upnpmediaserver/avobjects/src/upnpcontainer.cpp
upnpmediaserver/avobjects/src/upnpcontainerlist.cpp
upnpmediaserver/avobjects/src/upnpdlnaprotocolinfo.cpp
upnpmediaserver/avobjects/src/upnpelement.cpp
upnpmediaserver/avobjects/src/upnpfiletransferevent.cpp
upnpmediaserver/avobjects/src/upnpfiletransfereventlist.cpp
upnpmediaserver/avobjects/src/upnpitem.cpp
upnpmediaserver/avobjects/src/upnpitemlist.cpp
upnpmediaserver/avobjects/src/upnpmediaserverevent.cpp
upnpmediaserver/avobjects/src/upnpmediaservereventlist.cpp
upnpmediaserver/avobjects/src/upnpobject.cpp
upnpmediaserver/avobjects/src/upnpobjectlist.cpp
upnpmediaserver/avobjects/src/upnpprotocolinfo.cpp
upnpmediaserver/avobjects/src/upnpprotocolinfolocal.cpp
upnpmediaserver/cenrep/keys_upnpmediaserver.xls
upnpmediaserver/conf/upnpmediaserver.confml
upnpmediaserver/conf/upnpmediaserver_101F978F.crml
upnpmediaserver/connectionmanagerservice/BWINS/AVConnectionManagerU.DEF
upnpmediaserver/connectionmanagerservice/EABI/AVConnectionManagerU.DEF
upnpmediaserver/connectionmanagerservice/group/bld.inf
upnpmediaserver/connectionmanagerservice/group/connectionmanagerservice.mmp
upnpmediaserver/connectionmanagerservice/inc/upnpcm.h
upnpmediaserver/connectionmanagerservice/src/upnpcm.cpp
upnpmediaserver/contentdirectoryservice/BWINS/AVContentDirectoryU.DEF
upnpmediaserver/contentdirectoryservice/EABI/AVContentDirectoryU.DEF
upnpmediaserver/contentdirectoryservice/group/bld.inf
upnpmediaserver/contentdirectoryservice/group/contentdirectoryservice.mmp
upnpmediaserver/contentdirectoryservice/inc/dlna/upnpdlnacorelation.h
upnpmediaserver/contentdirectoryservice/inc/dlna/upnpdlnafilter.h
upnpmediaserver/contentdirectoryservice/inc/dlna/upnpdlnafilterheaders.h
upnpmediaserver/contentdirectoryservice/inc/dlna/upnphttpfilereceivetransaction.h
upnpmediaserver/contentdirectoryservice/inc/dlna/upnphttpfileservetransaction.h
upnpmediaserver/contentdirectoryservice/inc/upnpattributebean.h
upnpmediaserver/contentdirectoryservice/inc/upnpattributebean.inl
upnpmediaserver/contentdirectoryservice/inc/upnpautodestroyobject.h
upnpmediaserver/contentdirectoryservice/inc/upnpautodestroyobjectlist.h
upnpmediaserver/contentdirectoryservice/inc/upnpcddbfactory.h
upnpmediaserver/contentdirectoryservice/inc/upnpcdsettings.h
upnpmediaserver/contentdirectoryservice/inc/upnpcdssender.h
upnpmediaserver/contentdirectoryservice/inc/upnpcdutils.h
upnpmediaserver/contentdirectoryservice/inc/upnpcontainerupdateid.h
upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectory.h
upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectorydatafinder.h
upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectorydb.h
upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectorydbdebug.h
upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectoryeventobserver.h
upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectoryglobals.h
upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectoryservice.h
upnpmediaserver/contentdirectoryservice/inc/upnpelementbean.h
upnpmediaserver/contentdirectoryservice/inc/upnpelementbean.inl
upnpmediaserver/contentdirectoryservice/inc/upnpelementfactory.h
upnpmediaserver/contentdirectoryservice/inc/upnperror.h
upnpmediaserver/contentdirectoryservice/inc/upnpfiletransfer.h
upnpmediaserver/contentdirectoryservice/inc/upnpfiletransfertimerobserver.h
upnpmediaserver/contentdirectoryservice/inc/upnpfilterelement.h
upnpmediaserver/contentdirectoryservice/inc/upnplocalstorage.h
upnpmediaserver/contentdirectoryservice/inc/upnpmap.h
upnpmediaserver/contentdirectoryservice/inc/upnpmapbase.h
upnpmediaserver/contentdirectoryservice/inc/upnpmapelement.h
upnpmediaserver/contentdirectoryservice/inc/upnpmetadatastorage.h
upnpmediaserver/contentdirectoryservice/inc/upnpmimemapper.h
upnpmediaserver/contentdirectoryservice/inc/upnpmspathutility.h
upnpmediaserver/contentdirectoryservice/inc/upnpobjectbean.h
upnpmediaserver/contentdirectoryservice/inc/upnpobjectbean.inl
upnpmediaserver/contentdirectoryservice/inc/upnpresourcesbean.h
upnpmediaserver/contentdirectoryservice/inc/upnpresourcesbean.inl
upnpmediaserver/contentdirectoryservice/inc/upnpsender.h
upnpmediaserver/contentdirectoryservice/inc/upnpstatehandler.h
upnpmediaserver/contentdirectoryservice/inc/upnptablebean.h
upnpmediaserver/contentdirectoryservice/inc/upnpthumbnailcreator.h
upnpmediaserver/contentdirectoryservice/inc/upnptransferbase.h
upnpmediaserver/contentdirectoryservice/inc/upnptransfercontroller.h
upnpmediaserver/contentdirectoryservice/inc/upnptransferdownloader.h
upnpmediaserver/contentdirectoryservice/inc/upnptransferhandler.h
upnpmediaserver/contentdirectoryservice/inc/upnptransferinterface.h
upnpmediaserver/contentdirectoryservice/inc/upnptransferobserver.h
upnpmediaserver/contentdirectoryservice/inc/upnptransferuploader.h
upnpmediaserver/contentdirectoryservice/inc/upnpxmlcontentfilter.h
upnpmediaserver/contentdirectoryservice/src/dlna/upnpdlnafilter.cpp
upnpmediaserver/contentdirectoryservice/src/dlna/upnpdlnafilterheaders.cpp
upnpmediaserver/contentdirectoryservice/src/dlna/upnphttpfilereceivetransaction.cpp
upnpmediaserver/contentdirectoryservice/src/dlna/upnphttpfileservetransaction.cpp
upnpmediaserver/contentdirectoryservice/src/upnpattributebean.cpp
upnpmediaserver/contentdirectoryservice/src/upnpautodestroyobject.cpp
upnpmediaserver/contentdirectoryservice/src/upnpautodestroyobjectlist.cpp
upnpmediaserver/contentdirectoryservice/src/upnpcddbfactory.cpp
upnpmediaserver/contentdirectoryservice/src/upnpcdutils.cpp
upnpmediaserver/contentdirectoryservice/src/upnpcontainerupdateid.cpp
upnpmediaserver/contentdirectoryservice/src/upnpcontentdirectory.cpp
upnpmediaserver/contentdirectoryservice/src/upnpcontentdirectorydb.cpp
upnpmediaserver/contentdirectoryservice/src/upnpcontentdirectoryservice.cpp
upnpmediaserver/contentdirectoryservice/src/upnpelementbean.cpp
upnpmediaserver/contentdirectoryservice/src/upnpelementfactory.cpp
upnpmediaserver/contentdirectoryservice/src/upnperror.cpp
upnpmediaserver/contentdirectoryservice/src/upnpfiletransfer.cpp
upnpmediaserver/contentdirectoryservice/src/upnpfiletransfertimerobserver.cpp
upnpmediaserver/contentdirectoryservice/src/upnpfilterelement.cpp
upnpmediaserver/contentdirectoryservice/src/upnplocalstorage.cpp
upnpmediaserver/contentdirectoryservice/src/upnpmapbase.cpp
upnpmediaserver/contentdirectoryservice/src/upnpmapelement.cpp
upnpmediaserver/contentdirectoryservice/src/upnpmetadatastorage.cpp
upnpmediaserver/contentdirectoryservice/src/upnpmimemapper.cpp
upnpmediaserver/contentdirectoryservice/src/upnpmspathutility.cpp
upnpmediaserver/contentdirectoryservice/src/upnpobjectbean.cpp
upnpmediaserver/contentdirectoryservice/src/upnpresourcesbean.cpp
upnpmediaserver/contentdirectoryservice/src/upnpsender.cpp
upnpmediaserver/contentdirectoryservice/src/upnpstatehandler.cpp
upnpmediaserver/contentdirectoryservice/src/upnptablebean.cpp
upnpmediaserver/contentdirectoryservice/src/upnpthumbnailcreator.cpp
upnpmediaserver/contentdirectoryservice/src/upnptransferbase.cpp
upnpmediaserver/contentdirectoryservice/src/upnptransfercontroller.cpp
upnpmediaserver/contentdirectoryservice/src/upnptransferdownloader.cpp
upnpmediaserver/contentdirectoryservice/src/upnptransferhandler.cpp
upnpmediaserver/contentdirectoryservice/src/upnptransferuploader.cpp
upnpmediaserver/contentdirectoryservice/src/upnpxmlcontentfilter.cpp
upnpmediaserver/group/bld.inf
upnpmediaserver/mediaserverclient/BWINS/AVMediaServerClientU.DEF
upnpmediaserver/mediaserverclient/EABI/AVMediaServerClientU.DEF
upnpmediaserver/mediaserverclient/data/2000f87f.cre
upnpmediaserver/mediaserverclient/data/backup_registration.xml
upnpmediaserver/mediaserverclient/group/bld.inf
upnpmediaserver/mediaserverclient/group/mediaserverclient.mmp
upnpmediaserver/mediaserverclient/inc/upnpfilesharingbody.h
upnpmediaserver/mediaserverclient/src/upnpfilesharing.cpp
upnpmediaserver/mediaserverclient/src/upnpfilesharingbody.cpp
upnpmediaserver/mediaserverclient/src/upnpmediaserverclient.cpp
upnpmediaserver/mediaserverclient/src/upnpmediaservernotifier.cpp
upnpmediaserver/mediaserverclient/src/upnpmediaserversettings.cpp
upnpmediaserver/mediaserverclient/src/upnpmediaserverstatuswatcher.cpp
upnpmediaserver/mediaserverclient/src/upnpsecuritymanager.cpp
upnpmediaserver/mediaserverengine/data/MediaServer1/ConnectionManager1.xml
upnpmediaserver/mediaserverengine/data/MediaServer1/ContentDirectory1.xml
upnpmediaserver/mediaserverengine/data/MediaServer1/MediaServer1.xml
upnpmediaserver/mediaserverengine/data/backup_registration.xml
upnpmediaserver/mediaserverengine/data/objects.xml
upnpmediaserver/mediaserverengine/group/bld.inf
upnpmediaserver/mediaserverengine/group/mediaserverengine.mmp
upnpmediaserver/mediaserverengine/inc/upnpdiskremovedetector.h
upnpmediaserver/mediaserverengine/inc/upnpiconmanager.h
upnpmediaserver/mediaserverengine/inc/upnpmediaserver.h
upnpmediaserver/mediaserverengine/inc/upnpmediaserver.pan
upnpmediaserver/mediaserverengine/inc/upnpmediaserverdescriptionprovider.h
upnpmediaserver/mediaserverengine/inc/upnpmediaservereventhandler.h
upnpmediaserver/mediaserverengine/inc/upnpmediaserverglobals.h
upnpmediaserver/mediaserverengine/inc/upnpmediaserversession.h
upnpmediaserver/mediaserverengine/src/upnpdiskremovedetector.cpp
upnpmediaserver/mediaserverengine/src/upnpiconmanager.cpp
upnpmediaserver/mediaserverengine/src/upnpmediaserver.cpp
upnpmediaserver/mediaserverengine/src/upnpmediaserverdescriptionprovider.cpp
upnpmediaserver/mediaserverengine/src/upnpmediaservereventhandler.cpp
upnpmediaserver/mediaserverengine/src/upnpmediaserversession.cpp
upnpmediaserver/rom/upnpmediaserver.iby
upnpmpxplugins/group/bld.inf
upnpmpxplugins/rom/upnpmpxplugins.iby
upnpmpxplugins/upnpplaybackplugins/group/bld.inf
upnpmpxplugins/upnpplaybackplugins/group/upnpplaybackplugins.mmp
upnpmpxplugins/upnpplaybackplugins/inc/upnpaudiopolicy.h
upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicdownloadproxy.h
upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicperiodizer.h
upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicplayer.h
upnpmpxplugins/upnpplaybackplugins/inc/upnpplaybackstatemachine.h
upnpmpxplugins/upnpplaybackplugins/inc/upnppluginserrortranslation.h
upnpmpxplugins/upnpplaybackplugins/inc/upnprendererselectorobserver.h
upnpmpxplugins/upnpplaybackplugins/inc/upnpsingleton.h
upnpmpxplugins/upnpplaybackplugins/inc/upnptrack.h
upnpmpxplugins/upnpplaybackplugins/inc/upnptrackobserver.h
upnpmpxplugins/upnpplaybackplugins/inc/upnpvaluestatemachine.h
upnpmpxplugins/upnpplaybackplugins/src/20007568.rss
upnpmpxplugins/upnpplaybackplugins/src/upnpaudiopolicy.cpp
upnpmpxplugins/upnpplaybackplugins/src/upnpmusicdownloadproxy.cpp
upnpmpxplugins/upnpplaybackplugins/src/upnpmusicperiodizer.cpp
upnpmpxplugins/upnpplaybackplugins/src/upnpmusicplayer.cpp
upnpmpxplugins/upnpplaybackplugins/src/upnpmusicpluginsproxy.cpp
upnpmpxplugins/upnpplaybackplugins/src/upnpplaybackstatemachine.cpp
upnpmpxplugins/upnpplaybackplugins/src/upnppluginserrortranslation.cpp
upnpmpxplugins/upnpplaybackplugins/src/upnpsingleton.cpp
upnpmpxplugins/upnpplaybackplugins/src/upnptrack.cpp
upnpmpxplugins/upnpplaybackplugins/src/upnpvaluestatemachine.cpp
upnpsettings/appwizard/BWINS/upnpappwizardU.DEF
upnpsettings/appwizard/EABI/upnpappwizardU.DEF
upnpsettings/appwizard/data/cupnpappwizard.rss
upnpsettings/appwizard/group/bld.inf
upnpsettings/appwizard/group/cupnpappwizard.mmp
upnpsettings/appwizard/inc/cupnpappwizard.h
upnpsettings/appwizard/src/cupnpappwizard.cpp
upnpsettings/group/bld.inf
upnpsettings/loc/upnpsettings.loc
upnpsettings/multiselectionui/BWINS/UPnPMultiselectionUiU.DEF
upnpsettings/multiselectionui/EABI/UPnPMultiselectionUiU.DEF
upnpsettings/multiselectionui/data/cupnpmultiselectionui.rss
upnpsettings/multiselectionui/group/bld.inf
upnpsettings/multiselectionui/group/cupnpmultiselectionui.mmp
upnpsettings/multiselectionui/inc/cupnpmultiselectionui.h
upnpsettings/multiselectionui/inc/cupnpmultiselectionui.hrh
upnpsettings/multiselectionui/inc/upnpappmultiselectiondialog.h
upnpsettings/multiselectionui/inc/upnpappmultiselectionpopup.h
upnpsettings/multiselectionui/inc/upnpmultiselectionutility.h
upnpsettings/multiselectionui/src/cupnpmultiselectionui.cpp
upnpsettings/multiselectionui/src/upnpappmultiselectiondialog.cpp
upnpsettings/multiselectionui/src/upnpappmultiselectionpopup.cpp
upnpsettings/multiselectionui/src/upnpmultiselectionutility.cpp
upnpsettings/rom/upnpsettings.iby
upnpsettings/rom/upnpsettingsresources.iby
upnpsettings/upnpgsplugin/bitmaps/qgn_menu_upnp_homemedia.svg
upnpsettings/upnpgsplugin/data/20009CAF.rss
upnpsettings/upnpgsplugin/data/upnpgspluginrsc.rss
upnpsettings/upnpgsplugin/group/bld.inf
upnpsettings/upnpgsplugin/group/upnpgsplugin.mmp
upnpsettings/upnpgsplugin/inc/upnpappsettingitemhomeiap.h
upnpsettings/upnpgsplugin/inc/upnpappsettingitemmydevicename.h
upnpsettings/upnpgsplugin/inc/upnpappsettingslist.h
upnpsettings/upnpgsplugin/inc/upnpgsplugin.hrh
upnpsettings/upnpgsplugin/inc/upnpgspluginview.h
upnpsettings/upnpgsplugin/inc/upnpsettingitemmemoryselection.h
upnpsettings/upnpgsplugin/src/upnpappsettingitemhomeiap.cpp
upnpsettings/upnpgsplugin/src/upnpappsettingitemmydevicename.cpp
upnpsettings/upnpgsplugin/src/upnpappsettingslist.cpp
upnpsettings/upnpgsplugin/src/upnpgspluginimplementationtable.cpp
upnpsettings/upnpgsplugin/src/upnpgspluginview.cpp
upnpsettings/upnpgsplugin/src/upnpsettingitemmemoryselection.cpp
upnpsettings/upnpsettingsengine/bwins/upnpsettingsengineu.def
upnpsettings/upnpsettingsengine/cenrep/20009CAE.txt
upnpsettings/upnpsettingsengine/cenrep/keys_upnpsettingsengine.xls
upnpsettings/upnpsettingsengine/conf/upnpsettingsengine.confml
upnpsettings/upnpsettingsengine/conf/upnpsettingsengine_20009CAE.crml
upnpsettings/upnpsettingsengine/eabi/upnpsettingsengineu.def
upnpsettings/upnpsettingsengine/group/backup_registration.xml
upnpsettings/upnpsettingsengine/group/bld.inf
upnpsettings/upnpsettingsengine/group/upnpsettingsengine.mmp
upnpsettings/upnpsettingsengine/inc/upnpapplicationcrkeys.h
upnpsettings/upnpsettingsengine/inc/upnpsettingsengine.h
upnpsettings/upnpsettingsengine/inc/upnpsettingsengine.hrh
upnpsettings/upnpsettingsengine/src/upnpsettingsengine.cpp
upnpsettings/upnpsharingui/BWINS/upnpsharinguiu.def
upnpsettings/upnpsharingui/EABI/upnpsharinguiu.def
upnpsettings/upnpsharingui/data/upnpsharingui.rss
upnpsettings/upnpsharingui/group/bld.inf
upnpsettings/upnpsharingui/group/upnpsharingui.mmp
upnpsettings/upnpsharingui/inc/upnpappfilesharingdialog.h
upnpsettings/upnpsharingui/inc/upnpappfilesharinglist.h
upnpsettings/upnpsharingui/inc/upnpsharingui.hrh
upnpsettings/upnpsharingui/src/upnpappfilesharingdialog.cpp
upnpsettings/upnpsharingui/src/upnpappfilesharinglist.cpp
upnpsharing/applicationengine/bwins/upnpapplicationengineU.DEF
upnpsharing/applicationengine/data/upnp_ms_jpeg_lrg.jpg
upnpsharing/applicationengine/data/upnp_ms_jpeg_sm.jpg
upnpsharing/applicationengine/data/upnp_ms_png_lrg.png
upnpsharing/applicationengine/data/upnp_ms_png_sm.png
upnpsharing/applicationengine/eabi/upnpapplicationengineU.DEF
upnpsharing/applicationengine/group/bld.inf
upnpsharing/applicationengine/group/upnpapplicationengine.mmp
upnpsharing/applicationengine/inc/upnpcontentrequestao.h
upnpsharing/applicationengine/inc/upnpcontentshareao.h
upnpsharing/applicationengine/inc/upnpfilesharingengine.h
upnpsharing/applicationengine/inc/upnpfilesharingengineao.h
upnpsharing/applicationengine/inc/upnpfilesharingengineobserver.h
upnpsharing/applicationengine/inc/upnpiconconfigurator.h
upnpsharing/applicationengine/inc/upnpprogresswatcher.h
upnpsharing/applicationengine/src/upnpcontentrequestao.cpp
upnpsharing/applicationengine/src/upnpcontentshareao.cpp
upnpsharing/applicationengine/src/upnpfilesharingengine.cpp
upnpsharing/applicationengine/src/upnpfilesharingengineao.cpp
upnpsharing/applicationengine/src/upnpiconconfigurator.cpp
upnpsharing/applicationengine/src/upnpprogresswatcher.cpp
upnpsharing/group/bld.inf
upnpsharing/loc/upnpsharing.loc
upnpsharing/rom/upnpsharing.iby
upnpsharing/rom/upnpsharingresources.iby
upnpsharing/upnpcontentserver/bwins/upnpcontentserverclientU.DEF
upnpsharing/upnpcontentserver/cenrep/20007564.txt
upnpsharing/upnpcontentserver/cenrep/keys_upnpcontentserver.xls
upnpsharing/upnpcontentserver/conf/upnpcontentserver.confml
upnpsharing/upnpcontentserver/conf/upnpcontentserver_20007564.crml
upnpsharing/upnpcontentserver/eabi/upnpcontentserverclientU.DEF
upnpsharing/upnpcontentserver/group/bld.inf
upnpsharing/upnpcontentserver/group/upnpcontentserver.mmp
upnpsharing/upnpcontentserver/group/upnpcontentserverclient.mmp
upnpsharing/upnpcontentserver/inc/upnpcontainercheckerao.h
upnpsharing/upnpcontentserver/inc/upnpcontentmetadatautility.h
upnpsharing/upnpcontentserver/inc/upnpcontentserver.h
upnpsharing/upnpcontentserver/inc/upnpcontentserverclient.h
upnpsharing/upnpcontentserver/inc/upnpcontentservercrkeys.h
upnpsharing/upnpcontentserver/inc/upnpcontentserverdefs.h
upnpsharing/upnpcontentserver/inc/upnpcontentserverhandler.h
upnpsharing/upnpcontentserver/inc/upnpcontentserversession.h
upnpsharing/upnpcontentserver/inc/upnpcontentsharingao.h
upnpsharing/upnpcontentserver/inc/upnpcontentsharingobserver.h
upnpsharing/upnpcontentserver/inc/upnpcustomgrouper.h
upnpsharing/upnpcontentserver/inc/upnpmetadataobserver.h
upnpsharing/upnpcontentserver/inc/upnppostfilter.h
upnpsharing/upnpcontentserver/inc/upnpselectionreader.h
upnpsharing/upnpcontentserver/inc/upnpselectionwriter.h
upnpsharing/upnpcontentserver/inc/upnpsharingcallback.h
upnpsharing/upnpcontentserver/inc/upnpsharingrequest.h
upnpsharing/upnpcontentserver/inc/upnpunsharerao.h
upnpsharing/upnpcontentserver/src/upnpcontainercheckerao.cpp
upnpsharing/upnpcontentserver/src/upnpcontentmetadatautility.cpp
upnpsharing/upnpcontentserver/src/upnpcontentserver.cpp
upnpsharing/upnpcontentserver/src/upnpcontentserverclient.cpp
upnpsharing/upnpcontentserver/src/upnpcontentserverhandler.cpp
upnpsharing/upnpcontentserver/src/upnpcontentserversession.cpp
upnpsharing/upnpcontentserver/src/upnpcontentsharingao.cpp
upnpsharing/upnpcontentserver/src/upnpcustomgrouper.cpp
upnpsharing/upnpcontentserver/src/upnppostfilter.cpp
upnpsharing/upnpcontentserver/src/upnpselectionreader.cpp
upnpsharing/upnpcontentserver/src/upnpselectionwriter.cpp
upnpsharing/upnpcontentserver/src/upnpsharingrequest.cpp
upnpsharing/upnpcontentserver/src/upnpunsharerao.cpp
upnpsharing/upnpdlnaprofiler/bwins/dlnaprofilerU.DEF
upnpsharing/upnpdlnaprofiler/eabi/dlnaprofilerU.DEF
upnpsharing/upnpdlnaprofiler/group/bld.inf
upnpsharing/upnpdlnaprofiler/group/dlnaprofiler.mmp
upnpsharing/upnpdlnaprofiler/inc/upnpaudiosolverbase.h
upnpsharing/upnpdlnaprofiler/inc/upnpavsolverbase.h
upnpsharing/upnpdlnaprofiler/inc/upnpdlnaprofiler.h
upnpsharing/upnpdlnaprofiler/inc/upnpimagesolverbase.h
upnpsharing/upnpdlnaprofiler/inc/upnpprofiler.h
upnpsharing/upnpdlnaprofiler/inc/upnpresparameters.h
upnpsharing/upnpdlnaprofiler/inc/upnpresresolver.h
upnpsharing/upnpdlnaprofiler/src/upnpaudiosolverbase.cpp
upnpsharing/upnpdlnaprofiler/src/upnpavsolverbase.cpp
upnpsharing/upnpdlnaprofiler/src/upnpdlnaprofiler.cpp
upnpsharing/upnpdlnaprofiler/src/upnpimagesolverbase.cpp
upnpsharing/upnpdlnaprofiler/src/upnpresparameters.cpp
upnpsharing/upnpdlnaprofiler/src/upnpresresolver.cpp
upnpsharing/upnpsecurity/bwins/upnpsecurityU.DEF
upnpsharing/upnpsecurity/bwins/upnpsecuritymanagerclientu.def
upnpsharing/upnpsecurity/data/101F977E.rss
upnpsharing/upnpsecurity/data/upnpnotifier.rss
upnpsharing/upnpsecurity/eabi/upnpsecurityU.DEF
upnpsharing/upnpsecurity/eabi/upnpsecuritymanagerclientu.def
upnpsharing/upnpsecurity/group/bld.inf
upnpsharing/upnpsecurity/group/upnpsecurity.mmp
upnpsharing/upnpsecurity/group/upnpsecuritymanagerclient.mmp
upnpsharing/upnpsecurity/group/upnpsecuritymanagerplugin.mmp
upnpsharing/upnpsecurity/group/upnpsecuritymanagerserver.mmp
upnpsharing/upnpsecurity/group/upnpsecurityuids.h
upnpsharing/upnpsecurity/inc/client/upnpsecuritymanagerclientsession.h
upnpsharing/upnpsecurity/inc/server/upnpauthorizationnote.h
upnpsharing/upnpsecurity/inc/server/upnpsecuritydbconnection.h
upnpsharing/upnpsecurity/inc/server/upnpsecuritymanagerengine.h
upnpsharing/upnpsecurity/inc/server/upnpsecuritymanagerserver.h
upnpsharing/upnpsecurity/inc/server/upnpsecuritymanagersession.h
upnpsharing/upnpsecurity/inc/server/upnpsecuritysqlclausedef.h
upnpsharing/upnpsecurity/inc/upnpsecaccesscontroller.h
upnpsharing/upnpsecurity/inc/upnpsecuritymanagerclientservercommon.h
upnpsharing/upnpsecurity/inc/upnpsecuritymanagerplugin.h
upnpsharing/upnpsecurity/src/client/upnpsecuritymanagerclientsession.cpp
upnpsharing/upnpsecurity/src/server/upnpauthorizationnote.cpp
upnpsharing/upnpsecurity/src/server/upnpsecuritydbconnection.cpp
upnpsharing/upnpsecurity/src/server/upnpsecuritymanagerengine.cpp
upnpsharing/upnpsecurity/src/server/upnpsecuritymanagerserver.cpp
upnpsharing/upnpsecurity/src/server/upnpsecuritymanagersession.cpp
upnpsharing/upnpsecurity/src/upnpsecaccesscontroller.cpp
upnpsharing/upnpsecurity/src/upnpsecuritymanagerplugin.cpp
upnpsharing/upnpsecurity/src/upnpsecuritymanagerpluginproxy.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "../upnp_media_server_settings_api/group/bld.inf"
+
+#include "../upnp_av_objects_api/group/bld.inf"
+#include "../upnp_media_server_api/group/bld.inf"
+#include "../upnp_security_plugin_api/group/bld.inf"
+#include "../upnp_avcp_api/group/bld.inf"
+#
+#include "../upnp_media_server_metadata_api/group/bld.inf"
+
+#include "../upnp_command_api/group/bld.inf"
+#include "../upnp_plugin_api/group/bld.inf"
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,40 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                UPnP AV Objects API
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/upnpobject.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpobject.h)
+../inc/upnpattribute.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpattribute.h)
+../inc/upnpbrowsecriteria.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpbrowsecriteria.h)
+../inc/upnpcontainer.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpcontainer.h)
+../inc/upnpobjectlist.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpobjectlist.h)
+../inc/upnpelement.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpelement.h)
+../inc/upnpcontainerlist.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpcontainerlist.h)
+../inc/upnpitem.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpitem.h)
+../inc/upnpfiletransferevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpfiletransferevent.h)
+../inc/upnpmediaserverevent.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpmediaserverevent.h)
+../inc/upnpitemlist.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpitemlist.h)
+../inc/upnpdlnaprotocolinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpdlnaprotocolinfo.h)
+../inc/upnpdlnaprotocolinfocons.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpdlnaprotocolinfocons.h)
+../inc/upnpprotocolinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpprotocolinfo.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpattribute.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,137 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Upnp Attribute information
+*
+*/
+
+
+#ifndef UPNPATTRIBUTE_H
+#define UPNPATTRIBUTE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpelement.h"
+
+const TInt KMaxUpnpObjLongStringLen = 1024;
+const TInt KMaxUpnpObjStringLen = 256;
+
+/**
+*  UPnP CUpnpAttribute header
+*
+*  @lib upnpavobjects.lib
+*  @since Series 60 3.0
+*/
+class CUpnpAttribute : public CBase
+    {
+    public:
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUpnpAttribute* NewLC(const TDesC8& aName = KNullDesC8());
+        IMPORT_C static CUpnpAttribute* NewL(const TDesC8& aName = KNullDesC8());
+          
+        /**
+        * C++ default constructor.
+        */
+        virtual ~CUpnpAttribute();
+        
+        /**
+        * Externalizes attribute information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RWriteStream
+        * @return none
+        */
+      
+        
+  public: //New functions      
+        /**
+        * Sets name for the UPnP attribute. 
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param TDesC8 reference for name
+        * @return none
+        */
+        IMPORT_C void SetNameL( const TDesC8& aName);
+        
+        /**
+        * Gets name for the UPnP attribute
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for parent ID
+        */
+        IMPORT_C const TDesC8& Name() const;
+        
+        /**
+        * Sets scope for the UPnP attribute. 
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param TDesC8 reference for name
+        * @return none
+        */
+        IMPORT_C void SetValueL( const TDesC8& aValue );
+        
+        /**
+        * Gets name for the UPnP attribute
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for parent ID
+        */
+        IMPORT_C const TDesC8& Value() const;
+        
+        
+        void ExternalizeL( RWriteStream& aStream ) const;
+        
+        /**
+        * Internalizes attribute information from stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        void InternalizeL( RReadStream& aStream );
+				
+    private:
+       /**
+        * C++ default constructor.
+        */
+        CUpnpAttribute();        
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(const TDesC8& aName);
+
+		/**
+        * Safely externalizes attribute information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        void SafeExternalizeL(RWriteStream& aStream, const TDesC8& aDesc, const TInt aNumber) const;		
+		TInt MapItemNameToProperLength(TDesC8& aItemName) const;
+
+    private:
+        // Parameters
+        HBufC8*     iName;
+        HBufC8*     iValue;
+    };
+
+
+#endif      // UPNPATTRIBUTE_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpbrowsecriteria.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,167 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP BrowseCriteria information
+*
+*/
+
+
+
+#ifndef UPNPBROWSECRITERIA_H
+#define UPNPBROWSECRITERIA_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+
+// CONSTANTS
+
+// MACROS
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+/**
+*  UpnpBrowseCriteria interface
+*
+*  @lib upnpavobjects.lib
+*  @since Series 60 3.0
+*/
+class CUpnpBrowseCriteria : public CBase
+    {
+    public:  // Constructors and destructor
+    
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUpnpBrowseCriteria* NewLC(const TDesC8& aFilter = KNullDesC8());
+        IMPORT_C static CUpnpBrowseCriteria* NewL(const TDesC8& aFilter = KNullDesC8());
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpBrowseCriteria();
+
+    public: // New functions
+        
+       /**
+        * Sets filter. 
+        * @since Series 60 3.0
+        * @param TDesC8 reference for filter
+        * @return none
+        */
+        IMPORT_C void SetFilterL( const TDesC8& aFilter );
+        
+        /**
+        * Gets filter
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for filter
+        */
+        IMPORT_C const TDesC8& Filter() const;
+        
+         /**
+        * Sets request count. 
+        * @since Series 60 3.0
+        * @param TInt reference for requested count
+        * @return none
+        */
+        IMPORT_C void SetRequestedCount( TInt aRequestedCount );
+        
+        /**
+        * Gets request count
+        * @since Series 60 3.0
+        * @param none
+        * @return TInt reference for requested count
+        */
+        IMPORT_C TInt RequestedCount() const;
+          
+        /**
+        * Sets starting index. 
+        * @since Series 60 3.0
+        * @param TInt reference for starting index
+        * @return none
+        */
+        IMPORT_C void SetStartingIndex( TInt aStartingIndex );
+        
+        /**
+        * Gets starting index
+        * @since Series 60 3.0
+        * @param none
+        * @return TInt reference for starting index
+        */
+        IMPORT_C TInt StartingIndex() const;		
+	
+        /**
+        * Externalizes element information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RWriteStream
+        * @return none
+        */
+        
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+        
+        /**
+        * Internalizes element information from stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        IMPORT_C void InternalizeL( RReadStream& aStream );
+        
+        /**
+        * Copies contents from CUpnpElement given as parameter to this object.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param aObject const reference to source information
+        * @return none
+        */
+        IMPORT_C void CopyL( const CUpnpBrowseCriteria& aBrowseCriteria );
+        IMPORT_C HBufC8* ToDes8L() const;
+
+    private:
+       /**
+        * C++ default constructor.
+        */
+        CUpnpBrowseCriteria();        
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(const TDesC8& aName);
+
+
+    private:
+       
+        //Requested Count
+        TInt    iRequestedCount;
+
+        //filter
+        HBufC8*     iFilter;
+
+        // Starting index
+        TInt        iStartingIndex;       
+        
+    };
+
+#endif      // UPNPBROWSECRITERIA_H  
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpcontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,152 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Container information
+*
+*/
+
+
+#ifndef UPNPCONTAINER_H
+#define UPNPCONTAINER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpobject.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUpnpObjectList;
+
+// CLASS DECLARATION
+
+/**
+*  UPnPContainer interface
+*
+*  @lib upnpavobjects.lib
+*  @since Series 60 3.0
+*/
+class CUpnpContainer : public CUpnpObject
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUpnpContainer* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpContainer();
+
+    public: // New functions
+        
+        IMPORT_C CUpnpObject* operator[](TInt aIndex);
+        
+        /**
+        * Appends new object to hierarchy
+        * @since Series 60 3.0
+        * @param none
+        * @return TUPnPObjectType information of the type
+        */
+        IMPORT_C void AppendObjectL( CUpnpObject& aNewObject );
+        
+        /**
+        * Removes object from the hierarchy if found.
+        * @since Series 60 3.0
+        * @param none
+        * @return TUPnPObjectType information of the type
+        */
+        IMPORT_C void RemoveObjectL( const TDesC8& aObjectId );
+
+        /**
+        * Searches object from the object hierarchy
+        * @since Series 60 3.0
+        * @param CUpnpObject pointer to the object found
+        * @param TDesC8 referenco to Object ID which is searched
+        * @return TBool indicating the status of the find
+        */
+        IMPORT_C CUpnpObject* FindObject( const TDesC8& aObjectId );
+        
+        /**
+        * Returns childcount of the container (including sub-containers)
+        * @since Series 60 3.0
+        * @return TInt count information
+        */
+        IMPORT_C TInt ObjectCount();
+        
+        
+    public: // Functions from CUpnpObject
+
+		/**
+        * Returns type of the object (= container)
+        * @since Series 60 3.0
+        * @param none
+        * @return TUPnPObjectType information of the type
+        */
+        TUPnPObjectType ObjectType() const;
+
+        /**
+        * Externalizes container information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RWriteStream
+        * @return none
+        */
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+        
+        /**
+        * Internalizes container information from stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        IMPORT_C void InternalizeL( RReadStream& aStream );
+        
+      
+        
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CUpnpContainer( );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+
+    private:
+        
+        // Child object array.        
+        CUpnpObjectList*     iObjects;
+
+
+    };
+
+#endif      // UPNPCONTAINER_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpcontainerlist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,81 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Item information class
+*
+*/
+
+
+#ifndef UPNPCONTAINERLIST_H
+#define UPNPCONTAINERLIST_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpobject.h"
+#include "upnpitem.h"
+#include "upnpobjectlist.h"
+
+// CLASS DECLARATION
+/**
+*  UPnPItemList class
+*
+*  @lib upnpavobjects.lib
+*  @since Series 60 3.0
+*/
+class CUpnpContainerList : public CUpnpObjectList
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUpnpContainerList* NewL();
+        IMPORT_C static CUpnpContainerList* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpContainerList();
+
+    public: // Functions from base classes 
+
+        /**
+        * Appends new object to hierarchy.
+        * This function verifies if the given object is of CUpnpContainer type 
+        * and leaves with KErrArgument if not.
+        *
+        * @since Series 60 3.0
+        * @param aNewObject an object to be added to the list.
+        *           NOTE: The object must be of CUpnpContainer type.
+        */
+        IMPORT_C void AppendObjectL( CUpnpObject& aNewObject );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CUpnpContainerList();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+
+        
+    };
+
+#endif      // UPNPCONTAINERLIST_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpdlnaprotocolinfo.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,398 @@
+/** @file
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ProtocolInfo DLNA functionality class 
+*
+*/
+
+
+#ifndef C_CUPNPDLNAPROTOCOLINFO_H
+#define C_CUPNPDLNAPROTOCOLINFO_H
+
+#include <e32base.h>
+#include "upnpdlnaprotocolinfocons.h"
+#include "upnpprotocolinfo.h"
+
+/**
+* UpnpDlnaProtocolInfo class.
+*  
+*  
+*
+*  @lib upnpavobjects.lib
+*  @since S60 3.1
+*/
+class CUpnpDlnaProtocolInfo : public CUpnpProtocolInfo 
+{                          
+//PUBLIC MEMBERS:
+public: 
+
+
+    /**
+    * Factory method for creating instance of the class. 
+    * aInputString must contain protocolInfo string. 
+    */
+    IMPORT_C static CUpnpDlnaProtocolInfo* NewL();
+    
+    /**
+    * Factory method for creating instance of the class. 
+    * aInputString must contain protocolInfo string. 
+    */
+    IMPORT_C static CUpnpDlnaProtocolInfo* NewL(const TDesC8& aInputString);
+
+    /**
+    * Destructor of the class. 
+    */
+    virtual ~CUpnpDlnaProtocolInfo();    
+                        
+// PUBLIC ACCESSED METHODS - EXPORTED INTERFACE
+public: // 4th_field methods
+
+   
+     /*
+     * 4th_field = pn-param [op-param] [ps-param] [ci-param] [flags-param] [ *(other-param)]
+     */        
+     IMPORT_C virtual TPtrC8 FourthField();
+
+     
+public: //pn-param methods
+
+     /**
+     * Setter for DLNA.ORG_PN
+     */
+     IMPORT_C void SetPnParameterL( const TDesC8& aValue ); 
+     
+     /**
+     * Getter for DLNA.ORG_PN
+     * pn-param= "DLNA.ORG_PN=" pn-value, where pn-value= *<'a'-'z', 'A'-'Z', '0'-'9', '_'>
+     */
+     IMPORT_C TPtrC8 PnParameter(); 
+
+
+public: //op-param methods
+
+     /**
+     * Setter for DLNA.ORG_OP
+     */
+     IMPORT_C void SetOpParameterL( const TDesC8& aValue );
+     
+     /**
+     * Setter for DLNA.ORG_OP
+     */
+     IMPORT_C void SetOpParameterL( UpnpDlnaProtocolInfo::TDlnaParams param, TBool aValue );
+     
+     /**
+     * Getter for DLNA.ORG_OP
+     * op-param = [op-param-delim] "DLNA.ORG_OP=" op-value
+     * op-param-delim = ';'
+     *           op-value = a-val b-val
+     *           a-val = Boolean b-val = Boolean, Boolean = '1' | '0'
+     */
+     IMPORT_C TPtrC8 OpParameterL();
+     
+     
+     IMPORT_C TBool OpParameter( UpnpDlnaProtocolInfo::TDlnaParams param );
+
+
+public: //ps-param methods
+
+     /**
+     * Setter for DLNA.ORG_PS 
+     */
+     IMPORT_C void SetPsParameterL(const TDesC8& aValue);
+
+     /**
+     * Getter for DLNA.ORG_PS 
+     * [ps-param-delim] "DLNA.ORG_PS=" ps-value
+     * ps-param-delim = ';', ps-value = [server-speed *(',' server-speed)]
+     * server-speed = 
+     * <conforms to the TransportPlaySpeed string, as specified in the AVTransport specification>
+     */
+     IMPORT_C TPtrC8 PsParameter(); 
+
+public: //ci-param methods
+
+     /**
+     * Setter for DLNA.ORG_CI
+     */
+     IMPORT_C void SetCiParameter( TBool aValue );
+
+     /**
+     * Getter for DLNA.ORG_CI
+     * [ci-param-delim] "DLNA.ORG_CI=" ci-value
+     *  ci-param-delim = ';' ci-value = Boolean Boolean = '0' | '1'
+     */
+     IMPORT_C TBool CiParameter();
+
+                                                  
+public: //flags-param methods
+     
+
+     //ACCESS METHODS FOR ALL FLAGS AND PARAMETRES                
+     /**
+     * Setter for a single flag.
+     */
+     IMPORT_C void SetDlnaFlag( UpnpDlnaProtocolInfo::TDlnaFlags flag, TBool aValue );
+     /**
+     * Getter for a single flag.
+     */
+     IMPORT_C TBool DlnaFlag( UpnpDlnaProtocolInfo::TDlnaFlags flag );
+                                                                             
+     /**
+     * setter for DLNA.ORG_FLAGS 
+     */
+     IMPORT_C void SetFlagsParameterL( const TDesC8& flags );                  
+     
+     /**
+     * getter for DLNA.ORG_FLAGS 
+     * "DLNA.ORG_FLAGS=" flags-value
+     *  flags-value = primary-flags reserved-data 
+     *     primary-flags = 8 hexdigit
+     *     reserved-data = 24 reserved-hexdigit
+     *     hexdigit = <hexadecimal digit: '0' - '9', 'A' - 'F', 'a' - 'f'>, 
+     *     reserved-hexdigit = '0'
+     */
+     IMPORT_C TPtrC8 FlagsParameterL();                  
+     
+     
+public: //other-param methods
+     
+     /**
+     * Setter for other parameter.
+     * Refer
+     */
+     IMPORT_C void SetOtherParamL(const TDesC8& aValue);
+
+     /**
+     * Getter for other parameter value.
+     * other-param = [other-param-delim] IANA-name '_' other-param-name '=' other-param-value
+     * other-param-delim = ';'
+     * IANA-name = <IANA-registered name, with top level domain (e.g. .net, .org, .com)>
+     * other-param-name = *<'a'-'z', 'A'-'Z', '0'-'9'>
+     */
+     IMPORT_C TPtrC8 GetOtherParams();
+     
+                                
+protected: //Base construct
+
+     /** 
+     * Constructor of the class          
+     */
+     CUpnpDlnaProtocolInfo();
+
+      /**
+     * Method for creating instance of class. 
+     * aInputString must contain protocolInfo string. 
+     */
+     void ConstructL(const TDesC8& aInputString);
+    
+protected: 
+
+     /**
+     * Setter for DLNA.ORG_OP time seek parameter.
+     */
+     void SetOpTimeParam(TBool aValue);
+     
+     /**
+     * Setter for DLNA.ORG_OP range seek parameter.
+     */
+     void SetOpRangeParam(TBool aValue);
+     
+     /**
+     * Setter for DLNA_FLAGS 
+     */
+     void SetDlnaFlag(TBool aValue, TUint8 aFlagIndex); 
+     
+     /**
+     * This function produces a string containing all info taken from fourth ProtocolInfo field         
+     * aBuffer - on this variable values are appended. 
+     */
+     virtual void GetFourthParameterInternalL(TDes8& aBuffer); 
+
+public:          
+     /**
+     * Getter for DLNA.ORG_OP time seek parameter.
+     */
+     TBool GetDlnaOpTimeParam(); 
+                            
+     /**
+     * Getter for DLNA.ORG_OP range seek parameter
+     */
+     TBool GetDlnaOpRangeParam(); 
+     
+
+//MEMBER METHODS - USED INTERNALLY
+private:     
+              
+     /**
+     * Getter for DLNA_FLAGS 
+     */
+     TBool GetDlnaFlag(TInt aFlagIndex); 
+                     
+     /**
+     * Parses aInputString into protocolInfo object.  
+     * aInputString- descriptor with protocolInfo
+     * Returns     KErrNone when everything ok.
+     *             KErrArgument when there was additionalInfo string empty.
+     */
+     virtual TInt ParseL(const TDesC8& aInputString);
+                               
+     /**
+     * Parses the fourth parameter.
+     * Returns     KErrNone when everything is ok.
+     *             KErrArgument when additionalInfo string is empty.
+     */
+     TInt ParseForthParameterL();
+
+     /**
+     * Parses DLNA.ORG_PN params.
+     */        
+     void ParseDlnaPnParamL(TLex8& aLexer);     
+     
+     /**
+     * Parses DLNA.ORG_OP params.
+     */         
+     void ParseDlnaOpParamL(TLex8& aLexer);
+     
+     /**         
+     * Parses DLNA.ORG_PS params.
+     */
+     void ParseDlnaPsParamL(TLex8& aLexer);                  
+              
+     /**
+     * Parses DLNA.ORG_CI params.
+     */
+     void ParseDlnaCiParamL(TLex8& aLexer);
+     
+     /**
+     * Parses DLNA.ORG_FLAGS params.
+     */
+     void ParseDlnaFlagsParamL(TLex8& aLexer);
+     
+     /**
+     * Parses other params.
+     */
+     void ParseOtherParamsL(TLex8& aLexer);
+     
+     /**
+     * Parses the fourth parameter
+     * Returns: ETrue - When the last parameter has been parsed. 
+     *             EFalse - In other situations.
+     */
+     TBool ParseForthParameterInternalL( const TDesC8& aName, TLex8& aLexer);
+     
+     /**
+     * Setter for DLNA_FLAGS 
+     * Sets in aParameter, aValue at aBitNumber counting from right.
+     */
+     void SetIntBit8(TUint8& aParameter, TBool aValue, TUint8 aBitNumber);
+
+     /**
+     * Setter for DLNA_FLAGS 
+     * Sets aValue on position specified by aBitNumber in aParameter byte.         
+     */
+     void SetIntBit32(TUint32& aParameter, TBool aValue, TUint8 aBitNumber);
+
+     /**
+     * Setter for Internal variable. 
+     * Sets aValue on position specified by aBitNumber in iParams byte.         
+     */
+     void SetDlnaParam(TBool aValue, TUint8 aParamIndex);
+     
+     /**
+     * Getter for Internal variable. 
+     * Gets a bit from iParams byte, from aParamIndex position.         
+     */
+     TBool GetDlnaParam(TInt aParamIndex);  
+protected:
+     /**
+     * This function returns ETrue if at least one dlna flag is set.         
+     */ 
+     TBool IsDlnaFlagsSet(); 
+public:                                                  
+   
+     /**
+     * This function returns length of the string containing all relevant information from fourth ProtocolInfo field. 
+     * Returns - length of the string for 4th field.
+     */
+     virtual TInt GetFourthParameterLength(); 
+     
+     /**
+     * This member function serializes iDlnaFlags member variable into a string. 
+     * aBuffer - variable to which iDlnaFlags will be appended.
+     */
+     void SerializeDlnaFlagsL(TDes8& aBuffer); 
+     
+     void FourthParameterInternalL();
+     
+                                                                                  
+//MEMBER VARIABLES
+protected: //data 
+
+     /**
+     * If not null, it contains values of DLNA.ORG_PN parameter. 
+     */
+     HBufC8* iDlnaPn;
+                   
+     /**
+     * If not null, it contains values of DLNA.ORG_PS parameter. 
+     * There is no additional support for this parameter.
+     */
+     HBufC8* iDlnaPs;
+     
+     /**
+     *  It contains values of DLNA.ORG_CI parameter. 
+     */
+     TInt iDlnaCi;
+     
+     /**
+     * There are stored binary parameters from DLNA specification in this member. 
+     * 7-bit 0-bit 
+     * 7-bit this is LSOP Time parameter from DLNA.ORG_OP
+     * 6-bit this is LSOP Range parameter from DLNA.ORG_OP 
+     * 5-bit this is CI parameter DLNA.ORG_CI
+     * There is a enum containing this information: DLNA_PARAMS
+     *
+     */
+     TUint8 iParams; 
+     
+     /**
+     * This contains flags, which are DLNA.ORG_FLAGS parameter value
+     * TUnit32[0] This main flags field contains: 
+     * 31-bit ... 0-bit where: Values stored in enum: DLNA_FLAGS. 
+     * 31-bit SP_FLAG Sender Paced flag.
+     * 30-bit LSOP_TSR_FLAG limited time seek flag
+     * 29-bit LSOP_RANGE_FLAG limited range seek flag 
+     * 28-bit PLAY_CONTAINER  play container flag
+     * 27-bit S0_INC_FLAG S0 increasing flag. 
+     * 26-bit SN_INC_FLAG SN increasing flag
+     * ... Unused
+     * TUint32[1], TUint32[2], TUint32[3], there is no method to access this members.
+     * this might be used in inherited classes.
+     */ 
+     TUint32 iDlnaFlags[4];        
+              
+     /**
+     * String containing information about other parameters from DLNA specification. 
+     * In case of this is not DLNA protocolInfo, it contains information about whole 4th field.
+     */
+     HBufC8* iOtherParams;       
+     
+     //Buffer for flags parameter
+     HBufC8* iFlagsParam;     
+       
+     //Buffer for op paramater
+     HBufC8* iOpParam;       
+};
+
+#endif // C_CUPNPDLNAPROTOCOLINFO_H
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpdlnaprotocolinfocons.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,73 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares protocolInfo namespace
+*
+*/
+
+
+#ifndef C_CUPNPDLNAPROTOCOLINFOCONS_H
+#define C_CUPNPDLNAPROTOCOLINFOCONS_H
+
+#include <e32base.h>
+
+namespace UpnpDlnaProtocolInfo
+	{
+
+
+	enum TDlnaFlags
+		{
+		SP_FLAG = 31,
+		LSOP_TSR_FLAG = 30, 
+		LSOP_RANGE_FLAG = 29, 
+		PLAY_CONTAINER = 28, 
+		S0_INC_FLAG = 27, 
+		SN_INC_FLAG = 26,
+		RSTP_PAUSE_FLAG = 25,
+		TM_S_FLAG = 24,	// Streaming transfer
+		TM_I_FLAG = 23,	// Interactiv transfer
+		TM_B_FLAG = 22,	// Background transfer
+		DLNA_V1_5_FLAG = 20  
+		};
+
+	enum TDlnaParams
+		{
+		A_VAL = 0,
+		B_VAL = 1,			
+		};
+
+
+	_LIT8(KDLNA_PN_JPEG_SM, "JPEG_SM");
+	_LIT8(KDLNA_PN_JPEG_MED, "JPEG_MED");
+	_LIT8(KDLNA_PN_JPEG_LRG, "JPEG_LRG");
+	_LIT8(KDLNA_PN_JPEG_TN, "JPEG_TN");
+	_LIT8(KDLNA_PN_JPEG_SM_ICO, "JPEG_SM_ICO");
+	_LIT8(KDLNA_PN_JPEG_LRG_ICO, "JPEG_LRG_ICO");
+	_LIT8(KDLNA_PN_PNG_TN, "PNG_TN");
+	_LIT8(KDLNA_PN_PNG_SM_ICO, "PNG_SM_ICO");
+	_LIT8(KDLNA_PN_PNG_LRG_ICO, "PNG_LRG_ICO");
+	_LIT8(KDLNA_PN_PNG_LRG, "PNG_LRG");
+	_LIT8(KDLNA_PN_MP3, "MP3");
+	
+	_LIT8(KDLNA_PN_AAC_ISO_320, "AAC_ISO_320");
+	_LIT8(KDLNA_PN_AVC_MP4_BL_CIF15_AAC_520, "AVC_MP4_BL_CIF15_AAC_520");
+
+	_LIT8(KDEFAULT_DLNA_FLAGS_IMAGE, "DLNA.ORG_FLAGS=00D00000000000000000000000000000");
+	_LIT8(KDEFAULT_DLNA_FLAGS_AV, "DLNA.ORG_FLAGS=01500000000000000000000000000000");
+	_LIT8(KDEFAULT_DLNA_FLAGS_AUDIO, "DLNA.ORG_FLAGS=01500000000000000000000000000000");
+
+	_LIT8(KDEFAULT_DLNA_OP, "DLNA.ORG_OP=01");						
+	}
+
+#endif // C_CUPNPDLNAPROTOCOLINFOCONS_H
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpelement.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,221 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Element information
+*
+*/
+
+
+
+#ifndef UPNPELEMENT_H
+#define UPNPELEMENT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpattribute.h"
+
+_LIT8( KResEl,"res" );
+_LIT8( KFilePathAttrib, "filepath" );
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+class CUpnpAttribute;
+// Array type for UPnPObjects
+typedef RPointerArray<CUpnpAttribute> RUPnPAttributesArray;
+
+// CLASS DECLARATION
+
+/**
+*  UPnPContainer interface
+*
+*  @lib upnpavobjects.lib
+*  @since Series 60 3.0
+*/
+class CUpnpElement : public CBase
+    {
+    public:  // Constructors and destructor
+    
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUpnpElement* NewLC(const TDesC8& aName = KNullDesC8());
+        IMPORT_C static CUpnpElement* NewL(const TDesC8& aName = KNullDesC8());
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpElement();
+
+    public: // New functions
+        
+       /**
+        * Sets name for the UPnP element. 
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param TDesC8 reference for name
+        * @return none
+        */
+        IMPORT_C void SetNameL( const TDesC8& aName );
+        
+        /**
+        * Gets name for the UPnP element
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for parent ID
+        */
+        IMPORT_C const TDesC8& Name() const;
+        
+         /**
+        * Sets value for the UPnP element. 
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param TDesC8 reference for name
+        * @return none
+        */
+        IMPORT_C void SetValueL( const TDesC8& aValue );
+        
+        /**
+        * Gets value for the UPnP element
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for parent ID
+        */
+        IMPORT_C const TDesC8& Value() const;
+ 		
+ 		
+ 		/**
+        * Gets path for the UPnP element res
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 path
+        */
+ 		IMPORT_C const TDesC& FilePath() const;
+
+ 		/**
+        * SetFilePathL path for the UPnP element res
+        * @since Series 60 3.0
+        * @param TDesC8 file path
+        * @return none
+        */
+ 		IMPORT_C void SetFilePathL(const TDesC& aFilePath);
+ 		
+ 		/**
+        * Adds Attribute for the UPnP Object
+        * @since Series 60 3.0
+        * @param none
+        * @return none
+        */
+        
+        IMPORT_C void AddAttributeL( CUpnpAttribute* aNewAttribute );
+        
+        /**
+        * Removes specified Attribute from the UPnP Object
+        * @since Series 60 3.0
+        * @param none
+        * @return none
+        */
+        IMPORT_C void RemoveAttributeL( const CUpnpAttribute* aNewAttribute );
+        
+        /**
+        * Gets Attribute array of the object
+        * @since Series 60 3.0
+        * @param none
+        * @return none
+        */
+        IMPORT_C const RUPnPAttributesArray& GetAttributes();      
+	   
+	    
+		/**
+        * Externalizes element information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RWriteStream
+        * @return none
+        */
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+        
+        /**
+        * Internalizes element information from stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        IMPORT_C void InternalizeL( RReadStream& aStream );
+        
+        /**
+        * Copies contents from CUpnpElement given as parameter to this object.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param aObject const reference to source information
+        * @return none
+        */
+        IMPORT_C void CopyL( const CUpnpElement& aElement );
+        
+        IMPORT_C void SetIsRequired(TBool aIsRequired);
+        IMPORT_C TBool IsRequired() const;
+
+    private:
+       /**
+        * C++ default constructor.
+        */
+        CUpnpElement();        
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(const TDesC8& aName);
+
+		/**
+        * Safely externalizes element information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        void SafeExternalizeL(RWriteStream& aStream, const TDesC8& aDesc, const TInt aNumber) const;
+		void SafeExternalize16L(RWriteStream& aStream, const TDesC& aDesc, const TInt aNumber) const;
+		TInt MapItemNameToProperLength(TDesC8& aItemName) const;
+
+    private:
+       
+        //Element Name
+        HBufC8*      iElementName;
+
+        //Element Value
+        HBufC8*      iElementValue;
+
+        // File path
+        HBufC*       iFilePath;
+        
+        // Is required
+        TBool iIsRequired;
+        
+        //Element attributes
+        RUPnPAttributesArray  iAttributes;         
+        
+    };
+
+#endif      // UPNPELEMENT_H  
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpfiletransferevent.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,228 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Upnp Media Server file transfer event
+*
+*/
+
+
+#ifndef C_CUPNPFILETRANSFEREVENT_H
+#define C_CUPNPFILETRANSFEREVENT_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpmediaserverevent.h"
+
+
+// FORWARD DECLARATIONS
+class CUpnpMediaServerEvent;
+
+
+// CLASS DECLARATION
+
+/**
+ *  Class encapsulates file transfer message
+ *
+ *  @lib MediaServerClient.lib
+ *  @since S60 v3.1
+ */
+class CUpnpFileTransferEvent : public CUpnpMediaServerEvent
+{
+public:
+    enum TProgressState
+        {
+	    EStarted,
+	    ECompleted,
+	    EFailed,
+	    EStopped
+        };
+        
+    enum TDirection
+        {   
+        EIncoming,
+        EOutgoing,        
+        };    
+public:
+	
+	/**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CUpnpFileTransferEvent* NewL();
+
+    /**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CUpnpFileTransferEvent* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpFileTransferEvent();
+    
+    
+    /**
+    * Gets progress state of transfer
+    * @since Series 60 3.1
+    * @param none
+    * @return progress state
+    */
+    IMPORT_C TProgressState ProgressState();
+ 
+    /**
+    * Sets progress state of transfer
+    * @since Series 60 3.1
+    * @param aState progress state
+    * @return none
+    */
+    IMPORT_C void SetProgressState( TProgressState aState );
+ 
+    /**
+    * Gets transfer direction
+    * @since Series 60 3.1
+    * @param none
+    * @return progress state
+    */
+    IMPORT_C TDirection Direction();
+ 
+    /**
+    * Sets transfer direction
+    * @since Series 60 3.1
+    * @param aState progress state
+    * @return none
+    */
+    IMPORT_C void SetDirection( TDirection aState );
+    
+    /**
+    * Gets content transfer identifier
+    * @since Series 60 3.1
+    * @param none
+    * @return transfer identifier
+    */    
+    IMPORT_C TInt TransferId();
+
+    /**
+    * Sets transfer identifier
+    * @since Series 60 3.1
+    * @param aTransferId transfer identifier
+    * @return none
+    */    
+    IMPORT_C void SetTransferId( TInt aTransferId );
+
+    /**
+    * Gets content directory object identifier
+    * associated with transfer
+    * @since Series 60 3.1
+    * @param none
+    * @return object identifier 
+    */    
+    IMPORT_C TInt ContentDirectoryObjectId();
+
+    /**
+    * Sets content directory object identifier
+    * associated with transfer
+    * @since Series 60 3.1
+    * @param aObjectId object identifier
+    * @return none  
+    */    
+    IMPORT_C void SetContentDirectoryObjectId( TInt aObjectId );
+
+    /**
+    * Gets file path 
+    * @since Series 60 3.1
+    * @param none
+    * @return file path
+    */    
+    IMPORT_C TDesC& FilePath();
+
+    /**
+    * Gets file path 
+    * @since Series 60 3.1
+    * @param aFile file path
+    * @return none 
+    */    
+    IMPORT_C void SetFilePathL(const TDesC& aFile);
+    
+    /**
+    * Gets error code
+    * @since Series 60 3.1
+    * @param none
+    * @return transport specific error code
+    */    
+    IMPORT_C TInt ErrorCode();
+    
+    /**
+    * Sets error code
+    * @since Series 60 3.1
+    * @param aError transport specific error code
+    * @return none
+    */    
+    IMPORT_C void SetErrorCode( TInt aError );
+    
+    /**
+    * Sets error code
+    * @since Series 60 3.1
+    * @param aError transport specific error code
+    * @return none
+    */    
+    IMPORT_C CUpnpFileTransferEvent* CloneL();
+    
+    
+    /**
+    * Externalizes transfer event information to a stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+        
+    /**
+    * Internalizes transfer event information from a stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+	
+private:	
+
+	 /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+	void ConstructL();
+	
+	/**
+    * Constructor.
+    */
+	CUpnpFileTransferEvent();
+	
+private:
+    //Transfer progress state 
+	TInt iProgress;
+    //Transfer direction
+	TInt iDirection;
+    //Content Directory object identifier
+	TInt iContentDirectoryObjectId;
+    //Local disk file path 
+	HBufC*  iFilePath;
+    //Transfer identifier
+	TInt iTransferId;
+    //Lower level error code, for failed transfers
+	TInt iErrorCode;
+
+};
+
+#endif //C_CUPNPFILETRANSFEREVENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,120 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Item information class
+*
+*/
+
+
+#ifndef UPNPITEM_H
+#define UPNPITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpobject.h"
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+
+// CLASS DECLARATION
+/**
+*  UPnPItem class
+*
+*  @lib upnpavobjects.lib
+*  @since Series 60 3.0
+*/
+class CUpnpItem : public CUpnpObject
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUpnpItem* NewL( );
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CUpnpItem();
+
+        
+    public:  // New functions
+        
+        /**
+        * Sets File name (including path) for the UPnP item. 
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param TDesC8 reference for file name
+        * @return none
+        */
+        IMPORT_C void SetRefIdL( const TDesC8& aRefId);
+        
+        /**
+        * Gets File name for the UPnP item
+        * @since Series 60 3.0
+        * @param none
+        * @return TInt reference for parent ID
+        */
+        IMPORT_C const TDesC8& RefId() const;
+
+
+		/**
+        * Returns type of the object (= item)
+        * @since Series 60 3.0
+        * @param none
+        * @return TUPnPObjectType information of the type
+        */
+        TUPnPObjectType ObjectType() const;
+
+        /**
+        * Externalizes item information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RWriteStream
+        * @return none
+        */
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+        
+        /**
+        * Internalizes item information from stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        IMPORT_C void InternalizeL( RReadStream& aStream );
+          
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CUpnpItem( );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+
+    private:    // Data
+
+        // Full file name to physical file
+       	HBufC8*      iRefId ;  
+
+    };
+
+#endif      // UPNPITEM_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpitemlist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,85 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Item information class
+*
+*/
+
+
+#ifndef UPNPITEMLIST_H
+#define UPNPITEMLIST_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpobject.h"
+#include "upnpitem.h"
+#include "upnpobjectlist.h"
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+
+// CLASS DECLARATION
+/**
+*  UPnPItemList class
+*
+*  @lib upnpavobjects.lib
+*  @since Series 60 3.0
+*/
+class CUpnpItemList : public CUpnpObjectList
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUpnpItemList* NewL();
+        IMPORT_C static CUpnpItemList* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpItemList();
+
+    public: // Functions from base classes 
+
+        /**
+        * Appends new object to hierarchy.
+        * This function verifies if the given object is of CUpnpItem type 
+        * and leaves with KErrArgument if not.
+        *
+        * @since Series 60 3.0
+        * @param aNewObject an object to be added to the list.
+        *           NOTE: The object must be of CUpnpItem type.
+        */
+        IMPORT_C void AppendObjectL( CUpnpObject& aNewObject );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CUpnpItemList();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+        
+    private:    // Data
+        
+    };
+
+#endif      // UPNPITEMLIST_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpmediaserverevent.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,67 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Upnp Media Server event
+*
+*/
+
+
+#ifndef C_CUPNPMEDIASERVEREVENT_H
+#define C_CUPNPMEDIASERVEREVENT_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+
+// CLASS DECLARATION
+/**
+*  Base class for Media Server events
+*  @since Series 60 3.1
+*/
+class CUpnpMediaServerEvent : public CBase
+{
+public:
+    /**
+    * Constructor
+    */
+    CUpnpMediaServerEvent(TInt aType);
+
+    /**
+    * Destructor
+    */
+    virtual ~CUpnpMediaServerEvent();
+
+    /**
+    * Gets type of the event
+    */
+    TInt GetEventType();
+
+    /**
+    * Internalizes object
+    */
+    virtual void InternalizeL( RReadStream& aStream ) = 0;
+
+    /**
+    * Externalizes object
+    */
+    virtual void ExternalizeL( RWriteStream& aStream ) const = 0;
+
+
+protected:
+
+    //Event type of derived class
+    TInt iEventType;
+
+};
+
+#endif // C_CUPNPMEDIASERVEREVENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpobject.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,301 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base class for UPnP object information
+*
+*/
+
+
+#ifndef UPNPOBJECT_H
+#define UPNPOBJECT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpelement.h"
+
+//CONSTANTS
+const TInt KDefBufferGranularity = 100;
+const TInt KDefArraySize = 8;
+
+// FORWARD DECLARATIONS
+class CUpnpObject;
+
+// DATA TYPES
+enum TUPnPObjectType 
+	{
+    EUPnPContainer = 1,
+    EUPnPItem  
+	};
+
+// Array type for UPnPObjects
+typedef RPointerArray<CUpnpElement> RUPnPElementsArray;
+
+// CLASS DECLARATION
+/**
+*  UPnP Object header
+*
+*  @lib upnpavobjects.lib
+*  @since Series 60 3.0
+*/
+class CUpnpObject : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CUpnpObject();
+
+    public: // New functions
+        
+        /**
+        * Gets ID for the UPnP Object
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for ID
+        */
+        IMPORT_C void SetIdL( const TDesC8& aId );
+        
+        /**
+        * Gets ID for the UPnP Object
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for ID
+        */
+        IMPORT_C const TDesC8& Id() const;
+        
+	    /**
+        * Sets Parent ID for the UPnP Object. Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param TInt reference for parent ID
+        * @return none
+        */
+        IMPORT_C void SetParentIdL( const TDesC8& aParentId );
+        
+        /**
+        * Gets Parent ID for the UPnP Object
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for parent ID
+        */
+        IMPORT_C const TDesC8& ParentId() const;
+        
+        /**
+        * Sets title for the UPnP Object. Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param TDesC8 reference for parent ID
+        * @return none
+        */
+        IMPORT_C void SetTitleL( const TDesC8& aTitle );
+        
+        /**
+        * Gets title for the UPnP Object
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for title
+        */
+        IMPORT_C const TDesC8& Title() const;
+       
+        /**
+        * Sets ObjectClass for the UPnP Object. Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param TDesC8 reference for parent ID
+        * @return none
+        */
+        IMPORT_C void SetObjectClassL( const TDesC8& aObjectClass );
+        
+        /**
+        * Gets ObjectClass for the UPnP Object
+        * @since Series 60 3.0
+        * @param none
+        * @return TDesC8 reference for title
+        */
+        IMPORT_C const TDesC8& ObjectClass() const;
+        
+        /**
+        * Adds Element for the UPnP Object
+        * @since Series 60 3.0
+        * @param none
+        * @return none
+        */
+        IMPORT_C void AddElementL( CUpnpElement* aNewElement );
+        
+        /**
+        * Removes specified Element from the UPnP Object
+        * @since Series 60 3.0
+        * @param none
+        * @return none
+        */
+        IMPORT_C void RemoveElementL( const CUpnpElement* aNewElement );
+        
+        /**
+        * Gets Element array of the object
+        * @since Series 60 3.0
+        * @param none
+        * @return none
+        */
+        IMPORT_C const RUPnPElementsArray& GetElements();
+
+        /**
+        * Sets the write status.
+        * @since Series 60 3.0
+        * @param aWriteStatus TBool
+        * @return None
+        */
+        IMPORT_C void SetRestricted( TBool aRestriction );
+
+        /**
+        * Gets the write status. 
+        * @since Series 60 3.0
+        * @param None
+        * @return TBool
+        */
+        IMPORT_C TBool Restricted() const;
+
+        /**
+        * Sets the write status.
+        * @since Series 60 3.0
+        * @param aWriteStatus TBool
+        * @return None
+        */
+        IMPORT_C void SetWriteStatus( TBool aWriteStatus );
+
+        /**
+        * Gets the write status. 
+        * @since Series 60 3.0
+        * @param None
+        * @return TBool
+        */
+        IMPORT_C TBool WriteStatus() const;
+        		
+        /**
+        * Pure virtual function to return the concrete object type
+        * @since Series 60 3.0
+        * @param none
+        * @return TUPnPObjectType object type
+        */
+        virtual TUPnPObjectType ObjectType() const = 0;        
+        
+        /**
+        * Externalizes container information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RWriteStream
+        * @return none
+        */
+        virtual void ExternalizeL( RWriteStream& aStream ) const = 0;
+        
+        /**
+        * Internalizes container information from stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        virtual void InternalizeL( RReadStream& aStream ) = 0;
+      
+        /**
+        * Copies contents from CUpnpObject given as parameter to this object.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param aObject const reference to source information
+        * @return none
+        */
+        IMPORT_C void CopyL( const CUpnpObject& aObject );
+        
+        IMPORT_C HBufC8* ToDes8L() const;
+		
+        /**
+        * Attaches proper <res> element (resource associated with an UPnP object) to protocolInfo        
+        * @since Series 60 3.0
+        * @param aFilename - resource file to be attached
+        * @param aProtocolinfo - protocolInfo to which the resource will be attached
+        * @return none
+        */
+        IMPORT_C void AddResourceL( const TDesC16& aFilename,const TDesC8& aProtocolinfo );
+        
+    protected:
+
+        /**
+        * C++ default constructor.
+        */
+        CUpnpObject();
+        
+        /**
+        *  By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        CUpnpObject& operator= (const CUpnpObject& aObj);
+  
+        /**
+        * Externalizes container information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RWriteStream
+        * @return none
+        */
+        void BaseExternalizeL( RWriteStream& aStream ) const;
+        
+        /**
+        * Safely externalizes object information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        void SafeExternalizeL(RWriteStream& aStream, const TDesC8& aDesc, const TInt aNumber) const;
+        
+        /**
+        * Internalizes container information from stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        void BaseInternalizeL( RReadStream& aStream );
+        
+    private:
+    
+        void ValidateClassL(const TDesC8& aObjectClass);
+                
+    protected:    // Data
+    
+        // Object ID
+        HBufC8*      iId;
+         
+        // Parent's object ID
+        HBufC8*      iParentId;
+        
+        // Name of the object
+        HBufC8*     iTitle;
+        
+        // object class
+        HBufC8* 	iObjectClass;  
+        
+        // Restricted status
+        TBool       iRestricted;
+        
+        // WriteStatus
+        TBool       iWriteStatus;
+        
+        // Elements
+        RUPnPElementsArray  iElements;
+
+    };
+
+#endif      // UPNPOBJECT_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpobjectlist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,156 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Item information class
+*
+*/
+
+
+#ifndef UPNPOBJECTLIST_H
+#define UPNPOBJECTLIST_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpobject.h"
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+
+// CLASS DECLARATION
+/**
+*  UPnPItemList class
+*
+*  @lib upnpavobjects.lib
+*  @since Series 60 3.0
+*/
+class CUpnpObjectList : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUpnpObjectList* NewL();
+        IMPORT_C static CUpnpObjectList* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpObjectList();
+
+    public: // New functions
+        
+        IMPORT_C CUpnpObject* operator[]( TInt aIndex ) const;
+        
+        /**
+        * Serialize ids of contained objects to a heap based descriptor.
+        * @since Series 60 3.0
+        * @return pointer to the descriptor where ids are serialized.
+        */
+        IMPORT_C HBufC8* IdsToDes8L() const;
+        
+        /**
+        * Serialize the whole list to a heap based descriptor.
+        * @since Series 60 3.0
+        * @return pointer to the descriptor where the list is serialized.
+        */
+        IMPORT_C HBufC8* ToDes8L() const;       
+
+        /**
+        * Appends new object to hierarchy
+        * @since Series 60 3.0
+        * @param none
+        * @return TUPnPObjectType information of the type
+        */
+        IMPORT_C void AppendObjectL( CUpnpObject& aNewObject );
+        
+        /**
+        * Removes object from the hierarchy.
+        * @since Series 60 3.0
+        * @param aId id of the object to be removed and destroyed
+        */
+        IMPORT_C void RemoveAndDestroy( const TDesC8& aId );
+
+        /**
+        * Detaches object from the hierarchy.
+        * @since Series 60 3.0
+        * @param aId id of the object to be removed and destroyed
+        * @return pointer to the object
+        */
+        IMPORT_C CUpnpObject* Remove( const TDesC8& aId );
+
+        /**
+        * Searches object from the object hierarchy
+        * @since Series 60 3.0
+        * @param CUpnpObject pointer to the object found
+        * @param TDesC8 referenco to Object ID which is searched
+        * @return TBool indicating the status of the find
+        */
+        IMPORT_C CUpnpObject* FindObject( const TDesC8& aObjectId );
+        
+        /**
+        * Returns childcount of the itemlist 
+        * @since Series 60 3.0
+        * @param TBool indicating whether recursive count is needed
+        * @return TInt count information
+        */
+        IMPORT_C TInt ObjectCount( ) const;
+        
+
+    public: // Functions from CUpnpObject
+
+        /**
+        * Externalizes itemlist information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RWriteStream
+        * @return none
+        */
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+        
+        /**
+        * Internalizes itemlist information from stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.0
+        * @param reference to RReadStream
+        * @return none
+        */
+        IMPORT_C void InternalizeL( RReadStream& aStream );
+        
+     
+
+    protected:
+
+        /**
+        * C++ default constructor.
+        */
+        CUpnpObjectList();
+    
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+        
+     private:
+        TInt FindObjectIndex(const TDesC8& aObjId) const;
+
+    private:    // Data
+        
+        // objects
+        RPointerArray<CUpnpObject>   iObjects;
+    };
+
+#endif      // UPNPOBJECTLIST_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/inc/upnpprotocolinfo.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,258 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ProtocolInfo base functionality class 
+*
+*/
+
+
+#ifndef C_CUPNPPROTOCOLINFO_H
+#define C_CUPNPPROTOCOLINFO_H
+
+#include <e32base.h>
+
+
+/**
+*  CUpnpProtocolInfo class.
+*  Class siplifies mainipulation of UPnP res@protocolInfo property.
+*  Syntax: 
+*      protocolInfo =  
+*            <protocol>’:’ <network>’:’<contentFormat>’:’<additionalInfo>
+*
+*      (See ConnectionManager:1 Service Template Version 1.01 for details)
+*
+*  Use case 1: Building protocol info: 
+*
+*     _LIT8(KFirstParam, "http-get");
+*     _LIT8(KSecondParam, "*");
+*     _LIT8(KThirdParam, "image/jpeg");
+*     _LIT8(KFourthParam, "*");          
+*     
+*     CUpnpProtocolInfo * protocolInfo = CUpnpProtocolInfo::NewL();
+*     protocolInfo->SetFirstFieldL(KFirstParam());
+*     protocolInfo->SetSecondFieldL(KSecondParam());
+*     protocolInfo->SetThirdFieldL(KThirdParam());
+*     protocolInfo->SetFourthFieldL(KFourthParam());
+*
+*  Use case 2: Parsing existing protocol info: 
+*
+*     _LIT8(KInfo, "http-get:*:audio/mpeg:*");
+*     CUpnpProtocolInfo * protocolInfo = CUpnpProtocolInfo::NewL(KInfo());
+*     TPtrC8 param = protocolInfo->SetFirstField();
+*     param = protocolInfo->SecondParameterL();
+*     param = protocolInfo->ThirdParameterL();
+*     param = protocolInfo->FourthParameterL();
+*
+*  @lib upnpavobjects.lib
+*  @since S60 3.1
+*/
+class CUpnpProtocolInfo: public CBase 
+{    	    	  	    
+
+//PUBLIC MEMBERS:
+public: 
+	
+    /**
+    * Factory method. Creates CProtocolInfo with empty parameters
+    *  
+    * @param aProtocolInfo protocolInfo string to be parsed
+    * @return instance CProtocolInfo
+    */
+    IMPORT_C static CUpnpProtocolInfo* NewL();
+    
+    	 
+    /**
+    * Factory method. Parses input descriptor.
+    * Example:
+    * _LIT8(KProtocolInfo,""http-get:*:audio/mpeg:*");
+    * CProtocolInfo* protocolInfo = CProtocolInfo::NewL( KProtocolInfo() ); 
+    *  
+    * @param aProtocolInfo protocolInfo string to be parsed
+    * @return instance CProtocolInfo
+    */
+    IMPORT_C static CUpnpProtocolInfo* NewL(const TDesC8& aProtocolInfo);
+
+    
+    /**
+    * Destructor of the class. 
+    */
+    virtual ~CUpnpProtocolInfo();	
+    	    	    	    
+// PUBLIC ACCESSED METHODS - EXPORTED INTERFACE
+public:
+        	 
+     /**
+     * Gets whole ProtocolInfo as a descriptor.
+     * @return descriptor
+     */
+     IMPORT_C TPtrC8 ProtocolInfoL();
+         	 		  		 
+     /**
+     * Getter for ProtocolInfo.
+     * @return parameter value
+     */
+     IMPORT_C TPtrC8 FirstField(); 
+     
+     /**
+     * Setter for first parameter value.
+     * @param aValue parameter value
+     */
+     IMPORT_C void SetFirstFieldL(const TDesC8& aValue); 
+    
+     /**
+     * Getter for second parameter.
+     * @return parameter value
+     */
+     IMPORT_C TPtrC8 SecondField(); 
+     
+     /**
+     * Setter for second parameter value.
+     * @param aValue parameter value
+     */
+     IMPORT_C void SetSecondFieldL(const TDesC8& aValue);
+    
+     /**
+     * Getter for third parameter.
+     * @return parameter value
+     */
+     IMPORT_C TPtrC8 ThirdField(); 
+    
+     /**
+     * Setter for third parameter value.
+     * @param aValue parameter value
+     */
+     IMPORT_C void SetThirdFieldL(const TDesC8& aValue);
+    
+     /**
+     * Getter for fourth parameter 
+     * @return parameter value
+     */
+     IMPORT_C virtual TPtrC8 FourthField();
+    
+     /**
+     * Setter for fourth parameter value.
+     * @param aValue parameter value
+     */
+     IMPORT_C void SetFourthFieldL(const TDesC8& aValue);
+    
+    
+    	     	     	     	     	 	 	 	
+protected: //Base construct
+
+     /** 
+     * Constructor of the class     	 
+     */
+     CUpnpProtocolInfo();
+    
+      /**
+     * Method for creating instance of class. 
+     * aInputString must contain protocolInfo string. 
+     */
+     void BaseConstructL(const TDesC8& aInputString);
+     
+     /**
+     * This function produces a string containing all info taken from fourth ProtocolInfo field    	 
+     * aBuffer - on this variable values are appended. 
+     */
+     virtual void GetFourthParameterInternalL(TDes8& aBuffer);
+    	                  	  		
+//MEMBER METHODS - USED INTERNALLY
+protected: 	
+		 		 		 	 	 	 	 
+     /**
+     * Parses aInputString into protocolInfo object.  
+     * aInputString- descriptor with protocolInfo
+     * Returns 	KErrNone when everything ok.
+     * 			KErrArgument when there was additionalInfo string empty.
+     */
+     virtual TInt ParseL(const TDesC8& aInputString);
+     
+     /**
+     * This function returns length of the string containing all relevant information from fourth ProtocolInfo field. 
+     * Returns - length of the string for 4th field.
+     */
+     virtual TInt GetFourthParameterLength(); 
+     
+     /**
+     * It marks a string placed between start position and aDelimeter    	     	 
+     * aLexeme - TLex8 object on which marking is occuring.
+     * aDelimeter - character on which marking will end. 
+     */
+     void ParseAtomToDelimeter(TLex8& aLexeme, TChar aDelimeter);
+     
+     /**
+     * Sets one of the four parameters of protcolInfo object:
+     * <protocol>':'<network>':'<contentType>':'<additionalInfo>
+     * protocol - iFirstField. 
+     * network- iSecondField
+     * contentType - iThirdField
+     * additionalInfo iFourthField.
+     */
+     void SetParameterL(TInt aWhich, const TDesC8& aValue);
+    	     	     	     	     	 
+     /**
+     * Skips aValue characters and marks after end of skipping.
+     */
+     void SkipAndMark(TLex8& aLexer, TInt aValue);
+    
+     /**
+     * Skips aValue characters. Do not mark.
+     */
+     void Skip(TLex8& aLexer, TInt aValue);
+         	 
+     /**
+     * Check if character contains correct value for boolean type (1 or 0)
+     * @param character to check
+     * @return KErrNone if value is correct, else KErrArgument
+     */ 	 	 	 
+     TInt CheckBooleanValue(TChar aCharacter);
+    	 	 	 
+     /**
+     * Returns - integer value, which contains iformation about the length of the string currently stored in the class. 
+     */
+     TInt GetProtocolInfoLength(); 
+    	     	     	     	 	 	     	    	     	     	              	     	    	     	     	 
+//MEMBER VARIABLES
+protected: //data
+
+    /**
+    * ProtoclInfo. 
+    */	
+    HBufC8* iProtocolInfo;
+    /**
+    * Third field of protoclInfo. 
+    */	
+    HBufC8* iThirdParameter;    
+    
+    /**
+    * Fourth field of protocolInfo. 
+    * If this field equals NULL this means that information in rest DLNA parameters is valid. 
+    * else, the field contains information from parsed string.
+    */	
+    HBufC8* iFourthParameter;    
+    	 
+private: //data
+	 
+     /**
+     * First field of protoclInfo. 
+     */	
+     HBufC8* iFirstParameter; 
+    
+     /**
+     * Second field of protoclInfo. 
+     */	
+     HBufC8* iSecondParameter;     	  	 	     
+};
+
+#endif // C_CUPNPPROTOCOLINFO_H
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_av_objects_api/upnp_av_objects_api.metaxml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="0a0d900cb82f4c2eb37477cf77133cac" dataversion="1.0">
+  <name>UPnP AV Objects API</name>
+  <description>This API is used to create UPnP AV objects</description>
+  <type>c++</type>
+  <subsystem>upnpmediaserver</subsystem>
+  <libs>
+    <lib name="upnpavobjects.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_avcp_api/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,28 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                UPnP AVCP API
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/upnpavcontrolpointobserver.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcontrolpointobserver.h)
+../inc/upnpavcontrolpoint.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcontrolpoint.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_avcp_api/inc/upnpavcontrolpoint.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,631 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AV control point class
+*
+*/
+
+
+
+#ifndef C_CUPNPAVCONTROLPOINT_H
+#define C_CUPNPAVCONTROLPOINT_H
+
+
+//  INCLUDES
+#include "upnpavcontrolpointobserver.h"
+#include "upnpcontrolpoint.h"
+#include "upnphttpmessage.h"
+
+// FORWARD DECLARATIONS
+class CUpnpActionResponseHandler;
+class CUpnpStateUpdateHandler;
+class CUpnpAvtActionFactory;
+class CUpnpCdsActionFactory;
+class CUpnpCmActionFactory;
+class CUpnpRcActionFactory;
+// CLASS DECLARATION
+
+/**
+*  Main class of AV Control Point.
+*  This class serves as an interface to AVCP library and contais functions for
+*  UPnP Action creation and sending as well as receiving Action responses and
+*  UPnP events.
+*
+*  Prior using the CUpnpAVControlPoint class, client application has to create 
+*  the network connection. If connection is not up and 
+*  running, the CUpnpDispatcherEngine class construction will fail. 
+*  See UPnP Interface Design document for instuctions.
+*
+*  @since Series 60 2.6
+*/
+class CUpnpAVControlPoint : public CUpnpControlPoint
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CUpnpAVControlPoint* NewL(
+        MUpnpAVControlPointObserver& aAVControlPointObserver            
+        );
+    
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~CUpnpAVControlPoint();
+
+public: // New functions
+    
+    /**
+    * Service search and getter function.
+    * @since Series 60 2.6
+    * @param aDevice Target device of search.
+    * @param aServiceType Type of searched service.
+    * @return Found CUpnpService or NULL if not found.
+    */
+    IMPORT_C CUpnpService* Service(
+        CUpnpDevice* aDevice,
+        const TDesC8& aServiceType);
+
+    /**
+    * Device getter.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @return Founded device.
+    IMPORT_C const CUpnpDevice* Device(const TDesC8& aUuid);       
+    */
+
+
+    /**
+    * Creates and sends a SetTransportURI action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @param aCurrentUri Content URI.
+    * @param aCurrentMetaData Content metadata.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtSetTransportUriActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceId,
+        const TDesC8& aCurrentUri,
+        const TDesC8& aCurrentMetaData);
+
+    /**
+    * Creates and sends a SetNextTransportURI action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @param aNextUri Content URI.
+    * @param aNextMetaData Content metadata.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtSetNextTransportUriActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceId,
+        const TDesC8& aNextUri,
+        const TDesC8& aNextMetaData);
+
+    /**
+    * Creates and sends a Seek action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @param aUnit
+    * @param aTarget
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtSeekActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceId,
+        const TDesC8& aUnit,
+        const TDesC8& aTarget);
+
+    /**
+    * Creates and sends a GetMediaInfo action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtMediaInfoActionL(const TDesC8& aUuid,TInt aInstanceId);
+
+    /**
+    * Creates and sends a GetTransportInfo action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtTransportInfoActionL(const TDesC8& aUuid,TInt aInstanceId);
+
+    /**
+    * Creates and sends a GetPositionInfo action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtPositionInfoActionL(const TDesC8& aUuid,TInt aInstanceId);
+
+    /**
+    * Creates and sends a GetDeviceCapabilities action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtDeviceCapabilitiesActionL(const TDesC8& aUuid,TInt aInstanceId);
+
+    /**
+    * Creates and sends a GetTransportSetings action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtTransportSettingsActionL(const TDesC8& aUuid, TInt aInstanceId);
+
+    /**
+    * Creates and sends a Stop action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtStopActionL(const TDesC8& aUuid, TInt aInstanceId);
+
+    /**
+    * Creates and sends a Play action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @param aSpeed Speed of playback.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtPlayActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceId,
+        const TDesC8& aSpeed);
+
+    /**
+    * Creates and sends a Pause action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtPauseActionL(const TDesC8& aUuid, TInt aInstanceId);
+
+    /**
+    * Creates and sends a Record action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtRecordActionL(const TDesC8& aUuid,TInt aInstanceId);
+
+    /**
+    * Creates and sends a Next action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtNextActionL(const TDesC8& aUuid, TInt aInstanceId);
+
+    /**
+    * Creates and sends a Previous action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtPreviousActionL(const TDesC8& aUuid, TInt aInstanceId);
+
+    /**
+    * Creates and sends a SetPlayMode action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @param aPlayMode
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtSetPlayModeActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceId,
+        const TDesC8& aPlayMode);
+
+    /**
+    * Creates and sends a SetRecordQualityMode action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @param aRecordMode
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtSetRecordModeActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceId,
+        const TDesC8& aRecordMode);
+
+    /**
+    * Creates and sends a GetTransportIDs action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt AvtTransportsActionL(const TDesC8& aUuid, TInt aInstanceId);
+
+    /**
+    * Creates and sends a Browse action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aObjectId Target's id.
+    * @param aBrowseFlag MetaData or DirectChildren.
+    * @param aFilter What is returned.
+    * @param aStartingIndex First returned item.
+    * @param aRequestedCount How manyy items is returned.
+    * @param aSortCriteria Sorting order.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsBrowseActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aObjectId,
+        const TDesC8& aBrowseFlag,
+        const TDesC8& aFilter, 
+        TInt aStartingIndex,
+        TInt aRequestedCount,
+        const TDesC8& aSortCriteria);
+
+    /**
+    * Creates and sends a Search action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aObjectId Target's id.
+    * @param aSearchCriteria Search rules.
+    * @param aFilter What is returned.
+    * @param aStartingIndex First returned item.
+    * @param aRequestedCount How manyy items is returned.
+    * @param aSortCriteria Sorting order.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsSearchActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aObjectId,
+        const TDesC8& aSearchCriteria,
+        const TDesC8& aFilter, 
+        TInt aStartingIndex,
+        TInt aRequestedCount,
+        const TDesC8& aSortCriteria
+        );
+
+    /**
+    * Creates and sends a GetSystemUpdateID action.
+    * @since Series 60 2.6
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsSystemUpdateIdActionL(const TDesC8& aUuid);
+
+    /**
+    * Creates and sends a GetSearchCapabilities action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsSearchCapabilitiesActionL(const TDesC8& aUuid);
+
+    /**
+    * Creates and sends a GetSortCapabilities action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsSortCapabilitiesActionL(const TDesC8& aUuid);
+
+    /**
+    * Creates and sends a CreateObject action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aId Parent container.
+    * @param aElements Object in XML form.
+    * @return Error code. KErrNone if no errors.
+    */                                                                                              
+    IMPORT_C TInt CdsCreateObjectActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aId, 
+        const TDesC8& aElements);
+
+    /**
+    * Creates and sends a ImportResource action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aSourceUri Source of import.
+    * @param aDestinationUri Destination of import.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsImportResourceActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aSourceUri, 
+        const TDesC8& aDestinationUri
+        );
+
+    /**
+    * Creates and sends a ExportResource action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aSourceUri Source of export.
+    * @param aDestinationUri Destination of export.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsExportResourceActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aSourceUri, 
+        const TDesC8& aDestinationUri );
+
+    /**
+    * Creates and sends a CreteReference action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aDestinationContainerId Place for reference.
+    * @param aSourceObjectId Referred object.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsCreateReferenceActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aDestinationContainerId, 
+        const TDesC8& aSourceObjectId );
+
+    /**
+    * Creates and sends a DeleteResource action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aResourceUri Resource to be deleted.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsDeleteResourceActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aResourceUri );
+
+    /**
+    * Creates and sends a DestroyObject action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aObjectId Object to be destroyed.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsDestroyObjectActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aObjectId );
+
+    /**
+    * Creates and sends a StopTransfer action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aTransferId Transfer to be stopped.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsStopTransferActionL(const TDesC8& aUuid, TInt aTransferId );
+
+    /**
+    * Creates and sends a GetTransferProgress action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aTransferId Observed transfer.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsTransferProgressActionL(const TDesC8& aUuid, TInt aTransferId );
+
+    /**
+    * Creates and sends a SetTransportURI action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aObjectID Updated object.
+    * @param aCurrentTagValue Current object XML.
+    * @param aNewTagValue New object XML.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CdsUpdateObjectActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aObjectID,
+        const TDesC8& aCurrentTagValue,
+        const TDesC8& aNewTagValue );
+
+    /**
+    * Creates and sends a GetProtocolInfo action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CmProtocolInfoActionL(const TDesC8& aUuid);
+
+    /**
+    * Creates and sends a GetCurrentConnections action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CmCurrentConnectionsActionL(const TDesC8& aUuid);
+
+    /**
+    * Creates and sends a PrepareForConnection action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aRemoteProtocolInfo
+    * @param aPeerConnectionManager
+    * @param aPeerConnectionID
+    * @param aDirection
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CmPrepareConnectionActionL(
+        const TDesC8& aUuid,
+        const TDesC8& aRemoteProtocolInfo,
+        const TDesC8& aPeerConnectionManager,
+        TInt aPeerConnectionID,
+        const TDesC8& aDirection
+        );
+
+    /**
+    * Creates and sends a ConnectionComplete action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aConnectionId
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CmConnectionCompleteActionL(
+        const TDesC8& aUuid,
+        TInt aConnectionId
+        );
+
+    /**
+    * Creates and sends a GetCurrentConnectionInfo action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aConnectionId
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt CmCurrentConnectionInfoActionL(
+        const TDesC8& aUuid,
+        TInt aConnectionId
+        );
+
+    /**
+    * Creates and sends a GetVolume action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceID Rendring Instance.
+    * @param aChannel Audio channel.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt RcGetVolumetActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceID,
+        const TDesC8& aChannel
+        );
+
+    /**
+    * Creates and sends a SetVolume action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @param aChannel Audio channel.
+    * @param aVolume
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt RcSetVolumetActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceId,
+        const TDesC8& aChannel,
+        TInt aVolume
+        );
+
+    /**
+    * Creates and sends a GetMute action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @param aChannel Audio channel.
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt RcGetMuteActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceId,
+        const TDesC8& aChannel
+        );
+
+    /**
+    * Creates and sends a SetTransportURI action.
+    * @since Series 60 2.6
+    * @param aUuid A Universal Unique Identifier of device.
+    * @param aInstanceId Rendring Instance.
+    * @param aChannel Audio channel.
+    * @param aMute
+    * @return Error code. KErrNone if no errors.
+    */
+    IMPORT_C TInt RcSetMuteActionL(
+        const TDesC8& aUuid,
+        TInt aInstanceId,
+        const TDesC8& aChannel,
+        const TDesC8& aMute
+        );
+
+    /**
+     * This function will be invoke if some network event will occure
+     * for example IP Address of UPnP changes
+     */
+    IMPORT_C void NetworkEvent( CUpnpNetworkEventBase* aEvent );
+
+protected:  // Functions from base classes
+    
+    /**
+    * From CUpnpControlPoint State update handler.
+    */
+    IMPORT_C void StateUpdatedL(CUpnpService* aService);
+
+    /**
+    * From CUpnpControlPoint Device discovery handler.
+    */
+    IMPORT_C void DeviceDiscoveredL(CUpnpDevice* aDevice);
+
+    /**
+    * From CUpnpControlPoint Device dissappear handler.
+    */
+    IMPORT_C void DeviceDisappearedL(CUpnpDevice* aDevice);
+
+    /**
+    * From CUpnpControlPoint Action response handler function.
+    */
+    IMPORT_C void ActionResponseReceivedL(CUpnpAction* aAction);
+
+    /**
+    * From CUpnpControlPoint HTTP message handler function.
+    */
+    IMPORT_C void HttpResponseReceivedL(CUpnpHttpMessage* aMessage);
+
+    /**
+    * C++ default constructor.
+    */
+    IMPORT_C CUpnpAVControlPoint(MUpnpAVControlPointObserver& aAVControlPointObserver);
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    IMPORT_C void ConstructL();
+    
+    /**
+    * Initialize CdsActionFactory if is equal NULL 
+    */
+    IMPORT_C void InitializeCdsActionFactoryL();
+	
+protected:    // Data
+    //AV control point observer (engine)
+    MUpnpAVControlPointObserver& iAVControlPointObserver;
+
+    //Action response handler
+    CUpnpActionResponseHandler*         iActionResponseHandler;
+
+    // UPnP event handler
+    CUpnpStateUpdateHandler*            iStateUpdateHandler;
+
+    // Action factories
+    CUpnpAvtActionFactory*              iAvtActionFactory;
+    CUpnpCdsActionFactory*              iCdsActionFactory;
+    CUpnpCmActionFactory*               iCmActionFactory;
+    CUpnpRcActionFactory*               iRcActionFactory;
+    };
+
+#endif      // C_CUPNPAVCONTROLPOINT_H
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_avcp_api/inc/upnpavcontrolpointobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,825 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MUpnpAVControlPointObserver
+*
+*/
+
+
+
+#ifndef C_MUPNPAVCONTROLPOINTOBSERVER_H
+#define C_MUPNPAVCONTROLPOINTOBSERVER_H
+
+//  INCLUDES
+#include "upnpdevice.h"
+
+// CLASS DECLARATION
+
+/**
+*  Interface class.
+*  This class defines a observer interface for AV controlpoint
+*
+*  @since Series 60 2.6
+*/
+class MUpnpAVControlPointObserver
+        {
+    public:  // Constructors and destructor
+
+    public: // New functions
+        /**
+        * Observer callback for rendering control Set Volume.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aInstance rendering instance.
+        * @param aChannel audio channel.
+        * @param aDesiredVolume 
+        */
+        virtual void RcSetVolumeResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr, 
+            const TDesC8& aInstance, 
+            const TDesC8& aChannel, 
+            const TDesC8& aDesiredVolume) = 0;
+            public: // New functions
+        /**
+        * Observer callback for rendering control Get Volume.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aInstance rendering instance.
+        * @param aChannel audio channel.
+        * @param aCurrentVolume 
+        */
+        virtual void RcVolumeResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr, 
+            const TDesC8& aInstance, 
+            const TDesC8& aChannel, 
+            const TDesC8& aCurrentVolume) = 0; 
+        /**
+        * Observer callback for rendering control Set Mute.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aInstance rendering instance.
+        * @param aChannel audio channel.
+        * @param aDesiredMute 
+        */
+        virtual void RcSetMuteResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr, 
+            const TDesC8& aInstance, 
+            const TDesC8& aChannel, 
+            const TDesC8& aDesiredMute) = 0;
+        /**
+        * Observer callback for rendering control Get Mute.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aInstance rendering instance.
+        * @param aChannel audio channel.
+        * @param aCurrentMute 
+        */
+        virtual void RcMuteResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr, 
+            const TDesC8& aInstance, 
+            const TDesC8& aChannel, 
+            const TDesC8& aCurrentMute) = 0; 
+
+
+        /**
+        * Observer callback for rendering control AV set transport uri.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aInstance rendering instance.
+        * @param aCurrentUri Current transport URI.
+        * @param Current transport URI Metadata. 
+        */
+        virtual void AvtSetTransportUriResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aCurrentUri,
+            const TDesC8& aCurrentUriMetaData) = 0;
+        /**
+        * Observer callback for rendering control AV set next transport uri.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aInstance rendering instance.
+        * @param aCurrentUri Current transport URI.
+        * @param Current transport URI Metadata. 
+        */
+        virtual void AvtSetNextTransportUriResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aNextUri,
+            const TDesC8& aNextUriMetaData) = 0;
+        /**
+        * Observer callback for rendering control AV get media info response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aInstance rendering instance.
+        * @param aNrTracks Number of tracks.
+        * @param aMediaDuration 
+        * @param aCurrentUri Current transport URI.
+        * @param aCurrentUriMetaData Metadata of current trransport uri. 
+        * @param aNextUri Next transport URI.
+        * @param aNextUriMetaData Metadata of next trransport uri.
+        * @param aPlayMedium
+        * @param aRecordMedium
+        * @param aWriteStatus
+        */
+        virtual void AvtMediaInfoResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aNrTracks,
+            const TDesC8& aMediaDuration,
+            const TDesC8& aCurrentUri,
+            const TDesC8& aCurrentUriMetaData,
+            const TDesC8& aNextUri,
+            const TDesC8& aNextUriMetaData,
+            const TDesC8& aPlayMedium,
+            const TDesC8& aRecordMedium,
+            const TDesC8& aWriteStatus) = 0;
+        /**
+        * Observer callback for rendering control AV get transport info response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId
+        * @param aErr UPnP error code.
+        * @param aInstance rendering instance.
+        * @param aCurrenTransportState
+        * @param aCurrentTransportStatus
+        * @param aCurrentUri aCurrentSpeed
+        */
+        virtual void AvtGetTransportInfoResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aCurrenTransportState,
+            const TDesC8& aCurrentTransportStatus,
+            const TDesC8& aCurrentSpeed) = 0;
+        /**
+        * Observer callback for rendering control AV get position info response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aTrack rendering instance.
+        * @param aTrackDuration 
+        * @param aTrackMetaData
+        * @param aTrackURI
+        * @param aRelTime
+        * @param aAbsTime
+        * @param aRelCount
+        * @param aAbsCount
+        */
+        virtual void AvtPositionInfoResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aTrack,
+            const TDesC8& aTrackDuration,
+            const TDesC8& aTrackMetaData,
+            const TDesC8& aTrackURI,
+            const TDesC8& aRelTime,
+            const TDesC8& aAbsTime,
+            const TDesC8& aRelCount,
+            const TDesC8& aAbsCount) = 0;
+        /**
+        * Observer callback for rendering control AV get device capabilities response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aPlayMedia
+        * @param aRecMedia 
+        * @param aRecQualityModes
+        */
+        virtual void AvtDeviceCapabilitiesResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aPlayMedia,
+            const TDesC8& aRecMedia,
+            const TDesC8& aRecQualityMode) = 0;
+        /**
+        * Observer callback for rendering control AV get transport settings response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId
+        * @param aInstanceId
+        * @param aErr UPnP error code.        
+        * @param aPlayMode
+        * @param aRecQualityMode
+        */
+        virtual void AvtTransportSettingsResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aPlayMode,
+            const TDesC8& aRecQualityMode) = 0;
+        /**
+        * Observer callback for rendering control AV Stop response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        */
+        virtual void AvtStopResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId) = 0;
+        /**
+        * Observer callback for rendering control AV Play response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSpeed
+        */
+        virtual void AvtPlayResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aSpeed) = 0;
+        /**
+        * Observer callback for rendering control AV Pause response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        */
+        virtual void AvtPauseResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId) = 0;
+        /**
+        * Observer callback for rendering control AV Record response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        */
+        virtual void AvtRecordResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId) = 0;
+        /**
+        * Observer callback for rendering control AV Seek response.
+        * @since Series 60 2.6
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aUnit
+        * @param aTarget
+        */
+        virtual void AvtSeekResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aUnit,
+            const TDesC8& aTarget) = 0;
+        /**
+        * Observer callback for rendering control AV Next response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        */
+        virtual void AvtNextResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId) = 0;
+        /**
+        * Observer callback for rendering control AV Previous response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        */
+        virtual void AvtPreviousResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId) = 0;
+        /**
+        * Observer callback for rendering control AV setplay mode response.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aNewPlayMode
+        */
+        virtual void AvtSetPlayModeResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aNewPlayMode) = 0;
+        /**
+        * Observer callback for rendering control AV set record qualityresponse.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aNewRecordQuality
+        */
+        virtual void AvtSetRecordModeResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aNewRecordQuality) = 0;
+        /**
+        * Observer callback for Content Directory GetSearchCapabilities function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSearchCaps
+        */
+        virtual void CdsSearchCapabilitiesResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSearchCaps) = 0;
+        /**
+        * Observer callback for Content Directory GetSortCapabilities function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSortCaps
+        */
+        virtual void CdsSortCapabilitiesResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSortCaps) = 0;
+        /**
+        * Observer callback for Content Directory GetSystemUpdateID function.
+        * @since Series 60 2.6
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSystemUpdateId
+        */
+        virtual void CdsSystemUpdateIdResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            TInt aSystemUpdateId) = 0;
+        /**
+        * Observer callback for Content Directory Browse function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aObjectID
+        * @param aBrowseFlag
+        * @param aFilter
+        * @param aIndex
+        * @param arequest
+        * @param aSortCriteria
+        * @param aResult
+        * @param aReturned
+        * @param aMatches
+        * @param aUpdateID
+        */
+        virtual void CdsBrowseResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aObjectID,
+            const TDesC8&  aBrowseFlag,
+            const TDesC8&  aFilter,
+            TInt aIndex,
+            TInt aRequest,
+            const TDesC8&  aSortCriteria,
+            const TDesC8&  aResult,
+            TInt aReturned,
+            TInt aMatches,
+            const TDesC8&  aUpdateID) = 0;
+        /**
+        * Observer callback for Content Directory Search function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aContainerId
+        * @param aSearchCriteria
+        * @param aFilter
+        * @param aIndex
+        * @param arequest
+        * @param aSortCriteria
+        * @param aResult
+        * @param aReturned
+        * @param aMatches
+        * @param aUpdateID
+        */
+        virtual void CdsSearchResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aContainerId,
+            const TDesC8& aSearchCriteria,
+            const TDesC8& aFilter,
+            TInt aIndex,
+            TInt aRequest,
+            const TDesC8& aSortCriteria,
+            const TDesC8& aResult,
+            TInt aReturned,
+            TInt aMatches,
+            const TDesC8& aUpdateID) = 0;
+        /**
+        * Observer callback for Content Directory DestroyObject function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aObjectId
+        */
+        virtual void CdsDestroyObjectResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aObjectId ) = 0;
+        /**
+        * Observer callback for Content Directory UpdateObject function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aObjectId
+        * @param aCurrentTagValue
+        * @param aNewTagValue
+        */
+        virtual void CdsUpdateObjectResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aObjectId,
+            const TDesC8& aCurrentTagValue,
+            const TDesC8& aNewTagValue ) = 0;
+        /**
+        * Observer callback for Content Directory ImportResource function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSourceURI
+        * @param aDestinationURI
+        * @param aTransferId
+        */       
+        virtual void CdsImportResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSourceURI,
+            const TDesC8& aDestinationURI,
+            const TDesC8& aTransferId ) = 0;
+        /**
+        * Observer callback for Content Directory ExportResource function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSourceURI
+        * @param aDestinationURI
+        * @param aTransferId
+        */       
+        virtual void CdsExportResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSourceURI,
+            const TDesC8& aDestinationURI,
+            const TDesC8& aTransferId ) = 0;
+        /**
+        * Observer callback for Content Directory StopTransfer function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSourceURI
+        * @param aDestinationURI
+        * @param aTransferId
+        */       
+        virtual void CdsStopTransferResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aTransferId ) = 0;
+        /**
+        * Observer callback for Content Directory GetTransferProgress function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aTransferId
+        * @param aTransferStatus
+        * @param aTransferTotal
+        */         
+        virtual void CdsCTransferProgressResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aTransferId,
+            const TDesC8& aTransferStatus,
+            const TDesC8& aTransferLength,            
+            const TDesC8& aTransferTotal ) = 0;
+        /**
+        * Observer callback for Content Directory DeleteResource function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aResourceUri Resource to be deleted.
+        */ 
+        virtual void CdsDeleteResourceResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aResourceUri ) = 0;
+        /**
+        * Observer callback for Content Directory CreateReference function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aContainerId Destination folder.
+        * @param aObjectId Source object.
+        * @param aNewId Created reference.
+        */ 
+        virtual void CdsCreateReferenceResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aContainerId, 
+            const TDesC8& aObjectId, 
+            const TDesC8& aNewId ) = 0;
+        /**
+        * Observer callback for Content Directory CreateReference function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aContainerID Container in which new object is created.
+        * @param aElements Elements for item creation.
+        * @param aObjectID New objects ID.
+        * @param aResult Result of the action.
+        */ 
+        virtual void CdsCreateObjectResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aContainerID, 
+            const TDesC8& aElements, 
+            const TDesC8& aObjectID, 
+            const TDesC8& aResult ) = 0;
+
+        /**
+        * Observer callback for Connection Manager GetProtocolInfo function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSource
+        * @param aSink
+        */ 
+        virtual void CmProtocolInfoResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSource, 
+            const TDesC8& aSink ) = 0;
+        /**
+        * Observer callback for Connection Manager PrepareForConnection 
+        * function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aRemoteProtocolInfo
+        * @param aPeerConnectionManager
+        * @param aPeerConnectionId
+        * @param aDirection
+        * @param aConnection
+        * @param aTransport
+        * @param aRsc
+        */        
+        virtual void CmPrepareResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aRemoteProtocolInfo,
+            const TDesC8& aPeerConnectionManager,
+            const TDesC8& aPeerConnectionId,
+            const TDesC8& aDirection,
+            TInt aConnection,
+            TInt aTransport,
+            TInt aRsc ) = 0;
+        /**
+        * Observer callback for Connection Manager ConnectionComplete 
+        * function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aConnection
+        */         
+        virtual void CmComplete(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            TInt aConnection ) = 0;
+        /**
+        * Observer callback for Connection Manager GetCurrentConnectionIDs
+        * function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aConnection
+        */         
+        virtual void CmCurrentConnections(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aConnections) = 0;
+        /**
+        * Observer callback for Connection Manager GetCurrentConnectionInfo
+        * function.
+        * @since Series 60 2.6
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param rscId
+        * @param aProtocolInfo
+        * @param aPeerConnectionManager
+        * @param peerId
+        * @param aStatus
+        */   
+        virtual void CmCurrentInfo(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            TInt rscId, 
+            TInt transportId, 
+            const TDesC8& aProtocolInfo,
+            const TDesC8& aPeerConnectionManager, 
+            TInt peerId, 
+            const TDesC8& aDirection, 
+            const TDesC8& aStatus ) = 0;
+
+        //*****************************************************************
+        //Functions for UPnP event handling
+        //*****************************************************************
+        /**
+        * Content Directory SystemUpdateId event handler.
+        * @since Series 60 2.6
+        * @param aUuid Device UUID.
+        * @param aSystemUpdateId Device systemUpdateId.
+        */
+        virtual void CdsUpdateEvent(
+                const TDesC8& aUuid,
+                TInt aSystemUpdateId
+                ) = 0;
+        /**
+        * Content Directory ContainerUpdateIDs event handler.
+        * @since Series 60 2.6
+        * @param aUuid Device UUID.
+        * @param aConteinerIds Device container update ids.
+        */
+        virtual void CdsContainerEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aConteinerIds
+                ) = 0;
+        /**
+        * Content Directory TransferIDs event handler.
+        * @since Series 60 2.6
+        * @param aUuid Device UUID.
+        * @param aTransferIds Device transfer ids.
+        */
+        virtual void CdsTransferEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aTransferIds
+                ) = 0;
+        /**
+        * Rendering Control LastChange event handler.
+        * @since Series 60 2.6
+        * @param aUuid Device UUID.
+        * @param aLastChange Device LastChange statevariable.
+        */
+        virtual void RcLastChangeEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aLastChange
+                ) = 0;
+        /**
+        * AV Transport LastChange event handler.
+        * @since Series 60 2.6
+        * @param aUuid Device UUID.
+        * @param aLastChange Device LastChange statevariable.
+        */
+        virtual void AvtLastChangeEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aLastChange
+                ) = 0;
+        /**
+        * Connection Manager SourceEvent event handler.
+        * @since Series 60 2.6
+        * @param aUuid Device UUID.
+        * @param aSource Device's source info.
+        */
+        virtual void CmSourceEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aSource
+                ) = 0;
+        /**
+        * Connection Manager SinkEvent event handler.
+        * @since Series 60 2.6
+        * @param aUuid Device UUID.
+        * @param aSink Device's sink info.
+        */
+        virtual void CmSinkEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aSink
+                ) = 0;
+        /**
+        * Connection Manager ConnectionsEvent event handler.
+        * @since Series 60 2.6
+        * @param aUuid Device UUID.
+        * @param aConnections Devices connections.
+        */
+        virtual void CmConnectionsEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aConnections
+                ) = 0;
+        //*****************************************************************
+        // Device and http functions.
+        //*****************************************************************
+        /**
+        * Handles HTTP messages.
+        * @since Series 60 2.6
+        * @param aMessage Incoming HTTP message.
+        */
+        virtual void HttpResponseL(CUpnpHttpMessage* aMessage) = 0;
+
+        /**
+        * Handles UPnP device discoveries.
+        * @since Series 60 2.6
+        * @param aDevice Device that is discovered.
+        */
+        virtual void DeviceDiscoveredL(CUpnpDevice* aDevice) = 0;
+
+        /**
+        * Handles UPnP device disappears.
+        * @since Series 60 2.6
+        * @param aDevice Device that disappeared.
+        */
+        virtual void DeviceDisappearedL(CUpnpDevice* aDevice) = 0;
+    };
+
+#endif      // C_MUPNPAVCONTROLPOINTOBSERVER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_avcp_api/upnp_avcp_api.metaxml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="2c4df520ba7b3bfdf00d0a8971c63ce3" dataversion="1.0">
+  <name>UPnP AVCP API</name>
+  <description>Functions for controlling media server and media renderer UPnP devices and their AV services (Content Directory, Connection Manager, AV Transport, Rendering Control).</description>
+  <type>c++</type>
+  <subsystem>upnpavcontrolpoint</subsystem>
+  <libs>
+    <lib name="avcontrolframework.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_command_api/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+/** @file
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  exports the files belonging to UPnP Command API
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/upnpshowcommand.h            MW_LAYER_PLATFORM_EXPORT_PATH(upnpshowcommand.h)
+../inc/upnpcopycommand.h            MW_LAYER_PLATFORM_EXPORT_PATH(upnpcopycommand.h)
+../inc/upnpmovecommand.h            MW_LAYER_PLATFORM_EXPORT_PATH(upnpmovecommand.h)
+../inc/upnpbrowsecommand.h          MW_LAYER_PLATFORM_EXPORT_PATH(upnpbrowsecommand.h)
+../inc/upnprunsetupcommand.h        MW_LAYER_PLATFORM_EXPORT_PATH(upnprunsetupcommand.h)
+../inc/upnpcommandobserver.h        MW_LAYER_PLATFORM_EXPORT_PATH(upnpcommandobserver.h)
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_command_api/inc/upnpbrowsecommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,102 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class to ease the use of the Upnp Framework's
+*                UpnpCommand API when browsing the Upnp home network.
+*
+*/
+
+
+#ifndef UPNP_BROWSE_COMMAND_H
+#define UPNP_BROWSE_COMMAND_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpCommand;
+
+// CLASS DEFINITION
+class CUpnpBrowseCommand: public CBase
+    {
+
+    public: // Construction/destruction methods
+
+        /**
+         * Creates a new UpnpCommand for Upnp home network browsing purposes.
+         * Does not instantiate Upnp Framework services yet at this point.
+         *
+         * Leaves with KErrNotReady if Upnp dedicated IAP is not set, or with
+         * using standard e32err.h error code if construction fails.
+         *
+         * @since S60 3.2
+         * @return a new CUpnpBrowseCommand object
+         */
+        IMPORT_C static CUpnpBrowseCommand* NewL();
+
+        /**
+         * Destructor.
+         *
+         * @since S60 3.2
+         */
+        virtual ~CUpnpBrowseCommand();
+
+    public: // Business logic methods
+
+        /**
+         * Returns the availability information of the command.
+         *
+         * @since S60 3.2
+         * @return TBool (ETrue if available)
+         */
+        IMPORT_C static TBool IsAvailableL();
+
+        /**
+         * Allocates Upnp Framework resources, and initiates Upnp home network
+         * browsing.
+         *
+         * Leaves if the operation fails. Standard system wide (e32err.h)
+         * error codes will be used.
+         *
+         * @since S60 3.2
+         */
+        IMPORT_C void BrowseHomeNetworkL();
+
+    private: // Private construction methods
+
+        /**
+         * Constructor
+         *
+         * @since S60 3.2
+         */
+        CUpnpBrowseCommand();
+
+        /**
+         * Second phase constructor
+         *
+         * @since S60 3.2
+         */
+        void ConstructL();
+
+    private: // Data members
+
+        /*
+         * UpnpCommand instance, owned
+         */
+        CUpnpCommand*    iCommand;
+
+    };
+
+#endif // UPNP_BROWSE_COMMAND_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_command_api/inc/upnpcommandobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,58 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UpnpCommand ECom plugin. Defines the
+*                Upnp Framework's UpnpCommand callback API.
+*
+*/
+
+
+#ifndef UPNP_COMMAND_OBSERVER_H
+#define UPNP_COMMAND_OBSERVER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+const TInt KUpnpCommandStatusStartPlayVideo = 6; // video is ready to be played.
+
+/**
+* UpnpCommand Observer interface class definition.
+*
+* @since S60 3.2
+*/
+class MUpnpCommandObserver
+    {
+
+    public:
+
+        /**
+        * Indicates that the command has been completed.
+        *
+        * If the WLAN connection or the target device is lost,
+        * KErrDisconnected will be returned.
+        * 
+        * When video is ready to be played (launching 
+        * videoplayerdialog), KUpnpCommandStatusStartPlayVideo 
+        * will be returned.
+        *
+        * @since S60 3.2
+        * @param aStatusCode (TInt) status code
+        */
+        virtual void CommandComplete( TInt aStatusCode ) = 0;
+
+    };
+
+#endif // UPNP_COMMAND_OBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_command_api/inc/upnpcopycommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,125 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class to ease the use of the Upnp Framework's
+*                UpnpCommand API when copying files via Upnp.
+*
+*/
+
+
+#ifndef UPNP_COPY_COMMAND_H
+#define UPNP_COPY_COMMAND_H
+
+// INCLUDES
+#include <badesca.h>                  // CDesCArrayFlat
+
+// FORWARD DECLARATIONS
+class CUpnpCommand;
+
+// CLASS DEFINITION
+class CUpnpCopyCommand: public CBase
+    {
+
+    public: // Construction/destruction methods
+
+        /**
+         * Creates a new UpnpCommand for file copying purposes. Does not
+         * instantiate Upnp Framework services yet at this point.
+         *
+         * Leaves with KErrNotReady if Upnp dedicated IAP is not set, or with
+         * using standard e32err.h error code if construction fails.
+         *
+         * @since S60 3.2
+         * @return a new CUpnpCopyCommand object
+         */
+        IMPORT_C static CUpnpCopyCommand* NewL();
+
+        /**
+         * Destructor.
+         *
+         * @since S60 3.2
+         */
+        virtual ~CUpnpCopyCommand();
+
+    public: // Business logic methods
+
+        /**
+         * Returns the availability information of the command.
+         *
+         * @since S60 3.2
+         * @return TBool (ETrue if available)
+         */
+        IMPORT_C static TBool IsAvailableL();
+
+        /**
+         * Copies the given list of files to a remote Upnp Media Server. The
+         * method is synchronous. The target server device will be queried
+         * from the user using an UI component.
+         *
+         * The files that are successfully copied are removed from the array.
+         * DRM protected files are skipped (not copied and left in the array)
+         *
+         * Leaves if the operation fails. Standard system wide (e32err.h)
+         * error codes will be used.
+         *
+         * @since S60 3.2
+         * @param aFiles (CDesCArrayFlat*) list of filenames (including path)
+         */
+        IMPORT_C void CopyFilesL( CDesCArrayFlat* aFiles );
+
+        /**
+         * Copies the given playlist (playlist name + filenames) to a remote
+         * Upnp Media Server. The method is synchronous. The target server
+         * device will be queried from the user using an UI component.
+         *
+         * The files that are successfully copied are removed from the array.
+         * DRM protected files are skipped (not copied and left in the array).
+         *
+         * Leaves if the operation fails. Standard system wide (e32err.h)
+         * error codes will be used.
+         *
+         * @since S60 3.2
+         * @param aPlaylistName (const TDesC&) name of the playlist
+         * @param aFiles (CDesCArrayFlat*) list of filenames (including path)
+         */
+        IMPORT_C void CopyPlaylistL( const TDesC& aPlaylistName,
+                                     CDesCArrayFlat* aFiles );
+
+    private: // Private construction methods
+
+        /**
+         * Constructor
+         *
+         * @since S60 3.2
+         */
+        CUpnpCopyCommand();
+
+        /**
+         * Second phase constructor
+         *
+         * @since S60 3.2
+         */
+        void ConstructL();
+
+    private: // Data members
+
+        /*
+         * UpnpCommand instance. Owned.
+         */
+        CUpnpCommand*    iCommand;
+
+    };
+
+#endif // UPNP_COPY_COMMAND_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_command_api/inc/upnpmovecommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class to ease the use of the Upnp Framework's
+*                UpnpCommand API when moving files via Upnp.
+*
+*/
+
+
+#ifndef UPNP_MOVE_COMMAND_H
+#define UPNP_MOVE_COMMAND_H
+
+// INCLUDES
+#include <badesca.h>                  // CDesCArrayFlat
+
+// FORWARD DECLARATIONS
+class CUpnpCommand;
+
+// CLASS DEFINITION
+class CUpnpMoveCommand: public CBase
+    {
+
+    public: // Construction/destruction methods
+
+        /**
+         * Creates a new UpnpCommand for file moving purposes. Does not
+         * instantiate Upnp Framework services yet at this point.
+         *
+         * Leaves with KErrNotReady if Upnp dedicated IAP is not set, or with
+         * using standard e32err.h error code if construction fails.
+         *
+         * @since S60 3.2
+         * @return a new CUpnpMoveCommand object
+         */
+        IMPORT_C static CUpnpMoveCommand* NewL();
+
+        /**
+         * Destructor.
+         *
+         * @since S60 3.2
+         */
+        virtual ~CUpnpMoveCommand();
+
+    public: // Business logic methods
+
+        /**
+         * Returns the availability information of the command.
+         *
+         * @since S60 3.2
+         * @return TBool (ETrue if available)
+         */
+        IMPORT_C static TBool IsAvailableL();
+
+        /**
+         * Moves the given list of files to a remote Upnp Media Server. The
+         * method is synchronous. The target server device will be queried
+         * from the user using an UI component.
+         *
+         * The files that are successfully moved are removed from the array.
+         * DRM protected files are skipped (not copied and left in the array)
+         *
+         * Leaves if the operation fails. Standard system wide (e32err.h)
+         * error codes will be used.
+         *
+         * @since S60 3.2
+         * @param aFiles (CDesCArrayFlat*) list of filenames (including path)
+         */
+        IMPORT_C void MoveFilesL( CDesCArrayFlat* aFiles );
+
+    private: // Private construction methods
+
+        /**
+         * Constructor
+         *
+         * @since S60 3.2
+         */
+        CUpnpMoveCommand();
+
+        /**
+         * Second phase constructor
+         *
+         * @since S60 3.2
+         */
+        void ConstructL();
+
+    private: // Data members
+
+        /*
+         * UpnpCommand instance. Owned.
+         */
+        CUpnpCommand*    iCommand;
+
+    };
+
+#endif // UPNP_MOVE_COMMAND_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_command_api/inc/upnprunsetupcommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,102 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class to ease the use of the Upnp Framework's
+*                UpnpCommand API when running the Upnp Fw's setup wizard.
+*
+*/
+
+
+#ifndef UPNP_RUN_SETUP_COMMAND_H
+#define UPNP_RUN_SETUP_COMMAND_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpCommand;
+
+// CLASS DEFINITION
+class CUpnpRunSetupCommand: public CBase
+    {
+
+    public: // Construction/destruction methods
+
+        /**
+         * Creates a new UpnpCommand for running the Upnp Fw setup wizard.
+         * Does not instantiate Upnp Framework services yet at this point.
+         *
+         * Leaves with KErrNotReady if Upnp dedicated IAP is not set, or with
+         * using standard e32err.h error code if construction fails.
+         *
+         * @since S60 3.2
+         * @return a new CUpnpRunSetupCommand object
+         */
+        IMPORT_C static CUpnpRunSetupCommand* NewL();
+
+        /**
+         * Destructor.
+         *
+         * @since S60 3.2
+         */
+        virtual ~CUpnpRunSetupCommand();
+
+    public: // Business logic methods
+
+        /**
+         * Returns the availability information of the command.
+         *
+         * @since S60 3.2
+         * @return TBool (ETrue if available)
+         */
+        IMPORT_C static TBool IsAvailableL();
+
+        /**
+         * Allocates Upnp Framework resources, and starts up the Upnp Fw's
+         * setup wizard.
+         *
+         * Leaves if the operation fails. Standard system wide (e32err.h)
+         * error codes will be used.
+         *
+         * @since S60 3.2
+         */
+        IMPORT_C void RunSetupL();
+
+    private: // Private construction methods
+
+        /**
+         * Constructor
+         *
+         * @since S60 3.2
+         */
+        CUpnpRunSetupCommand();
+
+        /**
+         * Second phase constructor
+         *
+         * @since S60 3.2
+         */
+        void ConstructL();
+
+    private: // Data members
+
+        /*
+         * UpnpCommand instance. Owned.
+         */
+        CUpnpCommand*    iCommand;
+
+    };
+
+#endif // UPNP_RUN_SETUP_COMMAND_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_command_api/inc/upnpshowcommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,177 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class to ease the use of the Upnp Framework's
+*                UpnpCommand API when showing images and videos via Upnp.
+*
+*/
+
+
+#ifndef UPNP_SHOW_COMMAND_H
+#define UPNP_SHOW_COMMAND_H
+
+// INCLUDES
+#include <e32base.h>                // CBase
+
+// FORWARD DECLARATIONS
+class CUpnpCommand;
+class MUpnpCommandObserver;
+class CUpnpCommandCallbackAdapter;
+
+
+// CLASS DEFINITION
+class CUpnpShowCommand: public CBase
+    {
+
+    public: // Construction/destruction methods
+
+        /**
+         * Creates a new UpnpCommand for image and video showing purposes.
+         * Does not instantiate Upnp Framework services yet at this point.
+         *
+         * Leaves with KErrNotReady if Upnp dedicated IAP is not set, or with
+         * using standard e32err.h error code if construction fails.
+         *
+         * @since S60 3.2
+         * @return a new CUpnpShowCommand object
+         */
+        IMPORT_C static CUpnpShowCommand* NewL();
+
+        /**
+         * Creates a new UpnpCommand for image and video showing purposes.
+         * Does not instantiate Upnp Framework services yet at this point.
+         *
+         * Leaves if the given observer instance is not valid.
+         *
+         * @since S60 3.2
+         * @param aObserver (MUpnpCommandObserver*) The observer instance
+         * @return a new CUpnpShowCommand object
+         */
+        IMPORT_C static CUpnpShowCommand* NewL(
+            MUpnpCommandObserver* aObserver );
+
+        /**
+         * Destructor.
+         *
+         * @since S60 3.2
+         */
+        virtual ~CUpnpShowCommand();
+
+    public: // Business logic methods
+
+        /**
+         * Returns the availability information of the command.
+         *
+         * @since S60 3.2
+         * @return TBool (ETrue if available)
+         */
+        IMPORT_C static TBool IsAvailableL();
+
+        /**
+         * Starts showing. Allocates Upnp Framework resources. The target
+         * rendering device will be queried from the user using an UI
+         * component. Local Media Server sharing will be activated (if not
+         * yet activated).
+         *
+         * Leaves if the Upnp Framework resource allocation fails. Standard
+         * system wide (e32err.h) error codes will be used.
+         *
+         * @since S60 3.2
+         */
+        IMPORT_C void StartShowingL();
+
+        /**
+         * Stops showing. Releases all Upnp Framework resources. Local Media
+         * Server sharing state will be returned to it's original state.
+         *
+         * Leaves if the operation fails. Standard system wide (e32err.h)
+         * error codes will be used.
+         *
+         * @since S60 3.2
+         */
+        IMPORT_C void StopShowingL();
+
+        /**
+         * Shows the given images on a remote Upnp Media Rendering device.
+         * The method is asynchronous. Upnp Framework resources will be 
+         * allocated, if not yet allocated (by calling StartShowingL). 
+         *
+         * MUpnpCommandObserver::CommandComplete callback method is used to
+         * delived the return the return code of the operation.
+         *
+         * Leaves if the operation fails, or if the user cancels the
+         * operations. Standard system wide (e32err.h) error codes will be
+         * used.
+         *
+         * @since S60 3.2
+         * @param aFilename (const TDesC&) filename (including path)
+         */
+        IMPORT_C void ShowImageL( const TDesC& aFilename );
+
+        /**
+         * Shows the given video on a remote Upnp Media Rendering device. The
+         * method is asynchronous. Upnp Framework resources will be allocated,
+         * if not yet allocated (by calling StartShowingL). 
+         *
+         * MUpnpCommandObserver::CommandComplete callback method is used to
+         * delived the return the return code of the operation.
+         *
+         * Leaves if the operation fails, or if the user cancels the
+         * operations. Standard system wide (e32err.h) error codes will be
+         * used.
+         *
+         * @since S60 3.2
+         * @param aFilename (const TDesC&) filename (including path)
+         */
+        IMPORT_C void ShowVideoL( const TDesC& aFilename );
+
+    private: // Private construction methods
+
+        /**
+         * Constructor
+         *
+         * @since S60 3.2
+         * @param aObserver (MUpnpCommandObserver*) The observer instance
+         *        can be NULL
+         */
+        CUpnpShowCommand( MUpnpCommandObserver* aObserver );
+
+        /**
+         * Second phase constructor
+         *
+         * @since S60 3.2
+         */
+        void ConstructL();
+
+    private: // Data members
+
+        /*
+         * UpnpCommand instance. Owned.
+         */
+        CUpnpCommand*               iCommand;
+
+        /*
+         * Observer instance. Not owned.
+         */
+        MUpnpCommandObserver*       iObserver;
+
+        /*
+         * Callback adapter. Owned.
+         */
+        CUpnpCommandCallbackAdapter* iAdapter;
+
+    };
+
+#endif // UPNP_SHOW_COMMAND_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_command_api/upnp_command_api.metaxml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="71017ac67649c84e150cbfc46b1bf6f1" dataversion="1.0">
+  <name>UPnP Command API</name>
+  <description>API for UPnP commands</description>
+  <type>c++</type>
+  <subsystem>upnpframework</subsystem>
+  <libs>
+    <lib name="upnpcommand.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_api/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,30 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                UPnP Media Server API
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/upnpmediaserverclient.h            MW_LAYER_PLATFORM_EXPORT_PATH(upnpmediaserverclient.h)
+../inc/upnpmediaserverobserver.h          MW_LAYER_PLATFORM_EXPORT_PATH(upnpmediaserverobserver.h)
+../inc/upnpmediaservernotifier.h          MW_LAYER_PLATFORM_EXPORT_PATH(upnpmediaservernotifier.h)
+../inc/upnpmediaserverstatuswatcher.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpmediaserverstatuswatcher.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_api/inc/upnpmediaserverclient.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,436 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server Client
+*
+*/
+
+#ifndef C_CUPNPMEDIASERVERCLIENT_H
+#define C_CUPNPMEDIASERVERCLIENT_H
+
+// INCLUDES
+
+#include <e32base.h>
+#include <in_sock.h>
+#include "upnpicon.h"
+#include "upnpsessionbase.h"
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+
+// CLASS DECLARATION
+
+/**
+@brief Client-side interface to Media Server
+
+This class provides the client-side interface to the media server session
+*/
+class RUpnpMediaServerClient : public RUpnpSessionBase
+    {
+
+public:
+    //Media Server operational status
+    enum TServerStatus
+        {
+        EStartedOnline,
+        EStartedOffline,
+        EStopped
+        };
+
+    enum TServerStopMode
+        {
+        EStopNormal,
+        EStopSilent
+        };
+
+public: // exported methods
+
+    IMPORT_C void Close();
+    /**
+    * Constructs the object
+    */
+    IMPORT_C RUpnpMediaServerClient();
+
+    /**
+    * RMediaServerClient checks if Media Server Engine exists. If not creates new process.
+    * During Media Server Engine process initialization the CUpnpMediaServer class is instantiated.
+    * When Media Server Engine is created RMediaServerClient creates session to it.
+    * Each time session is created the session counter is incremented.
+    * Note: During a first start the private directory structure is created and
+    *       device/service description files are copied there from Z: drive.
+    * @return error code
+    */
+    IMPORT_C TInt Connect();
+
+    /**
+    * Stops the media server.
+    * This operation is complementary to Start operation.
+    * It destroys all services and device itself.
+    * The Media Server process is not terminated, it goes to a idle state.
+    *
+    * @param aMode one of the following modes:
+    *    - EStopNormal - ssdp:bye-bye messages are sent before stop (the same as stop)
+    *    - EStopSilent - server is stopped silently without ssdp:bye-bye messages
+    *
+    * Note: Process is terminated when last session is disconnected and
+    *       media Server Engine is stopped.
+    *       To disconnect session use: RMediaServerClient::Close() which is inherited
+    *       from RSessionBase();
+    * @return error code
+    */
+    IMPORT_C TInt Stop( TServerStopMode aMode );
+
+    /**
+    * Stops media server. It equals to the Stop( EStopNormal ).
+    *
+    * @return error code
+    */
+    IMPORT_C TInt Stop();
+
+    /**
+    * Starts media server - UPnP device.
+    * Sets device description values accoriding to Content Directory settings.
+    * After that instantiates services needed for Media Server operation:
+    * - Content Directory Service
+    * - Connection Manager Service
+    * Finally sets internal status variable to true (that means server is up and running).
+    *
+    * Panic occurs if session is not connected.
+    * Returns one of the system-wide error codes in case of wrong Central Repository settings:
+    * - KUPnPStackIapId
+    * - KUpnpMediaServerMediaTypes
+    *
+    * KErrNotFound – if following Central Repository settings has empty values.
+    * - KUpnpMediaServerFriendlyName
+    * - KUpnpMediaServerManufacturer
+    * - KUpnpMediaServerModelName
+    * @return error code
+    */
+    IMPORT_C TInt Start();
+
+    /**
+    * Starts media server in offline mode, Media Server is not visible in UPnP network
+    * It instantiate only Content Directory without Upnp framework.
+    * This mode is used for local sharing purpose.
+    * @return error code
+    */
+    IMPORT_C TInt StartOffline();
+
+    /**
+    * Starts media server (asynchonous version)
+    * See Start() description for details
+    * @return error code
+    */
+    IMPORT_C void Start(TRequestStatus& aStatus);
+
+    /**
+    * This operation performs restart on CUpnpDevice only.
+    * This causes sending "bye-bye" and "alive" notification to the network.
+    * In order to activate changes in Central Repository use Stop()/Start()
+    * sequence.
+    * @return error code
+    */
+    IMPORT_C TInt Restart();
+
+    /**
+    * Gets media server operational status
+    * @return error code
+    */
+    IMPORT_C TInt Status( TInt& aStat );        
+    
+    /**
+    * Gets media server inet address
+    * @return error code
+    */
+    IMPORT_C TInt GetAddress( TInetAddr& aAddr );
+
+    /**
+    * Gets media server inet address asynchronously
+    * @return error code
+    */
+    IMPORT_C void GetAddressL( TInetAddr& aAddr, TRequestStatus& aStatus );
+
+    /**
+    * Method performs 2 steps:
+    * 1. Changes Central Repository KUpnpMediaServerUploadDirectory key value,
+    * 2. Forces Media Server to switch to new upload directory.
+    *
+    * Note: In case of Media Server is not started request status is set to KErrNotReady,
+    *       but Central Repository key is changed.
+    *       During starting Media Server is initiated with new value.
+    *       First param aPath should end with double backslash ('\\').
+    *       for example default value equals c:\\Download\\Media\\
+    * @param aPath upload directory path
+    * @param aStatus request status
+    */
+    IMPORT_C void SetUploadDirectoryL( const TDesC& aPath, TRequestStatus& aStatus );
+
+    /**
+    * Adds new icon to Media Server.
+    * Media Server performs the following operations:
+    * - copies file from path specified aIcon object
+    *   to its private directory,
+    * - adds icon element to its device description XML file
+    *
+    * @param aIcon icon
+    * @param aStatus request status
+    */
+    IMPORT_C void AddIcon( CUpnpIcon* aIcon, TRequestStatus& aStatus);
+
+    /**
+    * Removes icon of given url.
+    * Media Server performs the following operations:
+    * - deletes its private copy of icon file,
+    * - deletes respective icon element from description XML flie
+    * Usage example:
+    *
+    * iIcon = CUpnpIcon::NewL(aPath, aWidth, aHeight, aDepth, aMimeType);
+    * iDevice.SetIcon( iIcon );
+    *
+    * @param aUrl icon url from XML description
+    * @param aStatus
+    */
+    IMPORT_C void RemoveIcon( TDes8& aUrl, TRequestStatus& aStatus);
+
+    /**
+    * Removes all icons
+    * Media Server performs the following operations:
+    * - deletes all private copies of icon files,
+    * - deletes all icon elements from description XML flie
+    *
+    * @param aStatus
+    */
+    IMPORT_C void RemoveIcons( TRequestStatus& aStatus);
+
+    /**
+    * Updates icon of given url.
+    * Media Server performs the following operations:
+    * - replaces its private copy of icon file,
+    * - replaces respective icon element from description XML flie
+    *   url value remains unchanged
+    *
+    * @param aUrl icon url from XML description
+    * @param aIcon icon
+    * @param aStatus
+    */
+    IMPORT_C void UpdateIcon( TDes8& aUrl, CUpnpIcon* aIcon, TRequestStatus& aStatus);
+
+public: // File sharing related methods
+
+    /**
+    * Shares item
+    * @param aSend
+    * @param aRcvdBufSize
+    * @param aStatus request status
+    * @return the version
+    */
+    void ShareItem( TDes8& aSend, TDes8& aRcvdBufSize, TRequestStatus& aStatus);
+
+    /**
+    * Gets share item result
+    * @param aResult buffer for result
+    * @param aStatus request status
+    * @return the version
+    */
+    void ShareItemResult( TDes8& aResult, TRequestStatus& aStatus);
+
+
+    /**
+    * Shares container
+    * @param aStatus request status
+    * @return the version
+    */
+    void ShareContainer( TDes8& aSend, TDes8& aRcvd, TRequestStatus& aStatus);
+
+    /**
+    * Gets share container result
+    * @param aResult buffer for result
+    * @param aStatus request status
+    * @return the version
+    */
+    void ShareContainerResult( TDes8& aResult, TRequestStatus& aStatus);
+
+    /**
+    * Shares item list
+    * @param aSend
+    * @param aStatus request status
+    * @return the version
+    */
+    void ShareItemList( TDes8& aSend, TDes8& aRcvd, TRequestStatus& aStatus);
+
+    /**
+    * Gets share item result
+    * @param aResult buffer for result
+    * @param aStatus request status
+    * @return the version
+    */
+    void ShareItemListResult( TDes8& aResult, TDes8& aExecStatus, TRequestStatus& aStatus);
+
+    /**
+    * Unshares root
+    * @param aStatus request status
+    * @return the version
+    */
+    void UnshareRoot(TRequestStatus& aStatus);
+
+    /**
+    * Unshares item
+    * @param aStatus request status
+    * @return the version
+    */
+    void UnshareItem(TInt aItemId, TRequestStatus& aStatus);
+
+    /**
+    * Unshares container
+    * @param aStatus request status
+    * @return the version
+    */
+
+    void UnshareContainer(TInt aItemId, TRequestStatus& aStatus);
+    /**
+    * Gets shared item
+    * @param aStatus request status
+    * @return the version
+    */
+    void GetSharedItem(TInt aItemId, TDes8& aRcvdBufSize, TRequestStatus& aStatus);
+
+    /**
+    * Gets shared item result
+    * @param aResult buffer for result
+    * @param aStatus request status
+    * @return the version
+    */
+    void GetSharedItemResult( TDes8& aResult, TRequestStatus& aStatus);
+
+    /**
+    * Gets shared container
+    * @param aStatus request status
+    * @return the version
+    */
+    void GetSharedContainer(TInt aContainerId, TDes8& aRcvdBufSize, TRequestStatus& aStatus);
+
+    /**
+    * Gets shared container result
+    * @param aResult buffer for result
+    * @param aStatus request status
+    * @return the version
+    */
+    void GetSharedContainerResult( TDes8& aResult, TRequestStatus& aStatus);
+
+    /**
+    * Unshares item list
+    * @param aStatus request status
+    * @return the version
+    */
+    void UnshareItemListL(TDes8& aSend, TDes8& aExecStatus, TRequestStatus& aStatus);
+
+    /**
+    * Gets shared item list
+    * @param aStatus request status
+    * @return the version
+    */
+    void GetSharedItemList(TInt aContainerId, TDes8& aSend, TDes8& aRcvdBufSize,
+        TRequestStatus& aStatus);
+
+    /**
+    * Gets shared item list result
+    * @param aResult buffer for result
+    * @param aStatus request status
+    * @return the version
+    */
+    void GetSharedItemListResult(TDes8& aResult, TDes8& aTotalMatches,
+        TRequestStatus& aStatus);
+
+    /**
+    * Gets shared container list
+    * @param aStatus request status
+    * @return the version
+    */
+    void GetSharedContainerList(TInt aContainerId, TDes8& aSend, TDes8& aRcvdBufSize,
+        TRequestStatus& aStatus);
+
+    /**
+    * Gets shared container list results
+    * @param aResult buffer for result
+    * @param aStatus request status
+    * @return the version
+    */
+    void GetSharedContainerListResult(TDes8& aResult, TDes8& aTotalMatches,
+        TRequestStatus& aStatus);
+
+    /**
+    * Creates a single reference upon given object
+    * @param aSend
+    * @param aRcvdBufSize
+    * @param aStatus request status
+    * @return the version
+    */
+    void ShareReference( TDes8& aSend, TDes8& aRcvdBufSize, TRequestStatus& aStatus );
+
+    /**
+    * Creates some reference items, located at specific container, pointing specific objects
+    * @param aSend
+    * @param aRcvdBufSize
+    * @param aStatus request status
+    */
+    void ShareReferenceList( TDes8& aSend, TDes8& aRcvdBufSize, TRequestStatus& aStatus );
+    
+public: // Event handling related methods
+
+    /**
+    * Subscribe Media Server events
+    * @param aStatus request status
+    */
+    void SubscribeEvents(TRequestStatus& aStatus);
+
+    /**
+    * Unsubscribe Media Server events
+    */
+    void UnsubscribeEvents();
+
+    /**
+    * Requests single events list
+    * @param aEventSize size of buffer for events list to be allocated by client
+    * @param aStatus request status
+    */
+    void ListenTransferEvent(TDes8& aEventSize, TRequestStatus& aStatus);
+
+    /**
+    * Requests single events list body
+    * @param aResult buffer for events list
+    * @param aStatus request status
+    */
+    void GetTransferEventBody(TDes8& aResult, TRequestStatus& aStatus);
+    
+public: // Notify status change related methods     
+   
+    /**
+    * Notify about media server operational status
+    * @param aStatus request status
+    */
+    void StatusChangeNotify( TRequestStatus& aStatus );
+    
+    /**
+    * Cancel notifycation about media server operational status
+    */
+    void CancelStatusChangeNotify();
+
+private:
+
+    // holds inet address
+    TPckg<TInetAddr>* iAddressPkg;
+    };
+
+#endif // C_CUPNPMEDIASERVERCLIENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_api/inc/upnpmediaservernotifier.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,118 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server notifier
+*
+*/
+
+
+#ifndef C_CUPNPMEDIASERVERNOTIFIER_H
+#define C_CUPNPMEDIASERVERNOTIFIER_H
+
+// INCLUDES
+#include "upnpmediaserverclient.h"
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MUpnpMediaServerObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Class wrapps asynchronous communication with Media Server Engine
+*  in scope of eventing. New RUpnpMediaServerClient session is opened
+*  for each CUpnpMediaServerNotifier object.
+*  Events are automatically subscribed during object
+*  construction and unsubscribed during object destruction.
+*  Event observer must be derived from MUpnpMediaServerObserver.
+*
+*  @since Series 60 3.1
+*/
+class CUpnpMediaServerNotifier : public CActive
+    {
+public:
+
+    enum TNotifierAction
+        {
+        ENoAction = 1,
+        ESubscribe,
+        EListenEvent,
+        EGetEventBody
+        };
+
+    /**
+    * Two-phased constructor. Subscribes events during construction phase.
+    * @since Series 60 3.1
+    * @param aObserver event observer
+    * @return notifier object
+    */
+    IMPORT_C static CUpnpMediaServerNotifier* NewL( MUpnpMediaServerObserver* aObserver );
+
+    /**
+    * Two-phased constructor. Subscribes events during construction phase.
+    * @since Series 60 3.1
+    * @param aObserver event observer
+    * @return notifier object
+    */
+    IMPORT_C static CUpnpMediaServerNotifier* NewLC( MUpnpMediaServerObserver* aObserver );
+
+    /**
+    * Destructor. Usubscribes
+    */
+	virtual ~CUpnpMediaServerNotifier();
+
+private:
+    /**
+    * Cancellation of ongoing asynchronous operation (from CActive)
+    */
+	void DoCancel();
+
+    /**
+    * RunL (from CActive)
+    */
+	void RunL();
+
+    /**
+    * RunError (from CActive)
+    */
+    TInt RunError(TInt aError);
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    /**
+    * Constructor.
+    */
+    CUpnpMediaServerNotifier( MUpnpMediaServerObserver* aObserver );
+
+private:
+    //Upnp Media Server Client
+	RUpnpMediaServerClient iMediaServerClient;
+    //Pending action, state of active object
+    TNotifierAction  iPendingAction;
+    //Media Server observer
+    MUpnpMediaServerObserver* iObserver;
+
+    //Size of buffer for response to be allocated by client
+    TInt            iRespBufSize;
+    TPckg<TInt>     iRespBufSizePkg;
+
+    //Buffer for response
+    HBufC8*         iReceiveBuffer;
+    TPtr8           iReceiveBufferPtr;
+    };
+
+#endif // C_CUPNPMEDIASERVERNOTIFIER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_api/inc/upnpmediaserverobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,60 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server observer
+*
+*/
+
+
+#ifndef C_CUPNPMEDIASERVEROBSERVER_H
+#define C_CUPNPMEDIASERVEROBSERVER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+class CUpnpFileTransferEvent;
+// CLASS DECLARATION
+
+/**
+*  Interface for Media Server events listeners
+*
+*  @since Series 60 3.1
+*/
+class MUpnpMediaServerObserver
+    {
+public:
+
+    /**
+    * Called when Content Directory file transfer is finished
+    * either with success or failure.
+    * See CUpnpFileTransferEvent class description for details.
+    *
+    * @since Series 60 3.1
+    * @param aEvents Media Server event
+    * @return notifier object
+    */
+    virtual void FileTransferEvent(CUpnpFileTransferEvent *aEvent) = 0;
+
+    /**
+    * Called in case of CUpnpMediaServerNotifier internal error.
+    * Should be used for event handling recovery.
+    *
+    * @since Series 60 3.1
+    * @param aObserver event observer
+    * @return notifier object
+    */
+    virtual void NotifierError(TInt aError) = 0;
+    };
+#endif // C_CUPNPMEDIASERVEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_api/inc/upnpmediaserverstatuswatcher.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,155 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server Client
+*
+*/
+
+#ifndef C_UPNPMEDIASERVERSTATUSWATCHER_H
+#define C_UPNPMEDIASERVERSTATUSWATCHER_H
+
+// INCLUDES
+
+#include <e32base.h>
+#include "upnpmediaserverclient.h"
+
+    
+/**
+* Observer for media server status chnges
+**/
+class MUpnpMediaServerStatusObserver
+    {
+public:
+    // media server status
+    enum TServerState
+        {
+        EStartedOnline,
+        EStartedOffline,
+        EStopped
+        };
+    
+public:
+    /**
+    * Inform about media server status change event
+    * called when media server status has changed
+    * @param aState new media server status
+    */
+    virtual void StatusChanged( MUpnpMediaServerStatusObserver::TServerState aState ) = 0;
+    
+    /**
+    * Inform about subscribtion error
+    * called when media server status subscription has failed
+    * @param aError subscription error
+    */
+    virtual void SubscribeError( TInt aError ) = 0;
+    };
+
+/**
+* Watches media server status
+**/
+NONSHARABLE_CLASS( CUpnpMediaServerStatusWatcher ): public CActive
+    {           
+public:
+    /**
+    * Two-phased constructor. Subscribes events for media server status
+    * session to server is maintained by the class
+    * @since Series 60 5.0 HN
+    * @param aObserver event observer    
+    * @return watcher object
+    */
+    IMPORT_C static CUpnpMediaServerStatusWatcher* NewL( 
+                                    MUpnpMediaServerStatusObserver& aObserver );
+
+    /**
+    * Two-phased constructor. Subscribes events for media server status
+    * session to server is maintained outside the class
+    * @since Series 60 5.0 HN
+    * @param aClient that must be opened and closed outside the class
+    * @param aObserver event observer
+    * @return watcher object
+    */
+    IMPORT_C static CUpnpMediaServerStatusWatcher* NewL( RUpnpMediaServerClient& aClient,
+                                    MUpnpMediaServerStatusObserver& aObserver );
+                                    
+    /**
+    * Destructor. Usubscribes
+    */                                 
+    ~CUpnpMediaServerStatusWatcher();
+    
+    /**
+    * Subscribes to server
+    * called during construction
+    * @since Series 60 5.0 HN
+    */
+    IMPORT_C void Subscribe();
+    
+private:
+    /**
+    * Constructor.
+    */
+    CUpnpMediaServerStatusWatcher( MUpnpMediaServerStatusObserver& aObserver );
+
+    /**
+    * Constructor.
+    */
+    CUpnpMediaServerStatusWatcher( RUpnpMediaServerClient& aClient,
+                                                MUpnpMediaServerStatusObserver& aObserver );
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();    
+
+    /**
+    * Dispatch response from server
+    * @param aStatus current media server status
+    * @since Series 60 5.0 HN
+    */
+    void DispatchResponseStatusEvent( TInt aStatus );
+    
+private:    // from CActive
+    /**
+    * RunL
+    */
+    void RunL();
+    
+    /**
+    * RunError
+    */
+    TInt RunError( TInt aError );
+    
+    /**
+    * DoCancel
+    */
+    void DoCancel();   
+
+private:    
+    
+    // current media server status
+    TInt iMediaServerStatus;
+    
+    // determines if session to server is maintaned by the class
+    TBool iSessionOwner;
+    
+    // media server client
+    RUpnpMediaServerClient iMediaServerClient;
+    
+    // event observer
+    MUpnpMediaServerStatusObserver& iStatusEventObserver;      
+
+	// the status read from media server
+    TInt iCurrentStatus;
+    };        
+    
+#endif // C_UPNPMEDIASERVERSTATUSWATCHER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_api/upnp_media_server_api.metaxml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="c151325b6098d0d1e3295dbaeea0836b" dataversion="1.0">
+  <name>UPnP Media Server API</name>
+  <description>The API to start and stop UPnP Media Server.</description>
+  <type>c++</type>
+  <subsystem>upnpmediaserver</subsystem>
+  <libs>
+    <lib name="avmediaserverclient.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_metadata_api/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,27 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                UPnP Media Server Metadata API
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/upnpfilesharing.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpfilesharing.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_metadata_api/inc/upnpfilesharing.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,314 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File sharing interface class
+*
+*/
+
+
+#ifndef C_CUPNPFILESHARING_H
+#define C_CUPNPFILESHARING_H
+
+#include <e32base.h>
+#include "upnpobject.h"
+
+// FORWARD DECLARATIONS
+class CUpnpFileSharingBody;
+class CUpnpItem;
+class CUpnpContainer;
+class CUpnpBrowseCriteria;
+class CUpnpItemList;
+class CUpnpContainerList;
+class RUpnpMediaServerClient;
+/**
+ *  Interface class for UPnP File Sharing
+ *
+ *  @lib MediaServerClient.lib
+ *  @since S60 v3.1
+ */
+class CUpnpFileSharing : public CBase
+    {
+
+public:
+    
+    /**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CUpnpFileSharing* NewL();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpFileSharing();
+
+public:     // Interface methods
+    /**
+    * Database Clearing function
+    * Stops mediaserver, delete database file and starts mediaserver
+    *
+    * @since S60 3.1
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void DropAllContentL(TRequestStatus& aStatus);
+    
+    /**
+    * Shares a single item asynchronously to Media Server.
+    * Symbian data base doesn't support foreign key constraints. In order to avoid  
+    * adding item with nonexistent parent container, parent id existence is checked 
+    * by Media Server. 
+    * The item is created with parent id passed as an argument to this operation 
+    * (object field iParentId value is ignored). 
+    * After creation input object is updated with:
+    * - iId - generated object identifier
+    * - "res" element value - in offline sharing there is no possible to set ip:port 
+    *    information in URL. "Res" value example: http:///00000001/filename. 
+    *    For consistency the same approach will be used in online mode.
+    *
+    * @since S60 3.1
+    * @param aContainerId information to which container the item is shared.
+    * @param aItem reference to item which is shared.
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void ShareItemL( const TDesC8& aContainerId, 
+                              CUpnpItem& aItem,
+                              TRequestStatus& aStatus ); 
+
+    /**
+    * Shares a single container asynchronously to Media Server.
+    * Nested container and items are ignored.  The container is created with parent id 
+    * passed as an argument to this operation (object field iParentId value is ignored). 
+    * Parent id existence is checked by Media Server. 
+    * After creation input object is updated with the current:
+    * - iId
+    *
+    * @since S60 3.1
+    * @param aContainerId information to which container the item is shared.
+    * @param aContainer reference to container which is shared.
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void ShareContainerL( const TDesC8& aParentId, 
+                                   CUpnpContainer& aContainer,
+                                   TRequestStatus& aStatus ); 
+    
+    /**
+    * Shares a list of items asynchronously to Media Server. 
+    * Each CUpnpItem of CUpnpItemList is created with the same parent id passed as 
+    * an argument to this operation (object field iParentId value is ignored). 
+    * Parent id existence is checked by Media Server - only once for this operation. 
+    * Database transaction is committed each 11 objects created into database. 
+    * This empirical value is hard coded in current implementation. 
+    * If an execution of task fails when creating object (e.g. 776-th item on list) 
+    * error code is retuned (aExecStatus), which points to last successfully created item index [1...total count] 
+    * (e.g. aExecutionStatus = 770 last item in database is object number 770, 
+    * if no object is cretated index = 0, if all are created index = total count).
+    *
+    * Note: There is no support for chunked operations (splitting long operation 
+    * into sequence of asynchronical calls). Each operation is atomic from 
+    * Media Server Engine perspective. Long lasting operations may block Media Server Engine. 
+    * In such case switching Media Server to offline mode is recommended.
+    *
+    * For each created item respective input object is updated with:
+    * - iId
+    * - "res" element value
+    *
+    * @since S60 3.1
+    * @param aContainerId information to which container the item is shared.
+    * @param aItemList reference to item list which are to be shared.
+    * @param aExecStatus reference pointing to the index of item list
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void ShareItemListL( const TDesC8& aContainerId, 
+                                  CUpnpItemList& aItemList,
+                                  TInt& aExecStatus,
+                                  TRequestStatus& aStatus ); 
+                                    
+    /**
+    * Unshares existing item from the Media Server.
+    * Item with specified id is removed from database regardless "restricted" property value.
+    * Note: This method removes uploaded file associated with item being destroyed. 
+    *       Shared files are never removed.
+    *       
+    *
+    * @since S60 3.1
+    * @param aItemId item which is unshared
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void UnshareItemL( TInt aItemId,
+                                TRequestStatus& aStatus);
+       
+     
+    /**
+    * Unshares existing container from the Media Server.
+    * Container with its whole branch is removed from database regardless "restricted" 
+    * property value for this container and any object in branch.
+    * Object removing is a bottom-up process. If removing of particular object fails 
+    * whole operation is broken and error is returned. 
+    *
+    * Note: This method removes uploaded file associated with item being destroyed. 
+    *       Shared files are never removed.
+    *
+    * Note: The iId value is not verified whether it points to a container or item. 
+    * Therefore, clients must not use UnshareContainer method with ids pointing to an 
+    * item or other way round. 
+    *    
+    * @since S60 3.1
+    * @param aContainerId container which is unshared
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void UnshareContainerL( TInt aItemId,
+                                     TRequestStatus& aStatus );
+     
+    /**
+    * Unshares existing items from the MediaServer.
+    * Each Item from list is removed from database regardless "restricted" property value.
+    * Database transaction is committed each 11 objects removed database. 
+    * If an execution of task fails when creating object error code is retuned, 
+    * which points to last successfully removed item index.
+    *
+    * Note: This method removes uploaded file associated with item being destroyed. 
+    *       Shared files are never removed.
+    *
+    * @since S60 3.1
+    * @param aItemList list of items which are to be unshared
+    * @param aExecStatus reference pointing to the index of item list    
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void UnshareItemListL( CUpnpItemList& aItemList,
+                                TInt& aExecStatus,
+                                TRequestStatus& aStatus);
+
+    /**
+    * Gets shared item information from MediaServer. 
+    * This operation returns all properties. Browse criteria is not used.
+    * Information is returned to item reference.
+    *
+    * @since S60 3.1
+    * @param aItemId item id
+    * @param aItem reference to item where information is updated.
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void GetSharedItemL( TInt aItemId,
+                                  CUpnpItem& aItem,
+                                  TRequestStatus& aStatus );
+    
+    
+    /**
+    * Gets shared container information from Media Server. 
+    * Nested container and items are not returned.
+    * This operation returns all properties. Browse criteria is not used.
+    * Information is returned to container reference.
+    *
+    * @since S60 3.1
+    * @param aContainerId container id
+    * @param aContainer reference to container where information is updated.
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void GetSharedContainerL( TInt aItemId,
+                                       CUpnpContainer& aContainer,
+                                       TRequestStatus& aStatus );
+
+    /**
+    * Gets shared items information from Media Server according to supported browse criteria.
+    * Note: There are only two possible values of filter:
+    * -    "" (empty filter) only required properties will be returned
+    * -    "*" (asterisk)  all properties will be returned
+    * Information is returned to container reference.    
+    *
+    * @since S60 3.1
+    * @param aContainerId id of the container of which items are to be returned
+    * @param aBrowseCriteria specifies request details, such as requestCount, startingIndes, filter
+    * @param aItemList reference to item list where information is updated.
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void GetSharedItemListL( TInt aContainerId,
+                                    CUpnpBrowseCriteria& aBrowseCriteria,
+                                    CUpnpItemList& aItemList,
+                                    TInt& aTotalMatches,
+                                    TRequestStatus& aStatus );
+    
+    /**
+    * Gets shared containers information from Media Server according to supported browse criteria.
+    * Note: There are only two possible values of filter:
+    * -    "" (empty filter) only required properties will be returned
+    * -    "*" (asterisk)  all properties will be returned
+    * Information is returned to container reference. 
+    * Nested container are not returned.   
+    *
+    * @since S60 3.1
+    * @param aContainerId id of the container of which items are to be returned
+    * @param aBrowseCriteria specifies request details, such as requestCount, startingIndes, filter
+    * @param aItemList reference to item list where information is updated.
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void GetSharedContainerListL( TInt aContainerId,
+                                    CUpnpBrowseCriteria& aBrowseCriteria,
+                                    CUpnpContainerList& aItem,
+                                    TInt& aTotalMatches,
+                                    TRequestStatus& aStatus );
+    
+    /**
+    * Creates a single reference upon passed item asynchronously in Media Server.    
+    *
+    * @since S60 5.0 HN
+    * @param aContainerId - container id upon which the reference will be located.
+    * @param aObjectId - the reference is created on the basis of passed object id
+    * @param aItem reference item to be filled
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void ShareReferenceL( TInt aContainerId, 
+                            TInt aObjectId,
+                            CUpnpItem& aItem,
+                            TRequestStatus& aStatus );
+
+    /**
+    * Creates some reference items, located at specific container, pointing specific objects
+    *
+    * @since S60 5.0 HN
+    * @param aItemList 'reference item' list which are to be shared
+    * @param aExecStatus reference pointing to the index of item list
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    IMPORT_C void ShareReferenceListL( CUpnpItemList& aItemList,
+                                  TInt& aExecStatus,
+                                  TRequestStatus& aStatus ); 
+    /**
+    * Returns reference to media server client
+    *
+    * @since S60 5.0 HN
+    * @return media server client refernce
+    */                              
+    IMPORT_C RUpnpMediaServerClient& CUpnpFileSharing::MediaServerClient( );
+
+private:
+
+	/**
+    * C++ default constructor.
+    */
+    CUpnpFileSharing();
+	
+	/**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Actual implementation class for the interface
+     * Own.
+     */
+     CUpnpFileSharingBody* iBody;
+    };
+
+
+#endif // C_CUPNPFILESHARING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_metadata_api/upnp_media_server_metadata_api.metaxml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="5b2da54cb04654dadce172d8f15171b3" dataversion="1.0">
+  <name>UPnP Media Server Metadata API</name>
+  <description>The API to create, delete and read metadata in order to share, unshare and browse local media server content.</description>
+  <type>c++</type>
+  <subsystem>upnpmediaserver</subsystem>
+  <libs>
+    <lib name="avmediaserverclient.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_settings_api/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,27 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                UPnP Media Server Settings API
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/upnpmediaserversettings.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpmediaserversettings.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_settings_api/inc/upnpmediaserversettings.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,201 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server Settings
+*
+*/
+
+
+#ifndef C_CUPNPMEDIASERVERSETTINGS_H
+#define C_CUPNPMEDIASERVERSETTINGS_H
+
+// INCLUDES
+
+
+#include <e32base.h>
+
+// CONSTANTS
+
+const TUid KHnCRUidMediaServer = { 0x2000f87f }; //for parallel stack
+const TUid KCRUidMediaServer   = { 0x101F978F };
+
+
+// FORWARD DECLARATIONS
+class CRepository;
+
+
+namespace UpnpMediaServerSettings 
+{
+    
+_LIT8( KFriendlyName, "friendlyName" );
+_LIT8( KModelUrl, "modelURL" );
+_LIT8( KModelDescription, "modelDescription" );
+_LIT8( KModelNumber, "modelNumber" );
+_LIT8( KSerialNumber, "serialNumber" );
+_LIT8( KPresentationUrl, "presentationURL" );
+_LIT8( KModelName, "modelName" );
+_LIT8( KManufacturer, "manufacturer" );
+_LIT8( KManufacturerUrl, "manufacturerURL" );
+
+enum TMediaServerKeys 
+    {
+    EFriendlyName = 1, 
+    EUploadDirectory = 2, 
+    ESupportedMedia = 3, 
+    ESecurityManager = 4,
+    EModelUrl = 5,
+    EModelDescription = 6,
+    EModelNumber = 7,
+    ESerialNumber = 8,
+    EPresentationUrl = 9,
+    EModelName = 10,
+    EManufacturer = 11,
+    EManufacturerUrl = 12,
+    EUpnpMediaServerThumbnails = 13,
+    KUpnpMediaServerBrowseLimit = 14
+    };
+
+}
+
+
+/**
+ *  Observer class for getting information about setting changes
+ *
+ *  @since S60 S60 v3.1
+ */
+class MUpnpSettingObserver
+	{
+public:
+   	/**
+	* This function will be invoke if setting change
+	*/
+	virtual void SettingChangedL() = 0;
+	};
+	
+	
+/**
+ *  Class wraps Central Repository settings for Media Server.
+ *  Those changes are applied only to Central Repository.
+ *  In order to make them active Media Server must be restarted. 
+ *
+ *  @since S60 S60 v3.1
+ */
+class CUpnpMediaServerSettings : public CActive
+    {
+
+public: // Constructors and destructor
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CUpnpMediaServerSettings* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpMediaServerSettings();
+
+
+public: // New functions
+    /**
+     * Sets numeric value.
+     * @param aId parameter id
+     * @return error code
+     */
+    IMPORT_C TInt Set(TUint aId, const TInt& aValue);
+
+    /**
+     * Sets string value.
+     * @param aId parameter id
+     * @return error code
+     */
+    IMPORT_C TInt Set(TUint aId, const TDesC& aValue);
+
+    /**
+     * Sets string value.
+     * @param aId parameter id
+     * @return error code
+     */
+    IMPORT_C TInt SetL(TUint aId, const TDesC8& aValue);    
+    
+    /**
+     * Gets numeric value.
+     * @param aId parameter id
+     * @return error code
+     */
+    IMPORT_C TInt Get(TUint aId, TInt& aValue);
+
+    /**
+     * Gets string value.
+     * @param aId parameter id
+     * @return error code
+     */
+    IMPORT_C TInt Get(TUint aId, TDes& aValue);
+
+    /**
+     * Gets string value.
+     * @param aId parameter id
+     * @return string value
+     */
+    IMPORT_C HBufC8* GetL(TUint aId);
+    
+    /**
+     * Subcribe notification about setting change
+     * Onlu one subsription can be pending for one instance of class
+     * @param aId parameter id
+     * @param aObserver interface to notify
+     * @return error code
+     */
+    IMPORT_C TInt Subscribe(TUint aId, MUpnpSettingObserver* aObserver);
+        
+
+private:
+    CUpnpMediaServerSettings();
+    void ConstructL(TUid aRepositoryId);
+
+    /**
+    * From CActive.
+    * Invoke when asynchronous request will be completed
+    *
+    * @since S60 S60 v3.1
+    */
+    void RunL();
+
+    /**
+    * From CActive.
+    * Invoke when RunL leaves
+    */
+    TInt RunError( TInt aErr );    
+
+    /**
+    * From CActive.
+    * Invoke for canceling asynchronous request
+    *
+    * @since S60 S60 v3.1
+    */	
+    void DoCancel();
+	
+private: 
+    /**
+    * Central repository client
+    */	
+    CRepository* iRepository;
+    
+    /**
+    * Observer which should be informed in case of changes
+    */
+    MUpnpSettingObserver* iObserver;
+    };
+
+#endif // C_CUPNPMEDIASERVERSETTINGS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_media_server_settings_api/upnp_media_server_settings_api.metaxml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="8b21ead1e12a955ec0a81da1fe3b392e" dataversion="1.0">
+  <name>UPnP Media Server Settings API</name>
+  <description>The setting and configuration API for controlling the settings of UPnP Media Server.</description>
+  <type>c++</type>
+  <subsystem>upnpmediaserver</subsystem>
+  <libs>
+    <lib name="avmediaserverclient.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_plugin_api/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,28 @@
+/** @file
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  exports the files belonging to UPnP Plugin API
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/upnpplugininterface.h MW_LAYER_PLATFORM_EXPORT_PATH(upnpplugininterface.h)
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_plugin_api/inc/upnpplugininterface.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,256 @@
+/** @file
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for ECom plugins
+*
+*/
+
+
+
+#ifndef C_UPNPPLUGININTERFACE_H
+#define C_UPNPPLUGININTERFACE_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class CGulIcon;
+
+// CONSTANT DEFINITIONS
+const TUid interfaceUid = { 0x200075DD };
+
+
+
+/**
+ * This event is sent from plugins to the MUPnPPluginObserver
+ *
+ * @since S60 3.2
+ */
+enum TExtensionEvent
+    {
+    // the extension is enabled by default - no need to call explicitly
+    EExtensionEnabled = 0x0001,
+    // when called, disables the item in the list, cannot execute
+    EExtensionDisabled = 0x0002,
+    // will call GetIcon again, and redraw
+    EExtensionIconChanged = 0x0010,
+    // will call GetTitle again, and redraw
+    EExtensionTitleChanged = 0x0020,
+    // will call GetSubTitle again, and redraw
+    EExtensionSecondaryTextChanged = 0x0040,
+    // extension which was ExecuteL'd, has been closed.
+    EExtensionClosed = 0x0100
+    };
+
+
+/**
+ * Implemented by CUPnPPluginLoader
+ *
+ * @since S60 3.2
+ */
+class MUPnPPluginObserver
+    {
+public:
+
+    /**
+     * Called by plugins when it needs updating.
+     *
+     * @since S60 3.2
+     * @param aEvent event type sent from plugin
+     */
+    virtual void ExtensionEvent(const TExtensionEvent& aEvent)=0;
+    
+    /**
+     * Virtual destructor 
+     *
+     * @since S60 3.2
+     */
+     virtual ~MUPnPPluginObserver() {}
+
+    };
+
+
+/**
+ * ECom interface class which all home connect plugins have to implement.
+ *
+ * IMPORTANT!!!
+ * 
+ * Following methdods and attribute have to be implemented in the implementing
+ * class as well so that observer argument can be passed correctly.
+ * Example is given from all methods.
+ *
+ * private:
+ *    // attribute
+ *    MUPnPPluginObserver* iPluginObserver;
+ *    
+ *    // constructor
+ *    // constructor has to be inherited from the interface constructor
+ *    // the following way
+ *    CUPnPPluginImplementation(TAny* aEcomArguments)
+ *         : CUPnPPluginInterface( aEcomArguments ) {}
+ *
+ *    // ConstructL
+ *    // ConstructL has to set its argument to the attribute
+ *    void ConstructL(MUPnPPluginObserver* aPluginObserver) 
+ *      {
+ *      iPluginObserver = aPluginObserver;
+ *      }
+ *
+ * public:
+ *    // NewL
+ *    // This has to give its argument to the constructor and pass it to
+ *    // ConstructL as well
+ *    static CUPnPPluginImplementation* NewL(MUPnPPluginObserver* 
+ *                                             aPluginObserver)
+ *      {
+ *      CUPnPPluginImplementation* self = new(ELeave) 
+ *                       CUPnPPluginImplementation( aPluginObserver );
+ *      CleanupStack::PushL( self );
+ *      self->ConstructL( aPluginObserver );
+ *      CleanupStack::Pop( self );
+ *      return self;
+ *      }
+ *
+ *
+ */
+class CUPnPPluginInterface : public CBase
+    {
+public:
+        
+    /**
+     * Creates instance of ECom plugin implementation which corresponds
+     * the parameter aUid.
+     *
+     * @since S60 3.2
+     * @param aUid - Uid of the plugin implementation
+     * @param aPluginObserver - Call back to CUPnPPluginLoader
+     * @return Instance of CUPnPPluginInterface
+     */
+    static CUPnPPluginInterface* NewL(TUid aUid,
+                                    MUPnPPluginObserver& aPluginObserver);
+
+    /**
+     * Informs to ECom that it has been destroyed.
+     *
+     * @since S60 3.2
+     */
+    virtual ~CUPnPPluginInterface();
+
+    //-------------------------------------------------------------------
+    // ECom interface methods
+    //-------------------------------------------------------------------
+    /**
+     * Returns reference to the icon of the plugin
+     *
+     * @since S60 3.2
+     * @return Reference to the icon of the plugin
+     */
+    virtual const CGulIcon& GetIcon()=0;
+
+    /**
+     * Returns const reference to the icon of the plugin
+     *
+     * @since S60 3.2
+     * @return const reference to the title of the plugin
+     */
+    virtual const TDesC& GetTitle()=0;
+
+    /**
+     * Returns const reference to the scondary text of the plugin
+     *
+     * @since S60 3.2
+     * @return const reference to the secondary text of the plugin
+     */
+    virtual const TDesC& GetSecondaryText()=0;
+
+    /**
+     * Executes the plugin
+     *
+     * @since S60 3.2
+     */
+    virtual void ExecuteL()=0;
+
+    /**
+     * Checks if the plugin needs upnp configuration (set IAP)
+     *
+     * @since S60 3.2
+     * @return Information whether plugin needs upnp configuration
+     */
+    virtual TBool RequiresUpnpConfiguration()=0;
+
+protected:
+    /**
+     * Constructor. Sets plugin observer.
+     *
+     * @since S60 3.2
+     * @param aPluginObserver - reference to CUPnPPluginObserver
+     */
+    CUPnPPluginInterface(TAny* aEcomArguments);
+
+private:
+
+    /**
+     * Uid of the plugin
+     */
+    TUid iDtor_ID_Key;
+
+    /**
+     * Pointer to the plugin observer which handles the events plugin sends
+     *
+     * Not owned.
+     */
+    MUPnPPluginObserver& iPluginObserver;
+    };
+
+
+// inline methods
+
+// ----------------------------------------------------------------------------
+// CUPnPPluginInterface::NewL
+// Constructor
+// ----------------------------------------------------------------------------
+inline CUPnPPluginInterface* CUPnPPluginInterface::NewL(TUid aUid,
+                                  MUPnPPluginObserver& aPluginObserver)
+    {
+    TAny* arg = reinterpret_cast<TAny*>(&aPluginObserver);
+    TAny* interface = REComSession::CreateImplementationL(aUid,
+                           _FOFF(CUPnPPluginInterface,iDtor_ID_Key),arg);
+    CUPnPPluginInterface* retval =
+                   REINTERPRET_CAST(CUPnPPluginInterface*,interface);
+    return retval;
+    }
+
+// ----------------------------------------------------------------------------
+// CUPnPPluginInterface::~CUPnPPluginInterface
+// Destructor
+// ----------------------------------------------------------------------------
+inline CUPnPPluginInterface::~CUPnPPluginInterface()
+    {
+    REComSession::DestroyedImplementation( iDtor_ID_Key );
+    }
+
+// ----------------------------------------------------------------------------
+// CUPnPPluginInterface::CUPnPPluginInterface
+// Constructor
+// ----------------------------------------------------------------------------
+inline CUPnPPluginInterface::CUPnPPluginInterface(TAny* aEcomArguments)
+    : iPluginObserver(*(reinterpret_cast<MUPnPPluginObserver*>
+                                        (aEcomArguments)))
+    {
+    }
+
+
+#endif // C_UPNPPLUGININTERFACE_H
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_plugin_api/upnp_plugin_api.metaxml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="7962190d3ac281ae325f7277989fae08" dataversion="1.0">
+  <name>UPnP Plugin API</name>
+  <description>UPnP Home Media Application extension plugin API</description>
+  <type>c++</type>
+  <subsystem>upnpframework</subsystem>
+  <libs>
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_security_plugin_api/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,27 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                UPnP Security Plug-in API
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/upnpsecuritymanager.h     MW_LAYER_PLATFORM_EXPORT_PATH(upnpsecuritymanager.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_security_plugin_api/inc/upnpsecuritymanager.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,86 @@
+/** @file
+* Copyright (c)  Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements the CUpnpSecurityManager class
+*    
+*
+*/
+
+#ifndef C_CUPNPSECURITYMANAGER_H
+#define C_CUPNPSECURITYMANAGER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// UID of this interface
+const TUid KCUpnpSecurityManagerUid = {0x101F977E}; // the standard plugin
+const TUid KCUpnpSecurityManagerUidRemote = {0x2001137B}; // Remote Access branch version
+
+// FORWARD DECLARATIONS
+class CUpnpAction;
+class CUpnpHttpMessage;
+
+
+// CLASS DECLARATION
+/**
+* Class responsbile for security checking in mediaserver-side
+*/
+class CUpnpSecurityManager : public CBase
+{
+public:
+
+    /**
+    * Two-phased constructor.
+    *
+    * @param aType name of security manager name used to identification in ECOM mechanism
+    * @return a pointer to an object instance that implements    
+    */
+    IMPORT_C static CUpnpSecurityManager* NewL(const TDesC8& aType);
+
+    /**
+     * Creates new instance of CUpnpSecurityManager based on upnp settings,
+     * and NULL if there is no, or empty setting.
+     */
+    IMPORT_C static CUpnpSecurityManager* NewInstanceFromUpnpSettingsL();    
+    
+    /**
+    * Destructor    
+    */    
+    IMPORT_C virtual ~CUpnpSecurityManager(); 
+    
+    /** 
+    * Authorize HTTP message.
+    * It gets notification about all HTTP GET,HEAD requests with real file that was requested.
+    * It also gets notification about HTTP POST request with real file where content of POST will be saved
+    *
+    * @param aMessage HTTP message
+    * @param aRequestedFile requested file location
+    * @return error code , if different that KErrNone, message with code EHttpUnAuthorized will be sent to remote side
+    */
+    virtual TInt AuthorizeMessage(CUpnpHttpMessage* aMessage, TFileName& aRequestedFile) = 0;
+    
+    /** 
+    * Authorize SOAP action
+    * It gets notification about all SOAP requests
+    *
+    * @param aAction SOAP action   
+    * @return error code , if different that KErrNone, message with code EHttpUnAuthorized will be sent to remote side
+    */    
+    virtual TInt AuthorizeAction(CUpnpAction* aAction) = 0;    
+    
+private:        
+    // Unique instance identifier key
+    TUid            iDtor_ID_Key; 
+
+};
+#endif // C_CUPNPSECURITYMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dlnasrv_plat/upnp_security_plugin_api/upnp_security_plugin_api.metaxml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="e72947e11e52e716289e304a19afda75" dataversion="1.0">
+  <name>UPnP Security Plugin API</name>
+  <description>Defines the logical interface implemented by a security plug-in component authorizing service requests.</description>
+  <type>c++</type>
+  <subsystem>upnpstack</subsystem>
+  <libs>
+    <lib name="upnpserviceframework.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnpservices build file
+*
+*/
+
+
+
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "upnpplatformvar.hrh"
+
+// Export domain and SDK headers
+#include "../dlnasrv_plat/group/bld.inf"
+
+// upnp stack
+#include "../upnpavcontrolpoint/group/bld.inf"
+#include "../upnpmediaserver/group/bld.inf"
+
+// upnp framework
+#include "../upnpavcontroller/group/bld.inf"
+#include "../upnpframework/group/bld.inf"
+#include "../upnpsettings/group/bld.inf"
+#include "../upnpsharing/group/bld.inf"
+#include "../upnpmpxplugins/group/bld.inf"
+
+#ifdef FF_UPNP_FRAMEWORK_2_0  // UPnP feature flag
+#include "../upnpharvester/group/bld.inf"
+
+// upnp applications
+#include "../homesync/group/bld.inf"
+#include "../homemedia/group/bld.inf"
+#endif // FF_UPNP_FRAMEWORK_2_0
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/upnpplatformvar.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Defines flags which are needed for compatibility with
+* S60 3.2 SDKs and IAD branch.
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPPLATFORMVAR_HRH
+#define UPNPPLATFORMVAR_HRH
+
+#ifndef __SERIES60_32__
+#include <platform_paths.hrh>
+#else
+#include <platform_paths.hrh>
+#endif
+
+// LOC export for MCL SDKs.
+// Loc files have to be exported to /epoc32/include/... in MCL SDKs.
+#define UPNP_LOC_EXPORT(exported) ../loc/##exported MW_LAYER_LOC_EXPORT_PATH(exported)
+
+// No need for language ids in MCL SDKs
+
+// No need for LOC file include paths MCL SDKs.
+// But they need to be defined.
+#define UPNP_LOC_INCLUDE_PATH_COMPONENT
+#define UPNP_LOC_INCLUDE_PATH_SUBCOMPONENT
+
+#endif // UPNPPLATFORMVAR_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build info for the HomeMedia subsystem
+*
+*/
+
+
+
+
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// ROM build
+../rom/homemedia.iby               CORE_MW_LAYER_IBY_EXPORT_PATH(homemedia.iby)
+../rom/homemediaresources.iby      CORE_MW_LAYER_IBY_EXPORT_PATH(homemediaresources.iby)
+// LOC files
+UPNP_LOC_EXPORT(homemedia.loc)
+// IAD support
+../install/upnpapplications_stub.SIS      /epoc32/data/z/system/install/upnpapplications_stub.sis
+
+    // HomeMedia
+    #include "../homemedia/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/data/homemedia.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,321 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main resource file
+*
+*/
+
+
+
+
+
+
+//  RESOURCE IDENTIFIER
+NAME HOME    // 4 letter ID
+
+
+//  INCLUDES
+#include <uikon.rh>
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <appinfo.rh>
+#include <homemedia.loc>
+#include <aknsconstants.hrh>
+#include "homemedia.hrh"
+
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+// --------------------------------------------------------------------------
+//
+//    Default Document Name
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_default_document_name
+    {
+    buf=qtn_iupnp_title_home_media;
+    }
+
+// --------------------------------------------------------------------------
+//
+//    Define default menu and CBA key.
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO r_localisable_app_info
+    {
+    menubar = r_homemedia_menubar;
+    custom_app_info_extension = r_info_extension;
+    }
+
+RESOURCE EIK_APP_INFO_EXT r_info_extension
+    {
+    popup_toolbar = r_fixed_toolbar;
+    }
+
+RESOURCE AVKON_TOOLBAR r_fixed_toolbar
+    {
+    flags = KAknToolbarFixed|KAknToolbarTransparent|KAknToolbarWithoutCba;
+    items =
+        {
+        TBAR_CTRL
+            {
+            type = EAknCtButton;
+            id = ECmdDummy;
+            control = AVKON_BUTTON
+                {
+                flags = 0;
+                states =
+                    {
+                    AVKON_BUTTON_STATE
+                        {
+                        txt = "Dummy";
+                        }  
+                    };
+                };
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//
+//    Localization application info.
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE LOCALISABLE_APP_INFO r_homemedia_localisable_app_info
+    {
+    short_caption = qtn_iupnp_grid_home_media;
+    caption_and_icon =
+    CAPTION_AND_ICON_INFO
+        {
+        caption = qtn_iupnp_title_home_media;
+        number_of_icons = 1;
+        icon_file = "\\resource\\apps\\homemedia_aif.mif";
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_softkeys_options_exit__open
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE CBA r_homemedia_softkeys_options_exit__open
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyExit; txt = text_softkey_exit; },
+        CBA_BUTTON {id=EAknSoftkeyOpen; txt= qtn_msk_open; }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_menubar
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_homemedia_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane = r_homemedia_menu;}
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_menu
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_homemedia_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            { 
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {   
+            command = EAknSoftkeyExit; 
+            txt = qtn_options_exit;
+            }
+        };
+    }
+    
+//----------------------------------------------------
+//
+//    r_homemedia_main_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_homemedia_main_view
+    {
+    menubar = r_homemedia_main_view_menubar;
+    // required to define something here but cba will be
+    // changed dynamically
+    cba = r_homemedia_softkeys_options_exit__open;
+    }
+    
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_main_view_menubar
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_homemedia_main_view_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane = r_homemedia_menu;},
+        MENU_TITLE { menu_pane = r_homemedia_main_view_menu;}
+        };
+    }
+
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_main_view_menu
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_homemedia_main_view_menu
+    {
+    items =
+        {
+        MENU_ITEM 
+            { 
+            command = EAknSoftkeyOpen;
+            txt = qtn_options_open; 
+            },
+        MENU_ITEM 
+            { 
+            command = EHomeMediaCmdRunWizard;
+            txt = qtn_iupnp_options_run_wizard; 
+            },
+        MENU_ITEM 
+            { 
+            command = EHomeMediaCmdSettings;
+            txt = qtn_iupnp_options_settings_main;
+            }
+        };
+    }
+    
+    
+    
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_connecting_dialog
+//
+//----------------------------------------------------------------------------
+//    
+RESOURCE DIALOG r_homemedia_connecting_dialog
+    { 
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                singular_label = qtn_iupnp_wait_connecting;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_browsehome_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF32 r_homemedia_browsehome_text { buf=qtn_iupnp_browse_home; }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_sharecontent_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF32 r_homemedia_sharecontent_text { buf=qtn_iupnp_share; }
+
+// --------------------------------------------------------------------------
+//
+//    r_homemedia_error_con_failed_text
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_homemedia_error_con_failed_text
+    { 
+    buf = qtn_iupnp_err_con_failed;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_share_active_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF32 r_homemedia_share_active_text { buf=qtn_iupnp_share_active; }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_share_inactive_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF32 r_homemedia_share_inactive_text { buf=qtn_iupnp_share_inactive; }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_navi_not_connected_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF32 r_homemedia_navi_not_connected_text { buf=qtn_iupnp_navi_not_connected; }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_navi_connected_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF32 r_homemedia_navi_connected_text { buf=qtn_iupnp_navi_connected; }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homemedia_title_pane_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_homemedia_title_pane_text { buf=qtn_iupnp_title_home_media; }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/data/homemedia_reg.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Application registry resource file
+*
+*/
+
+
+
+
+
+
+#include "homemedia.hrh"
+#include <homemedia.loc>
+#include <appinfo.rh>
+#include <homemedia.rsg>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 _UID3
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file="HomeMedia";
+    localisable_resource_file = "\\Resource\\Apps\\homemedia";
+    localisable_resource_id = R_HOMEMEDIA_LOCALISABLE_APP_INFO;
+    embeddability=KAppNotEmbeddable;
+    newfile=KAppDoesNotSupportNewFile;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/gfx/qgn_menu_upnp_homemedia.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -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/homemedia/homemedia/gfx/qgn_prop_upnp_browse_home.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.0" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="84" height="72" viewBox="0 0 84 72"
+	 overflow="visible" enable-background="new 0 0 84 72" xml:space="preserve">
+<g>
+	<g>
+		<g>
+			<g>
+				<path fill="#FFFFFF" d="M57.74,56.746l0.645-34.06l-21.85-2.27l-3.855-7.495c0,0-8.696-0.366-10.517,0.194
+					c-1.225,0.83-1.473,4.87-1.717,6.99c-1.589,0.593-1.705,1.126-1.705,1.126c-0.796,1.262-0.09,26.922,0.647,28.021
+					c0.723,1.081,34.157,8.7,36.027,8.749C56.017,58.054,56.82,57.54,57.74,56.746z"/>
+				
+					<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="-58.6812" y1="-583.0503" x2="-47.4028" y2="-623.4877" gradientTransform="matrix(1.1364 0 0 -1.1364 105.6695 -653.5159)">
+					<stop  offset="0" style="stop-color:#D7D9D9"/>
+					<stop  offset="0.0337" style="stop-color:#D7D9D9"/>
+					<stop  offset="0.0787" style="stop-color:#FDFFFF"/>
+					<stop  offset="0.2191" style="stop-color:#5E5F5F"/>
+					<stop  offset="0.3764" style="stop-color:#FFFFFF"/>
+					<stop  offset="0.4101" style="stop-color:#FFFFFF"/>
+					<stop  offset="1" style="stop-color:#0D0D0D"/>
+				</linearGradient>
+				<path fill="url(#XMLID_6_)" d="M55.705,57.96c1.018-0.092,4.537-2.326,4.833-3.316c0.791-2.655,1.114-26.49,1.099-27.973
+					c-0.021-1.979-0.422-4.504-3.494-5.097c-5.492-1.062-17.83-1.872-17.83-1.872s-3.236-7.035-3.797-7.174
+					c-0.565-0.144-9.571-0.846-10.343-0.846c-0.776,0-4.204,1.175-4.204,1.175c3.17-0.504,9.718,0.289,10.496,0.601
+					c0.779,0.313,3.584,7.018,3.584,7.018s20.063,1.882,20.975,2.652c0.854,0.72,0.854,2.383,0.938,4.93
+					c0.107,3.286-0.334,24.082-0.475,25.847C57.325,55.902,56.711,57.563,55.705,57.96z"/>
+				<path fill="#8C5400" d="M52.492,55.633c0,0,2.062,0.713,3.012-1.091c0.547-1.034,0.668-9.96,0.668-15.164
+					c0.06-3.456,0.365-14.293-0.398-15.086c-0.691-0.716-20.784-2.763-20.784-2.763l-3.334-7.022c0,0-7.138-0.76-8.135-0.703
+					c-0.856,0.051-1.17,1.15-1.17,1.15L52.492,55.633z"/>
+				
+					<radialGradient id="XMLID_7_" cx="-17.0771" cy="-679.0889" r="52.6128" gradientTransform="matrix(1 0 0 -1 36.9365 -664.1426)" gradientUnits="userSpaceOnUse">
+					<stop  offset="0" style="stop-color:#FEFB77"/>
+					<stop  offset="0.2022" style="stop-color:#FEFB77"/>
+					<stop  offset="1" style="stop-color:#D37700"/>
+				</radialGradient>
+				<path fill="url(#XMLID_7_)" d="M31.137,15.306c0,0-7.667-1.03-8.434-0.805c-0.775,0.225-1.688,6.327-1.688,6.327
+					c-1.399,0-1.52,0.754-1.52,1.051c0,0.296-0.182,25.2,1.098,26.566c0.486,0.521,0.716,0.569,1.245,0.704
+					c10.822,2.749,19.116,4.618,31.245,6.667c0.779,0.133,1.13,0.273,1.789-0.399c0.438-0.447,1.379-29.82,0.408-30.647
+					c-0.471-0.402-16.687-2.162-20.845-2.542L31.137,15.306z"/>
+				<path fill="#8C5400" d="M34.25,21.902l-13.197-1.374c-0.002,0.016-0.018,0.008-0.018,0.008s-0.428,0.143-0.783,0.261
+					c0.914-0.021,4.939,0.472,7.393,0.78c1.07,0.133,3.873,0.392,6.955,0.675L34.25,21.902z"/>
+			</g>
+		</g>
+		<g>
+			
+				<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="63.8154" y1="47.8506" x2="63.8154" y2="60.3929" gradientTransform="matrix(0.9862 0.0103 0.0142 1.0142 -3.6791 -2.8585)">
+				<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_8_)" d="M59.845,49.486c0,0-0.196-0.167-0.239-0.205c0.051,3.534,0.143,10.231,0.143,10.231
+				c0.012,0.848-0.615,1.32-1.004,1.389c0,0,2.023-0.594,2.313-0.864c0.292-0.272,0.456-0.675,0.45-1.103
+				c0,0-0.082-5.759-0.131-9.294l-0.539,0.134C60.488,49.838,60.127,49.732,59.845,49.486z"/>
+			
+				<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="53.4473" y1="38.2559" x2="67.4477" y2="49.5667" gradientTransform="matrix(0.9862 0.0103 0.0142 1.0142 -3.6791 -2.8585)">
+				<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_9_)" d="M63.678,45.584L52.422,35.158c-0.553-0.485-1.191-0.339-1.447-0.261l-1.393,0.435
+				c0.432-0.203,0.945-0.125,1.322,0.227L62.16,45.978c0.51,0.475,0.631,1.299,0.275,1.907l-0.75,1.28
+				c-0.156,0.269-0.389,0.459-0.66,0.556c0,0,1.031-0.21,1.33-0.342c0.326-0.144,0.656-0.282,0.849-0.612l0.747-1.278
+				C64.307,46.882,64.188,46.059,63.678,45.584z"/>
+			<path fill="#FFFFFF" d="M50.904,35.559L62.16,45.978c0.51,0.475,0.631,1.299,0.275,1.907l-0.75,1.28
+				c-0.191,0.329-0.498,0.55-0.848,0.609c-0.35,0.063-0.711-0.042-0.993-0.288c0,0-0.196-0.167-0.239-0.205
+				c0.051,3.534,0.143,10.231,0.143,10.231c0.006,0.427-0.158,0.832-0.449,1.101c-0.291,0.271-0.678,0.378-1.053,0.295
+				l-16.137-3.605c-0.609-0.134-1.053-0.731-1.064-1.419c0,0-0.102-7.228-0.143-10.347c-0.002,0-0.05,0.028-0.05,0.028
+				c-0.332,0.186-0.721,0.199-1.069,0.038c-0.347-0.159-0.618-0.482-0.743-0.882l-0.401-1.294c-0.204-0.654,0.035-1.372,0.57-1.699
+				l10.254-6.336C49.922,35.11,50.492,35.173,50.904,35.559z"/>
+			<path fill="#9E0A00" d="M50.104,36.653l-10.254,6.336l0.399,1.292L42.15,43.2l0.175,12.693l15.401,4.075l0.74-0.471l-0.184-13.15
+				l1.585,2.48l0.741-0.471l0.748-1.281L50.104,36.653z M52.688,57.289l-5.378-1.114l-0.123-8.814l5.376,0.914L52.688,57.289z"/>
+			
+				<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="37.9404" y1="39.0107" x2="65.8306" y2="62.4134" gradientTransform="matrix(0.9862 0.0103 0.0142 1.0142 -3.6791 -2.8585)">
+				<stop  offset="0.0056" style="stop-color:#FF0000"/>
+				<stop  offset="0.356" style="stop-color:#FD0000"/>
+				<stop  offset="0.539" style="stop-color:#F50000"/>
+				<stop  offset="0.6834" style="stop-color:#E70000"/>
+				<stop  offset="0.8076" style="stop-color:#D40000"/>
+				<stop  offset="0.9176" style="stop-color:#BC0000"/>
+				<stop  offset="1" style="stop-color:#A40000"/>
+			</linearGradient>
+			<path fill="url(#XMLID_10_)" d="M49.363,37.126l-10.255,6.336l0.4,1.289l1.9-1.083l0.177,12.698l16.141,3.603l-0.184-13.151
+				l2.325,2.011l0.75-1.279L49.363,37.126z M51.949,57.763l-5.381-1.117l-0.122-8.815l5.376,0.915L51.949,57.763z"/>
+		</g>
+	</g>
+	<rect fill="none" width="84" height="72"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/gfx/qgn_prop_upnp_share_sub.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,87 @@
+<?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 56 48">
+<g>
+<g>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="-33.2896" y1="64.4863" x2="-15.7015" y2="82.6993" gradientTransform="matrix(1.1364 0 0 -1.1364 37.3206 106.1367)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M11.427,24.652c-2.706-6.191,4.813-9.128,8.757-10.533c-0.497-1.095-0.329-1.246-0.824-2.341     C10.554,14.915,7.299,19.499,11.427,24.652"/>
+<polygon fill="#005795" points="31.403,8.032 31.066,10.079 19.855,17.22 19.51,14.903    "/>
+<path fill="#005795" d="M11.828,24.287c-1.643-0.698-5.24-6.47-5.24-6.47c-0.189,2.981,2.415,6.973,5.458,8.344L11.828,24.287z"/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-572.689" y1="871.5293" x2="-578.9237" y2="853.4222" gradientTransform="matrix(-1.1364 0 0 1.1364 -636.181 -965.1318)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M11.666,24.258c-10.524-5.46-3.25-13.029,7.2-16.536l-0.21-3.135l12.738,3.447l-11.95,6.943     l-0.175-3.045C11.28,14.783,6.857,19.668,11.666,24.258z"/>
+</g>
+<g>
+<path fill="#FFFFFF" d="M39.088,39.908l0.358-22.49l-14.651-1.996l-1.573-4.893c0,0-6.932-0.563-8.159-0.186     c-0.817,0.934-1.44,4.052-1.527,4.377c-0.087,0.325-0.827,0.652-0.83,1.482c-0.004,0.315,0.122,15.559,0.225,18.063     c0.014,0.535,0.441,0.693,0.612,0.766c2.805,0.814,22.792,5.691,23.978,5.723C37.925,40.791,38.465,40.443,39.088,39.908z"/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="26.1523" y1="38.7168" x2="35.6641" y2="4.5878" gradientTransform="matrix(1 0 0 -1 0.1377 45.835)">
+<stop offset="0" style="stop-color:#D7D9D9"/>
+<stop offset="0.03" style="stop-color:#D7D9D9"/>
+<stop offset="0.08" style="stop-color:#FDFFFF"/>
+<stop offset="0.22" style="stop-color:#5E5F5F"/>
+<stop offset="0.38" style="stop-color:#FFFFFF"/>
+<stop offset="0.41" style="stop-color:#FFFFFF"/>
+<stop offset="0.5" style="stop-color:#E3E3E3"/>
+<stop offset="0.7" style="stop-color:#9B9B9B"/>
+<stop offset="0.99" style="stop-color:#292929"/>
+<stop offset="1" style="stop-color:#262626"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M37.461,40.766c0.689-0.063,3.846-1.455,4.004-2.473c0.312-2.316,0.187-17.189,0.175-18.187     c-0.014-1.333,0.137-2.919-1.936-3.318c-3.771-0.518-12.317-1.694-12.317-1.694s-2.062-4.8-2.439-4.894     c-0.381-0.097-6.617-0.663-7.138-0.663c-0.523,0-2.724,0.807-2.724,0.807c2.513-0.148,6.59,0.577,7.604,0.666     c0.523,0.21,2.097,4.626,2.097,4.626s12.117,1.665,13.696,1.989c0.576,0.485,0.551,1.359,0.551,2.457     c0.073,2.214-0.104,17.649-0.2,18.84C38.725,40.268,38.139,40.496,37.461,40.766z"/>
+<path fill="#8C5400" d="M38.266,19.73c-0.009-0.467-0.094-1.254-0.747-1.341c-1.022-0.142-7.5-1.013-13.29-1.881     c0,0-1.783-4.44-1.874-4.665c-0.05-0.096-0.217-0.343-0.607-0.375c-0.181-0.014-5.025-0.612-5.542-0.461     c-0.087,0.026-0.619,0.169-0.77,0.502c-0.514,1.109-1.17,3.833-1.17,3.833c-0.509,0.214-0.899,0.81-0.899,1.009     c0,0.201,14.463,21.715,22.679,23.372c0.527,0.088,1.974-0.156,2.091-1.375C38.193,37.764,38.279,20.515,38.266,19.73z"/>
+<radialGradient id="XMLID_10_" cx="18.5527" cy="27.4492" r="22.7592" gradientTransform="matrix(1 0 0 -1 0.1377 45.835)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FEFB77"/>
+<stop offset="0.2" style="stop-color:#FEFB77"/>
+<stop offset="1" style="stop-color:#D37700"/>
+</radialGradient>
+<path fill="url(#XMLID_10_)" d="M21.877,12.034c0.055,0.134-0.033-0.137-0.247-0.168c-0.215-0.031-5.5-0.72-6.017-0.568     c-0.381,0.111-1.13,2.837-1.358,4.044l9.505,1.241C23.761,16.583,21.822,11.897,21.877,12.034z M37.6,19.956     c-0.038-0.785-0.214-1.041-0.726-1.104c-1.9-0.264-22.531-3.129-22.531-3.129c-0.946-0.033-1.032,0.705-1.032,0.905     c0,0.199,0.191,15.475,0.25,17.236c0.04,0.646,0.447,0.646,1.017,0.783c7.292,1.855,12.896,3.377,21.114,5.031     c0.526,0.092,1.67,0.148,1.787-1.066C37.534,38.027,37.641,20.741,37.6,19.956z"/>
+</g>
+<g>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="11.0776" y1="66.9199" x2="-2.5918" y2="57.9494" gradientTransform="matrix(1.1364 0 0 -1.1364 37.3206 106.1367)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_11_)" d="M46.655,27.465c0,0-11.125,12.789-11.137,12.861c0.2,1.555,0.339,2.369,0.42,2.602     C36.107,42.883,50.214,39.043,46.655,27.465z"/>
+<polygon fill="#0046B7" points="35.986,42.889 35.519,40.326 35.536,43.066 35.967,45.908    "/>
+<polygon fill="#005447" points="35.715,43.424 35.957,45.98 24.023,42.225 23.765,39.887    "/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="-8.7896" y1="54.7832" x2="7.9718" y2="69.8752" gradientTransform="matrix(1.1364 0 0 -1.1364 37.3206 106.1367)">
+<stop offset="0" style="stop-color:#68D80B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M42.287,23.277c9.876,5.608,3.054,13.375-6.757,16.977l0.198,3.217l-11.95-3.537l11.211-7.129     l0.165,3.123C42.65,33.006,46.8,27.99,42.287,23.277z"/>
+</g>
+</g>
+<rect fill="none" width="56" height="48"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build info for the HomeMedia application
+*
+*/
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+// help exports
+#include "../help/group/bld.inf"
+
+PRJ_MMPFILES
+homemedia.mmp
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE homemedia.mif
+OPTION HEADERFILE homemedia.mbg
+OPTION SOURCEDIR ../gfx
+OPTION SOURCES -c8,8 qgn_prop_upnp_share_sub -c8,8 qgn_prop_upnp_browse_home
+END
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE homemedia_aif.mif
+OPTION SOURCEDIR ../gfx
+OPTION SOURCES -c8,8 qgn_menu_upnp_homemedia
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/group/homemedia.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project specification for HomeMedia application
+*
+*/
+
+
+
+
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh" 
+
+#include <data_caging_paths.hrh>
+
+TARGET              homemedia.exe
+TARGETTYPE          exe
+UID                 0x100039CE 0x2000F8D6
+
+// Minimum heap size 16kB, maximum heap size 8MB
+EPOCHEAPSIZE        16384 8388608
+EPOCSTACKSIZE       0x8000
+VENDORID            VID_DEFAULT
+SECUREID            0x2000F8D6
+CAPABILITY          CAP_APPLICATION
+
+SOURCEPATH          ../src
+SOURCE              homemedia.cpp
+SOURCE              homemediaapplication.cpp
+SOURCE              homemediaappview.cpp 
+SOURCE              homemediaappui.cpp
+SOURCE              homemediadocument.cpp 
+SOURCE              homemediacontainer.cpp 
+SOURCE              homemediabaselistbox.cpp
+
+SOURCEPATH          ../data
+
+START RESOURCE      homemedia.rss
+HEADER
+TARGET              homemedia
+TARGETPATH          APP_RESOURCE_DIR
+LANGUAGE_IDS
+END //RESOURCE
+
+START RESOURCE      homemedia_reg.rss
+DEPENDS homemedia.rsg
+TARGET homemedia_reg
+TARGETPATH          /private/10003a3f/apps
+LANGUAGE_IDS
+END //RESOURCE
+
+//SYSTEM INCLUDE
+APP_LAYER_SYSTEMINCLUDE
+
+//USER INCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+USERINCLUDE   			../../../inc
+USERINCLUDE         ../inc
+USERINCLUDE         ../help/inc
+
+LIBRARY             euser.lib
+LIBRARY             apparc.lib
+LIBRARY             cone.lib
+LIBRARY             eikcore.lib
+LIBRARY             avkon.lib
+LIBRARY             CommonEngine.lib
+LIBRARY             hlplch.lib
+LIBRARY             GSEcomPlugin.lib
+LIBRARY             egul.lib 
+LIBRARY             AKNSKINS.lib 
+LIBRARY             eikcoctl.lib 
+LIBRARY             eikctl.lib 
+LIBRARY             bafl.lib 
+LIBRARY             AknIcon.lib
+LIBRARY             featmgr.lib
+LIBRARY             ecom.lib
+LIBRARY             upnpappwizard.lib
+LIBRARY             upnpsettingsengine.lib
+LIBRARY             upnpapplicationengine.lib
+LIBRARY             upnpextensionpluginif.lib
+LIBRARY             upnputilities.lib
+LIBRARY             upnpsharingui.lib
+LIBRARY             upnpavcontrollerclient.lib
+LIBRARY             upnpcommonui.lib
+
+DEBUGLIBRARY        flogger.lib
+
+// End of File
+
Binary file homemedia/homemedia/help/data/xhtml.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/help/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+* 
+* Contributors:
+* 
+* 
+* Description:
+* Export help related files.
+*
+*/
+
+#include <platform_paths.hrh>				
+PRJ_EXPORTS
+:zip ../data/xhtml.zip   /epoc32/data/z/resource/ overwrite
+:zip ../data/xhtml.zip   /epoc32/winscw/c/resource/ overwrite
+
+../inc/iupnp.hlp.hrh	MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/iupnp.hlp.hrh)
+../rom/homemediahelps_variant.iby		CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(homemediahelps_variant.iby)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/help/inc/iupnp.hlp.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Help header for project Home media
+*/
+	
+// iupnp.hlp.hrh
+// 
+
+//
+// File generated by CSXHelp Utilities on 2009-04-17
+// 
+
+#ifndef __IUPNP_HLP_HRH__
+#define __IUPNP_HLP_HRH__
+
+_LIT(KUPNP_HLP_SHARE_CONTENT, "UPNP_HLP_SHARE_CONTENT"); // 
+_LIT(KUPNP_HLP_SHARING_PROP, "UPNP_HLP_SHARING_PROP"); // 
+_LIT(KUPNP_HLP_MAIN_VIEW, "UPNP_HLP_MAIN_VIEW"); // 
+_LIT(KUPNP_HLP_MAIN_EXTERNAL, "UPNP_HLP_MAIN_EXTERNAL"); // 
+_LIT(KUPNP_HLP_CONTENT_VIEW, "UPNP_HLP_CONTENT_VIEW"); // 
+_LIT(KUPNP_HLP_REMOTE_DEVICES, "UPNP_HLP_REMOTE_DEVICES"); // 
+_LIT(KUPNP_HLP_SEARCH, "UPNP_HLP_SEARCH"); // 
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/help/rom/homemediahelps_variant.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: homemediahelps_variant.iby
+*
+*/
+
+#ifndef __HOMEMEDIAHELPS_VARIANT_IBY__
+#define __HOMEMEDIAHELPS_VARIANT_IBY__
+
+#if defined(FF_S60_HELPS_IN_USE)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000F8D6\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x2000F8D6\contents.zip)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000F8D6\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x2000F8D6\index.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000F8D6\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x2000F8D6\keywords.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000F8D6\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x2000F8D6\meta.xml)
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/inc/homemedia.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resource header
+*
+*/
+
+
+
+
+
+
+#ifndef __HOMEMEDIA_HRH__
+#define __HOMEMEDIA_HRH__
+
+#define _UID3 0x2000F8D6
+
+enum THomeMediaMainViewOptItems
+    {
+    EHomeMediaCmdRunWizard = 1,
+    EHomeMediaCmdSettings
+    };
+
+enum THomeMediaMainViewItems
+    {
+    EHomeMediaBrowseHome = 0,
+    EHomeMediaFileSharingDialog
+    };
+
+enum THomeMediaBtnCommandIds
+    {
+    ECmdDummy = 0
+    };
+
+#endif // __HOMEMEDIA_HRH__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/inc/homemediaapplication.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main application class
+*
+*/
+
+
+
+
+
+
+#ifndef __HOMEMEDIAAPPLICATION_H__
+#define __HOMEMEDIAAPPLICATION_H__
+
+// INCLUDES
+#include <aknapp.h>
+#include "homemedia.hrh"
+
+// UID for the application;
+// this should correspond to the uid defined in the mmp file
+const TUid KUidhomemediaApp =
+    {
+    _UID3
+    };
+
+// CLASS DECLARATION
+
+/**
+ * ChomemediaApplication application class.
+ * Provides factory to create concrete document object.
+ * An instance of ChomemediaApplication is the application part of the
+ * AVKON application framework for the homemedia example application.
+ */
+class CHomeMediaApplication : public CAknApplication
+    {
+public:
+    // Functions from base classes
+
+    /**
+     * From CApaApplication, AppDllUid.
+     * @return Application's UID (KUidhomemediaApp).
+     */
+    TUid AppDllUid() const;
+
+protected:
+    // Functions from base classes
+
+    /**
+     * From CApaApplication, CreateDocumentL.
+     * Creates ChomemediaDocument document object. The returned
+     * pointer in not owned by the CHomeMediaApplication object.
+     * @return A pointer to the created document object.
+     */
+    CApaDocument* CreateDocumentL();
+    };
+
+#endif // __HOMEMEDIAAPPLICATION_H__
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/inc/homemediaappui.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main Ui class
+*
+*/
+
+
+
+
+
+
+#ifndef __HOMEMEDIAAPPUI_H__
+#define __HOMEMEDIAAPPUI_H__
+
+// INCLUDES
+#include <aknViewAppUi.h> 
+
+// FORWARD DECLARATIONS
+class CHomeMediaAppView;
+
+// CLASS DECLARATION
+/**
+ * ChomemediaAppUi application UI class.
+ * Interacts with the user through the UI and request message processing
+ * from the handler class
+ */
+class CHomeMediaAppUi : public CAknViewAppUi
+    {
+public:
+    // Constructors and destructor
+
+    /**
+     * ConstructL.
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * CHomeMediaAppUi.
+     * C++ default constructor. This needs to be public due to
+     * the way the framework constructs the AppUi
+     */
+    CHomeMediaAppUi();
+
+    /**
+     * ~CHomeMediaAppUi.
+     * Virtual Destructor.
+     */
+    virtual ~CHomeMediaAppUi();
+
+private:
+    // Functions from base classes
+
+    /**
+     * From CEikAppUi, HandleCommandL.
+     * Takes care of command handling.
+     * @param aCommand Command to be handled.
+     */
+    void HandleCommandL(TInt aCommand);
+
+    /**
+    * From CEikAppUi, handles key events.
+    * @param aType The type of resources that have changed
+    */    
+    virtual void HandleResourceChangeL( TInt aType );  
+
+    /** 
+    * From CCoeAppUi
+    */
+    void HandleForegroundEventL( TBool aForeground );  
+
+    
+private:
+    // Data
+
+    /**
+     * The application view
+     * Owned by CHomeMediaAppUi
+     */
+    CHomeMediaAppView* iAppView;
+
+    };
+
+#endif // __HOMEMEDIAAPPUI_H__
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/inc/homemediaappview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,347 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main application view
+*
+*/
+
+
+
+
+
+
+#ifndef __HOMEMEDIAAPPVIEW_H__
+#define __HOMEMEDIAAPPVIEW_H__
+
+// INCLUDES
+#include <aknview.h> 
+#include <AknWaitNoteWrapper.h> //MAknBackgroundProcess
+#include "upnpfilesharingengineobserver.h"
+#include "upnppluginloaderobserver.h"
+
+//forward declaration
+class CHomeMediaContainer;
+class CUPnPFileSharingEngine;
+class CUPnPPluginInterface;
+class CUPnPPluginLoader;
+class MUPnPAVController;
+class CUPnPSettingsEngine;
+class CAknNavigationDecorator;
+class CGSPluginInterface;
+class CIdle;
+class CAknInputBlock;
+class CUPnPAppFileSharingDialog;
+class CUPnPPeriodic;
+
+/**
+ * CHomeMediaAppView
+ * View class for CHomeMediaAppUi, handles menu commands and creates
+ * container which shows main view items.
+ */
+class CHomeMediaAppView : public CAknView, 
+                          private MUPnPFileSharingEngineObserver,
+                          private MAknBackgroundProcess,
+                          private MUPnPPluginLoaderObserver
+    {
+public:
+    // New methods
+
+    /**
+     * NewL.
+     * Two-phased constructor.
+     * @return a pointer to the created instance of CHomeMediaAppView.
+     */
+    static CHomeMediaAppView* NewL();
+
+    /**
+     * NewLC.
+     * Two-phased constructor.
+     * @return A pointer to the created instance of CHomeMediaAppView.
+     */
+    static CHomeMediaAppView* NewLC();
+
+    /**
+     * ~CHomeMediaAppView
+     * Virtual Destructor.
+     */
+    virtual ~CHomeMediaAppView();
+
+    /**
+     * Get the pointer of fileSharingDialog ,which is constructed in the function of 
+     * ProcessCommandL
+     */
+    void RefreshVisibilitySettingItemL() ;
+
+private:
+    // Constructors
+
+    /**
+     * ConstructL
+     * 2nd phase constructor.
+     * Perform the second phase construction of a
+     * CHomeMediaAppView object.
+     */
+    void ConstructL();
+    
+    /**    
+     * CHomeMediaAppView.
+     * C++ default constructor.
+     */
+    CHomeMediaAppView();
+    
+public: // Functions from base classes
+    
+    /**
+    * Return Uid
+    */
+    TUid Id() const;
+
+    /**
+    * Handle Size changes
+    */
+    void HandleClientRectChange();
+
+private: // From AknView
+
+    /**
+    * Activates view
+    */
+    void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+        const TDesC8& aCustomMessage);
+
+    /**
+    * Deactivates view
+    */
+    void DoDeactivate();
+    
+private: // Functions from base classes
+
+    /**
+    * Handle Commands
+    */
+    void HandleCommandL(TInt aCommand);
+    
+    /**
+    * Add some comments here
+    */
+    void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );    
+    
+private:
+    /**
+     * From MAknBackgroundProcess
+     */
+    void StepL();
+
+    /**
+     * From MAknBackgroundProcess
+     */
+    TBool IsProcessDone() const;
+
+    /**
+     * From MAknBackgroundProcess
+     */
+    TInt CycleError( TInt aError );
+
+private: //From MUPnPFileSharingEngineObserver
+
+    /**
+     * Function informs when file sharing was enabled or disabled
+     * @param aEngine File sharing engine
+     * @param aError, error code
+     * @param aPhase ETrue if current phase is sharing activation,
+     * otherwise EFalse
+     */
+    void HandleSharingStatus( 
+        CUPnPFileSharingEngine& aEngine, 
+        TInt aError, 
+        TBool aPhase );
+
+    /**
+     * Callback to inform if connection has been lost
+     * @param aEngine File sharing engine
+     */ 
+    void HandleSharingConnectionLost( 
+        CUPnPFileSharingEngine& aEngine );
+
+private: //From MUPnPPluginLoaderObserver
+
+    /**
+     * Called by UPnPPluginLoader when plugin(s) has been updated
+     */
+    void PluginsUpdated();
+
+private: //business logic methods
+   
+    /**    
+     * Browse home
+     */
+    void ExecuteBrowseL();
+    
+    /**    
+     * Browse home
+     */
+    void DoExecuteBrowseL();
+    
+    /**    
+     * Start wizard
+     * @return key pressed in the wizard
+     */
+    TInt StartWizardL();
+    
+    /**
+     * @return IAP id
+     */     
+    TInt IAP() const;
+    
+    /**
+     * @return validity of current IAP
+     */     
+    TBool CheckAccessPointValid();
+           
+    /**
+     * Show the error note
+     * 
+     * @param aMain resource id for loc
+     */     
+    void ShowErrorNoteL( TInt aMain ) const;
+    
+    /**
+     * Update title pane
+     */
+    void UpdateTitlePaneL();
+    
+    /**
+     * update navi pane
+     * 
+     * @param aShowStatus ETrue if shown
+     */
+    void UpdateNaviPaneL( TBool aShowStatus );
+
+    /**
+     * Load external plugins
+     */
+    void LoadPluginL();
+    
+    /**
+     * Launch the settings view
+     */
+    void StartSettingsViewL();
+    
+    /**
+     * If get the correct pointer ,refresh the correspond item in view or share dialog
+     */
+    void RefreshSharelistItemL() ;
+    
+    /**
+     * Launch the setup wizard
+     *
+     * @param aPtr CHomeMediaAppView* pointer
+     * @return EFalse
+     */
+    static TBool InitializeWizardL( TAny* aPtr );
+
+    /**
+     * Launch a timer
+     *
+     * @param aPtr CHomeMediaAppView* pointer
+     * @return KErrNone
+     */
+    static TInt RefreshSharingL( TAny* aPtr );
+    
+private:
+    /**
+     * The internal phases of wait note when starting browsing
+     */
+    enum TBrowsingState
+        {
+        EPhaseNotActive,
+        EPhaseProcessing,
+        EPhaseCompleted
+        };
+
+    /**
+     * View's window
+     * Own
+     */
+    CHomeMediaContainer*                    iContainer;
+    
+    /**
+     * File sharing engine 
+     * Own
+     */
+    CUPnPFileSharingEngine*                 iFileSharing;
+
+    /**
+     * Array of plugins
+     * Not own
+     */
+    RPointerArray<CUPnPPluginInterface>     iPluginArray;
+
+    /**
+     * Plugin loader
+     * Own
+     */
+    CUPnPPluginLoader*                      iPluginLoader;
+
+    /**
+     * Current browse state
+     */
+    TBrowsingState                          iBrowseState;
+    
+    /**
+     * AV contoller
+     * Own
+     */
+    MUPnPAVController*                      iAvControl;
+    
+    /**
+     * Settings engine
+     * Own
+     */
+    CUPnPSettingsEngine*                    iSettingsEngine;
+    
+    /**
+     * App's navigation decorator
+     * Own
+     */
+    CAknNavigationDecorator*                iNaviDecorator;
+    
+    /**
+     * Settings view
+     * Not own
+     */
+    CGSPluginInterface*                     iSettingsView;
+    
+    /**
+     * Idle loop
+     * Own
+     */
+    CIdle*                                  iIdle;
+    
+    /**
+     * block UI in case of first start
+     * Own
+     */
+    CAknInputBlock*                         iInputBlocker;
+
+    /**
+     * record the pointer of CUPnPAppFileSharingDialog
+     * Own
+     */
+    CUPnPAppFileSharingDialog* ifileSharingDialog;
+
+    CUPnPPeriodic* iRefreshTimer;   
+    };
+
+#endif // __HOMEMEDIAAPPVIEW_H__
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/inc/homemediabaselistbox.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Base listbox class
+*
+*/
+
+
+
+
+
+
+#ifndef HOMEMEDIABASELISTBOX_H_
+#define HOMEMEDIABASELISTBOX_H_
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+#include <eikclbd.h>
+#include <AknIconArray.h> 
+
+/**
+ * CHomeMediaBaseListbox
+ * baseclass for lisboxes 
+ */
+class CHomeMediaBaseListbox : public CCoeControl
+    {
+public: // Constructors and destructor
+    
+    /**
+    * Constructor.
+    */
+    CHomeMediaBaseListbox();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CHomeMediaBaseListbox();
+
+    /**
+    * Returns reference to listbox
+    * @return reference to CEikListBox
+    */
+    CEikListBox& ListBox();
+    
+    /**
+    * Add's new column to listbox 
+    * 
+    * @param aFmt format of the lisbox ex. "%d\t%S\t\t",0,str
+    */    
+    void AddColumnL( TRefByValue<const TDesC> aFmt,... );
+
+private:
+
+    /**
+    * From CoeControl, SizeChanged.
+    * Called by framework when the view size is changed.
+    */
+    void SizeChanged();
+    
+    /**
+    * Handles key events
+    * 
+    * @param  aKeyEvent
+    * @param  aType
+    * @return TKeyResponse
+    */
+    TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent,
+                                TEventCode aType);
+    
+    /**
+    * From CoeControl,CountComponentControls.
+    * 
+    * @return Number of components in this control
+    */
+    TInt CountComponentControls() const;
+    
+    /**
+    * From CCoeControl,ComponentControl.
+    * @param  aIndex
+    * @return pointer to control
+    */
+    CCoeControl* ComponentControl(TInt aIndex) const;
+
+protected:
+
+    /**
+    * EPOC default constructor for performing 2nd stage construction
+    * 
+    * @param aRect rectangle for this control
+    * @param aListBox baseclass for all s60 lisboxes, takes ownership
+    */
+    void BaseConstructL( const TRect& aRect 
+                       , CEikTextListBox* aListBox );
+
+    /**
+     * Adds new icon to icon array
+     * 
+     * @param aArray
+     * @param aSkin
+     * @param aMbmFile
+     * @param aID
+     * @param aBitmapId
+     * @param aMaskId
+     */
+    void AppendIconToArrayL(CAknIconArray* aArray,
+                            MAknsSkinInstance* aSkin,
+                            const TDesC& aMbmFile,
+                            const TAknsItemID& aID,
+                            TInt aBitmapId,
+                            TInt aMaskId);
+    
+    /**
+     * TOverFlowHandler
+     * handles over flow in formatlist
+     */
+    class TOverFlowHandler : public TDes16Overflow 
+        {
+        /**
+         * called when descriptor is overflowed 
+         * 
+         * @param reference to overflown data
+         */
+        void Overflow(TDes16&){}
+        };
+
+    /**
+     * protected because derived classes may need to use iListBox ( owned )
+     */
+    CEikTextListBox* iListBox;
+    
+    /**
+     * protected because derived classes may need to use 
+     * iListBoxItems ( owned )
+     */ 
+    CDesCArray* iListBoxItems;    
+
+    };
+
+#endif /*HOMEMEDIABASELISTBOX_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/inc/homemediacontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main application window
+*
+*/
+
+
+
+
+
+
+#ifndef HOMEMEDIACONTAINER_H
+#define HOMEMEDIACONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include "homemediabaselistbox.h"
+
+//forward declaration
+class CUPnPPluginInterface;
+class CUPnPFileSharingEngine;
+
+/**
+ *  CHomeMediaContainer
+ *  Ui control for appview, inherited from CHomeMediaBaseListbox
+ *  Shows listbox on screen containing items: Browse Home , Sharing 
+ *  , ++ possible plugin items
+ */
+class CHomeMediaContainer : public CHomeMediaBaseListbox
+    {
+
+public:
+
+    // Constructors and destructor
+    /**
+     * Two-phased constructor.
+     * @param aRect Control's rectangle
+     * @param aFileSharing File sharing engine
+     * @param aPluginArray Array of extention plugins
+     * @return pointer to newly created CHomeMediaContainer
+     */
+    static CHomeMediaContainer* NewL(const TRect& aRect,
+        CUPnPFileSharingEngine& aFileSharing,
+        const RPointerArray<CUPnPPluginInterface>& aPluginArray );
+
+    /**
+     * Two-phased constructor.
+     * @param aRect Control's rectangle
+     * @param aFileSharing File sharing engine
+     * @param aPluginArray Array of extention plugins
+     * @return pointer to newly created CHomeMediaContainer
+     */
+    static CHomeMediaContainer* NewLC(const TRect& aRect,
+        CUPnPFileSharingEngine& aFileSharing,
+        const RPointerArray<CUPnPPluginInterface>& aPluginArray );
+
+    /**
+     * Destructor.
+     */
+    ~CHomeMediaContainer();
+
+public:
+    /**
+     * Update container if any changes has happed.
+     */
+    void UpdateL();
+    
+private:
+
+    /**
+     * Constructor for performing 1st stage construction
+     * @param aFileSharing File sharing engine
+     * @param aPluginArray Array of extention plugins
+     */
+    CHomeMediaContainer( 
+        CUPnPFileSharingEngine& aFileSharing,
+        const RPointerArray<CUPnPPluginInterface>& aPluginArray );
+
+    /**
+     * EPOC default constructor for performing 2nd stage construction
+     * 
+     * @param aRect rectangle for this control
+     */
+    void ConstructL(const TRect& aRect);
+
+    /**
+     * Load plugins icons and texts, update listbox.
+     */
+    void UpdatePluginsL();
+    
+    /**
+    * Get help context.
+    */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+    /**
+     * File sharing engine ( Not owned )
+     */
+    CUPnPFileSharingEngine& iFileSharing;
+
+    /**
+     * Array of extention plugins ( Not owned )
+     */
+    const RPointerArray<CUPnPPluginInterface>& iPluginArray;
+
+    };
+
+#endif // HOMEMEDIACONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/inc/homemediadocument.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main document class
+*
+*/
+
+
+
+
+
+
+#ifndef __HOMEMEDIADOCUMENT_H__
+#define __HOMEMEDIADOCUMENT_H__
+
+// INCLUDES
+#include <AknDoc.h>
+
+// FORWARD DECLARATIONS
+class CHomeMediaAppUi;
+class CEikApplication;
+
+// CLASS DECLARATION
+
+/**
+ * ChomemediaDocument application class.
+ * An instance of class ChomemediaDocument is the Document part of the
+ * AVKON application framework for the homemedia example application.
+ */
+class CHomeMediaDocument : public CAknDocument
+    {
+public:
+    // Constructors and destructor
+
+    /**
+     * NewL.
+     * Two-phased constructor.
+     * Construct a CHomeMediaDocument for the AVKON application aApp
+     * using two phase construction, and return a pointer
+     * to the created object.
+     * @param aApp Application creating this document.
+     * @return A pointer to the created instance of CHomeMediaDocument.
+     */
+    static CHomeMediaDocument* NewL(CEikApplication& aApp);
+
+    /**
+     * NewLC.
+     * Two-phased constructor.
+     * Construct a CHomeMediaDocument for the AVKON application aApp
+     * using two phase construction, and return a pointer
+     * to the created object.
+     * @param aApp Application creating this document.
+     * @return A pointer to the created instance of CHomeMediaDocument.
+     */
+    static CHomeMediaDocument* NewLC(CEikApplication& aApp);
+
+    /**
+     * ~CHomeMediaDocument
+     * Virtual Destructor.
+     */
+    virtual ~CHomeMediaDocument();
+
+public:
+    // Functions from base classes
+
+    /**
+     * CreateAppUiL
+     * From CEikDocument, CreateAppUiL.
+     * Create a ChomemediaAppUi object and return a pointer to it.
+     * The object returned is owned by the Uikon framework.
+     * @return Pointer to created instance of AppUi.
+     */
+    CEikAppUi* CreateAppUiL();
+    
+public:
+    // New functions
+    
+    /**
+     * Registers the destructor key of ecom plugin implementation. 
+     * Ecom plugin implementation will be destroyed in the destructor
+     * of the document object, after the appui object (and its views)
+     * has been destructed.
+     * 
+     * Method check if the given TUid is already registered. 
+     * Then it is not registered.
+     * 
+     * @param aDestructorKey A key specifying the ecom plugin implementation.
+     */
+    void RegisterEcomDestructorKeyL( const TUid& aDestructorKey );
+
+private:
+    // Constructors
+
+    /**
+     * ConstructL
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * CHomeMediaDocument.
+     * C++ default constructor.
+     * @param aApp Application creating this document.
+     */
+    CHomeMediaDocument(CEikApplication& aApp);
+    
+private:
+    
+    /**
+     * List of ecom destructor keys.
+     */
+    RArray<TUid> iEcomDestructorKeys;
+
+    };
+
+#endif // __HOMEMEDIADOCUMENT_H__
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/src/homemedia.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Application entry point
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <eikstart.h>
+#include "homemediaapplication.h"
+
+LOCAL_C CApaApplication* NewApplication()
+    {
+    return new CHomeMediaApplication;
+    }
+
+GLDEF_C TInt E32Main()
+    {
+    return EikStart::RunApplication( NewApplication );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/src/homemediaapplication.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main application class
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "homemediadocument.h"
+#include "homemediaapplication.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CHomeMediaApplication::CreateDocumentL()
+// Creates CApaDocument object
+// --------------------------------------------------------------------------
+//
+CApaDocument* CHomeMediaApplication::CreateDocumentL()
+    {
+    // Create an homemedia document, and return a pointer to it
+    return CHomeMediaDocument::NewL(*this);
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaApplication::AppDllUid()
+// Returns application UID
+// --------------------------------------------------------------------------
+//
+TUid CHomeMediaApplication::AppDllUid() const
+    {
+    // Return the UID for the homemedia application
+    return KUidhomemediaApp;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/src/homemediaappui.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main Ui class
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <avkon.hrh>
+#include <aknmessagequerydialog.h>
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+#include <f32file.h>
+#include <s32file.h>
+#include <hlplch.h>
+#include <homemedia.rsg>
+#include <akntoolbar.h>
+
+// debug log support
+_LIT( KComponentLogfile, "homemedia.txt");
+#include "upnplog.h"
+
+#include "homemedia.hrh"
+#include "homemediaapplication.h"
+#include "homemediaappui.h"
+#include "homemediaappview.h"
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppUi::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppUi::ConstructL()
+    {
+    __LOG("CHomeMediaAppUi::ConstructL begin");
+    BaseConstructL( EAknEnableSkin|EAknEnableMSK );
+
+    // Create view object
+    iAppView = CHomeMediaAppView::NewL();
+    
+    // Ownership transferred
+    AddViewL(iAppView);
+    
+    SetDefaultViewL(*iAppView);
+
+    CAknToolbar* toolbar = CurrentFixedToolbar();
+    if ( toolbar != NULL )
+        {
+        toolbar->HideItem( ECmdDummy, ETrue, EFalse );
+        toolbar->SetToolbarVisibility( EFalse );
+        }
+
+    __LOG("CHomeMediaAppUi::ConstructL end");
+    }
+// --------------------------------------------------------------------------
+// CHomeMediaAppUi::CHomeMediaAppUi()
+// C++ default constructor can NOT contain any code, that might leave.
+// --------------------------------------------------------------------------
+//
+CHomeMediaAppUi::CHomeMediaAppUi()
+    {
+    // No implementation required
+    }
+    
+// --------------------------------------------------------------------------
+// CHomeMediaAppUi::~CHomeMediaAppUi()
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CHomeMediaAppUi::~CHomeMediaAppUi()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppUi::HandleCommandL()
+// Takes care of command handling.
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppUi::HandleCommandL(TInt aCommand)
+    {
+    switch (aCommand)
+        {
+        case EEikCmdExit:
+        case EAknSoftkeyExit: // fall through
+            Exit();
+            break;
+        default:
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+//  Called by the framework when the application status pane
+//  size is changed.  Passes the new client rectangle to the
+//  AppView
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppUi::HandleResourceChangeL( TInt aType )
+    {
+    __LOG1("CHomeMediaAppUi::HandleResourceChangeL aType = %d",aType);
+    CAknAppUi::HandleResourceChangeL( aType );
+    // *****************************
+    // ADDED FOR SCALABLE UI SUPPORT
+    // *****************************
+    if ( aType==KEikDynamicLayoutVariantSwitch )
+        {
+        ((CHomeMediaAppView*) View( iAppView->Id() ) )->
+                                                  HandleClientRectChange(  );
+        }
+    } 
+
+// ---------------------------------------------------------------------------
+// HandleForegroundEventL
+// handle switches to background and foreground
+// ---------------------------------------------------------------------------
+void CHomeMediaAppUi::HandleForegroundEventL( TBool aForeground )
+    {
+    if( aForeground )
+        {
+        iAppView->RefreshVisibilitySettingItemL();
+        }
+  
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/src/homemediaappview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,820 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main application view
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <homemedia.rsg>
+#include <GSPluginInterface.h>  // CGSPluginInterface
+#include <StringLoader.h>       // StringLoader
+#include <aknnotewrappers.h>    // CAknErrorNote
+#include <featmgr/featmgr.h>            // FeatureManager
+#include <hlplch.h>             // HlpLauncher
+#include <aknnavi.h> 
+#include <aknnavide.h> 
+#include <akntitle.h> 
+#include <akninputblock.h>      // CAknInputBlock
+
+// upnpcontroller api
+#include "upnpavcontrollerfactory.h"
+#include "upnpavcontroller.h"
+
+// upnpframework api
+#include "upnppluginloader.h"
+#include "upnpcommonui.h"
+
+// upnpsettings api
+#include "upnpsettingsengine.h"     // CUPnPSettingsEngine
+#include "upnpsettingsengine.hrh"   // CUPnPSettingsEngine
+#include "cupnpappwizard.h"
+#include "upnpappfilesharingdialog.h"
+
+// upnpsharing api
+#include "upnpfilesharingengine.h"
+
+// homemedia
+#include "homemediadocument.h"
+#include "homemediaappview.h"
+#include "homemedia.hrh"
+#include "homemediacontainer.h"
+#include "upnpperiodic.h"
+
+// debug log support
+_LIT( KComponentLogfile, "homemedia.txt");
+#include "upnplog.h"
+
+//CONSTANTS
+static const TUid KHomeMediaAppViewId = {1}; 
+static const TUid KUPnPGSPluginImpUid = { 0x20009CB0 };
+static const TInt KNumberOfItemsBeforePlugins( 2 );
+static const TInt KUPnPAlreadyStarted( 0 );
+
+// Media Server shutdown delay in seconds (15s)
+const TInt KMediaServerShutdownTimeout = 15000000;
+// --------------------------------------------------------------------------
+// ChomemediaAppView::NewL()
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CHomeMediaAppView* CHomeMediaAppView::NewL()
+    {
+    CHomeMediaAppView* self = CHomeMediaAppView::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// ChomemediaAppView::NewLC()
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CHomeMediaAppView* CHomeMediaAppView::NewLC()
+    {
+    CHomeMediaAppView* self = new ( ELeave ) CHomeMediaAppView;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// ChomemediaAppView::~ChomemediaAppView()
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CHomeMediaAppView::~CHomeMediaAppView()
+    {
+    delete iFileSharing;
+    delete iPluginLoader;
+    delete iSettingsEngine;
+    delete iNaviDecorator;
+    delete iIdle;
+    delete iInputBlocker;
+    delete iRefreshTimer;
+    }
+    
+// --------------------------------------------------------------------------
+// ChomemediaAppView::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::ConstructL()
+    {
+    BaseConstructL( R_HOMEMEDIA_MAIN_VIEW );
+    ifileSharingDialog= NULL;       
+    iFileSharing = CUPnPFileSharingEngine::NewL();
+    iFileSharing->SetObserver( this );
+    
+    iPluginLoader = CUPnPPluginLoader::NewL(*this);
+    iPluginArray = iPluginLoader->CreatePluginsL();
+    iSettingsEngine = CUPnPSettingsEngine::NewL();
+    
+    TInt firstStart( 0 );
+    iSettingsEngine->GetFirstStart( firstStart );    
+    if( firstStart )
+        {
+        iInputBlocker = CAknInputBlock::NewLC();
+        CleanupStack::Pop( iInputBlocker );
+        iIdle = CIdle::NewL( CActive::EPriorityIdle );
+        TCallBack cb( InitializeWizardL, this );
+        iIdle->Start( cb );
+        }
+    
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::CHomeMediaAppView()
+// C++ default constructor can NOT contain any code, that might leave.
+// --------------------------------------------------------------------------
+//
+CHomeMediaAppView::CHomeMediaAppView()
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CHomeMediaAppView::Id ()const
+    {
+    return KHomeMediaAppViewId;
+    }
+    
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::HandleClientRectChange()
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+        
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::DoActivateL()
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::DoActivateL(const TVwsViewId &/*aPrevViewId*/
+                                  , TUid /*aCustomMessageId*/
+                                  , const TDesC8 &/*aCustomMessage*/)
+    {
+    if( !iContainer )
+        {
+        iContainer = CHomeMediaContainer::NewL( 
+            ClientRect(), *iFileSharing, iPluginArray );
+        iContainer->SetMopParent(this);
+        AppUi()->AddToStackL( *this, iContainer );
+        
+        UpdateTitlePaneL();
+        UpdateNaviPaneL( ETrue );  
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::DoDeactivate()
+// --------------------------------------------------------------------------
+// 
+void CHomeMediaAppView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        }
+    delete iContainer;
+    iContainer = NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::HandleCommandL()
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::HandleCommandL(TInt aCommand)
+    {
+    __LOG("CHomeMediaAppView::HandleCommandL");
+
+    switch (aCommand)
+        {
+        case EAknSoftkeyOpen: // fall through
+        case EAknCmdOpen :    // fall through
+            {
+            TInt index = iContainer->ListBox().CurrentItemIndex();
+            if ( index == EHomeMediaFileSharingDialog )
+                {
+                UpdateNaviPaneL( EFalse );
+                CUPnPAppFileSharingDialog* dlg =
+                    CUPnPAppFileSharingDialog::NewL( 0, *iFileSharing );
+                ifileSharingDialog= dlg;         
+                dlg->ExecuteSharingDialogLD();
+                dlg = NULL;
+                ifileSharingDialog= NULL;        
+                iContainer->UpdateL();
+                }
+            else if ( index == EHomeMediaBrowseHome )
+                {
+                ExecuteBrowseL();
+                }
+            else
+                // plugin was chosen
+                {
+                LoadPluginL();
+                }
+            break;
+            }
+        case EHomeMediaCmdRunWizard :
+            {
+            StartWizardL();
+            iContainer->UpdateL();
+            break;
+            }
+        case EHomeMediaCmdSettings:
+            { 
+            StartSettingsViewL();
+            break;
+            }
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL(
+                  iEikonEnv->WsSession(),
+                  iEikonEnv->EikAppUi()->AppHelpContextL() );
+            break;
+            }
+        case EAknSoftkeyExit :
+            {
+            AppUi()->HandleCommandL(EEikCmdExit);
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    //Set observer back, because other ui componets might change observer
+    iFileSharing->SetObserver( this );
+    if( aCommand != EHomeMediaCmdSettings )
+        {
+        UpdateTitlePaneL();
+        UpdateNaviPaneL( ETrue );        
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::DynInitMenuPaneL()
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::DynInitMenuPaneL( TInt aResourceId, 
+                                          CEikMenuPane* aMenuPane )
+    {
+    __LOG("CHomeMediaAppView::DynInitMenuPaneL");
+
+    // hide help option if not supported
+    if (aResourceId == R_HOMEMEDIA_MENU &&
+        !FeatureManager::FeatureSupported(KFeatureIdHelp))
+        {
+        aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue);
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAppMainDialog::StepL
+// Step done during wait note
+// From MAknBackgroundProcess
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::StepL(void)
+    {
+    if ( iBrowseState == EPhaseNotActive )
+        {
+        // try to start avcontroller
+        // handle leaves in CycleError
+        iAvControl = UPnPAVControllerFactory::NewUPnPAVControllerL();
+        iBrowseState = EPhaseCompleted;
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMainDialog::IsProcessDone
+// Returns ETrue if process finished
+// From MAknBackgroundProcess
+// --------------------------------------------------------------------------
+//
+TBool CHomeMediaAppView::IsProcessDone(void) const
+    {
+    TBool ret(EFalse);
+    if ( iBrowseState == EPhaseNotActive )
+        {
+        // try to start avcontroller
+        }
+    else if ( iBrowseState == EPhaseCompleted )
+        {
+        ret = ETrue;
+        }
+    else
+        {
+        __LOG( "CHomeMediaAppView::IsProcessDone: else branch" );
+        }
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppMainDialog::CycleError
+// Handle error
+// From MAknBackgroundProcess
+// --------------------------------------------------------------------------
+//
+TInt CHomeMediaAppView::CycleError( TInt aError )
+    {
+    __LOG( "CHomeMediaAppView::CycleError" );
+    delete iAvControl;
+    iAvControl = NULL;
+    return aError;
+    }
+
+    
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::HandleSharingStatus
+// Function informs when file sharing was enabled or disabled
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::HandleSharingStatus( 
+    CUPnPFileSharingEngine& /*aEngine*/, 
+    TInt /*aError*/, 
+    TBool /*aPhase*/ )
+    {
+    __LOG("CHomeMediaAppView::HandleSharingStatus begin");
+    if( iContainer )
+        {
+        TRAPD( err, iContainer->UpdateL() );
+        if( err )
+            {
+            __LOG1( "error=%d", err );
+            }
+        }
+    __LOG("CHomeMediaAppView::HandleSharingStatus end");
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::HandleSharingConnectionLost
+// Callback to inform if connection has been lost
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::HandleSharingConnectionLost( 
+    CUPnPFileSharingEngine& /*aEngine*/ )
+    {
+    __LOG("CHomeMediaAppView::HandleSharingConnectionLost begin");
+    if( iContainer )
+        {
+        TRAPD( err, iContainer->UpdateL() );
+        if( err )
+            {
+            __LOG1( "iContainer->UpdateL error=%d", err );
+            }
+        TRAP( err, UpdateNaviPaneL( ETrue ) );
+        
+        if( err )
+            {
+            __LOG1( "UpdateNaviPaneL error=%d", err );
+            }
+        
+        }
+    __LOG("CHomeMediaAppView::HandleSharingConnectionLost end");
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::PluginsUpdated
+// Called by UPnPPluginLoader when plugin(s) has been updated
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::PluginsUpdated()
+    {
+    __LOG("CHomeMediaAppView::PluginsUpdated begin");
+    if( iContainer )
+        {
+        TRAPD( err, iContainer->UpdateL() );
+        if( err )
+            {
+            __LOG1( "error=%d", err );
+            }
+        }
+    __LOG("CHomeMediaAppView::PluginsUpdated end");
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::ExecuteBrowseL
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::ExecuteBrowseL()
+    {
+    __LOG("CHomeMediaAppView::ExecuteBrowseL begin");
+    TInt leaveCode( KErrNone );
+    
+    if( CheckAccessPointValid() )
+        {
+        UpdateNaviPaneL( EFalse );
+        TRAP( leaveCode, DoExecuteBrowseL() );
+        }
+    else
+        {
+        TInt ret = StartWizardL();
+        // ret: 0 when wizard is canceled
+        // ret: -2 when wizard steps are completed
+        if( ret ) 
+            {
+            UpdateNaviPaneL( EFalse );
+            TRAP( leaveCode, DoExecuteBrowseL() );
+            }
+        }    
+    
+    // Inform user if browse failed
+    // KErrCancel is returned when user selectes NO to WLAN query
+    if( leaveCode && 
+        leaveCode != KErrCancel )
+        {
+        ShowErrorNoteL( R_HOMEMEDIA_ERROR_CON_FAILED_TEXT );
+        }
+        
+    __LOG("CHomeMediaAppView::ExecuteBrowseL end");    
+    }
+    
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::DoExecuteBrowseL
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::DoExecuteBrowseL()
+    {
+    __LOG("CHomeMediaAppView::DoExecuteBrowseL begin");
+    iBrowseState = EPhaseNotActive;
+
+    CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL();
+    CleanupStack::PushL(reinterpret_cast<CBase*>(waitNoteWrapper));
+    waitNoteWrapper->ExecuteL(
+      R_HOMEMEDIA_CONNECTING_DIALOG,
+      *this,
+      ETrue); //ETrue = show immediately
+    CleanupStack::PopAndDestroy(waitNoteWrapper);
+    
+    if ( iAvControl )
+        {
+        CUPnPCommonUI *commonui = CUPnPCommonUI::NewL();
+        CleanupStack::PushL( commonui );
+
+        TInt returnValue( KErrNone );
+        returnValue = commonui->ExecuteDeviceDialogL( *iAvControl );
+
+        CleanupStack::PopAndDestroy( commonui );
+        delete iAvControl;
+        iAvControl = NULL;
+        if ( returnValue == EAknCmdExit ||
+             returnValue == EEikCmdExit )
+            {
+            User::Exit( KErrNone );
+            }
+        }
+    __LOG("CHomeMediaAppView::DoExecuteBrowseL end");    
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::StartWizardL
+// --------------------------------------------------------------------------
+//    
+TInt CHomeMediaAppView::StartWizardL()
+    {
+    //Start wizzard
+    
+    CUPnPAppWizard* wiz = 
+        CUPnPAppWizard::NewL( KNullDesC, iFileSharing );
+    CleanupStack::PushL( wiz );
+    TInt ret = wiz->StartL();
+    CleanupStack::PopAndDestroy( wiz );
+    
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::IAP()
+// --------------------------------------------------------------------------
+//    
+TInt CHomeMediaAppView::IAP() const
+    {
+    TInt iapId( EUPnPSettingsEngineIAPIdNone );
+    iSettingsEngine->GetAccessPoint( iapId );
+    return iapId;
+    }
+ 
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::CheckAccessPointValid
+// Check the current selected iap's validity
+// --------------------------------------------------------------------------
+//  
+TBool CHomeMediaAppView::CheckAccessPointValid()
+    {
+    //check if the selected iap is still valid
+    __LOG( "CHomeMediaAppView::CheckAccessPointValid()" );
+    
+    TBool validiap = EFalse;
+    TRAPD(err, validiap = CUPnPSettingsEngine::IsAccessPointValidL( IAP() ) );
+                        
+    if( !err && validiap )
+        {
+        __LOG( "CheckAccessPointValid ETrue" );
+        return ETrue;
+        }
+    else
+        {
+        __LOG( "etAccessPoint" );
+        iSettingsEngine->SetAccessPoint( EUPnPSettingsEngineIAPIdNone );
+
+        /**
+         * These two APIs will be removed after the CUPnPSettingsEngine
+         * is refactoryed
+         */
+        
+        iSettingsEngine->SetWapId( 
+                EUPnPSettingsEngineIAPItemNone );
+        iSettingsEngine->SetAccessPointSetting( 
+                EUPnPSettingsEngineIAPItemNone );
+        
+        __LOG( "CheckAccessPointValid EFalse" );  
+        return EFalse;                
+        }
+    }    
+   
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::ShowErrorNoteL
+// Shows note with error message
+// --------------------------------------------------------------------------
+//
+void CHomeMediaAppView::ShowErrorNoteL( TInt aMain ) const
+    {
+    __LOG("CHomeMediaAppView::ShowErrorNoteL begin");
+
+    // show error note
+    HBufC* errorNote = StringLoader::LoadLC( aMain );
+    CAknErrorNote* note = new (ELeave) CAknErrorNote(ETrue);
+    note->ExecuteLD(*errorNote);
+    CleanupStack::PopAndDestroy(errorNote);
+    __LOG("CHomeMediaAppView::ShowErrorNoteL end");
+    }
+
+//---------------------------------------------------------------------------
+// CHomeMediaAppView::UpdateTitlePaneL()
+//---------------------------------------------------------------------------
+//
+void CHomeMediaAppView::UpdateTitlePaneL()
+    {
+    __LOG("CHomeMediaAppView::UpdateTitlePaneL begin");
+    CAknTitlePane* titlePane = static_cast<CAknTitlePane*>(
+        StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    HBufC* titlePaneTxt = StringLoader::LoadLC( 
+        R_HOMEMEDIA_TITLE_PANE_TEXT );
+    titlePane->SetTextL( *titlePaneTxt );
+    CleanupStack::PopAndDestroy( titlePaneTxt );
+    __LOG("CHomeMediaAppView::UpdateTitlePaneL begin");
+    }
+    
+//---------------------------------------------------------------------------
+// CHomeMediaAppView::UpdateNaviPaneL()
+//---------------------------------------------------------------------------
+//
+void CHomeMediaAppView::UpdateNaviPaneL( TBool aShowStatus )
+    {
+    __LOG("CHomeMediaAppView::UpdateNaviPaneL begin");
+    TUid naviPaneUid;
+    naviPaneUid.iUid = EEikStatusPaneUidNavi;
+    CEikStatusPane* statusPane  = StatusPane();
+    CEikStatusPaneBase::TPaneCapabilities subPane =
+            statusPane->PaneCapabilities(naviPaneUid);
+    
+    if(subPane.IsPresent()&&subPane.IsAppOwned())
+        {
+        CAknNavigationControlContainer* naviPane = 
+         (CAknNavigationControlContainer*) statusPane->ControlL(naviPaneUid);
+         
+        if( aShowStatus )
+            {
+            delete iNaviDecorator;
+            iNaviDecorator = NULL;
+            HBufC* naviPaneTxt = NULL;
+            
+            if( iFileSharing->SharingStateL() )
+                {
+                TInt iapId( EUPnPSettingsEngineIAPIdNone );
+                iSettingsEngine->GetAccessPoint( iapId );
+                if( iapId == EUPnPSettingsEngineIAPIdAlwaysAsk )
+                    {
+                    __LOG("alw ask");
+                    naviPaneTxt = StringLoader::LoadLC(
+                        R_HOMEMEDIA_NAVI_CONNECTED_TEXT );
+                    }
+                else
+                    {
+                    naviPaneTxt = 
+                            CUPnPSettingsEngine::GetCurrentIapNameL( iapId );
+                    CleanupStack::PushL( naviPaneTxt );
+                    __LOG16( *naviPaneTxt );
+                    }
+                }
+            else
+                {
+                naviPaneTxt = StringLoader::LoadLC( 
+                    R_HOMEMEDIA_NAVI_NOT_CONNECTED_TEXT );
+                }    
+
+            iNaviDecorator = naviPane->CreateNavigationLabelL(*naviPaneTxt);
+            naviPane->PushL(*iNaviDecorator);
+            CleanupStack::PopAndDestroy( naviPaneTxt );
+            }
+        else    
+            {
+            if ( iNaviDecorator )
+                {
+                naviPane->Pop( iNaviDecorator );
+                }
+            // destroy iNaviDecorator
+            delete iNaviDecorator;
+            iNaviDecorator = NULL;
+            }
+        }    
+    __LOG("CHomeMediaAppView::UpdateNaviPaneL begin");
+    }
+
+//---------------------------------------------------------------------------
+// CHomeMediaAppView::LoadPluginL()
+//---------------------------------------------------------------------------
+//
+void CHomeMediaAppView::LoadPluginL()
+    {
+    __LOG("CHomeMediaAppView::LoadPluginL begin");
+    TInt iapId( IAP() );
+    TInt index = iContainer->ListBox().CurrentItemIndex() - 
+                 KNumberOfItemsBeforePlugins;
+    if ( iPluginArray[index]->RequiresUpnpConfiguration() &&
+         iapId <= EUPnPSettingsEngineIAPIdNone )
+        {
+        //Start wizzard
+        StartWizardL();
+
+        // get the apid again
+        iapId = IAP();
+
+        //if apid is set,get into the plugin view
+        if ( iapId > EUPnPSettingsEngineIAPIdNone )
+            {
+            // after wizard has been run, launch plugin
+            iPluginArray[index]->ExecuteL();
+            }
+        }
+    else
+        {
+        iPluginArray[index]->ExecuteL();
+        }
+    __LOG("CHomeMediaAppView::LoadPluginL begin");
+    }
+    
+//---------------------------------------------------------------------------
+// CHomeMediaAppView::StartSettingsViewL()
+//---------------------------------------------------------------------------
+//    
+void CHomeMediaAppView::StartSettingsViewL()
+    {
+    CAknViewAppUi* appUi = AppUi();
+    if( !appUi->View( KUPnPGSPluginImpUid ) )
+        {
+        // Creates GS plugin implementation. CGSPluginInterface is
+        // inherited from the CAknView.
+        CGSPluginInterface* settingsView = CGSPluginInterface::NewL( 
+                        KUPnPGSPluginImpUid, NULL );
+        CleanupStack::PushL( settingsView );
+        
+        // Registers destructor key to document object.
+        // Ecom plugin implementation will be destroyed after view
+        // destruction.
+        CHomeMediaDocument* doc = static_cast<CHomeMediaDocument*>( 
+                appUi->Document() );
+        doc->RegisterEcomDestructorKeyL( 
+                settingsView->GetEcomDestructorKey() );
+        
+        // Adds the view to system view framework.
+        appUi->AddViewL( settingsView ); //ownership transferred
+        CleanupStack::Pop( settingsView );
+        }
+    
+    UpdateNaviPaneL( EFalse );
+    
+    // We check the existence of gsplugin view with hardcoded uid,
+    // we active the view also with the same uid to detect
+    // possible changes better (leaves if view isn't found).
+    appUi->ActivateLocalViewL( KUPnPGSPluginImpUid );            
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::InitializeWizardL
+// callback to run wizard
+// --------------------------------------------------------------------------
+//
+TBool CHomeMediaAppView::InitializeWizardL( TAny* aPtr )
+    {
+    __LOG("[UPNP_HOMECONNECT]\t CUPnPAppMainDialog::InitializeWizardL \
+begin");
+    CHomeMediaAppView* main = static_cast< CHomeMediaAppView* >( aPtr );
+    if( main )
+        {
+        if ( main->iInputBlocker )
+            {
+            delete main->iInputBlocker;
+            main->iInputBlocker = NULL;
+            }
+        main->StartWizardL();
+        main->iSettingsEngine->SetFirstStart( KUPnPAlreadyStarted ); 
+        main->UpdateTitlePaneL();
+        main->UpdateNaviPaneL( ETrue );
+        if( main->iContainer )
+            {
+             main->iContainer->UpdateL();
+            }
+        }
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::RefreshSharelistItemL
+// if get the correct pointer ,refresh the correspond item 
+// in view or share dialog
+// --------------------------------------------------------------------------
+//  
+void CHomeMediaAppView::RefreshSharelistItemL() 
+    { 
+    if( iContainer )    
+        {
+        iContainer->UpdateL();
+        }
+   
+    if( ifileSharingDialog )
+        {
+        ifileSharingDialog->UpdateFileSharingListL();
+        }  
+    
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::RefreshVisibilitySettingItemL
+// First refresh the share item either in the CHomeMediaAppView or in the 
+// CUPnPAppFileSharingList,it is ten seconds that shutdown 
+// mediaserver,so need a timer refresh the items in time .
+// --------------------------------------------------------------------------
+//  
+void CHomeMediaAppView::RefreshVisibilitySettingItemL() 
+    {
+    RefreshSharelistItemL();
+    if( iRefreshTimer )    
+        {
+        iRefreshTimer->Cancel();  
+        delete iRefreshTimer; 
+        iRefreshTimer = NULL;
+        }
+     
+    iRefreshTimer = CUPnPPeriodic::NewL( CActive::EPriorityIdle );
+    TCallBack updatelist( RefreshSharingL, this );
+    iRefreshTimer->Start( KMediaServerShutdownTimeout, 
+        KMediaServerShutdownTimeout, updatelist );
+  
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaAppView::RefreshSharingL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CHomeMediaAppView::RefreshSharingL( TAny* aPtr )
+    { 
+    CHomeMediaAppView* view( NULL );
+    view = static_cast<CHomeMediaAppView*>( aPtr );
+    view->RefreshSharelistItemL();
+  
+    view->iRefreshTimer->Cancel();
+    delete view->iRefreshTimer;
+    view->iRefreshTimer = NULL;
+    
+    return KErrNone;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/src/homemediabaselistbox.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Base listbox class
+*
+*/
+
+
+
+
+
+
+#include <aknViewAppUi.h>
+#include <badesca.h>
+#include <eiklbx.h> 
+#include <homemedia.mbg>
+#include <gulicon.h>
+#include <eikenv.h>
+#include <eikapp.h>
+#include <AknsUtils.h> 
+#include <AknIconUtils.h> 
+#include "homemediaappview.h"
+#include "homemediabaselistbox.h"
+
+//CONSTANTS
+static const TInt KIconGranularity( 3 );
+_LIT( KAknHomeMediaMbmFileName, "\\resource\\apps\\HomeMedia.mif" );
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::CHomeMediaBaseListbox()
+// --------------------------------------------------------------------------
+//
+CHomeMediaBaseListbox::CHomeMediaBaseListbox()
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::~CHomeMediaBaseListbox()
+// --------------------------------------------------------------------------
+//
+CHomeMediaBaseListbox::~CHomeMediaBaseListbox()
+    {
+    delete iListBox;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::ListBox()
+// --------------------------------------------------------------------------
+//
+CEikListBox& CHomeMediaBaseListbox::ListBox()
+    {
+    return *iListBox;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::AddColumnL()
+// --------------------------------------------------------------------------
+//
+void CHomeMediaBaseListbox::AddColumnL( TRefByValue<const TDesC> aFmt,... )
+    {
+    // pointer to list of arguments 
+    VA_LIST args;
+    // tells the code where to start the list
+    VA_START(args,aFmt);
+    HBufC* data = HBufC::NewLC(KMaxFileName);
+    // create TOverFlowHandler object in case if there is 
+    // huge descriptor passed here
+    TOverFlowHandler overFlow;
+    // now format descriptor
+    data->Des().AppendFormatList( aFmt , args , &overFlow );
+    // add item to list
+    iListBoxItems->AppendL(*data);
+    CleanupStack::PopAndDestroy(data);
+    // sets pointer to zero
+    VA_END(args);
+    // draw listbox
+    iListBox->HandleItemAdditionL();
+    iListBox->DrawDeferred();
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::SizeChanged()
+// Called by framework when the view size is changed.
+// --------------------------------------------------------------------------
+//
+void CHomeMediaBaseListbox::SizeChanged()
+    {  
+    const TPoint listPosition(0,0);
+    iListBox->SetExtent(listPosition, iListBox->MinimumSize() );
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::OfferKeyEventL()
+// --------------------------------------------------------------------------
+//
+TKeyResponse CHomeMediaBaseListbox::OfferKeyEventL(
+    const TKeyEvent &aKeyEvent,
+    TEventCode aType)
+    {
+    TKeyResponse ret(EKeyWasNotConsumed);
+    if( aType == EEventKey )
+        {
+        if( aKeyEvent.iCode == EKeyUpArrow 
+            || aKeyEvent.iCode == EKeyDownArrow )
+            {
+            ret = iListBox->OfferKeyEventL(aKeyEvent, aType);
+            }
+        } 
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::CountComponentControls()
+// --------------------------------------------------------------------------
+//
+TInt CHomeMediaBaseListbox::CountComponentControls() const
+    {
+    return 1;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::ComponentControl()
+// --------------------------------------------------------------------------
+//
+CCoeControl* CHomeMediaBaseListbox::ComponentControl(TInt aIndex) const
+    {
+    CCoeControl* ret = NULL;
+    switch( aIndex )
+        {
+        case 0:
+            ret = iListBox;
+            break;
+        }
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::BaseConstructL()
+// --------------------------------------------------------------------------
+//
+void CHomeMediaBaseListbox::BaseConstructL( const TRect& aRect 
+                                                ,CEikTextListBox* aListBox )
+    {    
+    CreateWindowL();
+
+    // take the ownership of aListBox
+    iListBox = aListBox;
+    
+    /** This initializes the C-classes of a newly-created @c CEikTextListBox 
+    * from supplied arguments. This function fully constructs the associated 
+    * list box model and item drawer for this list box, and then invokes 
+    * CEikListBox::ConstructL().
+    */
+    iListBox->ConstructL(this);
+    
+    /**
+    * Creates an own window for the list box or draws the list box to an old 
+    * window defined by the container.
+    */
+    iListBox->SetContainerWindowL(*this);
+    
+    // add scrollbars to listbox 
+    iListBox->CreateScrollBarFrameL(ETrue); 
+    
+    /**
+    * Sets the visibility state for both the horizontal and the vertical
+    * scrollbars. This is used when tiling.
+    */
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
+        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff);
+    
+    // get the pointer to listbox itemTextArray
+    iListBoxItems 
+            = static_cast<CDesCArray*>( iListBox->Model()->ItemTextArray() );
+    
+    //Set icons
+    CAknIconArray* icons = new (ELeave) CAknIconArray( KIconGranularity );
+    CleanupStack::PushL( icons );
+    
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) );
+
+    TFileName mbmFileName( KAknHomeMediaMbmFileName );
+    TFileName dllName 
+             = CEikonEnv::Static()->EikAppUi()->Application()->AppFullName();
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    mbmFileName.Insert( 0, drive );
+
+    // if new static menu item added constant KNumberOfItemsBeforePlugins
+    // has to be changed
+    AppendIconToArrayL( icons, skin,
+                        mbmFileName,
+                        KAknsIIDDefault,
+                        EMbmHomemediaQgn_prop_upnp_browse_home,
+                        EMbmHomemediaQgn_prop_upnp_browse_home_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        mbmFileName,
+                        KAknsIIDDefault,
+                        EMbmHomemediaQgn_prop_upnp_share_sub,
+                        EMbmHomemediaQgn_prop_upnp_share_sub_mask );
+    
+    static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->
+                                    FormattedCellData()->SetIconArray(icons);
+    
+    CleanupStack::Pop(icons);
+    
+    // Set the windows size
+    SetRect( aRect );
+    // Activate the window, which makes it ready to be drawn
+    ActivateL();
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaBaseListbox::AppendIconToArrayL()
+// --------------------------------------------------------------------------
+//
+void CHomeMediaBaseListbox::AppendIconToArrayL(CAknIconArray* aArray,
+                                               MAknsSkinInstance* aSkin,
+                                               const TDesC& aMbmFile,
+                                               const TAknsItemID& aID,
+                                               TInt aBitmapId,
+                                               TInt aMaskId)
+    {
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC(aSkin, aID,
+        bitmap, mask, aMbmFile, aBitmapId, aMaskId);
+
+    CGulIcon* icon = CGulIcon::NewL(bitmap, mask);
+    icon->SetBitmapsOwnedExternally(EFalse);
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop(mask);
+    CleanupStack::Pop(bitmap);
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL(icon);
+
+    aArray->AppendL(icon);
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop(icon);
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/src/homemediacontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main application window
+*
+*/
+
+
+
+
+
+#include <StringLoader.h> 
+#include <homemedia.rsg>
+
+// debug log support
+_LIT( KComponentLogfile, "homemedia.txt");
+#include "upnplog.h"
+
+#include "homemediacontainer.h"
+#include "upnppluginloader.h"
+#include "upnpfilesharingengine.h"
+#include "iupnp.hlp.hrh"
+
+//CONSTANTS
+#define KHomeMEdiaUID           0x2000F8D6 // home media app UID
+static const TInt KNumberOfItemsBeforePlugins( 2 );
+_LIT( KFormatWithOneStr , "%d\t%S\t\t" );
+_LIT( KFormatWithTwoStr , "%d\t%S\t%S\t" );
+
+// --------------------------------------------------------------------------
+// CHomeMediaContainer::NewL
+// --------------------------------------------------------------------------
+//
+CHomeMediaContainer* CHomeMediaContainer::NewL(const TRect& aRect,
+    CUPnPFileSharingEngine& aFileSharing,
+    const RPointerArray<CUPnPPluginInterface>& aPluginArray)
+    {
+    CHomeMediaContainer* self = 
+        CHomeMediaContainer::NewLC(aRect, aFileSharing, aPluginArray );
+    CleanupStack::Pop(self); 
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaContainer::NewLC
+// --------------------------------------------------------------------------
+//
+CHomeMediaContainer* CHomeMediaContainer::NewLC(const TRect& aRect,
+    CUPnPFileSharingEngine& aFileSharing,
+    const RPointerArray<CUPnPPluginInterface>& aPluginArray)
+    {
+    CHomeMediaContainer* self = 
+        new (ELeave) CHomeMediaContainer(aFileSharing,aPluginArray);
+    CleanupStack::PushL(self);
+    self->ConstructL(aRect);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaContainer::~CHomeMediaContainer
+// --------------------------------------------------------------------------
+//
+CHomeMediaContainer::~CHomeMediaContainer()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaContainer::UpdateL
+// --------------------------------------------------------------------------
+//
+void CHomeMediaContainer::UpdateL()
+    {
+    if( iListBoxItems->Count() > 0 )
+        {
+        iListBoxItems->Reset();
+        }
+    //Set Browse item
+    HBufC* columnText = StringLoader::LoadLC( R_HOMEMEDIA_BROWSEHOME_TEXT );
+    AddColumnL(KFormatWithOneStr,0,columnText);
+    CleanupStack::PopAndDestroy( columnText );
+
+    //Set Sharing item
+    HBufC* secondaryText = NULL;
+    if ( iFileSharing.SharingStateL() )
+        {
+        secondaryText = 
+            StringLoader::LoadLC( R_HOMEMEDIA_SHARE_ACTIVE_TEXT );
+        }
+    else
+        {
+        secondaryText = 
+            StringLoader::LoadLC( R_HOMEMEDIA_SHARE_INACTIVE_TEXT );
+        }
+
+    columnText = StringLoader::LoadLC( R_HOMEMEDIA_SHARECONTENT_TEXT );
+    AddColumnL( KFormatWithTwoStr,
+                1,
+                columnText,
+                secondaryText );
+    CleanupStack::PopAndDestroy( columnText );
+    CleanupStack::PopAndDestroy( secondaryText );
+
+    //Load plugins icons & texts
+    UpdatePluginsL();
+   }
+
+// --------------------------------------------------------------------------
+// CHomeMediaContainer::CHomeMediaContainer
+// --------------------------------------------------------------------------
+//
+CHomeMediaContainer::CHomeMediaContainer( 
+    CUPnPFileSharingEngine& aFileSharing,
+    const RPointerArray<CUPnPPluginInterface>& aPluginArray ):
+    iFileSharing( aFileSharing ),
+    iPluginArray( aPluginArray )
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaContainer::ConstructL
+// --------------------------------------------------------------------------
+//
+void CHomeMediaContainer::ConstructL(const TRect& aRect)
+    {
+    CAknDoubleLargeStyleListBox* listBoxModel
+                                   = new (ELeave)CAknDoubleLargeStyleListBox;
+    BaseConstructL( aRect , listBoxModel );
+    UpdateL();
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaContainer::UpdatePluginsL
+// --------------------------------------------------------------------------
+//
+void CHomeMediaContainer::UpdatePluginsL()
+    {
+    __LOG("CHomeMediaContainer::UpdatePluginsL begin");
+    CEikFormattedCellListBox* listBox = 
+        static_cast<CEikFormattedCellListBox*>( &ListBox() );
+
+    CArrayPtr<CGulIcon>& icons = 
+        *listBox->ItemDrawer()->FormattedCellData()->IconArray();
+    // Remove old plugins icons
+    TInt pluginIcons = icons.Count() - KNumberOfItemsBeforePlugins;
+    while( pluginIcons )
+        {
+        pluginIcons--;
+        CGulIcon* icon = icons[ KNumberOfItemsBeforePlugins ];
+        icons.Delete( KNumberOfItemsBeforePlugins );
+        delete icon;
+        icon = NULL;
+        }
+
+    for( TInt i = 0; i < iPluginArray.Count(); i++ )
+        {
+        //append icon
+        const CGulIcon& icon = iPluginArray[i]->GetIcon();
+        CGulIcon* copyIcon = CGulIcon::NewL( icon.Bitmap(), icon.Mask() );
+        CleanupStack::PushL( copyIcon );
+        // Icon is handled by us, but bitmaps by plugin
+        // when we delete icon, we delete icon only but not bitmaps
+        copyIcon->SetBitmapsOwnedExternally( ETrue );
+        icons.AppendL( copyIcon ); //Ownership goes to array
+        CleanupStack::Pop( copyIcon );
+
+        HBufC* primary = NULL;
+        HBufC* secondary = NULL;
+
+        // if title of the plugin is not null alloc space for it
+        if ( &(iPluginArray[i]->GetTitle()) )
+            {
+            primary = ( iPluginArray[i]->GetTitle() ).AllocLC();
+            }
+        else
+            {
+            primary = KNullDesC().AllocLC();
+            }
+
+        // if secondary text of the plugin is not null alloc space for it
+        if ( &(iPluginArray[i]->GetSecondaryText()) )
+            {
+            secondary = ( iPluginArray[i]->GetSecondaryText() ).AllocLC();
+            }
+        else
+            {
+            secondary = KNullDesC().AllocLC();
+            }
+
+        AddColumnL( KFormatWithTwoStr,
+                    i + KNumberOfItemsBeforePlugins,
+                    primary,
+                    secondary );
+
+        // deletion of the texts after they have been set to listbox item
+        CleanupStack::PopAndDestroy( secondary );
+        CleanupStack::PopAndDestroy( primary );
+        }
+    __LOG("CHomeMediaContainer::UpdatePluginsL end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// CHomeMediaContainer::GetHelpContext
+// ---------------------------------------------------------------------------
+//
+void CHomeMediaContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+
+    aContext.iMajor = TUid::Uid(0x2000F8D6);
+    aContext.iContext = KUPNP_HLP_MAIN_VIEW;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/homemedia/src/homemediadocument.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main document class
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "homemediaappui.h"
+#include "homemediadocument.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CHomeMediaDocument::NewL()
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CHomeMediaDocument* CHomeMediaDocument::NewL( CEikApplication& aApp )
+    {
+    CHomeMediaDocument* self = NewLC( aApp );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaDocument::NewLC()
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CHomeMediaDocument* CHomeMediaDocument::NewLC( CEikApplication& aApp )
+    {
+    CHomeMediaDocument* self = new ( ELeave ) CHomeMediaDocument( aApp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaDocument::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CHomeMediaDocument::ConstructL()
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CHomeMediaDocument::CHomeMediaDocument()
+// C++ default constructor can NOT contain any code, that might leave.
+// --------------------------------------------------------------------------
+//
+CHomeMediaDocument::CHomeMediaDocument( CEikApplication& aApp ) :
+    CAknDocument( aApp ),
+    iEcomDestructorKeys( 1 )
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CHomeMediaDocument::~CHomeMediaDocument()
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CHomeMediaDocument::~CHomeMediaDocument()
+    {
+    // Destroyes registered ecom plugin implementations.
+    TInt count = iEcomDestructorKeys.Count();
+    if ( count )
+        {
+        for ( TInt i = 0; i < count; i++ )
+            {
+            REComSession::DestroyedImplementation( iEcomDestructorKeys[i] );
+            }
+        }
+    iEcomDestructorKeys.Close();
+    
+    // Tears down ECom framework. Probably application enviroment does the same
+    // thing but it doesn't cause any harm it it is here as well.
+    REComSession::FinalClose();
+    }
+
+// ---------------------------------------------------------------------------
+// CHomeMediaDocument::CreateAppUiL()
+// Constructs CreateAppUi.
+// ---------------------------------------------------------------------------
+//
+CEikAppUi* CHomeMediaDocument::CreateAppUiL()
+    {
+    // Create the application user interface, and return a pointer to it;
+    // the framework takes ownership of this object
+    return new ( ELeave )CHomeMediaAppUi;
+    }
+
+// ---------------------------------------------------------------------------
+// CHomeMediaDocument::RegisterEcomDestructorKeyL()
+// ---------------------------------------------------------------------------
+//
+void CHomeMediaDocument::RegisterEcomDestructorKeyL( const TUid& aDestructorKey )
+    {
+    // Checks the given destructor key, does it exist already.
+    TInt idx = KErrNotFound;
+    TInt count = iEcomDestructorKeys.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if ( iEcomDestructorKeys[i] == aDestructorKey )
+            {
+            // Given TUid exists already.
+            idx = i;
+            break;
+            }
+        }
+    
+    if ( idx <= KErrNotFound )
+        {
+        // Appends new TUid in the list.
+        iEcomDestructorKeys.AppendL( aDestructorKey );
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/install/make_upnpapplications_sis.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,19 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:     Makes sisx for upnpapplications
+rem
+
+makesis upnpapplications.pkg
+signsis upnpapplications.sis upnpapplications.sisx  rd.cer rd-key.pem
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/install/make_upnpapplications_stub_sis.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,17 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:     Package file for upnpapplications stub
+rem
+
+makesis -s upnpapplications_stub.pkg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/install/upnpapplications.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,60 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:     Package file for upnpapplications
+;
+&EN
+
+; standard SIS file header
+#{"UPnPApplications"},(0x1028291A),1,0,0, TYPE=SA, RU
+
+;Localized Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;Supports Series 60 v 3.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+
+; HomeMedia
+"\Epoc32\release\armv5\urel\homemedia.exe"-"!:\sys\bin\homemedia.exe"
+"\Epoc32\data\z\resource\apps\homemedia.rsc"-"!:\resource\apps\homemedia.rsc"
+"\Epoc32\data\z\private\10003a3f\apps\homemedia_reg.rsc"-"!:\private\10003a3f\import\apps\homemedia_reg.rsc"
+"\epoc32\data\Z\resource\apps\homemedia_aif.mif"-"!:\resource\apps\homemedia_aif.mif"
+"\epoc32\data\Z\resource\apps\homemedia.mif"-"!:\resource\apps\homemedia.mif"
+
+; HomeSync
+"\epoc32\release\armv5\urel\mediaservant.exe"-"!:\sys\bin\mediaservant.exe"
+"\epoc32\data\z\private\10003a3f\apps\mediaservant_reg.rsc"-"!:\private\10003a3f\import\apps\mediaservant_reg.rsc"
+"\epoc32\data\z\resource\apps\mediaservant_aif.mif"-"!:\resource\apps\mediaservant_aif.mif"
+"\epoc32\data\z\resource\apps\mediaservant.mif"-"!:\resource\apps\mediaservant.mif"
+"\epoc32\release\armv5\urel\msengine.dll"-"!:\sys\bin\msengine.dll"
+"\epoc32\release\armv5\urel\msappwizard.dll"-"!:\sys\bin\msappwizard.dll"
+"\epoc32\data\z\resource\apps\msappwizard.mif"-"!:\resource\apps\msappwizard.mif"
+"\epoc32\data\z\resource\plugins\mediaservantplugin.rsc"-"!:\resource\plugins\mediaservantplugin.rsc"
+"\epoc32\release\armv5\urel\mediaservantplugin.dll"-"!:\sys\bin\mediaservantplugin.dll"
+"\epoc32\data\z\resource\plugins\msgsplugin.rsc"-"!:\resource\plugins\msgsplugin.rsc"
+"\epoc32\release\armv5\urel\msgsplugin.dll"-"!:\sys\bin\msgsplugin.dll"
+"\epoc32\release\armv5\urel\cmfillmanager.dll"-"!:\sys\bin\cmfillmanager.dll"
+"\epoc32\release\armv5\urel\cmstoremanager.dll"-"!:\sys\bin\cmstoremanager.dll"
+"\epoc32\release\armv5\urel\cmscheduler.dll"-"!:\sys\bin\cmscheduler.dll"
+"\epoc32\release\armv5\urel\cmmemorymanager.dll"-"!:\sys\bin\cmmemorymanager.dll"
+"\epoc32\release\armv5\urel\cmclient.dll"-"!:\sys\bin\cmclient.dll"
+"\epoc32\release\armv5\urel\cmserver.exe"-"!:\sys\bin\cmserver.exe"
+"\epoc32\data\z\resource\apps\mediaservant.rsc"-"!:\resource\apps\mediaservant.rsc"
+"\epoc32\data\z\resource\apps\cmsappwizard.rsc"-"!:\resource\apps\cmsappwizard.rsc"
+"\epoc32\data\z\resource\apps\memorymanager.rsc"-"!:\resource\apps\memorymanager.rsc"
+"\epoc32\data\z\resource\msgspluginsrc.rsc"-"!:\resource\msgspluginsrc.rsc"
+; End of file
Binary file homemedia/install/upnpapplications_stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/install/upnpapplications_stub.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,25 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:     Package file for upnpapplications stub
+;
+&EN
+
+; standard SIS file header
+#{"UPnPApplications"},(0x1028291A),1,0,0, TYPE=SA
+
+;Localized Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/loc/homemedia.loc	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Localization strings
+*
+*/
+
+
+
+
+
+
+//  LOCALISATION STRINGS
+
+//--------------------------------------------------------------------
+//
+//    Text of Home Media application in application grid
+//    and application title
+//
+//    "Home Media"
+//    "Home Media"
+//--------------------------------------------------------------------
+//
+
+//d:Icon text for the application grid
+//l:cell_app_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_grid_home_media                  "Home Media"
+
+
+//d:Title text for the application
+//d:This is visible in the title pane
+//l:title_pane_t2/opt9
+//r:2.0
+//
+#define qtn_iupnp_title_home_media                 "Home Media"
+
+
+
+//--------------------------------------------------------------------
+//
+//    Text of setting list items in the Home Media:
+//
+//    "Browse home"
+//    "Sharing"
+//--------------------------------------------------------------------
+//
+
+//d:First line text for the "Browse home" -listbox item in the main
+//d:pane of the Home Media application
+//d:This starts the browsing home network
+//l:list_double_large_graphic_pane_t1
+//r:2.0
+// 
+#define qtn_iupnp_browse_home                      "Browse home"
+
+
+//d:First line text for the "Sharing" -listbox item in the main
+//d:pane of the Home Media application
+//d:This starts the Sharing dialog
+//l:list_double_large_graphic_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_share                            "Sharing"
+
+
+
+//--------------------------------------------------------------------
+//
+//    Secondary text for the 2nd setting list 
+//    item "Share content":
+// 
+//    "Sharing is on"
+//    "Sharing is off"
+//--------------------------------------------------------------------
+//
+
+//d:Alternative second line text for the "Sharing" -listbox item
+//d:in the main pane of the Home Media application
+//d:Indicates that files can be seen through wlan network
+//l:list_double_large_graphic_pane_t2
+//r:2.0
+//
+#define qtn_iupnp_share_active                      "Sharing is on"
+
+
+//d:Alternative second line text for the "Sharing" -listbox item
+//d:in the main pane of the Home Media application
+//d:Indicates that files can not be seen through wlan network
+//l:list_double_large_graphic_pane_t2
+//r:2.0
+//
+#define qtn_iupnp_share_inactive                    "Sharing is off"
+
+
+
+//--------------------------------------------------------------------
+//
+//    Text of Home Media Options menu items:
+//    "Run wizard"
+//    "Settings"
+//
+//--------------------------------------------------------------------
+//
+
+//d:Menu text in Home Media
+//d:Start wizard dialog
+//l:list_single_pane_t1_cp2
+//r:1.0
+//  
+#define qtn_iupnp_options_run_wizard                 "Run wizard"
+
+
+//d:Menu text in Home Media
+//d:Start settings view
+//l:list_single_pane_t1_cp2
+//r:2.0
+//
+#define qtn_iupnp_options_settings_main              "Settings"
+
+
+//--------------------------------------------------------------------
+//
+//    Text to be shown in Home Media NaviPane depending on the sharing 
+//    status:
+//    
+//    "Not connected"
+//    "Connected"
+//
+//--------------------------------------------------------------------
+
+//d:Text in nave pane if sharing is not active
+//l:navi_text_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_navi_not_connected                 "Not connected"
+
+
+//d:Text in nave pane if sharing is active and iap is always ask
+//l:navi_text_pane_t1
+//r:wk50/2008
+//
+#define qtn_iupnp_navi_connected                     "Connected"
+
+
+//--------------------------------------------------------------------
+//
+//    Home Media wait notes:
+//    
+//    "Connecting"
+//--------------------------------------------------------------------
+//
+
+//d:Connecting wait note.
+//d:Shown when the user have selected Browse Home and waiting
+//d:for connection to be established.
+//l:popup_note_wait_window
+//r:wk51/2008
+//
+#define qtn_iupnp_wait_connecting                      "Connecting"
+
+
+//--------------------------------------------------------------------
+//
+//    Text to be shown in Home Media when the
+//    connection is failed
+//    
+//    "Connection failed"
+//--------------------------------------------------------------------
+//
+
+//d:Connection failed note
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_iupnp_err_con_failed                      "Connection failed"
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/rom/homemedia.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      homemedia subsystem ROM include file
+*
+*/
+
+
+
+
+
+
+#ifndef __HOMEMEDIA_IBY__
+#define __HOMEMEDIA_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // HomeMedia
+    S60_APP_EXE(HomeMedia)
+    S60_UPGRADABLE_APP_REG_RSC(HomeMedia)
+
+    // The stub sis file
+    data=ZSYSTEM\install\upnpapplications_stub.sis system\install\upnpapplications_stub.sis
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __HOMEMEDIA_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homemedia/rom/homemediaresources.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      homemedia subsystem resource ROM include file
+*
+*/
+
+
+
+
+
+
+#ifndef __HOMEMEDIARESOURCES_IBY__
+#define __HOMEMEDIARESOURCES_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // HomeMedia
+    data=DATAZ_\resource\apps\homemedia.rsc \resource\apps\homemedia.rsc
+    data=DATAZ_\resource\apps\homemedia.mif \resource\apps\homemedia.mif 
+    data=DATAZ_\resource\apps\homemedia_aif.mif \resource\apps\homemedia_aif.mif 
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __HOMEMEDIARESOURCES_IBY__
Binary file homesync/conf/mediaservant.confml has changed
Binary file homesync/conf/mediaservant_10281fab.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/bwins/cmfillmanageru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewFillManagerL@CmFillManagerFactory@@SAPAVMCmFmManager@@PAVMCmServiceObserver@@AAVCMdESession@@PAVCCmDmMain@@PAVCCmMmMain@@@Z @ 1 NONAME ; class MCmFmManager * CmFillManagerFactory::NewFillManagerL(class MCmServiceObserver *, class CMdESession &, class CCmDmMain *, class CCmMmMain *)
+	?NewFillManagerLC@CmFillManagerFactory@@SAPAVMCmFmManager@@PAVMCmServiceObserver@@AAVCMdESession@@PAVCCmDmMain@@PAVCCmMmMain@@@Z @ 2 NONAME ; class MCmFmManager * CmFillManagerFactory::NewFillManagerLC(class MCmServiceObserver *, class CMdESession &, class CCmDmMain *, class CCmMmMain *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/eabi/cmfillmanageru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN20CmFillManagerFactory15NewFillManagerLEP18MCmServiceObserverR11CMdESessionP9CCmDmMainP9CCmMmMain @ 1 NONAME
+	_ZN20CmFillManagerFactory16NewFillManagerLCEP18MCmServiceObserverR11CMdESessionP9CCmDmMainP9CCmMmMain @ 2 NONAME
+	_ZTI9CCmFmMain @ 3 NONAME ; #<TI>#
+	_ZTV9CCmFmMain @ 4 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Fill Manager
+*
+*/
+
+
+
+// Supported platforms
+prj_platforms
+DEFAULT
+
+// MMP files
+prj_mmpfiles
+cmfillmanager.mmp
+
+// Files to be exported
+prj_exports
+../inc/cmfillmanagerfactory.h   |../../../../../inc/cmfillmanagerfactory.h
+../inc/cmfillmanager.h          |../../../../../inc/cmfillmanager.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/group/cmfillmanager.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project Media servant
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          cmfillmanager.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10281FAC
+
+VENDORID        VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH     /sys/bin
+
+USERINCLUDE     ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../../../inc
+
+SOURCEPATH      ../src
+
+SOURCE          cmfillmanagerfactory.cpp
+SOURCE          cmfmmain.cpp
+SOURCE          cmfmfilldrivemngr.cpp
+SOURCE          cmfmmpxnotifier.cpp
+SOURCE          cmfmglxnotifier.cpp
+SOURCE          cmfmupnpmngr.cpp
+SOURCE          cmfmdownloadmngr.cpp
+SOURCE          cmfmdownloadproxy.cpp
+SOURCE          cmfmduplicatedetector.cpp
+SOURCE          cmfmmdeduplicatedetector.cpp
+SOURCE          cmfmmpxduplicatedetector.cpp
+SOURCE          cmfmfillrulefilleddatamngr.cpp
+SOURCE          cmfmao.cpp
+
+LIBRARY         euser.lib                   // Basic types
+LIBRARY         efsrv.lib                   // File server
+LIBRARY         charconv.lib                // Character conversion
+LIBRARY         bafl.lib
+LIBRARY         inetprotutil.lib            // EscapeUtils
+// Media servant specific libraries
+LIBRARY         cmcommon.lib                // Media servant common
+LIBRARY         cmdatabasemanager.lib       // Database manager
+LIBRARY         cmsettingsengine.lib        // Settings engine
+LIBRARY         cmmemorymanager.lib         // Memory manager
+LIBRARY         cmsqlwrapper.lib            // Sqlite wrapper
+// Upnp specific libs
+LIBRARY         upnpavcontrollerclient.lib  // Av controller client
+LIBRARY         upnpavcontrollerhelper.lib  // Av controller helper
+LIBRARY         upnpavobjects.lib           // Upnp Av objects
+LIBRARY         ws32.lib                    // RWsSession, CWsScreenDevice
+LIBRARY         upnpxmlparser.lib           // Xml parser
+// Metadata engine client
+LIBRARY         mdeclient.lib        
+// MPX framework
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxharvesterutility.lib
+LIBRARY         mpxcollectionmediator.lib
+LIBRARY         contentlistingframework.lib
+// Path infos
+LIBRARY         PlatformEnv.lib
+// Debug
+DEBUGLIBRARY    flogger.lib
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfillmanager.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fill manager interface
+*
+*/
+
+
+#ifndef M_CMFMMANAGER_H
+#define M_CMFMMANAGER_H
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <badesca.h>
+#include "cmcommon.h"
+#include "cmcommontypes.h"
+
+// FORWARD DECLARATIONS
+class CCmSqlPropertyCollector;
+class CCmSqlPropertyContainer;
+class MUPnPAVController;
+class CCmMediaServerFull;
+
+/**
+ *  Defines the fill manager interface
+ *
+ *  This class defines the fill manager interface. Provides methods to
+ *  execute fill specific services
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( MCmFmManager )
+    {
+
+public:
+
+    /**
+     * Starts fill service
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */    
+    virtual void StartFillL() = 0;
+
+    /**
+     * Cancels fill service
+     *
+     * @since S60 5.1     
+     * @param None
+     * @return  None
+     */        
+    virtual void CancelOperation() = 0;
+
+    /**
+     * Pre-process fill lists
+     *
+     * @since S60 5.1     
+     * @param None
+     * @return  None
+     */        
+    virtual void PreProcessListsL() = 0;
+
+    /**
+     * Processes defined fill list
+     *
+     * @since S60 5.1     
+     * @param aFillListName, name of the fill list
+     * @return  None
+     */    
+    virtual void PreProcessListL( const TDesC8& aFillListName ) = 0;
+
+    /**
+     * Provides metadata column item list
+     *
+     * @since S60 5.1     
+     * @param aType, metadata field
+     * @param aMedia, media type
+     * @param aArray, array of field values
+     * @return  None
+     */
+    virtual void GetColItemsL( TCmMetadataField aType, 
+        TCmMediaType aMedia, CDesCArray& aArray ) = 0;
+    
+    /**
+     * Provides metadata column item list
+     *
+     * @since S60 5.1     
+     * @param aType, metadata field
+     * @param aMedia, media type
+     * @param aPropertys, container of field values
+     * @return  None
+     */
+    virtual void GetColItemsL( TCmMetadataField aType, 
+        TCmMediaType aMedia, CCmSqlPropertyContainer& aPropertys ) = 0;
+
+    /**
+     * Provides metadata items list
+     *
+     * @since S60 5.1     
+     * @param aPropertys, property collector reference
+     * @return  None
+     */    
+    virtual void GetMetadataItemsL(
+                            CCmSqlPropertyCollector& aPropertys ) = 0;
+    /**
+     * Sets av controller
+     *
+     * @since S60 5.1     
+     * @param aAVController, pointer to av controller
+     * @return  None
+     */        
+    virtual void SetAvController( MUPnPAVController* aAVController ) = 0; 
+
+    /**
+     * Update fill list item priorities
+     *
+     * @since S60 5.1     
+     * @param None
+     * @return  None
+     */     
+    virtual void UpdatePriorities() = 0;
+
+    /**
+     * Update fill list item reference values
+     *
+     * @since S60 5.1     
+     * @param None
+     * @return  None
+     */    
+    virtual void UpdateRefIds() = 0;
+    
+    /**
+     * Delete metadata from defined servers
+     *
+     * @since S60 5.1
+     * @param None     
+     * @return  None
+     */ 
+    virtual void DeleteMetadataL() = 0;       
+        
+    /**
+     * Closes the utility and deletes the object
+     *
+     * @since S60 5.1
+     * @param None     
+     * @return  None     
+     */
+    virtual void Close() = 0;            
+    
+    };
+
+
+#endif // M_CMFMMANAGER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfillmanagerfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Abstract factory for Fill Manager
+*
+*/
+
+
+
+#ifndef C_CMFILLMANAGERFACTORY_H
+#define C_CMFILLMANAGERFACTORY_H
+
+#include <e32std.h>
+
+class MCmFmManager;
+class MCmServiceObserver;
+class CMdESession;
+class CCmDmMain;
+class CCmMmMain;
+
+/**
+ *  Abstract factory for Fill manager
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+class CmFillManagerFactory
+    {
+
+public:
+
+    /**
+     * Creates a new instance of Fill Manager
+     *
+     * @since S60 5.1
+     * @param aObserver, service observer
+     * @param aSession, mde session
+     * @param aDBManager, database manager
+     * @param aMemManager, memory manager
+     * @return  pointer to CCmFmMain class
+     */
+    IMPORT_C static MCmFmManager* NewFillManagerL( 
+        MCmServiceObserver* aObserver, CMdESession& aSession, 
+        CCmDmMain* aDBManager, CCmMmMain* aMemManager );
+
+    /**
+     * Creates a new instance of Fill Manager. Instance is left in
+     * cleanup stack.
+     *
+     * @since S60 5.1     
+     * @param aObserver, service observer
+     * @param aSession, mde session
+     * @param aDBManager, database manager
+     * @param aMemManager, memory manager
+     * @return  pointer to MCmFmManager class
+     */
+    IMPORT_C static MCmFmManager* NewFillManagerLC( 
+        MCmServiceObserver* aObserver, CMdESession& aSession, 
+        CCmDmMain* aDBManager, CCmMmMain* aMemManager );
+
+    };
+
+#endif // C_CMFILLMANAGERFACTORY_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmao.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fill rule and filled data managing Active object
+*
+*/
+
+
+
+#ifndef __CMFMAO_H
+#define __CMFMAO_H
+
+#include <e32base.h>
+
+
+
+// Forward Declarations
+class CCmFmFillRuleFilledDataMngr;
+      
+ /**
+  *  Class asyncronous request completions from sqlite wrapper 
+  *
+  *  @lib cmfillmanager.lib
+  *
+  *  @since S60 5.1
+  */
+NONSHARABLE_CLASS( CCmFmAo ): public CActive
+    {
+                
+public:    
+
+    /**
+     * Creates new CCmFmAo class
+     *
+     * @since S60 5.1
+     * @param aMngr, main class
+     * @return  pointer to CCmFmAo class
+     */
+    static CCmFmAo* NewL( CCmFmFillRuleFilledDataMngr& aMngr );
+    
+    /**
+     * Creates new CCmFmAo class
+     *
+     * @since S60 5.1
+     * @param aMngr, main class
+     * @return  pointer to CCmFmAo class
+     */
+    static CCmFmAo* NewLC( CCmFmFillRuleFilledDataMngr& aMngr );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmAo(); 
+
+// Functions from base class CActive
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void DoCancel();
+    
+    /**
+     * From CActive
+     * See base class definition
+     */
+    virtual TInt RunError( TInt aError );
+        
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aMngr, fill rule filled data manager
+     */
+    CCmFmAo( CCmFmFillRuleFilledDataMngr& aMngr );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private:
+    
+    /**
+     * Main manager class
+     */
+    CCmFmFillRuleFilledDataMngr& iMngr;
+    
+    /**
+     * State variable if ETrue ao is on idle state
+     */
+    TBool iIdle;
+ 
+    };
+
+#endif //  __CMFMAO_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmcommon.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common header for fill manager
+*  Version     : %version: tr1ido#7 % << Don't touch!
+*
+*/
+
+
+#ifndef CMFMCOMMON_H
+#define CMFMCOMMON_H
+
+// Fill temp file
+_LIT( KCmFmTempFile, "cm_temp" );
+
+
+// Status codes used in Fill Manager
+enum TCmFmStatus
+    {
+    ECmFmNULL = 0,
+    ECmFmFillRuleProgessingStarted, // Rule processing started
+    ECmFmFillRulesReady,            // Not used at the moment
+    ECmFmMMCCheckStarted,           // memory card check starting
+    ECmFmDeviceListingStarted,      // Not used at the moment
+    ECmFmWrongMMC,                  // Wrong memory card found
+    ECmFmMMCOk,                     // Memory ok
+    ECmFmMMCCheckFailed,            // Memory checking failed
+    ECmFmNoConnection,              // Not used at the moment 
+    ECmFmConnectionLost,            // Not used at the moment 
+    ECmFmStartUriCheck,             // Starting Uri check
+    ECmFmDeleteFiles,               // Starting delete files
+    ECmFmShrinkImage,               // Starting shrink images
+    ECmFmBrowseReady,               // Browse to check uri ready
+    ECmFmUriOK,                     // Uri ok
+    ECmFmCheckItem                  // Starting check item
+    };
+
+// File transfer statuses
+enum TCmFmTransferStatus
+    {
+    ECmFmFileFetchStarted = 20,     // File copy started
+    ECmFmFileFetched                // File copied
+    };  
+
+// Uri check statuses    
+enum TCmFmUriCheckResult
+    {
+    ECanceled = 25,                 // Operation canceled
+    ENoUriAvailable,                // Uri not available
+    EUriChecked                     // Uri checked
+    };
+
+// Fill list processing statuses    
+enum TCmFmFillRuleProcessing 
+    {
+    EProcessingStarted = 60,        // Fill rule processing started
+    EProcessing,                    // Processing on-going
+    EProcessingReady,               // Processing ready
+    EQueryCompleted,                // Metadata query completed
+    EQueryFailed,                   // Metadata query failed
+    ENextFillRule,                  // Processing next rule
+    EFillRulesLoaded,               // Fill rules loaded
+    ENoRulesSelected,               // Rules selected
+    ENoObjectsSelected,             // Fill objects selected
+    EProcessingCanceled,            // Canceled
+    EPreProcessingStarted,          // Preprocessing started
+    EFillFilesLoaded,               // Files loaded
+    EProcessStatusValues,           // Processing file statuses
+    ERandomizingStarted,            // Randomizing list
+    EColumnDataReady,               // Property columns got
+    EProcessDuplicates,             // Processing duplicate files
+    EProcessReferenceValues,        // Processing reference files end
+    EProcessingFailed,              // Processing failed
+    EUpdatePriorities,              // Updating fill list priorities
+    EDoUpdatePriorities,            // Do update priorities
+    EMetadataDeleted                // Metadata deleted
+    };    
+    
+#endif // CMFMCOMMON_H
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadmngr.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages upnp download
+*
+*/
+
+
+
+#ifndef __CMFMDOWNLOADMNGR_H
+#define __CMFMDOWNLOADMNGR_H
+
+#include <e32base.h>
+#include <f32file.h>
+#include "upnpfiletransfersessionobserver.h"
+
+/* Forward declarations. */
+class MUPnPAVController;
+class CUpnpAVDevice;
+class MCmFmTransferObserver;
+
+// CLASS DECLARATION
+ /**
+  *  Class represents methods to communication with AV Controller API.
+  *
+  *  @lib cmfillmanager.lib
+  *
+  *  @since S60 5.1
+  */
+NONSHARABLE_CLASS( CCmFmDownloadMngr ): public CBase,
+                          public MUPnPFileTransferSessionObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aAVController, av controller
+     * @param aObserver, action observer
+     * @param aDevice, device
+     * @param aDownloadId, id for the download manager
+     * @return  pointer to CCmFmDownloadMngr class
+     */
+    static CCmFmDownloadMngr* NewL( MUPnPAVController* aAVController, 
+        MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice,
+        const TInt aDownloadId  );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aAVController, av controller
+     * @param aObserver, action observer
+     * @param aDevice, device      
+     * @param aDownloadId, id for the download manager
+     * @return  pointer to CCmFmDownloadMngr class
+     */
+    static CCmFmDownloadMngr* NewLC( MUPnPAVController* aAVController, 
+        MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice,
+        const TInt aDownloadId  );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmDownloadMngr();
+
+public: 
+        
+    /**
+    * Starts to fetch defined file
+    *
+    * @since S60 5.1
+    * @param aResElement, pointer to av controller
+    * @param aItem, item to be transferred
+    * @param aFile, file to be downloaded
+    * @param aInternalItemId, internal item index
+    * @return None
+    */ 
+    void FetchFileL( const CUpnpElement& aResElement, 
+        const CUpnpItem& aItem, RFile& aFile, const TInt64 aInternalItemId );
+    
+    /**
+    * Cancel UPnP operation
+    *
+    * @since S60 5.1
+    * @param None
+    * @return None
+    */    
+    void CancelOperation();
+
+protected: 
+    
+// From base class MUPnPFileTransferSessionObserver
+
+    /**
+     * From MUPnPFileTransferSessionObserver
+     * @see base class definition
+     */
+    void TransferStarted( TInt aKey, TInt aStatus );
+ 
+    /**
+     * From MUPnPFileTransferSessionObserver
+     * @see base class definition
+     */
+     void TransferCompleted( TInt aKey, TInt aStatus,
+                             const TDesC& aFilePath );
+    
+    /**
+     * From MUPnPFileTransferSessionObserver
+     * @see base class definition
+     */
+    void TransferProgress( TInt aKey, TInt aBytes, TInt aTotalBytes );
+
+    /**
+     * From MUPnPFileTransferSessionObserver
+     * @see base class definition
+     */        
+    void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );
+                           
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aAVController, av controller
+     * @param aObserver, transfer observer
+     * @param aDownloadId, download manager id
+     */
+    CCmFmDownloadMngr( MUPnPAVController* aAVController, 
+        MCmFmTransferObserver* aObserver, const TInt aDownloadId );
+
+    /**
+     * Performs the second phase construction.
+     * @since S60 5.1
+     * @param aDevice, UPnP server
+     */
+    void ConstructL( const CUpnpAVDevice& aDevice );
+    
+
+private:
+    
+    /**
+     * AV Controller
+     */
+    MUPnPAVController* iAVController;                   // Not owned
+    
+    /**
+     * File transfer Observer
+     */
+    MCmFmTransferObserver* iObserver;                   // Not owned
+    
+    /**
+     * Download manager id. Proxy identifies managers with this id
+     */
+    TInt iDownloadId;
+    
+    /**
+     * Download session
+     */
+    MUPnPFileDownloadSession* iDownloadSession;         // Not owned
+
+    /**
+     * Size of transferred file
+     */
+    TInt64 iFileSize;
+    
+    };
+
+#endif //  __CMFMDOWNLOADMNGR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadproxy.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages upnp download
+*
+*/
+
+
+
+#ifndef __CMFMDOWNLOADPROXY_H
+#define __CMFMDOWNLOADPROXY_H
+
+#include <e32base.h>
+
+/* Forward declarations. */
+class MUPnPAVController;
+
+class CUpnpAVDevice;
+class MCmFmTransferObserver;
+class CCmFmDownloadMngr;
+
+// CLASS DECLARATION
+ 
+/**
+ *  Class represents methods to communication with AV Controller API.
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CCmFmDownloadProxy ): public CBase
+    {
+ 
+private:
+    
+    // Struct containing indexed download session 
+    // ( own session for each server )
+    struct TCmFmDownloadSessionIndexes
+        {
+        TInt iDeviceIndex;  // Device index
+        TInt iSessionIndex; // Session index
+        };
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     */
+    static CCmFmDownloadProxy* NewL( );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     */
+    static CCmFmDownloadProxy* NewLC( );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmDownloadProxy();
+
+public: 
+            
+    /**
+     * Starts to fetch defined file
+     *
+     * @since S60 5.1
+     * @param aObserver, action observer
+     * @param aAVController, pointer to av controller
+     * @param aDevices, list of devices        
+     * @param aResElement, pointer to av controller
+     * @param aItem, item to be transferred
+     * @param aFile, file reference
+     * @param aInternalDeviceIndex, internal device index
+     * @param aInternalItemId, internal item index
+     * @return None
+     */ 
+    void FetchFileL( MCmFmTransferObserver* aObserver, 
+        MUPnPAVController* aAVController, CUpnpAVDeviceList* aDevices, 
+        const CUpnpElement& aResElement, 
+        const CUpnpItem& aItem, RFile& aFile, const TInt aInternalDeviceIndex,
+        const TInt64 aInternalItemId );
+   
+    /**
+     * Closes download session
+     *
+     * @since S60 5.1
+     * @param aSessionId, session to be closed
+     * @return ETrue, if sessions left
+     */    
+    TBool CloseDownloadSession( const TInt aSessionId );
+    
+    /**
+     * Cancel UPnP operation download
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void CancelOperation();
+    
+private:
+
+    /**
+     * Starts new download session if session to 
+     * defined device doesn't already exist.
+     *
+     * @since S60 5.1
+     * @param aObserver, action observer
+     * @param aAVController, pointer to av controller
+     * @param aDevices, list of devices       
+     * @param aInternalDeviceIndex, internal device index
+     * @return index of the used session
+     */    
+    TInt StartNewDownloadSessionIfNeededL( MCmFmTransferObserver* aObserver, 
+        MUPnPAVController* aAVController, 
+        CUpnpAVDeviceList* aDevices, 
+        const TInt aInternalDeviceIndex );
+
+    /**
+     * Creates new download session
+     *
+     * @since S60 5.1
+     * @param aObserver, action observer
+     * @param aAVController, pointer to av controller
+     * @param aDevices, list of devices       
+     * @param aSessionCount, session count
+     * @param aSessionIndex, ref to session index
+     * @return index of the used session
+     */        
+    void CreateNewSessionL(  
+        MCmFmTransferObserver* aObserver, MUPnPAVController* aAVController, 
+        CUpnpAVDeviceList* aDevices, TInt aSessionCount, 
+        TInt& aSessionIndex );                              
+                           
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmFmDownloadProxy( );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private:
+    
+    /**
+     * Download sessions
+     */
+    RPointerArray<CCmFmDownloadMngr> iDownloadSessions;
+    
+    /**
+     * Indexed array for download sessions
+     */
+    RArray<TCmFmDownloadSessionIndexes> iSessionIndexes;
+    
+    /**
+     * Count of download session
+     */
+    TInt iDownloadSessionCount;
+    
+    };
+
+#endif //  __CMFMDOWNLOADPROXY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmduplicatedetector.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles duplicate detection
+*
+*/
+
+
+
+#ifndef __CMFMDUPLICATEDETECTOR_H
+#define __CMFMDUPLICATEDETECTOR_H
+
+#include <e32base.h>
+
+// Forward declarations
+class CCmFillListItem;
+class CMdESession;
+class CCmFmMdEDuplicateDetector;
+class CCmFmMpxDuplicateDetector;
+class MCmFmItemHandlerObserver;
+
+// Class declaration
+    
+/**
+ *  CCmFmDuplicateDetector class
+ *  Part of Fill manager. CCmFmDuplicateDetector manages
+ *  duplicate detection
+ * 
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CCmFmDuplicateDetector ) : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer class
+     * @param aSession, mde session
+     * @return  pointer to CCmFmDuplicateDetector class
+     */
+    static CCmFmDuplicateDetector* NewL( MCmFmItemHandlerObserver& aObserver,
+        CMdESession& aSession );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer class  
+     * @param aSession, mde session   
+     * @return  pointer to CCmFmDuplicateDetector class
+     */
+    static CCmFmDuplicateDetector* NewLC( MCmFmItemHandlerObserver& aObserver,
+        CMdESession& aSession );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmDuplicateDetector();    
+    
+public:
+
+    /**
+     * Check if file is duplicate.
+     * @param aItem, item to be checked
+     * @return None
+     */
+    void CheckItemL( const CCmFillListItem& aItem ); 
+
+    /**
+     * Add to items array for duplicated check
+     * @param aItem, item to be append
+     * @return None
+     */
+    void AppendToArrayL( const CCmFillListItem& aItem );
+    
+    /**
+     * reset the duplicator check array
+     * @param None
+     * @return None
+     */
+    void ResetArray();
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmFmDuplicateDetector( );
+
+    /**
+     * Performs the second phase construction.
+     *
+     * @since S60 5.1
+     * @param aObserver, item handler observer
+     * @param aSession, mde session
+     */
+    void ConstructL( MCmFmItemHandlerObserver& aObserver,
+        CMdESession& aSession );
+    
+
+private:
+
+    /**
+     * MdE (Video & Image) duplicate detector
+     */
+    CCmFmMdEDuplicateDetector* iCmFmMdEDuplicateDetector; // owned
+    
+    /**
+     * Mpx (Music) duplicate detector
+     */
+    CCmFmMpxDuplicateDetector* iCmFmMpxDuplicateDetector; // owned
+                    
+    };
+
+#endif //  __CMFMDUPLICATEDETECTOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfilldrivemngr.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fill drive manager class
+*
+*/
+
+
+
+#ifndef __CMFMFILLDRIVEMNGR_H
+#define __CMFMFILLDRIVEMNGR_H
+
+#include <e32base.h>
+#include "cmfmcommon.h"
+
+// Forward declarations
+class CCmDriveInfo;
+
+/**
+ *  CCmFmFillDriveMngr class
+ *  Part of Fill manager. CCmFmFillDriveMngr manages
+ *  driveId checking, which is executed before every fill
+ *  operation.
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CCmFmFillDriveMngr ): public CBase
+    {
+
+public:
+
+    /**     
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aFs, File server session
+     * @param aDrives, dirve array
+     * @return  pointer to CCmFmFillDriveMngr class
+     */
+    static CCmFmFillDriveMngr* NewL( RFs& aFs, 
+        RPointerArray<CCmDriveInfo>& aDrives );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aFs, File server session
+     * @param aDrives, dirve array
+     * @return  pointer to CCmFmFillDriveMngr class
+     */
+    static CCmFmFillDriveMngr* NewLC( RFs& aFs, 
+        RPointerArray<CCmDriveInfo>& aDrives );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmFillDriveMngr();
+    
+public: 
+    
+    /**
+     * Checking Drive Id
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TCmFmStatus status of the drive id check
+     */    
+    TCmFmStatus CheckDriveId();
+
+    /**
+     * Checkking if the Drive has a capasity for saving the file
+     *
+     * @since S60 5.1
+     * @param aFileSize, size of the file
+     * @param aDriveId, drive id
+     * @param aDriveNumber, drive number ( -1 if no space left )
+     * @return index to drive array
+     */        
+    TInt CheckFreeDiscSpace( TUint32 aFileSize, TUint& aDriveId, 
+                             TInt& aDriveNumber );                           
+    
+private:
+
+    /**
+     * Mounts file system
+     *
+     * @since S60 5.1
+     * @param aFileServer, file server session
+     * @param aVolInfo, drive info
+     * @param aDriveNumber, drive number
+     * @return error code
+     */  
+    TInt DoMountFileSystem( RFs& aFileServer, TVolumeInfo& aVolInfo, 
+        TInt aDriveNumber );
+    
+    /**
+     * Selects drive to be used
+     *
+     * @since S60 5.1
+     * @param None
+     * @return Drive number
+     */    
+    TInt SelectDrive();
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aFs, file server
+     * @param aDrives, drive array
+     */
+    CCmFmFillDriveMngr( RFs& aFs, 
+        RPointerArray<CCmDriveInfo>& aDrives );
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private:
+    
+    /**
+     * File server session
+     */ 
+    RFs iFsSession;
+    
+    /**
+     * Drive info array
+     */ 
+    RPointerArray<CCmDriveInfo>& iDrives;
+    
+    };
+
+#endif //  __CMFMFILLDRIVEMNGR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfillrulefilleddatamngr.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,648 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fill rule and filled data managing
+*  Version     : %version: tr1ido#8 % << Don't touch!
+*
+*/
+
+
+
+#ifndef __CMFMFILLLIST_H
+#define __CMFMFILLLIST_H
+
+#include <e32base.h>
+#include <f32file.h>
+#include "cmcommontypes.h"
+#include "cmcommon.h"
+#include "cmfmcommon.h"
+
+// Forward declarations
+class MCmSqlMain;
+class CCmDmMain;
+class CCmFillRule;
+class CCmFillListItem;
+class CCmFillRuleContainer;
+class CCmSqlPropertyItem;
+class CCmSqlPropertyContainer;
+class CCmFmAo;
+class MCmFmFillRuleObserver;
+class CCmSqlPropertyCollector;
+             
+ /**
+  *  Class processes selected fill rules. Uses Database Manager and 
+  *  Sqlite wrapper API to retrieve wanted metadata. Fill service is 
+  *  started using processed metadata items. 
+  *
+  *  @lib cmfillmanager.lib
+  *
+  *  @since S60 5.1
+  */
+NONSHARABLE_CLASS( CCmFmFillRuleFilledDataMngr ): public CActive
+    {
+
+private: // enumerations
+
+    // Metadata processing states
+    enum TCmFmMetadaProcessingState
+        {
+        ECmFmIdle            = 0,
+        ECmFmLoadingMetadata,
+        ECmFmLoadingPropertys,
+        ECmFmDeletingMetadata,
+        ECmFmLoadingProfileIds
+        };         
+            
+public:
+       
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer for metadata processing
+     * @param aDBMngr, database manager
+     * @param aItems, items pointers array
+     * @return  pointer to CCmFmFillRuleFilledDataMngr class
+     */
+    static CCmFmFillRuleFilledDataMngr* NewL(
+        MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr,
+        RPointerArray<CCmFillListItem>& aItems );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer for metadata processing
+     * @param aDBMngr, database manager
+     * @param aItems, items pointers array
+     * @return  pointer to CCmFmFillRuleFilledDataMngr class
+     */
+    static CCmFmFillRuleFilledDataMngr* NewLC(
+        MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr,
+        RPointerArray<CCmFillListItem>& aItems );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmFillRuleFilledDataMngr();
+
+public: 
+
+    /**
+     * Notified when asyncronous operation is completed
+     *
+     * @since S60 5.1
+     * @param aStatus, completion status
+     * @return None
+     */ 
+    void OperationCompletedL( TInt aStatus );
+
+   /**
+     * Loads profile ids from database
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */ 
+    void LoadProfileIdsL();
+        
+    /**
+     * Starting fill rule pre-processing
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void PreprocessListsL();
+    
+    /**
+     * Starting fill rule processing
+     *
+     * @since S60 5.1
+     * @param aFillListName, name of the list
+     * @return None
+     */    
+    void PreProcessListL( const TDesC8& aFillListName );
+    
+    /**
+     * Provides metadata column item list
+     *
+     * @since S60 5.1
+     * @param aType, metadata field identifier
+     * @param aMedia, media type identifier
+     * @param aPropertys, property container reference
+     * @return  None
+     */
+    void GetColItemsL( TCmMetadataField aType, 
+        TCmMediaType aMedia, CCmSqlPropertyContainer& aPropertys );   
+
+    /**
+     * Provides metadata items list
+     *
+     * @since S60 5.1
+     * @param aPropertys, property collector reference
+     * @return  None
+     */    
+    void GetMetadataItemsL( CCmSqlPropertyCollector& aPropertys );
+    
+    /**
+     * Update fill list item priorities and reference values
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */
+    void UpdatePriorities();
+
+    /**
+     * Do update fill list item reference ids
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */
+    void DoUpdateReferenceIdsL();
+
+    /**
+     * Delete metadata from unselected servers
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */ 
+    void DeleteMetadataL();
+                
+    /**
+     * Sets memory card quota to wrapper
+     *
+     * @since S60 5.1
+     * @param aQuota, fill quota
+     * @return  None
+     */    
+    void SetMemoryCardQuota( TInt64 aQuota );
+    
+    /**
+     * Canceling operations
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void CancelOperation();
+    
+    /**
+     * Updating transfer history
+     *
+     * @since S60 5.1
+     * @param aInterval, used time
+     * @param aDataAmount, amount of transferred data
+     * @param aServerId, server from where data transferred
+     * @return  None
+     */
+    void UpdateTransferHistoryData( TInt64 aInterval,
+                                    TInt64 aDataAmount,
+                                    TUint8 aServerId );
+
+    /**
+     * Loads wanted items from the db
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */                            
+    void GetFillItemsL();
+
+    /**
+     * Loads to be deleted items from the db
+     *
+     * @since S60 5.1
+     * @param aArray, array of to be deleted items
+     * @return  None
+     */        
+    void GetToBeDeletedL( RPointerArray<CCmFillListItem>& aArray );
+
+    /**
+     * Updates listed items into db
+     *
+     * @since S60 5.1
+     * @param aCancel, if this opration is called by cancel harvest
+     * @return  None
+     */       
+    void UpdateFillItems( TBool aCancel = EFalse );
+
+    /**
+     * Updates listed items into db
+     *
+     * @since S60 5.1     
+     * @param aArray, array of to be deleted items
+     * @return  None
+     */        
+    void UpdateToBeDeleted( RPointerArray<CCmFillListItem>& aArray );
+
+    /**
+     * Loads right Uuid 
+     *
+     * @since S60 5.1
+     * @param aUuid, contains uuid on return
+     * @param aId, id of the wanted uuid
+     * @return error code
+     */        
+    TInt GetUuidL( HBufC8*& aUuid, TUint8 aId );
+    
+   /**
+     * Resets allocated data
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    void ResetData();
+        
+   /**
+     * Calculating transfer history time
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void CalculateAvgTransferTimeL();
+    
+   /**
+     * Publishes transfer history time estimate
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void SendAvgTransferTime();
+    
+    /**
+     * Returns media servers db id
+     *
+     * @since S60 5.1
+     * @param aUuid, media server's uuids
+     * @return database id
+     */     
+    TInt64 GetMediaServerIdL( const TDesC8& aUuid );            
+                                    
+private:
+
+    /**
+     * Do update fill list item priorities
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void DoUpdatePrioritiesL();
+        
+    /**
+     * Loading all selected fill rules
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void LoadSelectedFillRulesL();
+
+    /**
+     * Loading all fill rules
+     *
+     * @since S60 5.1
+     * @param None
+     * @return Fill rule container
+     */ 
+    CCmFillRuleContainer* LoadAllFillRulesL();
+    
+    /**
+     * Loads defined fill list
+     *
+     * @since S60 5.1
+     * @param aFillListName, name of the list
+     * @return None
+     */        
+    void LoadRuleL( const TDesC8& aFillListName );
+    
+    /**
+     * Updates fill list item priorities up to date
+     *
+     * @since S60 5.1
+     * @param aContainer, container containing all rules
+     * @return None
+     */     
+    TInt UpdateListItemPriorities( CCmFillRuleContainer* aContainer );
+            
+    /**
+     * Initializing metadata find
+     *
+     * @since S60 5.1
+     * @param aFillRule, fill list
+     * @return None
+     */                        
+    void LoadMetadataL( CCmFillRule* aFillRule );
+    
+    /**
+     * Processing possible fill file list duplicates 
+     * and adds reference values if needed
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void ProcessReferenceValuesL();
+
+    /**
+     * Processes possible fill file list duplicates 
+     * and adds reference values if needed
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void DoProcessReferenceValuesL();
+    
+    /**
+     * Processing possible fill file list duplicates,
+     * removes duplicates appeared in new sql query
+     * If same item is twice in item list, 
+     * new item is removed
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void ProcessDuplicates();
+    
+    /**
+     * Selects fill list files which are with defined rule id
+     *
+     * @since S60 5.1
+     * @param aList, list to be filled
+     * @param aId, fill list id
+     * @return None
+     */        
+    void SelectFillListFiles( RArray<TInt>& aList, TUint8 aId );
+    
+    /**
+     * Updates status values of the fill list files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void ProcessFileStatusValuesL();
+    
+     /**
+     * Updatas the fill file's ids.
+     *
+     * @since S60 5.1
+     * @param aDelIds,array to store files's id 
+     * @param aIndex, Index of fill items
+     * @param aRealCount, count of fill items
+     * @param aRealSize, size of fill items
+     * @return None
+     */ 
+     void ProcessFileSizeAndCount( RArray<TInt>& aDelIds, TInt aIndex, 
+                            TInt64& aRealCount, TInt64& aRealSize );
+
+    /**
+     * Loads all fill file items
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void LoadAllFillItemsL();
+    
+    /**
+     * Delete duplicated fill items and adjust array
+     *
+     * @since S60 5.1
+     * @param aIndex, Index array of fill items
+     */     
+	void DoDeleteProcess( TInt aIndex );
+
+   /**
+     * Defines unsupported dlna profile ids
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */ 
+    void DefineAndSetDlnaProfileIdFiltersL();   
+
+   /**
+     * Completes request
+     *
+     * @since S60 5.1
+     * @param aStatus, defined id for the completing 
+     * @return None
+     */     
+    void CompleteRequest( TCmFmFillRuleProcessing aStatus );
+ 
+    /**
+     * Starts asyncronous operartion observer
+     * i.e. creates active object
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void StartObserverL();
+
+    /**
+     * Creates metadata cache wrapper
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void CreateWrapperL();
+    
+    /**
+     * Deletes metadata cache wrapper
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */ 
+    void DeleteWrapper();     
+
+    /**
+     * Processes fill lists
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */ 
+    void CheckFillListsL();
+    
+    /**
+     * Deletes hash codes
+     * @since S60 5.2
+     * @param None
+     * @return None
+     */ 
+    void DeleteHashCodesL();
+    
+protected: 
+
+// Functions from base class CActive
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void DoCancel();
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    virtual TInt RunError(TInt aError);
+        
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aObserver, Fill list observer
+     * @param aDBMngr, database manager
+     * @param aItems, array of list items
+     */
+    CCmFmFillRuleFilledDataMngr( MCmFmFillRuleObserver* aObserver, 
+        CCmDmMain* aDBMngr, RPointerArray<CCmFillListItem>& aItems );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private:
+
+    /**
+     * Metadata cache wrapper
+     */
+    MCmSqlMain* iWrapper;                           // owned
+    
+    /**
+     * Active object in use of sql wrapper
+     */
+    CCmFmAo* iAo;                                   // owned
+    
+    /**
+     * Pointer to observer class
+     */
+    MCmFmFillRuleObserver* iObserver;               // not owned
+    
+    /**
+     * Pointer to database manager
+     */
+    CCmDmMain* iDBManager;                          // not owned
+    
+    /**
+     * All fill list items
+     */
+    RPointerArray<CCmFillListItem>& iItems;         // not owned
+
+    /**
+     * fill list items for updating to DB
+     */
+    RPointerArray<CCmFillListItem> iUpdateItems;    //owned
+    
+    /**
+     * Property values loaded from the cache
+     */
+    RPointerArray<CCmSqlPropertyItem> iPropertys;   // owned
+    
+    /**
+     * Property container referencing got from client
+     */
+    CCmSqlPropertyContainer* iPropertyContainer;    // not owned
+
+    /**
+     * Property container referencing got from client
+     */
+    CCmSqlPropertyCollector* iPropertyCollector;    // not owned           
+        
+    /**
+     * Rule array
+     */
+    RPointerArray<CCmFillRule> iRuleArray;
+    
+    /**
+     * Item ids on the list
+     */    
+    RArray<TInt> iFileIds;
+    
+    /**
+     * State of the metadata processing
+     */ 
+    TCmFmMetadaProcessingState iProcessingState;
+    
+    /**
+     * Count of new metadata items
+     */ 
+    TInt iNewItemCount;
+    
+    /**
+     * Count of all metadata items
+     */
+    TInt iAllItemCount;
+    
+    /**
+     * Start time of list processing
+     */
+    TTime iQueryStart;
+    /**
+     * End time of list processing
+     */    
+    TTime iQueryFinished;
+    
+    /**
+     * Total transfer time estimate
+     */
+    TCmProgressInfo iTransferInfo;
+    
+    /**
+     * Container for fill lists
+     */
+    CCmFillRuleContainer* iContainer;               // owned
+
+    /**
+     * Server list whose metadata will be deleted
+     */    
+    RArray<TInt> iMetadataServersToBeDeleted;
+    
+    /**
+     * Profile filters
+     */    
+    RArray<TInt64> iFilteredProfiles;
+    
+    /**
+     * File Server session
+     */
+    RFs iFs;
+    
+    /**
+     * Old item ids on the list
+     */    
+    RArray<TInt> iOldIds;
+   
+    };
+
+#endif //  __CMFMFILLLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfillruleobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Callback interface to fill rule processing
+*
+*/
+
+
+
+#ifndef M_CMFMFILLRULEOBSERVER_H
+#define M_CMFMFILLRULEOBSERVER_H
+
+#include "cmfmcommon.h"
+
+/**
+ *  Fill rule observer class
+ *  Callback interface class used to notify CmFmMain -class
+ *  about fill rule processing status
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( MCmFmFillRuleObserver )
+    {
+
+public:
+
+    /**
+     * Used to notify about status changes in fill rule processing
+     *
+     * @since S60 5.1
+     * @param aStatus, status of processing
+     * @return None
+     */
+    virtual void FillRuleProcessingStatus( 
+        TCmFmFillRuleProcessing aStatus ) = 0;
+
+    };
+
+
+#endif // M_CMFMFILLRULEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmglxnotifier.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gallery notifier class
+*
+*/
+
+
+
+#ifndef __CMFMGLXNOTIFIER_H
+#define __CMFMGLXNOTIFIER_H
+
+#include <e32base.h>
+
+/**
+ *  CCmFmGlxNotifier class
+ *  Part of Fill manager. CCmFmGlxNotifier manages
+ *  Gallery notify events
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CCmFmGlxNotifier ): public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aFS, file session
+     * @return  pointer to CCmFmGlxNotifier class
+     */
+    static CCmFmGlxNotifier* NewL( RFs& aFS );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aFS, file session
+     * @return  pointer to CCmFmGlxNotifier class
+     */
+    static CCmFmGlxNotifier* NewLC( RFs& aFS );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmGlxNotifier();
+    
+public: 
+
+    /**
+     * Notifying Media gallery about filled files
+     *
+     * @since S60 5.1
+     * @param aFullPath, path of the filled files
+     * @return None
+     */        
+    void NotifyGalleryL( const TDesC& aFullPath );
+
+    /**
+     * Notifying Media gallery about filled files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void NotifyGalleryL();
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmFmGlxNotifier( );
+
+    /**
+     * Performs the second phase construction.
+     * @since S60 5.1
+     * @param aFs, file server
+     */
+    void ConstructL( RFs& aFS );
+   
+    };
+
+#endif //  __CMFMGLXNOTIFIER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmitemhandlerobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Callback interface to fill rule processing
+*
+*/
+
+
+
+#ifndef M_CMFMITEMHANDLEROBSERVER_H
+#define M_CMFMITEMHANDLEROBSERVER_H
+
+ /**
+  *  Call back observer
+  *
+  *  @lib cmfillmanager.lib
+  *
+  *  @since S60 5.1
+  */      
+NONSHARABLE_CLASS( MCmFmItemHandlerObserver )
+    {
+public:
+
+    /**
+     * Call back for observer
+     *
+     * @since S60 5.1
+     * @param aDuplicate, ETrue if file is a duplicate
+     * @return  None
+     */    
+    virtual void DuplicateL( const TBool aDuplicate ) = 0;  
+       
+    }; 
+
+
+#endif // M_CMFMITEMHANDLEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmain.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,723 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main class in the Fill manager component
+*
+*/
+
+
+#ifndef C_CMFMMAIN_H
+#define C_CMFMMAIN_H
+
+#include <f32file.h>
+#include "cmfmfillruleobserver.h"
+#include "cmfmupnpactionobserver.h"
+#include "cmfmtransferobserver.h"
+#include "cmfmitemhandlerobserver.h"
+#include "cmmmobserver.h"        
+#include "cmcommon.h"
+#include "cmfillmanager.h"
+   
+/* Forward declarations. */
+class CCmFmUpnpMngr;
+class MCmServiceObserver;
+class CCmFmFillDriveMngr;
+class CCmFmFillRuleFilledDataMngr;
+class CCmFmDuplicateDetector;
+class CCmMmMain;
+class CCmDmMain;
+class CCmFmDownloadProxy;
+class CCmFillListItem;
+class CUpnpAVDeviceList;
+class CCmDriveInfo;
+class CMdESession;
+class CCmFmMpxNotifier;
+class CCmFmGlxNotifier;
+
+// Constants
+_LIT( KCmFmFillManager, "FillManager");
+
+/**
+ *  CCmFmMain class 
+ *  Part of Fill manager.Fill service
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 v3.1
+ */
+class CCmFmMain : public CActive,
+                  public MCmFmManager, 
+                  public MCmFmFillRuleObserver,
+                  public MCmFmUPnPActionObserver, 
+                  public MCmFmTransferObserver,
+                  public MCmFmItemHandlerObserver, 
+                  public MCmMmObserver
+    {     
+    
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, service observer
+     * @param aSession, mde session
+     * @param aDBManager, database manager
+     * @param aMemManager, memory manager
+     * @return  pointer to CCmFmMain class
+     */
+    static CCmFmMain* NewL(
+        MCmServiceObserver* aObserver, CMdESession& aSession,
+        CCmDmMain* aDBManager, CCmMmMain* aMemManager );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, service observer
+     * @param aSession, mde session
+     * @param aDBManager, database manager
+     * @param aMemManager, memory manager
+     * @return  pointer to CCmFmMain class
+     */
+    static CCmFmMain* NewLC(
+        MCmServiceObserver* aObserver, CMdESession& aSession,
+        CCmDmMain* aDBManager, CCmMmMain* aMemManager );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmMain();
+
+    /**
+     * Sort function that arranges pointers by id
+     * @since S60 5.1
+     * @param aItem1, item to be sorted
+     * @param aItem2, item to be sorted
+     */
+    static TInt CompareById( const CCmFillListItem& aItem1,
+                             const CCmFillListItem& aItem2 );
+
+    /**
+     * Sort function that arranges pointers by size
+     * @since S60 3.2
+     * @param aItem1, item to be sorted
+     * @param aItem2, item to be sorted
+     */
+    static TInt CompareBySize( const CCmFillListItem& aItem1,
+                               const CCmFillListItem& aItem2 );
+
+
+protected:
+
+// From base class MCmFmManager
+    
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */
+    void StartFillL();
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */
+    void CancelOperation();
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */
+    void PreProcessListsL();
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */
+    void PreProcessListL( const TDesC8& aFillListName );
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */
+    void GetColItemsL( TCmMetadataField aType, 
+        TCmMediaType aMedia, CDesCArray& aArray );
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */
+    void GetColItemsL( TCmMetadataField aType, 
+                       TCmMediaType aMedia,
+                       CCmSqlPropertyContainer& aPropertys );
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */
+    void GetMetadataItemsL( CCmSqlPropertyCollector& aPropertys );
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */   
+    void SetAvController( MUPnPAVController* aAVController ); 
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */   
+    void UpdatePriorities();
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */
+    void UpdateRefIds();
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */
+    void DeleteMetadataL();
+
+    /**
+     * From MCmFmManager
+     * See base class definition
+     */   
+    void Close();
+
+// From base class MCmFmFillRuleObserver
+
+    /**
+     * From MCmFmFillRuleObserver
+     * See base class definition
+     */   
+    virtual void FillRuleProcessingStatus( TCmFmFillRuleProcessing aStatus );
+
+// From base class MCmFmTransferObserver
+
+    /**
+     * From MCmFmTransferObserver
+     * See base class definition
+     */   
+    virtual void TransferStatus( TCmFmTransferStatus aStatus,
+                    TInt aSessionId,
+                    TInt aInternalItemId,
+                    TInt aError,
+                    TInt64 aFSize );
+
+// From base class MCmFmUPnPActionObserver     
+
+    /**
+     * From MCmFmUPnPActionObserver
+     * See base class definition
+     */   
+    virtual void URICheckResult( TCmFmUriCheckResult aStatus,
+        const CUpnpItem* aItem = NULL, const CUpnpElement* aRes = NULL );
+
+// From base class MCmFmItemHandlerObserver   
+
+    /**
+     * From MCmFmItemHandlerObserver
+     * See base class definition
+     */  
+    virtual void DuplicateL( const TBool aDuplicate );                
+
+// From base class MCmMmObserver 
+
+    /**
+     * From MCmMmObserver
+     * See base class definition
+     */  
+    virtual void DeleteCompleteL( TInt aErr );
+
+    /**
+     * From MCmMmObserver
+     * See base class definition
+     */  
+    virtual void ShrinkCompleteL( TInt aErr );            
+
+// From base class CActive 
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void DoCancel();
+
+    /**
+     * From CActive
+     * See base class definition
+     */   
+    TInt RunError( TInt aError );    
+
+private:
+
+    /**
+     * Sets mmc quota to fill list manager
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */    
+    void SetMmcQuotaL();
+
+    /**
+     * Handles mmc id ok state
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void HandleIfMmcOkL();
+
+    /**
+     * Handles if files need to be deleted
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void HandleIfDeleteFilesL();
+
+    /**
+     * Completes request
+     *
+     * @since S60 5.1
+     * @param aStatus, completing status
+     * @return None
+     */
+    void CompleteRequest( TCmFmStatus aStatus );
+
+    /**
+     * Completes request and incerements iIndex
+     *
+     * @since S60 5.1
+     * @param aStatus, completing status
+     * @return None
+     */    
+    void ProceedWithNextItem( TCmFmStatus aStatus );
+
+    /**
+     * Do uri check if needed
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void DoUriCheckL();
+    
+    /**
+     * Parses full path from the Uri and upnp class
+     *
+     * @since S60 5.1
+     * @param None
+     * @return Error code
+     */
+    TInt ParseFullPathL();
+
+    /**
+     * Parses file name from the Uri
+     *
+     * @since S60 5.1
+     * @param None
+     * @return Error code
+     */    
+    TInt ParseFileNameL();
+
+    /**
+     * Sets uri to current item
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void SetUriL();
+    
+    /**
+     * Logs media server Uuids
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void LogServers();
+
+    /**
+     * Reset metadata item infos
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void ResetItemInfo();
+
+    /**
+     * Publishes progress info
+     *
+     * @since S60 5.1
+     * @param aProgress, progress 
+     * @return None
+     */    
+    void SendProgressInfo( TInt aProgress );
+
+    /**
+     * Sets status to ECmFilled for every reference file
+     *
+     * @since S60 5.1
+     * @param aInternalItemId, item id
+     * @return  None
+     */    
+    void SetStatusL( const TInt64 aInternalItemId );
+
+    /**
+     * Removes illegal chars from the file name
+     *
+     * @since S60 5.1
+     * @param aFileName, file name
+     * @return modified file name
+     */      
+    HBufC* RemoveIllegalFilenameCharactersL( const TDesC& aFileName );
+
+    /**
+     * Replaces defined chars
+     *
+     * @since S60 5.1
+     * @param aString, file name string
+     * @param aTrg, char to be changed
+     * @param aReplacement, replacement char
+     * @return None
+     */    
+    void ReplaceCharsL( TDes& aString, const TDesC& aTrg,
+                   const TDesC& aReplacement );
+
+    /**
+     * Loads selected drives into iDrives array
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */                   
+    void LoadDrivesL();                   
+
+    /**
+     * Updates selected drives into iDrives table
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */            
+    void UpdateDrives();
+
+    /**
+     * Resolves root path of the fill drive
+     *
+     * @since S60 5.1
+     * @param aDriveNumber, drive number
+     * @return Root path
+     */     
+    HBufC* ResolveAndAppendRootPathL( const TInt aDriveNumber );
+    
+    /**
+     * Updates quota of used drive
+     *
+     * @since S60 5.1
+     * @param aDriveNumber, drive number
+     * @param aQuota, new used quota
+     * @return None
+     */    
+    void UpdateDriveQuota( const TInt aDriveNumber, 
+        const TInt64 aQuota );
+
+    /**
+     * Initializes quotas of all selected drives
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void InitializeDriveQuotasL();
+
+    /**
+     * Initializes quotas of all selected drives
+     *
+     * @since S60 5.1
+     * @param aDriveNumber, drive number
+     * @return used fill space per drive
+     */     
+    TInt64 GetUsedQuota( const TInt aDriveNumber );
+
+
+    /**
+     * Creates RFile
+     *
+     * @since S60 5.1
+     * @param aFilePath, file name and path
+     * @return error code
+     */    
+    TInt CreateRFile( const TDesC& aFilePath );
+    
+    /**
+     * Resolves private path of cm server
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void PrivatePathL( );
+    
+    /**
+     * Replaces file with orginal file
+     *
+     * @since S60 5.1
+     * @param aOriginal, orginal file name
+     * @return None
+     */    
+    void ReplaceFileL( const TDesC& aOriginal );
+
+    /**
+     * Returns index to iDevices device array
+     *
+     * @since S60 5.1
+     * @param aUuid, identifier of the server
+     * @param aList, device list
+     * @return index to iDevices 
+     */    
+    TInt CheckServerIndex( const TDesC8& aUuid,
+        const CUpnpAVDeviceList& aList );
+        
+    /**
+     * Returns ETrue if one of needed servers is available
+     *
+     * @since S60 5.1
+     * @param None
+     * @return ETrue if server available
+     */     
+    TBool NeededServerAvailableL( );
+
+    /**
+     * Reset item arrays
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    void ResetItems();
+
+    /**
+     * Reset delete queue array
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void ResetDeleteQueue();
+
+    /**
+     * Adds file to delete queue
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void AddFilesToDeleteQueueL();        
+         
+    /**
+     * Performs operations after items have been checked
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void StopItemCheck();
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aObserver, service observer
+     * @param aMemManager, memory manager
+     * @pram aDBManager, database manager
+     */
+    CCmFmMain( MCmServiceObserver* aObserver, CCmMmMain* aMemManager, 
+        CCmDmMain* aDBManager );
+
+    /**
+     * Performs the second phase construction.
+     *
+     * @since S60 5.1
+     * @param aSession, mde session
+     * @param aDBManager, database manager
+     */
+    void ConstructL( CMdESession& aSession, CCmDmMain* aDBManager );
+    
+
+private:
+    
+    /**
+     * Fill manager observer
+     */ 
+    MCmServiceObserver* iObserver;                              // Not owned
+        
+    /**
+     * Memory manager
+     */
+    CCmMmMain* iMemManager;                                     // Not owned
+    
+    /**
+     * Database manager
+     */
+    CCmDmMain* iDbManager;                                      // Not owned
+    
+    /**
+     * Upnp operation manager
+     */
+    CCmFmUpnpMngr* iCmFmUpnpMngr;                               // Owned
+    
+    /**
+     * fill drive id manager
+     */
+    CCmFmFillDriveMngr* iCmFmFillDriveMngr;                     // Owned
+    
+    /**
+     * Fill rule and filled data manager
+     */
+    CCmFmFillRuleFilledDataMngr* iCmFmFillRuleFilledDataMngr;   // Owned
+
+    /**
+     * Item handler, checks if media item is already in phone
+     */
+    CCmFmDuplicateDetector* iCmFmDuplicateDetector;             // Owned
+       
+    /**
+     * Download proxy
+     */
+    CCmFmDownloadProxy* iCmFmDownloadProxy;                     // Owned
+    
+    /**
+     * Mpx notifier
+     */
+    CCmFmMpxNotifier* iCmFmMpxNotifier;                         // Owned
+    
+    /**
+     * Glx notifier
+     */
+    CCmFmGlxNotifier* iCmFmGlxNotifier;                         // Owned
+    
+    /**
+     * AV Controller
+     */
+    MUPnPAVController* iAvController;                           // Not owned
+    
+    /**
+     * Array of found devices
+     */
+    CUpnpAVDeviceList* iDevices;                                // Owned
+    
+    /**
+     * Array of fill list items
+     */
+    RPointerArray<CCmFillListItem> iItems;                      // Owned
+    
+    /**
+     * Array of to be deleted fill list items
+     */
+    RPointerArray<CCmFillListItem> iToBeDeleted;                // Owned
+    
+    /**
+     * Array of to be deleted fill file names and paths
+     */
+    CDesCArray* iArray;                                         // Owned 
+    
+    /**
+     * File name and path to media file
+     */
+    TFileName iFullPath;
+    
+    /**
+     * Fill progress info
+     */
+    TCmProgressInfo iProgressInfo;
+    
+    /**
+     * Temporary uuid
+     */
+    HBufC8* iUuid;                                              // Owned
+    
+    /**
+     * Calculating fill transfer times
+     */
+    TTime iFileFetchStart;
+    
+    /**
+     * Index of the current item
+     */
+    TInt iIndex;
+    
+    /**
+     * Started service
+     */
+    TCmService iService;
+    
+    /**
+     * Flag identifying if fill is on or not
+     */
+    TBool iFetchingFile;
+    
+    /**
+     * File server session
+     */
+    RFs iFsSession;
+    
+    /**
+     * Drive info table
+     */
+    RPointerArray<CCmDriveInfo> iDrives;
+    
+    /**
+     * Drive id of the fill drive
+     */
+    TUint iDriveId;
+    
+    /**
+     * Drive number of the fill drive
+     */
+    TInt iDriveNumber;
+    
+    /**
+     * Index to drive info array
+     */
+    TInt iDriveIndex;
+    
+    /**
+     * File
+     */
+    RFile iFile;
+
+    /**
+     * Index of sent items
+     */
+    TInt iTempIndex;
+
+    };
+
+#endif //  C_CMFMMAIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmdeduplicatedetector.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles duplicate detection for images and videos
+*
+*/
+
+
+
+#ifndef __CMFMMDEDUPLICATEDETECTOR_H
+#define __CMFMMDEDUPLICATEDETECTOR_H
+
+#include <e32base.h>
+#include <mdequery.h>
+
+
+// Forward declarations
+class CCmFillListItem;
+class MCmFmItemHandlerObserver;
+class CMdESession;
+class CMdENamespaceDef;
+class CMdEObjectDef;
+class CMdEObjectQuery;
+class CMdEPropertyDef;
+
+// Class declarations
+
+/**
+ *  CCmFmMdEDuplicateDetector class
+ *  Part of Fill manager. CCmFmMdEDuplicateDetector manages
+ *  duplicate detection for images and videos
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CCmFmMdEDuplicateDetector ) : public CBase,
+                                  public MMdEQueryObserver
+    {
+
+public:    
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer class
+     * @param aSession, mde session
+     * @return  pointer to CCmFmMdEDuplicateDetector class
+     */
+    static CCmFmMdEDuplicateDetector* NewL( 
+        MCmFmItemHandlerObserver& aObserver, CMdESession& aSession );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer class  
+     * @param aSession, mde session   
+     * @return  pointer to CCmFmMdEDuplicateDetector class
+     */
+    static CCmFmMdEDuplicateDetector* NewLC( 
+        MCmFmItemHandlerObserver& aObserver, CMdESession& aSession );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmMdEDuplicateDetector();
+    
+public:
+
+    /**
+     * Check if file is duplicate.
+     *
+     * @since S60 5.1     
+     * @param aItem, item to be checked
+     * @return None
+     */
+    void CheckImageOrVideoL( const CCmFillListItem& aItem );
+
+    /**
+     * Add to items array for duplicated check
+     * @param aItem, item to be append
+     * @return None
+     */
+    void AppendToArrayL( const CCmFillListItem& aItem );
+
+    /**
+     * reset the duplicator check array
+     * @param None
+     * @return None
+     */
+    void ResetArray();
+
+
+protected: 
+
+// From base class MMdEQueryObserver  
+
+    /**
+     * From MMdEQueryObserver
+     * See base class definition
+     */
+    void HandleQueryNewResults( CMdEQuery& aQuery,
+                                TInt aFirstNewItemIndex,
+                                TInt aNewItemCount );
+          
+    /**
+     * From MMdEQueryObserver
+     * See base class definition
+     */
+    void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); 
+	
+private:
+    
+    /**
+     * Set logic condition for image and video item query
+     *
+     * @since S60 5.1        
+     * @param aItem, item to be checked
+     * @return None
+     */    
+    void SetLogicConditionL( const CCmFillListItem& aItem );    
+
+    /**
+     * Check if file is duplicate by compareing with array.
+     * @param aItem, item to be checked
+     * @return None
+     */
+    void CheckImageOrVideoLIfDuplicated( const CCmFillListItem& aItem );
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aObserver, item handler observer
+     * @param aSession, mde session
+     */
+    CCmFmMdEDuplicateDetector( MCmFmItemHandlerObserver& aObserver, 
+        CMdESession& aSession );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL( );
+    
+
+private:
+
+    /**
+     * Observer class
+     */
+    MCmFmItemHandlerObserver& iObserver;
+ 
+     /**
+      * MdE session
+      */
+    CMdESession& iSession;
+       
+    /**
+     * mde namespace
+     */
+    CMdENamespaceDef* iNamespace;               // owned
+    
+    /**
+     * Object definition ( Image/Video )
+     */
+    CMdEObjectDef* iObjectDef;                  // owned
+
+    /**
+     * Object definition ( Image/Video )
+     */
+    CMdEObjectDef* iMediaTypeDef; // owned
+
+    /**
+     * Object query
+     */
+    CMdEObjectQuery* iQuery;                    // owned
+        
+    /**
+     * Queried property
+     */
+    CMdEPropertyDef* iTitle;                    // owned
+    
+    /**
+     * Queried property
+     */
+    CMdEPropertyDef* iSize;                     // owned
+    
+    /**
+     * Queried property
+     */
+    CMdEPropertyDef* iDate;                     // owned
+
+    /**
+     * Item to be checked
+     */
+    CCmFillListItem* iCheckItem;
+
+    /**
+     * Array of fill list items
+     */
+    RPointerArray<CCmFillListItem> iExistFiles; // Owned
+
+    /**
+     * current download media type
+     */
+    TCmMediaType iCurrentMediaType;
+
+    };
+
+#endif //  __CMFMMDEDUPLICATEDETECTOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmpxduplicatedetector.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles duplicate detection for music
+*
+*/
+
+
+
+#ifndef __CMFMMPXDUPLICATEDETECTOR_H
+#define __CMFMMPXDUPLICATEDETECTOR_H
+
+#include <e32base.h>
+#include <mpxcollectionobserver.h>
+
+
+// Forward declarations
+class MMPXCollectionUtility;
+
+// Class declarations
+    
+/**
+ * CCmFmMpxDuplicateDetector class
+ * Part of Fill manager. CCmFmMpxDuplicateDetector manages
+ * duplicate detection 
+ *
+ * @lib cmfillmanager.lib
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CCmFmMpxDuplicateDetector ) : public CBase,
+                         public MMPXCollectionObserver,
+                         public MMPXCollectionFindObserver
+    {
+
+public:    
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer class
+     * @return  pointer to CCmFmMpxDuplicateDetector class
+     */
+    static CCmFmMpxDuplicateDetector* NewL( 
+        MCmFmItemHandlerObserver& aObserver );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer class  
+     * @return  pointer to CCmFmMpxDuplicateDetector class
+     */
+    static CCmFmMpxDuplicateDetector* NewLC( 
+        MCmFmItemHandlerObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmMpxDuplicateDetector();
+    
+public:
+
+    /**
+     * Check if file is duplicate.
+     *
+     * @since S60 5.1
+     * @param aItem, item to be checked
+     * @return None
+     */    
+    void CheckMusicL( const CCmFillListItem& aItem );
+   
+   /**
+     * Opens connection to collection plugin
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void OpenCollectionPluginL();
+    
+   /**
+     * Closes connection to collection plugin
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */ 
+    void CloseCollectionPlugin();    
+	
+protected:
+
+// From base class MMPXCollectionObserver
+
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+	 void HandleCollectionMediaL(const CMPXMedia& aMedia, TInt aError);
+
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+	void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
+	
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+	void HandleOpenL( const CMPXMedia& aEntries,
+	    TInt aIndex,TBool aComplete,TInt aError );
+	
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+    void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError);
+	
+// From base class MMPXCollectionFindObserver
+
+	/**
+     * From MMPXCollectionFindObserver
+     * See base class definition
+     */
+	 void HandleFindAllL(const CMPXMedia& aResults, 
+	    TBool aComplete, TInt aError);	
+	
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmFmMpxDuplicateDetector( MCmFmItemHandlerObserver& aObserver );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL( );
+    
+
+private: // data
+
+    /**
+     * Observer class
+     */
+    MCmFmItemHandlerObserver& iObserver;
+    
+    /**
+     * Collection utility of MPX framework
+     */
+    MMPXCollectionUtility* iCollectionUtility;          // owned
+    
+    /**
+     * Duplicate or not
+     */
+    TBool iDuplicate;
+            
+    };
+
+#endif //  __CMFMMPXDUPLICATEDETECTOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmpxnotifier.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Mpx nofifier class
+*
+*/
+
+
+
+#ifndef __CMFMMPXNOTIFIER_H
+#define __CMFMMPXNOTIFIER_H
+
+#include <e32base.h>
+#include "mpxmediatorobserver.h" // base class
+#include "mpxcollectionobserver.h" // base class
+
+// Forward declarations
+class MMPXHarvesterUtility;
+class MMPXCollectionUtility;
+class CMPXCollectionMediator;
+
+/**
+ *  CCmFmMpxNotifier class
+ *  Part of Fill manager.
+ *  Mpx nofifier class
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CCmFmMpxNotifier ): public CBase,
+                     public MMPXMediatorObserver,
+                     public MMPXCollectionObserver
+    {
+
+public:    
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCmFmMpxNotifier* NewL( );
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCmFmMpxNotifier* NewLC( );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmMpxNotifier();
+    
+public: 
+
+    /**
+     * Notifying Mpx about new music files
+     *
+     * @since S60 5.1
+     * @param aTrackPath, path to track
+     * @param aTrackMetadata, metadata to be added in mpx db
+     * @return None
+     */     
+    void NotifyMpxL( const TDesC& aTrackPath,
+                    const CUpnpItem& aTrackMetadata );
+                    
+protected:
+
+// From base class MMPXMediatorObserver
+    
+    /**
+     * From MMPXMediatorObserver
+     * See base class definition
+     */
+    void HandleMediatorPathUpdatedL(
+        CMPXMedia*& /*aMedia*/, TUid /*aOldPath*/ ) {}
+
+// From base class MMPXCollectionObserver
+
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& /*aMedia*/, TInt /*aError*/) {}
+
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+    void HandleCollectionMessageL(
+        const TMPXCollectionMessage& /*aMessage*/ ) {}
+
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+    void HandleCollectionMessageL(
+        const CMPXMessage& /*aMsg*/ ) {}
+
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+    void HandleOpenL(
+        const CMPXMedia& /*aEntries*/,
+        TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ ) {}
+
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& /*aPlaylist*/,
+        TInt /*aError*/ ) {}
+
+    /**
+     * From MMPXCollectionObserver
+     * See base class definition
+     */
+    void HandleCommandComplete(
+        CMPXCommand* /*aCommandResult*/, TInt /*aError*/) {}                    
+    
+private:
+    
+    /**
+     * Finds an element within CUpnpItem
+     * returns the element value converted to unicode
+     *
+     * Since S60 5.1
+     * @param aSource the source CUpnpItem
+     * @param aSourceField the element name within source
+     * @return the vield value, or 0 if element not found.
+     */
+    HBufC16* GetElementL( const CUpnpItem& aSource,
+        const TDesC8& aSourceField ) const;    
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmFmMpxNotifier( );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private: // data
+        
+    /**
+     * MPX harvester utility
+     */
+    MMPXHarvesterUtility* iHarvester;               // Owned
+
+    /**
+     * MPX collection utility
+     */
+    MMPXCollectionUtility* iCollectionUtil;         // Owned
+
+    /**
+     * MPX collection mediator
+     */
+    CMPXCollectionMediator* iMediator;              // Owned 
+       
+    };
+
+#endif //  __CMFMMPXNOTIFIER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmtransferobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Callback interface to Fill manager
+*
+*/
+
+
+
+#ifndef M_CMFMTRANSFEROBSERVER_H
+#define M_CMFMTRANSFEROBSERVER_H
+
+#include "cmfmcommon.h"
+
+/**
+ *  Download observer
+ *  Callback interface class used to notify Fill Manager
+ *  about status changes in Fill Manager
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( MCmFmTransferObserver )
+    {
+
+public:
+
+    /**
+     * Status notify to Fill Manager 
+     *
+     * @since S60 5.1
+     * @param aStatus
+     * @param aSessionId
+     * @param aInternalItemId
+     * @param aError 
+     * @param aFileSize
+     * @return None
+     */
+    virtual void TransferStatus( TCmFmTransferStatus aStatus, TInt aSessionId,
+        TInt aInternalItemId, TInt aError, TInt64 aFSize ) = 0;
+
+    };
+
+
+#endif // M_CMFMTRANSFEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmupnpactionobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Callback interface
+*
+*/
+
+
+
+#ifndef M_CMFMUPNPACTIONOBSERVER_H
+#define M_CMFMUPNPACTIONOBSERVER_H
+
+#include "cmfmcommon.h"
+
+// Forward declarations
+class CUpnpItem;
+class CUpnpElement;
+
+/**
+ *  UPnP action observer
+ *  Callback interface class used to notify CCmFmMain class
+ *  about status changes in Upnp actions
+ *
+ *  @lib cmfillmanager.lib
+ *
+ *  @since S60 5.1
+ */
+class MCmFmUPnPActionObserver
+    {
+
+public:
+
+    /**
+     * Upnp action notify about Browse results
+     *
+     * @since S60 5.1
+     * @param aStatus, uri check result
+     * @param aItem, item to be filled
+     * @param aRes, resource of item item
+     * @return  None
+     */
+    virtual void URICheckResult( TCmFmUriCheckResult aStatus, 
+        const CUpnpItem* aItem = NULL, const CUpnpElement* aRes = NULL ) = 0;
+            
+
+    };
+
+#endif // M_CMFMUPNPACTIONOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmupnpmngr.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,331 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages Upnp actions needed by Fill Manager
+*
+*/
+
+
+
+#ifndef __CMFMUPNPMNGR_H
+#define __CMFMUPNPMNGR_H
+
+#include <e32base.h>
+#include "upnpavbrowsingsessionobserver.h"
+#include "upnpavdeviceobserver.h"
+
+// Forward declarations
+class CUPnPXMLParser;
+class CCmFillListItem;
+class MCmFmUPnPActionObserver;
+
+// CLASS DECLARATION
+ /**
+  * Class represents methods to communication with AV Controller API.
+  *
+  * @lib cmfillmanager.lib
+  *
+  * @since S60 v3.1
+  */
+NONSHARABLE_CLASS( CCmFmUpnpMngr ): public CBase,
+                      public MUPnPAVBrowsingSessionObserver,
+                      public MUPnPAVDeviceObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, action observer
+     * @return  pointer to CCmFmUpnpMngr class
+     */
+    static CCmFmUpnpMngr* NewL( MCmFmUPnPActionObserver* aObserver );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, action observer
+     * @return  pointer to CCmFmUpnpMngr class
+     */
+    static CCmFmUpnpMngr* NewLC( MCmFmUPnPActionObserver* aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmFmUpnpMngr();
+
+public: 
+
+    /**
+    * Sets av controller
+    *
+    * @since S60 5.1
+    * @param aAVController, pointer to av controller
+    * @return None
+    */
+    void SetAvController( MUPnPAVController* aAVController );
+    
+    /**
+    * Lists media servers 
+    *
+    * @since S60 5.1
+    * @param aDevices, device list
+    * @return None
+    */
+    void GetMediaServersL( CUpnpAVDeviceList*& aDevices );
+    
+    /**
+    * Checks uri
+    *
+    * @since S60 5.1
+    * @param aDevice, upnp device
+    * @param aItem, fill list item to be checked
+    * @return None
+    */    
+    void CheckURIL( CUpnpAVDevice* aDevice, CCmFillListItem& aItem );
+    
+    /**
+    * Cancel UPnP operation
+    *
+    * @since S60 5.1
+    * @param None
+    * @return None
+    */    
+    void CancelOperation();
+
+    /**
+    * Returns browsed uri
+    *
+    * @since S60 5.1
+    * @param None
+    * @return uri
+    */    
+    TDesC8& Uri() const;
+
+    /**
+    * Returns browsed upnp item
+    *
+    * @since S60 5.1
+    * @param None
+    * @return upnp item
+    */     
+    CUpnpItem& UpnpItem() const;
+    
+protected:
+
+// From base class MUPnPAVBrowsingSessionObserver
+
+    /**
+     * From MUPnPAVBrowsingSessionObserver
+     * See base class definition
+     */
+    virtual void BrowseResponse( const TDesC8& aBrowseResponse,
+                                 TInt aError,
+                                 TInt aMatches,
+                                 TInt aTotalCount,
+                                 const TDesC8& aUpdateId );
+
+    /**
+     * From MUPnPAVBrowsingSessionObserver
+     * See base class definition
+     */
+    virtual void SearchResponse( const TDesC8& aSearchResponse,
+                                 TInt aError,
+                                 TInt aMatches,
+                                 TInt aTotalCount,
+                                 const TDesC8& aUpdateId );                     
+
+    /**
+     * From MUPnPAVBrowsingSessionObserver
+     * See base class definition
+     */
+    virtual void SearchCapabilitiesResponse( 
+                                TInt aStatus,
+                                const TDesC8& aSearchCapabilities );
+
+    /**
+     * From MUPnPAVBrowsingSessionObserver
+     * See base class definition
+     */
+    virtual void CreateContainerResponse( TInt aError, 
+                                          const TDesC8& aObjectId );
+
+    /**
+     * From MUPnPAVBrowsingSessionObserver
+     * See base class definition
+     */
+    virtual void DeleteObjectResponse( TInt aStatus );
+
+    /**
+     * From MUPnPAVBrowsingSessionObserver
+     * See base class definition
+     */
+    virtual void MediaServerDisappeared(
+            TUPnPDeviceDisconnectedReason aReason );
+
+    /**
+     * From MUPnPAVBrowsingSessionObserver
+     * See base class definition
+     */
+    virtual void ReserveLocalMSServicesCompleted( TInt aStatus );
+
+//public: 
+// From base class MCmAVDeviceObserver
+
+    /**
+     * From MCmAVDeviceObserver
+     * See base class definition
+     */
+    void UPnPDeviceDiscovered(const CUpnpAVDevice& aDevice);
+
+    /**
+     * From MCmAVDeviceObserver
+     * See base class definition
+     */
+    void UPnPDeviceDisappeared(const CUpnpAVDevice& aDevice);
+
+    /**
+     * From MCmAVDeviceObserver
+     * See base class definition
+     */  
+    void WLANConnectionLost();                                   
+   
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aObserver, UPnP action observer
+     */
+    CCmFmUpnpMngr( MCmFmUPnPActionObserver* aObserver );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+    /**
+     * Parser all resolution which object owns
+     *
+     * @since S60 5.1
+     * @param aResElementsArray, resource array
+     * @return Optimal resource element
+     */ 
+    const CUpnpElement& ParseImageResolutions( 
+        RUPnPElementsArray& aResElementsArray );
+
+    /**
+     * Initializes screen size member variable
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void ScreenSizeL();
+    
+    /**
+     * Returns processed browse results received from a Media Server.
+     *
+     * UPnPAVController releases the memory allocated for 
+     * aResultArray after calling the callback method.
+     *
+     * @since S60 5.1
+     * @param aStatus TInt  status information
+     * @param aTotalCount TInt total number of objects
+     * @param aResultArray browse result array
+     * @return None
+     */
+    void BrowseResponseL( TInt aStatus,
+                          TInt aTotalCount,
+                          const TDesC8& aResultArray );
+
+    /**
+     * Returns processed search results received from a Media Server.
+     *
+     * UPnPAVController releases the memory allocated for 
+     * aResultArray after calling the callback method.
+     *
+     * @since S60 5.1
+     * @param aStatus TInt  status information
+     * @param aTotalCount TInt total number of objects
+     * @param aResultArray RPointerArray of CUPnPObject objects
+     * @return None
+     */
+    void SearchResponse( TInt aStatus,
+                         TInt aTotalCount,
+                         const RPointerArray<CUpnpObject>& aResultArray );   
+
+private:
+
+    /**
+     * Pointer to AV Controller
+     */
+    MUPnPAVController* iAVController;                   // not owned
+
+    /**
+     * Browse action Observer
+     */
+    MCmFmUPnPActionObserver* iObserver;                 // not owned
+    
+    /**
+     * Browse response parser
+     */
+    CUPnPXMLParser* iParser;                            // owned
+    
+    /**
+     * CUpnpAVDevice
+     */
+    CUpnpAVDevice* iDevice;                             // Not owned
+    
+    /**
+     * URI
+     */
+    HBufC8* iURI;                                       // owned
+    
+    /**
+     * upnp item
+     */
+    CUpnpItem* iItem;                                   // owned
+    
+    /**
+     * Browse started
+     */
+    TTime iBrowseStarted;
+    
+    /**
+     * Browse finished
+     */
+    TTime iBrowseFinished;  
+    
+    /**
+     * Browse session
+     */
+    MUPnPAVBrowsingSession* iBrowseSession;             // Not owned
+    
+    /**
+     * If true select optimal image size to be filled
+     */
+    TBool iSelectOptimalImageSize;
+    
+    /**
+     * Screen size of the device
+     */
+    TSize iScreenSize;
+    
+    };
+
+#endif //  __CMFMUPNPMNGR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfillmanagerfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The factory for Fill manager
+*
+*/
+
+
+#include "cmfillmanagerfactory.h"
+#include "cmfillmanager.h"
+#include "cmfmmain.h"
+
+
+// --------------------------------------------------------------------------
+// CmFillManagerFactory::NewFillManagerL
+// --------------------------------------------------------------------------
+//
+EXPORT_C MCmFmManager* CmFillManagerFactory::NewFillManagerL( 
+    MCmServiceObserver* aObserver, CMdESession& aSession, 
+    CCmDmMain* aDBManager, CCmMmMain* aMemManager )
+    {
+    return CCmFmMain::NewL( aObserver, aSession, aDBManager, aMemManager );
+    }
+
+// --------------------------------------------------------------------------
+// CmFillManagerFactory::NewFillManagerLC
+// --------------------------------------------------------------------------
+//    
+EXPORT_C MCmFmManager* CmFillManagerFactory::NewFillManagerLC( 
+    MCmServiceObserver* aObserver, CMdESession& aSession, 
+    CCmDmMain* aDBManager, CCmMmMain* aMemManager )
+    {
+    return CCmFmMain::NewLC( aObserver, aSession, aDBManager, aMemManager );
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmao.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fill rule and filled data processing Active object
+*
+*/
+
+
+#include "cmfmfillrulefilleddatamngr.h"
+#include "cmfmao.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CCmFmAo::NewL
+// ---------------------------------------------------------------------------
+//
+CCmFmAo* CCmFmAo::NewL( CCmFmFillRuleFilledDataMngr& aMngr )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmAo::NewL() start"));    
+    CCmFmAo* self = CCmFmAo::NewLC( aMngr );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmAo::NewL() end")); 
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmAo::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmFmAo* CCmFmAo::NewLC( CCmFmFillRuleFilledDataMngr& aMngr )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmAo::NewLC() start"));     
+    CCmFmAo* self = new ( ELeave ) CCmFmAo( aMngr );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[FILL MNGR]\t CCmFmAo::NewLC() end"));     
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmAo::~CCmFmAo
+// ---------------------------------------------------------------------------
+//
+CCmFmAo::~CCmFmAo()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmAo::~CCmFmAo() start"));
+    Cancel();   
+    LOG(_L("[FILL MNGR]\t CCmFmAo::~CCmFmAo() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmAo::CCmFmAo
+// ---------------------------------------------------------------------------
+//            
+CCmFmAo::CCmFmAo( CCmFmFillRuleFilledDataMngr& aMngr )
+    :CActive( EPriorityStandard ), iMngr( aMngr ), iIdle( ETrue )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmAo::CCmFmAo()"));
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmAo::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCmFmAo::ConstructL()
+    { 
+    LOG(_L("[FILL MNGR]\t CCmFmAo::ConstructL()"));                   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmAo::RunL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmAo::RunL()
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmAo::RunL status %d"),iStatus.Int() ));            
+    if ( iIdle )
+        {
+        LOG(_L("[FILL MNGR]\t CCmFmAo::RunL iIdle == ETrue "));
+        SetActive();
+        iIdle = EFalse;
+        }
+    else 
+        {
+        LOG(_L("[FILL MNGR]\t CCmFmAo::RunL iIdle == EFalse "));
+        iMngr.OperationCompletedL( iStatus.Int() );
+        iIdle = ETrue;
+        }
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmAo::DoCancel
+// ---------------------------------------------------------------------------
+//     
+void CCmFmAo::DoCancel()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmAo::DoCancel"));
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmAo::RunError( TInt aError )
+// ---------------------------------------------------------------------------
+//  
+TInt CCmFmAo::RunError( TInt aError )
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmAo::RunError %d"), aError ));
+    return aError;
+    }
+    
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmdownloadmngr.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Download manager class, handles file download events
+*
+*/
+
+
+#include "upnpavcontroller.h"
+#include "upnpfiledownloadsession.h"
+#include "cmfmtransferobserver.h"
+#include "cmfmdownloadmngr.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::NewL
+// ---------------------------------------------------------------------------
+//
+CCmFmDownloadMngr* CCmFmDownloadMngr::NewL( MUPnPAVController* aAVController, 
+    MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice,
+    const TInt aDownloadId )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::NewL() start"));    
+    CCmFmDownloadMngr* self = CCmFmDownloadMngr::NewLC( aAVController, 
+        aObserver, aDevice, aDownloadId );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::NewLC
+// ---------------------------------------------------------------------------
+//   
+CCmFmDownloadMngr* CCmFmDownloadMngr::NewLC( MUPnPAVController* aAVController, 
+    MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice,
+    const TInt aDownloadId )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::NewLC() start"));    
+    CCmFmDownloadMngr* self = 
+        new ( ELeave ) CCmFmDownloadMngr( aAVController, 
+            aObserver, aDownloadId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aDevice );
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::~CCmFmDownloadMngr
+// ---------------------------------------------------------------------------
+//
+CCmFmDownloadMngr::~CCmFmDownloadMngr()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::~CCmFmDownloadMngr()"));
+    CancelOperation();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::CCmFmDownloadMngr
+// ---------------------------------------------------------------------------
+//        
+CCmFmDownloadMngr::CCmFmDownloadMngr( MUPnPAVController* aAVController, 
+    MCmFmTransferObserver* aObserver, const TInt aDownloadId )
+    : iAVController( aAVController ), iObserver( aObserver ), 
+      iDownloadId( aDownloadId ) 
+      
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::CCmFmDownloadMngr()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::ConstructL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmDownloadMngr::ConstructL( const CUpnpAVDevice& aDevice )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::ConstructL()"));
+    
+    iDownloadSession = &( iAVController->
+            StartDownloadSessionL( aDevice ) );
+    iDownloadSession->SetObserver( *this );
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::FetchFileL
+// ---------------------------------------------------------------------------
+//  
+void CCmFmDownloadMngr::FetchFileL( const CUpnpElement& aResElement, 
+    const CUpnpItem& aItem, RFile& aFile, const TInt64 aInternalItemId )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::FetchFileL()"));
+    
+    iDownloadSession->StartDownloadL( aResElement, aItem, 
+        aFile, aInternalItemId );
+    iDownloadSession->StartTrackingProgressL( aInternalItemId );                    
+    iFileSize = 0;            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::CancelOperation
+// ---------------------------------------------------------------------------
+//     
+void CCmFmDownloadMngr::CancelOperation()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::CancelOperation() start"));
+    if( iAVController )
+        {
+        if( iDownloadSession )
+            {
+            iAVController->StopDownloadSession( *iDownloadSession );
+            }
+        }
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::CancelOperation() end"));                
+    }                
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::TransferStarted
+// ---------------------------------------------------------------------------
+//
+void CCmFmDownloadMngr::TransferStarted( TInt aKey, TInt aStatus )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::TransferStarted()"));
+    iObserver->TransferStatus( ECmFmFileFetchStarted, iDownloadId, aKey, 
+        aStatus, iFileSize );       
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::TransferCompleted
+// ---------------------------------------------------------------------------
+//
+void CCmFmDownloadMngr::TransferCompleted( TInt aKey, TInt aStatus,
+        const TDesC& /*aFilePath*/ )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::TransferCompleted()"));
+    iObserver->TransferStatus( ECmFmFileFetched, iDownloadId, aKey, aStatus, 
+        iFileSize );           
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::TransferProgress
+// ---------------------------------------------------------------------------
+//
+void CCmFmDownloadMngr::TransferProgress( TInt /*aKey*/, TInt aBytes,
+        TInt /*aTotalBytes*/ )              
+    {
+    TRACE(Print(_L("[FILL MNGR]\t aBytes= %d"), aBytes ));
+
+	// Get the transferred bytes
+    iFileSize = ( aBytes / KKilo );
+    } 
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadMngr::MediaServerDisappeared
+// ---------------------------------------------------------------------------
+//
+void CCmFmDownloadMngr::MediaServerDisappeared( 
+    TUPnPDeviceDisconnectedReason /*aReason*/ )
+    {
+    TRACE(Print(_L("[FILL MNGR]\t MediaServerDisappeared = %d"), iDownloadId ));
+    iObserver->TransferStatus( ECmFmFileFetched, iDownloadId, KErrNone, 
+        KErrDisconnected, KErrNone );
+    }
+    
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmdownloadproxy.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Proxy class to handle multiple download sessions
+*
+*/
+
+
+#include "upnpavcontroller.h"
+#include "upnpavdevicelist.h"
+#include "upnpitem.h"
+#include "cmfmdownloadmngr.h"
+#include "cmfmdownloadproxy.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::NewL
+// ---------------------------------------------------------------------------
+//
+CCmFmDownloadProxy* CCmFmDownloadProxy::NewL( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::NewL() start"));    
+    CCmFmDownloadProxy* self = CCmFmDownloadProxy::NewLC( );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::NewLC
+// ---------------------------------------------------------------------------
+//   
+CCmFmDownloadProxy* CCmFmDownloadProxy::NewLC( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::NewLC() start"));    
+    CCmFmDownloadProxy* self = 
+        new ( ELeave ) CCmFmDownloadProxy( );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::~CCmFmDownloadProxy
+// ---------------------------------------------------------------------------
+//
+CCmFmDownloadProxy::~CCmFmDownloadProxy()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::~CCmFmDownloadProxy()"));
+    CancelOperation();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::CCmFmDownloadProxy
+// ---------------------------------------------------------------------------
+//        
+CCmFmDownloadProxy::CCmFmDownloadProxy( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::CCmFmDownloadProxy()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::ConstructL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmDownloadProxy::ConstructL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::ConstructL()"));
+    }          
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::FetchFileL
+// ---------------------------------------------------------------------------
+//  
+void CCmFmDownloadProxy::FetchFileL( MCmFmTransferObserver* aObserver, 
+    MUPnPAVController* aAVController, CUpnpAVDeviceList* aDevices, 
+    const CUpnpElement& aResElement, const CUpnpItem& aItem, RFile& aFile, 
+    const TInt aInternalDeviceIndex, const TInt64 aInternalItemId )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::FetchFileL()"));
+    
+    // Starts download session if no session for defined device exists yet
+    TInt index = StartNewDownloadSessionIfNeededL( aObserver, 
+                                                   aAVController, 
+                                                   aDevices, 
+                                                   aInternalDeviceIndex );
+        
+    if( index > KErrNotFound && index < iDownloadSessions.Count() )
+        {
+        TRACE(Print(_L("[FILL MNGR]\t FetchFileL index = %d"), index ));
+        iDownloadSessions[ index ]->
+                FetchFileL( aResElement, aItem, aFile, aInternalItemId );   
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        } 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::CloseDownloadSession
+// ---------------------------------------------------------------------------
+//
+TBool CCmFmDownloadProxy::CloseDownloadSession( const TInt aSessionId )
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CloseDownloadSession = %d"), aSessionId ));
+    TBool sessionsLeft( EFalse );
+    
+    if( KErrNotFound < aSessionId && 
+        aSessionId < iDownloadSessions.Count() && 
+        iDownloadSessions[ aSessionId ] )
+        {
+        // Delete defined download session
+        delete iDownloadSessions[ aSessionId ];
+        iDownloadSessions[ aSessionId ] = NULL;
+        iDownloadSessionCount--;
+        TInt temp( KErrNotFound );
+        for( TInt i = 0; i < iSessionIndexes.Count(); i++ )
+            {
+            if( iSessionIndexes[i].iSessionIndex == aSessionId )
+                {
+                temp = i; 
+                }
+            }
+    
+        if( temp != KErrNotFound )
+            {
+            iSessionIndexes.Remove( temp );
+            }        
+        }
+    
+    if( iDownloadSessionCount )
+        {
+        sessionsLeft = ETrue;
+        }
+    else
+        {
+        LOG(_L("[FILL MNGR]\t No sessions left!"));
+        }
+    
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::CloseDownloadSession() end"));        
+    return sessionsLeft;    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::CancelOperation
+// ---------------------------------------------------------------------------
+//     
+void CCmFmDownloadProxy::CancelOperation()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::CancelOperation()"));
+    iDownloadSessions.ResetAndDestroy();
+    iSessionIndexes.Reset();
+    iSessionIndexes.Close();
+    iDownloadSessionCount  = 0;                
+    }
+                    
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::StartNewDownloadSessionIfNeededL
+// ---------------------------------------------------------------------------
+// 
+TInt CCmFmDownloadProxy::StartNewDownloadSessionIfNeededL( 
+    MCmFmTransferObserver* aObserver, MUPnPAVController* aAVController, 
+    CUpnpAVDeviceList* aDevices, const TInt aInternalDeviceIndex )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::\
+    StartNewDownloadSessionIfNeededL()"));
+    
+    TBool newServer( ETrue );
+    TInt sessionIndex( KErrNotFound );
+    for( TInt i = 0; i < iSessionIndexes.Count(); i++ )
+        {
+        if( iSessionIndexes[i].iDeviceIndex == aInternalDeviceIndex )
+            {
+            TRACE(Print(_L("[FILL MNGR]\t old server sessionIndex = %d"), 
+                i ));
+            newServer = EFalse;
+            sessionIndex = i;
+            // Index found => end loop
+            i = iSessionIndexes.Count();
+            }
+        }
+    
+    if( newServer )
+        {
+        TRACE(Print(_L("[FILL MNGR]\t New server found")));       
+
+        CreateNewSessionL( aObserver, aAVController, aDevices, 
+            iDownloadSessionCount, sessionIndex );              
+        }
+    TRACE(Print(_L("[FILL MNGR]\t started sessionIndex = %d"), sessionIndex ));        
+    
+    return sessionIndex;              
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDownloadProxy::CreateNewSessionL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmDownloadProxy::CreateNewSessionL(  
+    MCmFmTransferObserver* aObserver, MUPnPAVController* aAVController, 
+    CUpnpAVDeviceList* aDevices, TInt aSessionCount, TInt& aSessionIndex )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::CreateNewSessionL()"));
+    
+    CCmFmDownloadMngr* mngr = CCmFmDownloadMngr::NewL( aAVController, aObserver,
+       *(*aDevices)[aSessionCount], aSessionCount );
+    CleanupStack::PushL( mngr );
+    iDownloadSessions.Append( mngr );            
+    CleanupStack::Pop( mngr );
+    iDownloadSessionCount++;             
+    TCmFmDownloadSessionIndexes index;
+    index.iDeviceIndex = aSessionCount;   
+    index.iSessionIndex = ( iDownloadSessions.Count() - 1 );
+    iSessionIndexes.Append( index );
+    aSessionIndex = index.iSessionIndex;     
+    }
+     
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmduplicatedetector.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Duplicate detector
+*
+*/
+
+
+#include "cmfilllistitem.h"
+#include "cmfmmdeduplicatedetector.h"
+#include "cmfmmpxduplicatedetector.h"
+#include "cmfmduplicatedetector.h"
+#include "msdebug.h"    
+
+// ---------------------------------------------------------------------------
+// CCmFmDuplicateDetector::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmFmDuplicateDetector* CCmFmDuplicateDetector::NewL( 
+    MCmFmItemHandlerObserver& aObserver, CMdESession& aSession )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::NewL() start"));    
+    CCmFmDuplicateDetector* self = 
+        CCmFmDuplicateDetector::NewLC( aObserver, aSession );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDuplicateDetector::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmFmDuplicateDetector* CCmFmDuplicateDetector::NewLC( 
+    MCmFmItemHandlerObserver& aObserver, CMdESession& aSession )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::NewLC() start"));    
+    CCmFmDuplicateDetector* self = 
+        new ( ELeave ) CCmFmDuplicateDetector( );
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver, aSession );
+    LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmDuplicateDetector::~CCmFmDuplicateDetector
+// ---------------------------------------------------------------------------
+// 
+CCmFmDuplicateDetector::~CCmFmDuplicateDetector()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::\
+    ~CCmFmDuplicateDetector()"));
+    delete iCmFmMdEDuplicateDetector;
+    delete iCmFmMpxDuplicateDetector;         
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDuplicateDetector::CCmFmDuplicateDetector
+// ---------------------------------------------------------------------------
+// 
+CCmFmDuplicateDetector::CCmFmDuplicateDetector( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::\
+    CCmFmDuplicateDetector()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDuplicateDetector::ConstructL
+// ---------------------------------------------------------------------------
+//     
+void CCmFmDuplicateDetector::ConstructL(  
+    MCmFmItemHandlerObserver& aObserver, CMdESession& aSession )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::ConstructL()"));
+
+    iCmFmMdEDuplicateDetector = 
+        CCmFmMdEDuplicateDetector::NewL( aObserver, aSession );
+    
+    iCmFmMpxDuplicateDetector =
+        CCmFmMpxDuplicateDetector::NewL( aObserver );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmDuplicateDetector::CheckItemL
+// ---------------------------------------------------------------------------
+//
+void CCmFmDuplicateDetector::CheckItemL( const CCmFillListItem& aItem )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::CheckItemL()"));    
+    
+    if( aItem.MediaType() == ECmAudio )
+        {
+        iCmFmMpxDuplicateDetector->CheckMusicL( aItem );
+        }
+    else
+        {
+        iCmFmMdEDuplicateDetector->CheckImageOrVideoL( aItem );
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDuplicateDetector::AppendToArrayL
+// ---------------------------------------------------------------------------
+//
+void CCmFmDuplicateDetector::AppendToArrayL( const CCmFillListItem& aItem )
+    {
+    if( aItem.MediaType() != ECmAudio )
+        {
+        iCmFmMdEDuplicateDetector->AppendToArrayL( aItem );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmDuplicateDetector::ResetArray
+// ---------------------------------------------------------------------------
+//
+void CCmFmDuplicateDetector::ResetArray()
+    {
+    iCmFmMdEDuplicateDetector->ResetArray();
+    }
+    
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmfilldrivemngr.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fill drive handling 
+*
+*/
+
+
+#include <f32file.h>
+#include "cmcommon.h"
+#include "cmdriveinfo.h"
+#include "cmfmfilldrivemngr.h"
+#include "msdebug.h"    
+
+// ---------------------------------------------------------------------------
+// CCmFmFillDriveMngr::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmFmFillDriveMngr* CCmFmFillDriveMngr::NewL( RFs& aFs, 
+    RPointerArray<CCmDriveInfo>& aDrives )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::NewL() start"));    
+    CCmFmFillDriveMngr* self = CCmFmFillDriveMngr::NewLC( aFs, aDrives );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillDriveMngr::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmFmFillDriveMngr* CCmFmFillDriveMngr::NewLC( RFs& aFs, 
+    RPointerArray<CCmDriveInfo>& aDrives )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::NewLC() start"));    
+    CCmFmFillDriveMngr* self = new ( ELeave ) CCmFmFillDriveMngr( aFs, aDrives );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmFillDriveMngr::~CCmFmFillDriveMngr
+// ---------------------------------------------------------------------------
+// 
+CCmFmFillDriveMngr::~CCmFmFillDriveMngr()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::~CCmFmFillDriveMngr()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillDriveMngr::CCmFmFillDriveMngr
+// ---------------------------------------------------------------------------
+// 
+CCmFmFillDriveMngr::CCmFmFillDriveMngr( RFs& aFs, 
+    RPointerArray<CCmDriveInfo>& aDrives )
+    : iFsSession( aFs ), iDrives( aDrives )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::CCmFmFillDriveMngr()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillDriveMngr::ConstructL
+// ---------------------------------------------------------------------------
+//     
+void CCmFmFillDriveMngr::ConstructL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::ConstructL()"));    
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmFillDriveMngr::CheckDriveId
+// ---------------------------------------------------------------------------
+// 
+TCmFmStatus CCmFmFillDriveMngr::CheckDriveId()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::CheckDriveId()"));
+    
+    TCmFmStatus status(ECmFmMMCCheckFailed);
+    TVolumeInfo volInfo;    
+    for( TInt i = iDrives.Count() - 1; i >= 0; i-- )
+        {
+        DoMountFileSystem( iFsSession, volInfo, iDrives[i]->DriveNumber() );
+        if( volInfo.iUniqueID != iDrives[i]->DriveId() )
+            {
+            delete iDrives[i];
+            iDrives.Remove(i);
+            }
+        }
+    if( iDrives.Count() )
+        {
+        status = ECmFmMMCOk;
+        }
+    
+    return status;       
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillDriveMngr::CheckFreeDiscSpace
+// ---------------------------------------------------------------------------
+// 
+TInt CCmFmFillDriveMngr::CheckFreeDiscSpace( TUint32 aFileSize,
+                                             TUint& aDriveId, 
+                                             TInt& aDriveNumber )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::CheckFreeDiscSpace()"));    
+    
+    aDriveNumber = KErrNotFound;
+    TInt64 totalSize( 0 );
+    TInt64 quota( 0 );
+    TInt driveIndex( 0 );
+    
+    for( TInt i = 0; i < iDrives.Count(); i++ )
+        {
+        totalSize = iDrives[i]->UsedDriveQuota() + aFileSize;
+        quota = iDrives[i]->DriveQuota();
+        TRACE(Print(_L("[FILL MNGR]\t CCmFmFillDriveMngr Quota = \
+            : %ld"), quota ));         
+        if( totalSize >= quota )
+            {
+            TRACE(Print(_L("[FILL MNGR]\t QUOTA FULL drive number = %d"),
+                iDrives[i]->DriveNumber()));
+            }
+        else
+            {
+            TInt error( KErrNone );
+            TVolumeInfo volInfo;        
+            TInt64 freespace( 0 );        
+            
+            error = DoMountFileSystem( iFsSession, volInfo, 
+                iDrives[i]->DriveNumber() );
+            
+            if ( !error )
+                {            
+                freespace = volInfo.iFree;
+                TRACE(Print(_L("[FILL MNGR]\t CCmFmFillDriveMngr freespace \
+                    : %ld"), freespace ));
+                if( freespace < ( KCmMmcLowMemory + aFileSize ) )
+                    {
+                    TRACE(Print(_L("[FILL MNGR]\t Disc full!!")));
+                    }
+                else
+                    {
+                    TRACE(Print(_L("[FILL MNGR]\t Drive number of the drive \
+                    where to fill = %d"), iDrives[i]->DriveNumber() ));
+                    aDriveNumber = iDrives[i]->DriveNumber();
+                    aDriveId = iDrives[i]->DriveId();                    
+                    driveIndex = i;
+                    i = iDrives.Count();
+                    }    
+                }
+            else
+                {
+                // Disc is not ready => Do not fill
+                TRACE(Print(_L("[FILL MNGR]\t Disc is not ready!!")));
+                }              
+            }                    
+        }
+        
+    return driveIndex;
+    }       
+    
+// ---------------------------------------------------------------------------
+// CCmFmFillDriveMngr::DoMountFileSystem
+// ---------------------------------------------------------------------------
+//
+TInt CCmFmFillDriveMngr::DoMountFileSystem( RFs& aFileServer, 
+                                            TVolumeInfo& aVolInfo, 
+                                            TInt aDriveNumber )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::CheckFreeDiscSpace()")); 
+    
+    TInt error( KErrNone );
+    TFullName fsname;  
+    error = aFileServer.FileSystemName( fsname, aDriveNumber );
+    
+    TRACE(Print(_L("[FILL MNGR]\t FileSystemName %d, %S"), 
+        error, &fsname ));                    
+
+    error = aFileServer.FileSystemName( fsname, aDriveNumber );
+    
+    TRACE(Print(_L("[FILL MNGR]\t FileSystemName %d, %S"), 
+        error, &fsname ));
+
+    error = aFileServer.Volume( aVolInfo, aDriveNumber );       
+
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmFillDriveMngr::volinfo error = %d"), 
+        error )); 
+
+    return error;
+    }
+        
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmfillrulefilleddatamngr.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1686 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fill rule and filled data processing
+*  Version     : %version: tr1ido#17 % << Don't touch!
+*
+*/
+
+
+
+#include <e32property.h>
+#include "upnpdlnautility.h"
+#include "cmsqlmainfactory.h"
+#include "mcmsqlmain.h"
+#include "cmdmmain.h"
+#include "cmfillrule.h"
+#include "cmfillrulecontainer.h"
+#include "cmsqlpropertyitem.h"
+#include "cmmediaserverfull.h"
+#include "cmfilllistitem.h"
+#include "cmfmmain.h"
+#include "cmfmao.h"
+#include "cmfmfillrulefilleddatamngr.h"
+#include "msdebug.h"
+
+// Constants
+const TInt KCmFmIniDownloadDataAmount = 300; // 300 kBs
+const TInt KCmFmIniDownloadTime = 1; // One second
+
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::NewL
+// ---------------------------------------------------------------------------
+//
+CCmFmFillRuleFilledDataMngr* CCmFmFillRuleFilledDataMngr::NewL(
+    MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr,
+    RPointerArray<CCmFillListItem>& aItems )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::NewL() start"));    
+    CCmFmFillRuleFilledDataMngr* self = CCmFmFillRuleFilledDataMngr::NewLC(
+        aObserver, aDBMngr, aItems );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::NewL() end")); 
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmFmFillRuleFilledDataMngr* CCmFmFillRuleFilledDataMngr::NewLC(
+    MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr,
+    RPointerArray<CCmFillListItem>& aItems )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::NewLC() start"));     
+    CCmFmFillRuleFilledDataMngr* self = 
+        new ( ELeave ) CCmFmFillRuleFilledDataMngr( aObserver, aDBMngr, 
+                                                    aItems );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::NewLC() end"));     
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::~CCmFmFillRuleFilledDataMngr
+// ---------------------------------------------------------------------------
+//
+CCmFmFillRuleFilledDataMngr::~CCmFmFillRuleFilledDataMngr()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+        ~CCmFmFillRuleFilledDataMngr() start"));
+    Cancel();
+    
+    if ( iWrapper )
+        {
+        iWrapper->Close();    
+        }    
+    
+    if ( iAo )
+        {
+        delete iAo;      
+        }
+    
+    iObserver = NULL;
+    iDBManager = NULL;
+    
+    if ( iContainer )
+        {
+        delete iContainer;    
+        }
+    
+    iRuleArray.Reset();
+    iRuleArray.Close();
+    
+    iUpdateItems.Reset();
+    iUpdateItems.Close();        
+    
+    iPropertys.ResetAndDestroy();
+    
+    iFileIds.Close();
+    iMetadataServersToBeDeleted.Close();
+    iOldIds.Close();
+    iFs.Close();
+    iFilteredProfiles.Reset();
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+        ~CCmFmFillRuleFilledDataMngr() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::CCmFmFillRuleFilledDataMngr
+// ---------------------------------------------------------------------------
+//            
+CCmFmFillRuleFilledDataMngr::CCmFmFillRuleFilledDataMngr( 
+    MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr,
+    RPointerArray<CCmFillListItem>& aItems )
+    :CActive( EPriorityStandard ), iObserver( aObserver ), 
+    iDBManager( aDBMngr ), iItems(aItems)
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    CCmFmFillRuleFilledDataMngr()"));    
+    
+    CActiveScheduler::Add( this );
+    iTransferInfo.iService = ECmServiceTransferInfoFill;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCmFmFillRuleFilledDataMngr::ConstructL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::ConstructL()"));   
+    User::LeaveIfError( iFs.Connect() );                           
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::OperationCompletedL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::OperationCompletedL( TInt aStatus )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    OperationCompletedL()"));
+    
+    iQueryFinished.HomeTime();
+    TTimeIntervalMicroSeconds usecsFrom = 
+        iQueryFinished.MicroSecondsFrom( iQueryStart );
+    TRACE(Print(_L("[FILL MNGR]\t Query \
+        took = %ld mseconds"), ( usecsFrom.Int64() / 1000 ) ));    
+    
+    if( KErrNone == aStatus )
+        {
+        switch( iProcessingState )
+            {
+            case ECmFmLoadingPropertys:
+                {
+                // Loading propertys ready
+                CompleteRequest( EColumnDataReady );
+                break;
+                }
+            case ECmFmLoadingMetadata:
+                {
+                // Loading file metadata ready ( for one fill list )
+                iNewItemCount = iItems.Count() - iNewItemCount;              
+                CompleteRequest( EQueryCompleted );
+                break;
+                }
+            case ECmFmDeletingMetadata:
+                {
+                // Metadata deleted from defined media servers
+                TRAPD( err, DeleteHashCodesL() );
+                iMetadataServersToBeDeleted.Reset();
+                iMetadataServersToBeDeleted.Close();
+                iWrapper->DeleteUnusedPropertys( );
+                if( !err )
+                    {
+                    CompleteRequest( EMetadataDeleted );
+                    }
+                else
+                    {
+                    TRACE(Print(_L("[FILL MNGR]\t \
+                        OperationCompletedL err %d "), err ));                    
+                    }                                    
+                break;
+                }
+            case ECmFmLoadingProfileIds:
+                {
+                DefineAndSetDlnaProfileIdFiltersL();
+                PreprocessListsL();
+                break;
+                }
+            default:
+                {
+                LOG(_L("[FILL MNGR]\t OperationCompletedL processing \
+                state not found"));
+                break;
+                }    
+            }         
+        }
+    else
+        {        
+        TRACE(Print(_L("[FILL MNGR]\t OperationCompletedL aStatus = %d"), 
+            aStatus ));        
+        }         
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::LoadProfileIdsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::LoadProfileIdsL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::LoadProfileIdsL()"));
+    // Loads all dlna profile ids from database. Profile ids are used
+    // to filter out unsupported media types
+    iPropertys.ResetAndDestroy();
+    iProcessingState = ECmFmLoadingProfileIds;
+    CreateWrapperL();
+    StartObserverL();
+    iWrapper->GetPropertyValuesL( iPropertys, iAo->iStatus, 
+        ECmProfileId, ECmAll );
+    iQueryStart.HomeTime();
+    iAo->RunL();    
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::PreprocessListsL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::PreprocessListsL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::PreprocessListsL()"));
+    
+#ifdef _DEBUG
+    TInt alloc;
+    TInt cells = User::Heap().AllocSize( alloc );
+    TInt size = User::Heap().Size();
+    TRACE(Print(_L("[FILL MNGR]\t preprocess heap allocsize %d, \
+    size %d, cells %d"), alloc, size, cells ));
+#endif
+    iProcessingState = ECmFmIdle;  
+    ResetData();
+    // Creates sqlite wrapper and starts preprocessing of all fill lists
+    TRAP_IGNORE( CreateWrapperL() );
+    iTransferInfo.iTotalItems = KErrNone;
+    iTransferInfo.iProcessedItems = KErrNone;        
+    CompleteRequest( EPreProcessingStarted );   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::PreProcessListL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::PreProcessListL( 
+    const TDesC8& aFillListName )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::PreProcessListL()"));
+    
+    iProcessingState = ECmFmIdle;
+    // Creates sqlite wrapper and starts preprocessing of 
+    // one defined fill list 
+    CreateWrapperL();
+    ResetData();
+    iContainer = CCmFillRuleContainer::NewL();     
+    LoadRuleL( aFillListName );
+    LoadAllFillItemsL();    
+    CompleteRequest( ERandomizingStarted );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::GetColItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::GetColItemsL( TCmMetadataField aType, 
+    TCmMediaType aMedia, CCmSqlPropertyContainer& aPropertys )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::GetColItemsL()"));
+    
+    iPropertyContainer = NULL;
+    iPropertyContainer = &aPropertys;
+    iPropertys.ResetAndDestroy(); 
+    iProcessingState = ECmFmLoadingPropertys;
+    CreateWrapperL();
+    StartObserverL();
+    // starts loading defined propertys from database
+    iWrapper->GetPropertyValuesL(iPropertys, iAo->iStatus, aType, aMedia );
+    iQueryStart.HomeTime();
+    iAo->RunL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::GetMetadataItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::GetMetadataItemsL(
+                                    CCmSqlPropertyCollector& aPropertys )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    GetMetadataItemsL()"));
+    
+    iPropertyCollector = NULL;
+    iPropertyCollector = &aPropertys;    
+    iProcessingState = ECmFmLoadingPropertys;
+    CreateWrapperL();
+    StartObserverL();
+    // starts loading property values. Selected artists, albums, genres and 
+    // tracks are used as a filtering parameter ( e.g. if some artist is 
+    // selected, only albums for that defined artist are loaded.
+    iWrapper->GetFilteredPropertyValuesL( *iPropertyCollector, iAo->iStatus );
+    iQueryStart.HomeTime();
+    iAo->RunL();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::UpdatePriorities
+// ---------------------------------------------------------------------------
+//    
+void CCmFmFillRuleFilledDataMngr::UpdatePriorities()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::UpdatePriorities()"));
+    
+    CompleteRequest( EUpdatePriorities );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::DoUpdatePrioritiesL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::DoUpdatePrioritiesL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    DoUpdatePrioritiesL()"));
+    
+    // Updating first list item priorities    
+#ifdef _DEBUG
+    TInt alloc;
+    TInt cells = User::Heap().AllocSize( alloc );
+    TInt size = User::Heap().Size();
+    TRACE(Print(_L("[FILL MNGR]\t DoUpdatePrioritiesL start heap \
+    allocsize %d, size %d, cells %d"), alloc, size, cells ));    
+#endif    
+    
+    CCmFillRuleContainer* container = LoadAllFillRulesL();
+    CleanupStack::PushL( container );
+    TInt err( UpdateListItemPriorities( container ) );
+    TRACE(Print(_L("[FILL MNGR]\t UpdateListItemPriorities err = %d"), 
+    err ));     
+    CleanupStack::PopAndDestroy(container);
+    CalculateAvgTransferTimeL();
+    SendAvgTransferTime();
+
+#ifdef _DEBUG    
+    cells = User::Heap().AllocSize( alloc );
+    size = User::Heap().Size();
+    TRACE(Print(_L("[FILL MNGR]\t DoUpdatePrioritiesL end heap \
+    allocsize %d, size %d, cells %d"), alloc, size, cells ));
+#endif
+                  
+    iObserver->FillRuleProcessingStatus( EDoUpdatePriorities );   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::DoUpdateReferenceIdsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::DoUpdateReferenceIdsL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    DoUpdateReferenceIdsL()")); 
+    
+#ifdef _DEBUG
+    TInt alloc;
+    TInt cells = User::Heap().AllocSize( alloc );
+    TInt size = User::Heap().Size();
+    TRACE(Print(_L("[FILL MNGR]\t DoUpdateReferenceIdsL start heap \
+    allocsize %d, size %d, cells %d"), alloc, size, cells ));    
+#endif
+    
+    LoadAllFillItemsL();
+    LOG(_L("[FILL MNGR]\t Items loaded...")); 
+    
+    // Processing set referense ids into duplicate items
+    LOG(_L("[FILL MNGR]\t Processing ref ids..."));
+
+    DoProcessReferenceValuesL();   
+       
+    LOG(_L("[FILL MNGR]\t Ref ids processed..."));        
+    UpdateFillItems();
+    iItems.ResetAndDestroy();
+    iItems.Close();
+#ifdef _DEBUG    
+    cells = User::Heap().AllocSize( alloc );
+    size = User::Heap().Size();
+    TRACE(Print(_L("[FILL MNGR]\t DoUpdateReferenceIdsL end heap \
+    allocsize %d, size %d, cells %d"), alloc, size, cells ));
+#endif     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::DeleteMetadataL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::DeleteMetadataL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DeleteMetadataL()")); 
+    
+    iMetadataServersToBeDeleted.Reset();
+    
+    RPointerArray<CCmMediaServerFull> mediaServers;
+    CleanupClosePushL( mediaServers );
+   
+    iDBManager->GetMediaServersL( mediaServers ); 
+    
+    TBool setSystemUpdateIDChange( EFalse );
+    for( TInt i = 0; i < mediaServers.Count(); i++ )
+        {
+        // checks that server is either inactive or deleted
+        if( mediaServers[i]->DbId() != 0 && 
+            !( mediaServers[i]->FillUsage() ) )
+            {
+            iMetadataServersToBeDeleted.Append( mediaServers[i]->DbId() );
+            TRACE(Print(_L("[FILL MNGR]\t DbId = %ld"), 
+                mediaServers[i]->DbId() ));            
+                
+            mediaServers[i]->SetSystemUpdateID( KErrNotFound );
+                
+			setSystemUpdateIDChange = ETrue;
+            }
+        }
+
+	if ( setSystemUpdateIDChange )
+		{
+		iDBManager->SetMediaServersL( mediaServers ); 	
+		}
+
+    mediaServers.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &mediaServers );
+    
+    iProcessingState = ECmFmDeletingMetadata;
+    CreateWrapperL();
+    StartObserverL();
+    iWrapper->AsyncMetadataDelete( iMetadataServersToBeDeleted, 
+        iAo->iStatus );
+    iQueryStart.HomeTime();
+    iAo->RunL();        
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::SetMemoryCardQuota
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::SetMemoryCardQuota( TInt64 aQuota )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    SetMemoryCardQuota()")); 
+    
+    if( iWrapper )
+        {
+        iWrapper->SetQuota( aQuota );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::CancelOperation
+// ---------------------------------------------------------------------------
+//    
+void CCmFmFillRuleFilledDataMngr::CancelOperation()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::CancelOperation()"));
+    
+    Cancel();    
+    if( iWrapper )
+        {
+        iWrapper->CancelAsyncOperation();
+        }
+    DeleteWrapper(); 
+    if( iAo )
+        {
+        if( iAo->IsActive() )
+            {
+            iAo->Cancel();
+            } 
+        delete iAo;
+        iAo = NULL;      
+        }
+    LOG(_L("[FILL MNGR]\t iAo canceled..."));          
+    iObserver->FillRuleProcessingStatus(EProcessingCanceled);           
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::UpdateTransferHistoryData
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::UpdateTransferHistoryData( 
+    TInt64 aInterval, TInt64 aDataAmount, 
+    TUint8 aServerId )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    UpdateTransferHistoryData()")); 
+    
+    iDBManager->UpdateDownloadHistory( (TUint)aServerId, aDataAmount,
+        aInterval );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::GetFillItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::GetFillItemsL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::GetFillItemsL()")); 
+    
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    iDBManager->PrepareQueryCmdL(EAllFillFilesStatusQuery);
+    iDBManager->GetAllFillFilesL( iItems, 
+        ECmToBeShrinked|ECmToBeFilled|ECmFilled|ECmLocalCopy );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::GetToBeDeletedL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::GetToBeDeletedL(
+    RPointerArray<CCmFillListItem>& aArray )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::GetToBeDeletedL()")); 
+    
+    iDBManager->PrepareQueryCmdL(EAllFillFilesStatusQuery);
+    iDBManager->GetAllFillFilesL( aArray, ECmToBeRemoved );   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::UpdateFillItems
+// ---------------------------------------------------------------------------
+//    
+void CCmFmFillRuleFilledDataMngr::UpdateFillItems( TBool aCancel )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::UpdateFillItems()")); 
+    
+    iDBManager->DeleteFillFiles();
+    if( aCancel && iUpdateItems.Count() )
+        {
+        iDBManager->SetFillFiles( iUpdateItems );
+        }
+    else
+        {
+        iDBManager->SetFillFiles( iItems );
+        }
+    iUpdateItems.Reset();
+    iUpdateItems.Close();
+
+    iItems.ResetAndDestroy();
+    iItems.Close();
+
+    TRAP_IGNORE( CalculateAvgTransferTimeL() );
+    SendAvgTransferTime();    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::UpdateToBeDeleted
+// ---------------------------------------------------------------------------
+//    
+void CCmFmFillRuleFilledDataMngr::UpdateToBeDeleted( 
+    RPointerArray<CCmFillListItem>& aArray )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    UpdateToBeDeleted()")); 
+    
+    // This function is needed when fill is processed only partially
+    // Some of the to be deleted files are still on device
+    iDBManager->SetFillFiles( aArray );
+    aArray.ResetAndDestroy();
+    aArray.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::GetUuidL
+// ---------------------------------------------------------------------------
+//
+TInt CCmFmFillRuleFilledDataMngr::GetUuidL( HBufC8*& aUuid, TUint8 aId )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::GetUuidL()")); 
+    
+    iDBManager->PrepareQueryCmdL( EMediaServerUDNQuery );
+    return iDBManager->QueryMediaServerUdn(aUuid, aId);      
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::ResetData
+// ---------------------------------------------------------------------------
+//  
+void CCmFmFillRuleFilledDataMngr::ResetData()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::ResetData()")); 
+    
+    iNewItemCount = KErrNone;
+    
+    iRuleArray.Reset();
+    iRuleArray.Close();
+    
+    iUpdateItems.Reset();
+    iUpdateItems.Close();    
+
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    
+    iFileIds.Close();
+    iOldIds.Close(); 
+    
+    if( iContainer )
+        {
+        delete iContainer;
+        iContainer = NULL;
+        }              
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::CalculateAvgTransferTimeL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::CalculateAvgTransferTimeL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    CalculateAvgTransferTimeL()")); 
+    
+    TInt64 ud(KErrNone);
+    TInt64 dd(KErrNone);
+    TInt64 ut(KErrNone);
+    TInt64 dt(KErrNone);
+    TInt64 size( KErrNone );
+    TInt64 shrinkTime(KErrNone);
+    TInt64 transferTime(KErrNone);
+    TInt ret( KErrNone );   
+    RPointerArray<CCmMediaServerFull> servers;
+    CleanupClosePushL( servers );
+    
+    iDBManager->PrepareQueryCmdL( EMediaServersAllQuery );
+    while( !ret )
+        {
+        CCmMediaServerFull* server = CCmMediaServerFull::NewLC();
+        ret = iDBManager->QueryAllMediaServersL( server );
+        if( !ret )
+            {
+            servers.Append( server );
+            CleanupStack::Pop( server );
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy( server );
+            }   
+        }
+    TRACE( Print( _L("[FILL MNGR]\t servers.Count() = %d"),
+        servers.Count() ));             
+    for( TInt i = 0; i < servers.Count(); i++ )
+        {
+        iDBManager->PrepareQueryCmdL(ETransferHistoryQuery);
+        TPtrC8 ser( servers[i]->MediaServer() );
+        if( &ser )
+            {
+            iDBManager->QueryTransferHistory( 
+                ser, dd, ud, dt, ut );
+            size = iDBManager->KBytesToBeFilled( 
+                GetMediaServerIdL(ser), 
+                ECmToBeShrinked|ECmToBeFilled );
+            TRACE( Print( _L("[FILL MNGR]\t data amount \
+                to be filled = %ld"), size ));
+                
+            TRACE( Print( _L("[FILL MNGR]\t transferred data = %ld"),
+                dd )); 
+                
+            TRACE( Print( _L("[FILL MNGR]\t transfer time = %ld"),
+                dt ));                                                 
+            if( dd == KErrNone || dt == KErrNone )
+                {
+                dd = KCmFmIniDownloadDataAmount;
+                dt = KCmFmIniDownloadTime;
+                }
+            // If server hasn't been handled    
+            if( size != KErrNone )
+                {
+                transferTime = transferTime + (( dt * size ) / dd );
+                }
+            TRACE( Print( _L("[FILL MNGR]\t avg transfer time = %ld"),
+                transferTime ));                            
+            }
+             
+        }
+    servers.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &servers );
+    
+    TInt shrinkCount( iDBManager->FillFileCount(ECmToBeShrinked) );
+        
+    shrinkTime = (iDBManager->GetAvgImageShrinkTime() * shrinkCount);     
+    
+    TInt totalCount( iDBManager->FillFileCount( 
+        ECmToBeShrinked|ECmToBeFilled ));
+    transferTime = transferTime + ( shrinkTime / 1000 );
+    if( KErrNone >= totalCount )
+        {
+        transferTime = KErrNone;
+        }
+    iDBManager->UpdateTransferInfo( ECmServiceFill, totalCount, 
+        transferTime );             
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::SendAvgTransferTime
+// ---------------------------------------------------------------------------
+//   
+void CCmFmFillRuleFilledDataMngr::SendAvgTransferTime()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    SendAvgTransferTime()")); 
+    
+    // Load transfer information from database
+    TInt err = iDBManager->GetTransferInfo( ECmServiceFill, 
+        iTransferInfo.iProcessedItems, iTransferInfo.iTotalItems );
+        
+    TRACE( Print( _L("[FILL MNGR]\t GetTransferInfo returned %d"), err));
+    
+    TRACE( Print( _L(
+        "[FILL MNGR]\t item count = %d, avg time = %d"),
+            iTransferInfo.iProcessedItems, iTransferInfo.iTotalItems ));    
+    iTransferInfo.iService = ECmServiceTransferInfoFill;
+        
+    TCmProgressInfoPckg transferInfoPckg( iTransferInfo );
+    
+    err = RProperty::Set( KCmPropertyCat, KCmProperty, 
+        transferInfoPckg );
+    
+    TRACE( Print( _L("[FILL MNGR]\t RProperty::Set returned %d"), err));    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::GetMediaServerIdL
+// ---------------------------------------------------------------------------
+//     
+TInt64 CCmFmFillRuleFilledDataMngr::GetMediaServerIdL( const TDesC8& aUuid )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    GetMediaServerIdL()")); 
+    
+    iDBManager->PrepareQueryCmdL( EMediaServerIdQuery );
+    return iDBManager->QueryMediaServerId( aUuid ); 
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::LoadSelectedFillRulesL
+// ---------------------------------------------------------------------------
+//    
+void CCmFmFillRuleFilledDataMngr::LoadSelectedFillRulesL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+        LoadSelectedFillRulesL()"));
+            
+    RPointerArray<HBufC8> array;
+    CleanupClosePushL( array );
+    
+    iDBManager->PrepareQueryCmdL( ESelectedFillRuleQuery );    
+    iDBManager->QuerySelectedFillRuleNamesL( array, (TInt)ECmSelected );
+    // Load selected fill rules to array ( using names as a query 
+    // parameter ) 
+    for( TInt i = 0; i < array.Count(); i++ ) 
+        {
+        LoadRuleL( *array[i] );
+        }
+    
+    // Remove random rules. When fill manager is booted up first time 
+    // Do not remove random rules => need to be processed
+    // If list don't have any files on the list => process list
+    for( TInt j = 0; j < iRuleArray.Count(); j++ )
+        {
+        if( ECmRandom == iRuleArray[j]->Method() || 
+            ECmRandomAlbum == iRuleArray[j]->Method() ||
+            ECmRandomTrack == iRuleArray[j]->Method() )
+            {
+            TInt count( KErrNone );
+            iDBManager->GetFillFileCount(iRuleArray[j]->Name(), 
+                ECmToBeFilled|ECmToBeShrinked|ECmFilled|ECmLocalCopy, count );
+            if( KErrNone < count )
+                {
+                LOG(_L("[FILL MNGR]\t Random rule is already processed"));
+                delete iRuleArray[j];
+                iRuleArray.Remove(j);
+                j--;                
+                }
+            else
+                {
+                LOG(_L("[FILL MNGR]\t Random rule is not processed"));
+                // Don't remove rule
+                }
+            }
+        }
+    for( TInt k = 0; k < iRuleArray.Count(); k++ )
+        {
+        if( KErrNone == iRuleArray[k]->MediaServerCount() )
+            {
+            LOG(_L("[FILL MNGR]\t No Servers included in fill rule"));
+            TRACE(Print(_L("[FILL MNGR]\t => Any Server rule...")));
+            }
+        }
+        
+    array.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &array );
+    
+    CompleteRequest( EFillRulesLoaded );       
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::LoadAllFillRulesL
+// ---------------------------------------------------------------------------
+//
+CCmFillRuleContainer* CCmFmFillRuleFilledDataMngr::LoadAllFillRulesL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::FillRuleContainerL"));
+    
+    RPointerArray<HBufC8> array;
+    CleanupClosePushL( array );
+    
+    // Query fill rule names
+    iDBManager->PrepareQueryCmdL( EFillRuleNamesQuery );
+    iDBManager->QueryFillRuleNamesL( array );
+    TRACE(Print(_L("[FILL MNGR]\t fill rule array size is %d"), 
+        array.Count()));
+    
+    CCmFillRuleContainer* ruleContainer = CCmFillRuleContainer::NewLC();
+    for ( TInt i = 0; i < array.Count(); i++ )
+        {
+        // Query all fill rules
+        CCmFillRule* rule = CCmFillRule::NewLC();
+        rule->SetNameL( *(array[i]) );
+        iDBManager->PrepareQueryCmdL( EFillRuleQuery );
+        iDBManager->QueryFillRuleL( rule );
+        
+        ruleContainer->AddFillRuleL( rule );
+        CleanupStack::Pop( rule );
+        }
+    CleanupStack::Pop( ruleContainer );
+    
+    array.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &array );
+    
+    return ruleContainer;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::LoadRuleL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::LoadRuleL( const TDesC8& aFillListName )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::LoadRuleL()")); 
+    
+    CCmFillRule* fillRule = CCmFillRule::NewLC();
+    iDBManager->PrepareQueryCmdL(EFillRuleQuery);
+    fillRule->SetNameL( aFillListName );
+    iDBManager->QueryFillRuleL( fillRule );
+    iRuleArray.Append( fillRule );   
+    iContainer->AddFillRuleL( fillRule );
+    CleanupStack::Pop( fillRule );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::UpdateListItemPriorities
+// ---------------------------------------------------------------------------
+//
+TInt CCmFmFillRuleFilledDataMngr::UpdateListItemPriorities( 
+    CCmFillRuleContainer* aContainer )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    UpdateListItemPriorities()"));
+     
+    TInt err( KErrNone );
+    err = iDBManager->UpdateFillListItemPriority( aContainer );            
+    TRACE(Print(_L("[FILL MNGR]\t priority update err = %d"), 
+        err ));            
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::LoadMetadataL
+// ---------------------------------------------------------------------------
+//    
+void CCmFmFillRuleFilledDataMngr::LoadMetadataL( CCmFillRule* aFillRule )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    LoadMetadataL()"));
+    
+    StartObserverL();    
+    TRAPD( err, iWrapper->GetFillItemsL( iItems, *aFillRule, iAo->iStatus ) );
+    if( !err )
+        {
+        iQueryStart.HomeTime();
+        iAo->RunL();
+        iNewItemCount = iItems.Count();
+        //add the old item to list
+        SelectFillListFiles( iOldIds, aFillRule->ListId() );
+        iProcessingState = ECmFmLoadingMetadata;        
+        }
+    else
+        {
+        TRACE(Print(_L("[FILL MNGR]\t Metadata find err = %d"), err ));
+        TRACE(Print(_L("[FILL MNGR]\t Skipping rule...")));
+        iRuleArray.Remove(0);        
+        iRuleArray.Compress();   
+        /** Splitting long task into shorter ones */            
+        CompleteRequest( ENextFillRule );       
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::ProcessReferenceValuesL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::ProcessReferenceValuesL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    ProcessReferenceValuesL()"));
+
+    DoProcessReferenceValuesL();
+    CompleteRequest( EProcessStatusValues );             
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::DoProcessReferenceValuesL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::DoProcessReferenceValuesL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    DoProcessReferenceValuesL()"));
+    
+    RArray<TInt> refIds;
+    CleanupClosePushL( refIds );
+    
+    TBool ref( EFalse );
+    // Processing set referense ids into duplicate items
+    for( TInt j = 0; j < iItems.Count(); j++ )
+        {                       
+        for( TInt k = iItems.Count() - 1; k >= KErrNone; k-- )
+            {
+            if( ( KErrNone == iItems[k]->PrimaryText().Compare(
+                iItems[j]->PrimaryText() )) && (iItems[k]->Size() 
+               == iItems[j]->Size() ) && ( j != k ) && 
+                    ( ECmSelected == iItems[j]->Selected() || 
+                    ( ECmUnSelected == iItems[j]->Selected() && 
+                    ECmUnSelected == iItems[k]->Selected() ) ) )
+                {
+                if( iItems[k]->Priority() > iItems[j]->Priority() )
+                    {
+                    refIds.InsertInOrder( k );
+                    }
+                else if ( iItems[k]->Priority() < iItems[j]->Priority() )
+                    {
+                    // Some of the items are on the higher priority than
+                    // iItems[ j ]
+                    if( ECmUnSelected == iItems[k]->Selected() && 
+                        ECmSelected == iItems[j]->Selected() )
+                        {
+                        refIds.InsertInOrder( k );
+                        }
+                    else
+                        {
+                        ref = ETrue;
+                        }    
+                    }
+                }
+            // Check if there is a match on a selected list    
+            if( ( KErrNone == iItems[k]->PrimaryText().Compare(
+                iItems[j]->PrimaryText() ) ) && ( iItems[k]->Size() 
+               == iItems[j]->Size() ) && ( j != k ) && 
+                    ( ECmUnSelected == iItems[j]->Selected() && 
+                    ECmSelected == iItems[k]->Selected() ) && ( 
+                    iItems[k]->Priority() < iItems[j]->Priority() ) )
+                {
+                // Do not set ref id to zero
+                ref = ETrue;
+                }
+            }
+        // Updating referense ids    
+        for( TInt i = 0; i < refIds.Count(); i++ )
+            {
+            iItems[refIds[i]]->SetRefId( iItems[j]->DbId() );
+            }
+        if( !ref )
+            {
+            iItems[j]->SetRefId( 0 );
+            }
+        ref = EFalse;    
+        refIds.Reset();    
+        }
+    
+    CleanupStack::PopAndDestroy( &refIds );                     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::ProcessDuplicates
+// Processes duplicates. If same list has some item twice,
+// newer one is removed from the list
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::ProcessDuplicates()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    ProcessDuplicates()"));
+
+    TBool duplicateFound( EFalse );
+    
+    for( TInt i = 0; i < iFileIds.Count() - 1; i++ )
+        {
+        duplicateFound = EFalse;
+        //Compare item with following items 
+        for( TInt j = i+1; j < iFileIds.Count() && !duplicateFound; j++ )
+            {
+            if( ( iFileIds[i] < iItems.Count() ) && 
+                ( iFileIds[j] < iItems.Count() ) )
+                {
+                if( i != j && ( ( KErrNone == iItems[iFileIds[i]]->
+                    PrimaryText().Compare( 
+                    iItems[iFileIds[j]]->PrimaryText() ) ) 
+                    && ( iItems[iFileIds[i]]->Size() == 
+                    iItems[iFileIds[j]]->Size() ) || 
+                    iItems[iFileIds[i]]->DbId() == 
+                    iItems[iFileIds[j]]->DbId() ) ) 
+                    {
+                    if( ( ECmImage == iItems[iFileIds[j]]->MediaType() &&
+                         ECmToBeShrinked == iItems[iFileIds[i]]->Status()) ||
+                        ( ECmImage == iItems[iFileIds[j]]->MediaType() &&
+                          ECmToBeFilled == iItems[iFileIds[i]]->Status()) )
+	                    {
+	                    // if the media type is image and never be filled
+	                    //before ,so do not change the new items status value
+	                    //in this cycle , just delete the old items 	
+	                    }
+	                else
+	                    {
+	                    iItems[iFileIds[j]]->SetStatus( 
+                            iItems[iFileIds[i]]->Status() ) ;	
+	                    }
+                    TRAP_IGNORE( iItems[iFileIds[j]]->SetPathL( 
+                        iItems[iFileIds[i]]->Path() ) );
+                    iItems[iFileIds[j]]->SetDriveId( 
+                        iItems[iFileIds[i]]->DriveId() );
+                    iItems[iFileIds[j]]->SetDriveNumber( 
+                        iItems[iFileIds[i]]->DriveNumber() );                                           
+
+                    duplicateFound = ETrue;
+                    }                
+                }                           
+            }
+        //iItems[iFileIds[i]] is duplicated, should delete it
+        if( duplicateFound )
+            {
+            DoDeleteProcess( iFileIds[i] );
+            i--;
+            }
+        }  
+    iItems.Compress();
+     
+    /** Spliting long task into shorter ones */            
+    CompleteRequest( EProcessReferenceValues );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::SelectFillListFiles
+// ---------------------------------------------------------------------------
+//    
+void CCmFmFillRuleFilledDataMngr::SelectFillListFiles( RArray<TInt>& aList,
+                                                       TUint8 aId )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    SelectFillListFiles()"));
+    
+    TRACE(Print(_L("[FILL MNGR]\t LIST ID = %d"), aId ));
+    aList.Reset();
+    aList.Close();
+    TInt count( iItems.Count() );
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iItems[i]->ListId() == aId )
+            {
+            aList.InsertInOrder( i );
+            }
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::ProcessFileStatusValuesL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::ProcessFileStatusValuesL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    ProcessFileStatusValuesL()"));
+    
+    // Let's update priorities,is it possible that priority has changed
+    // And list ids
+    TInt64 ruleSize( KErrNone );
+    TInt64 realSize( KErrNone );
+    TInt err( KErrNone );
+    if( iRuleArray.Count() > 0 )
+	    {
+	    TRAP( err, iDBManager->SetFillListRealCountAndSizeL( 
+	        iRuleArray[0]->ListId(), 0, 0 ) );	
+	    }
+   
+    TRACE(Print(_L("[FILL MNGR]\t Size set err = %d"), 
+        err ));                    
+    TInt64 realCount( iFileIds.Count() );
+    for( TInt k = ( iFileIds.Count() - 1 ); k >= KErrNone && 
+        iFileIds[k] < iItems.Count() ; k-- )
+        {
+        // Update priority
+        iItems[iFileIds[k]]->SetPriority( iRuleArray[0]->Priority() );
+        // Update list id
+        iItems[iFileIds[k]]->SetListId( iRuleArray[0]->ListId() );        
+        if ( iItems[iFileIds[k]]->Status() == ECmToBeFilled || 
+            iItems[iFileIds[k]]->Status() == ECmToBeShrinked ||
+            iItems[iFileIds[k]]->Status() == ECmFilled ||
+            iItems[iFileIds[k]]->Status() == ECmLocalCopy )
+            {
+            // increases list size
+            realSize += iItems[iFileIds[k]]->Size();
+            }
+
+        else if ( iItems[iFileIds[k]]->Status() == ECmToBeRemoved )
+            {
+            // reduces list size
+            realCount--;
+            }
+                   
+        ruleSize = ruleSize + iItems[iFileIds[k]]->Size();
+        } 
+              
+    TInt index( KErrNone );
+    RArray<TInt> delIds;
+    CleanupClosePushL( delIds );
+    
+    TRACE( Print( _L("[FILL MNGR]\t iAllItemCount = %d"), iAllItemCount ) );
+    TRACE( Print( _L("[FILL MNGR]\t iFileIds.Count() = %d"), 
+                  iFileIds.Count() ) );
+    TRACE( Print( _L("[FILL MNGR]\t iNewItemCount = %d"), 
+                  iNewItemCount ) );
+    // Let's mark to be remove extra files  
+    if( iRuleArray.Count() > 0 )
+        {
+        TRACE( Print( _L("[FILL MNGR]\t fill rule array is not empty!")));
+        if( iRuleArray[0]->LimitType() == EMbits )  
+		    {
+		    TRACE( Print( _L("[FILL MNGR]\t fill rule\
+		    Limit Type is EMbits!") ) );
+		    
+		    // KMega=1024*1024
+		    // The size of files to be filled should be small than
+		    // the amount value set by user.
+		    // When realSize be 0 , realCount should be 0 also. 
+		    // iAllItemCount > iNewItemCount : sure that extra file be delete
+		    while( ( (( iRuleArray[0]->Amount()*KMega ) < realSize ) &&
+		              ( realCount>0 )) ||
+		                iAllItemCount > iNewItemCount )
+		        { 
+		        // handle the fill file's count and size.         
+		        ProcessFileSizeAndCount( delIds, index, realCount, realSize);
+		        index++;         
+		        iAllItemCount--;    
+		        }  	
+		     }
+        else
+	        {
+	        // when limit tyep are EUnlimited and EPieces 
+	        // do not need to limit the size of the file that to be filled.
+	        while( iAllItemCount > iNewItemCount )
+	            {         
+	            // handle the fill file's count and size.
+                ProcessFileSizeAndCount( delIds, index, realCount, realSize );
+	            index++;         
+	            iAllItemCount--;    
+	            }      	
+	        }
+        }
+    else
+        {
+     	// if the fill rule array is empty ,just show the information.
+     	TRACE( Print( _L("[FILL MNGR]\t fill rule array is empty!")));
+        }
+    // Let's remove items which had ECmToBeFilled or ECmToShrinked status    
+    if( delIds.Count() > KErrNone )
+        {
+        index = KErrNone;
+        while( delIds.Count() != KErrNone )
+            {
+            ruleSize = ruleSize - iItems[delIds[0] - index]->Size();
+            delete iItems[delIds[0] - index];
+            iItems.Remove( delIds[0] - index );
+            delIds.Remove(0);
+            index++;
+            }        
+        }
+    
+    CleanupStack::PopAndDestroy( &delIds);
+    
+    if( iRuleArray.Count() > 0 )
+	    {
+	    TRAP( err, iDBManager->SetFillListRealCountAndSizeL( 
+             iRuleArray[0]->ListId(), realCount, ruleSize ) );
+            iUpdateItems.Reset();
+            for( TInt j = 0; j < iItems.Count(); j++ )
+                {
+                iUpdateItems.Append( iItems[j] );
+                }
+	    }
+     
+    
+    TRACE(Print(_L("FILL RULE INFORMATION UPDATE err = %d"), err ));
+    if ( iRuleArray.Count() > 0 )
+    	{
+    	iRuleArray.Remove(0);        
+    	iRuleArray.Compress();    	
+    	}
+    
+    TRACE(Print(_L("****** FILL RULE TOTAL SIZE ******")));
+    TRACE(Print(_L("FILL RULE SIZE = %ld ( Bytes )"), ruleSize ));
+    TRACE(Print(_L("****** FILL RULE TOTAL SIZE ******")));
+             
+    /** Spliting long task into shorter ones */            
+    CompleteRequest( ENextFillRule );           
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::ProcessFileSizeAndCount
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::ProcessFileSizeAndCount(
+                                        RArray<TInt>& aDelIds, TInt aIndex, 
+                                        TInt64& aRealCount,
+                                        TInt64& aRealSize )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    ProcessFileSizeAndCount()"));
+    
+	TRACE( Print( _L(" realCount = %ld, aDelIds's count =%d") , aRealCount,
+	aDelIds.Count() ));
+	TRACE( Print( _L(" realSize = %ld ( Bytes )") , aRealSize ));
+	
+	// Should this status be set if priority is higher than duplicates
+    // priority
+    if( iItems[iFileIds[aIndex]]->Status() == ECmFilled )
+        {
+        iItems[iFileIds[aIndex]]->SetStatus( ECmToBeRemoved );
+        aRealCount--;
+        for( TInt i = 0; i < iItems.Count(); i++ )
+            {
+            if( iItems[i]->RefId() == iItems[iFileIds[aIndex]]->DbId() )
+                {
+                // Set also reference ids to status to be removed
+                iItems[i]->SetStatus( ECmToBeRemoved );
+                }
+            }              
+        }
+    else if( iItems[iFileIds[aIndex]]->Status() == ECmToBeFilled ||
+         iItems[iFileIds[aIndex]]->Status() == ECmToBeShrinked )
+        {
+        aRealSize -= iItems[iFileIds[aIndex]]->Size();
+        aDelIds.InsertInOrder( iFileIds[aIndex] );
+        aRealCount--;
+        }
+    else // ECmLocalCopy
+        {
+        TRACE(Print(_L("[FILL MNGR]\t No effect on size")));
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::LoadAllFillItemsL
+// ---------------------------------------------------------------------------
+//    
+void CCmFmFillRuleFilledDataMngr::LoadAllFillItemsL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::LoadAllFillItemsL()"));
+    
+    iItems.ResetAndDestroy();
+    iItems.Close();    
+    iDBManager->PrepareQueryCmdL( EAllFillFilesQuery );
+    TInt err = iDBManager->QueryAllFillFilesL(iItems);
+    TRACE( Print( _L("[FILL MNGR]\t QueryAllFillFilesL err = %d"), err ));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::DefineAndSetDlnaProfileIdFiltersL
+// ---------------------------------------------------------------------------
+//
+void CCmFmFillRuleFilledDataMngr::DefineAndSetDlnaProfileIdFiltersL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    DefineAndSetDlnaProfileIdFiltersL()"));
+    
+    CDesC8Array* array = 
+        &UPnPDlnaUtility::GetSupportedProfilesL( UPnPDlnaUtility::EDMPMode );
+    CleanupStack::PushL( array );
+    TInt okProfile( EFalse );
+    iFilteredProfiles.Reset();
+    for( TInt i = 0 ; i < iPropertys.Count(); i++ )
+        {
+        for( TInt j = 0; j < array->Count(); j++ )
+            {
+            if( KErrNotFound != 
+                iPropertys[i]->Name().Match( array->MdcaPoint(j) ) )
+                {
+                // Profile is supported
+                okProfile = ETrue;
+                // profile is supported, end loop
+                j = array->Count();
+                }
+            }
+        if( !okProfile )
+            {
+            iFilteredProfiles.InsertInSignedKeyOrder( iPropertys[i]->Id() );
+            }
+        okProfile = EFalse;            
+        }
+    iPropertys.ResetAndDestroy();    
+    CleanupStack::PopAndDestroy( array );    
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::CompleteRequest
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::CompleteRequest( 
+    TCmFmFillRuleProcessing aStatus )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::CompleteRequest()"));
+    
+    __ASSERT_DEBUG(!IsActive(),\
+        User::Panic( KCmFmFillManager, KErrInUse ));          
+    SetActive();        
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, aStatus );     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::StartObserverL
+// ---------------------------------------------------------------------------
+//  
+void CCmFmFillRuleFilledDataMngr::StartObserverL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::StartObserverL()"));
+    
+    if( iAo )
+        {
+        delete iAo;
+        iAo = NULL;
+        }
+    iAo = CCmFmAo::NewL( *this );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::CreateWrapperL
+// ---------------------------------------------------------------------------
+//  
+void CCmFmFillRuleFilledDataMngr::CreateWrapperL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::CreateWrapperL()"));
+    
+    DeleteWrapper();
+    iWrapper = CCmSqlMainFactory::NewCmSqlMainL( iFs );
+#ifndef __SERIES60_31__     
+    iWrapper->SetDlnaProfileFilters( iFilteredProfiles );
+#endif    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::DeleteWrapper
+// ---------------------------------------------------------------------------
+//  
+void CCmFmFillRuleFilledDataMngr::DeleteWrapper()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DeleteWrapper()"));
+    
+    if( iWrapper )
+        {
+        iWrapper->Close();
+        iWrapper = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::CheckFillListsL
+// ---------------------------------------------------------------------------
+//  
+void CCmFmFillRuleFilledDataMngr::CheckFillListsL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::CheckFillListsL()"));
+    
+    delete iContainer;
+    iContainer = NULL;
+    iContainer = LoadAllFillRulesL();
+    iRuleArray.Reset();
+    for( TInt j = (iContainer->FillRuleCount() - 1 ) ; j >= 0;
+        j-- )
+        {
+        if( ECmRandom ==  iContainer->FillRule(j)->Method() ||
+            ECmRandomAlbum == iContainer->FillRule(j)->Method() || 
+            ECmRandomTrack == iContainer->FillRule(j)->Method() )
+            {
+            TInt count( KErrNone );
+            iDBManager->GetFillFileCount(
+                iContainer->FillRule(j)->Name(), 
+                ECmToBeFilled|ECmToBeShrinked|ECmFilled|ECmLocalCopy, 
+                count );
+            if( KErrNone < count )
+                {
+                // If rule is random rule which is already processed
+                // do not process rule automatically 
+                LOG(_L("[FILL MNGR]\t Random rule already processed"));
+                iContainer->DeleteFillRule( j );
+                }
+            else
+                {
+                LOG(_L("[FILL MNGR]\t Random rule is not processed"));
+                // Don't remove rule
+                iRuleArray.Append( iContainer->FillRule( j ) );
+                }                   
+            }
+        else
+            {
+            LOG(_L("[FILL MNGR]\t Rule is not random rule"));
+            iRuleArray.Append( iContainer->FillRule( j ) );
+            }    
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::DeleteHashCodesL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::DeleteHashCodesL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DeleteHashCodesL()"));
+    
+    for( TInt i = 0; i < iMetadataServersToBeDeleted.Count(); i++ )
+        {
+        iDBManager->DeleteHashValuesL( iMetadataServersToBeDeleted[i], 0 );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::RunL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::RunL()
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::RunL\
+         status = %d"), iStatus.Int() ));        
+    switch( iStatus.Int() )
+        {
+        case EPreProcessingStarted:
+            {
+            CheckFillListsL();
+            CompleteRequest( EFillRulesLoaded );                       
+            break;
+            }
+        case EQueryFailed:
+            {
+            // Error condition what about now...
+            TRACE(Print(_L("[FILL MNGR]\t EQueryFailed")));
+            if( KErrNone < iRuleArray.Count() )
+                {
+                iRuleArray.Remove(0);        
+                iRuleArray.Compress();                
+                }
+            TRACE(Print(_L("[FILL MNGR]\t Jump to next rule")));
+            CompleteRequest( ENextFillRule );             
+            break;
+            }
+        case EQueryCompleted:
+            {
+            // Select needed amount of Fill rules metadata objects
+            if( KErrNone < iRuleArray.Count() )
+                {
+                SelectFillListFiles( iFileIds, iRuleArray[0]->ListId() );
+                iAllItemCount = iFileIds.Count();
+                TRACE(Print(_L("[FILL MNGR]\t Already on the list = %d"), 
+                    iAllItemCount ));
+                CompleteRequest( EProcessDuplicates );
+                }
+            else
+                {
+                ResetData();
+                DeleteWrapper();
+                iObserver->FillRuleProcessingStatus(ENoObjectsSelected);
+                }    
+            break;
+            }
+        case ENextFillRule:
+            {       
+            // Start processing next fill rule
+            if( KErrNone < iRuleArray.Count() )
+                {
+                LoadMetadataL(iRuleArray[0]);
+                }
+            else
+                {
+                TRACE(Print(_L("[FILL MNGR]\t Rule array empty")));
+                UpdateFillItems();
+                ResetData();
+                DeleteWrapper();                
+#ifdef _DEBUG
+                TInt alloc;
+                TInt cells = User::Heap().AllocSize( alloc );
+                TInt size = User::Heap().Size();
+                TRACE(Print(_L("[FILL MNGR]\t preprocess end heap \
+                allocsize %d, size %d, cells %d"), alloc, size, cells ));
+#endif                
+                iObserver->FillRuleProcessingStatus(EProcessingReady);
+                }    
+            break;
+            }
+        case EFillRulesLoaded:
+            {
+            LoadAllFillItemsL();
+            CompleteRequest( EFillFilesLoaded );
+            break;
+            }
+        case EFillFilesLoaded:
+            {
+            if( KErrNone < iRuleArray.Count() )
+                {
+                LoadMetadataL( iRuleArray[0] );    
+                }
+            else
+                {
+                TRACE(Print(_L("[FILL MNGR]\t Rule array empty")));
+                TRAP_IGNORE( CalculateAvgTransferTimeL() );
+                SendAvgTransferTime();
+                ResetData();
+                DeleteWrapper();                
+                iObserver->FillRuleProcessingStatus(ENoRulesSelected);
+                }
+            break;    
+            }
+        case EProcessDuplicates:
+            {
+            ProcessDuplicates();
+            break;
+            }
+        case EProcessReferenceValues:
+            {
+            ProcessReferenceValuesL();
+            break;
+            }
+        case EProcessStatusValues:
+            {
+            ProcessFileStatusValuesL()  ;
+            break;
+            }
+        case ERandomizingStarted:
+            {
+            if( KErrNone < iRuleArray.Count() )
+                {
+                LoadMetadataL( iRuleArray[0] );    
+                }
+            else
+                {
+                TRACE(Print(_L("[FILL MNGR]\t Rule array empty")));
+                ResetData();
+                DeleteWrapper();
+                iObserver->FillRuleProcessingStatus(ENoRulesSelected);
+                }
+            break;
+            }
+        case EColumnDataReady:
+            {
+            DeleteWrapper();
+            iObserver->FillRuleProcessingStatus(EColumnDataReady);
+            break;
+            }
+        case EUpdatePriorities:
+            {
+            DoUpdatePrioritiesL();
+            break;
+            }
+        case EMetadataDeleted:
+            {
+            iObserver->FillRuleProcessingStatus( EMetadataDeleted );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[FILL MNGR]\t Fill rule processing RunL default"));
+            User::Invariant();
+            break;
+            }
+        }
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::RunError
+// ---------------------------------------------------------------------------
+// 
+#ifdef _DEBUG  
+TInt CCmFmFillRuleFilledDataMngr::RunError( TInt aError )
+#else
+TInt CCmFmFillRuleFilledDataMngr::RunError( TInt /*aError*/ )
+#endif
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\
+    RunError = %d"), aError ));       
+    
+    iObserver->FillRuleProcessingStatus( EProcessingFailed );
+    return KErrNone;     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::DoCancel
+// ---------------------------------------------------------------------------
+//     
+void CCmFmFillRuleFilledDataMngr::DoCancel()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DoCancel()"));
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmFmFillRuleFilledDataMngr::DoDeleteProcess
+// ---------------------------------------------------------------------------
+// 
+void CCmFmFillRuleFilledDataMngr::DoDeleteProcess( TInt aIndex )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DoDeleteProcess()"));
+    TBool delNew( ETrue );
+    
+    //delete duplicated fill item
+    delete iItems[aIndex];
+    iItems.Remove( aIndex );
+
+    //adjust iOldIds, and judge the item new item or old item
+    for( TInt i = 0; i < iOldIds.Count(); i++ )
+        {
+        if( iOldIds[i] > aIndex )
+            {
+            iOldIds[i] = iOldIds[i] - 1;
+            }
+        else if( iOldIds[i] == aIndex )
+            {
+            delNew = EFalse;
+            iOldIds.Remove(i);
+            i--;
+            }
+        }
+    
+    //adjust iFileIds
+    for( TInt i = 0; i < iFileIds.Count(); i++ )
+        {
+        if( iFileIds[i] > aIndex )
+            {
+            iFileIds[i] = iFileIds[i] - 1;
+            }
+        else if( iFileIds[i] == aIndex )
+            {
+            iFileIds.Remove(i);
+            i--;
+            }
+        }
+
+    //count update
+    iAllItemCount--;
+    if( delNew )
+        {
+        iNewItemCount--;
+        }
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmglxnotifier.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gallery notifier
+*
+*/
+
+
+
+#include <f32file.h>
+#include <ContentListingFactory.h>
+#include <MCLFContentListingEngine.h>
+#include "cmfmglxnotifier.h"
+#include "msdebug.h"    
+
+
+// ---------------------------------------------------------------------------
+// CCmFmGlxNotifier::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmFmGlxNotifier* CCmFmGlxNotifier::NewL( RFs& aFS )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NewL() start"));    
+    CCmFmGlxNotifier* self = CCmFmGlxNotifier::NewLC( aFS );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmGlxNotifier::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmFmGlxNotifier* CCmFmGlxNotifier::NewLC( RFs& aFS )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NewLC() start"));    
+    CCmFmGlxNotifier* self = new ( ELeave ) CCmFmGlxNotifier( );
+    CleanupStack::PushL( self );
+    self->ConstructL( aFS );
+    LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmGlxNotifier::~CCmFmGlxNotifier
+// ---------------------------------------------------------------------------
+// 
+CCmFmGlxNotifier::~CCmFmGlxNotifier()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::~CCmFmGlxNotifier()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmGlxNotifier::CCmFmGlxNotifier
+// ---------------------------------------------------------------------------
+// 
+CCmFmGlxNotifier::CCmFmGlxNotifier( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::CCmFmGlxNotifier()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmGlxNotifier::ConstructL
+// ---------------------------------------------------------------------------
+//     
+void CCmFmGlxNotifier::ConstructL( RFs& /*aFS*/ )
+    {        
+    LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::ConstructL()"));
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmGlxNotifier::NotifyGalleryL
+// ---------------------------------------------------------------------------
+//     
+void CCmFmGlxNotifier::NotifyGalleryL( const TDesC& /*aFullPath*/ )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NotifyGalleryL()"));
+    
+    MCLFContentListingEngine* clfEngine = 
+            ContentListingFactory::NewContentListingEngineLC();
+    
+    TRAP_IGNORE( clfEngine->UpdateItemsL() );
+    
+    CleanupStack::PopAndDestroy(); // clfEngine
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmGlxNotifier::NotifyGalleryL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmGlxNotifier::NotifyGalleryL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NotifyGalleryL()"));
+   
+    MCLFContentListingEngine* clfEngine = 
+            ContentListingFactory::NewContentListingEngineLC();
+            
+    TRAP_IGNORE( clfEngine->UpdateItemsL() );
+    
+    CleanupStack::PopAndDestroy(); // clfEngine
+    }        
+        
+// End of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmain.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1774 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main class in the Fill manager component
+*
+*/
+
+
+#include <e32property.h>
+#include <e32std.h>
+#include <f32file.h>
+#include <badesca.h>
+#include "upnpavdevice.h"
+#include "upnpavcontroller.h"
+#include "upnpavdevicelist.h"
+#include "upnpitem.h"
+#include "upnpcontainer.h"
+#include <pathinfo.h>
+#include <utf.h>
+#include "cmserviceobserver.h"
+#include "cmfmdownloadproxy.h"
+#include "cmfmupnpmngr.h"
+#include "cmfmfilldrivemngr.h"
+#include "cmfmduplicatedetector.h"
+#include "cmdriveinfo.h"
+#include "cmfmfillrulefilleddatamngr.h"
+#include "cmfmmpxnotifier.h"
+#include "cmfmglxnotifier.h"
+#include "cmfmcommon.h"
+#include "cmdmmain.h"
+#include "cmmmmain.h"
+#include "cmfilllistitem.h"
+#include "cmsqlpropertyitem.h"
+#include "cmsqlpropertycontainer.h"
+#include "cmfmmain.h"
+#include "msdebug.h"
+
+const TUint8 KExtensionLength = 4;
+const TInt KCmFmOneFile = 1;
+const TInt KCmFmLengthOfRoot = 3;
+const TInt KCmFmOneSecond = 1000000;
+const TInt KArrayGranularity = 10;
+const TInt KExtraSpace = 5; // space reserved for backslashes etc. 
+const TInt KDefaultCalculateSize = 100;
+
+_LIT16( KCmKorp,               "<" );
+_LIT16( KCmProk,               ">" );
+_LIT16( KCmQuotation,          "\"" );
+_LIT16( KCmDoubleBackSlash,    "\\" );
+_LIT16( KCmSlash,              "/" );
+_LIT16( KCmStar,               "*" );
+_LIT16( KCmPipe,               "|" );
+_LIT16( KCmColon,              ":");
+_LIT16( KCmQuestionMark,       "?" );
+_LIT16( KCmUnderScore,         "_" );
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::NewL
+// ---------------------------------------------------------------------------
+//
+CCmFmMain* CCmFmMain::NewL( MCmServiceObserver* aObserver,
+    CMdESession& aSession, CCmDmMain* aDBManager, 
+    CCmMmMain* aMemManager )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::NewL() start"));
+    CCmFmMain* self = CCmFmMain::NewLC( aObserver, aSession,
+        aDBManager, aMemManager );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmMain::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::NewLC
+// ---------------------------------------------------------------------------
+//
+CCmFmMain* CCmFmMain::NewLC( MCmServiceObserver* aObserver,
+    CMdESession& aSession, CCmDmMain* aDBManager, 
+    CCmMmMain* aMemManager )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::NewLC() start"));
+    CCmFmMain* self = new ( ELeave ) CCmFmMain( aObserver, 
+        aMemManager, aDBManager );
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession, aDBManager );
+    LOG(_L("[FILL MNGR]\t CCmFmMain::NewLC() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::~CCmFmMain
+// ---------------------------------------------------------------------------
+//
+CCmFmMain::~CCmFmMain()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::~CCmFmMain() start"));
+    if( IsActive() )
+        {
+        Cancel();
+        }
+    iFile.Close();        
+    iFsSession.Close();
+    delete iCmFmFillDriveMngr;
+    delete iCmFmUpnpMngr;
+
+    if( iDevices )
+        {
+        iDevices->ResetAndDestroy();
+        delete iDevices;
+        iDevices = NULL;
+        }
+
+    delete iCmFmFillRuleFilledDataMngr;
+    delete iCmFmDownloadProxy;
+    delete iCmFmDuplicateDetector;
+    delete iCmFmGlxNotifier;
+    delete iCmFmMpxNotifier;
+
+    ResetDeleteQueue();
+    ResetItems();
+    iFullPath.Zero();
+    iDrives.ResetAndDestroy();
+    iDrives.Close();
+    LOG(_L("[FILL MNGR]\t CCmFmMain::~CCmFmMain() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::CCmFmMain
+// ---------------------------------------------------------------------------
+//
+CCmFmMain::CCmFmMain( MCmServiceObserver* aObserver,
+    CCmMmMain* aMemManager, CCmDmMain* aDBManager )
+    : CActive( EPriorityStandard ), iObserver( aObserver ), 
+    iMemManager( aMemManager ), iDbManager( aDBManager )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::CCmFmMain()"));
+        
+    CActiveScheduler::Add( this );
+    iProgressInfo.iService = ECmServiceNone;
+    iProgressInfo.iProcessedItems = 0;
+    iProgressInfo.iItemsToTransferPerService = 0;
+    iProgressInfo.iTotalItems = 0;
+    iService = ECmServiceFill;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::ConstructL( CMdESession& aSession, CCmDmMain* aDBManager )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ConstructL() start"));
+    
+    User::LeaveIfError( iFsSession.Connect() );
+    User::LeaveIfError( iFsSession.ShareProtected() );   
+    iCmFmFillDriveMngr = CCmFmFillDriveMngr::NewL( iFsSession, iDrives );
+    iCmFmUpnpMngr = CCmFmUpnpMngr::NewL( this );
+    iCmFmFillRuleFilledDataMngr =
+        CCmFmFillRuleFilledDataMngr::NewL( this, aDBManager, iItems );
+    iCmFmDownloadProxy = CCmFmDownloadProxy::NewL( );
+    iCmFmDuplicateDetector = CCmFmDuplicateDetector::NewL( *this, aSession );
+    iCmFmGlxNotifier = CCmFmGlxNotifier::NewL( iFsSession );
+    iCmFmMpxNotifier = CCmFmMpxNotifier::NewL( );
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ConstructL() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::StartFillL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::StartFillL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::StartFillL()"));
+    
+    iDbManager->GetProgressInfo( iProgressInfo.iProcessedItems,
+        iProgressInfo.iTotalItems );
+    iProgressInfo.iItemsToTransferPerService =
+        iDbManager->FillFileCount( ECmToBeShrinked|ECmToBeFilled );
+    iService = ECmServiceFill;
+    iProgressInfo.iService = ECmServiceFill;
+    iTempIndex = 0;
+    SendProgressInfo( KErrNone );
+    LoadDrivesL();
+    CompleteRequest( ECmFmMMCCheckStarted );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::CancelOperation
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::CancelOperation()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::CancelOperation()"));
+    
+    // Destroy all active objects
+    iCmFmUpnpMngr->CancelOperation();
+    iCmFmFillRuleFilledDataMngr->CancelOperation();
+    iCmFmDownloadProxy->CancelOperation();
+    LOG(_L("[FILL MNGR]\t Filling => Update items to database"));
+    if( KErrNone < iItems.Count() )
+        {
+        iCmFmFillRuleFilledDataMngr->UpdateFillItems( ETrue );
+        }
+    if( KErrNone < iToBeDeleted.Count() )
+        {
+        iCmFmFillRuleFilledDataMngr->UpdateToBeDeleted( iToBeDeleted );
+        }
+    UpdateDrives();
+    
+    // File fetching was ongoing => have to notify gallery 
+    // about deleted file    
+    if( iFetchingFile && iIndex < iItems.Count() )
+        {
+        iFsSession.Delete( iFullPath );
+        TRAP_IGNORE( iCmFmGlxNotifier->NotifyGalleryL( iFullPath ) );
+        }
+
+    // Update UI information
+    TRAPD( err, iCmFmFillRuleFilledDataMngr->CalculateAvgTransferTimeL() );
+    if( err )
+        {
+        TRACE(Print(_L("[FILL MNGR]\t CancelOperation error = %d"), err ));
+        }
+            
+    iCmFmFillRuleFilledDataMngr->SendAvgTransferTime();
+    iCmFmFillRuleFilledDataMngr->ResetData();
+    Cancel();
+    iObserver->ServiceExecuted( iService, KErrCancel );
+    if( iProgressInfo.iService != ECmServiceNone )
+        {
+        // Service finished. Reset progress info.
+        iProgressInfo.iService = ECmServiceNone;
+        SendProgressInfo( KErrNone );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::PreProcessListsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::PreProcessListsL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::PreProcessListsL()"));
+    
+    if( KErrNone == iDbManager->FillFileCount(
+        ECmToBeShrinked|ECmToBeFilled|ECmToBeRemoved|ECmFilled ) )
+        {
+        // Set used fill space to zero
+        InitializeDriveQuotasL();
+        }
+    iService = ECmServicePreProcessingFill;
+  
+    TRAPD( err, iCmFmFillRuleFilledDataMngr->LoadProfileIdsL() );    
+
+    if( err )
+        {
+        iObserver->ServiceExecuted( iService, KErrNone );
+        }
+
+    SetMmcQuotaL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::PreProcessListL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::PreProcessListL( const TDesC8& aFillListName )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::PreProcessListL()"));
+    
+    if( KErrNone == iDbManager->FillFileCount(
+        ECmToBeShrinked|ECmToBeFilled|ECmToBeRemoved|ECmFilled ) )
+        {
+        // Set used fill space to zero
+        InitializeDriveQuotasL();
+        }
+    iService = ECmServicePreProcessingFilllist;
+    TRAPD( err, 
+           iCmFmFillRuleFilledDataMngr->PreProcessListL( aFillListName) );
+    if( err )
+        {
+        TRACE(Print(_L("[FILL MNGR]\t PreProcessListL err = %d"), err )); 
+        iObserver->ServiceExecuted( iService, KErrNone );
+        }
+
+    SetMmcQuotaL();
+
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::GetColItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::GetColItemsL( TCmMetadataField /*aType*/,
+    TCmMediaType /*aMedia*/, CDesCArray& /*aArray*/ )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::GetColItemsL()"));
+    
+    iService = ECmServiceGetFillFields;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::GetMetadataItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::GetMetadataItemsL(
+                                CCmSqlPropertyCollector& aPropertys )
+
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::GetMetadataItemsL()"));
+    
+    iService = ECmServiceGetFillFields;
+    iCmFmFillRuleFilledDataMngr->GetMetadataItemsL( aPropertys );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmMain::GetColItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::GetColItemsL( TCmMetadataField aType,
+    TCmMediaType aMedia, CCmSqlPropertyContainer& aPropertys )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::GetColItemsL()"));
+    
+    iService = ECmServiceGetFillFields;
+    iCmFmFillRuleFilledDataMngr->GetColItemsL( aType, aMedia, aPropertys );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::SetAvController
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::SetAvController( MUPnPAVController* aAVController )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::SetAvController()"));
+    
+    iAvController = aAVController;
+    iCmFmUpnpMngr->SetAvController( aAVController );
+    iCmFmDownloadProxy->CancelOperation( );
+    ResetItemInfo();
+    iDrives.ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::UpdatePriorities
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::UpdatePriorities()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::UpdatePriorities()"));
+    
+    iCmFmFillRuleFilledDataMngr->UpdatePriorities();
+    iService = ECmServiceUpdateFillLists;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::UpdateRefIds
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::UpdateRefIds()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::UpdateRefIds()"));
+    
+    TRAPD( err, iCmFmFillRuleFilledDataMngr->DoUpdateReferenceIdsL() );
+    if( err )
+        {
+        TRACE(Print(_L("[FILL MNGR]\t UpdateRefIds err = %d"), err ));
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::DeleteMetadataL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::DeleteMetadataL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::DeleteMetadataL()"));
+    
+    iCmFmFillRuleFilledDataMngr->DeleteMetadataL();
+    iService = ECmServiceDeleteMetadata;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::SetMmcQuotaL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::SetMmcQuotaL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::SetMmcQuotaL()"));
+    
+    LoadDrivesL();
+    TInt64 quota( KErrNone );
+    for( TInt i = 0 ; i < iDrives.Count(); i++ )
+        {
+        if( quota < iDrives[i]->DriveQuota() )
+            {
+            quota = iDrives[i]->DriveQuota();
+            }
+        }
+    iDrives.ResetAndDestroy();
+    TRACE(Print(_L("[FILL MNGR]\t Max fill list size in bytes = %ld"),
+        quota ));
+    iCmFmFillRuleFilledDataMngr->SetMemoryCardQuota( quota );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::FillRuleProcessingStatus
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::FillRuleProcessingStatus( TCmFmFillRuleProcessing aStatus )
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::\
+        FillRuleProcessingStatus status = %d"), (TInt)aStatus ));
+        
+    switch( aStatus )
+        {
+        case EProcessingReady:
+            {
+            iObserver->ServiceExecuted( iService,
+                KErrNone );
+            break;
+            }
+        case ENoRulesSelected:    // fall through
+        case ENoObjectsSelected:  // fall through
+        case EColumnDataReady:    // fall through
+        case EDoUpdatePriorities: // fall through
+        case EMetadataDeleted:    
+            {
+            // Finish fill operation
+            iObserver->ServiceExecuted( iService, KErrNone );
+            break;
+            }
+        case EProcessingCanceled:
+            {
+            break;
+            }
+        case EProcessingFailed:
+            {
+            iObserver->ServiceExecuted( iService,
+                KErrUnknown );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[FILL MNGR]\t Wrong status in Fill rule processing"));
+            User::Invariant();
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::TransferStatus
+// ---------------------------------------------------------------------------
+//    
+void CCmFmMain::TransferStatus( TCmFmTransferStatus aStatus, TInt aSessionId,
+    TInt aInternalItemId, TInt aError, TInt64 aFSize )
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::TransferStatus status = %d \
+    error = %d"), (TInt)aStatus, (TInt)aError ));
+
+    TInt err( KErrNone );    
+    switch( aStatus )
+        {
+        case ECmFmFileFetchStarted: 
+            {
+            if( !aError )
+                {
+                TRACE(Print(_L("[FILL MNGR]\t File download started!"))); 
+                iFetchingFile = ETrue;                
+                }
+            else if( KErrDisconnected == aError )
+                {
+                TransferStatus( ECmFmFileFetched, aSessionId, 0, 
+                    aError, 0 );
+                }
+            else
+                {
+                ProceedWithNextItem( ECmFmCheckItem );                   
+                }                
+            break;
+            }
+        case ECmFmFileFetched:
+            {
+            iFetchingFile = EFalse; 
+            iFile.Close();
+            if( !aError )
+                {
+                TTime fetchFinished;                           
+                fetchFinished.HomeTime();
+                TTimeIntervalMicroSeconds usecsFrom =
+                    fetchFinished.MicroSecondsFrom(iFileFetchStart);
+                TRACE(Print(_L("[FILL MNGR]\t File Fetch \
+                    took = %ld microseconds"), usecsFrom.Int64() ));
+
+                // Update Fill quota
+                TInt64 fillSpace( KErrNone );
+                fillSpace = iDrives[iDriveIndex]->UsedDriveQuota() +
+                    ( aFSize * KKilo );
+                UpdateDriveQuota( iDriveNumber, fillSpace );
+
+                TInt64 timeinsecs((TInt64)(usecsFrom.Int64()/KCmFmOneSecond));
+                // Update transfer history information
+                iCmFmFillRuleFilledDataMngr->UpdateTransferHistoryData(
+                    timeinsecs, aFSize,
+                    iItems[iIndex]->DevId() );
+
+                // Update progress info
+                SendProgressInfo( KCmFmOneFile );
+
+                if( iItems[iIndex]->Status() == ECmToBeShrinked )
+                    {
+                    // Let's update file status
+                    TRAP( err, SetStatusL( aInternalItemId ) );
+                    TRACE(Print(_L("[FILL MNGR]\t SetStatusL err = %d"), err));
+                    CompleteRequest( ECmFmShrinkImage );
+                    }
+                else
+                    {
+                    TRAP( err, ReplaceFileL( iItems[iIndex]->Path() ) );
+                    TRACE(Print(_L("[FILL MNGR]\t ReplaceFileL err = %d"), 
+                    err));
+                    TRAP_IGNORE( iCmFmGlxNotifier->NotifyGalleryL( iFullPath ) ); 
+                    if( iItems[iIndex]->MediaType() == ECmAudio )
+                        {
+                        TRAP( err, iCmFmMpxNotifier->NotifyMpxL( 
+                            iFullPath, iCmFmUpnpMngr->UpnpItem() ) );
+                        TRACE(Print(_L("[FILL MNGR]\t NotifyMpxL err = %d"), 
+                        err));                        
+                        }
+                    else
+                        {
+                        TRACE(Print(_L("[FILL MNGR]\t Image or video file")));
+                        }                                          
+                    // Let's update file status to filled
+                    TRAP( err, SetStatusL( aInternalItemId ) );
+                    TRACE(Print(_L("[FILL MNGR]\t SetStatusL err = %d"), err));
+                    // Jump to next file => Update item index
+                    ProceedWithNextItem( ECmFmCheckItem );
+                    }                
+                }
+            else if( KErrDisconnected == aError )
+                {
+                // Close used session: wlan connection lost or 
+                // used media server disappeared
+                if( iCmFmDownloadProxy->CloseDownloadSession( aSessionId ) )
+                    {
+                    // Continue if some sessions still available
+                    if( !IsActive() )
+                        {
+                    ProceedWithNextItem( ECmFmCheckItem );
+                        }
+                    }
+                else
+                    {
+                    // Update item information into db
+                    if( KErrNone < iItems.Count() )
+                        {
+                        iCmFmFillRuleFilledDataMngr->UpdateFillItems();
+                        }
+                    if( KErrNone < iToBeDeleted.Count() )
+                        {
+                        iCmFmFillRuleFilledDataMngr->UpdateToBeDeleted( 
+                            iToBeDeleted );
+                        }
+                    UpdateDrives();
+                    // Finish filling if connection to all sessions lost
+                    iObserver->ServiceExecuted( iService, KErrGeneral );
+                    }                                     
+                }
+            else
+                {
+                ProceedWithNextItem( ECmFmCheckItem );                
+                }                                                
+            break;
+            }
+        default:
+            {
+            LOG(_L("[FILL MNGR]\t Wrong status in transfer"));
+            User::Invariant();
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::URICheckResult
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::URICheckResult( TCmFmUriCheckResult aStatus, 
+    const CUpnpItem* aItem, const CUpnpElement* aRes )
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::URICheckResult status = %d"),
+        (TInt)aStatus ));
+        
+    switch( aStatus )
+        {
+        case ECanceled:
+            {
+            // Finish operation
+            iIndex = iItems.Count();
+            CompleteRequest( ECmFmCheckItem );
+            break;
+            }
+        case ENoUriAvailable:
+            {
+            // No uri available => Jump to next item
+            ProceedWithNextItem( ECmFmCheckItem );
+            break;
+            }
+        case EUriChecked:
+            {
+            TRAPD( err, SetUriL( ) );
+            TRACE(Print(_L("[FILL MNGR]\t SetUriL err = %d"), err ));
+            TInt error( KErrNone );
+            TRAP(  err, error = ParseFullPathL() );
+            TRACE(Print(_L("[FILL MNGR]\t ParseFullPathL err=%d"), err ));
+            if( KErrNone == error && 
+                iItems[iIndex]->Uri().Length() != KErrNone )
+                {
+                iFullPath.Zero();
+                TRAP( err, PrivatePathL( ) );
+                TRACE(Print(_L("[FILL MNGR]\t PrivatePathL err=%d"), err ));
+                error  = CreateRFile( iFullPath );
+                TRACE(Print(_L("[FILL MNGR]\t CreateRFile error = %d"), 
+                    error ));                
+                if( !error )
+                    {
+                    iFileFetchStart.HomeTime();
+                    TRAP( error, iCmFmDownloadProxy->FetchFileL( this, 
+                        iAvController, iDevices, *aRes, *aItem, 
+                        iFile, CheckServerIndex( *iUuid, *iDevices ), 
+                        iItems[iIndex]->DbId() ) );
+                    TRACE(Print(_L("[FILL MNGR]\t FetchFileL error = %d"), 
+                        error));                    
+                    }
+                if( error )
+                    {
+                    TRACE(Print(_L("[FILL MNGR]\t Error = %d"), error ));
+                    ProceedWithNextItem( ECmFmCheckItem );                    
+                    }
+                }
+            else
+                {
+                ProceedWithNextItem( ECmFmCheckItem );
+                }
+            break;            
+            }
+        default:
+            {
+            LOG(_L("[FILL MNGR]\t Wrong URI check value"));
+            User::Invariant();
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::Duplicate
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::DuplicateL( const TBool aDuplicate )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::Duplicate()"));
+    
+    if( !aDuplicate )
+        {
+        // Not duplicate
+        CompleteRequest( ECmFmStartUriCheck );
+        }
+    else
+        {
+        TInt index( iIndex );
+        // Duplicate => skip item and check next one
+        ProceedWithNextItem( ECmFmCheckItem );
+        
+        if ( index < iItems.Count() )
+			{
+			// Update status of duplicate item to filled
+			iItems[index]->SetStatus( ECmFilled );
+			RPointerArray<CCmBaseListItem> items;
+			CleanupClosePushL( items );
+			items.Append( iItems[index] );
+			iDbManager->UpdateStatusValues( items );
+			items.Reset();
+			CleanupStack::PopAndDestroy( &items );
+			
+			// Update transfer info
+	        TInt count( KErrNone );
+	        TInt time( KErrNone );
+	        iDbManager->GetTransferInfo( ECmServiceFill, count, time );
+	        iProgressInfo.iItemsToTransferPerService =
+	            iDbManager->FillFileCount( ECmToBeShrinked|ECmToBeFilled );
+	        iDbManager->UpdateTransferInfo( ECmServiceFill,
+	            iProgressInfo.iItemsToTransferPerService, time );
+			}
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::DeleteCompleteL
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CCmFmMain::DeleteCompleteL( TInt aErr )
+#else
+void CCmFmMain::DeleteCompleteL( TInt /*aErr*/ )
+#endif
+    {
+    TRACE(Print(_L("[FILL MNGR]\t DeleteCompleteL err = %d"), aErr ));
+    //this function is called back by CmMmMain
+    //after all array is be deleted or cancel
+    for( TInt i = iToBeDeleted.Count() - 1; i >= 0; i-- )
+        {
+        if ( KErrNone == iToBeDeleted[i]->RefId() )
+            {
+            delete iToBeDeleted[i];
+            iToBeDeleted.Remove( i );
+            }
+        }
+    iToBeDeleted.Compress();
+    CompleteRequest( ECmFmCheckItem );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ShrinkCompleteL
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CCmFmMain::ShrinkCompleteL( TInt aErr )
+#else
+void CCmFmMain::ShrinkCompleteL( TInt /*aErr*/ )
+#endif
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::\
+    ShrinkCompleteL err = %d"), aErr ));
+    
+    ReplaceFileL( iItems[iIndex]->Path() );
+    iCmFmGlxNotifier->NotifyGalleryL( iFullPath );
+    ProceedWithNextItem( ECmFmCheckItem );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::RunL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::RunL()
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::\
+    RunL status = %d"), iStatus.Int() ));
+    
+    switch( iStatus.Int() )
+        {
+        case ECmFmMMCCheckStarted:
+            {
+            // Update updated drive array into database
+            UpdateDrives();
+            // Check first Drive Id
+            CompleteRequest( iCmFmFillDriveMngr->CheckDriveId() );
+            break;
+            }
+        case ECmFmWrongMMC:
+            {
+            // Error Wrong MMC
+            iObserver->ServiceExecuted( iService, KErrNone );
+            break;
+            }
+        case ECmFmMMCOk:
+            {
+            HandleIfMmcOkL();
+            break;
+            }
+        case ECmFmMMCCheckFailed:
+            {
+            // Error MMC check failed
+            iObserver->ServiceExecuted( iService, KErrNone );
+            break;
+            }
+        case ECmFmStartUriCheck:
+            {
+            if( iIndex < iItems.Count() &&
+                ECmFilled != iItems[iIndex]->Status() &&
+                ECmLocalCopy != iItems[iIndex]->Status() &&
+                KErrNone == iItems[iIndex]->RefId() &&
+                ECmSelected == iItems[iIndex]->Selected() )
+                {
+                DoUriCheckL();
+                }
+            else
+                {
+                ProceedWithNextItem( ECmFmCheckItem );
+                }
+            break;
+            }
+        case ECmFmBrowseReady:
+            {
+            TRAP_IGNORE( SetUriL() );
+            CompleteRequest( ECmFmUriOK );
+            break;
+            }
+        case ECmFmCheckItem:
+            {
+            if( iIndex < iItems.Count() )
+                {
+                TBool checkneed( EFalse );
+                if( iIndex < iItems.Count() &&
+                    ECmFilled != iItems[iIndex]->Status() &&
+                    ECmLocalCopy != iItems[iIndex]->Status() &&
+                    KErrNone == iItems[iIndex]->RefId() &&
+                    ECmSelected == iItems[iIndex]->Selected() )
+                    {
+                    TRAPD( err, 
+                      iCmFmDuplicateDetector->CheckItemL( *iItems[iIndex] ) );
+                    if( !err )
+                        {
+                        checkneed = ETrue;
+                        }
+                    }
+                if( !checkneed )
+                    {
+                    // Error occurred => Jump to next item
+                    ProceedWithNextItem( ECmFmCheckItem );
+                    }                
+                }
+            else
+                {
+                StopItemCheck();
+                iObserver->ServiceExecuted( iService, KErrNone );
+                }                
+            break;
+            }            
+        case ECmFmDeleteFiles:
+            {
+            HandleIfDeleteFilesL();
+            break;
+            }
+        case ECmFmShrinkImage:
+            {
+            ResetDeleteQueue();
+            iArray = new ( ELeave ) CDesCArrayFlat( KArrayGranularity );
+            iArray->AppendL( iFullPath );
+            // Let's ensure that fill manager is set as a observer
+            iMemManager->SetObserver( *this );
+            iMemManager->ShrinkImagesL( *iArray );
+            break;
+            }
+        default:
+            {
+            // NOT HERE -> Panic
+            LOG(_L("[FILL MNGR]\t RunL default"));
+            User::Invariant();
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::DoCancel()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::DoCancel()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::RunError
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+TInt CCmFmMain::RunError( TInt aError )
+#else // _DEBUG
+TInt CCmFmMain::RunError( TInt /*aError*/ )
+#endif // _DEBUG
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::RunError = %d"), aError ));
+    
+    iObserver->ServiceExecuted( iService, KErrNone );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::HandleIfMmcOkL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::HandleIfMmcOkL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::HandleIfMmcOkL()"));
+    
+    iIndex = KErrNone;
+    iCmFmFillRuleFilledDataMngr->GetFillItemsL();
+    iCmFmFillRuleFilledDataMngr->GetToBeDeletedL(iToBeDeleted);
+    if ( iDevices )
+        {
+        iDevices->ResetAndDestroy();
+        delete iDevices;
+        iDevices = NULL;
+        }
+    TRAPD( err, iCmFmUpnpMngr->GetMediaServersL( iDevices ) );
+    TRACE(Print(_L("[FILL MNGR]\t GetMediaServersL err = %d"), err ));
+    if( err )
+        {
+        iObserver->ServiceExecuted( iService, KErrNone );
+        }
+    else
+        {
+#ifdef _DEBUG
+        LogServers();
+#endif
+        if( !iDevices->Count() )
+            {
+            TRACE(Print(_L("[FILL MNGR]\t No devices selected")));
+            iObserver->ServiceExecuted( iService, KErrNotFound );
+            ResetItems();
+            }
+        else
+            {
+            // If some of needed servers is available and there is items to
+            // be transfered => Start fill
+            if( NeededServerAvailableL() && 
+                iProgressInfo.iItemsToTransferPerService )
+                {
+                CompleteRequest( ECmFmDeleteFiles );                
+                }
+            else
+                {
+                TRACE(Print(_L("[FILL MNGR]\t No needed server available")));
+                TRACE(Print(_L("[FILL MNGR]\t Or no items to be transfered.")));
+                TInt errorCode( KErrNone );
+                if( 0 != iProgressInfo.iItemsToTransferPerService )
+                    {
+                    errorCode = KErrNotFound;
+                    }
+                iObserver->ServiceExecuted( iService , errorCode );
+                ResetItems();
+                }                
+            }                
+        }     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::HandleIfDeleteFilesL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::HandleIfDeleteFilesL()
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::ECmFmDeleteFiles, iIndex = %d"),
+                iIndex ));
+    ResetDeleteQueue();
+    AddFilesToDeleteQueueL();
+    if( KErrNone != iArray->Count() )
+        {
+        iMemManager->SetObserver( *this );
+        iMemManager->DeleteFilesL( *iArray );
+        }
+    else
+        {
+        iCmFmDuplicateDetector->ResetArray();
+        CompleteRequest( ECmFmCheckItem );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::CompleteRequest
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::CompleteRequest(
+    TCmFmStatus aStatus )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::CompleteRequest()"));
+    
+    __ASSERT_DEBUG(!IsActive(),\
+        User::Panic( KCmFmFillManager, KErrInUse ));
+    SetActive();
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ProceedWithNextItem
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::ProceedWithNextItem( TCmFmStatus aStatus )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ProceedWithNextItem()"));
+    
+    __ASSERT_DEBUG(!IsActive(),\
+        User::Panic( KCmFmFillManager, KErrInUse ));
+    iIndex++;        
+    SetActive();
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, aStatus );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmMain::DoUriCheckL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::DoUriCheckL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::DoUriCheckL()"));
+    
+    ResetItemInfo();
+    TInt ret( KErrNone );
+    if( iIndex < iItems.Count() )
+        {
+        ret = iCmFmFillRuleFilledDataMngr->GetUuidL( iUuid,
+            iItems[iIndex]->DevId() );
+        }
+    else
+        {
+        ret = KErrNotFound;
+        }
+    // Check if file fits to mmc
+    iDriveIndex = iCmFmFillDriveMngr->CheckFreeDiscSpace(
+        iItems[iIndex]->Size(), iDriveId, iDriveNumber );
+    iItems[iIndex]->SetDriveNumber( iDriveNumber );
+    iItems[iIndex]->SetDriveId( iDriveId );
+    if( ( KErrNone == ret ) && 
+        ( KErrNone < iDevices->Count() ) && iDriveNumber != -1 )
+        {
+        TBool found(EFalse);
+        TInt index(0);
+        for( TInt i = 0; i < iDevices->Count() && !found &&
+            iUuid ; i++ )
+            {
+            if( KErrNotFound !=  (((*iDevices)[i]->Uuid()).Match(*iUuid) ) )
+                {
+                found = ETrue;
+                index = i;
+                TRACE(Print(_L("[FILL MNGR]\t device found= %d"), index ));
+                }
+            }
+        if( found )
+            {
+            TRAPD( error, iCmFmUpnpMngr->CheckURIL( (*iDevices)[index], 
+                *iItems[ iIndex ]) );
+            if( error )
+                {
+                TRACE(Print(_L("[FILL MNGR]\t Uri check failed...")));
+                ProceedWithNextItem( ECmFmCheckItem );
+                }
+            }
+        else
+            {
+            // Jump to next item
+            TRACE(Print(_L("[FILL MNGR]\t Device not found")));
+            ProceedWithNextItem( ECmFmCheckItem );
+            }
+        }
+    else if( KErrNotFound  == ret )
+        {
+        // Jump to next item
+        TRACE(Print(_L("[FILL MNGR]\t Media server not in db")));
+        ProceedWithNextItem( ECmFmCheckItem );
+        }
+    else if( iDriveNumber == -1 && KErrNone < iToBeDeleted.Count() )
+        {
+        // Jump to next item
+        TRACE(Print(_L("[FILL MNGR]\t FILE TOO BIG OR NO DRIVES SELECTED")));
+        ProceedWithNextItem( ECmFmCheckItem );
+        }
+    else
+        {
+        ProceedWithNextItem( ECmFmCheckItem );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ParseFullPathL
+// ---------------------------------------------------------------------------
+//
+TInt CCmFmMain::ParseFullPathL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ParseFullPathL()"));
+    
+    iFullPath.Zero();
+    TInt ret( KErrNone );
+    if( iIndex < iItems.Count() )
+        {
+        HBufC* temp = ResolveAndAppendRootPathL( iDriveNumber );
+        CleanupStack::PushL( temp );
+        
+        iFullPath.Append( *temp );
+        
+        CleanupStack::PopAndDestroy( temp );
+        
+        if( ECmAudio == iItems[iIndex]->MediaType() )
+            {
+            iFullPath.Append( PathInfo::SoundsPath() );
+            }
+        else if( ECmVideo == iItems[iIndex]->MediaType() )
+            {
+            iFullPath.Append( PathInfo::VideosPath() );
+            }
+        else if( ECmImage == iItems[iIndex]->MediaType() )
+            {
+            iFullPath.Append( PathInfo::ImagesPath() );
+            }
+        else
+            {
+            // Not supported upnp class use OthersPath
+            iFullPath.Append( PathInfo::OthersPath() );
+            }
+        ret = ParseFileNameL();
+        }
+    else
+        {
+        ret = KErrNotFound;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ParseFileNameL
+// ---------------------------------------------------------------------------
+//
+TInt CCmFmMain::ParseFileNameL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ParseFileNameL()"));
+    
+    TInt index(0);
+    TInt ret( KErrNone );
+    if( KErrNone != iItems[iIndex]->Uri().Length() )
+        {
+		const TChar slash( '/' );
+        index = iItems[iIndex]->Uri().LocateReverse( slash );
+        if( KErrNotFound < index && KErrNone !=
+            iItems[iIndex]->PrimaryText().Length() )
+            {
+            HBufC* data16bitBuf = RemoveIllegalFilenameCharactersL(
+                iItems[iIndex]->PrimaryText() );
+            TBuf<KExtensionLength>fileExtension;
+            fileExtension.Zero();
+            TInt conversionError = CnvUtfConverter::
+                ConvertToUnicodeFromUtf8(fileExtension,
+                    iItems[iIndex]->Uri().Mid(
+                    (iItems[iIndex]->Uri().Length() -
+                    KExtensionLength), KExtensionLength) );
+
+            if( conversionError )
+                {
+                ret = KErrGeneral;
+                }
+            else if ( ( iFullPath.Length() +
+                    data16bitBuf->Length() + fileExtension.Length() ) <
+                    KMaxFileName )
+                {
+                iFullPath.Append(*data16bitBuf);
+                iFullPath.Append(fileExtension);
+                iItems[iIndex]->SetPathL(
+                    iFullPath.Mid( KCmFmLengthOfRoot ) );
+                iItems[iIndex]->SetDriveNumber( iDriveNumber );
+                iItems[iIndex]->SetDriveId( iDriveId );
+                iFullPath.Zero();     
+                }
+            else
+                {
+                iFullPath.Append( data16bitBuf->Left(
+                	KMaxFileName - iFullPath.Length() -
+                	fileExtension.Length() - KExtraSpace ) );
+
+                iFullPath.Append(fileExtension);
+                iItems[iIndex]->SetPathL(
+                    iFullPath.Mid( KCmFmLengthOfRoot ) );
+                iItems[iIndex]->SetDriveNumber( iDriveNumber );
+                iItems[iIndex]->SetDriveId( iDriveId );
+                iFullPath.Zero();    
+                }
+            delete data16bitBuf;
+            data16bitBuf = NULL;
+            }
+        }
+    else
+        {
+        LOG(_L("[FILL MNGR]\t File name parsing, compose failed)"));
+        ret = KErrGeneral;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::SetUriL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::SetUriL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::SetUriL()"));
+    
+    if( iIndex < iItems.Count() )
+        {
+        iItems[iIndex]->SetUriL( iCmFmUpnpMngr->Uri() );
+        }
+    LOG(_L("[FILL MNGR]\t SetUriL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::LogServers
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::LogServers()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::LogServers()"));
+    
+    for( TInt i = 0; i < iDevices->Count(); i++ )
+        {
+        TBuf<KMaxName>temp;
+        if((*iDevices)[i])
+            {
+            if( &(*iDevices)[i]->Uuid())
+                {
+                if( (*iDevices)[i]->Uuid().Length() < KMaxName )
+                    {
+                    temp.Copy( (*iDevices)[i]->Uuid() );
+                    TRACE(Print(_L("[FILL MNGR]\t FOUND DEVICE %d = %S"),
+                        i+1, &temp ));
+                    }
+                temp.Zero();
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ResetItemInfo
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::ResetItemInfo()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ResetItemInfo()"));
+    
+    if( iUuid )
+        {
+        delete iUuid;
+        iUuid = NULL;
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::SendProgressInfo
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::SendProgressInfo( TInt aProgress )
+    {
+    if ( iProgressInfo.iTotalItems > iProgressInfo.iProcessedItems )
+        {
+        iProgressInfo.iProcessedItems += aProgress;
+        iProgressInfo.iItemsToTransferPerService -= aProgress;
+        TCmProgressInfoPckg progressPckg( iProgressInfo );
+        TRACE( Print( _L("[FILL MNGR]\t processed: %d total %d"),
+                iProgressInfo.iProcessedItems, iProgressInfo.iTotalItems) );
+       
+        if ( ( iProgressInfo.iTotalItems <= iProgressInfo.iProcessedItems ) ||
+             ( iProgressInfo.iTotalItems > iProgressInfo.iProcessedItems &&
+               iProgressInfo.iProcessedItems > 0 &&
+               ( iProgressInfo.iProcessedItems - iTempIndex ) >=
+               iProgressInfo.iTotalItems / KDefaultCalculateSize )
+           )
+            {
+            iTempIndex = iProgressInfo.iProcessedItems;
+            TInt err = RProperty::Set( KCmPropertyCat, KCmProperty, 
+                                  progressPckg );
+            TRACE( Print( _L("[FILL MNGR]\t RProperty::Set returned %d"), 
+                  err)); 
+            }
+        else
+            {
+            LOG(_L("[FILL MNGR]\t progress small no need to pub&sub"));
+            }
+        }
+
+    else
+        {
+        iProgressInfo.iProcessedItems += aProgress;
+        LOG(_L("[FILL MNGR]\t Bigger than 100%% or not beginning"));
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::SetStatusL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::SetStatusL( const TInt64 aInternalItemId )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::SetStatusL()"));
+    
+    if( iIndex < iItems.Count() )
+        {
+        iItems[iIndex]->SetStatus( ECmFilled );
+        TUint id(iItems[iIndex]->DbId());
+        for( TInt i = 0; i < iItems.Count(); i++ )
+            {
+            // Set all reference items also filled
+            if( aInternalItemId == iItems[i]->RefId() &&
+                iItems[i]->Selected() == ECmSelected )
+                {
+                iItems[i]->SetStatus( ECmFilled );
+                iItems[i]->SetPathL( iItems[iIndex]->Path() );
+                iItems[i]->SetDriveId( iItems[iIndex]->DriveId() );
+                iItems[i]->SetDriveNumber( iItems[iIndex]->DriveNumber() );
+                }
+            }
+        // add to duplicatied detector
+        iCmFmDuplicateDetector->AppendToArrayL( *iItems[iIndex] );
+        // Update statuses into db
+        iDbManager->UpdateFillTransferStatus( ECmFilled, iItems[iIndex] );
+        TInt count( KErrNone );
+        TInt time( KErrNone );
+        iDbManager->GetTransferInfo( ECmServiceFill, count, time );
+        
+        iDbManager->UpdateTransferInfo( ECmServiceFill,
+            iProgressInfo.iItemsToTransferPerService, time );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::RemoveIllegalFilenameCharactersL
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmFmMain::RemoveIllegalFilenameCharactersL( const TDesC& aFileName )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::RemoveIllegalFilenameCharactersL()"));
+    
+    HBufC* buf = aFileName.AllocLC();
+    TPtr ptr = buf->Des();
+    ReplaceCharsL( ptr, KCmProk(), KCmUnderScore() );        // >
+    ReplaceCharsL( ptr, KCmKorp(), KCmUnderScore() );        // <
+    ReplaceCharsL( ptr, KCmQuotation(), KCmUnderScore() );   // "
+    // \ character
+    ReplaceCharsL( ptr, KCmDoubleBackSlash(), KCmUnderScore() );
+    ReplaceCharsL( ptr, KCmSlash(), KCmUnderScore() );       // /
+    ReplaceCharsL( ptr, KCmStar(), KCmUnderScore() );        // *
+    ReplaceCharsL( ptr, KCmPipe(), KCmUnderScore() );        // |
+    ReplaceCharsL( ptr, KCmColon(), KCmUnderScore() );       // :
+    ReplaceCharsL( ptr, KCmQuestionMark(), KCmUnderScore() );// question mark
+    CleanupStack::Pop(); // Can't pop by name, name invalid now
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ReplaceCharsL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::ReplaceCharsL( TDes& aString, const TDesC& aTrg,
+        const TDesC& aReplacement )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ReplaceCharsL()"));
+    
+    __ASSERT_DEBUG( aTrg != aReplacement, User::Panic( _L( "CmFm" ), 1) );
+    TPtrC ptr( aString );
+    TInt position( 0 );
+
+    TBool continueLoop = ETrue;
+    while ( continueLoop )
+        {
+        TInt found = ptr.Find( aTrg );
+        if( found < 0 )
+            {
+            continueLoop = EFalse;
+            }
+        else 
+            {
+            aString.Replace( position + found, aTrg.Length(), aReplacement );
+            if( position + found + aReplacement.Length() < aString.Length() )
+                {
+                position += found + aReplacement.Length();
+                ptr.Set( aString.Mid( position ) );
+                }
+            else
+                {
+                continueLoop = EFalse;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::LoadDrivesL()
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::LoadDrivesL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::LoadDrivesL()"));
+    
+    iDrives.ResetAndDestroy();
+    iDbManager->PrepareQueryCmdL( EDrivesQuery );
+    iDbManager->QueryDrivesL( iDrives );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::UpdateDrives()
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::UpdateDrives()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::UpdateDrives()"));
+    if ( 0 != iDrives.Count() )
+        {
+        #ifdef _DEBUG
+            TRAPD( err, iDbManager->SetDrivesL( iDrives ) );
+            TRACE(Print(_L("[FILL MNGR]\t drives update err = %d"),
+                 err ));
+        #else // _DEBUG
+            TRAP_IGNORE( iDbManager->SetDrivesL( iDrives ) );
+        #endif // _DEBUG
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ResolveAndAppendRootPath()
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmFmMain::ResolveAndAppendRootPathL( const TInt aDriveNumber )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ResolveAndAppendRootPathL()"));
+    
+    HBufC* buf = HBufC::NewLC( KExtensionLength );
+    TChar driveChar;
+    iFsSession.DriveToChar( aDriveNumber, driveChar );
+    buf->Des().Append( driveChar );
+    buf->Des().Append( KCmColon );
+    buf->Des().Append( KCmDoubleBackSlash );
+    CleanupStack::Pop();
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::UpdateDriveQuota()
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::UpdateDriveQuota( const TInt aDriveNumber,
+    const TInt64 aQuota )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::UpdateDriveQuota()"));
+    
+    for( TInt i = 0 ; i < iDrives.Count(); i++ )
+        {
+        if( iDrives[i]->DriveNumber() == aDriveNumber )
+            {
+            iDrives[i]->SetUsedDriveQuota( aQuota );
+            i =  iDrives.Count();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::InitializeDriveQuotasL()
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::InitializeDriveQuotasL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::InitializeDriveQuotasL()"));
+    
+    LoadDrivesL();
+    for( TInt i = 0 ; i < iDrives.Count(); i++ )
+        {
+        iDrives[i]->SetUsedDriveQuota( 0 );
+        }
+    iDrives.ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::GetUsedQuota()
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmFmMain::GetUsedQuota( const TInt aDriveNumber )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::GetUsedQuota()"));
+    
+    TInt64 quota( 0 );
+    for( TInt i = 0; i < iDrives.Count(); i++ )
+        {
+        if( iDrives[i]->DriveNumber() == aDriveNumber )
+            {
+            quota = iDrives[i]->UsedDriveQuota();
+            }
+        }
+    return quota;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmFmMain::CreateRFile()
+// -----------------------------------------------------------------------------
+// 
+TInt CCmFmMain::CreateRFile( const TDesC& aFilePath )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::CreateRFile()"));
+    
+    iFile.Close();
+    TRACE(Print(_L("[FILL MNGR]\t Creating file : %S"), &aFilePath ));
+    TInt error(iFile.Create( iFsSession, aFilePath, EFileWrite ));
+    if( KErrAlreadyExists == error )
+        {
+        TRACE(Print(_L("[FILL MNGR]\t Allready exists => delete old file") ));
+        error = iFsSession.Delete( aFilePath );
+        error = iFile.Create( iFsSession, aFilePath, EFileWrite );
+        }
+    TRACE(Print(_L("[FILL MNGR]\t CreateRFile err: %d"), error ));
+    return error; 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::PrivatePathL
+// ---------------------------------------------------------------------------
+//   
+void CCmFmMain::PrivatePathL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::PrivatePathL()"));
+    
+    iFullPath.Zero();
+    HBufC* temp = ResolveAndAppendRootPathL( iItems[ iIndex ]->DriveNumber() );
+    CleanupStack::PushL( temp );
+    iFullPath.Append( *temp );
+    CleanupStack::PopAndDestroy( temp );
+    
+    TFileName privatePath;
+    TInt err = iFsSession.PrivatePath( privatePath );
+    if ( !err )
+        {
+        iFullPath.Append( privatePath.Mid( 1 ) );
+        
+        // Now the path contains everything but filename and extension
+        // => check that the directory exists. If not, it will be created.
+        // Possible error is ignored at the moment 
+        // (normal case is KErrAlreadyExists)
+        err = iFsSession.MkDirAll( iFullPath );
+        
+        iFullPath.Append( KCmFmTempFile() );
+        }
+    LOG(_L("[FILL MNGR]\t CCmFmMain::PrivatePath() end"));        
+    }  
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ReplaceFileL
+// ---------------------------------------------------------------------------
+//  
+void CCmFmMain::ReplaceFileL( const TDesC& aOriginal )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ReplaceFileL()"));
+    
+    HBufC* temp = ResolveAndAppendRootPathL(
+                            iItems[ iIndex ]->DriveNumber() );
+//    CleanupStack::PushL( temp );                            
+    temp = temp->ReAllocL( temp->Length() + aOriginal.Length() );
+    temp->Des().Append( aOriginal );
+    
+    TInt error = iFsSession.Replace( iFullPath, *temp );
+    if( error == KErrPathNotFound )
+        {
+        error = iFsSession.MkDirAll( *temp );
+        TRACE(Print(_L("[FILL MNGR]\t MkDir err: %d"), error ));
+        
+        error = iFsSession.Replace( iFullPath, *temp );
+        TRACE(Print(_L("[FILL MNGR]\t MkDir err: %d"), error ));
+        }
+    iFullPath.Copy( *temp );
+    delete temp;
+//    CleanupStack::PopAndDestroy( temp );
+    
+    TRACE(Print(_L("[FILL MNGR]\t File Replace done err: %d"), error ));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::CheckServerIndex
+// ---------------------------------------------------------------------------
+// 
+TInt CCmFmMain::CheckServerIndex( const TDesC8& aUuid, 
+    const CUpnpAVDeviceList& aList )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::CheckServerIndex()"));
+    
+    TInt index( KErrNotFound ); 
+    for( TInt i = 0; i < aList.Count(); i++ )
+        {
+        if( KErrNotFound != aList[i]->Uuid().Match( aUuid ) )
+            {
+            index = i;
+            i = aList.Count();
+            }
+        }
+    return index;        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::NeededServerAvailableL
+// ---------------------------------------------------------------------------
+// 
+TBool CCmFmMain::NeededServerAvailableL( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::NeededServerAvailableL()"));
+    
+    TBool available( EFalse );
+    TInt index( 0 );
+    for( TInt i = 0 ; i < iDevices->Count(); i++ )
+        {
+        index = 
+            iCmFmFillRuleFilledDataMngr->GetMediaServerIdL( 
+                (*iDevices)[i]->Uuid() );
+        if( index != KErrNotFound )
+            {
+            available = ETrue;
+            i = iDevices->Count();
+            LOG(_L("[FILL MNGR]\t Server available.")); 
+            }
+        }
+    return available;               
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ResetItems
+// ---------------------------------------------------------------------------
+// 
+void CCmFmMain::ResetItems()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ResetItems()"));
+    
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    iToBeDeleted.ResetAndDestroy();
+    iToBeDeleted.Close();     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::ResetDeleteQueue
+// ---------------------------------------------------------------------------
+//  
+void CCmFmMain::ResetDeleteQueue( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::ResetDeleteQueue()"));
+    
+    if( iArray )
+        {
+        iArray->Reset();
+        delete iArray;
+        iArray = NULL;
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::AddFilesToDeleteQueueL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmMain::AddFilesToDeleteQueueL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::AddFilesToDeleteQueueL()"));
+    
+    iArray = new ( ELeave ) CDesCArrayFlat( 10 );
+    HBufC* temp = NULL;
+    TFileName path;
+    TInt64 totalSize( KErrNone );
+    TBool drivechange( EFalse );
+    for( TInt i = 0; i < iToBeDeleted.Count(); i++ )
+        {
+        if( KErrNone == iToBeDeleted[i]->RefId() )
+            {
+            drivechange = ETrue;
+            temp = ResolveAndAppendRootPathL(
+                iToBeDeleted[i]->DriveNumber() );
+            path.Append( *temp );
+            path.Append( iToBeDeleted[i]->Path() );
+            iArray->AppendL( path );
+            delete temp;
+            path.Zero();
+            
+            totalSize = GetUsedQuota(
+                        iToBeDeleted[i]->DriveNumber() );
+            totalSize -= iToBeDeleted[i]->Size();
+            UpdateDriveQuota( iToBeDeleted[i]->DriveNumber(),
+                              totalSize );
+            }
+        }
+    
+    if( drivechange )
+        {
+        UpdateDrives();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::StopItemCheck
+// ---------------------------------------------------------------------------
+//
+void CCmFmMain::StopItemCheck()
+    {
+    if( KErrNone < iItems.Count() )
+    	{
+    	iCmFmFillRuleFilledDataMngr->UpdateFillItems();
+    	}
+    if( KErrNone < iToBeDeleted.Count() )
+    	{
+    	iCmFmFillRuleFilledDataMngr->UpdateToBeDeleted(
+    			iToBeDeleted );
+    	}
+    iCmFmDownloadProxy->CancelOperation();
+    iFullPath.Zero();
+    if( iDevices )
+    	{
+    	iDevices->ResetAndDestroy();
+    	}
+    delete iDevices;
+    iDevices = NULL;
+    UpdateDrives();
+    iDrives.ResetAndDestroy();
+    iToBeDeleted.ResetAndDestroy();
+    ResetDeleteQueue();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMain::Close
+// ---------------------------------------------------------------------------
+//    
+void CCmFmMain::Close()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMain::Close()"));
+    
+    delete this;
+    }
+
+// ---------------------------------------------------------------------------
+// CompareById
+// For sort. Sort is based on db id
+// ---------------------------------------------------------------------------
+// 
+TInt CCmFmMain::CompareById( const CCmFillListItem& aItem1,
+                             const CCmFillListItem& aItem2 )
+    {
+    TInt result = 0;
+
+    if ( aItem1.DbId() < aItem2.DbId() )
+        {
+        result = -1;
+        }
+    else if ( aItem1.DbId() > aItem2.DbId() )
+        {
+        result = 1;
+        }
+
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CompareBySize
+// For sort. Sort is based on item size
+// ---------------------------------------------------------------------------
+//
+TInt CCmFmMain::CompareBySize( const CCmFillListItem& aItem1,
+                                               const CCmFillListItem& aItem2 )
+    {
+    TInt result = 0;
+
+    if ( aItem1.Size() < aItem2.Size() )
+        {
+        result = -1;
+        }
+    else if ( aItem1.Size() > aItem2.Size() )
+        {
+        result = 1;
+        }
+
+    return result;
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmdeduplicatedetector.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,322 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dublicate detector for images and videos
+*
+*/
+
+#include <mdelogiccondition.h>
+#include <mdesession.h>
+#include <mdccommon.h>
+#include <mdeconstants.h>
+
+#include "cmfilllistitem.h"
+#include "cmfmitemhandlerobserver.h"
+#include "cmfmmdeduplicatedetector.h"
+#include "cmfmmpxduplicatedetector.h"
+#include "cmfmmain.h"
+#include "msdebug.h"    
+
+    
+
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmFmMdEDuplicateDetector* CCmFmMdEDuplicateDetector::NewL( 
+    MCmFmItemHandlerObserver& aObserver, CMdESession& aSession )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::NewL() start"));    
+    CCmFmMdEDuplicateDetector* self = 
+        CCmFmMdEDuplicateDetector::NewLC( aObserver, aSession );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmFmMdEDuplicateDetector* CCmFmMdEDuplicateDetector::NewLC( 
+    MCmFmItemHandlerObserver& aObserver, CMdESession& aSession )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::NewLC() start"));    
+    CCmFmMdEDuplicateDetector* self = 
+        new ( ELeave ) CCmFmMdEDuplicateDetector( aObserver, aSession );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::~CCmFmMdEDuplicateDetector
+// ---------------------------------------------------------------------------
+// 
+CCmFmMdEDuplicateDetector::~CCmFmMdEDuplicateDetector()
+    {
+    LOG(_L("[FILL MNGR]\t ~CCmFmMdEDuplicateDetector()"));
+    delete iTitle;
+    delete iDate;
+    delete iSize;
+    
+    delete iQuery;
+    delete iMediaTypeDef;
+    delete iObjectDef;
+    delete iNamespace;
+    delete iCheckItem;
+    iExistFiles.ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::CCmFmMdEDuplicateDetector
+// ---------------------------------------------------------------------------
+// 
+CCmFmMdEDuplicateDetector::CCmFmMdEDuplicateDetector( 
+    MCmFmItemHandlerObserver& aObserver, CMdESession& aSession )
+    : iObserver( aObserver ), iSession( aSession )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::\
+    CCmFmMdEDuplicateDetector"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::ConstructL
+// ---------------------------------------------------------------------------
+//     
+void CCmFmMdEDuplicateDetector::ConstructL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::ConstructL"));
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::CheckImageOrVideoL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMdEDuplicateDetector::CheckImageOrVideoL( 
+    const CCmFillListItem& aItem )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::CheckImageOrVideoL"));
+    TCmMediaType theType = aItem.MediaType();
+    if( iExistFiles.Count() > 0 && iCurrentMediaType == theType )
+        {
+        CheckImageOrVideoLIfDuplicated( aItem );
+        }
+    else
+        {
+        delete iCheckItem;
+        iCheckItem = NULL;
+        iCheckItem = CCmFillListItem::NewL();
+        iCheckItem->SetPrimaryTextL( aItem.PrimaryText() );
+        iCheckItem->SetSize( aItem.Size() );
+        iCheckItem->SetDate( aItem.Date() );
+        delete iQuery;
+        iQuery = NULL;
+        
+        if( !iNamespace )
+            {
+            iNamespace = &iSession.GetDefaultNamespaceDefL();
+            }
+        if( iNamespace )
+            {
+            iObjectDef = 
+               &iNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
+            }
+        
+        iCurrentMediaType = theType;
+        if( ECmImage == theType || ECmOtherImage == theType )
+            {
+            TRACE(Print(_L("ECmImage == aType")));
+            iMediaTypeDef = 
+               &iNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
+            }
+        else if( ECmVideo == theType || ECmOtherVideo == theType )
+            {
+            TRACE(Print(_L("ECmVideo == aType")));
+            iMediaTypeDef = 
+               &iNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
+            }
+        else
+            {
+            User::Leave( KErrArgument );
+            }        
+        if( !iObjectDef || !iMediaTypeDef )
+            {
+            User::Leave( KErrArgument );
+            }
+    
+        iQuery = iSession.NewObjectQueryL( 
+                *iNamespace, *iMediaTypeDef, this );
+        if( !iQuery )
+            {
+            User::Leave( KErrArgument );
+            }
+        SetLogicConditionL( aItem );    
+        //iQuery->SetResultMode( EQueryResultModeId );
+        iQuery->SetResultMode( EQueryResultModeItem );
+        /** Start query, no need to query more than one item */ 
+        iQuery->FindL();
+        }
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::HandleQueryNewResults
+// ---------------------------------------------------------------------------
+// 
+void CCmFmMdEDuplicateDetector::HandleQueryNewResults(CMdEQuery& aQuery,
+                                       TInt aFirstNewItemIndex,
+                                       TInt aNewItemCount)
+    {
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::\
+    HandleQueryNewResultsaNewItemCount %d"), aNewItemCount ));
+    CMdEObjectQuery& query = (CMdEObjectQuery &) aQuery;
+    iExistFiles.Reset();
+    TRACE(Print(_L("[FILL MNGR]\t aNewItemCount %d"), aNewItemCount ));
+    if( &query ) 
+        {
+        for ( TInt i = aFirstNewItemIndex; 
+              i < aFirstNewItemIndex+aNewItemCount; 
+              i++ )
+            {
+            CCmFillListItem *itm = CCmFillListItem::NewLC();
+            CMdEObject* object = (CMdEObject*)query.TakeOwnershipOfResult(i);
+            CMdEProperty* prop;
+            TInt propIndex = object->Property( *iTitle, prop );
+            if( propIndex != KErrNotFound )
+                {
+                CMdETextProperty* textprop = (CMdETextProperty*) prop;
+                itm->SetPrimaryTextL( textprop->Value() );
+                }
+            else
+                {
+                TParsePtrC parser( object->Uri());
+                itm->SetPrimaryTextL( parser.Name() );
+                }
+            
+            propIndex = object->Property( *iSize, prop );
+            if( propIndex != KErrNotFound )
+                {
+                itm->SetSize( prop->Uint32ValueL() );
+                }
+            iExistFiles.AppendL( itm );
+            TRACE(Print(_L("[FILL MNGR]\t HandleQueryNewResults [%S][%d]"),
+                            &itm->PrimaryText(), itm->Size() ));
+            CleanupStack::Pop( itm );
+            }
+        
+        // sort by size
+        TLinearOrder<CCmFillListItem> key( CCmFmMain::CompareBySize );
+        iExistFiles.Sort( key );
+        }
+    }
+          
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::HandleQueryCompleted
+// ---------------------------------------------------------------------------
+// 
+#ifdef _DEBUG
+void CCmFmMdEDuplicateDetector::HandleQueryCompleted( CMdEQuery& /*aQuery*/, 
+                                        TInt aError )
+#else
+void CCmFmMdEDuplicateDetector::HandleQueryCompleted( CMdEQuery& /*aQuery*/, 
+                                        TInt /*aError*/ )
+#endif                                        
+    {
+    TRACE(Print(_L("[FILL MNGR]\t HandleQueryCompleted error = %d"), 
+        aError ));
+    if( iCheckItem )
+        {
+        CheckImageOrVideoLIfDuplicated( *iCheckItem );
+        }
+    }          
+
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::SetLogicConditionL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmMdEDuplicateDetector::SetLogicConditionL( 
+    const CCmFillListItem& /*aItem*/ )
+    {
+    LOG(_L("[FILL MNGR]\t SetLogicConditionL"));
+    CMdELogicCondition& rootCondition = iQuery->Conditions();
+    CMdELogicCondition* contentCondition = &rootCondition;
+    CMdELogicCondition& logicCondition = 
+        contentCondition->AddLogicConditionL( ELogicConditionOperatorOr );
+    logicCondition.AddObjectConditionL( *iMediaTypeDef );
+   
+    iTitle = &iMediaTypeDef->GetPropertyDefL( 
+            MdeConstants::Object::KTitleProperty );
+    iSize = &iMediaTypeDef->GetPropertyDefL( 
+            MdeConstants::Object::KSizeProperty );
+    iDate = &iMediaTypeDef->GetPropertyDefL(  
+            MdeConstants::Object::KCreationDateProperty );
+    iQuery->AddPropertyFilterL( iTitle );      
+    iQuery->AddPropertyFilterL( iSize );      
+    iQuery->AddPropertyFilterL( iDate );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::CheckImageOrVideoLIfDuplicated
+// ---------------------------------------------------------------------------
+// 
+void CCmFmMdEDuplicateDetector::CheckImageOrVideoLIfDuplicated( 
+        const CCmFillListItem& aItem )
+    {
+    TInt count( iExistFiles.Count() );
+    TBool dup( EFalse );
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iExistFiles[i]->Size() > aItem.Size() )
+            {
+            //quit loop
+            i = count;
+            }
+        else if( iExistFiles[i]->Size() == aItem.Size() && KErrNone == 
+            iExistFiles[i]->PrimaryText().CompareF( aItem.PrimaryText() ) )
+            {
+            //quit loop
+            i = count;
+            dup = ETrue;
+            }
+        }
+    iObserver.DuplicateL( dup );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::AppendToArray
+// ---------------------------------------------------------------------------
+// 
+void CCmFmMdEDuplicateDetector::AppendToArrayL( const CCmFillListItem& aItem )
+    {
+    CCmFillListItem* p = CCmFillListItem::NewLC();
+    p->SetPrimaryTextL( aItem.PrimaryText() );
+    p->SetSize( aItem.Size() );
+    iExistFiles.AppendL( p );
+    CleanupStack::Pop( p );
+    
+    // sort by size
+    TLinearOrder<CCmFillListItem> key( CCmFmMain::CompareBySize );
+    iExistFiles.Sort( key );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMdEDuplicateDetector::ResetArrayL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmMdEDuplicateDetector::ResetArray()
+    {
+    iExistFiles.Reset();
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmpxduplicatedetector.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dublicate detector for music
+*
+*/
+
+#include <mpxcollectionutility.h>
+#include <mpxmediageneraldefs.h> // commonly used attribute keys
+#include <mpxmediacontainerdefs.h> // container-specific attribute keys
+#include <mpxcollectionplugin.hrh> // collection plugin types
+#include "cmfilllistitem.h"
+#include "cmfmitemhandlerobserver.h"
+#include "cmfmmpxduplicatedetector.h"
+#include "msdebug.h"    
+
+const TUid KMpxLocalCollectionUid = { 0x101FFC3A };
+const TUid KCmServerUid = { 0x10281FA7 };
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmFmMpxDuplicateDetector* CCmFmMpxDuplicateDetector::NewL( 
+    MCmFmItemHandlerObserver& aObserver )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::NewL() start"));    
+    CCmFmMpxDuplicateDetector* self = 
+        CCmFmMpxDuplicateDetector::NewLC( aObserver );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmFmMpxDuplicateDetector* CCmFmMpxDuplicateDetector::NewLC( 
+    MCmFmItemHandlerObserver& aObserver )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::NewLC() start"));    
+    CCmFmMpxDuplicateDetector* self = 
+        new ( ELeave ) CCmFmMpxDuplicateDetector( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::~CCmFmMpxDuplicateDetector
+// ---------------------------------------------------------------------------
+// 
+CCmFmMpxDuplicateDetector::~CCmFmMpxDuplicateDetector()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\
+    ~CCmFmMpxDuplicateDetector()"));
+    CloseCollectionPlugin();         
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::CCmFmMpxDuplicateDetector
+// ---------------------------------------------------------------------------
+// 
+CCmFmMpxDuplicateDetector::CCmFmMpxDuplicateDetector( 
+    MCmFmItemHandlerObserver& aObserver )
+    : iObserver( aObserver )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\
+    CCmFmMpxDuplicateDetector()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::ConstructL
+// ---------------------------------------------------------------------------
+//     
+void CCmFmMpxDuplicateDetector::ConstructL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::ConstructL()"));
+
+    OpenCollectionPluginL(); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::CheckMusicL
+// ---------------------------------------------------------------------------
+//    
+void CCmFmMpxDuplicateDetector::CheckMusicL( const CCmFillListItem& aItem )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::CheckMusicL()"));
+    
+    CMPXMedia* criteria = CMPXMedia::NewL();
+    CleanupStack::PushL( criteria );
+    criteria->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    criteria->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXItem );
+
+    criteria->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, EMPXSong );
+    
+    // Set title, size and date to criteria
+    criteria->SetTextValueL( 
+                KMPXMediaGeneralTitle, aItem.PrimaryText() );
+                
+    criteria->SetTObjectValueL<TInt32>(
+                KMPXMediaGeneralSize, aItem.Size() );
+                
+    criteria->SetTObjectValueL<TInt64>(
+                KMPXMediaGeneralDate, aItem.Date().Int64() );
+
+    // define attributes fetched
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL( attributes );
+    // add a dummy attribute because the query will fail if
+    // there are no attributes
+    attributes.AppendL( KMPXMediaGeneralId );
+
+    // now find
+    iCollectionUtility->Collection()
+        .FindAllL( *criteria , attributes.Array(), *this );
+    CleanupStack::PopAndDestroy(); // attributes
+    CleanupStack::PopAndDestroy( criteria );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::OpenCollectionPluginL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmMpxDuplicateDetector::OpenCollectionPluginL( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\
+    OpenCollectionPluginL()"));
+    
+    iCollectionUtility = MMPXCollectionUtility::NewL(
+        (MMPXCollectionObserver*)this, KCmServerUid );
+    // Fetch mpx/gallery collection collection UID
+    RArray<TUid> uid;
+    CleanupClosePushL( uid );
+    uid.AppendL( TUid::Uid( EMPXCollectionPluginMusic ) );
+    TInt err = KErrNone;
+    TUid collection = iCollectionUtility->CollectionIDL( uid.Array() );
+    TRAP( err,iCollectionUtility->Collection().CommandL(
+        EMcCmdCollectionInit,  collection.iUid ) );        
+    CleanupStack::PopAndDestroy( &uid );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::CloseCollectionPlugin
+// ---------------------------------------------------------------------------
+//
+void CCmFmMpxDuplicateDetector::CloseCollectionPlugin()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\
+    CloseCollectionPlugin()"));
+    
+    if( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        iCollectionUtility = NULL;        
+        }    
+    }      
+
+// --------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::HandleCollectionMessage
+// --------------------------------------------------------------------------
+// 
+void CCmFmMpxDuplicateDetector::HandleCollectionMessage( CMPXMessage* /*aMsg*/,
+    TInt /*aErr*/ )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\
+    HandleCollectionMessage()"));    
+    }
+
+// --------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::HandleCollectionMediaL
+// --------------------------------------------------------------------------
+// 
+void CCmFmMpxDuplicateDetector::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/,
+    TInt /*aError*/ )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\
+    HandleCollectionMediaL()"));    
+    }
+
+// --------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::HandleOpenL
+// --------------------------------------------------------------------------
+// 
+void CCmFmMpxDuplicateDetector::HandleOpenL( const CMPXMedia& /*aEntries*/,
+    TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::HandleOpenL()"));    
+    }
+
+// --------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::HandleOpenL
+// --------------------------------------------------------------------------
+// 
+void CCmFmMpxDuplicateDetector::HandleOpenL( 
+    const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::HandleOpenL()"));
+    }
+
+// --------------------------------------------------------------------------
+// CCmFmMpxDuplicateDetector::HandleFindAllL
+// Async find
+// --------------------------------------------------------------------------
+// 
+void CCmFmMpxDuplicateDetector::HandleFindAllL( const CMPXMedia& aResults,
+    TBool /*aComplete*/, TInt /*aError*/ )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::HandleFindAllL()"));    
+    
+    if( &aResults )
+        {
+        if( !aResults.Value<CMPXMediaArray>( 
+            KMPXMediaArrayContents )->Count() )
+            {
+            // No results => Not duplicate
+            iObserver.DuplicateL( EFalse );
+            }
+        else
+            {
+            iObserver.DuplicateL( ETrue );
+            }                                
+        }
+    }
+    
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmpxnotifier.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,252 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Notifies mpx
+*
+*/
+
+
+class MMPXCollection;
+
+#include <mpxcollectionmediator.h>
+#include <mpxharvesterutility.h>
+#include <mpxcollectionutility.h>
+#include <mpxmediageneraldefs.h> // for KMPXMediaGeneralCollectionId
+#include <mpxmediamusicdefs.h> // music-specific attribute keys
+#include <upnpitem.h> // s60 upnp stack
+#include <escapeutils.h> // for unicode conversion
+#include "upnpitemutility.h" // for FindElementByName & ResourceFromItemL
+#include "upnpconstantdefs.h" // for element names
+#include "cmfmmpxnotifier.h"
+#include "msdebug.h"    
+
+// CONSTANTS
+const TUid KMpxLocalCollectionUid = { 0x101FFC3A };
+const TUid KCmServerUid = { 0x10281FA7 };
+
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxNotifier::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmFmMpxNotifier* CCmFmMpxNotifier::NewL( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NewL() start"));    
+    CCmFmMpxNotifier* self = CCmFmMpxNotifier::NewLC( );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxNotifier::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmFmMpxNotifier* CCmFmMpxNotifier::NewLC( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NewLC() start"));    
+    CCmFmMpxNotifier* self = new ( ELeave ) CCmFmMpxNotifier( );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxNotifier::~CCmFmMpxNotifier
+// ---------------------------------------------------------------------------
+// 
+CCmFmMpxNotifier::~CCmFmMpxNotifier()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::~CCmFmMpxNotifier()"));
+    if( iHarvester )
+        {
+        iHarvester->Close();
+        }
+    if( iCollectionUtil )
+        {
+        iCollectionUtil->Close(); 
+        }         
+    delete iMediator;  
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxNotifier::CCmFmMpxNotifier
+// ---------------------------------------------------------------------------
+// 
+CCmFmMpxNotifier::CCmFmMpxNotifier( )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::CCmFmMpxNotifier"));    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmMpxNotifier::ConstructL
+// ---------------------------------------------------------------------------
+//     
+void CCmFmMpxNotifier::ConstructL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::ConstructL"));    
+    
+    iHarvester = CMPXHarvesterFactory::NewL();
+    iCollectionUtil = MMPXCollectionUtility::NewL( 0, KCmServerUid );
+        
+    iMediator = CMPXCollectionMediator::NewL( 
+        iCollectionUtil->Collection(), this );    
+    }  
+      
+// ---------------------------------------------------------------------------
+// CCmFmMpxNotifier::NotifyMpxL
+// ---------------------------------------------------------------------------
+//
+void CCmFmMpxNotifier::NotifyMpxL( const TDesC& aTrackPath,
+    const CUpnpItem& aTrackMetadata )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NotifyMpxL"));    
+    
+    CMPXMedia* item = CMPXMedia::NewL();
+    CleanupStack::PushL( item );
+    item->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    item->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXItem );
+    item->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXSong );
+    item->SetTextValueL(
+        KMPXMediaGeneralUri, aTrackPath );
+    // Insert metadata
+    HBufC16* buf = NULL;
+    // title
+    buf = EscapeUtils::ConvertToUnicodeFromUtf8L( aTrackMetadata.Title() );
+    CleanupStack::PushL( buf );
+    if( buf )
+        {
+        item->SetTextValueL(
+            KMPXMediaGeneralTitle, *buf );        
+        }
+    CleanupStack::PopAndDestroy( buf );
+    // artist
+    if ( ( buf = GetElementL( aTrackMetadata, KElementCreator ) ) != 0 )
+        {
+        CleanupStack::PushL( buf );
+        item->SetTextValueL(
+            KMPXMediaMusicArtist, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    else if ( ( buf = GetElementL( aTrackMetadata, KElementArtist ) ) != 0 )
+        {
+        CleanupStack::PushL( buf );
+        item->SetTextValueL(
+            KMPXMediaMusicArtist, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    // album
+    if ( ( buf = GetElementL( aTrackMetadata, KElementAlbum ) ) != 0 )
+        {
+        CleanupStack::PushL( buf );
+        item->SetTextValueL(
+            KMPXMediaMusicAlbum, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    // genre
+    if ( ( buf = GetElementL( aTrackMetadata, KElementGenre ) ) != 0 )
+        {
+        CleanupStack::PushL( buf );
+        item->SetTextValueL(
+            KMPXMediaMusicGenre, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+
+    // tracknumber
+    if ( ( buf = GetElementL( aTrackMetadata, KElementTrackNumber ) ) != 0 )
+        {
+        CleanupStack::PushL( buf );
+        TLex16 iLex(*buf);
+        TInt tracknumber(0);
+        iLex.Val(tracknumber);
+        item->SetTObjectValueL<TInt>(
+                KMPXMediaMusicAlbumTrack, tracknumber );
+        CleanupStack::PopAndDestroy( buf );
+        }
+
+
+    // year
+    const CUpnpElement* elem = UPnPItemUtility::FindElementByName(
+        aTrackMetadata, KElementDate );
+    if ( elem != 0 )
+        {
+        TTime timestamp;
+        TInt err = 
+            UPnPItemUtility::UPnPDateAsTTime( elem->Value(), timestamp );
+        if( err == KErrNone )
+            {
+            item->SetTObjectValueL<TInt64>(
+                    KMPXMediaMusicYear, timestamp.Int64() );
+            }
+        }
+        
+    // duration
+    const CUpnpElement* trackResource = 
+        &UPnPItemUtility::ResourceFromItemL( aTrackMetadata );
+     
+    if( trackResource != 0 )
+        {
+        const CUpnpAttribute* attr = UPnPItemUtility
+            ::FindAttributeByName( *trackResource, KAttributeDuration );
+
+        if ( attr != 0 )
+            {
+            TInt ms = 0;
+            UPnPItemUtility
+                ::UPnPDurationAsMilliseconds( attr->Value(), ms );
+            
+            item->SetTObjectValueL<TInt>(
+                KMPXMediaGeneralDuration, ms );
+            }
+        }
+
+    // Add to harvester
+    TRACE(Print(_L("[FILL MNGR]\t iHarvester->AddFileL ")));
+    TInt colUid = iHarvester->AddFileL( item );
+
+    // Add to collection, make sure we set the collection ID
+    item->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, TUid::Uid( colUid ) );
+
+    TRACE(Print(_L("[FILL MNGR]\t iMediator->AddItemL ")));
+    iMediator->AddItemL( item );
+
+    CleanupStack::PopAndDestroy( item );
+    TRACE(Print(_L("[FILL MNGR]\t CCmFmMpxNotifier::NotifyMpxL end")));    
+    }
+
+// --------------------------------------------------------------------------
+// CCmFmMpxNotifier::GetElementL
+// --------------------------------------------------------------------------
+//
+HBufC16* CCmFmMpxNotifier::GetElementL(
+    const CUpnpItem& aSource, const TDesC8& aSourceField ) const
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::GetElementL"));    
+    HBufC16* result = 0;
+    const CUpnpElement* elem = UPnPItemUtility::FindElementByName(
+        aSource, aSourceField );
+    if ( elem != 0 )
+        {
+        result = EscapeUtils::ConvertToUnicodeFromUtf8L( elem->Value() );
+        }
+    return result;
+    }
+        
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmupnpmngr.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,555 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AV Controller UPnP actions handler
+*
+*/
+
+
+#include "upnpavdevice.h"
+#include "upnpxmlparser.h"
+#include "upnpavcontroller.h"
+#include "upnpavbrowsingsession.h"
+#include "upnpconstantdefs.h"
+#include "upnpitem.h"
+#include <w32std.h>
+
+#include "upnpitemutility.h"
+#include "cmfilllistitem.h"
+#include "cmfmupnpactionobserver.h"
+#include "cmfmupnpmngr.h"
+#include "msdebug.h"
+
+_LIT8( KCmBrowseFilter,    "*" ); // No filter
+_LIT8( KCmSortCriteria,    "" ); // No sorting
+const TInt KStartIndex = 0; // Start from beginning
+const TInt KRequestedCount = 1; // Only one item browsed at a time
+const TInt KScreenWidth = 128;
+const TInt KScreenHeight = 128;
+_LIT8( KCmFmXMark, "x" );
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::NewL
+// ---------------------------------------------------------------------------
+//
+CCmFmUpnpMngr* CCmFmUpnpMngr::NewL( MCmFmUPnPActionObserver* aObserver )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::NewL() start"));    
+    CCmFmUpnpMngr* self = CCmFmUpnpMngr::NewLC( aObserver );
+    CleanupStack::Pop( self );
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::NewLC
+// ---------------------------------------------------------------------------
+//   
+CCmFmUpnpMngr* CCmFmUpnpMngr::NewLC( MCmFmUPnPActionObserver* aObserver )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::NewLC() start"));    
+    CCmFmUpnpMngr* self = new ( ELeave ) CCmFmUpnpMngr( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::~CCmFmUpnpMngr
+// ---------------------------------------------------------------------------
+//
+CCmFmUpnpMngr::~CCmFmUpnpMngr()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::~CCmFmUpnpMngr()"));
+    
+    CancelOperation();
+
+    delete iURI;
+    delete iParser;
+    delete iItem;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::CCmFmUpnpMngr
+// ---------------------------------------------------------------------------
+//        
+CCmFmUpnpMngr::CCmFmUpnpMngr( MCmFmUPnPActionObserver* aObserver )
+    : iObserver( aObserver ), iScreenSize( KScreenWidth, KScreenHeight )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::CCmFmUpnpMngr()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::ConstructL
+// ---------------------------------------------------------------------------
+// 
+void CCmFmUpnpMngr::ConstructL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ConstructL()"));
+    
+    iParser = CUPnPXMLParser::NewL();
+    ScreenSizeL();
+    TRACE(Print(_L("[FILL MNGR]\t Phones screen size = %d x %d"), 
+        iScreenSize.iWidth, iScreenSize.iHeight ));
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::SetAvController
+// ---------------------------------------------------------------------------
+// 
+void CCmFmUpnpMngr::SetAvController( MUPnPAVController* aAVController )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::SetAvController()"));
+    
+    if( aAVController )
+        {
+        aAVController->SetDeviceObserver( *this );
+        }    
+    iAVController = aAVController;
+    iBrowseSession = NULL;
+    delete iURI;
+    iURI = NULL;
+    delete iItem;
+    iItem = NULL;       
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::GetMediaServersL
+// ---------------------------------------------------------------------------
+//     
+void CCmFmUpnpMngr::GetMediaServersL( CUpnpAVDeviceList*& aDevices )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::GetMediaServersL()"));
+    
+    if( iAVController )
+        {
+        aDevices = iAVController->GetMediaServersL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::CheckURIL
+// ---------------------------------------------------------------------------
+//     
+void CCmFmUpnpMngr::CheckURIL( CUpnpAVDevice* aDevice,
+                               CCmFillListItem& aItem )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::CheckURIL()"));
+    if( iAVController )
+        {
+        iSelectOptimalImageSize = EFalse;
+        if( aItem.Status() == ECmToBeShrinked )
+            {
+            iSelectOptimalImageSize = ETrue;
+            }
+			
+	    if( !iBrowseSession )
+			{
+            // session not found -> create
+            iBrowseSession =
+                &iAVController->StartBrowsingSessionL( *aDevice );
+            iBrowseSession->SetObserver( *this );   
+			iDevice = aDevice;
+			}	
+        else if( ( aDevice != iDevice ) ||
+	        ( aDevice->Uuid() != iDevice->Uuid() ) )
+			{
+            // device is different than previosly or pointer to it
+            // has been changed -> create new session
+			CancelOperation();           
+			iBrowseSession =
+				&iAVController->StartBrowsingSessionL( *aDevice );
+			iBrowseSession->SetObserver( *this );  
+			iDevice = aDevice;    
+			}
+		
+        iBrowseSession->BrowseL( aItem.ItemId(), KCmBrowseFilter, 
+            MUPnPAVBrowsingSession::EMetadata, KStartIndex, 
+            KRequestedCount, KCmSortCriteria );
+        iBrowseStarted.HomeTime();
+        TRACE(Print(_L("[FILL MNGR]\t BROWSE STARTED")));
+#ifdef _DEBUG
+        TBuf<KMaxName> temp;
+        if( aDevice->Uuid().Length() < KMaxName )
+            {
+            temp.Copy( aDevice->Uuid() );
+            TRACE(Print(_L("[FILL MNGR]\t TARGET DEVICE %S"), &temp ));
+            }
+        temp.Zero();
+        if( aItem.ItemId().Length() < KMaxName )
+            {
+            temp.Copy( aItem.ItemId() );
+            TRACE(Print(_L("[FILL MNGR]\t TARGET ITEM %S"), &temp ));        
+            }
+        temp.Zero();       
+#endif         
+        }
+    else
+        {
+        TRACE(Print(_L("[FILL MNGR]\t iAVController == NULL"))); 
+        iObserver->URICheckResult( ENoUriAvailable );
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::CancelOperation
+// ---------------------------------------------------------------------------
+//     
+void CCmFmUpnpMngr::CancelOperation()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::CancelOperation()"));
+    
+    if( iBrowseSession )
+        {
+        iAVController->StopBrowsingSession( *iBrowseSession );
+		iBrowseSession = NULL;
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::Uri
+// ---------------------------------------------------------------------------
+// 
+TDesC8& CCmFmUpnpMngr::Uri() const
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::Uri()"));
+    
+    return *iURI;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::UpnpItem
+// ---------------------------------------------------------------------------
+// 
+CUpnpItem& CCmFmUpnpMngr::UpnpItem() const
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::UpnpItem()"));
+    
+    return *iItem;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::BrowseResponse
+// ---------------------------------------------------------------------------
+// 
+void CCmFmUpnpMngr::BrowseResponse(
+                    const TDesC8& aBrowseResponse,
+                    TInt aError,
+                    TInt /*aMatches*/,
+                    TInt aTotalCount,
+                    const TDesC8& /*aUpdateId*/
+                    )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::BrowseResponse()"));   
+    
+    TRACE(Print(_L("[FILL MNGR]\t ParseResultDataL error = %d"), aError ));
+    
+    TRAPD( err, BrowseResponseL( aError, aTotalCount, aBrowseResponse ) );
+    if ( err )
+        {
+        TRACE(Print(_L("[FILL MNGR]\t BrowseResponseL err = %d"), err ));
+        }    
+    }
+                    
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::BrowseResponseL
+// ---------------------------------------------------------------------------
+//    
+void CCmFmUpnpMngr::BrowseResponseL( TInt aStatus,
+                                     TInt /*aTotalCount*/,
+                                     const TDesC8& aResultArray )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::BrowseResponseL()"));
+
+    RPointerArray<CUpnpObject> tempArray;
+    CleanupClosePushL( tempArray );
+    TInt err( aStatus );
+    TRACE(Print(_L("[FILL MNGR]\t BrowseResponse err = %d"), err )); 
+    if( !err )
+        {
+        TRAP( err, iParser->ParseResultDataL(
+            tempArray, aResultArray ) );        
+        }
+                   
+    /** Browse finished */
+    iBrowseFinished.HomeTime();
+    TTimeIntervalMicroSeconds usecsFrom = 
+        iBrowseFinished.MicroSecondsFrom( iBrowseStarted );
+    TRACE(Print(_L("[FILL MNGR]\t Browse took = %ld microseconds"), 
+        usecsFrom.Int64() ));
+    
+    if( !err )
+        {
+    	if ( tempArray.Count() )
+    		{
+    		if( iItem )
+    		    {
+    		    delete iItem;
+    		    iItem = NULL;
+    		    }
+    		iItem = CUpnpItem::NewL();
+    		// first object is an item, safe to downcast
+    		CUpnpItem* item = static_cast<CUpnpItem*>( tempArray[0] );
+    		iItem->CopyL( *tempArray[0] );
+
+    		const CUpnpElement& res = UPnPItemUtility::ResourceFromItemL( *item );      		
+    		if( iSelectOptimalImageSize )
+    		    {
+    		    RUPnPElementsArray array;
+    		    UPnPItemUtility::GetResElements( *tempArray[0], array );
+    		    const CUpnpElement& res = ParseImageResolutions( array );  		    
+    		    }
+
+            if(iURI)
+                {
+                delete iURI;
+                iURI = NULL;            
+                }                  	        	
+            iURI = res.Value().AllocL();
+            iObserver->URICheckResult( EUriChecked, item, &res );
+    		}
+        else
+            {
+            LOG(_L("[FILL MNGR]\t tempArray.Count() = 0"));
+            iObserver->URICheckResult( ENoUriAvailable );
+            }        
+        }
+    else
+        {
+        LOG(_L("[FILL MNGR]\t err != 0"));
+        iObserver->URICheckResult( ENoUriAvailable );
+        }
+
+    tempArray.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &tempArray );            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::SearchResponse
+// ---------------------------------------------------------------------------
+//
+void CCmFmUpnpMngr::SearchResponse( 
+                const TDesC8& /*aSearchResponse*/,
+                 TInt /*aError*/,
+                 TInt /*aMatches*/,
+                 TInt /*aTotalCount*/,
+                 const TDesC8& /*aUpdateId*/
+                 )
+    {
+    // None
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::SearchResponse
+// ---------------------------------------------------------------------------
+//
+void CCmFmUpnpMngr::SearchResponse( 
+                 TInt /*aStatus*/,
+                 TInt /*aTotalCount*/,
+                 const RPointerArray<CUpnpObject>& /*aResultArray*/ 
+                 )
+    {
+    // None
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::SearchCapabilitiesResponse
+// ---------------------------------------------------------------------------
+//
+void CCmFmUpnpMngr::SearchCapabilitiesResponse( 
+                 TInt /*aStatus*/,
+                 const TDesC8& /*aSearchCapabilities*/ 
+                 )
+    {
+    // None
+    }                 
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::CreateContainerResponse
+// ---------------------------------------------------------------------------
+//
+void CCmFmUpnpMngr::CreateContainerResponse( TInt /*aError*/, 
+                                             const TDesC8& /*aObjectId*/ )
+    {
+    // None
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::DeleteObjectResponse
+// ---------------------------------------------------------------------------
+//
+void CCmFmUpnpMngr::DeleteObjectResponse( TInt /*aStatus*/ )
+    {
+    // None
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::MediaServerDisappeared
+// ---------------------------------------------------------------------------
+//
+void CCmFmUpnpMngr::MediaServerDisappeared(
+    TUPnPDeviceDisconnectedReason /*aReason*/ )
+    {
+    // None
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::ReserveLocalMSServicesCompleted
+// ---------------------------------------------------------------------------
+//
+void CCmFmUpnpMngr::ReserveLocalMSServicesCompleted( TInt /*aStatus*/ )
+    {
+    // None
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::UPnPDeviceDiscovered
+// ---------------------------------------------------------------------------
+//
+void CCmFmUpnpMngr::UPnPDeviceDiscovered( const CUpnpAVDevice& /*aDevice*/ )
+    {
+    }
+  
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::UPnPDeviceDisappeared
+// ---------------------------------------------------------------------------
+//    
+void CCmFmUpnpMngr::UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::UPnPDeviceDisappeared"));
+    if( iDevice )
+        {
+        if( KErrNotFound != iDevice->Uuid().Match( aDevice.Uuid() ) )
+            {
+            LOG(_L("[FILL MNGR]\t Used server disappeared!"));
+            LOG(_L("[FILL MNGR]\t Canceling"));
+            iObserver->URICheckResult( ECanceled );
+            }        
+        }
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::WLANConnectionLost
+// ---------------------------------------------------------------------------
+// 
+void CCmFmUpnpMngr::WLANConnectionLost()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::WLANConnectionLost"));
+    iObserver->URICheckResult( ECanceled );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::ParseImageResolutions
+// ---------------------------------------------------------------------------
+// 
+const CUpnpElement& CCmFmUpnpMngr::ParseImageResolutions( 
+    RUPnPElementsArray& aResElementsArray )
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ParseImageResolutions"));
+    
+    TInt elementIndex( KErrNone );
+    TSize matchingSize( 0, 0 );
+    for( TInt i = 0 ; i < aResElementsArray.Count(); i++ )
+        {
+        const CUpnpAttribute* attribute = 
+            UPnPItemUtility::FindAttributeByName( *aResElementsArray[i], 
+                KAttributeResolution() ); 
+        
+        if( attribute )
+            {
+            TPtrC8 resolution( attribute->Value() );
+            TInt index = resolution.Find( KCmFmXMark );
+            if( index != KErrNotFound )
+                {
+                TLex8 lexH( resolution.Mid( index + 1 ) );
+                TInt height( KErrNone );
+                TInt err = lexH.Val( height ); 
+                TRACE(Print(_L("[FILL MNGR]\t Val( height ) = %d"), err ));
+                
+                TInt width( KErrNone );
+                TLex8 lexW( resolution.Mid( 0, index ) );
+                err = lexW.Val( width );
+                TRACE(Print(_L("[FILL MNGR]\t Val( width ) = %d"), err ));
+                
+                TRACE(Print(_L("[FILL MNGR]\t Sizes in landscape mode!!!")));
+                TRACE(Print(_L("[FILL MNGR]\t Image heigth = %d"), height ));
+                TRACE(Print(_L("[FILL MNGR]\t Image width = %d"), width ));
+                if( height >= iScreenSize.iWidth && width >= 
+                    iScreenSize.iHeight )
+                    {
+                    if( matchingSize.iHeight == 0 )
+                        {
+                        matchingSize.iHeight = height;
+                        matchingSize.iWidth = width;
+                        elementIndex = i;
+                        }
+                    else
+                        {
+                        if( matchingSize.iHeight > height && 
+                            matchingSize.iWidth > width )
+                            {
+                            matchingSize.iHeight = height;
+                            matchingSize.iWidth = width;
+                            elementIndex = i;
+                            }
+                        
+                        }                
+                    }                           
+                }            
+            }
+        else
+            {
+            LOG(_L("[FILL MNGR]\t attribute == NULL"));
+            }            
+        }
+    TRACE(Print(_L("[FILL MNGR]\t Selected height = %d"), 
+        matchingSize.iHeight ));
+    TRACE(Print(_L("[FILL MNGR]\t Selected width = %d"), 
+        matchingSize.iWidth ));
+    TRACE(Print(_L("[FILL MNGR]\t Selected elementIndex = %d"), 
+        elementIndex ));
+    return *aResElementsArray[ elementIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFmUpnpMngr::ScreenSizeL
+// ---------------------------------------------------------------------------
+//
+void CCmFmUpnpMngr::ScreenSizeL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ScreenSizeL start"));   
+    RWsSession session;
+    TInt error = session.Connect() ;
+    CleanupClosePushL( session );
+    if ( !error )
+        {
+        CWsScreenDevice* screenDevice = 
+            new ( ELeave ) CWsScreenDevice( session );
+        if ( screenDevice && !screenDevice->Construct() )
+            {
+            iScreenSize = screenDevice->SizeInPixels();
+            }
+        delete screenDevice;
+        screenDevice = NULL;
+        }
+    else
+        {
+        TRACE(Print(_L("[FILL MNGR]\t ScreenSizeL error = %d"), error ));        
+        }    
+
+    CleanupStack::PopAndDestroy( &session );
+    LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ScreenSizeL end"));
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/bwins/cmmemorymanageru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,10 @@
+EXPORTS
+	??1CCmMmMain@@UAE@XZ @ 1 NONAME ; CCmMmMain::~CCmMmMain(void)
+	?Cancel@CCmMmMain@@QAEXXZ @ 2 NONAME ; void CCmMmMain::Cancel(void)
+	?DeleteFilesL@CCmMmMain@@QAEXAAVCDesC16Array@@@Z @ 3 NONAME ; void CCmMmMain::DeleteFilesL(class CDesC16Array &)
+	?NewL@CCmMmMain@@SAPAV1@AAVCCmDmMain@@@Z @ 4 NONAME ; class CCmMmMain * CCmMmMain::NewL(class CCmDmMain &)
+	?NewLC@CCmMmMain@@SAPAV1@AAVCCmDmMain@@@Z @ 5 NONAME ; class CCmMmMain * CCmMmMain::NewLC(class CCmDmMain &)
+	?SetObserver@CCmMmMain@@QAEXAAVMCmMmObserver@@@Z @ 6 NONAME ; void CCmMmMain::SetObserver(class MCmMmObserver &)
+	?SetQuotaListenerStateL@CCmMmMain@@QAEXH@Z @ 7 NONAME ; void CCmMmMain::SetQuotaListenerStateL(int)
+	?ShrinkImagesL@CCmMmMain@@QAEXAAVCDesC16Array@@@Z @ 8 NONAME ; void CCmMmMain::ShrinkImagesL(class CDesC16Array &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/data/memorymanager.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project Memory Manager
+*
+*/
+
+
+#include <uikon.rh>
+#include <memorymanager.loc>
+
+//-----------------------------------------------------------------------------
+// r_mserv_conf_auto_remove
+//-----------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mserv_conf_auto_remove
+    {
+    txt = qtn_mserv_conf_auto_remove;
+    }
+
+//-----------------------------------------------------------------------------
+// r_mserv_progress_remove
+//-----------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mserv_progress_remove
+    {
+    txt = qtn_mserv_progress_remove_list;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/eabi/cmmemorymanageru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,20 @@
+EXPORTS
+	_ZN9CCmMmMain11SetObserverER13MCmMmObserver @ 1 NONAME
+	_ZN9CCmMmMain12DeleteFilesLER12CDesC16Array @ 2 NONAME
+	_ZN9CCmMmMain13ShrinkImagesLER12CDesC16Array @ 3 NONAME
+	_ZN9CCmMmMain22SetQuotaListenerStateLEi @ 4 NONAME
+	_ZN9CCmMmMain4NewLER9CCmDmMain @ 5 NONAME
+	_ZN9CCmMmMain5NewLCER9CCmDmMain @ 6 NONAME
+	_ZN9CCmMmMain6CancelEv @ 7 NONAME
+	_ZN9CCmMmMainD0Ev @ 8 NONAME
+	_ZN9CCmMmMainD1Ev @ 9 NONAME
+	_ZN9CCmMmMainD2Ev @ 10 NONAME
+	_ZTI13CCmMmShrinker @ 11 NONAME ; #<TI>#
+	_ZTI18CCmMmQuotaListener @ 12 NONAME ; #<TI>#
+	_ZTI26CCmMmImageMetadataResolver @ 13 NONAME ; #<TI>#
+	_ZTI9CCmMmMain @ 14 NONAME ; #<TI>#
+	_ZTV13CCmMmShrinker @ 15 NONAME ; #<VT>#
+	_ZTV18CCmMmQuotaListener @ 16 NONAME ; #<VT>#
+	_ZTV26CCmMmImageMetadataResolver @ 17 NONAME ; #<VT>#
+	_ZTV9CCmMmMain @ 18 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Memory Manager
+*
+*/
+
+
+#include "../../../../../group/upnpplatformvar.hrh"
+
+// Supported platforms
+prj_platforms
+DEFAULT
+
+// MMP files
+prj_mmpfiles
+cmmemorymanager.mmp
+
+// Files to be exported
+prj_exports
+../inc/cmmmmain.h                    |../../../../../inc/cmmmmain.h
+../inc/cmmmobserver.h                |../../../../../inc/cmmmobserver.h
+../inc/cmmmquotalistener.h           |../../../../../inc/cmmmquotalistener.h
+../inc/cmmmshrinker.h                |../../../../../inc/cmmmshrinker.h
+// LOC export
+UPNP_LOC_EXPORT(memorymanager.loc)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/group/cmmemorymanager.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project Memory Manager
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          cmmemorymanager.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10282344
+
+VENDORID        VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH     /sys/bin
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../loc
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../../../inc
+
+SOURCEPATH      ../src
+
+SOURCE          cmmmmain.cpp
+SOURCE          cmmmquotalistener.cpp
+SOURCE          cmmmshrinker.cpp
+SOURCE          cmmmimagemetadataresolver.cpp
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib // f32file.h
+LIBRARY         aknnotify.lib // CAknGlobalNote, CAknGlobalProgressDialog
+LIBRARY         eiksrv.lib // CAknGlobalNote, CAknGlobalProgressDialog
+LIBRARY         bafl.lib // CDesCArray, RResourceFile
+LIBRARY         imageconversion.lib // CImageDecoder
+LIBRARY         bitmaptransforms.lib // CBitmapScaler
+LIBRARY         fbscli.lib // CFbsBitmap
+LIBRARY         mpxharvesterutility.lib // Mpx harvester
+LIBRARY         mpxcollectionhelper.lib //MMPXCollectionHelper
+LIBRARY         cmcommon.lib // TCmLowPriorityFilled, TCmShrinkResolution
+LIBRARY         cmdatabasemanager.lib
+LIBRARY         ws32.lib // RWsSession, CWsScreenDevice
+LIBRARY         PlatformEnv.lib // PathInfo
+LIBRARY         avkon.lib // CompeteWithAppPath
+LIBRARY         upnpipserversutils.lib
+LIBRARY         exiflib.lib
+LIBRARY         contentlistingframework.lib
+
+DEBUGLIBRARY    flogger.lib
+
+START RESOURCE      ../data/memorymanager.rss
+HEADER
+TARGETPATH          /resource/apps
+LANGUAGE_IDS
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmimagemetadataresolver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Metadata resolver class in the Memory manager component
+*
+*/
+
+
+#ifndef C_CMMMIMAGEMETADATARESOLVER_H
+#define C_CMMMIMAGEMETADATARESOLVER_H
+
+#include <e32base.h>
+#include <f32file.h> // RFs
+
+// Forward declarations
+class CExifRead;
+class CExifModify;
+
+/**
+ *  CCmMmImageMetadataResolver class
+ *  Part of Memory manager
+ *
+ *  @lib cmmemorymanager.lib
+ *  @since S60 v3.2
+ */
+class CCmMmImageMetadataResolver : public CBase
+    {
+
+public: // Symbian constructors and C++ destructor
+
+    /**
+     * Creates new CCmMmImageMetadataResolver class
+     *
+     * @since S60 3.2
+     * @param aFileSession
+     * @return pointer to CCmMmImageMetadataResolver object
+     */
+    static CCmMmImageMetadataResolver* NewL( RFs& aFileSession );
+
+    /**
+     * Creates new CCmMmImageMetadataResolver class and leaves the instance
+     * in the cleanup stack
+     *
+     * @since S60 3.2
+     * @param aFileSession
+     * @return  pointer to CCmMmImageMetadataResolver object
+     */
+    static CCmMmImageMetadataResolver* NewLC( RFs& aFileSession );
+
+    /**
+     * @since S60 3.2
+     *
+     * C++ destructor
+     */
+    virtual ~CCmMmImageMetadataResolver();
+
+public: // New methods
+
+    /**
+     * Captures orginal metadata
+     * @since S60 3.2
+     * @param aOrigFileName, orginal file name
+     * @return None
+     */
+    void CaptureOrginalMetadataL( const TDesC& aOrigFileName );
+    
+    /**
+     * Captures and resolves image metadata
+     * @since S60 3.2
+     * @param aShrinkedFileName, shrinked file name
+     * @return None
+     */
+    void ResolveMetadataL( const TDesC& aShrinkedFileName );
+
+private:
+
+    /**
+     * Fills orginal exif data to shrinked image
+     * @since S60 3.2
+     * @param aRead, exif reader
+     * @param aModify, exif modifier
+     * @return None
+     */
+    void FillExifL( CExifRead& aRead, CExifModify& aModify );
+    
+private: // Constructors
+
+    /**
+     * C++ constructor
+     *
+     * @since S60 3.2
+     * @param None
+     */
+    CCmMmImageMetadataResolver( RFs& aFileSession );
+
+    /**
+     * Second-phase constructor
+     *
+     * @since S60 3.2
+     */
+    void ConstructL();
+
+private: // data
+    
+    /** File session*/
+    RFs& iFileSession;
+    
+    /** Orginal Metadata ( owned ) */
+    HBufC8* iExifOrig;
+    
+    };
+
+#endif // C_CMMMIMAGEMETADATARESOLVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmmain.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main class in the Memory manager component
+*
+*/
+
+
+#ifndef C_CMMMMAIN_H
+#define C_CMMMMAIN_H
+
+#include <e32base.h>
+#include <badesca.h> // CDesCArray
+#include <f32file.h> // RFs
+#include "cmcommon.h" // TCmListItemStatus
+
+// Forward declarations
+class MCmMmObserver;
+class MMPXHarvesterUtility;
+class CCmMmQuotaListener;
+class CCmMmShrinker;
+class CCmDmMain;
+class MMPXCollectionHelper;
+
+/**
+ *  CCmMmMain class
+ *  Memory manager
+ *
+ *  @lib cmmemorymanager.lib
+ *  @since S60 v3.0
+ */
+class CCmMmMain : public CBase
+    {
+
+public: // Symbian constructors and C++ destructor
+
+    /**
+     * Creates new CCmMmMain class
+     *
+     * @since S60 v3.0
+     * @param aDbManager
+     * @return pointer to CCmMmMain object
+     */
+    IMPORT_C static CCmMmMain* NewL( CCmDmMain& aDbManager );
+
+    /**
+     * Creates new CCmMmMain class and leaves the instance
+     * in the cleanup stack
+     *
+     * @since S60 v3.0
+     * @param aDbManager
+     * @return  pointer to CCmMmMain object
+     */
+    IMPORT_C static CCmMmMain* NewLC( CCmDmMain& aDbManager );
+
+    /**
+     * @since S60 v3.0
+     *
+     * C++ destructor
+     */
+    IMPORT_C virtual ~CCmMmMain();
+
+public: // New methods
+
+    /**
+     * Cancels deletion and shrinking
+     *
+     * @since S60 3.0
+     */
+    IMPORT_C void Cancel();
+
+    /**
+     * Deletes files from array
+     *
+     * @since S60 3.0
+     * @param aFiles
+     */
+    IMPORT_C void DeleteFilesL( CDesCArray& aFiles );
+
+    /**
+     * Sets observer
+     *
+     * @since S60 3.0
+     * @param aObserver
+     */
+    IMPORT_C void SetObserver( MCmMmObserver& aObserver );
+
+    /**
+     * Sets quotalistener on/off
+     *
+     * @since S60 3.0
+     * @param aState
+     */
+    IMPORT_C void SetQuotaListenerStateL( TBool aState );
+
+    /**
+     * Shrinks files from array
+     *
+     * @since S60 3.0
+     * @param aFiles
+     */
+    IMPORT_C void ShrinkImagesL( CDesCArray& aFiles );
+
+    /**
+     * Tells MMC state
+     *
+     * @since S60 3.0
+     * @param aFileServer
+     * @param aDriveNumber
+     * @return ETrue if Drive is usable and else EFalse
+     */
+    static TBool CCmMmMain::DriveState( 
+        const RFs& aFileServer, 
+        TInt aDriveNumber );
+
+private: // Constructors
+
+    /**
+     * C++ constructor
+     *
+     * @since S60 3.0
+     * @param aObserver
+     */
+    CCmMmMain( CCmDmMain& aDbManager );
+
+    /**
+     * Second-phase constructor
+     *
+     * @since S60 3.0
+     */
+    void ConstructL();
+
+private: // New methods
+
+    /**
+     * Static callback method for deletion
+     *
+     * @since S60 3.0
+     * @param aMm
+     */
+    static TInt BackgroundDeleteL( TAny* aMm );
+
+    /**
+     * Deletes files in background
+     *
+     * @since S60 3.0
+     * @return ETrue if Drive is usable and else EFalse
+     */
+    TInt DoBackgroundDeleteL();
+
+    /**
+     * Delete the collection hepler
+     *
+     * @since S60 3.0
+     */
+    void CloseMpxCollectionHelper();
+
+private: // data
+    TInt                                iDeleteIndex;
+    RFs                                 iFileSession;
+    TBool                               iQuotaListenerState;            
+    CCmDmMain&                          iDbManager;
+    CIdle*                              iDeleter;               // owned
+    CDesCArray*                         iFilesToDelete;         // owned
+    CDesCArray*                         iFilesToShrink;         // owned   
+    MMPXHarvesterUtility*               iHarvester;             // owned
+    MCmMmObserver*                      iObserver;              // now owned
+    CCmMmShrinker*                      iShrinker;              // owned
+    RPointerArray<CCmMmQuotaListener>   iQuotaListeners;        // owned
+    MMPXCollectionHelper*               iMpxCollectionHelper;   // owned
+
+    };
+
+#endif // C_CMMMMAIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Callback interface
+*
+*/
+
+
+#ifndef M_CMMMOBSERVER_H
+#define M_CMMMOBSERVER_H
+
+/**
+ *  Callback interface class used to notify derived class
+ *  about status changes in MemoryManager actions
+ *  @lib cmmemorymanager.lib
+ *  @since S60 v3.0
+ */
+class MCmMmObserver
+    {
+
+public:
+
+    /**
+     * Delete completed notification
+     *
+     * @since S60 3.0
+     * @param aErr
+     */
+    virtual void DeleteCompleteL( TInt aErr ) = 0;
+
+    /**
+     * Shrink completed notification
+     *
+     * @since S60 3.0
+     * @param aErr
+     */
+    virtual void ShrinkCompleteL( TInt aErr ) = 0;
+    };
+
+#endif // M_CMMMOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmquotalistener.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Quota listener class in the Store manager component
+*
+*/
+
+
+#ifndef C_CMMMQUOTALISTENER_H
+#define C_CMMMQUOTALISTENER_H
+
+#include <e32base.h>
+#include <f32file.h> // RFs
+
+/* Forward declarations. */
+class CAknGlobalProgressDialog;
+class CCmDmMain;
+class MMPXHarvesterUtility;
+
+/**
+ *  CCmMmQuotaListener class
+ *  Part of Memory Manager
+ *  @lib cmmemorymanager.lib
+ *  @since S60 v3.0
+ */
+class CCmMmQuotaListener : public CActive
+    {
+
+public: // Symbian constructors and C++ destructor
+
+    /**
+     * Creates new CCmMmQuotaListener class and opens connection to database
+     *
+     * @since S60 v3.0
+     * @param aDbManager
+     * @param aDrive
+     * @return pointer to CCmMmQuotaListener object
+     */
+    static CCmMmQuotaListener* NewL( CCmDmMain& aDbManager, TInt aDrive );
+
+    /**
+     * Creates new CCmMmQuotaListener class and leaves the instance
+     * in the cleanup stack
+     *
+     * @since S60 v3.0
+     * @param aDbManager
+     * @param aDrive
+     * @return  pointer to CCmMmQuotaListener object
+     */
+    static CCmMmQuotaListener* NewLC( CCmDmMain& aDbManager, TInt aDrive );
+
+    /**
+     * C++ destructor
+     *
+     * @since S60 v3.0
+     */
+    virtual ~CCmMmQuotaListener();
+
+protected: // Functions from base class
+
+    /**
+     * From CActive
+     * Cancels any outstanding operation
+     *
+     * @since S60 v3.0
+     */
+    void DoCancel();
+
+    /**
+     * From CActive
+     * Callback function
+     *
+     * @since S60 v3.0
+     */
+    void RunL();
+    
+private:
+
+    /**
+     * Resolves drives root path
+     *
+     * @since S60 v3.0
+     * @param aDriveNumber
+     * @return Root path
+     */
+    HBufC* ResolveAndAppendRootPathL( const TInt aDriveNumber );  
+
+private:
+
+    /**
+     * C++ constructor
+     *
+     * @since S60 v3.0
+     * @param aDbManager
+     * @param aDrive
+     */
+    CCmMmQuotaListener( CCmDmMain& aDbManager, TInt aDrive );
+
+    /**
+     * Second-phase constructor
+     *
+     * @since S60 v3.0
+     */
+    void ConstructL();
+
+private: // New methods
+
+    /**
+     * ReadResourceL
+     *
+     * @since S60 v3.0
+     * @param aResourceId
+     * @return resource string
+     */
+    HBufC16* ReadResourceL( TInt aResourceId );
+
+    /**
+     * Waits for given time and after that issues NotifyDiskSpace request
+     * to the fileserver and sets this object active.
+     *
+     * @since S60 v3.1
+     * @param aTimeoutValue time to wait.
+     */
+    void RequestNotificationAfterTimeout( TInt aTimeoutValue );
+    
+    /**
+     * Issues NotifyDiskSpace request to the fileserver and sets this object 
+     * active.
+     *
+     * @since S60 v3.1
+     */
+    void RequestDiskSpaceNotification();
+
+    /**
+     * Asks a confirmation for delete operation from the user.
+     *
+     * @since S60 v3.1
+     * @param aListName 
+     * @param aListSize 
+     * @return the status of the confirmation in a TRequestStatus
+     */
+    TRequestStatus DeleteConfirmationL( 
+        const TDesC& aListName, 
+        TUint32 aListSize );
+    
+    /**
+     * Deletes the files in the array. Shows progressnote about delete 
+     * operation progress.
+     *
+     * @since S60 v3.1
+     * @param aArray 
+     * @param aListName 
+     * @return Total size of all deleted files together.
+     */
+    TUint32 DeleteFilesL( 
+        const RPointerArray<CCmFillListItem>& aArray,
+        const TDesC8& aListName );
+
+    /**
+     * Remove files from the end of the array so that the total amount of 
+     * files in the list is no more than aDeleteLimit megabytes.
+     *
+     * @since S60 v3.1
+     * @param aArray the array 
+     * @param aDeleteLimit maximum amount of the filesizes in the array 
+     *        together after this method call (in megabytes).
+     * @return Total size of all files in the array together.
+     */ 
+    TUint32 CCmMmQuotaListener::RemoveExtraFiles( 
+        RPointerArray<CCmFillListItem>& aArray, 
+        TInt64 aDeleteLimit ) const;
+
+private: // data
+    TInt             iDrive;
+    RFs              iFileSession;
+    TInt64           iQuota;
+    CCmDmMain&       iDbManager;    
+    MMPXHarvesterUtility* iHarvester; // owned
+    CAknGlobalProgressDialog* iProgressDialog; //owned
+    };
+
+#endif //  C_CMMMQUOTALISTENER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmshrinker.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Shrinker class in the Memory manager component
+*
+*/
+
+
+#ifndef C_CMMMSHRINKER_H
+#define C_CMMMSHRINKER_H
+
+#include <e32base.h>
+#include "cmcommon.h" // TCmListItemStatus
+
+/* Forward declarations. */
+class MCmMmObserver;
+class CCmMmImageMetadataResolver;
+class CFbsBitmap;
+class CImageDecoder;
+class CBitmapScaler;
+class CImageEncoder;
+class CCmDmMain;
+
+/**
+ *  CCmMmShrinker class
+ *
+ *  @lib cmmemorymanager.lib
+ *  @since S60 v3.1
+ */
+class CCmMmShrinker : public CActive
+    {
+
+// States
+    enum TImageState
+        {
+        EIdle = 0,
+        EDecode,
+        EScale,
+        EEncode,
+        EReplace
+        };
+
+public: // Constructors and destructor
+
+    /**
+     * Creates new CCmMmShrinker class and opens connection to database
+     *
+     * @since S60 3.1
+     * @param aDbManager
+     * @return pointer to CCmMmShrinker object
+     */
+    static CCmMmShrinker* NewL( CCmDmMain& aDbManager );
+
+    /**
+     * Creates new CCmMmShrinker class and opens connection to database and
+     * leaves the instance in the cleanup stack
+     *
+     * @since S60 3.1
+     * @param aDbManager
+     * @return pointer to CCmMmShrinker object
+     */
+    static CCmMmShrinker* NewLC( CCmDmMain& aDbManager );
+
+    /**
+     * C++ destructor
+     *
+     * @since S60 3.1
+     */
+    virtual ~CCmMmShrinker();
+
+public:     // New functions
+
+    /**
+     * Shrinks given images.
+     *
+     * @since S60 3.1
+     * @param aFiles
+     */
+    void ShrinkImagesL( CDesCArray& aFiles );
+    
+    /**
+     * Sets memory manager observer
+     *
+     * @since S60 3.1
+     * @param aObserver
+     */
+    void SetObserver ( MCmMmObserver* aObserver );
+
+protected: // Functions from base class
+
+    /**
+     * From CActive
+     * Cancels any outstanding operation
+     *
+     * @since S60 3.1
+     */
+    void DoCancel();
+
+    /**
+     * Handles a leave occurring in the request
+     * completion event handler RunL()
+     *
+     * @since S60 3.1
+     * @param aError
+     * @return error value
+     */
+    TInt RunError( TInt aError );
+
+    /**
+     * From CActive
+     * Callback function
+     * Invoked to handle responses from the server
+     *
+     * @since S60 3.1
+     */
+    void RunL();
+
+ private: // New methods
+
+    /**
+     * Return screensize
+     *
+     * @since S60 3.1
+     * @return screensize
+     */
+    TSize ScreenSizeL();
+ 
+    /**
+     * Returns the private path according to the specified file name
+     *
+     * @since S60 3.1
+     * @param aFs handle to file server
+     * @param aPrivatePath reference to descriptor where private path is 
+                           modified.
+     * @param aOriginal original file path used to define drive and file name
+     */     
+     void PrivatePath( RFs& aFs, 
+                       TFileName& aPrivatePath, 
+                       const TFileName& aOriginal );
+
+    /**
+     * Clear shrinker mermber variables
+     *
+     * @since S60 3.1
+     * @param None
+     */                       
+     void ClearShrinker();                                              
+
+private:
+
+    /**
+     * C++ constructor
+     *
+     * @since S60 3.1
+     * @param aDbManager
+     */
+    CCmMmShrinker( CCmDmMain& aDbManager );
+
+    /**
+     * Second-phase constructor.
+     *
+     * @since S60 3.1
+     * @param aFiles
+     */
+    void ConstructL();
+
+
+
+private: // data
+    RFs               iFileSession;
+    TSize             iScreenSize;
+    TInt              iShrinkIndex;
+    TTime             iStartTime;
+    TImageState       iState;
+    TTime             iStopTime;
+    MCmMmObserver*    iObserver;        // not owned
+    CCmDmMain&        iDbManager;
+    CFbsBitmap*       iBitmap;          // owned
+    CBitmapScaler*    iBitmapScaler;    // owned
+    CDesCArray*       iFiles;           // owned
+    CImageDecoder*    iImageDecoder;    // owned
+    CImageEncoder*    iImageEncoder;    // owned
+    TFileName         iTempFilename;
+    CCmMmImageMetadataResolver* iImageMetadataResolver;
+    };
+
+#endif //  C_CMMMSHRINKER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/loc/memorymanager.loc	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project MemoryManager
+*
+*/
+
+
+//d:Low memory on memory card.
+//d:Temporarily remove %d MB of your synced home media from list %S?
+//d:Parameter 1 max length: 5 characters
+//d:Parameter 2 max length: 255 characters
+//l:popup_note_window
+//r:1.0
+//
+#define qtn_mserv_conf_auto_remove "Memory low. Temporarily remove %d MB media content from list %S?"
+
+//d:Removing home media
+//l:popup_note_wait_window
+//r:1.0
+//
+#define qtn_mserv_progress_remove "Removing home media"
+
+//d:Removing home media
+//d:Parameter 2 max length: 255 characters
+//l:popup_note_wait_window
+//r:1.0
+//
+#define qtn_mserv_progress_remove_list "Removing media content from list %S"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmimagemetadataresolver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,427 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image metadata resolver class in Memory manager component
+*
+*/
+
+
+#include <e32std.h>
+#include <ExifModify.h>
+#include <ExifTag.h> 
+#include <exifutility.h>
+#include <ExifRead.h> 
+#include "msdebug.h"
+#include "cmmmimagemetadataresolver.h"
+
+const TUint16 KIdFNumber = 0x829D;
+const TUint16 KIdFocalLength = 0x920A;
+const TUint16 KIdFocalLength35mmFilm = 0xA405;
+const TUint16 KIdFocalPlaneResolutionUnit = 0xA210;
+const TUint16 KIdFocalPlaneXResolution = 0xA20E;
+const TUint16 KIdFocalPlaneYResolution = 0xA20F;
+const TUint32 KDefaultPixelsPerResolutionUnitNumerator = 99;
+const TUint32 KDefaultPixelsPerResolutionUnitDenominator = 66;
+const TUint16 KDefaultYCbCrPositioningCentered = 1;
+const TUint16 KDefaultColorSpace_sRGB = 1;
+
+// ---------------------------------------------------------------------------
+// CCmMmImageMetadataResolver::NewL
+// ---------------------------------------------------------------------------
+//
+CCmMmImageMetadataResolver* CCmMmImageMetadataResolver::NewL( 
+    RFs& aFileSession )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::NewL() start"));
+    CCmMmImageMetadataResolver* self = 
+        CCmMmImageMetadataResolver::NewLC( aFileSession );
+    CleanupStack::Pop( self );
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmImageMetadataResolver::NewLC
+// ---------------------------------------------------------------------------
+//
+CCmMmImageMetadataResolver* CCmMmImageMetadataResolver::NewLC( 
+    RFs& aFileSession )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::NewLC() start"));
+    CCmMmImageMetadataResolver* self = 
+        new ( ELeave ) CCmMmImageMetadataResolver( aFileSession );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::NewLC() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ destructor
+// ---------------------------------------------------------------------------
+//
+CCmMmImageMetadataResolver::~CCmMmImageMetadataResolver()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::~CCmMmImageMetadataResolver() start"));
+    delete iExifOrig;
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::~CCmMmImageMetadataResolver() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmImageMetadataResolver::CaptureOrginalMetadataL
+// ---------------------------------------------------------------------------
+//
+void CCmMmImageMetadataResolver::CaptureOrginalMetadataL( 
+    const TDesC& aOrigFileName )
+    {
+    RFile orig;
+    User::LeaveIfError( orig.Open( iFileSession, aOrigFileName, EFileRead ) );    
+    CleanupClosePushL( orig );        
+    TInt size = 0;
+    orig.Size(size);
+    delete iExifOrig;
+    iExifOrig = NULL;
+    iExifOrig = HBufC8::NewL( size );
+    TPtr8 bufferDes( iExifOrig->Des() );
+    User::LeaveIfError( orig.Read( bufferDes ) );
+    CleanupStack::PopAndDestroy();    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMmImageMetadataResolver::ResolveMetadataL
+// ---------------------------------------------------------------------------
+//
+void CCmMmImageMetadataResolver::ResolveMetadataL(
+    const TDesC& aShrinkedFileName )
+    {
+    RFile shrinked;
+    User::LeaveIfError( 
+        shrinked.Open( iFileSession, aShrinkedFileName, EFileRead|EFileWrite ) );
+    
+    CleanupClosePushL( shrinked );         
+    
+    // 1. Read Exif image from the file to a buffer...
+    TInt sizeS = 0;
+    shrinked.Size(sizeS);
+    HBufC8* exifShrinked = HBufC8::NewL( sizeS );
+    CleanupStack::PushL( exifShrinked );
+    TPtr8 bufferDesS( exifShrinked->Des() );
+    User::LeaveIfError( shrinked.Read( bufferDesS ) );
+    
+    CExifModify* modify = NULL;
+    CExifRead* read = NULL;
+    TRAPD( err1, read = CExifRead::NewL( iExifOrig->Des() ) );
+    User::LeaveIfError( err1 );
+    // 2. Instantiate Exif modifier in EModify mode...
+    TRAPD( err, modify = CExifModify::NewL( exifShrinked->Des() ) );
+    if(err == KErrCorrupt)
+        {
+        modify = CExifModify::NewL( exifShrinked->Des(), CExifModify::ECreate );
+        }
+    CleanupStack::PushL(modify);
+    // If exif info fails, there is nothing we can do
+    TRAP_IGNORE( FillExifL( *read, *modify ) );         
+    
+    // 4. Get the modified Exif image...
+    // If zero length descriptor is given instead of exif->Des(), then only the
+    // Exif meta data is returned
+    TInt pos = 0;
+    User::LeaveIfError( shrinked.Seek( ESeekStart, pos ) );    
+    HBufC8* modifiedExif = NULL;
+    TRAPD( err2, modifiedExif = modify->WriteDataL( exifShrinked->Des() ) );
+    /* Process the modified Exif data */
+    if( modifiedExif && !err2 )
+        {
+        shrinked.Write( *modifiedExif, modifiedExif->Des().Length() );
+        }    
+    
+    delete modifiedExif;
+    modifiedExif = NULL;
+
+    // 5. Delete the modifier instance...
+    CleanupStack::PopAndDestroy( modify );
+    CleanupStack::PopAndDestroy( exifShrinked );
+    CleanupStack::PopAndDestroy(); 
+    delete iExifOrig;
+    iExifOrig = NULL; 
+    
+    }
+    
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CCmMmImageMetadataResolver::CCmMmImageMetadataResolver( RFs& aFileSession ) 
+    : iFileSession( aFileSession )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::CCmMmImageMetadataResolver() start"));
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::CCmMmImageMetadataResolver() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmImageMetadataResolver::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmMmImageMetadataResolver::ConstructL()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::ConstructL() start"));
+    LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::ConstructL() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmImageMetadataResolver::FillExifL
+// ---------------------------------------------------------------------------
+//
+void CCmMmImageMetadataResolver::FillExifL( CExifRead& aRead, CExifModify& aModify )
+    {    
+    TRAP_IGNORE( aModify.SetImageDescriptionL( *aRead.GetImageDescriptionL() ) );
+    TRAP_IGNORE( aModify.SetMakeL( *aRead.GetMakeL() ) );
+    TRAP_IGNORE( aModify.SetModelL( *aRead.GetModelL() ) ); 
+    
+    TRAP_IGNORE( aModify.SetThumbnailL( *aRead.GetThumbnailL() ) );
+    TRAP_IGNORE( aModify.SetTransferFunctionL( *aRead.GetTransferFunctionL() ) );
+    TRAP_IGNORE( aModify.SetDateTimeL( *aRead.GetDateTimeL() ) );         
+    
+    TRAP_IGNORE( aModify.SetSoftwareL( *aRead.GetSoftwareL() ) );
+    TRAP_IGNORE( aModify.SetCopyrightL( *aRead.GetCopyrightL() ) );
+
+    aModify.SetXResolutionL(
+        KDefaultPixelsPerResolutionUnitNumerator,
+        KDefaultPixelsPerResolutionUnitDenominator );
+    aModify.SetYResolutionL( 
+        KDefaultPixelsPerResolutionUnitNumerator, 
+        KDefaultPixelsPerResolutionUnitDenominator );
+
+    aModify.SetYCbCrPositioningL( KDefaultYCbCrPositioningCentered );
+
+    aModify.SetColorSpaceL( KDefaultColorSpace_sRGB );
+    
+    TUint32 uint32Value = 0;
+    TUint16 uint16Value = 0;
+    HBufC8* textValue = NULL;
+    const CExifTag* exifTagInfo = NULL;
+    TInt exifError( KErrNone );
+    exifError = aRead.GetPixelXDimension( uint32Value );
+    if( exifError == KErrNone )
+        { 
+        TRAP_IGNORE( aModify.SetPixelXDimensionL( uint32Value ) );
+        }
+    exifError = aRead.GetPixelYDimension( uint32Value );
+    if( exifError == KErrNone )
+        { 
+        TRAP_IGNORE( aModify.SetPixelYDimensionL( uint32Value ) );
+        }
+    
+    exifError = aRead.GetWhiteBalance( uint16Value );
+    if( exifError == KErrNone )
+        {
+        aModify.SetWhiteBalanceL( uint16Value );
+        }
+    exifError = aRead.GetFlash( uint16Value );
+    if( exifError == KErrNone )
+        {
+        aModify.SetFlashL( uint16Value );        
+        }
+
+    exifError = aRead.GetExposureProgram( uint16Value );
+    if( exifError == KErrNone )
+        {
+        aModify.SetExposureProgramL( uint16Value );
+        }
+
+
+    TRAP( exifError, textValue = aRead.GetUserCommentL() );
+
+    if ( exifError == KErrNone )
+        {
+        aModify.SetUserCommentL( *textValue );
+        }
+
+    TRAP( exifError, textValue = aRead.GetDateTimeOriginalL() );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetDateTimeOriginalL( *textValue );
+        }
+
+    TRAP( exifError, textValue = aRead.GetDateTimeDigitizedL() );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetDateTimeDigitizedL( *textValue );
+        }
+
+    exifError = aRead.GetOrientation( uint16Value );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetOrientationL( uint16Value );
+        }
+
+    exifError = aRead.GetYCbCrPositioning( uint16Value );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetYCbCrPositioningL( uint16Value );
+        }
+
+    exifError = aRead.GetResolutionUnit( uint16Value );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetResolutionUnitL( uint16Value );
+        }
+
+    TRAP( exifError, textValue = aRead.GetIsoSpeedRatingsL() );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetIsoSpeedRatingsL( *textValue );
+        }
+
+    TRAP( exifError, textValue = aRead.GetRelatedSoundFileL() );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetRelatedSoundFileL( *textValue );
+        }
+                
+    TUint32 exifDenominator = 0;
+    exifError = aRead.GetExposureTime( uint32Value, exifDenominator );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetExposureTimeL( uint32Value, exifDenominator );
+        }
+        
+    exifDenominator = 0;
+    exifError = aRead.GetApertureValue( uint32Value, exifDenominator );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetApertureValueL( uint32Value, exifDenominator );
+        }        
+
+    exifError = aRead.GetColorSpace( uint16Value );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetColorSpaceL( uint16Value );
+        }
+
+    TInt32 exifExposureB = 0;
+    TInt32 exifDenominatorB = 0;
+    exifError = aRead.GetExposureBiasValue( exifExposureB, exifDenominatorB );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetExposureBiasValueL( exifExposureB, exifDenominatorB );
+        }
+
+    exifError = aRead.GetMeteringMode( uint16Value );
+    if ( exifError == KErrNone )
+        {               
+        aModify.SetMeteringModeL( uint16Value );
+        }
+
+    exifDenominator = 0;
+    exifError = aRead.GetThumbnailXResolution( uint32Value, exifDenominator );
+    if ( exifError == KErrNone )
+        {        
+        aModify.SetThumbnailXResolutionL( uint32Value, exifDenominator );
+        }
+    
+    exifDenominator = 0;
+    exifError = aRead.GetThumbnailYResolution( uint32Value, exifDenominator );
+    if ( exifError == KErrNone )
+        {        
+        aModify.SetThumbnailYResolutionL( uint32Value, exifDenominator );
+        } 
+       
+    exifError = aRead.GetThumbnailResolutionUnit( uint16Value );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetThumbnailResolutionUnitL( uint16Value );
+        }
+
+
+    TInt32 exifShutterSpeedValue = 0;
+    TInt32 exifDenominatorS = 0;
+    exifError = aRead.GetShutterSpeedValue( exifShutterSpeedValue, exifDenominatorS );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetShutterSpeedValueL( exifShutterSpeedValue, exifDenominatorS );
+        }
+
+    TUint8 exifComponent4th( 0 );
+    TUint8 exifComponent3rd( 0 );
+    TUint8 exifComponent2nd( 0 );
+    TUint8 exifComponent1st( 0 );
+
+    exifError = aRead.GetComponentsConfiguration(
+    		exifComponent1st, exifComponent2nd, exifComponent3rd, exifComponent4th );
+    if ( exifError == KErrNone )
+        {
+        aModify.SetComponentsConfigurationL(
+        		exifComponent1st, exifComponent2nd, 
+        		exifComponent3rd, exifComponent4th );
+        }
+        
+    TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFNumber ) );
+    if ( exifError == KErrNone )
+        {
+        TPtrC8 exifFNumberBuf( exifTagInfo->Data() );
+        TExifTagInfo tagInfo( KIdFNumber, CExifTag::ETagRational, 1 );
+        aModify.SetTagL( EIfdExif, tagInfo, exifFNumberBuf );
+        }
+        
+
+    TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalLength ) );
+    if ( exifError == KErrNone )
+        {
+        TPtrC8 exifFocalLengthBuf( exifTagInfo->Data() );
+        TExifTagInfo tagInfo( KIdFocalLength, CExifTag::ETagRational, 1 );
+        TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocalLengthBuf ) );
+        }
+        
+    TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalLength35mmFilm ) );
+    if ( exifError == KErrNone )
+        {
+        TPtrC8 exifFocal35mmBuf( exifTagInfo->Data() );
+        TExifTagInfo tagInfo( KIdFocalLength35mmFilm, CExifTag::ETagRational, 1 );
+        TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocal35mmBuf ) );
+        }                
+
+    TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalPlaneResolutionUnit ) );
+    if ( exifError == KErrNone )
+        {
+        TPtrC8 exifFocalPlaneResolutionUnitBuf( exifTagInfo->Data() );
+        TExifTagInfo tagInfo( KIdFocalPlaneResolutionUnit, CExifTag::ETagShort, 1 );
+        TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocalPlaneResolutionUnitBuf ) );
+        }        
+
+    TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalPlaneXResolution ) );
+    if ( exifError == KErrNone )
+        {
+        TPtrC8 exifFocalPlaneXResBuf( exifTagInfo->Data() );
+        TExifTagInfo tagInfo( KIdFocalPlaneXResolution, CExifTag::ETagRational, 1 );
+        TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocalPlaneXResBuf ) );
+        }
+        
+    TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalPlaneYResolution ) );
+    if ( exifError == KErrNone )
+        {
+        TPtrC8 exifFocalPlaneYResBuf( exifTagInfo->Data() );
+        TExifTagInfo tagInfo( KIdFocalPlaneYResolution, CExifTag::ETagRational, 1 );
+        TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocalPlaneYResBuf ) );
+        }
+         
+    exifError = aRead.GetLightSource( uint16Value );
+    if ( exifError == KErrNone )
+        {
+        TRAP_IGNORE( aModify.SetLightSourceL( uint16Value ) );
+        }
+                                                                                                                        
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmmain.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,367 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main class in the Memory manager component
+*
+*/
+
+
+#include <e32std.h>
+#include <e32base.h>
+#include <MCLFContentListingEngine.h>
+#include <ContentListingFactory.h>
+#include <mpxharvesterutility.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionhelper.h>
+#include <pathinfo.h>
+
+#include "cmdmmain.h"
+#include "msdebug.h"
+#include "cmmmmain.h"
+#include "cmdriveinfo.h"
+#include "cmmmquotalistener.h"
+#include "cmmmshrinker.h"
+#include "cmmmobserver.h"
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmMmMain* CCmMmMain::NewL( CCmDmMain& aDbManager )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::NewL() start"));
+    CCmMmMain* self = CCmMmMain::NewLC( aDbManager );
+    CleanupStack::Pop( self );
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::NewLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmMmMain* CCmMmMain::NewLC( CCmDmMain& aDbManager )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::NewLC() start"));
+    CCmMmMain* self = new ( ELeave ) CCmMmMain( aDbManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::NewLC() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmMmMain::~CCmMmMain()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::~CCmMmMain() start"));
+
+    iFileSession.Close();
+    iQuotaListeners.ResetAndDestroy();
+    delete iDeleter;
+    delete iFilesToDelete;
+    delete iFilesToShrink;
+    
+    if( iHarvester )
+        {
+        iHarvester->Close();
+        }
+
+    CloseMpxCollectionHelper();
+
+    delete iObserver;
+    delete iShrinker;
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::~CCmMmMain() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::Cancel
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMmMain::Cancel()
+    {
+    if ( iDeleter )
+        {
+        iDeleter->Cancel();
+        if ( iObserver )
+            {
+            // Trap here, do nothing if it leaves.
+            TRAP_IGNORE( iObserver->DeleteCompleteL( KErrCancel ) );
+            }
+        }
+    if ( iShrinker )
+        {
+        iShrinker->Cancel();
+        if ( iObserver )
+            {
+            // Trap here, do nothing if it leaves
+            TRAP_IGNORE( iObserver->ShrinkCompleteL( KErrCancel ) );
+            }
+        }
+    for( TInt i = 0; i < iQuotaListeners.Count(); i++ )
+        {        
+        iQuotaListeners[i]->Cancel();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::DeleteFilesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMmMain::DeleteFilesL( CDesCArray& aFiles )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::DeleteFilesL() start"));
+
+    if ( &aFiles && aFiles.Count() > 0 )
+        {
+        delete iFilesToDelete;
+        iFilesToDelete = NULL;
+        iFilesToDelete = new ( ELeave ) CDesC16ArrayFlat( aFiles.Count() );
+        for ( TInt i = 0; i < aFiles.Count(); i++ )
+            {
+            iFilesToDelete->AppendL( aFiles[i] );
+            }
+        }
+    iDeleteIndex = 0;
+
+    if ( iDeleter )
+        {
+        CloseMpxCollectionHelper();
+        iMpxCollectionHelper = CMPXCollectionHelperFactory::NewCollectionHelperL();
+        iDeleter->Start( TCallBack( BackgroundDeleteL, this ) );
+        }
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::DeleteFilesL() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::SetObserver
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMmMain::SetObserver( MCmMmObserver& aObserver )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::SetObserver() start"));
+    iObserver = &aObserver;
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::SetObserver() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::SetQuotaListenerStateL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMmMain::SetQuotaListenerStateL( TBool aState )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::SetQuotaListenerStateL() start"));
+    
+    if( !aState )
+        {
+        iQuotaListeners.ResetAndDestroy();
+        iQuotaListeners.Close();
+        LOG(_L("[MEMORY MNGR]\t Quotalisteners deleted"));
+        }
+    else
+        {
+        iDbManager.PrepareQueryCmdL( EDrivesQuery );
+        RPointerArray<CCmDriveInfo> drives;
+        TRAP_IGNORE( iDbManager.QueryDrivesL( drives ) );
+        iQuotaListeners.ResetAndDestroy();
+        for( TInt i = 0 ; i < drives.Count(); i++ )
+            {
+            TRACE(Print(_L("[MEMORY MNGR]\t Starting quota listener to \
+            drive = %d"), drives[i]->DriveNumber() ));            
+            CCmMmQuotaListener* listener = 
+                CCmMmQuotaListener::NewL( 
+                    iDbManager, 
+                    drives[i]->DriveNumber() );
+            iQuotaListeners.Append( listener );        
+            }
+        drives.ResetAndDestroy();            
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::ShrinkImagesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMmMain::ShrinkImagesL( CDesCArray& aFiles )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::ShrinkImagesL() start"));
+
+    if ( !iShrinker )
+        {
+        iShrinker = CCmMmShrinker::NewL( iDbManager );       
+        }
+    else
+        {
+        // Cancel the possible ongoing operation
+        iShrinker->Cancel();
+        }
+    iShrinker->SetObserver( iObserver );
+    iShrinker->ShrinkImagesL( aFiles );
+
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::ShrinkImagesL() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::MmcState
+// ---------------------------------------------------------------------------
+//
+TBool CCmMmMain::DriveState( const RFs& aFileServer, TInt aDriveNumber )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::DriveState() start"));
+
+    TDriveInfo driveInfo;
+    TInt error = aFileServer.Drive( driveInfo, aDriveNumber );
+
+    //check if MMC is present
+    TBool status = EFalse;
+    if ( error == KErrNone && driveInfo.iType == EMediaHardDisk )
+        {
+        status = ETrue;
+        LOG(_L("[MEMORY MNGR]\t CCmMmMain::DriveState() Drive found"));
+        }
+
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::DriveState() end"));
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CCmMmMain::CCmMmMain( CCmDmMain& aDbManager ) :
+    iDeleteIndex( 0 ),
+    iQuotaListenerState( ETrue ),
+    iDbManager( aDbManager )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::CCmMmMain() start"));
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::CCmMmMain() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmMmMain::ConstructL()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::ConstructL() start"));
+
+    User::LeaveIfError( iFileSession.Connect() );
+    iDeleter = CIdle::NewL( CActive::EPriorityIdle );    
+    iHarvester = CMPXHarvesterFactory::NewL();
+    SetQuotaListenerStateL( ETrue );
+
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::ConstructL() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::BackgroundDeleteL
+// ---------------------------------------------------------------------------
+//
+TInt CCmMmMain::BackgroundDeleteL( TAny* aMm )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::BackgroundDeleteL() start"));
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::BackgroundDeleteL() end"));
+    return ((CCmMmMain*)aMm)->DoBackgroundDeleteL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::DoBackgroundDeleteL
+// ---------------------------------------------------------------------------
+//
+TInt CCmMmMain::DoBackgroundDeleteL()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::DoBackgroundDeleteL() start"));
+    TInt moreFiles = EFalse;
+    TInt error = KErrNone;
+    TInt trapinfo( KErrNone );
+
+    if ( iFilesToDelete )
+        {
+        if ( iDeleteIndex < iFilesToDelete->Count() )
+            {
+            TPtrC filenameTemp = (*iFilesToDelete)[iDeleteIndex];
+            // Delete file from filesystem
+            error = iFileSession.Delete( filenameTemp );
+
+            TRACE(Print(_L("[MEMORY MNGR]\t CCmMmMain:DoBackgroundDeleteL \
+error: %d"), error));
+
+#ifdef _DEBUG
+
+            TRACE(Print(_L("[MEMORY MNGR]\t CCmMmMain: File %S deleted"),
+                                          &filenameTemp ));
+#endif // _DEBUG
+            TRAP( trapinfo, iMpxCollectionHelper->RemoveL( filenameTemp ) );
+            TRACE(Print(_L("[MEMORY MNGR]\t CCmMmMain:DoBackgroundDeleteL \
+RemoveL: %d"), trapinfo));
+
+            iDeleteIndex++;
+            }
+
+        // return ETrue if there are more files to delete
+        if ( iDeleteIndex < iFilesToDelete->Count() )
+            {
+            moreFiles = ETrue;
+            }
+        // No more files to be deleted. Call Media Gallery update.
+        else if ( iFilesToDelete->Count() )
+            {
+            MCLFContentListingEngine* clfEngine =
+                    ContentListingFactory::NewContentListingEngineLC();
+            if( clfEngine )
+                {
+                TRAP_IGNORE( clfEngine->UpdateItemsL() );
+
+                TRAP_IGNORE( iHarvester->RemoveFilesL( *iFilesToDelete ) );
+                }
+            CleanupStack::PopAndDestroy();
+
+            }
+            
+        }
+                
+    // If all files are deleted, inform observer that deletion is ready.
+    if ( !moreFiles )
+        {
+        CloseMpxCollectionHelper();
+        }
+    
+    if ( !moreFiles && iObserver )
+        {
+        delete iFilesToDelete;
+        iFilesToDelete = NULL;
+        iObserver->DeleteCompleteL( error );
+        }
+    LOG(_L("[MEMORY MNGR]\t CCmMmMain::DoBackgroundDeleteL() end"));
+
+    // Return EFalse if background deletion is done, ETrue if there are more 
+    // files to be deleted.
+    return moreFiles;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmMain::CloseMpxCollectionHelper
+// ---------------------------------------------------------------------------
+//    
+void CCmMmMain::CloseMpxCollectionHelper()
+    {
+    if( iMpxCollectionHelper )
+        {
+    	iMpxCollectionHelper->Close();
+        }
+    iMpxCollectionHelper = NULL;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmquotalistener.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,541 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main class in the manory manager component
+*
+*/
+
+
+#include <e32std.h>
+#include <AknGlobalNote.h> // CAknGlobalNote
+#include <AknGlobalProgressDialog.h>  // CAknGlobalProgressDialog
+#include <mpxharvesterutility.h>
+#include <MCLFContentListingEngine.h>
+#include <ContentListingFactory.h>
+#include <avkon.rsg> // R_AVKON_SOFTKEYS_OK_EMPTY
+#include <barsc.h> // RResourceFile
+#include <barsread.h> // TResourceReader
+#include <bautils.h> // BaflUtils
+#include <AknUtils.h>
+#include <memorymanager.rsg>
+#include <pathinfo.h>
+
+#include "cmcommon.h"
+#include "cmfilllistitem.h"
+#include "cmdmmain.h"
+#include "upnpstring.h"
+#include "msdebug.h"
+#include "cmmmmain.h"
+#include "cmmmquotalistener.h"
+
+
+// Contants
+const TInt64 KDeleteLimit = 50; // 50MB
+const TInt KSizeStringLength = 10;
+const TInt KTimeoutValue = 3000000; // 3 seconds
+_LIT16( KCmDoubleBackSlash,    "\\" ); 
+_LIT16( KCmColon,              ":");
+
+_LIT( KResourceFilePath, "\\resource\\apps\\memorymanager.rsc" );
+
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::NewL
+// ---------------------------------------------------------------------------
+//
+CCmMmQuotaListener* CCmMmQuotaListener::NewL( CCmDmMain& aDbManager,
+                                              TInt aDrive )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::NewL() start"));
+    CCmMmQuotaListener* self = CCmMmQuotaListener::NewLC( aDbManager,
+                                                          aDrive );
+    CleanupStack::Pop( self );
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::NewLC
+// ---------------------------------------------------------------------------
+//
+CCmMmQuotaListener* CCmMmQuotaListener::NewLC( CCmDmMain& aDbManager,
+                                               TInt aDrive )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::NewLC() start"));
+    CCmMmQuotaListener* self = new ( ELeave ) CCmMmQuotaListener( aDbManager,
+                                                                   aDrive );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::NewLC() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ destructor
+// ---------------------------------------------------------------------------
+//
+CCmMmQuotaListener::~CCmMmQuotaListener()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::~CCmMmQuotaListener()\
+             start"));
+    if( IsActive() )
+        {
+        Cancel();
+        }
+    iFileSession.Close();
+    
+    if( iHarvester )
+        {
+        iHarvester->Close();
+        }
+    delete iProgressDialog;
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::~CCmMmQuotaListener() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCmMmQuotaListener::DoCancel()
+    {
+    iFileSession.NotifyDiskSpaceCancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::RunL
+// ---------------------------------------------------------------------------
+//
+void CCmMmQuotaListener::RunL()
+    {
+    TRACE(Print(_L("[MEMORY MNGR]\t CCmMmQuotaListener:RunL status = %d"),
+        iStatus.Int() ) );
+
+    // Check if MMC is inserted
+    if ( CCmMmMain::DriveState( iFileSession, iDrive ) && 
+         !iProgressDialog )
+        {
+        // Check out that NotifyDiskSpace event came from quota
+        TVolumeInfo volumeInfo;
+        iFileSession.Volume( volumeInfo, iDrive );
+
+        if ( volumeInfo.iFree >= iQuota )
+            {
+            // Request a notification when disk space crosses the threshold 
+            // value.
+            RequestDiskSpaceNotification();
+            }
+        else 
+            {   
+            // Get lowest priority list
+            RPointerArray<CCmFillListItem> array;
+            iDbManager.PrepareQueryCmdL( EFilledLowPriorityQuery );
+            iDbManager.GetLowPriorityFilledFilesL( iDrive, array );
+            // If Fill list is empty we wait 3 seconds and try again
+            if ( !array.Count() )
+                {
+                TRACE( Print( _L("[MEMORY MNGR]\t CCmMmQuotaListener:RunL \
+                    Fill list is empty") ) );
+                }
+            else 
+                {
+                switch ( iStatus.Int() )
+                    {
+                    case KErrNone:
+                        {
+                        // Remove files from the end of the list so that the 
+                        // total amount of files in the list is no more than 
+                        // KDeleteLimit megabytes.
+
+                        // listsize is the total size of the files in array 
+                        // in megabytes.
+                        TUint32 listSize = RemoveExtraFiles( array, 
+                                                             KDeleteLimit ); 
+
+                        // Get fill list name
+                        HBufC8* listName8 = NULL;
+                        iDbManager.GetFillListNameL( listName8,
+                                                     array[0]->ListId() );
+                        CleanupStack::PushL( listName8 );
+                        
+                        HBufC* listName16 = 
+                            HBufC::NewLC( listName8->Length() );
+                        listName16->Des().Copy( *listName8 );
+                        
+                        // Get confirmation for the delete operation from the 
+                        // user.
+                        TRequestStatus status = DeleteConfirmationL( 
+                            *listName16, 
+                            listSize );
+                        
+                        // If file deletion Yes is selected
+                        if ( status.Int() == EAknSoftkeyYes )
+                            {
+                            // delete the files
+                            TUint32 delAmount = DeleteFilesL( array, 
+                                                              *listName8 );
+                                                              
+                            TRACE( Print(_L("[MEMORY MNGR]\t Deleted %d \
+                                MBytes from list %S"), 
+                                delAmount, listName16 ) );
+                            }
+                        else
+                            {
+                            LOG( _L("EAknSoftkeyNo") );
+                            // Request a notification when disk space crosses
+                            // the threshold value.
+                            iFileSession.NotifyDiskSpace( 
+                                iQuota, iDrive, iStatus );
+                            }
+
+                        // clean up
+                        CleanupStack::PopAndDestroy( listName16 );
+                        CleanupStack::PopAndDestroy( listName8 );
+                        array.ResetAndDestroy();
+                        SetActive();
+                        break;
+                        }
+                    case KErrNotReady:
+                        {
+                        TRACE( Print( 
+                            _L("[MEMORY MNGR]\t CCmMmQuotaListener::RunL \
+                            status = %d"), iStatus.Int() ) );
+
+                        // Wait 3 seconds and try again.
+                        RequestNotificationAfterTimeout( KTimeoutValue );
+                        break;
+                        }
+                    default:
+                        {
+                        TRACE( Print( 
+                            _L("[MEMORY MNGR]\t CCmMmQuotaListener::RunL \
+                            status = %d"), iStatus.Int() ) );
+
+                        // Request a notification when disk space crosses the
+                        // threshold value.
+                        RequestDiskSpaceNotification();
+                        break;
+                        }
+                    }                
+                }
+            }
+        }
+    else if( iProgressDialog )
+        {
+        LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::RunL ProgressDialog"));
+        iProgressDialog->CancelProgressDialog();
+        iProgressDialog = NULL;
+        RequestDiskSpaceNotification();
+        }
+    else
+        {
+        TRACE(Print(_L("[MEMORY MNGR]\t CCmMmQuotaListener:RunL: \
+            Drive not found!")));
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CCmMmQuotaListener::CCmMmQuotaListener( CCmDmMain& aDbManager, TInt aDrive )
+    : CActive( EPriorityStandard ),
+    iDrive( aDrive ),
+    iQuota( KCmMmcLowMemory ),
+    iDbManager( aDbManager )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmMmQuotaListener::ConstructL()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::ConstructL() start"));
+
+    User::LeaveIfError( iFileSession.Connect() );
+        
+    iHarvester = CMPXHarvesterFactory::NewL();
+
+    // Request a notification when disk space crosses the threshold 
+    // value.
+    RequestDiskSpaceNotification();
+
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::ConstructL() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::ReadResourceL
+// ---------------------------------------------------------------------------
+//
+HBufC16* CCmMmQuotaListener::ReadResourceL( TInt aResourceId )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::ReadReasourceL() start"));
+    TFileName rscFileName( KResourceFilePath );
+
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( iFileSession, rscFileName );
+        
+    TRACE( Print( _L("[MEMORY MNGR]\t Resource path = %s"), &rscFileName ) );
+    RResourceFile resourceFile;
+    TInt err( KErrNone );
+    TRAP(err, resourceFile.OpenL(iFileSession, rscFileName ))
+    if ( err != KErrNone )
+        {        
+        LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::Read from e"));
+        // not found? let's try mmc drive
+        rscFileName.Copy( PathInfo::MemoryCardRootPath() );
+        rscFileName.Delete(2, 2); // remove //
+        rscFileName.Append( KResourceFilePath );        
+        resourceFile.OpenL(iFileSession, rscFileName );
+        }
+    HBufC8* res = resourceFile.AllocReadLC( aResourceId );    
+    TResourceReader theReader;
+    theReader.SetBuffer(res);
+    HBufC16* des = theReader.ReadHBufC16L();
+    CleanupStack::PopAndDestroy( res );
+    resourceFile.Close();
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::ReadReasourceL() end"));
+    return des;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::ResolveAndAppendRootPath()
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmMmQuotaListener::ResolveAndAppendRootPathL( 
+    const TInt aDriveNumber )
+    {
+    HBufC* buf = HBufC::NewLC( 4 );
+    TChar driveChar;
+    iFileSession.DriveToChar( aDriveNumber, driveChar );
+    buf->Des().Append( driveChar );
+    buf->Des().Append( KCmColon );
+    buf->Des().Append( KCmDoubleBackSlash );
+    CleanupStack::Pop( buf );
+    return buf;    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::RequestNotificationAfterTimeout()
+// ---------------------------------------------------------------------------
+//
+void CCmMmQuotaListener::RequestNotificationAfterTimeout( TInt aTimeoutValue )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::\
+        RequestNotificationAfterTimeout()"));
+    TTimeIntervalMicroSeconds32 timeOut( aTimeoutValue );
+    RTimer timer;
+    timer.CreateLocal();
+    TRequestStatus status( KRequestPending );
+    timer.After( status, timeOut ); // Wait time defined by aTimeoutValue
+    User::WaitForRequest( status );
+    timer.Close();
+
+    // Request a notification when disk space crosses the threshold 
+    // value.
+    RequestDiskSpaceNotification();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::RequestDiskSpaceNotification()
+// ---------------------------------------------------------------------------
+//
+void CCmMmQuotaListener::RequestDiskSpaceNotification()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::\
+        RequestDiskSpaceNotification()"));
+    iFileSession.NotifyDiskSpace( iQuota, iDrive, iStatus );
+    SetActive();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::DeleteConfirmationL()
+// ---------------------------------------------------------------------------
+//
+TRequestStatus CCmMmQuotaListener::DeleteConfirmationL( 
+    const TDesC& aListName, 
+    TUint32 aListSize )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::DeleteConfirmationL()"));
+    // Get text for delete confirmation dialog
+    HBufC* format = ReadResourceL( R_MSERV_CONF_AUTO_REMOVE );
+    CleanupStack::PushL( format );
+
+    HBufC* tempName = aListName.AllocLC();
+        
+    // Create confirm note
+    HBufC* confirmNote = NULL;    
+    if ( aListName.Length() == 0 )
+        {
+        //reserve 1 character for empty list name
+        confirmNote = HBufC::NewLC( format->Length() +
+                                     1 + 
+                                     KSizeStringLength );
+        confirmNote->Des().Format( *format,
+                                   aListSize,
+                                   &KNullDesC() );
+        }
+    else
+        {
+        confirmNote = HBufC::NewLC( format->Length() +
+                                     aListName.Length() +
+                                     KSizeStringLength );
+        confirmNote->Des().Format( *format,
+                                   aListSize,
+                                   tempName );
+        }
+
+    // Show note to ask if it's ok to delete files.
+    CAknGlobalNote* note = CAknGlobalNote::NewLC();
+    TRequestStatus status = KRequestPending;
+    note->SetSoftkeys( R_AVKON_SOFTKEYS_YES_NO );
+    note->ShowNoteL( status,
+                     EAknGlobalInformationNote,
+                     *confirmNote );
+    User::WaitForRequest( status );
+
+    // Clean up
+    CleanupStack::PopAndDestroy( note );
+    CleanupStack::PopAndDestroy( confirmNote );
+    CleanupStack::PopAndDestroy( tempName );    
+    CleanupStack::PopAndDestroy( format );
+    
+    // Return the user selection.
+    return status;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::DeleteFilesL()
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmMmQuotaListener::DeleteFilesL( 
+    const RPointerArray<CCmFillListItem>& aArray,
+    const TDesC8& aListName
+    )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::DeleteFilesL()"));
+    // Get text for progress dialog
+    HBufC* format = ReadResourceL( R_MSERV_PROGRESS_REMOVE );
+    CleanupStack::PushL( format );
+
+    HBufC* listName = UpnpString::ToUnicodeL( aListName );
+    CleanupStack::PushL( listName );
+    
+    HBufC* progressNote = NULL;
+    if ( listName->Length() == 0 )
+        {
+        //reserve 1 character for empty list name
+        progressNote = HBufC::NewLC( format->Length() + 1 );
+        progressNote->Des().Format( *format,
+                                    &KNullDesC() );
+        }
+    else
+        {
+        progressNote = HBufC::NewLC( format->Length() +
+                                     listName->Length() );
+        progressNote->Des().Format( *format,
+                                    listName );
+        }
+
+    
+    // Show file deletion progress in a progress dialog.
+    iProgressDialog = CAknGlobalProgressDialog::NewL();
+    iProgressDialog->ShowProgressDialogL( iStatus,
+                                 *progressNote,
+                                 R_AVKON_SOFTKEYS_EMPTY,
+                                 aArray.Count() );
+
+    // Create files array for file paths
+    CDesC16Array* files =
+        new (ELeave) CDesC16ArrayFlat( aArray.Count() );
+    CleanupStack::PushL( files );
+
+    // Delete all items from current array
+    HBufC* temp( NULL );
+    TFileName path;
+    TUint32 sizes = 0;
+    
+    for ( TInt i = 0; i < aArray.Count(); i++ )
+        {
+        temp = ResolveAndAppendRootPathL( iDrive );
+        CleanupStack::PushL( temp );
+        path.Append( *temp );
+        path.Append( aArray[i]->Path() );
+        files->AppendL( path );
+        iFileSession.Delete( path );
+        CleanupStack::PopAndDestroy( temp );
+        path.Zero();
+        sizes += aArray[i]->Size();
+        TRACE(Print(_L("[MEMORY MNGR]\t CCmMmQuotaListener::DeleteFilesL \
+                        Deleted file %S, size %d"), 
+                    &aArray[i]->Path(), 
+                    aArray[i]->Size()));
+        iProgressDialog->UpdateProgressDialog( i, aArray.Count() - 1 );
+        }
+
+    TInt tes( KErrNone );
+    TRAP( tes, iDbManager.RestoreFileStatusesL( aArray,
+                                                aListName ) );
+    TRACE( Print( _L("[MEMORY MNGR]\t tes = %d "), tes ) );
+
+    MCLFContentListingEngine* clfEngine =
+                 ContentListingFactory::NewContentListingEngineLC();    
+    TRAP_IGNORE( clfEngine->UpdateItemsL() );
+    CleanupStack::PopAndDestroy();
+    
+    TRAP_IGNORE( iHarvester->RemoveFilesL( *files ) );
+
+    CleanupStack::PopAndDestroy( files );
+    iProgressDialog->ProcessFinished();
+    CleanupStack::PopAndDestroy( progressNote );
+    CleanupStack::PopAndDestroy( listName );
+    CleanupStack::PopAndDestroy( format );
+
+    return sizes;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmQuotaListener::RemoveExtraFiles()
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmMmQuotaListener::RemoveExtraFiles( 
+    RPointerArray<CCmFillListItem>& aArray, 
+    TInt64 aDeleteLimit ) const 
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::RemoveExtraFiles()"));
+    TUint32 listSize( 0 );
+    TInt lastIndex( 0 );
+    for ( TInt i = 0;
+          i < aArray.Count() && listSize <= aDeleteLimit; 
+          i++ )
+        {
+        listSize += ( aArray[i]->Size() / KMega );
+        lastIndex = i;
+        }
+
+    TRACE(Print(_L("[MEMORY MNGR]\t Deleting extra \
+        items...")));
+    for( TInt j = ( aArray.Count() - 1 ); 
+         j > lastIndex ; 
+         j-- )
+        {
+        delete aArray[j];
+        aArray.Remove( j );
+        }
+        
+    aArray.Compress();
+    return listSize;
+    }
+    
+// End of file    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmshrinker.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,525 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCmShrinker class in the Memory manager component
+*
+*/
+
+
+#include <e32std.h>
+#include <imageconversion.h> // CImageDecoder, CImageEncoder
+#include <bitmaptransforms.h> // CBitmapScaler
+#include <fbs.h> // CFbsBitmap
+#include <w32std.h> // RWsSession, CWsScreenDevice
+
+#include "cmdmmain.h"
+#include "msdebug.h"
+#include "cmmmimagemetadataresolver.h"
+#include "cmmmobserver.h"
+#include "cmmmshrinker.h"
+
+// CONSTANTS
+const TInt KScreenWidth = 128;
+const TInt KScreenHeight = 128;
+
+
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::NewL
+// ---------------------------------------------------------------------------
+//
+CCmMmShrinker* CCmMmShrinker::NewL( CCmDmMain& aDbManager )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::NewL() start"));
+    CCmMmShrinker* self = CCmMmShrinker::NewLC( aDbManager );
+    CleanupStack::Pop( self );
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::NewL() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::NewLC
+// ---------------------------------------------------------------------------
+//
+CCmMmShrinker* CCmMmShrinker::NewLC( CCmDmMain& aDbManager )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::NewLC() start"));
+    CCmMmShrinker* self = new ( ELeave ) CCmMmShrinker( aDbManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::NewLC() end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CCmMmShrinker::CCmMmShrinker( CCmDmMain& aDbManager ) :
+    CActive( EPriorityIdle ),
+    iShrinkIndex( 0 ),
+    iState( EIdle ),
+    iDbManager( aDbManager )
+    {
+    
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmMmShrinker::ConstructL()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::ConstructL() start"));
+
+    User::LeaveIfError( iFileSession.Connect() );
+    User::LeaveIfError( RFbsSession::Connect() );
+
+    // Get the screen size
+    iScreenSize = ScreenSizeL();
+    
+    iImageMetadataResolver = CCmMmImageMetadataResolver::NewL( iFileSession );
+
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::ConstructL() end"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// C++ destructor
+// ---------------------------------------------------------------------------
+//
+CCmMmShrinker::~CCmMmShrinker()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::~CCmMmShrinker() start"));
+    Cancel();
+    delete iBitmap;
+    iFileSession.Close();
+    
+    delete iBitmapScaler;
+    delete iFiles;
+    delete iImageDecoder;
+    delete iImageEncoder;
+    RFbsSession::Disconnect();
+    delete iImageMetadataResolver;
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::~CCmMmShrinker() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCmMmShrinker::DoCancel()
+    {
+    ClearShrinker();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::RunError
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+TInt CCmMmShrinker::RunError( TInt aError )
+#else //_DEBUG
+TInt CCmMmShrinker::RunError( TInt /*aError*/ )
+#endif // _DEBÚG
+    {
+    TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunError error = %d"),
+                                                             aError ));
+                                                                    
+    // NOTE!!!
+    // Should we continue from the next file, if there's error in the 
+    // middle of the shrinking operation
+    iShrinkIndex++;
+    iState = EIdle;
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::ShrinkImagesL
+// ---------------------------------------------------------------------------
+//
+void CCmMmShrinker::ShrinkImagesL( CDesCArray& aFiles )
+    {
+    // Cancel 1st
+    Cancel();
+    
+    // Add processed files 
+    if ( &aFiles )
+        {
+        delete iFiles; 
+        iFiles = NULL;
+        iFiles = new ( ELeave ) CDesC16ArrayFlat( aFiles.Count() );
+        for (TInt i = 0; i < aFiles.Count(); i++)
+            {
+            iFiles->AppendL( aFiles[i] );
+            }
+        }
+    // Start the action
+    iShrinkIndex = 0;
+    iState = EIdle;
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone);    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::SetObserver
+// ---------------------------------------------------------------------------
+//
+void CCmMmShrinker::SetObserver( MCmMmObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::RunL
+// ---------------------------------------------------------------------------
+//
+void CCmMmShrinker::RunL()
+    {
+    TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunL status = %d"),
+                                                             iStatus.Int() ));
+
+    // If all files have been processed, notify the observer.
+    if ( iShrinkIndex >= iFiles->Count() )
+        {
+        if ( iObserver )
+            {
+            iObserver->ShrinkCompleteL( KErrNone );
+            }
+        }
+    else 
+        {
+        if ( iState == EIdle )
+            {
+            const TDesC& origFilename = (*iFiles)[iShrinkIndex];
+            iImageMetadataResolver->CaptureOrginalMetadataL( origFilename );
+            // Check that file exists (entry is not actually used)
+            TEntry entry;
+            User::LeaveIfError( iFileSession.Entry( origFilename, entry ));
+            iStartTime.HomeTime();
+            CImageDecoder* imageDecoder = NULL;
+            TRAPD( error, 
+                   imageDecoder = CImageDecoder::FileNewL( 
+                        iFileSession,
+                        origFilename,
+                        CImageDecoder::EOptionNone ) );
+            if ( error )
+                {
+                if ( iObserver )
+                    {
+                    iObserver->ShrinkCompleteL( error );
+                    }
+                }
+            else
+            	{
+            	TUid imageType = KNullUid;
+	            TUid imageSubType = KNullUid;
+	            imageDecoder->ImageType( 0, imageType, imageSubType );
+
+	            if (  imageType == KImageTypeBMPUid )
+	                {
+	                iState = EScale;
+	                }
+	            else if ( imageType == KImageTypeGIFUid ||
+	                      imageType == KImageTypePNGUid ||
+	                      imageType == KImageTypeJPGUid )
+	                {
+	                iState = EDecode;
+	                }
+	            else
+	                {
+	                if ( iObserver )
+	                    {
+	                    iObserver->ShrinkCompleteL( KErrNone );
+	                    }
+	                }
+
+	            delete imageDecoder;
+	            imageDecoder = NULL;
+            	}
+            }
+
+        TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: status = %d"),
+            iStatus.Int() ));
+
+        switch ( iState )
+            {
+            case EDecode:
+                {
+                const TDesC& origFilename = (*iFiles)[iShrinkIndex];
+                TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: Decoding file \
+                    %S"), &origFilename ));
+
+                delete iImageDecoder;
+                iImageDecoder = NULL;
+                delete iBitmap;
+                iBitmap = NULL;
+
+                iImageDecoder = CImageDecoder::FileNewL( iFileSession,
+                                                         origFilename, CImageDecoder::EOptionNone );
+                iBitmap = new (ELeave) CFbsBitmap();
+                TInt error = iBitmap->Create(
+                    iImageDecoder->FrameInfo().iOverallSizeInPixels,
+                    iImageDecoder->FrameInfo().iFrameDisplayMode );
+                if ( error != KErrNone )
+                    {
+                    TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunL \
+                        error: %d"), error ));
+                    if ( iObserver )
+                        {
+                        TRACE(Print(_L("[MEMORY MNGR]\t Clearing shrinker" )));                        
+                        ClearShrinker();
+                        iObserver->ShrinkCompleteL( error );
+                        }
+                    Cancel();
+                    }
+                else 
+                    {
+                    iImageDecoder->Convert( &iStatus, *iBitmap );
+
+                    iState = EScale;
+                    SetActive();
+                    }
+                break;
+                }
+            case EScale:
+                {
+                const TDesC& origFilename = (*iFiles)[iShrinkIndex];
+                TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: Scaling file \
+                    %S"), &origFilename ));
+
+                // If converting is still ongoing we should continue it
+                if ( iStatus == KErrUnderflow )
+                    {
+                    TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: \
+    Still decoding file %S"), &origFilename ));
+                    iImageDecoder->ContinueConvert( &iStatus );
+                    SetActive();
+                    }
+                else 
+                    {
+                    delete iBitmapScaler;
+                    iBitmapScaler = NULL;
+                    iBitmapScaler = CBitmapScaler::NewL();
+
+                    iBitmapScaler->Scale( &iStatus, *iBitmap, iScreenSize );
+                    iState = EEncode;
+                    SetActive();
+
+                    delete iImageDecoder;
+                    iImageDecoder = NULL;
+                    }
+
+                break;
+                }
+            case EEncode:
+                {
+                const TDesC& origFilename = (*iFiles)[iShrinkIndex];
+                TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: Encoding file \
+                    %S"), &origFilename ));
+
+                delete iImageEncoder;
+                iImageEncoder = NULL;
+                
+                // Shrink into private directory
+                PrivatePath( iFileSession, iTempFilename, origFilename );
+                
+                // Check that if the file already exists somehow...
+                if ( iTempFilename == origFilename )
+                    {
+                    // Delete the original
+                    iFileSession.Delete( origFilename );
+                    }
+                iImageEncoder = CImageEncoder::FileNewL(
+                    iFileSession,
+                    iTempFilename,
+                    CImageEncoder::EOptionNone,
+                    KImageTypeJPGUid );
+
+                iImageEncoder->Convert( &iStatus, *iBitmap );
+                iState = EReplace;
+
+                SetActive();
+                break;
+                }
+            case EReplace:
+                {
+                const TDesC& origFilename = (*iFiles)[iShrinkIndex];
+                TRACE( Print(
+                    _L("[MEMORY MNGR]\t CCmMmShrinker: Replacing file %S"),
+                    &origFilename) );                                                 
+                                                        
+                TInt error = iFileSession.Replace( 
+                    iTempFilename, 
+                    origFilename );                                       
+                    
+                TRACE( Print(
+                    _L("[MEMORY MNGR]\t CCmMmShrinker: Replace done err: %d"),
+                    error ) );
+                    
+                // Resolve orginal image metadata!!!
+                TRAPD( mdError, iImageMetadataResolver->ResolveMetadataL(
+                        origFilename ) );
+                if( mdError )
+                    {
+                    TRACE( Print(
+                        _L("[MEMORY MNGR]\t Metadata resolving error : %d"),
+                        mdError ) );                    
+                    }
+                    
+                iStopTime.HomeTime();
+
+                TTimeIntervalMicroSeconds t =
+                    iStartTime.MicroSecondsFrom( iStopTime );
+                error =  iDbManager.IncrementShrinkTimeL(
+                    iFiles->Count(),
+                    iStartTime.MicroSecondsFrom( iStopTime ).Int64() / 1000 );
+                    
+                iState = EIdle;
+                iShrinkIndex++;
+                SetActive();
+                TRequestStatus* status = &iStatus;
+                User::RequestComplete( status, KErrNone );
+                break;
+                }
+            case EIdle:
+            	{
+            	TRACE( Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunL() \
+                Idle state")) );
+                break;
+                }
+            default:
+                {
+                TRACE( Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunL() \
+                Incorrect state")) );
+                if ( iObserver )
+                    {
+                    iObserver->ShrinkCompleteL( iStatus.Int() );
+                    }
+                Cancel();
+                break;
+                }
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::ScreenSizeL
+// ---------------------------------------------------------------------------
+//
+TSize CCmMmShrinker::ScreenSizeL()
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::ScreenSizeL() start"));
+
+    TSize screenSize( KScreenWidth, KScreenHeight );
+    RWsSession session;
+
+    TInt error = session.Connect() ;
+    CleanupClosePushL( session );
+    if ( !error )
+        {
+        CWsScreenDevice* screenDevice = 
+            new ( ELeave ) CWsScreenDevice( session );
+        if ( screenDevice && !screenDevice->Construct() )
+            {
+            TSize temp( KScreenWidth, KScreenHeight );
+            temp = screenDevice->SizeInPixels();
+            // Use landscape mode in shrinking
+            TRACE(Print(_L("[MEMORY MNGR]\t Image height = %d"),temp.iWidth));
+            TRACE(Print(_L("[MEMORY MNGR]\t Image width = %d"),temp.iHeight)); 
+            screenSize.iHeight = temp.iWidth;
+            screenSize.iWidth = temp.iHeight;
+            }
+        delete screenDevice;
+        screenDevice = NULL;
+        }
+
+    CleanupStack::PopAndDestroy( &session );
+
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::ScreenSizeL() end"));
+    return screenSize;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::PrivatePath
+// ---------------------------------------------------------------------------
+//   
+void CCmMmShrinker::PrivatePath( RFs& aFs, 
+                                 TFileName& aPrivatePath, 
+                                 const TFileName& aOriginal )
+    {
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::PrivatePath() start"));
+    
+    aPrivatePath.Zero();
+    
+    TParse nameParse;
+    nameParse.Set( aOriginal, NULL, NULL );
+        
+    aPrivatePath.Append( nameParse.Drive() );
+    TFileName privatePath;
+    TInt err = aFs.PrivatePath( privatePath );
+    if ( !err )
+        {
+        aPrivatePath.Append( privatePath );
+        
+        // Now the path contains everything but filename and extension
+        // => check that the directory exists. If not, it will be created.
+        // Possible error is ignored at the moment 
+        // (normal case is KErrAlreadyExists)
+        err = aFs.MkDirAll( aPrivatePath );
+        
+        
+        aPrivatePath.Append( nameParse.NameAndExt() );
+        }
+    LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::PrivatePath() end"));
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMmShrinker::ClearShrinker
+// ---------------------------------------------------------------------------
+//
+void CCmMmShrinker::ClearShrinker()
+    {
+    if ( iImageDecoder )
+        {
+        iImageDecoder->Cancel();
+        delete iImageDecoder;
+        iImageDecoder = NULL;
+        }
+    if ( iBitmapScaler )
+        {
+        iBitmapScaler->Cancel();
+        delete iBitmapScaler;
+        iBitmapScaler = NULL;        
+        }
+    if ( iImageEncoder )
+        {
+        iImageEncoder->Cancel();
+        delete iImageEncoder;
+        iImageEncoder = NULL;        
+        }
+    if( iBitmap )
+        {
+        delete iBitmap;
+        iBitmap = NULL;
+        }
+    }
+    
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/bwins/cmscheduleru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+	?NewL@CCmScheduler@@SAPAV1@AAVMCmServiceObserver@@AAVMCmSettings@@@Z @ 1 NONAME ; class CCmScheduler * CCmScheduler::NewL(class MCmServiceObserver &, class MCmSettings &)
+	?ServiceExecuted@CCmScheduler@@QAEXW4TCmService@@H@Z @ 2 NONAME ; void CCmScheduler::ServiceExecuted(enum TCmService, int)
+	?SetEnabledL@CCmScheduler@@QAEXH@Z @ 3 NONAME ; void CCmScheduler::SetEnabledL(int)
+	?SetScheduledServiceState@CCmScheduler@@QAEXH@Z @ 4 NONAME ; void CCmScheduler::SetScheduledServiceState(int)
+	?SetServiceToExecute@CCmScheduler@@QAEXW4TCmService@@@Z @ 5 NONAME ; void CCmScheduler::SetServiceToExecute(enum TCmService)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/eabi/cmscheduleru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	_ZN12CCmScheduler11SetEnabledLEi @ 1 NONAME
+	_ZN12CCmScheduler15ServiceExecutedE10TCmServicei @ 2 NONAME
+	_ZN12CCmScheduler19SetServiceToExecuteE10TCmService @ 3 NONAME
+	_ZN12CCmScheduler24SetScheduledServiceStateEi @ 4 NONAME
+	_ZN12CCmScheduler4NewLER18MCmServiceObserverR11MCmSettings @ 5 NONAME
+	_ZTI12CCmScheduler @ 6 NONAME ; #<TI>#
+	_ZTI17CCmCenrepNotifier @ 7 NONAME ; #<TI>#
+	_ZTI18CCmCommsDbNotifier @ 8 NONAME ; #<TI>#
+	_ZTV12CCmScheduler @ 9 NONAME ; #<VT>#
+	_ZTV17CCmCenrepNotifier @ 10 NONAME ; #<VT>#
+	_ZTV18CCmCommsDbNotifier @ 11 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for CM Scheduler
+*
+*/
+
+
+
+// Supported platforms
+prj_platforms
+DEFAULT
+
+// MMP files
+prj_mmpfiles
+cmscheduler.mmp
+
+// files to be exported
+prj_exports
+../inc/cmscheduler.h            |../../../../../inc/cmscheduler.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/group/cmscheduler.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project MyMediaWizard
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          cmscheduler.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10281FAF
+
+VENDORID        VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH  /sys/bin
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../mediaservant/inc
+USERINCLUDE     ../../cmserver/inc/server
+
+APP_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../../../../../inc
+
+SOURCEPATH      ../src
+
+SOURCE          cmscheduler.cpp
+SOURCE          cmcommsdbnotifier.cpp
+SOURCE          cmcenrepnotifier.cpp
+
+LIBRARY         euser.lib
+LIBRARY         connmon.lib
+LIBRARY         commdb.lib
+LIBRARY         apgrfx.lib
+LIBRARY         ws32.lib
+LIBRARY         cmsettingsengine.lib
+LIBRARY         centralrepository.lib   // cenrep notifier
+LIBRARY         ecom.lib
+LIBRARY         cmcommon.lib            // for wlan scan
+
+DEBUGLIBRARY    flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/inc/cmcenrepnotifier.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  central repository notifier class definition
+*
+*/
+
+
+#ifndef _CCMCENREPNOTIFIER_H
+#define _CCMCENREPNOTIFIER_H
+
+//  Include Files
+#include <d32dbms.h>
+
+// FORWARD DECLARATIONS
+class CRepository;
+class CCmScheduler;
+
+
+// CLASS DECLARATION
+
+/**
+ *  Comms database notifier class for scheduler
+ *  @lib cmscheduler.lib
+ *  @since S60 5.1
+ */
+class CCmCenrepNotifier : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         */
+        static CCmCenrepNotifier* NewL( CCmScheduler& aSheduler );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CCmCenrepNotifier();
+
+        /**
+         * Reads current profile from central repository
+         *
+         * @since S60 5.1
+         * @param aProfile, reference of current profile
+         * @return TInt, error code
+         */
+        TInt GetCurrentProfile( TInt& aProfile );
+
+    protected: // From CActive
+	
+        /**
+         * Called when request completes
+         *
+         * @since S60 5.1
+         */
+        void RunL();
+		
+        /**
+         * Called when request is cancelled
+         *
+         * @since S60 5.1
+         */
+        void DoCancel();
+		
+        /**
+         * Called when RunL leaves
+         *
+         * @since S60 5.1
+         */
+        TInt RunError(TInt aError);
+
+    private: // Constructors
+
+        /**
+         * Default constructor.
+         */
+        CCmCenrepNotifier( CCmScheduler& aSheduler );
+		
+        /**
+         * Two-phased constructor.
+         */
+        void ConstructL();
+
+        /**
+         * Initiates asyncronous notification request to database
+         *
+         * @since S60 5.1
+         */
+        void RequestNotification();
+
+    private:
+
+        /**
+         * Database to be monitored
+         */
+        CRepository*                    iRepository;    // owned
+		
+        /**
+         * Change observer
+         */
+        CCmScheduler&                   iScheduler;     // not owned
+    };
+
+#endif //  _CCMCENREPNOTIFIER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/inc/cmcommsdbnotifier.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Comms database notifier class definition
+*
+*/
+
+
+#ifndef _CCMCOMMSDBNOTIFIER_H
+#define _CCMCOMMSDBNOTIFIER_H
+
+//  Include Files
+#include <d32dbms.h>
+
+// FORWARD DECLARATIONS
+class CCommsDatabase;
+class CCmScheduler;
+
+// CLASS DECLARATION
+
+/**
+ *  Comms database notifier class for scheduler
+ *  @lib cmscheduler.lib
+ *  @since S60 5.1
+ */
+class CCmCommsDbNotifier : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         */
+        static CCmCommsDbNotifier* NewL( CCmScheduler& aSheduler );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CCmCommsDbNotifier();
+
+        /**
+         * Checks wlan scan state
+         *
+         * @since S60 5.1
+         * @return TBool, ETrue if value changed, EFalse otherwise
+         */
+        TBool HasScanStateChangedL();
+
+        /**
+         * Gets wlan scan interval setting value
+         *
+         * @since S60 5.1
+         * @return TUint32, scan interval
+         */
+        TUint32 WlanScanStateL();
+
+    protected: // From CActive
+	
+        /**
+         * Called when request completes
+         *
+         * @since S60 5.1
+         */
+        void RunL();
+		
+        /**
+         * Called when request is cancelled
+         *
+         * @since S60 5.1
+         */
+        void DoCancel();
+		
+        /**
+         * Called when RunL leaves
+         *
+         * @since S60 5.1
+         */
+        TInt RunError(TInt aError);
+
+    private: // Constructors
+
+        /**
+         * Default constructor.
+         */
+        CCmCommsDbNotifier( CCmScheduler& aSheduler );
+		
+        /**
+         * Two-phased constructor.
+         */
+        void ConstructL();
+
+        /**
+         * Initiates asyncronous notification request to database
+         *
+         * @since S60 5.1
+         */
+        void RequestNotification();
+
+    private:
+
+        /**
+         * Database to be monitored
+         */
+        CCommsDatabase*                 iDb;    // owned
+		
+        /**
+         * Change observer
+         */
+        CCmScheduler*                   iScheduler;  // not owned
+		
+        /**
+         * Previous scan state
+         */
+        TUint32                         iScanState;
+    };
+
+#endif //  _CCMCOMMSDBNOTIFIER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/inc/cmscheduler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,298 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main class in the CM Scheduler component
+*
+*/
+
+
+#ifndef _CMSCHEDULER_H
+#define _CMSCHEDULER_H
+
+#include <e32base.h>
+#include <rconnmon.h>
+#include "cmserver.h"
+#include "cmsettings.h"
+
+/* Forward declarations. */
+class CCmCommsDbNotifier;
+class CCmCenrepNotifier;
+class CCmSettingsEngine;
+class MCmSettings;
+
+/**
+ *  CCmScheduler class
+ *  Part of CM Scheduler
+ *  @lib cmscheduler.lib
+ *  @since S60 v5.1
+ */
+class CCmScheduler : public CActive,
+                     public MConnectionMonitorObserver
+    {
+    private: // Enumerations
+
+    // Scheduler states
+    enum TCmSchedulerState
+        {
+        ECmScStateOffline = 0,  // Don't start processing
+        ECmScStateOnline        // Start processing
+        };
+
+    public:  // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         */
+        IMPORT_C static CCmScheduler* NewL( MCmServiceObserver& aServer,
+                                   MCmSettings& aSettings );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CCmScheduler();
+
+        /**
+         * Enabled connection monitor events
+         *
+         * @since S60 5.1
+         * @param aEnable, ETrue if enabled, EFalse otherwise
+         */
+        void SetEnabledL( TBool aEnable );
+
+        /**
+         * Called when service is executed
+         *
+         * @since S60 5.1
+         * @param aService, executed service
+         * @param aErr, error code
+         */
+        IMPORT_C void ServiceExecuted( TCmService aService, TInt aErr );
+
+        /**
+         * Sets service where execution starts
+         *
+         * @since S60 5.1
+         * @param aService, service to be executed
+         */
+        IMPORT_C void SetServiceToExecute( TCmService aService );
+
+        /**
+         * Called by commsdb notifier when wlan scan state is changed
+         *
+         * @since S60 5.1
+         * @param aState, Scan interval
+         */
+        void WlanScanStateChanged( TInt aState );
+
+        /**
+         * Called by cenrep notifier when profile has been changed
+         *
+         * @since S60 5.1
+         * @param aProfile, current profile
+         */
+        void ProfileChangedL( TInt aProfile );
+
+        /**
+         * Sets scheduled service state
+         *
+         * @since S60 5.1
+         * @param TBool, ETrue = running
+         *               EFalse = not running
+         */
+        IMPORT_C void SetScheduledServiceState( TBool aState );
+
+
+    protected:
+
+    // From base class MConnectionMonitorObserver
+
+        /**
+         * From MConnectionMonitorObserver
+         * see base class definition
+         */
+        void EventL( const CConnMonEventBase &aConnMonEvent );
+
+     // From base class CActive
+
+        /**
+         * From CActive
+         * see base class definition
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         * see base class definition
+         */
+        void DoCancel();
+
+        /**
+         * From CActive
+         * see base class definition
+         */
+        TInt RunError( TInt aError );
+
+    private:
+
+        /**
+         * Tries to execute service
+         *
+         * @since S60 5.1
+         * @param aService, service to be executed
+         */
+        void TryToExecuteService( TCmService aService );
+
+        /**
+         * Tries to start timer
+         *
+         * @since S60 5.1
+         */
+        void TryToStartRetryTimer();
+
+        /**
+         * Cancels timer
+         *
+         * @since S60 5.1
+         */
+        void CancelTimer();
+
+        /**
+         * Handles connection event
+         *
+         * @since S60 5.1
+         * @param aConnMonEvent The event information.
+         */
+        void HandleConnectionEventL(
+                    const CConnMonEventBase& aConnMonEvent );
+
+        /**
+         * Checks if client application is running
+         *
+         * @since S60 5.1
+         * @return TBool, ETrue if running, EFalse otherwise
+         */
+        TBool ApplicationRunning();
+
+        /**
+         * Checks if iap is available
+         *
+         * @since S60 5.1
+         * @param aConnMonEvent The event information.
+         * @return TBool, ETrue if iap is available, EFalse otherwise
+         */
+        TBool CheckIapAvailabilityL(
+                        const CConnMonEventBase& aConnMonEvent );
+
+	private:
+
+        /**
+         * C++ default constructor.
+         */
+        CCmScheduler( MCmServiceObserver& aServer,
+                      MCmSettings& aSettings );
+
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         */
+        void ConstructL();
+
+    private:
+
+        /**
+         * Service observer
+         */
+        MCmServiceObserver&                     iServer;
+		
+        /**
+         * Settings handler
+         */
+        MCmSettings&                            iSettings;
+		
+        /**
+         * Service state
+         */
+        TBool                                   iScheduledServiceRunning;
+		
+        /**
+         * Connection monitor state
+         */
+        TBool                                   iEnabled;
+		
+        /**
+         * Scheduler state
+         */
+        TCmSchedulerState                       iState;
+		
+        /**
+         * Timer counter
+         */
+        TInt                                    iTimerCount;
+		
+        /**
+         * Service to be executed
+         */
+        TCmService                              iServiceToExecute;
+		
+        /**
+         * Harvest execution flag
+         */
+        TBool                                   iExecuteHarvest;
+		
+        /**
+         * Scheduler started operation
+         */
+        TBool                                   iSchedulerInitiated;
+		
+        /**
+         * Connection monitor
+         */
+        RConnectionMonitor                      iConnMon;
+		
+        /**
+         * Timer for service execution
+         */
+        RTimer                                  iTimer;
+		
+        /**
+         * Comms database notifier
+         */
+        CCmCommsDbNotifier*                     iNotifier;           // owned
+		
+        /**
+         * Cenral repository notifier
+         */
+        CCmCenrepNotifier*                      iRepositoryNotifier; // owned
+		
+        /**
+         * Current profile
+         */
+        TInt                                    iCurrentProfile;
+		
+        /**
+         * Wlan scan state
+         */
+        TInt                                    iWlanScanState;
+		
+        /**
+         * Store preprocessing flag
+         */
+        TBool                                   iStorePreprocessed;
+		
+        /**
+         * Last sync time
+         */
+        TTime                                   iLastSyncTime;
+    };
+
+
+#endif //  _CMSCHEDULER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/src/cmcenrepnotifier.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Checks if wlan scan state changes and informs observer of it
+*
+*/
+
+
+//  Include Files
+#include <centralrepository.h>
+#include <ProfileEngineSDKCRKeys.h>
+#include "cmscheduler.h"
+#include "cmcenrepnotifier.h"
+#include "msdebug.h"
+
+// Two-phased constructor.
+CCmCenrepNotifier* CCmCenrepNotifier::NewL( CCmScheduler& aScheduler )
+    {
+    CCmCenrepNotifier* self = new (ELeave) CCmCenrepNotifier( aScheduler );
+
+    CleanupStack::PushL( self );
+    CActiveScheduler::Add( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+}
+
+void CCmCenrepNotifier::ConstructL()
+    {
+    // open central repository
+    iRepository = CRepository::NewL( KCRUidProfileEngine );
+    // assign notification request
+    RequestNotification();
+    }
+
+// --------------------------------------------------------------------------
+// CCmCenrepNotifier::CCmCenrepNotifier
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CCmCenrepNotifier::CCmCenrepNotifier( CCmScheduler& aScheduler ) :
+    CActive( CActive::EPriorityStandard ), iScheduler( aScheduler )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::CCmCenrepNotifier()"));
+    }
+
+// Destructor
+CCmCenrepNotifier::~CCmCenrepNotifier()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::~CCmCenrepNotifier()"));
+
+    Cancel();
+    delete iRepository;
+    }
+
+// --------------------------------------------------------------------------
+// CCmCenrepNotifier::RequestNotification
+// Requests database notification
+// --------------------------------------------------------------------------
+//
+void CCmCenrepNotifier::RequestNotification()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::RequestNotification()"));
+    if ( !IsActive() )
+        {
+        iRepository->NotifyRequest( KProEngActiveProfile, iStatus );
+        SetActive();
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmCenrepNotifier::DoCancel
+// --------------------------------------------------------------------------
+//
+void CCmCenrepNotifier::DoCancel()
+    {
+    // cancel possible requests
+    iRepository->NotifyCancelAll();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmCenrepNotifier::RunL
+// Called when change in database occurs
+// ---------------------------------------------------------------------------
+//
+void CCmCenrepNotifier::RunL()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::RunL()"));
+
+    // Get ID of current profile
+    TInt profile( 0 );
+    User::LeaveIfError( GetCurrentProfile( profile ) );
+
+    iScheduler.ProfileChangedL( profile );
+
+    // Assign new request
+    RequestNotification();
+    }
+
+// --------------------------------------------------------------------------
+// CCmCenrepNotifier::RunError
+// Called if RunL leaves
+// --------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+TInt CCmCenrepNotifier::RunError( TInt aError )
+#else // _DEBUG
+TInt CCmCenrepNotifier::RunError( TInt /*aError*/ )
+#endif // _DEBUG
+    {
+    TRACE(Print(_L("[Cm Scheduler]\t \
+    CCmCenrepNotifier::RunError errorcode = %d"), aError));
+
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CCmCenrepNotifier::GetCurrentProfile
+// --------------------------------------------------------------------------
+//
+TInt CCmCenrepNotifier::GetCurrentProfile( TInt& aProfile )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::GetCurrentProfile()"));
+
+    return iRepository->Get( KProEngActiveProfile, aProfile );
+    }
+	
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/src/cmcommsdbnotifier.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Checks if wlan scan state changes and informs observer of it
+*
+*/
+
+
+//  Include Files
+#include <commdb.h>
+#include <d32dbms.h>
+#include <WlanCdbCols.h>
+#include <wlanmgmtclient.h>
+#include "cmcommsdbnotifier.h"
+#include "cmscheduler.h"
+#include "msdebug.h"
+
+// Two-phased constructor.
+CCmCommsDbNotifier* CCmCommsDbNotifier::NewL( CCmScheduler& aScheduler )
+    {
+    CCmCommsDbNotifier* self = new (ELeave) CCmCommsDbNotifier( aScheduler );
+
+    CleanupStack::PushL( self );
+    CActiveScheduler::Add( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+}
+
+void CCmCommsDbNotifier::ConstructL()
+    {
+    // open comms database
+    iDb = CCommsDatabase::NewL();
+    // assign notification request
+    RequestNotification();
+    }
+
+// --------------------------------------------------------------------------
+// CCmCommsDbNotifier::CCmCommsDbNotifier
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CCmCommsDbNotifier::CCmCommsDbNotifier( CCmScheduler& aScheduler ) :
+    CActive( CActive::EPriorityStandard )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::CCmCommsDbNotifier()"));
+
+    // Scheduler reads scan interval on construction, so we can
+    // assume it's off
+    // now
+    iScanState = 0;
+    iScheduler = &aScheduler;
+    }
+
+// Destructor
+CCmCommsDbNotifier::~CCmCommsDbNotifier()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::~CCmCommsDbNotifier()"));
+
+    Cancel();
+
+    delete iDb;
+    }
+
+// --------------------------------------------------------------------------
+// CCmCommsDbNotifier::RequestNotification
+// Requests database notification
+// --------------------------------------------------------------------------
+//
+void CCmCommsDbNotifier::RequestNotification()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::RequestNotification()"));
+    if ( !IsActive() )
+        {
+        iDb->RequestNotification( iStatus );
+        SetActive();
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmCommsDbNotifier::DoCancel
+// --------------------------------------------------------------------------
+//
+void CCmCommsDbNotifier::DoCancel()
+    {
+    // cancel possible requests
+    iDb->CancelRequestNotification();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmCommsDbNotifier::RunL
+// Called when change in database occurs
+// ---------------------------------------------------------------------------
+//
+void CCmCommsDbNotifier::RunL()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::RunL()"));
+
+    if ( iScheduler &&
+         iStatus.Int() == RDbNotifier::ECommit &&
+         HasScanStateChangedL() )
+        {
+        iScheduler->WlanScanStateChanged( iScanState );
+        }
+
+    // Assign new request
+    RequestNotification();
+    }
+
+// --------------------------------------------------------------------------
+// CCmCommsDbNotifier::RunError
+// Called if RunL leaves
+// --------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+TInt CCmCommsDbNotifier::RunError( TInt aError )
+#else // _DEBUG
+TInt CCmCommsDbNotifier::RunError( TInt /*aError*/ )
+#endif // _DEBUG
+
+    {
+    TRACE(Print(_L("[Cm Scheduler]\t \
+    CCmCommsDbNotifier::RunError errorcode = %d"), aError));
+
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CCmCommsDbNotifier::HasScanStateChangedL
+// Checks if wlan scanning interval has been changed
+// --------------------------------------------------------------------------
+//
+TBool CCmCommsDbNotifier::HasScanStateChangedL()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::HasScanStateChangedL"));
+
+    TBool status( EFalse );
+
+    TUint32 scanState = WlanScanStateL();
+
+    if ( iScanState != scanState )
+        {
+        // value changed
+        iScanState = scanState;
+        status = ETrue;
+        }
+    else
+        {
+        // value not changed
+        status = EFalse;
+        }
+
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CCmCommsDbNotifier::WlanScanStateL
+// Returns state of wlan scan interval setting
+// --------------------------------------------------------------------------
+//
+TUint32 CCmCommsDbNotifier::WlanScanStateL()
+    {
+    TUint32 scanState( 0 );
+
+#ifndef __WINS__
+
+    // open wlan table
+    CCommsDbTableView* view = iDb->OpenViewMatchingUintLC
+        (
+        TPtrC( WLAN_DEVICE_SETTINGS ),
+        TPtrC( WLAN_DEVICE_SETTINGS_TYPE ), KWlanUserSettings
+        );
+
+    User::LeaveIfError( view->GotoFirstRecord() );
+
+    // read scanning interval
+    view->ReadUintL( TPtrC( WLAN_BG_SCAN_INTERVAL ),
+                     scanState );
+
+    TRACE(Print(_L("[Cm Scheduler]\t CCmCommsDbNotifier::prev: %d, \
+                scan :%d"), iScanState, scanState ));
+
+
+    CleanupStack::PopAndDestroy( view );
+
+#endif
+
+    return scanState;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmscheduler/src/cmscheduler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,646 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Manager server's scheduler component
+*
+*/
+
+
+// INCLUDE FILES
+#include <apgtask.h>
+
+#include "cmsettings.h"
+#include "cmcommonutils.h"
+#include "cmscheduler.h"
+#include "mediaservantuid.h"
+#include "cmcommsdbnotifier.h"
+#include "cmcenrepnotifier.h"
+#include "msdebug.h"
+
+// WLAN scanning interval [s]
+const TInt
+    KTimerInterval = 30 * 60 * 1000 * 1000; // 30 minutes in microseconds
+const TInt KTimerCount = 2; // KTimerCount*KTimerInterval = 1 hour
+const TUid KMediaServantUid = { KMediaServantUID3 }; // application uid
+const TInt KOfflineProfile = 5; // offline profile identifier
+
+// ========================== MEMBER FUNCTIONS ===============================
+
+// Two-phased constructor.
+EXPORT_C CCmScheduler* CCmScheduler::NewL(
+    MCmServiceObserver& aServer, MCmSettings& aSettings)
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::NewL"));
+    CCmScheduler* self = new ( ELeave )
+        CCmScheduler( aServer, aSettings );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CCmScheduler::~CCmScheduler()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::~CCmScheduler"));
+
+    Cancel();
+    delete iNotifier;
+    delete iRepositoryNotifier;
+    iConnMon.CancelNotifications();
+    iConnMon.Close();
+    iTimer.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::CCmScheduler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CCmScheduler::CCmScheduler(
+    MCmServiceObserver& aServer, MCmSettings& aSettings)
+    : CActive( EPriorityStandard ),
+    iServer( aServer ), iSettings( aSettings ),
+    iScheduledServiceRunning( EFalse ), iEnabled( ETrue ),
+    iState( ECmScStateOffline ), iTimerCount( 0 ),
+    iServiceToExecute( ECmServicePreProcessingStore ),
+    iExecuteHarvest( ETrue ), iSchedulerInitiated( EFalse )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::CCmScheduler()"));
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::ConstructL()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL"));
+
+    // Ensure that iap is set. Otherwise scheduler cannot be used
+#ifdef __DEBUG
+    TInt iap( 0 );
+    User::LeaveIfError( iSettings.GetIapL( iap ) );
+    TRACE( Print( _L("[Cm Scheduler]\t IAP to use is  %d"), iap));
+#endif
+
+    User::LeaveIfError( iTimer.CreateLocal() );
+    CActiveScheduler::Add( this );
+    iEnabled = EFalse;
+
+    iRepositoryNotifier = CCmCenrepNotifier::NewL( *this );
+    User::LeaveIfError( iRepositoryNotifier->GetCurrentProfile(
+                        iCurrentProfile ) );
+
+    // create commsdb notifier
+    TRAPD( error, iNotifier = CCmCommsDbNotifier::NewL( *this ) );
+
+    if ( !error )
+        {
+        iWlanScanState = iNotifier->WlanScanStateL();
+        }
+    else
+        {
+        TRACE( Print( _L("[Cm Scheduler]\t CCmScheduler::ConstructL \
+        error = %d"), error));
+        }
+
+    // check that mc is not in offline mode
+    if ( iCurrentProfile != KOfflineProfile )
+        {
+        iState = ECmScStateOnline;
+        if ( error == KErrNone )
+            {
+            // We assume that scan is off.
+            // State is checked and if it is on wlan events can be used.
+            if ( iNotifier->HasScanStateChangedL() )
+                {
+                LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL() \
+                    Scanning state changed on"));
+                // scanning is on
+                SetEnabledL( ETrue );
+                }
+
+            else
+                {
+                LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL() \
+                    Scanning state is off - starting timer"));
+                // scanning is off - use timer
+                TryToStartRetryTimer();
+                }
+            }
+        else
+            {
+            LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL() \
+                Notifier creation failed"));
+            // if notifier cannot be created we start the timer
+            TryToStartRetryTimer();
+            }
+        }
+    else
+        {
+        LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL() \
+            profile = offline"));
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::EventL()
+// Called when an event arrives to connection monitor
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::EventL( const CConnMonEventBase& aConnMonEvent )
+    {
+    TRACE(Print(_L("[Cm Scheduler]\t CCmScheduler::EventL() \
+        eventtype = %d, connection id = %d"),
+        aConnMonEvent.EventType(), aConnMonEvent.ConnectionId()));
+
+    TTime currentTime;
+    currentTime.HomeTime();
+
+    TTimeIntervalHours interval;
+    currentTime.HoursFrom( iLastSyncTime, interval );
+
+    TRACE(Print(_L("[Cm Scheduler]\t CCmScheduler::EventL() \
+	    hours from last sync = %d"), interval.Int()));
+
+    if ( interval.Int() >= 1 && !ApplicationRunning() )
+        {
+        HandleConnectionEventL( aConnMonEvent );
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::HandleConnectionEventL()
+// Handles connection event
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::HandleConnectionEventL(
+                            const CConnMonEventBase& aConnMonEvent )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::HandleConnectionEventL() \
+	    HandleConnectionEventL"));
+
+    if ( aConnMonEvent.EventType() == EConnMonIapAvailabilityChange )
+        {
+        LOG(_L("[Cm Scheduler]\t CCmScheduler::HandleConnectionEventL() \
+            EConnMonIapAvailabilityChange"));
+
+        TCmSchedulerState newState = ECmScStateOffline;
+
+        if ( CheckIapAvailabilityL( aConnMonEvent ) )
+            {
+            newState = ECmScStateOnline;
+            }
+
+        if ( newState != iState )
+            {
+            iState = newState;
+
+            if ( newState && !iScheduledServiceRunning )
+                {
+                LOG(_L("[Cm Scheduler]\t State changed to online,\
+                    starting operation.."));
+                iSchedulerInitiated = ETrue;// do also harvest
+                TRACE( Print( _L("[Cm Scheduler]\t HandleConnectionEventL \
+                    iSchedulerInitiated = %d"), iSchedulerInitiated));
+                iExecuteHarvest = ETrue;
+                TRACE( Print( _L("[Cm Scheduler]\t HandleConnectionEventL \
+                    iExecuteHarvest = %d"), iExecuteHarvest));
+                TryToExecuteService( iServiceToExecute );
+                }
+            else
+                {
+                LOG(_L("[Cm Scheduler]\t State changed to offline,\
+                    canceling timer.."));
+                CancelTimer();
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::RunL()
+// Called when the timer elapses
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::RunL()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::RunL()"));
+    TRACE( Print( _L("[Cm Scheduler]\t status %d"), iStatus.Int() ));
+    TRACE( Print( _L("[Cm Scheduler]\t state %d"), iState ));
+
+    if ( KErrNone == iStatus.Int() &&
+         iState == ECmScStateOnline &&
+         !iScheduledServiceRunning )
+        {
+        if ( ++iTimerCount >= KTimerCount && !ApplicationRunning() )
+            {
+            LOG(_L("[Cm Scheduler]\t Online timer passed, \
+                starting operation.."));
+            iSchedulerInitiated = ETrue;// do also harvest
+            TRACE( Print( _L("[Cm Scheduler]\t RunL \
+                iSchedulerInitiated = %d"), iSchedulerInitiated));
+            iExecuteHarvest = ETrue;
+            TRACE( Print( _L("[Cm Scheduler]\t RunL \
+                iExecuteHarvest = %d"), iExecuteHarvest));
+            TryToExecuteService( iServiceToExecute );
+            }
+        else
+            {
+            iTimer.After( iStatus,
+                TTimeIntervalMicroSeconds32( KTimerInterval ) );
+            SetActive();
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::TryToExecuteService()
+// Starts process if application is not running
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::TryToExecuteService( TCmService aService )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::TryToExecuteService()"));
+    TInt err = KErrNone;
+
+    TRAP( err, iServer.ExecuteServiceL( aService ));
+    iScheduledServiceRunning = !err;
+
+    if ( !err && aService == ECmServicePreProcessingStore )
+        {
+        iStorePreprocessed = EFalse;
+        }
+
+    TRACE( Print( _L("[Cm Scheduler]\t ExecuteServiceL err: %d"), err));
+
+    if ( err )
+        {
+        TryToStartRetryTimer();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::TryToStartRetryTimer()
+// Starts timer if not already active
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::TryToStartRetryTimer()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::TryToStartRetryTimer()"));
+
+    if ( !IsActive() )
+        {
+        LOG(_L("[Cm Scheduler]\t starting one hour resync timer.."));
+
+        CancelTimer();
+
+        iTimer.After(
+                iStatus, TTimeIntervalMicroSeconds32( KTimerInterval ));
+        SetActive();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::CancelTimer()
+// Cancels timer
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::CancelTimer()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::CancelTimer"));
+
+    iTimer.Cancel();
+    iTimerCount = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::SetEnabledL()
+// Enabled/disabled connection monitor events
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmScheduler::SetEnabledL( TBool aEnable )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::SetEnabled()"));
+    if ( iEnabled != aEnable )
+        {
+        iEnabled = aEnable;
+        if ( iEnabled )
+            {
+            LOG(_L("[Cm Scheduler]\t enabling scheduler.."));
+            LOG(_L("[Cm Scheduler]\t starting to listen wlan events.."));
+            User::LeaveIfError( iConnMon.ConnectL() );
+            iConnMon.NotifyEventL( *this );
+
+            }
+         else // iConnMon is connected when entering here...
+            {
+            LOG(_L("[Cm Scheduler]\t disabling scheduler.."));
+
+            iConnMon.CancelNotifications();
+            iConnMon.Close();
+
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::SetServiceToExecute
+// Sets service to be executed
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmScheduler::SetServiceToExecute( TCmService aService )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::SetServiceToExecute()"));
+    iServiceToExecute = aService;
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::ServiceExecuted
+// Called when service is ready
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmScheduler::ServiceExecuted( TCmService aService, TInt aErr )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::ServiceExecuted()"));
+    TRACE( Print( _L("[Cm Scheduler]\t service %d err %d"),
+        aService, aErr));
+
+    if ( !iScheduledServiceRunning )
+        {
+        LOG(_L("[Cm Scheduler]\t No scheduled service running, returning"));
+        return;
+        }
+
+    iScheduledServiceRunning = EFalse;
+    TBool startRetryTimer( EFalse );
+    if ( aErr )
+        {
+        startRetryTimer = ETrue;
+        }
+    else
+        {
+        switch ( aService )
+            {
+            case ECmServicePreProcessingStore:
+                {
+                if ( iStorePreprocessed == EFalse )
+                    {
+                    iStorePreprocessed = ETrue;
+                    TryToExecuteService( ECmServiceStore );
+                    }
+                else
+                    {
+                    iLastSyncTime.HomeTime();
+                    startRetryTimer = ETrue;
+                    iSchedulerInitiated = EFalse;
+                    }
+                break;
+                }
+            case ECmServiceStore:
+                {
+                // execute fill
+                TryToExecuteService( ECmServiceFill );
+                break;
+                }
+
+            case ECmServiceFill:
+                {
+                if ( iExecuteHarvest )
+                    {
+                    TRACE( Print( _L("[Cm Scheduler]\t serviceexecuted \
+                        harvest %d schedulerinitiated %d"),
+                        iExecuteHarvest, iSchedulerInitiated));
+                    // execute harvest
+                    TryToExecuteService( ECmServiceHarvest );
+                    }
+                else
+                    {
+                    LOG(_L("[Cm Scheduler]\t CCmScheduler::ServiceExecuted \
+                        ExecuteHarvest = EFalse"));
+                    startRetryTimer = ETrue;
+                    iLastSyncTime.HomeTime();
+                    iSchedulerInitiated = EFalse;
+                    TRACE( Print( _L("[Cm Scheduler]\t ServiceExecuted \
+                         iSchedulerInitiated = %d"), iSchedulerInitiated));
+                    }
+                break;
+                }
+
+            case ECmServiceHarvest:
+            // fall through
+            case ECmServicePreProcessingFill:
+                {
+                iSchedulerInitiated = EFalse;
+                TRACE( Print( _L("[Cm Scheduler]\t ServiceExecuted \
+                    iSchedulerInitiated = %d"), iSchedulerInitiated));
+                startRetryTimer = ETrue;
+                iLastSyncTime.HomeTime();
+                break;
+                }
+
+            default:
+                {
+                LOG(_L("[Cm Scheduler]\t default"));
+                break;
+                }
+            }
+
+        }
+    if ( startRetryTimer )
+        {
+        TryToStartRetryTimer();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::DoCancel
+// Called by framework when timer is cancelled
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::DoCancel()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::DoCancel()"));
+
+    CancelTimer();
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::WlanScanStateChanged
+// starts/disables timer and connection monitor events depending on state
+// of wlan scanning interval
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::WlanScanStateChanged( TInt aState )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::WlanScanStateChanged()"));
+
+    iWlanScanState = aState;
+
+    if ( iCurrentProfile != KOfflineProfile )
+        {
+        if ( aState == KWlanScanNetworkNever )
+            {
+            TRAP_IGNORE( SetEnabledL( EFalse ) );
+            // state is set online so we can try start process
+            iState = ECmScStateOnline;
+            TryToStartRetryTimer();
+            }
+        else
+            {
+            // cancel timer
+            CancelTimer();
+
+            TRAP_IGNORE( SetEnabledL( ETrue ) );
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmScheduler::ProfileChangedL
+// --------------------------------------------------------------------------
+//
+void CCmScheduler::ProfileChangedL( TInt aProfile )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::ProfileChangedL()"));
+
+    if ( aProfile == KOfflineProfile )
+        {
+        LOG(_L("[Cm Scheduler]\t CCmScheduler::ProfileChangedL() \
+            offline"));
+
+        iCurrentProfile = aProfile;
+
+        // disable wlan scanning
+        CmCommonUtils::SetWlanScanL( KWlanScanNetworkNever );
+
+        // stop receiving events
+        SetEnabledL( EFalse );
+        // cancel timer
+        CancelTimer();
+        }
+    else if ( iCurrentProfile == KOfflineProfile )
+        {
+        LOG(_L("[Cm Scheduler]\t CCmScheduler::ProfileChangedL() \
+            online"));
+
+        iCurrentProfile = aProfile;
+
+        // enable wlan scanning
+        CmCommonUtils::SetWlanScanL( KWlanScanNetworkInterval60 );
+
+        if ( iWlanScanState )
+            {
+            SetEnabledL( ETrue );
+            }
+        else
+            {
+            TryToStartRetryTimer();
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::SetScheduledServiceState
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmScheduler::SetScheduledServiceState( TBool aState )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::SetScheduledServiceState()"));
+
+    iScheduledServiceRunning = aState;
+    // we don't want to make second round
+    iStorePreprocessed = ETrue;
+    // This function is called when application transfers responsibility
+    // to scheduler. In this case we don't want to do harvest.
+    if ( !iSchedulerInitiated )
+        {
+        LOG(_L("[Cm Scheduler]\t CCmScheduler::SetScheduledServiceState() \
+            iSchedulerInitiated = EFalse"));
+        iExecuteHarvest = EFalse;
+        TRACE( Print( _L("[Cm Scheduler]\t SetScheduledServiceState \
+            iExecuteHarvest = %d"), iExecuteHarvest));
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::RunError
+// --------------------------------------------------------------------------
+//
+TInt CCmScheduler::RunError( TInt aError )
+    {
+    TRACE( Print( _L("[Cm Scheduler]\t CCmScheduler::RunError \
+        error = %d"), aError));
+
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::ApplicationRunning
+// --------------------------------------------------------------------------
+//
+TBool CCmScheduler::ApplicationRunning()
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::ApplicationRunning()"));
+
+    TBool mediaServantRunning( EFalse );
+    RWsSession wsSession;
+    TInt err = wsSession.Connect();
+    if ( !err )
+        {
+        TApaTaskList taskList( wsSession );
+        mediaServantRunning = taskList.FindApp( KMediaServantUid ).Exists();
+        wsSession.Close();
+        }
+    return mediaServantRunning;
+    }
+
+// --------------------------------------------------------------------------
+// CCmScheduler::CheckIapAvailabilityL()
+// --------------------------------------------------------------------------
+//
+TBool CCmScheduler::CheckIapAvailabilityL(
+                            const CConnMonEventBase& aConnMonEvent )
+    {
+    LOG(_L("[Cm Scheduler]\t CCmScheduler::CheckIapAvailabilityL()"));
+
+    TBool iapFound( EFalse );
+    TInt accessPoint( -1 );
+    User::LeaveIfError( iSettings.GetIapL( accessPoint ) );
+    TRACE( Print( _L("[Cm Scheduler]\t \
+        IAP to use is  %d"), accessPoint));
+
+    CConnMonIapAvailabilityChange* eventIap =
+                    ( CConnMonIapAvailabilityChange* ) &aConnMonEvent;
+
+    TConnMonIapInfo iaps = eventIap->IapAvailability();
+
+    for ( TInt i = 0; i < iaps.iCount; i++ )
+        {
+        // Compare available IAPs to our IAP
+        TRACE( Print( _L("[Cm Scheduler]\t CONNMON iap: %d"),
+            iaps.iIap[i].iIapId));
+        if ( accessPoint == iaps.iIap[i].iIapId )
+            {
+            LOG(_L("[Cm Scheduler]\t FOUND CORRECT IAP!"));
+            iapFound = ETrue;
+            i = iaps.iCount;
+            }
+        }
+    return iapFound;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/bwins/cmclientu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+EXPORTS
+	??0RContentManager@@QAE@XZ @ 1 NONAME ; RContentManager::RContentManager(void)
+	?AppWizardState@RContentManager@@QBEHXZ @ 2 NONAME ; int RContentManager::AppWizardState(void) const
+	?ApplicationExit@RContentManager@@QAEXXZ @ 3 NONAME ; void RContentManager::ApplicationExit(void)
+	?Cancel@RContentManager@@QAEXXZ @ 4 NONAME ; void RContentManager::Cancel(void)
+	?Close@RContentManager@@QAEHXZ @ 5 NONAME ; int RContentManager::Close(void)
+	?Connect@RContentManager@@QAEHXZ @ 6 NONAME ; int RContentManager::Connect(void)
+	?DeleteDeletedMediaserversL@RContentManager@@QAEXXZ @ 7 NONAME ; void RContentManager::DeleteDeletedMediaserversL(void)
+	?DeleteMetadataL@RContentManager@@QAEXAAVTRequestStatus@@@Z @ 8 NONAME ; void RContentManager::DeleteMetadataL(class TRequestStatus &)
+	?DriveSelectionStatus@RContentManager@@QAEHXZ @ 9 NONAME ; int RContentManager::DriveSelectionStatus(void)
+	?ExecuteService@RContentManager@@QAEHW4TCmService@@AAVTRequestStatus@@@Z @ 10 NONAME ; int RContentManager::ExecuteService(enum TCmService, class TRequestStatus &)
+	?FillRulesL@RContentManager@@QAEPAVCCmFillRuleContainer@@XZ @ 11 NONAME ; class CCmFillRuleContainer * RContentManager::FillRulesL(void)
+	?GetDrivesL@RContentManager@@QAEXAAV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 12 NONAME ; void RContentManager::GetDrivesL(class RPointerArray<class CCmDriveInfo> &)
+	?GetFilteredMetadataL@RContentManager@@QAEHW4TCmService@@AAPAVCCmSqlPropertyCollector@@AAVTRequestStatus@@@Z @ 13 NONAME ; int RContentManager::GetFilteredMetadataL(enum TCmService, class CCmSqlPropertyCollector * &, class TRequestStatus &)
+	?GetItemCountsL@RContentManager@@QBEHW4TCmService@@ABVTDesC8@@AAHAA_J@Z @ 14 NONAME ; int RContentManager::GetItemCountsL(enum TCmService, class TDesC8 const &, int &, long long &) const
+	?GetTransferInfo@RContentManager@@QBEXW4TCmService@@AAH1@Z @ 15 NONAME ; void RContentManager::GetTransferInfo(enum TCmService, int &, int &) const
+	?LastSyncTime@RContentManager@@QBE?AVTTime@@XZ @ 16 NONAME ; class TTime RContentManager::LastSyncTime(void) const
+	?ListItemsL@RContentManager@@QAEPAV?$RPointerArray@VCCmBaseListItem@@@@ABVTDesC8@@W4TCmService@@@Z @ 17 NONAME ; class RPointerArray<class CCmBaseListItem> * RContentManager::ListItemsL(class TDesC8 const &, enum TCmService)
+	?MediaserversL@RContentManager@@QBEPAV?$RPointerArray@VCCmMediaServerFull@@@@XZ @ 18 NONAME ; class RPointerArray<class CCmMediaServerFull> * RContentManager::MediaserversL(void) const
+	?PreProcessFillList@RContentManager@@QAEHABVTDesC8@@AAVTRequestStatus@@@Z @ 19 NONAME ; int RContentManager::PreProcessFillList(class TDesC8 const &, class TRequestStatus &)
+	?ServerState@RContentManager@@QBE?AW4TCmServerState@@XZ @ 20 NONAME ; enum TCmServerState RContentManager::ServerState(void) const
+	?ServiceState@RContentManager@@QBE?AW4TCmServiceState@@W4TCmService@@@Z @ 21 NONAME ; enum TCmServiceState RContentManager::ServiceState(enum TCmService) const
+	?SetAppWizardState@RContentManager@@QAEHXZ @ 22 NONAME ; int RContentManager::SetAppWizardState(void)
+	?SetDrivesL@RContentManager@@QAEXV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 23 NONAME ; void RContentManager::SetDrivesL(class RPointerArray<class CCmDriveInfo>)
+	?SetFillFileStatusesL@RContentManager@@QAEXABV?$RPointerArray@VCCmBaseListItem@@@@@Z @ 24 NONAME ; void RContentManager::SetFillFileStatusesL(class RPointerArray<class CCmBaseListItem> const &)
+	?SetFillRulesL@RContentManager@@QAEXABVCCmFillRuleContainer@@@Z @ 25 NONAME ; void RContentManager::SetFillRulesL(class CCmFillRuleContainer const &)
+	?SetMediaserversL@RContentManager@@QAEHAAV?$RPointerArray@VCCmMediaServerFull@@@@@Z @ 26 NONAME ; int RContentManager::SetMediaserversL(class RPointerArray<class CCmMediaServerFull> &)
+	?SetServiceState@RContentManager@@QAEHW4TCmService@@W4TCmServiceState@@@Z @ 27 NONAME ; int RContentManager::SetServiceState(enum TCmService, enum TCmServiceState)
+	?SetStoreRulesL@RContentManager@@QAEXABVCCmStoreRuleContainer@@@Z @ 28 NONAME ; void RContentManager::SetStoreRulesL(class CCmStoreRuleContainer const &)
+	?StoreRulesL@RContentManager@@QAEPAVCCmStoreRuleContainer@@XZ @ 29 NONAME ; class CCmStoreRuleContainer * RContentManager::StoreRulesL(void)
+	?UpdateFillListsL@RContentManager@@QAEXAAVTRequestStatus@@@Z @ 30 NONAME ; void RContentManager::UpdateFillListsL(class TRequestStatus &)
+	?GetFilledFilesSize@RContentManager@@QBEXAA_JH@Z @ 31 NONAME ; void RContentManager::GetFilledFilesSize(long long &, int) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/data/cmserver.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  A startup control file to add content manager server to startup
+*                list
+*
+*/
+
+#include <StartupItem.rh>
+
+RESOURCE STARTUP_ITEM_INFO contentmanager_server
+    {
+    executable_name = "\\sys\\bin\\cmserver.exe";
+    recovery = EStartupItemExPolicyNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/data/cmserver_reg.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions 
+*
+*/
+
+
+#include <appinfo.rh>                    // APP_REGISTRATION_INFO.
+#include <data_caging_paths_strings.hrh> // APP_RESOURCE_DIR.
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x1000008d
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "cmserver"; // Filename of application binary (without extension).
+    hidden = KAppIsHidden;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/eabi/cmclientu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+EXPORTS
+	_ZN15RContentManager10FillRulesLEv @ 1 NONAME
+	_ZN15RContentManager10GetDrivesLER13RPointerArrayI12CCmDriveInfoE @ 2 NONAME
+	_ZN15RContentManager10ListItemsLERK6TDesC810TCmService @ 3 NONAME
+	_ZN15RContentManager10SetDrivesLE13RPointerArrayI12CCmDriveInfoE @ 4 NONAME
+	_ZN15RContentManager11StoreRulesLEv @ 5 NONAME
+	_ZN15RContentManager13SetFillRulesLERK20CCmFillRuleContainer @ 6 NONAME
+	_ZN15RContentManager14ExecuteServiceE10TCmServiceR14TRequestStatus @ 7 NONAME
+	_ZN15RContentManager14SetStoreRulesLERK21CCmStoreRuleContainer @ 8 NONAME
+	_ZN15RContentManager15ApplicationExitEv @ 9 NONAME
+	_ZN15RContentManager15DeleteMetadataLER14TRequestStatus @ 10 NONAME
+	_ZN15RContentManager15SetServiceStateE10TCmService15TCmServiceState @ 11 NONAME
+	_ZN15RContentManager16SetMediaserversLER13RPointerArrayI18CCmMediaServerFullE @ 12 NONAME
+	_ZN15RContentManager16UpdateFillListsLER14TRequestStatus @ 13 NONAME
+	_ZN15RContentManager17SetAppWizardStateEv @ 14 NONAME
+	_ZN15RContentManager18PreProcessFillListERK6TDesC8R14TRequestStatus @ 15 NONAME
+	_ZN15RContentManager20DriveSelectionStatusEv @ 16 NONAME
+	_ZN15RContentManager20GetFilteredMetadataLE10TCmServiceRP23CCmSqlPropertyCollectorR14TRequestStatus @ 17 NONAME
+	_ZN15RContentManager20SetFillFileStatusesLERK13RPointerArrayI15CCmBaseListItemE @ 18 NONAME
+	_ZN15RContentManager26DeleteDeletedMediaserversLEv @ 19 NONAME
+	_ZN15RContentManager5CloseEv @ 20 NONAME
+	_ZN15RContentManager6CancelEv @ 21 NONAME
+	_ZN15RContentManager7ConnectEv @ 22 NONAME
+	_ZN15RContentManagerC1Ev @ 23 NONAME
+	_ZN15RContentManagerC2Ev @ 24 NONAME
+	_ZNK15RContentManager11ServerStateEv @ 25 NONAME
+	_ZNK15RContentManager12LastSyncTimeEv @ 26 NONAME
+	_ZNK15RContentManager12ServiceStateE10TCmService @ 27 NONAME
+	_ZNK15RContentManager13MediaserversLEv @ 28 NONAME
+	_ZNK15RContentManager14AppWizardStateEv @ 29 NONAME
+	_ZNK15RContentManager14GetItemCountsLE10TCmServiceRK6TDesC8RiRx @ 30 NONAME
+	_ZNK15RContentManager15GetTransferInfoE10TCmServiceRiS1_ @ 31 NONAME
+	_ZNK15RContentManager18GetFilledFilesSizeERxi @ 32 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Content Manager server
+*
+*/
+
+
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/client/contentmanager.h          |../../../../../inc/contentmanager.h
+
+PRJ_MMPFILES
+
+cmclient.mmp
+cmserver.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/group/cmclient.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification file for Content Manager client
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../inc/cmuids.hrh"
+
+TARGET          cmclient.dll
+TARGETTYPE      dll
+UID             0x1000008D KCmClientUid
+
+CAPABILITY CAP_GENERAL_DLL
+
+SOURCEPATH      ../src/client
+SOURCE          cmclientsession.cpp
+SOURCE          cmactive.cpp
+
+USERINCLUDE     ../inc/client
+USERINCLUDE     ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../../../inc
+
+LIBRARY         euser.lib
+LIBRARY         bafl.lib
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+LIBRARY         cmcommon.lib
+
+DEBUGLIBRARY    flogger.lib
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/group/cmserver.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification file for Content Manager server
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../inc/cmuids.hrh"
+
+TARGET              cmserver.exe
+TARGETTYPE          exe
+UID                 0x1000008d KCmServerUid
+
+TARGETPATH          /system/programs
+
+CAPABILITY          CAP_SERVER
+VENDORID            VID_DEFAULT
+
+// Minimum heap size 4kB, maximum heap size 16MB, stack size 32kB
+EPOCHEAPSIZE   0x1000 0x1000000
+EPOCSTACKSIZE  0x8000
+
+SOURCEPATH          ../src/server
+SOURCE              cmservermain.cpp
+SOURCE              cmserver.cpp
+SOURCE              cmserversession.cpp
+
+START RESOURCE      ../../data/cmserver.rss
+TARGETPATH          /resource/apps
+END
+
+USERINCLUDE         ../inc
+USERINCLUDE         ../inc/server
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE       ../../../../../inc
+
+LIBRARY         avcontrolframework.lib
+LIBRARY         upnpserviceframework.lib
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         cmmdhclient.lib
+LIBRARY         cmsettingsengine.lib
+LIBRARY         cmcommon.lib
+LIBRARY         cmdatabasemanager.lib
+LIBRARY         cmfillmanager.lib
+LIBRARY         cmstoremanager.lib
+LIBRARY         cmscheduler.lib
+LIBRARY         cmmemorymanager.lib
+LIBRARY         centralrepository.lib
+LIBRARY         mdeclient.lib
+LIBRARY         bafl.lib
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+LIBRARY         ws32.lib        // for application activity info
+LIBRARY         apgrfx.lib      // for application activity info
+DEBUGLIBRARY    flogger.lib
+
+START RESOURCE      ../../data/cmserver_reg.rss
+TARGETPATH          /resource/apps
+END
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/inc/client/cmactive.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Manager server's client ao header
+*
+*/
+
+
+#ifndef CMACTIVE_H
+#define CMACTIVE_H
+
+#include <badesca.h>
+#include "contentmanager.h"
+
+NONSHARABLE_CLASS ( CCmActive ) : public CActive
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aCm, cmserver reference
+     */
+    static CCmActive* NewL( RContentManager& aCm );
+
+    /**
+     * Two-phased constructor.
+     *
+    * @param aCm, cmserver reference     
+     */
+    static CCmActive* NewLC( RContentManager& aCm );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CCmActive();
+
+    
+// From base class CActive
+
+    /**
+     * From CActive
+     * see base class definition
+     */
+    void RunL();
+
+protected:
+
+// From base class CActive
+
+    /**
+     * From CActive
+     * see base class definition
+     */
+    void DoCancel();
+
+    /**
+     * From CActive
+     * see base class definition
+     */
+    TInt RunError( TInt aError );
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction
+     *
+     * @since S60 5.1
+     * @param aCm, client reference.
+     */    
+    CCmActive( RContentManager& aCm );
+    
+    /**
+     * Performs the second phase construction.
+     */    
+    void ConstructL();
+        
+private:
+
+    /**
+     * server client interface
+     */
+    RContentManager& iCm;
+    /**
+     * idle indicator
+     */
+    TBool iIdle;
+    };
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/inc/client/contentmanager.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,379 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Manager server's client header
+*
+*/
+
+
+
+#ifndef CONTENTMANAGER_H
+#define CONTENTMANAGER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include "cmcommon.h"
+
+// FORWARD DECLARATIONS
+class CCmFillRuleContainer;
+class CCmStoreRuleContainer;
+class CCmMediaServerFull;
+class CCmBaseListItem;
+class CCmActive;
+class CCmDriveInfo;
+class CCmSqlPropertyCollector;
+class RDesReadStream;
+
+/**
+*  Content Manager session
+*
+*  @lib cmclient.lib
+*  @since S60 3.1
+*/
+class RContentManager : public RSessionBase
+    {
+public:
+
+    /**
+     * Session constructor.
+     */
+     IMPORT_C RContentManager();
+
+    /**
+     * Creates a connection to server. If server is not started,
+     * method will start the server first and then create a new session.
+     *
+     * @since S60 3.1
+     * @return TInt indicating the success of the call.
+     */
+    IMPORT_C TInt Connect();
+
+    /**
+     * Closes connection to server
+     *
+     * @since S60 3.1
+     * @return TInt indicating the success of the call.
+     */
+    IMPORT_C TInt Close();
+
+    /**
+     * Cancels all ongoing async operations
+     *
+     * @since S60 3.1
+     */
+    IMPORT_C void Cancel();
+
+    /**
+     * Returns the current state of the Content Manager
+     *
+     * @since S60 3.1
+     * @return TCmServerState state of the manager
+     */
+    IMPORT_C TCmServerState ServerState() const;
+
+
+    /**
+     * Sets state of a service
+     *
+     * @since S60 3.1
+     * @param aService, defines the service
+     * @param aNewState, service state to set¨
+     * @return TInt, status of the operation
+     */
+    IMPORT_C TInt SetServiceState( const TCmService aService,
+                                   const TCmServiceState aNewState );
+
+    /**
+     * Gets service state
+     *
+     * @since S60 3.1
+     * @param aService, defining the requested service
+     * @return TCmServiceState, service state
+     */
+    IMPORT_C TCmServiceState ServiceState( const TCmService aService ) const;
+
+    /**
+     * Execute a service
+     *
+     * @since S60 3.1
+     * @param aService defines the service
+     * @param aStatus asynchronous request status
+     * @return TInt, KErrNone if successfull
+     */
+    IMPORT_C TInt ExecuteService( const TCmService aService,
+                                  TRequestStatus& aStatus );
+
+    /**
+     * Sets media server information to database
+     *
+     * @since S60 3.1
+     * @param aServers New media server information.
+     * @return TInt, status of the operation
+     */
+    IMPORT_C TInt SetMediaserversL(
+            RPointerArray<CCmMediaServerFull>& aServers );
+
+    /**
+     * Deletes media servers from db ( servers with deleted status )
+     *
+     * @since S60 3.1
+     * @return None
+     */
+    IMPORT_C void DeleteDeletedMediaserversL();
+
+    /**
+     * Gets media server information from database (ownership to caller)
+     *
+     * @since S60 3.1
+     * @return RPointerArray<CCmMediaServerFull>,
+     *         media server information array
+     */
+    IMPORT_C RPointerArray<CCmMediaServerFull>* MediaserversL() const;
+
+    /**
+     * Gets current item count for a list of a service (fill or store)
+     *
+     * @since S60 3.1
+     * @param aService defines the service
+     * @param aListName list name
+     * @param aCount returns count
+     * @param aSize returns size
+     * @return TInt, KErrNone if successfull
+     */
+    IMPORT_C TInt GetItemCountsL( const TCmService aService,
+                                  const TDesC8& aListName,
+                                  TInt& aCount,
+                                  TInt64& aSize ) const;
+    /**
+     * Gets filled files size
+     *
+     * @since S60 3.1
+     * @param aSize returns size
+     * @param aID id of fill rule
+     */
+    IMPORT_C void GetFilledFilesSize( TInt64& aSize, const TInt aID ) const;
+
+    /**
+     * Gets filtered metadata items
+     *
+     * @since S60 3.2
+     * @param aService, defines the service
+     * @param aCollector, metadata collector
+     * @param aStatus, asynchronous request status
+     * @return TInt, error code
+     */
+    IMPORT_C TInt GetFilteredMetadataL( const TCmService aService,
+                                        CCmSqlPropertyCollector*& aCollector,
+                                        TRequestStatus& aStatus );
+
+    /**
+     * Updating fill lists
+     *
+     * @since S60 3.1
+     * @param aStatus asynchronous request status
+     */
+    IMPORT_C void UpdateFillListsL( TRequestStatus& aStatus );
+
+    /**
+     * Deleting metadata
+     *
+     * @since S60 3.1
+     * @param aStatus asynchronous request status
+     */
+    IMPORT_C void DeleteMetadataL( TRequestStatus& aStatus );
+
+    /**
+     * Returns the app wizard execution information.
+     *
+     * @since S60 3.1
+     * @return TBool, ETrue if app wizard has been executed at startup
+     */
+    IMPORT_C TBool AppWizardState() const;
+
+    /**
+     * Sets the app wizard execution information.
+     *
+     * @since S60 3.1
+     * @return TInt, KErrNone if successfull
+     */
+    IMPORT_C TInt SetAppWizardState();
+
+    /**
+     * Gets last sync time
+     *
+     * @since S60 3.1
+     * @return TTime, last sync time
+     */
+    IMPORT_C TTime LastSyncTime() const;
+
+    /**
+     * Sets fill file statuses
+     *
+     * @param aItems, reference to item array containing statuses
+     * @since S60 3.1
+     */
+    IMPORT_C void SetFillFileStatusesL(
+            const RPointerArray<CCmBaseListItem>& aItems );
+
+    /**
+     * Get transfer item count and time for a service
+     *
+     * @param aService defines the service
+     * @param aItemCount, item count value
+     * @param aTimeInSec, transfer time value
+     * @since S60 3.1
+     */
+    IMPORT_C void GetTransferInfo( const TCmService aService,
+                                   TInt& aItemCount,
+                                   TInt& aTimeInSec ) const;
+
+    /**
+     * Sets Fill rules
+     *
+     * @since S60 3.1
+     * @param aFillRules, reference to fill rule container object
+     */
+    IMPORT_C void SetFillRulesL( const CCmFillRuleContainer& aFillRules );
+
+    /**
+     * Gets fill rules
+     *
+     * @since S60 3.1
+     * @return CCmFillRuleContainer, pointer to fill rule container
+     *                               object (ownership to caller)
+     */
+    IMPORT_C CCmFillRuleContainer* FillRulesL();
+
+    /**
+     * Gets files of the list
+     *
+     * @since S60 3.1
+     * @param aListName, list name
+     * @param aService, fill or store service
+     * @return RPointerArray<CCmBaseListItem, pointer to fill list item
+     *                                        array (ownership to caller)
+     */
+    IMPORT_C RPointerArray<CCmBaseListItem>*
+                ListItemsL( const TDesC8& aListName, TCmService aService );
+
+    /**
+     * Preprocesses fill list
+     *
+     * @since S60 3.1
+     * @param aListName fill list name
+     * @return TInt, error code
+     */
+    IMPORT_C TInt PreProcessFillList( const TDesC8& aListName,
+                                      TRequestStatus& aStatus );
+
+    /**
+     * Sets store rules
+     *
+     * @since S60 3.1
+     * @param aStoreRules reference to store rule container object
+     */
+    IMPORT_C void SetStoreRulesL(
+            const CCmStoreRuleContainer& aStoreRules );
+
+    /**
+     * Gets store rules
+     *
+     * @since S60 3.1
+     * @return CCmStoreRuleContainer, pointer to store rule container object
+     *                                (ownership to caller)
+     */
+    IMPORT_C CCmStoreRuleContainer* StoreRulesL();
+
+    /**
+     * Sets drives
+     * @since S60 3.1
+     * @param aDrive, drive info array
+     */
+    IMPORT_C void SetDrivesL( RPointerArray<CCmDriveInfo> aDrives );
+
+    /**
+     * Gets drives
+     * @since S60 3.1
+     * @param aDrives, drives on return
+     */
+    IMPORT_C void GetDrivesL( RPointerArray<CCmDriveInfo>& aDrives );
+
+    /**
+     * Returns drive selection status
+     * @since S60 3.1
+     * @return TBool, ETrue if set, EFalse otherwise
+     */
+    IMPORT_C TBool DriveSelectionStatus();
+
+    /**
+     * Informs server that application will be shut down
+     * @since S60 3.1
+     */
+    IMPORT_C void ApplicationExit();
+   
+    /**
+     * Informs client when server operation is complete
+     *
+     * @since S60 3.1
+     * @param aErr
+     * @return TInt, KErrNone if successfull
+     */
+    TInt OperationCompletedL( TInt aErr );
+
+private:
+
+    /**
+     * Copy items from server side collector to client collector
+     * @Since s60 3.1
+     * @param aStream, dataStream from server
+     */
+    void CopyItemsL( RDesReadStream& aStream );
+
+private: // data
+
+    /**
+     * active object
+     */
+    CCmActive* iAo;                                 // owned
+
+    /**
+     * target array for metadata items
+     */
+    CCmSqlPropertyCollector** iTargetContainer;     // not owned
+
+    /**
+     * client's request status
+     */
+    TRequestStatus* iClientRequest;
+
+    /**
+     * indicator for user cancelling
+     */
+    TBool iCanceled;
+
+    /**
+     * data buffer
+     */
+    CBufFlat* iBuffer;                              // owned
+
+    /**
+     * buffer to be sent to server size
+     */
+    TPtrC8 iBufferPointer;
+    };
+
+
+#endif // CONTENTMANAGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/inc/cmuids.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Specifies the UID values used in Content Manager
+*
+*/
+
+
+#ifndef CM_UIDS_HRH
+#define CM_UIDS_HRH
+
+// Content Manager module Uids
+#define KCmClientUid                 0x10281FA8
+#define KCmServerUid                 0x10281FA7
+
+
+#endif  // CM_UIDS_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/inc/server/cmserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,478 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Manager server executable header file
+*
+*/
+
+
+
+#ifndef CMSERVER_H
+#define CMSERVER_H
+
+//  Includes
+#include <mdesession.h>
+#include "upnpavdeviceobserver.h"
+#include <f32file.h>
+
+#include "cmmmobserver.h"
+#include "cmserviceobserver.h"
+
+// Forward declarations
+class MUPnPAVController;
+class CCmMediaServerFull;
+class CCmDriveInfo;
+class CCmFillListItem;
+class CCmSqlPropertyCollector;
+class CCmDmMain;
+class MCmFmManager;
+class MCmSmManager;
+class CCmMmMain;
+class MCmMdhClient;
+class MCmSettings;
+class CCmScheduler;
+class CCmFillRuleContainer;
+class CCmSqlPropertyContainer;
+
+
+// CLASS DECLARATION
+
+/**
+ *  Content Manager server Core class
+ *
+ *  @since S60 3.1
+ */
+NONSHARABLE_CLASS ( CCmServer ) : public CPolicyServer,
+                                  public MCmServiceObserver,
+                                  public MUPnPAVDeviceObserver,
+                                  public MCmMmObserver,
+                                  public MMdESessionObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCmServer* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmServer();
+
+public:
+
+    /**
+     * Decrements server sessions
+     * @Since S60 3.1
+     */
+    void DecrementSessions();
+
+    /**
+     * Server state
+     * @Since S60 3.1
+     * @return TCmServerState, server state
+     */
+    TCmServerState ServerState() const;
+
+    /**
+     * Sets asynchronous message
+     * @Since S60 3.1
+     * @param aMessage, asynchronous message
+     */
+    void SetCurrentAsyncMsg( const RMessage2& aMessage );
+
+    /**
+     * Executes service
+     * @Since S60 3.1
+     * @param aService, service to be executed
+     */
+    void ExecuteServiceL( TCmService aService );
+
+    /**
+     * Executes service
+     * @Since S60 3.1
+     * @param aService, service to be executed
+     * @param aOptParam1, optional parameter 1
+     * @param aOptParam2, optional parameter 2
+     */
+        void ExecuteServiceL( TCmService aService,
+                              TInt aOptParam1,
+                              TAny* aOptParam2 );
+
+    /**
+     * Sets service state
+     * @Since S60 3.1
+     * @param aService, Service
+     * @param aState, service state
+     */
+    void SetServiceStateL( TCmService aService, TCmServiceState aState );
+
+    /**
+     * Cancels current service
+     * @Since S60 3.1
+     */
+    void CancelServiceL();
+
+    /**
+     * Returns propertycontainer
+     * @since S60 3.1
+     * @return CCmSqlPropertyContainer, property container
+     */
+    CCmSqlPropertyContainer* PropertyContainer() const;
+
+    /**
+     * Returns propertycollector
+     * @since S60 3.2
+     * @return CCmSqlPropertyCollector, property containers
+     */
+    CCmSqlPropertyCollector* PropertyCollector() const;
+
+    /**
+     * Returns mediaserver array
+     * @Since S60 3.1
+     * @return RPointerArray<CCmMediaServerFull>, server array
+     */
+    RPointerArray<CCmMediaServerFull>& MediaServerArray();
+
+    /**
+     * Returns fill rule container
+     * @Since S60 3.1
+     * @return CCmFillRuleContainer, fill rule container
+     */
+    CCmFillRuleContainer* FillRuleContainerL() const;
+
+    /**
+     * Drive status
+     * @since S60 3.1
+     * @return TBool, ETrue if set, EFalse otherwise
+     */
+    TBool DriveSelectionStatus();
+
+    /**
+     * Sets drive status
+     * @since S60 3.1
+     * @param aDriveSelectionStatus, Drive status
+     */
+    void SetDriveSelectionStatus( const TBool aDriveSelectionStatus );
+
+    /**
+     * Set async observer flag
+     * @since S60 3.1
+     * @param aState, ETrue if application initiated
+     *                EFalse if scheduler initiated
+     */
+    void SetAsyncRequestStateL( TBool aState );
+
+protected:
+
+// From base class MCmAVDeviceObserver
+
+    /**
+     * From MCmAVDeviceObserver
+     * See base class definition
+     */
+    void UPnPDeviceDiscovered(const CUpnpAVDevice& aDevice);
+
+    /**
+     * From MCmAVDeviceObserver
+     * See base class definition
+     */
+    void UPnPDeviceDisappeared(const CUpnpAVDevice& aDevice);
+
+    /**
+     * From MCmAVDeviceObserver
+     * See base class definition
+     */
+    void WLANConnectionLost();
+
+// From base class MCmMmObserver
+
+    /**
+     * From MCmMmObserver
+     * See base class definition
+     */
+    void DeleteCompleteL( TInt aErr );
+
+    /**
+     * From MCmMmObserver
+     * See base class definition
+     */
+    void ShrinkCompleteL( TInt aErr );
+
+// From base class MMdESessionObserver
+
+    /**
+     * From MMdESessionObserver
+     * See base class definition
+     */
+    void HandleSessionOpened(CMdESession& aSession, TInt aError);
+
+    /**
+     * From MMdESessionObserver
+     * See base class definition
+     */
+    void HandleSessionError(CMdESession& aSession, TInt aError);
+
+// From base class CPolicyServer
+
+    /**
+     * From CPolicyServer
+     * See base class definition
+     */
+    CSession2* NewSessionL( const TVersion& aVersion,
+                            const RMessage2& aMessage ) const;
+
+private:
+    /**
+     * Creates SQL about files to be deleted
+     * 
+     * @since S60 5.1
+     * @param aItems, item list
+     * @param aDrives, drivinfo
+     * @param aFilesToDelete, Sql clause array
+     */
+    void CreateFileDeleteSQLL( RPointerArray<CCmFillListItem>& aItems,
+                        RPointerArray<CCmDriveInfo>& aDrives,
+                        CDesCArrayFlat* aFilesToDelete );
+private:
+
+    /**
+     * C++ default constructor.
+     */
+     CCmServer();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Creates AV controller and starts discovery timer
+     * @since S60 3.1
+     */
+    void CreateAvcAndTimerL();
+
+    /**
+     * Checks if server is not ready
+     * @since S60 3.1
+     */
+    void LeaveIfNotReadyL();
+
+    /**
+     * Deletes next fill rule
+     * @since S60 3.1
+     */
+    void DeleteUnselectedFillFilesL();
+
+    /**
+     * Starts store process
+     * @since S60 3.1
+     */
+    void ExecuteStoreL();
+
+    /**
+     * Starts fill process
+     * @since S60 3.1
+     */
+    void ExecuteFillL();
+
+    /**
+     * Gets status by group id
+     * @since S60 3.1
+     * @param aListId, list id
+     * @param aStatus, list item status
+     * @return TInt, error code
+     */
+    TInt GetStatusByGroupId( TUint aListId, TCmListItemStatus& aStatus );
+
+    /**
+     * Checks server and adds it to db
+     * @since S60 3.1
+     * @param aDevice, media server
+     */
+    void CheckServerL( const CUpnpAVDevice& aDevice );
+
+    /**
+     * Deletes filled files
+     * @Since S60 3.1
+     */
+    void DeleteFilledFilesL();
+
+    /**
+     * Device discovery timer
+     * @Since S60 3.1
+     * @param TAny, caller class pointer
+     * @return TInt, returns always 0
+     */
+    static TInt SearchTimerCompletedL( TAny* aNy );
+
+    /**
+     * Called when service is executed
+     * @Since S60 3.1
+     * @param TCmService, completed service
+     * @param TInt, error code
+     */
+    void ServiceExecuted( TCmService aService, TInt aErrCode );
+
+    /**
+     * Updates fill list priorities
+     * @Since S60 3.1
+     */
+    void UpdateFillPriorities();
+
+    /**
+     * Append drive letter
+     * @since S60 3.1
+     * @param aFs, file server
+     * @param aDriveNumber, drive number
+     */
+    HBufC* ResolveAndAppendRootPathL( RFs& aFs, const TInt aDriveNumber );
+
+    /**
+     * Updates drive quota when files are deleted
+     * @since S60 3.1
+     * @param aDrives, drive info
+     * @param aItem, deleted item
+     */
+    void UpdateDriveQuota( RPointerArray<CCmDriveInfo>& aDrives,
+                           CCmFillListItem& aItem );
+
+    /**
+     * Starts service when timer elapses
+     * @Since S60 3.1
+     * @return TInt, returns always 0
+     */
+    TInt DoSearchTimerCompletedL();
+
+    /**
+     * Deletes property container
+     * @Since S60 3.1
+     */
+    void DeletePropertyContainer();
+    
+    /**
+     * Deletes items from database by FillListId
+     * @Since S60 3.1
+     */
+    void DeleteItemsByFillListId( TInt aFillListId );
+        
+    /**
+     * Sort function that arranges pointers by id
+     * @since S60 5.1
+     * @param aItem1, item to be sorted
+     * @param aItem2, item to be sorted
+     */
+    static TInt CompareById( const CCmFillListItem& aItem1,
+                             const CCmFillListItem& aItem2 );
+
+private:
+
+    /**
+     * AV controller
+     */
+    MUPnPAVController*          iAvController;          // owned
+    /**
+     * Database manager
+     */
+    CCmDmMain*                  iDbManager;             // owned
+    /**
+     * Fill manager
+     */
+    MCmFmManager*               iFillManager;           // owned
+    /**
+     * Store manager
+     */
+    MCmSmManager*               iStoreManager;          // owned
+    /**
+     * Memory manager
+     */
+    CCmMmMain*                  iMemoryManager;         // owned
+    /**
+     * Metadata harvester
+     */
+    MCmMdhClient*               iMdhClient;             // owned
+    /**
+     * Settings engine
+     */
+    MCmSettings*                iSettings;              // owned
+    /**
+     * Scheduler
+     */
+    CCmScheduler*               iScheduler;             // owned
+    /**
+     * Server state
+     */
+    TCmServerState              iServerState;
+    /**
+     * Current asyncronous message holder
+     */
+    RMessage2                   iCurrentAsyncMsg;
+    /**
+     * Device discovery timer
+     */
+    CPeriodic*                  iDeviceDiscoveryTimer;  // owned
+    /**
+     * Fill rule container
+     */
+    CCmFillRuleContainer*       iFillRuleContainer;     // owned
+    /**
+     * Item container
+     */
+    CCmSqlPropertyContainer*    iPropertyContainer;     // owned
+    /**
+     * Mediaserver array
+     */
+    RPointerArray<CCmMediaServerFull> iMediaServers;    // owned
+    /**
+     * Session counter
+     */
+    TInt*                       iSessionCount;
+    /**
+     * Fill rule index
+     */
+    TInt                        iFillRuleIndex;
+    /**
+     * Indicator for delete process
+     */
+    TBool                       iDeletingDeletedItems;
+    /**
+     * Asynchronous request status
+     */
+    TBool                       iAsyncRequestOn;
+    /**
+     * Store execution indicator
+     */
+    TBool                       iExecuteStoreAfterDelete;
+    /**
+     * Memory manager status
+     */
+    TBool                       iMmState;
+    /**
+     * MDE session
+     */
+    CMdESession*                iSession;               // owned
+    /**
+     * Fill list collector
+     */
+    CCmSqlPropertyCollector*    iPropertyCollector;     // not owned
+    /**
+     * status flag for drive setting
+     */
+    TBool                       iDriveSelectionStatus;
+    };
+
+#endif // CMSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/inc/server/cmserversession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  content manager server session header
+*
+*/
+
+
+
+#ifndef CMSERVERSESSION_H
+#define CMSERVERSESSION_H
+
+
+// FORWARD DECLARATIONS
+class CCmServer;
+
+// CLASS DECLARATION
+
+/**
+*  CCmSession
+*  This is a class for content manager server main session
+*
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CCmSession ) : public CSession2
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCmSession* NewL( CCmDmMain& aDbManager,
+                                 MCmSettings& aSettings );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSession();
+
+// From base class CSession2    
+
+    /**
+     * From CSession2.
+     * see base class definition
+     */
+    void ServiceL( const RMessage2 &aMessage );
+
+protected:
+
+    /**
+     * Panics the client
+     *
+     * @since S60 5.1
+     * @param aMessage, received message
+     * @param aPanic, panic code
+     */
+    void PanicClient( const RMessage2& aMessage, TInt aPanic ) const;
+
+private:
+
+    /**
+     * Constructor.
+     */
+    CCmSession( CCmDmMain& aDbManager, MCmSettings& aSettings );
+
+    /**
+     * Performs the second phase construction.
+     */   
+    void ConstructL();
+
+    /**
+     * Performs the first phase of two phase construction
+     * @since S60 3.1
+     * @param void
+     * @return content manager server reference
+     */
+    CCmServer& Server();
+
+private:
+
+    /**
+     * Database manager
+     */
+    CCmDmMain&                  iDbManager;
+    /**
+     * Settings engine
+     */
+    MCmSettings&                iSettings;
+    /**
+     * Buffer for collected data
+     */
+    CBufFlat*                   iDataBuffer;        // owned
+    /**
+     * Metadata collector
+     */
+    CCmSqlPropertyCollector*    iCollector;         // owned
+    };
+
+#endif      // CMSERVERSESSION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/src/client/cmactive.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Manager server's client ao implementation
+*
+*/
+
+
+#include "cmactive.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CCmActive::NewL
+// ---------------------------------------------------------------------------
+CCmActive* CCmActive::NewL( RContentManager& aCm )
+    {
+    LOG(_L("[Cm Server]\t CCmActive::NewL"));
+    CCmActive* self = CCmActive::NewLC( aCm );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmActive::NewLC
+// ---------------------------------------------------------------------------
+CCmActive* CCmActive::NewLC( RContentManager& aCm )
+    {
+    LOG(_L("[Cm Server]\t CCmActive::NewL"));
+    CCmActive* self = new ( ELeave ) CCmActive( aCm );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmActive::~CCmActive
+// ---------------------------------------------------------------------------
+CCmActive::~CCmActive()
+    {
+    LOG(_L("[Cm Server]\t CCmActive::~CCmActive"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmActive::CCmActive
+// ---------------------------------------------------------------------------
+CCmActive::CCmActive( RContentManager& aCm )
+    : CActive( EPriorityHigh ),
+      iCm( aCm ), iIdle( ETrue )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmActive::ConstructL
+// ---------------------------------------------------------------------------
+void CCmActive::ConstructL()
+    {
+    LOG(_L("[Cm Server]\t CCmActive::ConstructL"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmActive::RunL
+// ---------------------------------------------------------------------------
+void CCmActive::RunL()
+    {
+    LOG(_L("[Cm Server]\t CCmActive::RunL"));
+    TRACE(Print(_L("[Cm Server]\t status %d"), iStatus.Int() ));
+
+    if ( iIdle )
+        {
+        LOG(_L("[Cm Server]\t CCmActive::RunL set active"));
+        SetActive();
+        iIdle = EFalse;
+        }
+    else
+        {
+        LOG(_L("[Cm Server]\t CCmActive::RunL operation completed"));
+        iCm.OperationCompletedL( iStatus.Int() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmActive::DoCancel
+// ---------------------------------------------------------------------------
+void CCmActive::DoCancel()
+    {
+    LOG(_L("[Cm Server]\t CCmActive::DoCancel"));
+    TRAPD( error, iCm.OperationCompletedL( KErrCancel ) );
+    if ( error )
+        {
+        TRACE(Print(_L("[Cm Server]\tCCmActive::DoCancel \
+        error = %d"), error ));
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmActive::RunError
+// ---------------------------------------------------------------------------
+TInt CCmActive::RunError( TInt aError )
+    {
+    TRACE( Print(_L("[Cm Server]\t CCmActive::RunError \
+    error = %d"), aError ));
+
+    // let it leave
+    return aError;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/src/client/cmclientsession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,938 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Manager server's client
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include    <s32mem.h>
+#include    <badesca.h>
+
+#include    "cmfillrulecontainer.h"
+#include    "cmstorerulecontainer.h"
+#include    "cmbaselistitem.h"
+#include    "cmmediaserverfull.h"
+#include    "cmsqlpropertyitem.h"
+#include    "cmsqlpropertycontainer.h"
+#include    "cmsqlpropertycollector.h"
+#include    "cmdriveinfo.h"
+#include    "cmactive.h"
+#include    "msdebug.h"
+
+
+// CONSTANTS
+// Number of retries to start server
+const TInt KServerRetries = 2;
+// wizard executed state
+const TInt KAppWizardExecuted = 1;
+
+// ---------------------------------------------------------------------------
+// StartServer
+// Creates a new process for the server and starts it up.
+// ---------------------------------------------------------------------------
+//
+static TInt StartServer()
+    {
+    LOG(_L("[Cm Server]\t StartServer begin"));
+
+    TInt result( KErrNone );
+    // create server - if one of this name does not already exist
+    TFindServer findServer( KCmServerName );
+    TFullName name;
+    if ( findServer.Next( name ) != KErrNone ) // we don't exist already
+        {
+
+        TRequestStatus status( KRequestPending );
+        RProcess server;
+        // Create the server process
+        result = server.Create( KCmServerExe, KNullDesC );
+        if( result != KErrNone )
+            {
+            return result;
+            }
+
+        // Process created successfully
+        server.Resume(); // start it going
+        server.Rendezvous( status );
+
+        // Wait until the completion of the server creation
+        // server signals us when it's up
+        User::WaitForRequest( status );
+
+        if( status != KErrNone )
+            {
+            server.Close();
+            return status.Int();
+            }
+
+        // Server created successfully
+        server.Close(); // we can close the handle to server process now
+        }
+
+    LOG(_L("[Cm Server]\t StartServer end"));
+
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::RContentManager
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RContentManager::RContentManager()
+    {
+    LOG(_L("[Cm Server]\t RContentManager::RContentManager"));
+    
+    iClientRequest = NULL;
+    iTargetContainer = NULL;
+    iBuffer = NULL;
+    iAo = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::Close
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RContentManager::Close()
+    {
+    LOG(_L("[Cm Server]\t RContentManager::Close"));
+    
+    // Base call
+    RSessionBase::Close();
+
+    if ( iAo )
+        {
+        delete iAo; iAo = NULL;
+        }
+
+    if( iBuffer )
+        {
+        delete iBuffer;
+        iBuffer = NULL;
+        }
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::Connect
+// Starts and creates a session of Content Manager
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RContentManager::Connect()
+    {
+    LOG(_L("[Cm Server]\t RContentManager::Connect"));
+    
+    iCanceled = EFalse;
+    
+    TInt tryLoop( 0 );
+    TInt errCode( KErrNone );
+
+    for ( tryLoop = 0; tryLoop < KServerRetries; tryLoop++ )
+        {
+        errCode = CreateSession(KCmServerName,
+            TVersion( KCmServerMajor, KCmServerMinor,
+                    KCmServerBuild ) );
+        //gives MessageSlots of -1
+        //this uses global pool rather than local pool
+
+        TRACE(Print(_L("[Cm Server]\t RContentManager::Connect New Session \
+        created with status %d\n"), errCode));
+
+        if( errCode == KErrNotSupported )
+            {
+            TRACE(Print(_L("[Cm Server]\t Version not supported!\n")));
+            return errCode;
+            }
+        if ( errCode != KErrNotFound && errCode != KErrServerTerminated)
+            {
+            return errCode;
+            }
+
+        errCode = StartServer();
+
+        TRACE(Print(_L("[Cm Server]\t RContentManager::Connect Start server \
+        errCode %d\n"), errCode));
+
+        if ( errCode != KErrNone && errCode != KErrAlreadyExists )
+            {
+            return errCode;
+            }
+
+        }
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::OperationCompletedL
+// ---------------------------------------------------------------------------
+//
+TInt RContentManager::OperationCompletedL( TInt aErr )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::OperationCompletedL"));
+
+    TRACE(Print(_L("[Cm Server]\t RContentManager::OperationCompletedL \
+    aErr = %d, iCanceled = %d\n"), aErr, iCanceled));
+
+    if ( !aErr && !iCanceled )
+        {
+        // Items are changed so we don't want to keep old ones
+        // Containers cannot be deleted because application
+        // looses their address
+        for ( TInt i = 0;
+              i < (*iTargetContainer)->PropertyContainerCount();
+              i++ )
+            {
+            CCmSqlPropertyContainer* container =
+                            (*iTargetContainer)->PropertyContainer( i );
+            for ( TInt j = 0; j < container->PropertyItemCount(); j++ )
+                {
+                container->DeletePropertyItem(j--);
+                }
+            }
+
+        TInt size( 0 );
+        TPckg<TInt> sizePckg( size );
+        SendReceive( ECmGetDataFieldSize, TIpcArgs( &sizePckg ));
+
+        if ( size > 0 )
+            {
+            HBufC8* buffer = HBufC8::NewLC( size );
+
+            TPtr8 bufferPointer = buffer->Des();
+            SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) );
+
+            RDesReadStream stream;
+            stream.Open( bufferPointer );
+            CleanupClosePushL( stream );
+
+            // copy items to application side containers
+            CopyItemsL( stream );
+
+            CleanupStack::PopAndDestroy( 2, buffer );
+            }
+
+
+        }
+    User::RequestComplete( iClientRequest, aErr );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::CopyItemsL
+// ---------------------------------------------------------------------------
+//
+void RContentManager::CopyItemsL( RDesReadStream& aStream )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::CopyItemsL"));
+
+    CCmSqlPropertyCollector* collector = CCmSqlPropertyCollector::NewLC();
+    collector->InternalizeL( aStream );
+
+    // append internalized items to containers
+    for ( TInt k = 0; k < collector->PropertyContainerCount(); k++ )
+        {
+        CCmSqlPropertyContainer* container =
+                                collector->PropertyContainer( k );
+        CCmSqlPropertyContainer* targetContainer =
+                                (*iTargetContainer)->PropertyContainer(k);
+        for ( TInt l = 0; l < container->PropertyItemCount(); l++ )
+            {
+            // copy item
+            // must be done so that we can destroy collector
+            CCmSqlPropertyItem* item = new ( ELeave )
+                            CCmSqlPropertyItem( *container->PropertyItem(l));
+            CleanupStack::PushL( item );
+            // add copied item
+            targetContainer->AddPropertyItemL( item );
+            CleanupStack::Pop( item );
+            // delete original item
+            container->DeletePropertyItem( l );
+            // itemcount decreased so index must be updated also
+            l--;
+            }
+        }
+    CleanupStack::PopAndDestroy( collector );
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::Cancel
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::Cancel()
+    {
+    LOG(_L("[Cm Server]\t RContentManager::Cancel\n"));
+
+    // iCanceled is set ETrue if user is closing the application
+    // We don't want to cancel asynchronous process
+
+    TRACE(Print(_L("[Cm Server]\t RContentManager::Cancel value is %d\n"),
+        iCanceled));
+    if ( !iCanceled )
+        {
+        SendReceive( ECmCancel, TIpcArgs() );
+        }
+
+    if ( iAo )
+        {
+        iAo->Deque();
+        delete iAo; iAo = NULL;
+        }
+        
+    LOG(_L("[Cm Server]\t RContentManager::Cancel end\n"));
+    }
+    
+// ---------------------------------------------------------------------------
+// RContentManager::ServerState
+// ---------------------------------------------------------------------------
+EXPORT_C TCmServerState RContentManager::ServerState() const
+    {
+    LOG(_L("[Cm Server]\t RContentManager::ServerState\n"));
+
+    TCmServerState state;
+    TPckg<TCmServerState> pckg( state );
+    SendReceive( ECmGetServerState, TIpcArgs( &pckg ) );
+    
+    return state;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::SetServiceState
+// ---------------------------------------------------------------------------
+EXPORT_C TInt RContentManager::SetServiceState( const TCmService aService,
+                               const TCmServiceState aNewState )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::SetServiceState\n"));
+    
+    TRACE(Print(_L("[Cm Server]\t service %d state %d \n"),
+        aService, (TInt)aNewState ));
+
+    SendReceive( ECmSetServiceState, TIpcArgs( aService, aNewState ) );
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::ServiceState
+// ---------------------------------------------------------------------------
+EXPORT_C TCmServiceState RContentManager::ServiceState
+    ( const TCmService aService ) const
+    {
+    LOG(_L("[Cm Server]\t RContentManager::ServiceState\n"));
+    
+    TCmServiceState state;
+    TPckg<TCmServiceState> pckg( state );
+    SendReceive( ECmGetServiceState, TIpcArgs( aService, &pckg ) );
+    
+    return state;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::ExecuteService
+// ---------------------------------------------------------------------------
+EXPORT_C TInt RContentManager::ExecuteService( const TCmService aService,
+                                               TRequestStatus& aStatus )
+    {
+    TRACE( Print (_L("[Cm Server]\t RContentManager::ExecuteServiceL \
+    aService = %d\n"), aService ));
+   
+    SendReceive( ECmExecuteService, TIpcArgs( aService ), aStatus );
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::GetItemCountsL
+// ---------------------------------------------------------------------------
+
+EXPORT_C TInt RContentManager::GetItemCountsL( const TCmService aService,
+                                               const TDesC8& aListName,
+                                               TInt& aCount,
+                                               TInt64& aSize ) const
+    {
+    TRACE( Print( _L("[Cm Server]\t RContentManager::GetItemCountsL \
+    service = %d\n"), aService ));
+
+    if ( aService != ECmServiceFill &&
+         aService != ECmServiceStore )
+        {
+        LOG(_L("[Cm Server]\t RContentManager::ItemCount wrong argument\n"));
+        User::Leave( KErrArgument );
+        }
+    TPckg<TInt> countPckg( aCount );
+    TPckg<TInt64> sizePckg( aSize );
+
+    SendReceive( ECmGetItemCount,
+        TIpcArgs( &countPckg, &sizePckg, aService, &aListName ) );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Get filled files size
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::GetFilledFilesSize( TInt64& aSize, const TInt aID ) const
+    {
+    TPckg<TInt64> sizePckg( aSize );
+    SendReceive( ECmGetFilledFilesSize, TIpcArgs( &sizePckg, aID ) );
+    }
+
+// RContentManager::GetTransferInfo
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::GetTransferInfo( const TCmService aService,
+                               TInt& aItemCount,
+                               TInt& aTimeInSec ) const
+    {
+    TRACE( Print( _L("[Cm Server]\t RContentManager::GetTransferInfo \
+    service = %d\n"), aService ));
+    TPckg<TInt> countPckg( aItemCount );
+    TPckg<TInt> timePckg( aTimeInSec );
+    SendReceive( ECmGetTransferInfo,
+        TIpcArgs( aService, &countPckg, &timePckg ) );
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::GetFilteredMetadataL
+// ---------------------------------------------------------------------------
+EXPORT_C TInt RContentManager::GetFilteredMetadataL(
+                            const TCmService aService,
+                            CCmSqlPropertyCollector*& aCollector,
+                            TRequestStatus& aStatus )
+    {
+    TRACE( Print( _L("[Cm Server]\t RContentManager::GetFilteredMetadataL \
+    service = %d\n"), aService ));
+
+    if ( aService != ECmServiceFill &&
+         aService != ECmServiceStore )
+        {
+        LOG(_L("[Cm Server]\t RContentManager::GetFilteredMetadataL \
+        wrong argument\n"));
+        User::Leave( KErrArgument );
+        }
+
+    iCanceled = EFalse;
+
+    if ( iAo )
+        {
+        delete iAo; iAo = NULL;
+        }
+    iAo = CCmActive::NewL( *this );
+
+    iBuffer = CBufFlat::NewL( KKilo );
+    RBufWriteStream stream;
+    stream.Open( *iBuffer );
+    CleanupClosePushL( stream );
+    aCollector->ExternalizeL( stream );
+    
+    iBufferPointer.Set( iBuffer->Ptr(0) );
+    SendReceive( ECmGetDataFields,
+                 TIpcArgs( &iBufferPointer ),
+                 iAo->iStatus);
+
+    CleanupStack::PopAndDestroy(); // stream
+
+    iAo->RunL();
+    
+    aStatus = KRequestPending;
+    iTargetContainer = &aCollector;
+
+    iClientRequest = &aStatus;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::DeleteMetadataL
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::UpdateFillListsL( TRequestStatus& aStatus )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::UpdateFillListsL\n"));
+    SendReceive( ECmUpdateFillLists, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Deleting metadata harvested from unselected servers
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::DeleteMetadataL(
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::DeleteMetadataL\n"));
+    if( iBuffer )
+        {
+        delete iBuffer;
+        iBuffer = NULL;
+        }
+    iBuffer = CBufFlat::NewL( KKilo );
+    RBufWriteStream stream;
+    stream.Open( *iBuffer );
+    CleanupClosePushL( stream );
+
+    iBufferPointer.Set( iBuffer->Ptr(0) );
+    SendReceive( ECmDeleteMetadata,
+                 TIpcArgs( &iBufferPointer ),
+                 aStatus );
+    CleanupStack::PopAndDestroy( &stream );
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::LastSyncTime
+// ---------------------------------------------------------------------------
+EXPORT_C TTime RContentManager::LastSyncTime() const
+    {
+    LOG(_L("[Cm Server]\t RContentManager::LastSyncTime\n"));
+    TTime syncTime( 0 );
+    TPckg<TTime> timePckg( syncTime );
+    SendReceive( ECmGetSyncTime, TIpcArgs( &timePckg ) );
+    return syncTime;
+    }
+
+
+// ---------------------------------------------------------------------------
+// RContentManager::SetFillFileStatusesL
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::SetFillFileStatusesL(
+            const RPointerArray<CCmBaseListItem>& aItems )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::SetFillFileStatusesL\n"));
+
+    CBufFlat* buffer = CBufFlat::NewL( KKilo );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream stream;
+    stream.Open( *buffer );
+    CleanupClosePushL( stream );
+    for ( TInt i = 0; i < aItems.Count(); i++ )
+        {
+        aItems[ i ]->ExternalizeL( stream );
+        }
+
+    TPtrC8 bufferPointer = buffer->Ptr(0);
+    SendReceive( ECmSetFillFileStatuses,
+                 TIpcArgs( &bufferPointer, aItems.Count() ) );
+    CleanupStack::PopAndDestroy( 2, buffer );
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::AppWizardState
+// ---------------------------------------------------------------------------
+
+EXPORT_C TBool RContentManager::AppWizardState() const
+    {
+    LOG(_L("[Cm Server]\t RContentManager::AppWizardState\n"));
+
+    TInt appWizardState(0);
+    TPckg<TInt> wizardStatepckg( appWizardState );
+    SendReceive( ECmGetAppWizardState, TIpcArgs( &wizardStatepckg ) );
+
+    TBool returnvalue = EFalse;
+    if ( appWizardState == KAppWizardExecuted )
+        {
+        returnvalue = ETrue;
+        }
+    return returnvalue;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::SetAppWizardState
+// ---------------------------------------------------------------------------
+
+EXPORT_C TInt RContentManager::SetAppWizardState()
+    {
+    LOG(_L("[Cm Server]\t RContentManager::SetAppWizardState\n"));
+
+    SendReceive( ECmSetAppWizardState );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::SetFillRulesL
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::SetFillRulesL(
+    const CCmFillRuleContainer& aFillRules )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::SetFillRulesL\n"));
+
+#ifdef _DEBUG
+    CCmFillRuleContainer* temp = (CCmFillRuleContainer*) &aFillRules;
+    TInt count = temp->FillRuleCount();
+    TRACE(Print(_L("[Cm Server]\t fill rule count is %d\n"), count));
+#endif
+
+    CBufFlat* buffer = CBufFlat::NewL( KKilo );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream stream;
+    stream.Open( *buffer );
+    CleanupClosePushL( stream );
+    aFillRules.ExternalizeL( stream );
+    TPtrC8 bufferPointer = buffer->Ptr(0);
+    SendReceive( ECmSetFillRules, TIpcArgs( &bufferPointer ) );
+    CleanupStack::PopAndDestroy( 2, buffer );
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::FillRulesL
+// ---------------------------------------------------------------------------
+EXPORT_C CCmFillRuleContainer* RContentManager::FillRulesL()
+    {
+    LOG(_L("[Cm Server]\t RContentManager::FillRulesL\n"));
+    TInt size( 0 );
+    TPckg<TInt> pckg( size );
+    SendReceive( ECmGetFillRulesSize, TIpcArgs( &pckg ));
+    // for some reason the sendreceive sometimes leaves size as negative.
+    // leave if this is the case.
+    if ( size < 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+    TRACE(Print(_L("[Cm Server]\t RContentManager: buffer size is %d\n"),
+        size) );
+    HBufC8* buffer = HBufC8::NewLC( size );
+    TPtr8 bufferPointer = buffer->Des();
+    SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) );
+
+    RDesReadStream stream;
+    stream.Open( bufferPointer );
+    CleanupClosePushL( stream );
+    CCmFillRuleContainer* container = CCmFillRuleContainer::NewLC();
+    container->InternalizeL( stream );
+    CleanupStack::Pop( container );
+    CleanupStack::PopAndDestroy( 2, buffer );
+    return container;
+    }
+
+
+// ---------------------------------------------------------------------------
+// RContentManager::ListItemsL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RPointerArray<CCmBaseListItem>*
+            RContentManager::ListItemsL( const TDesC8& aListName,
+                                         TCmService aService )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::ListItemsL"));
+    
+#ifdef _DEBUG
+    HBufC* listName16 = HBufC::NewLC( aListName.Length() );
+    listName16->Des().Copy( aListName );
+    TRACE( Print(_L("[Cm Server]\t RContentManager::FillListItemsL \
+    list name %S"), listName16 ) );
+    CleanupStack::PopAndDestroy( listName16 );
+#endif
+
+    TInt size( 0 );
+    TInt itemCount( 0 );
+    TPckg<TInt> sizePckg( size );
+    TPckg<TInt> countPckg( itemCount );
+
+    // Switch statement ensures that SendReceive is not called with other
+    // services that ECmGetFillItemsSize and ECmGetStoreItemsSize
+    switch ( aService )
+        {
+        case ECmServiceFill:
+            {
+            SendReceive( ECmGetFillItemsSize,
+                         TIpcArgs( &aListName, &sizePckg, &countPckg ) );
+
+            break;
+            }
+        case ECmServiceStore:
+            {
+            SendReceive( ECmGetStoreItemsSize,
+                         TIpcArgs( &aListName, &sizePckg, &countPckg ) );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[Cm Server]\t RContentManager::ListItemsL \
+            service not supported"));
+            break;
+            }
+
+        }
+
+    TRACE( Print( _L("[Cm Server]\t RContentManager::ListItemsL \
+    size = %d, itemCount = %d"), size, itemCount ));
+
+    // Sendreceive leaves size or itemCount as negative
+    if ( size < 0 || itemCount < 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    HBufC8* buffer = HBufC8::NewLC( size );
+    TPtr8 bufferPointer = buffer->Des();
+    SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) );
+    RDesReadStream stream;
+    stream.Open( bufferPointer );
+    CleanupClosePushL( stream );
+
+    RPointerArray<CCmBaseListItem>* itemArray =
+        new (ELeave)RPointerArray<CCmBaseListItem>();
+    CleanupStack::PushL( itemArray );
+    for( TInt i = 0; i < itemCount; i++ )
+        {
+        CCmBaseListItem* item = CCmBaseListItem::NewLC();
+        item->InternalizeL( stream );
+        itemArray->AppendL( item );
+        CleanupStack::Pop( item );
+        }
+
+    CleanupStack::Pop( itemArray );
+    CleanupStack::PopAndDestroy( 2, buffer );
+    return itemArray;
+
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::PreProcessFillList
+// ---------------------------------------------------------------------------
+EXPORT_C TInt RContentManager::PreProcessFillList( const TDesC8& aListName,
+                                                   TRequestStatus& aStatus )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::PreProcessFillList\n"));
+
+    SendReceive( ECmPreProcessFillList, TIpcArgs( &aListName ), aStatus );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::MediaserversL
+// ---------------------------------------------------------------------------
+
+EXPORT_C RPointerArray<CCmMediaServerFull>*
+    RContentManager::MediaserversL() const
+    {
+    LOG(_L("[Cm Server]\t RContentManager::MediaServersL\n"));
+    TInt size( 0 );
+    TInt amount( 0 );
+    TPckg<TInt> pckg( size );
+    TPckg<TInt> pckg2( amount );
+
+    SendReceive( ECmGetMediaserversSize, TIpcArgs( &pckg, &pckg2 ) );
+    // Sendreceive leaves size or amount as negative
+    if ( size < 0 || amount < 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    TRACE(Print(_L("[Cm Server]\t RContentManager: \
+        buffer size is %d, amount %d\n"), size, amount));
+
+    HBufC8* buffer = HBufC8::NewLC( size );
+    TPtr8 bufferPointer = buffer->Des();
+    SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) );
+
+    RDesReadStream stream;
+    stream.Open( bufferPointer );
+    CleanupClosePushL( stream );
+
+    RPointerArray<CCmMediaServerFull>* mediaServers =
+        new (ELeave) RPointerArray<CCmMediaServerFull>();
+    CleanupStack::PushL( mediaServers );
+
+    for ( TInt i = 0; i < amount; i++ )
+        {
+        CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC();
+        tempServer->InternalizeL( stream );
+        mediaServers->Append( tempServer );
+        CleanupStack::Pop( tempServer );
+        }
+    CleanupStack::Pop( mediaServers );
+    CleanupStack::PopAndDestroy( 2, buffer );
+    return mediaServers;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::SetMediaserversL
+// ---------------------------------------------------------------------------
+EXPORT_C TInt RContentManager::SetMediaserversL(
+    RPointerArray<CCmMediaServerFull>& aMediaServers )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::SetMediaserversL\n"));
+
+    CBufFlat* buffer = CBufFlat::NewL( KKilo );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream stream;
+    stream.Open( *buffer );
+    CleanupClosePushL( stream );
+    for ( TInt i = 0; i < aMediaServers.Count(); i++ )
+        {
+        aMediaServers[ i ]->ExternalizeL( stream );
+        }
+
+    TPtrC8 bufferPointer = buffer->Ptr(0);
+    SendReceive( ECmSetMediaServers,
+                 TIpcArgs( &bufferPointer, aMediaServers.Count() ) );
+    CleanupStack::PopAndDestroy( 2, buffer );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::DeleteDeletedMediaserversL
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::DeleteDeletedMediaserversL()
+    {
+    LOG(_L("[Cm Server]\t RContentManager::DeleteDeletedMediaserversL\n"));
+    SendReceive( ECmDeleteDeletedMediaServers );
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::SetStoreRulesL
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::SetStoreRulesL(
+    const CCmStoreRuleContainer& aStoreRules )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::SetStoreRulesL\n"));
+
+#ifdef _DEBUG
+    CCmStoreRuleContainer* temp = (CCmStoreRuleContainer*) &aStoreRules;
+    TInt count = temp->StoreRuleCount();
+    TRACE(Print(_L("[Cm Server]\t store rule count is %d\n"), count));
+#endif
+
+    CBufFlat* buffer = CBufFlat::NewL( KKilo );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream stream;
+    stream.Open( *buffer );
+    CleanupClosePushL( stream );
+    aStoreRules.ExternalizeL( stream );
+    TPtrC8 bufferPointer = buffer->Ptr(0);
+    SendReceive( ECmSetStoreRules, TIpcArgs( &bufferPointer ) );
+    CleanupStack::PopAndDestroy( 2, buffer );
+
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::StoreRulesL
+// ---------------------------------------------------------------------------
+EXPORT_C CCmStoreRuleContainer* RContentManager::StoreRulesL()
+    {
+    LOG(_L("[Cm Server]\t RContentManager::StoreRulesL\n"));
+    TInt size( 0 );
+    TPckg<TInt> pckg( size );
+    SendReceive( ECmGetStoreRulesSize, TIpcArgs( &pckg ) );
+    // Sendreceive leaves size as negative
+    if ( size < 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    TRACE(Print(_L("[Cm Server]\t RContentManager: buffer size is %d\n"),
+        size));
+    
+    HBufC8* buffer = HBufC8::NewLC( size );
+    TPtr8 bufferPointer = buffer->Des();
+    SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) );
+
+    RDesReadStream stream;
+    stream.Open( bufferPointer );
+    CleanupClosePushL( stream );
+    CCmStoreRuleContainer* container = CCmStoreRuleContainer::NewLC();
+    container->InternalizeL( stream );
+    CleanupStack::Pop( container );
+    CleanupStack::PopAndDestroy( 2, buffer );
+    return container;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::SetDrivesL
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::SetDrivesL(
+    RPointerArray<CCmDriveInfo> aDrives )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::SetDrivesL\n"));
+
+    CBufFlat* buffer = CBufFlat::NewL( KKilo );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream stream;
+    stream.Open( *buffer );
+    CleanupClosePushL( stream );
+    
+    for ( TInt i = 0; i < aDrives.Count(); i++ )
+        {
+        aDrives[ i ]->ExternalizeL( stream );
+        }
+    
+    TPtrC8 bufferPointer = buffer->Ptr(0);
+    SendReceive( ECmSetDrives,
+                 TIpcArgs( &bufferPointer, aDrives.Count() ) );
+    CleanupStack::PopAndDestroy( 2, buffer );
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::GetDrivesL
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::GetDrivesL(
+    RPointerArray<CCmDriveInfo>& aDrives )
+    {
+    LOG(_L("[Cm Server]\t RContentManager::GetDrivesL\n"));
+    TInt size( 0 );
+    TInt amount( 0 );
+    TPckg<TInt> pckg( size );
+    TPckg<TInt> pckg2( amount );
+    SendReceive( ECmGetDrivesSize, TIpcArgs( &pckg, &pckg2 ) );
+    // Sendreceive leaves size or amount as negative
+    if ( size < 0 || amount < 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    TRACE(Print(_L("[Cm Server]\t RContentManager: \
+        buffer size is %d, amount %d\n"), size, amount));
+    
+    HBufC8* buffer = HBufC8::NewLC( size );
+    TPtr8 bufferPointer = buffer->Des();
+    SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) );
+
+    RDesReadStream stream;
+    stream.Open( bufferPointer );
+    CleanupClosePushL( stream );
+
+    for ( TInt i = 0; i < amount; i++ )
+        {
+        CCmDriveInfo* tempDrive = CCmDriveInfo::NewLC();
+        tempDrive->InternalizeL( stream );
+        aDrives.Append( tempDrive );
+        CleanupStack::Pop( tempDrive );
+        }
+    CleanupStack::PopAndDestroy( 2, buffer );
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::DriveSelectionStatus
+// ---------------------------------------------------------------------------
+EXPORT_C TBool RContentManager::DriveSelectionStatus()
+    {
+    LOG(_L("[Cm Server]\t RContentManager: DriveSelectionStatus\n"));
+
+    TBool status( EFalse );
+    TPckg<TBool> pckg( status );
+
+    SendReceive( ECmGetDriveSelectionStatus, TIpcArgs( &pckg ) );
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// RContentManager::ApplicationExit
+// ---------------------------------------------------------------------------
+EXPORT_C void RContentManager::ApplicationExit()
+    {
+    LOG(_L("[Cm Server]\t RContentManager: ApplicationExit\n"));
+    iCanceled = ETrue;
+
+    SendReceive( ECmApplicationExit, TIpcArgs() );
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/src/server/cmserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1786 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Server implementation
+*
+*/
+
+
+#include    <e32property.h>
+#include    "upnpavdevice.h"
+#include    "upnpavcontroller.h"
+#include    "upnpavcontrollerfactory.h"
+
+#include    "cmdmmain.h"
+#include    "cmfillmanagerfactory.h"
+#include    "cmfillmanager.h"
+#include    "cmstoremanagerfactory.h"
+#include    "cmstoremanager.h"
+#include    "cmscheduler.h"
+#include    "cmmmmain.h"
+#include    "cmfilllistitem.h"
+#include    "cmdriveinfo.h"
+#include    "cmmediaserverfull.h"
+#include    "cmfillrulecontainer.h"
+#include    "cmfillrule.h"
+#include    "cmsqlpropertycontainer.h"
+#include    "cmsettingsfactory.h"
+#include	"mmdhclient.h"
+#include	"mdhclientfactory.h"
+#include    "cmsettings.h"
+#include    "cmserver.h"
+#include    "cmserversession.h"
+#include    "msdebug.h"
+
+// CONSTANTS
+const TInt KDefaultSystemUpdateId = 0;  // default system update id
+const TInt KArrayGranularity = 16;      // array granularity
+const TInt KDriveBufferSize = 4;        // drive letter buffer size
+const TInt KDeleteDataBaseItem = 255;   // delete status for FillListId
+_LIT( KColon, ":");                     // colon
+_LIT( KDoubleBackSlash, "\\");          // double backslash
+
+//Total number of ranges
+const TUint KCmServerRangeCount = 2;
+
+//Definition of the ranges of IPC numbers
+const TInt KCmServerRanges[KCmServerRangeCount] =
+        {
+        0,
+        34
+        };
+
+//Policy to implement for each of the above ranges
+const TUint8 KCmServerElementsIndex[KCmServerRangeCount] =
+        {
+        1, //applies to 1st range
+        CPolicyServer::ENotSupported
+        };
+
+//Specific capability checks
+const CPolicyServer::TPolicyElement KCmServerElements[] =
+        {
+        {_INIT_SECURITY_POLICY_C3(ECapabilityNetworkServices,
+            ECapabilityReadUserData, ECapabilityWriteUserData ),
+            CPolicyServer::EFailClient },
+        {_INIT_SECURITY_POLICY_C1(ECapabilityNetworkServices),
+            CPolicyServer::EFailClient}
+        };
+
+//Package all the above together into a policy
+const CPolicyServer::TPolicy KCmServerPolicy =
+        {
+        //specifies all connect attempts should pass
+        CPolicyServer::EAlwaysPass,
+        KCmServerRangeCount,
+        KCmServerRanges,
+        KCmServerElementsIndex,
+        KCmServerElements
+        };
+
+
+// ---------------------------------------------------------------------------
+// CCmServer::CCmServer
+// ---------------------------------------------------------------------------
+//
+CCmServer::CCmServer()
+    : CPolicyServer( CActive::EPriorityHigh, KCmServerPolicy )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::CCmServer"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::ConstructL()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::ConstructL"));
+
+    iServerState = ECmServerStateIdle;
+    iSessionCount = (TInt*) User::AllocL( sizeof( TInt ) );
+    *iSessionCount = 0;
+
+    LOG(_L("[Cm Server]\t Creating settings.."));
+    iSettings = CCmSettingsFactory::NewCmSettingsEngineL();
+
+    TCmServiceState cmState( ECmServiceStateDisabled );
+    iSettings->GetServiceState( ECmServiceContentManager, cmState );
+
+    TRACE(Print(_L("[Cm Server]\t Cm state is %d\n"), cmState));
+
+    if ( cmState )
+        {
+        LOG(_L("[Cm Server]\t Creating scheduler.."));
+        iScheduler = CCmScheduler::NewL( *this, *iSettings );
+        if ( cmState == ECmServiceStateAutomatic )
+            {
+            iScheduler->SetServiceToExecute( ECmServicePreProcessingStore );
+            }
+        }
+
+    LOG(_L("[Cm Server]\t Creating db manager"));
+    iDbManager = CCmDmMain::NewL();
+    LOG(_L("[Cm Server]\t Creating Mde session"));
+    iSession = CMdESession::NewL(*this);
+    
+    RPointerArray<CCmDriveInfo> drives;
+    CleanupClosePushL( drives );
+    iDbManager->PrepareQueryCmdL( EDrivesQuery );
+    iDbManager->QueryDrivesL( drives );
+    TRACE(Print(_L("[Cm Server]\t Drives count = %d"),
+        drives.Count() ));
+    if( drives.Count() )
+        {
+        SetDriveSelectionStatus( ETrue );
+        }
+    drives.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &drives );
+    
+    LOG(_L("[Cm Server]\t Creating memory manager"));
+    TBool mmEnabled( EFalse );
+    iSettings->GetMemoryManagerStatus( mmEnabled );
+    LOG(_L("[Cm Server]\t Creating memory manager"));
+    iMemoryManager = CCmMmMain::NewL( *iDbManager );
+    iMemoryManager->SetQuotaListenerStateL( mmEnabled );
+
+    LOG(_L("[Cm Server]\t Creating store manager"));
+    iStoreManager = CmStoreManagerFactory::NewStoreManagerL( this, *iSession,
+        iDbManager, iMemoryManager);
+
+    LOG(_L("[Cm Server]\t Creating fill manager"));
+    iFillManager = CmFillManagerFactory::NewFillManagerL(
+        this, *iSession, iDbManager, iMemoryManager);
+
+    LOG(_L("[Cm Server]\t Starting server..."));
+
+    StartL( KCmServerName );
+
+    LOG(_L("[Cm Server]\t CCmServer::ConstructL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::NewLC
+// ---------------------------------------------------------------------------
+//
+CCmServer* CCmServer::NewLC()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::NewLC"));
+    CCmServer *self = new (ELeave) CCmServer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::~CCmServer
+// ---------------------------------------------------------------------------
+//
+CCmServer::~CCmServer()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::~CCmServer"));
+
+    delete iDeviceDiscoveryTimer;
+    delete iFillRuleContainer;
+
+    if ( iFillManager )
+        {
+        iFillManager->Close();
+        }
+    if ( iStoreManager )
+        {
+        iStoreManager->Close();
+        }
+    if ( iAvController )
+        {
+        iAvController->RemoveDeviceObserver();
+		iAvController->Release();
+		iAvController = NULL;
+        }
+
+    iMdhClient->Close();
+    delete iPropertyContainer;
+    delete iDbManager;
+    delete iMemoryManager;
+    delete iSessionCount;
+    iSettings->Close();
+    delete iSession;
+    delete iScheduler;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmServer::NewSessionL
+// ---------------------------------------------------------------------------
+//
+CSession2* CCmServer::NewSessionL( const TVersion& aVersion,
+                                   const RMessage2 &/*aMessage*/) const
+    {
+    LOG(_L("[Cm Server]\t CCmServer::NewSessionL"));
+    // check we're the right version
+    TVersion version( KCmServerMajor,
+                      KCmServerMinor,
+                      KCmServerBuild);
+
+    if( !User::QueryVersionSupported( version, aVersion ) )
+        {
+        LOG(_L("[Cm Server]\t CCmServer::NewSessionL leave with \
+        KErrNotSupported"));
+        User::Leave( KErrNotSupported );
+        }
+    ++(*iSessionCount);
+    // make new session
+    return CCmSession::NewL( *iDbManager, *iSettings );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::CreateAvcAndTimerL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::CreateAvcAndTimerL()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::CreateAvcAndTimerL"));
+    
+    iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL();
+    iAvController->SetDeviceObserver( *this );
+    
+    LOG( _L("[Cm Server]\t Creating CPeriodic timer..." ) );
+    
+    iDeviceDiscoveryTimer = CPeriodic::NewL(EPriorityHigh);
+    TInt deviceDiscoveryDelay( 0 );
+    iSettings->GetDiscoveryDelay( deviceDiscoveryDelay );
+    
+    TRACE(Print(_L("[Cm Server]\t using device discovery delay %d\n"),
+        deviceDiscoveryDelay));
+    
+    iDeviceDiscoveryTimer->Start(deviceDiscoveryDelay * KMega,
+                  0,
+                  TCallBack(SearchTimerCompletedL,
+                  this));
+    
+    LOG( _L("[Cm Server]\t Updated!" ) );
+    
+    iMediaServers.ResetAndDestroy();
+    
+    LOG( _L("[Cm Server]\t Loading media servers from db..." ) );
+    
+    iDbManager->GetMediaServersL( iMediaServers );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::LeaveIfNotReadyL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::LeaveIfNotReadyL()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::LeaveIfNotReadyL"));
+    
+    if ( ServerState() != ECmServerStateIdle )
+        {
+        if ( !ServerState() ) // CM disabled
+            {
+            LOG(_L("[Cm Server]\t CCmServer::LeaveIfNotReadyL \
+            leave with KErrNotReady"));
+            User::Leave( KErrNotReady );
+            }
+        // CM busy
+        LOG(_L("[Cm Server]\t CCmServer::LeaveIfNotReadyL \
+        leave with KErrServerBusy"));
+        User::Leave( KErrServerBusy );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::DeleteUnselectedFillFilesL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::DeleteUnselectedFillFilesL()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::DeleteUnselectedFillFilesL"));
+    
+    for ( ; iFillRuleIndex < iFillRuleContainer->FillRuleCount();
+            iFillRuleIndex++ )
+        {
+        CCmFillRule* rule =
+            iFillRuleContainer->FillRule( iFillRuleIndex );
+
+        TCmFillRuleStatus status = rule->Selected();
+        
+        if ( status == ECmUnSelected || status == ECmDeleted )
+        	{
+        	iDeletingDeletedItems = ETrue;
+        	DeleteFilledFilesL();
+        	iFillRuleIndex = iFillRuleContainer->FillRuleCount();
+        	}
+        }
+    
+    if ( !iDeletingDeletedItems )
+    	{
+    	// no unselected lists - complete delete request
+    	iDeletingDeletedItems = EFalse;
+    	ServiceExecuted( ECmServiceDeleteFilledFiles, KErrNone );
+    	}
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::DecrementSessions
+// ---------------------------------------------------------------------------
+//
+void CCmServer::DecrementSessions()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::DecrementSessions"));
+
+    --( *iSessionCount );
+    
+    if ( (*iSessionCount) <= 0 )
+        {
+        TCmServiceState cmState;
+        iSettings->GetServiceState( ECmServiceContentManager, cmState );
+        TBool mmEnabled;
+        iSettings->GetMemoryManagerStatus( mmEnabled );
+
+        if ( !cmState && !mmEnabled &&
+             ServerState() == ECmServerStateIdle )
+             // cm & mm disabled and server idle
+            {
+            // shutdown server
+            LOG(_L("[Cm Server]\t Server & mm disabled and \
+                no sessions left, shutting down.."));
+            CActiveScheduler::Stop();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::ServerState
+// ---------------------------------------------------------------------------
+//
+TCmServerState CCmServer::ServerState() const
+    {
+    TRACE( Print( _L("[Cm Server]\t CCmServer::ServerState \
+    iServerState = %d"), iServerState ));
+    return iServerState;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::PropertyContainer
+// ---------------------------------------------------------------------------
+//
+CCmSqlPropertyContainer* CCmServer::PropertyContainer() const
+    {
+    LOG(_L("[Cm Server]\t CCmServer::PropertyContainer"));
+    return iPropertyContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::PropertyCollector
+// ---------------------------------------------------------------------------
+//
+CCmSqlPropertyCollector* CCmServer::PropertyCollector() const
+    {
+    LOG(_L("[Cm Server]\t CCmServer::PropertyCollector"));
+    return iPropertyCollector;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::MediaServerArray
+// ---------------------------------------------------------------------------
+//
+RPointerArray<CCmMediaServerFull>& CCmServer::MediaServerArray()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::MediaServerArray"));
+    
+    return iMediaServers;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::UpdateFillPriorities
+// ---------------------------------------------------------------------------
+//
+void CCmServer::UpdateFillPriorities()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::UpdateFillPriorities"));
+    iFillManager->UpdatePriorities();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::DeletePropertyContainer
+// ---------------------------------------------------------------------------
+//
+void CCmServer::DeletePropertyContainer()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::DeletePropertyContainer"));
+    
+    if ( iPropertyContainer )
+        {
+        delete iPropertyContainer;
+        iPropertyContainer = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::DeleteItemsByFillListId
+// ---------------------------------------------------------------------------
+//
+void CCmServer::DeleteItemsByFillListId( TInt aFillListId )
+	{
+    LOG(_L("[Cm Server]\t CCmServer::DeleteItemsByFillListId"));
+    
+    TInt error = iDbManager->DeleteItemsByFillListId( aFillListId );
+            
+    if ( error )
+       	{
+       	TRACE( Print( _L("[Cm Server]\t CCmServer::DeleteItemsByFillListId \
+       	error = %d\n"), error ));
+       	}
+	}
+
+// ---------------------------------------------------------------------------
+// CCmServer::FillRuleContainerL
+// ---------------------------------------------------------------------------
+//
+CCmFillRuleContainer* CCmServer::FillRuleContainerL() const
+    {
+    LOG(_L("[Cm Server]\t CCmServer::FillRuleContainerL"));
+
+    RPointerArray<HBufC8> array;
+    CleanupClosePushL( array );
+    iDbManager->PrepareQueryCmdL( EFillRuleNamesQuery );
+    iDbManager->QueryFillRuleNamesL( array );
+    TRACE(Print(_L("[Cm Server]\t fill rule array size is %d"),
+        array.Count()));
+
+    CCmFillRuleContainer* ruleContainer = CCmFillRuleContainer::NewLC();
+    for ( TInt i = 0; i < array.Count(); i++ )
+        {
+        CCmFillRule* rule = CCmFillRule::NewLC();
+        rule->SetNameL( *(array[i]) );
+        iDbManager->PrepareQueryCmdL( EFillRuleQuery );
+        iDbManager->QueryFillRuleL( rule );
+
+        ruleContainer->AddFillRuleL( rule );
+        CleanupStack::Pop( rule );
+        }
+    CleanupStack::Pop( ruleContainer );
+    array.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &array );
+    
+    return ruleContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::ExecuteStoreL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::ExecuteStoreL()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::ExecuteStoreL"));
+    TInt err = KErrNone;
+    iServerState = ECmServerStateStoring;
+    if ( !iAvController ) // need to create avc and wait for devices
+        {
+        TRAP( err, CreateAvcAndTimerL() );
+        TRACE(Print(_L("[Cm Server]\t CreateAvcAndTimerL err = %d"), err ));
+        }
+    else // avc already created, start store
+        {
+        iStoreManager->SetAvController( iAvController );
+        TRAP( err, iStoreManager->StartStoreL() );
+        }
+    if ( err )
+        {
+        TRACE(Print(_L("[Cm Server]\t Error occurred = %d"), err ));
+        ServiceExecuted( ECmServiceStore, err );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::ExecuteFillL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::ExecuteFillL()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::ExecuteFillL"));
+    if( !iDriveSelectionStatus )
+        {
+        LOG(_L("[Cm Server]\t No drives selected. Do not start fill!!!"));
+        iServerState = ECmServerStateFilling;
+        ServiceExecuted( ECmServiceFill, KErrNone );
+        }
+    else
+        {
+        TInt err = KErrNone;
+        if ( !iAvController ) // need to create avc and wait for devices
+            {
+            TRAP( err, CreateAvcAndTimerL() );
+            }
+        else // avc already created, start fill
+            {
+            iSettings->GetMemoryManagerStatus( iMmState );
+            TRACE(Print(_L("[Cm Server]\t Mm status = %d"), (TInt)iMmState ));
+            LOG(_L("[Cm Server]\t Disabling quota listener..."));
+            iMemoryManager->SetQuotaListenerStateL( EFalse );
+            iAvController->RemoveDeviceObserver();
+            iFillManager->SetAvController( iAvController );
+            TRAP( err, iFillManager->StartFillL() );            
+            }
+        iServerState = ECmServerStateFilling;
+        if ( err )
+            {
+            ServiceExecuted( ECmServiceFill, err );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::SetCurrentAsyncMsg
+// ---------------------------------------------------------------------------
+//
+void CCmServer::SetCurrentAsyncMsg( const RMessage2& aMessage )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::SetCurrentAsyncMsg"));
+    if ( !iAsyncRequestOn )
+        {
+        iCurrentAsyncMsg = aMessage;
+        iAsyncRequestOn = ETrue;
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::SearchTimerCompletedL
+// ---------------------------------------------------------------------------
+//
+TInt CCmServer::SearchTimerCompletedL(TAny* aInstance)
+    {
+    LOG(_L("[Cm Server]\t CCmServer::SearchTimerCompleted"));
+    return static_cast<CCmServer*>(aInstance)->DoSearchTimerCompletedL();
+   }
+
+// ---------------------------------------------------------------------------
+// CCmServer::DoSearchTimerCompletedL
+// ---------------------------------------------------------------------------
+//
+TInt CCmServer::DoSearchTimerCompletedL()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::DoSearchTimerCompleted"));
+    delete iDeviceDiscoveryTimer;
+    iDeviceDiscoveryTimer = NULL;
+
+    switch ( ServerState() )
+        {
+        case ECmServerStateFilling:
+            {
+            ExecuteFillL();
+            break;
+            }
+
+        case ECmServerStateStoring:
+            {
+            ExecuteStoreL();
+            break;
+            }
+
+        case ECmServerStateSearchingForServers:
+            {
+            ServiceExecuted( ECmServiceSearchForServers, KErrNone );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::DoSearchTimerCompletedL \
+            leave with KErrUnknown"));
+            User::Leave( KErrUnknown );
+            break;
+            }
+        }
+    return KErrNone;
+   }
+
+// ---------------------------------------------------------------------------
+// CCmServer::SetServiceStateL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::SetServiceStateL( TCmService aService,
+                                  TCmServiceState aState )
+    {
+    TRACE( Print( _L("[Cm Server]\t CCmServer::SetServiceStateL \
+    state = %d"), aState ));
+
+    switch ( aService )
+        {
+        case ECmServiceFill:  // fall through
+        case ECmServiceStore: // fall through
+        case ECmServiceContentManager:
+        // sync setting
+            {
+            switch ( aState )
+                {
+                case ECmServiceStateDisabled:
+                    {
+                    iSettings->SetAutoSync( EFalse );
+                    // disable scheduler
+                    if ( iScheduler )
+                        {
+                        LOG(_L("[Cm Server]\t CCmServer::\
+                        SetServiceStateL delete scheduler"));
+                        delete iScheduler;
+                        iScheduler = NULL;
+                        }
+                    break;
+                    }
+
+                case ECmServiceStateAutomatic:
+                    {
+                    // enable scheduler
+                    if ( !iScheduler )
+                        {
+                        iScheduler = CCmScheduler::NewL( *this, *iSettings );
+                        LOG(_L("[Cm Server]\t CCmServer::\
+                        SetServiceStateL create scheduler"));
+
+                        }
+                    iScheduler->SetServiceToExecute(
+                        ECmServicePreProcessingStore );
+                    iSettings->SetAutoSync( ETrue );
+                    break;
+                    }
+                default:
+                    {
+                    LOG(_L("[Cm Server]\t CCmServer::SetServiceStateL \
+                    leave with KErrArgument"));
+                    User::Leave( KErrArgument );
+                    }
+                }
+            iSettings->SetServiceState( ECmServiceContentManager,
+                                        aState );
+            break;
+            }
+        case ECmServiceMemoryManager:
+            {
+            TBool enable = (TBool) aState;
+            iMemoryManager->SetQuotaListenerStateL( enable );
+            iSettings->SetMemoryManagerStatus( enable );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::SetServiceStateL \
+            leave with KErrArgument"));
+            User::Leave( KErrArgument );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::ExecuteServiceL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::ExecuteServiceL( TCmService aService )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::ExecuteServiceL"));
+    
+    ExecuteServiceL( aService, 0, NULL );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::ExecuteServiceL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::ExecuteServiceL( TCmService aService,
+                                 TInt aOptParam1,
+                                 TAny* aOptParam2 )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::ExecuteServiceL"));
+    LeaveIfNotReadyL();
+
+#ifdef _DEBUG
+
+    TInt alloc;
+    TInt cells = User::Heap().AllocSize( alloc );
+    TInt size = User::Heap().Size();
+    TRACE(Print(_L("[Cm Server]\t heap allocsize %d, size %d, cells %d"),
+        alloc, size, cells ));
+
+#endif
+
+
+
+    switch ( aService )
+        {
+        case ECmServiceHarvest:
+            {
+            LOG(_L("[Cm Server]\t ECmServiceHarvest"));
+
+            if ( iMdhClient )
+                {
+                iMdhClient->Close();
+                iMdhClient = NULL;
+                }
+
+            iMdhClient = CCmMdhClientFactory::NewCmMdhClientL( *this );
+            User::LeaveIfError( iMdhClient->Harvest() );
+            iServerState = ECmServerStateHarvesting;
+            break;
+            }
+        case ECmServiceFill:
+            {
+            LOG(_L("[Cm Server]\t ECmServiceFill"));
+            ExecuteFillL();
+            break;
+            }
+        case ECmServiceStore:
+            {
+            LOG(_L("[Cm Server]\t ECmServiceStore"));
+
+            // just executes deletefilledfiles and
+            // sets a flag to start store after that
+            iExecuteStoreAfterDelete = ETrue;
+            ExecuteServiceL( ECmServiceDeleteFilledFiles );
+            break;
+            }
+        case ECmServicePreProcessingStore:
+            {
+            LOG(_L("[Cm Server]\t ECmServicePreProcessingStore"));
+            iStoreManager->PreProcessLists();
+            iServerState = ECmServerStatePreProcessingStore;
+            break;
+            }
+
+        case ECmServicePreProcessingFill:
+            {
+            LOG(_L("[Cm Server]\t ECmServicePreProcessingFill"));
+            iFillManager->PreProcessListsL();
+            iServerState = ECmServerStatePreProcessingFill;
+            break;
+            }
+
+        case ECmServiceGetStoreFields:
+            {
+            LOG(_L("[Cm Server]\t ECmServiceGetStoreFields"));
+
+            iServerState = ECmServerStateGettingStoreFields;
+
+            TCmMediaType mediaType =
+                static_cast<TCmMediaType> ( aOptParam1 );
+
+            DeletePropertyContainer();
+            iPropertyContainer = CCmSqlPropertyContainer::NewL();
+            iStoreManager->GetColItemsL( mediaType, *iPropertyContainer );
+
+            break;
+            }
+
+        case ECmServiceGetFillFields:
+            {
+            LOG(_L("[Cm Server]\t ECmServiceGetFillFields"));
+
+            iServerState = ECmServerStateGettingFillFields;
+
+            iPropertyCollector =
+                    static_cast<CCmSqlPropertyCollector*> (aOptParam2);
+
+            iFillManager->GetMetadataItemsL( *iPropertyCollector );
+
+            break;
+            }
+        case ECmServiceSearchForServers:
+            {
+            LOG(_L("[Cm Server]\t ECmServiceSearchForServers"));
+
+            if ( !iAvController )
+                {
+                CreateAvcAndTimerL();
+                }
+            iServerState = ECmServerStateSearchingForServers;
+            break;
+            }
+
+        case ECmServiceDeleteFilledFiles:
+            {
+            LOG(_L("[Cm Server]\t ECmServiceDeleteFilledFiles"));
+
+            iServerState = ECmServerStateDeleting;
+            iFillRuleContainer = FillRuleContainerL();
+            iFillRuleIndex = 0;
+
+            DeleteUnselectedFillFilesL();
+            DeleteItemsByFillListId( KDeleteDataBaseItem );
+            // this request is completed in DeleteComplete or
+            // DeleteUnselectedFillFilesL
+            break;
+            }
+
+        case ECmServicePreProcessingFilllist:
+            {
+            LOG(_L("[Cm Server]\t ECmServicePreProcessingFilllist"));
+
+            HBufC8* listName = static_cast<HBufC8*> ( aOptParam2 );
+            iFillManager->PreProcessListL( *listName );
+            iServerState = ECmServerStatePreProcessingFilllist;
+            delete listName;
+            break;
+            }
+        case ECmServiceUpdateFillLists:
+            {
+            LOG(_L("[Cm Server]\t ECmServiceUpdateFillLists"));
+            UpdateFillPriorities();
+            iServerState = ECmServerStateUpdatingFillLists;
+            break;
+            }
+        case ECmServiceDeleteMetadata:
+            {                   
+            LOG(_L("[Cm Server]\t ECmServiceDeleteMetadata"));
+            iFillManager->DeleteMetadataL();
+            iServerState = ECmServerStateDeletingMetadata;
+            break;
+            }
+        default:
+
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ExecuteServiceL \
+            leave with KErrArgument"));
+            User::Leave( KErrArgument );
+            break;
+            }
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::CancelServiceL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::CancelServiceL()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::CancelServiceL"));
+    switch ( ServerState() )
+        {
+        case ECmServerStateHarvesting:
+            {
+            iMdhClient->Stop();
+            break;
+            }
+
+        case ECmServerStateFilling:               // fall through
+        case ECmServerStatePreProcessingFill:     // fall through
+        case ECmServerStatePreProcessingFilllist: // fall through
+        case ECmServerStateGettingFillFields:     // fall through
+        case ECmServerStateUpdatingFillLists:     // fall through
+        case ECmServerStateDeletingMetadata:
+            {
+            if ( iDeviceDiscoveryTimer ) // only possible with fill
+                {
+                ServiceExecuted( ECmServiceFill, KErrCancel );
+                }
+            else
+                {
+                iFillManager->CancelOperation();
+                }
+            break;
+            }
+
+        case ECmServerStateStoring:
+        case ECmServerStatePreProcessingStore:
+        case ECmServerStateGettingStoreFields:
+
+            {
+            if ( iDeviceDiscoveryTimer ) // only possible with store
+                {
+                ServiceExecuted( ECmServiceStore, KErrCancel );
+                }
+            else
+                {
+                iStoreManager->CancelOperation();
+                }
+            break;
+            }
+
+        case ECmServerStateSearchingForServers:
+            {
+            ServiceExecuted( ECmServiceSearchForServers, KErrCancel );
+            break;
+            }
+
+        case ECmServerStateDeleting:
+            {
+            iMemoryManager->Cancel();
+            if ( iFillRuleContainer )
+                {
+                delete iFillRuleContainer;
+                iFillRuleContainer = NULL;
+                }
+            ServiceExecuted( ECmServiceDeleteFilledFiles, KErrCancel );
+            break;
+            }
+
+        case ECmServerStateIdle:
+            {
+            break;
+            }
+
+        default:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::CancelServiceL \
+            leave with KErrNotReady"));
+            User::Leave( KErrNotReady );
+            break;
+            }
+        }
+
+    LOG(_L("[Cm Server]\t CCmServer::CancelServiceL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::DeleteFilledFilesL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::DeleteFilledFilesL()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::DeleteFilledFilesL"));
+    iDbManager->PrepareQueryCmdL(EAllFillFilesStatusQuery);
+    CDesCArrayFlat* filesToDelete =
+                new (ELeave) CDesCArrayFlat( KArrayGranularity );
+    CleanupStack::PushL( filesToDelete );
+
+    TInt ret( KErrNone );
+    TFileName file;
+    RPointerArray<CCmDriveInfo> drives;
+    CleanupClosePushL( drives );
+    iDbManager->PrepareQueryCmdL( EDrivesQuery );
+    TRAP( ret, iDbManager->QueryDrivesL( drives ) );
+    TRACE(Print(_L("[Cm Server]\t QueryDrivesL error = %d \n"),
+        ret ));
+    
+    RPointerArray<CCmFillListItem> items;
+    CleanupClosePushL( items );
+    iDbManager->PrepareQueryCmdL( EAllFillFilesStatusQuery );
+    iDbManager->GetAllFillFilesL( items,
+        ECmToBeShrinked | ECmToBeFilled | ECmFilled | ECmLocalCopy );
+
+    TRACE(Print(_L("[Cm Server]\t %d total count of list items \n"),
+        items.Count()));
+    
+    RFs fs;
+    ret = fs.Connect();
+    TRACE(Print(_L("[Cm Server]\t File session connect error = %d \n"),
+        ret ));
+    
+    TLinearOrder<CCmFillListItem> key( CompareById );
+    items.Sort( key );
+    TInt itemcount = items.Count();
+    CCmFillListItem* pi = NULL;
+    CCmFillListItem* pj = NULL;
+    for ( TInt i = 0; i < itemcount; i++ )
+        {
+        CleanupStack::PushL( items[i] );
+        pi = items[i];
+        // if file is on some other list, do not delete
+        if( ECmToBeFilled == pi->Status() ||
+            ECmToBeShrinked == pi->Status() || 
+            ECmLocalCopy == pi->Status() )
+            {
+            // Do not handle this. Already removed.
+            }
+        else
+            {
+            TCmListItemStatus sta( ECmToBeFilled );
+            // gets list status where item belogs to
+            TInt err = GetStatusByGroupId( pi->ListId(), sta );
+            TRACE( Print( _L("[Cm Server]\t GetStatusByGroupId ret = %d\n"),
+            err ));
+            if( pi->Selected() == ECmUnSelected ||
+                pi->Selected() == ECmDeleted )
+                {
+                //file of unselected, delete
+                if( pi->RefId() == 0 )
+                    {
+                    file.Append( *ResolveAndAppendRootPathL( fs,
+                                  pi->DriveNumber() ));
+                    file.Append( pi->Path() );
+                    TRAPD( error, filesToDelete->InsertIsqL( file ) );
+                    if ( error )
+                        {
+                        TRACE( Print( _L("[Cm Server]\t GetStatusByGroupId \
+                        error = %d\n"), error ));
+                        }
+                    UpdateDriveQuota( drives, *pi );
+                    file.Zero();
+                    }
+                //duplicated file, just set status
+                if( ECmUnSelected == pi->Selected() )
+                    {
+                    pi->SetStatus( sta );
+                    }
+                }
+            else
+                {
+                 //duplicated file, just set status
+                if( pi->RefId() != 0 )
+                    {
+                    pi->SetStatus( sta );
+                    }
+                else
+                    {
+                    TInt j( 0 );
+                    for ( j = i + 1; j < itemcount; j++ )
+                        {
+                        pj = items[j];
+                        if( items[i]->DbId() != items[j]->DbId() )
+                            {
+                            break;
+                            }
+                        else if ( ECmSelected == pj->Selected() &&
+                                  pj->Priority() < pi->Priority() )
+                            {
+                            file.Append( *ResolveAndAppendRootPathL( fs,
+                                          pi->DriveNumber() ) );
+                            file.Append( pi->Path() );
+                            filesToDelete->InsertIsqL( file );
+                            UpdateDriveQuota( drives, *pi );
+                            file.Zero();
+                            items[i]->SetStatus( sta );
+                            break;
+                            }
+                        }
+                    for ( j = i - 1; j >= 0; j-- )
+                        {
+                        pj = items[j];
+                        if( items[i]->DbId() != items[j]->DbId() )
+                            {
+                            break;
+                            }
+                        else if ( ECmSelected == pj->Selected() &&
+                                  pj->Priority() < pi->Priority() )
+                            {
+                            file.Append( *ResolveAndAppendRootPathL( fs,
+                                          pi->DriveNumber() ) );
+                            file.Append( pi->Path() );
+                            filesToDelete->InsertIsqL( file );
+                            UpdateDriveQuota( drives, *pi );
+                            file.Zero();
+                            items[i]->SetStatus( sta );
+                            break;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    
+    filesToDelete->Compress();
+    TRACE(Print(_L("[Cm Server]\t %d files to delete\n"),
+        filesToDelete->Count()));
+    iMemoryManager->SetObserver( *this );
+    // delete files asynchronously
+    // DeleteCompleteL callback is called when ready
+    iMemoryManager->DeleteFilesL( *filesToDelete );
+    
+    //refresh the fill items
+    iDbManager->DeleteFillFiles();
+    iDbManager->SetFillFiles( items );
+	CleanupStack::Pop( items.Count() );
+    items.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &items );
+
+    TRAP( ret, iDbManager->SetDrivesL( drives ) );
+    drives.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &drives );
+    
+    TRACE(Print(_L("[Cm Server]\t Poping filesToDelete \n")));
+    CleanupStack::PopAndDestroy( filesToDelete );
+
+    //updates RefIds
+    iFillManager->UpdateRefIds();
+    iDbManager->DeleteDeletedItemsL();   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::CreateFileDeleteSQLL
+// ---------------------------------------------------------------------------
+void CCmServer::CreateFileDeleteSQLL( RPointerArray<CCmFillListItem>& aItems,
+                                      RPointerArray<CCmDriveInfo>& aDrives,
+                                      CDesCArrayFlat* aFilesToDelete )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::CCmServer::CreateFileDeleteSQLL"));
+    
+    TFileName file;
+    
+    TInt ret( KErrNone );
+    RFs fs;
+    ret = fs.Connect();   
+    TRACE(Print(_L("[Cm Server]\t File session connect error = %d \n"),
+        ret ));    
+
+    if ( ret == KErrNone )
+        {
+        for ( TInt i = 0; i < aItems.Count(); i++ )
+            {                        
+            // if file is on some other list, do not delete
+            if( ECmToBeFilled == aItems[i]->Status() ||
+                ECmToBeShrinked == aItems[i]->Status() || 
+                ECmLocalCopy == aItems[i]->Status() )
+                {
+                // Do not handle this. Already removed.
+                }
+            else
+                {
+                TCmListItemStatus sta( ECmToBeFilled );
+                TInt err = GetStatusByGroupId( aItems[i]->ListId(), sta );
+                TRACE( Print( _L("[Cm Server]\t GetStatusByGroupId \
+                ret = %d\n"),
+                err ));
+                if( aItems[i]->Selected() == ECmUnSelected ||
+                    aItems[i]->Selected() == ECmDeleted )
+                    {
+                    //file of unselected, delete
+                    if( aItems[i]->RefId() == 0 )
+                        {
+                        file.Append( *ResolveAndAppendRootPathL( fs,
+                            aItems[i]->DriveNumber() ));
+                        file.Append( aItems[i]->Path() );
+                        TRAPD( error, aFilesToDelete->InsertIsqL( file ) );
+                        if ( error )
+                            {
+                            TRACE( Print( _L("[Cm Server]\t \
+                            insertIsql failed with error = %d\n"), error ));
+                            }
+                        UpdateDriveQuota( aDrives, *aItems[i] );
+                        file.Zero();
+                        }
+                    //duplicated file, just set status
+                    if( ECmUnSelected == aItems[i]->Selected() )
+                        {
+                        aItems[i]->SetStatus( sta );
+                        }
+                    }
+                else
+                    {
+                     //duplicated file, just set status
+                    if( aItems[i]->RefId() != 0 )
+                        {
+                        aItems[i]->SetStatus( sta );
+                        }
+                    else
+                        {
+                        for ( TInt j = 0; j < aItems.Count(); j++ )
+                            {
+                            //If the prioritys of items with the same Dbid
+                            //have changed, should delete files
+                            if( aItems[i]->DbId() == aItems[j]->DbId() &&
+                                i != j &&
+                                ECmSelected == aItems[j]->Selected() &&
+                                aItems[j]->Priority() < 
+                                aItems[i]->Priority() )
+                                {
+                                file.Append( *ResolveAndAppendRootPathL( fs,
+                                    aItems[i]->DriveNumber() ));
+                                file.Append( aItems[i]->Path() );
+                                TRAPD( error, aFilesToDelete->InsertIsqL(
+                                                                file ) );
+                                if ( error )
+                                    {
+                                    TRACE( Print( _L("[Cm Server]\t \
+                                    CCmServer::DeleteFilledFilesL \
+                                    error = %d\n"), error ));
+                                    }
+                                UpdateDriveQuota( aDrives, *aItems[i] );
+                                file.Zero();
+    
+                                //set status and break
+                                aItems[i]->SetStatus( sta );
+                                j = aItems.Count();
+                                }
+                            }
+                        }
+                    }
+                }     
+            }            
+        }
+    fs.Close();               
+    }
+                                   
+// ---------------------------------------------------------------------------
+// CCmServer::ServiceExecuted
+// ---------------------------------------------------------------------------
+//
+void CCmServer::ServiceExecuted( TCmService aService, TInt aErrCode )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted"));
+    TRACE(Print(_L("[Cm Server]\t service %d state %d err %d\n"),
+        aService, iServerState, aErrCode ));
+
+#ifdef _DEBUG
+
+    TInt alloc;
+    TInt cells = User::Heap().AllocSize( alloc );
+    TInt size = User::Heap().Size();
+    TRACE(Print(_L("[Cm Server]\t heap allocsize %d, size %d, cells %d"),
+        alloc, size, cells ));
+
+#endif
+
+    if ( iDeviceDiscoveryTimer )
+        {
+        delete iDeviceDiscoveryTimer;
+        iDeviceDiscoveryTimer = NULL;
+        }
+
+    if ( aService != ServerState() )
+        {
+        LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted INTERNAL ERROR"));
+        return;
+        }
+
+    TBool returnToIdle = ETrue;
+    switch ( aService )
+        {
+        case ECmServiceHarvest:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServiceHarvest"));
+
+            // Harvest includes fill preprocessing
+            iServerState = ECmServerStateIdle;
+            TRAPD( error, ExecuteServiceL( ECmServicePreProcessingFill ) );
+            if ( error )
+                {
+                TRACE( Print( _L("[Cm Server]\t CCmServer::\
+                ServiceExecuted fill preprocessing error = %d"), error));
+                }
+            // return from here because processing continues,
+            // so we do not complete msg
+            return;
+            }
+        case ECmServiceFill:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServiceFill"));
+            TRACE(Print(_L("[Cm Server]\t Setting mm to state = %d"),
+                (TInt)iMmState ));
+            TRAPD( error, iMemoryManager->SetQuotaListenerStateL(
+                                                        iMmState ) );
+            if ( error )
+                {
+                TRACE( Print( _L("[Cm Server]\t CCmServer::\
+                ServiceExecuted ECmServiceFill \
+                error = %d"), error));
+                }
+
+            if ( aErrCode == KErrNone )
+                {
+                iDbManager->SetSyncTime();
+                }
+            // Creation of av controller failed
+            if( KErrServerTerminated == aErrCode )
+                {
+                aErrCode = KErrNone;
+                }
+            iFillManager->SetAvController( NULL );
+            if ( iAvController )
+                {
+                iAvController->RemoveDeviceObserver();
+				iAvController->Release();
+				iAvController = NULL;
+                LOG(_L("[Cm Server]\t avc deleted"));
+                }
+            break;
+            }
+        case ECmServiceStore:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServiceStore"));
+
+            iStoreManager->SetAvController( NULL );
+            if ( aErrCode != KErrNone )
+                {
+                if ( iAvController )
+                    {
+                    iAvController->RemoveDeviceObserver();
+					iAvController->Release();
+					iAvController = NULL;
+                    LOG(_L("[Cm Server]\t avc deleted"));
+                    }
+                }
+            break;
+            }
+        case ECmServicePreProcessingStore:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServicePreProcessingStore"));
+            break;
+            }
+
+        case ECmServicePreProcessingFill:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+            ECmServicePreProcessingFill"));
+            iServerState = ECmServerStateIdle;
+            TRAPD( error, ExecuteServiceL( ECmServicePreProcessingStore ) );
+            if ( error )
+                {
+                TRACE( Print( _L("[Cm Server]\t CCmServer::\
+                ServiceExecuted ECmServicePreProcessingFill \
+                error = %d"), error));
+                }
+            break;
+            }
+
+        case ECmServiceGetStoreFields:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServiceGetStoreFields"));
+            break;
+            }
+
+        case ECmServiceGetFillFields:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServiceGetFillFields"));
+            break;
+            }
+
+        case ECmServiceSearchForServers:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServiceSearchForServers"));
+            iAvController->RemoveDeviceObserver();
+    		iAvController->Release();
+    		iAvController = NULL;
+    		iServerState = ECmServerStateIdle;
+            break;
+            }
+
+        case ECmServiceDeleteFilledFiles:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServiceDeleteFilledFiles"));
+
+            // check if store is flagged to be run after delete
+            if ( aErrCode == KErrNone && iExecuteStoreAfterDelete )
+                {
+                iExecuteStoreAfterDelete = EFalse;
+                TRAPD( error, ExecuteStoreL() );
+                if ( error )
+                    {
+                    TRACE( Print( _L("[Cm Server]\t CCmServer::\
+                    ServiceExecuted ECmServiceDeleteFilledFiles \
+                    error = %d"), error));
+                    }
+                return;
+                }
+            iExecuteStoreAfterDelete = EFalse;
+            break;
+            }
+
+        case ECmServicePreProcessingFilllist:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServicePreProcessingFilllist"));
+            break;
+            }
+        case ECmServerStateUpdatingFillLists:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServerStateUpdatingFillLists"));
+            break;
+            }
+        case ECmServerStateDeletingMetadata:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                ECmServerStateDeletingMetadata"));
+            break;
+            }
+        default:
+            {
+            LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \
+                default"));
+            }
+        }
+
+    if ( aService == ECmServicePreProcessingFill )
+        {
+        return;
+        }
+
+    if ( !iCurrentAsyncMsg.IsNull() )
+        // client-initiated case
+        {
+        LOG(_L("[Cm Server]\t CCmServer::completing message.."));
+
+        iCurrentAsyncMsg.Complete( aErrCode );
+
+        iAsyncRequestOn = EFalse;
+
+        if ( returnToIdle )
+            {
+            iServerState = ECmServerStateIdle;
+            }
+        }
+
+    else // scheduler-initiated case
+        {
+        if ( returnToIdle )
+            {
+            iServerState = ECmServerStateIdle;
+            }
+
+        iScheduler->ServiceExecuted( aService, aErrCode );
+        }
+
+
+    if ( aService == ECmServiceFill ||
+         aService == ECmServicePreProcessingStore )
+        {
+        TCmProgressInfo progressInfo;
+        progressInfo.iService = ECmServiceNone;
+        progressInfo.iProcessedItems = 0;
+        progressInfo.iItemsToTransferPerService = 0;
+        TCmProgressInfoPckg progressPckg( progressInfo );
+
+        TInt err =
+            RProperty::Set( KCmPropertyCat, KCmProperty, progressPckg );
+
+        TRACE( Print( _L(
+            "[CMSERVER]\t CmServer::ServiceExecuted progresInfo sent"),
+            progressInfo.iProcessedItems, progressInfo.iTotalItems));
+        }
+
+    TCmServiceState cmState;
+    iSettings->GetServiceState( ECmServiceContentManager, cmState );
+    TBool mmEnabled;
+        iSettings->GetMemoryManagerStatus( mmEnabled );
+
+    if ( !cmState && !mmEnabled && !(*iSessionCount) &&
+         !ServerState() == ECmServerStateIdle
+         )
+        // server & mm disabled and idle, no sessions
+        {
+        // shutdown server
+        LOG(_L("[Cm Server]\t Server & mm disabled and \
+            no sessions left, shutting down.."));
+        CActiveScheduler::Stop();
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::UPnPDeviceDiscovered
+// ---------------------------------------------------------------------------
+//
+void CCmServer::UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::UPnPDeviceDiscovered"));
+    CUpnpAVDevice* device = const_cast<CUpnpAVDevice*> ( &aDevice );
+
+    TRACE(Print(_L("[Cm Server]\t serverstate %d devicetype %d\n"),
+        iServerState, device->DeviceType() ));
+    TBool allFound( EFalse );
+    if( device->DeviceType() == CUpnpAVDevice::EMediaServer )
+        {
+        for( TInt i = 0 ; i < iMediaServers.Count(); i++ )
+            {
+            if( KErrNotFound !=
+                device->Uuid().Match( iMediaServers[i]->MediaServer() ) )
+                {
+                iMediaServers[i]->SetIsActive( EFalse );
+                }
+            if( iMediaServers[i]->IsActive() )
+                {
+                allFound = ETrue;
+                }
+            }
+         }
+
+    if ( ServerState() == ECmServerStateSearchingForServers &&
+         device->DeviceType() == CUpnpAVDevice::EMediaServer )
+        {
+        TRAPD( error, CheckServerL( *device ) );
+        if ( error )
+            {
+            TRACE( Print( _L("[Cm Server]\t CCmServer::\
+            UPnPDeviceDiscovered error = %d"), error));
+            }
+        }
+
+    if( !allFound && iMediaServers.Count() &&
+        device->DeviceType() == CUpnpAVDevice::EMediaServer &&
+        iDeviceDiscoveryTimer )
+        {
+        delete iDeviceDiscoveryTimer;
+        iDeviceDiscoveryTimer = NULL;
+        
+        TRACE( Print(
+            _L("[Cm Server]\t All Servers found => Start Syncing\n") ) );
+        TRAPD( error, DoSearchTimerCompletedL() );
+        if ( error )
+            {
+            TRACE( Print( _L("[Cm Server]\t CCmServer::\
+            UPnPDeviceDiscovered searchtimer error = %d"), error));
+            }
+        iMediaServers.ResetAndDestroy();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::UPnPDeviceDisappeared
+// ---------------------------------------------------------------------------
+//
+void CCmServer::UPnPDeviceDisappeared( const CUpnpAVDevice& /* aDevice */)
+    {
+    LOG(_L("[Cm Server]\t CCmServer::UPnPDeviceDisappeared"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::DeleteCompleteL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::DeleteCompleteL( TInt aErr )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::DeleteCompleteL"));
+    
+    iDeletingDeletedItems = EFalse;
+    // just complete delete process
+    ServiceExecuted( ECmServiceDeleteFilledFiles, aErr );
+    }
+
+// ---------------------------------------------------------------------------
+// See mdesession.h
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CCmServer::HandleSessionOpened( CMdESession& /*aSession*/,
+    TInt aError )
+    {
+#else
+void CCmServer::HandleSessionOpened( CMdESession& /*aSession*/,
+    TInt /*aError*/ )
+    {
+#endif
+    TRACE(Print(_L("[Cm Server]\t CCmServer::HandleSessionOpened\
+         aError = %d"), aError ));
+    }
+
+// ---------------------------------------------------------------------------
+// See mdesession.h
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CCmServer::HandleSessionError( CMdESession& /*aSession*/,
+    TInt aError )
+    {
+#else
+void CCmServer::HandleSessionError( CMdESession& /*aSession*/,
+    TInt /*aError*/ )
+    {
+#endif
+    TRACE(Print(_L("[Cm Server]\t CCmServer::HandleSessionError\
+         aError = %d"), aError ));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::WLANConnectionLost
+// ---------------------------------------------------------------------------
+//
+void CCmServer::WLANConnectionLost()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::WLANConnectionLost"));
+    LOG(_L("[Cm Server]\t Finishing operation..."));
+
+    TInt err( KErrNone );
+
+    TRAP( err,CancelServiceL() );
+
+    if ( err )
+        {
+        TRACE( Print( _L( "[Cm Server]\t Wlan lost error = %d" ), err ) );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmServer::DriveSelectionStatus
+// --------------------------------------------------------------------------
+TBool CCmServer::DriveSelectionStatus()
+    {
+    LOG(_L("[Cm Server]\t CCmServer::DriveSelectionStatus"));
+    
+    return iDriveSelectionStatus;
+    }
+
+// --------------------------------------------------------------------------
+// CCmServer::SetDriveSelectionStatus
+// --------------------------------------------------------------------------
+void CCmServer::SetDriveSelectionStatus( const TBool aDriveSelectionStatus )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::SetDriveSelectionStatus"));
+    
+    iDriveSelectionStatus = aDriveSelectionStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::ResolveAndAppendRootPathL
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmServer::ResolveAndAppendRootPathL( RFs& aFs,
+                                             const TInt aDriveNumber )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::ResolveAndAppendRootPathL"));
+
+    HBufC* buf = HBufC::NewLC( KDriveBufferSize );
+    TChar driveChar;
+    TInt error = aFs.DriveToChar( aDriveNumber, driveChar );
+    if ( !error )
+        {
+        buf->Des().Append( driveChar );
+        buf->Des().Append( KColon );
+        }
+    buf->Des().Append( KDoubleBackSlash );
+    CleanupStack::Pop();
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::UpdateDriveQuota
+// ---------------------------------------------------------------------------
+//
+void CCmServer::UpdateDriveQuota( RPointerArray<CCmDriveInfo>& aDrives,
+    CCmFillListItem& aItem )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::UpdateDriveQuota"));
+
+    for( TInt i = 0; i < aDrives.Count(); i++ )
+        {
+        if( aDrives[i]->DriveNumber() == aItem.DriveNumber() )
+            {
+            TInt64 usedQuota( aDrives[i]->UsedDriveQuota() );
+            usedQuota -= aItem.Size();
+            aDrives[i]->SetUsedDriveQuota( usedQuota );
+            i = aDrives.Count();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::ShrinkCompleteL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::ShrinkCompleteL( TInt /* aErr */)
+    {
+    LOG(_L("[Cm Server]\t CCmServer::ShrinkCompleteL"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::GetStatusByGroupId
+// ---------------------------------------------------------------------------
+//
+TInt CCmServer::GetStatusByGroupId( TUint aListId,
+                                    TCmListItemStatus& aStatus )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::GetStatusByGroupId"));
+
+    TInt result( KErrNotFound );
+    TInt count = iFillRuleContainer->FillRuleCount();
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        CCmFillRule* rule =
+            iFillRuleContainer->FillRule( i );
+        if ( rule->ListId() == aListId )
+            {
+            aStatus = rule->Status();
+            result = KErrNone;
+            i = count;
+            }
+        }
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::CheckServerL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::CheckServerL( const CUpnpAVDevice& aDevice )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::CheckServerL"));
+
+    CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC();
+    tempServer->SetUDNL( aDevice.Uuid() );
+    iDbManager->PrepareQueryCmdL( EMediaServerInfoQyery );
+    TInt errCode = iDbManager->QueryMediaServerL( tempServer );
+    if ( errCode == KErrNotFound )
+        {
+        LOG(_L("[CmMdh Server]\t not found in DB, adding new.."));
+        tempServer->SetMediaServerNameL( aDevice.FriendlyName() );
+        tempServer->SetSystemUpdateID( KDefaultSystemUpdateId );
+        TTime timeStamp;
+        timeStamp.HomeTime();
+        tempServer->SetVisibleDate( timeStamp );
+        iDbManager->AddMediaServerL( tempServer );
+
+        }
+    else
+        {
+        TRACE(Print(_L("[CmMdh Server]\t CCmServer::CheckServerL \
+        error = %d"), errCode ));
+        }
+    CleanupStack::PopAndDestroy( tempServer );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmServer::SetAsyncRequestStateL
+// ---------------------------------------------------------------------------
+//
+void CCmServer::SetAsyncRequestStateL( TBool aState )
+    {
+    LOG(_L("[Cm Server]\t CCmServer::SetAsyncRequestStateL"));
+
+    iAsyncRequestOn = aState;
+
+    if ( !iCurrentAsyncMsg.IsNull() )
+        {
+        iCurrentAsyncMsg.Complete( KErrNone );
+        }
+
+    if ( !iScheduler )
+        {
+        iScheduler = CCmScheduler::NewL( *this, *iSettings );
+        LOG(_L("[Cm Server]\t CCmServer::SetAsyncRequestState\
+                 scheduler created"));
+        }
+
+    // responsibility of starting services transferred to scheduler
+    iScheduler->SetScheduledServiceState( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// CompareById
+// For sort. Sort is based on db id
+// ---------------------------------------------------------------------------
+// 
+TInt CCmServer::CompareById( const CCmFillListItem& aItem1,
+                             const CCmFillListItem& aItem2 )
+    {
+    TInt result = 0;
+
+    if ( aItem1.DbId() < aItem2.DbId() )
+        {
+        result = -1;
+        }
+    else if ( aItem1.DbId() > aItem2.DbId() )
+        {
+        result = 1;
+        }
+
+    return result;
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/src/server/cmservermain.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main functions to start the Content Manager server
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmserver.h"
+#include "msdebug.h"
+
+
+// LOCAL FUNCTION PROTOTYPES
+void RunServerL();
+
+// ---------------------------------------------------------------------------
+// E32Main
+//
+// Module entry point
+// ---------------------------------------------------------------------------
+//
+TInt E32Main()
+    {
+    LOG(_L("[Cm Server]\t E32Main"));
+    
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    TInt error = KErrNoMemory;
+    if ( cleanup )
+        {
+        TRAP( error, RunServerL() );
+        delete cleanup;
+        }
+    __UHEAP_MARKEND;
+    
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// RunServerL
+// 
+// Constructs Active Scheduler and starts the server up & running
+// ---------------------------------------------------------------------------
+//
+void RunServerL()
+    {
+    LOG(_L("[Cm Server]\t RunServerL"));
+    // Create and install the active scheduler we need
+    CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    // Create server
+    CCmServer* server = CCmServer::NewLC();
+
+    // Initialisation complete, now signal the client
+    User::LeaveIfError( RThread().RenameMe( KCmServerName ) );
+    RProcess::Rendezvous( KErrNone );
+
+    // Ready to run
+    CActiveScheduler::Start();
+
+    // Cleanup the server and scheduler
+    CleanupStack::PopAndDestroy( server );
+    CleanupStack::PopAndDestroy( scheduler );
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmserver/src/server/cmserversession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1138 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Session implementation class for Content Manager
+*
+*/
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <s32mem.h>
+
+#include    "cmcommon.h"
+#include    "cmfillrulecontainer.h"
+#include    "cmfillrule.h"
+#include    "cmstorerulecontainer.h"
+#include    "cmstorerule.h"
+#include    "cmbaselistitem.h"
+#include    "cmdmmain.h"
+#include    "cmsettingsfactory.h"
+#include    "cmsettings.h"
+#include    "cmmediaserverfull.h"
+#include    "cmsqlpropertycontainer.h"
+#include    "cmsqlpropertycollector.h"
+#include    "cmdriveinfo.h"
+#include    "cmserversession.h"
+#include    "cmserver.h"
+#include    "msdebug.h"
+
+// data buffer size
+const TInt KBufferExpandSize = KKilo;
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCmSession::CCmSession
+// ---------------------------------------------------------------------------
+//
+CCmSession::CCmSession( CCmDmMain& aDbManager, MCmSettings& aSettings )
+    : iDbManager( aDbManager ), iSettings( aSettings )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSession::NewL
+// ---------------------------------------------------------------------------
+//
+CCmSession* CCmSession::NewL( CCmDmMain& aDbManager,
+                              MCmSettings& aSettings )
+    {
+    LOG(_L("[Cm Server]\t CCmSession::NewL"));
+    CCmSession* self =
+        new (ELeave) CCmSession( aDbManager, aSettings );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSession::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmSession::ConstructL()
+    {
+    LOG(_L("[Cm Server]\t CCmSession::ConstructL"))
+    iCollector = CCmSqlPropertyCollector::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmSession::~CCmSession
+// ---------------------------------------------------------------------------
+//
+CCmSession::~CCmSession()
+    {
+    LOG(_L("[Cm Server]\t CCmSession::~CCmSession"));
+
+    delete iDataBuffer;
+
+    Server().DecrementSessions();
+
+    delete iCollector;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CCmSession::Server
+// Returns a reference to server
+// ---------------------------------------------------------------------------
+//
+CCmServer& CCmSession::Server()
+    {
+    LOG(_L("[Cm Server]\t CCmSession::Server"));
+    
+    return *static_cast<CCmServer*>(const_cast<CServer2*>
+        (CSession2::Server()));
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CCmSession::ServiceL
+// Implements CSession2 -derived ServiceL -method.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCmSession::ServiceL(const RMessage2& aMessage)
+    {
+    LOG(_L("[Cm Server]\t CCmSession::ServiceL"));
+
+    switch ( aMessage.Function() )
+        {
+        case ECmExecuteService:
+            {
+            LOG(_L("[Cm Server]\t ECmExecuteService request"));
+            TCmService service = (TCmService)aMessage.Int0();
+
+            TRACE( Print (_L("[Cm Server]\t CCmSession::\
+            ServiceL ECmExecuteService service = %d\n"), service ));
+
+            Server().SetCurrentAsyncMsg( aMessage );
+            Server().ExecuteServiceL( service );
+            break;
+            }
+
+        case ECmCancel:
+            {
+            LOG(_L("[Cm Server]\t ECmCancel request"));
+            Server().CancelServiceL();
+
+            aMessage.Complete( KErrNone );
+            break;
+            }
+
+        case ECmGetServerState:
+            {
+            LOG(_L("[Cm Server]\t ECmGetServerState request"));
+            TPckg<TCmServerState> pckg( Server().ServerState() );
+            aMessage.WriteL(0, pckg );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+
+        case ECmGetServiceState:
+            {
+            LOG(_L("[Cm Server]\t ECmGetServiceState request"));
+            TCmService service = static_cast<TCmService>(aMessage.Int0());
+
+            TRACE( Print (_L("[Cm Server]\t CCmSession::\
+            ServiceL ECmGetServiceState service = %d\n"), service ));
+
+            TCmServiceState state = ECmServiceStateDisabled;
+            TInt err( KErrNone );
+            switch ( service )
+                {
+                case ECmServiceFill:  // fall through
+                case ECmServiceStore: // fall through
+                case ECmServiceContentManager:
+                    {
+                    iSettings.GetServiceState( ECmServiceContentManager,
+                                               state );
+                    if ( state )
+                        {
+                        TBool autoSync = EFalse;
+                        iSettings.GetAutoSync( autoSync );
+                        if ( autoSync )
+                            {
+                            state = ECmServiceStateAutomatic;
+                            }
+                        else
+                            {
+                            LOG(_L("[Cm Server]\t ECmGetServiceState \
+                            request autosync = disabled"));
+                            }
+                        }
+                    else
+                        {
+                        LOG(_L("[Cm Server]\t ECmGetServiceState request \
+                        state = ECmServiceStateDisabled"));
+                        }
+                    break;
+                    }
+                case ECmServiceMemoryManager:
+                    {
+                    TBool mm = EFalse;
+                    iSettings.GetMemoryManagerStatus( mm );
+                    state = ECmServiceStateAutomatic;
+                    if ( !mm )
+                        {
+                        state = ECmServiceStateDisabled;
+                        }
+
+                    break;
+                    }
+                default:
+                    {
+                    err = KErrArgument;
+                    break;
+                    }
+                }
+            TPckg<TCmServiceState> pckg( state );
+            aMessage.WriteL(1, pckg );
+            aMessage.Complete( err );
+            break;
+            }
+
+        case ECmSetServiceState:
+            {
+            LOG(_L("[Cm Server]\t ECmSetServiceState request"));
+
+            TCmService service = static_cast<TCmService>(aMessage.Int0());
+            TCmServiceState state =
+                static_cast<TCmServiceState>(aMessage.Int1());
+
+            TRACE(Print(_L("[Cm Server]\t service %d state %d \n"),
+                service, state ));
+
+            Server().SetServiceStateL( service, state );
+
+            aMessage.Complete( KErrNone );
+            break;
+            }
+
+        case ECmGetItemCount:
+            {
+            LOG(_L("[Cm Server]\t ECmGetItemCount request"));
+            TCmService service = static_cast<TCmService>(aMessage.Int2());
+
+            TRACE( Print (_L("[Cm Server]\t CCmSession::\
+            ServiceL ECmGetItemCount service = %d\n"), service ));
+
+            TInt len = aMessage.GetDesLength( 3 );
+            if( len <= 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmGetItemCount request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            HBufC8* name = HBufC8::NewLC( len );
+            TPtr8 ptr( name->Des() );
+            aMessage.ReadL( 3, ptr );
+            TInt64 size = 0;
+            TInt count = 0;
+
+            if ( service == ECmServiceFill )
+                {
+                size = iDbManager.ListSize(
+                    ECmFmFillRule,
+                    *name,
+                    ECmFilled | ECmToBeFilled | ECmToBeShrinked
+                );
+                iDbManager.GetFillFileCount(
+                    *name,
+                    ECmFilled | ECmToBeFilled | ECmToBeShrinked,
+                    count
+                );
+                TRACE(Print(_L("[Cm Server]\t got fill size %ld count %d"),
+                    size, count));
+                }
+            else // ECmServiceStore
+                {
+                size = iDbManager.ListSize(
+                    ECmFmStoreRule,
+                    *name,
+                    ECmToBeRemoved | ECmToBeShrinked | ECmKeepOnDevice
+                );
+                iDbManager.GetStoreFileCount(
+                    *name,
+                    ECmToBeRemoved | ECmToBeShrinked | ECmKeepOnDevice,
+                    count
+                );
+                TRACE(Print(_L("[Cm Server]\t got store size %ld count %d"),
+                    size, count));
+                }
+            CleanupStack::PopAndDestroy( name );
+            TPckg<TInt> countPckg( count );
+            TPckg<TInt64> sizePckg( size );
+            aMessage.WriteL( 0, countPckg );
+            aMessage.WriteL( 1, sizePckg );
+
+            aMessage.Complete( KErrNone );
+            break;
+            }
+
+        case ECmGetTransferInfo:
+            {
+            LOG(_L("[Cm Server]\t ECmGetTransferInfo request"));
+            TCmService service = static_cast<TCmService>(aMessage.Int0());
+            TInt count( 0 );
+            TInt time( 0 );
+            TPckg<TInt> countPckg( count );
+            TPckg<TInt> timePckg( time );
+
+            iDbManager.GetTransferInfo(
+                service, count, time );
+
+            TRACE(Print(_L("[Cm Server]\t ECmGetTransferInfo \
+            count = %d, time = %d"), count, time));
+
+            aMessage.WriteL( 1, countPckg );
+            aMessage.WriteL( 2, timePckg );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+
+
+        case ECmGetDataFields:
+            {
+            LOG(_L("[Cm Server]\t ECmGetDataFields request"));
+
+            TInt len = aMessage.GetDesLength(0);
+            if( len <= 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmGetDataFields request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len));
+
+            HBufC8* buffer = HBufC8::NewLC(len);
+
+            TPtr8 ptr(buffer->Des());
+            aMessage.ReadL(0, ptr);
+            RDesReadStream stream;
+            stream.Open(ptr);
+            CleanupClosePushL(stream);
+
+            iCollector->InternalizeL( stream );
+
+            Server().SetCurrentAsyncMsg( aMessage );
+            Server().ExecuteServiceL( ECmServiceGetFillFields,
+                                      0,
+                                      iCollector );
+            CleanupStack::PopAndDestroy( 2 );
+            break;
+            }
+
+        case ECmGetDataFieldSize:
+            {
+            LOG(_L("[Cm Server]\t ECmGetDataFieldSize request"));
+
+            delete iDataBuffer;
+            iDataBuffer = NULL;
+
+            iDataBuffer = CBufFlat::NewL( KBufferExpandSize );
+            RBufWriteStream propertyStream;
+            propertyStream.Open( *iDataBuffer );
+            CleanupClosePushL( propertyStream );
+
+            CCmSqlPropertyCollector* propertyCollector =
+                Server().PropertyCollector();
+
+            if( !propertyCollector )
+                {
+                LOG(_L("[Cm Server]\t ECmGetDataFieldSize request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            propertyCollector->ExternalizeL( propertyStream );
+
+            TInt size = iDataBuffer->Size();
+            TPckg<TInt> pckg( size );
+            aMessage.WriteL(0, pckg );
+            CleanupStack::PopAndDestroy( &propertyStream );
+
+            TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size));
+
+            aMessage.Complete( KErrNone );
+            break;
+            }
+
+        case ECmGetDataBuffer:
+            {
+            TInt errCode = KErrNone;
+            if ( !iDataBuffer )
+                {
+                LOG(_L("[Cm Server]\t ECmGetDataBuffer \
+                databuffer doesn't exist"));
+                errCode = KErrNotReady;
+                }
+
+            if (errCode == KErrNone )
+                {
+                aMessage.WriteL(0, iDataBuffer->Ptr(0));
+                }
+            aMessage.Complete( errCode );
+            break;
+            }
+
+        case ECmGetFillRulesSize:
+            {
+            LOG(_L("[Cm Server]\t ECmGetFillRulesSize request"));
+
+            delete iDataBuffer;
+            iDataBuffer = NULL;
+
+            iDataBuffer = CBufFlat::NewL( KBufferExpandSize );
+            RBufWriteStream ruleStream;
+            ruleStream.Open( *iDataBuffer );
+            CleanupClosePushL( ruleStream );
+
+            CCmFillRuleContainer* ruleContainer =
+                Server().FillRuleContainerL();
+            CleanupStack::PushL( ruleContainer );
+            ruleContainer->ExternalizeL( ruleStream );
+            CleanupStack::PopAndDestroy( ruleContainer );
+
+            TInt size = iDataBuffer->Size();
+            TPckg<TInt> pckg( size );
+            aMessage.WriteL(0, pckg );
+            CleanupStack::PopAndDestroy( &ruleStream );
+
+            TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size));
+
+            aMessage.Complete( KErrNone );
+            LOG(_L("[Cm Server]\t ECmGetFillRulesSize request end"));
+
+            break;
+            }
+
+        case ECmGetStoreItemsSize:
+            {
+            LOG(_L("[Cm Server]\t ECmGetStoreItemsSize request"));
+
+            TInt len = aMessage.GetDesLength( 0 );
+            if( len <= 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmGetStoreItemsSize request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            HBufC8* name = HBufC8::NewLC( len );
+            TPtr8 ptr( name->Des() );
+            aMessage.ReadL(0, ptr);
+
+            iDbManager.PrepareQueryCmdL( EStoreFilesQuery );
+            RPointerArray<CCmBaseListItem> items;
+            CleanupClosePushL( items );
+
+            iDbManager.QueryStoreFileListL(
+                items,
+                *name,
+                ECmToBeRemoved | ECmToBeShrinked | ECmKeepOnDevice
+            );
+            
+            TInt count = items.Count();
+
+            TRACE(Print(_L("[Cm Server]\t store item array size is %d"),
+                count));
+
+            delete iDataBuffer;
+            iDataBuffer = NULL;
+
+            iDataBuffer = CBufFlat::NewL( KBufferExpandSize );
+            RBufWriteStream ruleStream;
+            ruleStream.Open( *iDataBuffer );
+            CleanupClosePushL( ruleStream );
+
+            for ( TInt i = 0; i < count; i++ )
+                {
+                items[i]->ExternalizeL( ruleStream );
+                }
+
+            CleanupStack::PopAndDestroy( &ruleStream );
+            items.ResetAndDestroy();
+            CleanupStack::PopAndDestroy( &items );
+            CleanupStack::PopAndDestroy( name );
+
+            TInt size = iDataBuffer->Size();
+
+            TPckg<TInt> sizePckg( size );
+            aMessage.WriteL( 1, sizePckg );
+            TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size));            
+
+            TPckg<TInt> countPckg( count );
+            aMessage.WriteL( 2, countPckg );
+            TRACE(Print(_L("[Cm Server]\t item count is %d"), count));
+
+            aMessage.Complete( KErrNone );
+
+            LOG(_L("[Cm Server]\t ECmGetStoreItemsSize request end"));
+
+            break;
+            }
+
+        case ECmGetFillItemsSize:
+            {
+            LOG(_L("[Cm Server]\t ECmGetFillItemsSize request"));
+
+            TInt len = aMessage.GetDesLength( 0 );
+            if( len <= 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmGetFillItemsSize request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            HBufC8* name = HBufC8::NewLC( len );
+            TPtr8 ptr( name->Des() );
+            aMessage.ReadL(0, ptr);
+
+            iDbManager.PrepareQueryCmdL( EFillFilesQuery );
+            RPointerArray<CCmBaseListItem> items;
+            CleanupClosePushL( items );
+
+            iDbManager.QueryFillFileListL(
+                items,
+                *name,
+                ECmFilled | ECmToBeFilled | ECmToBeShrinked | ECmLocalCopy
+            );
+            
+            TInt count = items.Count();
+
+            TRACE(Print(_L("[Cm Server]\t list item array size is %d"),
+                count));
+
+            delete iDataBuffer;
+            iDataBuffer = NULL;
+
+            iDataBuffer = CBufFlat::NewL( KBufferExpandSize );
+            RBufWriteStream ruleStream;
+            ruleStream.Open( *iDataBuffer );
+            CleanupClosePushL( ruleStream );
+
+            for ( TInt i = 0; i < count; i++ )
+                {
+                items[i]->ExternalizeL( ruleStream );
+                }
+
+            CleanupStack::PopAndDestroy( &ruleStream );
+            items.ResetAndDestroy();
+            CleanupStack::PopAndDestroy( &items );
+            CleanupStack::PopAndDestroy( name );
+            TInt size = iDataBuffer->Size();
+
+            TPckg<TInt> sizePckg( size );
+            aMessage.WriteL( 1, sizePckg );
+            TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size));            
+
+            TPckg<TInt> countPckg( count );
+            aMessage.WriteL( 2, countPckg );
+            TRACE(Print(_L("[Cm Server]\t item count is %d"), count));
+
+            aMessage.Complete( KErrNone );
+
+            LOG(_L("[Cm Server]\t ECmGetStoreItemsSize request end"));
+
+            break;
+            }
+
+        case ECmSetFillRules:
+            {
+            LOG(_L("[Cm Server]\t ECmSetFillRules request"));
+
+            TInt len = aMessage.GetDesLength(0);
+            if( len <= 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmSetFillRules request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len));
+
+            HBufC8* buffer = HBufC8::NewLC(len);
+
+            TPtr8 ptr(buffer->Des());
+            aMessage.ReadL(0, ptr);
+            RDesReadStream stream;
+            stream.Open(ptr);
+            CleanupClosePushL(stream);
+
+            CCmFillRuleContainer* tempContainer =
+                CCmFillRuleContainer::NewLC();
+            tempContainer->InternalizeL( stream );
+            iDbManager.DeleteAllFillRules();
+            for ( TInt i = 0; i < tempContainer->FillRuleCount(); i++ )
+                {
+#ifdef _DEBUG
+                TDesC8& name = tempContainer->FillRule( i )->Name();
+                TBuf<KMaxFileName> buf;
+                buf.Copy(name);
+                TRACE(Print(_L("[Cm Server]\t updating fill rule %S"), &buf));
+#endif
+
+                if ( tempContainer->FillRule( i )->Selected() == ECmDeleted )
+                    {
+                    TRACE(Print(_L("[Cm Server]\t skipping deleted rule %S"),
+                        &buf));
+                    iDbManager.SetFillListStateL(
+                        tempContainer->FillRule( i )->ListId(), ECmDeleted );
+                    }
+                else
+                    {
+                    TRACE(Print(_L("[Cm Server]\t storing rule %S to db"),
+                        &buf));
+                    TInt ret = iDbManager.AddFillRuleL(
+                        tempContainer->FillRule( i ));
+                    TRACE(Print(_L("[Cm Server]\t ret = %d"), ret));
+                    }
+                }
+            aMessage.Complete( KErrNone );
+            CleanupStack::PopAndDestroy( 3, buffer );
+            break;
+            }
+
+        case ECmPreProcessFillList:
+            {
+            LOG(_L("[Cm Server]\t ECmPreProcessFillList request"));
+
+            TInt len = aMessage.GetDesLength( 0 );
+            if( len <= 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmPreProcessFillList request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            HBufC8* name = HBufC8::NewLC( len );
+            TPtr8 ptr( name->Des() );
+            aMessage.ReadL(0, ptr);
+
+            TRACE(Print(_L("[Cm Server]\t list name %S"), name ));
+
+            Server().ExecuteServiceL(
+                ECmServicePreProcessingFilllist, 0, name );
+            Server().SetCurrentAsyncMsg( aMessage );
+
+            CleanupStack::Pop( name );
+            break;
+            }
+
+        case ECmGetSyncTime:
+            {
+            LOG(_L("[Cm Server]\t ECmGetSyncTime request"));
+            TTime syncTime;
+            TInt err = iDbManager.GetSyncTime( syncTime );
+            TRACE( Print(_L("[Cm Server]\t returning time %ld"),
+                   syncTime.Int64() ) );
+
+            TPckg<TTime> pckg( syncTime );
+            aMessage.WriteL( 0, pckg );
+            aMessage.Complete( err );
+            break;
+            }
+
+        case ECmGetMediaserversSize:
+            {
+            LOG(_L("[Cm Server]\t ECmGetMediaserversSize request"));
+
+            iDbManager.PrepareQueryCmdL( EMediaServersAllQuery );
+
+            delete iDataBuffer;
+            iDataBuffer = NULL;
+
+            iDataBuffer = CBufFlat::NewL( KBufferExpandSize );
+            RBufWriteStream serverStream;
+            serverStream.Open( *iDataBuffer );
+            CleanupClosePushL( serverStream );
+
+            TInt ret( KErrNone );
+            TInt amount = 0;
+            while( KErrNotFound != ret )
+                {
+                CCmMediaServerFull* server = CCmMediaServerFull::NewLC();
+                ret = iDbManager.QueryAllMediaServersL( server );
+                if( KErrNotFound != ret )
+                    {
+                    ++amount;
+                    server->ExternalizeL( serverStream );
+                    }
+                CleanupStack::PopAndDestroy( server );
+                }
+
+            TInt size = iDataBuffer->Size();
+            TPckg<TInt> pckg( size );
+            aMessage.WriteL(0, pckg );
+
+            TPckg<TInt> pckg2( amount );
+            aMessage.WriteL(1, pckg2 );
+
+            TRACE(Print(_L("[Cm Server]\t buffer size is %d, amount %d"),
+                size, amount));
+
+            aMessage.Complete( KErrNone );
+            CleanupStack::PopAndDestroy( &serverStream );
+            break;
+            }
+
+        case ECmGetStoreRulesSize:
+            {
+            LOG(_L("[Cm Server]\t ECmGetStoreRulesSize request"));
+            RPointerArray<HBufC8> array;
+            CleanupClosePushL( array );
+            iDbManager.PrepareQueryCmdL( EStoreRuleNamesQuery );
+            iDbManager.QueryStoreRuleNamesL( array );
+            TRACE(Print(_L("[Cm Server]\t store rule array size is %d"),
+                array.Count()));
+
+            CCmStoreRuleContainer* ruleContainer =
+                CCmStoreRuleContainer::NewLC();
+            for ( TInt i = 0; i < array.Count(); i++ )
+                {
+                CCmStoreRule* rule = CCmStoreRule::NewLC();
+                rule->SetNameL( *(array[i]) );
+                iDbManager.PrepareQueryCmdL( EStoreRuleQuery );
+                iDbManager.QueryStoreRuleL( rule );
+                ruleContainer->AddStoreRuleL( rule );
+                CleanupStack::Pop( rule );
+                }
+
+            delete iDataBuffer;
+            iDataBuffer = NULL;
+
+            iDataBuffer = CBufFlat::NewL( KBufferExpandSize );
+            RBufWriteStream ruleStream;
+            ruleStream.Open( *iDataBuffer );
+            CleanupClosePushL( ruleStream );
+
+            ruleContainer->ExternalizeL( ruleStream );
+            TInt size = iDataBuffer->Size();
+            TPckg<TInt> pckg( size );
+            aMessage.WriteL(0, pckg );
+
+            TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size));
+
+            aMessage.Complete( KErrNone );
+            CleanupStack::PopAndDestroy( 2, ruleContainer );
+            array.Reset();
+            CleanupStack::PopAndDestroy( &array );
+            LOG(_L("[Cm Server]\t ECmGetStoreRulesSize request end"));
+
+            break;
+            }
+
+        case ECmSetStoreRules:
+            {
+            LOG(_L("[Cm Server]\t ECmSetStoreRules request"));
+
+            TInt len = aMessage.GetDesLength(0);
+            TInt totalCount(0);
+            if( len <= 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmSetStoreRules request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len));
+
+            HBufC8* buffer = HBufC8::NewLC(len);
+
+            TPtr8 ptr(buffer->Des());
+            aMessage.ReadL(0, ptr);
+            RDesReadStream stream;
+            stream.Open(ptr);
+            CleanupClosePushL(stream);
+
+            CCmStoreRuleContainer* tempContainer =
+                CCmStoreRuleContainer::NewLC();
+            tempContainer->InternalizeL( stream );
+            iDbManager.DeleteAllStoreRules();
+            for ( TInt i = 0; i < tempContainer->StoreRuleCount(); i++ )
+                {
+                TDesC8& name = tempContainer->StoreRule( i )->Name();
+                TBuf<KMaxFileName> buf;
+                buf.Copy(name);
+                TRACE(Print(_L("[Cm Server]\t updating store rule %S"),
+                    &buf));
+                TInt ret = iDbManager.AddStoreRuleL(
+                    tempContainer->StoreRule( i ));
+                TRACE(Print(_L("[Cm Server]\t ret = %d"), ret));
+
+                if( tempContainer->StoreRule( i )->Selected() )
+                    {
+                    TInt oneRuleCount(0);
+                    iDbManager.GetStoreFileCount(
+                           name,
+                           ECmToBeRemoved | ECmToBeShrinked | ECmKeepOnDevice,
+                           oneRuleCount );
+                    totalCount += oneRuleCount;
+                    }
+                }
+            TInt time (0);
+            TInt count(0);
+            iDbManager.GetTransferInfo( ECmServiceStore, count, time );
+            iDbManager.UpdateTransferInfo( ECmServiceStore, totalCount, 
+                    time ); 
+
+            aMessage.Complete( KErrNone );
+
+            CleanupStack::PopAndDestroy( 3, buffer );
+            break;
+            }
+
+        case ECmSetMediaServers:
+            {
+            LOG(_L("[Cm Server]\t ECmSetMediaServers request"));
+
+            TInt mediaServerCount = aMessage.Int1();
+            TInt len = aMessage.GetDesLength(0);
+            if( len <= 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmSetMediaServers request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len));
+            TRACE(Print(_L("[Cm Server]\t mediaserver count is %d"),
+                mediaServerCount ));
+
+            HBufC8* buffer = HBufC8::NewLC(len);
+
+            TPtr8 ptr(buffer->Des());
+            aMessage.ReadL(0, ptr);
+            RDesReadStream stream;
+            stream.Open(ptr);
+            CleanupClosePushL(stream);
+
+            RPointerArray<CCmMediaServerFull> mediaServers;
+            CleanupClosePushL( mediaServers);
+
+            for ( TInt i = 0; i < mediaServerCount; i++ )
+                {
+                CCmMediaServerFull* mediaServer =
+                    CCmMediaServerFull::NewLC();
+                mediaServer->InternalizeL( stream );
+                mediaServers.Append( mediaServer );
+                CleanupStack::Pop( mediaServer );
+                }
+            TInt ret = iDbManager.SetMediaServersL( mediaServers );
+            TRACE(Print(_L("[Cm Server]\t mediaservers update ret = %d"),
+                ret));
+
+            aMessage.Complete( ret );
+
+            mediaServers.ResetAndDestroy();            
+            CleanupStack::PopAndDestroy( 3 ); //buffer, &stream, &mediaServers
+            break;
+            }
+
+        case ECmSetFillFileStatuses:
+            {
+            LOG(_L("[Cm Server]\t ECmSetFillFileStatuses request"));
+
+            TInt itemCount = aMessage.Int1();
+            TInt len = aMessage.GetDesLength(0);
+            if( len <= 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmSetFillFileStatuses request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len));
+            TRACE(Print(_L("[Cm Server]\t item count is %d"),
+                itemCount ));
+
+            HBufC8* buffer = HBufC8::NewLC(len);
+
+            TPtr8 ptr(buffer->Des());
+            aMessage.ReadL(0, ptr);
+            RDesReadStream stream;
+            stream.Open(ptr);
+            CleanupClosePushL(stream);
+
+            RPointerArray<CCmBaseListItem> items;
+            CleanupClosePushL( items );
+
+            for ( TInt i = 0; i < itemCount; i++ )
+                {
+                CCmBaseListItem* item = CCmBaseListItem::NewLC();
+                item->InternalizeL( stream );
+                items.Append( item );
+                CleanupStack::Pop( item );
+                }
+            TInt ret = iDbManager.UpdateStatusValues( items );
+            TRACE(Print(_L("[Cm Server]\t fillfile status update ret = %d"),
+                ret));
+
+            aMessage.Complete( ret );
+
+            items.ResetAndDestroy();
+            CleanupStack::PopAndDestroy( 3 ); //buffer, &stream, &items
+            break;
+            }
+
+        case ECmGetAppWizardState:
+            {
+            LOG(_L("[Cm Server]\t ECmGetAppWizardState request"));
+
+            TInt appWizardState( KErrNotFound );
+            TInt err;
+            err = iSettings.GetAppWizardInformation( appWizardState );
+            TPckg<TInt> pckg( appWizardState );
+            aMessage.WriteL(0, pckg );
+            aMessage.Complete( err );
+            break;
+            }
+
+        case ECmSetAppWizardState:
+            {
+            LOG(_L("[Cm Server]\t ECmSetAppWizardState request"));
+            TInt err;
+            err = iSettings.SetAppWizardInformation();
+            aMessage.Complete( err );
+
+            break;
+            }
+        case ECmUpdateFillLists:
+            {
+            LOG(_L("[Cm Server]\t ECmUpdateLists request"));
+            Server().ExecuteServiceL(
+                ECmServiceUpdateFillLists, 0, NULL );
+            Server().SetCurrentAsyncMsg( aMessage );
+            break;
+            }
+        case ECmDeleteMetadata:
+            {
+            LOG(_L("[Cm Server]\t ECmDeleteMetadata request"));
+
+            Server().ExecuteServiceL(
+                ECmServiceDeleteMetadata, 0, NULL );
+            Server().SetCurrentAsyncMsg( aMessage );
+            break;
+            }
+        case ECmDeleteDeletedMediaServers:
+            {
+            TRAPD( err, iDbManager.DeleteDeletedMediaServersL() );
+            aMessage.Complete( err );
+            break;
+            }
+        case ECmGetDriveSelectionStatus:
+            {
+            TInt err( KErrNone );
+            TPckg<TBool> pckg( Server().DriveSelectionStatus() );
+            aMessage.WriteL( 0, pckg );
+            aMessage.Complete( err );
+            break;
+            }
+        case ECmSetDrives:
+            {
+            LOG(_L("[Cm Server]\t ECmSetDrives request"));
+
+            TInt driveCount = aMessage.Int1();
+            TInt len = aMessage.GetDesLength(0);
+            if( len < 0 )
+                {
+                LOG(_L("[Cm Server]\t ECmSetDrives request \
+                leaving with KErrArgument"));
+                User::Leave( KErrArgument );
+                }
+            TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len));
+            TRACE(Print(_L("[Cm Server]\t drive count is %d"),
+                driveCount ));
+
+            RPointerArray<CCmDriveInfo> origDrives;
+            CleanupClosePushL( origDrives );
+            
+            iDbManager.PrepareQueryCmdL( EDrivesQuery );
+            TRAPD( ret, iDbManager.QueryDrivesL( origDrives ) );
+            TRACE(Print(_L("[Cm Server]\t Query orig drives ret = %d"),
+                ret ));
+
+            HBufC8* buffer = HBufC8::NewLC(len);
+
+            TPtr8 ptr(buffer->Des());
+            aMessage.ReadL(0, ptr);
+            RDesReadStream stream;
+            stream.Open(ptr);
+            CleanupClosePushL(stream);
+
+            RPointerArray<CCmDriveInfo> drives;
+            CleanupClosePushL( drives );
+
+            for ( TInt i = 0; i < driveCount; i++ )
+                {
+                CCmDriveInfo* drive =
+                    CCmDriveInfo::NewLC();
+                drive->InternalizeL( stream );
+                drives.Append( drive );
+                }
+            // Has drive slots changed or has some mmc taken away
+            TBool driveSelected( EFalse );
+            for( TInt j = 0; j < origDrives.Count(); j++ )
+                {
+                for( TInt k = 0; k < drives.Count(); k++ )
+                    {
+                    if( origDrives[j]->DriveId() == drives[k]->DriveId() )
+                        {
+                        driveSelected = ETrue;
+                        if( origDrives[j]->DriveNumber() !=
+                            drives[k]->DriveNumber() )
+                            {
+                            // update fill list drive numbers and ids
+                            iDbManager.UpdateFillListDriveStatusesL(
+                                origDrives[j], drives[k], driveSelected );
+                            }
+                        else
+                            {
+                            // Do nothing, drive still in same slot as
+                            // previously
+                            }
+                        }
+                    }
+                if( !driveSelected )
+                    {
+                    // Drive not selected, update fill file list statuses
+                    // Use drive id in update clause
+                     iDbManager.UpdateFillListDriveStatusesL(
+                        origDrives[j], NULL, driveSelected );
+                    }
+                driveSelected = EFalse;
+                }
+
+            TRAP( ret, iDbManager.SetDrivesL( drives ) );
+            TRACE(Print(_L("[Cm Server]\t drives update ret = %d"),
+                ret));
+            if( drives.Count() )
+                {
+                Server().SetDriveSelectionStatus( ETrue );
+                }
+            else
+                {
+                Server().SetDriveSelectionStatus( EFalse );
+                }
+            aMessage.Complete( ret );
+
+            CleanupStack::PopAndDestroy( driveCount );
+            drives.Reset();
+            CleanupStack::PopAndDestroy( &drives );
+            CleanupStack::PopAndDestroy( 2, buffer );
+            origDrives.ResetAndDestroy();
+            CleanupStack::PopAndDestroy( &origDrives );
+            // Restart quota listener if needed
+            TBool mmEnabled( EFalse );
+            iSettings.GetMemoryManagerStatus( mmEnabled );
+            Server().SetServiceStateL( ECmServiceMemoryManager,
+                (TCmServiceState)mmEnabled );
+            break;
+            }
+        case ECmGetDrivesSize:
+            {
+            LOG(_L("[Cm Server]\t ECmGetDrivesSize request"));
+
+            iDbManager.PrepareQueryCmdL( EDrivesQuery );
+
+            delete iDataBuffer;
+            iDataBuffer = NULL;
+
+            iDataBuffer = CBufFlat::NewL( KBufferExpandSize );
+            RBufWriteStream driveStream;
+            driveStream.Open( *iDataBuffer );
+            CleanupClosePushL( driveStream );
+
+            RPointerArray<CCmDriveInfo> drives;
+            CleanupClosePushL( drives );
+            iDbManager.QueryDrivesL( drives );
+            for( TInt i = 0; i < drives.Count(); i++ )
+                {
+                drives[i]->ExternalizeL( driveStream );
+                }
+
+            TInt size = iDataBuffer->Size();
+            TPckg<TInt> pckg( size );
+            aMessage.WriteL(0, pckg );
+
+            TPckg<TInt> pckg2( drives.Count() );
+            aMessage.WriteL(1, pckg2 );
+
+            TRACE(Print(_L("[Cm Server]\t buffer size is %d, amount %d"),
+                size, drives.Count() ));
+
+            aMessage.Complete( KErrNone );
+            drives.ResetAndDestroy();
+            CleanupStack::PopAndDestroy( &drives );
+            CleanupStack::PopAndDestroy( &driveStream );
+            break;
+            }
+        case ECmApplicationExit:
+            {
+            LOG(_L("[Cm Server]\t ECmApplicationExit request"));
+            Server().SetAsyncRequestStateL( EFalse );
+            if ( !aMessage.IsNull() )
+                {
+                aMessage.Complete( KErrNone );
+                }
+            break;
+            }
+        case ECmGetFilledFilesSize:
+            {
+            LOG(_L("[Cm Server]\t ECmGetFilledFilesSize request"));
+            TInt id = aMessage.Int1();
+            TInt64 size = iDbManager.BytesFilled( id );
+            TPckg<TInt64> pckg( size );
+
+            aMessage.WriteL(0, pckg );
+            aMessage.Complete( KErrNone );
+
+            break;
+            }
+        default:
+            {
+            LOG(_L("[Cm Server]\t default panic with ECmClientBadRequest"));
+            // Unknown opcode --> panic client
+            PanicClient( aMessage, ECmClientBadRequest );
+            break;
+            }
+        }
+
+    // If ServiceL leaves, default implementation in server framework
+    // completes the RMessage2 with the leave code.
+    }
+
+// ---------------------------------------------------------------------------
+// PanicClient
+// Client panic handler
+// RMessage2::Panic() also completes the message. This is:
+// (a) important for efficient cleanup within the kernel
+// (b) a problem if the message is completed a second time
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCmSession::PanicClient( const RMessage2& aMessage, TInt aPanic ) const
+    {
+    TRACE(Print(_L("[Cm Server]\t PanicClient: Reason = %d\n"), aPanic));
+    aMessage.Panic( KCmServerPanic, aPanic );
+    }    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/bwins/cmstoremanageru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewStoreManagerL@CmStoreManagerFactory@@SAPAVMCmSmManager@@PAVMCmServiceObserver@@AAVCMdESession@@PAVCCmDmMain@@PAVCCmMmMain@@@Z @ 1 NONAME ; class MCmSmManager * CmStoreManagerFactory::NewStoreManagerL(class MCmServiceObserver *, class CMdESession &, class CCmDmMain *, class CCmMmMain *)
+	?NewStoreManagerLC@CmStoreManagerFactory@@SAPAVMCmSmManager@@PAVMCmServiceObserver@@AAVCMdESession@@PAVCCmDmMain@@PAVCCmMmMain@@@Z @ 2 NONAME ; class MCmSmManager * CmStoreManagerFactory::NewStoreManagerLC(class MCmServiceObserver *, class CMdESession &, class CCmDmMain *, class CCmMmMain *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/eabi/cmstoremanageru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,8 @@
+EXPORTS
+	_ZN21CmStoreManagerFactory16NewStoreManagerLEP18MCmServiceObserverR11CMdESessionP9CCmDmMainP9CCmMmMain @ 1 NONAME
+	_ZN21CmStoreManagerFactory17NewStoreManagerLCEP18MCmServiceObserverR11CMdESessionP9CCmDmMainP9CCmMmMain @ 2 NONAME
+	_ZTI26CCmSmContentChangeObserver @ 3 NONAME ; #<TI>#
+	_ZTI9CCmSmMain @ 4 NONAME ; #<TI>#
+	_ZTV26CCmSmContentChangeObserver @ 5 NONAME ; #<VT>#
+	_ZTV9CCmSmMain @ 6 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Store Manager
+*
+*/
+
+
+
+// Supported platforms
+prj_platforms
+DEFAULT
+
+// MMP files
+prj_mmpfiles
+cmstoremanager.mmp
+
+// Files to be exported
+prj_exports
+../inc/cmstoremanagerfactory.h   |../../../../../inc/cmstoremanagerfactory.h
+../inc/cmstoremanager.h          |../../../../../inc/cmstoremanager.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/group/cmstoremanager.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project store manager
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          cmstoremanager.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10281FAE
+
+VENDORID        VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH      /sys/bin
+
+USERINCLUDE     ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../../../inc
+
+SOURCEPATH      ../src
+
+SOURCE          cmstoremanagerfactory.cpp
+SOURCE          cmsmmain.cpp
+SOURCE          cmsmtransferengine.cpp
+SOURCE          cmsmfilemngr.cpp
+SOURCE          cmsmvideoandimagemngr.cpp
+SOURCE          cmsmclfmngr.cpp
+SOURCE          cmsmcontentchangeobserver.cpp
+SOURCE          cmsmiteminfo.cpp
+SOURCE          cmsmmsinfo.cpp
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         charconv.lib
+LIBRARY         cmcommon.lib
+LIBRARY         cmdatabaseManager.lib
+LIBRARY         cmmemorymanager.lib
+LIBRARY         cmsqlwrapper.lib
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         upnpavcontrollerhelper.lib
+LIBRARY         mdeclient.lib
+LIBRARY         contentlistingframework.lib
+
+// Path infos
+LIBRARY         PlatformEnv.lib
+
+DEBUGLIBRARY    flogger.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmclfmngr.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,236 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  store file manager
+*
+*/
+
+
+
+#ifndef __CMSMCLFMNGR_H
+#define __CMSMCLFMNGR_H
+
+#include <e32base.h>
+#include <MCLFOperationObserver.h>
+#include <MCLFItemListModel.h>
+#include <badesca.h>
+#include "cmcommontypes.h"
+#include "cmcommon.h"
+#include "cmsmcommon.h"
+
+// Forward declarations
+class MCLFContentListingEngine;
+class MCLFItemListModel;
+class MCLFSortingStyle;
+class MCmSmMusicMngrObserver;
+class CCmSmFileMngr;
+
+// CLASS DECLARATION      
+  
+ /**
+  * CCmSmClfMngr class definition
+  * This class processes music files metadata.
+  *
+  * @lib cmstoremanager.lib
+  *
+  * @since S60 5.1
+  */
+NONSHARABLE_CLASS( CCmSmClfMngr ) : public CActive, 
+                     public MCLFOperationObserver
+    {         
+public:
+        
+    /**
+     * Two-phased constructor.
+     * Creates new CCmSmClfMngr class
+     *
+     * @since S60 5.1
+     * @param aObserver, observer pointer
+     * @param aFileMngr, file manager reference
+     * @param aItems, store list items
+     * @return  pointer to CCmSmClfMngr class
+     */
+    static CCmSmClfMngr* NewL( MCmSmMusicMngrObserver& aObserver, 
+    CCmSmFileMngr& aFileMngr, RPointerArray<CCmStoreListItem>& aItems );
+    
+    /**     
+     * Two-phased constructor.
+     * Creates new CCmSmClfMngr class     
+     *
+     * @since S60 5.1     
+     * @param aObserver, observer pointer
+     * @param aFileMngr, file manager reference
+     * @param aItems, store list items
+     * @return  pointer to CCmSmClfMngr class
+     */
+    static CCmSmClfMngr* NewLC( MCmSmMusicMngrObserver& aObserver, 
+    CCmSmFileMngr& aFileMngr, RPointerArray<CCmStoreListItem>& aItems );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSmClfMngr();
+
+    /**
+     * Cancels list processing
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */              
+    void CancelOperation();
+    
+    /**
+     * Cancel clf refresh
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    void CancelClfRefresh();
+    
+    /**
+     * Setting up clf lists
+     *
+     * @since S60 5.1
+     * @param aMediaType, media type
+     * @return None
+     */                        
+    void SetupCLFListModelsL( TCmMediaType aMediaType );
+
+    /**
+     * CLF refresh
+     *
+     * @since S60 5.1
+     * @param aMediaType, media type
+     * @return None
+     */        
+    void DoRefreshL( TCmMediaType aMediaType );
+    
+    /**
+     * Filters files from the clf lists
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void FilterItemsL();
+
+    /**
+     * Filters defined media files from the clf lists
+     *
+     * @since S60 5.1
+     * @param aNewItems, list model
+     * @param aDeviceIds, devices
+     * @param aType, media type
+     * @return None
+     */        
+    void FilterNewItemsL( MCLFItemListModel* aNewItems, 
+        RArray<TInt> aDeviceIds, TCmMediaType aType );  
+
+// From base class MCLFOperationObserver
+
+    /**
+     * From MCLFOperationObserver
+     * See base class definition
+     */
+    void HandleOperationEventL( TCLFOperationEvent aOperationEvent,
+                                TInt aError ); 
+
+protected:
+
+// From base class CActive
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void DoCancel();
+            
+private:
+
+    /**
+     * Completes request
+     *
+     * @since S60 5.1
+     * @param aStatus, defined id for the completing 
+     * @return None
+     */     
+    void CompleteRequest( TCmSmFileProcessingStatus aStatus );                   
+        
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * since S60 5.1
+     * @param aObserver, music manager observer
+     * @param aFileMngr, file manager
+     * @param aItems, store list items
+     */
+    CCmSmClfMngr( MCmSmMusicMngrObserver& aObserver, 
+    CCmSmFileMngr& aFileMngr, RPointerArray<CCmStoreListItem>& aItems );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+
+private:
+
+    /**
+     * Pointer to observer class
+     */
+    MCmSmMusicMngrObserver& iObserver;    
+    /**
+     * Main file manager
+     */
+    CCmSmFileMngr& iFileMngr;        
+    /**
+     * Clf engine
+     */
+    MCLFContentListingEngine* iEngine;          // owned    
+    /**
+     * Audio list model to be refreshed
+     */
+    MCLFItemListModel* iNewAudioItems;          // owned    
+    /**
+     * Image list model to be refreshed
+     */
+    MCLFItemListModel* iNewImageItems;          // owned    
+    /**
+     * Video list model to be refreshed
+     */
+    MCLFItemListModel* iNewVideoItems;          // owned
+    /**
+     * Sorting style for item ordering.
+     */       
+    MCLFSortingStyle* iSortingStyle;            // owned
+    /**
+     * Store file list items
+     */
+    RPointerArray<CCmStoreListItem>& iItems;
+    /**       
+     * Filter file index
+     */
+    TInt iFilterIndex;      
+    };
+
+#endif //  __CMSMCLFMNGR_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmcommon.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common header for store manager
+*
+*/
+
+
+#ifndef __CMSMCOMMON_H
+#define __CMSMCOMMON_H
+
+// Used in store manager panics
+_LIT( KCmSmManager, "CmStoreManager" );
+
+/// Status codes used in Store Manager
+// Transfer engine call back statuses
+enum TCmSmTransferStatus
+    {
+    ECmSmTransferCompleted = 0,
+    ECmSmAborted,
+    ECmSmTransferCanceled,
+    ECmSmFileTransferred,
+    ECmSmFileTransferFailed,
+    ECmSmWlanLost,
+    ECmSmTransferContinued
+    };
+
+// Store file processing call back statuses  
+enum TCmSmFileProcessingStatus 
+    {
+    ECmSmStoreRulesLoaded = 20,
+    ECmSmProcessingFilesStarted,
+    ECmSmProcessingFilesReady,
+    ECmSmAllLoaded,
+    ECmSmStoreRulesReady,
+    ECmSmAllRefreshed,
+    ECmSmMediaTypesSelected,
+    ECmSmFilesLoaded,
+    ECmSmStartItemFiltering,
+    ECmSmContinueFiltering,
+    ECmSmFilteringReady,
+    ECmSmProcessingCanceled,
+    ECmSmRefreshError,
+    ECmSmNoStoreRulesSelected,
+    ECmSmNoDevicesAvailable,
+    ECmSmPreProcessingStarted,
+    ECmSmLoadFilledAndStored,
+    ECmSmPreProcessingReady,
+    ECmSmFileAdded,
+    ECmSmFileRemoved,
+    ECmSmFileRenamed,
+    ECmSmEventProcessed,
+    ECmSmProcessAlbumList,
+    ECmSmAlbumFilteringReady,
+    ECmSmAlbumProcessingReady,
+    ECmSmQueryCompleted,
+    ECmSmQueryFailed,
+    ECmSmContentChanged,
+    ECmSmNone
+    };    
+
+// Store manager main statuses 
+enum TCmSmMainSequencer
+    {
+    ECmSmGetMediaServers = 40,
+    ECmSmStartFileProcessing,
+    ECmSmStartFileFiltering,
+    ECmSmStartCopying,
+    ECmSmContinueCopying,
+    ECmSmManageFiles,
+    ECmSmFinishCanceling,
+    ECmSmFinishing
+    };    
+
+// Transfer engine states    
+enum TCmSmTransferEngineState
+    {
+    ECmSmIdle = 60,
+    ECmSmCopying,
+    ECmSmNextFile,
+    ECmSmWaitingForCopyStarted,
+    ECmSmTransferComplete,
+    ECmSmTransferAborted,
+    ECmSmStartingTransfer,
+    ECmSmCanceling,
+    ECmSmReserveLocalMs,
+    ECmSmReserveLocalMsFailed
+    };
+
+#endif // __CMSMCOMMON_H
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmcontentchangeobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles devices internal content change events
+*
+*/
+
+
+
+#ifndef __CMSMCONTENTCHANGEOBSERVER_H
+#define __CMSMCONTENTCHANGEOBSERVER_H
+
+#include <e32base.h>
+#include <mdesession.h>
+
+// FORWARD DECLARATIONS
+class MCmSmFileProcessingObserver;
+
+// CLASS DECLARATION
+/**
+ *  Handles devices internal content change events
+ *  Store list processing will be started when notification is received
+ *
+ *  @lib cmstoremanager.lib
+ *
+ *  @since S60 v5.1
+ */
+class CCmSmContentChangeObserver : public CBase,
+                                   public MMdEObjectObserver 
+    {     
+         
+public:
+
+    /**
+     * Two-phased constructor.
+     * Creates new CCmSmContentChangeObserver class
+     *
+     * @since S60 5.1
+     * @param aSession, mds session
+     * @param aObserver, observer class
+     * @return  pointer to CCmSmContentChangeObserver class
+     */
+    static CCmSmContentChangeObserver* NewL( CMdESession& aSession,
+        MCmSmFileProcessingObserver& aObserver );
+    
+    /**
+     * Two-phased constructor.
+     * Creates new CCmSmContentChangeObserver class
+     *
+     * @since S60 5.1     
+     * @param aSession, mds session
+     * @param aObserver, observer class
+     * @return  pointer to CCmSmContentChangeObserver class
+     */
+    static CCmSmContentChangeObserver* NewLC( CMdESession& aSession,
+        MCmSmFileProcessingObserver& aObserver );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSmContentChangeObserver();
+
+    /**
+     * Starts content change observers
+     *
+     * @since S60 5.1
+     * @param None
+     */
+    void StartObserversL();
+
+    /**
+     * ETrue if observers are started
+     *
+     * @since S60 5.1
+     * @param None
+     * @return ETrue if observers started
+     */    
+    TBool IsStarted();
+    
+protected: 
+
+// From base class MMdEObjectObserver
+
+	/**
+	 * From MMdEObjectObserver
+	 * See base class definition
+     */
+    void HandleObjectNotification(CMdESession& aSession, 
+						TObserverNotificationType aType,
+						const RArray<TItemId>& aObjectIdArray);
+		          
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * since S60 5.1
+     * @param aSession, mde session
+     * @param aObserver, process observer
+     */
+    CCmSmContentChangeObserver( CMdESession& aSession,
+        MCmSmFileProcessingObserver& aObserver );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+
+private: // data
+    
+    /**
+     * MdS session
+     */
+    CMdESession& iMdSSession;                   // not owned
+    
+    /**
+     * Observer to give notification about changed content
+     */
+    MCmSmFileProcessingObserver& iObserver;     // not owned
+    
+    /**
+     * ETrue if observers started 
+     */
+    TBool iStarted;
+    
+    };
+
+#endif //  __CMSMCONTENTCHANGEOBSERVER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmfilemngr.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,517 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  store file manager
+*
+*/
+
+
+
+#ifndef __CMSMFILEMNGR_H
+#define __CMSMFILEMNGR_H
+
+#include <e32base.h>
+#include <badesca.h>
+#include "cmsmvideoandimagemngrobserver.h"
+#include "cmsmmusicmngrobserver.h"
+#include "cmsmcommon.h"
+#include "cmcommontypes.h"
+#include "cmcommon.h"
+
+// Forward declarations
+class CCmDmMain;
+class CMdESession;
+class CCmStoreRule;
+class CUpnpAVDevice;
+class MCmSmFileProcessingObserver;
+class CCmStoreListItem;
+class CCmFillListItem;
+class CUpnpAVDeviceList;
+class CCmSmVideoAndImageMngr;
+class CCmSmClfMngr;
+class CCmSmContentChangeObserver;
+class CCmSmItemInfo;
+class CCmSmMsInfo;
+
+
+// CLASS DECLARATION  
+ /**
+  *  Processes store files
+  * 
+  *  @lib cmstoremanager.lib
+  *
+  *  @since S60 v5.1
+  */
+NONSHARABLE_CLASS( CCmSmFileMngr ): public CActive,
+                      public MCmSmVideoAndImageMngrObserver,
+                      public MCmSmMusicMngrObserver
+    {         
+public:
+
+    /**
+     * Two-phased constructor.
+     * Creates new CCmSmFileMngr class
+     *
+     * @since S60 5.1
+     * @param aObserver, observer pointer
+     * @param aSession, mde session
+     * @param aDBMngr, database manager
+     * @param aItems, store list items
+     * @return pointer to CCmSmFileMngr class
+     */
+    static CCmSmFileMngr* NewL(
+        MCmSmFileProcessingObserver* aObserver, CMdESession& aSession, 
+        CCmDmMain* aDBMngr, RPointerArray<CCmStoreListItem>& aItems );
+    
+    /**
+     * Two-phased constructor.
+     * Creates new CCmSmFileMngr class
+     *
+     * @since S60 5.1
+     * @param aObserver, observer pointer
+     * @param aSession, mde session
+     * @param aDBMngr, database manager
+     * @param aItems, store list items
+     * @return  pointer to CCmSmFileMngr class
+     */
+    static CCmSmFileMngr* NewLC(
+        MCmSmFileProcessingObserver* aObserver, CMdESession& aSession, 
+        CCmDmMain* aDBMngr, RPointerArray<CCmStoreListItem>& aItems );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSmFileMngr();
+
+public: 
+
+    /**
+     * Starts store list processing
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void StartProcessing();
+
+    /**
+     * Provides album list
+     * @param aMedia, media type
+     * @param aArray, array of albums
+     * @return  None
+     */
+    void ProcessAlbumList( TCmMediaType aMedia, 
+    CDesCArray& aArray );
+        
+    /**
+     * Canceling file processing
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void CancelOperation();
+        
+    /**
+     * Returns amount of items to be stored
+     *
+     * @since S60 5.1
+     * @param None
+     * @return count
+     */        
+    TInt StoreItemCount();
+
+    /**
+     * Returns amount of items to be filled
+     *
+     * @since S60 5.1
+     * @param None
+     * @return count
+     */      
+    TInt FillItemCount();
+ 
+    /**
+     * Returns amount of items to be stored, no duplicates
+     *
+     * @since S60 5.1
+     * @param aCount
+     * @return None
+     */    
+    void GetStoreFileCountNoDuplicatesL( TInt& aCount );
+    
+    /**
+     * Updating transfer history
+     * @param aInterval, time stamp
+     * @param aDataAmount, transfered data
+     * @param aServerId, device id
+     * @return  None
+     */
+    void UpdateTransferHistoryData(TInt64 aInterval,
+                            TInt64 aDataAmount, TUint8 aServerId );    
+
+    /**
+     * Loading all selected Store rules
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void LoadSelectedStoreRulesL();
+    
+    /**
+     * Processing Store rules 
+     *
+     * @since Series 60 5.1
+     * @param None
+     * @return None
+     */        
+    void ProcessStoreRules();
+
+    /**
+     * Loads filled and stored items
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void LoadFilledAndStoredL();
+    
+    /**
+     * Loading all filled items
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void LoadFilledL();
+    
+    /**
+     * Loading all stored items ( filled from UDN )
+     *
+     * @since S60 5.1
+     * @param aUDN, server identifier
+     * @return None
+     */    
+    void LoadStoredL( const TDesC8& aUDN );
+
+    /**
+     * Reseting filled array
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void ResetFilledArray();
+
+    /**
+     * Selects media types from store rules for CLF
+     * Refresh. 
+     *
+     * @since S60 5.1
+     * @param None     
+     * @return None
+     */    
+    void SelectMediaTypes();
+
+    /**
+     * Checks if file is filled
+     *
+     * @since S60 5.1
+     * @param aPathAndFileName, file to be chekced
+     * @return ETrue if file is filled
+     */  
+    TBool CheckIsFilledFileL( const TDesC& aPathAndFileName );
+    
+    /**
+     * Checks if file is already stored
+     *
+     * @since S60 5.1
+     * @param aPathAndFileName, file to be chekced
+     * @param aStoredIds, reference to stored servers array
+     * @param aStoreIds, reference to store servers array
+     * @return None
+     */     
+    void IsAlreadyStoreL( const TDesC& aPathAndFileName, 
+        RArray<TInt>& aStoredIds, RArray<TInt>& aStoreIds );
+
+    /**
+     * Identifies media types used with aDeviceIndex server
+     *
+     * @since S60 5.1
+     * @param aIds, media server ids
+     * @param aType, media type
+     * @return None
+     */        
+    void MediaTypesL( RArray<TInt>& aIds, TCmMediaType aType );    
+    
+    /**
+     * Loads all media server id from the database
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void LoadMediaServerIdsL();
+
+    /**
+     * Returns devide id
+     *
+     * @since S60 5.1
+     * @param aUuid, media server identifier
+     * @return id, database id
+     */    
+    TInt64 GetDevId( const TDesC8& aUuid );
+
+    /**
+     * Select files which is needed to be stored to def. server
+     *
+     * @since S60 5.1
+     * @param aItemIds, item id array
+     * @param aUuid, server identifier
+     * @param aId, server database id
+     * @return None
+     */    
+    void GetItemsL( RArray<TInt>& aItemIds, 
+        const TDesC8& aUuid, TInt64& aId );
+
+    /**
+     * Updates store file list up to date
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void UpdateStoreFileListL();
+    
+    /**
+     * Loads store file list from the db
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void LoadStoreFileListL();
+
+    /**
+     * Get store rule id
+     *
+     * @since S60 5.1
+     * @param aType, media type
+     * @return rule id
+     */        
+    TInt64 RetrieveListId( TCmMediaType aType );
+    
+    /**
+     * Get status values and server ids 
+     *
+     * @since S60 5.1
+     * @param aType, media type
+     * @param aStatus
+     * @return None
+     */        
+    void RetrieveListStatusValues( TCmMediaType aType,
+        TCmListItemStatus& aStatus );
+        
+    /**
+     * Deletes items which need to be deleled
+     *
+     * @since S60 5.1
+     * @param aIds, item id array
+     * @return None
+     */        
+    void DeleteItems( RArray<TInt>& aIds );
+    
+   /**
+     * Reseting arrays
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void ResetArrays();
+
+   /**
+     * Calculating transfer history time
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void CalculateAvgTransferTimeL();
+    
+   /**
+     * Publishes transfer history time estimate
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void SendAvgTransferTime();
+    
+    /**
+     * Sets processing status
+     * @param aStatus, processing status
+     * @return  None
+     */        
+    void SetProcessingStatus( TCmSmFileProcessingStatus aStatus );   
+
+protected:
+
+// From base class CActive
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void DoCancel();    
+ 
+     /**
+      * From CActive
+      * See base class definition
+      */   
+    TInt RunError( TInt aError );    
+
+// From base class MCmSmMediaTypeObserver
+
+    /**
+     * From MCmSmMediaTypeObserver
+     * See base class definition
+     */
+    void ImagesAndVideosReady( const TInt aStatus );
+
+// From base class MCmSmMusicMngrObserver
+
+    /**
+     * From MCmSmMusicMngrObserver
+     * See base class definition
+     */
+    void MusicReady( const TInt aStatus );        
+            
+private:
+
+    /**
+     * Process media lists
+     * 
+     * @param aType, defined media type
+     * @return None
+     */
+    void ProcessMedia( TCmMediaType aType );
+    
+    /**
+     * Process music
+     * 
+     * @param None
+     * @return None
+     */    
+    void ProcessMusics();
+    
+    /**
+     * Completes request
+     *
+     * @since S60 5.1
+     * @param aStatus, defined id for the completing 
+     * @return None
+     */     
+    void CompleteRequest( TCmSmFileProcessingStatus aStatus );        
+                    
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aObserver, process observer
+     * @param aDBMngr, database manager
+     * @param aItems, store items
+     */
+    CCmSmFileMngr(
+        MCmSmFileProcessingObserver* aObserver, CCmDmMain* aDBMngr, 
+        RPointerArray<CCmStoreListItem>& aItems );
+
+    /**
+     * Performs the second phase construction.
+     *
+     * @since S60 5.1
+     * @param aSesstion, mde sesstion
+     */
+    void ConstructL( CMdESession& aSession );
+
+private:
+
+    /**
+     * Pointer to observer class
+     */
+    MCmSmFileProcessingObserver* iObserver;             // not owned    
+    /**
+     * Pointer to database manager
+     */
+    CCmDmMain* iDBManager;                              // not owned         
+    /**
+     * Rule array
+     */
+    RPointerArray<CCmStoreRule> iRuleArray;             // owned
+    /**
+     * Stored items array
+     */
+    RPointerArray<CCmSmItemInfo>iStoredArray;           // owned
+    /**
+     * Media server id array
+     */
+    RPointerArray<CCmSmMsInfo> iMsIds;                  // owned
+    /**
+     * Store file list items
+     */
+    RPointerArray<CCmStoreListItem>& iItems;            // not owned
+    /**
+     * Filled file list items
+     */
+    RPointerArray<CCmFillListItem>iFilledItems;         // owned
+    /**
+     * video and image process
+     */
+    CCmSmVideoAndImageMngr* iVideoAndImageMngr;         // owned      
+    /**
+     * music process temp
+     */
+    CCmSmClfMngr* iClfMusicMngr;                        // owned
+    /**
+     * observers content changes in local device
+     */
+    CCmSmContentChangeObserver* iCcObserver;            // owned  
+    /**
+     * Media type array
+     */
+    RArray<TCmMediaType>iMediaTypes;                    // owned
+    /**
+     * Used to select media to be refreshed
+     */
+    TInt iRefreshIndex;
+    /**
+     * Total transfer time estimate
+     */
+    TCmProgressInfo iTransferInfo;
+    /**
+     * Processing status
+     */
+    TCmSmFileProcessingStatus iProcessingStatus;
+
+    };
+
+#endif //  __CMSMFILEMNGR_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmfileprocessingobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Callback interface to store file processing
+*
+*/
+
+
+
+#ifndef M_CMSMFILERULEPROCESSINGOBSERVER_H
+#define M_CMSMFILERULEPROCESSINGOBSERVER_H
+
+#include "cmsmcommon.h"
+
+/**
+ *  Callback interface class used to notify CmSmMain -class
+ *  about store file processing status
+ *
+ *  @lib cmstoremanager.lib
+ *
+ *  @since S60 v5.1
+ */
+class MCmSmFileProcessingObserver
+    {
+
+public:
+
+    /**
+     * Used to notify about status changes in fill rule processing
+     *
+     * @since S60 5.1
+     * @param aStatus, status of the file processing
+     * @return None
+     */
+    virtual void FileProcessingStatus( 
+        TCmSmFileProcessingStatus aStatus ) = 0;
+    };
+
+#endif // M_CMSMFILERULEPROCESSINGOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmiteminfo.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  store item info class
+*
+*/
+
+
+
+#ifndef __CMSMITEMINFO_H
+#define __CMSMITEMINFO_H
+
+#include <e32base.h>
+
+// Forward declarations
+
+// LITERALS
+
+// CLASS DECLARATION
+ /**
+ *  Stored item class 
+ *  @lib cmstoremanager.lib
+ *  @since S60 v5.1
+ */
+NONSHARABLE_CLASS( CCmSmItemInfo ): public CBase
+    {
+public:
+    /**
+     * Two-phased constructor.     
+     *
+     * @since S60 5.1 
+     * @param aFile, file name
+     * @param aId, media server's id
+     * @return  pointer to CCmSmItemInfo class
+     */
+    static CCmSmItemInfo* NewL( TDesC& aFile, TInt64 aId );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * since S60 5.1
+     * @param aFile, file name
+     * @param aId, media server's id
+     * @return  pointer to CCmSmItemInfo class
+     */
+    static CCmSmItemInfo* NewLC( TDesC& aFile, TInt64 aId );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSmItemInfo();        
+
+private: 
+    
+    /**
+     * Performs the second phase construction.
+     *
+     * @since S60 5.1
+     * @param aFile, file name
+     * @param aId, media server's id
+     * @return None
+     */
+    void ConstructL( TDesC& aFile, TInt64 aId );
+    
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmSmItemInfo(  );
+    
+public: 
+    
+    /**
+     * File name
+     */
+    HBufC* iFile;                            // owned    
+    /**
+     * Media server identifier
+     */
+    TInt64 iId;    
+    };
+
+#endif //  __CMSMITEMINFO_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmain.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,394 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main class in the Store manager component
+*
+*/
+
+
+#ifndef C_CMSMMAIN_H
+#define C_CMSMMAIN_H
+
+#include <e32base.h>
+#include "cmsmfileprocessingobserver.h"
+#include "cmsmtransferobserver.h"
+#include "cmmmobserver.h"
+#include "cmcommon.h"
+#include "cmstoremanager.h"
+   
+// Forward declarations
+class MUPnPAVController;
+class MCmServiceObserver;
+class CCmSmTransferEngine;
+class CCmSmFileMngr;
+class CCmDmMain;
+class CCmStoreListItem;
+class CCmSqlPropertyContainer;
+class CCmMmMain;
+class CUpnpAVDeviceList;
+
+
+/**
+ *  CCmSmMain class definition
+ *
+ *  @lib cmstoremanager.lib
+ *
+ *  @since S60 v5.1
+ */    
+class CCmSmMain : public CActive,
+                  public MCmSmManager, 
+                  public MCmSmFileProcessingObserver,
+                  public MCmSmTransferObserver,
+                  public MCmMmObserver
+    {
+        
+public:
+
+    /**
+     * Two-phased constructor.
+     * Creates new CCmSmMain class and opens connection to database.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer pointer
+     * @param aSession, Mde session
+     * @param aDBManager, database manager
+     * @param aMemManager, memory manager
+     * @return  pointer to CCmSmMain class
+     */
+    static CCmSmMain* NewL( 
+        MCmServiceObserver* aObserver, CMdESession& aSession, 
+        CCmDmMain* aDBManager, CCmMmMain* aMemManager );
+    
+    /**
+     * Two-phased constructor.
+     * Creates new CCmSmMain class and opens connection to database and 
+     * leaves the instance in the cleanup stack.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer pointer
+     * @param aSession, Mde session
+     * @param aDBManager, database manager
+     * @param aMemManager, memory manager
+     * @return  pointer to CCmSmMain class
+     */
+    static CCmSmMain* NewLC(
+        MCmServiceObserver* aObserver, CMdESession& aSession, 
+        CCmDmMain* aDBManager, CCmMmMain* aMemManager );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSmMain();
+
+public: 
+
+    /**
+     * Starts store service
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */    
+    void StartStoreL();
+
+    /**
+     * Cancels store service
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */        
+    void CancelOperation();
+
+    /**
+     * Starts store list processing
+     *
+     * @since S60 5.1     
+     * @param None
+     * @return  None
+     */        
+    void PreProcessLists();
+
+    /**
+     * Provides album list
+     *
+     * @since S60 5.1
+     * @param aMedia, media type
+     * @param aArray, list of values
+     * @return  None
+     */
+    void GetColItemsL( TCmMediaType aMedia, 
+        CDesCArray& aArray );
+        
+    /**
+     * Provides metadata column item list
+     *
+     * @since S60 5.1
+     * @param aMedia, media type
+     * @param aPropertys, list of values
+     * @return  None
+     */
+    void GetColItemsL( TCmMediaType aMedia, 
+        CCmSqlPropertyContainer& aPropertys );        
+    
+    /**
+     * Sets av controller
+     *
+     * @since S60 5.1     
+     * @param aAVController, av controller pointer
+     * @return  None
+     */        
+    void SetAvController( MUPnPAVController* aAVController );    
+    
+// From base class MCmSmManager
+    
+    /**
+     * From MCmSmManager
+     * See base class definition
+     */    
+    void Close();    
+    
+// From base class MCmSmFileProcessingObserver
+
+    /**
+     * From MCmSmFileProcessingObserver
+     * See base class definition
+     */
+    void FileProcessingStatus( TCmSmFileProcessingStatus aStatus );
+    
+// From base class MCmSmTransferObserver
+
+    /**
+     * From MCmSmTransferObserver
+     * See base class definition
+     */
+    void TransferStatus( TCmSmTransferStatus aStatus );        
+
+// From base class MCmMmObserver
+
+    /**
+     * From MCmMmObserver
+     * See base class definition
+     */     
+    void DeleteCompleteL( TInt aErr );
+
+    /**
+     * From MCmMmObserver
+     * See base class definition
+     */     
+    void ShrinkCompleteL( TInt aErr );
+
+protected:
+
+// From base class CActive
+
+    /**
+     * From CActive
+     * See base class definition
+     */  
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */ 
+    void DoCancel();
+
+    /**
+     * From CActive
+     * See base class definition
+     */     
+    TInt RunError( TInt aError );    
+                
+private:
+
+    /**
+     * Managing files after storing
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */    
+    void ManageFileL();    
+
+#ifdef _DEBUG        
+    /**
+     * Logs server Uuids
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */    
+    void LogServers();    
+#endif    
+  
+    /**
+     * Publish progress info
+     *
+     * @since S60 5.1
+     * @param aProgress
+     * @return  None
+     */        
+    void SendProgressInfo( TInt aProgress );
+    
+    /**
+     * Changes state
+     *
+     * @since S60 5.1
+     * @param aStatus, defined id for the completing 
+     * @return None
+     */     
+    void ChangeState( TCmSmMainSequencer aStatus );
+    
+    /**
+     * Starts clf refresh timer
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */  
+    void StartMdETimerL();
+
+    /**
+     * Cancels mde refresh timer
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    void CancelMdETimer();
+
+    /**
+     * Call back for clf refresh timer
+     *
+     * @since S60 5.1
+     * @param aPtr, this
+     * @return None
+     */ 
+    static TInt CheckItems( TAny* aPtr );
+    
+    /**
+     * Starts clf refresh if no services ongoing
+     *
+     * @since S60 5.1
+     * @param None
+     * @return KErrNone
+     */     
+    TInt CheckItemsChanged( );
+
+    /**
+     * Delete devices
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void DeleteDevices();
+    
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aObserver, service observer
+     * @param aDBManager, database manager
+     * @param aMemManager, memory manager
+     */
+    CCmSmMain( MCmServiceObserver* aObserver, CCmDmMain* aDBManager, 
+        CCmMmMain* aMemManager );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL( CMdESession& aSession, CCmDmMain* aDBManager );
+    
+
+private:
+    
+    /**
+     * Service observer
+     */ 
+    MCmServiceObserver* iObserver;                  // not owned
+    
+    /**
+     * Database manager
+     */
+    CCmMmMain* iMemManager;                         // not owned
+        
+    /**
+     * Memory manager
+     */
+    CCmDmMain* iDbManager;                          // not owned
+    
+    /**
+     * Upnp operation manager
+     */
+    CCmSmTransferEngine* iCmSmTransferEngine;       // owned
+    
+    /**
+     * File manager
+     */
+    CCmSmFileMngr* iCmSmFileMngr;                   // owned
+    
+    /**
+     * Checks if clf state has changed
+     */
+    CPeriodic* iPeriodic;                           // owned
+    
+    /**
+     * Array of found devices
+     */
+    CUpnpAVDeviceList* iDevices;                    // owned
+    
+    /**
+     * Fill progress info
+     */
+    TCmProgressInfo iProgressInfo;
+    
+    /**
+     * Logged storing time values
+     */
+    TTime iStoreStarted;
+    
+    /**
+     * Index to device array
+     */
+    TInt iDeviceIndex;
+    
+    /**
+     * List of store file items
+     */
+    RPointerArray<CCmStoreListItem> iItems;         // owned
+    
+    /**
+     * List of store item ids
+     */
+    RArray<TInt>iItemIds;                           // owned
+    
+    /**
+     * Id of the current mediaserver 
+     */
+    TInt64 iId;
+    
+    /**
+     * Service
+     */
+    TCmService iService;
+    
+    /**
+     * Flag defining if cancel is on
+     */
+    TBool iCancelOnGoing;
+    
+    };
+
+#endif //  C_CMSMMAIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmsinfo.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  media server info class
+*
+*/
+
+
+
+#ifndef __CMSMMSINFO_H
+#define __CMSMMSINFO_H
+
+#include <e32base.h>
+
+// CLASS DECLARATION
+ /**
+  *  Media server info class
+  *
+  *  @lib cmstoremanager.lib
+  *
+  *  @since S60 5.1
+  */    
+NONSHARABLE_CLASS( CCmSmMsInfo ): public CBase
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     * Creates new CCmSmMsInfo class
+     *
+     * @since S60 5.1
+     * @param aUuid, server's uuid
+     * @param aId, media server's id
+     * @return  pointer to CCmSmMsInfo class
+     */
+    static CCmSmMsInfo* NewL( TDesC8& aUuid, TInt aId );
+    
+    /**
+     * Two-phased constructor.
+     * Creates new CCmSmMsInfo class
+     *
+     * @since S60 5.1
+     * @param aUuid, server's uuid
+     * @param aId, media server's id
+     * @return  pointer to CCmSmMsInfo class
+     */
+    static CCmSmMsInfo* NewLC( TDesC8& aUuid, TInt aId );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSmMsInfo();        
+
+private: 
+    
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL( TDesC8& aUuid, TInt aId );
+    
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmSmMsInfo( );
+    
+public: 
+    
+    /**
+     * Server's uuid
+     */
+    HBufC8* iUuid;                              // owned
+    
+    /**
+     * Media server identifier
+     */
+    TInt iId;    
+    };      
+  
+#endif //  __CMSMMSINFO_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmusicmngrobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  store file manager observer for music files
+*
+*/
+
+
+
+#ifndef __CMSMMUSICMNGROBSERVER_H
+#define __CMSMMUSICMNGROBSERVER_H
+
+// CLASS DECLARATION    
+ /**
+  *  Music manager observer class definition
+  *
+  *  @lib cmstoremanager.lib
+  *
+  *  @since S60 v5.1
+  */      
+class MCmSmMusicMngrObserver
+    {
+public:
+
+    /**
+     * Call back for observer
+     *
+     * @since S60 5.1
+     * @param aStatus, KErrNone if no errors, otherwise system wide error codes
+     * @return  None
+     */    
+    virtual void MusicReady( const TInt aStatus ) = 0;  
+       
+    };      
+
+#endif //  __CMSMMUSICMNGROBSERVER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmtransferengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,470 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages Upnp actions needed by Store Manager
+*  Version     : %version: tr1ido#1.1.6 % << Don't touch!
+*
+*/
+
+
+
+#ifndef __CMSMTRANSFERENGINE_H
+#define __CMSMTRANSFERENGINE_H
+
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+#include "upnpfiletransfersessionobserver.h"
+
+// Forward declarations
+class MUPnPAVController;
+class MCmSmTransferObserver;
+class CCmDmMain;
+class CCmStoreListItem;
+class MCmSqlMain;
+
+// CLASS DECLARATION
+ /**
+ *  Class represents methods to communication with AV Controller API.
+ *
+ *  @lib cmstoremanager.lib
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CCmSmTransferEngine ): public CBase,
+                            public MUPnPFileTransferSessionObserver
+    {
+
+public:
+
+    // panic codes
+    enum TCmSmTransferEnginePanic
+        {
+        ECmSmTransferQueueMessedUp = 30
+        };
+
+    // Copy statuses        
+    enum TCmSmCopyStatus
+        {
+        ECmSmCopyNever,
+        ECmSmCopyContinued,
+        ECmSmCopySuccess
+        }; 
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer pointer
+     * @param aDBMngr, database manager
+     * @param aItems, reference to items array
+     * @param aItemIds, reference to item id array
+     * @return  pointer to CCmSmTransferEngine class
+     */
+    static CCmSmTransferEngine* NewL( MCmSmTransferObserver* aObserver, 
+        CCmDmMain* aDBMngr, RPointerArray<CCmStoreListItem>& aItems, 
+        RArray<TInt>& aItemIds );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer pointer
+     * @param aDBMngr, database manager
+     * @param aItems, reference to items array
+     * @param aItemIds, reference to item id array
+     * @return  pointer to CCmSmTransferEngine class
+     */
+    static CCmSmTransferEngine* NewLC( MCmSmTransferObserver* aObserver, 
+        CCmDmMain* aDBMngr, RPointerArray<CCmStoreListItem>& aItems,
+        RArray<TInt>& aItemIds );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSmTransferEngine();
+
+public: 
+
+    /**
+     * Sets av controller
+     *
+     * @since S60 5.1
+     * @param aAVControl, pointer to av controller
+     * @return  None
+     */        
+    void SetAvController( MUPnPAVController* aAVController );
+        
+    /**
+     * Lists media servers 
+     *
+     * @since S60 5.1
+     * @param aDevices, device list
+     * @return None
+     */
+    void GetMediaServersL( CUpnpAVDeviceList*& aDevices );
+    
+    /**
+     * Resets file arrays
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void ResetFileArrays();
+       
+    /**
+     * Cancel UPnP copy operation
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void CancelCopy();
+    
+    /**
+     * Copy files
+     *
+     * @since S60 5.1
+     * @param aDevId, device identifier
+     * @param aDevice, device
+     * @return None
+     */    
+    void CopyFilesL( TUint8 aDevId, CUpnpAVDevice* aDevice );
+    
+    /**
+     * Continue Copying files
+     *
+     * @since S60 5.1
+     * @return None
+     */    
+    void ContinueCopyFilesL();
+    
+    /**
+     * Transferred data
+     *
+     * @since S60 5.1
+     * @param None
+     * @return data amount
+     */      
+    TInt DataAmount() const;
+    
+    /**
+     * Returns file list
+     *
+     * @since S60 5.1
+     * @param None
+     * @return file array
+     */ 
+    CDesCArray& FilesToBeRemoved();
+
+    /**
+     * Delete file list
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    void DeleteToBeRemoved();
+    
+    /**
+     * Returns file list
+     *
+     * @since S60 5.1
+     * @param None
+     * @return file array
+     */     
+    CDesCArray& FilesToBeShrinked();
+    
+    /**
+     * Delete file list
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void DeleteToBeShrinked();
+
+    /**
+     * Returns item ids which need to be deleted
+     *
+     * @since S60 5.1
+     * @param None
+     * @return Item ids
+     */     
+    RArray<TInt>& ToBeDeleted();    
+    
+    /**
+     * Cancel operation
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void CancelOperation();    
+
+protected:
+
+// From base class MUPnPFileTransferSessionObserver
+
+    /**
+     * From MUPnPFileTransferSessionObserver 
+     * See base class definition
+     */
+    void TransferStarted( TInt aKey, TInt aStatus );
+ 
+    /**
+     * From MUPnPFileTransferSessionObserver 
+     * See base class definition
+     */    
+    void TransferCompleted( TInt aKey, TInt aStatus,
+        const TDesC& aFilePath );
+    
+    /**
+     * From MUPnPFileTransferSessionObserver 
+     * See base class definition
+     */
+    void TransferProgress( TInt aKey, TInt aBytes,
+        TInt aTotalBytes );   
+
+    /**
+     * From MUPnPFileTransferSessionObserver 
+     * See base class definition
+     */
+    void MediaServerDisappeared(
+        TUPnPDeviceDisconnectedReason aReason );  
+            
+private:
+
+    /**
+     * Copying one file
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void CopySingleFileL();
+
+    /**
+     * Connects to device
+     *
+     * @since S60 5.1
+     * @param aDevice to be connected
+     * @return None
+     */    
+    void ConnectedToDeviceL( const CUpnpAVDevice& aDevice );
+    
+    /**
+     * Wait
+     *
+     * @since S60 5.1
+     * @param aDelay, delay in seconds
+     * @return None
+     */        
+    void WaitForProgress( TInt aDelay );
+    
+    /**
+     * Abort operation
+     *
+     * @since S60 5.1
+     * @param aError, error code
+     * @return None
+     */
+    void AbortTransfer( TInt aError );
+    
+    /**
+     * Adds stored item to database
+     *
+     * @since S60 5.1
+     * @param aFileName, name of the stored file
+     * @param aUDN, where file was stored
+     * @param aTimeStamp, time stamp for store
+     * @return None
+     */       
+    void AddStoredL( const TDesC& aFileName, const TDesC8& aUDN, 
+        TTime aTimeStamp );
+
+    /**
+     * Handles item status values
+     * @param aKey, database id of item
+     * @return  None
+     */        
+    void HandleItemStatusL( const TInt aKey );
+
+     /**
+     * Updates status
+     *
+     * @since S60 5.1
+     * @param aStatus, status to be set
+     * @param aFid, file id
+     * @param aMsId, media server id
+     * @return None
+     */    
+    void UpdateStoreTransferStatus( TUint aStatus, TInt64 aFid, 
+        TInt64 aMsId );
+        
+     /**
+     * Returns index to transferred items array
+     *
+     * @since S60 5.1
+     * @param aKey, database id
+     * @return index to item array
+     */  
+    TInt GetArrayIndex( TInt aKey );
+
+     /**
+     * Returns ETrue if file is already on server
+     *
+     * @since S60 5.1
+     * @param aIndex, index to iItems array
+     * @return ETrue if file is duplicate
+     */     
+    TBool IsDuplicateL( const TInt aIndex );
+
+    /**
+     * Handle to copying files once
+     *
+     * @since S60 3.2
+     * @param None
+     * @return None
+     */  
+    void CopyFilesOnceL();
+
+    /**
+     * Complete the copy process
+     *
+     * @since S60 3.2
+     * @param None
+     * @return None
+     */  
+    void FinishCopy();   
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aObserver, transfer observer
+     * @param aDBMngr, database manager
+     * @param aItems, store items
+     * @param aItemIds, item ids
+     * @return None
+     */
+    CCmSmTransferEngine( MCmSmTransferObserver* aObserver, 
+        CCmDmMain* aDBMngr, RPointerArray<CCmStoreListItem>& aItems,
+        RArray<TInt>& aItemIds );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private:
+
+    /**
+     * Pointer to AV Controller
+     */
+    MUPnPAVController* iAVController;               // not owned
+
+    /**
+     * Browse action Observer
+     */
+    MCmSmTransferObserver* iObserver;               // not owned
+    
+    /**
+     * Database manager
+     */
+    CCmDmMain* iDBManager;                          // not owned  
+    
+    /**
+     * File transfer started
+     */
+    TTime iTransferStarted;
+    
+    /**
+     * Device
+     */  
+    CUpnpAVDevice* iDevice;                         // not owned            
+
+    /**
+     * File Data amount in kbytes
+     */
+    TInt iTransferredData;
+    
+    /**
+     * Total transferred data amount in kbytes
+     */
+    TInt iTotalTransferredData;
+    
+    /**
+     * Items to store
+     */
+    RPointerArray<CCmStoreListItem>& iItems;
+    
+    /**
+     * Ids of the selected store items
+     */
+    RArray<TInt>& iItemIds;
+    
+    /**
+     * Item ids to be deleted
+     */
+    RArray<TInt> iToBeDeleted;                      // owned
+    
+    /**
+     * Index of the processed file
+     */
+    TInt iIndex;
+    
+    /**
+     * Index of the current mediaserver
+     */
+    TUint8 iDevId;
+    
+    /**
+     * File to be removed
+     */
+    CDesCArray* iFilesToBeRemoved;                  // owned
+
+    /**
+     * File to be shrinked
+     */
+    CDesCArray* iFilesToBeShrinked;                 // owned
+    
+    /**
+     * Database wrapper ( member variable because of performance issues )
+     */
+    MCmSqlMain* iDbWrapper; // owned
+    
+    /** Browse session */
+    MUPnPFileUploadSession* iUploadSession; // not owned
+    
+    /**
+     * Transfer queue
+     */    
+    RArray<TInt> iTransferQueue;    
+    
+    /**
+     * Copy status
+     */
+    TCmSmCopyStatus iCopyStatus;
+    
+    /**
+     * File server session
+     */
+    RFs iFSession;
+    
+    };
+
+#endif //  __CMSMTRANSFERENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmtransferobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Callback interface
+*
+*/
+
+
+
+#ifndef M_CMSMTRANSFEROBSERVER_H
+#define M_CMSMTRANSFEROBSERVER_H
+
+#include "cmsmcommon.h"
+
+/**
+ *  Callback interface class used to notify client
+ *  about status changes in Upnp actions
+ *  @lib cmstoremanager.lib
+ *  @since S60 v3.1
+ */
+class MCmSmTransferObserver
+    {
+
+public:
+
+    /**
+     * Upnp action notifys
+     * @since S60 3.1
+     * @param aStatus, transfer status
+     * @return None
+     */
+    virtual void TransferStatus( TCmSmTransferStatus aStatus ) = 0;
+
+    };
+
+#endif // M_CMSMTRANSFEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmvideoandimagemngr.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,324 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  store file manager for images and videos
+*
+*/
+
+
+
+#ifndef __CMSMVIDEOANDIMAGEMNGR_H
+#define __CMSMVIDEOANDIMAGEMNGR_H
+
+#include <e32base.h>
+#include <badesca.h>
+#include <mdequery.h>
+#include "cmcommontypes.h"
+#include "cmcommon.h"
+#include "cmsmcommon.h"
+
+// Forward declarations
+class CMdESession;
+class CMdENamespaceDef;
+class CMdEObjectDef;
+class CMdEObjectQuery;
+class CMdEPropertyDef;
+class CCmStoreListItem;
+class CCmSmFileMngr;
+class CMdEObject;
+class MCmSmVideoAndImageMngrObserver;
+
+// CLASS DECLARATION 
+    
+ /**
+  *  Video and Image manager class definition
+  *
+  *  @lib cmstoremanager.lib
+  *
+  *  @since S60 5.1
+  */
+NONSHARABLE_CLASS( CCmSmVideoAndImageMngr ): public CActive,
+                               public MMdEQueryObserver
+    {      
+         
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1     
+     * @param aObserver, observer class
+     * @param aFileMngr, file manager
+     * @param aSession, mde session
+     * @param aItems, store list items
+     * @return  pointer to CCmSmVideoAndImageMngr class
+     */
+    static CCmSmVideoAndImageMngr* NewL( 
+        MCmSmVideoAndImageMngrObserver& aObserver,
+        CCmSmFileMngr& aFileMngr, CMdESession& aSession, 
+        RPointerArray<CCmStoreListItem>& aItems );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1     
+     * @param aObserver, observer class
+     * @param aFileMngr, file manager
+     * @param aSession, mde session
+     * @param aItems, store list items     
+     * @return  pointer to CCmSmVideoAndImageMngr class
+     */
+    static CCmSmVideoAndImageMngr* NewLC(  
+        MCmSmVideoAndImageMngrObserver& aObserver,
+        CCmSmFileMngr& aFileMngr, CMdESession& aSession,
+        RPointerArray<CCmStoreListItem>& aItems );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSmVideoAndImageMngr();
+
+public: 
+
+    /**
+     * Starts video/image list processing
+     *
+     * @since S60 5.1
+     * @param aType, media type to be processed
+     * @return None
+     */
+    void ProcessMedia( TCmMediaType aType );  
+        
+    /**
+     * Canceling file processing
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void CancelOperation();
+
+    /**
+     * Canceling clf refress
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void CancelListRefresh();                    
+    
+    /**
+     * Filters files from the clf lists
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void FilterItems();
+
+    /**
+     * Filters defined media files from the clf lists
+     *
+     * @since S60 5.1
+     * @param aDeviceIds, devices
+     * @param aType, media type
+     * @return None
+     */        
+    void FilterNewItemsL( RArray<TInt>aDeviceIds, 
+    TCmMediaType aType );
+
+protected:
+
+// From base class MMdEQueryObserver
+
+    /**
+     * From MMdEQueryObserver
+     * See base class definition
+     */
+    void HandleQueryNewResults(CMdEQuery& aQuery,
+                                       TInt aFirstNewItemIndex,
+                                       TInt aNewItemCount);
+          
+    /**
+     * From MMdEQueryObserver
+     * See base class definition
+     */
+    void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);  
+
+// From base class CActive
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void DoCancel();
+    
+    /**
+     * From CActive
+     * See base class definition
+     */  
+    TInt RunError( TInt aError );        
+    
+private:
+
+   /**
+     * Creates query for defined media type
+     *
+     * @since S60 5.1
+     * @param aType, media type
+     * @return None
+     */ 
+    void SetQueryAndStartFindL( TCmMediaType aType );
+    
+   /**
+     * Sets property filters
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */ 
+    void SetPropertyFiltersL( );
+    
+   /**
+     * Sets logic condition
+     *
+     * @since S60 5.1
+     * @param aType, media type ( phone or other )
+     * @return None
+     */
+    void SetLogicConditionL( TCmMediaType aType );
+
+   /**
+     * Resets mde query
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    void ResetQuery();
+    
+   /**
+     * Completes request
+     *
+     * @since S60 5.1
+     * @param aStatus, defined id for the completing 
+     * @return None
+     */     
+    void CompleteRequest( TCmSmFileProcessingStatus aStatus );
+
+   /**
+     * Collects item info from mde objects
+     *
+     * @since S60 5.1
+     * @param aType, media type
+     * @return TCmListItemStatus, list status value
+     */     
+    TCmListItemStatus CollectItemDataL( TCmMediaType aType );            
+            
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aObserver, video and image manager observer
+     * @param aFileMngr, file manager
+     * @param aSession, Mde session
+     * @param aItems, Store items
+     * @return None
+     */
+    CCmSmVideoAndImageMngr(  
+        MCmSmVideoAndImageMngrObserver& aObserver,
+        CCmSmFileMngr& aFileMngr, CMdESession& aSession,
+        RPointerArray<CCmStoreListItem>& aItems );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+
+private: 
+
+    /**
+     * Observer
+     */
+    MCmSmVideoAndImageMngrObserver& iObserver;
+    
+    /**
+     * Reference to main file manager
+     */
+    CCmSmFileMngr& iFileMngr;
+    
+    /**
+     * MdE session
+     */
+    CMdESession& iSession;                                
+        
+    /**
+     * Reference to store list items
+     */
+    RPointerArray<CCmStoreListItem>& iItems;
+    
+    /**
+     * mde namespace
+     */
+    CMdENamespaceDef* iNamespace;                           // owned
+    
+    /**
+     * Object definition ( Image/Video )
+     */
+    CMdEObjectDef* iObjectDef;                              // owned
+        
+    /**
+     * Object definition ( Image/Video )
+     */
+    CMdEObjectDef* iMediaTypeDef;                           // owned
+    
+    /**
+     * Object query
+     */
+    CMdEObjectQuery* iQuery;                                // owned
+    
+    /**
+     * Queried property
+     */
+    CMdEPropertyDef* iTitleDef;                             // owned
+    
+    /**
+     * Queried property
+     */
+    CMdEPropertyDef* iSizeDef;                              // owned
+    
+    /**
+     * Queried property
+     */
+    CMdEPropertyDef* iDateDef;                              // owned
+    
+    /**
+     * Metadata object array
+     */
+    RPointerArray<CMdEObject> iObjects;                     // Owned
+    
+    /**
+     * Defines which media query is active
+     */
+    TCmMediaType iQueriedMedia;
+    
+    };
+
+#endif //  __CMSMVIDEOANDIMAGEMNGR_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmvideoandimagemngrobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  store file manager observer for images and videos
+*
+*/
+
+
+
+#ifndef __CMSMVIDEOANDIMAGEMNGROBSERVER_H
+#define __CMSMVIDEOANDIMAGEMNGROBSERVER_H
+
+
+// CLASS DECLARATION
+ /**
+  * Video and image manager observer class definition
+  *
+  * @lib cmstoremanager.lib
+  *
+  * @since S60 v3.1
+  */      
+class MCmSmVideoAndImageMngrObserver
+    {
+public:
+
+    /**
+     * Call back for observer
+     *
+     * @since S60 5.1
+     * @param aStatus, KErrNone if no errors, otherwise
+     *                 system wide error codes
+     * @return  None
+     */    
+    virtual void ImagesAndVideosReady( const TInt aStatus ) = 0;     
+    };
+
+#endif //  __CMSMVIDEOANDIMAGEMNGROBSERVER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmstoremanager.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Store manager interface
+*
+*/
+
+
+#ifndef M_CMSTOREMANAGER_H
+#define M_CMSTOREMANAGER_H
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <badesca.h>
+#include "cmcommontypes.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class CCmSqlPropertyContainer;
+
+/**
+ * Defines the store manager interface
+ *
+ * This class defines the store manager interface. Provides methods to
+ * execute storing
+ *
+ * @lib cmstoremanager.lib
+ *
+ * @since S60 5.1
+ */
+class MCmSmManager
+    {
+
+public:
+
+    /**
+     * Starts store service
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */    
+    virtual void StartStoreL() = 0;
+
+    /**
+     * Cancels store service
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */        
+    virtual void CancelOperation() = 0;
+
+    /**
+     * Starts store list processing
+     *
+     * @since S60 5.1
+     * @param None
+     * @return  None
+     */        
+    virtual void PreProcessLists() = 0;
+
+    /**
+     * Provides album list
+     *
+     * @since S60 5.1
+     * @param aMedia, media type
+     * @param aArray, list of values
+     * @return  None
+     */
+    virtual void GetColItemsL( TCmMediaType aMedia, 
+        CDesCArray& aArray ) = 0;
+        
+    /**
+     * Provides metadata column item list
+     *
+     * @since S60 5.1
+     * @param aMedia, media type
+     * @param aPropertys, list of values
+     * @return  None
+     */
+    virtual void GetColItemsL( TCmMediaType aMedia, 
+        CCmSqlPropertyContainer& aPropertys ) = 0;        
+    
+    /**
+     * Sets av controller
+     *
+     * @since S60 5.1
+     * @param aAVController, av controller pointer
+     * @return  None
+     */        
+    virtual void SetAvController( MUPnPAVController* aAVController ) = 0;   
+    
+    /**
+     * Closes the utility and deletes the object
+     *
+     * @since S60 5.1
+     */
+    virtual void Close() = 0;
+    };
+
+
+#endif // M_CMSTOREMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/inc/cmstoremanagerfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Abstract factory for Store manager
+*
+*/
+
+
+
+#ifndef C_CMSTOREMANAGERFACTORY_H
+#define C_CMSTOREMANAGERFACTORY_H
+
+#include <e32std.h>
+
+class MCmSmManager;
+class MCmServiceObserver;
+class CMdESession;
+class CCmDmMain;
+class CCmMmMain;
+
+/**
+ * Abstract factory for Store manager
+ *
+ * @lib cmstoremanager.lib
+ *
+ * @since S60 5.1
+ */
+class CmStoreManagerFactory
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer pointer
+     * @param aSession, Mde session
+     * @param aDBManager, database manager
+     * @param aMemManager, memory manager
+     * @return instance of Store manager
+     */
+    IMPORT_C static MCmSmManager* NewStoreManagerL( 
+        MCmServiceObserver* aObserver, CMdESession& aSession, 
+        CCmDmMain* aDBManager, CCmMmMain* aMemManager );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aObserver, observer pointer
+     * @param aSession, Mde session
+     * @param aDBManager, database manager
+     * @param aMemManager, memory manager
+     * @return instance of Store manager
+     */
+    IMPORT_C static MCmSmManager* NewStoreManagerLC( 
+        MCmServiceObserver* aObserver, CMdESession& aSession, 
+        CCmDmMain* aDBManager, CCmMmMain* aMemManager );
+
+    };
+
+#endif // C_CMSTOREMANAGERFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmclfmngr.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,450 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Store music file processing
+*  Version     : %version: tr1ido#9.1.2 % << Don't touch!
+*
+*/
+
+
+
+#include <ContentListingFactory.h>
+#include <MCLFContentListingEngine.h>
+#include <MCLFItem.h>
+#include <MCLFSortingStyle.h>
+#include "upnpfileutility.h"
+
+#include "cmstorelistitem.h"
+#include "cmsmfilemngr.h"
+#include "cmsmclfmngr.h"
+#include "msdebug.h"
+
+// CONSTANTS
+ _LIT( KCmSmIconExtension, ".fil" );
+ _LIT( ROM1, "Z" );
+ _LIT( ROM2, "z" );
+// Once filter maximum count;
+const TInt KFilterMaxCount = 10;
+        
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmSmClfMngr* CCmSmClfMngr::NewL( MCmSmMusicMngrObserver& aObserver, 
+    CCmSmFileMngr& aFileMngr, RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::NewL() start"));    
+    CCmSmClfMngr* self = CCmSmClfMngr::NewLC(
+        aObserver, aFileMngr, aItems );
+    CleanupStack::Pop( self );
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::NewL() end")); 
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::NewLC
+// ---------------------------------------------------------------------------
+//     
+CCmSmClfMngr* CCmSmClfMngr::NewLC( MCmSmMusicMngrObserver& aObserver, 
+    CCmSmFileMngr& aFileMngr, RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::NewLC() start"));     
+    CCmSmClfMngr* self = new ( ELeave ) CCmSmClfMngr(
+        aObserver, aFileMngr, aItems );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::NewLC() end"));     
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::~CCmSmClfMngr
+// ---------------------------------------------------------------------------
+// 
+CCmSmClfMngr::~CCmSmClfMngr()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::\
+        ~CCmSmClfMngr() start"));
+    Cancel();
+    CancelClfRefresh();
+    delete iNewAudioItems;
+    delete iNewImageItems;
+    delete iNewVideoItems;    
+    delete iEngine;
+    delete iSortingStyle;    
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::\
+        ~CCmSmClfMngr() end"));            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::CCmSmClfMngr
+// ---------------------------------------------------------------------------
+//            
+CCmSmClfMngr::CCmSmClfMngr( MCmSmMusicMngrObserver& aObserver, 
+    CCmSmFileMngr& aFileMngr, RPointerArray<CCmStoreListItem>& aItems )
+    :CActive( EPriorityStandard ),
+    iObserver( aObserver ), iFileMngr( aFileMngr ),
+    iItems( aItems )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCmSmClfMngr::ConstructL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::ConstructL()"));
+    iEngine = ContentListingFactory::NewContentListingEngineLC();
+    CleanupStack::Pop();
+    iNewAudioItems = iEngine->CreateListModelLC( *this );
+    CleanupStack::Pop();
+    
+    // Creating a temporary pointer since ContentListingFactory interface 
+    // forces us to use LC-method and we don't want to assign an member 
+    // variable with LC-method.
+    MCLFSortingStyle* sortingStyle = 
+        ContentListingFactory::NewSortingStyleLC();
+    CleanupStack::Pop(); // can't pop by name here
+    iSortingStyle = sortingStyle;
+    sortingStyle = NULL;
+    
+    iSortingStyle->SetOrdering( ECLFOrderingAscending );
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );  
+    }   
+    
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::CancelClfRefresh
+// ---------------------------------------------------------------------------
+//
+void CCmSmClfMngr::CancelClfRefresh()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::CancelClfRefresh()"));
+    if( iNewAudioItems )
+        {
+        iNewAudioItems->CancelRefresh();
+        }                 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::CancelOperation
+// ---------------------------------------------------------------------------
+//    
+void CCmSmClfMngr::CancelOperation()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::CancelOperation"));    
+    
+    if ( IsActive() )
+        {
+        Cancel();    
+        }
+    CancelClfRefresh();
+    iObserver.MusicReady( ECmSmProcessingCanceled );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::SetupCLFListModelsL
+// ---------------------------------------------------------------------------
+//    
+void CCmSmClfMngr::SetupCLFListModelsL( TCmMediaType aMediaType )
+    {
+    LOG(_L("[STORE MNGR]\t SetupCLFListModelsL"));
+    
+    RArray< TInt > mediaTypes;
+    CleanupClosePushL( mediaTypes );
+        
+    switch(aMediaType)
+        {
+        case ECmAudio:
+            {
+            mediaTypes.AppendL( ECLFMediaTypeMusic );
+            mediaTypes.AppendL( ECLFMediaTypeSound );
+            iNewAudioItems->SetWantedMediaTypesL( mediaTypes.Array() );
+            iNewAudioItems->SetSortingStyle( iSortingStyle );
+            break;
+            }                      
+        default:
+            {
+            break;
+            }    
+        }
+    CleanupStack::PopAndDestroy( &mediaTypes );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::DoRefreshL
+// ---------------------------------------------------------------------------
+//
+void CCmSmClfMngr::DoRefreshL( TCmMediaType aMediaType )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::DoRefreshL"));
+    
+    switch( aMediaType )
+        {
+        case ECmAudio:
+            {
+            SetupCLFListModelsL( aMediaType );
+            iNewAudioItems->RefreshL();
+            break;
+            }      
+        default:
+            {
+            LOG(_L("[STORE MNGR]\t DoRefreshL invariant media type"));
+            User::Invariant();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::FilterItemsL
+// ---------------------------------------------------------------------------
+//    
+void CCmSmClfMngr::FilterItemsL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::DoRefreshL"));
+    TRACE(Print( _L("[STORE MNGR]\t Filter file start index = %d"), 
+                                                             iFilterIndex ) );
+    TCmSmFileProcessingStatus status = ECmSmNone;
+    if ( iFilterIndex < iNewAudioItems->ItemCount() )
+        {
+        RArray<TInt>ids;
+        CleanupClosePushL( ids );
+        iFileMngr.MediaTypesL( ids, ECmAudio );
+        FilterNewItemsL( iNewAudioItems, ids, ECmAudio );
+        CleanupStack::PopAndDestroy( &ids );
+        status = ECmSmContinueFiltering;
+        }
+    else
+        { 
+        status = ECmSmFilteringReady;
+        }
+    
+    TRACE(Print( _L("[STORE MNGR]\t Filter file end index = %d"), 
+                                                             iFilterIndex ) );
+    CompleteRequest( status );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::FilterNewItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmSmClfMngr::FilterNewItemsL( MCLFItemListModel* aNewItems, 
+    RArray<TInt>aDeviceIds, TCmMediaType aType )
+    {
+    LOG(_L("[STORE MNGR]\t Filtering defined media type items"));
+    
+    TInt allCount = aNewItems->ItemCount();
+    
+    RArray<TInt>storeIds;
+    CleanupClosePushL( storeIds );
+    RArray<TInt>storedIds;
+    CleanupClosePushL( storedIds );
+    
+    // Copy all file names
+    TInt count = ( iFilterIndex + KFilterMaxCount ) <= allCount ? 
+                                KFilterMaxCount : ( allCount - iFilterIndex );
+    TRACE(Print( _L("[STORE MNGR]\t FilterNewItemsL file count = %d"), 
+                                                                    count ) );
+
+    TBool drm( EFalse );        
+    for ( TInt i = 0; i < count; i++ )
+        {
+        storeIds.Reset();         
+        
+        // Copy ids into temporary array
+        for( TInt ll = 0; ll < aDeviceIds.Count(); ll++ )
+            {
+            storeIds.Append(aDeviceIds[ll]);
+            }
+        
+        const MCLFItem& item = aNewItems->Item( iFilterIndex );
+        // Fetch protection type
+        TPtrC fileName;
+        TPtrC path;
+        TInt32 size( 0 );
+        TTime date;
+        TPtrC album;
+        TPtrC mediaType;
+        TPtrC pathAndFileName;
+        TPtrC fileExtension;
+        User::LeaveIfError( item.GetField( ECLFFieldIdPath, path ));
+        User::LeaveIfError( item.GetField( ECLFFieldIdFileName, fileName ));
+        User::LeaveIfError( item.GetField( ECLFFieldIdFileSize, size ));
+        User::LeaveIfError( item.GetField( ECLFFieldIdFileDate, date ));
+        User::LeaveIfError( item.GetField( ECLFFieldIdFileNameAndPath, 
+            pathAndFileName ));
+        User::LeaveIfError( item.GetField( ECLFFieldIdFileExtension,
+            fileExtension ) );    
+        
+        // Album list is needed for UI use
+        TInt error( item.GetField( ECLFFieldIdAlbum, album ) );    
+            
+        TRACE(Print( _L("[STORE MNGR]\t %03d: %S"), i, &fileName ) );
+        
+        // If the items is not an DRM item and album isn't in excluded list, 
+        // it is a potential candidate to be added into list of 
+        // files to transfer.
+        TRAP( error, drm = 
+            UPnPFileUtility::IsFileProtectedL( pathAndFileName ) );
+        TRACE( Print( _L("[STORE MNGR]\t IsFileProtectedL err = %d"), error));
+        if ( pathAndFileName[0] != ROM1()[0] 
+            && pathAndFileName[0] != ROM2()[0] 
+            && !drm 
+            && KErrNotFound == fileExtension.Match( KCmSmIconExtension ) )
+            {
+            if( iFileMngr.CheckIsFilledFileL( pathAndFileName ) )
+                {
+                storeIds.Reset();                
+                }
+            iFileMngr.IsAlreadyStoreL( pathAndFileName, storedIds, storeIds );
+            // If file is already stored to every wanted server
+            // => no need to keep file on the list any longer    
+            if( KErrNone < storeIds.Count() )
+                {
+                TCmListItemStatus status;
+                CCmStoreListItem* item = CCmStoreListItem::NewLC();                
+                item->SetPrimaryTextL( fileName );
+                item->SetPathL( pathAndFileName );
+                item->SetSize( size );
+                item->SetDate( date );
+                item->SetListId( iFileMngr.RetrieveListId( aType ) );
+                // Ms id values are binded with file status values 
+                iFileMngr.RetrieveListStatusValues( aType, status );
+                // Where item will be stored 
+                for( TInt s = 0 ; s < storeIds.Count(); s++ )
+                    {
+                    item->SetDevId( storeIds[s], status );    
+                    }
+                // Where item has already been stored
+                for( TInt d = 0; d < storedIds.Count(); d++ )
+                    {
+                    item->SetDevId( storedIds[d], ECmStored );
+                    }
+                iItems.AppendL( item );
+                CleanupStack::Pop( item );                
+                }
+            storedIds.Reset();         
+            }              
+        iFilterIndex++;
+        }
+    
+    CleanupStack::PopAndDestroy( &storedIds );
+    CleanupStack::PopAndDestroy( &storeIds );         
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::HandleOperationEventL
+// ---------------------------------------------------------------------------
+//     
+void CCmSmClfMngr::HandleOperationEventL(
+    TCLFOperationEvent aOperationEvent, TInt aError )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::HandleOperationEventL"));
+
+    if ( aOperationEvent == ECLFRefreshComplete )
+        {
+        switch ( aError )
+            {
+            case KErrNone:
+                {
+                CompleteRequest( ECmSmAllRefreshed );
+                break;
+                }
+            case KErrCancel:
+                {
+                iObserver.MusicReady( ECmSmProcessingCanceled );
+                break;
+                }
+            default:
+                {
+                // Notify observer.
+                iObserver.MusicReady( ECmSmRefreshError );
+                break;
+                }
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::CompleteRequest
+// ---------------------------------------------------------------------------
+// 
+void CCmSmClfMngr::CompleteRequest( 
+    TCmSmFileProcessingStatus aStatus )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::CompleteRequest"));
+    
+    __ASSERT_DEBUG(!IsActive(),\
+        User::Panic( KCmSmManager, KErrInUse ));          
+    SetActive();        
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, aStatus );     
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::RunL
+// ---------------------------------------------------------------------------
+//                 
+void CCmSmClfMngr::RunL()
+    {
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmClfMngr::RunL\
+         status = %d"), iStatus.Int() ));
+         
+    switch( iStatus.Int() )
+        {       
+        case ECmSmAllRefreshed:
+            {
+            CompleteRequest( ECmSmStartItemFiltering );  
+            break;
+            }
+        case ECmSmStartItemFiltering:
+            {
+            iFilterIndex = 0;
+            TRACE(Print( _L("[STORE MNGR]\t Need filter file count = %d"), 
+                                              iNewAudioItems->ItemCount() ) );
+            CompleteRequest( ECmSmContinueFiltering );
+            break;
+            }
+        case ECmSmContinueFiltering:
+            {
+            FilterItemsL();
+            break;
+            }
+        case ECmSmFilteringReady:
+            {
+            iObserver.MusicReady( KErrNone );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[STORE MNGR]\t Store file processing RunL default"));
+            User::Invariant();
+            break;
+            }
+        }
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmClfMngr::DoCancel
+// ---------------------------------------------------------------------------
+//    
+void CCmSmClfMngr::DoCancel()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmClfMngr::DoCancel"));
+    }
+                        
+// End of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmcontentchangeobserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles devices content change events
+*
+*/
+
+
+#include "cmsmcontentchangeobserver.h"
+#include "cmsmfileprocessingobserver.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CCmSmContentChangeObserver::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmSmContentChangeObserver* CCmSmContentChangeObserver::NewL( 
+    CMdESession& aSession, 
+    MCmSmFileProcessingObserver& aObserver )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::NewL() start"));    
+    CCmSmContentChangeObserver* self = 
+        CCmSmContentChangeObserver::NewLC( aSession, aObserver );
+    CleanupStack::Pop( self );
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::NewL() end")); 
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmContentChangeObserver::NewLC
+// ---------------------------------------------------------------------------
+//     
+CCmSmContentChangeObserver* CCmSmContentChangeObserver::NewLC( 
+    CMdESession& aSession,
+    MCmSmFileProcessingObserver& aObserver )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::NewLC() start"));     
+    CCmSmContentChangeObserver* self = 
+        new ( ELeave ) CCmSmContentChangeObserver( aSession, aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::NewLC() end"));     
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmContentChangeObserver::~CCmSmContentChangeObserver
+// ---------------------------------------------------------------------------
+// 
+CCmSmContentChangeObserver::~CCmSmContentChangeObserver()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::\
+        ~CCmSmContentChangeObserver() start"));
+    TRAP_IGNORE( iMdSSession.RemoveObjectObserverL( *this ) );
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::\
+        ~CCmSmContentChangeObserver() end"));            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmContentChangeObserver::StartObserversL
+// ---------------------------------------------------------------------------
+//
+void CCmSmContentChangeObserver::StartObserversL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::StartObserversL")); 
+    
+    iMdSSession.AddObjectObserverL( *this );
+    iStarted = ETrue;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmContentChangeObserver::IsStarted
+// ---------------------------------------------------------------------------
+// 
+TBool CCmSmContentChangeObserver::IsStarted()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::IsStarted")); 
+    
+    return iStarted;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmContentChangeObserver::HandleObjectNotification
+// ---------------------------------------------------------------------------
+// 
+void CCmSmContentChangeObserver::HandleObjectNotification(
+                                  CMdESession& /*aSession*/, 
+						          TObserverNotificationType /*aType*/,
+						          const RArray<TItemId>& /*aObjectIdArray*/)
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::\
+    HandleObjectNotification")); 
+    
+    iObserver.FileProcessingStatus( ECmSmContentChanged );
+    }
+    
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//            
+CCmSmContentChangeObserver::CCmSmContentChangeObserver( 
+    CMdESession& aSession,
+    MCmSmFileProcessingObserver& aObserver ) : iMdSSession( aSession ), 
+    iObserver( aObserver )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::\
+    CCmSmContentChangeObserver")); 
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCmSmContentChangeObserver::ConstructL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::ConstructL"));
+    
+    iStarted = EFalse;
+    }    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmfilemngr.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1007 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Store file processing
+*
+*/
+
+
+#include <e32property.h>
+#include "cmdmmain.h"
+#include "cmstorerule.h"
+#include "cmstorelistitem.h"
+#include "cmfilllistitem.h"
+#include "cmsmfileprocessingobserver.h"
+#include "cmsmcontentchangeobserver.h"
+#include "cmsmvideoandimagemngr.h"
+#include "cmsmclfmngr.h"
+#include "cmsmiteminfo.h"
+#include "cmsmmsinfo.h"
+#include "cmsmfilemngr.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KCmSmIniStoreTransferSpeed = 200; // 200 kBs
+const TInt KCmSmIniStoreTransferTime = 1; // One second
+
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmSmFileMngr* CCmSmFileMngr::NewL(
+    MCmSmFileProcessingObserver* aObserver, CMdESession& aSession, 
+    CCmDmMain* aDBMngr, RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::NewL() start"));    
+    CCmSmFileMngr* self = CCmSmFileMngr::NewLC(
+        aObserver, aSession, aDBMngr, aItems );
+    CleanupStack::Pop( self );
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::NewL() end")); 
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::NewLC
+// ---------------------------------------------------------------------------
+//     
+CCmSmFileMngr* CCmSmFileMngr::NewLC( 
+    MCmSmFileProcessingObserver* aObserver, CMdESession& aSession, 
+    CCmDmMain* aDBMngr,
+    RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::NewLC() start"));     
+    CCmSmFileMngr* self = new ( ELeave ) CCmSmFileMngr(
+        aObserver, aDBMngr, aItems );
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession );
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::NewLC() end"));     
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::~CCmSmFileMngr
+// ---------------------------------------------------------------------------
+// 
+CCmSmFileMngr::~CCmSmFileMngr()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::\
+        ~CCmSmFileMngr() start"));
+    Cancel();    
+    
+    delete iVideoAndImageMngr;
+    delete iClfMusicMngr;
+    iRuleArray.ResetAndDestroy();
+    iRuleArray.Close();
+    
+    iFilledItems.ResetAndDestroy();
+    iFilledItems.Close();
+        
+    iStoredArray.ResetAndDestroy();
+    iStoredArray.Close();
+    
+    iMsIds.ResetAndDestroy();
+    iMsIds.Close();
+    
+    iMediaTypes.Reset();
+    iMediaTypes.Close();
+    
+    delete iCcObserver;
+         
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::\
+        ~CCmSmFileMngr() end"));            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::CCmSmFileMngr
+// ---------------------------------------------------------------------------
+//            
+CCmSmFileMngr::CCmSmFileMngr( 
+    MCmSmFileProcessingObserver* aObserver, CCmDmMain* aDBMngr,
+    RPointerArray<CCmStoreListItem>& aItems )
+    :CActive( EPriorityStandard ),
+    iObserver( aObserver ), iDBManager( aDBMngr ), iItems( aItems )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CCmSmFileMngr()"));
+    
+    CActiveScheduler::Add( this );
+    iTransferInfo.iTotalItems = KErrNone;
+    iTransferInfo.iProcessedItems = KErrNone;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCmSmFileMngr::ConstructL( CMdESession& aSession )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ConstructL()"));
+    iVideoAndImageMngr = 
+        CCmSmVideoAndImageMngr::NewL( *this, *this, aSession, iItems );
+    iClfMusicMngr = CCmSmClfMngr::NewL( *this, *this, iItems );
+    iCcObserver = 
+            CCmSmContentChangeObserver::NewL( aSession, *iObserver );        
+    iProcessingStatus = ECmSmNone;
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::StartProcessing
+// ---------------------------------------------------------------------------
+// 
+void CCmSmFileMngr::StartProcessing()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::StartProcessing()"));
+    
+    iTransferInfo.iTotalItems = KErrNone;
+    iTransferInfo.iProcessedItems = KErrNone;
+    if( !iCcObserver->IsStarted() )
+        {
+        TRAPD( err, iCcObserver->StartObserversL() );
+        if( err )
+            {
+            TRACE(Print( _L("[STORE MNGR] StartObserversL err = %d"),
+                err ) );
+            }
+        }    
+    CompleteRequest( ECmSmPreProcessingStarted );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::ProcessAlbumList
+// ---------------------------------------------------------------------------
+// 
+void CCmSmFileMngr::ProcessAlbumList( TCmMediaType /*aMedia*/, 
+    CDesCArray& /*aArray*/ )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ProcessAlbumList()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::StoreItemCount
+// ---------------------------------------------------------------------------
+//        
+TInt CCmSmFileMngr::StoreItemCount()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::StoreItemCount()"));
+    
+    return iDBManager->StoreFileCount( 
+        ECmToBeRemoved|ECmToBeShrinked|ECmKeepOnDevice );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::FillItemCount
+// ---------------------------------------------------------------------------
+//
+TInt CCmSmFileMngr::FillItemCount()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::FillItemCount()"));
+    
+    return iDBManager->FillFileCount( ECmToBeShrinked|ECmToBeFilled );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::GetStoreFileCountNoDuplicatesL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::GetStoreFileCountNoDuplicatesL( TInt& aCount )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::\
+    GetStoreFileCountNoDuplicatesL()"));
+    
+    iDBManager->GetStoreFileCountNoDuplicatesL( aCount, 
+        ECmToBeRemoved|ECmToBeShrinked|ECmKeepOnDevice );
+    TRACE(Print( _L("[STORE MNGR] GetStoreFileCountNoDuplicatesL count = %d"),
+        aCount ) );        
+    TInt count = 0;
+    TInt time = 0;
+    iDBManager->GetTransferInfo( ECmServiceStore, count, time );
+    iDBManager->UpdateTransferInfo( ECmServiceStore, aCount, 
+        time );    
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::UpdateTransferHistoryData
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::UpdateTransferHistoryData(
+    TInt64 aInterval, TInt64 aDataAmount, 
+    TUint8 aServerId )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::UpdateTransferHistoryData()"));
+    
+    iDBManager->UpdateUploadHistory( aServerId,
+        aDataAmount, aInterval );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::CancelOperation
+// ---------------------------------------------------------------------------
+//    
+void CCmSmFileMngr::CancelOperation()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CancelOperation()"));
+    
+    Cancel();
+    iVideoAndImageMngr->CancelOperation();
+    iClfMusicMngr->CancelOperation();
+    iObserver->FileProcessingStatus( ECmSmProcessingCanceled );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::ImagesAndVideosReady
+// ---------------------------------------------------------------------------
+// 
+void CCmSmFileMngr::ImagesAndVideosReady( const TInt /*aStatus*/ )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ImagesAndVideosReady()"));
+    
+    CompleteRequest( ECmSmMediaTypesSelected );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::MusicReady
+// ---------------------------------------------------------------------------
+// 
+void CCmSmFileMngr::MusicReady( const TInt /*aStatus*/ )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::MusicReady()"));
+    
+    CompleteRequest( ECmSmMediaTypesSelected );
+    }
+            
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::LoadSelectedStoreRulesL
+// ---------------------------------------------------------------------------
+//        
+void CCmSmFileMngr::LoadSelectedStoreRulesL()
+    {
+    LOG(_L("[FILL MNGR]\t CCmSmFileMngr::LoadSelectedStoreRulesL()"));
+    
+    RPointerArray<HBufC8> array;
+    CleanupClosePushL( array );
+    iDBManager->PrepareQueryCmdL( ESelectedStoreRuleQuery );    
+    iDBManager->QuerySelectedStoreRuleNamesL( array, 1 );
+    // Load selected store rules to array ( using names as a qyery 
+    // parameter )
+    for( TInt i = 0; i < array.Count(); i++ ) 
+        {
+        CCmStoreRule* storeRule = CCmStoreRule::NewLC();    
+        iDBManager->PrepareQueryCmdL(EStoreRuleQuery);
+        storeRule->SetNameL( *array[i] );        
+        iDBManager->QueryStoreRuleL( storeRule );
+        iRuleArray.Append( storeRule );
+        CleanupStack::Pop(storeRule);
+        }
+    array.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &array );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::ProcessStoreRules
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::ProcessStoreRules()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ProcessStoreRules()"));    
+    
+    TPtrC8 mediaServer;        
+    for( TInt i = iRuleArray.Count() - 1; i >= 0; i-- )
+        {
+        if( KErrNone == iRuleArray[i]->MediaServerCount() )    
+            {
+            // If no servers defined => DO NOT use rule at all
+            // First delete the object
+            delete iRuleArray[i];
+            // Then delete the pointer
+            iRuleArray.Remove(i);    
+            LOG(_L("[STORE MNGR]\t Store rule doesn't have any \
+                defined servers"));
+            LOG(_L("[STORE MNGR]\t ******* ==> RULE SKIPPED \
+                ******************"));      
+            }
+        else
+            {
+            // Do nothing
+            }        
+        }
+    iRuleArray.Compress();                
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::LoadFilledAndStoredL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::LoadFilledAndStoredL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadFilledAndStoredL()"));    
+    
+    LoadMediaServerIdsL();
+    LoadFilledL();    
+    for( TInt i = 0; i < iMsIds.Count(); i++ )
+        {
+        LoadStoredL( *iMsIds[i]->iUuid );
+        }
+    CompleteRequest( ECmSmAllLoaded );            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::LoadFilledL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::LoadFilledL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadFilledL()"));
+    
+    iFilledItems.ResetAndDestroy();
+    iFilledItems.Close();
+    iDBManager->PrepareQueryCmdL(EAllFillFilesStatusQuery);    
+    iDBManager->GetAllFillFilesL( 
+        iFilledItems,ECmFilled|ECmToBeRemoved|ECmLocalCopy );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::LoadStoredL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::LoadStoredL( const TDesC8& aUDN )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadStoredL()"));        
+    
+    // Load to spesific server filled items
+    iDBManager->PrepareQueryCmdL( EMediaServerIdQuery );
+    TInt64 id( iDBManager->QueryMediaServerId( aUDN ) );
+    if( KErrNone < id )
+        {
+        RPointerArray<HBufC16> array;
+        CleanupClosePushL( array );
+        iDBManager->PrepareQueryCmdL(EStoredRowQuery);
+        iDBManager->QueryStoredRowL( array, aUDN, KErrNotFound );
+        for( TInt i = 0; i < array.Count(); i++ )
+            {            
+            CCmSmItemInfo* storedItemInfo = 
+                CCmSmItemInfo::NewLC( *array[i], id );
+            iStoredArray.Append( storedItemInfo );
+            CleanupStack::Pop( storedItemInfo );
+            }
+        // Ownership didn't change, reset and destroy    
+        array.ResetAndDestroy();
+        CleanupStack::PopAndDestroy( &array );
+        }
+    else
+        {
+        LOG(_L("[STORE MNGR]\t No media server id found"));        
+        }                        
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::ResetFilledArray
+// ---------------------------------------------------------------------------
+//    
+void CCmSmFileMngr::ResetFilledArray()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ResetFilledArray()"));
+            
+    iFilledItems.ResetAndDestroy();
+    iFilledItems.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::SelectMediaTypes
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::SelectMediaTypes()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::SelectMediaTypes()"));
+    
+    TCmMediaType mediaType;
+    for( TInt i = 0; i < iRuleArray.Count(); i++ )
+        {
+        for( TInt j = 0; j < iRuleArray[i]->DefCount(); j++ )
+            {
+            iRuleArray[i]->StoreRule( j, &mediaType );
+            if( KErrNotFound == iMediaTypes.Find( mediaType ) )
+                {
+                iMediaTypes.Append( mediaType );
+                }
+            }
+        }                                                   
+    iRefreshIndex = 0;            
+    CompleteRequest( ECmSmMediaTypesSelected );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::CheckIsFilledFileL
+// ---------------------------------------------------------------------------
+//
+TBool CCmSmFileMngr::CheckIsFilledFileL( const TDesC& aPathAndFileName )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CheckIsFilledFileL()"));
+    
+    TBool processed( EFalse );
+    // Check if file is filled from some listed server
+    for( TInt j = 0; j < iFilledItems.Count() && !processed; j++ )
+        {
+        if( KErrNotFound != aPathAndFileName.FindC( 
+            iFilledItems[j]->Path() ) )
+            {
+            LOG(_L("[STORE MNGR]\t Filled file!!!"));
+            LOG(_L("[STORE MNGR]\t File not stored!!!"));            
+            processed = ETrue;
+            // End loop
+            j = iFilledItems.Count();
+            }
+        }
+    return processed;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::IsAlreadyStoreL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::IsAlreadyStoreL( const TDesC& aPathAndFileName, 
+    RArray<TInt>& aStoredIds, RArray<TInt>& aStoreIds )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::IsAlreadyStoreL()"));
+    
+    // Check if file is already stored to some of the defined servers
+    for( TInt k = 0; k < iStoredArray.Count() ;k++ )
+        {
+        if(  KErrNone == iStoredArray[k]->iFile->
+            Compare( aPathAndFileName ) )
+                {
+                for( TInt l = aStoreIds.Count() - 1; l >= 0; l-- )
+                    {
+                    if( aStoreIds[l] == iStoredArray[k]->iId )
+                        {
+                        aStoredIds.Append( aStoreIds[l] );
+                        aStoreIds.Remove(l);
+                        LOG(_L("[STORE MNGR]\t Stored file!!!"));
+                        }
+                    }
+                aStoreIds.Compress();   
+                }                        
+        }     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::MediaTypesL
+// ---------------------------------------------------------------------------
+//    
+void CCmSmFileMngr::MediaTypesL( RArray<TInt>& aIds, TCmMediaType aType )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::MediaTypesL()"));
+    
+    // Loop for store rules
+    for( TInt i = 0; i < iRuleArray.Count(); i++ )
+        {
+        TBool addServers = EFalse;
+        TInt msCount(iRuleArray[i]->MediaServerCount());
+        TInt defCount( iRuleArray[i]->DefCount() ); 
+        TCmMediaType temptype;
+        
+        // In specific store rule, loop to check if the rule has relevant 
+        // media type.
+        for( TInt n = 0; n < defCount; n++ )
+            {
+            iRuleArray[i]->StoreRule(n, &temptype );
+            if(  aType == temptype )
+                {
+                addServers = ETrue;            
+                }
+            }
+        if( addServers )
+            {
+            // Loop for media servers
+            for( TInt k = 0; k < msCount ; k++ )
+                {
+                const TPtrC8 ms = iRuleArray[i]->MediaServerL( k );
+                
+                // To find if Uuid of ms has been in iMsIds.
+                for( TInt l = 0 ; l < iMsIds.Count(); l++ )
+                    {
+                    if( KErrNone == ms.Compare( *iMsIds[l]->iUuid ) )
+                        {
+                        aIds.InsertInOrder( iMsIds[l]->iId );
+                        // End loop    
+                    	l = iMsIds.Count();  
+                        }
+                    }
+                }
+            }
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::LoadMediaServerIdsL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::LoadMediaServerIdsL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadMediaServerIdsL()"));
+    
+    TInt64 id(KErrNone);
+    RArray<TInt64> tempIds;
+    CleanupClosePushL( tempIds );
+    for( TInt i = 0; i < iRuleArray.Count(); i++ )
+        {
+        for( TInt j = 0 ; j < iRuleArray[i]->MediaServerCount(); j++ )
+            {
+            const TDesC8& mediaServer = iRuleArray[i]->MediaServerL( j );
+            iDBManager->PrepareQueryCmdL( EMediaServerIdQuery );
+            id = iDBManager->QueryMediaServerId( mediaServer );
+            if( KErrNone < id && KErrNotFound == tempIds.Find(id) )
+                {
+                HBufC8* uuid = mediaServer.AllocLC();
+                CCmSmMsInfo* msInfo = CCmSmMsInfo::NewLC( *uuid, id );
+                tempIds.Append(id);
+                iMsIds.Append(msInfo);                
+                CleanupStack::Pop( msInfo );
+                CleanupStack::PopAndDestroy( uuid );
+                }
+            }
+        }
+    tempIds.Reset();
+    CleanupStack::PopAndDestroy( &tempIds );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::GetDevId
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmSmFileMngr::GetDevId( const TDesC8& aUuid )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::GetDevId()"));
+    
+    TInt64 id( KErrNone );
+    TBool flag( EFalse );
+    for( TInt i = 0; i < iMsIds.Count() && !flag; i++ )
+        {
+        if( KErrNotFound != iMsIds[i]->iUuid->Match( aUuid ) )
+            {
+            id = iMsIds[i]->iId;
+            flag = ETrue;
+            }
+        }
+    return id;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::GetItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::GetItemsL( RArray<TInt>& aItemIds,
+    const TDesC8& aUuid, TInt64& aId )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::GetItemsL()"));
+    
+    aItemIds.Reset();        
+    
+    RArray<TInt>ids;    
+    RArray<TCmListItemStatus> statusValues;
+    
+    aId = GetDevId( aUuid );
+    for( TInt i = 0; i < iItems.Count() && aId != KErrNone; i++ )
+        {
+        ids = iItems[i]->DevIds();
+        statusValues = iItems[i]->StatusValues();
+        TInt index( ids.FindInOrder( aId ) );
+        if( KErrNotFound != index )
+            {
+            TBool itemOnSelectedList( EFalse );
+            // check that item belongs to selected list
+            for ( TInt j = 0; j < iRuleArray.Count(); j++ )
+                {
+                CCmStoreRule* rule = iRuleArray[j];
+                if ( iItems[i]->ListId() ==  rule->ListId() )
+                    {
+                    itemOnSelectedList = ETrue;
+                    }
+                }
+
+            // Check that item isn't stored yet            
+            if( index < statusValues.Count() )
+                {
+                if( itemOnSelectedList &&
+                    ECmStored != statusValues[ index ] )
+                    {
+                    aItemIds.Append( i );
+                    }                
+                }            
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::UpdateStoreFileListL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::UpdateStoreFileListL()
+    {
+    TRACE( Print( _L("[STORE MNGR]\t UpdateStoreFileListL iItemsCount = %d"), 
+        iItems.Count() ));
+        
+    iDBManager->DeleteStoreFiles();
+    iDBManager->SetStoreFilesL( iItems );
+    iItems.ResetAndDestroy();
+    iItems.Close();            
+    CalculateAvgTransferTimeL();
+    SendAvgTransferTime();    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::LoadStoreFileListL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::LoadStoreFileListL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadStoreFileListL()"));
+    
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    ResetArrays();
+    LoadSelectedStoreRulesL();
+    ProcessStoreRules();
+    LoadMediaServerIdsL();
+
+    iDBManager->PrepareQueryCmdL( EAllStoreFilesQuery );
+    iDBManager->QueryAllStoreFilesL( iItems );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::RetrieveListId
+// ---------------------------------------------------------------------------
+//    
+TInt64 CCmSmFileMngr::RetrieveListId( TCmMediaType aType )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::RetrieveListId()"));
+    
+    TCmMediaType type;
+    TUint id( KErrNone );
+    TBool flag( EFalse );
+    for( TInt i = 0; i < iRuleArray.Count() && !flag; i++ )
+        {
+        TInt defCount = iRuleArray[i]->DefCount();
+        for( TInt j = 0; j < defCount && !flag; j++ )
+            {
+            iRuleArray[i]->StoreRule( j, &type );
+            if( type == aType )
+                {
+                flag = ETrue;
+                id = iRuleArray[i]->ListId();
+                }
+            }
+        }
+    return id;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::RetrieveListStatusValues
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::RetrieveListStatusValues( TCmMediaType aType,
+    TCmListItemStatus& aStatus )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::RetrieveListStatusValues()"));
+    
+    TCmMediaType type;
+    TBool flag( EFalse );
+    for( TInt i = 0; i < iRuleArray.Count() && !flag; i++ )
+        {
+        TInt defCount = iRuleArray[i]->DefCount();
+        for( TInt j = 0; j < defCount && !flag; j++ )
+            {
+            iRuleArray[i]->StoreRule( j, &type );
+            if( type == aType )
+                {
+                flag = ETrue;
+                // Set found status value
+                aStatus = iRuleArray[i]->Status();
+                }
+            }
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::DeleteItems
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::DeleteItems( RArray<TInt>& aIds )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::DeleteItems()"));
+    
+    TInt i( 0 );
+    // aIds has indexes to iItems array. 
+    while( aIds.Count() )
+        {
+        if( ( aIds[0] - i ) < iItems.Count() )
+            {
+            delete iItems[aIds[0] - i];
+            iItems.Remove( aIds[0] - i );
+            aIds.Remove(0);            
+            }
+        i++;
+        }
+    iItems.Compress();    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::ResetArrays
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::ResetArrays()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ResetArrays()"));
+    
+    // Let's reset all needed array    
+    iRuleArray.ResetAndDestroy();
+    iRuleArray.Close();
+ 
+    iFilledItems.ResetAndDestroy();
+    iFilledItems.Close(); 
+    iStoredArray.ResetAndDestroy();
+    iStoredArray.Close();
+    
+    iMsIds.ResetAndDestroy();
+    iMsIds.Close();  
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::ProcessMedia
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::ProcessMedia( TCmMediaType aType )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ProcessMedia"));
+    switch( aType )
+        {
+        case ECmAudio:
+            {
+            ProcessMusics();
+            break;
+            }                
+        case ECmVideo: // Fall through
+        case ECmImage: // Fall through
+        case ECmOtherImage: // Fall through
+        case ECmOtherVideo: // Fall through       
+            {
+            iVideoAndImageMngr->ProcessMedia( aType );
+            break;
+            }
+        default:
+            {
+            User::Invariant();
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::ProcessMusics
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::ProcessMusics()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ProcessMusics()"));
+    
+    TRAPD( err, iClfMusicMngr->DoRefreshL( ECmAudio ) );
+    if( err )
+        {
+        TRACE( Print( _L( "ProcessMusics err = %d"), err ));
+        CompleteRequest( ECmSmPreProcessingReady );        
+        }    
+    } 
+                
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::CalculateAvgTransferTimeL
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::CalculateAvgTransferTimeL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CalculateAvgTransferTimeL()"));
+    
+    TInt64 ud(KErrNone);
+    TInt64 dd(KErrNone);
+    TInt64 ut(KErrNone);
+    TInt64 dt(KErrNone);
+    TInt64 size( KErrNone );
+    TInt64 shrinkTime(KErrNone);
+    TInt64 transferTime(KErrNone);
+    for( TInt i = 0; i < iMsIds.Count(); i++ )
+        {
+        iDBManager->PrepareQueryCmdL(ETransferHistoryQuery);
+        iDBManager->QueryTransferHistory( 
+            *iMsIds[i]->iUuid, dd, ud, dt, ut );
+        size = iDBManager->KBytesToBeStored( iMsIds[i]->iId, 
+            ECmToBeRemoved|ECmToBeShrinked|ECmKeepOnDevice );
+        if( ud == KErrNone || ut == KErrNone )
+            {
+            ud = KCmSmIniStoreTransferSpeed;
+            ut = KCmSmIniStoreTransferTime;
+            }            
+        transferTime = transferTime + (( ut * size ) / ud );  
+        }
+    
+    TInt shrinkCount( iDBManager->StoreFileCount(ECmToBeShrinked) );
+        
+    shrinkTime = (iDBManager->GetAvgImageShrinkTime() * shrinkCount);     
+    
+    TInt totalCount(KErrNone);
+    totalCount = iDBManager->StoreFileCountNoDuplicates();
+    transferTime = transferTime + (shrinkTime / 1000 );
+    if( KErrNone >= totalCount ) 
+        {
+        transferTime = KErrNone;
+        }
+    iDBManager->UpdateTransferInfo( ECmServiceStore, totalCount, 
+        transferTime );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::SendAvgTransferTime
+// ---------------------------------------------------------------------------
+//   
+void CCmSmFileMngr::SendAvgTransferTime()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::SendAvgTransferTime()"));
+          
+    iDBManager->GetTransferInfo( ECmServiceStore, 
+        iTransferInfo.iProcessedItems, iTransferInfo.iTotalItems );
+    iTransferInfo.iService = ECmServiceTransferInfoStore;
+    
+    TRACE( Print( _L("[STORE MNGR]\t Store file count %d"), 
+        iTransferInfo.iProcessedItems)); 
+            
+    TCmProgressInfoPckg transferInfoPckg( iTransferInfo );
+    
+    TInt err = RProperty::Set( KCmPropertyCat, KCmProperty, 
+        transferInfoPckg );
+    
+    TRACE( Print( _L("[STORE MNGR]\t RProperty::Set returned %d"), err));    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::SetProcessingStatus
+// ---------------------------------------------------------------------------
+//
+void CCmSmFileMngr::SetProcessingStatus( TCmSmFileProcessingStatus aStatus )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::SetProcessingStatus()"));
+    
+    iProcessingStatus = aStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::CompleteRequest
+// ---------------------------------------------------------------------------
+// 
+void CCmSmFileMngr::CompleteRequest( 
+    TCmSmFileProcessingStatus aStatus )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CompleteRequest()"));
+    
+    __ASSERT_DEBUG(!IsActive(),\
+        User::Panic( KCmSmManager, KErrInUse ));          
+    SetActive();        
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, aStatus );     
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::RunL
+// ---------------------------------------------------------------------------
+//                 
+void CCmSmFileMngr::RunL()
+    {
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmFileMngr::RunL\
+         status = %d"), iStatus.Int() ));        
+    switch( iStatus.Int() )
+        {
+        case ECmSmPreProcessingStarted:
+            {
+            LoadSelectedStoreRulesL();
+            CompleteRequest( ECmSmStoreRulesLoaded );              
+            break;
+            }
+        case ECmSmStoreRulesLoaded:
+            {
+            ProcessStoreRules();
+            if( KErrNone < iRuleArray.Count() )
+                {
+                CompleteRequest( ECmSmLoadFilledAndStored );
+                }
+            else
+                {
+                // No selected rules => Delete all store files
+                TInt err( iDBManager->DeleteStoreFiles() );
+                TRACE(Print(_L("[STORE MNGR]\t DeleteStoreFiles error = %d"),
+                      err ));
+                CalculateAvgTransferTimeL();
+                SendAvgTransferTime();
+                iObserver->FileProcessingStatus( ECmSmNoStoreRulesSelected );
+                }               
+            break;
+            }
+        case ECmSmLoadFilledAndStored:
+            {
+            LoadFilledAndStoredL();
+            break;
+            }
+        case ECmSmAllLoaded:
+            {
+            SelectMediaTypes();
+            break;
+            }
+        case ECmSmMediaTypesSelected:
+            {
+            if( iMediaTypes.Count() > iRefreshIndex )
+                {
+                ProcessMedia( iMediaTypes[iRefreshIndex] );
+                iRefreshIndex++;
+                if( iProcessingStatus == ECmSmProcessingFilesStarted )
+                    {
+                    iObserver->FileProcessingStatus( iProcessingStatus );
+                    iProcessingStatus = ECmSmNone;
+                    }
+                }
+            else
+                {
+                LOG(_L("[STORE MNGR]\t Store list processing ready"));
+                UpdateStoreFileListL();
+                CompleteRequest( ECmSmPreProcessingReady );                
+                }                            
+            break;
+            }
+        case ECmSmPreProcessingReady:
+            {
+            ResetArrays();
+            if( iProcessingStatus == ECmSmProcessingFilesStarted )
+                {
+                iObserver->FileProcessingStatus( iProcessingStatus );
+                iProcessingStatus = ECmSmNone;
+                }
+            iObserver->FileProcessingStatus( ECmSmPreProcessingReady );            
+            break;
+            }
+        default:
+            {
+            LOG(_L("[STORE MNGR]\t Store file processing RunL default"));
+            User::Invariant();
+            break;
+            }
+        }
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::DoCancel
+// ---------------------------------------------------------------------------
+//    
+void CCmSmFileMngr::DoCancel()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmFileMngr::DoCancel()"));     
+    }
+  
+// ---------------------------------------------------------------------------
+// CCmSmFileMngr::RunError
+// ---------------------------------------------------------------------------
+// 
+TInt CCmSmFileMngr::RunError( TInt aError )
+    {
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmFileMngr::RunError\
+         aError = %d"), aError ));     
+    return aError;
+    }
+                            
+// End of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmiteminfo.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Store item info class
+*
+*/
+
+
+#include "cmsmiteminfo.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CCmSmItemInfo::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmSmItemInfo* CCmSmItemInfo::NewL( TDesC& aFile, TInt64 aId )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmItemInfo::NewL"));
+    
+    CCmSmItemInfo* self = CCmSmItemInfo::NewLC( aFile, aId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmItemInfo::NewLC
+// ---------------------------------------------------------------------------
+//     
+CCmSmItemInfo* CCmSmItemInfo::NewLC( TDesC& aFile, TInt64 aId )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmItemInfo::NewLC"));
+    
+    CCmSmItemInfo* self = new ( ELeave ) CCmSmItemInfo();
+    CleanupStack::PushL( self );
+    self->ConstructL( aFile, aId );    
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmItemInfo::~CCmSmItemInfo
+// ---------------------------------------------------------------------------
+// 
+CCmSmItemInfo::~CCmSmItemInfo()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmItemInfo::~CCmSmItemInfo"));
+    
+    delete iFile;      
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmItemInfo::CCmSmItemInfo
+// ---------------------------------------------------------------------------
+//            
+CCmSmItemInfo::CCmSmItemInfo()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmItemInfo::CCmSmItemInfo"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmItemInfo::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCmSmItemInfo::ConstructL( TDesC& aFile, TInt64 aId )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmItemInfo::ConstructL"));
+    
+    iFile = aFile.AllocL();
+    iId = aId;                                     
+    }  
+                        
+// End of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmmain.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,778 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main class in Store manager component
+*
+*/
+
+
+#include <e32property.h>
+#include "upnpavdevice.h"
+#include "upnpavcontroller.h"
+#include "upnpavdevicelist.h"
+#include <utf.h>
+#include "cmserviceobserver.h"
+#include "cmsmfilemngr.h"
+#include "cmsmtransferengine.h"
+#include "cmstorelistitem.h"
+#include "cmdmmain.h"
+#include "cmmmmain.h"
+#include "cmsmmain.h"
+#include "msdebug.h"
+
+// One file transfered
+const TInt KCmOneFile = 1;
+const TInt KCmSmClfRefreshInterval = 15000000;
+const TInt KCmSmOneSecond = 1000000;
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmSmMain* CCmSmMain::NewL( 
+    MCmServiceObserver* aObserver, CMdESession& aSession,
+    CCmDmMain* aDBManager, CCmMmMain* aMemManager )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::NewL() start"));
+    CCmSmMain* self = CCmSmMain::NewLC( aObserver, aSession,
+        aDBManager, aMemManager );
+    CleanupStack::Pop( self );
+    LOG(_L("[STORE MNGR]\t CCmSmMain::NewL() end")); 
+    return self;         
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::NewLC
+// ---------------------------------------------------------------------------
+//  
+CCmSmMain* CCmSmMain::NewLC(
+    MCmServiceObserver* aObserver, CMdESession& aSession, 
+    CCmDmMain* aDBManager, CCmMmMain* aMemManager )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::NewLC() start"));    
+    CCmSmMain* self = new ( ELeave ) CCmSmMain( aObserver, aDBManager, 
+        aMemManager );
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession, aDBManager );
+    LOG(_L("[STORE MNGR]\t CCmSmMain::NewLC() end")); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::~CCmSmMain
+// ---------------------------------------------------------------------------
+//
+CCmSmMain::~CCmSmMain()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::~CCmSmMain() start"));
+    Cancel();
+    delete iCmSmTransferEngine;
+    delete iCmSmFileMngr;
+    DeleteDevices();
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    iItemIds.Reset();
+    iItemIds.Close();
+    delete iPeriodic;            
+    LOG(_L("[STORE MNGR]\t CCmSmMain::~CCmSmMain() end"));     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::CCmSmMain
+// ---------------------------------------------------------------------------
+//    
+CCmSmMain::CCmSmMain( MCmServiceObserver* aObserver, CCmDmMain* aDBManager,
+    CCmMmMain* aMemManager  ) 
+    : CActive( EPriorityStandard ), iObserver( aObserver ), 
+        iMemManager( aMemManager ), iDbManager( aDBManager )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::CCmSmMain"));
+    
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmSmMain::ConstructL( CMdESession& aSession, CCmDmMain* aDBManager )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::ConstructL() start"));
+    iService = ECmServiceNone;
+    iCmSmTransferEngine = 
+        CCmSmTransferEngine::NewL( this, aDBManager, iItems, iItemIds );
+    iCmSmFileMngr = 
+        CCmSmFileMngr::NewL( this, aSession, aDBManager, iItems );
+    LOG(_L("[STORE MNGR]\t CCmSmMain::ConstructL() end"));
+    iProgressInfo.iService = ECmServiceStore;
+    }     
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::StartStoreL
+// ---------------------------------------------------------------------------
+//    
+void CCmSmMain::StartStoreL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::StartStoreL()"));
+    if( iService == ECmServiceAutomStoreListProcess )
+        {
+        iCmSmFileMngr->CancelOperation();
+        }
+    iCancelOnGoing = EFalse;
+    iService = ECmServiceStore;
+    iMemManager->SetObserver( *this );
+    iDeviceIndex = KErrNone;
+    iProgressInfo.iService = ECmServiceStore;
+    iProgressInfo.iProcessedItems = KErrNone;
+    iProgressInfo.iTotalItems = iCmSmFileMngr->StoreItemCount() + 
+        iCmSmFileMngr->FillItemCount();
+    SendProgressInfo( KErrNone );    
+    ChangeState( ECmSmGetMediaServers );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::CancelOperation
+// ---------------------------------------------------------------------------
+//
+void CCmSmMain::CancelOperation()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::CancelOperation()"));    
+    // If some files need to be removed or shrinked do it now
+    iCancelOnGoing = ETrue;
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    iItemIds.Reset();
+    iItemIds.Close();
+    iCmSmFileMngr->CancelOperation();    
+    iCmSmTransferEngine->CancelOperation();              
+    iObserver->ServiceExecuted( iService, KErrCancel );
+    // Service finished. Reset progress info.
+    iProgressInfo.iService = ECmServiceNone;
+    iService = ECmServiceNone;
+    SendProgressInfo( KErrNone );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::PreProcessLists
+// ---------------------------------------------------------------------------
+//
+void CCmSmMain::PreProcessLists()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::PreProcessLists"));
+    
+    iCancelOnGoing = EFalse;
+    if( iService == ECmServiceAutomStoreListProcess )
+        {
+        iCmSmFileMngr->CancelOperation();
+        iCmSmFileMngr->SetProcessingStatus( ECmSmProcessingFilesStarted );
+        }    
+    else
+        {
+        ChangeState( ECmSmStartFileProcessing );
+        }
+    
+    iService = ECmServicePreProcessingStore;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::GetColItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmSmMain::GetColItemsL( TCmMediaType aMedia, 
+    CDesCArray& aArray )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::GetColItemsL"));
+    
+    iCancelOnGoing = EFalse;
+    if( iService == ECmServiceAutomStoreListProcess )
+        {
+        iCmSmFileMngr->CancelOperation();
+        }    
+    iService = ECmServiceGetStoreFields;
+    iCmSmFileMngr->ProcessAlbumList( aMedia, aArray );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::GetColItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmSmMain::GetColItemsL( TCmMediaType /*aMedia*/, 
+    CCmSqlPropertyContainer& /*aPropertys*/ )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::GetColItemsL"));
+    
+    iService = ECmServiceGetFillFields;
+    ChangeState( ECmSmFinishing );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmMain::SetAvController
+// ---------------------------------------------------------------------------
+//    
+void CCmSmMain::SetAvController( MUPnPAVController* aAVController )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::SetAvController"));
+    
+    iCmSmTransferEngine->SetAvController(aAVController);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::FileProcessingStatus
+// ---------------------------------------------------------------------------
+//    
+void CCmSmMain::FileProcessingStatus( TCmSmFileProcessingStatus aStatus )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::FileProcessingStatus()"));
+    
+    CancelMdETimer();
+    switch(aStatus)
+        {
+        case ECmSmProcessingFilesStarted:
+            {
+            if( iService == ECmServicePreProcessingStore )
+                {
+                ChangeState( ECmSmStartFileProcessing );
+                }
+            break;
+            }
+        case ECmSmProcessingFilesReady:
+            {
+            break;
+            }
+        case ECmSmProcessingCanceled:
+            {           
+            break;
+            }
+        case ECmSmNoStoreRulesSelected:
+            {
+            if( iService == ECmServiceAutomStoreListProcess )
+                {
+                // Do not complete message
+                }
+            else
+                {
+                ChangeState( ECmSmFinishing );
+                }                                        
+            break;
+            }
+        case ECmSmPreProcessingReady:
+            {
+            if( iService == ECmServiceAutomStoreListProcess )
+                {
+                // Do not complete message
+                }
+            else
+                {
+                iObserver->ServiceExecuted( iService, KErrNone );
+                }
+            iService = ECmServiceNone;                    
+            break;
+            }
+        case ECmSmRefreshError:
+            {
+            if( iService == ECmServiceAutomStoreListProcess )
+                {
+                // Do not complete message
+                }
+            else
+                {
+                iObserver->ServiceExecuted( iService, 
+                    KErrGeneral );
+                }
+            iService = ECmServiceNone;                                
+            break;
+            }
+        case ECmSmAlbumProcessingReady:
+            {
+            if( iService == ECmServiceAutomStoreListProcess )
+                {
+                // Do not complete message
+                }
+            else
+                {
+                iObserver->ServiceExecuted( iService, KErrNone );
+                }
+            iService = ECmServiceNone;                                  
+            break;
+            }
+        case ECmSmContentChanged:
+            {
+            // If timer start up fails => wait next content change event
+            TRAPD( err, StartMdETimerL() );
+            if( err )
+                {
+                TRACE(Print(_L("[STORE MNGR]\t StartMdETimerL err = %d"), 
+                    err ));
+                }           
+            break;
+            }
+        default:
+            {
+            break;
+            }    
+        }
+    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmMain::TransferStatus
+// ---------------------------------------------------------------------------
+//    
+void CCmSmMain::TransferStatus( TCmSmTransferStatus aStatus )    
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::TransferStatus()"));
+    switch( aStatus )
+        {
+        case ECmSmTransferCompleted:
+            {
+            TTime storeFinished;
+            storeFinished.HomeTime();
+            TTimeIntervalMicroSeconds usecsFrom = 
+                storeFinished.MicroSecondsFrom(iStoreStarted);
+            TInt64 timeinsecs((TInt64)( usecsFrom.Int64() / KCmSmOneSecond ));
+            TRACE(Print(_L("[STORE MNGR]\t Store took = %ld seconds"), 
+                timeinsecs ));                        
+                
+            iCmSmFileMngr->UpdateTransferHistoryData( timeinsecs, 
+                iCmSmTransferEngine->DataAmount(), (TUint8)iId );            
+            ChangeState( ECmSmManageFiles );
+            break;
+            }
+        case ECmSmAborted:
+            {
+            ChangeState( ECmSmStartCopying );            
+            break;
+            }
+        case ECmSmTransferCanceled:
+            {           
+            break;
+            }
+        case ECmSmFileTransferred:
+            {
+            SendProgressInfo( KCmOneFile );
+            break;
+            }
+        case ECmSmFileTransferFailed:
+            {
+            // File transferring failed => skip file
+            SendProgressInfo( KCmOneFile );
+            break;
+            }
+        case ECmSmWlanLost:
+            {
+            if( iDevices )
+                {
+                iDevices->ResetAndDestroy();
+                delete iDevices;
+                iDevices = NULL;                
+                }
+            iItemIds.Reset();
+            iItemIds.Close();
+            iCmSmFileMngr->ResetArrays();    
+            iObserver->ServiceExecuted( iService, KErrGeneral );
+            iProgressInfo.iService = ECmServiceNone;
+            iService = ECmServiceNone;
+            SendProgressInfo( KErrNone );
+            break;
+            }
+        case ECmSmTransferContinued:
+            {
+            ChangeState( ECmSmContinueCopying ); 
+            break;
+            }
+        default:
+            {
+            break;
+            }                
+        }
+    }
+
+#ifdef _DEBUG 
+// ---------------------------------------------------------------------------
+// CCmSmMain::LogServers
+// ---------------------------------------------------------------------------
+//
+void CCmSmMain::LogServers()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::LogServers"));
+    
+    for( TInt i = 0; i < iDevices->Count(); i++ )
+        {
+        TBuf<KMaxName>temp;
+        if((*iDevices)[i])
+            {
+            if( &(*iDevices)[i]->Uuid() )
+                {
+                if( (*iDevices)[i]->Uuid().Length() < KMaxName )
+                    {
+                    temp.Copy( (*iDevices)[i]->Uuid() );
+                    TRACE(Print(_L("[STORE MNGR]\t FOUND DEVICE %d = %S"), 
+                        i+1, &temp ));        
+                    }
+                temp.Zero();                
+                }            
+            }        
+        }            
+    }
+#endif
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::SendProgressInfo
+// ---------------------------------------------------------------------------
+//
+void CCmSmMain::SendProgressInfo( TInt aProgress ) 
+    {
+    TRACE( Print( _L(
+        "[STORE MNGR]\t CCmSmMain::SendProgressInfo( %d )"), 
+        aProgress));
+    
+    iProgressInfo.iProcessedItems += aProgress;
+    TRAPD( error, iCmSmFileMngr->GetStoreFileCountNoDuplicatesL( 
+        iProgressInfo.iItemsToTransferPerService ) );
+    if ( error ) 
+        {
+        TRACE( Print( _L( "[STORE MNGR]\t GetStoreFileCountNoDuplicatesL \
+            failed with error %d"), error ) );
+        }
+    TCmProgressInfoPckg progressPckg( iProgressInfo );
+    
+    TRACE( Print( _L(
+        "[STORE MNGR]\t processed: %d total %d"), 
+        iProgressInfo.iProcessedItems, iProgressInfo.iTotalItems));
+    
+    TInt err = RProperty::Set( KCmPropertyCat, KCmProperty, progressPckg );
+    
+    TRACE( Print( _L("[STORE MNGR]\t RProperty::Set returned %d"), err));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::ManageFileL
+// ---------------------------------------------------------------------------
+//
+void CCmSmMain::ManageFileL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::ManageFileL"));
+    
+    if( KErrNone < iCmSmTransferEngine->FilesToBeRemoved().Count() )
+        {
+        iMemManager->DeleteFilesL( iCmSmTransferEngine->FilesToBeRemoved() );
+        }
+    else if ( KErrNone < iCmSmTransferEngine->FilesToBeShrinked().Count() )
+        {
+        TRAPD( err, iMemManager->ShrinkImagesL( 
+            iCmSmTransferEngine->FilesToBeShrinked() ) );
+        if( err )
+            {
+            ChangeState( ECmSmStartCopying );
+            }
+        }
+    else if( iCancelOnGoing )
+        {
+        ChangeState( ECmSmFinishCanceling );      
+        }
+    else
+        {
+        // Store to next server...        
+        ChangeState( ECmSmStartCopying );  
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::DeleteCompleteL
+// ---------------------------------------------------------------------------
+//
+void CCmSmMain::DeleteCompleteL( TInt /*aErr*/ )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteCompleteL"));
+    
+    iCmSmTransferEngine->DeleteToBeRemoved();
+    ManageFileL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::ShrinkCompleteL
+// ---------------------------------------------------------------------------
+//    
+void CCmSmMain::ShrinkCompleteL( TInt /*aErr*/ )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::ShrinkCompleteL"));
+    
+    iCmSmTransferEngine->DeleteToBeShrinked();
+    ManageFileL();    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::ChangeState
+// ---------------------------------------------------------------------------
+// 
+void CCmSmMain::ChangeState( 
+    TCmSmMainSequencer aStatus )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::ChangeState"));
+    
+    __ASSERT_DEBUG(!IsActive(),\
+        User::Panic( KCmSmManager, KErrInUse ));          
+    SetActive();
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, aStatus );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmMain::StartMdETimerL
+// ---------------------------------------------------------------------------
+// 
+void CCmSmMain::StartMdETimerL()
+    {
+    LOG( _L("[STORE MNGR] CCmSmMain::StartMdETimerL start"));
+    
+    if( iPeriodic )
+        {
+        iPeriodic->Cancel();
+        }
+    else
+        {
+        iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
+        }
+    iPeriodic->Start( KCmSmClfRefreshInterval, KCmSmClfRefreshInterval,
+            TCallBack( CheckItems, this ) );
+    LOG( _L("[STORE MNGR] CCmSmMain::StartMdETimerL end"));                    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::CancelMdETimer
+// ---------------------------------------------------------------------------
+//     
+void CCmSmMain::CancelMdETimer()
+    {
+    LOG( _L("[STORE MNGR] CCmSmMain::CancelMdETimer start"));
+    
+    if( iPeriodic )
+        {
+        iPeriodic->Cancel();
+        }
+    LOG( _L("[STORE MNGR] CCmSmMain::CancelMdETimer end"));        
+    } 
+    
+// -----------------------------------------------------------------------------
+// CCmSmMain::CheckItems
+// -----------------------------------------------------------------------------
+//
+TInt CCmSmMain::CheckItems( TAny* aPtr )
+    {
+    LOG( _L("[STORE MNGR] CCmSmMain::CheckItems"));
+    
+    return ( (CCmSmMain*)aPtr)->CheckItemsChanged();
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmSmMain::CheckItemsChanged
+// -----------------------------------------------------------------------------
+//
+TInt CCmSmMain::CheckItemsChanged( )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::CheckItemsChanged"));
+    
+    TInt restart( 1 );
+    if( iService == ECmServiceNone )
+        {
+        LOG( _L("[STORE MNGR] Starting autom. store list process..."));
+        iService = ECmServiceAutomStoreListProcess;
+        iCmSmFileMngr->StartProcessing();
+        }
+    else
+        {
+        LOG( _L("[STORE MNGR] Store manager busy wait another x mins..."));
+        restart = 0;
+        }                        
+    return restart;
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSmMain::DeleteDevices
+// ---------------------------------------------------------------------------
+// 
+void CCmSmMain::DeleteDevices()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices"));
+    
+    if ( iDevices )
+        {
+        iDevices->ResetAndDestroy();
+        delete iDevices;
+        iDevices = NULL;
+        }    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmMain::RunL
+// ---------------------------------------------------------------------------
+//    
+void CCmSmMain::RunL()
+    {
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmMain::RunL status = %d"),
+                iStatus.Int() ));
+                
+    switch( iStatus.Int() )
+        {
+        case ECmSmGetMediaServers:
+            {
+            DeleteDevices();            
+            TRAPD( err, iCmSmTransferEngine->GetMediaServersL( iDevices ) );
+            TRACE(Print(_L("[STORE MNGR]\t GetMediaServersL err = %d"), 
+                err ));            
+            if( err || 0 == iDevices->Count() )
+                {
+                iObserver->ServiceExecuted( iService, KErrNotFound );
+                iService = ECmServiceNone;
+                }
+            else
+                {
+#ifdef _DEBUG            
+                LogServers();
+#endif        
+                iDeviceIndex = 0;
+                // Load store list into memory
+                iCmSmFileMngr->LoadStoreFileListL();
+                iCmSmTransferEngine->ResetFileArrays();    
+                ChangeState( ECmSmStartCopying );                 
+                }                           
+            break;
+            }
+        case ECmSmStartFileProcessing:
+            { 
+            if( iService == ECmServicePreProcessingStore )
+                {
+                iCmSmFileMngr->StartProcessing();
+                }
+            break;
+            }
+        case ECmSmStartCopying:
+            {
+            LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices \
+                    start file copy"));
+
+            iStoreStarted.HomeTime();    
+            if( iDeviceIndex < iDevices->Count())
+                {                    
+                iCmSmFileMngr->GetItemsL( iItemIds, 
+                    (*iDevices)[iDeviceIndex]->Uuid(), iId );
+                if( KErrNone < iItemIds.Count() )
+                    {
+                    LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices \
+                    files to be copied"));
+                    iCmSmTransferEngine->CopyFilesL( (TUint8)iId, 
+                        (*iDevices)[iDeviceIndex] );
+                    }
+                else
+                    {
+                    // Jump to next device
+                    LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices \
+                    undefined mediaserver - no items"));
+                    ChangeState( ECmSmStartCopying );
+                    }    
+                iDeviceIndex++;
+                }
+            else
+                {
+                iCmSmFileMngr->DeleteItems(
+                    iCmSmTransferEngine->ToBeDeleted() );
+                iCmSmFileMngr->UpdateStoreFileListL();
+                iDbManager->SetProgressInfo( iProgressInfo.iProcessedItems, 
+                    iProgressInfo.iTotalItems );
+                DeleteDevices();
+                iItemIds.Reset();
+                iItemIds.Close();
+                iCmSmFileMngr->ResetArrays();    
+                iObserver->ServiceExecuted( iService, KErrNone );
+                iService = ECmServiceNone;
+                }    
+            break;
+            }
+        case ECmSmContinueCopying:
+            {
+            iCmSmTransferEngine->ContinueCopyFilesL();
+            break;
+            }
+        case ECmSmFinishing:
+            {
+            LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices no \
+            rules selected"));
+            iObserver->ServiceExecuted( iService, 
+                KErrNone );
+            iService = ECmServiceNone;                            
+            break;
+            }
+        case ECmSmManageFiles:
+            {
+            ManageFileL();
+            break;
+            }
+        case ECmSmFinishCanceling:
+            {
+            iCancelOnGoing = EFalse;
+            // Before canceling update content of the db    
+            if( KErrNone < iItems.Count() )
+                {
+                iCmSmFileMngr->DeleteItems( 
+                    iCmSmTransferEngine->ToBeDeleted() );
+                iCmSmFileMngr->UpdateStoreFileListL();        
+                }            
+            if( IsActive() )
+                {
+                Cancel();
+                }           
+            break;
+            }
+        default:
+            {
+            LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices \
+            no defined status"));
+            break;
+            }    
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmMain::Close
+// ---------------------------------------------------------------------------
+//      
+void CCmSmMain::Close()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMain::Close"));
+    
+    delete this;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::DoCancel
+// ---------------------------------------------------------------------------
+//    
+void CCmSmMain::DoCancel()
+    {
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmMain::DoCancel()")));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMain::RunError
+// ---------------------------------------------------------------------------
+//   
+TInt CCmSmMain::RunError( TInt aError )
+    {
+    TRACE(Print(_L("[STORE MNGR]\t RunError aError = %d"), aError ));
+    return aError;
+    }
+    
+// End of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmmsinfo.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Store media server info class
+*
+*/
+
+
+#include "cmsmmsinfo.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CCmSmMsInfo::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmSmMsInfo* CCmSmMsInfo::NewL( TDesC8& aUuid, TInt aId )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMsInfo::NewL"));
+    
+    CCmSmMsInfo* self = CCmSmMsInfo::NewLC( aUuid, aId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMsInfo::NewLC
+// ---------------------------------------------------------------------------
+//     
+CCmSmMsInfo* CCmSmMsInfo::NewLC( TDesC8& aUuid, TInt aId )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMsInfo::NewLC"));
+    
+    CCmSmMsInfo* self = new ( ELeave ) CCmSmMsInfo();
+    CleanupStack::PushL( self );
+    self->ConstructL( aUuid, aId );    
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmMsInfo::~CCmSmMsInfo
+// ---------------------------------------------------------------------------
+// 
+CCmSmMsInfo::~CCmSmMsInfo()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMsInfo::~CCmSmMsInfo"));
+    
+    delete iUuid;      
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmMsInfo::CCmSmMsInfo
+// ---------------------------------------------------------------------------
+//            
+CCmSmMsInfo::CCmSmMsInfo()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMsInfo::CCmSmMsInfo"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmMsInfo::Construct
+// ---------------------------------------------------------------------------
+//  
+void CCmSmMsInfo::ConstructL( TDesC8& aUuid, TInt aId )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmMsInfo::ConstructL"));
+    
+    iUuid = aUuid.AllocL();
+    iId = aId;                                     
+    } 
+                        
+// End of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmtransferengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,753 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AV Controller UPnP actions handler
+*  Version     : %version: tr1ido#1.1.10 % << Don't touch!
+*
+*/
+
+#include <utf.h>
+#include "upnpavdevice.h"
+#include "upnpavcontroller.h"
+#include "upnpfileuploadsession.h"
+
+#include "cmsmtransferobserver.h"
+#include "cmdmmain.h"
+#include "cmstorelistitem.h"
+#include "cmsqlmainfactory.h"
+#include "mcmsqlmain.h"
+#include "cmsmtransferengine.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KGranularity = 10;
+//If once total size bigger than 30MB may cause timeout when uploading
+const TInt KCopySizePerTime = 30 * KMega;
+//If once total count more than 20 files may cause timeout when uploading
+const TInt KCopyCountPerTime = 20;
+    
+#ifdef _DEBUG
+_LIT( KCmStoreManager, "CmStoreManager" ); 
+#endif // _DEBUG
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmSmTransferEngine* CCmSmTransferEngine::NewL( 
+    MCmSmTransferObserver* aObserver, CCmDmMain* aDBMngr, 
+    RPointerArray<CCmStoreListItem>& aItems, RArray<TInt>& aItemIds )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::NewL() start"));    
+    CCmSmTransferEngine* self = CCmSmTransferEngine::NewLC( aObserver, 
+        aDBMngr, aItems, aItemIds );
+    CleanupStack::Pop( self );
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::NewL() end"));
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmSmTransferEngine* CCmSmTransferEngine::NewLC( 
+    MCmSmTransferObserver* aObserver, CCmDmMain* aDBMngr,
+    RPointerArray<CCmStoreListItem>& aItems, RArray<TInt>& aItemIds )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::NewLC() start"));    
+    CCmSmTransferEngine* self = new ( ELeave ) CCmSmTransferEngine( aObserver,
+        aDBMngr, aItems, aItemIds );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::NewLC() end"));
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::~CCmSmTransferEngine
+// ---------------------------------------------------------------------------
+// 
+CCmSmTransferEngine::~CCmSmTransferEngine()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::~CCmSmTransferEngine()"));
+    CancelCopy();
+    if( iFilesToBeRemoved )
+        {
+        iFilesToBeRemoved->Reset();
+        delete iFilesToBeRemoved;
+        }
+    if( iFilesToBeShrinked )
+        {
+        iFilesToBeShrinked->Reset();
+        delete iFilesToBeShrinked;
+        }
+    iToBeDeleted.Close();        
+    iObserver = NULL;
+    iDBManager = NULL;   
+    iDbWrapper->Close();
+    iFSession.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::CCmSmTransferEngine
+// ---------------------------------------------------------------------------
+//         
+CCmSmTransferEngine::CCmSmTransferEngine( MCmSmTransferObserver* aObserver, 
+    CCmDmMain* aDBMngr, RPointerArray<CCmStoreListItem>& aItems, 
+    RArray<TInt>& aItemIds )
+    : iObserver( aObserver ), iDBManager( aDBMngr ), iDevice( NULL ), 
+    iItems( aItems ), iItemIds(aItemIds)
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CCmSmTransferEngine"));    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCmSmTransferEngine::ConstructL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::ConstructL"));    
+    
+    User::LeaveIfError( iFSession.Connect() );
+    iFilesToBeRemoved = new ( ELeave ) CDesCArrayFlat( KGranularity );
+    iFilesToBeShrinked = new ( ELeave ) CDesCArrayFlat( KGranularity );
+    iDbWrapper = CCmSqlMainFactory::NewCmSqlMainL( iFSession );
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::SetAvController
+// ---------------------------------------------------------------------------
+// 
+void CCmSmTransferEngine::SetAvController( MUPnPAVController* aAVController )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::SetAvController"));    
+    
+    iAVController = aAVController;
+    iUploadSession = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::GetMediaServersL
+// ---------------------------------------------------------------------------
+//     
+void CCmSmTransferEngine::GetMediaServersL( 
+    CUpnpAVDeviceList*& aDevices )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::GetMediaServersL()"));
+    
+    aDevices = iAVController->GetMediaServersL();    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::ResetFileArrays
+// ---------------------------------------------------------------------------
+// 
+void CCmSmTransferEngine::ResetFileArrays()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::ResetFileArrays"));
+    
+    if( iFilesToBeRemoved )
+        {
+        iFilesToBeRemoved->Reset();
+        }
+    if( iFilesToBeShrinked )
+        {
+        iFilesToBeShrinked->Reset();
+        }    
+    iToBeDeleted.Reset();
+    iToBeDeleted.Close();      
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::CancelCopy
+// ---------------------------------------------------------------------------
+//        
+void CCmSmTransferEngine::CancelCopy()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CancelCopy()"));
+    
+    if ( iAVController )
+        {
+        iAVController->StopUploadSession( *iUploadSession );
+        iUploadSession = NULL;
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::CopyFilesL
+// ---------------------------------------------------------------------------
+//
+void CCmSmTransferEngine::CopyFilesL( TUint8 aDevId, 
+    CUpnpAVDevice* aDevice )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CopyFilesL"));
+    
+    if( iAVController )
+        {
+        iAVController->StopUploadSession( *iUploadSession );
+        iUploadSession = NULL;
+        }
+    iDevId = aDevId;    
+    iIndex = iItemIds.Count() - 1;    
+    iDevice = aDevice;
+    ResetFileArrays();   
+    iTransferredData = KErrNone; 
+	iTotalTransferredData = KErrNone;
+	
+    if( aDevice )
+        {
+        ConnectedToDeviceL( *aDevice );
+        CopySingleFileL();        
+        }
+    else
+        {
+        LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CopyFilesL \
+        aDevice == NULL"));
+        FinishCopy();
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::DataAmount
+// ---------------------------------------------------------------------------
+//
+TInt CCmSmTransferEngine::DataAmount() const
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::DataAmount"));
+    
+    return iTotalTransferredData;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::FilesToBeRemoved
+// ---------------------------------------------------------------------------
+//
+CDesCArray& CCmSmTransferEngine::FilesToBeRemoved()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::FilesToBeRemoved"));
+    
+    /** Files to be removed */
+    return *iFilesToBeRemoved;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::DeleteToBeRemoved
+// ---------------------------------------------------------------------------
+//    
+void CCmSmTransferEngine::DeleteToBeRemoved()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::DeleteToBeRemoved"));
+    
+    iFilesToBeRemoved->Reset();    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::FilesToBeShrinked
+// ---------------------------------------------------------------------------
+//        
+CDesCArray& CCmSmTransferEngine::FilesToBeShrinked()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::FilesToBeShrinked"));
+    
+    /** Files to be shrinked */
+    return *iFilesToBeShrinked;        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::DeleteToBeShrinked
+// ---------------------------------------------------------------------------
+//
+void CCmSmTransferEngine::DeleteToBeShrinked()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::DeleteToBeShrinked"));
+    
+    iFilesToBeShrinked->Reset();    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::ToBeDeleted
+// ---------------------------------------------------------------------------
+//
+RArray<TInt>& CCmSmTransferEngine::ToBeDeleted()
+    {
+    TRACE(Print(_L("[STORE MNGR] CCmSmTransferEngine::DeleteToBeShrinked \
+    To be deleted count = %d"), 
+        iToBeDeleted.Count() ));
+    return iToBeDeleted;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::TransferStarted
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CCmSmTransferEngine::TransferStarted( TInt aKey, TInt aStatus )
+    {
+#else
+void CCmSmTransferEngine::TransferStarted( TInt /*aKey*/, TInt /*aStatus*/ )
+    {
+#endif        
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::TransferStarted()"));
+    TRACE(Print( _L("[STORE MNGR] Started transferin file aKey = %D"),aKey));
+    TRACE(Print( _L("[STORE MNGR] Started transferin file aStatus = %D"),
+        aStatus ));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::TransferCompleted
+// ---------------------------------------------------------------------------
+//
+void CCmSmTransferEngine::TransferCompleted( TInt aKey, TInt aStatus,
+        const TDesC& /*aFilePath*/ )
+    {
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmTransferEngine::TransferCompleted() \
+     aStatus %d"), aStatus ));     
+    TRACE(Print( _L("[STORE MNGR] Transfered file = %d"), aKey ));    
+    
+    iObserver->TransferStatus( ECmSmFileTransferred );
+    TInt err( KErrNone );
+    if( !aStatus )
+        {
+        TTime time;
+        time.HomeTime();
+        if( iItems[ iItemIds[ aKey ] ] )
+            {
+            TRAP( err, AddStoredL( iItems[iItemIds[aKey]]->Path(), 
+                iDevice->Uuid(), time ) ); 
+            TRACE(Print( _L("[STORE MNGR] AddStoredL err = %d"), err ));                            
+            }
+        TRAP( err, HandleItemStatusL( aKey ) );
+        TRACE(Print( _L("[STORE MNGR] HandleItemStatusL err = %d"), err )); 
+        }    
+    TInt index( iTransferQueue.FindInOrder( aKey ) );
+    if( KErrNotFound != index )
+        {
+        iTransferQueue.Remove( index );
+        if( !iTransferQueue.Count() )
+            {
+            LOG( _L("[STORE MNGR] Transfer successfully completed"));
+            LOG( _L("[STORE MNGR] Queue empty!"));
+            iObserver->TransferStatus( ECmSmTransferCompleted );             
+            iTransferQueue.Reset();          
+            }        
+        }
+    else
+        {
+        LOG( _L("[STORE MNGR] Transfer successfully completed"));
+        iObserver->TransferStatus( ECmSmTransferCompleted );             
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::TransferProgress
+// ---------------------------------------------------------------------------
+//
+void CCmSmTransferEngine::TransferProgress( TInt /*aKey*/, TInt aBytes,
+        TInt aTotalBytes )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::TransferProgress"));
+    
+    iTransferredData = ( aBytes / KKilo ); // Convert to kilobytes
+    
+    // Check if file has been transferred completely
+    if ( aBytes == aTotalBytes )
+    	{
+    	iTotalTransferredData += ( aTotalBytes / KKilo );
+    	}
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::MediaServerDisappeared
+// ---------------------------------------------------------------------------
+//
+void CCmSmTransferEngine::MediaServerDisappeared( 
+    TUPnPDeviceDisconnectedReason /*aReason*/ )
+    {
+    TRACE(Print( _L("[STORE MNGR] CCmSmTransferEngine::\
+    MediaServerDisappeared WLANLost") ));
+    CancelCopy();        
+    iObserver->TransferStatus( ECmSmWlanLost );        
+    DeleteToBeRemoved();
+    DeleteToBeShrinked();
+    iToBeDeleted.Reset();
+    iToBeDeleted.Close();  
+    }
+               
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::CancelOperation
+// ---------------------------------------------------------------------------
+//    
+void CCmSmTransferEngine::CancelOperation()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CancelOperation"));
+    
+    CancelCopy();
+    DeleteToBeRemoved();
+    DeleteToBeShrinked();
+    iToBeDeleted.Reset();
+    iToBeDeleted.Close();    
+    iObserver->TransferStatus(ECmSmTransferCanceled);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::CopySingleFileL
+// ---------------------------------------------------------------------------
+//
+void CCmSmTransferEngine::CopySingleFileL()
+    {
+    LOG( _L("[STORE MNGR] COTSTransferEngine::CopySingleFileL"));
+    
+    /** File transfer started */
+    iTransferStarted.HomeTime();    
+    // Files left in queue
+    iTransferQueue.Reset();
+    iCopyStatus = ECmSmCopyNever;
+    //start uploading
+    CopyFilesOnceL();
+
+    if( iItems.Count() == KErrNone )
+        {
+        iCopyStatus = ECmSmCopySuccess;
+        LOG( _L("[STORE MNGR] Transfer successfully completed"));
+        __ASSERT_DEBUG(( iIndex + 1 == 0 ),\
+            User::Panic( KCmStoreManager, ECmSmTransferQueueMessedUp ));
+        FinishCopy();
+        }
+    if( ECmSmCopyNever == iCopyStatus )
+        {
+        FinishCopy();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::ContinueCopyFilesL
+// ---------------------------------------------------------------------------
+//  
+void CCmSmTransferEngine::ContinueCopyFilesL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::ContinueCopyFilesL"));
+    
+    CopyFilesOnceL();
+
+    if ( iIndex == KErrNotFound && ECmSmCopyContinued == iCopyStatus )
+        {
+        iCopyStatus = ECmSmCopyNever; 
+        }
+    if( ECmSmCopyNever == iCopyStatus )
+        {
+        FinishCopy();    
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::CopyFilesOnceL
+// ---------------------------------------------------------------------------
+//  
+void CCmSmTransferEngine::CopyFilesOnceL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CopyFilesOnceL"));
+    
+    TInt copySize( 0 );
+    TInt copyCt( 0 );
+    if( iItemIds.Count() )
+        {
+        while( 0 <= iIndex && 
+               copySize < KCopySizePerTime &&
+               copyCt < KCopyCountPerTime )
+            {
+            if( iItemIds[iIndex] < iItems.Count() )
+                {
+                TFileName tempFileName;
+                tempFileName.Copy( iItems[iItemIds[iIndex]]->Path() );
+                TRACE(Print( _L("[STORE MNGR] Filename S.L 16-bit = %S,%d"), 
+                    &tempFileName, iUploadSession ));
+                if( !IsDuplicateL( iIndex ) )
+                    {
+                    TRAPD( err, iUploadSession->StartUploadL( 
+                        tempFileName, iIndex ) );
+                        
+                    if( !err )
+                        {
+                        iCopyStatus = ECmSmCopySuccess;
+                        }
+                    
+                    TRAP( err, 
+                        iUploadSession->StartTrackingProgressL( iIndex ) );                
+                    tempFileName.Zero();
+                    if( !err )
+                        {
+                        iTransferQueue.InsertInOrder( iIndex );
+                        }
+                    copySize += iItems[iItemIds[iIndex]]->Size();
+                    copyCt++;
+                    }
+                else
+                    {
+                    LOG( _L("[STORE MNGR] File already \
+                    on server!Skip file!"));
+
+                    TTime time;
+                    time.HomeTime();
+                    AddStoredL( iItems[iItemIds[iIndex]]->Path(), 
+                                    iDevice->Uuid(), time ); 
+                    HandleItemStatusL( iIndex );                      
+                    }
+                }
+            iIndex--;
+            if( ( copySize >= KCopySizePerTime ||
+                  copyCt >= KCopyCountPerTime ) &&
+                  iIndex != KErrNotFound )
+                {
+                if( ECmSmCopySuccess != iCopyStatus )
+                    {
+                    iCopyStatus = ECmSmCopyContinued;
+                    }
+                iObserver->TransferStatus( ECmSmTransferContinued );
+                }
+            }        
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::FinishCopy
+// ---------------------------------------------------------------------------
+//  
+void CCmSmTransferEngine::FinishCopy()
+    {
+    LOG( _L("[STORE MNGR] CCmSmTransferEngine::FinishCopy \
+    No files to be transfered!"));
+    iObserver->TransferStatus( ECmSmTransferCompleted );             
+    CancelCopy();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::ConnectedToDeviceL
+// ---------------------------------------------------------------------------
+//    
+void CCmSmTransferEngine::ConnectedToDeviceL( const CUpnpAVDevice& aDevice )
+    {
+    LOG( _L("[STORE MNGR] CCmSmTransferEngine::ConnectedToDeviceL"));
+    
+    CancelCopy();
+    iUploadSession = &iAVController->StartUploadSessionL( aDevice );
+    iUploadSession->SetObserver( *this );
+#ifdef _DEBUG
+    CUpnpAVDevice& device = const_cast< CUpnpAVDevice& >( aDevice );                    
+    HBufC* data16bitBuf = HBufC::NewLC( device.FriendlyName().Length() );
+    TPtr data16bitPtr = data16bitBuf->Des();
+    TInt conversionError = 
+        CnvUtfConverter::ConvertToUnicodeFromUtf8( data16bitPtr, 
+            device.FriendlyName() );
+            
+    TRACE(Print( _L("[STORE MNGR] conversionError = %d"), conversionError ));            
+    TRACE(Print( _L("[STORE MNGR] Target device name: %S"), 
+        &data16bitPtr ));
+    
+    CleanupStack::PopAndDestroy( data16bitBuf );
+    
+    data16bitBuf = HBufC::NewLC( device.FriendlyName().Length() );
+    
+    data16bitPtr = data16bitBuf->Des();
+    conversionError = 
+        CnvUtfConverter::ConvertToUnicodeFromUtf8( data16bitPtr, 
+            device.FriendlyName() );
+    TRACE(Print( _L("[STORE MNGR] conversionError = %d"), conversionError ));             
+    TRACE(Print( _L("[STORE MNGR] Targer device id: %S"), 
+        &data16bitPtr ));                
+                                                
+    CleanupStack::PopAndDestroy( data16bitBuf );    
+#endif
+
+    LOG( _L("[STORE MNGR] ****** Connected to target device ******"));
+    LOG( _L("[STORE MNGR] CCmSmTransferEngine::ConnectedToDeviceL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::AddStoredL
+// ---------------------------------------------------------------------------
+// 
+void CCmSmTransferEngine::AddStoredL( const TDesC& aFileName, 
+    const TDesC8& aUDN, TTime aTimeStamp )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::AddStoredL"));
+    
+    iDBManager->AddStoredL( aFileName, aUDN, aTimeStamp );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::HandleItemStatusL
+// ---------------------------------------------------------------------------
+//
+void CCmSmTransferEngine::HandleItemStatusL( const TInt aKey )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::HandleItemStatusL"));
+    
+    RArray<TCmListItemStatus> statusValues; // ownership transferred  
+    RArray<TInt> devIds; // ownership transferred
+
+    TInt index( KErrNotFound );
+    TCmListItemStatus status( ECmStored );    
+    
+    if( iItemIds[aKey] < iItems.Count() )
+        {
+        devIds = iItems[iItemIds[aKey]]->DevIds();    
+        statusValues = iItems[iItemIds[aKey]]->StatusValues();
+        index = devIds.Find( iDevId );
+        }
+    
+    if( KErrNotFound != index )
+        {
+        status = statusValues[index];
+        }
+    TInt countOfStatusVal( KErrNone );
+    TRACE(Print( _L("[STORE MNGR] Status = %d"), 
+        (TInt)status ));    
+    TRACE(Print( _L("[STORE MNGR] statusValues.Count() = %d"), 
+        statusValues.Count() ));    
+    for( TInt i = 0 ; i < statusValues.Count(); i++ )
+        {
+        if( statusValues[i] == status )
+            {
+            countOfStatusVal++;
+            }
+        }
+     
+    TRACE(Print( _L("[STORE MNGR] countOfStatusVal = %d"), 
+        countOfStatusVal ));
+    if( iItemIds[aKey] < iItems.Count() )
+        {
+        switch( status )
+            {
+            case ECmToBeRemoved:
+                {
+                LOG(_L("[STORE MNGR]\t To be removed"));
+                if (  2 > countOfStatusVal )
+                    {
+                    iItems[iItemIds[aKey]]->
+                        UpdateFileStatusL( iDevId, ECmStored );
+                    // Let's mark item to be deleted from the db
+                    iToBeDeleted.InsertInOrder( iItemIds[aKey] );
+                    iFilesToBeRemoved->AppendL( 
+                        iItems[iItemIds[aKey]]->Path() );
+                    }
+                else
+                    {
+                    iItems[iItemIds[aKey]]->
+                        UpdateFileStatusL( iDevId, ECmStored );
+                    }    
+                break;
+                }
+            case ECmToBeShrinked:
+                {
+                LOG(_L("[STORE MNGR]\t To be shrinked"));
+                if ( 2 > countOfStatusVal)
+                    {            
+                    iItems[iItemIds[aKey]]->
+                        UpdateFileStatusL( iDevId, ECmStored );
+                    // Let's mark item to be deleted from the db
+                    iToBeDeleted.InsertInOrder( iItemIds[aKey] );
+                    iFilesToBeShrinked->AppendL( 
+                        iItems[iItemIds[aKey]]->Path() );
+                    }
+                else
+                    {
+                    iItems[iItemIds[aKey]]->
+                        UpdateFileStatusL( iDevId, ECmStored );
+                    }                
+                break;
+                }        
+            case ECmKeepOnDevice:
+                {
+                LOG(_L("[STORE MNGR]\t Keep On Device"));
+                if( 2 > countOfStatusVal )
+                    {
+                    iItems[iItemIds[aKey]]->
+                        UpdateFileStatusL( iDevId, ECmStored );
+                    // Let's mark item to be deleted from the db
+                    iToBeDeleted.InsertInOrder( iItemIds[aKey] );
+                    }
+                else
+                    {
+                    // If no action needed just change status
+                    iItems[iItemIds[aKey]]->
+                        UpdateFileStatusL( iDevId, ECmStored );
+                    }    
+                break;
+                }
+            case ECmStored:
+                {
+                LOG(_L("[STORE MNGR]\t already stored"));
+                break;
+                }
+            default:
+                {
+                LOG(_L("[STORE MNGR]\t Wrong status!!!"));
+                TRACE(Print( _L("[STORE MNGR] Status = %d"), (TInt)status ));
+                User::Invariant();
+                break;
+                }
+            } 
+        UpdateStoreTransferStatus( ECmStored,
+                                   iItems[iItemIds[aKey]]->DbId(),
+                                   iDevId );
+        }       
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::UpdateStoreTransferStatus
+// ---------------------------------------------------------------------------
+//
+void CCmSmTransferEngine::UpdateStoreTransferStatus( TUint aStatus, 
+    TInt64 aFid, TInt64 aMsId )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::UpdateStoreTransferStatus"));
+    
+    iDBManager->UpdateStoreTransferStatus( aStatus, aFid, aMsId );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::GetArrayIndex
+// ---------------------------------------------------------------------------
+//
+TInt CCmSmTransferEngine::GetArrayIndex( TInt aKey )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::GetArrayIndex"));
+    
+    TInt index( 0 );
+    for( TInt i = 0; i < iItemIds.Count(); i++ )
+        {
+        if( iItems[iItemIds[i]]->DbId() == aKey )
+            {
+            index = i;
+            // End loop
+            i = iItemIds.Count();
+            }
+        }
+    return index;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmTransferEngine::IsDuplicateL
+// ---------------------------------------------------------------------------
+// 
+TBool CCmSmTransferEngine::IsDuplicateL( const TInt aIndex )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::IsDuplicateL"));
+    
+    return iDbWrapper->ExistsL( *iItems[iItemIds[aIndex]], iDevId );
+    }
+    
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmvideoandimagemngr.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,536 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Store image ja video file processing
+*
+*/
+
+
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include "upnpfileutility.h"
+#include <f32file.h>
+#include "cmstorelistitem.h"
+#include "cmsmfilemngr.h"
+#include "cmsmvideoandimagemngr.h"
+#include "msdebug.h"
+
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::NewL
+// ---------------------------------------------------------------------------
+// 
+CCmSmVideoAndImageMngr* CCmSmVideoAndImageMngr::NewL( 
+    MCmSmVideoAndImageMngrObserver& aObserver, CCmSmFileMngr& aFileMngr,
+    CMdESession& aSession, RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::NewL() start"));    
+    CCmSmVideoAndImageMngr* self = CCmSmVideoAndImageMngr::NewLC( aObserver,
+        aFileMngr, aSession, aItems );
+    CleanupStack::Pop( self );
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::NewL() end")); 
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::NewLC
+// ---------------------------------------------------------------------------
+//     
+CCmSmVideoAndImageMngr* CCmSmVideoAndImageMngr::NewLC( 
+    MCmSmVideoAndImageMngrObserver& aObserver, CCmSmFileMngr& aFileMngr, 
+    CMdESession& aSession, RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::NewLC() start"));     
+    CCmSmVideoAndImageMngr* self = new ( ELeave ) CCmSmVideoAndImageMngr(
+        aObserver, aFileMngr, aSession, aItems );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::NewLC() end"));     
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::~CCmSmVideoAndImageMngr
+// ---------------------------------------------------------------------------
+// 
+CCmSmVideoAndImageMngr::~CCmSmVideoAndImageMngr()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::\
+        ~CCmSmVideoAndImageMngr() start"));
+    Cancel();
+    delete iTitleDef;
+    delete iSizeDef;
+    delete iDateDef;    
+    delete iQuery;
+    delete iMediaTypeDef;        
+    delete iObjectDef;
+    delete iNamespace;
+    iObjects.ResetAndDestroy();
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::\
+        ~CCmSmVideoAndImageMngr() end"));            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::CCmSmVideoAndImageMngr
+// ---------------------------------------------------------------------------
+//            
+CCmSmVideoAndImageMngr::CCmSmVideoAndImageMngr( 
+    MCmSmVideoAndImageMngrObserver& aObserver, CCmSmFileMngr& aFileMngr,
+    CMdESession& aSession, RPointerArray<CCmStoreListItem>& aItems )
+    :CActive( EPriorityStandard ), iObserver( aObserver ), 
+    iFileMngr( aFileMngr ), iSession( aSession ), iItems( aItems )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::CCmSmVideoAndImageMngr"));    
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCmSmVideoAndImageMngr::ConstructL()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::ConstructL()"));
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::ProcessMedia
+// ---------------------------------------------------------------------------
+// 
+void CCmSmVideoAndImageMngr::ProcessMedia( TCmMediaType aType )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::ProcessMedia"));    
+    
+    TRAPD( err, SetQueryAndStartFindL( aType ) );
+    iQueriedMedia = aType;
+    if( err )
+        {
+        TRACE(Print(_L("SetQueryAndStartFindL err = %d"), err ));
+        iObserver.ImagesAndVideosReady( err );
+        }
+    }
+            
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::CancelListRefresh
+// ---------------------------------------------------------------------------
+//
+void CCmSmVideoAndImageMngr::CancelListRefresh()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::CancelListRefresh()"));
+    ResetQuery();              
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::CancelOperation
+// ---------------------------------------------------------------------------
+//    
+void CCmSmVideoAndImageMngr::CancelOperation()
+    {   
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::CancelOperation"));    
+    
+    Cancel();    
+    CancelListRefresh();
+    iFileMngr.ResetArrays();    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::HandleQueryNewResults
+// ---------------------------------------------------------------------------
+// 
+void CCmSmVideoAndImageMngr::HandleQueryNewResults(CMdEQuery& aQuery,
+                                       TInt aFirstNewItemIndex,
+                                       TInt aNewItemCount)
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::HandleQueryNewResults"));
+    
+    CMdEObjectQuery& query = (CMdEObjectQuery &) aQuery;
+    TRACE(Print(_L("[FILL MNGR]\t aNewItemCount %d"), aNewItemCount ));
+    if( &query ) 
+        {
+        for ( TInt i=aFirstNewItemIndex; 
+              i < aFirstNewItemIndex+aNewItemCount; 
+              i++ ) 
+            {
+            CMdEObject* object = (CMdEObject*)query.TakeOwnershipOfResult(i);
+            iObjects.Append(object);         
+            }   
+        }
+                   
+    }
+          
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::HandleQueryCompleted
+// ---------------------------------------------------------------------------
+// 
+void CCmSmVideoAndImageMngr::HandleQueryCompleted( CMdEQuery& aQuery, 
+                                        TInt aError )
+    {    
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::\
+    HandleQueryCompleted error = %d"), aError ));
+    if (aError == KErrNone) 
+        {
+        if( &aQuery )
+            {
+            CompleteRequest( ECmSmQueryCompleted );                                          
+            }
+        else
+            {
+            CompleteRequest( ECmSmQueryFailed );
+            }                      
+        }
+    else if ( aError == KErrCancel )
+        {
+        // Query canceled
+        }
+    else
+        {
+        CompleteRequest( ECmSmQueryFailed );
+        }     
+    }
+       
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::FilterItems
+// ---------------------------------------------------------------------------
+//    
+void CCmSmVideoAndImageMngr::FilterItems()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::FilterItems"));
+    
+    TInt err( KErrNone );
+    RArray<TInt> ids;
+    
+    TRAP( err, iFileMngr.MediaTypesL( ids, iQueriedMedia ) );
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::FilterItems \
+         mediatypes err = %d"), err ));
+    TRAP( err, FilterNewItemsL( ids, iQueriedMedia ) );
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::FilterItems \
+          filter new items err = %d"), err ));
+    ids.Reset();
+         
+    CompleteRequest( ECmSmFilteringReady );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::FilterNewItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmSmVideoAndImageMngr::FilterNewItemsL( RArray<TInt>aDeviceIds, 
+    TCmMediaType aType )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::FilterNewItemsL"));
+    
+    RArray<TInt>storeIds;
+    RArray<TInt>storedIds;
+
+    
+    // Collecting mde object propertys into CCmFillListItem package         
+    for( TInt i = 0; i < iObjects.Count(); i++ )
+        {
+        // Copy ids into temporary array
+        for( TInt ll = 0; ll < aDeviceIds.Count(); ll++ )
+            {
+            storeIds.Append(aDeviceIds[ll]);
+            }          
+        
+        if ( !UPnPFileUtility::IsFileProtectedL( iObjects[i]->Uri( ) ) )
+            {
+            if( iFileMngr.CheckIsFilledFileL(  iObjects[i]->Uri( ) ) )
+                {
+                storeIds.Reset();              
+                storeIds.Close();
+                }
+            iFileMngr.IsAlreadyStoreL( iObjects[i]->Uri(),
+                                       storedIds,
+                                       storeIds );
+            if( KErrNone < storeIds.Count() )
+                {        
+                TCmListItemStatus status;
+                CCmStoreListItem* item = CCmStoreListItem::NewL();
+                CleanupStack::PushL( item );
+                item->SetPathL( iObjects[i]->Uri( ) );
+                item->SetListId( iFileMngr.RetrieveListId( aType ) );
+                // Ms id values are binded with file status values 
+                iFileMngr.RetrieveListStatusValues( aType, status );    
+                CMdEProperty* prop;
+                CMdETextProperty* textprop;
+                TInt propIndex = iObjects[i]->Property( *iTitleDef, prop );
+                if( propIndex != KErrNotFound )
+                    {
+                    textprop = (CMdETextProperty*) prop;
+                    item->SetPrimaryTextL( textprop->Value() );
+                    }
+                else
+                    {
+                    TParsePtrC parser( iObjects[i]->Uri());                  
+                    item->SetPrimaryTextL( parser.Name() );
+                    LOG(_L("[STORE MNGR]\t Title not found file name used"));
+                    }
+                            
+                propIndex = iObjects[i]->Property( *iSizeDef, prop );
+                if( propIndex != KErrNotFound )
+                    {
+                    item->SetSize( prop->Uint32ValueL() );
+                    }
+                else
+                    {
+                    LOG(_L("[STORE MNGR]\t Size not found"));
+                    }                            
+                propIndex = iObjects[i]->Property( *iDateDef, prop );
+                if( propIndex != KErrNotFound )
+                    {
+                    CMdETimeProperty* dateprop = (CMdETimeProperty*)prop;
+                    item->SetDate( dateprop->Value() );
+                    }
+                else
+                    {
+                    LOG(_L("[STORE MNGR]\t Date not found"));
+                    }
+                // Where item will be stored 
+                for( TInt s = 0 ; s < storeIds.Count(); s++ )
+                    {
+                    item->SetDevId( storeIds[s], status );    
+                    }
+                // Where item has already been stored
+                for( TInt d = 0; d < storedIds.Count(); d++ )
+                    {
+                    item->SetDevId( storedIds[d], ECmStored );
+                    }                                                              
+                iItems.AppendL( item );
+                CleanupStack::Pop( item );
+                }            
+            }
+        storedIds.Reset();
+        storedIds.Close();
+        storeIds.Reset();
+        storeIds.Close();
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::SetQueryAndStartFindL
+// ---------------------------------------------------------------------------
+//
+void CCmSmVideoAndImageMngr::SetQueryAndStartFindL( TCmMediaType aType )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::SetQueryAndStartFindL"));
+    
+    ResetQuery();
+    if( !iNamespace )
+        {
+        iNamespace = &iSession.GetDefaultNamespaceDefL();
+        }
+    if( iNamespace )
+        {
+        iObjectDef = 
+           &iNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
+        }
+    if( ECmImage == aType || ECmOtherImage == aType )
+        {
+        TRACE(Print(_L("ECmImage == aType")));
+        iMediaTypeDef = 
+           &iNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
+        }
+    else if( ECmVideo == aType || ECmOtherVideo == aType )
+        {
+        TRACE(Print(_L("ECmVideo == aType")));
+        iMediaTypeDef = 
+           &iNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }        
+    if( !iObjectDef )
+        {
+        User::Leave( KErrArgument );
+        }
+    if( !iMediaTypeDef )
+        {
+        User::Leave( KErrArgument );
+        }        
+        
+    iQuery = iSession.NewObjectQueryL( *iNamespace, *iMediaTypeDef, this );
+    if( !iQuery )
+        {
+        User::Leave( KErrArgument );
+        }
+    /** Set logic condition */
+    SetLogicConditionL( aType );  
+    /** Set property filters */
+    SetPropertyFiltersL();
+    iQuery->SetResultMode( EQueryResultModeItem );
+    /** Start query */ 
+    iQuery->FindL();   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::SetPropertyFiltersL
+// ---------------------------------------------------------------------------
+//    
+void CCmSmVideoAndImageMngr::SetPropertyFiltersL( )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::SetPropertyFiltersL"));
+    
+    iTitleDef = &iObjectDef->GetPropertyDefL( 
+        MdeConstants::Object::KTitleProperty );
+    iSizeDef = &iObjectDef->GetPropertyDefL( 
+        MdeConstants::Object::KSizeProperty );
+    iDateDef = &iObjectDef->GetPropertyDefL(  
+        MdeConstants::Object::KCreationDateProperty );    
+    iQuery->AddPropertyFilterL( iTitleDef );      
+    iQuery->AddPropertyFilterL( iSizeDef );      
+    iQuery->AddPropertyFilterL( iDateDef ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::SetLogicConditionL
+// ---------------------------------------------------------------------------
+// 
+void CCmSmVideoAndImageMngr::SetLogicConditionL( TCmMediaType aType )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::SetLogicConditionL"));
+           
+    CMdELogicCondition& rootCondition = iQuery->Conditions();
+    CMdELogicCondition* contentCondition = &rootCondition;
+    CMdELogicCondition& logicCondition = 
+        contentCondition->AddLogicConditionL( ELogicConditionOperatorOr );
+    logicCondition.AddObjectConditionL( *iMediaTypeDef );
+    
+    CMdEPropertyDef* originProperty = NULL;
+    if( aType == ECmOtherVideo || aType == ECmOtherImage )
+        {
+        originProperty = &iObjectDef->GetPropertyDefL( _L("Origin") );
+        if( originProperty )
+            {
+            CMdELogicCondition& origLogicCondition = 
+                contentCondition->AddLogicConditionL( 
+                ELogicConditionOperatorAnd );            
+            origLogicCondition.AddPropertyConditionL( 
+                *originProperty, TMdEUintNotEqual( 
+                MdeConstants::Object::ECamera ));
+            }        
+        }
+    if( aType == ECmVideo || aType == ECmImage )
+        {
+        originProperty = &iObjectDef->GetPropertyDefL( _L("Origin") );
+        if( originProperty )
+            {
+            CMdELogicCondition& origLogicCondition = 
+                contentCondition->AddLogicConditionL( 
+                ELogicConditionOperatorAnd );            
+            origLogicCondition.AddPropertyConditionL( 
+                *originProperty, TMdEUintEqual( 
+                MdeConstants::Object::ECamera ));
+            }         
+        }
+               
+    }
+    
+// ---------------------------------------------------------------------------
+// RCCmSmVideoAndImageMngr::ResetQuery
+// ---------------------------------------------------------------------------
+// 
+void CCmSmVideoAndImageMngr::ResetQuery()
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::ResetQuery"));
+    
+    iObjects.ResetAndDestroy();    
+
+	if ( iQuery )
+		{
+		iQuery->Cancel();
+	    delete iQuery;
+    	iQuery = NULL; 
+		}
+    }    
+    
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::CompleteRequest
+// ---------------------------------------------------------------------------
+// 
+void CCmSmVideoAndImageMngr::CompleteRequest( 
+    TCmSmFileProcessingStatus aStatus )
+    {
+    LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::CompleteRequest"));
+    
+    __ASSERT_DEBUG(!IsActive(),\
+        User::Panic( KCmSmManager, KErrInUse ));          
+    SetActive();        
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, aStatus );     
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::RunL
+// ---------------------------------------------------------------------------
+//                 
+void CCmSmVideoAndImageMngr::RunL()
+    {
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::RunL\
+         status = %d"), iStatus.Int() ));        
+    switch( iStatus.Int() )
+        {
+        case ECmSmQueryCompleted:
+            {
+            FilterItems();
+            break;
+            }
+        case ECmSmFilteringReady:
+            {
+            iObserver.ImagesAndVideosReady( KErrNone );
+            break;
+            }
+        case ECmSmQueryFailed:
+            {
+            iObserver.ImagesAndVideosReady( KErrGeneral );
+            break;
+            }        
+        default:
+            {
+            LOG(_L("[STORE MNGR]\t Store file processing RunL default"));
+            User::Invariant();
+            break;
+            }
+        }
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::DoCancel
+// ---------------------------------------------------------------------------
+//    
+void CCmSmVideoAndImageMngr::DoCancel()
+    {
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::DoCancel()")));    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSmVideoAndImageMngr::RunError
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+TInt CCmSmVideoAndImageMngr::RunError( TInt aError )    
+    {
+#else
+TInt CCmSmVideoAndImageMngr::RunError( TInt /*aError*/ )    
+    {    
+#endif    
+    TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::RunError\
+         aError = %d"), aError ));
+    iObserver.ImagesAndVideosReady( KErrGeneral );     
+    return KErrNone;     
+    }
+                        
+// End of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/cmserver/cmstoremanager/src/cmstoremanagerfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The factory for store manager
+*
+*/
+
+
+#include "cmstoremanagerfactory.h"
+#include "cmstoremanager.h"
+#include "cmsmmain.h"
+
+// --------------------------------------------------------------------------
+// CmStoreManagerFactory::NewStoreManagerL
+// --------------------------------------------------------------------------
+//
+EXPORT_C MCmSmManager* CmStoreManagerFactory::NewStoreManagerL( 
+    MCmServiceObserver* aObserver, CMdESession& aSession,
+    CCmDmMain* aDBManager, CCmMmMain* aMemManager )
+    {
+    return CCmSmMain::NewL( aObserver, aSession, aDBManager, aMemManager );
+    }
+
+// --------------------------------------------------------------------------
+// CmStoreManagerFactory::NewStoreManagerLC
+// --------------------------------------------------------------------------
+//    
+EXPORT_C MCmSmManager* CmStoreManagerFactory::NewStoreManagerLC( 
+    MCmServiceObserver* aObserver, CMdESession& aSession,
+    CCmDmMain* aDBManager, CCmMmMain* aMemManager )
+    {
+    return CCmSmMain::NewLC( aObserver, aSession, aDBManager, aMemManager );
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_1.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="2.996" y="3.001" width="10.01" height="9.995"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_2.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="2.881" y="3.016" width="0.984" height="1"/>
+<rect x="4.881" y="3.016" width="0.984" height="1"/>
+<rect x="6.881" y="3.016" width="0.984" height="1"/>
+<rect x="8.881" y="3.016" width="0.984" height="1"/>
+<rect x="10.881" y="3.016" width="0.984" height="1"/>
+<rect x="3.881" y="4.016" width="0.984" height="1"/>
+<rect x="5.881" y="4.016" width="0.984" height="1"/>
+<rect x="7.881" y="4.016" width="0.984" height="1"/>
+<rect x="9.881" y="4.016" width="0.984" height="1"/>
+<rect x="11.881" y="4.016" width="0.984" height="1"/>
+<rect x="2.881" y="5.016" width="0.984" height="1"/>
+<rect x="4.881" y="5.016" width="0.984" height="1"/>
+<rect x="6.881" y="5.016" width="0.984" height="1"/>
+<rect x="8.881" y="5.016" width="0.984" height="1"/>
+<rect x="10.881" y="5.016" width="0.984" height="1"/>
+<rect x="3.881" y="6.016" width="0.984" height="1"/>
+<rect x="5.881" y="6.016" width="0.984" height="1"/>
+<rect x="7.881" y="6.016" width="0.984" height="1"/>
+<rect x="9.881" y="6.016" width="0.984" height="1"/>
+<rect x="11.881" y="6.016" width="0.984" height="1"/>
+<rect x="2.881" y="7.016" width="0.984" height="1"/>
+<rect x="4.881" y="7.016" width="0.984" height="1"/>
+<rect x="6.881" y="7.016" width="0.984" height="1"/>
+<rect x="8.881" y="7.016" width="0.984" height="1"/>
+<rect x="10.881" y="7.016" width="0.984" height="1"/>
+<rect x="3.881" y="8.016" width="0.984" height="1"/>
+<rect x="5.881" y="8.016" width="0.984" height="1"/>
+<rect x="7.881" y="8.016" width="0.984" height="1"/>
+<rect x="9.881" y="8.016" width="0.984" height="1"/>
+<rect x="11.881" y="8.016" width="0.984" height="1"/>
+<rect x="2.881" y="9.016" width="0.984" height="1"/>
+<rect x="4.881" y="9.016" width="0.984" height="1"/>
+<rect x="6.881" y="9.016" width="0.984" height="1"/>
+<rect x="8.881" y="9.016" width="0.984" height="1"/>
+<rect x="10.881" y="9.016" width="0.984" height="1"/>
+<rect x="3.881" y="10.016" width="0.984" height="1"/>
+<rect x="5.881" y="10.016" width="0.984" height="1"/>
+<rect x="7.881" y="10.016" width="0.984" height="1"/>
+<rect x="9.881" y="10.016" width="0.984" height="1"/>
+<rect x="11.881" y="10.016" width="0.984" height="1"/>
+<rect x="2.881" y="11.016" width="0.984" height="1"/>
+<rect x="4.881" y="11.016" width="0.984" height="1"/>
+<rect x="6.881" y="11.016" width="0.984" height="1"/>
+<rect x="8.881" y="11.016" width="0.984" height="1"/>
+<rect x="10.881" y="11.016" width="0.984" height="1"/>
+<rect x="3.881" y="12.016" width="0.984" height="1"/>
+<rect x="5.881" y="12.016" width="0.984" height="1"/>
+<rect x="7.881" y="12.016" width="0.984" height="1"/>
+<rect x="9.881" y="12.016" width="0.984" height="1"/>
+<rect x="11.881" y="12.016" width="0.984" height="1"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_3.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="3.009" y="3.023" width="0.984" height="1"/>
+	<rect x="5.009" y="3.023" width="0.984" height="1"/>
+	<rect x="7.009" y="3.023" width="0.984" height="1"/>
+	<rect x="9.009" y="3.023" width="0.984" height="1"/>
+	<rect x="11.009" y="3.023" width="0.984" height="1"/>
+	<rect x="4.009" y="4.023" width="0.984" height="1"/>
+	<rect x="6.009" y="4.023" width="0.984" height="1"/>
+	<rect x="8.009" y="4.023" width="0.984" height="1"/>
+	<rect x="10.009" y="4.023" width="0.984" height="1"/>
+	<rect x="12.009" y="4.023" width="0.984" height="1"/>
+	<rect x="3.009" y="5.023" width="0.984" height="1"/>
+	<rect x="5.009" y="5.023" width="0.984" height="1"/>
+	<rect x="7.009" y="5.023" width="0.984" height="1"/>
+	<rect x="9.009" y="5.023" width="0.984" height="1"/>
+	<rect x="11.009" y="5.023" width="0.984" height="1"/>
+	<rect x="4.009" y="6.023" width="0.984" height="1"/>
+	<rect x="10.009" y="6.023" width="0.984" height="1"/>
+	<rect x="12.009" y="6.023" width="0.984" height="1"/>
+	<rect x="3.009" y="7.023" width="0.984" height="1"/>
+	<rect x="5.009" y="7.023" width="0.984" height="1"/>
+	<rect x="11.009" y="7.023" width="0.984" height="1"/>
+	<rect x="4.009" y="8.023" width="0.984" height="1"/>
+	<rect x="10.009" y="8.023" width="0.984" height="1"/>
+	<rect x="12.009" y="8.023" width="0.984" height="1"/>
+	<rect x="3.009" y="9.023" width="0.984" height="1"/>
+	<rect x="5.009" y="9.023" width="0.984" height="1"/>
+	<rect x="11.009" y="9.023" width="0.984" height="1"/>
+	<rect x="4.009" y="10.023" width="0.984" height="1"/>
+	<rect x="6.009" y="10.023" width="0.984" height="1"/>
+	<rect x="8.009" y="10.023" width="0.984" height="1"/>
+	<rect x="10.009" y="10.023" width="0.984" height="1"/>
+	<rect x="12.009" y="10.023" width="0.984" height="1"/>
+	<rect x="3.009" y="11.023" width="0.984" height="1"/>
+	<rect x="5.009" y="11.023" width="0.984" height="1"/>
+	<rect x="7.009" y="11.023" width="0.984" height="1"/>
+	<rect x="9.009" y="11.023" width="0.984" height="1"/>
+	<rect x="11.009" y="11.023" width="0.984" height="1"/>
+	<rect x="4.009" y="12.023" width="0.984" height="1"/>
+	<rect x="6.009" y="12.023" width="0.984" height="1"/>
+	<rect x="8.009" y="12.023" width="0.984" height="1"/>
+	<rect x="10.009" y="12.023" width="0.984" height="1"/>
+	<rect x="12.009" y="12.023" width="0.984" height="1"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_4.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="3.006" y="2.989" width="0.984" height="1"/>
+	<rect x="5.005" y="2.989" width="0.984" height="1"/>
+	<rect x="7.005" y="2.989" width="0.984" height="1"/>
+	<rect x="9.005" y="2.989" width="0.984" height="1"/>
+	<rect x="11.005" y="2.989" width="0.984" height="1"/>
+	<rect x="12.005" y="3.989" width="0.984" height="1"/>
+	<rect x="3.006" y="4.989" width="0.984" height="1"/>
+	<rect x="12.005" y="5.989" width="0.984" height="1"/>
+	<rect x="3.006" y="6.989" width="0.984" height="1"/>
+	<rect x="12.005" y="7.989" width="0.984" height="1"/>
+	<rect x="3.006" y="8.989" width="0.984" height="1"/>
+	<rect x="12.005" y="9.989" width="0.984" height="1"/>
+	<rect x="3.006" y="10.989" width="0.984" height="1"/>
+	<rect x="4.005" y="11.989" width="0.984" height="1"/>
+	<rect x="6.005" y="11.989" width="0.984" height="1"/>
+	<rect x="8.005" y="11.989" width="0.984" height="1"/>
+	<rect x="10.005" y="11.989" width="0.984" height="1"/>
+	<rect x="12.005" y="11.989" width="0.984" height="1"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_5.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="12.993" y="22.001" width="1" height="0.984"/>
+<rect x="12.993" y="20.001" width="1" height="0.984"/>
+<rect x="12.993" y="18.001" width="1" height="0.984"/>
+<rect x="12.993" y="16.001" width="1" height="0.984"/>
+<rect x="12.993" y="14.001" width="1" height="0.984"/>
+<rect x="13.993" y="21.001" width="1" height="0.984"/>
+<rect x="13.993" y="19.001" width="1" height="0.984"/>
+<rect x="13.993" y="17.001" width="1" height="0.984"/>
+<rect x="13.993" y="15.001" width="1" height="0.984"/>
+<rect x="13.993" y="13.002" width="1" height="0.983"/>
+<rect x="14.993" y="22.001" width="1" height="0.984"/>
+<rect x="14.993" y="20.001" width="1" height="0.984"/>
+<rect x="14.993" y="18.001" width="1" height="0.984"/>
+<rect x="14.993" y="16.001" width="1" height="0.984"/>
+<rect x="14.993" y="14.001" width="1" height="0.984"/>
+<rect x="15.993" y="21.001" width="1" height="0.984"/>
+<rect x="15.993" y="19.001" width="1" height="0.984"/>
+<rect x="15.993" y="17.001" width="1" height="0.984"/>
+<rect x="15.993" y="15.001" width="1" height="0.984"/>
+<rect x="15.993" y="13.002" width="1" height="0.983"/>
+<rect x="16.993" y="22.001" width="1" height="0.984"/>
+<rect x="16.993" y="20.001" width="1" height="0.984"/>
+<rect x="16.993" y="18.001" width="1" height="0.984"/>
+<rect x="16.993" y="16.001" width="1" height="0.984"/>
+<rect x="16.993" y="14.001" width="1" height="0.984"/>
+<rect x="17.993" y="21.001" width="1" height="0.984"/>
+<rect x="17.993" y="19.001" width="1" height="0.984"/>
+<rect x="17.993" y="17.001" width="1" height="0.984"/>
+<rect x="17.993" y="15.001" width="1" height="0.984"/>
+<rect x="17.993" y="13.002" width="1" height="0.983"/>
+<rect x="18.993" y="22.001" width="1" height="0.984"/>
+<rect x="18.993" y="20.001" width="1" height="0.984"/>
+<rect x="18.993" y="18.001" width="1" height="0.984"/>
+<rect x="18.993" y="16.001" width="1" height="0.984"/>
+<rect x="18.993" y="14.001" width="1" height="0.984"/>
+<rect x="19.993" y="21.001" width="1" height="0.984"/>
+<rect x="19.993" y="19.001" width="1" height="0.984"/>
+<rect x="19.993" y="17.001" width="1" height="0.984"/>
+<rect x="19.993" y="15.001" width="1" height="0.984"/>
+<rect x="19.993" y="13.002" width="1" height="0.983"/>
+<rect x="20.993" y="22.001" width="1" height="0.984"/>
+<rect x="20.993" y="20.001" width="1" height="0.984"/>
+<rect x="20.993" y="18.001" width="1" height="0.984"/>
+<rect x="20.993" y="16.001" width="1" height="0.984"/>
+<rect x="20.993" y="14.001" width="1" height="0.984"/>
+<rect x="21.993" y="21.001" width="1" height="0.984"/>
+<rect x="21.993" y="19.001" width="1" height="0.984"/>
+<rect x="21.993" y="17.001" width="1" height="0.984"/>
+<rect x="21.993" y="15.001" width="1" height="0.984"/>
+<rect x="21.993" y="13.002" width="1" height="0.983"/>
+<g>
+	<rect x="2.997" y="2.975" width="0.984" height="1"/>
+	<rect x="4.997" y="2.975" width="0.984" height="1"/>
+	<rect x="6.997" y="2.975" width="0.984" height="1"/>
+	<rect x="8.996" y="2.975" width="0.984" height="1"/>
+	<rect x="10.996" y="2.975" width="0.984" height="1"/>
+	<rect x="11.996" y="3.975" width="0.984" height="1"/>
+	<rect x="2.997" y="4.975" width="0.984" height="1"/>
+	<rect x="11.996" y="5.975" width="0.984" height="1"/>
+	<rect x="2.997" y="6.975" width="0.984" height="1"/>
+	<rect x="11.996" y="7.975" width="0.984" height="1"/>
+	<rect x="2.997" y="8.975" width="0.984" height="1"/>
+	<rect x="11.996" y="9.975" width="0.984" height="1"/>
+	<rect x="2.997" y="10.975" width="0.984" height="1"/>
+	<rect x="3.997" y="11.974" width="0.984" height="1"/>
+	<rect x="5.997" y="11.974" width="0.984" height="1"/>
+	<rect x="7.997" y="11.974" width="0.984" height="1"/>
+	<rect x="9.996" y="11.974" width="0.984" height="1"/>
+	<rect x="11.996" y="11.974" width="0.984" height="1"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_6.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="13.001" y="22.007" width="1" height="0.984"/>
+	<rect x="13.001" y="20.007" width="1" height="0.984"/>
+	<rect x="13.001" y="18.007" width="1" height="0.984"/>
+	<rect x="13.001" y="16.007" width="1" height="0.984"/>
+	<rect x="13.001" y="14.007" width="1" height="0.984"/>
+	<rect x="14.001" y="21.007" width="1" height="0.984"/>
+	<rect x="14.001" y="19.007" width="1" height="0.984"/>
+	<rect x="14.001" y="17.007" width="1" height="0.984"/>
+	<rect x="14.001" y="15.007" width="1" height="0.984"/>
+	<rect x="14.001" y="13.008" width="1" height="0.983"/>
+	<rect x="15.001" y="22.007" width="1" height="0.984"/>
+	<rect x="15.001" y="20.007" width="1" height="0.984"/>
+	<rect x="15.001" y="18.007" width="1" height="0.984"/>
+	<rect x="15.001" y="16.007" width="1" height="0.984"/>
+	<rect x="15.001" y="14.007" width="1" height="0.984"/>
+	<rect x="16.001" y="21.007" width="1" height="0.984"/>
+	<rect x="16.001" y="19.007" width="1" height="0.984"/>
+	<rect x="16.001" y="17.007" width="1" height="0.984"/>
+	<rect x="16.001" y="15.007" width="1" height="0.984"/>
+	<rect x="16.001" y="13.008" width="1" height="0.983"/>
+	<rect x="17.001" y="22.007" width="1" height="0.984"/>
+	<rect x="17.001" y="20.007" width="1" height="0.984"/>
+	<rect x="17.001" y="18.007" width="1" height="0.984"/>
+	<rect x="17.001" y="16.007" width="1" height="0.984"/>
+	<rect x="17.001" y="14.007" width="1" height="0.984"/>
+	<rect x="18.001" y="21.007" width="1" height="0.984"/>
+	<rect x="18.001" y="19.007" width="1" height="0.984"/>
+	<rect x="18.001" y="17.007" width="1" height="0.984"/>
+	<rect x="18.001" y="15.007" width="1" height="0.984"/>
+	<rect x="18.001" y="13.008" width="1" height="0.983"/>
+	<rect x="19.001" y="22.007" width="1" height="0.984"/>
+	<rect x="19.001" y="20.007" width="1" height="0.984"/>
+	<rect x="19.001" y="18.007" width="1" height="0.984"/>
+	<rect x="19.001" y="16.007" width="1" height="0.984"/>
+	<rect x="19.001" y="14.007" width="1" height="0.984"/>
+	<rect x="20.001" y="21.007" width="1" height="0.984"/>
+	<rect x="20.001" y="19.007" width="1" height="0.984"/>
+	<rect x="20.001" y="17.007" width="1" height="0.984"/>
+	<rect x="20.001" y="15.007" width="1" height="0.984"/>
+	<rect x="20.001" y="13.008" width="1" height="0.983"/>
+	<rect x="21.001" y="22.007" width="1" height="0.984"/>
+	<rect x="21.001" y="20.007" width="1" height="0.984"/>
+	<rect x="21.001" y="18.007" width="1" height="0.984"/>
+	<rect x="21.001" y="16.007" width="1" height="0.984"/>
+	<rect x="21.001" y="14.007" width="1" height="0.984"/>
+	<rect x="22.001" y="21.007" width="1" height="0.984"/>
+	<rect x="22.001" y="19.007" width="1" height="0.984"/>
+	<rect x="22.001" y="17.007" width="1" height="0.984"/>
+	<rect x="22.001" y="15.007" width="1" height="0.984"/>
+	<rect x="22.001" y="13.008" width="1" height="0.983"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_7.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="13.009" y="22.001" width="1" height="0.984"/>
+	<rect x="13.009" y="20.001" width="1" height="0.984"/>
+	<rect x="13.009" y="18.001" width="1" height="0.984"/>
+	<rect x="13.009" y="16.001" width="1" height="0.984"/>
+	<rect x="13.009" y="14.001" width="1" height="0.984"/>
+	<rect x="14.009" y="21.001" width="1" height="0.984"/>
+	<rect x="14.009" y="19.001" width="1" height="0.984"/>
+	<rect x="14.009" y="17.001" width="1" height="0.984"/>
+	<rect x="14.009" y="15.001" width="1" height="0.984"/>
+	<rect x="14.009" y="13.002" width="1" height="0.983"/>
+	<rect x="15.009" y="22.001" width="1" height="0.984"/>
+	<rect x="15.009" y="20.001" width="1" height="0.984"/>
+	<rect x="15.009" y="18.001" width="1" height="0.984"/>
+	<rect x="15.009" y="16.001" width="1" height="0.984"/>
+	<rect x="15.009" y="14.001" width="1" height="0.984"/>
+	<rect x="16.009" y="21.001" width="1" height="0.984"/>
+	<rect x="16.009" y="15.001" width="1" height="0.984"/>
+	<rect x="16.009" y="13.002" width="1" height="0.983"/>
+	<rect x="17.009" y="22.001" width="1" height="0.984"/>
+	<rect x="17.009" y="20.001" width="1" height="0.984"/>
+	<rect x="17.009" y="14.001" width="1" height="0.984"/>
+	<rect x="18.009" y="21.001" width="1" height="0.984"/>
+	<rect x="18.009" y="15.001" width="1" height="0.984"/>
+	<rect x="18.009" y="13.002" width="1" height="0.983"/>
+	<rect x="19.009" y="22.001" width="1" height="0.984"/>
+	<rect x="19.009" y="20.001" width="1" height="0.984"/>
+	<rect x="19.009" y="14.001" width="1" height="0.984"/>
+	<rect x="20.009" y="21.001" width="1" height="0.984"/>
+	<rect x="20.009" y="19.001" width="1" height="0.984"/>
+	<rect x="20.009" y="17.001" width="1" height="0.984"/>
+	<rect x="20.009" y="15.001" width="1" height="0.984"/>
+	<rect x="20.009" y="13.002" width="1" height="0.983"/>
+	<rect x="21.009" y="22.001" width="1" height="0.984"/>
+	<rect x="21.009" y="20.001" width="1" height="0.984"/>
+	<rect x="21.009" y="18.001" width="1" height="0.984"/>
+	<rect x="21.009" y="16.001" width="1" height="0.984"/>
+	<rect x="21.009" y="14.001" width="1" height="0.984"/>
+	<rect x="22.009" y="21.001" width="1" height="0.984"/>
+	<rect x="22.009" y="19.001" width="1" height="0.984"/>
+	<rect x="22.009" y="17.001" width="1" height="0.984"/>
+	<rect x="22.009" y="15.001" width="1" height="0.984"/>
+	<rect x="22.009" y="13.002" width="1" height="0.983"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_8.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="12.995" y="22.003" width="1" height="0.984"/>
+	<rect x="12.995" y="20.003" width="1" height="0.984"/>
+	<rect x="12.995" y="18.003" width="1" height="0.984"/>
+	<rect x="12.995" y="16.003" width="1" height="0.984"/>
+	<rect x="12.995" y="14.003" width="1" height="0.984"/>
+	<rect x="13.995" y="13.004" width="1" height="0.983"/>
+	<rect x="14.995" y="22.003" width="1" height="0.984"/>
+	<rect x="15.995" y="13.004" width="1" height="0.983"/>
+	<rect x="16.995" y="22.003" width="1" height="0.984"/>
+	<rect x="17.995" y="13.004" width="1" height="0.983"/>
+	<rect x="18.995" y="22.003" width="1" height="0.984"/>
+	<rect x="19.995" y="13.004" width="1" height="0.983"/>
+	<rect x="20.995" y="22.003" width="1" height="0.984"/>
+	<rect x="21.995" y="21.003" width="1" height="0.984"/>
+	<rect x="21.995" y="19.003" width="1" height="0.984"/>
+	<rect x="21.995" y="17.003" width="1" height="0.984"/>
+	<rect x="21.995" y="15.003" width="1" height="0.984"/>
+	<rect x="21.995" y="13.004" width="1" height="0.983"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_9.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="13.005" y="13.013" width="10.01" height="9.994"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_mserv_app_menu_icon.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+<?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 53 53">
+<g>
+<rect fill="none" width="53" height="53"/>
+<g>
+<g>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-34.9785" y1="65.2231" x2="-16.5408" y2="84.316" gradientTransform="matrix(1.1364 0 0 -1.1364 37.5547 110.179)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M10.319,27.461c-2.836-6.49,5.044-9.569,9.179-11.042c-0.518-1.147-0.342-1.304-0.863-2.453     C9.404,17.253,5.991,22.06,10.319,27.461"/>
+<polygon fill="#005795" points="31.258,10.039 30.907,12.184 19.156,19.669 18.792,17.242    "/>
+<path fill="#005795" d="M10.74,27.08c-1.724-0.732-5.494-6.784-5.494-6.784c-0.199,3.124,2.532,7.31,5.721,8.747L10.74,27.08z"/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-575.0776" y1="874.2534" x2="-581.6132" y2="855.2729" gradientTransform="matrix(-1.1364 0 0 1.1364 -639.8477 -965.3899)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M10.569,27.047c-11.032-5.722-3.408-13.656,7.548-17.334l-0.22-3.285l13.352,3.612L18.723,17.32     l-0.183-3.193C10.164,17.115,5.528,22.236,10.569,27.047z"/>
+</g>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="40.686" y1="25.6226" x2="40.686" y2="41.9047">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1601" style="stop-color:#F6F6F6"/>
+<stop offset="0.3124" style="stop-color:#EAEAEA"/>
+<stop offset="0.4639" style="stop-color:#D6D7D7"/>
+<stop offset="0.615" style="stop-color:#BBBBBB"/>
+<stop offset="0.7657" style="stop-color:#979797"/>
+<stop offset="0.9142" style="stop-color:#6D6D6D"/>
+<stop offset="1" style="stop-color:#505151"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M40.493,29.667c0,0-0.277-0.212-0.338-0.26c0,4.523,0,13.096,0,13.096     c0,1.085-0.91,1.699-1.472,1.792c0,0,2.919-0.789,3.341-1.139s0.666-0.869,0.666-1.416c0,0,0-7.373,0-11.896l-0.777,0.182     C41.409,30.108,40.895,29.978,40.493,29.667z"/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="26.3813" y1="12.792" x2="45.4685" y2="28.2124">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1353" style="stop-color:#F3F3F3"/>
+<stop offset="0.3231" style="stop-color:#E0E0E0"/>
+<stop offset="0.5464" style="stop-color:#C0C1C1"/>
+<stop offset="0.7948" style="stop-color:#959696"/>
+<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_11_)" d="M46.068,24.62L30.131,11.429c-0.777-0.613-1.702-0.417-2.07-0.316l-2.009,0.575     c0.628-0.268,1.36-0.172,1.894,0.271l15.939,13.188c0.725,0.602,0.879,1.653,0.356,2.436l-1.101,1.648     c-0.228,0.346-0.57,0.593-0.958,0.72c0,0,1.48-0.28,1.914-0.453c0.472-0.188,0.947-0.372,1.229-0.794l1.1-1.649     C46.948,26.271,46.793,25.22,46.068,24.62z"/>
+<path fill="#FFFFFF" d="M25.882,11.766l-14.839,8.245c-0.773,0.43-1.132,1.349-0.852,2.187l0.549,1.649     c0.17,0.507,0.552,0.917,1.05,1.119c0.496,0.203,1.055,0.18,1.531-0.065c0,0,0.068-0.034,0.074-0.037c0,3.994,0,13.241,0,13.241     c0,0.882,0.626,1.641,1.494,1.805l23.083,4.397c0.537,0.103,1.094-0.039,1.514-0.391c0.423-0.349,0.668-0.867,0.668-1.414     c0,0,0-8.572,0-13.096c0.061,0.048,0.338,0.26,0.338,0.26c0.402,0.312,0.916,0.441,1.42,0.359     c0.502-0.083,0.947-0.371,1.229-0.795l1.101-1.648c0.522-0.782,0.368-1.834-0.356-2.436L27.946,11.958     C27.362,11.476,26.544,11.4,25.882,11.766z"/>
+<path fill="#9D0A00" d="M26.775,13.374l-14.839,8.244l0.549,1.648l2.749-1.407v16.246l22.01,5.011l1.072-0.613V25.67l2.227,3.155     l1.071-0.612l1.1-1.65L26.775,13.374z M30.074,39.753l-7.695-1.355V27.112l7.695,1.101V39.753z"/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="42.0073" y1="15.1685" x2="12.6481" y2="43.7942">
+<stop offset="0" style="stop-color:#FF0000"/>
+<stop offset="0.0056" style="stop-color:#FF0000"/>
+<stop offset="0.3111" style="stop-color:#FC0000"/>
+<stop offset="0.5001" style="stop-color:#F40000"/>
+<stop offset="0.6575" style="stop-color:#E50000"/>
+<stop offset="0.7974" style="stop-color:#D10000"/>
+<stop offset="0.9246" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#A30000"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M25.703,13.985l-14.84,8.246l0.552,1.648l2.746-1.408v16.248l23.083,4.397V26.283l3.299,2.542     l1.099-1.649L25.703,13.985z M29,40.367l-7.694-1.357V27.725l7.694,1.1V40.367z"/>
+</g>
+<g>
+<polygon fill="#005447" points="35.567,46.772 35.069,44.121 35.088,46.953 35.545,49.886    "/>
+<g>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="11.1978" y1="67.4683" x2="-3.1378" y2="58.0605" gradientTransform="matrix(1.1364 0 0 -1.1364 37.5547 110.179)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_13_)" d="M46.927,30.848c0,0-11.845,13.201-11.858,13.272c0.215,1.605,0.36,2.447,0.449,2.686      C35.696,46.763,50.715,42.798,46.927,30.848z"/>
+<polygon fill="#005447" points="35.278,47.318 35.536,49.958 22.83,46.083 22.554,43.669     "/>
+</g>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="-9.8828" y1="54.812" x2="7.7625" y2="70.6999" gradientTransform="matrix(1.1364 0 0 -1.1364 37.5547 110.179)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_14_)" d="M44.157,29.474c0,0,0.426-0.146,0.668-0.312c0.241-0.166,0.496-0.466,0.496-0.466     c5.68,5.481-1.05,12.08-10.238,15.353l0.211,3.319l-12.726-3.65l11.938-7.359l0.177,3.227     C41.061,37.173,45.217,33.382,44.157,29.474z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/data/msgsplugin.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM plugin resource file for MediaServant GS Plugin.
+*
+*/
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO pluginInfo
+    {
+    dll_uid     = 0x10282910;
+    interfaces  =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid   = 0x10207236;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid  =  0x10282912;
+                    version_no          =  1;
+                    display_name        =  "MediaServant plugin";
+                    default_data        =  "0x10207239"; // Parent UID;
+                    opaque_data         =  "1000"; // Order number
+                    }
+                };
+            }
+        };
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/data/msgspluginsrc.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,680 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file for MediaServant gs plugin
+*
+*/
+
+
+
+//  RESOURCE IDENTIFIER
+NAME        MSGS // 4 letter ID
+
+// INCLUDES
+#include    <avkon.loc> // Avkon localized strings
+#include    <avkon.rsg>
+#include    <GSCommon.rh> // Common GS resource structures
+#include    <eikon.rh>
+#include    <avkon.rh>
+#include    <avkon.loc>
+#include    <msgsplugin.mbg>
+#include    <data_caging_paths_strings.hrh> // For APP_RESOURCE_DIR
+#include    <msgsplugin.loc> // Localized strings
+#include    "msgs.hrh"
+
+
+//  RESOURCE DEFINITIONS
+
+//----------------------------------------------------
+//
+//
+//    Needed or loading the resource fails!
+//
+//----------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+
+//----------------------------------------------------
+//   
+//    r_gs_ms_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_gs_hs_view
+    {
+    menubar = r_ms_menubar_settings_view;  
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;    
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_settings_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_ms_settings_view
+    {
+    menubar = r_ms_menubar_settings_view;
+    cba     = r_ms_softkeys_options_back__change;
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_menubar_settings_view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_ms_menubar_settings_view
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_ms_setting_menu; }
+        };
+    }    
+
+//----------------------------------------------------
+//
+//    r_ms_setting_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_ms_setting_menu
+    {
+    items =
+        {
+        MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_change; },
+        MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; },
+        MENU_ITEM { command = EEikCmdExit; txt = qtn_options_exit; }
+        };
+    }
+
+/***************************** GENERAL SETTINGS ****************************/
+/***************************************************************************/
+
+//----------------------------------------------------
+//
+//    r_ms_general_settings
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_ITEM_LIST r_ms_general_settings
+    {
+    items =
+        {
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSSettingsSync;
+            setting_page_resource = r_ms_sync_setting_page;
+            associated_resource = r_ms_sync_popup_texts;
+            name = qtn_mserv_item_sync;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSSettingsSourceDevices;
+            name = qtn_mserv_item_source_devices;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSSettingsTargetDevices;
+            name = qtn_mserv_item_target_devices;
+            },            
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSSettingsMemory;
+            name = qtn_mserv_item_used_memory;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSMemoryManager;
+            setting_page_resource = r_ms_memory_manager_setting_page;
+            associated_resource = r_ms_memory_manager_page_texts;
+            name = qtn_mserv_item_memory_manager;
+            }
+        };
+    }
+
+/******************************* SYNC SETTING ******************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_sync_setting_page
+    {
+    type = EAknCtPopupSettingList;
+    label = qtn_mserv_sett_sync_act;
+    editor_resource_id = r_ms_sync_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_popup_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_sync_popup_texts
+    {
+    setting_texts_resource = r_ms_sync_texts;
+    popped_up_texts_resource = r_ms_sync_item_texts;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_ms_sync_editor
+    {
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_sync_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSSyncDisabled;
+            text = qtn_mserv_sett_sync_manually;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSSyncAutomatic;
+            text = qtn_mserv_sett_sync_automatic;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_item_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_sync_item_texts
+    {
+    items =
+        {
+        LBUF { txt = qtn_mserv_sett_sync_manually; },
+        LBUF { txt = qtn_mserv_sett_sync_automatic; }
+        };
+    }
+
+
+
+/*************************** SOURCE DEVICE SETTING ***************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_settings_source_devices
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_settings_source_devices
+    {
+    label = qtn_mserv_sett_source_devices;
+    type = EAknSetListBox;
+    editor_resource_id = r_ms_store_settings_source_editor;
+    softkey_resource = r_ms_softkeys_ok_cancel__toggle;
+    }
+
+
+//----------------------------------------------------------------------------
+//    r_ms_wait_dialog
+//    resource formediaservant wait dialog
+//----------------------------------------------------------------------------
+
+RESOURCE DIALOG r_ms_wait_dialog
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                singular_label = qtn_mserv_searching_devices;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//    r_ms_wait_for_createavc_dialog
+//    resource for wait dialog
+//----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_ms_wait_for_createavc_dialog
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+//    r_ms_source_device_selection_dialog
+//    resource for device search dialog
+// ---------------------------------------------------------------------------
+
+RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_ms_source_device_selection_dialog
+    {
+    flags = EGeneralQueryFlags;
+
+    softkeys = r_ms_softkeys_ok_cancel__toggle;
+    items =
+        {
+        AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSingleGraphicPopupMenuListBox;
+                listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST
+                    {
+                    };
+                heading = qtn_mserv_sett_source_devices;
+                };
+            }
+        };
+    }
+    
+// ---------------------------------------------------------------------------
+//    r_ms_target_device_selection_dialog
+//    resource for device search dialog
+// ---------------------------------------------------------------------------
+
+RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_ms_target_device_selection_dialog
+    {
+    flags = EGeneralQueryFlags;
+
+    softkeys = r_ms_softkeys_ok_cancel__toggle;
+    items =
+        {
+        AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSingleGraphicPopupMenuListBox;
+                listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST
+                    {
+                    };
+                heading = qtn_mserv_sett_target_devices;
+                };
+            }
+        };
+    }    
+
+/***************************** MEMORY SETTING ******************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_memoryselection_setting
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_memoryselection_setting
+    {
+    type = EAknSetListBox;
+    label = qtn_mserv_sett_used_memory;
+    editor_resource_id = r_ms_setting_page_editor;
+    softkey_resource = r_ms_softkeys_ok_cancel__select;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_setting_page_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX  r_ms_setting_page_editor
+    {
+    flags = EAknListBoxMultipleSelection;
+    }
+
+/********************* MEMORY MANAGER SETTING ***********************/
+
+//----------------------------------------------------
+//
+//    r_ms_memory_manager_setting_page
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_memory_manager_setting_page
+    {
+    type = EAknCtPopupSettingList;
+    editor_resource_id = r_ms_memory_manager_editor;
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_memory_manager_page_texts
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_memory_manager_page_texts
+    {
+    setting_texts_resource = r_ms_memory_manager_settingitem_texts;
+    popped_up_texts_resource = r_ms_memory_manager_settingpage_texts;
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_memory_manager_editor
+//
+//----------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_ms_memory_manager_editor
+    {
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_memory_manager_settingitem_texts
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_ms_memory_manager_settingitem_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSDisabled;
+            text = qtn_mserv_item_manager_disabled;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSAskWhenFull;
+            text = qtn_mserv_item_ask_full;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_memory_manager_settingpage_texts
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_ms_memory_manager_settingpage_texts
+    {
+    items =
+        {
+        LBUF { txt = qtn_mserv_item_manager_disabled; },
+        LBUF { txt = qtn_mserv_item_ask_full; }
+        };
+    }
+
+//----------------------------------------------------------------------------
+// r_msgs_animation_for_selection_dialog
+//----------------------------------------------------------------------------
+//
+
+RESOURCE BMPANIM_DATA r_msgs_animation_for_selection_dialog
+    {
+    frameinterval   = 300;
+    playmode        = EAknBitmapAnimationPlayModeCycle;
+    bmpfile         = ""APP_RESOURCE_DIR"\\msgsplugin.mif";
+    frames          = r_msgs_animation_for_selection_dialog_images;
+    }
+
+//----------------------------------------------------------------------------
+// r_msgs_animation_for_selection_dialog_images
+//----------------------------------------------------------------------------
+//
+
+RESOURCE ARRAY r_msgs_animation_for_selection_dialog_images
+    {
+    items=
+        {
+        BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_1 ;
+                       maskid=EMbmMsgspluginQgn_indi_upnp_search_1_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_2 ;
+                       maskid=EMbmMsgspluginQgn_indi_upnp_search_2_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_3 ;
+                       maskid=EMbmMsgspluginQgn_indi_upnp_search_3_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_4 ;
+                       maskid=EMbmMsgspluginQgn_indi_upnp_search_4_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_5 ;
+                       maskid=EMbmMsgspluginQgn_indi_upnp_search_5_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_6 ;
+                       maskid=EMbmMsgspluginQgn_indi_upnp_search_6_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_7 ;
+                       maskid=EMbmMsgspluginQgn_indi_upnp_search_7_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_8 ;
+                       maskid=EMbmMsgspluginQgn_indi_upnp_search_8_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_9 ;
+                       maskid=EMbmMsgspluginQgn_indi_upnp_search_9_mask;}
+        };
+    }    
+// --------------------------------------------------------------------------
+//    r_ms_softkeys_ok_cancel__select
+// --------------------------------------------------------------------------
+RESOURCE CBA r_ms_softkeys_ok_cancel__select
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOk;                 // left sk
+            txt = text_softkey_ok;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;             // right sk
+            txt = text_softkey_cancel;
+            }
+#ifndef __SERIES60_31__
+            ,
+        CBA_BUTTON
+            {
+            id = EAknSoftkeySelect;
+            }
+#endif
+        };
+    }        
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_softkeys_options_back__change
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_ms_softkeys_options_back__change
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;    // left sk
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyBack;       // right sk
+            txt = text_softkey_back;
+            },
+        CBA_BUTTON
+            {
+            id = EAknCmdOpen;           // middle sk
+            txt = qtn_msk_change;
+            }
+        };
+    }    
+    
+// --------------------------------------------------------------------------
+//    r_ms_softkeys_ok_cancel__toggle
+// --------------------------------------------------------------------------
+RESOURCE CBA r_ms_softkeys_ok_cancel__toggle
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOk;                 // left sk
+            txt = text_softkey_ok;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;             // right sk
+            txt = text_softkey_cancel;
+            }
+#ifndef __SERIES60_31__
+            ,
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyForwardKeyEvent;
+            }
+#endif
+        };
+    }
+
+    
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_settings_source_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_ms_store_settings_source_editor
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+    
+//-----------------------------------------------------------------------------
+//
+//    r_ms_no_memory_in_use
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_no_memory_in_use
+    {
+    buf = qtn_mserv_none_memory_in_use;
+    }    
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_nof_memories_in_use
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_nof_memories_in_use
+    {
+    buf = qtn_mserv_item_nof_of_memories;
+    }    
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_settings_default_memory_name
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_settings_default_memory_name
+    {
+    buf = qtn_mserv_default_mmc_name;
+    }    
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_item_devices
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_item_devices
+    {
+    buf = qtn_mserv_item_nof_servers;
+    }    
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_preprocessing_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_preprocessing_text
+    {
+    buf = qtn_mserv_wait_preprocessing;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_gs_plugin_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_gs_plugin_text
+    {
+    buf = qtn_mserv_grid_media_servant_home_media;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_gs_settings_view_title
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_no_server_selected
+    {
+    buf = qtn_mserv_none_serv;
+    }
+    
+//-----------------------------------------------------------------------------
+//
+//    r_ms_gs_settings_view_title
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_gs_settings_view_title
+    {
+    buf = qtn_mserv_title_sync_settings;
+    }
+        
+//-----------------------------------------------------------------------------
+//
+//    r_ms_gs_memory_full
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_gs_memory_full
+    {
+    buf = qtn_memlo_not_enough_memory;
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Information required for building GSMediaServantPlugin.
+*
+*/
+
+
+#include "../../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/msgsinterface.h   |../../../../inc/msgsinterface.h
+../inc/msgspluginuids.h   |../../../../inc/msgspluginuids.h
+../inc/msgs.inl   |../../../../inc/msgs.inl
+// LOC export
+UPNP_LOC_EXPORT(msgsplugin.loc)
+
+PRJ_MMPFILES
+msgsplugin.mmp
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE msgsplugin.mif
+OPTION HEADERFILE msgsplugin.mbg
+OPTION SOURCEDIR ../bitmaps
+OPTION SOURCES -c8,8 qgn_mserv_app_menu_icon \
+			   -c8,8 qgn_indi_upnp_search_1 \
+			   -c8,8 qgn_indi_upnp_search_2 \
+			   -c8,8 qgn_indi_upnp_search_3 \
+			   -c8,8 qgn_indi_upnp_search_4 \
+			   -c8,8 qgn_indi_upnp_search_5 \
+			   -c8,8 qgn_indi_upnp_search_6 \
+			   -c8,8 qgn_indi_upnp_search_7 \
+			   -c8,8 qgn_indi_upnp_search_8 \
+			   -c8,8 qgn_indi_upnp_search_9
+END
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/group/msgsplugin.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification file for MediaServant plugin.
+*
+*/
+
+#include <data_caging_paths.hrh>    //this is needed for RESOURCE_FILES_DIR
+#include <platform_paths.hrh>
+
+TARGET              msgsplugin.dll
+TARGETTYPE          PLUGIN
+UID                 0x10009D8D 0x10282910
+
+CAPABILITY          CAP_ECOM_PLUGIN
+VENDORID            VID_DEFAULT
+
+SOURCEPATH          ../src
+SOURCE              msgspluginimplementationtable.cpp
+SOURCE              mssettingsview.cpp
+SOURCE              mssettingitemlist.cpp
+SOURCE              mssettingitemmemory.cpp
+SOURCE              mssettingitemdevices.cpp
+SOURCE              msmultiselectionpopup.cpp
+SOURCE              mssettingitems.cpp
+
+USERINCLUDE         ../data
+USERINCLUDE         ../inc
+USERINCLUDE         ../loc
+USERINCLUDE         ../../mediaservant/help/inc
+
+// System Includes
+APP_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../../inc
+
+SOURCEPATH          ../data
+
+START RESOURCE      msgsplugin.rss
+TARGET              msgsplugin.rsc
+TARGETPATH          ECOM_RESOURCE_DIR
+END
+
+START RESOURCE      msgspluginsrc.rss
+HEADER
+TARGETPATH          RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+LIBRARY             AKNSKINS.lib                // AknsUtils.h
+LIBRARY             avkon.lib
+LIBRARY             bafl.lib
+LIBRARY             CommonEngine.lib            // RConeResourceLoader
+LIBRARY             cone.lib 
+LIBRARY             egul.lib                    // CGulIcon
+LIBRARY             AknIcon.lib
+LIBRARY             eikcoctl.lib 
+LIBRARY             eikcore.lib 
+LIBRARY             euser.lib
+LIBRARY             flogger.lib                 // RFileLogger
+LIBRARY             GSEcomPlugin.lib
+LIBRARY             GSFramework.lib
+LIBRARY             hlplch.lib                  // HlpLauncher
+LIBRARY             msengine.lib
+LIBRARY             cmsettingsengine.lib
+LIBRARY             cmcommon.lib
+LIBRARY             eikdlg.lib                  // multiselection dialog
+LIBRARY             charconv.lib      
+LIBRARY             upnpavcontrollerclient.lib
+LIBRARY             commdb.lib
+LIBRARY             ecom.lib
+LIBRARY             centralrepository.lib       // profile query
+LIBRARY             PlatformEnv.lib             // pathinfo
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/msgs.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project Media Servant
+*
+*/
+
+
+#ifndef MSGS_HRH
+#define MSGS_HRH
+
+
+// setting list items
+enum TMSSettingItems
+    {
+    EMSSettingsSync = 0,
+    EMSSettingsSourceDevices,
+    EMSSettingsTargetDevices,
+    EMSSettingsMemory,
+    EMSMemoryManager
+    };
+
+// memory manager setting items
+enum TMSMemoryManagerItems
+    {
+    EMSDisabled = 0,
+    EMSAskWhenFull
+    };
+
+// sync setting items
+enum TMSSyncSettings
+    {
+    EMSSyncDisabled = 0,
+    EMSSyncAutomatic
+    };
+        
+#endif      // MSGS_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/msgs.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Inline methods of Mediaservant GS plugin
+*
+*/
+
+
+#ifndef MSGS_INL
+#define MSGS_INL
+
+// ----------------------------------------------------
+// CMSGSInterface::NewL
+// Creates General Settings plugin.
+// ----------------------------------------------------
+//    
+CMSGSInterface* CMSGSInterface::NewL( const TUid aUid )
+    {
+	TAny* ext = REComSession::CreateImplementationL(
+		aUid, _FOFF( CMSGSInterface, iDtor_ID_Key ) );
+
+    CMSGSInterface* result = 
+        reinterpret_cast< CMSGSInterface* >( ext );
+	return result;
+    }
+    
+    
+// ----------------------------------------------------
+// CMSGSInterface::DestroyPlugin
+// Destroy Ecom plugin.
+// ----------------------------------------------------
+//    
+void CMSGSInterface::DestroyPlugin()
+    {
+    REComSession::DestroyedImplementation( iDtor_ID_Key );    
+    }    
+
+#endif // MSGS_INL
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/msgsinterface.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for Mediaservant application
+*
+*/
+
+
+#ifndef MSGSINTERFACE_H
+#define MSGSINTERFACE_H
+
+#include <e32std.h>
+#include <aknview.h>
+
+
+/**
+ *  GS plugin interface
+ *
+ *  @lib msgsplugin.lib
+ */
+class CMSGSInterface : public CAknView
+    {
+    public: // New functions
+
+        /**
+        * Wraps ECom object instantiation.
+        * @param aUid Specifies the concrete implementation.
+        */
+        inline static CMSGSInterface* NewL( const TUid aUid );       
+        
+        
+        /**
+        * Notifies framework that this instance is being destroyed
+        * and resources can be released.
+        */
+        inline void DestroyPlugin();        
+        
+	protected:
+	    /** iDtor_ID_Key Instance identifier key. When instance of an
+	     *               implementation is created by ECOM framework, the
+	     *               framework will assign UID for it. The UID is used in
+	     *               destructor to notify framework that this instance is
+	     *               being destroyed and resources can be released.
+         */	
+	    TUid iDtor_ID_Key;     
+    };
+
+#include "msgs.inl"
+    
+#endif // MSGSINTERFACE_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/msgspluginuids.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UID definition for MSGSPlugin
+*
+*/
+
+
+#ifndef __MSGSPLUGINUID_H
+#define __MSGSPLUGINUID_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CONSTANTS
+const TUid KMSGSImplementationUid = { 0x10282912 };
+
+#endif      // __MSGSPLUGINUID_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/msmultiselectionpopup.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSMultiselectionPopup class definition
+*
+*/
+
+
+#ifndef CMSMULTISELECTIONPOPUP_H
+#define CMSMULTISELECTIONPOPUP_H
+
+// INCLUDES
+#include <AknIconArray.h> // CAknIconArray
+#include <aknlistquerydialog.h> //CAknListQueryDialog
+
+// CLASS DECLARATION
+
+/**
+ * CMSMultiselectionPopup dialog class
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSMultiselectionPopup ) : public CAknListQueryDialog
+    {
+            
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 v5.1
+         * @param aMediaServerArray, array of servers to show
+         * @param aSelectionIndexArray, currently selected servers
+         * @return CMSMultiselectionPopup*, the new CMSMultiselectionPopup object
+            */
+        static CMSMultiselectionPopup* NewL(
+                TBool aUploadCapabilitySupport,
+                RPointerArray<CCmMediaServerFull>* aMediaServerArray,
+                CListBoxView::CSelectionIndexArray* aSelectionIndexArray );
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 v5.1
+         * @param aMediaServerArray, array of servers to show
+         * @param aSelectionIndexArray, currently selected servers
+         * @return CMSMultiselectionPopup*, the new CMSMultiselectionPopup object
+            */
+        static CMSMultiselectionPopup* NewLC(
+                TBool aUploadCapabilitySupport,
+                RPointerArray<CCmMediaServerFull>* aMediaServerArray,
+                CListBoxView::CSelectionIndexArray* aSelectionIndexArray );
+				
+        /**
+         * Destructor.
+         */
+        virtual ~CMSMultiselectionPopup();
+
+        /**
+         * Updates the list of servers.
+         *
+         * @since S60 v5.1
+         * @param aMediaServer, found server
+         */
+        void UpdateAndDrawPopupL( CCmMediaServerFull* aMediaServer );
+
+		/**
+	     * Handles pointer event on touchscreen
+	     *
+	     * @param aPointerEvent, touchscreen key event 
+	     */
+		void HandlePointerEventL ( const TPointerEvent& aPointerEvent );
+
+    protected:
+
+        /**
+         * 2nd phase constructor.
+         */
+        void ConstructL();
+
+
+    // From base class CAknSelectionListDialog
+        /**
+         * From CAknSelectionListDialog
+         * See base class definition
+         */
+        void PreLayoutDynInitL();
+
+        /**
+         * From CAknSelectionListDialog 
+         * See base class definition        
+         */
+        void  PostLayoutDynInitL();
+
+        /**
+         * From CAknSelectionListDialog 
+         * See base class definition        
+         */
+        TKeyResponse  OfferKeyEventL( const TKeyEvent &aKeyEvent,
+                                      TEventCode aType );
+        /**
+         * From CAknSelectionListDialog 
+         * See base class definition        
+         */
+        TBool OkToExitL( TInt aButtonId );
+
+    private:
+
+        /**
+         * C++ default constructor.
+         */
+        CMSMultiselectionPopup(
+            TBool aUploadCapabilitySupport,            
+            RPointerArray<CCmMediaServerFull>* aMediaServerArray,
+            CListBoxView::CSelectionIndexArray* aSelectionIndexArray );
+
+
+        /**
+         * Loads a possibly skinned icon and adds it to icon array
+         *
+         * @since S60 v5.1
+         * @param CAknIconArray, array of icons
+         * @param MAknsSkinInstance, skin instance
+         * @param TDesC, reference to icon file
+         * @param TAknsItemID, skinned icon id
+         * @param TInt, bitmap id
+         * @param TInt, bitmap mask id
+         */
+        void AppendIconToArrayL( CAknIconArray* aArray,
+                                 MAknsSkinInstance* aSkin,
+                                 const TDesC& aMbmFile,
+                                 const TAknsItemID& aID,
+                                 TInt aBitmapId,
+                                 TInt aMaskId ) const;
+
+        /**
+         * Sets the list of servers for the listbox.
+         * @since S60 v5.1
+         */
+        void AppendMediaServersL();
+
+        /**
+         * Creates listbox item string
+         * @since S60 v5.1
+         * @param aServer, server info
+         * @return HBufC*, listbox item
+         */
+        HBufC* CreateListBoxItemLC( const CCmMediaServerFull* aServer );
+
+    // Enumerations
+    
+        // icons indexes for the listbox
+        enum TIconList
+            {
+            ECheckedBox = 0,
+            EUnCheckedBox,
+            EUploadCapability,
+            EIconLast
+            };
+
+    private: // data
+
+        /**
+         * Dialog control item
+         */
+        CEikListBox*                        iListBox;           // not owned
+
+        /**
+         * Indicates if upload capability is needed
+         */
+        TBool                               iUploadCapabilitySupport;
+        
+        /**
+         * Media servers
+         */
+        RPointerArray<CCmMediaServerFull>*  iServers;           // not owned
+
+        /**
+         * Previously selected indexes
+         */
+        CArrayFix<TInt>*                    iPreviousSelection; // not owned
+    };
+
+#endif // CMSMULTISELECTIONPOPUP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/mssettingitemdevices.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,308 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant Source devices setting item
+*
+*/
+
+
+#ifndef C_MSSETTINGITEMSOURCEDEV_H
+#define C_MSSETTINGITEMSOURCEDEV_H
+
+// INCLUDES
+#include <AknProgressDialog.h>
+#include "upnpavdeviceobserver.h"
+#include <AknWaitNoteWrapper.h> //MAknBackgroundProcess
+#include "mssettingitems.h"
+
+// FORWARD DECLARATIONS
+class CMSMultiselectionPopup;
+class MUPnPAVController;
+class CMSEngine;
+
+/**
+ * CMSSettingItemDevices class.
+ *
+ * Class searches devices and shows them to user
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSSettingItemDevices ): public CMSTextSettingItem,
+                             public MAknBackgroundProcess,
+                             public MProgressDialogCallback,
+                             public MUPnPAVDeviceObserver
+    {
+
+    public: // Constructor and destructor
+
+        /**
+         * NewL
+         * 2-phase constructor.
+         *
+         * @since S60 v5.1
+         * @param aIdentifier, setting item identifier
+         * @param aText, setting item text
+         * @param aMSEngine, application engine
+         * @param aStoredServers, stored servers
+         * @param aUploadCapabilitySupport, upload capability support
+         * @return CMSSettingItemDevices*, the new CMSSettingItemDevices object
+         */
+        static CMSSettingItemDevices* NewL(
+                           TInt aIdentifier,
+                           TDes& aText,
+                           CMSEngine& aMSEngine,
+                           RPointerArray<CCmMediaServerFull>& aStoredServers,
+                           TBool aUploadCapabilitySupport = EFalse );
+
+        /**
+         * NewLC
+         * 2-phase constructor.
+         *
+         * @since S60 v5.1
+         * @param aIdentifier, setting item identifier
+         * @param aText, setting item text
+         * @param aMSEngine, application engine
+         * @param aStoredServers, stored servers
+         * @param aUploadCapabilitySupport, upload capability support
+         * @return CMSSettingItemDevices*, the new CMSSettingItemDevices object
+         */
+        static CMSSettingItemDevices* NewLC(
+                           TInt aIdentifier,
+                           TDes& aText,
+                           CMSEngine& aMSEngine,
+                           RPointerArray<CCmMediaServerFull>& aStoredServers,
+                           TBool aUploadCapabilitySupport = EFalse );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSSettingItemDevices();
+
+
+    public:// from MAknBackgroundProcess
+
+        /**
+         * Completes one cycle of the process.
+         */
+        void StepL();
+
+        /**
+         * Return true when the process is done.
+         */
+        TBool IsProcessDone() const;
+
+        /**
+         * Handles error occurred in StepL.
+         */
+        TInt CycleError( TInt aError );
+
+    protected: 
+    
+    // From base class CAknTextSettingItem
+
+        /**
+         * From CAknTextSettingItem
+         * See base class definition
+         */         
+        void EditItemL( TBool aCalledFromMenu );
+    
+    // From base class MProgressDialogCallback         
+       
+       /**
+        * From MProgressDialogCallback
+        * See base class definition
+        */
+        void DialogDismissedL( TInt aButtonId );
+    
+    // From base class MUPnPAVDeviceObserver
+
+        /**
+         * From MUPnPAVDeviceObserver
+         * See base class definition
+         */
+        void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
+
+        /**
+         * From MUPnPAVDeviceObserver
+         * See base class definition
+         */
+        void UPnPDeviceDiscoveredL( const CUpnpAVDevice& aDevice );
+
+        /**
+         * From MUPnPAVDeviceObserver
+         * See base class definition
+         */
+        void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
+
+        /**
+         * From MUPnPAVDeviceObserver
+         * See base class definition
+         */
+        void WLANConnectionLost();         
+
+    private:
+
+        /**
+         * Shows error note
+         * @since S60 5.1
+         * @param aTextResource, error text resource
+         */
+        void ShowErrorNoteL( TInt aTextResource );
+
+        /**
+         * Sets servers activity
+         * @since S60 5.1
+         */
+        void SetServersActivity();
+
+        /**
+         * Reads source devices and set item text
+         * @since S60 5.1
+         */
+        void ReadServerListL();
+
+        /**
+         * Sets correct text for settings page
+         * @since S60 5.1
+         */
+        void SetSettingItemTextL();
+
+        /**
+         * Returns number of selected servers in active servers list.
+         * @since S60 5.1
+         * @return number of selected servers
+         */
+        TInt CountSelectedItems() const;
+
+        /**
+         * Creates AV controller.
+         * @since S60 5.1
+         * @return operation success. KErrNone if succesfull
+         */
+        TInt CreateAvcontrollerL();
+
+        /**
+         * Cancels devices search operation.
+         * @since S60 5.1
+         */
+        void CancelDeviceSearch();
+
+        /**
+         * Fetches devices from AVController and calls 
+         * DeviceDiscovered-callback for each of them.
+         * @since S60 5.1
+         */
+        void FetchAlreadyDiscoveredDevicesL();
+
+        /**
+         * Creates AVController, fetches devices from it and calls 
+         * DeviceDiscovered-callback for each of them. Starts wait note if no 
+         * devices are already discovered.
+         *
+         * @since S60 5.1
+         * @return TInt system wide error code. KErrNone if successful.
+         */
+        TInt CreateAvcAndFetchDevicesL();        
+
+        /**
+         * Constructor.
+         */
+        CMSSettingItemDevices( TInt aIdentifier,
+                               TDes& aText,
+                               CMSEngine& aMSEngine,
+                               RPointerArray<CCmMediaServerFull>& aStoredServers,
+                               TBool aUploadCapabilitySupport );
+
+        /**
+         * ConstructL
+         * Second phase constructor.
+         */
+        void ConstructL();
+
+    private:
+
+        /**
+         * The internal phases of wait note when creating AvC
+         */
+        enum TCreateAvCState
+            {
+            EPhaseNotActive,
+            EPhaseProcessing,
+            EPhaseCompleted
+            };
+
+        /**
+         * Id list of selected servers
+         */
+        CArrayFix<TInt>*                    iSelectedServers;   // owned
+        
+        /**
+         * Flag for indicating user cancel
+         */
+        TBool                               iUserCancelledSearch;
+        
+        /**
+         * Device selection dialog
+         */
+        CMSMultiselectionPopup*             iDevSelectionDlg;   // owned
+        
+        /**
+         * application engine
+         */
+        CMSEngine&                          iMSEngine;
+        
+        /**
+         * Servers to be shown to user
+         */
+        RPointerArray<CCmMediaServerFull>   iServerList;        // not owned
+
+        /**
+         * searched servers list
+         */
+        RPointerArray<CCmMediaServerFull>&  iStoredServers;     // not owned
+                
+        /**
+         * Indicates if upload capability is needed
+         */
+        TBool                               iUploadCapabilitySupport;
+
+        /**
+         * Server name string (external set)
+         */
+        HBufC*                              iSettingText;       // ownded
+        
+        /**
+         * Wait dialog shown on device search
+         */
+        CAknWaitDialog*                     iWaitDialog;        // owned
+        
+        /**
+         * Wait scheduler
+         */
+        CActiveSchedulerWait                iWait;
+        
+        /**
+         * AV controller for device search
+         */
+        MUPnPAVController*                  iAvController;          // owned
+
+        /**
+         * Current state of creating AvC
+         */
+        TCreateAvCState                     iCreateAvCState;
+
+    };
+
+#endif // C_MSSETTINGITEMSOURCEDEV_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/mssettingitemlist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for Setting item list -class
+*
+*/
+
+
+#ifndef MSSETTINGITEMLIST_H
+#define MSSETTINGITEMLIST_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+
+#include "cmcommon.h"
+#include "msengineobserver.h"
+#include "msgs.hrh"
+
+// FORWARD DECLARATIONS
+class CMSSettingsView;
+class CMSEngine;
+class CCmMediaServerFull;
+
+
+// CLASS DECLARATION
+
+/**
+* CMSSSettingItemList general class. This class is used to
+* create setting items to several setting item lists.
+*/
+NONSHARABLE_CLASS( CMSSettingItemList ): public CAknSettingItemList,
+                                         public MMSEngineObserver
+    {
+    public: // Constructor and destructor
+
+        /**
+         * NewL
+         * 2-phase constructor.
+         * @param aResourceId : resource ID of setting page.
+         * @param aAppUi : application ui.
+         */
+        static CMSSettingItemList* NewL( TInt aResourceId,
+                                         CMSSettingsView& aView );
+
+        /**
+         * NewLC
+         * 2-phase constructor.
+         * @param aResourceId : resource ID of setting page.
+         * @param aAppUi : application ui.
+         */
+        static CMSSettingItemList* NewLC( TInt aResourceId,
+                                         CMSSettingsView& aView );
+
+        /**
+         * Constructor.
+         */
+        CMSSettingItemList( CMSSettingsView& aView );
+        
+        /**
+         * ConstructL
+         * Second phase constructor.
+         * @param aResourceId : resource ID of setting page.
+         * @param aAppUi : application ui
+         */
+        void ConstructL( TInt aResourceId );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSSettingItemList();
+
+        /**
+         * Opens the selected listbox item
+         *
+         * @since S60 5.1
+         */
+        void OpenSelectedListboxItemL();
+
+        /**
+         * Returns MSEngine
+         *
+         * @since S60 5.1
+         * @return CMSEngine, application engine
+         */
+        CMSEngine* MSEngine();
+
+    protected:
+
+    // From base class CAknSettingItemList
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        CAknSettingItem* CreateSettingItemL( TInt aSettingId );
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        void SizeChanged();
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        void HandleResourceChange( TInt aType );
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        void EditItemL ( TInt aIndex, TBool aCalledFromMenu );
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        void HandleListBoxEventL( CEikListBox *aListBox,
+                                  TListBoxEvent aEventType );
+
+    // From base class MMSEngineObserver
+
+        /**
+         * From MMSEngineObserver
+         * see base class definition
+         */
+        void ReadyL( TCmService aService, TInt aError );
+
+    // From base class CCoeControl
+
+        /**
+         * From CCoeControl
+         * see base class definition
+         */
+        void GetHelpContext(TCoeHelpContext& aContext) const;
+
+    private:
+
+        /**
+         * Searches item from the list be item ID
+         *
+         * @since S60 5.1
+         * @param aId, item id
+         * @return CAknSettingItem, item pointer
+         */
+        CAknSettingItem* SearchItemById( const TMSSettingItems aId ) const;
+
+        /**
+         * Reads current profile from cenrep
+         *
+         * @since S60 5.1
+         * @return TInt, profile
+         */
+        TInt GetCurrentProfileL() const;
+
+        /**
+         * Sets memory selection visibility
+         *
+         * @since S60 5.1
+         */
+        void SetMemorySelectionL();
+
+    private:
+
+        /**
+         * Reference to AppUi
+         */
+        CMSEngine*                          iMSEngine;          // owned
+        
+        /**
+         * Parent view
+         */
+        CMSSettingsView&                    iView;
+        
+        /**
+         * Pointer to listbox
+         */
+        CEikFormattedCellListBox*           iListBox;           // not owned
+        
+        /**
+         * dummy text needed by text setting items
+         */
+        TBuf<KMaxFileName>                  iDummyText;
+        
+        /**
+         * Sync selection
+         */
+        TCmServiceState                     iSync;
+        
+        /**
+         * Memory manager
+         */
+        TCmServiceState                     iMemoryManager;
+        
+        /**
+         * searched servers list
+         */
+        RPointerArray<CCmMediaServerFull>*  iStoredServers;     // owned        
+    };
+
+#endif // MSSETTINGITEMLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/mssettingitemmemory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant memory setting item
+*
+*/
+
+
+#ifndef MSSETTINGITEMMEMORY_H
+#define MSSETTINGITEMMEMORY_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+
+// FORWARD DECLARATIONS
+class CMSEngine;
+class CSelectionItemList;
+class CMSSettingItemList;
+
+// CLASS DECLARATION
+
+/**
+ * CMSSettingItemmemory class.
+ */
+NONSHARABLE_CLASS( CMSSettingItemMemory ): public CAknTextSettingItem
+    {
+    public: // Constructor and destructor
+
+        /**
+         * NewL
+         * 2-phase constructor.
+         *
+         * @param aIdentifier, setting item identifier
+         * @param aText, setting item text
+         * @param aMSEngine, application engine
+         * @param aParent, parent list
+         * @return CMSSettingItemMemory*, the new CMSSettingItemMemory object
+         */
+        static CMSSettingItemMemory* NewL( TInt aIdentifier,
+                                        TDes& aText,
+                                        CMSEngine& aMSEngine,
+                                        CMSSettingItemList& aParent );
+
+        /**
+         * NewLC
+         * 2-phase constructor.
+         *
+         * @param aIdentifier, setting item identifier
+         * @param aText, setting item text
+         * @param aMSEngine, application engine
+         * @param aParent, parent list
+         * @return CMSSettingItemMemory*, the new CMSSettingItemMemory object
+         */
+        static CMSSettingItemMemory* NewLC( TInt aIdentifier,
+                                        TDes& aText,
+                                        CMSEngine& aMSEngine,
+                                        CMSSettingItemList& aParent );
+
+       /**
+        * Destructor.
+        */
+        virtual ~CMSSettingItemMemory();
+
+
+    protected: // From CAknSettingItem
+
+       /**
+        * This method activates the memory "setting page"
+        */
+        void EditItemL( TBool aCalledFromMenu );
+
+    private: // New functions
+
+        /**
+         * Creates selection list for drive selection
+         *
+         * @since S60 5.1
+         */
+        void CreateSelectionListL();
+
+        /**
+         * Sets storage information to settings
+         *
+         * @since S60 5.1
+         */
+        void SetStorageInformationL();
+
+        /**
+         * Sets correct text setting item secondary text
+         *
+         * @since S60 5.1
+         */
+        void SetSettingItemTextL();
+
+    private:
+
+         /**
+          * Constructor.
+          */
+        CMSSettingItemMemory(
+            TInt aIdentifier,
+            TDes& aText,
+            CMSEngine& aMSEngine,
+            CMSSettingItemList& aParent
+            );
+
+        /**
+         * ConstructL
+         * Second phase constructor.
+         */
+        void ConstructL();
+
+    private:
+
+        /**
+         * application ui
+         */
+        CMSEngine&                          iMSEngine;
+        
+        /**
+         * application ui
+         */
+        CMSSettingItemList&                 iParent;
+        
+        /**
+         * array of available memory cards - needed for settingpage
+         */
+        CSelectionItemList*                 iItemArray;     // owned
+        
+        /**
+         * drive info array
+         */
+        RPointerArray<CCmDriveInfo>         iDriveArray;    // owned
+    };
+
+#endif // MSSETTINGITEMMEMORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/mssettingitems.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant fill rule editor class
+*
+*/
+
+
+#ifndef C_MSSETTINGITEMS_H
+#define C_MSSETTINGITEMS_H
+
+#include <aknsettingitemlist.h>
+
+// CLASS DECLARATIONS
+
+/**
+ * CMSTextSettingItem
+ * Text setting item class
+ */
+class CMSTextSettingItem : public CAknTextSettingItem
+    {
+    public:
+        CMSTextSettingItem( TInt aIdentifier, TDes& aText );
+
+    public:
+        /**
+         * Setting page acceptance status
+         *
+         * @since S60 5.1
+         * @return TBool, ETrue if accepted EFalse if cancelled
+         */
+        TBool SettingAccepted();
+        /**
+         * Sets setting page accept state
+         *
+         * @since S60 5.1
+         * @param aState, ETrue if accepted
+         */
+        void SetAcceptState( TBool aState );
+
+    private:
+        /*
+         * Setting page acceptance status
+         */
+        TBool iOKPressed;
+    };
+
+#endif // C_MSSETTINGITEMS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/inc/mssettingsview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MediaServant settings view.
+*
+*/
+
+
+#ifndef MSSETTINGSVIEW_H
+#define MSSETTINGSVIEW_H
+
+// INCLUDES
+#include <GSPluginInterface.h>
+
+// FORWARD DECLARATIONS
+class CMSSettingItemList;
+class CAknNavigationDecorator;
+class CAknNavigationControlContainer;
+
+/**
+ *  MediaServant settings view.
+ *
+ *  @lib msgsplugin.lib
+ */
+NONSHARABLE_CLASS( CMSSettingsView ) : public CGSPluginInterface
+    {
+
+    public:
+        /**
+         * NewL
+         * Two phased constructor.
+         * @return CMSSettingsView*, the new CMSSettingsView object
+        */
+        static CMSSettingsView* NewL();
+
+        /**
+         * NewLC
+         * Two phased constructor.
+         * @return CMSSettingsView*, the new CMSSettingsView object
+         */
+        static CMSSettingsView* NewLC();
+		
+        /**
+         * Destructor.
+         */
+        virtual ~CMSSettingsView();
+
+        /**
+         * SetNavigationPaneTextL
+         * Sets Navigation pane text.
+         * @since S60 5.1
+         * @param aText, text to be shown
+         */
+        void SetNavigationPaneTextL( const TDesC& aText );
+
+        /**
+         * ClearCurrentNaviPaneText
+         * Clears current navi pane text
+         * @since S60 5.1
+         */
+        void ClearCurrentNaviPaneText();
+        
+    protected:
+    
+    // From base class CAknView
+
+        /**
+         * From CAknView
+         * See base class definition.
+         */
+        TUid Id() const;
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );
+    
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage);
+
+        /**
+         * From CAknView
+         * See base class definition
+         */        
+        void DoDeactivate();
+                    
+    // From base class CGSPluginInterface
+    
+        /**
+         * From CGSPluginInterface
+         * See base class definition
+         */
+        void GetCaptionL( TDes& aCaption ) const;
+
+        /**
+         * From CGSPluginInterface
+         * See base class definition
+         */
+        CGulIcon* CreateIconL( const TUid aIconType );        
+
+    private:
+
+        /**
+         * Default constructor.
+         */
+        CMSSettingsView();
+
+        /**
+         * Second phase constructor.
+         */
+        void ConstructL();
+    
+        /**
+         * Sets text by resource ID in title pane.
+         *
+         * @since S60 5.1
+         * @param aResourceId, The ID of outline number to displayed next.
+         */
+        void SetTitlePaneTextL( const TInt aResourceId );    
+
+    private: // data
+
+        /**
+         * Setting list
+         */
+        CMSSettingItemList*                 iSettingItemList;   // owned
+
+        /**
+         * Resource file offset
+         */
+        TInt                                iResFileOffset;
+
+        /**
+         * Navi decorator
+         */
+        CAknNavigationDecorator*            iNaviDecorator;     // owned 
+
+        /**
+         * Navigation pane
+         */
+        CAknNavigationControlContainer*     iNaviPane;          // not owned
+        
+        /**
+         * Control environment for file session
+         */
+        CEikonEnv*                          iCoeEnv;            // not owned
+        
+    };
+
+#endif // MSSETTINGSVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/loc/msgsplugin.loc	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for GS plugin
+*
+*/
+
+
+//d:Setting list item primary text
+//d:Scheduled syncronisation setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_sync "Synchronization"
+
+//d:Source devices setting item primary text
+//d:Devices where data search is done
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_source_devices "Source devices"
+
+//d:Store setting item primary text
+//d:Location where files will be copied
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_target_devices "Target devices"
+
+//d:Memory setting item primary text
+//d:Used memory card
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_used_memory "Memory in use"
+
+//d:Setting list item primary text
+//d:Memory manager setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_memory_manager "Memory manager"
+
+//d:Setting page heading text
+//d:Syncronization mode setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_sync_act "Synchronization"
+
+//d:Sync setting page item text
+//d:Sync is done manually by user
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_sync_manually "Manual"
+
+//d:Sync setting page item text
+//d:Sync is done automatically by certain period
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_sync_automatic "Automatic"
+
+//d:Sync setting item secondary text
+//d:Sync is done automatically by certain period
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_sync_automatically "Automatic"
+
+//d:Setting page heading text
+//d:Source devices where data search is done
+//l:heading_pane_t1/opt2
+//r:1.0
+//
+#define qtn_mserv_sett_source_devices "Source device(s)"
+
+//d:Wait dialog text
+//l:popup_note_wait_window
+//r:2.1
+//
+#define qtn_mserv_searching_devices "Searching for compatible devices"
+
+//d:Setting page heading text
+//d:Sets target devices for file copying
+//l:list_setting_pane_t1
+//r:1.0
+#define qtn_mserv_sett_target_devices "Target devices"
+
+//d:Setting page heading text
+//d:Memomory manager state
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_used_memory "Memory in use"
+
+//d:Setting item secondary text
+//d:Memory manager is turned off
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_manager_disabled "Disabled"
+
+//d:Setting item secondary text
+//d:Memory manager is turned on
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_ask_full "Ask when full"
+
+//d:Setting list item secondary text
+//d:No memory card selected
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_none_memory_in_use "None"
+
+//d:Setting list item secondary text
+//d:N drives selected
+//d:Parameter maximum length: 2 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_nof_of_memories "%N drives"
+
+//d:Setting list item secondary text
+//d:MMC default name
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_default_mmc_name "Noname"
+
+//d:Source and target devices setting item secondary text
+//d:Devices count where data search is done
+//d:Parameter maximum length: 2 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_nof_servers "%N devices"
+
+//d:Source devices setting item secondary text
+//d:No devices selected
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_none_serv "None"
+
+//d:Navi pane text
+//d:Preprocesses files so that updated information can be seen on screen
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wait_preprocessing "Updating lists"
+
+//d:Item primary text on listbox
+//d:Name of the plugin
+//l:list_double_large_graphic_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_grid_media_servant_home_media "Media Sync"
+
+//d:settings view title
+//d:General synchronization settings
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_sync_settings "Sync settings"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/src/msgspluginimplementationtable.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM proxy table for MediaServant plugin.
+*
+*/
+
+
+// System includes
+#include <ecom/implementationproxy.h>
+
+// User includes
+#include "mssettingsview.h"
+
+// Constants
+const TImplementationProxy KMSGSSettingsPluginImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x10282912, CMSSettingsView::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Gate/factory function
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = sizeof( KMSGSSettingsPluginImplementationTable ) 
+        / sizeof( TImplementationProxy );
+    return KMSGSSettingsPluginImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/src/msmultiselectionpopup.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,415 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Multiselection popup implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <avkon.mbg>
+#include <aknlists.h>
+
+#include "cmmediaserverfull.h"
+#include "msmultiselectionpopup.h"
+#include "msconstants.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KSoftkeyOk = 63585;
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMSMultiselectionPopup* CMSMultiselectionPopup::NewL(
+    TBool aUploadCapabilitySupport,
+    RPointerArray<CCmMediaServerFull>* aMediaServerArray,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup::NewL begin"));
+
+    CMSMultiselectionPopup* self = CMSMultiselectionPopup::NewLC( 
+													aUploadCapabilitySupport,
+                                                    aMediaServerArray,
+                                                    aSelectionIndexArray );
+
+    CleanupStack::Pop( self );
+
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup::NewL end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMSMultiselectionPopup* CMSMultiselectionPopup::NewLC(
+    TBool aUploadCapabilitySupport,
+    RPointerArray<CCmMediaServerFull>* aMediaServerArray,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup::NewLC begin"));
+
+    CMSMultiselectionPopup* self =
+                 new(ELeave) CMSMultiselectionPopup( aUploadCapabilitySupport,
+                                                     aMediaServerArray,
+                                                     aSelectionIndexArray );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup::NewLC end"));
+    return self;
+    }
+	
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup::ConstructL begin"));
+
+    for (TInt i=0;i<iServers->Count();i++)
+        {
+        if ( iUploadCapabilitySupport && (*iServers)[i]->StoreUsage() )
+            {
+            iPreviousSelection->AppendL(i);
+            }
+        else if (!iUploadCapabilitySupport && (*iServers)[i]->FillUsage() )
+            {
+            iPreviousSelection->AppendL(i);
+            }
+        else
+            {
+            LOG(_L("[MediaServant]\t CMSMultiselectionPopup::ConstructL \
+            server not used"));
+            }            
+        }
+
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup::ConstructL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::CMSMultiselectionPopup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMSMultiselectionPopup::CMSMultiselectionPopup(
+    TBool aUploadCapabilitySupport,   
+    RPointerArray<CCmMediaServerFull>* aMediaServerArray,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray )
+    : CAknListQueryDialog( aSelectionIndexArray ),    
+    iUploadCapabilitySupport ( aUploadCapabilitySupport ),
+    iServers( aMediaServerArray ),
+    iPreviousSelection( aSelectionIndexArray )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            CMSMultiselectionPopup"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::~CMSMultiselectionPopup
+// C++ default destructor.
+// ---------------------------------------------------------------------------
+//
+CMSMultiselectionPopup::~CMSMultiselectionPopup()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            ~CMSMultiselectionPopup"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::UpdateAndDrawPopupL
+//
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::UpdateAndDrawPopupL(
+                                CCmMediaServerFull* aMediaServer )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            UpdateAndDrawPopupL begin"));
+
+    // Listbox items
+    CDesCArray* device_array = static_cast<CDesCArray*>
+                     (ListControl()->listbox()->Model()->ItemTextArray());
+
+    HBufC* item = CreateListBoxItemLC( aMediaServer );
+    device_array->AppendL( *item );
+    CleanupStack::PopAndDestroy( item );
+
+    iListBox->HandleItemAdditionL(); // Update listbox
+
+    Layout();
+    SizeChanged();
+    DrawNow();
+
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            UpdateAndDrawPopupL ends"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::HandlePointerEventL
+//
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::HandlePointerEventL 
+                               ( const TPointerEvent& aPointerEvent )
+	{
+	CCoeControl::HandlePointerEventL( aPointerEvent );
+
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+    	{
+		TKeyEvent keyEvent;
+		keyEvent.iCode = EKeyOK;
+		this->OfferKeyEventL( keyEvent, EEventKey );
+	    }
+	}
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::AppendIconToArrayL
+//
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::AppendIconToArrayL( CAknIconArray* aArray,
+                                                 MAknsSkinInstance* aSkin,
+                                                 const TDesC& aMbmFile,
+                                                 const TAknsItemID& aID,
+                                                 TInt aBitmapId,
+                                                 TInt aMaskId ) const
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            AppendIconToArrayL begin"));
+
+    __ASSERT_DEBUG( aArray, User::Leave(KErrArgument) );
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC(aSkin, aID,
+        bitmap, mask, aMbmFile, aBitmapId, aMaskId);
+
+    CGulIcon* icon = CGulIcon::NewL(bitmap, mask);
+    icon->SetBitmapsOwnedExternally(EFalse);
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop(2); // mask, bitmap
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL(icon);
+
+    // ownership transferred
+    aArray->AppendL(icon);
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop(icon);
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            AppendIconToArrayL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::OkToExitL(TInt aButtonId)
+// called by framework when the softkey is pressed
+// ---------------------------------------------------------------------------
+//
+TBool CMSMultiselectionPopup::OkToExitL( TInt /*aButtonId*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup::OkToExitL"));
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::AppendMediaServersL
+// Appends items to the listbox
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::AppendMediaServersL()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            AppendMediaServersL begin"));
+
+    TInt serverCount = iServers->Count();
+
+    CDesCArray* listBoxArray = static_cast<CDesCArray*>
+                   (ListControl()->listbox()->Model()->ItemTextArray());
+
+    for ( TInt i = 0; i < serverCount; i++ )
+        {
+        CCmMediaServerFull* server = (*iServers)[i];
+
+        HBufC* item = CreateListBoxItemLC( server );
+
+        listBoxArray->AppendL( *item );
+
+        CleanupStack::PopAndDestroy( item );
+        }
+
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            AppendMediaServersL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::PreLayoutDynInitL()
+// called by framework before dialog is shown
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::PreLayoutDynInitL()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            PreLayoutDynInitL begin"));
+
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    CAknIconArray* icons = new (ELeave) CAknIconArray( EIconLast );
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName() );
+
+    AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOn,
+                        EMbmAvkonQgn_indi_checkbox_on,
+                        EMbmAvkonQgn_indi_checkbox_on_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOff,
+                        EMbmAvkonQgn_indi_checkbox_off,
+                        EMbmAvkonQgn_indi_checkbox_off_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnIndiNaviArrowRight,
+                        EMbmAvkonQgn_indi_navi_arrow_right,
+                        EMbmAvkonQgn_indi_navi_arrow_right_mask );
+
+    CAknListQueryDialog::SetIconArrayL( icons );
+
+    CleanupStack::Pop( icons );
+
+    iListBox = ListBox();
+    SetOwnershipType( ELbmOwnsItemArray );
+
+    AppendMediaServersL();
+
+    iListBox->ActivateL();
+
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            PreLayoutDynInitL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::PostLayoutDynInitL()
+// Called by framework before dialog is shown.
+// Needed because filter is not active until PreLayoutDynInitL().
+// ---------------------------------------------------------------------------
+//
+void  CMSMultiselectionPopup::PostLayoutDynInitL()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            PostLayoutDynInitL begin"));
+
+    CAknListQueryDialog::PostLayoutDynInitL();
+    ListBox()->ActivateL();
+
+    if ( iPreviousSelection && iPreviousSelection->Count() )
+        {
+        iListBox->SetSelectionIndexesL( iPreviousSelection );
+        }
+
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            PostLayoutDynInitL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::OfferKeyEventL()
+// called by framework when key is pressed
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMSMultiselectionPopup::OfferKeyEventL (
+                                    const TKeyEvent &aKeyEvent,
+                                    TEventCode aType )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup::OfferKeyEventL begin"));
+
+    TKeyResponse status( EKeyWasNotConsumed );
+
+    // check if user has selected something
+    if (aKeyEvent.iCode == EKeyOK)
+        {
+        status = ListBox()->OfferKeyEventL( aKeyEvent, aType );
+
+        TInt itemNbr = iListBox->CurrentItemIndex();
+        if( iListBox->View()->ItemIsSelected( itemNbr ) )
+            {
+            iPreviousSelection->AppendL( itemNbr );
+            }
+        else
+            {
+            TKeyArrayFix sortKey( 0, ECmpTInt );
+            TInt itemIndex( 0 );
+
+            if( iPreviousSelection->Find( 
+                itemNbr, sortKey, itemIndex ) == 0 )
+                {
+                // remove selection
+                iPreviousSelection->Delete( itemIndex );
+                }
+            }
+        }
+    else
+        {
+        // prevents to mark item if dialog is accepted with OK key
+        if ( aKeyEvent.iCode == KSoftkeyOk )
+            {
+            iListBox->View()->SetDisableRedraw(ETrue);    
+            }
+           
+        status = CAknListQueryDialog::OfferKeyEventL(aKeyEvent,aType);
+        }
+
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup::OfferKeyEventL end"));
+    return status;
+}
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::CreateListBoxItemLC()
+// Creates listbox item
+// ---------------------------------------------------------------------------
+//
+HBufC* CMSMultiselectionPopup::CreateListBoxItemLC(
+                                const CCmMediaServerFull* aServer )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \
+            CreateListBoxItemLC"));
+
+    TBuf<KMaxFileName> serverName;
+    serverName.Copy( aServer->MediaServerName().Left( KMaxFileName ) );
+
+    HBufC* item = HBufC::NewLC( serverName.Size() +
+            sizeof( KSingleGraphicStyleFormatStringNoTrailIcons() ) );
+            item->Des().Format( KSingleGraphicStyleFormatStringNoTrailIcons,
+            EUnCheckedBox,
+            &serverName );
+
+    return item;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/src/mssettingitemdevices.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,776 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSSettingItemDevices class implementation
+*
+*/
+
+
+#include <msgspluginsrc.rsg>
+#include <StringLoader.h>
+#include "upnpavdevice.h"
+#include "upnpavcontroller.h" // for MUPnPAVController
+#include "upnpavcontrollerfactory.h" // for UPnPAVControllerFactory
+#include <AknWaitDialog.h>
+#include <utf.h> // for CnvUtfConverter
+
+#include "cmmediaserverfull.h"
+#include "cmcommonutils.h"
+#include <aknnotewrappers.h>
+#include "mssettingitemdevices.h"
+#include "msmultiselectionpopup.h"
+#include "msengine.h"
+#include "upnpavdevicelist.h"
+#include "msdebug.h"
+
+// CONSTANTS
+
+// reserved list size
+const TInt KItemArrayGranularity = 3;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::NewL
+// --------------------------------------------------------------------------
+//
+CMSSettingItemDevices* CMSSettingItemDevices::NewL(
+                        TInt aIdentifier,
+                        TDes& aText,
+                        CMSEngine& aMSEngine,
+                        RPointerArray<CCmMediaServerFull>& aStoredServers,
+                        TBool aUploadCapabilitySupport )
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::NewL"));
+
+    CMSSettingItemDevices* self = CMSSettingItemDevices::NewLC(
+                                          aIdentifier,
+                                          aText,
+                                          aMSEngine,
+                                          aStoredServers,
+                                          aUploadCapabilitySupport );
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::NewLC
+// --------------------------------------------------------------------------
+//
+CMSSettingItemDevices* CMSSettingItemDevices::NewLC(
+                        TInt aIdentifier,
+                        TDes& aText,
+                        CMSEngine& aMSEngine,
+                        RPointerArray<CCmMediaServerFull>& aStoredServers,
+                        TBool aUploadCapabilitySupport )
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::NewLC"));
+	
+    CMSSettingItemDevices* self = new ( ELeave ) CMSSettingItemDevices(
+                                          aIdentifier,
+                                          aText,
+                                          aMSEngine,
+                                          aStoredServers,
+                                          aUploadCapabilitySupport );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+	
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::ConstructL()
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::ConstructL begins"));
+
+    iSettingText = HBufC::NewL( KMaxFileName );
+
+    iSelectedServers =
+        new (ELeave) CArrayFixFlat<TInt>( KItemArrayGranularity );
+    
+    SetSettingItemTextL();
+
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::ConstructL ends"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::~~CMSSettingItemDevices()
+// --------------------------------------------------------------------------
+//
+CMSSettingItemDevices::~CMSSettingItemDevices()
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::~CMSSettingItemDevices"));
+
+    delete iSettingText;
+
+    delete iSelectedServers;
+
+    iServerList.Reset();
+    iServerList.Close();
+    
+    if ( iAvController )
+        {
+        iAvController->RemoveDeviceObserver();
+		iAvController->Release();
+		iAvController = NULL;
+        }
+
+    if ( iWaitDialog )
+        {
+        TRAP_IGNORE( iWaitDialog->ProcessFinishedL() );
+        iWaitDialog = NULL;
+        }
+
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::EditItemL( TBool aCalledFromMenu )
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::EditItemL( TBool /*aCalledFromMenu*/ )
+    {
+    LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::EditItemL") );
+
+    // restore original state
+    SetAcceptState( EFalse );
+
+    // Create list for selection
+    ReadServerListL();
+
+    // Create Avcontroller and fetch already discovered devices from it.
+    CreateAvcAndFetchDevicesL();           
+            
+    if( !iUserCancelledSearch )
+        {
+        if ( iUploadCapabilitySupport )
+            {
+            iDevSelectionDlg = CMSMultiselectionPopup::NewL(
+                                    iUploadCapabilitySupport,
+                                    &iServerList,
+                                    iSelectedServers );
+            iDevSelectionDlg->PrepareLC(
+                            R_MS_TARGET_DEVICE_SELECTION_DIALOG );
+            }
+        else
+            {
+            iDevSelectionDlg = CMSMultiselectionPopup::NewL(
+                                    iUploadCapabilitySupport,
+                                    &iServerList,
+                                    iSelectedServers );           
+            iDevSelectionDlg->PrepareLC(
+                            R_MS_SOURCE_DEVICE_SELECTION_DIALOG );
+            }            
+
+        #ifndef __WINS__
+            iDevSelectionDlg->QueryHeading()->SetHeaderAnimationL(
+                R_MSGS_ANIMATION_FOR_SELECTION_DIALOG );
+        #endif
+
+        TInt returnValue = iDevSelectionDlg->RunLD();            
+
+        iDevSelectionDlg = NULL;
+        
+        CancelDeviceSearch();
+
+        if( returnValue )
+            {
+            // User presses OK
+            SetAcceptState( ETrue );
+
+            SetServersActivity();
+            SetSettingItemTextL();
+
+            iMSEngine.SetMediaServersL( iStoredServers );
+
+            LoadL();
+            UpdateListBoxTextL();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::SetServersActivity
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::SetServersActivity()
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::SetServersActivity \
+    begins"));
+
+    // Set all servers inactive
+    for( TInt ind=0; ind < iStoredServers.Count(); ind++ )
+        {
+        CCmMediaServerFull* server = iStoredServers[ind];
+
+        if ( iUploadCapabilitySupport )
+            {
+            server->SetStoreUsage( EFalse );
+            }
+        else
+            {            
+            server->SetFillUsage( EFalse );
+            }
+            
+        if ( !server->StoreUsage() && !server->FillUsage() )
+            {
+            server->SetIsActive( EFalse );	
+            }
+        }
+
+    // Set selected servers active
+    if( iSelectedServers )
+        {
+        // loop trough selected servers
+        for ( TInt iy = 0; iy < iSelectedServers->Count(); iy++ )
+            {
+
+            // Look for the server in selection array
+            TInt selectedIndex = iSelectedServers->At( iy );
+            // server points to iStoredServers table
+            CCmMediaServerFull* server = iServerList[selectedIndex];
+           
+            if ( iUploadCapabilitySupport )
+                {
+                server->SetStoreUsage( ETrue );
+                }
+            else // fill server
+                {
+                server->SetFillUsage( ETrue );
+                }
+            server->SetIsActive( ETrue );
+            }
+        }
+
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::SetServersActivity \
+    ends"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::CMSSettingItemDevices
+// --------------------------------------------------------------------------
+//
+CMSSettingItemDevices::CMSSettingItemDevices( TInt aIdentifier, TDes& aText,
+    CMSEngine& aMSEngine,
+    RPointerArray<CCmMediaServerFull>& aStoredServers,
+    TBool aUploadCapabilitySupport  ):
+    CMSTextSettingItem( aIdentifier, aText ),
+    iMSEngine( aMSEngine ),
+    iStoredServers( aStoredServers ),
+    iUploadCapabilitySupport( aUploadCapabilitySupport )
+    {
+    LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::CMSSettingItemDevices") );
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::ReadServerListL
+//
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::ReadServerListL()
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::ReadServerListL"));
+
+    // delete old ones
+    iServerList.Reset();
+
+    for ( TInt i = 0; i < iStoredServers.Count(); i++ )
+        {
+        // Add selected/marked servers to list
+        if (iUploadCapabilitySupport && iStoredServers[i]->CopyCapability()
+                && iStoredServers[i]->StoreUsage() )
+            {
+            // Add selected target servers
+            iServerList.AppendL(iStoredServers[i]);
+            }
+        else if (!iUploadCapabilitySupport && iStoredServers[i]->FillUsage() )
+            {
+            // Add selected source servers
+            iServerList.AppendL(iStoredServers[i]);
+            }
+        else
+            {
+            LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::ReadServerListL \
+            Not selected servers should not show to user"));
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::SetSettingItemTextL
+// Sets setting item secondary text according to selected items
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::SetSettingItemTextL()
+    {
+    LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::SetSettingItemTextL") );
+    
+    // count how many active devices threre are
+    TInt count = CountSelectedItems();
+    HBufC* itemText = NULL;
+
+    if ( count == 1 )
+        {
+        // one active found - need to get server name
+        for ( TInt index = 0; index < iStoredServers.Count(); index++ )
+            {
+            CCmMediaServerFull* server = iStoredServers[index];
+
+            if ( ( iUploadCapabilitySupport && server->StoreUsage() ) ||
+                 ( !iUploadCapabilitySupport && server->FillUsage() ) )
+                {
+                itemText = CnvUtfConverter::ConvertToUnicodeFromUtf8L(                                                
+                                                server->MediaServerName() );
+                CleanupStack::PushL(itemText);
+
+                iSettingText->Des().Copy( itemText->Left( KMaxFileName) );
+
+                CleanupStack::PopAndDestroy( itemText );
+                index = iStoredServers.Count(); // break loop                
+                }
+            else
+                {
+                LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\
+                SetSettingItemTextL copycapability required but not \
+                supported by server"));
+                }
+            }
+        }
+    // more than one item selected
+    else
+        {
+        if ( count > 1 )
+            {
+            itemText = StringLoader::LoadLC( R_MS_ITEM_DEVICES, count );
+            }
+        else
+            {
+            itemText = StringLoader::LoadLC( R_MS_NO_SERVER_SELECTED );
+            }
+
+        // do number conversion
+        TPtr ptr = itemText->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+        iSettingText->Des().Copy( *itemText );
+        CleanupStack::PopAndDestroy( itemText );
+        }
+
+     // Set new value
+     SetExternalText( *iSettingText );
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::CountSelectedItems
+// Counts selected items
+// --------------------------------------------------------------------------
+//
+TInt CMSSettingItemDevices::CountSelectedItems() const
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::CountSelectedItems"));
+
+    TInt count(0);
+
+    if( iStoredServers.Count() )
+        {
+        TRACE(Print(_L("[MSGSPlugin]\t server COUNT:  = %d"),
+            iStoredServers.Count() ));
+        for ( TInt index = 0; index < iStoredServers.Count(); index++ )
+            {
+
+            CCmMediaServerFull* server = iStoredServers[index];
+
+            if ( iUploadCapabilitySupport && server->StoreUsage() )
+                {
+                count++;
+                }
+            else if ( !iUploadCapabilitySupport && server->FillUsage() )
+                {
+                count++;
+                }
+            else
+                {
+                LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\
+                CountSelectedItems server not used"));
+                }
+            }
+        }
+    TRACE(Print(_L("[MSGSPlugin]\t active server COUNT:  = %d"),
+    count ));
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::DialogDismissedL
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::DialogDismissedL( TInt aButtonId )
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::DialogDismissedL"));
+
+    if( aButtonId != EAknSoftkeyDone )
+        {
+        LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\
+        DialogDismissedL CANCEL"));
+        iUserCancelledSearch = ETrue;
+        // cancel server search if it was started
+        CancelDeviceSearch();
+        }
+
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::UPnPDeviceDiscoveredL
+// Returns discovered device from UPnP AV control point.
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::UPnPDeviceDiscoveredL(
+                                    const CUpnpAVDevice& aDevice)
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::UPnPDeviceDiscoveredL"));
+
+    // Check that this is mediaserver
+    if ( aDevice.DeviceType() == CUpnpAVDevice::EMediaServer &&
+         aDevice.SearchCapability() && aDevice.DlnaCompatible() )
+        {
+        LOG(_L("[MSGSPlugin]\t Found device is Media server!"));
+
+#ifdef __DEBUG
+        HBufC* devName = UpnpString::ToUnicodeL( aDevice.FriendlyName() );
+        TRACE(Print(_L("[MSGSPlugin]\t device Name= %S"), devName ));
+        delete devName;
+#endif
+        TPtrC8 deviceUDN = aDevice.Uuid();
+
+        TInt serverCount = iStoredServers.Count();
+        TBool newServer( ETrue );
+        CCmMediaServerFull* tempServer = NULL;
+
+        // Check if server is already on the list
+        for ( TInt i=0; i < serverCount; i++ )
+            {
+            // Compare server udn
+            if ( deviceUDN.Compare(
+                    iStoredServers[i]->MediaServer() ) == 0 )
+                {
+                tempServer = iStoredServers[i];
+                // server already on the list
+                i = serverCount; // end loop
+                newServer = EFalse;
+                }
+            }
+
+        if ( newServer )
+            {
+            tempServer = CCmMediaServerFull::NewL();
+            CleanupStack::PushL( tempServer );
+            tempServer->SetUDNL( aDevice.Uuid() );
+            tempServer->SetMediaServerNameL( aDevice.FriendlyName() );
+            tempServer->SetCopyCapability( aDevice.CopyCapability() );
+            
+            // Add the server to found list            
+            iStoredServers.Append( tempServer );
+            
+            CleanupStack::Pop( tempServer );
+            }
+        // Add unselected servers to show to user
+        if ( ( iUploadCapabilitySupport && tempServer->CopyCapability()
+              && !tempServer->StoreUsage() )
+             || ( !iUploadCapabilitySupport && !tempServer->FillUsage() ) )
+            {
+            iServerList.AppendL( tempServer );
+            if ( iWaitDialog )
+                {
+                TRAP_IGNORE( iWaitDialog->ProcessFinishedL() );
+                iWaitDialog = NULL;
+                }
+
+            // If devices are searched for the first time
+            // the dialog needs to be created in EditItemL.
+            // This call is for updating existing dialog.
+            if ( iDevSelectionDlg )
+                {
+                iDevSelectionDlg->UpdateAndDrawPopupL( tempServer );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::UPnPDeviceDiscovered
+// Returns discovered device from UPnP AV control point
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::UPnPDeviceDiscovered(
+                                    const CUpnpAVDevice& aDevice )
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\
+             UPnPDeviceDiscovered"));
+
+    TRAP_IGNORE( UPnPDeviceDiscoveredL( aDevice ) );       
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::UPnPDeviceDisappeared
+// Returns disappeared device from UPnP AV control point.
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::UPnPDeviceDisappeared(
+                                    const CUpnpAVDevice& /*aDevice*/ )
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\
+             UPnPDeviceDisappeared"));
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::WLANConnectionLost
+// Notifies wlan connection lost
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::WLANConnectionLost()
+    {
+    LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::WLANConnectionLost"));
+    
+    TRAP_IGNORE( DialogDismissedL( EAknSoftkeyCancel ) );
+    if ( iWaitDialog )
+        {
+        TRAP_IGNORE( iWaitDialog->ProcessFinishedL() );
+        iWaitDialog = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::CreateAvcontrollerL
+//
+// --------------------------------------------------------------------------
+//
+TInt CMSSettingItemDevices::CreateAvcontrollerL()
+    {
+    LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::CreateAvcontrollerL" ) );
+
+    if( iAvController )
+        {
+        iAvController->Release();
+        iAvController = NULL;
+        }
+
+    iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL();
+
+    if( iAvController )
+        {
+        iAvController->SetDeviceObserver( *this );
+        }
+
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemDevices::CancelDeviceSearch
+//
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::CancelDeviceSearch()
+    {
+    LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::CancelDeviceSearch" ) );
+
+    if ( iAvController )
+        {
+        iAvController->RemoveDeviceObserver();
+		iAvController->Release();
+		iAvController = NULL;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::FetchAlreadyDiscoveredDevicesL
+// Fetches devices from AVController and calls
+// DeviceDiscovered-callback for each of them.
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::FetchAlreadyDiscoveredDevicesL()
+    {
+    LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::\
+    FetchAlreadyDiscoveredDevicesL") );
+    
+    // If iAvController is not created, this method is unusable. 
+    // Call CreateAvControllerL first.
+    User::LeaveIfNull( iAvController );
+    
+    // Fetch already found devices from AVController.
+    CUpnpAVDeviceList* discoveredDevices = 
+        iAvController->GetMediaServersL();
+    CleanupStack::PushL( discoveredDevices );
+        
+    if ( discoveredDevices && discoveredDevices->Count() > 0 ) 
+        {
+        // the AVController already has some devices.
+        LOG(_L("[MSGSPlugin]\t \
+                CMSSettingItemDevices::FetchAlreadyDiscoveredDevicesL: \
+                AVController has already discovered devices" ) );
+
+        // process the already existing devices
+        for ( TInt i = 0 ; i < discoveredDevices->Count() ; i++ ) 
+            {
+            UPnPDeviceDiscovered( 
+                *( discoveredDevices->operator[](i) ) );
+            }
+        }
+
+    // clean up        
+    CleanupStack::PopAndDestroy( discoveredDevices );
+    discoveredDevices = NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::CreateAvcAndFetchDevicesL
+// Creates AVController, fetches devices from it and calls
+// DeviceDiscovered-callback for each of them. Starts wait note if no devices 
+// are already discovered.
+// ---------------------------------------------------------------------------
+//
+TInt CMSSettingItemDevices::CreateAvcAndFetchDevicesL()
+    {
+    LOG( _L(
+        "[MSGSPlugin]\t CMSSettingItemDevices::CreateAvcAndFetchDevicesL" )
+       );
+    
+    iUserCancelledSearch = EFalse;
+
+    if( iSelectedServers )
+        {
+        iSelectedServers->Reset();
+        delete iSelectedServers;
+        iSelectedServers = NULL;
+        }
+    iSelectedServers =
+            new (ELeave) CArrayFixFlat<TInt>( KItemArrayGranularity );
+
+    iCreateAvCState = EPhaseNotActive;
+    CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL();
+    CleanupStack::PushL( reinterpret_cast<CBase*>( waitNoteWrapper ) );
+    TRAPD( err, waitNoteWrapper->ExecuteL(
+              R_MS_WAIT_FOR_CREATEAVC_DIALOG,
+              *this,
+              ETrue ) );//ETrue = show immediately
+    CleanupStack::PopAndDestroy( waitNoteWrapper );
+
+
+    if ( iAvController )
+        {
+        // Process devices that AVController has already discovered.
+        FetchAlreadyDiscoveredDevicesL();
+
+        // If still no devices discovered, start wait note.
+        if ( iServerList.Count() == 0 )
+            {
+            iWaitDialog = new ( ELeave ) CAknWaitDialog(
+            ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ) );
+            iWaitDialog->SetCallback( this );
+            iWaitDialog->ExecuteLD( R_MS_WAIT_DIALOG );
+            LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::\
+            CreateAvcAndFetchDevicesL starting wait" ) );
+            iWait.Start(); // wait here until first server is found.
+            }
+        }
+    else
+        {
+        //handle the error
+        if( KErrDiskFull == err )
+            {
+            ShowErrorNoteL( R_MS_GS_MEMORY_FULL );
+            }
+        iUserCancelledSearch = ETrue; // Don't show selection dialog.
+        }
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::ShowErrorNoteL
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::ShowErrorNoteL( TInt aTextResource )
+    {
+    LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::ShowErrorNoteL" ) );
+    HBufC* warningText =
+                      StringLoader::LoadLC( aTextResource );
+    CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( );
+    dlg->ExecuteLD( *warningText );
+    CleanupStack::PopAndDestroy( warningText );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::StepL
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemDevices::StepL()
+    {
+    LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::StepL" ) );
+    if( EPhaseNotActive == iCreateAvCState )
+        {
+        CreateAvcontrollerL();
+        iCreateAvCState = EPhaseCompleted;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::IsProcessDone
+// ---------------------------------------------------------------------------
+//
+TBool CMSSettingItemDevices::IsProcessDone() const
+    {
+    LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::IsProcessDone" ) );
+    TBool ret( EFalse );
+    if ( EPhaseNotActive == iCreateAvCState )
+        {
+        // try to start avcontroller
+        }
+    else if ( EPhaseCompleted  == iCreateAvCState )
+        {
+        ret = ETrue;
+        }
+    else
+        {
+        LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::IsProcessDone \
+        other branch" ) );
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemDevices::CycleError
+// handles the error
+// ---------------------------------------------------------------------------
+//
+TInt CMSSettingItemDevices::CycleError( TInt aError )
+    {
+    TRACE( Print( _L( " CMSSettingItemDevices::CycleError \
+            aError = %d " ), aError ) );
+
+    return aError;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/src/mssettingitemlist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,495 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSSettingItemList class implementation
+*
+*/
+
+
+#include <msgspluginsrc.rsg>
+#include <commdb.h> // for RProperty
+#include <StringLoader.h> // for StringLoader
+#include <centralrepository.h> // for profile
+#include <ProfileEngineSDKCRKeys.h> // for profile
+#include <driveinfo.h>
+
+#include "cmsettingsfactory.h"
+#include "cmcommonutils.h"
+#include "cmsettings.h"
+#include "cmdriveinfo.h"
+#include "mserv.hlp.hrh"
+#include "msengine.h"
+#include "mssettingitemlist.h"
+#include "mssettingitemmemory.h" // mmc name
+#include "mssettingitemdevices.h" // source devices
+#include "mssettingsview.h"
+#include "msconstants.h"
+#include "cmmediaserverfull.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KOfflineProfile = 5;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::NewL()
+// Two phase constructor.
+// --------------------------------------------------------------------------
+//
+CMSSettingItemList* CMSSettingItemList::NewL( TInt aResourceId,
+                                              CMSSettingsView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::NewL"));
+
+    CMSSettingItemList* self = CMSSettingItemList::NewLC( aResourceId, 
+	                                                      aView );
+
+	CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::NewLC()
+// Two phase constructor.
+// --------------------------------------------------------------------------
+//
+CMSSettingItemList* CMSSettingItemList::NewLC( TInt aResourceId,
+                                              CMSSettingsView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::NewLC"));
+
+    CMSSettingItemList* self = new ( ELeave ) CMSSettingItemList(
+                                                aView );
+    CleanupStack::PushL( self );
+    self->ConstructL( aResourceId );
+    return self;
+    }
+	
+// --------------------------------------------------------------------------
+// CMSSettingItemList::CMSSettingItemList()
+// --------------------------------------------------------------------------
+//
+CMSSettingItemList::CMSSettingItemList( CMSSettingsView& aView )
+    : iView( aView )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::CMSSettingItemList"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::~CMSSettingItemList()
+// --------------------------------------------------------------------------
+//
+CMSSettingItemList::~CMSSettingItemList()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::~CMSSettingItemList"));
+
+	if ( iStoredServers ) 
+		{
+		iStoredServers->ResetAndDestroy();
+	    iStoredServers->Close();
+	    delete iStoredServers;		
+		}
+
+    if ( iMSEngine )
+        {
+        delete iMSEngine;    
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::ConstructL()
+// Second phase constructor.
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemList::ConstructL( TInt aResourceId )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::ConstructL"));
+
+    // Create engine
+    iMSEngine = CMSEngine::NewL();
+
+    // Set engine observer
+    iMSEngine->SetObserver( this );
+    // Read memory manager setting
+    iMemoryManager =
+           iMSEngine->ServiceState( ECmServiceMemoryManager );
+
+    iSync = iMSEngine->ServiceState( ECmServiceContentManager );
+
+    // Get server list
+    iStoredServers = iMSEngine->GetMediaServersL();
+
+    CAknSettingItemList::ConstructFromResourceL( aResourceId );
+
+    // sets memory selection setting visibility
+    SetMemorySelectionL();
+
+    iListBox = ListBox();
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::OpenSelectedListboxItemL
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemList::OpenSelectedListboxItemL()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::OpenSelectedListboxItemL"));
+
+    HandleListBoxEventL( ListBox(), EEventEnterKeyPressed );
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::HandleListBoxEventL()
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemList::HandleListBoxEventL( CEikListBox *aListBox,
+                                              TListBoxEvent aEventType)
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::HandleListBoxEventL"));
+
+    CAknSettingItemList::HandleListBoxEventL( aListBox, aEventType );
+
+    // UI selection is stored to actual settings variable
+    StoreSettingsL();
+
+    TInt listBoxItemIndex = iListBox->CurrentItemIndex();
+    CAknSettingItemArray* itemArray = SettingItemArray();
+    TInt realIndex = itemArray->ItemIndexFromVisibleIndex(
+                                                      listBoxItemIndex );
+
+    if ( realIndex == EMSSettingsSync )
+        {
+        iMSEngine->SetServiceState( ECmServiceContentManager,
+                                             iSync );
+        // inform plugin about changed setting
+        TCmProgressInfo info;
+        info.iProcessedItems = 0,
+        info.iTotalItems = 0;
+        info.iService = ECmServiceNone;
+
+        TCmProgressInfoPckg transferInfoPckg( info );
+
+        RProperty::Set( KCmPropertyCat, KCmProperty,
+        transferInfoPckg );
+
+        // we aren't allowed to set wlan scanning in offline mode
+        if ( GetCurrentProfileL() != KOfflineProfile )
+            {
+            // Set wlan scanning parameters
+            TInt interval = ( iSync == ECmServiceStateDisabled ?
+                    KWlanScanNetworkNever : KWlanScanNetworkInterval60 );
+
+            CmCommonUtils::SetWlanScanL( interval );
+            }
+        }
+
+    else if ( realIndex == EMSMemoryManager )
+        {
+        iMSEngine->SetServiceState( ECmServiceMemoryManager,
+                                             iMemoryManager );
+        }
+    else
+        {
+        LOG(_L("[MediaServant]\t CMSSettingItemList::\
+        HandleListBoxEventL no such item"));
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAknSettingItem* CMSSettingItemList::CreateSettingItemL(TInt aIdentifier)
+// Takes care of creating actual setting items.
+// --------------------------------------------------------------------------
+//
+CAknSettingItem* CMSSettingItemList::CreateSettingItemL( TInt aIdentifier )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::CreateSettingItemL"));
+
+    CAknSettingItem* settingItem = NULL;
+
+    // setting item is created according to aIdentifier
+    switch ( aIdentifier )
+        {
+        case EMSSettingsSync:
+            {
+            LOG(_L("[MediaServant]\t List Item: EMSSettingsSync"));
+            settingItem = new (ELeave ) CAknEnumeratedTextPopupSettingItem(
+                                         aIdentifier,
+                                         reinterpret_cast<TInt&> (iSync) );
+            break;
+            }
+        
+        case EMSSettingsSourceDevices:
+            {
+            LOG(_L("[MediaServant]\t List Item: EMSSettingsSourceDevices"));
+            settingItem = CMSSettingItemDevices::NewL (
+                                            aIdentifier,
+                                            iDummyText,
+                                            *iMSEngine,
+                                            *iStoredServers );
+            break;
+            }
+
+        case EMSSettingsTargetDevices:
+            {
+            LOG(_L("[MediaServant]\t List Item: EMSSettingsTargetDevices"));
+            settingItem = CMSSettingItemDevices::NewL (
+                                            aIdentifier,
+                                            iDummyText,
+                                            *iMSEngine,
+                                            *iStoredServers,
+                                            ETrue );
+            break;
+            }
+            
+        case EMSSettingsMemory:
+            {
+            LOG(_L("[MediaServant]\t List Item: EMSSettingsMMC"));
+            settingItem = CMSSettingItemMemory::NewL (
+                                            aIdentifier,
+                                            iDummyText,
+                                            *iMSEngine,                                            
+                                            *this );
+            break;
+            }
+
+        case EMSMemoryManager:
+            {
+            LOG(_L("[MediaServant]\t List Item: EMSMemoryManager"));
+            settingItem = new ( ELeave ) CAknBinaryPopupSettingItem(
+                                  aIdentifier,
+                                  reinterpret_cast<TBool&> (iMemoryManager) );
+            break;
+            }
+
+        default:
+            {
+            LOG(_L("[MediaServant]\t No list item found"));
+            break;
+            }
+        }
+    return settingItem;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::EditItemL()
+// Called by framework when item is opened
+// --------------------------------------------------------------------------
+//
+void  CMSSettingItemList::EditItemL ( TInt aIndex, TBool aCalledFromMenu )
+    {
+    CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
+
+    if ( iListBox->CurrentItemIndex() == EMSSettingsSourceDevices )
+        {
+        CMSSettingItemDevices* item = static_cast<CMSSettingItemDevices*>
+                               (SearchItemById( EMSSettingsSourceDevices ));
+
+        if ( item->SettingAccepted() )
+            {
+            TCmServerState state( ECmServerStateIdle );
+            // List of unselected servers
+            RPointerArray<CCmMediaServerFull> unselectedServers;
+
+            iMSEngine->ServerState( state );
+            if ( state != ECmServerStateIdle )
+                {
+                iMSEngine->StopOperation();
+                }
+            iView.ClearCurrentNaviPaneText();
+
+            iMSEngine->DeleteMetadataL();
+
+            HBufC* naviText = StringLoader::LoadLC(
+                                 R_MS_PREPROCESSING_TEXT );
+            iView.SetNavigationPaneTextL( *naviText );
+            CleanupStack::PopAndDestroy( naviText );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::SearchItemById
+// Searches item from the itemarray by given ID
+// --------------------------------------------------------------------------
+//
+CAknSettingItem* CMSSettingItemList::
+                SearchItemById( const TMSSettingItems aId ) const
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::SearchItemById"));
+
+    CAknSettingItem* item = NULL;
+    CAknSettingItemArray* itemArray = SettingItemArray();
+    TInt count = itemArray->Count();
+
+    for ( TInt index = 0; index < count; index++ )
+        {
+        if ( itemArray->At( index )->Identifier() == aId )
+            {
+            item = itemArray->At( index );
+            // end loop
+            index = count;
+            }
+        }
+    return item;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::SizeChanged()
+// Called by framework when the view size is changed.
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemList::SizeChanged()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::SizeChanged"));
+
+    ListBox()->SetRect( Rect() ); // Set rectangle of listbox.
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::HandleResourceChange
+// Handles layout change
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemList::HandleResourceChange( TInt aType )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::HandleResourceChange"));
+
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect( iView.ClientRect() );
+        }
+
+    CCoeControl::HandleResourceChange( aType );
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::ReadyL()
+// engine observer callback
+// --------------------------------------------------------------------------
+//
+#ifdef __DEBUG
+void CMSSettingItemList::ReadyL( TCmService aService, TInt aError )
+#else
+void CMSSettingItemList::ReadyL( TCmService aService, TInt /*aError*/ )
+#endif
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::ReadyL"));
+#ifdef __DEBUG
+    TRACE(Print(_L("[MediaServant]\t CMSSettingItemList::\
+    ReadyL error %d"), aError));
+#endif
+
+
+    switch ( aService )
+        {
+        case ECmServiceDeleteMetadata:
+            {
+            iMSEngine->ExecuteFillPreProcessingL();
+            break;
+            }
+        case ECmServicePreProcessingFill:
+            {
+            iView.ClearCurrentNaviPaneText();
+            break;
+            }
+        default:
+            {
+            // do nothing
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemList::MSEngine()
+// --------------------------------------------------------------------------
+//
+CMSEngine* CMSSettingItemList::MSEngine()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::MSEngine"));
+
+    return iMSEngine;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::GetCurrentProfileL()
+// Reads current profile
+// --------------------------------------------------------------------------
+//
+TInt CMSSettingItemList::GetCurrentProfileL() const
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::GetCurrentProfileL"));
+
+    TInt profile( 0 );
+    CRepository* repository = CRepository::NewLC( KCRUidProfileEngine );
+    repository->Get( KProEngActiveProfile, profile );
+    CleanupStack::PopAndDestroy( repository );
+
+    return profile;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemList::SetMemorySelectionL
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemList::SetMemorySelectionL()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::SetMemorySelectionL"));
+    
+    TBool memoryCardFound( EFalse );
+    RPointerArray<CCmDriveInfo> driveArray;
+    CleanupClosePushL( driveArray );
+    MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC();
+
+    // get available drives
+    settings->DriveListL( ControlEnv()->FsSession(), driveArray );
+	settings->Close();
+    CleanupStack::Pop(); // settings
+
+    TInt driveCount = driveArray.Count();
+    for ( TInt i = 0; i < driveCount; i++ )
+        {
+        if ( driveArray[i]->DriveType() == DriveInfo::EDriveRemovable )
+            {
+            memoryCardFound = ETrue;
+            i = driveCount; // break loop
+            }
+        }
+    if ( !memoryCardFound )
+        {
+        CAknSettingItem* item = SearchItemById( EMSSettingsMemory );
+        item->SetHidden( ETrue);
+        // visibility changed
+        HandleChangeInItemArrayOrVisibilityL();
+        }
+
+    driveArray.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &driveArray );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSSettingItemList::GetHelpContext
+// ---------------------------------------------------------------------------
+//
+void CMSSettingItemList::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemList::GetHelpContext"));
+
+    aContext.iMajor = KUidMediaServant;
+    aContext.iContext = KMSERV_HLP_SYNC_SETTINGS;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/src/mssettingitemmemory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSSettingItemMemory class implementation
+*
+*/
+
+
+#include <msgspluginsrc.rsg>
+#include <StringLoader.h> // StringLoader
+#include <akncheckboxsettingpage.h> // CSelectionItemList
+#include <driveinfo.h>
+
+#include "cmsettingsfactory.h"
+#include "cmsettings.h"
+#include "cmdriveinfo.h"
+#include "mssettingitemmemory.h"
+#include "mssettingitemlist.h"
+#include "msconstants.h"
+#include "msengine.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KArrayGranularity = 2; // memory list size
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CMSSettingItemMemory::NewL
+// --------------------------------------------------------------------------
+//
+CMSSettingItemMemory* CMSSettingItemMemory::NewL(
+                                TInt aIdentifier,
+                                TDes& aText,
+                                CMSEngine& aMSEngine,
+                                CMSSettingItemList& aParent )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreServersSetting::NewL"));
+
+    CMSSettingItemMemory* self = CMSSettingItemMemory::NewLC(
+                                                    aIdentifier,
+                                                    aText,
+                                                    aMSEngine,
+                                                    aParent );
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemMemory::NewLC
+// --------------------------------------------------------------------------
+//
+CMSSettingItemMemory* CMSSettingItemMemory::NewLC(
+                                TInt aIdentifier,
+                                TDes& aText,
+                                CMSEngine& aMSEngine,
+                                CMSSettingItemList& aParent )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreServersSetting::NewLC"));
+
+    CMSSettingItemMemory* self = new (ELeave) CMSSettingItemMemory(
+                                                    aIdentifier,
+                                                    aText,
+                                                    aMSEngine,
+                                                    aParent );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+	
+// --------------------------------------------------------------------------
+// CMSSettingItemMemory::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemMemory::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemMemory::ConstructL"));
+
+    iItemArray = new ( ELeave ) CSelectionItemList( KArrayGranularity );
+    // Create selection list
+    CreateSelectionListL();
+    // set setting item secondary text
+    SetSettingItemTextL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemMemory::~CMSSettingItemMemory()
+// --------------------------------------------------------------------------
+//
+CMSSettingItemMemory::~CMSSettingItemMemory()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemMemory::~CMSSettingItemMemory"));
+
+    if ( iItemArray )
+        {
+        iItemArray->ResetAndDestroy();
+        delete iItemArray;
+        }
+
+    iDriveArray.ResetAndDestroy();
+    iDriveArray.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemMemory::EditItemL( TBool aCalledFromMenu )
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemMemory::EditItemL( TBool /*aCalledFromMenu*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemMemory::EditItemL"));
+
+    if ( iItemArray->Count() )
+        {
+        CAknSettingPage* dlg = new ( ELeave ) CAknCheckBoxSettingPage(
+                R_MS_MEMORYSELECTION_SETTING, iItemArray );
+
+        //store item before launch setting page
+        CSelectionItemList* tempItemArray = new ( ELeave )
+                                CSelectionItemList( KArrayGranularity );
+        CleanupStack::PushL( tempItemArray );
+        for ( TInt i = 0; i < iItemArray->Count(); i++ )
+            {
+            HBufC* memoryName = ( *iItemArray )[i]->ItemText().AllocLC();
+            TBool selected = ( *iItemArray )[i]->SelectionStatus();
+            CSelectableItem* tempitem = new ( ELeave )
+                                CSelectableItem( *memoryName, selected );
+            CleanupStack::PushL( tempitem );
+            tempitem->ConstructL();
+            tempItemArray->AppendL( tempitem );  // ownership transferred
+            CleanupStack::Pop( tempitem );
+            CleanupStack::PopAndDestroy( memoryName );
+            }
+
+        // launch setting page
+        if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+            {
+            LOG(_L("[MediaServant]\t CMSSettingItemMemory::\
+            EditItemL  Press Ok to exit"));
+            SetStorageInformationL();
+            SetSettingItemTextL();
+            UpdateListBoxTextL();
+            }
+        else
+            {
+            //restore item after press cancel key to exit setting page
+            LOG(_L("[MediaServant]\t CMSSettingItemMemory::\
+            EditItemL  Press Cancel to exit"));
+            if( iItemArray )
+                {
+                iItemArray->ResetAndDestroy();
+                }
+
+            for ( TInt i = 0; i < tempItemArray->Count(); i++ )
+                {
+                iItemArray->AppendL( ( *tempItemArray )[i] );
+                //ownership transferred
+                }
+            }
+
+        CleanupStack::PopAndDestroy( tempItemArray );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemMemory::SetSettingItemTextL
+// Sets setting item secondary text according to selected items
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemMemory::SetSettingItemTextL()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemMemory::SetSettingItemTextL"));
+
+    TInt count(0);
+
+    // count selected items
+    for ( TInt i = 0; i < iItemArray->Count(); i++ )
+        {
+        if ( (*iItemArray)[i]->SelectionStatus() )
+            {
+            count++;
+            }
+        }
+
+    HBufC* itemText = NULL;
+    // Check if there is no selected items
+    if ( count == 0 )
+        {
+        itemText = StringLoader::LoadLC( R_MS_NO_MEMORY_IN_USE );
+        }
+    // Check if only one item is selected
+    else if ( count == 1 )
+        {
+        TInt itemCount = iItemArray->Count();
+        for ( TInt index = 0; index < itemCount; index++ )
+            {
+            CSelectableItem* item = (*iItemArray)[ index ];
+            if ( item->SelectionStatus() )
+                {
+                itemText = item->ItemText().AllocLC();
+                index = itemCount; // break loop
+                }
+            }
+        }
+    // more than one item selected
+    else
+        {
+        itemText = StringLoader::LoadLC( R_MS_NOF_MEMORIES_IN_USE, count );
+        // do number conversion
+        TPtr ptr = itemText->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+        }
+
+    if ( itemText )
+        {
+        // Set new value
+        SetExternalText( *itemText );
+        LoadL();
+        CleanupStack::PopAndDestroy( itemText );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemMemory::CMSSettingItemMemory
+// --------------------------------------------------------------------------
+//
+CMSSettingItemMemory::CMSSettingItemMemory(
+    TInt aIdentifier,
+    TDes& aText,
+    CMSEngine& aMSEngine,
+    CMSSettingItemList& aParent
+     ) :
+    CAknTextSettingItem( aIdentifier, aText ),
+    iMSEngine( aMSEngine ),
+    iParent( aParent )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemMemory::CMSSettingItemMemory"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemMemory::CreateSelectionListL
+// Creates selection list using drivelist and stored drivelit as input
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemMemory::CreateSelectionListL()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemMemory::CreateSelectionListL"));
+
+    RFs fileSession = iParent.ControlEnv()->FsSession();
+
+    MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC();
+    settings->DriveListL( fileSession, iDriveArray );
+
+    RPointerArray<CCmDriveInfo> storedDrives;
+    CleanupClosePushL( storedDrives );
+    iMSEngine.GetDrivesL( storedDrives );
+
+    for ( TInt i = 0; i< iDriveArray.Count(); i++ )
+        {
+        TDesC* memoryName = NULL;
+
+        if ( iDriveArray[i]->DriveName().Length() )
+            {
+            memoryName = iDriveArray[i]->DriveName().AllocLC();
+            }
+        else
+            {
+            // use default name if drive has no name
+            memoryName = StringLoader::LoadLC(
+                                R_MS_SETTINGS_DEFAULT_MEMORY_NAME );
+            }
+
+        TBool selected( EFalse );
+        for ( TInt j = 0; j < storedDrives.Count(); j++)
+            {
+            if ( storedDrives[j]->DriveId() == iDriveArray[i]->DriveId() )
+                {
+                selected = ETrue;
+                }
+            }
+        CSelectableItem* item = new ( ELeave ) CSelectableItem( *memoryName,
+                                                                selected );
+        CleanupStack::PushL( item );
+        item->ConstructL();
+        iItemArray->AppendL( item ); // ownership transferred
+        CleanupStack::Pop( item );
+        CleanupStack::PopAndDestroy( memoryName );
+        }
+
+    storedDrives.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &storedDrives );
+	settings->Close();
+    CleanupStack::Pop(); // settings
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingItemMemory::SetStorageInformationL
+// Sets drive information and quota
+// --------------------------------------------------------------------------
+//
+void CMSSettingItemMemory::SetStorageInformationL()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemMemory::SetStorageInformationL"));
+
+    RPointerArray<CCmDriveInfo> activeDrives;
+    for ( TInt i = 0; i < iItemArray->Count(); i++ )
+        {
+        if ( (*iItemArray)[i]->SelectionStatus() )
+            {
+            TInt64 quota(0);
+            if ( iDriveArray[i]->DriveType() & DriveInfo::EDriveRemovable )
+                {
+                LOG(_L("[MediaServant]\t CMSSettingItemMemory::\
+                SetStorageInformationL set memory card quota"));
+                // memory card
+                quota =
+                    ( iDriveArray[i]->DriveSize() * KMMCDefaultQuota ) / 100;
+                }
+            else
+                {
+                LOG(_L("[MediaServant]\t CMSSettingItemMemory::\
+                SetStorageInformationL internal memory quota"));
+                // internal hd
+                quota =
+                    ( iDriveArray[i]->DriveSize() * KHDDefaultQuota ) / 100;
+
+                }
+            // add quota to drive info
+            iDriveArray[i]->SetDriveQuota( quota );
+            // add selected drive to array
+            activeDrives.Append( iDriveArray[i] );
+            }
+        }
+
+    // store drive information
+    TRACE(Print(_L("[MediaServant]\t CMSSettingItemMMemory::\
+        SetStorageInformationL drivecount = %d"), activeDrives.Count()));
+    iMSEngine.SetDrivesL( activeDrives );
+    activeDrives.Reset();
+    activeDrives.Close();
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/src/mssettingitems.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Setting item class implementations
+*
+*/
+
+
+#include "mssettingitems.h"
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CMSTextSettingItem::CMSTextSettingItem
+// --------------------------------------------------------------------------
+//
+CMSTextSettingItem::CMSTextSettingItem(  TInt aIdentifier, TDes& aText ) :
+    CAknTextSettingItem( aIdentifier, aText )
+    {
+    LOG(_L("[MediaServant]\t CMSTextSettingItem::CMSTextSettingItem"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSTextSettingItem::SettingAccepted
+// --------------------------------------------------------------------------
+//
+TBool CMSTextSettingItem::SettingAccepted()
+    {
+    LOG(_L("[MediaServant]\t CMSTextSettingItem::SettingAccepted"));
+
+    return iOKPressed;
+    }
+
+// --------------------------------------------------------------------------
+// CMSTextSettingItem::SetAcceptState
+// --------------------------------------------------------------------------
+//
+void CMSTextSettingItem::SetAcceptState( TBool aState )
+    {
+    LOG(_L("[MediaServant]\t CMSTextSettingItem::SetAcceptState"));
+
+    iOKPressed = aState;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncgsplugin/src/mssettingsview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSSettingsView class implementation
+*
+*/
+
+
+#include <msgspluginsrc.rsg>
+#include <hlplch.h>
+#include <GSFWViewUIDs.h>
+#include <aknnavide.h>
+#include <StringLoader.h>
+#include <msgsplugin.mbg>
+#include <akntitle.h>
+
+#include "cmcommonutils.h"
+#include "msconstants.h"
+#include "mssettingitemlist.h"
+#include "msgspluginuids.h"
+#include "mssettingsview.h"
+#include "msengine.h"
+#include "msdebug.h"
+
+// CONSTANTS
+_LIT( KMediaservantRscFile, "\\resource\\msgspluginsrc.rsc" );
+_LIT( KMSGSMifFileName, "\\resource\\apps\\msgsplugin.mif" );
+
+// --------------------------------------------------------------------------
+// Two phased constructor.
+// --------------------------------------------------------------------------
+//
+CMSSettingsView* CMSSettingsView::NewL()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::NewL"));
+
+    CMSSettingsView* self = CMSSettingsView::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Two phased constructor.
+// --------------------------------------------------------------------------
+//
+CMSSettingsView* CMSSettingsView::NewLC()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::NewLC"));
+
+    CMSSettingsView* self = new ( ELeave ) CMSSettingsView();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+	
+// --------------------------------------------------------------------------
+// CMSSettingsView::CMSSettingsView()
+// --------------------------------------------------------------------------
+//
+CMSSettingsView::CMSSettingsView()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::CMSSettingsView"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingsView::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSSettingsView::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::ConstructL"));
+
+    iCoeEnv = CEikonEnv::Static();    
+    // Load resource file
+    iResFileOffset = CmCommonUtils::LoadResourceFileL(
+                                        KMediaservantRscFile(),
+                                        *iCoeEnv );
+    
+    BaseConstructL( R_MS_SETTINGS_VIEW );
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingsView::~CMSSettingsView()
+// --------------------------------------------------------------------------
+//
+CMSSettingsView::~CMSSettingsView()
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::~CMSSettingsView"));
+    
+    ClearCurrentNaviPaneText();
+    
+    if ( iResFileOffset )
+        {
+        iCoeEnv->DeleteResourceFile( iResFileOffset );
+        }
+  
+    DoDeactivate();
+    }
+    
+// --------------------------------------------------------------------------
+// TUid CMSSettingsView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CMSSettingsView::Id() const
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::Id"));
+
+    return KMSGSImplementationUid;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingsView::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CMSSettingsView::HandleCommandL( TInt aCommand )
+    {
+    TRACE(Print(_L("[MediaServant]\t CMSSettingsView::\
+HandleCommandL command = %d"), aCommand ));
+
+    switch ( aCommand )
+        {
+        case EAknCmdOpen:
+            {
+            iSettingItemList->OpenSelectedListboxItemL();
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            TCmServerState state;
+            iSettingItemList->MSEngine()->ServerState( state );
+            if ( state != ECmServerStateIdle )
+                {
+                iSettingItemList->MSEngine()->StopOperation();
+                }            
+
+            CAknView* activeView = AppUi()->View( KMSMainViewId );
+            CAknView* activeView2 = AppUi()->View( KGSMainViewUid );            
+            
+            if ( activeView )
+                {                
+                AppUi()->ActivateLocalViewL( KMSMainViewId );
+                }
+            else if ( activeView2 )
+                {
+                AppUi()->ActivateLocalViewL( KGSAppsPluginUid );
+                }
+            else
+                {
+                LOG(_L("[MediaServant]\t CMSSettingsView::HandleCommandL \
+                parent view not found"));
+                }
+            
+            break;
+            }
+        case EAknCmdHelp :
+            {
+            TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL(
+                        iEikonEnv->WsSession(),
+            iEikonEnv->EikAppUi()->AppHelpContextL() ));
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingsView::DoActivateL(...)
+// --------------------------------------------------------------------------
+//
+void CMSSettingsView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::DoActivateL"));
+
+    // Set title pane text to default
+    SetTitlePaneTextL( R_MS_GS_SETTINGS_VIEW_TITLE );
+
+    if ( !iSettingItemList )
+        {
+        // create settings screen
+        iSettingItemList = CMSSettingItemList::NewL( R_MS_GENERAL_SETTINGS,
+                                                     *this );
+        iSettingItemList->SetMopParent( this );
+
+        // now control receives keyboard events
+        AppUi()->AddToStackL( *this, iSettingItemList );
+        iSettingItemList->ActivateL();
+
+        }
+   }
+
+// --------------------------------------------------------------------------
+// CMSSettingsView::DoDeactivate()
+// --------------------------------------------------------------------------
+//
+void CMSSettingsView::DoDeactivate()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::DoDeactivate"));
+
+    if ( iSettingItemList )
+        {
+        AppUi()->RemoveFromStack( iSettingItemList );
+        }
+
+    delete iSettingItemList; // Deletes the container class object.
+    iSettingItemList = NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// Method for getting caption of this plugin. 
+// --------------------------------------------------------------------------
+//
+void CMSSettingsView::GetCaptionL( TDes& aCaption ) const
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::GetCaptionL"));
+    
+    HBufC* pluginText = StringLoader::LoadLC( R_MS_GS_PLUGIN_TEXT );
+    aCaption.Copy( *pluginText );
+    CleanupStack::PopAndDestroy( pluginText );
+    }
+
+// --------------------------------------------------------------------------
+// Creates a new icon of desired type.
+// --------------------------------------------------------------------------
+//
+CGulIcon* CMSSettingsView::CreateIconL( const TUid /*aIconType*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::CreateIconL"));
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName() );
+    
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC( skin,
+                             KAknsIIDDefault,
+                             bitmap,
+                             mask,
+                             KMSGSMifFileName,
+                             EMbmMsgspluginQgn_mserv_app_menu_icon,
+                             EMbmMsgspluginQgn_mserv_app_menu_icon_mask );
+
+    CGulIcon* icon = CGulIcon::NewL(bitmap, mask);
+    CleanupStack::Pop(mask);
+    CleanupStack::Pop(bitmap);
+    bitmap = NULL;
+    mask = NULL;
+
+    return icon;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingsView::SetNavigationPaneTextL()
+// Sets navigation pane text.
+// --------------------------------------------------------------------------
+//
+void CMSSettingsView::SetNavigationPaneTextL(const TDesC& aText )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::SetNavigationPaneTextL"));
+
+    // old decorator is popped and deleted
+    ClearCurrentNaviPaneText();
+
+    if ( !iNaviPane )
+        {
+        iNaviPane = static_cast<CAknNavigationControlContainer*>
+            ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+                // ownership of decorator is transfered to application
+        }
+
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( aText );
+    iNaviPane->PushL( *iNaviDecorator );
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingsView::ClearCurrentNaviPaneText()
+// Clears navi pane text.
+// --------------------------------------------------------------------------
+//
+void CMSSettingsView::ClearCurrentNaviPaneText()
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::ClearCurrentNaviPaneText"));
+
+    if ( iNaviDecorator )
+        {
+        iNaviPane->Pop( iNaviDecorator );
+        delete iNaviDecorator;
+        iNaviDecorator = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSettingsView::SetTitlePaneTextL()
+// Sets text to title pane.
+// --------------------------------------------------------------------------
+void CMSSettingsView::SetTitlePaneTextL( TInt aResourceId )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingsView::SetTitlePaneTextL"));
+
+    // Fetches pointer to the default title pane control.
+    CAknTitlePane* titlePane = static_cast<CAknTitlePane*>(
+        StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+
+    // Makes and sets text which is used title pane.
+    if ( aResourceId == KMSDefaultTitleId )
+        {
+        titlePane->SetTextToDefaultL();
+        }
+    else
+        {
+        TBuf<KMSTitleBufLength> titleText( 0 );
+        iCoeEnv->ReadResourceL( titleText, aResourceId );
+        titlePane->SetTextL( titleText );
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/BWINS/msappwizardu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	?NewL@CMSAppWizard@@SAPAV1@AAVCMSEngine@@@Z @ 1 NONAME ; class CMSAppWizard * CMSAppWizard::NewL(class CMSEngine &)
+	?StartL@CMSAppWizard@@QAEHXZ @ 2 NONAME ; int CMSAppWizard::StartL(void)
+	?NewLC@CMSAppWizard@@SAPAV1@AAVCMSEngine@@@Z @ 3 NONAME ; class CMSAppWizard * CMSAppWizard::NewLC(class CMSEngine &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/EABI/msappwizardu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	_ZN12CMSAppWizard4NewLER9CMSEngine @ 1 NONAME
+	_ZN12CMSAppWizard5NewLCER9CMSEngine @ 2 NONAME
+	_ZN12CMSAppWizard6StartLEv @ 3 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_graf_upnp_ext_renderer.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,527 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="245.3867 439.0518" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="352" height="286"
+	 viewBox="0 0 352 286" overflow="visible" enable-background="new 0 0 352 286" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="&ns_vars;">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="153.052" x="245.387" width="352" height="286" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about=''
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-08-31T11:03:11Z</xap:CreateDate>
+  <xap:ModifyDate>2005-08-31T11:03:17Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>256</xapGImg:width>
+     <xapGImg:height>208</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgA0AEAAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7&#xA;FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F&#xA;XYqp3FzbW0RluJUhiHWSRgqj6TQYql8fmryvK/pxaxYvIDQotzETXp0DYqmMNxBMvKGRZV/mRgw3&#xA;+WKr8VdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdiqSa&#xA;x5dvNRQhdd1CyX+W2MEY/wCCEXP/AIbFWCan+Rkl8/rnzFPNIRUPcx+sTX/L9QYKVJ5fyE12M1g1&#xA;G1l8PUEkf6lkxpUP/wAqh85WrcooopWHRoplU/8AD8MaVExeX/zIsPsi/jp/vmZmH/JNj4YqjIta&#xA;/MGz/vZrxKf7/iLf8nFPjiqOtvPvmlNpJY5SNjzjUH/heOKprb/mHqx/vrWBv9Tmv6y2NqmMHn0N&#xA;T1bEr7rJX8CoxtUfF5y05/tRTIfkpH/EsKouPzHpL/7tK/6yt/AHFUSmqac/2bhPpPH9dMVV0mhf&#xA;7Eit8iDiq/FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXnHm2NNZuri01DlLaRyM&#xA;i2/N1j+BqAlVIBPucyYRADWSxuLyPo8H+8Ml3YeBtrmVKfezZKkIyLSvMtuP9D81aolOn1iRbkf8&#xA;OMHAFsouK+/M63/u9ftr2nQXVmkf3mEg4PDCeIoqPzh+Z0H9/p2lXoHa3kmhY/8AIzkK5HwgnjRK&#xA;fmX5ki/3u8o3CgdWtbmG4r7haIfoweEvGqH81vLzgDUtF1S07E3FlyX6Cheo3yJxFPEHRef/AMpL&#xA;s8TdW0Un7SzW8kDA7dSyJ+vI+GU8QTK2k/Lm+p9Uv7KRj2iulLf8Dz/hg4Sto8eVNJdQ8MknE9Cr&#xA;Ky/qwJWnypEPsXBH+stf1EYq1/hudfsyofnUf1xV36EvF7K3yP8AWmKr0sb2PorD/VP9DiqqpvU6&#xA;tIPnX+OKqyXVyOrV+YGKqy3U3cA4qqLct3XFV4mB7HFVwkU4q3yGKt1GKuxV2KuxV2KuxV2KuxV2&#xA;KuxV2KvPNTH+5O7/AOM8n/EzmVHkGo80PJJHDE8sh4xxqXdtzRVFSdskhi0H5u/lpJcPbHzDaQzR&#xA;sUdLhmgowNCKyhBkeIJosg0/zP5Z1Cn1DV7K8r09C4ilr/wDHDYRScKMKqijCqooxV0lrbzjjNEk&#xA;q+DqGH44qgJ/JvlS5/vtItCT1ZYUQ/eoB7Yqgx+WnlJWL2ttLZyHq9tcTRn/AInT8MaVVXyZfQb2&#xA;PmfWbfwR7n1ox16LIp8fHI8ATZVBZfmNbf7z+a1uFH2YrqxhPj1kQq2ROILxFeutfmtbfaTRr5B4&#xA;fWIJD/xJMHhBPGqJ5+87QbXnlL1VHWW1vYm+6N1VvxyPgp41VPzXt49r7y9rFqf2nFsJox0/aR/f&#xA;wweEU8StF+b/AJAchZ797SQ/7rubeeM9u/Ar38cj4ZTxBNbXzv5Hu6ehrVgzHopnjRv+BYq2DhK2&#xA;nEEllcJzt5ElT+aNgw/AnIpVfSXFXemMVb44q6mKt0xV2KuxV2KuxV2KuxV2KuxV2KvP9SH+5K7/&#xA;AOM0n/EzmVHkGo80v1Uf7ib3/jBL/wAQOSQ+O9KsbW78w+YBPCkwW4WgkUNSrP4j2zO7MxxkZ8QB&#xA;5fpdb2pklHhokc/0JlJ5T0OX7Vmg/wBWqf8AESM2UtDhP8IdbHXZh/EVW10F7Kn6N1G/06n2fqt1&#xA;JHT5bnKT2ZiPKx8W2PamUc6PwTi11z8yLL/eLzlqW3T60wu/Hr61a5VLsodJH726Pax6xCc2v5p/&#xA;nRaD/jsWOoEf8tVmkdev++AmVS7MyDlIFtj2tDrEpza/n/8AmfB/vb5f0u9p/wAss01vXr09Vpfb&#xA;/PpUdDmHQH4t0e0sJ6kfBObX/nJm4T/jpeS76Hx+qXEV14/5MXtlR0+Uc4n726OrwnlIfcnNp/zk&#xA;7+XbU+vWuraZ4/WrM0H/ACKeXKjY5gj4N0ZxlyIPxT2x/Pz8ob6gh8y26E/8tCTW/wDyeSPI+IGf&#xA;CWR2HnfybqVP0fr2n3ZPQQXUMh+5WOHiCKTbkCAQag7gjCqwnFVhOKqUiq6lXAZT1BFRiqWXPl3y&#xA;/cf3+m2sh8WhjJ++lcCpXN+X/lB25rp4ikHR4ZJIyO37DDFW18qyQf7w67q9mOyxXjlO/VW5V64O&#xA;EJtWWPz5bf7yea5io/YuraCevXYsQGyPhhPEVLUfO35l6HaNezfo/VrSD4rhRFJDMEHVhxbj89jT&#xA;wwHEF4i9D8o+Z7PzNoFtrFqhiScESQsQWjkQ8XUkddxse4yiQoswU2eRV64ErIZfUZh4Yqq4q7FX&#xA;Yq7FXYq7FXYq7FWBaiP9yV3/AMZpP+JHMuPINR5pfqw/3E3v/GCX/iBwofJHlSFpfMnmNVBZjcRh&#xA;VG5JLSbDNj2Tzn8P0uo7Y/g+P6Get5K80JCJm0i8EZ35ehJ08Tttm18aHeHT8Eu4sj8l/lTfeYLd&#xA;ry6n+oWauY1qnKV2XZqKSvEA7VP3ZRn1QgaG5bcWAy35JrrP5G6jBwbSbxLsMwV45h6TKCacuQLB&#xA;gOp6HwrlcNcD9QpnPSnoU6sPyL0NYF+v39zLPQcjB6caA9wA6yE5VLXyvYBmNIOpY35y/Ka40S0f&#xA;UNOnN5Yx7zo60ljH822zL49KZkYNWJmjsWnLpzEWOTBRb+2Zji2uFv7Yrad+WfJdvrH6RvLuwjub&#xA;CxsruSZ5VBAmFpM8FPcOgb6MxNVKIoGrJH3i3L0ombIuog/caYlN5L8tzfb06Ef6i+n/AMQ44ZaP&#xA;Ef4Qxjrsw/iKy38k6baNy02e805q1BtbmWM123+0fDKT2bh6Aj4t0e1cw5kH4Jpbf47sqfUPOmsI&#xA;F+ytzN9bUUptSUUptlR7Lj0kW+PbM+sQmdv50/Oizpw8yWuoKvRbyxiTYU2LQhWPTrlR7Mn0l9jd&#xA;HtmPWJ+aYwfm/wDm7bgC70jRtQA720k8DHp19QuK5UdBmH80t8e1sJ/nD4JhB+fnmGPbUvJFygH2&#xA;ns7yK4r7heKH6K5UdNmHOLdHX4Dykjov+ciPKYoL/SNa04/tNPZ1T6Gjd6j6MqMZDnGQ+DfHNjly&#xA;lE/FkflX81fIvmu+bT9E1L6xfqjSvavDPE4RSAx/eIq7ch0OQEgW2mUk5JUu14/7hNQ/5hpv+TZx&#xA;VF/84/8A/KCSf8xs3/EI8x8vNnHkza7uOMjivQ0ytku0mb1JJfYD+OKplirsVdirsVdirsVdirsV&#xA;YLqA/wByN1/xmk/4kcy48g1Hml+rD/cTe/8AMPL/AMQOFD5u/I3VtO0n8xtfvdQj526zKnqU5GJn&#xA;MoEgHt7ZlaGBlGYHl+l1nacxGUCfP9D6utrq2uoEntpVmhkFUkQhlI9iMBBBotAIO4VcCXYq7FVk&#xA;0Uc0TwyqHikUo6HoVYUIOINIIt5X5u/KyCwsZdQ0iV5I4AXntpaFgg3ZkYAdPA/fmywaziNSdfm0&#xA;vCLiwS20+a5njt4IzJPMwjijXcszGgA+ZzOlIAWXCiCTQ5l76fKUHl78uptLjANw9tdvdyj9uZ7O&#xA;YMfkv2R7DOc/MHJn4ulivdxB6n8sMWn4etG/fwl4NLYyQzPDItJI2KOPAqaHOijISAI6vLTBiSDz&#xA;DQt/bJMbXC39sUWuFv7Yra4W/tii1wt/bFbXC29sVtJfy1Xh+f8AqA/7VR/VDnO67+/Puet7K/xc&#xA;e8/e+gScoc9LtdP+4XUP+Yab/k2cVRv/ADj/AP8AKCyf8x03/EI8x8vNnHkyLU7jjdzCvRjlbJFe&#xA;WZfUluPYL+s4qn2KuxV2KuxV2KuxV2KuxVg9+P8Achdf8ZZP+JHMuPINR5oDVh/uIvv+YeX/AIgc&#xA;KHyl+XgDeZfNKftGeMj5BpR/HNh2UfVP4fpdL23yh8f0PTNL1LVtLk9TT7qS3JNSEPwn/WU/CfpG&#xA;baeOMuYdFDLKPIst0/8ANHXYQFvLeG7UdWFYnP0iq/8AC5iy0UTyNOTHXSHMWntr+aekuALm0nhY&#xA;9eHGRR9NUP4ZRLQy6EN8dfHqCmcX5g+VXFWumjPg0Un/ABqrZWdJk7mwazH3qj+evKqUrfA1/ljl&#xA;P6lwDS5O5J1ePvQHmDzzoY0u4hs5vrVxPG0aIqsFHMFasWAFBXplmLSz4gTsGvNq4cJANlD/AJPe&#xA;UBJdN5gukrHATHYqe8lKPJ/sQaD3+WQ7U1NDwx15uR2NpLPinkOT0fzSFOkzK37UdwKHv/osuanB&#xA;9Xy+8O81P0/P/cl4l520f6vq5nVaR3I5f7Ndm/gc3fZebix8PWLzfbODgy8Q5S+9j4tvbNk6i1wt&#xA;vbFFrxbe2K2uFt7YotcLb2xW1wtvbFbYt5BXh/zkLqQ/7VX/ABrBnPa3+/Puew7J/wAWHvP3veSc&#xA;odgl+uH/AHDX/wDzDTf8mzgVH/8AOP8A/wAoLJ/zHTf8QjyjLzZx5I7WrjjqNyK9JG/XlbJMfJUv&#xA;qT3fsqfrOKsrxV2KuxV2KuxV2KuxV2KsKvx/p9z/AMZX/wCJHMuPINR5oDVx/uIvv+YeX/iBwofL&#xA;P5bxBvN/mgAdGhP3l8z+y/qn8HSdun0w+P6HpAtvbNy85a4W3titrhbe2KLXC29sVtcLb2xW0fou&#xA;hT6pqUFjCKNK1GfsqjdmPyGVZswxwMj0btNhllmIDq9+0uztrCxgsrVeEECBI19h3Puepzk8kzOR&#xA;keZe7xYxCIjHkEJ5oP8AuMY9aLOaf9Gs2W6Yer5f7oNGsNQ+f+5kwnzrpIuNPd1WskB9RfkPtfhl&#xA;3Z2bgyjuls4/a+DxMJI5x3/W8+Ft7Z0zxdrhbe2KLXC29sVtcLb2xRa4W3titrhbe2K2wbyavD/n&#xA;IvUx/wBqr/jWDOe1v9+fc9l2R/i0fefve5k5juyS/XD/ALhr/wD5h5f+IHFUx/5x/wD+UFk/5jpv&#xA;+IR5Rl5s48lLzDccdYvBXpK/68rZJz+XcvO4vvZY/wBbYqzbFXYq7FXYq7FWN65+YGhaLN6N3BqT&#xA;yVP9xpt9Mm3UiRITGfobFUnH55flkoH1jVJbM0BIurK9goGNBVpIVXr74qmNl+a/5Z3tBB5o0zk2&#xA;yrJdRRMTWlAshQ1xVLX1bSry8ne0vYLhWlYq0UqODyY0pxJ65lxOwaip6uP9xF9/zDy/8QOFD4/8&#xA;s+ZX0Lzb5glFuLhJnjV1LFCOPI7GjfqzP7L+qfw/S6rtfDxxiL7/AND0Gy/Mry7NQXMc1q3clQ6D&#xA;6VJb/hc3FvPS0cxy3T6y8yeWrugg1GAs3RXb02P+xficbaJYZjmE3jiR1DoQyHowNQfpGFqJVBbe&#xA;2KLXC29sVt6J5C0VbG1N9Kv+k3Q+CvVYuo/4Lr92c92lqeOXAOUfveu7F0fhw8SX1S+79rNYpM1j&#xA;u0H5hBfTmUbkpPQfO2lGZGm+r5f7oOHrfo+f+5kgtStQysCKgihGY4LlkW8wvdNNtdywU2Rjx/1T&#xA;uPwzrdPl8SAl3vnusw+FllDuP2dFIW3tlzjWuFt7Yra4W3tii1wtvbFbXC3xRbzfyyvD/nJDVB/2&#xA;qh/xCDOe1v8Afn3Pbdjf4tH3n73tZOUOzQGtn/cNf/8AMPL/AMQOKpn/AM4//wDKCyf8x03/ABCP&#xA;KMvNnHklHmi4469fivSd/wBeVsk//KyXnc6j7JF+tsVehYq7FXYq7FWC+c/P11p17JpmmKgmjAE1&#xA;y45cWYVoi9KgHqa/LN52f2VHJDjmdjyDz/aXbEsU+CAFjmSxCLz75zjcsdUaUdkkht+P/CRo345n&#xA;y7GwnlYdfHt/MOYiURH+annKJv3w0+aMdP8AR5kcj3YTla/7HKZdhw6SLkQ9oZdYfahrr8xtOu2K&#xA;6t5O0y+U/akd1Yn/AJ5yW0nif28x5dhy6SDlQ7fxnnEoP/EP5P3D8b3yU9qT1e0WBYxua/3c0Dd+&#xA;y5jy7HzDlRcmHbOA8yR8E20tPyfvj6Gm6vLpUzjgLe6aSFCTtwrOFVya9FkOYuTR5sfOJczFq8WT&#xA;6ZBEX3/ON35c3yzvJDJbXtzQteWjCIllrxPA80PX+XIYNTPEbHVlm08cg3fOv5nflvqfkTzD+jLm&#xA;QXVpOnrWF6q8RJHUghl34up+0K+B750Ol1AyxsOl1GE45UWIcGzJpx7V7ae8tn5200kLfzRsyH7w&#xA;RjTE0eadWfnbzfa09PUpXA7TcZa/TIGOGmmWDGej0b8q/MXmjzPr62d3Fbvp1svq3twEZXC9EUUb&#xA;jV226dKntmJrdR4UL/iPJs0nZkMkxzoc30JbygAAdBnLvWphDL0xVR1i4iS2QO6rz9ZV5ECpFtKx&#xA;pX2UnMjTjc/D/dBxNZ9I+P8AuZIm8hqDmO5bBvNNiElS4A6/A36xm67Jzc4fF5f2h0/05B7j+j9K&#xA;Q8R4ZuXmG6DFXYq7FXYq8u09VX/nJMkAAtpZLEdz6dN/oGc/r/7/AOD2vYn+LD3l7UTmO7VL9bP+&#xA;4e//AOYeX/iBxVNv+cf/APlBZP8AmOm/4hHlGXmzjyYr5vnp5k1IeFxJ/wASytkyf8nped1qnskP&#xA;63xV6birsVdirsVeMz20V/58ntbmrRTahJE4BoePqlevyzsozMNKJR5iAP2PCzgMmsMZcjkI+1GX&#xA;UX5RfX7mx/xELK8tZXt54p5BGqSRsUZayotaMOoama6Gv1VAmAIP473az7L0hJAmYn8eSonkHQtR&#xA;FdI8y2l3y+wqGOSvh8Uch8R2yf8ALEo/XjI/Hua/5CifoyA/j3oK9/J/zKtTBPazDsObq33FKfjl&#xA;ke2sR5iQa5dhZhyMT+Pcx2//ACx88Q1P6NaVfGKSJ/wDcvwzIj2ngP8AF97TLsvUR/h+5i2seWtf&#xA;sIXk1DTLm3gGzySwuse9B9ojj3pl8M+Oe0ZA/Fplp8kN5RI+D0b/AJx/80Xcsep+Vbh2nWwRL3Su&#xA;bElIXYo8NTSipIoK+Aamc72ppxCdjkXp+zNQcmPfmFf/AJyY0KLUfJEGqKtZ9IuVbn4Q3FInH0v6&#xA;f3YOyclZeH+cPuT2nC8fF3F8uiD2zpeF57jXCDHhRxomw0ye+vbezgAM9zIsUYOw5OQoqfDfBMiM&#xA;TI8gyhciAOZfRHkHynfeTtBSK9tY1a6cyS3sc8TLI/QLuVpxXanzzl9dmjlnYlt8Xo9HilijRG/w&#xA;ZnbavY0HK4iU+BkT+BOa8ucnNrcI6hkYMp6EGoxVA+are4u7O3WCMyFDdFgu9A2nXUY+9nAzI08g&#xA;Cb8v90GjPEkCvP8A3JZVPHUZjt7FPOGl3d7ol7b2UhhvWiY2sgANJV+JPtAihYUPtl+ly+HkEujj&#xA;avTjLiMD1fNtv+ZHmy3bjMYZ2XZhLFxNRtvwKZ2vhAvDSwRTa2/Ne5G1zpyP4mOQr+DK368HgNZw&#xA;DvTS2/NDQ5Npre4hPjRXX8Gr+GROAsDhKaW/njyvPSl6EY/syK6U+kin45E4pdzA45Jnb6tpdzT6&#xA;veQy16BJFY/cDkTEhiQXnVl/60kP+2Uf+IZzuv8A7/4Padif4sPeXsxOY7tUs8xn/cBqf/MJP/yb&#xA;bFU8/wCcf/8AlBZP+Y6b/iEeUZebOPJgfnO6U+aNWodhdTL9KuQf1ZWyZd+SMvO81f2jh/W+KvWM&#xA;VdirsVdirx63/wDJjH/tqP8A8njnXy/xP/kn+h4iH+Pf8lD/ALpJfzN/KO2mn1LXNHM0l9LcS3F1&#xA;Zn956hkkLOYgByBBatN8wdHq9hGXKnY6zB6pEd5eRtpckbtHIhR0JDIwoQR1BBza260yZJcWnmPy&#xA;/aaZJBf3llLeQfWBHHNJHxQsRGRxK05IA2Y0eDITsDRcicp4xHcixaNsfzF/MS0p6WuXLU6etxn/&#xA;AOTqvkZaLCf4Qse0Mw5SLNm82a/5i/KXzLLrMyzTW0tqkbqixniZ4iahAB+GYkNPDFqYCPW/uLnH&#xA;UzzaWZl0I+8JD/zj+7f8rPvFBPE6LKSvYkXcFD+OPbPIfjvbexeR/Hc9N/M9Vvfy71qGShJtDKf9&#xA;aIiQfiuavQms8fe7LWi8Evc+ThBnacLx3G2IMPCjjR2i3A0/V7K+IJFtPHKwHUhGBI+7Ks+HjhKP&#xA;eC2Yc3BMS7i+pPL9/bXtirROlzZXKiqmjxup8Qf9vOGnAxNSFEPbwmJCwbBSvzB+V+o3BN35cuUh&#xA;Vqk2V0z8R/xjlUO1PZh9OQZMLvNF/NjQ3MiaTcSAH+8sZFmr/sI2L/euKo7yl+YPmfUNbXRNdtJr&#xA;Q+hdSLJdW728gZLaUBTyCDv4VxVUm/5yr8ssD6OmO38vO4Va/OiNiqEl/wCcm9DmH/HKAr/y9A/8&#xA;ysVSR9RPmS9nvLTQV+pytz9e5gi4JWnL9/Iijr4GuXw1OWP0ykPi0T02KXOMT8GMebYtFjmittPt&#xA;41mSpubiLmqsT0VFJpQeNKnOm7HyZskTKZuPIPNdrwxY5CMBUuZY+Ic3XC6XiXCHDwo4mxDjwrxI&#xA;j8uwV/OmxH/aql/4k+cn2wP8I/zQ9b2Ibwf5x/Q+gic1ztUs8xH/AHAan/zCz/8AJtsVT7/nH/8A&#xA;5QWT/mOm/wCIR5Rl5s48nl3nKenmrWh4X1yP+SzZWyZz+QknO91n2jg/4k+KvYsVdirsVdirxe3l&#xA;/wCQllf+1q4/5LnOvl/if/JP9DxUB/h3/JQ/7pkWq+fvL9rql3bStL6sE8kUlIyRyRyDvXxGarFp&#xA;JmAPkHYZ9ZAZJA95YtY6FY+ePPn1qKAppVuqPeuw4mTh0Bp/P9nxoMyMuU6fDR+o8mnTYhqc230D&#xA;n+PNM/zi0Fbi4S/jXe2CRsB0CMNvuOY3Zmajwn+K/m5nbGC4mY/hr5PMl072zePOcTLbWD0Pyj80&#xA;jpWe0P8AyXizAyf41j9x+4u20pvS5PfH7wlP/OPhr+aF5/2xJv8AqLt8p7Z+kfjvc/sbkfx3PRPM&#xA;nDVLfUNAEzW6XyTWAmXdoxMDFyG43XlXrmhgSJAh3cgCCDyeSX//ADjt5wglY6b5hingSpRbpFDN&#xA;4CiR/wDMz6c20O0M8f4r99Otn2bgl/DXuJY/eflX+bFh6kj6ZbXsCVp6D8Hb3Cq1yx/4HMqHbGUf&#xA;VGJ+Y/W4s+xcZ+mUh9v6khvbPzTpcfPVvLl7aqSeLAKVNPD1fRb/AIXMmHbcf4oke6j+pxJ9hz/h&#xA;kD77H60x8tfmhqnliRXsrq4sUc1e2ubaRoCSBUsGRogdvtA198OXU6PP9fP3G/mxxabW4Po5e8V8&#xA;nrvlr/nKPTbkpBqlrBPJtyl06dC3/Ih2/wCN8wZ9k4p/3WSJ8j+z9Tmx7Wyw/vcch5gfr/W9B038&#xA;3vIOpABdSFrKesV0rQkfNyPT/wCGzDy9k6iH8N+7f9rmYu19PP8Air37fsT2LVrC8j9SxuormPqG&#xA;hkWRafNScwJ45R+oEe9z4ZIyHpIPuSTUrDSZW5TWNtMwrRpIY3O/uynIM2O3clrY8ntLe3tSNy0U&#xA;MUZ271VRiFLz7zT5qWUsgnN1L2AYso+np92bfR9j5cpuQ4Yef6A6jW9sYsIqJ4p+X6SwWRXkkaRz&#xA;VmNSc7HFhjjiIx5B4zLnlkkZS5loQ5bwtfEuEOPCjibEOHhRxLPIi8fzssh/2qpf+JPnH9tf4z/m&#xA;h7PsE3p/84/oe+E5rHcJb5hP+4HUv+YWf/k22Ksg/wCcf/8AlBZP+Y6b/iEeUZebOPJ4952np5v1&#xA;weGoXQ/5LNlbJn//ADjxJzvtc9o7f/iUmKvbMVdirsVdirw5GCfmsUHQ6qT9LSkn9edYTej/AMz9&#xA;DxwjWt/5KfpQ3mLTjJ5k1Qhal7yegHcmVsOnNYo/1R9zhaw/v5j+mfvepeSdGh0XSUgAH1iU+pct&#xA;4uR9n5KNs5zWajxZ306PYdn6TwcQB+o7lvzBYR37XsTiqvGin6VOQjMw4ZDoWyWMZDOJ5EAPKH0l&#xA;opWjdaMhKn5jbOqhMSAI6vBZQYSMTzBpMtVg9D8pfM3astof+niLMOf+NY/cfuLt9Cb0mT3x+8MW&#xA;/wCcd2r+Z95/2xZv+ou3yrtn6R+O92nY3I/juZDLq1fOYh5f9LLhT/nvTNDHmHdnk9KJzLalhOKr&#xA;CcVS280LQryUzXenWtzKesk0Mbt97KTgVjGp/lB+XeoK/r6RHzf/AHYGckb12Vyyf8LgMQm2L3f/&#xA;ADjr5SWMjSr2806Rq1ZJCF/4GEwD78nCcofSSPcaa54oT+qIl7xaT3X5E+arVl/Q/mclRU8rpVqC&#xA;fD93K/8Aw+ZMe0NRHbjPxo/e4k+zNPI3wV7rH3IO48qfnhZMwjljvbdKklJ5IS3ypNIf+SeXR7Sl&#xA;/FDHL/NaJdkivTkyR/zkhvrnz1ArSa1oF+IgaeqJDID/AMjxBmdh7axx54+H+rX7HX5+wssuWTi/&#xA;rX+1L080aYF5XMN1aV/37byEf8FEJE/HM/H21p5cyY+8fqt12TsPUx5AS9x/XSKt9f0C4YLDqFuz&#xA;t0j9RQ9f9UkN+GZuPW4J8px+bg5NDnhzhL5JiFUio3GZQpxDbdBhRbqDFUJ5K/8AJ3WX/bKl/wCJ&#xA;PnGduf4z/mh7f2f/AMW/zj+h7wTmrd0lnmE/7gdS/wCYWb/k22Ksj/5x/wD+UFk/5jpv+IR5Rl5s&#xA;48nh/nqannPXx4ajd/8AJ98rZPRf+cbZOV/r3tFb/wDEpMVe64q7FXYq7FXgnq/8hh4/9ren/JXO&#xA;r/5B/wCZ+h5Gv8N/z/0oPyxH5hl/MnzPqmpXcv6Bs9UvorOJqNG0guZFUFqEoIwNgaVNPDNbqdRW&#xA;GMBzMRfup2uDRwOc5COUj87ewadqEUqgxurjxUg/qzTO5Rdm81xe6gjxlYkEPpSUNH5KeW/scskf&#xA;SPi1QjU5Hvp5b+Z/mC18q6pbyXdpPJbXysVmgCmkkdAykMydip6+Phm97KyccDHrF5jtrQnxeMfx&#xA;feEDN5o0zXfyg81S2PqAQS2YkWVeJBa5jp0J8MuyxI1OP3S+5jooGOmyA98fvSP/AJxxav5m3v8A&#xA;2xZv+oq3zH7Z+kfjvdn2PyP47kJp+sCb80rMdBJrkQ4/612Ns0Du3089rbP9uJT70FcIkUUh5NHs&#xA;X6IUP+ST/GuTGQo4QhZPL0Z/u5mX/WAP6qZIZkcCFl8vXg+w6OPmQf1ZIZQjhQcukaknWBiP8mjf&#xA;qrkhMI4SgpYpozSRGQ/5QI/XkrVRJxQsJxSsJxVA3ul6XekG9s4LkqKKZo0kIHWg5A4FSDUvy28j&#xA;6gzPdaTCzMCNuSqK+CA8PwxpWMXP5C+TBzksHubC4avGSF/TC19oRCT/AMFhgTHeJI92zGeOMxUg&#xA;D790qufyV162SmleZZmY9RcgMo/5GLcN+OZcO0dRHlM/Hf77cLJ2Xpp84D4bfdSWXHkD80rSQRwt&#xA;Zakg6ykelX6fUX/k3mXDtzOOfDL4fqLhZPZ/TnkZR+P7FDyP5d85w/mnZ6vqmkta2i2ktrJKnqNG&#xA;p4u4YsyJ1bbNfrNSc+XjIranY6DRjT4+AG97e2E5Q5aW+YD/ALgtR/5hZv8Ak22Ksl/5x/8A+UFk&#xA;/wCY6b/iEeUZebOPJ4D5+mp538wjw1O8/wCoh8rZPS/+cY35ah5g9orb/iUmKvfcVdirsVdir59u&#xA;CI/zuEY2rqsZof8AKYN/HOoib0f+Y8rKNa3/AD1HSvP2n+X/ADn5m03V4Xawl1e+dZokEnH1Lh+S&#xA;uhK1X5fdlOXsqWXHCcDvwR2+DlY+1Y4sk4TG3Gd/iy6PR/y415/rPl7zRJp9y4qkMcyoeR7+jOBL&#xA;9AOajLoc2P6ol2uLXYcn0yCPutD8/adp9vBpfmqNZVLm6u7izWZ5V29IfE7U4/F88xHLYf5huvM8&#xA;UBPmDzGt1CjchFDaRW5Ygf78BJ79OJy3DinOVQBJ8mrNlhCNzIA80mtLwXX5V+e7kRrEjTacERQB&#xA;8IuV3PiT3OdCdNLDkwxkblUr+Tz0dTHNDNKIqPpr5of/AJxq5H8yb1/2To84B9xdW1f15R2x9I9/&#xA;63M7I6sM8oXM97+a2jtspfWoJGG9KC6Dkfhmgd0+z8VdirsVUbq9tLROdzMkSnpyIBPyHfCBapTN&#xA;5w0lDSISTHsVWg/4ah/DJjGWPEl9z+YFrBMI5bNzGy15KwJ60+yQP14fDXibTzd5Puv7+Mwk95It&#xA;/vj5YOGQWwrpH5PvP7i7jRj0Al4tv/kv/TDxSC0F0nlKCReVvdHiehKhgfpBGPio4UDN5R1JamN4&#xA;5B4VIP4in45IZQvCgJ9B1iL7Vq7f6lH/AOIk5LjCKKXzQzRGksbRnwYEfryVoUCcVWE4qsJxVYTg&#xA;VLfMB/3B6j/zCzf8mzirJ/8AnH//AJQWT/mOm/4hHlOXmzjyfOv5gy089+Yx4ape/wDUQ+VsnqH/&#xA;ADi0/LUPMX/GK2/4lJir6ExV2KuxV2KvnbzhfWmkfnkbu9kMVnBd2k8spVjRPRjZjRQSab9BnTaa&#xA;JnpKHOj95eZ1JENXZ5WPuD1xfMf5XeYGHqXelX0jUAS6EPM7U+zMA34ZpvD1OLlxx91/odwZ6bLz&#xA;4Je+v0qdz+VP5c6gnqDSYVDj4ZLZ3jHzURsF/DLYdq6mH8Xzpqn2Rpp/w/IlKpvyQ0FEppuqahYk&#xA;bqqyhkB/1eKn/hsyR23M/XCEvg4suwogeic4/H+xjmpf84/6m7c7XWo7hu31mN0I/wBkrS/qzPw+&#xA;0OMc8fD7q/Y6/N7O5TyycXvv9qXeYfJOseU/yj83xai0L/WXsGheBiwIS6jBryVSPtZDLr8eo1GM&#xA;wvbi5+5t03Z+TTYMgnW/Dy97H/8AnGILJ551B6/FFpkq07UkuLc9f+eeY3bB2Dn9kjmwD8rQz/mP&#xA;5c6s36QgJ7nZwSc0LuX2zirsVSfzRrb6VYBoqG5mbhFXcDapantkoRsoJefPcT3EplnkaWRursan&#xA;MgBrVosKoPVErKn+r/E4qEF6eBLvTxVUhluYDWCV4j4oxU/hjSoXRPOvmtfzJttJbUppNPlRjJby&#xA;UkB427uN3BYfEoOxwcAK8Reo/wCILyP7So49wQfwOA4gvGV6+aYD8NxbkKepUhvwNMicSeNHfo7R&#xA;L6JZhbxSI42dVAP3ihyuyGVBBz+TdEl+ykkP+o5/425YfEK8IS+fyDGd4Lxl8A6A/iCP1ZLxUcKW&#xA;XHkXWUqYmimHYBip/wCGAH45LxAjhSjVPJPme7sbmyitAJLiJ4g7yIEXmOPJmBOwrXYE4eMLRZh+&#xA;Xfk9vKflqPS5JxcXBkae4kUEJzegISu9AFA3ymUrLICnyh5zsNQ1L8yfMNlp9tLd3curXwjghQu7&#xA;f6Q/RVqcil9BfkR+WereT9MvrzWeMep6oYv9FVg3oxRciAzL8PNi5rStKDfrir1PFXYq7FXYq+f/&#xA;AM4vKrX/AJ8u5vW9D1LS3eM8eQZvjjqdxsPT7ZvtDqeDCAO8um1ejGTKST0DyLU7K+025NveJwfq&#xA;jjdHA7oe/wCsZtsWYTGzqc+mljO/JTs9Z1Oyk52F3PaydQ0EjxtX5oRk5xifqALVAyB9JLIbD85f&#xA;zH048YdcnlC7FbkJcdPEzK7fjmJLQ4J/wj4fscuOszw6n4/tZLp3/OTnnK2ot9Y2V6g6sFkhkP0q&#xA;zL/wmY0+yMZ5Ehyodq5BzALvPf8AzkFY+bPI+o6DJo8ljeXgh9OVZlmiBinjlNarGwqqHscjp+zT&#xA;iyCXFYH6mWftAZcZjVEoX/nGaRh5o191JDLpEhVhsQRKm4yvtc7Bu7LGxYl+T/8A5Mzy7/zFr/xE&#xA;5onbvtLFXYqwD84dRudM0nTtQWIy2cV16d6VFWVJEIVh4fEB+rLMXNjJjOm31pfW6XFrKssL9GX9&#xA;RHY+2XMEyiwqqtawzULipGwIOKtfoaFvsuy/MA/0xpVraBcfsOrexqDjSqL6LqCf7pLDxWjfqxpW&#xA;OaP5d1o/mdHqZtJEsLVD6tw44LVrdkAXlTkeTDphCHo02FUFNgVNPKF6V1GWxLbSRNOqf8Y2RSR/&#xA;yMGVZRsziy3KGbsVdirsVWTLI0ZWN/TY7c6ciPkDtXwriqV+X/KXl7QFl/RdmkM9wxe6uj8c8zse&#xA;TNLK1Xarb9aeGKpvirsVdirsVdiryP8AOS9stP8AMGmy3kywLe2zRwO+yloJCzgsdh/frmz0UTKB&#xA;roXC1GSMZC9rYDrmmWur6VJE3FjxMltNXZZADxYHw8fbMqEjE21TgJxo8kD5K0u2ttFt7oIDc3SC&#xA;WSWm9G3VQfADLdRlMpeTTpcIhHzKJ8xeXLPWbN0dVS8Vf9HuQPiVh0BPdT3H8crx5DE2G7JjExRe&#xA;aeW/Ld5reoPbkmCG3/3rkIqVNacAP5jQ5scmoEY33uqx6UykR3PStP8AKHl2yTjHZJK1N5JgJWP/&#xA;AAVQPozAlnnLq7OGnhHkEx/JzT7bS/OHnkWi8Rb6VyhHUL6iiQrTw5Zh66RMI25GmgIk0wX8j0Zv&#xA;zU0AKCT6spoPAW8hP4DNW5j7JxV2KqF/YWeoWc1lewrcWlwpSaFxVWU4gq8O8yfk95q8u3Umo+T7&#xA;iS6tD8RtQR66gfslT8EwHbv7ZfHIDzYGKR2X5l39jObTXNOZJozxl4AxyKR/NFJ3+kZYxZTp35ge&#xA;VLoAfXRA56pOrR0/2RHD8cKsksdR0+6ANrdRTg9PSdX/AOIk4qmcWFCKjxVfL0xVJ9S1fSrIE3l5&#xA;Bb07SyKh+4kYqwrXPzT8vWqsljyv5xsOAKR193YfqBwKyD8n9N8yX2oXfm3WkMEVzB9W023IKj0m&#xA;dZGdVO4UlFoT9r5ZRll0ZxD1TKmbsVdirsVdirsVdirsVdirsVdirxr/AJyh0V7nyZY6tGvJtMuw&#xA;sp/liuV4E/8AIxYx9ObXsnJw5CO8Ot7Tx3AHuL5jh1O9gRkguJYkcEOqOygg9QQDvm+NHmHSxJHI&#xA;vUvy/wBct7/RIrTkBdWQ9N467lAfgYDwpt8812ohUr73a6XJca6hks0sUMTzSsEijUs7saAKBUkn&#xA;KHJeY+WfP2kaU2oi5gmYXd09xE8QVjxf9lgzJ0zKniJAcKGeIJTW4/N7RFQ+hZ3LvTYP6aCvzDPl&#xA;fgFs/MjuTr8n9VmvNN/MbXbgqJH0WUsm9OTLMEUewEYXMLtAUAHK0kuKyo/8426W13+ZCXfGqada&#xA;TzluwLgQD7/VOatzX1firsVdirsVS/V/L+h6zF6WqWEF4gFF9ZFZl/1WPxL9BwgkLTBtV/IPyRdl&#xA;mszc6c56LFJ6iV91lDt/w2TGQseEMWvv+ccLxamw1uOTwSeBo/8AhkZ/1ZLxUcCBP5HfmRbMPquq&#xA;WxUElTHczoR4Egxr+GS8UI4Vh/Kn84ASBfsQO4vn3/HHxQvCVT/lSX5l3TEXWq2/E05NLczvXt09&#xA;Nq4+KF4Ux07/AJxwlJDalrSqNuUdtCWJ8aO7LT/gcicqeFnXlz8oPI+husyWZvrpN1uL0iUg9ahK&#xA;LGPnxrkDMlkIhmmQS7FXYq7FXYq7FXYq7FXYq7FXYq7FUPqGn2Oo2U1jfwJc2dwpjnglUMjqeoIO&#xA;GMjE2OaJRBFF4r5m/wCcVvLl5M8/l/VJtK5GotZl+swj2QlkkUf6zNmzx9qSH1C3X5Ozon6TTAr/&#xA;AP5xq/NLSJvrOj3Npeun901tO0E30iVY1H/B5kjtLHLY2HHOgyR3DE/NPlb85YYWg1vStTe2TdzH&#xA;EZYdt/ie3DIfpOXQzYjyIYTx5eUgWAziWGRopkaORdmRwVYfMHLuJp4W7Gy1DUbpLTT7aW8upDSO&#xA;CBGkkY+yqCTkJTA5tkYE8numneS9Y8h/k9q6apbsnmPzhPbWVnpyjnMsMbGQgotTyYF6qP8AJrvt&#xA;ml1mcTIA5B22mxGEd3p/5BflvqPlPRbu/wBYiEGq6oyf6OaFooIwSqtTozMxLD5d8w3Ieq4q7FXY&#xA;q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FVG6srO7ThdQR3&#xA;CbjjKiuN+uzA+GEEhBFrbPTtPslZbO1htlY1YQxrGCffiBiSTzUABT/RNidS/SUkYlvVX04ZpPiM&#xA;SH7SxV2Tl+1Tdu/QUCUZirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdi&#xA;rsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir&#xA;sVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirs&#xA;VdirsVdir//Z</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<rect i:knockout="Off" fill="none" width="352" height="286"/> 
+				<g>
+					<g>
+						<path i:knockout="Off" fill="#565D6F" d="M138.754,207.178l109.78,8.616c0,0,0,4.846,0,6.407
+							c0,10.771-24.629,17.813-55.008,15.736c-30.383-2.089-55.012-12.511-55.012-23.281
+							C138.515,212.16,138.754,207.178,138.754,207.178z"/>
+						
+							<linearGradient id="XMLID_25_" gradientUnits="userSpaceOnUse" x1="-607.6221" y1="265.626" x2="-497.6025" y2="265.626" gradientTransform="matrix(1 0.0685 0 1 746.1367 -15.7498)">
+							<stop  offset="0.0056" style="stop-color:#ADB2C2"/>
+							<stop  offset="0.6517" style="stop-color:#DDE5FA"/>
+							<stop  offset="1" style="stop-color:#BBC2D4"/>
+							<a:midPointStop  offset="0.0056" style="stop-color:#ADB2C2"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#ADB2C2"/>
+							<a:midPointStop  offset="0.6517" style="stop-color:#DDE5FA"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#DDE5FA"/>
+							<a:midPointStop  offset="1" style="stop-color:#BBC2D4"/>
+						</linearGradient>
+						<path i:knockout="Off" fill="url(#XMLID_25_)" d="M248.534,215.794c0,10.78-24.629,17.824-55.008,15.735
+							c-30.383-2.078-55.012-12.493-55.012-23.274c0-10.77,24.629-17.819,55.012-15.741
+							C223.905,194.603,248.534,205.024,248.534,215.794z"/>
+						<g>
+							
+								<linearGradient id="XMLID_26_" gradientUnits="userSpaceOnUse" x1="-555.166" y1="183.543" x2="-555.166" y2="233.7756" gradientTransform="matrix(1 0 0 1 746.1367 0)">
+								<stop  offset="0.0056" style="stop-color:#9DA1B0"/>
+								<stop  offset="1" style="stop-color:#BBC2D4"/>
+								<a:midPointStop  offset="0.0056" style="stop-color:#9DA1B0"/>
+								<a:midPointStop  offset="0.5" style="stop-color:#9DA1B0"/>
+								<a:midPointStop  offset="1" style="stop-color:#BBC2D4"/>
+							</linearGradient>
+							<polygon i:knockout="Off" fill="url(#XMLID_26_)" points="169.708,187.189 169.708,211.355 212.232,218.954 212.124,194.618 
+								"/>
+							<polygon i:knockout="Off" fill="#565D6F" points="216.834,192.529 212.124,194.618 212.232,218.954 217.046,216.469 "/>
+						</g>
+					</g>
+					<g>
+						
+							<linearGradient id="XMLID_27_" gradientUnits="userSpaceOnUse" x1="710.7461" y1="-33.4839" x2="572.9243" y2="204.4626" gradientTransform="matrix(-1 0.0211 0 1 872.0371 0.2321)">
+							<stop  offset="0" style="stop-color:#6E6E6A"/>
+							<stop  offset="0.0364" style="stop-color:#848480"/>
+							<stop  offset="0.1092" style="stop-color:#A9A9A7"/>
+							<stop  offset="0.1848" style="stop-color:#C8C8C7"/>
+							<stop  offset="0.2628" style="stop-color:#E0E0E0"/>
+							<stop  offset="0.3442" style="stop-color:#F2F2F1"/>
+							<stop  offset="0.4312" style="stop-color:#FCFCFC"/>
+							<stop  offset="0.5337" style="stop-color:#FFFFFF"/>
+							<stop  offset="0.623" style="stop-color:#D0D0D0"/>
+							<stop  offset="0.7542" style="stop-color:#929292"/>
+							<stop  offset="0.8653" style="stop-color:#646464"/>
+							<stop  offset="0.9507" style="stop-color:#484848"/>
+							<stop  offset="1" style="stop-color:#3D3D3D"/>
+							<a:midPointStop  offset="0" style="stop-color:#6E6E6A"/>
+							<a:midPointStop  offset="0.2605" style="stop-color:#6E6E6A"/>
+							<a:midPointStop  offset="0.5337" style="stop-color:#FFFFFF"/>
+							<a:midPointStop  offset="0.4138" style="stop-color:#FFFFFF"/>
+							<a:midPointStop  offset="1" style="stop-color:#3D3D3D"/>
+						</linearGradient>
+						<path fill="url(#XMLID_27_)" d="M65.23,26.235c0,0,15.17-3.443,17.178-3.895c2.604-0.588,7.517-1.828,10.317-1.513
+							l222.55,23.509c5.266,0.582,9.563,5.467,9.557,10.873l-0.021,143.079c0,2.697-1.078,4.972-2.808,6.462
+							c-1.73,1.496-16.983,9.193-16.983,9.193L65.23,26.235z"/>
+						<g i:knockout="Off">
+							<path i:knockout="Off" fill="#FFFFFF" d="M68.424,175.353c-4.585-0.778-8.35-5.341-8.35-10.144V33.714
+								c0-4.809,3.785-8.321,8.42-7.815l232.41,25.7c4.753,0.528,8.643,4.95,8.637,9.823l-0.311,145.636
+								c-0.01,4.88-3.889,8.226-8.609,7.431L68.424,175.353z"/>
+						</g>
+					</g>
+					<path i:knockout="Off" fill="#565D6F" d="M293.396,59.284c-1.821-0.275-198.563-23.932-216.419-26.343
+						c-1.216-0.077-2.169,0.313-2.661,0.556s-4.966,2.646-4.966,2.646l223.224,170.189l5.049-1.918c0,0,2.861-1.343,2.861-3.775
+						c0-2.176,0-109.841,0-133.349C300.484,64.512,299.141,60.155,293.396,59.284z"/>
+					<g i:knockout="Off">
+						
+							<linearGradient id="XMLID_28_" gradientUnits="userSpaceOnUse" x1="576.2344" y1="192.5801" x2="799.922" y2="17.1336" gradientTransform="matrix(-1 0.0183 0 1 872.0371 0.0048)">
+							<stop  offset="0.0056" style="stop-color:#ADB2C2"/>
+							<stop  offset="0.6517" style="stop-color:#DDE5FA"/>
+							<stop  offset="1" style="stop-color:#BBC2D4"/>
+							<a:midPointStop  offset="0.0056" style="stop-color:#ADB2C2"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#ADB2C2"/>
+							<a:midPointStop  offset="0.6517" style="stop-color:#DDE5FA"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#DDE5FA"/>
+							<a:midPointStop  offset="1" style="stop-color:#BBC2D4"/>
+						</linearGradient>
+						<path i:knockout="Off" fill="url(#XMLID_28_)" d="M72.878,169.859c-3.023-0.507-5.493-3.433-5.493-6.495V40.171
+							c0-3.063,2.491-5.271,5.531-4.9l217.332,26.255c3.041,0.37,5.525,3.176,5.521,6.238l-0.299,134.072
+							c-0.006,3.063-2.48,5.151-5.505,4.646L72.878,169.859z"/>
+					</g>
+					<polygon i:knockout="Off" points="271.586,185.481 270.954,74.879 87.755,52.376 87.955,111.934 88.06,155.631 "/>
+					<polygon i:knockout="Off" fill="#565D6F" points="89.578,52.6 89.879,154.588 271.578,184.142 271.586,185.481 88.06,155.631 
+						87.755,52.376 "/>
+				</g>
+				<g>
+					
+						<linearGradient id="XMLID_29_" gradientUnits="userSpaceOnUse" x1="285.8027" y1="899.4316" x2="285.8027" y2="984.8441" gradientTransform="matrix(0.9196 -0.0931 -0.4005 -1.0133 282.4847 1064.7212)">
+						<stop  offset="0.0056" style="stop-color:#4FD2FF"/>
+						<stop  offset="0.6753" style="stop-color:#1871B1"/>
+						<stop  offset="0.9944" style="stop-color:#004890"/>
+						<a:midPointStop  offset="0.0056" style="stop-color:#4FD2FF"/>
+						<a:midPointStop  offset="0.4773" style="stop-color:#4FD2FF"/>
+						<a:midPointStop  offset="0.9944" style="stop-color:#004890"/>
+					</linearGradient>
+					<polygon i:knockout="Off" fill="url(#XMLID_29_)" points="267.428,180.688 94.016,152.686 93.729,56.053 266.832,77.162 "/>
+					
+						<linearGradient id="XMLID_30_" gradientUnits="userSpaceOnUse" x1="272.3018" y1="854.1563" x2="272.3018" y2="906.8079" gradientTransform="matrix(0.9196 -0.0931 -0.4005 -1.0133 282.4847 1064.7212)">
+						<stop  offset="0.0056" style="stop-color:#0087E9"/>
+						<stop  offset="0.5225" style="stop-color:#0062B7"/>
+						<stop  offset="1" style="stop-color:#003B7D"/>
+						<a:midPointStop  offset="0.0056" style="stop-color:#0087E9"/>
+						<a:midPointStop  offset="0.5" style="stop-color:#0087E9"/>
+						<a:midPointStop  offset="0.5225" style="stop-color:#0062B7"/>
+						<a:midPointStop  offset="0.5" style="stop-color:#0062B7"/>
+						<a:midPointStop  offset="1" style="stop-color:#003B7D"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_30_)" d="M93.807,114.47c17.327,6.64,173.543,29.086,173.543,29.086l0.078,37.586
+						L94.016,152.936L93.807,114.47z"/>
+					<path i:knockout="Off" fill="#BAEEFF" d="M101.075,86.85c11.253,6.611,43.453,11.195,50.376,8.831
+						c16.143,4.475,16.369-13.184,2.533-14.978c-4.524-14.263-20.596-11.545-23.726-5.782c-9.196-8.298-18.384-0.951-16.856,2.677
+						c-2.835-1.417-9.355-2.502-12.212-1.918C98.334,76.266,89.822,80.237,101.075,86.85z"/>
+					
+						<linearGradient id="XMLID_31_" gradientUnits="userSpaceOnUse" x1="783.6943" y1="-279.6216" x2="832.1451" y2="-223.586" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2048" style="stop-color:#FCFCFC"/>
+						<stop  offset="0.3396" style="stop-color:#F3F3F3"/>
+						<stop  offset="0.4542" style="stop-color:#E4E4E4"/>
+						<stop  offset="0.5575" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.6533" style="stop-color:#B4B4B4"/>
+						<stop  offset="0.7435" style="stop-color:#929292"/>
+						<stop  offset="0.8293" style="stop-color:#6A6A6A"/>
+						<stop  offset="0.9117" style="stop-color:#3B3B3B"/>
+						<stop  offset="0.9887" style="stop-color:#080808"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7853" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_31_)" d="M158.363,150.534c12.016,3.447,28.979,5.724,38.356,5.683
+						c9.351-0.064,22.594-0.172,29.649-10.086c-3.473,9.954-10.307,22.953-40.579,19.046c-14.783-2.258-34.682-7.592-38.791-11.043
+						C149.114,154.618,158.039,152.188,158.363,150.534z"/>
+					
+						<linearGradient id="XMLID_32_" gradientUnits="userSpaceOnUse" x1="762.9004" y1="-261.8945" x2="845.3633" y2="-261.8945" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2543" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4827" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.701" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9119" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#B8B8B8"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#B8B8B8"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_32_)" d="M141.887,140.042l16.44,10.755c9.799,2.95,26.442,5.887,38.748,6.004
+						c13.142,0.054,23.14-2.68,29.292-10.67C211.024,143.215,153.64,138.038,141.887,140.042z"/>
+					
+						<linearGradient id="XMLID_33_" gradientUnits="userSpaceOnUse" x1="807.2725" y1="-269.1001" x2="803.3225" y2="-253.925" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#B0B0B0"/>
+						<stop  offset="0.1732" style="stop-color:#ACACAC"/>
+						<stop  offset="0.3287" style="stop-color:#A1A1A1"/>
+						<stop  offset="0.4775" style="stop-color:#8F8F8F"/>
+						<stop  offset="0.6221" style="stop-color:#757575"/>
+						<stop  offset="0.7637" style="stop-color:#545454"/>
+						<stop  offset="0.9012" style="stop-color:#2C2C2C"/>
+						<stop  offset="1" style="stop-color:#0A0A0A"/>
+						<a:midPointStop  offset="0" style="stop-color:#B0B0B0"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#B0B0B0"/>
+						<a:midPointStop  offset="1" style="stop-color:#0A0A0A"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_33_)" d="M195.917,154.512c-12.007-0.217-28.166-3.62-35.323-5.432l-12.345-7.926
+						c9.771-1.008,62.688,3.114,75.747,5.609C217.931,152.91,207.769,154.683,195.917,154.512z"/>
+					<linearGradient id="XMLID_34_" gradientUnits="userSpaceOnUse" x1="184.9014" y1="108.4639" x2="93.298" y2="182.5674">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.0971" style="stop-color:#F9F9F9"/>
+						<stop  offset="0.2212" style="stop-color:#EAEAEA"/>
+						<stop  offset="0.36" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.5095" style="stop-color:#ABABAB"/>
+						<stop  offset="0.6676" style="stop-color:#7C7C7C"/>
+						<stop  offset="0.8331" style="stop-color:#424242"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.6554" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_34_)" d="M182.612,147.056l0.895-74.204c0,0-36.696,61.917-38.206,65.099
+						C161.604,139.461,182.612,147.056,182.612,147.056z"/>
+					
+						<linearGradient id="XMLID_35_" gradientUnits="userSpaceOnUse" x1="804.1924" y1="-284.895" x2="838.417" y2="-284.895" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2631" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4992" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.7251" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9432" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#BDBDBD"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#BDBDBD"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_35_)" d="M187.315,149.058c0.058-2.359-0.489-65.339-0.489-65.339l24.758,64.832
+						C211.584,148.551,193.701,147.998,187.315,149.058z"/>
+					<linearGradient id="XMLID_36_" gradientUnits="userSpaceOnUse" x1="165.7031" y1="143.6299" x2="112.9957" y2="154.4415">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.0971" style="stop-color:#F9F9F9"/>
+						<stop  offset="0.2212" style="stop-color:#EAEAEA"/>
+						<stop  offset="0.36" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.5095" style="stop-color:#ABABAB"/>
+						<stop  offset="0.6676" style="stop-color:#7C7C7C"/>
+						<stop  offset="0.8331" style="stop-color:#424242"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.6554" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_36_)" d="M141.887,140.042l16.44,10.755c0,0-3.17,6.167-10.992,3.373
+						C139.513,151.377,141.887,140.042,141.887,140.042z"/>
+					<linearGradient id="XMLID_37_" gradientUnits="userSpaceOnUse" x1="184.0098" y1="111.1172" x2="186.3672" y2="111.1172">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2631" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4992" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.7251" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9432" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#BDBDBD"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#BDBDBD"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_37_)" d="M184.01,153.379l0.261-84.94h1.113l0.983,85.357
+						C186.367,153.796,184.89,153.558,184.01,153.379z"/>
+				</g>
+				<g>
+					<g>
+						<path fill="#FFFFFF" d="M37.232,119.525c0,0,15.6,0.926,25.43,2.267c9.676,1.333,30.383,2.461,34.002,10.903
+							c4.293,10.015,3.928,40.496,2.804,62.674c-1.115,22.226,0,49.581-5.435,57.653c-5.489,8.162-16.234,5.828-35.164,2.395
+							c-19.572-3.563-27.699-4.11-31.076-11.213c-3.388-7.145-7.02-40.475-7.23-60.083c-0.207-19.626-0.425-56.304,5.325-60.732
+							C31.58,118.988,34.308,119.351,37.232,119.525z"/>
+					</g>
+					<g>
+						<g>
+							<linearGradient id="XMLID_38_" gradientUnits="userSpaceOnUse" x1="67.0791" y1="118.499" x2="88.3885" y2="196.3888">
+								<stop  offset="0" style="stop-color:#222221"/>
+								<stop  offset="0.1461" style="stop-color:#BFBFC0"/>
+								<stop  offset="0.1685" style="stop-color:#FFFFFF"/>
+								<stop  offset="0.3202" style="stop-color:#FFFFFF"/>
+								<stop  offset="0.5169" style="stop-color:#E9E9E9"/>
+								<stop  offset="0.5615" style="stop-color:#D7D7D7"/>
+								<stop  offset="0.775" style="stop-color:#858585"/>
+								<stop  offset="0.9262" style="stop-color:#515151"/>
+								<stop  offset="1" style="stop-color:#3D3D3D"/>
+								<a:midPointStop  offset="0" style="stop-color:#222221"/>
+								<a:midPointStop  offset="0.5" style="stop-color:#222221"/>
+								<a:midPointStop  offset="0.1461" style="stop-color:#BFBFC0"/>
+								<a:midPointStop  offset="0.5" style="stop-color:#BFBFC0"/>
+								<a:midPointStop  offset="0.1685" style="stop-color:#FFFFFF"/>
+								<a:midPointStop  offset="0.5185" style="stop-color:#FFFFFF"/>
+								<a:midPointStop  offset="0.3202" style="stop-color:#FFFFFF"/>
+								<a:midPointStop  offset="0.5" style="stop-color:#FFFFFF"/>
+								<a:midPointStop  offset="0.5169" style="stop-color:#E9E9E9"/>
+								<a:midPointStop  offset="0.4535" style="stop-color:#E9E9E9"/>
+								<a:midPointStop  offset="1" style="stop-color:#3D3D3D"/>
+							</linearGradient>
+							<path i:knockout="Off" fill="url(#XMLID_38_)" d="M34.357,119.479c-0.197,0.022-0.414,0.048-0.612,0.079 M108.381,155.497
+								c-0.367-7.347-1.287-17.677-5.35-25.608c-4.091-7.998-25.598-8.543-33.609-9.406c-8.123-0.871-23.082-2.353-27.806-2.448
+								c-1.335-0.027-4.048,0.577-7.259,1.444c1.024-0.074,1.955-0.009,2.898,0.048c0,0,15.605,0.927,25.441,2.268
+								c9.672,1.332,30.377,2.462,33.995,10.903c4.298,10.014,3.929,40.495,2.813,62.672c-1.119,22.225,0,49.579-5.435,57.651
+								c-0.959,1.428-2.079,2.501-3.364,3.338c6.218-3.732,10.674-6.608,11.398-7.484c2.593-3.085,5.171-14.153,5.353-23.607
+								C107.649,216.071,109.196,171.814,108.381,155.497z"/>
+						</g>
+					</g>
+					<g>
+						<path fill="#183268" d="M91.463,134.754c-3.51-5.958-22.819-7.03-31.137-8.039c-8.393-1.003-22.503-2.427-24.33-2.528
+							c-1.547-0.085-4.04,0.614-4.756,0.831c-0.008,0-0.014,0-0.014,0c1.612-0.234,3.283-0.031,5.701,0.249
+							c0,0,18.096,1.745,29.084,3.367c10.12,1.492,20.754,2.201,23.626,7.086c3.074,5.243,2.649,7.954,2.649,13.584
+							c0,5.617,0,36.538,0.205,47.786c0.205,11.247-1.024,47.488-2.033,49.958c-0.742,1.772-3.095,3.888-5.959,5.199
+							c0,0,0,0,0.007-0.001l0.039,0.087c0,0,3.742-0.908,5.467-2.177c1.721-1.265,2.692-2.731,3.572-7.08
+							c0.266-1.337,0.843-29.903,1.024-46.283c0.168-16.351-0.041-44.412-0.041-49.62C94.568,142.045,94.342,139.605,91.463,134.754
+							z"/>
+					</g>
+					<g>
+						
+							<radialGradient id="XMLID_39_" cx="27.498" cy="134.0684" r="127.8748" fx="27.498" fy="134.0684" gradientUnits="userSpaceOnUse">
+							<stop  offset="0.1461" style="stop-color:#3CB5FF"/>
+							<stop  offset="0.7697" style="stop-color:#004A92"/>
+							<stop  offset="1" style="stop-color:#002B5D"/>
+							<a:midPointStop  offset="0.1461" style="stop-color:#3CB5FF"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#3CB5FF"/>
+							<a:midPointStop  offset="0.7697" style="stop-color:#004A92"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#004A92"/>
+							<a:midPointStop  offset="1" style="stop-color:#002B5D"/>
+						</radialGradient>
+						<path fill="url(#XMLID_39_)" d="M36.928,125.267c0,0,18.147,1.775,29.157,3.178c10.34,1.322,20.265,1.266,23.553,7.275
+							c3.266,5.976,2.649,7.954,2.649,13.584c0,5.617,0,36.538,0.205,47.786c0.205,11.247-1.024,47.488-2.033,49.958
+							c-1.031,2.472-5.186,5.648-9.529,6.299c-4.39,0.66-14.832-0.885-25.606-3.192c-10.968-2.361-20.378-3.252-24.292-7.732
+							c-4.238-4.85-7.093-45.628-7.093-57.991c0-12.354-1.146-47.012,0-51.229c1.147-4.208,1.764-5.964,4.911-7.489
+							C31.34,124.515,33.327,124.853,36.928,125.267z"/>
+					</g>
+					<g>
+						<polygon fill="#FFFFFF" points="31.377,135.368 85.042,142.343 85.042,215.361 31.51,205.995 "/>
+					</g>
+					<g>
+						<path fill="#889AC2" d="M71.314,237.038c-1.397-1.887-0.857-4.226-0.166-5.899c0.693-1.668,3.246-5.705,7.834-7.633
+							c3.816-1.612,8.107-2.976,9.679-1.918c2.54,1.711,2.663,5.674,2.474,8.087c-0.229,2.799-1.05,6.138-3.672,6.975
+							c-2.636,0.86-5.893,0.918-8.703,0.964C75.927,237.668,72.18,238.217,71.314,237.038z"/>
+					</g>
+					<path fill="#183268" d="M44.407,226.776c-0.443-1.991-1.72-4.049-3.803-6.224c-1.664-1.737-6.982-6.62-8.679-6.911
+						c-0.803-0.134-2.57,0.241-2.57,0.241s0.027,0.047,0.035,0.054c0.185-0.024,0.38-0.059,0.596-0.047
+						c2.301,0.208,7.933,5.229,9.397,6.946c1.462,1.718,2.781,2.615,3.454,4.637c0.695,2.143,1.126,2.946,0.635,5.015
+						c-0.184,0.733-0.427,1.12-0.75,1.358c1.056-0.216,1.365-0.642,1.633-1.159C44.652,230.108,44.693,228.039,44.407,226.776z
+						 M29.391,213.937L29.391,213.937L29.391,213.937L29.391,213.937z"/>
+					<g>
+						<path fill="#889AC2" d="M41.11,232.177c0,0-4.397-0.963-7.751-2.233c-3.373-1.269-4.452-1.489-5.543-3.222
+							c-1.079-1.74-1.226-4.523-0.948-7.313c0.269-2.793,0.808-5.725,3.118-5.519c2.301,0.208,7.933,5.229,9.397,6.946
+							c1.462,1.718,2.781,2.615,3.454,4.637c0.695,2.143,1.126,2.946,0.635,5.015C43.077,232.121,42.381,232.196,41.11,232.177z"/>
+					</g>
+					<path fill="#183268" d="M59.979,243.876v0.019c0,0,0.066-0.033,0.087-0.036c0.341-0.098,0.685-0.151,1.012-0.277
+						c-0.358,0.143-0.73,0.198-1.106,0.295C59.971,243.876,59.971,243.876,59.979,243.876z M67.807,229.232
+						c-2.202-7.979-9.314-9.963-10.485-10.042c-1.161-0.077-3.988,0.565-3.988,0.565l0.048,0.173
+						c4.938-0.893,10.316,2.533,12.596,8.321c2.028,5.153,0.951,10.563-2.279,13.587c1.088-0.656,2.115-1.324,2.646-1.824
+						C67.756,238.692,69.314,234.702,67.807,229.232z"/>
+					<g>
+						<path fill="#889AC2" d="M65.977,228.25c2.504,6.372,0.328,13.216-4.899,15.331c-5.268,2.135-11.663-1.331-14.256-7.784
+							c-2.6-6.487-0.332-13.435,5.025-15.483C57.154,218.291,63.461,221.855,65.977,228.25z"/>
+					</g>
+					<path i:knockout="Off" fill="#183268" d="M89.818,221.827c-1.274-0.583-2.793-0.662-2.793-0.662l-0.012,0.052
+						c-0.006,0-0.021,0-0.037,0c0.705-0.008,1.289,0.101,1.685,0.371c2.54,1.711,2.663,5.674,2.474,8.087
+						c-0.229,2.799-1.05,6.138-3.672,6.975c-0.407,0.139-0.834,0.214-1.262,0.317c0,0,0.014-0.001,0.017-0.001
+						c0.646-0.132,1.448-0.291,2.27-0.462c1.848-0.396,2.382-1.587,2.962-3.074C93.254,228.811,91.449,222.587,89.818,221.827z"/>
+				</g>
+				<g>
+					
+						<linearGradient id="XMLID_40_" gradientUnits="userSpaceOnUse" x1="134.2231" y1="863.5508" x2="134.2231" y2="905.4798" gradientTransform="matrix(0.9196 -0.0931 -0.4005 -1.0133 282.4847 1064.7212)">
+						<stop  offset="0.0056" style="stop-color:#4FD2FF"/>
+						<stop  offset="0.6753" style="stop-color:#1871B1"/>
+						<stop  offset="0.9944" style="stop-color:#004890"/>
+						<a:midPointStop  offset="0.0056" style="stop-color:#4FD2FF"/>
+						<a:midPointStop  offset="0.4773" style="stop-color:#4FD2FF"/>
+						<a:midPointStop  offset="0.9944" style="stop-color:#004890"/>
+					</linearGradient>
+					<polygon i:knockout="Off" fill="url(#XMLID_40_)" points="81.925,205.563 34.608,197.79 34.447,140.553 81.589,146.641 "/>
+					
+						<linearGradient id="XMLID_41_" gradientUnits="userSpaceOnUse" x1="126.606" y1="840.4346" x2="126.606" y2="860.4087" gradientTransform="matrix(0.9196 -0.0931 -0.4005 -1.0133 282.4847 1064.7212)">
+						<stop  offset="0.0056" style="stop-color:#0087E9"/>
+						<stop  offset="0.5225" style="stop-color:#0062B7"/>
+						<stop  offset="1" style="stop-color:#003B7D"/>
+						<a:midPointStop  offset="0.0056" style="stop-color:#0087E9"/>
+						<a:midPointStop  offset="0.5" style="stop-color:#0087E9"/>
+						<a:midPointStop  offset="0.5225" style="stop-color:#0062B7"/>
+						<a:midPointStop  offset="0.5" style="stop-color:#0062B7"/>
+						<a:midPointStop  offset="1" style="stop-color:#003B7D"/>
+					</linearGradient>
+					<polygon i:knockout="Off" fill="url(#XMLID_41_)" points="34.489,177.886 81.715,183.823 81.758,205.062 34.607,197.79 "/>
+					<path i:knockout="Off" fill="#BAEEFF" d="M42.022,152.599c-1.356-4.276-4.547-5.835-7.51-5.886v14.607
+						c2.764,0.181,4.981,0.115,6.078-0.259C49.712,163.59,49.841,153.611,42.022,152.599z"/>
+					
+						<linearGradient id="XMLID_42_" gradientUnits="userSpaceOnUse" x1="642.9775" y1="-262.3721" x2="668.2901" y2="-233.0969" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2048" style="stop-color:#FCFCFC"/>
+						<stop  offset="0.3396" style="stop-color:#F3F3F3"/>
+						<stop  offset="0.4542" style="stop-color:#E4E4E4"/>
+						<stop  offset="0.5575" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.6533" style="stop-color:#B4B4B4"/>
+						<stop  offset="0.7435" style="stop-color:#929292"/>
+						<stop  offset="0.8293" style="stop-color:#6A6A6A"/>
+						<stop  offset="0.9117" style="stop-color:#3B3B3B"/>
+						<stop  offset="0.9887" style="stop-color:#080808"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7853" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_42_)" d="M45.224,190.679c6.277,1.8,15.14,2.99,20.039,2.969
+						c4.885-0.035,11.803-0.089,15.488-5.269c-1.813,5.199-5.383,11.99-21.199,9.948c-7.722-1.179-18.117-3.965-20.266-5.769
+						C40.393,192.812,45.055,191.542,45.224,190.679z"/>
+					
+						<linearGradient id="XMLID_43_" gradientUnits="userSpaceOnUse" x1="632.1162" y1="-253.1104" x2="675.1953" y2="-253.1104" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2543" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4827" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.701" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9119" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#B8B8B8"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#B8B8B8"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_43_)" d="M36.617,185.197l8.588,5.619c5.12,1.539,13.814,3.074,20.242,3.137
+						c6.865,0.028,12.09-1.399,15.304-5.574C72.736,186.854,42.758,184.15,36.617,185.197z"/>
+					
+						<linearGradient id="XMLID_44_" gradientUnits="userSpaceOnUse" x1="655.2979" y1="-256.8745" x2="653.2343" y2="-248.9467" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#B0B0B0"/>
+						<stop  offset="0.1732" style="stop-color:#ACACAC"/>
+						<stop  offset="0.3287" style="stop-color:#A1A1A1"/>
+						<stop  offset="0.4775" style="stop-color:#8F8F8F"/>
+						<stop  offset="0.6221" style="stop-color:#757575"/>
+						<stop  offset="0.7637" style="stop-color:#545454"/>
+						<stop  offset="0.9012" style="stop-color:#2C2C2C"/>
+						<stop  offset="1" style="stop-color:#0A0A0A"/>
+						<a:midPointStop  offset="0" style="stop-color:#B0B0B0"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#B0B0B0"/>
+						<a:midPointStop  offset="1" style="stop-color:#0A0A0A"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_44_)" d="M64.844,192.757c-6.273-0.113-14.715-1.891-18.454-2.838l-6.448-4.141
+						c5.104-0.525,32.749,1.627,39.57,2.931C76.343,191.921,71.034,192.846,64.844,192.757z"/>
+					<linearGradient id="XMLID_45_" gradientUnits="userSpaceOnUse" x1="59.0879" y1="168.7012" x2="11.2345" y2="207.4127">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.0971" style="stop-color:#F9F9F9"/>
+						<stop  offset="0.2212" style="stop-color:#EAEAEA"/>
+						<stop  offset="0.36" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.5095" style="stop-color:#ABABAB"/>
+						<stop  offset="0.6676" style="stop-color:#7C7C7C"/>
+						<stop  offset="0.8331" style="stop-color:#424242"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.6554" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_45_)" d="M57.893,188.861l0.468-38.764L38.4,184.104
+						C43.614,184.718,57.893,188.861,57.893,188.861z"/>
+					
+						<linearGradient id="XMLID_46_" gradientUnits="userSpaceOnUse" x1="653.6865" y1="-264.9023" x2="671.3027" y2="-264.9023" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2631" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4992" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.7251" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9432" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#BDBDBD"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#BDBDBD"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_46_)" d="M60.349,189.907c0.015-1.313-0.254-33.635-0.254-33.635l12.934,33.371
+						C73.028,189.644,62.417,189.346,60.349,189.907z"/>
+					<linearGradient id="XMLID_47_" gradientUnits="userSpaceOnUse" x1="49.0576" y1="187.0713" x2="21.5249" y2="192.7189">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.0971" style="stop-color:#F9F9F9"/>
+						<stop  offset="0.2212" style="stop-color:#EAEAEA"/>
+						<stop  offset="0.36" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.5095" style="stop-color:#ABABAB"/>
+						<stop  offset="0.6676" style="stop-color:#7C7C7C"/>
+						<stop  offset="0.8331" style="stop-color:#424242"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.6554" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_47_)" d="M36.617,185.197l8.588,5.619c0,0-1.655,3.221-5.742,1.762
+						C35.377,191.119,36.617,185.197,36.617,185.197z"/>
+					<linearGradient id="XMLID_48_" gradientUnits="userSpaceOnUse" x1="58.623" y1="170.0869" x2="59.8535" y2="170.0869">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2631" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4992" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.7251" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9432" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#BDBDBD"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#BDBDBD"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_48_)" d="M58.623,192.165l0.135-44.373h0.582l0.514,44.59
+						C59.854,192.382,59.082,192.259,58.623,192.165z"/>
+				</g>
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_1.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="2.996" y="3.001" width="10.01" height="9.995"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_2.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="2.881" y="3.016" width="0.984" height="1"/>
+<rect x="4.881" y="3.016" width="0.984" height="1"/>
+<rect x="6.881" y="3.016" width="0.984" height="1"/>
+<rect x="8.881" y="3.016" width="0.984" height="1"/>
+<rect x="10.881" y="3.016" width="0.984" height="1"/>
+<rect x="3.881" y="4.016" width="0.984" height="1"/>
+<rect x="5.881" y="4.016" width="0.984" height="1"/>
+<rect x="7.881" y="4.016" width="0.984" height="1"/>
+<rect x="9.881" y="4.016" width="0.984" height="1"/>
+<rect x="11.881" y="4.016" width="0.984" height="1"/>
+<rect x="2.881" y="5.016" width="0.984" height="1"/>
+<rect x="4.881" y="5.016" width="0.984" height="1"/>
+<rect x="6.881" y="5.016" width="0.984" height="1"/>
+<rect x="8.881" y="5.016" width="0.984" height="1"/>
+<rect x="10.881" y="5.016" width="0.984" height="1"/>
+<rect x="3.881" y="6.016" width="0.984" height="1"/>
+<rect x="5.881" y="6.016" width="0.984" height="1"/>
+<rect x="7.881" y="6.016" width="0.984" height="1"/>
+<rect x="9.881" y="6.016" width="0.984" height="1"/>
+<rect x="11.881" y="6.016" width="0.984" height="1"/>
+<rect x="2.881" y="7.016" width="0.984" height="1"/>
+<rect x="4.881" y="7.016" width="0.984" height="1"/>
+<rect x="6.881" y="7.016" width="0.984" height="1"/>
+<rect x="8.881" y="7.016" width="0.984" height="1"/>
+<rect x="10.881" y="7.016" width="0.984" height="1"/>
+<rect x="3.881" y="8.016" width="0.984" height="1"/>
+<rect x="5.881" y="8.016" width="0.984" height="1"/>
+<rect x="7.881" y="8.016" width="0.984" height="1"/>
+<rect x="9.881" y="8.016" width="0.984" height="1"/>
+<rect x="11.881" y="8.016" width="0.984" height="1"/>
+<rect x="2.881" y="9.016" width="0.984" height="1"/>
+<rect x="4.881" y="9.016" width="0.984" height="1"/>
+<rect x="6.881" y="9.016" width="0.984" height="1"/>
+<rect x="8.881" y="9.016" width="0.984" height="1"/>
+<rect x="10.881" y="9.016" width="0.984" height="1"/>
+<rect x="3.881" y="10.016" width="0.984" height="1"/>
+<rect x="5.881" y="10.016" width="0.984" height="1"/>
+<rect x="7.881" y="10.016" width="0.984" height="1"/>
+<rect x="9.881" y="10.016" width="0.984" height="1"/>
+<rect x="11.881" y="10.016" width="0.984" height="1"/>
+<rect x="2.881" y="11.016" width="0.984" height="1"/>
+<rect x="4.881" y="11.016" width="0.984" height="1"/>
+<rect x="6.881" y="11.016" width="0.984" height="1"/>
+<rect x="8.881" y="11.016" width="0.984" height="1"/>
+<rect x="10.881" y="11.016" width="0.984" height="1"/>
+<rect x="3.881" y="12.016" width="0.984" height="1"/>
+<rect x="5.881" y="12.016" width="0.984" height="1"/>
+<rect x="7.881" y="12.016" width="0.984" height="1"/>
+<rect x="9.881" y="12.016" width="0.984" height="1"/>
+<rect x="11.881" y="12.016" width="0.984" height="1"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_3.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="3.009" y="3.023" width="0.984" height="1"/>
+	<rect x="5.009" y="3.023" width="0.984" height="1"/>
+	<rect x="7.009" y="3.023" width="0.984" height="1"/>
+	<rect x="9.009" y="3.023" width="0.984" height="1"/>
+	<rect x="11.009" y="3.023" width="0.984" height="1"/>
+	<rect x="4.009" y="4.023" width="0.984" height="1"/>
+	<rect x="6.009" y="4.023" width="0.984" height="1"/>
+	<rect x="8.009" y="4.023" width="0.984" height="1"/>
+	<rect x="10.009" y="4.023" width="0.984" height="1"/>
+	<rect x="12.009" y="4.023" width="0.984" height="1"/>
+	<rect x="3.009" y="5.023" width="0.984" height="1"/>
+	<rect x="5.009" y="5.023" width="0.984" height="1"/>
+	<rect x="7.009" y="5.023" width="0.984" height="1"/>
+	<rect x="9.009" y="5.023" width="0.984" height="1"/>
+	<rect x="11.009" y="5.023" width="0.984" height="1"/>
+	<rect x="4.009" y="6.023" width="0.984" height="1"/>
+	<rect x="10.009" y="6.023" width="0.984" height="1"/>
+	<rect x="12.009" y="6.023" width="0.984" height="1"/>
+	<rect x="3.009" y="7.023" width="0.984" height="1"/>
+	<rect x="5.009" y="7.023" width="0.984" height="1"/>
+	<rect x="11.009" y="7.023" width="0.984" height="1"/>
+	<rect x="4.009" y="8.023" width="0.984" height="1"/>
+	<rect x="10.009" y="8.023" width="0.984" height="1"/>
+	<rect x="12.009" y="8.023" width="0.984" height="1"/>
+	<rect x="3.009" y="9.023" width="0.984" height="1"/>
+	<rect x="5.009" y="9.023" width="0.984" height="1"/>
+	<rect x="11.009" y="9.023" width="0.984" height="1"/>
+	<rect x="4.009" y="10.023" width="0.984" height="1"/>
+	<rect x="6.009" y="10.023" width="0.984" height="1"/>
+	<rect x="8.009" y="10.023" width="0.984" height="1"/>
+	<rect x="10.009" y="10.023" width="0.984" height="1"/>
+	<rect x="12.009" y="10.023" width="0.984" height="1"/>
+	<rect x="3.009" y="11.023" width="0.984" height="1"/>
+	<rect x="5.009" y="11.023" width="0.984" height="1"/>
+	<rect x="7.009" y="11.023" width="0.984" height="1"/>
+	<rect x="9.009" y="11.023" width="0.984" height="1"/>
+	<rect x="11.009" y="11.023" width="0.984" height="1"/>
+	<rect x="4.009" y="12.023" width="0.984" height="1"/>
+	<rect x="6.009" y="12.023" width="0.984" height="1"/>
+	<rect x="8.009" y="12.023" width="0.984" height="1"/>
+	<rect x="10.009" y="12.023" width="0.984" height="1"/>
+	<rect x="12.009" y="12.023" width="0.984" height="1"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_4.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="3.006" y="2.989" width="0.984" height="1"/>
+	<rect x="5.005" y="2.989" width="0.984" height="1"/>
+	<rect x="7.005" y="2.989" width="0.984" height="1"/>
+	<rect x="9.005" y="2.989" width="0.984" height="1"/>
+	<rect x="11.005" y="2.989" width="0.984" height="1"/>
+	<rect x="12.005" y="3.989" width="0.984" height="1"/>
+	<rect x="3.006" y="4.989" width="0.984" height="1"/>
+	<rect x="12.005" y="5.989" width="0.984" height="1"/>
+	<rect x="3.006" y="6.989" width="0.984" height="1"/>
+	<rect x="12.005" y="7.989" width="0.984" height="1"/>
+	<rect x="3.006" y="8.989" width="0.984" height="1"/>
+	<rect x="12.005" y="9.989" width="0.984" height="1"/>
+	<rect x="3.006" y="10.989" width="0.984" height="1"/>
+	<rect x="4.005" y="11.989" width="0.984" height="1"/>
+	<rect x="6.005" y="11.989" width="0.984" height="1"/>
+	<rect x="8.005" y="11.989" width="0.984" height="1"/>
+	<rect x="10.005" y="11.989" width="0.984" height="1"/>
+	<rect x="12.005" y="11.989" width="0.984" height="1"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_5.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="12.993" y="22.001" width="1" height="0.984"/>
+<rect x="12.993" y="20.001" width="1" height="0.984"/>
+<rect x="12.993" y="18.001" width="1" height="0.984"/>
+<rect x="12.993" y="16.001" width="1" height="0.984"/>
+<rect x="12.993" y="14.001" width="1" height="0.984"/>
+<rect x="13.993" y="21.001" width="1" height="0.984"/>
+<rect x="13.993" y="19.001" width="1" height="0.984"/>
+<rect x="13.993" y="17.001" width="1" height="0.984"/>
+<rect x="13.993" y="15.001" width="1" height="0.984"/>
+<rect x="13.993" y="13.002" width="1" height="0.983"/>
+<rect x="14.993" y="22.001" width="1" height="0.984"/>
+<rect x="14.993" y="20.001" width="1" height="0.984"/>
+<rect x="14.993" y="18.001" width="1" height="0.984"/>
+<rect x="14.993" y="16.001" width="1" height="0.984"/>
+<rect x="14.993" y="14.001" width="1" height="0.984"/>
+<rect x="15.993" y="21.001" width="1" height="0.984"/>
+<rect x="15.993" y="19.001" width="1" height="0.984"/>
+<rect x="15.993" y="17.001" width="1" height="0.984"/>
+<rect x="15.993" y="15.001" width="1" height="0.984"/>
+<rect x="15.993" y="13.002" width="1" height="0.983"/>
+<rect x="16.993" y="22.001" width="1" height="0.984"/>
+<rect x="16.993" y="20.001" width="1" height="0.984"/>
+<rect x="16.993" y="18.001" width="1" height="0.984"/>
+<rect x="16.993" y="16.001" width="1" height="0.984"/>
+<rect x="16.993" y="14.001" width="1" height="0.984"/>
+<rect x="17.993" y="21.001" width="1" height="0.984"/>
+<rect x="17.993" y="19.001" width="1" height="0.984"/>
+<rect x="17.993" y="17.001" width="1" height="0.984"/>
+<rect x="17.993" y="15.001" width="1" height="0.984"/>
+<rect x="17.993" y="13.002" width="1" height="0.983"/>
+<rect x="18.993" y="22.001" width="1" height="0.984"/>
+<rect x="18.993" y="20.001" width="1" height="0.984"/>
+<rect x="18.993" y="18.001" width="1" height="0.984"/>
+<rect x="18.993" y="16.001" width="1" height="0.984"/>
+<rect x="18.993" y="14.001" width="1" height="0.984"/>
+<rect x="19.993" y="21.001" width="1" height="0.984"/>
+<rect x="19.993" y="19.001" width="1" height="0.984"/>
+<rect x="19.993" y="17.001" width="1" height="0.984"/>
+<rect x="19.993" y="15.001" width="1" height="0.984"/>
+<rect x="19.993" y="13.002" width="1" height="0.983"/>
+<rect x="20.993" y="22.001" width="1" height="0.984"/>
+<rect x="20.993" y="20.001" width="1" height="0.984"/>
+<rect x="20.993" y="18.001" width="1" height="0.984"/>
+<rect x="20.993" y="16.001" width="1" height="0.984"/>
+<rect x="20.993" y="14.001" width="1" height="0.984"/>
+<rect x="21.993" y="21.001" width="1" height="0.984"/>
+<rect x="21.993" y="19.001" width="1" height="0.984"/>
+<rect x="21.993" y="17.001" width="1" height="0.984"/>
+<rect x="21.993" y="15.001" width="1" height="0.984"/>
+<rect x="21.993" y="13.002" width="1" height="0.983"/>
+<g>
+	<rect x="2.997" y="2.975" width="0.984" height="1"/>
+	<rect x="4.997" y="2.975" width="0.984" height="1"/>
+	<rect x="6.997" y="2.975" width="0.984" height="1"/>
+	<rect x="8.996" y="2.975" width="0.984" height="1"/>
+	<rect x="10.996" y="2.975" width="0.984" height="1"/>
+	<rect x="11.996" y="3.975" width="0.984" height="1"/>
+	<rect x="2.997" y="4.975" width="0.984" height="1"/>
+	<rect x="11.996" y="5.975" width="0.984" height="1"/>
+	<rect x="2.997" y="6.975" width="0.984" height="1"/>
+	<rect x="11.996" y="7.975" width="0.984" height="1"/>
+	<rect x="2.997" y="8.975" width="0.984" height="1"/>
+	<rect x="11.996" y="9.975" width="0.984" height="1"/>
+	<rect x="2.997" y="10.975" width="0.984" height="1"/>
+	<rect x="3.997" y="11.974" width="0.984" height="1"/>
+	<rect x="5.997" y="11.974" width="0.984" height="1"/>
+	<rect x="7.997" y="11.974" width="0.984" height="1"/>
+	<rect x="9.996" y="11.974" width="0.984" height="1"/>
+	<rect x="11.996" y="11.974" width="0.984" height="1"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_6.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="13.001" y="22.007" width="1" height="0.984"/>
+	<rect x="13.001" y="20.007" width="1" height="0.984"/>
+	<rect x="13.001" y="18.007" width="1" height="0.984"/>
+	<rect x="13.001" y="16.007" width="1" height="0.984"/>
+	<rect x="13.001" y="14.007" width="1" height="0.984"/>
+	<rect x="14.001" y="21.007" width="1" height="0.984"/>
+	<rect x="14.001" y="19.007" width="1" height="0.984"/>
+	<rect x="14.001" y="17.007" width="1" height="0.984"/>
+	<rect x="14.001" y="15.007" width="1" height="0.984"/>
+	<rect x="14.001" y="13.008" width="1" height="0.983"/>
+	<rect x="15.001" y="22.007" width="1" height="0.984"/>
+	<rect x="15.001" y="20.007" width="1" height="0.984"/>
+	<rect x="15.001" y="18.007" width="1" height="0.984"/>
+	<rect x="15.001" y="16.007" width="1" height="0.984"/>
+	<rect x="15.001" y="14.007" width="1" height="0.984"/>
+	<rect x="16.001" y="21.007" width="1" height="0.984"/>
+	<rect x="16.001" y="19.007" width="1" height="0.984"/>
+	<rect x="16.001" y="17.007" width="1" height="0.984"/>
+	<rect x="16.001" y="15.007" width="1" height="0.984"/>
+	<rect x="16.001" y="13.008" width="1" height="0.983"/>
+	<rect x="17.001" y="22.007" width="1" height="0.984"/>
+	<rect x="17.001" y="20.007" width="1" height="0.984"/>
+	<rect x="17.001" y="18.007" width="1" height="0.984"/>
+	<rect x="17.001" y="16.007" width="1" height="0.984"/>
+	<rect x="17.001" y="14.007" width="1" height="0.984"/>
+	<rect x="18.001" y="21.007" width="1" height="0.984"/>
+	<rect x="18.001" y="19.007" width="1" height="0.984"/>
+	<rect x="18.001" y="17.007" width="1" height="0.984"/>
+	<rect x="18.001" y="15.007" width="1" height="0.984"/>
+	<rect x="18.001" y="13.008" width="1" height="0.983"/>
+	<rect x="19.001" y="22.007" width="1" height="0.984"/>
+	<rect x="19.001" y="20.007" width="1" height="0.984"/>
+	<rect x="19.001" y="18.007" width="1" height="0.984"/>
+	<rect x="19.001" y="16.007" width="1" height="0.984"/>
+	<rect x="19.001" y="14.007" width="1" height="0.984"/>
+	<rect x="20.001" y="21.007" width="1" height="0.984"/>
+	<rect x="20.001" y="19.007" width="1" height="0.984"/>
+	<rect x="20.001" y="17.007" width="1" height="0.984"/>
+	<rect x="20.001" y="15.007" width="1" height="0.984"/>
+	<rect x="20.001" y="13.008" width="1" height="0.983"/>
+	<rect x="21.001" y="22.007" width="1" height="0.984"/>
+	<rect x="21.001" y="20.007" width="1" height="0.984"/>
+	<rect x="21.001" y="18.007" width="1" height="0.984"/>
+	<rect x="21.001" y="16.007" width="1" height="0.984"/>
+	<rect x="21.001" y="14.007" width="1" height="0.984"/>
+	<rect x="22.001" y="21.007" width="1" height="0.984"/>
+	<rect x="22.001" y="19.007" width="1" height="0.984"/>
+	<rect x="22.001" y="17.007" width="1" height="0.984"/>
+	<rect x="22.001" y="15.007" width="1" height="0.984"/>
+	<rect x="22.001" y="13.008" width="1" height="0.983"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_7.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="13.009" y="22.001" width="1" height="0.984"/>
+	<rect x="13.009" y="20.001" width="1" height="0.984"/>
+	<rect x="13.009" y="18.001" width="1" height="0.984"/>
+	<rect x="13.009" y="16.001" width="1" height="0.984"/>
+	<rect x="13.009" y="14.001" width="1" height="0.984"/>
+	<rect x="14.009" y="21.001" width="1" height="0.984"/>
+	<rect x="14.009" y="19.001" width="1" height="0.984"/>
+	<rect x="14.009" y="17.001" width="1" height="0.984"/>
+	<rect x="14.009" y="15.001" width="1" height="0.984"/>
+	<rect x="14.009" y="13.002" width="1" height="0.983"/>
+	<rect x="15.009" y="22.001" width="1" height="0.984"/>
+	<rect x="15.009" y="20.001" width="1" height="0.984"/>
+	<rect x="15.009" y="18.001" width="1" height="0.984"/>
+	<rect x="15.009" y="16.001" width="1" height="0.984"/>
+	<rect x="15.009" y="14.001" width="1" height="0.984"/>
+	<rect x="16.009" y="21.001" width="1" height="0.984"/>
+	<rect x="16.009" y="15.001" width="1" height="0.984"/>
+	<rect x="16.009" y="13.002" width="1" height="0.983"/>
+	<rect x="17.009" y="22.001" width="1" height="0.984"/>
+	<rect x="17.009" y="20.001" width="1" height="0.984"/>
+	<rect x="17.009" y="14.001" width="1" height="0.984"/>
+	<rect x="18.009" y="21.001" width="1" height="0.984"/>
+	<rect x="18.009" y="15.001" width="1" height="0.984"/>
+	<rect x="18.009" y="13.002" width="1" height="0.983"/>
+	<rect x="19.009" y="22.001" width="1" height="0.984"/>
+	<rect x="19.009" y="20.001" width="1" height="0.984"/>
+	<rect x="19.009" y="14.001" width="1" height="0.984"/>
+	<rect x="20.009" y="21.001" width="1" height="0.984"/>
+	<rect x="20.009" y="19.001" width="1" height="0.984"/>
+	<rect x="20.009" y="17.001" width="1" height="0.984"/>
+	<rect x="20.009" y="15.001" width="1" height="0.984"/>
+	<rect x="20.009" y="13.002" width="1" height="0.983"/>
+	<rect x="21.009" y="22.001" width="1" height="0.984"/>
+	<rect x="21.009" y="20.001" width="1" height="0.984"/>
+	<rect x="21.009" y="18.001" width="1" height="0.984"/>
+	<rect x="21.009" y="16.001" width="1" height="0.984"/>
+	<rect x="21.009" y="14.001" width="1" height="0.984"/>
+	<rect x="22.009" y="21.001" width="1" height="0.984"/>
+	<rect x="22.009" y="19.001" width="1" height="0.984"/>
+	<rect x="22.009" y="17.001" width="1" height="0.984"/>
+	<rect x="22.009" y="15.001" width="1" height="0.984"/>
+	<rect x="22.009" y="13.002" width="1" height="0.983"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_8.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="12.995" y="22.003" width="1" height="0.984"/>
+	<rect x="12.995" y="20.003" width="1" height="0.984"/>
+	<rect x="12.995" y="18.003" width="1" height="0.984"/>
+	<rect x="12.995" y="16.003" width="1" height="0.984"/>
+	<rect x="12.995" y="14.003" width="1" height="0.984"/>
+	<rect x="13.995" y="13.004" width="1" height="0.983"/>
+	<rect x="14.995" y="22.003" width="1" height="0.984"/>
+	<rect x="15.995" y="13.004" width="1" height="0.983"/>
+	<rect x="16.995" y="22.003" width="1" height="0.984"/>
+	<rect x="17.995" y="13.004" width="1" height="0.983"/>
+	<rect x="18.995" y="22.003" width="1" height="0.984"/>
+	<rect x="19.995" y="13.004" width="1" height="0.983"/>
+	<rect x="20.995" y="22.003" width="1" height="0.984"/>
+	<rect x="21.995" y="21.003" width="1" height="0.984"/>
+	<rect x="21.995" y="19.003" width="1" height="0.984"/>
+	<rect x="21.995" y="17.003" width="1" height="0.984"/>
+	<rect x="21.995" y="15.003" width="1" height="0.984"/>
+	<rect x="21.995" y="13.004" width="1" height="0.983"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_9.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="13.005" y="13.013" width="10.01" height="9.994"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_folder_current.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,16 @@
+<?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="16" height="16" viewBox="0 0 16 16">
+<g>
+<g>
+<rect fill="none" width="16" height="16"/>
+<g>
+<polygon fill="#B3DDFF" points="10.402,4.131 6.354,3.284 5.024,3.942 9.648,4.907 "/>
+<polygon fill="#0046B7" points="13.457,4.148 11.439,12.235 9.931,7.926 8.687,8.514 8.689,8.519 10.929,13.004 12.401,12.131        14.363,3.54 13.476,4.152 "/>
+<polygon fill="#B3DDFF" points="11.788,2.996 10.878,3.63 10.888,3.632 13.457,4.148 13.476,4.152 14.382,3.527 "/>
+<polygon fill="#B3DDFF" points="8.701,8.506 9.907,7.926 4.704,6.779 2.961,6.395 1.652,6.792 5.243,7.673 "/>
+<polygon fill="#5AA7E0" points="8.687,8.514 9.931,7.926 11.439,12.235 13.457,4.148 10.888,3.632 9.648,4.907 5.024,3.942        4.704,6.779 9.907,7.926 8.701,8.506 1.617,6.783 1.628,6.799 1.63,6.802 4.314,10.893 10.908,12.965 "/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_folder_locked_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="408 310" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="26" height="26"
+	 viewBox="0 0 26 26" overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="&ns_vars;">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="284" x="408" width="26" height="26" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+  <pdf:Producer>Adobe PDF library 6.66</pdf:Producer>
+ </rdf:Description>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-08-31T13:44:30+03:00</xap:CreateDate>
+  <xap:ModifyDate>2005-08-31T12:00:58Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:MetadataDate>2005-08-31T13:44:30+03:00</xap:MetadataDate>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>256</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAEAAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7&#xA;FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F&#xA;XYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX&#xA;Yq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXY&#xA;q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq&#xA;7FXYq7FULeapptlT65dRW5P2RI6qT8gTU5Tl1OPH9chH3ltx4Zz+kEoX/FPlv/q5W/8AyMXKP5R0&#xA;/wDPj8238lm/my+Tv8U+W/8Aq5W//Ixcf5R0/wDPj81/JZv5svk7/FPlv/q5W/8AyMXH+UdP/Pj8&#xA;1/JZv5svk7/FPlv/AKuVv/yMXH+UdP8Az4/NfyWb+bL5O/xT5b/6uVv/AMjFx/lHT/z4/NfyWb+b&#xA;L5O/xT5b/wCrlb/8jFx/lHT/AM+PzX8lm/my+SJs9X0q9bjaXkM7fyRurN9wNcuxarFk+iUZe4tW&#xA;TBOH1RI+CLy9qdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVSvzPrB0j&#xA;Rbi9QAyqAsIPTm5oK/LrmF2hqvAwymOfT3uVo8Hi5BHo8Vurq4urh7i4kaWaQ8nkY1JOeeZMkpyM&#xA;pGyXsYQERQFAKWQZuxV2KuxV2KuxVtWZGDKSrKaqw2II8MIJG4QRb0TyN53nnnTStUcySPta3Lfa&#xA;J/kc969jnVdj9rykRiymyeR/QXn+0uzhEeJD4hn2dQ6J2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K&#xA;uxV2KuxV2KuxV2KuxV2KsW/Mn/lGH/4yx/rzS9v/AOLH3h2fZH9/8C8lzhnq3Yq7FXYq7FXYq7FX&#xA;YquikkikSWNisiEMjDqCDUHDGRBscwggEUXuOgarHquk218tA0q/vVH7Mg2cffnpGi1Iz4ozHXn7&#xA;+rxOqwHFkMe5MMymh2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxVi35k/8ow/&#xA;/GWP9eaXt/8AxY+8Oz7I/v8A4F5LnDPVuxV2KuxV2KuxV2KuxV2Ksr8jebU0eZ7S8J+oTty5Dcxv&#xA;05U8COubvsftMac8M/ol9hdV2lofFHFH6h9r1WCeGeJZoJFlicVR0IKkexGdtCcZC4mwXmJRMTR2&#xA;K/JMXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYqxb8yf+UYf/jNH+s5pe3/APFj&#xA;7w7Psj+/+BeS5wz1bsVdirsVdirsVdirsVdirh1xQmGn6tqVgSbO5kg5faCMQD8x0OWYtVlxfRIx&#xA;aMuCE/qAKbL5z8zHrfN/wKf805kHtrV/zz9n6nFPZ+H+b96qvnHzIet83/Ap/wA05We29X/PPyH6&#xA;mJ0GH+aqr5u8xH/j9b/gU/5pyB7c1n+qH5D9TE6DD/NVV816+f8Aj8b/AIFP6ZWe3dZ/qh+Q/UxO&#xA;hw/zVVfNOu97tv8AgU/pkD2/rf8AVD8h+pidFi/mqq+Ztb/5am+5f6ZWfaDW/wCqH5D9TE6LF/NV&#xA;F8yaz/y1N9y/0yB9odd/qh+Q/Ux/J4u5UHmLWP8AlpP3L/TIn2i13+qH5R/Uj8nj7l48w6t/y0n7&#xA;l/pkf9EWu/1Q/KP6kflMfc3/AIg1b/loP3L/AEwf6I9f/qh+Uf1I/KY+53+INW/5aD9y/wBMf9Ee&#xA;v/1Q/KP6l/KY+5afMOr/APLSfuX+mH/RFrv9UPyj+pP5TH3Ktp5q1GGUGdhPF+0pABp7EAZn6L2q&#xA;1WOf7w+JDqCAD8CGGTQwkNtizG2uIrmBJ4jyjkHJTnpem1EM2MZIG4yDppwMSQeYVMuYuxV2KuxV&#xA;2KuxVjnn7/lHn/4yx/rznfan/Ez/AFg5/Zv978HmgzzJ6BeuRQqDAhcMiheMCFQZFC8YELxkVXjA&#xA;xXjIqvGBivGRVUGBivGRVeMCF65FC8YELxkUKgwIXjIoXAYEOIxVacKVhySsk0An9HL7M1Pvz2D2&#xA;NJOgHlKX3ur1f1pjnVOM7FXYq7FXYq7FWOefv+Uef/jLH+vOd9qf8TP9YOf2b/e/B5oM8yegXrkU&#xA;KgwIXDIoXjAhUGRQvGBC8ZFV4wMV4yKrxgYrxkVVBgYrxkVXjAheuRQvXAheMihUGBC8ZFC8HAhx&#xA;OKrDhSsOFWSaB/xzx/rNnsHsZ/iA/rSdXq/rTHOrcZ2KuxV2KuxV2Ksc8/f8o8//ABlj/XnO+1P+&#xA;Jn+sHP7N/vfg80GeZPQLxkULxgQvGRQvGBC8ZFC8YELxgVUGRYrxgVeMiheMCF4yKF4yKF4wIXjI&#xA;oXjAhUByKFwOBC8HAhdXArq4qtJwqtJwpZLoH/HOH+s2ev8AsZ/iA/rSdXq/rTHOrcV2KuxV2Kux&#xA;V2Ksc8/f8o8//GWP9ec77U/4mf6wc/s3+9+DzQZ5k9AvGBC8ZFC8YELxkVXrgQvGRQvGBC8ZFC8Y&#xA;EJZ5l816B5Y0xtS1u7S0thsnLd5G/kjQfEzewzJ0ehy6mfBijxH7vf3NeTJGAsvDvMn/ADlTemV4&#xA;vLWkRxxA0S61BmdmHj6MTIFP+zOdvo/YmNXmmb7o/rP6g67J2gf4R82Jy/8AOSH5ovIGS7tolBqU&#xA;S2jIO/T4uR/HNrH2R0IH0yP+cWg63Im2jf8AOUvne1lX9J2NlqMH7QVXt5T8nVnQf8BmJqPYrSyH&#xA;olOB+Y/HxZR10xzAL278uvzl8o+d6W1o7WWrheT6bc0DkDqYnHwyAe2/iBnFdrez2o0Xql6sf84f&#xA;p7vu83NxaiM+XNnwOaFvXg4ELwcihcDgVcDgQurgQ6uKtE4UrScKWTeX/wDjnD/WbPXvY3/ER/Wk&#xA;6rV/WmWdW4rsVdirsVdirsVY55//AOUef/jLH+vOd9qf8TP9YOf2b/e/B5mM8yegXjAqoMiheMCF&#xA;wyKF64CheMiheMCF4wIUNU1Sz0rTLrU71/TtLOJ5538EQcjTxO2wyeDDLLMQjvKRoMJSERZfF3n7&#xA;z1q/nLX5dTvnZYAWWxtK1SCGuyD3/mbuc9l7L7Mx6PEIQ5/xHvP45PP5sxySspp+X35P+bPOoNzZ&#xA;IlnpStxfUbmoQkdVjUAtIR7beJzG7V7f0+i9MvVP+aP09zPDppZOXJ6jD/zida+mvreZXMn7RS0A&#xA;X6KzHOYl7cyvbFt/W/465f8AJ/mxrzh/zjL5q0i0lvdEvI9bhiBZ7dYzBc0G54R8pFens1T2GbHs&#xA;/wBssGWQjlicZPW7j89q+XxacmhlHcbvIbW6vLG8jubaR7a7tnDxSoSjo6GoII3BBzrpwjOJjIXE&#xA;/a4YJBfan5PfmAPOvk6DUJ+I1S1b6tqSLsPVQAiQDwkUhvnUds8Y7f7K/JakwH0S3j7u74cndafL&#xA;xxvqzkHNG3LwcCFwOBC4HArdcVdXFWicVWk4VZR5d/45o/12z172N/xEf1pOq1n1pnnVOK7FXYq7&#xA;FXYq7FWOef8A/lHn/wCMsf68532p/wATP9YOf2b/AHvweZjPMnoV4wIXjAheMiheMCF4yKF4wIXD&#xA;IoXrgQ8p/wCclNbksfIMVhExDapdxxSU2rFEDK3/AA6pnVex+mE9WZn+CJPxO33W4OvnUK7y+bfL&#xA;GiSa75j03R4yVa/uYoC46qrsAz/7FanPR9bqRgwzyH+GJLqMcOKQHe+6NM06y0zT7fT7GJYLO1jW&#xA;KCJeiogoBnh2bLLJMzkblI2XoYxAFBGA5SleDgQ+RP8AnIryxbaJ+Yks9qgS31eBb4ouyiVmZJaf&#xA;6zJzP+tnrXslrJZtGBLnjPD8OY++vg6bWQ4Z+9kH/OKWsSQebtV0ktSC+shPT/iy2kUL/wALM2YH&#xA;txpxLTwydYzr4SH7Az0MvUQ+ogc8wdmuBwKuBxQurgV3LFDuWKurilaThVlflz/jmL/rtnrnsb/i&#xA;I/rSdTrPrTPOqcV2KuxV2KuxV2Ksc8//APKOv/xlj/XnO+1H+Jn+sHP7N/vfg8yGeZvQrxkULxgQ&#xA;vGRQvGBC8YELwciheMCFwOBXhn/OVDN+jfLq1PEzXJK9iQsdP152/sSPXl90f0ur7S5ReX/kmqt+&#xA;aXl8MAR60hod9xC5B+g50/tGf8Bye4feHC0n94H2YDnjjvlwOBC8HAh81/8AOV3/ACkOhf8AMJL/&#xA;AMnc9I9h/wC5yf1h9zq+0PqDH/8AnGn/AMmhB/zCXP8AxEZn+2H+In+tFq0X94+uwc8lduuBwK2D&#xA;gQu5YFdyxQ7lirq4pWk4VZb5a/45i/67Z657Hf4iP60nUaz+8TTOpcV2KuxV2KuxV2Ksb/MD/lHX&#xA;/wCMsf68532o/wATP9YOf2b/AHvweZDPM3oV4wIXjAheMiheMCF4yKrgcCF4OBC8HIoeF/8AOVH/&#xA;ABz/AC7/AMZbr/iMedx7E/Xl90f0ur7S5ReY/kl/5NLQP+Msn/JiTOm9o/8AEcnuH+6Dh6T+8D7K&#xA;Bzx13y8HAhcDgQ+bP+crf+Ug0L/mEl/5OZ6P7D/3OT+sPudV2h9QY/8A841/+TPg/wCYS4/4iM2H&#xA;th/iJ/rRatF/ePrkHPJXcLgcCF1cCurirdcVdXFXVxVonFWXeWf+OWv+u2et+x3+Ij+tJ1Gt/vE1&#xA;zqXEdirsVdirsVdirG/zA/5R1/8AjLH+vOd9qP8AEz/WDn9m/wB78HmIzzR6FeMiq8YELwcCF4OR&#xA;QuBwIXg4ELwcih5z5z/PPy95T8wT6Je2F3PcQLGzSw+lwIkQOKcnU9D4Z0XZ3s1m1WEZYyiAb530&#xA;+DhZtbHHLhILx784/wA1dH8822lxafaXFq1i8zSG44UYShAOPBm/kzr/AGf7EyaKUzOUZcVcr6W6&#xA;/V6kZQKHJiP5f+ZLXy15x03XLuJ5reyd3kiipzIaNk25EDq3jm27V0ctTp54okAy7/e4+DIITEj0&#xA;e7j/AJyk8of9WnUPuh/6qZwv+grUfz4fb+p2X8ow7iuH/OU3lD/q06h90H/VTH/QTqP58Pt/Uv8A&#xA;KEO4t/8AQ1Hk/wD6tOofdB/1Uwf6CdR/Ph9v6kfyhDuLyj85vzK0rz3qenXenWs9qlnA8Ui3HCpL&#xA;PyqODNnVez3Y+TQwlGZEuI3s4eqzjIQQlv5UedbDyb5vj1u+gluLdIJYjHBx51kAAPxFRmT252dP&#xA;Wac4oEA2Dv5MNPlEJWXulj/zlD5RvL23tE0rUFe4kSJWYQ0BdgoJpJ75w+X2L1EImRnDYX1/U541&#xA;0SaovZgc41zW64q3XArdcVdXFWq4q1XCrMfK/wDxyl/12z1n2P8A8RH9aTp9b/eJtnUuI7FXYq7F&#xA;XYq7FWN/mD/yjr/8ZY/15zvtR/ih/rBz+zf734PMBnmj0S8YELwcCFwORQvBwIXg4ELwciq4HAh8&#xA;ofn/AP8Akz9R/wCMVt/yYTPVfZb/ABGPvl95dBr/AO9LzrOhcN2KuxV2KuxV2KuxVMfLv/KQaZ/z&#xA;Fwf8nFzH1f8Acz/qn7mUPqD74Bzwd6JdXArq4q3XFDq4q1XFLq4qzLyt/wAclf8AXbPWfZD/ABEf&#xA;1pOm1v8AeJvnUOI7FXYq7FXYq7FWNfmD/wAo4/8Axlj/AF5zvtR/ih/rB2HZv978HmAOeavQrwci&#xA;hcDgQvBwKvBwIXg5FC4HAhcDgQ+Uvz+/8mdqP/GK2/5MJnqnst/iMffL7y6DX/3pedZ0LhuxV2Ku&#xA;xV2KuxV2Kpj5d/5SDTP+YuD/AJOLmPq/7mf9U/cyh9Qfe1c8IejdXFW64FdXFXVxV1cVarhVmvlT&#xA;/jkL/rt+vPV/ZD/Eh/Wk6bXf3icZ1DhuxV2KuxV2KuxVjX5hf8o4/wDxlj/XnPe0/wDih/rB2HZv&#xA;978Hl4OeaPQrwcCrgcCF4OBC4HIoXg4ELgcCrwcCHyl+fv8A5M7Uf+MVt/yYXPU/Zf8AxKPvl95e&#xA;f1/96XnedC4bsVdirsVdirsVdiqYeXf+Ug0z/mLg/wCTi5j6v+6n/VP3MofUH3pXPCnpG64FdXFD&#xA;q4q6uKurirq4pZt5S/446/67/rz1f2R/xIf1pOl1394nOdO4bsVdirsVdirsVY1+Yf8Ayjj/APGW&#xA;P9ec97T/AOKH+sHYdmf3vweXA55q9EuBwIXg4ELgciq4HAheDgQvBwIXA4EPlT8/P/Jm6j/xitv+&#xA;TC56l7L/AOJR98vvLz+v/vS87zoXDdirsVdirsVdirsVTDy9/wAd/TP+YuD/AJOLmPq/7qf9U/cy&#xA;h9QfeNc8LeldXFW64FdyxV3LFXVxVquFWc+Uf+OMv/GR/wBeeq+yP+JD+tJ0mu/vE6zp3DdirsVd&#xA;irsVdirGfzE/5Rt/+Msf68572n/xQ/1g7Dsz+9+BeWg55s9EvBwKuByKFwOBC8HAhcDgVeDgQuBw&#xA;IfKv59/+TM1D/jFbf8mFz1L2X/xKPvl95ef1/wDen4PPM6BwnYq7FXYq7FXYq7FUw8vf8d/TP+Yu&#xA;D/k4uY+r/up/1T9zKH1B93Vzwx6Z1cVbrih1cVdXFXVxVquKWd+T/wDjjL/xkf8AXnqvsl/iQ/rS&#xA;dHr/AO8+Cd50zhuxV2KuxV2KuxVjP5if8o2//GWP9ec97T/4of6wdh2Z/e/AvLAc82ejXA4ELgcC&#xA;F4OBVwOBC4HAhcDgVeDgQ8c/Mj8ktf8ANXm261qzv7SCCdIlWOb1OYMcYQ14ow7Z2HZHtHi0unGK&#xA;UZEi+VdT73V6nQyyTMgQxj/oWfzZ/wBXSw++b/qnmy/0Y6f+ZP7P1uP/ACZPvDf/AELL5s/6uth9&#xA;83/VPH/Rlp/5k/s/Wv8AJk+8O/6Fk82f9XWw++b/AKp4/wCjLT/zJ/Z+tf5Mn3hv/oWPzb/1dbD7&#xA;5v8Aqng/0Zaf+ZP7P1o/k2feG/8AoWLzb/1dbD75v+qeP+jPT/zJ/Z+tf5Nn3h3/AELD5t/6uun/&#xA;AHzf9U8f9Gen/mT+z9a/ybPvDf8A0LB5t/6uun/fN/1Twf6M9P8AzJ/Z+tf5Nn3hE6Z/zjV5rtNS&#xA;tLp9UsGS3mjlZVM1SEcMQKx+2V5vbDBOEoiE9wR0/WmPZ0wQbD6Mrnnbt264q3XArq4odXFXVxS1&#xA;XCrPfJv/ABxV/wCMj/rz1P2S/wASH9aTo9f/AHnwTzOmcJ2KuxV2KuxV2KsY/MX/AJRp/wDjLH+v&#xA;Oe9pv8UP9YOw7M/vfgXlYOebvRrgcCrwcCFwOBC4HAq4HAhcDgQuBwKvBwIXA4ENg4FXA4ELgcCt&#xA;g4oXA4FbrgQ3XFW64FdXFW64odXFXVxV1cVariln/kz/AI4i/wDGR/156n7J/wCJD+tJ0Wv/ALz4&#xA;J7nSuE7FXYq7FXYq7FWMfmN/yjT/APGWP9ec/wC03+KH+sHYdmf33wLykHPN3pF4OBC4HAhcDgVc&#xA;DgQuBwIXA4FXA4ELgcCrgcCFwOBC4HArYOKGwcCrq4FbrihuuBW+WNK6uKt1wIdXFXVxV1cVarhS&#xA;9B8lf8cNf+Mj/rz1H2T/AMSH9aToe0P734J9nSuE7FXYq7FXYq7FUu8xaQNW0i4sqhXcViY9A6mq&#xA;/wBDmD2lo/zOCWPqeXv6N+mzeHMSeM3tjeWNy1tdxNDMnVGH4jxHuM8sz6eeKRhMcMg9VjyRmLib&#xA;CkDlDNcDgQuBwIXA4FXA4ELgcCFwOBVwOBC4HArYOBC4HFVwOBDdcCt1xQ3XArdcVdXArdcUOrir&#xA;q4q6uKuriqta2tzdzrBbRtLK3RV/WfAZfp9NkzTEMYMpFjOYiLOwen6Lpw07TYbWoLoKyMO7sanP&#xA;XuytCNLp44uo5+883nNRl8SZkjc2DS7FXYq7FXYq7FXYqpT2trcALcQpMo6CRQw/EHK8mGE9pAS9&#xA;4tlGZjyNKH6G0j/lht/+RSf0yn8jg/mQ/wBKGfjz/nH5t/ofSP8Alht/+RSf0x/I4P5kP9KF8ef8&#xA;4/N36H0n/lit/wDkUn9MfyOD+ZD/AEoXx5/zj83fojSf+WKD/kUn9MfyOD+ZD/ShfHn/ADj83foj&#xA;Sf8Alig/5FJ/TH8jg/mQ/wBKF8ef84/N36I0r/lig/5FJ/TH8jg/1OH+lC+NP+cfm3+idK/5YoP+&#xA;RSf0x/I4P9Th/pQvjT/nH5u/ROlf8scH/IpP6Y/kcH+pw/0oR40/5x+bv0Tpf/LHB/yLT+mP5DB/&#xA;qcP9KF8af84/N36K0v8A5Y4P+Raf0wfkMH+pw/0oXxp/zj83forS/wDljg/5Fp/TH8hg/wBTh/pQ&#xA;vjT7z83forTP+WOD/kWn9MfyGn/1OH+lH6l8afefm3+i9M/5ZIP+Raf0x/Iaf/U4f6UfqXxp95+b&#xA;v0Xpn/LJD/yLT+mP5DT/AOpw/wBKP1L40+8/N36L0z/lkh/5Fp/TH8hp/wDU4f6UfqXxp95+bv0X&#xA;pn/LJD/yLT+mP5DT/wCpw/0o/UvjT7z83fovTf8Alkh/5Fp/TH8hp/8AU4f6UfqXxp95+bv0Xpv/&#xA;ACyQ/wDItP6Y/kNP/qcP9KP1L40+8/N36M03/lkh/wCRaf0x/Iaf/U4f6UfqXxp95+bv0Zpv/LJD&#xA;/wAi0/pj+Q0/+pw/0o/UvjT7z83fozTf+WSH/kWn9MfyGn/1OH+lH6l8afefm79Gab/yyQ/8i0/p&#xA;j+Q0/wDqcP8ASj9S+NPvPzVYbe3hBEMSRg9Qihf1ZdjwwxioREfcKYykTzKplrF2KuxV2KuxV2Ku&#xA;xV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kux&#xA;V2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV&#xA;2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2&#xA;KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K&#xA;uxV2KuxV2Kv/2Q==</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/'>
+  <xapMM:DocumentID>uuid:613db75f-bcf9-4a78-b76d-0d89ef07a31b</xapMM:DocumentID>
+ </rdf:Description>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<rect i:knockout="Off" fill="none" width="26" height="26"/> 
+				<g i:knockout="Off">
+					<path i:knockout="Off" fill="#FFFFFF" d="M4,2.954c-1.103,0-2,0.897-2,2V21c0,1.103,0.897,2,2,2h18c1.103,0,2-0.897,2-2V7.682
+						l-0.159-0.78c-0.318-0.743-1.04-1.22-1.841-1.22h-9.728c-0.158,0-0.443-0.183-0.51-0.326l-0.417-0.91
+						c-0.392-0.851-1.392-1.491-2.327-1.491H4z"/>
+				</g>
+				<g i:knockout="Off">
+					<radialGradient id="XMLID_3_" cx="20.2725" cy="8.1089" r="32.5557" fx="20.2725" fy="8.1089" gradientUnits="userSpaceOnUse">
+						<stop  offset="0" style="stop-color:#FEF700"/>
+						<stop  offset="0.3006" style="stop-color:#F0CD00"/>
+						<stop  offset="0.7745" style="stop-color:#DB8F00"/>
+						<stop  offset="1" style="stop-color:#D37700"/>
+						<a:midPointStop  offset="0" style="stop-color:#FEF700"/>
+						<a:midPointStop  offset="0.4615" style="stop-color:#FEF700"/>
+						<a:midPointStop  offset="1" style="stop-color:#D37700"/>
+					</radialGradient>
+					<path i:knockout="Off" fill="url(#XMLID_3_)" d="M3,7.291V21c0,0.55,0.45,1,1,1h18c0.55,0,1-0.45,1-1V7.682
+						c0-0.139-0.029-0.271-0.08-0.391H3z"/>
+					<radialGradient id="XMLID_4_" cx="20.2031" cy="4.1396" r="9.5686" fx="20.2031" fy="4.1396" gradientUnits="userSpaceOnUse">
+						<stop  offset="0" style="stop-color:#FEF700"/>
+						<stop  offset="0.3534" style="stop-color:#F6D10A"/>
+						<stop  offset="1" style="stop-color:#E88F1C"/>
+						<a:midPointStop  offset="0" style="stop-color:#FEF700"/>
+						<a:midPointStop  offset="0.4859" style="stop-color:#FEF700"/>
+						<a:midPointStop  offset="1" style="stop-color:#E88F1C"/>
+					</radialGradient>
+					<path i:knockout="Off" fill="url(#XMLID_4_)" d="M22,6.682h-9.728c-0.55,0-1.188-0.409-1.418-0.908l-0.418-0.911
+						c-0.229-0.499-0.868-0.908-1.418-0.908H4c-0.55,0-1,0.45-1,1v2.337h19.92C22.767,6.934,22.411,6.682,22,6.682z"/>
+				</g>
+				<path i:knockout="Off" d="M15.986,14.316V12.52c0-1.507-0.818-2.52-2.432-2.52c-1.614,0-2.541,1.013-2.541,2.52v1.797H10v4.852
+					h7v-4.852H15.986z M12,12.52c0-0.998,0.485-1.599,1.555-1.599S15,11.521,15,12.52v1.797h-3V12.52z"/>
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_im_server.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,16 @@
+<?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="16" height="16" viewBox="0 0 16 16">
+<g>
+<g>
+<polygon fill="#5AA7E0" points="7.771,14.428 3.494,13.119 2.854,3.46 7.624,4.406 "/>
+<polygon fill="#0046B7" points="7.771,14.428 3.494,13.119 3.395,11.616 7.791,12.804 "/>
+<polygon fill="#B3DDFF" points="13.146,1.969 8.14,1.552 2.864,3.462 7.646,4.407 "/>
+<polygon fill="#0046B7" points="7.771,14.448 12.693,11.713 13.119,1.979 7.626,4.426 "/>
+<polygon fill="#0046B7" points="3.737,5.028 3.776,5.787 6.714,6.553 6.698,5.644 "/>
+<polygon fill="#0046B7" points="3.871,7.376 3.91,8.135 6.714,8.996 6.698,8.087 "/>
+<polygon fill="#0046B7" points="5.976,10.125 6.022,10.997 6.714,11.2 6.698,10.291 "/>
+</g>
+<rect fill-opacity="0" stroke-opacity="0" fill="none" width="16" height="16"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/data/cmsappwizard.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,590 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  resource description
+*
+*/
+
+
+
+//  RESOURCE IDENTIFIER
+NAME    MSAW // 4 letter ID
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <AvkonIcons.hrh>
+#include <data_caging_paths_strings.hrh>
+#include <appinfo.rh>
+#include <msappwizard.mbg> // animation frames
+#include <cmsappwizard.loc>
+
+//  RESOURCE DEFINITIONS
+
+// ---------------------------------------------------------------------------
+//    RSS_SIGNATURE
+// ---------------------------------------------------------------------------
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// TBUF
+// ---------------------------------------------------------------------------
+RESOURCE TBUF
+    {
+    buf = "";
+    }
+
+//----------------------------------------------------------------------------
+//    r_ms_softkeys_next_cancel_next
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE CBA r_ms_softkeys_next_cancel_next
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;},
+        CBA_BUTTON {id=EAknSoftkeyCancel; txt=text_softkey_cancel;},
+        CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;}
+        };
+    }
+
+//----------------------------------------------------------------------------
+//    r_ms_softkeys_next_back_next
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE CBA r_ms_softkeys_next_back_next
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back;},
+        CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;}
+        };
+    }
+
+//----------------------------------------------------------------------------
+//    r_ms_softkeys_done_back
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE CBA r_ms_softkeys_done_back
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyDone; txt=text_softkey_done;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back;},
+        CBA_BUTTON {id=EAknSoftkeyDone; txt=text_softkey_done;}
+        };
+    }
+
+//----------------------------------------------------------------------------
+//    r_ms_softkeys_next_back_select
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE CBA r_ms_softkeys_next_back_select
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back;}
+#ifndef __SERIES60_31__
+        ,
+        CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent;/* txt=text_softkey_done;*/}
+#endif
+        };
+    }
+
+// ---------------------------------------------------------------------------
+//    r_ms_wizard_info_dialog
+// ---------------------------------------------------------------------------
+RESOURCE DIALOG r_ms_wizard_info_dialog
+    {
+    flags = EGeneralQueryFlags |
+        EEikDialogFlagNoTitleBar |
+        EEikDialogFlagNoBorder |
+        EEikDialogFlagNoShadow;
+
+    buttons = r_ms_softkeys_next_cancel_next;
+
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                bmpfile = "";
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//    r_ms_wizard_multiselection_dialog
+//----------------------------------------------------------------------------
+
+RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_ms_wizard_multiselection_dialog
+    {
+    flags = EGeneralQueryFlags;
+
+    softkeys = r_ms_softkeys_next_back_select;
+
+    items =
+        {
+        AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSingleGraphicPopupMenuListBox;
+                listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST
+                    {
+                    };
+                heading = " ";
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//    r_ms_wizard_selection_dialog_8
+//    resource for wizard step 8
+//----------------------------------------------------------------------------
+
+RESOURCE AVKON_LIST_QUERY r_ms_wizard_selection_dialog_8
+    {
+    flags = EGeneralQueryFlags;
+    softkeys = r_ms_softkeys_next_back_next;
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    };
+                heading = " ";
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//    r_ms_wizard_wait_dialog
+//    resource for wizard wait dialog
+//----------------------------------------------------------------------------
+
+RESOURCE DIALOG r_ms_wizard_wait_dialog
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+        {
+                layout = EWaitLayout;
+                singular_label = qtn_mserv_wizard_searching_devices;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+            };
+        }
+        };
+    }
+
+
+//----------------------------------------------------------------------------
+// Animation for server selection
+//----------------------------------------------------------------------------
+//
+
+RESOURCE BMPANIM_DATA r_ms_animation_for_selection_dialog
+    {
+    frameinterval   = 300;
+    playmode        = EAknBitmapAnimationPlayModeCycle;
+    bmpfile         = ""APP_RESOURCE_DIR"\\msappwizard.mif";
+    frames          = r_ms_animation_for_selection_dialog_images;
+    }
+
+
+//----------------------------------------------------------------------------
+// Image frames for r_ms_ animation_for_selection_dialog_images
+//----------------------------------------------------------------------------
+//
+
+RESOURCE ARRAY r_ms_animation_for_selection_dialog_images
+    {
+    items=
+        {
+        BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_1 ;
+                       maskid=EMbmMsappwizardQgn_indi_upnp_search_1_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_2 ;
+                       maskid=EMbmMsappwizardQgn_indi_upnp_search_2_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_3 ;
+                       maskid=EMbmMsappwizardQgn_indi_upnp_search_3_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_4 ;
+                       maskid=EMbmMsappwizardQgn_indi_upnp_search_4_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_5 ;
+                       maskid=EMbmMsappwizardQgn_indi_upnp_search_5_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_6 ;
+                       maskid=EMbmMsappwizardQgn_indi_upnp_search_6_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_7 ;
+                       maskid=EMbmMsappwizardQgn_indi_upnp_search_7_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_8 ;
+                       maskid=EMbmMsappwizardQgn_indi_upnp_search_8_mask;},
+        BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_9 ;
+                       maskid=EMbmMsappwizardQgn_indi_upnp_search_9_mask;}
+        };
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_automatic_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_automatic_text
+    {
+    buf = qtn_mserv_wizard_automatic;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_manual_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_manual_text
+    {
+    buf = qtn_mserv_wizard_manually;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_1
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_1
+    {
+    buf = qtn_mserv_wizard_head_1;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_2
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_2
+    {
+    buf = qtn_mserv_wizard_head_from_home_1;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_3
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_3
+    {
+    buf = qtn_mserv_wizard_head_from_home_2;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_4
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_4
+    {
+    buf = qtn_mserv_wizard_head_source_devices_1;
+    }
+    
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_5
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_5
+    {
+    buf = qtn_mserv_wizard_head_source_devices_2;
+    }
+    
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_6
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_6
+    {
+    buf = qtn_mserv_wizard_head_2;
+    }    
+           
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_7
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_7
+    {
+    buf = qtn_mserv_wizard_head_3;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_8
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_8
+    {
+    buf = qtn_mserv_wizard_head_4;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_9
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_9
+    {
+    buf = qtn_mserv_wizard_head_5;
+    }
+    
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_9_2
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_9_2
+    {
+    buf = qtn_mserv_wizard_head_5;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_10
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_10
+    {
+    buf = qtn_mserv_wizard_head_8;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_11
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_11
+    {
+    buf = qtn_mserv_wizard_head_9;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_heading_step_12
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_heading_step_12
+    {
+    buf = qtn_mserv_wizard_head_10;
+    }
+        
+//----------------------------------------------------------------------------
+//
+//    r_ms_step_1_body_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_step_1_body_text
+    {
+    buf = qtn_mserv_wizard_1;
+    }
+
+    
+//----------------------------------------------------------------------------
+//
+//    r_ms_step_2_body_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_step_2_body_text
+    {
+    buf = qtn_mserv_wizard_from_home;
+    }
+    
+//----------------------------------------------------------------------------
+//
+//    r_ms_step_4_body_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_step_4_body_text
+    {
+    buf = qtn_mserv_wizard_source_devices;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_step_6_body_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_step_6_body_text
+    {
+    buf = qtn_mserv_wizard_2;
+    }
+    
+//----------------------------------------------------------------------------
+//
+//    r_ms_step_8_body_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_step_8_body_text
+    {
+    buf = qtn_mserv_wizard_4;
+    }    
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_step_9_2_body_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_step_9_2_body_text
+    {
+    buf = qtn_mserv_wizard_no_target_devices_found;
+    } 
+    
+//----------------------------------------------------------------------------
+//
+//    r_ms_step_10_body_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_step_10_body_text
+    {
+    buf = qtn_mserv_wizard_8;
+    }   
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_last_step_body_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_last_step_body_text
+    {
+    buf = qtn_mserv_wizard_10;
+    }
+    
+//----------------------------------------------------------------------------
+//
+//    r_ms_no_target_devices_selected_info
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_no_target_devices_selected_info
+    {
+    buf = qtn_mserv_wizard_no_target_devices_selected;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_wizard_captured_images
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_wizard_captured_images
+    {
+    buf = qtn_mserv_wizard_phone_images;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_wizard_other_images
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_wizard_other_images
+    {
+    buf = qtn_mserv_wizard_other_images;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_wizard_captured_videos
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_wizard_captured_videos
+    {
+    buf = qtn_mserv_wizard_phone_videos;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_wizard_other_videos
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_wizard_other_videos
+    {
+    buf = qtn_mserv_wizard_other_videos;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_wizard_music
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_wizard_music
+    {
+    buf = qtn_mserv_wizard_music;
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project setup wizard
+*
+*/
+
+
+#include "../../../../group/upnpplatformvar.hrh"
+
+PRJ_EXPORTS
+../inc/cmsappwizard.h    |../../../../inc/cmsappwizard.h
+// LOC export
+UPNP_LOC_EXPORT(cmsappwizard.loc)
+
+PRJ_MMPFILES
+./cmsappwizard.mmp
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE msappwizard.mif
+OPTION HEADERFILE msappwizard.mbg
+OPTION SOURCEDIR ../bitmaps
+OPTION SOURCES -c8,8 qgn_graf_upnp_ext_renderer \
+			   -c8,8 qgn_prop_im_server \
+			   -c8,8 qgn_prop_folder_locked_small \
+			   -c8,8 qgn_prop_folder_current \
+			   -c8,8 qgn_indi_upnp_search_1 \
+			   -c8,8 qgn_indi_upnp_search_2 \
+			   -c8,8 qgn_indi_upnp_search_3 \
+			   -c8,8 qgn_indi_upnp_search_4 \
+			   -c8,8 qgn_indi_upnp_search_5 \
+			   -c8,8 qgn_indi_upnp_search_6 \
+			   -c8,8 qgn_indi_upnp_search_7 \
+			   -c8,8 qgn_indi_upnp_search_8 \
+			   -c8,8 qgn_indi_upnp_search_9
+END
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/group/cmsappwizard.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification file
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET          msappwizard.dll
+TARGETTYPE      dll
+UID             0x100000D8 0x1028290A
+
+CAPABILITY CAP_GENERAL_DLL
+
+// host process needs this size
+EPOCSTACKSIZE  65536
+
+VENDORID        VID_DEFAULT
+
+// Include paths
+USERINCLUDE     ../inc
+USERINCLUDE     ../loc
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../../inc
+
+START RESOURCE  ../data/cmsappwizard.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS
+END // RESOURCE
+
+SOURCEPATH      ../src
+
+SOURCE          cmsappwizard.cpp
+SOURCE          cmsmultiselectionpopup.cpp
+SOURCE          cmsselectionstorage.cpp
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         avkon.lib
+LIBRARY         AKNSKINS.lib
+LIBRARY         AknIcon.lib
+LIBRARY         eikdlg.lib
+LIBRARY         efsrv.lib
+LIBRARY         egul.lib
+LIBRARY         CommonEngine.lib
+LIBRARY         msengine.lib
+LIBRARY         cmcommon.lib
+LIBRARY         cmsettingsengine.lib
+LIBRARY         commdb.lib
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         bafl.lib
+LIBRARY         ecom.lib
+LIBRARY         charconv.lib            // ConvertToUnicodeFromUtf8
+
+// Logging
+DEBUGLIBRARY    flogger.lib
+
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/inc/cmsappwizard.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,456 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the Setup wizard class
+*
+*/
+
+
+
+
+#ifndef CMSAPPWIZARD
+#define CMSAPPWIZARD
+
+// INCLUDES
+#include <aknmessagequerydialog.h>
+#include <AknWaitDialog.h>
+#include "upnpavdeviceobserver.h"
+
+
+// FORWARD DECLARATIONS
+class CCmMediaServerFull;
+class CMSEngine;
+class CMSSelectionStorage;
+class CMSMultiselectionPopup;
+class MUPnPAVController;
+
+// CLASS DECLARATION
+
+/**
+  * CMSAppWizard class
+  * Class implementing the functionality of the setup wizard
+  *
+  * @since S60 5.1
+  *
+  * @lib msappwizard.lib
+  */
+NONSHARABLE_CLASS( CMSAppWizard ) : public CBase,
+                                    public MUPnPAVDeviceObserver,
+                                    public MProgressDialogCallback
+    {
+
+    // Wizard steps
+    enum TWizardStep
+        {
+        EStep1 = 0,
+        EStep2,
+        EStep3,
+        EStep4,
+        EStep5,
+        EStep6,
+        EStep7,
+        EStep8,
+        EStep9,
+        EStep10,
+        EStep11,
+        EStep12,
+        ELastStep,
+        EWizardEnd,
+        ECancelWizard
+        };
+
+    public:     // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aMSEngine, application engine
+         * @return CMSAppWizard pointer
+         */
+        IMPORT_C static CMSAppWizard* NewL( CMSEngine& aMSEngine );
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aMSEngine, application engine
+         * @return CMSAppWizard pointer
+         */
+        IMPORT_C static CMSAppWizard* NewLC( CMSEngine& aMSEngine );        
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSAppWizard();
+
+
+    public:
+
+        /**
+         * Starts wizard
+         * @since S60 5.1
+         * @return TInt, sk button, 0 if cancelled
+         */
+        IMPORT_C TInt StartL();
+
+
+
+    public: // Methods from MProgressDialogCallback
+
+        /**
+         * Handles the situation when the dialog
+         * is dismissed.
+         *
+         * @since S60 5.1
+         * @param aButtonId The identifier of the button, with which the
+         *                  dialog was dismissed.
+         * @return None
+         */
+        void DialogDismissedL( TInt aButtonId );
+
+
+    private:
+
+        /**
+         * Show the information note with OK BACK buttons
+         *
+         * @since S60 5.1
+         * @param aMain, resource ID
+         * @param aHeading, heading text
+         * @return keycode of the button user has pressed.
+         */
+        TInt ShowInfoStepL( TInt aMain, TPtr aHeading );
+
+        /**
+         * Show the UI dialog with selection list
+         *
+         * @since S60 5.1
+         * @param aMain, resource ID
+         * @param aHeading, heading text
+         * @return keycode of the button user has pressed.
+         */
+        TInt ShowListStepL( TInt aMain, TPtr aHeading );
+
+        /**
+         * Shows the step for setting shared content
+         *
+         * @since S60 5.1
+         * @param aItemArray, item array
+         * @param aResultArray, selected indexes
+         * @param aHeading, heading text
+         * @return keycode of the button user has pressed.
+         */
+        TInt ShowMultiselectionStepL( CDesCArrayFlat& aItemArray,
+                                      CArrayFix<TInt>& aResultArray,
+                                      TPtr aHeading );
+
+        /**
+         * Determines the next wizard step
+         *
+         * @since S60 5.1
+         * @param aSelection, forward / backward
+         */
+        void SetNextStep( const TInt aDirection );
+
+        /**
+         * Cancels device search operation.
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void CancelDeviceSearch();
+
+        /**
+         * Creates AV controller.
+         *
+         * @since S60 5.1
+         * @param None
+         * @return operation success. KErrNone if succesfull
+         */
+        TInt CreateAvControllerL();
+
+        /**
+         * Updates multiselection dialog content.
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void UpdateDevicePopupDlgL();
+
+        /**
+         * Show the UI dialog with selection list
+         *
+         * @since S60 5.1
+         * @param aServer, server name
+         * @param aServerIndex, server array index
+         * @return comparison result.
+         */
+        TInt MatchFoundServer( TDesC8& aServer, TInt &aServerIndex );
+
+        /**
+         * Sets server state to deleted if needed
+         * And updates server name
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        void CheckAndSetServerStateL();
+
+        /**
+         * Fetches devices from AVController and calls 
+         * DeviceDiscovered-callback for each of them.
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        void FetchAlreadyDiscoveredDevicesL();
+        
+        /**
+         * Close wait dialog
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        void CloseWaitDialog();
+        
+        /**
+         * Creates multiselection store list items according
+         * to default store rule
+         *
+         * @since S60 5.1
+         * @param None
+         * @return CDesCArrayFlat, item array
+         */
+        CDesCArrayFlat* CreateMultiselectionStoreListItemsLC();
+
+        /**
+         * Creates multiselection store list items according
+         * to UI spec string
+         *
+         * @since S60 5.1
+         * @param None
+         * @return CDesCArrayFlat, item array
+         */
+        CDesCArrayFlat* CreateMultiselectionUIStoreListStringLC();
+
+
+        /**
+         * Creates server name list for device selection dialog
+         *
+         * @since S60 5.1
+         * @param aServerArray, server list
+         * @return None
+         */        
+        void CreateServerNameListL(
+                    RPointerArray<CCmMediaServerFull>& aServerArray);
+
+        /**
+         * Creates multiselection fill list items
+         *
+         * @since S60 5.1
+         * @param None
+         * @return CDesCArrayFlat, item array
+         */        
+        CDesCArrayFlat* CreateMultiselectionFillListItemsLC();
+
+        /**
+         * Shows wait note until first device appears
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */        
+        TInt ShowWaitNoteL();
+
+        /**
+         * Shows info note
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        void ShowInfoNoteL( TInt aBodyTextResource );
+        
+        /**
+         * Adds device name to device name list
+         *
+         * @since S60 5.1
+         * @param aDevice, upnp device
+         * @return None         
+         */
+        void AddDeviceNameL( const CUpnpAVDevice& aDevice );
+
+    public: // Functions from base classes
+
+        /**
+         * Notifies that a new UPnP device was discovered.
+         *
+         * @since S60 5.1
+         * @param aDevice, upnp device
+         * @return None
+         */
+        void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
+
+        /**
+         * Notifies that a new UPnP device was discovered.
+         *
+         * @since S60 5.1
+         * @param aDevice, upnp device
+         * @return None
+         */     
+        void UPnPDeviceDiscoveredL( const CUpnpAVDevice& aDevice );
+
+        /**
+         * Notifies that a UPnP device was dissapeared.
+         *
+         * @since S60 5.1
+         * @param aDevice, upnp device
+         * @return None
+         */
+        void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
+
+                /**
+         * Notifies that a UPnP device was dissapeared.
+         *
+         * @since S60 5.1
+         * @param aDevice, upnp device
+         * @return None
+         */
+        void UPnPDeviceDisappearedL( const CUpnpAVDevice& aDevice );
+
+        /**
+         * Notifies lost in WLAN connection
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void WLANConnectionLost();
+
+        /**
+         * Sets system update id to zero
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        void ClearServersSystemUpdateId();
+
+    private:
+
+        /**
+         * Performs the second phase construction.
+         */
+        void ConstructL();
+
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aMSEngine, application engine
+         * @return None
+         */
+        CMSAppWizard( CMSEngine& aMSEngine );
+
+    private:
+
+        /**
+         * Resource file offset
+         */
+        TInt                                    iResFileOffset;
+        /**
+         * Control environment for file server access
+         */
+        CEikonEnv*                              iCoeEnv;
+        /**
+         * The position of the wizard
+         */
+        TInt                                    iStep;
+        /**
+         * Flag for indicating device search cancel
+         */
+        TBool                                   iUserCancelledSearch;
+        /**
+         * selection popup for category and device selection
+         */
+        CMSMultiselectionPopup*                 iMultiSelectionDlg; // owned
+        /**
+         * wait dialog
+         */
+        CAknWaitDialog*                         iWaitDialog;        // owned
+        /**
+         * wait sheduler
+         */
+        CActiveSchedulerWait                    iWait;              // owned
+        /**
+         * list of new servers
+         */
+        RPointerArray<CCmMediaServerFull>       iMediaServers;      // owned
+        /**
+         * list of previously stored servers
+         */
+        RPointerArray<CCmMediaServerFull>*      iOriginalServers;   // owned
+        /**
+         * list of upload capable servers
+         */
+        RPointerArray<CCmMediaServerFull>       iStoreServers;      // owned        
+        /**
+         * List of server names
+         */
+        CDesCArrayFlat*                         iDeviceNameArray;   // owned
+        /**
+         * The storage for the user selections
+         */
+        CMSSelectionStorage*                    iSelections;        // owned        
+        /**
+         * application engine
+         */
+        CMSEngine*                              iMSEngine;      // not owned  
+        /**
+         * Step count
+         */
+        TInt                                    iMaxSteps;
+        /**
+         * AV controller
+         */
+        MUPnPAVController*                      iAvController;      // owned
+        /**
+         * File server session
+         */
+        RFs                                     iFileSession;
+        /**
+         * found drives
+         */
+        RPointerArray<CCmDriveInfo>             iDriveArray;        // owned
+        /**
+         * Selected drives indexes
+         */
+        RArray<TInt>                            iDriveIndexes;
+        /**
+         * Flag for wlan lost 
+         */
+        TBool                                   iWLanLost;
+        /**
+         * Upload capable server found -flag
+         */
+        TBool                                   iUploadServerFound;
+    };
+
+#endif  // CMSAPPWIZARD
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/inc/cmsmultiselectionpopup.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSMultiselectionPopup class definition
+*
+*/
+
+
+#ifndef CMSMULTISELECTIONPOPUP_H
+#define CMSMULTISELECTIONPOPUP_H
+
+// INCLUDES
+#include <aknnavide.h>
+#include <AknIconArray.h>
+#include <aknlistquerydialog.h>
+
+// CLASS DECLARATION
+
+/**
+ * CMSMultiselectionPopup dialog class
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSMultiselectionPopup ) : public CAknListQueryDialog
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aItemArray, list item array
+     * @param aSelectionIndexArray, currently selected items
+     * @param aHeading, popup heading
+     * @return CMSMultiselectionPopup* the new CMSMultiselectionPopup object
+     */
+    static CMSMultiselectionPopup* NewL(
+        CDesCArrayFlat* aItemArray,
+        CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+        const TDesC& aHeading );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aItemArray, list item array
+     * @param aSelectionIndexArray, currently selected items
+     * @param aHeading, popup heading
+     * @return CMSMultiselectionPopup* the new CMSMultiselectionPopup object
+     */
+    static CMSMultiselectionPopup* NewLC(
+        CDesCArrayFlat* aItemArray,
+        CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+        const TDesC& aHeading );                
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMSMultiselectionPopup();
+
+public:
+
+    /**
+     * Updates the list of items
+     *
+     * @since S60 5.1
+     * @param aItemArray, list item array
+     * @return None
+     */
+    void UpdateAndDrawPopupL( CDesCArrayFlat* aItemArray );
+
+protected:
+
+// From base class CAknSelectionListDialog
+
+    /**
+     * From CAknSelectionListDialog
+     * See base class defition
+     */
+    void PreLayoutDynInitL();
+
+    /**
+     * From CAknSelectionListDialog
+     * See base class defition
+     */
+    TBool OkToExitL( TInt aButtonId );
+
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aSelectionIndexArray, selected indexes
+     * @param aHeading, popup heading
+     * @return None
+     */
+    CMSMultiselectionPopup(
+        CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+        const TDesC& aHeading );
+
+    /**
+     * Performs the second phase construction.
+     *
+     * @since S60 5.1
+     * @param aItemArray, list items
+     * @param aSelectionIndexArray, selected indexes
+     * @return None
+     */
+    void ConstructL( CDesCArrayFlat* aItemArray,
+                     CListBoxView::CSelectionIndexArray*
+                                            aSelectionIndexArray);
+
+   /**
+    * Loads a possibly skinned icon and adds it to icon array
+    *
+    * @since S60 5.1
+    * @param CAknIconArray, array of icons
+    * @param MAknsSkinInstance, skin instance
+    * @param TDesC, reference to icon file
+    * @param TAknsItemID, skinned icon id
+    * @param TInt, bitmap id
+    * @param TInt, bitmap mask id
+    * @return None
+    */
+    void AppendIconToArrayL( CAknIconArray* aArray,
+                             MAknsSkinInstance* aSkin,
+                             const TDesC& aMbmFile,
+                             const TAknsItemID& aID,
+                             TInt aBitmapId,
+                             TInt aMaskId ) const;
+
+   /**
+    * Creates listbox items and sets item array
+    *
+    * @since S60 5.1
+    */
+    void CreateAndSetListboxItemsL();
+
+private:
+
+    /**
+     * Dialog listbox
+     */
+    CEikListBox*                      iListBox;         // owned
+    /**
+     * Item array
+     */    
+    CDesCArrayFlat*                   iItemArray;       // not owned
+    /**
+     * Selected item indexes
+     */
+    CArrayFix<TInt>*                  iSelectionIndexes;// not owned
+    /**
+     * Dialog title
+     */
+    TPtrC                             iHeading;    
+    };
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/inc/cmsselectionstorage.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the selection storage class
+*
+*/
+
+
+
+#ifndef CMSSELECTIONSTORAGE
+#define CMSSELECTIONSTORAGE
+
+// INCLUDES
+#include <bautils.h>
+
+// FORWARD DECLARATIONS
+class CCmStoreRuleContainer;
+class CCmFillRuleContainer;
+class CMSEngine;
+class CCmMediaServerFull;
+class CCmStoreRule;
+class CCmFillRule;
+
+// CLASS DECLARATION
+
+/**
+ * CMSSelectionStorage class
+ * Class implementing the storage for MediaServant wizard
+ *
+ * @since S60 5.1
+ *
+ */
+NONSHARABLE_CLASS( CMSSelectionStorage ) : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aMSEngine, application engine
+     * @param aServers, mediaserver list
+     * @param aFs, file server session
+     * @return CMSSelectionStorage pointer
+     */
+    static CMSSelectionStorage* NewL(
+                        CMSEngine& aMSEngine,
+                        RPointerArray<CCmMediaServerFull>& aServers,
+                        RFs& aFs );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aMSEngine, application engine
+     * @param aServers, mediaserver list
+     * @param aFs, file server session
+     * @return CMSSelectionStorage pointer
+     */
+    static CMSSelectionStorage* NewLC(
+                        CMSEngine& aMSEngine,
+                        RPointerArray<CCmMediaServerFull>& aServers,
+                        RFs& aFs );
+    /**
+     * Destructor.
+     */
+    virtual ~CMSSelectionStorage();
+
+public:
+
+    /**
+     * Stores the media categories, selected devices and store operation 
+     * type.
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void StoreMSSettingsL();
+
+    /**
+     * Sets fill list selections.
+     *
+     * @since S60 5.1
+     * @param aSelections, selection array.
+     * @return None     
+     */
+    void SetFillListSelections( CArrayFix<TInt>& aSelections );
+
+    /**
+     * Sets the store list selections.
+     *
+     * @since S60 5.1
+     * @param aSelections, selection array.
+     * @return None     
+     */
+    void SetStoreListSelections( CArrayFix<TInt>& aSelections );
+
+    /**
+     * Resets store list selections
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */
+    void ClearStoreListSelections();
+
+    /**
+     * Sets the automatic/manual sync selection.
+     *
+     * @since S60 5.1
+     * @param aSelection, service state manual/automatic
+     * @return None     
+     */
+    void SetAutoManualSelection( TBool aSelection );
+
+    /**
+     * Returns the automatic/manual sync selection.
+     *
+     * @since S60 5.1
+     * @param None     
+     * @return automatic selection on/off.
+     */
+    TBool AutoManualSelection();
+
+    /**
+     * Stores drive information
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */
+    void SetDriveInformationL();
+
+    /**
+     * Sets the selected servers for store rules.
+     *
+     * @since S60 5.1
+     * @param aSelectedIndexes, selected server indexes
+     * @param aServers, mediaserver list
+     * @return None     
+     */
+    void SetServersForStoreRulesL(
+                        CArrayFix<TInt>& aSelectedIndexes,
+                        RPointerArray<CCmMediaServerFull>& aServers );
+
+    /**
+     * Sets the selected servers for fill rules.
+     *
+     * @since S60 5.1
+     * @param aSelectedIndexes, selected server indexes
+     * @return None     
+     */
+    void SetServersForFillRulesL( CArrayFix<TInt>& aSelectedIndexes );
+
+private:
+
+    /**
+     * Removes the selected servers for store rule.
+     *
+     * @since S60 5.1     
+     * @param aRule, store rule
+     * @return None     
+     */
+    void RemoveServersFromStoreRuleL( CCmStoreRule* aRule );
+
+    /**
+     * Removes the selected servers for fill rule.
+     *
+     * @since S60 5.1
+     * @param aRule, fill rule
+     * @return None     
+     */
+    void RemoveServersFromFillRuleL( CCmFillRule* aRule );
+
+    /**
+     * Set wlan scanning on/off
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */
+    void SetWlanScanL();
+
+    /**
+     * Sets the selected servers for store rule.
+     *
+     * @since S60 5.1
+     * @param aRule, store rule
+     * @param aSelectedIndexes, selected server indexes,
+     * @param aServers, mediaserver list
+     * @return None     
+     */
+    void SetServersForStoreRuleL( 
+                        CCmStoreRule* aRule,
+                        CArrayFix<TInt>& aSelectedIndexes,
+                        RPointerArray<CCmMediaServerFull>& aServers );
+
+    /**
+     * Sets the selected servers for fill rule.
+     *
+     * @since S60 5.1
+     * @param aRule, fill rule
+     * @param aSelectedIndexes, selected server indexes
+     * @return None     
+     */
+    void SetServersForFillRuleL( CCmFillRule* aRule,
+                                 CArrayFix<TInt>& aSelectedIndexes );        
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aMSEngine, application engine
+     * @param aServers, mediaserver list
+     * @param aFs, file server session
+     * @return None         
+     */
+    CMSSelectionStorage( CMSEngine& aMSEngine,
+                         RPointerArray<CCmMediaServerFull>& aServers,
+                             RFs& aFs );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+       
+private:
+
+    /**
+     * application engine
+     */
+    CMSEngine&                              iMSEngine;
+    /**
+     * Users selected Automatic or Manual synchronization type.
+     * Efalse = Manual, ETrue = Automatic
+     */
+    TBool                                   iServiceState;
+    /**
+     * Selected store lists
+     */
+    CArrayFix<TInt>*                        iSelectedStoreLists; // owned
+     
+    /**
+     * Selected fill lists
+     */
+    CArrayFix<TInt>*                        iSelectedFillLists; // owned       
+
+    /**
+     * Store rules
+     */
+    CCmStoreRuleContainer*                  iStoreRules;        // owned
+
+    /**
+     * Fill rules
+     */
+    CCmFillRuleContainer*                   iFillRules;         // owned
+
+    /**
+     * Mediaserver array
+     */
+    RPointerArray<CCmMediaServerFull>&      iServers;
+
+    /**
+     * file session
+     */
+    RFs&                                    iFs;        
+
+    };
+
+#endif      // CMSSELECTIONSTORAGE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/loc/cmsappwizard.loc	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,238 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file includes localization strings
+*
+*/
+
+
+// LOCALISATION STRINGS
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_head_1 "Setup wizard 1/%N"
+
+//d:Message for wizard step
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_1 "Media Sync application can be used for synchronizing media from and to home devices. Please run the wizard within range of your WLAN."
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:2.1
+//
+#define qtn_mserv_wizard_head_from_home_1 "Sync from home 2/%N"
+
+//d:Message for wizard step
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_from_home "Select the media you want to synchronize from home. You can edit the choices later in \"From home\" view."
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:2.1
+//
+#define qtn_mserv_wizard_head_from_home_2 "Sync from home 3/%N"
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:2.1
+//
+#define qtn_mserv_wizard_head_source_devices_1 "Source device(s) 4/%N"
+
+//d:Message for wizard step
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_source_devices "Select the device(s) from which to synchronise media. You can later add and remove sync devices in settings."
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:2.1
+//
+#define qtn_mserv_wizard_head_source_devices_2 "Source device(s) 5/%N"
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_head_2 "Sync to home 6/%N"
+
+//d:Message for wizard step
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_2 "Select the media categories you want to synchronize to home.  You can edit the choices later in \"To home\" view."
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_head_3 "Sync to home 7/%N"
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_head_4 "Target device(s) 8/%N"
+
+//d:Message for wizard step
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_4 "Select the device(s) to which to synchronise media. You can later add and remove sync devices in settings."
+
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1/opt2
+//r:1.0
+//
+#define qtn_mserv_wizard_head_5 "Target device(s) 9/%N"
+
+//d:Message for wizard step
+//l:popup_info_list_pane_t1
+//r:2.1
+//
+#define qtn_mserv_wizard_no_target_devices_found "There were no devices supporting upload found. Your selections of media categories to be synchronized to home are no longer valid."
+
+//d:Target devices not selected
+//l:popup_info_list_pane_t1
+//r:2.1
+//
+#define qtn_mserv_wizard_no_target_devices_selected "You didn’t select any target devices. Your selections of media categories to be synchronized to home are no longer valid."
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_head_8 "Synchronization 10/%N"
+
+//d:Message for wizard step
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_8 "Select whether you want to start synchronizing manually or let it run periodically while you are within the range of your WLAN."
+
+//d:Header for wizard step
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_head_9 "Synchronization 11/%N"
+
+//d:Syncronization setting value ( automatic mode )
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_wizard_automatic "Automatically"
+
+//d:Syncronization setting value ( manual mode )
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_wizard_manually "Manually"
+
+//d:Header for wizard step
+//d:Parameters maximum length: 2 characters
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_head_10 "Setup wizard %0N/%1N"
+
+//d:Message for wizard step
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_10 "Initial refresh of your home media library will start now. Exiting the application will not stop the refreshing."
+
+//d:Search devices
+//l:popup_note_wait_window
+//r:2.1
+//
+#define qtn_mserv_wizard_searching_devices "Searching for compatible devices"
+
+//d:Category to be synced from server to home
+//l:list_single_graphic_pane_t1_cp2
+//r:2.1
+//
+#define qtn_mserv_wizard_latest_images "Latest images"
+
+//d:Category to be synced from server to home
+//l:list_single_graphic_pane_t1_cp2
+//r:2.1
+//
+#define qtn_mserv_wizard_latest_music "Latest music"
+
+//d:Category to be synced from server to home
+//l:list_single_graphic_pane_t1_cp2
+//r:2.1
+//
+#define qtn_mserv_wizard_latest_videos "Latest videos"
+
+//d:Header for wizard step 8
+//d:Parameter maximum length: 2 characters
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wizard_head_8_2 "Synchronization 6/%N"
+
+//d:List item
+//d:Captures image category
+//l:list_single_graphic_pane_t1_cp2
+//r:2.0
+//
+#define qtn_mserv_wizard_phone_images "Captured images"
+
+//d:List item
+//d:Other images category
+//l:list_single_graphic_pane_t1_cp2
+//r:2.0
+//
+#define qtn_mserv_wizard_other_images "Other images"
+
+//d:List item
+//d:Captures videos category
+//l:list_single_graphic_pane_t1_cp2
+//r:2.0
+//
+#define qtn_mserv_wizard_phone_videos "Captured videos"
+
+//d:List item
+//d:Other videos category
+//l:list_single_graphic_pane_t1_cp2
+//r:2.0
+//
+#define qtn_mserv_wizard_other_videos "Other videos"
+
+//d:List item
+//d:Music category
+//l:list_single_graphic_pane_t1_cp2
+//r:2.0
+//
+#define qtn_mserv_wizard_music "Music"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/src/cmsappwizard.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1254 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of setup Wizard
+*
+*/
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <cmsappwizard.rsg>
+#include "upnpavdevice.h"
+#include "upnpavcontroller.h"
+#include "upnpavcontrollerfactory.h"
+#include <driveinfo.h>
+#include <utf.h>
+#include <aknnotewrappers.h>
+
+#include "cmdriveinfo.h"
+#include "cmmediaserverfull.h"
+#include "cmstorerulecontainer.h"
+#include "cmstorerule.h"
+#include "cmfillrulecontainer.h"
+#include "cmfillrule.h"
+#include "cmsappwizard.h"
+#include "msengine.h"
+#include "cmsmultiselectionpopup.h"
+#include "cmsselectionstorage.h"
+#include "msconstants.h"
+#include "msdebug.h"
+#include "upnpavdevicelist.h"
+
+// CONSTANTS
+_LIT( KMSSetupWizardRscFile, "\\resource\\apps\\cmsappwizard.rsc" );
+#ifdef _DEBUG
+_LIT( KPanicedUnit, "MSAPPWIZARD" );
+#endif // _DEBUG
+
+const TInt KArrayGranularity = 3;
+const TInt KFillListGranularity = 3;
+const TInt KStoreListGranularity = 5;
+
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::CMSAppWizard
+// --------------------------------------------------------------------------
+//
+CMSAppWizard::CMSAppWizard( CMSEngine& aMSEngine )
+    {
+    iMSEngine = &aMSEngine;
+    iMaxSteps = ELastStep;
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::CMSAppWizard"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CMSAppWizard::ConstructL()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::ConstructL begin"));
+
+    iCoeEnv = CEikonEnv::Static();
+    iFileSession = iCoeEnv->FsSession();
+
+    // Load resource file
+    TFileName rscFileName( KMSSetupWizardRscFile );
+    User::LeaveIfError( CompleteWithAppPath( rscFileName ) );
+
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( iFileSession, rscFileName );
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( iFileSession, rscFileName ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    TInt err(KErrNone);
+    TRAP( err, iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ) );
+    User::LeaveIfError( err );
+
+    iSelections = CMSSelectionStorage::NewL( *iMSEngine,
+                                             iMediaServers,
+                                             iFileSession );
+
+    iDeviceNameArray = new (ELeave) CDesCArrayFlat( KArrayGranularity );
+
+    // original servers
+    iOriginalServers = iMSEngine->GetMediaServersL();
+    ClearServersSystemUpdateId();
+
+    // Start searching servers
+    TInt error = CreateAvControllerL();
+    if ( !error && iAvController )
+        {
+        // Process devices that AVController has already discovered.
+        FetchAlreadyDiscoveredDevicesL();
+        }
+    
+#if _DEBUG
+    RDebug::Printf("[MSAppWizard]\t CMSAppWizard::ConstructL: %s, %s\n",\
+__DATE__,__TIME__);
+#endif
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::ConstructL end") );
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::NewL()
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CMSAppWizard* CMSAppWizard::NewL( CMSEngine& aMSEngine )
+    {
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::NewL begin") );
+
+    CMSAppWizard* self = CMSAppWizard::NewLC( aMSEngine );
+    
+    CleanupStack::Pop( self );
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::NewL end") );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::NewLC()
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CMSAppWizard* CMSAppWizard::NewLC( CMSEngine& aMSEngine )
+    {
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::NewLC begin") );
+
+    CMSAppWizard* self = new ( ELeave) CMSAppWizard( aMSEngine );
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::NewLC end") );
+    return self;
+    }    
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CMSAppWizard::~CMSAppWizard()
+    {
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::~CMSAppWizard begin") );
+
+    // stop device search
+    CancelDeviceSearch();
+    
+    // UnLoad resource file
+    iCoeEnv->DeleteResourceFile( iResFileOffset );
+
+    if ( iOriginalServers )
+        {
+        iOriginalServers->ResetAndDestroy();
+        iOriginalServers->Close();
+        delete iOriginalServers;
+        }
+
+    if ( iDeviceNameArray )
+        {
+        iDeviceNameArray->Reset();
+        delete iDeviceNameArray;
+        }
+
+    iDriveIndexes.Close();
+
+    iDriveArray.ResetAndDestroy();
+    iDriveArray.Close();
+
+    iStoreServers.Reset();
+    iStoreServers.Close();
+
+    iMediaServers.ResetAndDestroy();
+    iMediaServers.Close();
+
+    delete iSelections;
+
+    if ( iAvController )
+        {
+        iAvController->RemoveDeviceObserver();
+		iAvController->Release();
+		iAvController = NULL;
+        }
+
+    CloseWaitDialog();
+
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::~CMSAppWizard end") );
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::StartL
+// The main loop of setup wizard
+// --------------------------------------------------------------------------
+//
+
+EXPORT_C TInt CMSAppWizard::StartL()
+    {
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::StartL begin") );
+    TInt ret(KErrNone);
+    do
+        {
+        switch ( iStep )
+            {
+            case EStep1:
+                {
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_1, ELastStep );
+                ret = ShowInfoStepL( iStep, head->Des() );
+                CleanupStack::PopAndDestroy( head );
+                break;
+                }
+            case EStep2:
+                {
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_2, ELastStep );
+                ret = ShowInfoStepL( iStep, head->Des() );
+                CleanupStack::PopAndDestroy( head );
+                break;
+                }
+            case EStep3:
+                {
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_3, ELastStep );                
+                
+                CDesCArrayFlat* itemArray =
+                                    CreateMultiselectionFillListItemsLC();
+
+                CArrayFix<TInt>* resultArray =
+                    new (ELeave) CArrayFixFlat<TInt>( KFillListGranularity );
+                CleanupStack::PushL( resultArray );
+                                                    
+                ret = ShowMultiselectionStepL( *itemArray,
+                                               *resultArray,
+                                               head->Des() );
+                // keep selection safe
+                iSelections->SetFillListSelections( *resultArray );                
+                CleanupStack::Pop( resultArray );
+                CleanupStack::PopAndDestroy( itemArray );                                                           
+                CleanupStack::PopAndDestroy( head );
+                break;
+                }
+            case EStep4:
+                {
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_4, ELastStep );
+                ret = ShowInfoStepL( iStep, head->Des() );
+                CleanupStack::PopAndDestroy( head );
+                break;
+                }
+            case EStep5:
+                {
+                CreateServerNameListL( iMediaServers );
+                
+                if ( iDeviceNameArray->Count() == 0 )
+                    {
+                    // no devices yet - show wait note                
+                    ShowWaitNoteL();
+                    // wait here for the first device before
+                    // showing device selection
+                    iWait.Start();                    
+                    }
+                if ( !iUserCancelledSearch )
+                    {
+                    HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_5, ELastStep );
+
+                    CArrayFix<TInt>* selectedIndexes =
+                       new (ELeave) CArrayFixFlat<TInt>( KArrayGranularity );
+                    CleanupStack::PushL( selectedIndexes );                                                      
+                    ret = ShowMultiselectionStepL( *iDeviceNameArray,
+                                               *selectedIndexes,
+                                               head->Des() );
+                    iSelections->SetServersForFillRulesL( *selectedIndexes );
+                    CleanupStack::PopAndDestroy( selectedIndexes );
+                    CleanupStack::PopAndDestroy( head );                
+                    }
+                else
+                    {
+                    ret = KErrCancel;
+                    }                                
+                
+                break;
+                }
+            case EStep6:
+                {
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_6, ELastStep );
+                ret = ShowInfoStepL( iStep, head->Des() );
+                CleanupStack::PopAndDestroy( head );
+                break;
+                }
+            case EStep7:
+                {
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_7, ELastStep );
+                //used CreateMultiselectionStoreListItemsLC before, modify then to 
+                //make it the same with UI spec
+                CDesCArrayFlat* itemArray =
+                                    CreateMultiselectionUIStoreListStringLC();
+
+                CArrayFix<TInt>* resultArray =
+                   new (ELeave) CArrayFixFlat<TInt>( KStoreListGranularity );
+                CleanupStack::PushL( resultArray );    
+                                                    
+                ret = ShowMultiselectionStepL( *itemArray,
+                                               *resultArray,
+                                               head->Des() ); 
+                // keep selection safe
+                iSelections->SetStoreListSelections( *resultArray );                                                                
+                CleanupStack::Pop( resultArray );
+                CleanupStack::PopAndDestroy( itemArray );                
+                CleanupStack::PopAndDestroy( head );
+                break;
+                }
+            case EStep8:
+                {
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_8, ELastStep );
+                ret = ShowInfoStepL( iStep, head->Des() );
+                CleanupStack::PopAndDestroy( head );
+                break;
+                }
+            case EStep9:
+                {                
+                HBufC* head = StringLoader::LoadLC(
+                                    R_MS_HEADING_STEP_9, ELastStep );
+                                    
+				// Clear previous store servers
+    			iStoreServers.Reset();
+    			
+        		// copy those media servers to store servers list, 
+        		// where copy capability is active
+				for ( TInt index=0; index < iMediaServers.Count(); index++ )
+					{
+					if ( iMediaServers.operator[](index)->CopyCapability() )
+						{
+						iStoreServers.Append( 
+						    iMediaServers.operator[]( index ) );
+						}
+					}
+
+                // append items to iDeviceNameArray
+                CreateServerNameListL( iStoreServers );
+
+                CArrayFix<TInt>* selectedIndexes =
+                       new (ELeave) CArrayFixFlat<TInt>( KArrayGranularity );
+                CleanupStack::PushL( selectedIndexes );                       
+
+                if ( iDeviceNameArray->Count() )
+                    {
+                    ret = ShowMultiselectionStepL( *iDeviceNameArray,
+                                               *selectedIndexes,
+                                               head->Des() ); 
+                    if ( ret > 0 && selectedIndexes->Count() == 0 )
+                        {
+                        ShowInfoNoteL( R_MS_NO_TARGET_DEVICES_SELECTED_INFO );
+                        // clear store list selections
+                        iSelections->ClearStoreListSelections();
+                        }                                                
+                    iSelections->SetServersForStoreRulesL( *selectedIndexes,
+                                                           iStoreServers );
+                    }
+                else // no devices available - show info note
+                    {
+                    ret = ShowInfoStepL( iStep, head->Des() );
+                    if ( ret > KErrNone )
+                        {                        
+                        // clear store list selections
+                        iSelections->ClearStoreListSelections();
+                        iSelections->SetServersForStoreRulesL(
+                                                *selectedIndexes,
+                                                iStoreServers );
+                        }
+                    }                    
+                
+                CleanupStack::PopAndDestroy( selectedIndexes );                                    
+                CleanupStack::PopAndDestroy( head );                                                                                  
+                break;
+                }
+
+            case EStep10:
+                {
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_10, ELastStep );
+                ret = ShowInfoStepL( iStep, head->Des() );
+                CleanupStack::PopAndDestroy( head );
+                break;
+                }
+            case EStep11:
+                {
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_11, ELastStep );
+                ret = ShowListStepL( R_MS_WIZARD_SELECTION_DIALOG_8,
+                                     head->Des() );
+                CleanupStack::PopAndDestroy( head );
+                break;
+                }
+            case EStep12:
+                {
+                 // two parameters
+                CArrayFix<TInt>* stepArray =
+                                new ( ELeave ) CArrayFixFlat<TInt>(2);
+                CleanupStack::PushL( stepArray );
+                stepArray->AppendL( ELastStep );                                
+                stepArray->AppendL( ELastStep );
+                HBufC* head = StringLoader::LoadLC(
+                                        R_MS_HEADING_STEP_12, *stepArray );                
+                ret = ShowInfoStepL( iStep, head->Des() );                
+                CleanupStack::PopAndDestroy( head );
+                CleanupStack::PopAndDestroy( stepArray );
+                break;
+                }                
+            case ELastStep:
+                {                
+                // stop device search
+                CancelDeviceSearch();
+                
+                // set remove status and name to old servers
+                CheckAndSetServerStateL();
+                // clear ids again because there might be new unselected servers
+                ClearServersSystemUpdateId();
+
+                iMSEngine->SetMediaServersL( *iOriginalServers );
+
+                // Set used drives
+                iSelections->SetDriveInformationL();
+
+                iSelections->StoreMSSettingsL();
+
+                ret = ELastStep; // stop looping
+                break;
+                }
+            case ECancelWizard:
+            	{
+                // stop device search
+                CancelDeviceSearch();
+                
+            	// Wizard is cancelled, do not start information refreshing
+            	ret = KErrNone;
+            	break;
+            	}
+            default :
+                {
+                LOG( _L("[MSAppWizard]\t CMSAppWizard::StartL: default!") );
+                __ASSERT_DEBUG( EFalse, User::Panic( KPanicedUnit, 0 ) );
+                break;
+                }
+            }
+            
+        SetNextStep( ret );
+        }
+    while ( iStep != EWizardEnd );
+    
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::StartL end"));
+    
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::DialogDismissedL
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::DialogDismissedL( TInt aButtonId )
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::DialogDismissedL"));
+    if( aButtonId != EAknSoftkeyDone )
+        {
+        LOG(_L("[MSAppWizard]\t CMSAppWizard::DialogDismissedL CANCEL"));
+        if ( aButtonId == EAknSoftkeyCancel )
+            {
+            iUserCancelledSearch = ETrue;
+            }
+        }
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::ShowInfoNoteL
+// --------------------------------------------------------------------------
+//
+void CMSAppWizard::ShowInfoNoteL( TInt aBodyTextResource )
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowInfoNoteL"));
+    CAknInformationNote* dlg = new(ELeave)CAknInformationNote( ETrue );
+    CleanupStack::PushL( dlg );
+    HBufC* noteText = StringLoader::LoadLC( aBodyTextResource );
+    dlg->ExecuteLD( *noteText );
+    CleanupStack::PopAndDestroy( noteText );
+    CleanupStack::Pop( dlg );
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::AddDeviceNameL
+// --------------------------------------------------------------------------
+//
+void CMSAppWizard::AddDeviceNameL( const CUpnpAVDevice& aDevice )
+    {
+    CUpnpAVDevice* device = const_cast<CUpnpAVDevice*> ( &aDevice );
+
+    HBufC* devName = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+	                                           device->FriendlyName() );
+	CleanupStack::PushL( devName );
+	TRACE(Print(_L("[MSAppWizard]\t device Name= %S"), devName ));
+	iDeviceNameArray->AppendL( *devName );        
+	CleanupStack::PopAndDestroy( devName );	
+	}
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::ShowInfoStepL
+//
+// --------------------------------------------------------------------------
+//
+TInt CMSAppWizard::ShowInfoStepL( TInt aStep, TPtr aHeading )
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowInfoStepL"));
+    TInt returnValue( KErrNone );
+
+    CAknMessageQueryDialog* dlg = new (ELeave)
+    CAknMessageQueryDialog( CAknQueryDialog::ENoTone );
+    CleanupStack::PushL( dlg );
+
+    dlg->PrepareLC( R_MS_WIZARD_INFO_DIALOG );
+
+    // do number conversion
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aHeading );
+    
+    dlg->SetHeaderTextL( aHeading );
+    HBufC* body = NULL;
+    switch ( aStep )
+        {
+        case EStep1:
+            {
+            body = StringLoader::LoadLC( R_MS_STEP_1_BODY_TEXT );
+            break;
+            }
+        case EStep2:
+            {
+            body = StringLoader::LoadLC( R_MS_STEP_2_BODY_TEXT );
+            break;
+            }                
+        case EStep4:
+            {
+            body = StringLoader::LoadLC( R_MS_STEP_4_BODY_TEXT );
+            break;
+            }
+        case EStep6:
+            {
+            body = StringLoader::LoadLC( R_MS_STEP_6_BODY_TEXT );
+            break;
+            }
+        case EStep8:
+            {
+            body = StringLoader::LoadLC( R_MS_STEP_8_BODY_TEXT );
+            break;
+            }
+        case EStep9:
+            {
+            body = StringLoader::LoadLC( R_MS_STEP_9_2_BODY_TEXT );
+            break;
+            }                            
+        case EStep10:
+            {
+            body = StringLoader::LoadLC( R_MS_STEP_10_BODY_TEXT );
+            break;
+            }
+        case EStep12:
+            {
+            body = StringLoader::LoadLC( R_MS_LAST_STEP_BODY_TEXT );
+            break;
+            }                                
+        default:
+            {
+            LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowInfoStepL \
+                    Step not found"));
+            break;
+            }                
+        }
+        
+    if ( body )  // long body text
+        {            
+        dlg->SetMessageTextL( *body );
+        CleanupStack::PopAndDestroy( body );
+        }
+    
+    returnValue = dlg->RunLD();
+    CleanupStack::Pop( dlg );
+    
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::ShowListStepL
+// Show the UI dialog with selection list
+// --------------------------------------------------------------------------
+//
+TInt CMSAppWizard::ShowListStepL( TInt aMain, TPtr aHeading )
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowListStepL begin"));
+    TInt returnValue(KErrNone);
+
+    TBool currSelection =  iSelections->AutoManualSelection();
+
+    CDesCArrayFlat* storeTypeSelection = new (ELeave) CDesCArrayFlat(
+        KArrayGranularity );
+    CleanupStack::PushL( storeTypeSelection );
+
+    HBufC* itemText1 = StringLoader::LoadLC( R_MS_AUTOMATIC_TEXT );
+    HBufC* itemText2 = StringLoader::LoadLC( R_MS_MANUAL_TEXT );
+
+    storeTypeSelection->AppendL( *itemText1 );
+    storeTypeSelection->AppendL( *itemText2 );
+
+    CleanupStack::PopAndDestroy(2, itemText1 );
+
+    CAknListQueryDialog* dlg = new
+        ( ELeave ) CAknListQueryDialog( &currSelection );
+
+    dlg->PrepareLC( aMain );
+
+    // do number conversion
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aHeading );
+
+    dlg->SetHeaderTextL( aHeading );
+    dlg->SetItemTextArray( storeTypeSelection );
+    dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+    CListBoxView* listBoxView = dlg->ListBox()->View();
+    listBoxView->SetCurrentItemIndex( currSelection );
+
+    returnValue = dlg->RunLD();
+
+    TRACE(
+        Print( _L("MSAppWizard]\t ShowListStepL exit dlg: %d" ),
+        returnValue ) );
+    iSelections->SetAutoManualSelection( currSelection );
+
+    CleanupStack::PopAndDestroy( storeTypeSelection );
+
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowListStepL ends"));
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::ShowMultiselectionStepL
+// Show the multiselection popup dialog for setting content to share
+// --------------------------------------------------------------------------
+//
+TInt CMSAppWizard::ShowMultiselectionStepL( CDesCArrayFlat& aItemArray,
+                                            CArrayFix<TInt>& aResultArray,
+                                            TPtr aHeading
+                                             )
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowMultiselectionStepL"));
+    TInt returnValue(KErrNone);
+
+    // do number conversion
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aHeading );
+
+    iMultiSelectionDlg = CMSMultiselectionPopup::NewL(
+                                &aItemArray,
+                                &aResultArray,
+                                aHeading );
+    
+    iMultiSelectionDlg->PrepareLC( R_MS_WIZARD_MULTISELECTION_DIALOG );
+
+    // For Device selection
+    if ( iStep == EStep5 || iStep == EStep9 )
+        {
+#ifndef __WINS__
+        iMultiSelectionDlg->QueryHeading()->SetHeaderAnimationL(
+                                    R_MS_ANIMATION_FOR_SELECTION_DIALOG );
+#endif
+        if ( iStep == EStep9 ) // no upload servers found
+            {            
+            HBufC* defaultText =
+                        StringLoader::LoadLC( R_MS_STEP_9_2_BODY_TEXT );
+            iMultiSelectionDlg->ListBox()->View()->SetListEmptyTextL(
+                                                             *defaultText );
+            CleanupStack::PopAndDestroy( defaultText );
+            }
+        }
+      
+    returnValue = iMultiSelectionDlg->RunLD();        
+    iMultiSelectionDlg = NULL;        
+    
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::ShowWaitNoteL
+// --------------------------------------------------------------------------
+//
+TInt CMSAppWizard::ShowWaitNoteL()
+    {
+    TInt returnValue( 0 );
+        
+    iUserCancelledSearch = EFalse;
+    iWLanLost = EFalse;
+    iWaitDialog = new ( ELeave ) CAknWaitDialog(
+              ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ) );
+    iWaitDialog->SetCallback( this );
+    iWaitDialog->ExecuteLD( R_MS_WIZARD_WAIT_DIALOG );
+
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::SetNextStep
+// Calculates the next step in wizard
+// --------------------------------------------------------------------------
+//
+void CMSAppWizard::SetNextStep( const TInt aDirection )
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::SetNextStep"));
+
+    if ( aDirection > 0 || EEikBidOk == aDirection )    
+        {
+        iStep++;     
+        }
+    else if ( iStep <= 0 )
+	    {
+	    iStep = ECancelWizard;
+	    }
+    else
+    	{
+        iStep--;
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::CancelDeviceSearch
+//
+// --------------------------------------------------------------------------
+//
+void CMSAppWizard::CancelDeviceSearch()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::CancelDeviceSearch"));
+
+    if ( iAvController )
+        {
+        iAvController->RemoveDeviceObserver();
+		iAvController->Release();
+		iAvController = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppWizard::CreateAvControllerL
+//
+// --------------------------------------------------------------------------
+//
+TInt CMSAppWizard::CreateAvControllerL()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL begins"));
+
+    TInt retVal(KErrNone);
+
+
+    iMediaServers.ResetAndDestroy();
+    iMediaServers.Close();
+
+
+    if( iDeviceNameArray )
+        {
+        iDeviceNameArray->Reset();
+        delete iDeviceNameArray;
+        iDeviceNameArray = NULL;
+        iDeviceNameArray = new (ELeave) CDesCArrayFlat( KArrayGranularity );
+        }
+    
+    if( iAvController )
+        {
+		iAvController->Release();
+		iAvController = NULL;
+        }
+    
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL before"));
+    TRAP( retVal, 
+          iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL() );
+    
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL afterr"));
+    
+    if( retVal != KErrNone )
+        {
+        TRACE( Print(
+             _L("[MediaServant]\t AvController create FAILED, \
+                 err = %d"), retVal)
+             );
+        if( retVal == KErrCancel )
+            {
+            //operation cancelled, return to dialog 4/8
+            CloseWaitDialog();
+            }
+        }
+    else
+        {
+        iAvController->SetDeviceObserver( *this );
+        }
+
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL ends"));
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::UpdateDevicePopupDlgL
+// Updates popup data with found device
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::UpdateDevicePopupDlgL()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::UpdateDevicePopupDlgL begins"));
+
+    iMultiSelectionDlg->UpdateAndDrawPopupL( iDeviceNameArray );
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::UpdateDevicePopupDlgL ends"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::UPnPDeviceDiscovered
+// Returns discovered device from UPnP AV control point
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemDevices::\
+             UPnPDeviceDiscovered"));
+
+    TRAP_IGNORE( UPnPDeviceDiscoveredL(aDevice) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::UPnPDeviceDiscoveredL
+//
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::UPnPDeviceDiscoveredL( const CUpnpAVDevice& aDevice )
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDiscoveredL begins"));
+
+    CUpnpAVDevice* device = const_cast<CUpnpAVDevice*> ( &aDevice );
+
+    if( device->DeviceType() == CUpnpAVDevice::EMediaServer &&
+        device->SearchCapability() &&
+        device->DlnaCompatible() )
+        {
+        LOG(_L("[MSAppWizard]\t Found device is Media server!"));
+        CCmMediaServerFull* tempServer = CCmMediaServerFull::NewL();
+        CleanupStack::PushL( tempServer );
+        tempServer->SetUDNL( device->Uuid() );
+        tempServer->SetMediaServerNameL( device->FriendlyName() );
+        tempServer->SetSystemUpdateID( -1 );      
+        tempServer->SetCopyCapability( aDevice.CopyCapability() );
+            
+        TTime timeStamp;
+        timeStamp.HomeTime();
+        tempServer->SetVisibleDate( timeStamp );
+        iMediaServers.Append( tempServer );
+        
+        if ( iStep == EStep9 )
+        	{
+	        // Add only store servers in step EStep9
+        	if ( tempServer->CopyCapability() )
+        		{
+        		iStoreServers.Append( tempServer );
+        		AddDeviceNameL( aDevice );
+        		}
+        	}
+        else
+        	{
+        	AddDeviceNameL( aDevice );
+        	}
+
+        CleanupStack::Pop( tempServer );
+        }
+    else
+        {
+        LOG(_L("[MSAppWizard]\t Found device is NOT Dlna compliant \
+        Media server!"));
+        return;
+        }
+
+    if ( iWaitDialog )
+        {
+        CloseWaitDialog();
+        }
+    // Ensure that we are in device selection step before adding items
+    // to the dialog
+    else if( iMultiSelectionDlg  && ( iStep == EStep5 || iStep == EStep9 ))
+        {
+        //update device list for UI
+        UpdateDevicePopupDlgL();
+        }
+
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDiscoveredL ends"));
+
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::UPnPDeviceDisappeared
+// Returns disappeared device from UPnP AV control point.
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice )
+    {
+    LOG(_L("[MediaServant]\t CMSSettingItemDevices::\
+             UPnPDeviceDisappeared"));
+
+    TRAP_IGNORE( UPnPDeviceDisappearedL( aDevice ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::UPnPDeviceDisappearedL
+//
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::UPnPDeviceDisappearedL( const CUpnpAVDevice& aDevice )
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDisappearedL begins"));
+    TPtrC8 ptr( aDevice.Uuid() );
+    TInt serverIndex(0);
+
+    if (!ptr.Compare(_L8("ConnectionLost")))
+        {
+        LOG(_L("[MSAppWizard]\t CMSAppWizard::\
+             UPnPDeviceDisappearedL: Connection lost!"));
+        }
+
+    TPtrC8 serverUid = aDevice.Uuid();
+
+    if( MatchFoundServer( serverUid, serverIndex ) == KErrNone )
+        {
+        // remove server and update screen
+        LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDisappearedL, MATCH"));
+        delete (iMediaServers)[serverIndex];
+        (iMediaServers)[serverIndex] = NULL;
+        iMediaServers.Remove( serverIndex );
+        iDeviceNameArray->Delete( serverIndex );
+        
+        if( iMultiSelectionDlg  && ( iStep == EStep5 || iStep == EStep9 ) )
+        	{
+        	UpdateDevicePopupDlgL();
+        	}
+        }
+
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDisappearedL ends"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::WLANConnectionLost
+// Called when wlan connection is lost
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::WLANConnectionLost()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::WLANConnectionLost"));
+    iWLanLost = ETrue;
+    TRAP_IGNORE( DialogDismissedL( EAknSoftkeyCancel ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::MatchFoundServer
+// returns KErrNone if match found
+// ---------------------------------------------------------------------------
+//
+TInt CMSAppWizard::MatchFoundServer( TDesC8& aUid, TInt &aServerIndex )
+    {
+    TInt retVal( KErrNotFound );
+    TInt devicecount = iMediaServers.Count();
+
+    for( TInt i=0; i<devicecount; i++ )
+        {
+
+        retVal = (iMediaServers)[i]->MediaServer().Compare( aUid );
+
+        if ( retVal == KErrNone )
+            {
+            aServerIndex = i;
+            i = devicecount; // break from the for loop
+            }
+        }
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::CheckAndSetServerStateL
+// sets remove state to server if it is old one
+// also update the server name
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::CheckAndSetServerStateL()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::CheckAndSetServerStateL"));
+
+    TKeyArrayFix sortKey( 0, ECmpNormal );
+
+    // set remove status to all original servers
+    for ( TInt ind = 0; ind < iOriginalServers->Count(); ind++ )
+        {
+        CCmMediaServerFull* tempServer = (*iOriginalServers)[ind];
+        tempServer->SetIsActive( KServerRemoved );
+        tempServer->SetStoreUsage( EFalse );
+        tempServer->SetFillUsage( EFalse );
+        }
+
+    // Change found servers statuses
+    for ( TInt i = 0; i < iMediaServers.Count(); i++ )
+        {
+        CCmMediaServerFull* newServer = iMediaServers[i];
+        TBool found( EFalse );
+        TInt iterations = iOriginalServers->Count();
+        for ( TInt j = 0; j < iterations; j++ )
+            {
+            CCmMediaServerFull* origServer = (*iOriginalServers)[j];
+                {
+                if ( origServer->MediaServer() == newServer->MediaServer())
+                    {
+                    origServer->SetIsActive( newServer->IsActive() );
+                    origServer->SetStoreUsage( newServer->StoreUsage() );
+                    origServer->SetFillUsage( newServer->FillUsage() );
+                    found = ETrue;
+                    j = iterations; // break loop
+                    //update the server name
+                    origServer->SetMediaServerNameL(
+                        newServer->MediaServerName() );
+                    }
+                }
+            }
+        if ( !found )
+            {            
+            // append new server to the server list
+            iOriginalServers->Append( newServer );
+            
+            iMediaServers.Remove( i );
+            // reduce index because of the server remove to
+            // check all items
+            i--;
+            }
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::ClearServersSystemUpdateId
+// clears system update ids of unselected servers
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::ClearServersSystemUpdateId()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::ClearServersSystemUpdateId"));
+
+    for ( TInt ind = 0; ind < iOriginalServers->Count(); ind++ )
+        {
+        CCmMediaServerFull* server = (*iOriginalServers)[ind];
+        if ( !server->IsActive() )
+            {
+            server->SetSystemUpdateID( -1 );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::FetchAlreadyDiscoveredDevicesL
+// Fetches devices from AVController and calls
+// DeviceDiscovered-callback for each of them.
+// ---------------------------------------------------------------------------
+//
+void CMSAppWizard::FetchAlreadyDiscoveredDevicesL()
+    {
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::FetchAlreadyDiscoveredDevicesL") );
+
+    // If iAvController is not created, this method is unusable. 
+    // Call CreateAvControllerL first.
+    User::LeaveIfNull( iAvController );
+
+    // Fetch already found devices from AVController.
+    CUpnpAVDeviceList* discoveredDevices =
+        iAvController->GetMediaServersL();
+    CleanupStack::PushL( discoveredDevices );
+
+    if ( discoveredDevices && discoveredDevices->Count() > 0 )
+        {
+        // the AVController already has some devices.
+        LOG(_L("[MSAppWizard]\t CMSAppWizard::FetchAlreadyDiscoveredDevicesL:\
+                AVController has already discovered devices"));
+
+        // process the already existing devices
+        for ( TInt i = 0 ; i < discoveredDevices->Count() ; i++ )
+            {
+            UPnPDeviceDiscovered(
+                *( discoveredDevices->operator[](i) ) );
+            }
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( discoveredDevices );
+    discoveredDevices = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::CloseWaitDialog
+// Close wait dialog
+// ---------------------------------------------------------------------------
+void CMSAppWizard::CloseWaitDialog()
+    {
+    LOG( _L("[MSAppWizard]\t CMSAppWizard::CloseWaitDialog") );
+    if ( iWaitDialog )
+        {
+        TRAP_IGNORE( iWaitDialog->ProcessFinishedL() );
+        iWaitDialog = NULL;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CMSAppWizard::CreateMultiselectionFillListItemsLC
+// ---------------------------------------------------------------------------    
+CDesCArrayFlat* CMSAppWizard::CreateMultiselectionFillListItemsLC()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard:: \
+            CreateMultiselectionFillListItemsLC"));
+    
+    CDesCArrayFlat* itemArray = new (ELeave) CDesCArrayFlat(
+                                                KFillListGranularity );
+    CleanupStack::PushL( itemArray );                                                     
+    
+    // Read fill lists from engine
+    CCmFillRuleContainer* listContainer = iMSEngine->FillRulesL();
+
+    for ( TInt index = 0; index < listContainer->FillRuleCount(); index++ )
+        {
+        CCmFillRule* rule = listContainer->FillRule( index );
+        HBufC* itemText = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+                                                               rule->Name() );
+        CleanupStack::PushL( itemText );
+        
+        itemArray->AppendL( *itemText );
+
+        CleanupStack::PopAndDestroy( itemText );        
+        }   
+
+    delete listContainer;
+    listContainer = NULL;
+
+    return itemArray;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::CreateMultiselectionStoreListItemsLC
+// ---------------------------------------------------------------------------    
+CDesCArrayFlat* CMSAppWizard::CreateMultiselectionStoreListItemsLC()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard:: \
+            CreateMultiselectionStoreListItemsLC"));
+    
+    CDesCArrayFlat* itemArray = new (ELeave) CDesCArrayFlat(
+                                                    KFillListGranularity );
+    CleanupStack::PushL( itemArray );                                                    
+    
+    // Read store lists from engine
+    CCmStoreRuleContainer* listContainer = iMSEngine->StoreRulesL();
+
+    for ( TInt index = 0; index < listContainer->StoreRuleCount(); index++ )
+        {
+        CCmStoreRule* rule = listContainer->StoreRule( index );
+        HBufC* itemText = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+                                                            rule->Name() );
+        CleanupStack::PushL( itemText );
+
+        itemArray->AppendL( *itemText );
+
+        CleanupStack::PopAndDestroy( itemText );        
+        }   
+
+    delete listContainer;
+    listContainer = NULL;
+
+    return itemArray;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::CreateMultiselectionUIStoreListStringLC
+// ---------------------------------------------------------------------------    
+CDesCArrayFlat* CMSAppWizard::CreateMultiselectionUIStoreListStringLC()
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard:: \
+            CreateMultiselectionUIStoreListStringLC"));
+    
+    CDesCArrayFlat* itemArray = new (ELeave) CDesCArrayFlat(
+    		                                        KStoreListGranularity );
+    CleanupStack::PushL( itemArray );
+   
+    HBufC* capturedPic = StringLoader::LoadLC( R_MS_WIZARD_CAPTURED_IMAGES );
+    HBufC* otherPic = StringLoader::LoadLC( R_MS_WIZARD_OTHER_IMAGES );
+    HBufC* capturedVideo = StringLoader::LoadLC( R_MS_WIZARD_CAPTURED_VIDEOS );
+    HBufC* otherVideo = StringLoader::LoadLC( R_MS_WIZARD_OTHER_VIDEOS );
+    HBufC* music = StringLoader::LoadLC( R_MS_WIZARD_MUSIC );
+    
+    itemArray->AppendL( *capturedPic );
+    itemArray->AppendL( *otherPic );
+    itemArray->AppendL( *capturedVideo );
+    itemArray->AppendL( *otherVideo );
+    itemArray->AppendL( *music );
+    
+    CleanupStack::PopAndDestroy( 5 );   
+
+    return itemArray;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppWizard::CreateServerNameListL
+// ---------------------------------------------------------------------------    
+void CMSAppWizard::CreateServerNameListL(
+                            RPointerArray<CCmMediaServerFull>& aServerArray )
+    {
+    LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateServerNameListL"));
+
+    // reset previous names
+    iDeviceNameArray->Reset();
+
+    for ( TInt i = 0; i < aServerArray.Count(); i++ )            
+        {
+        CCmMediaServerFull* server = aServerArray[i];
+        HBufC* name = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+                                                server->MediaServerName() );
+        CleanupStack::PushL( name );                                                
+        iDeviceNameArray->AppendL( *name );
+        CleanupStack::PopAndDestroy( name );
+        }
+    }   
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/src/cmsmultiselectionpopup.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Multiselection popup implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <avkon.mbg>
+#include <AknsUtils.h>
+#include <cmsappwizard.rsg>
+
+#include "cmsmultiselectionpopup.h"
+#include "msdebug.h"
+
+// Format string for listbox items
+_LIT(KItemFormatString, "1\t%S");
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::NewL
+// ---------------------------------------------------------------------------
+//
+CMSMultiselectionPopup* CMSMultiselectionPopup::NewL(
+    CDesCArrayFlat* aItemArray,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+    const TDesC& aHeading )
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::NewL begin"));
+
+    CMSMultiselectionPopup* self =
+                    CMSMultiselectionPopup::NewLC( aItemArray,
+                                                   aSelectionIndexArray,
+                                                   aHeading );
+    CleanupStack::Pop( self );
+
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::NewL end"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::NewLC
+// ---------------------------------------------------------------------------
+//
+CMSMultiselectionPopup* CMSMultiselectionPopup::NewLC(
+    CDesCArrayFlat* aItemArray,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+    const TDesC& aHeading )
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::NewLC begin"));
+
+    CMSMultiselectionPopup* self =
+                        new(ELeave) CMSMultiselectionPopup( NULL,
+                                                            aHeading );
+
+    CleanupStack::PushL(self);
+    self->ConstructL( aItemArray, aSelectionIndexArray );
+
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::NewLC end"));
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::ConstructL(
+    CDesCArrayFlat* aItemArray,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray )
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\
+    ConstructL begin"));
+
+    iItemArray = aItemArray;
+
+    iSelectionIndexes = aSelectionIndexArray;
+
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\
+    ConstructL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::CMSMultiselectionPopup
+// ---------------------------------------------------------------------------
+//
+CMSMultiselectionPopup::CMSMultiselectionPopup(
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+    const TDesC& aHeading )
+    : CAknListQueryDialog( aSelectionIndexArray ),
+      iHeading( aHeading )
+
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \
+            CMSMultiselectionPopup"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::~CMSMultiselectionPopup
+// ---------------------------------------------------------------------------
+//
+CMSMultiselectionPopup::~CMSMultiselectionPopup()
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\
+    CMSMultiselectionPopup"));
+    }
+    
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::UpdateAndDrawPopup
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::UpdateAndDrawPopupL(
+    CDesCArrayFlat* aItemArray )
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \
+            UpdateAndDrawPopupL begin"));
+
+    iItemArray = aItemArray;
+
+    if ( iItemArray->Count() )
+        {
+        CreateAndSetListboxItemsL();        
+        }
+               
+    Layout();
+    SizeChanged();    
+    iListBox->DrawNow();
+
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \
+            UpdateAndDrawPopupL ends"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::AppendIconToArrayL
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::AppendIconToArrayL(CAknIconArray* aArray,
+                                               MAknsSkinInstance* aSkin,
+                                               const TDesC& aMbmFile,
+                                               const TAknsItemID& aID,
+                                               TInt aBitmapId,
+                                               TInt aMaskId) const
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \
+            AppendIconToArrayL begin"));
+
+    __ASSERT_DEBUG( aArray, User::Leave(KErrArgument) );
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC(aSkin, aID,
+        bitmap, mask, aMbmFile, aBitmapId, aMaskId);
+
+    CGulIcon* icon = CGulIcon::NewL(bitmap, mask);
+    icon->SetBitmapsOwnedExternally(EFalse);
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop(2); // mask, bitmap
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL(icon);
+
+    aArray->AppendL(icon);
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop(icon);
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \
+            AppendIconToArrayL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::OkToExitL(TInt aButtonId)
+// ---------------------------------------------------------------------------
+//
+TBool CMSMultiselectionPopup::OkToExitL(TInt aButtonId)
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\
+OkToExitL begin"));
+
+    if ( aButtonId == EAknSoftkeyNext ||  aButtonId == EAknSoftkeyBack )
+        {
+        LOG(_L("[MSAppWizard]\t CUPnPAppMultiselectionPopup::\
+OkToExitL: Next or Back"));
+
+        const CListBoxView::CSelectionIndexArray* selected =
+            ListBox()->SelectionIndexes();
+
+        if ( iSelectionIndexes )
+            {
+            TInt selectCount = selected->Count();
+            iSelectionIndexes->Reset();
+            for ( TInt i = 0; i < selectCount; i++ )
+                {
+                iSelectionIndexes->AppendL( selected->At( i ) );
+                }
+            }
+        }
+
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\
+OkToExitL end"));
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::CreateAndSetListboxItemsL()
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::CreateAndSetListboxItemsL()
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\
+    CreateAndSetListboxItemsL"));    
+    
+    TInt itemCount = iItemArray->Count();
+    
+    CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat( 5 );
+    CleanupStack::PushL( listItems );
+    
+    for ( TInt i = 0; i < itemCount; i++)
+        {
+        TPtrC itemStr = iItemArray->MdcaPoint(i);
+        HBufC* item = HBufC::NewLC( itemStr.Size() +
+                                    sizeof( KItemFormatString ) );                                
+        item->Des().Format( KItemFormatString, &itemStr );             
+        
+        listItems->AppendL( *item );
+        CleanupStack::PopAndDestroy( item );        
+        }
+    SetItemTextArray( listItems );
+    CleanupStack::Pop( listItems );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMultiselectionPopup::PreLayoutDynInitL()
+// ---------------------------------------------------------------------------
+//
+void CMSMultiselectionPopup::PreLayoutDynInitL()
+    {
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \
+            PreLayoutDynInitL begin"));
+
+    // two icons
+    CAknIconArray* icons = new (ELeave) CAknIconArray(2);
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName() );
+
+    AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOn,
+                        EMbmAvkonQgn_indi_checkbox_on,
+                        EMbmAvkonQgn_indi_checkbox_on_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOff,
+                        EMbmAvkonQgn_indi_checkbox_off,
+                        EMbmAvkonQgn_indi_checkbox_off_mask );
+
+
+    CAknListQueryDialog::SetIconArrayL(icons);
+
+    CleanupStack::Pop(icons);
+
+    iListBox = ListBox();
+
+    CAknFilteredTextListBoxModel* model = STATIC_CAST(
+            CAknFilteredTextListBoxModel*,
+            iListBox->Model());
+
+    // create listbox items if any
+    if ( iItemArray->Count() )
+        {
+        CreateAndSetListboxItemsL();        
+        }
+    
+    SetHeaderTextL( iHeading );
+
+    iListBox->ActivateL();
+    
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \
+            PreLayoutDynInitL end"));
+    }
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/homesyncwizard/src/cmsselectionstorage.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,454 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of setup wizard selection storage
+*
+*/
+
+
+// INCLUDE FILES
+#include <commdb.h>
+#include <WlanCdbCols.h>
+#include <wlanmgmtclient.h>
+#include <driveinfo.h>
+
+#include "cmsettingsfactory.h"
+#include "cmmediaserverfull.h"
+#include "cmdriveinfo.h"
+#include "cmsettings.h"
+#include "cmsselectionstorage.h"
+#include "msengine.h"
+#include "cmstorerulecontainer.h"
+#include "cmfillrulecontainer.h"
+#include "cmstorerule.h"
+#include "cmfillrule.h"
+#include "msconstants.h"
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::NewL
+// --------------------------------------------------------------------------
+//
+CMSSelectionStorage* CMSSelectionStorage::NewL(
+                            CMSEngine& aMSEngine,
+                            RPointerArray<CCmMediaServerFull>& aServers,
+                            RFs& aFs )
+    {
+    LOG(_L("[MSAppWizard]\t CMSSelectionStorage::NewL"));
+    
+    CMSSelectionStorage* self = CMSSelectionStorage::NewLC( aMSEngine,
+                                                            aServers,
+                                                            aFs );
+        
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::NewLC
+// --------------------------------------------------------------------------
+//
+CMSSelectionStorage* CMSSelectionStorage::NewLC(
+                            CMSEngine& aMSEngine,
+                            RPointerArray<CCmMediaServerFull>& aServers,
+                            RFs& aFs )
+    {
+    LOG(_L("[MSAppWizard]\t CMSSelectionStorage::NewLC"));
+    
+    CMSSelectionStorage* self = new (ELeave) CMSSelectionStorage( aMSEngine,
+                                                                  aServers,
+                                                                  aFs );
+    CleanupStack::PushL(self);
+    self->ConstructL(  );
+    
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::CMSSelectionStorage
+// --------------------------------------------------------------------------
+//
+CMSSelectionStorage::CMSSelectionStorage(
+                            CMSEngine& aMSEngine,
+                            RPointerArray<CCmMediaServerFull>& aServers,
+                            RFs& aFs ) :
+    iMSEngine( aMSEngine ), iServers( aServers ), iFs( aFs )
+    {
+    LOG(_L("[MSAppWizard]\t CMSSelectionStorage::CMSSelectionStorage"));
+    
+    // remove fill & store usage flag from every server
+    for ( TInt i = 0; i < iServers.Count(); i++ )
+        {
+        CCmMediaServerFull* server = iServers[i];
+        server->SetStoreUsage( EFalse );
+        server->SetStoreUsage( EFalse );
+        server->SetIsActive( EFalse );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::ConstructL()
+    {
+    LOG(_L("[MSAppWizard]\t CMSSelectionStorage::ConstructL"));
+    
+    iStoreRules = iMSEngine.StoreRulesL();
+    iFillRules = iMSEngine.FillRulesL();
+    iServiceState = ETrue; // default: manual sync   
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::~CMSSelectionStorage
+// --------------------------------------------------------------------------
+//
+CMSSelectionStorage::~CMSSelectionStorage()
+    {
+    LOG(_L("[MSAppWizard]\t CMSSelectionStorage::~CMSSelectionStorage"));
+
+    delete iSelectedFillLists;
+    delete iSelectedStoreLists;
+    delete iStoreRules;
+    delete iFillRules;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::StoreMSSettingsL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::StoreMSSettingsL()
+    {
+    LOG(_L("[MSAppWizard]\t CMSSelectionStorage::StoreMSSettingsL begins"));
+
+    // Set store rules
+    iMSEngine.SetStoreRulesL( iStoreRules );
+    
+    // Set fill rules
+    iMSEngine.SetFillRulesL( iFillRules );
+    
+    // Set syncrhronization state
+
+    // if ETrue -> MANUAL mode
+    // if EFalse -> AUTOMATIC mode
+    if( iServiceState )
+        {
+        iMSEngine.SetServiceState( ECmServiceContentManager,
+                                   ECmServiceStateDisabled );
+        }
+    else
+        {
+        iMSEngine.SetServiceState( ECmServiceContentManager,
+                                   ECmServiceStateAutomatic );
+        // Set wlan scanning on if AUTOMATIC mode
+        SetWlanScanL();
+        }
+    LOG(_L("[MSAppWizard]\t CMSSelectionStorage::StoreMSSettingsL ends"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::SetWlanScanL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::SetWlanScanL()
+    {
+    LOG(_L("[MSAppWizard]\t CMSSelectionStorage::SetWlanScanL"));
+
+    // open commsdb
+    CCommsDatabase* commsDb = CCommsDatabase::NewL();
+    CleanupStack::PushL( commsDb );
+#ifndef __WINS__
+    // open wlan table
+    CCommsDbTableView* view = commsDb->OpenViewMatchingUintLC
+        (
+        TPtrC( WLAN_DEVICE_SETTINGS ),
+        TPtrC( WLAN_DEVICE_SETTINGS_TYPE ), KWlanUserSettings
+        );
+
+    User::LeaveIfError( view->GotoFirstRecord() );
+    User::LeaveIfError( view->UpdateRecord() );
+
+    // set scan interval
+    view->WriteUintL( TPtrC( WLAN_BG_SCAN_INTERVAL ), 
+                      KWlanScanNetworkInterval60 );
+    User::LeaveIfError( view->PutRecordChanges() );
+
+    CleanupStack::PopAndDestroy( view );
+#endif
+    CleanupStack::PopAndDestroy( commsDb );
+
+#ifndef __WINS__
+    CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL();
+    CleanupStack::PushL( wlanMgmtClient );
+    // notify about changes
+    wlanMgmtClient->NotifyChangedSettings();
+    CleanupStack::PopAndDestroy( wlanMgmtClient );
+ #endif
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::SetServersForFillRulesL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::SetServersForFillRulesL( 
+                                CArrayFix<TInt>& aSelectedIndexes)
+    {
+    LOG(_L("[MSAppWizard]\t CMSSelectionStorage::SetServersForFillRulesL "));
+
+    // set server activity anyway
+    for ( TInt idx = 0; idx < aSelectedIndexes.Count(); idx++ )
+        {
+        CCmMediaServerFull* server = iServers[aSelectedIndexes.At(idx)];
+        server->SetFillUsage( ETrue );
+        server->SetIsActive( ETrue );
+        }
+
+    // Get fill list count
+    TInt fillrulecount = iFillRules->FillRuleCount();
+    
+    // remove all servers from store lists and set unselected
+    for ( TInt index = 0; index < fillrulecount; index++ )
+        {
+        CCmFillRule* rule = iFillRules->FillRule( index );
+        // remove list selection
+        rule->SetSelected( ECmUnSelected );
+        // remove servers
+        RemoveServersFromFillRuleL( rule );
+        }
+
+    // set selected servers for selected lists
+    for( TInt i=0; i<iSelectedFillLists->Count(); i++ )
+        {
+        TInt index = (*iSelectedFillLists)[i];
+        CCmFillRule* rule = iFillRules->FillRule(index);
+        rule->SetSelected( ECmSelected );
+        
+        SetServersForFillRuleL( rule, aSelectedIndexes );
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::SetServersForFillRuleL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::SetServersForFillRuleL( CCmFillRule* aRule,
+                                        CArrayFix<TInt>& aSelectedIndexes )
+    {
+    LOG(_L("[MSAppWizard]\t SetServersForFillRuleL"));
+    TInt ruleServerCount = aRule->MediaServerCount();
+
+    for ( TInt iy = 0; iy < aSelectedIndexes.Count(); iy++ )
+        {
+        CCmMediaServerFull* server = iServers[aSelectedIndexes.At(iy)];
+
+        TPtrC8 serverUDN = server->MediaServer();
+        aRule->AddMediaServerL( serverUDN );        
+        server->SetIsActive( KServerActive );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::SetServersForStoreRulesL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::SetServersForStoreRulesL(
+                                CArrayFix<TInt>& aSelectedIndexes,
+                                RPointerArray<CCmMediaServerFull>& aServers )
+    {
+
+    // set server activity anyway
+    for ( TInt idx = 0; idx < aSelectedIndexes.Count(); idx++ )
+        {
+        CCmMediaServerFull* server = aServers[aSelectedIndexes.At(idx)];
+        server->SetStoreUsage( ETrue );
+        server->SetIsActive( ETrue );
+        }
+
+    // remove all servers from store lists and set unselected
+    for ( TInt index = 0; index < iStoreRules->StoreRuleCount(); index++ )
+        {
+        CCmStoreRule* rule = iStoreRules->StoreRule( index );
+        // remove list selection
+        rule->SetSelected( ECmUnSelected );
+        RemoveServersFromStoreRuleL( rule );
+        }       
+
+    // set selected servers for selected lists
+    for ( TInt i = 0; i < iSelectedStoreLists->Count(); i++ )
+        {
+        TInt selectionValue = iSelectedStoreLists->At( i );
+
+        CCmStoreRule* rule = iStoreRules->StoreRule( selectionValue );
+        rule->SetSelected( ECmSelected );
+        //...and set selected servers to list
+        SetServersForStoreRuleL( rule, aSelectedIndexes, aServers );
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::SetServersForStoreRuleL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::SetServersForStoreRuleL(
+                                CCmStoreRule* aRule,
+                                CArrayFix<TInt>& aSelectedIndexes,
+                                RPointerArray<CCmMediaServerFull>& aServers )
+    {
+    LOG(_L("[MSAppWizard]\t SetServersForStoreRuleL"));            
+
+    for ( TInt iy = 0; iy < aSelectedIndexes.Count(); iy++ )
+        {
+        CCmMediaServerFull* server = aServers[aSelectedIndexes.At(iy)];
+        TPtrC8 serverUDN = server->MediaServer();
+        aRule->AddMediaServerL( serverUDN );
+        server->SetIsActive( KServerActive );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::RemoveServersFromFillRuleL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::RemoveServersFromFillRuleL( CCmFillRule* aRule )
+    {
+    //Remove old servers from the rule
+    LOG(_L("[MSAppWizard]\t RemoveServersFromFillRuleL"));
+    TInt ruleServerCount = aRule->MediaServerCount();
+    for ( TInt index = ruleServerCount-1; index >= 0; index-- )
+        {
+        const TDesC8& ruleServerUDN = aRule->MediaServerL( index );
+        aRule->DeleteMediaServer( ruleServerUDN );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::RemoveServersFromStoreRuleL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::RemoveServersFromStoreRuleL( CCmStoreRule* aRule )
+    {
+    //Remove old servers from the rule
+    LOG(_L("[MSAppWizard]\t RemoveServersFromStoreRuleL"));
+    TInt ruleServerCount = aRule->MediaServerCount();
+    for ( TInt index = ruleServerCount-1; index >= 0; index-- )
+        {
+        const TDesC8& ruleServerUDN = aRule->MediaServerL( index );
+        aRule->DeleteMediaServer( ruleServerUDN );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::SetStoreListSelections
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::SetStoreListSelections( CArrayFix<TInt>& aSelections )
+    {
+    if ( iSelectedStoreLists )
+        {
+        delete iSelectedStoreLists;
+        iSelectedStoreLists = NULL;
+        }
+
+    iSelectedStoreLists = &aSelections;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::ClearStoreListSelections
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::ClearStoreListSelections()
+    {
+    iSelectedStoreLists->Reset();
+    }
+    
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::SetFillListSelections
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::SetFillListSelections(
+                                    CArrayFix<TInt>& aSelections )
+    {
+    if ( iSelectedFillLists )
+        {
+        delete iSelectedFillLists;
+        iSelectedFillLists = NULL;
+        }
+
+    iSelectedFillLists = &aSelections;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::SetAutoManualSelection
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::SetAutoManualSelection( TBool aSelection )
+    {
+    iServiceState = aSelection;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::AutoManualSelection
+// --------------------------------------------------------------------------
+//
+TBool CMSSelectionStorage::AutoManualSelection()
+    {
+    return iServiceState;
+    }
+
+// --------------------------------------------------------------------------
+// CMSSelectionStorage::SetDriveInformationL
+// --------------------------------------------------------------------------
+//
+void CMSSelectionStorage::SetDriveInformationL()
+    {
+    LOG(_L("[MSAppWizard]\t SetDriveInformationL"));
+
+    MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC();
+    RPointerArray<CCmDriveInfo> driveArray;
+    CleanupClosePushL( driveArray );
+    
+    settings->DriveListL( iFs, driveArray );
+
+    TInt64 quota(0);
+
+    for ( TInt i = 0; i < driveArray.Count(); i++ )
+        {        
+        if ( driveArray[i]->DriveType() == DriveInfo::EDriveRemovable )
+            {
+            // mmc
+            quota = ( driveArray[i]->DriveSize() * KMMCDefaultQuota ) / 100;
+            LOG(_L("[MSAppWizard]\t CMSSelectionStorage::\
+            SetDriveInformationL memory card quota set"));
+            }
+        else
+            {
+            // internal hd
+            quota = ( driveArray[i]->DriveSize() * KHDDefaultQuota ) / 100;
+            LOG(_L("[MSAppWizard]\t CMSSelectionStorage::\
+            SetDriveInformationL mass memory quota set"));                      
+            }
+
+        // set quota
+        driveArray[i]->SetDriveQuota( quota );
+        }
+
+
+    iMSEngine.SetDrivesL( driveArray );
+    driveArray.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &driveArray );
+	settings->Close();
+    CleanupStack::Pop(); // settings
+    }
+    
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/aif/qgn_mserv_app_context_icon.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+<?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>
+<g>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-27.2686" y1="70.9365" x2="-11.615" y2="87.1462" gradientTransform="matrix(1.1364 0 0 -1.1364 37.0767 117.9015)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M16.713,29.99c-2.408-5.509,4.282-8.124,7.793-9.374c-0.44-0.975-0.292-1.108-0.733-2.083     C15.936,21.324,13.038,25.404,16.713,29.99"/>
+<polygon fill="#005795" points="34.49,15.199 34.192,17.02 24.215,23.375 23.906,21.314    "/>
+<path fill="#005795" d="M17.07,29.665c-1.463-0.622-4.664-5.759-4.664-5.759c-0.169,2.652,2.149,6.207,4.857,7.426L17.07,29.665z     "/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-573.6694" y1="876.8271" x2="-579.2184" y2="860.7118" gradientTransform="matrix(-1.1364 0 0 1.1364 -632.3599 -965.8829)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M16.925,29.639c-9.367-4.858-2.893-11.595,6.408-14.717l-0.187-2.789L34.482,15.2l-10.634,6.18     l-0.156-2.711C16.581,21.206,12.646,25.554,16.925,29.639z"/>
+</g>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="42.4937" y1="28.4287" x2="42.4937" y2="42.2522">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1601" style="stop-color:#F6F6F6"/>
+<stop offset="0.3124" style="stop-color:#EAEAEA"/>
+<stop offset="0.4639" style="stop-color:#D6D7D7"/>
+<stop offset="0.615" style="stop-color:#BBBBBB"/>
+<stop offset="0.7657" style="stop-color:#979797"/>
+<stop offset="0.9142" style="stop-color:#6D6D6D"/>
+<stop offset="1" style="stop-color:#505151"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M42.33,31.862c0,0-0.235-0.18-0.287-0.221c0,3.84,0,11.118,0,11.118     c0,0.921-0.772,1.442-1.25,1.521c0,0,2.479-0.669,2.838-0.966c0.357-0.297,0.564-0.737,0.564-1.202c0,0,0-6.26,0-10.1     l-0.66,0.154C43.108,32.237,42.671,32.128,42.33,31.862z"/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="30.3491" y1="17.5361" x2="46.5537" y2="30.6277">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1353" style="stop-color:#F3F3F3"/>
+<stop offset="0.3231" style="stop-color:#E0E0E0"/>
+<stop offset="0.5464" style="stop-color:#C0C1C1"/>
+<stop offset="0.7948" style="stop-color:#959696"/>
+<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_11_)" d="M47.064,27.578L33.533,16.378c-0.66-0.521-1.444-0.354-1.758-0.268l-1.705,0.488     c0.533-0.228,1.155-0.145,1.607,0.229L45.21,28.025c0.614,0.51,0.746,1.403,0.302,2.067l-0.933,1.4     c-0.195,0.293-0.484,0.502-0.814,0.61c0,0,1.256-0.238,1.624-0.385c0.401-0.16,0.805-0.315,1.044-0.675l0.935-1.399     C47.81,28.98,47.679,28.087,47.064,27.578z"/>
+<path fill="#FFFFFF" d="M29.925,16.665l-12.598,7c-0.656,0.365-0.961,1.145-0.723,1.856l0.467,1.401     c0.145,0.431,0.469,0.778,0.891,0.95c0.422,0.172,0.896,0.153,1.301-0.055c0,0,0.058-0.029,0.063-0.032     c0,3.391,0,11.242,0,11.242c0,0.749,0.532,1.393,1.268,1.533l19.598,3.732c0.455,0.087,0.928-0.033,1.285-0.332     c0.359-0.296,0.566-0.736,0.566-1.2c0,0,0-7.278,0-11.118c0.052,0.041,0.287,0.221,0.287,0.221     c0.342,0.266,0.778,0.375,1.205,0.305c0.428-0.07,0.805-0.314,1.045-0.674l0.933-1.4c0.444-0.665,0.313-1.557-0.302-2.067     L31.677,16.828C31.182,16.418,30.488,16.354,29.925,16.665z"/>
+<path fill="#9D0A00" d="M30.683,18.03l-12.598,6.999l0.466,1.399l2.333-1.194v13.792l18.687,4.254l0.91-0.521V28.469l1.89,2.679     l0.91-0.52l0.934-1.401L30.683,18.03z M33.484,40.426l-6.533-1.151v-9.58l6.533,0.934V40.426z"/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="43.6147" y1="19.5532" x2="18.6906" y2="43.8546">
+<stop offset="0" style="stop-color:#FF0000"/>
+<stop offset="0.0056" style="stop-color:#FF0000"/>
+<stop offset="0.3111" style="stop-color:#FC0000"/>
+<stop offset="0.5001" style="stop-color:#F40000"/>
+<stop offset="0.6575" style="stop-color:#E50000"/>
+<stop offset="0.7974" style="stop-color:#D10000"/>
+<stop offset="0.9246" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#A30000"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M29.773,18.549l-12.599,7l0.468,1.399l2.332-1.195v13.793l19.598,3.734V28.99l2.8,2.158     l0.933-1.4L29.773,18.549z M32.574,40.946l-6.533-1.152v-9.58l6.533,0.934V40.946z"/>
+</g>
+<g>
+<polygon fill="#005447" points="38.148,46.386 37.724,44.134 37.742,46.538 38.129,49.028    "/>
+<g>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="11.9331" y1="72.8408" x2="-0.2371" y2="64.8541" gradientTransform="matrix(1.1364 0 0 -1.1364 37.0767 117.9015)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_13_)" d="M47.792,32.866c0,0-10.057,11.207-10.068,11.268c0.183,1.363,0.307,2.078,0.382,2.28      C38.257,46.376,51.007,43.011,47.792,32.866z"/>
+<polygon fill="#005447" points="37.902,46.849 38.122,49.089 27.334,45.799 27.1,43.751     "/>
+</g>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="-5.9629" y1="62.0957" x2="9.0176" y2="75.5842" gradientTransform="matrix(1.1364 0 0 -1.1364 37.0767 117.9015)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_14_)" d="M45.44,31.698c0,0,0.362-0.123,0.567-0.264s0.422-0.396,0.422-0.396     c4.821,4.653-0.893,10.256-8.693,13.034l0.18,2.818l-10.804-3.1l10.136-6.248l0.148,2.738     C42.812,38.235,46.341,35.017,45.44,31.698z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/applicationengine/bwins/msengineu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,38 @@
+EXPORTS
+	?DeleteDeletedMediaserversL@CMSEngine@@QAEXXZ @ 1 NONAME ; void CMSEngine::DeleteDeletedMediaserversL(void)
+	?DeleteFilledFilesL@CMSEngine@@QAEHXZ @ 2 NONAME ; int CMSEngine::DeleteFilledFilesL(void)
+	?DeleteMetadataL@CMSEngine@@QBEXXZ @ 3 NONAME ; void CMSEngine::DeleteMetadataL(void) const
+	?DriveSelectionStatus@CMSEngine@@QAEHXZ @ 4 NONAME ; int CMSEngine::DriveSelectionStatus(void)
+	?ExecuteFillPreProcessingL@CMSEngine@@QAEHXZ @ 5 NONAME ; int CMSEngine::ExecuteFillPreProcessingL(void)
+	?ExecuteStorePreProcessingL@CMSEngine@@QAEHXZ @ 6 NONAME ; int CMSEngine::ExecuteStorePreProcessingL(void)
+	?ExecuteSyncL@CMSEngine@@QAEHXZ @ 7 NONAME ; int CMSEngine::ExecuteSyncL(void)
+	?FillRulesL@CMSEngine@@QAEPAVCCmFillRuleContainer@@XZ @ 8 NONAME ; class CCmFillRuleContainer * CMSEngine::FillRulesL(void)
+	?GetAppWizardState@CMSEngine@@QAEHAAH@Z @ 9 NONAME ; int CMSEngine::GetAppWizardState(int &)
+	?GetDrivesL@CMSEngine@@QAEXAAV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 10 NONAME ; void CMSEngine::GetDrivesL(class RPointerArray<class CCmDriveInfo> &)
+	?GetFillListItemsL@CMSEngine@@QAEPAV?$RPointerArray@VCCmBaseListItem@@@@AAVTDesC8@@@Z @ 11 NONAME ; class RPointerArray<class CCmBaseListItem> * CMSEngine::GetFillListItemsL(class TDesC8 &)
+	?GetFilteredMetadataL@CMSEngine@@QAEXAAPAVCCmSqlPropertyCollector@@@Z @ 12 NONAME ; void CMSEngine::GetFilteredMetadataL(class CCmSqlPropertyCollector * &)
+	?GetItemCountsL@CMSEngine@@QBEHW4TCmService@@ABVTDesC8@@AAHAA_J@Z @ 13 NONAME ; int CMSEngine::GetItemCountsL(enum TCmService, class TDesC8 const &, int &, long long &) const
+	?GetMediaServersL@CMSEngine@@QAEPAV?$RPointerArray@VCCmMediaServerFull@@@@XZ @ 14 NONAME ; class RPointerArray<class CCmMediaServerFull> * CMSEngine::GetMediaServersL(void)
+	?GetStoreListItemsL@CMSEngine@@QAEPAV?$RPointerArray@VCCmBaseListItem@@@@AAVTDesC8@@@Z @ 15 NONAME ; class RPointerArray<class CCmBaseListItem> * CMSEngine::GetStoreListItemsL(class TDesC8 &)
+	?GetTransferInfo@CMSEngine@@QBEXW4TCmService@@AAH1@Z @ 16 NONAME ; void CMSEngine::GetTransferInfo(enum TCmService, int &, int &) const
+	?LastSyncTime@CMSEngine@@QBE?AVTTime@@XZ @ 17 NONAME ; class TTime CMSEngine::LastSyncTime(void) const
+	?NewL@CMSEngine@@SAPAV1@XZ @ 18 NONAME ; class CMSEngine * CMSEngine::NewL(void)
+	?NewLC@CMSEngine@@SAPAV1@XZ @ 19 NONAME ; class CMSEngine * CMSEngine::NewLC(void)
+	?PreProcessFillListL@CMSEngine@@QBEHABVTDesC8@@@Z @ 20 NONAME ; int CMSEngine::PreProcessFillListL(class TDesC8 const &) const
+	?ScanMediaServersL@CMSEngine@@QAEHXZ @ 21 NONAME ; int CMSEngine::ScanMediaServersL(void)
+	?ServerState@CMSEngine@@QAEXAAW4TCmServerState@@@Z @ 22 NONAME ; void CMSEngine::ServerState(enum TCmServerState &)
+	?ServiceState@CMSEngine@@QAE?AW4TCmServiceState@@W4TCmService@@@Z @ 23 NONAME ; enum TCmServiceState CMSEngine::ServiceState(enum TCmService)
+	?SetAppWizardState@CMSEngine@@QAEHXZ @ 24 NONAME ; int CMSEngine::SetAppWizardState(void)
+	?SetDrivesL@CMSEngine@@QAEXV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 25 NONAME ; void CMSEngine::SetDrivesL(class RPointerArray<class CCmDriveInfo>)
+	?SetFillFileStatusesL@CMSEngine@@QAEXPBV?$RPointerArray@VCCmBaseListItem@@@@@Z @ 26 NONAME ; void CMSEngine::SetFillFileStatusesL(class RPointerArray<class CCmBaseListItem> const *)
+	?SetFillRulesL@CMSEngine@@QAEXPAVCCmFillRuleContainer@@@Z @ 27 NONAME ; void CMSEngine::SetFillRulesL(class CCmFillRuleContainer *)
+	?SetMediaServersL@CMSEngine@@QAEHAAV?$RPointerArray@VCCmMediaServerFull@@@@@Z @ 28 NONAME ; int CMSEngine::SetMediaServersL(class RPointerArray<class CCmMediaServerFull> &)
+	?SetObserver@CMSEngine@@QAEXPAVMMSEngineObserver@@@Z @ 29 NONAME ; void CMSEngine::SetObserver(class MMSEngineObserver *)
+	?SetObserver@CMSEngineAO@@QAEXPAVMMSEngineObserver@@@Z @ 30 NONAME ; void CMSEngineAO::SetObserver(class MMSEngineObserver *)
+	?SetServiceState@CMSEngine@@QAEHW4TCmService@@W4TCmServiceState@@@Z @ 31 NONAME ; int CMSEngine::SetServiceState(enum TCmService, enum TCmServiceState)
+	?SetStoreRulesL@CMSEngine@@QAEXPAVCCmStoreRuleContainer@@@Z @ 32 NONAME ; void CMSEngine::SetStoreRulesL(class CCmStoreRuleContainer *)
+	?StopOperation@CMSEngine@@QAEXXZ @ 33 NONAME ; void CMSEngine::StopOperation(void)
+	?StoreRulesL@CMSEngine@@QAEPAVCCmStoreRuleContainer@@XZ @ 34 NONAME ; class CCmStoreRuleContainer * CMSEngine::StoreRulesL(void)
+	?UpdateFillListsL@CMSEngine@@QBEXXZ @ 35 NONAME ; void CMSEngine::UpdateFillListsL(void) const
+	?GetFilledFilesSize@CMSEngine@@QAEXAA_JH@Z @ 36 NONAME ; void CMSEngine::GetFilledFilesSize(long long &, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/applicationengine/eabi/msengineu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,39 @@
+EXPORTS
+	_ZN9CMSEngine10FillRulesLEv @ 1 NONAME
+	_ZN9CMSEngine10GetDrivesLER13RPointerArrayI12CCmDriveInfoE @ 2 NONAME
+	_ZN9CMSEngine10SetDrivesLE13RPointerArrayI12CCmDriveInfoE @ 3 NONAME
+	_ZN9CMSEngine11ServerStateER14TCmServerState @ 4 NONAME
+	_ZN9CMSEngine11SetObserverEP17MMSEngineObserver @ 5 NONAME
+	_ZN9CMSEngine11StoreRulesLEv @ 6 NONAME
+	_ZN9CMSEngine12ExecuteSyncLEv @ 7 NONAME
+	_ZN9CMSEngine12ServiceStateE10TCmService @ 8 NONAME
+	_ZN9CMSEngine13SetFillRulesLEP20CCmFillRuleContainer @ 9 NONAME
+	_ZN9CMSEngine13StopOperationEv @ 10 NONAME
+	_ZN9CMSEngine14SetStoreRulesLEP21CCmStoreRuleContainer @ 11 NONAME
+	_ZN9CMSEngine15SetServiceStateE10TCmService15TCmServiceState @ 12 NONAME
+	_ZN9CMSEngine16GetMediaServersLEv @ 13 NONAME
+	_ZN9CMSEngine16SetMediaServersLER13RPointerArrayI18CCmMediaServerFullE @ 14 NONAME
+	_ZN9CMSEngine17GetAppWizardStateERi @ 15 NONAME
+	_ZN9CMSEngine17GetFillListItemsLER6TDesC8 @ 16 NONAME
+	_ZN9CMSEngine17ScanMediaServersLEv @ 17 NONAME
+	_ZN9CMSEngine17SetAppWizardStateEv @ 18 NONAME
+	_ZN9CMSEngine18DeleteFilledFilesLEv @ 19 NONAME
+	_ZN9CMSEngine18GetStoreListItemsLER6TDesC8 @ 20 NONAME
+	_ZN9CMSEngine20DriveSelectionStatusEv @ 21 NONAME
+	_ZN9CMSEngine20GetFilteredMetadataLERP23CCmSqlPropertyCollector @ 22 NONAME
+	_ZN9CMSEngine20SetFillFileStatusesLEPK13RPointerArrayI15CCmBaseListItemE @ 23 NONAME
+	_ZN9CMSEngine25ExecuteFillPreProcessingLEv @ 24 NONAME
+	_ZN9CMSEngine26DeleteDeletedMediaserversLEv @ 25 NONAME
+	_ZN9CMSEngine26ExecuteStorePreProcessingLEv @ 26 NONAME
+	_ZN9CMSEngine4NewLEv @ 27 NONAME
+	_ZN9CMSEngine5NewLCEv @ 28 NONAME
+	_ZNK9CMSEngine12LastSyncTimeEv @ 29 NONAME
+	_ZNK9CMSEngine14GetItemCountsLE10TCmServiceRK6TDesC8RiRx @ 30 NONAME
+	_ZNK9CMSEngine15DeleteMetadataLEv @ 31 NONAME
+	_ZNK9CMSEngine15GetTransferInfoE10TCmServiceRiS1_ @ 32 NONAME
+	_ZNK9CMSEngine16UpdateFillListsLEv @ 33 NONAME
+	_ZNK9CMSEngine19PreProcessFillListLERK6TDesC8 @ 34 NONAME
+	_ZTI9CMSEngine @ 35 NONAME ; #<TI>#
+	_ZTV9CMSEngine @ 36 NONAME ; #<VT>#
+	_ZN9CMSEngine18GetFilledFilesSizeERxi @ 37 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/applicationengine/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project Application Engine
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/msengine.h           |../../../../../inc/msengine.h
+../inc/msengineobserver.h   |../../../../../inc/msengineobserver.h
+
+PRJ_MMPFILES
+msengine.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/applicationengine/group/msengine.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project Application Engine
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          MSEngine.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x1028290C
+
+VENDORID        VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../../group
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../../../inc
+
+SOURCEPATH      ../src
+SOURCE          msengine.cpp
+SOURCE          msengineao.cpp
+
+LIBRARY         euser.lib
+LIBRARY         cmclient.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/applicationengine/inc/msengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,421 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  file sharing engine class definition
+*
+*/
+
+
+
+#ifndef __MSENGINE_H__
+#define __MSENGINE_H__
+
+
+//  Include Files
+#include <e32base.h>
+#include "contentmanager.h"
+#include "cmbaselistitem.h"
+
+// FORWARD DECLARATIONS
+class CMSEngineAO;
+class MMSEngineObserver;
+class CCmBaseListitem;
+class CCmSqlPropertyCollector;
+
+// CLASS DECLARATION
+
+/**
+ *  Media Servant engine class for Media Servant application
+ *
+ *  @lib msengine.lib
+ *
+ *  @since S60 5.1
+ */
+class CMSEngine : public CBase
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CMSEngine* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CMSEngine* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMSEngine();
+
+    /**
+     * Scans media servers on the network
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    IMPORT_C TInt ScanMediaServersL();
+
+    /**
+     * Start store & fill operations
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    IMPORT_C TInt ExecuteSyncL();
+
+    /**
+     * Preprocesses files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    IMPORT_C TInt ExecuteStorePreProcessingL();
+
+    /**
+     * Preprocesses files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    IMPORT_C TInt ExecuteFillPreProcessingL();
+
+    /**
+     * Cancels current operation
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    IMPORT_C void StopOperation();
+
+    /**
+     * Sets observer for active object
+     *
+     * @since S60 5.1
+     * @param MMSEngineObserver*, observer class
+     * @return None
+     */
+    IMPORT_C void SetObserver( MMSEngineObserver* aObserver );
+
+    /**
+     * Gets fill rules
+     *
+     * @since S60 5.1
+     * @param None
+     * @return pointer to fill rule container object
+     */
+    IMPORT_C CCmFillRuleContainer* FillRulesL();
+    /**
+     * Get filled files size
+     * @since S60 5.1
+     * @param aSize reference to filled files size
+     * @param aID id of fill rule
+     */
+    IMPORT_C void GetFilledFilesSize( TInt64& aSize, const TInt aID );
+
+    /**
+     * Sets Fill rules
+     *
+     * @since S60 5.1
+     * @param aFillRules reference to fill rule container object
+     * @return None
+     */
+    IMPORT_C void SetFillRulesL( CCmFillRuleContainer* aFillRules );
+
+    /**
+     * Gets store rules
+     *
+     * @since S60 5.1
+     * @param None
+     * @return pointer to store rule container object
+     */
+    IMPORT_C CCmStoreRuleContainer* StoreRulesL();
+
+    /**
+     * Sets Store rules
+     *
+     * @since S60 5.1
+     * @param aStoreRules reference to store rule container object
+     * @return None
+     */
+    IMPORT_C void SetStoreRulesL( CCmStoreRuleContainer* aStoreRules );
+
+    /**
+     * Reads server state
+     *
+     * @since S60 5.1
+     * @param aState, server state
+     * @return None
+     */
+    IMPORT_C void ServerState( TCmServerState& aState );
+
+    /**
+     * Gets service state
+     *
+     * @since S60 5.1
+     * @param aService, service type
+     * @return TCmServiceState, service state
+     */
+    IMPORT_C TCmServiceState ServiceState( const TCmService aService );
+
+    /**
+     * Sets service state
+     *
+     * @since S60 5.1
+     *
+     * @param aService, service type
+     * @param aState, service state
+     * @return TInt, error
+     */
+    IMPORT_C TInt SetServiceState( const TCmService aService,
+                                   TCmServiceState aState );
+
+    /**
+     * Gets media servers
+     *
+     * @since S60 5.1
+     * @param None
+     * @return RPointerArray*, mediaservers
+     */
+    IMPORT_C RPointerArray<CCmMediaServerFull>* GetMediaServersL();
+
+    /**
+     * Sets media servers
+     *
+     * @since S60 5.1
+     * @param aMediaServers, mediaservers
+     * @return KErrNone if successfull
+     */
+    IMPORT_C TInt SetMediaServersL(
+                    RPointerArray<CCmMediaServerFull>& aMediaServers );
+
+    /**
+     * Deletes filled files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    IMPORT_C TInt DeleteFilledFilesL();
+
+    /**
+     * Gets store list items
+     *
+     * @since S60 5.1
+     * @param aRuleName, name of the rule.
+     * @return RPointerArray*, store list items
+     */
+    IMPORT_C RPointerArray<CCmBaseListItem>* GetStoreListItemsL(
+                                                      TDesC8& aRuleName);
+
+    /**
+     * Gets fill list items
+     *
+     * @since S60 5.1
+     * @param aRuleName, name of the rule.
+     * @return RPointerArray*, fill list items
+     */
+    IMPORT_C RPointerArray<CCmBaseListItem>* GetFillListItemsL(
+                                                      TDesC8& aRuleName);
+
+    /**
+     * Returns item count for a list of a service (fill or store)
+     *
+     * @since S60 5.1
+     * @param aService defines the service
+     * @param aListName list name
+     * @param aCount, item count
+     * @param aSize, size in MBs
+     * @return item count (fill case in bytes, store case number of items)
+     */
+    IMPORT_C TInt GetItemCountsL( const TCmService aService,
+                                  const TDesC8& aListName,
+                                  TInt& aCount,
+                                  TInt64& aSize ) const;
+
+    /**
+     * Preprocesses a fill list
+     *
+     * @since S60 5.1
+     * @param aListName, list name to be preprocessed
+     * @return TInt, error code
+     */
+    IMPORT_C TInt PreProcessFillListL( const TDesC8& aListName ) const;
+
+    /**
+     * Updates fill lists
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    IMPORT_C void UpdateFillListsL() const;
+
+    /**
+     * Deletes metadata collected from given servers
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    IMPORT_C void DeleteMetadataL() const;
+
+    /**
+     * Gets app wizard state information.
+     *
+     * @since S60 5.1
+     * @param aErrorCode defines operation success information
+     * @return ETrue if application wizard first run has been executed.
+     */
+    IMPORT_C TBool GetAppWizardState( TInt& aErrorCode );
+
+    /**
+     * Sets app wizard state information.
+     *
+     * @since S60 5.1
+     * @param None
+     * @return KErrNone if successfull.
+     */
+    IMPORT_C TInt SetAppWizardState();
+
+    /**
+     * Gets last sync time
+     *
+     * @since S60 5.1
+     * @param None
+     * @return last sync time
+     */
+    IMPORT_C TTime LastSyncTime() const;
+
+    /**
+     * Sets fill file statuses
+     *
+     * @since S60 5.1
+     * @param aItems reference to item array containing statuses
+     * @return None         
+     */
+    IMPORT_C void SetFillFileStatusesL(
+                        const RPointerArray<CCmBaseListItem>* aItems );
+
+    /**
+     * Get transfer item count and time for a service
+     *
+     * @since S60 5.1
+     * @param aService defines the service
+     * @param aItemCount returns count
+     * @param aTimeInSec returns time
+     * @return None
+     */
+    IMPORT_C void GetTransferInfo( const TCmService aService,
+                                   TInt& aItemCount,
+                                   TInt& aTimeInSec ) const;
+
+    /**
+     * Deletes media servers from db ( servers with deleted status )
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    IMPORT_C void DeleteDeletedMediaserversL();
+
+    /**
+     * Sets drives
+     *
+     * @since S60 5.1    
+     * @param aDrives, drive info array
+     * @return None
+     */
+    IMPORT_C void SetDrivesL( RPointerArray<CCmDriveInfo> aDrives );
+
+    /**
+     * Gets drives
+     *
+     * @since S60 5.1
+     * @param aDrives, drives on return
+     * @return None
+     */
+    IMPORT_C void GetDrivesL( RPointerArray<CCmDriveInfo>& aDrives );
+
+    /**
+     * Gets drive selection info
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TBool, ETrue if drive(s) selected, EFalse otherwise
+     */
+    IMPORT_C TBool DriveSelectionStatus();
+
+    /**
+     * Gets metadata
+     *
+     * @since S60 5.1
+     * @param aCollector, group of metadata categories
+     * @return None
+     */
+    IMPORT_C void GetFilteredMetadataL(
+                        CCmSqlPropertyCollector*& aCollector );
+    
+private:
+
+    /**
+     * Opens Content Manager session
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    TInt OpenServerSession();
+
+    /**
+     * Closes Content Manager session
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None         
+     */
+    TInt CloseServerSession();
+    
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CMSEngine();
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+
+private:
+
+    /**
+     * Active object for asynchronous file sharing
+     */
+    CMSEngineAO*                    iAO;        // owned
+    /**
+     * mediaserver session handle
+     */
+    RContentManager                 iCMServer;  // owned
+    };
+
+#endif  // __MSENGINE_H__
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/applicationengine/inc/msengineao.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  file sharing engine active object class definition
+*
+*/
+
+
+
+#ifndef __MSENGINEAO_H__
+#define __MSENGINEAO_H__
+
+
+// Include Files
+#include "contentmanager.h"
+
+// FORWARD DECLARATIONS
+class CMSEngine;
+class MMSEngineObserver;
+
+
+// CLASS DECLARATION
+/**
+ * Active object class for MSEngine
+ *
+ * @lib msengine.lib
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSEngineAO ): public CActive
+    {
+private:
+    // Active object states
+    enum TMSEngineAOState
+        {
+        EMSEngineStateNone = 0,
+        EMSEngineHarvest,
+        EMSEngineFill,
+        EMSEngineStore,
+        EMSEngineDeleteFiles,
+        EMSEnginePreprocess,
+        EMSEngineGetMetadata,
+        EMSEnginePreprocessList,
+        EMSEngineDeleteMetadata,
+        EMSUpdateFillLists
+        };
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param CMSEngine*, pointer to mediaservant engine.
+     * @return 5.1
+     */
+    static CMSEngineAO* NewL( CMSEngine* aEngine );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMSEngineAO();
+
+    /**
+     * Scans media Servers
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    TInt ScanMediaServersL();
+
+    /**
+     * Start fill operation
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void ExecuteFillL();
+
+    /**
+     * Start store operation
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    TInt ExecuteStoreL();
+
+    /**
+     * Sets observer for active object
+     *
+     * @since S60 5.1
+     * @param MMSEngineObserver*, pointer to the observer object.
+     * @return None
+     */
+    IMPORT_C void SetObserver(MMSEngineObserver* aObserver);
+
+    /**
+     * Cancels current operation
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void StopOperation();
+
+    /**
+     * Informs server that application is shutting down
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None         
+     */
+    void ApplicationExit();
+
+    /**
+     * Deletes filled files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    TInt DeleteFilledFilesL();
+
+    /**
+     * Preprocesses file information for store.
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None         
+     */
+    TInt ExecuteStorePreProcessingL();
+
+    /**
+     * Preprocesses file information for fill.
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None         
+     */
+    TInt ExecuteFillPreProcessingL();
+
+    /**
+     * Gets metadata
+     *
+     * @since S60 5.1
+     * @param aCollector, group of metadata categories
+     * @return None
+     */
+    void GetFilteredMetadataL( CCmSqlPropertyCollector*& aCollector );
+
+    /**
+     * Preprocesses one fill list.
+     *
+     * @since S60 5.1
+     * @param aListName, list name to be preprocessed
+     * @return TInt, error code
+     */
+    TInt PreProcessFillListL( const TDesC8& aListName );
+
+    /**
+     * Update fill lists.
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None         
+     */
+    void UpdateFillListsL();
+
+    /**
+     * Deletes metadata collected from given servers.
+     *
+     * @since S60 5.1
+     * @param aServerList, list of servers
+     * @return None
+     */
+    void DeleteMetadataL();
+        
+protected:
+    
+// From base class CActive
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    virtual void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    virtual void DoCancel();
+
+private:
+
+    /**
+     * C++ default constructor.
+     * @param aEngine*, pointer to mediaservant engine
+     */
+    CMSEngineAO( CMSEngine* aEngine );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Opens Content Manager session
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    TInt OpenServerSession();
+
+    /**
+     * Closes Content Manager session
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    TInt CloseServerSession();
+
+private:
+
+    /**
+     * file sharing engine pointer
+     */
+    CMSEngine*                  iEngine;            // not owned
+
+    /**
+     * mediaserver session handle
+     */
+    RContentManager             iContentManager;    // owned
+
+    /**
+     * engine observer
+     */
+    MMSEngineObserver*          iObserver;          // not owned
+
+    /**
+     * current operation
+     */
+    TCmService                  iCurrentService;
+
+    /**
+     * Active object state
+     */
+    TMSEngineAOState           iState;
+    };
+
+#endif  // __MSENGINEAO_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/applicationengine/inc/msengineobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observer class definition
+*
+*/
+
+
+#ifndef __MSENGINEOBSERVER_H__
+#define __MSENGINEOBSERVER_H__
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "cmcommon.h"
+
+/**
+ *  File sharing observer definition
+ *
+ *  @lib msengine.lib
+ *
+ *  @since S60 5.1
+ */
+class MMSEngineObserver
+    {
+    public:
+        /**
+         * Function informs when process is ready
+         *
+         * @since S60 5.1 
+        * @param aService, completed service
+        * @param aError, error code        
+        * @return None
+         */
+        virtual void ReadyL( TCmService aService, TInt aError ) = 0;
+    };
+
+#endif //__MSENGINEOBSERVER_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/applicationengine/src/msengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,550 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUPnPFileSharingEngine class implementation
+*
+*/
+
+
+
+//  Include Files
+#include "contentmanager.h"
+#include "msengine.h"
+#include "msengineao.h"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSEngine::CMSEngine
+// --------------------------------------------------------------------------
+//
+CMSEngine::CMSEngine()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::CMSEngine") );
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSEngine::NewLC
+// --------------------------------------------------------------------------
+//
+EXPORT_C CMSEngine* CMSEngine::NewLC()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::NewLC") );
+
+    CMSEngine* self = new (ELeave) CMSEngine;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::NewL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CMSEngine* CMSEngine::NewL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::NewL") );
+
+    CMSEngine* self = CMSEngine::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSEngine::ConstructL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::ConstructL") );
+
+    // Open Content manager server
+    OpenServerSession();
+
+    // Create active object
+    iAO = CMSEngineAO::NewL( this );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::~CMSEngine
+// --------------------------------------------------------------------------
+//
+CMSEngine::~CMSEngine()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::~CMSEngine") );
+
+    TCmServerState state;
+    ServerState( state );
+
+    if ( state != ECmServerStateIdle )
+        {
+        LOG( _L( "[MediaServant]\t CMSEngine::\
+        ~CMSEngine cancel operation" ) );
+
+        // notify server that observer is shutting down
+        if( iAO )
+            {
+            iAO->ApplicationExit();
+            }
+        }
+
+    // Close Content manager server
+    CloseServerSession();
+
+    delete iAO;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::ScanMediaServersL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSEngine::ScanMediaServersL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::ScanMediaServersL") );
+
+    TInt error = iAO->ScanMediaServersL();
+
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::ExecuteSyncL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSEngine::ExecuteSyncL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::ExecuteSyncL") );
+
+    // Fill will be started when store is ready.
+    TInt error = iAO->ExecuteStoreL();
+
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::ExecuteStorePreProcessingL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSEngine::ExecuteStorePreProcessingL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::ExecuteStorePreProcessingL") );
+
+    TInt error = iAO->ExecuteStorePreProcessingL();
+
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::ExecuteFillPreProcessingL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSEngine::ExecuteFillPreProcessingL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::ExecuteFillPreProcessingL") );
+
+    TInt error = iAO->ExecuteFillPreProcessingL();
+
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::GetStoreListItemsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C RPointerArray<CCmBaseListItem>* CMSEngine::GetStoreListItemsL(
+                                                          TDesC8& aRuleName)
+    {
+    LOG(_L("[MediaServant ENG]\t CMSEngine::GetStoreListItemsL"));
+
+    RPointerArray<CCmBaseListItem>* storeListItems = NULL;
+    if ( &iCMServer )
+        {
+        storeListItems = iCMServer.ListItemsL( aRuleName, ECmServiceStore );
+        }
+
+    return storeListItems;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::GetFillListItemsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C RPointerArray<CCmBaseListItem>* CMSEngine::GetFillListItemsL(
+                                                          TDesC8& aRuleName)
+    {
+    LOG(_L("[MediaServant ENG]\t CMSEngine::GetFillListItemsL"));
+
+    RPointerArray<CCmBaseListItem>* fillListItems = NULL;
+
+    fillListItems = iCMServer.ListItemsL( aRuleName, ECmServiceFill );
+
+    return fillListItems;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::StopOperation
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::StopOperation()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::StopOperation") );
+
+    iAO->StopOperation();
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::FillRulesL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CCmFillRuleContainer* CMSEngine::FillRulesL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::FillRulesL") );
+
+    return ( iCMServer.FillRulesL() );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::StoreRulesL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CCmStoreRuleContainer* CMSEngine::StoreRulesL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::StoreRulesL") );
+
+    return ( iCMServer.StoreRulesL() );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::SetStoreRulesL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::SetStoreRulesL( CCmStoreRuleContainer* aStoreRules )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::SetStoreRulesL") );
+
+    iCMServer.SetStoreRulesL( *aStoreRules );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::SetFillRulesL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::SetFillRulesL( CCmFillRuleContainer* aFillRules )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::SetFillRulesL") );
+
+    iCMServer.SetFillRulesL( *aFillRules );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::GetFilledFilesSize
+// Get filled files size
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::GetFilledFilesSize( TInt64& aSize, const TInt aID )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::GetFilledFilesSize") );
+
+    iCMServer.GetFilledFilesSize( aSize, aID );
+    }
+
+// CMSEngine::ServerState
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::ServerState( TCmServerState& aState )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::ServerState") );
+
+    aState = iCMServer.ServerState();
+    }
+
+// -------------------------------------------------------------------------
+// CMSEngine::ServiceState
+// --------------------------------------------------------------------------
+EXPORT_C TCmServiceState CMSEngine::ServiceState( const TCmService aService )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::ServiceState") );
+
+    TCmServiceState state;
+
+    state = iCMServer.ServiceState( aService );
+
+    return state;
+    }
+
+// -------------------------------------------------------------------------
+// CMSEngine::SetServiceState
+// --------------------------------------------------------------------------
+EXPORT_C TInt CMSEngine::SetServiceState( const TCmService aService,
+                                          TCmServiceState aState )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::SetServiceState") );
+
+    TInt error = iCMServer.SetServiceState( aService, aState );
+
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::MediaServersL
+// --------------------------------------------------------------------------
+//
+EXPORT_C RPointerArray<CCmMediaServerFull>*
+                        CMSEngine::GetMediaServersL()
+    {
+    LOG(_L("[MediaServant ENG]\t CMSEngine::GetMediaServersL"));
+
+    return ( iCMServer.MediaserversL() );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::SetMediaServersL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSEngine::SetMediaServersL(
+    RPointerArray<CCmMediaServerFull>& aMediaServers )
+    {
+
+    LOG( _L("[MediaServant ENG]\t CMSEngine::SetMediaServersL") );
+
+    TInt error = iCMServer.SetMediaserversL( aMediaServers );
+
+    return error;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSEngine::DeleteDeletedMediaserversL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::DeleteDeletedMediaserversL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::DeleteDeletedMediaserversL") );
+
+    iCMServer.DeleteDeletedMediaserversL();
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSEngine::DeleteFilledFiles
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSEngine::DeleteFilledFilesL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::DeleteFilledFilesL") );
+
+    TInt error = iAO->DeleteFilledFilesL();
+
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::GetItemCountsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSEngine::GetItemCountsL( const TCmService aService,
+                                         const TDesC8& aListName,
+                                         TInt& aCount,
+                                         TInt64& aSize ) const
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::GetItemCountsL") );
+
+    TInt error = iCMServer.GetItemCountsL( aService,
+                                           aListName,
+                                           aCount,
+                                           aSize );
+
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::GetFilteredMetadataL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::GetFilteredMetadataL(
+                            CCmSqlPropertyCollector*& aCollector )
+    {
+    LOG(_L("[MediaServant ENG]\t CMSEngine::GetFilteredMetadataL"));
+
+    iAO->GetFilteredMetadataL( aCollector );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::PreProcessFillList
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSEngine::PreProcessFillListL( const TDesC8& aListName ) const
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::PreProcessFillList") );
+
+    TInt error = iAO->PreProcessFillListL( aListName );
+
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::UpdateFillListsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::UpdateFillListsL() const
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::UpdateFillListsL") );
+
+    iAO->UpdateFillListsL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::DeleteMetaDataL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::DeleteMetadataL() const
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::DeleteMetaDataL") );
+
+    iAO->DeleteMetadataL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::GetAppWizardState
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CMSEngine::GetAppWizardState( TInt& /*aErrorCode*/ )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::GetAppWizardState") );
+
+    TBool retVal = iCMServer.AppWizardState();
+
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSEngine::SetAppWizardStateL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSEngine::SetAppWizardState()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::SetAppWizardState") );
+
+    TInt retVal = iCMServer.SetAppWizardState();
+
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::SetObserver
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::SetObserver( MMSEngineObserver* aObserver )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::SetObserver") );
+
+    iAO->SetObserver( aObserver );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::LastSyncTime
+// --------------------------------------------------------------------------
+//
+EXPORT_C TTime CMSEngine::LastSyncTime() const
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::LastSyncTime") );
+
+    return ( iCMServer.LastSyncTime() );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::SetFillFileStatusesL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::SetFillFileStatusesL(
+            const RPointerArray<CCmBaseListItem>* aItems )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::SetFillFileStatusesL") );
+
+    iCMServer.SetFillFileStatusesL( *aItems );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::GetTransferInfo
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::GetTransferInfo( const TCmService aService,
+                                          TInt& aItemCount,
+                                          TInt& aTimeInSec ) const
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::GetTransferInfo") );
+
+    iCMServer.GetTransferInfo( aService,
+                               aItemCount,
+                               aTimeInSec );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::SetDrivesL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::SetDrivesL( RPointerArray<CCmDriveInfo> aDrives )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::SetDrivesL") );
+
+    iCMServer.SetDrivesL( aDrives );
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSEngine::GetDrivesL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CMSEngine::GetDrivesL( RPointerArray<CCmDriveInfo>& aDrives )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::GetDrivesL") );
+
+    iCMServer.GetDrivesL( aDrives );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::DriveSelectionStatus
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CMSEngine::DriveSelectionStatus()
+    {
+    LOG(_L("[MediaServant ENG]\t CMSEngine::DriveSelectionStatus"));
+
+    return iCMServer.DriveSelectionStatus();
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::OpenServerSession
+// --------------------------------------------------------------------------
+//
+TInt CMSEngine::OpenServerSession()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::OpenServerSession") );
+    TInt error = iCMServer.Connect();
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::CloseServerSession
+// --------------------------------------------------------------------------
+//
+TInt CMSEngine::CloseServerSession()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngine::CloseServerSession") );
+
+    return ( iCMServer.Close() );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/applicationengine/src/msengineao.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,536 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSEngineAO class implementation
+*
+*/
+
+
+
+//  Include Files
+#include "msengineobserver.h"
+#include "msengineao.h"
+#include "msengine.h"
+#include "msdebug.h"
+
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::CMSEngineAO
+// ---------------------------------------------------------------------------
+//
+CMSEngineAO::CMSEngineAO( CMSEngine* aEngine )
+            : CActive( CActive::EPriorityStandard ),
+              iEngine( aEngine )
+    {
+    LOG( _L( "[MediaServant ENG]\t CMSEngineAO::CMSEngineAO" ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::NewL
+// ---------------------------------------------------------------------------
+//
+CMSEngineAO* CMSEngineAO::NewL( CMSEngine* aEngine )
+    {
+    LOG(_L("[MediaServant ENG]\t CMSEngineAO::NewL"));
+
+    CMSEngineAO* self = new ( ELeave ) CMSEngineAO( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMSEngineAO::ConstructL()
+    {
+    LOG( _L("[MediaServant]\t CMSEngineAO::ConstructL") );
+
+    // Add this active object to the active scheduler.
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::~CMSEngineAO
+// ---------------------------------------------------------------------------
+//
+CMSEngineAO::~CMSEngineAO()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::~CMSEngineAO") );
+
+    // cancel any ongoing operation
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::RunL
+// ---------------------------------------------------------------------------
+//
+void CMSEngineAO::RunL()
+    {
+    TRACE( Print( _L("[MediaServant ENG]\t CMSEngineAO::RunL \
+    iStatus = %d" ), iStatus.Int() ) );
+
+    switch ( iState )
+        {
+        case EMSEngineStore:
+            {
+            // stop if error occurs
+            if ( iStatus.Int() == KErrNone  )
+                {
+                LOG(_L("[MediaServant ENG]\t CMSEngineAO::RunL start store"));
+                // Store ok, continue by executing fill operation.
+                ExecuteFillL();
+                }
+            else
+                {
+                // Close server session due to error.
+                CloseServerSession();
+                // Inform the observer about error.
+                iObserver->ReadyL( iCurrentService, iStatus.Int() );
+                }
+            break;
+            }
+        case EMSEngineFill:
+        // fall through
+        case EMSEngineHarvest:
+        // fall through
+        case EMSEngineDeleteFiles:
+        // fall through
+        case EMSEnginePreprocess:
+        // fall through
+        case EMSEngineGetMetadata:
+        // fall through
+        case EMSEnginePreprocessList:
+        // fall through
+        case EMSEngineDeleteMetadata:
+        // fall through
+        case EMSUpdateFillLists:
+            {
+            CloseServerSession();
+            // report for application
+            iObserver->ReadyL( iCurrentService, iStatus.Int() );
+            LOG( _L("[MediaServant ENG]\t CMSEngineAO::RunL close session") );
+            break;
+            }
+        default:
+            {
+            LOG( _L("[MediaServant ENG]\t CMSEngineAO::RunL \
+            not valid state") );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CMSEngineAO::DoCancel()
+    {
+    LOG( _L( "[MediaServant ENG]\t CMSEngineAO::DoCancel" ) );
+
+    iContentManager.Cancel();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::ScanMediaServersL
+// ---------------------------------------------------------------------------
+//
+TInt CMSEngineAO::ScanMediaServersL()
+    {
+    LOG( _L( "[MediaServant ENG]\t CMSEngineAO::ScanMediaServersL" ) );
+
+    // Open content manager session.
+    TInt error = OpenServerSession();
+
+    if ( !error )
+        {
+        // Session created. Update state variables and execute service.
+        iCurrentService = ECmServiceHarvest;
+        iState = EMSEngineHarvest;
+        iContentManager.ExecuteService( ECmServiceHarvest, iStatus );
+
+        if ( IsActive() )
+            {
+            User::Leave( KErrInUse );
+            }
+        else
+            {
+            // Enable active object
+            SetActive();
+            }
+        }
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::ExecuteFillL
+// ---------------------------------------------------------------------------
+//
+void CMSEngineAO::ExecuteFillL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::ExecuteFillL") );
+
+    // Update state variables and execute fill service.
+    iCurrentService = ECmServiceFill;
+    iState = EMSEngineFill;
+    iContentManager.ExecuteService( ECmServiceFill, iStatus );
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    else
+        {
+        // Enable active object
+        SetActive();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::ExecuteStoreL
+// ---------------------------------------------------------------------------
+//
+TInt CMSEngineAO::ExecuteStoreL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::ExecuteStoreL") );
+
+    iCurrentService = ECmServiceStore;
+    iState = EMSEngineStore;
+
+    // Open content manager session.
+    TInt error = OpenServerSession();
+
+    if ( !error )
+        {
+        iContentManager.ExecuteService( ECmServiceStore, iStatus );
+
+        if ( IsActive() )
+            {
+            User::Leave( KErrInUse );
+            }
+        else
+            {
+            // Enable active object
+            SetActive();
+            }
+        }
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::DeleteFilledFilesL()
+// ---------------------------------------------------------------------------
+//
+TInt CMSEngineAO::DeleteFilledFilesL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::DeleteFilledFilesL") );
+
+    // Open content manager session.
+    TInt error = OpenServerSession();
+    iState = EMSEngineDeleteFiles;
+    if ( !error )
+        {
+        // Session created. Update state variables and execute service.
+        iCurrentService = ECmServiceDeleteFilledFiles;
+        iState = EMSEngineDeleteFiles;
+        error = iContentManager.ExecuteService( ECmServiceDeleteFilledFiles,
+                                                iStatus );
+
+        if ( IsActive() )
+            {
+            User::Leave( KErrInUse );
+            }
+        else
+            {
+            // Enable active object
+            SetActive();
+            }
+        }
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::ExecuteStorePreProcessingL()
+// ---------------------------------------------------------------------------
+//
+TInt CMSEngineAO::ExecuteStorePreProcessingL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::ExecuteStorePreProcessingL") );
+
+    // Open content manager session.
+    TInt error = OpenServerSession();
+
+    if ( !error )
+        {
+        iCurrentService = ECmServicePreProcessingStore;
+        iState = EMSEnginePreprocess;
+        error = iContentManager.ExecuteService( ECmServicePreProcessingStore,
+                                                iStatus );
+
+        if ( IsActive() )
+            {
+            User::Leave( KErrInUse );
+            }
+        else
+            {
+            // Enable active object
+            SetActive();
+            }
+        }
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::ExecuteFillPreProcessingL()
+// ---------------------------------------------------------------------------
+//
+TInt CMSEngineAO::ExecuteFillPreProcessingL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::ExecuteFillPreProcessingL") );
+
+    // Open content manager session.
+    TInt error = OpenServerSession();
+
+    if ( !error )
+        {
+        iCurrentService = ECmServicePreProcessingFill;
+        iState = EMSEnginePreprocess;
+        error = iContentManager.ExecuteService( ECmServicePreProcessingFill,
+                                                iStatus );
+
+        if ( IsActive() )
+            {
+            User::Leave( KErrInUse );
+            }
+        else
+            {
+            // Enable active object
+            SetActive();
+            }
+        }
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngine::GetFilteredMetadataL
+// --------------------------------------------------------------------------
+//
+void CMSEngineAO::GetFilteredMetadataL(
+                            CCmSqlPropertyCollector*& aCollector )
+    {
+    LOG(_L("[MediaServant ENG]\t CMSEngine::GetFilteredMetadataL"));
+
+    // Open content manager session.
+    User::LeaveIfError( OpenServerSession() );
+
+    iCurrentService = ECmServiceFill;
+    iState = EMSEngineGetMetadata;
+    iContentManager.GetFilteredMetadataL( iCurrentService,
+                                          aCollector,
+                                          iStatus );
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    else
+        {
+        // Enable active object
+        SetActive();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngineAO::PreProcessFillList
+// --------------------------------------------------------------------------
+//
+TInt CMSEngineAO::PreProcessFillListL( const TDesC8& aListName )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::PreProcessFillListL") );
+
+    // Open content manager session.
+    TInt error = OpenServerSession();
+
+    if ( !error )
+        {
+        iCurrentService = ECmServicePreProcessingFilllist;
+        iState = EMSEnginePreprocessList;
+        error = iContentManager.PreProcessFillList( aListName, iStatus );
+
+        if ( IsActive() )
+            {
+            User::Leave( KErrInUse );
+            }
+        else
+            {
+            // Enable active object
+            SetActive();
+            }
+        }
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngineAO::UpdateFillListsL
+// --------------------------------------------------------------------------
+//
+void CMSEngineAO::UpdateFillListsL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::UpdateFillListsL") );
+
+    // Open content manager session.
+    User::LeaveIfError( OpenServerSession() );
+
+    iCurrentService = ECmServiceUpdateFillLists;
+    iState = EMSUpdateFillLists;
+    iContentManager.UpdateFillListsL( iStatus );
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    else
+        {
+        // Enable active object
+        SetActive();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSEngineAO::DeleteMetadataL
+// --------------------------------------------------------------------------
+//
+void CMSEngineAO::DeleteMetadataL()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::DeleteMetadataL") );
+
+    // Open content manager session.
+    User::LeaveIfError( OpenServerSession() );
+
+    iCurrentService = ECmServiceDeleteMetadata;
+    iState = EMSEngineDeleteMetadata;
+    iContentManager.DeleteMetadataL( iStatus );
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    else
+        {
+        // Enable active object
+        SetActive();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::OpenServerSession
+// ---------------------------------------------------------------------------
+//
+TInt CMSEngineAO::OpenServerSession()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::OpenServerSession") );
+
+    TInt error( KErrInUse );
+    // Enable active object
+    if ( !IsActive() )
+        {
+        error = iContentManager.Connect();
+        }
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::CloseServerSession
+// ---------------------------------------------------------------------------
+//
+TInt CMSEngineAO::CloseServerSession()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::CloseServerSession") );
+
+    TInt error = KErrNone;
+    iContentManager.Close();
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::ApplicationExit
+// ---------------------------------------------------------------------------
+//
+void CMSEngineAO::ApplicationExit()
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::ApplicationExit") );
+
+    if ( !IsActive() )
+        {
+        OpenServerSession();
+        }
+    iContentManager.ApplicationExit();
+    if ( IsActive() || iContentManager.Handle() )
+        {
+        CloseServerSession();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::StopOperation
+// ---------------------------------------------------------------------------
+//
+void CMSEngineAO::StopOperation()
+    {
+    LOG(_L("[MediaServant ENG]\t CMSEngineAO::StopOperation"));
+
+    if ( IsActive() )
+        {
+        LOG(_L("[MediaServant ENG]\t CMSEngineAO::StopOperation active \
+        cancelled"));
+        Cancel();
+        }
+    else
+        {
+        LOG( _L("[MediaServant ENG]\t CMSEngineAO::StopOperation \
+        contentmanager cancelled") );
+        // This is used to cancel scheduler initiated operation
+        // Open server session first
+        OpenServerSession();
+        iContentManager.Cancel();
+        }
+
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::StopOperation Server \
+    cancelled") );
+    CloseServerSession();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSEngineAO::SetObserver
+// ---------------------------------------------------------------------------
+//
+void CMSEngineAO::SetObserver( MMSEngineObserver* aObserver )
+    {
+    LOG( _L("[MediaServant ENG]\t CMSEngineAO::SetObserver") );
+
+    iObserver = aObserver;
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_app_context_icon.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+<?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>
+<g>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-37.1514" y1="69.3965" x2="-14.5089" y2="92.8435" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1476 118.3501)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M10.296,28.929C6.813,20.96,16.49,17.178,21.569,15.37c-0.636-1.41-0.421-1.602-1.06-3.014     C9.172,16.394,4.98,22.296,10.296,28.929"/>
+<polygon fill="#005795" points="36.01,7.534 35.579,10.168 21.148,19.361 20.701,16.379    "/>
+<path fill="#005795" d="M10.813,28.46c-2.117-0.899-6.746-8.331-6.746-8.331c-0.245,3.836,3.109,8.977,7.025,10.742L10.813,28.46     z"/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-570.1191" y1="876.1367" x2="-578.1451" y2="852.8275" gradientTransform="matrix(-1.1364 0 0 1.1364 -633.4719 -965.9116)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M10.604,28.421C-2.945,21.395,6.418,11.65,19.873,7.134L19.603,3.1l16.396,4.437l-15.382,8.939     l-0.226-3.922C10.105,16.224,4.413,22.513,10.604,28.421z"/>
+</g>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="47.5884" y1="26.6709" x2="47.5884" y2="46.6662">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1601" style="stop-color:#F6F6F6"/>
+<stop offset="0.3124" style="stop-color:#EAEAEA"/>
+<stop offset="0.4639" style="stop-color:#D6D7D7"/>
+<stop offset="0.615" style="stop-color:#BBBBBB"/>
+<stop offset="0.7657" style="stop-color:#979797"/>
+<stop offset="0.9142" style="stop-color:#6D6D6D"/>
+<stop offset="1" style="stop-color:#505151"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M47.35,31.638c0,0-0.34-0.261-0.416-0.319c0,5.556,0,16.082,0,16.082     c0,1.333-1.117,2.087-1.807,2.2c0,0,3.586-0.968,4.104-1.397s0.817-1.066,0.817-1.74c0,0,0-9.053,0-14.607l-0.955,0.223     C48.475,32.18,47.844,32.021,47.35,31.638z"/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="30.021" y1="10.915" x2="53.4606" y2="29.8517">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1353" style="stop-color:#F3F3F3"/>
+<stop offset="0.3231" style="stop-color:#E0E0E0"/>
+<stop offset="0.5464" style="stop-color:#C0C1C1"/>
+<stop offset="0.7948" style="stop-color:#959696"/>
+<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_11_)" d="M54.198,25.44l-19.572-16.2c-0.955-0.752-2.09-0.512-2.541-0.388l-2.467,0.706     c0.771-0.329,1.67-0.21,2.325,0.332l19.574,16.197c0.89,0.739,1.08,2.03,0.438,2.991l-1.35,2.025     c-0.281,0.424-0.701,0.727-1.178,0.883c0,0,1.818-0.345,2.35-0.557c0.579-0.231,1.164-0.457,1.51-0.975l1.352-2.025     C55.278,27.468,55.088,26.177,54.198,25.44z"/>
+<path fill="#FFFFFF" d="M29.408,9.654L11.186,19.78c-0.95,0.528-1.39,1.657-1.046,2.686l0.675,2.025     c0.209,0.623,0.678,1.126,1.289,1.374c0.609,0.249,1.296,0.221,1.881-0.08c0,0,0.083-0.042,0.091-0.046     c0,4.906,0,16.261,0,16.261c0,1.084,0.769,2.015,1.834,2.217l28.346,5.399c0.66,0.126,1.344-0.048,1.86-0.479     c0.52-0.428,0.818-1.064,0.818-1.736c0,0,0-10.526,0-16.082c0.076,0.059,0.416,0.319,0.416,0.319     c0.494,0.384,1.125,0.542,1.743,0.44s1.164-0.455,1.511-0.975l1.35-2.025c0.643-0.961,0.452-2.252-0.438-2.991L31.942,9.891     C31.225,9.298,30.221,9.205,29.408,9.654z"/>
+<path fill="#9D0A00" d="M30.504,11.629L12.281,21.753l0.675,2.024l3.375-1.728V42l27.029,6.153l1.316-0.753V26.729l2.734,3.874     l1.316-0.752l1.35-2.025L30.504,11.629z M34.555,44.024l-9.45-1.665V28.501l9.45,1.35V44.024z"/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="49.2104" y1="13.833" x2="13.1572" y2="48.9855">
+<stop offset="0" style="stop-color:#FF0000"/>
+<stop offset="0.0056" style="stop-color:#FF0000"/>
+<stop offset="0.3111" style="stop-color:#FC0000"/>
+<stop offset="0.5001" style="stop-color:#F40000"/>
+<stop offset="0.6575" style="stop-color:#E50000"/>
+<stop offset="0.7974" style="stop-color:#D10000"/>
+<stop offset="0.9246" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#A30000"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M29.188,12.38L10.964,22.506l0.678,2.024l3.372-1.729v19.951l28.347,5.401V27.482l4.051,3.121     l1.35-2.025L29.188,12.38z M33.239,44.777l-9.45-1.667V29.253l9.45,1.351V44.777z"/>
+</g>
+<g>
+<polygon fill="#005447" points="41.301,52.644 40.688,49.389 40.713,52.865 41.274,56.468    "/>
+<g>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="19.5532" y1="72.1523" x2="1.9488" y2="60.5994" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1476 118.3501)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_13_)" d="M55.251,33.089c0,0-14.546,16.211-14.563,16.3c0.265,1.971,0.444,3.004,0.553,3.298      C41.459,52.632,59.903,47.764,55.251,33.089z"/>
+<polygon fill="#005447" points="40.947,53.313 41.263,56.557 25.659,51.797 25.32,48.833     "/>
+</g>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="-6.333" y1="56.6123" x2="15.3358" y2="76.1229" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1476 118.3501)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_14_)" d="M51.849,31.401c0,0,0.524-0.18,0.82-0.382c0.296-0.204,0.61-0.572,0.61-0.572     c6.975,6.73-1.29,14.834-12.574,18.853l0.26,4.076l-15.627-4.483l14.661-9.036l0.215,3.961     C48.049,40.855,53.153,36.2,51.849,31.401z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_app_menu_icon.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+<?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 53 53">
+<g>
+<rect fill="none" width="53" height="53"/>
+<g>
+<g>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-34.9785" y1="65.2231" x2="-16.5408" y2="84.316" gradientTransform="matrix(1.1364 0 0 -1.1364 37.5547 110.179)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M10.319,27.461c-2.836-6.49,5.044-9.569,9.179-11.042c-0.518-1.147-0.342-1.304-0.863-2.453     C9.404,17.253,5.991,22.06,10.319,27.461"/>
+<polygon fill="#005795" points="31.258,10.039 30.907,12.184 19.156,19.669 18.792,17.242    "/>
+<path fill="#005795" d="M10.74,27.08c-1.724-0.732-5.494-6.784-5.494-6.784c-0.199,3.124,2.532,7.31,5.721,8.747L10.74,27.08z"/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-575.0776" y1="874.2534" x2="-581.6132" y2="855.2729" gradientTransform="matrix(-1.1364 0 0 1.1364 -639.8477 -965.3899)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M10.569,27.047c-11.032-5.722-3.408-13.656,7.548-17.334l-0.22-3.285l13.352,3.612L18.723,17.32     l-0.183-3.193C10.164,17.115,5.528,22.236,10.569,27.047z"/>
+</g>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="40.686" y1="25.6226" x2="40.686" y2="41.9047">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1601" style="stop-color:#F6F6F6"/>
+<stop offset="0.3124" style="stop-color:#EAEAEA"/>
+<stop offset="0.4639" style="stop-color:#D6D7D7"/>
+<stop offset="0.615" style="stop-color:#BBBBBB"/>
+<stop offset="0.7657" style="stop-color:#979797"/>
+<stop offset="0.9142" style="stop-color:#6D6D6D"/>
+<stop offset="1" style="stop-color:#505151"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M40.493,29.667c0,0-0.277-0.212-0.338-0.26c0,4.523,0,13.096,0,13.096     c0,1.085-0.91,1.699-1.472,1.792c0,0,2.919-0.789,3.341-1.139s0.666-0.869,0.666-1.416c0,0,0-7.373,0-11.896l-0.777,0.182     C41.409,30.108,40.895,29.978,40.493,29.667z"/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="26.3813" y1="12.792" x2="45.4685" y2="28.2124">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1353" style="stop-color:#F3F3F3"/>
+<stop offset="0.3231" style="stop-color:#E0E0E0"/>
+<stop offset="0.5464" style="stop-color:#C0C1C1"/>
+<stop offset="0.7948" style="stop-color:#959696"/>
+<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_11_)" d="M46.068,24.62L30.131,11.429c-0.777-0.613-1.702-0.417-2.07-0.316l-2.009,0.575     c0.628-0.268,1.36-0.172,1.894,0.271l15.939,13.188c0.725,0.602,0.879,1.653,0.356,2.436l-1.101,1.648     c-0.228,0.346-0.57,0.593-0.958,0.72c0,0,1.48-0.28,1.914-0.453c0.472-0.188,0.947-0.372,1.229-0.794l1.1-1.649     C46.948,26.271,46.793,25.22,46.068,24.62z"/>
+<path fill="#FFFFFF" d="M25.882,11.766l-14.839,8.245c-0.773,0.43-1.132,1.349-0.852,2.187l0.549,1.649     c0.17,0.507,0.552,0.917,1.05,1.119c0.496,0.203,1.055,0.18,1.531-0.065c0,0,0.068-0.034,0.074-0.037c0,3.994,0,13.241,0,13.241     c0,0.882,0.626,1.641,1.494,1.805l23.083,4.397c0.537,0.103,1.094-0.039,1.514-0.391c0.423-0.349,0.668-0.867,0.668-1.414     c0,0,0-8.572,0-13.096c0.061,0.048,0.338,0.26,0.338,0.26c0.402,0.312,0.916,0.441,1.42,0.359     c0.502-0.083,0.947-0.371,1.229-0.795l1.101-1.648c0.522-0.782,0.368-1.834-0.356-2.436L27.946,11.958     C27.362,11.476,26.544,11.4,25.882,11.766z"/>
+<path fill="#9D0A00" d="M26.775,13.374l-14.839,8.244l0.549,1.648l2.749-1.407v16.246l22.01,5.011l1.072-0.613V25.67l2.227,3.155     l1.071-0.612l1.1-1.65L26.775,13.374z M30.074,39.753l-7.695-1.355V27.112l7.695,1.101V39.753z"/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="42.0073" y1="15.1685" x2="12.6481" y2="43.7942">
+<stop offset="0" style="stop-color:#FF0000"/>
+<stop offset="0.0056" style="stop-color:#FF0000"/>
+<stop offset="0.3111" style="stop-color:#FC0000"/>
+<stop offset="0.5001" style="stop-color:#F40000"/>
+<stop offset="0.6575" style="stop-color:#E50000"/>
+<stop offset="0.7974" style="stop-color:#D10000"/>
+<stop offset="0.9246" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#A30000"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M25.703,13.985l-14.84,8.246l0.552,1.648l2.746-1.408v16.248l23.083,4.397V26.283l3.299,2.542     l1.099-1.649L25.703,13.985z M29,40.367l-7.694-1.357V27.725l7.694,1.1V40.367z"/>
+</g>
+<g>
+<polygon fill="#005447" points="35.567,46.772 35.069,44.121 35.088,46.953 35.545,49.886    "/>
+<g>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="11.1978" y1="67.4683" x2="-3.1378" y2="58.0605" gradientTransform="matrix(1.1364 0 0 -1.1364 37.5547 110.179)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_13_)" d="M46.927,30.848c0,0-11.845,13.201-11.858,13.272c0.215,1.605,0.36,2.447,0.449,2.686      C35.696,46.763,50.715,42.798,46.927,30.848z"/>
+<polygon fill="#005447" points="35.278,47.318 35.536,49.958 22.83,46.083 22.554,43.669     "/>
+</g>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="-9.8828" y1="54.812" x2="7.7625" y2="70.6999" gradientTransform="matrix(1.1364 0 0 -1.1364 37.5547 110.179)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_14_)" d="M44.157,29.474c0,0,0.426-0.146,0.668-0.312c0.241-0.166,0.496-0.466,0.496-0.466     c5.68,5.481-1.05,12.08-10.238,15.353l0.211,3.319l-12.726-3.65l11.938-7.359l0.177,3.227     C41.061,37.173,45.217,33.382,44.157,29.474z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_context_from_home.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,84 @@
+<?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>
+<g>
+<g>
+<path fill="#FFFFFF" d="M16.511,8.839c0,0,4.073,0,6.696,0.212c2.626,0.216,8.396,0.193,9.427,2.575      c1.232,2.837,1.127,11.678,0.802,18.103c-0.32,6.433,0,14.36-1.553,16.608c-1.551,2.252-4.549,1.394-9.696,0.107      c-5.145-1.285-7.23-1.555-8.09-3.537c-0.853-1.98-1.767-11.032-1.818-16.335c-0.052-5.305-0.106-15.22,1.339-16.502      C15.063,8.784,15.76,8.839,16.511,8.839z"/>
+</g>
+<g>
+<g>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="-354.8413" y1="315.6221" x2="-348.8875" y2="293.8596" gradientTransform="matrix(1 0 0 -1 379.667 324.2129)">
+<stop offset="0" style="stop-color:#222221"/>
+<stop offset="0.1461" style="stop-color:#BEBEBF"/>
+<stop offset="0.1685" style="stop-color:#FFFFFF"/>
+<stop offset="0.3202" style="stop-color:#FFFFFF"/>
+<stop offset="0.5169" style="stop-color:#E8E8E8"/>
+<stop offset="0.5615" style="stop-color:#D6D6D6"/>
+<stop offset="0.775" style="stop-color:#848484"/>
+<stop offset="0.9262" style="stop-color:#515151"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_6_)" d="M15.774,8.873c-0.05,0.011-0.107,0.019-0.158,0.033 M36.018,18.105       c-0.108-2.138-0.376-5.143-1.553-7.395c-1.179-2.245-7.234-2.031-9.43-2.144c-2.195-0.105-6.162-0.267-7.392-0.212       c-0.345,0.016-1.046,0.226-1.874,0.518c0.264-0.037,0.505-0.034,0.746-0.034c0,0,4.073,0,6.699,0.212       c2.625,0.216,8.395,0.193,9.424,2.575c1.234,2.837,1.129,11.678,0.809,18.103c-0.322,6.433,0,14.36-1.556,16.608       c-0.272,0.396-0.591,0.688-0.955,0.905c1.769-0.976,3.05-1.732,3.256-1.973c0.751-0.86,1.499-4.048,1.554-6.803       C35.805,35.787,36.255,22.865,36.018,18.105z"/>
+</g>
+</g>
+<g>
+<path fill="#183268" d="M31.154,12.293c-0.988-1.659-6.329-1.669-8.575-1.828c-2.233-0.151-5.914-0.332-6.385-0.332      c-0.397,0-1.036,0.23-1.216,0.302c-0.005,0-0.005,0-0.005,0c0.41-0.091,0.837-0.061,1.462-0.02c0,0,4.729,0.212,7.675,0.502      c2.765,0.272,5.722,0.314,6.53,1.675c0.872,1.466,0.75,2.25,0.75,3.873c0,1.615,0,10.512,0.058,13.748      c0.06,3.238-0.29,13.652-0.574,14.349c-0.213,0.497-0.873,1.066-1.676,1.397c0,0,0,0,0.003,0l0.009,0.021      c0,0,1.05-0.201,1.537-0.533c0.487-0.338,0.762-0.745,1.01-1.983c0.078-0.381,0.243-8.61,0.295-13.33      c0.046-4.715-0.011-12.805-0.011-14.307C32.036,14.353,31.973,13.647,31.154,12.293z"/>
+</g>
+<g>
+<radialGradient id="XMLID_7_" cx="-365.582" cy="311.2793" r="35.3161" gradientTransform="matrix(1 0 0 -1 379.667 324.2129)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.1461" style="stop-color:#3CB4FF"/>
+<stop offset="0.7697" style="stop-color:#004A91"/>
+<stop offset="1" style="stop-color:#002B5D"/>
+</radialGradient>
+<path fill="url(#XMLID_7_)" d="M16.435,10.419c0,0,4.745,0.218,7.697,0.446c2.824,0.219,5.581,0.052,6.508,1.727      c0.925,1.677,0.75,2.256,0.75,3.873c0,1.615,0,10.512,0.058,13.751c0.06,3.24-0.29,13.649-0.574,14.349      c-0.292,0.692-1.461,1.537-2.673,1.652c-1.212,0.115-4.067-0.481-6.956-1.293c-2.885-0.811-5.321-1.185-6.321-2.461      c-1.074-1.366-1.797-12.458-1.797-15.808c0-3.352-0.289-12.736,0-13.895c0.29-1.155,0.445-1.644,1.243-2.102      C15.001,10.295,15.511,10.361,16.435,10.419z"/>
+</g>
+<g>
+<radialGradient id="XMLID_8_" cx="-364.3491" cy="310.8711" r="25.9695" gradientTransform="matrix(1 0 0 -1 379.667 324.2129)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#C5FDFD"/>
+<stop offset="0.0337" style="stop-color:#C5FDFD"/>
+<stop offset="1" style="stop-color:#65C7FD"/>
+</radialGradient>
+<polygon fill="url(#XMLID_8_)" points="15.013,13.255 29.348,14.549 29.348,35.421 15.044,32.531     "/>
+</g>
+<path fill="#183268" d="M18.371,38.313c-0.114-0.554-0.446-1.13-0.986-1.744c-0.431-0.488-1.8-1.861-2.234-1.95     c-0.205-0.04-0.656,0.052-0.656,0.052s0.008,0.014,0.01,0.016c0.048-0.007,0.097-0.016,0.153-0.013     c0.586,0.071,2.031,1.485,2.411,1.968c0.377,0.48,0.721,0.74,0.893,1.3c0.183,0.595,0.296,0.823,0.167,1.389     c-0.049,0.2-0.114,0.302-0.195,0.367c0.272-0.052,0.353-0.163,0.427-0.307C18.434,39.233,18.446,38.661,18.371,38.313z      M14.504,34.685L14.504,34.685L14.504,34.685L14.504,34.685z"/>
+<g>
+<path fill="#8799C1" d="M17.514,39.769c0,0-1.137-0.309-1.996-0.689c-0.86-0.373-1.136-0.446-1.412-0.925      c-0.272-0.483-0.31-1.241-0.24-1.995c0.067-0.759,0.205-1.556,0.791-1.485c0.584,0.071,2.032,1.481,2.408,1.965      c0.38,0.483,0.721,0.739,0.896,1.303c0.181,0.595,0.293,0.823,0.167,1.387C18.024,39.775,17.842,39.786,17.514,39.769z"/>
+</g>
+<path fill="#183268" d="M22.486,43.233v0.009c0,0,0.017-0.012,0.021-0.012c0.092-0.023,0.184-0.032,0.27-0.064     c-0.092,0.033-0.193,0.047-0.293,0.067C22.483,43.233,22.483,43.233,22.486,43.233z M24.596,39.217     c-0.596-2.26-2.508-2.873-2.82-2.903c-0.311-0.03-1.061,0.128-1.061,0.128l0.013,0.047c1.313-0.212,2.757,0.788,3.373,2.437     c0.548,1.467,0.256,2.975-0.615,3.788c0.293-0.168,0.57-0.347,0.714-0.477C24.583,41.882,25.007,40.773,24.596,39.217z"/>
+<g>
+<circle fill="#8799C1" cx="21.55" cy="39.876" r="2.722"/>
+</g>
+</g>
+<g>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="14.2007" y1="77.6885" x2="-0.9271" y2="67.7609" gradientTransform="matrix(1.1364 0 0 -1.1364 36.9858 117.0461)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M49.524,25.854c0,0-12.313,14.153-12.325,14.235c0.222,1.72,0.372,2.624,0.465,2.879     C37.85,42.918,53.462,38.667,49.524,25.854z"/>
+<polygon fill="#005447" points="37.716,42.929 37.199,40.089 37.218,43.123 37.693,46.27    "/>
+<polygon fill="#005447" points="37.416,43.518 37.682,46.348 24.473,42.19 24.187,39.604    "/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-7.7881" y1="64.2529" x2="10.7651" y2="80.9583" gradientTransform="matrix(1.1364 0 0 -1.1364 36.9858 117.0461)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M44.689,21.216c10.932,6.208,3.379,14.805-7.478,18.791l0.22,3.564l-13.229-3.917l12.409-7.892     l0.184,3.458C45.093,31.983,49.685,26.437,44.689,21.216z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_context_icon.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,100 @@
+<?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>
+<g>
+<g>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="21.3438" y1="10.2734" x2="34.8636" y2="45.4939">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.1191" style="stop-color:#E2E2E2"/>
+<stop offset="0.2885" style="stop-color:#CDCDCD"/>
+<stop offset="0.4927" style="stop-color:#ACACAC"/>
+<stop offset="0.724" style="stop-color:#7E7E7E"/>
+<stop offset="0.9752" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M35.169,16.45l-13.174-2.083c0,0-0.576-0.085-0.582,0.969c-0.005,1.624,0.005,24.411,0,25.309       c-0.003,0.855,0.42,0.97,0.42,0.97l13.276,3.722c0,0,0.449,0.15,0.452-0.813c0.006-1.311,0.152-24.686,0.161-26.814       C35.728,16.452,35.169,16.45,35.169,16.45z"/>
+<polygon fill="#3D3D3D" points="22.32,18.22 34.563,20.438 34.563,22.551 22.313,20.366      "/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="33.5518" y1="3.5811" x2="43.3004" y2="45.8072">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.0056" style="stop-color:#000000"/>
+<stop offset="0.1404" style="stop-color:#3D3D3D"/>
+<stop offset="0.2303" style="stop-color:#FFFFFF"/>
+<stop offset="0.2865" style="stop-color:#FFFFFF"/>
+<stop offset="0.5112" style="stop-color:#E9E9E9"/>
+<stop offset="0.567" style="stop-color:#E2E2E2"/>
+<stop offset="0.6503" style="stop-color:#CDCDCD"/>
+<stop offset="0.7506" style="stop-color:#ACACAC"/>
+<stop offset="0.8643" style="stop-color:#7E7E7E"/>
+<stop offset="0.9878" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M48.384,10.524c-1.078-0.145-11.336-1.048-13.317-1.327c0,0-0.565-0.097-1.28-0.038       c-0.719,0.053-9.92,1.471-10.731,1.595c-1.016,0.139-1.629,0.714-1.796,0.986c0.272-0.35,0.625-0.313,0.625-0.313       c2.762,0.209,14.182,1.925,14.182,1.925s1.729-0.189,1.805,2.349v0.019c0,0,0,26.92,0,29.506c0,0.923-0.225,1.527-0.511,1.941       c2.729-1.592,11.058-6.549,11.058-6.549c1.065-0.56,1.196-2.608,1.196-2.608l0.142-25.419       C49.755,12.591,49.701,10.707,48.384,10.524z"/>
+<path fill="#FFFFFF" d="M36.065,13.353c0,0-11.419-1.716-14.182-1.925c0,0-0.939-0.12-0.939,1.562       c-0.01,2.055,0.012,25.511,0,28.939c-0.008,1.942,1.003,1.874,1.003,1.874l14.177,4.183c0,0,1.746-0.174,1.746-2.76       s0-29.506,0-29.506v-0.019C37.794,13.163,36.065,13.353,36.065,13.353z M35.562,44.522c-0.003,0.964-0.452,0.813-0.452,0.813       l-13.276-3.722c0,0-0.423-0.114-0.42-0.97c0.005-0.897-0.005-23.685,0-25.309c0.005-1.054,0.582-0.969,0.582-0.969       l13.174,2.083c0,0,0.559,0.002,0.554,1.258C35.714,19.837,35.567,43.212,35.562,44.522z"/>
+<path fill="#3D3D3D" d="M36.456,17.658c0-1.685-0.95-1.915-0.95-1.915l-12.607-1.895c0,0-0.474,0.065-0.592,0.13       c-0.292,0.162-0.799,0.472-0.799,0.693c0,0.017,0.01,0.038,0.011,0.048c0.167-0.39,0.477-0.353,0.477-0.353l13.174,2.083       c0,0,0.559,0.002,0.554,1.258c-0.009,2.129-0.155,25.504-0.161,26.814c0,0.117-0.007,0.223-0.019,0.305       c-0.006,0.049-0.019,0.088-0.03,0.132c-0.006,0.023-0.012,0.058-0.02,0.083c-0.016,0.051-0.037,0.088-0.057,0.124       c-0.005,0.008-0.006,0.014-0.012,0.023c-0.025,0.036-0.051,0.065-0.076,0.086l0,0c0.166-0.066,1.137-0.474,1.137-0.888       C36.485,43.939,36.456,19.139,36.456,17.658z"/>
+</g>
+<polygon fill="#3D3D3D" points="22.249,22.034 34.491,24.255 34.491,26.367 22.242,24.184     "/>
+</g>
+<g>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-32.624" y1="63.6299" x2="-13.6643" y2="83.2632" gradientTransform="matrix(1.1364 0 0 -1.1364 37.0591 118.1665)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M12.938,37.084c-2.757-6.896,4.897-10.164,8.913-11.729c-0.506-1.222-0.333-1.384-0.838-2.609      C12.048,26.242,8.735,31.342,12.938,37.084"/>
+<polygon fill="#005795" points="33.269,18.576 32.927,20.857 21.518,28.81 21.163,26.226     "/>
+<path fill="#005795" d="M13.347,36.676c-1.673-0.774-5.333-7.206-5.333-7.206c-0.194,3.321,2.458,7.768,5.552,9.297      L13.347,36.676z"/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-570.1572" y1="883.0088" x2="-576.9246" y2="863.3551" gradientTransform="matrix(-1.1364 0 0 1.1364 -632.0855 -965.8999)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M13.182,36.645c-10.715-6.08-3.31-14.506,7.328-18.415l-0.214-3.493l12.965,3.84l-12.164,7.735      l-0.18-3.394C12.788,26.091,8.287,31.533,13.182,36.645z"/>
+</g>
+</g>
+<g>
+<polygon fill="#102F02" points="27.016,35.45 27.295,35.325 28.855,35.567 28.855,37.294 28.677,37.393 27.348,36.201    "/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="27.1084" y1="21.5068" x2="28.6742" y2="19.3399" gradientTransform="matrix(1 0 0 -1 0.1377 57.0977)">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.0972" style="stop-color:#ED1C17"/>
+<stop offset="0.2366" style="stop-color:#D81A13"/>
+<stop offset="0.4066" style="stop-color:#B6170E"/>
+<stop offset="0.5989" style="stop-color:#861306"/>
+<stop offset="0.6798" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<polygon fill="url(#XMLID_11_)" points="28.677,37.393 27.016,37.128 27.016,35.45 28.677,35.715    "/>
+</g>
+<g>
+<polygon fill="#102F02" points="27.11,32.438 27.389,32.315 28.949,32.556 28.949,34.282 28.771,34.381 27.441,33.189    "/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="27.2021" y1="24.5186" x2="28.7676" y2="22.3521" gradientTransform="matrix(1 0 0 -1 0.1377 57.0977)">
+<stop offset="0" style="stop-color:#68D80B"/>
+<stop offset="0.0056" style="stop-color:#68D80B"/>
+<stop offset="0.1635" style="stop-color:#60D10A"/>
+<stop offset="0.4037" style="stop-color:#4BBD06"/>
+<stop offset="0.6798" style="stop-color:#2B9F00"/>
+<stop offset="1" style="stop-color:#2B9F00"/>
+</linearGradient>
+<polygon fill="url(#XMLID_12_)" points="28.771,34.381 27.11,34.116 27.11,32.438 28.771,32.703    "/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_fill_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,37 @@
+<?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>
+<polygon fill="#005447" points="10.368,14.861 10.079,13.28 10.089,14.97 10.354,16.719    "/>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="-18.1987" y1="61.4287" x2="-26.6131" y2="55.9068" gradientTransform="matrix(1.1364 0 0 -1.1364 39.6183 76.7883)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M16.936,5.363c0,0-6.849,7.873-6.857,7.917c0.125,0.958,0.209,1.459,0.26,1.603      C10.442,14.856,19.125,12.49,16.936,5.363z"/>
+<polygon fill="#005447" points="10.2,15.188 10.35,16.763 3.002,14.45 2.843,13.012     "/>
+</g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="-30.4287" y1="53.9561" x2="-20.1089" y2="63.2481" gradientTransform="matrix(1.1364 0 0 -1.1364 39.6183 76.7883)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M14.247,2.784c6.08,3.451,1.879,8.234-4.16,10.452l0.123,1.981L2.852,13.04l6.901-4.39     l0.103,1.923C14.471,8.772,17.026,5.688,14.247,2.784z"/>
+</g>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_from_home.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,84 @@
+<?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 57 49.149">
+<g>
+<rect fill="none" width="57" height="49.149"/>
+<g>
+<g>
+<g>
+<path fill="#FFFFFF" d="M14.651,3.971c0,0,3.824,0,6.286,0.197c2.465,0.203,7.881,0.183,8.849,2.417      c1.156,2.666,1.059,10.963,0.753,16.995c-0.301,6.036,0,13.479-1.458,15.587c-1.457,2.114-4.27,1.309-9.101,0.102      c-4.83-1.207-6.788-1.459-7.593-3.32c-0.801-1.857-1.659-10.354-1.708-15.333c-0.049-4.98-0.1-14.284,1.258-15.488      C13.292,3.917,13.947,3.971,14.651,3.971z"/>
+</g>
+<g>
+<g>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="-357.2109" y1="311.2661" x2="-351.6226" y2="290.8394" gradientTransform="matrix(1 0 0 -1 379.667 315.0029)">
+<stop offset="0" style="stop-color:#222221"/>
+<stop offset="0.1461" style="stop-color:#BEBEBF"/>
+<stop offset="0.1685" style="stop-color:#FFFFFF"/>
+<stop offset="0.3202" style="stop-color:#FFFFFF"/>
+<stop offset="0.5169" style="stop-color:#E8E8E8"/>
+<stop offset="0.5615" style="stop-color:#D6D6D6"/>
+<stop offset="0.775" style="stop-color:#848484"/>
+<stop offset="0.9262" style="stop-color:#515151"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_6_)" d="M13.96,4.002c-0.048,0.008-0.101,0.017-0.149,0.031 M32.961,12.668       c-0.1-2.007-0.353-4.826-1.457-6.94c-1.105-2.109-6.79-1.908-8.851-2.012c-2.061-0.1-5.784-0.251-6.938-0.199       c-0.324,0.014-0.982,0.211-1.758,0.486c0.247-0.036,0.474-0.032,0.7-0.032c0,0,3.823,0,6.288,0.197       c2.464,0.203,7.879,0.183,8.845,2.417c1.161,2.666,1.061,10.963,0.76,16.995c-0.302,6.036,0,13.479-1.46,15.587       c-0.256,0.372-0.554,0.646-0.897,0.851c1.661-0.915,2.863-1.626,3.056-1.852c0.706-0.809,1.407-3.799,1.459-6.386       C32.762,29.263,33.185,17.135,32.961,12.668z"/>
+</g>
+</g>
+<g>
+<path fill="#183268" d="M28.396,7.211c-0.927-1.557-5.94-1.567-8.049-1.714c-2.096-0.144-5.551-0.313-5.994-0.313      c-0.372,0-0.971,0.217-1.141,0.283c-0.005,0-0.005,0-0.005,0c0.385-0.083,0.786-0.055,1.373-0.018c0,0,4.438,0.2,7.204,0.472      c2.595,0.255,5.37,0.296,6.13,1.573c0.818,1.375,0.703,2.112,0.703,3.635c0,1.515,0,9.866,0.054,12.903      c0.056,3.041-0.272,12.814-0.538,13.469c-0.199,0.467-0.82,1.002-1.573,1.313c0,0,0,0,0.003,0l0.009,0.02      c0,0,0.986-0.188,1.443-0.501c0.457-0.317,0.715-0.698,0.948-1.862c0.073-0.357,0.228-8.082,0.276-12.511      c0.044-4.427-0.011-12.02-0.011-13.43C29.224,9.144,29.166,8.483,28.396,7.211z"/>
+</g>
+<g>
+<radialGradient id="XMLID_7_" cx="-367.2915" cy="307.1909" r="33.1479" gradientTransform="matrix(1 0 0 -1 379.667 315.0029)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.1461" style="stop-color:#3CB4FF"/>
+<stop offset="0.7697" style="stop-color:#004A91"/>
+<stop offset="1" style="stop-color:#002B5D"/>
+</radialGradient>
+<path fill="url(#XMLID_7_)" d="M14.581,5.451c0,0,4.453,0.207,7.225,0.419c2.65,0.207,5.238,0.051,6.109,1.623      c0.869,1.574,0.703,2.117,0.703,3.635c0,1.517,0,9.866,0.054,12.906c0.056,3.042-0.272,12.813-0.538,13.468      c-0.274,0.649-1.371,1.442-2.509,1.552c-1.138,0.109-3.818-0.453-6.529-1.215c-2.708-0.76-4.994-1.113-5.934-2.309      c-1.008-1.283-1.687-11.696-1.687-14.841c0-3.143-0.271-11.951,0-13.039c0.272-1.085,0.417-1.542,1.167-1.973      C13.235,5.336,13.713,5.397,14.581,5.451z"/>
+</g>
+<g>
+<radialGradient id="XMLID_8_" cx="-366.1353" cy="306.8081" r="24.3761" gradientTransform="matrix(1 0 0 -1 379.667 315.0029)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#C5FDFD"/>
+<stop offset="0.0337" style="stop-color:#C5FDFD"/>
+<stop offset="1" style="stop-color:#65C7FD"/>
+</radialGradient>
+<polygon fill="url(#XMLID_8_)" points="13.245,8.114 26.701,9.329 26.701,28.921 13.275,26.208     "/>
+</g>
+<path fill="#183268" d="M16.397,31.634c-0.107-0.519-0.418-1.059-0.926-1.635c-0.404-0.46-1.689-1.749-2.096-1.832     c-0.193-0.037-0.616,0.049-0.616,0.049s0.008,0.013,0.009,0.016c0.045-0.007,0.091-0.016,0.144-0.012     c0.55,0.066,1.906,1.393,2.263,1.846c0.354,0.45,0.677,0.695,0.838,1.22c0.171,0.56,0.278,0.772,0.156,1.304     c-0.045,0.188-0.106,0.283-0.183,0.346c0.255-0.049,0.332-0.153,0.401-0.288C16.457,32.5,16.468,31.962,16.397,31.634z      M12.768,28.229L12.768,28.229L12.768,28.229L12.768,28.229z"/>
+<g>
+<path fill="#8799C1" d="M15.593,33.001c0,0-1.067-0.289-1.874-0.646c-0.807-0.352-1.066-0.42-1.325-0.869      c-0.255-0.453-0.291-1.164-0.226-1.873c0.063-0.712,0.192-1.459,0.742-1.393c0.548,0.065,1.907,1.389,2.261,1.842      c0.357,0.454,0.677,0.695,0.841,1.224c0.17,0.56,0.275,0.772,0.156,1.303C16.072,33.008,15.901,33.018,15.593,33.001z"/>
+</g>
+<path fill="#183268" d="M20.261,36.253v0.01c0,0,0.016-0.012,0.02-0.012c0.086-0.021,0.173-0.031,0.253-0.061     c-0.087,0.031-0.182,0.044-0.276,0.063C20.257,36.253,20.257,36.253,20.261,36.253z M22.24,32.484     c-0.559-2.124-2.354-2.697-2.647-2.726c-0.291-0.028-0.995,0.119-0.995,0.119l0.012,0.046c1.232-0.2,2.588,0.738,3.166,2.287     c0.514,1.375,0.24,2.791-0.578,3.555c0.275-0.158,0.535-0.325,0.67-0.449C22.229,34.984,22.626,33.945,22.24,32.484z"/>
+<g>
+<circle fill="#8799C1" cx="19.382" cy="33.103" r="2.555"/>
+</g>
+</g>
+<g>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="10.4346" y1="74.394" x2="-3.7653" y2="65.0754" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1615 107.208)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M45.639,19.939c0,0-11.557,13.287-11.57,13.363c0.209,1.613,0.352,2.463,0.438,2.701     C34.681,35.958,49.336,31.967,45.639,19.939z"/>
+<polygon fill="#005447" points="34.556,35.967 34.069,33.302 34.088,36.15 34.534,39.104    "/>
+<polygon fill="#005447" points="34.274,36.519 34.524,39.175 22.125,35.274 21.856,32.846    "/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-10.2061" y1="61.7827" x2="7.21" y2="77.4642" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1615 107.208)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M41.1,15.587c10.262,5.827,3.173,13.897-7.018,17.639l0.205,3.344l-12.417-3.676l11.648-7.408     l0.171,3.246C41.48,25.695,45.792,20.487,41.1,15.587z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_from_home_inactive.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -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 57 49.148">
+<g>
+<rect fill="none" width="57" height="49.148"/>
+<g>
+<g>
+<g>
+<path fill="#FFFFFF" d="M14.573,4.445c0,0,3.79,0,6.23,0.197c2.443,0.199,7.812,0.18,8.771,2.394      c1.146,2.642,1.049,10.866,0.746,16.845c-0.298,5.984,0,13.359-1.445,15.451c-1.444,2.094-4.232,1.297-9.021,0.1      c-4.787-1.195-6.727-1.446-7.526-3.291c-0.793-1.842-1.645-10.264-1.692-15.198c-0.049-4.935-0.099-14.158,1.246-15.352      C13.226,4.395,13.874,4.445,14.573,4.445z"/>
+</g>
+<g>
+<g>
+<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="-357.3584" y1="309.2988" x2="-351.8193" y2="289.0522" gradientTransform="matrix(1 0 0 -1 379.667 313.5137)">
+<stop offset="0" style="stop-color:#222221"/>
+<stop offset="0.1461" style="stop-color:#BEBEBF"/>
+<stop offset="0.1685" style="stop-color:#FFFFFF"/>
+<stop offset="0.3202" style="stop-color:#FFFFFF"/>
+<stop offset="0.5169" style="stop-color:#E8E8E8"/>
+<stop offset="0.5615" style="stop-color:#D6D6D6"/>
+<stop offset="0.775" style="stop-color:#848484"/>
+<stop offset="0.9262" style="stop-color:#515151"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_5_)" d="M13.887,4.478c-0.046,0.008-0.1,0.017-0.147,0.03 M32.723,13.067       c-0.1-1.989-0.35-4.785-1.445-6.88c-1.096-2.091-6.73-1.893-8.772-1.996c-2.042-0.098-5.733-0.248-6.878-0.195       c-0.321,0.014-0.974,0.209-1.743,0.481c0.245-0.036,0.47-0.032,0.694-0.032c0,0,3.79,0,6.232,0.197       c2.442,0.199,7.811,0.18,8.767,2.394c1.15,2.642,1.053,10.866,0.754,16.845c-0.299,5.984,0,13.359-1.447,15.451       c-0.254,0.369-0.549,0.641-0.889,0.842c1.646-0.906,2.838-1.611,3.029-1.835c0.7-0.8,1.396-3.766,1.446-6.329       C32.525,29.516,32.943,17.494,32.723,13.067z"/>
+</g>
+</g>
+<g>
+<path d="M28.197,7.658c-0.919-1.544-5.887-1.554-7.979-1.699c-2.077-0.143-5.502-0.311-5.94-0.311      c-0.369,0-0.963,0.215-1.131,0.28c-0.004,0-0.004,0-0.004,0c0.381-0.083,0.778-0.056,1.36-0.019c0,0,4.399,0.197,7.14,0.469      c2.572,0.252,5.323,0.292,6.076,1.559c0.811,1.362,0.697,2.092,0.697,3.602c0,1.504,0,9.779,0.054,12.791      c0.055,3.014-0.27,12.702-0.534,13.35c-0.197,0.463-0.812,0.993-1.559,1.301c0,0,0,0,0.003,0L26.388,39      c0,0,0.978-0.188,1.431-0.496c0.453-0.314,0.708-0.693,0.939-1.846c0.072-0.354,0.226-8.011,0.273-12.402      c0.043-4.387-0.01-11.913-0.01-13.311C29.017,9.574,28.959,8.918,28.197,7.658z"/>
+</g>
+<g>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="-367.0415" y1="307.4033" x2="-351.2687" y2="275.5175" gradientTransform="matrix(1 0 0 -1 379.667 313.5137)">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.1325" style="stop-color:#CFCFCF"/>
+<stop offset="0.4327" style="stop-color:#575757"/>
+<stop offset="0.507" style="stop-color:#383838"/>
+<stop offset="0.7014" style="stop-color:#363636"/>
+<stop offset="0.8958" style="stop-color:#000000"/>
+<stop offset="0.9871" style="stop-color:#000000"/>
+<stop offset="1" style="stop-color:#000000"/>
+</linearGradient>
+<path fill="url(#XMLID_6_)" d="M14.502,5.914c0,0,4.414,0.203,7.161,0.415c2.627,0.204,5.192,0.05,6.055,1.608      c0.861,1.561,0.697,2.099,0.697,3.602c0,1.504,0,9.779,0.054,12.793c0.055,3.017-0.27,12.7-0.534,13.352      c-0.271,0.643-1.359,1.43-2.487,1.537c-1.128,0.108-3.783-0.449-6.471-1.203c-2.685-0.755-4.951-1.104-5.881-2.29      c-0.999-1.271-1.672-11.591-1.672-14.708s-0.268-11.848,0-12.927c0.27-1.074,0.414-1.527,1.156-1.955      C13.168,5.799,13.643,5.859,14.502,5.914z"/>
+</g>
+<g>
+<polygon fill="#D3D3D3" points="13.179,8.553 26.516,9.758 26.516,29.176 13.208,26.488     "/>
+</g>
+<path d="M16.303,31.867c-0.106-0.514-0.415-1.051-0.917-1.623c-0.401-0.453-1.676-1.732-2.079-1.814     c-0.191-0.037-0.61,0.049-0.61,0.049s0.008,0.012,0.009,0.015c0.045-0.007,0.09-0.015,0.142-0.013     c0.546,0.066,1.89,1.383,2.244,1.831c0.351,0.446,0.67,0.69,0.831,1.208c0.169,0.556,0.275,0.767,0.154,1.293     c-0.045,0.186-0.105,0.281-0.181,0.342c0.252-0.047,0.329-0.15,0.397-0.284C16.362,32.724,16.373,32.19,16.303,31.867z      M12.706,28.49L12.706,28.49L12.706,28.49L12.706,28.49z"/>
+<g>
+<path fill="#9A9494" d="M15.507,33.221c0,0-1.058-0.286-1.858-0.641c-0.801-0.348-1.057-0.416-1.314-0.861      c-0.252-0.449-0.289-1.154-0.223-1.855c0.062-0.707,0.19-1.447,0.735-1.383c0.543,0.066,1.891,1.379,2.241,1.828      c0.354,0.449,0.671,0.688,0.834,1.211c0.168,0.556,0.272,0.767,0.154,1.292C15.98,33.227,15.812,33.236,15.507,33.221z"/>
+</g>
+<path d="M20.133,36.445v0.008c0,0,0.016-0.01,0.02-0.01c0.085-0.023,0.171-0.031,0.251-0.061c-0.086,0.03-0.18,0.043-0.274,0.063     C20.129,36.445,20.129,36.445,20.133,36.445z M22.095,32.707c-0.554-2.104-2.333-2.672-2.625-2.699     c-0.288-0.029-0.986,0.117-0.986,0.117l0.013,0.044c1.221-0.196,2.564,0.733,3.137,2.268c0.51,1.364,0.238,2.769-0.572,3.524     c0.272-0.156,0.53-0.322,0.665-0.444C22.083,35.188,22.477,34.155,22.095,32.707z"/>
+<g>
+<circle fill="#9A9494" cx="19.262" cy="33.32" r="2.533"/>
+</g>
+</g>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="10.0728" y1="72.7197" x2="-4.001" y2="63.4838" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1911 105.6172)">
+<stop offset="0" style="stop-color:#F5F5F5"/>
+<stop offset="0.0056" style="stop-color:#F5F5F5"/>
+<stop offset="0.0098" style="stop-color:#F4F4F4"/>
+<stop offset="0.2882" style="stop-color:#A6A6A6"/>
+<stop offset="0.536" style="stop-color:#696969"/>
+<stop offset="0.7445" style="stop-color:#3C3C3C"/>
+<stop offset="0.9057" style="stop-color:#212121"/>
+<stop offset="1" style="stop-color:#171717"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M45.287,20.275c0,0-11.454,13.168-11.467,13.244c0.207,1.599,0.348,2.441,0.433,2.678     C34.426,36.151,48.951,32.195,45.287,20.275z"/>
+<polygon fill="#3D3D3D" points="34.302,36.16 33.82,33.52 33.839,36.342 34.28,39.27    "/>
+<polygon fill="#3D3D3D" points="34.022,36.708 34.271,39.341 21.981,35.474 21.714,33.068    "/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-10.3853" y1="60.2217" x2="6.8762" y2="75.7639" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1911 105.6172)">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.0399" style="stop-color:#DADADA"/>
+<stop offset="0.1461" style="stop-color:#B0B0B0"/>
+<stop offset="0.2584" style="stop-color:#8D8D8D"/>
+<stop offset="0.376" style="stop-color:#707070"/>
+<stop offset="0.5008" style="stop-color:#595959"/>
+<stop offset="0.6361" style="stop-color:#4A4A4A"/>
+<stop offset="0.7895" style="stop-color:#404040"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M40.789,15.96c10.172,5.776,3.145,13.774-6.956,17.483l0.204,3.316l-12.309-3.646l11.546-7.342     l0.169,3.219C41.166,25.979,45.438,20.817,40.789,15.96z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_image_list_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,8 @@
+<?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 16 16">
+<g>
+<rect fill="none" width="16" height="16"/>
+<path d="M0.641,3.198V13.99h14.778V3.198H0.641z M1.99,10.054V9.147l2.213-2.886v3.792H1.99z M5.552,6.274l2.9,3.779h-2.9V6.274z    M1.99,6.934V4.548h1.83L1.99,6.934z M10.147,10.054l0.003-0.002L5.93,4.548h8.142v8.093h-3.505l1.948-2.587H10.147z"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_music.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -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.191,2.823L7.379,4.699v9.387   c-0.066-0.009-0.125-0.027-0.197-0.037c-1.285-0.175-2.886,0.595-3.568,1.708c-0.688,1.106-0.196,2.15,1.091,2.314   c1.289,0.167,2.886-0.598,3.567-1.71c0.197-0.316,0.285-0.624,0.297-0.908c0.004-0.011,0.012-0.02,0.018-0.027   c0-0.299-0.064-8.165-0.064-8.165l7.493-1.65l0.03,6.624c-0.067-0.013-0.127-0.03-0.198-0.043   c-1.287-0.168-2.886,0.602-3.563,1.713c-0.69,1.11-0.199,2.148,1.086,2.315c1.292,0.165,2.885-0.595,3.566-1.709   c0.195-0.319,0.283-0.622,0.301-0.911c0.006-0.013,0.012-0.019,0.017-0.027C17.256,13.271,17.191,2.823,17.191,2.823z"/>
+<rect fill="none" width="21" height="21"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="3.3018" y1="10.459" x2="17.2529" y2="10.459">
+<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/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_music_list_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,8 @@
+<?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 16 16">
+<g>
+<rect fill="none" width="16" height="16"/>
+<path d="M13.92,10.785h0.011V2.206L5.809,4.928v5.619c-0.439-0.215-0.969-0.342-1.539-0.342c-1.535,0-2.78,0.91-2.78,2.028   c0,1.119,1.245,2.028,2.78,2.028c1.52,0,2.75-0.891,2.777-1.992h0.012V11.1V6.795l5.486-1.725v4.082   c-0.41-0.175-0.88-0.282-1.391-0.282c-1.537,0-2.782,0.909-2.782,2.028c0,1.12,1.245,2.028,2.782,2.028   c1.535,0,2.779-0.908,2.779-2.028C13.936,10.859,13.925,10.823,13.92,10.785z"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_other_images.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+<?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.605,4.147c-0.536,0-1.002,0.468-1.002,1.133L2.59,15.13c0,1.279,0.091,1.422,1.529,1.422h13.128     c0.92,0,1.173-0.4,1.173-1.342l0.014-9.598c0-0.938-0.19-1.463-1.111-1.463L4.26,4.147H3.605z"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="3.0449" y1="9.7627" x2="17.9741" y2="9.7627">
+<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_3_)" d="M17.406,4.575H3.613l0,0c-0.314,0-0.568,0.259-0.568,0.571v9.785     c-0.029,0.026,14.908,0.026,14.929,0V5.146C17.974,4.834,17.721,4.575,17.406,4.575z"/>
+</g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="3.0449" y1="14.7666" x2="17.9741" y2="14.7666">
+<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_4_)" d="M3.045,13.481v1.999c0,0.315,0.254,0.571,0.568,0.571h13.793c0.314,0,0.567-0.251,0.567-0.571    v-1.999H3.045z"/>
+<polygon fill="#F4A816" points="6.953,13.758 5.177,11.845 15.842,11.845 14.063,13.758   "/>
+<polygon fill="#FFFFFF" points="11.103,11.207 11.103,6.106 6.36,11.207   "/>
+<polygon fill="#FFFFFF" points="11.694,6.106 14.656,11.207 11.694,11.207   "/>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_other_videos.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -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/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_partial_icon.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,27 @@
+<?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 16 16">
+<g>
+<rect fill="none" width="16" height="16"/>
+<g>
+<g>
+<path stroke="#000000" stroke-width="0.25" d="M8.956,1.967c-0.29-0.039-3.052-0.43-3.585-0.5c0,0-0.152-0.024-0.345-0.01     c-0.193,0.015-2.67,0.534-2.889,0.566C1.864,2.058,1.7,2.202,1.654,2.271C1.607,2.328,1.568,2.42,1.568,2.586     C1.565,3.102,1.572,9,1.568,9.865c-0.002,0.486,0.27,0.472,0.27,0.472s3.129,1.052,3.818,1.052c0.687,0,3.308-1.85,3.308-1.85     c0.288-0.143,0.322-0.66,0.322-0.66l0.038-6.393C9.325,2.486,9.311,2.013,8.956,1.967z M1.808,2.195c-0.001,0-0.003,0-0.005,0     C1.804,2.195,1.807,2.195,1.808,2.195z M1.763,2.202c0.002,0,0.003-0.003,0.007-0.003C1.767,2.199,1.765,2.202,1.763,2.202z      M1.716,2.219c-0.002,0-0.004,0.004-0.007,0.005C1.712,2.223,1.714,2.219,1.716,2.219z"/>
+<polygon fill="#FFFFFF" stroke="#FFFFFF" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" points="     2.612,3.976 4.969,4.376 4.969,5.146 2.611,4.693    "/>
+</g>
+<g>
+<g>
+<path fill="#FFFFFF" stroke="#000000" stroke-width="0.5" d="M13.987,4.342c-0.29-0.036-3.052-0.427-3.585-0.499      c0,0-0.152-0.023-0.346-0.008C9.864,3.848,7.386,4.37,7.168,4.4C6.896,4.435,6.599,4.797,6.599,4.964      c-0.002,0.515,0.005,6.415,0,7.276c0,0.489,0.272,0.474,0.272,0.474s3.128,1.053,3.816,1.053c0.688,0,3.31-1.853,3.31-1.853      c0.287-0.144,0.321-0.657,0.321-0.657l0.039-6.395C14.357,4.862,14.342,4.389,13.987,4.342z M6.838,4.569c0,0-0.002,0-0.004,0      C6.835,4.569,6.837,4.569,6.838,4.569z M6.793,4.577c0.002,0,0.004,0,0.008-0.004C6.799,4.577,6.796,4.577,6.793,4.577z       M6.748,4.596c-0.002,0-0.005,0.003-0.008,0.003C6.742,4.599,6.745,4.596,6.748,4.596z"/>
+<polygon stroke="#000000" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" points="7.644,6.354 10,6.75       10,7.523 7.643,7.068     "/>
+<path fill="#FFFFFF" stroke="#000000" stroke-width="0.25" d="M14.294,5.729"/>
+<polyline fill="#FFFFFF" stroke="#000000" stroke-width="0.5" points="11.166,13.481 11.186,5.506 11.186,5.663 14.242,4.862           "/>
+<path fill="none" stroke="#000000" stroke-width="0.5" d="M11.186,6.019c0.063-0.624-0.298-0.645-0.298-0.645      S7.625,4.952,6.834,4.899c0,0-0.27-0.033-0.27,0.382"/>
+</g>
+<polygon points="11.107,13.876 6.734,12.66 6.734,9.539 11.22,10.589    "/>
+<polygon points="14.242,11.593 11.199,13.672 11.22,10.561 14.188,8.794    "/>
+</g>
+<g>
+<path stroke="#FFFFFF" stroke-width="0.5" d="M2.888,14.174c-3.552-2.016-1.097-4.809,2.43-6.104L5.247,6.912l4.297,1.272     l-4.031,2.564L5.452,9.624C2.758,10.676,1.266,12.48,2.888,14.174z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_partial_note_icon.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,132 @@
+<?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 40 53">
+<g>
+<rect fill="none" width="40" height="53"/>
+<g>
+<g>
+<g>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="3.6636" y1="13.2246" x2="12.9016" y2="37.2905">
+<stop offset="0" style="stop-color:#2DAD00"/>
+<stop offset="0.1833" style="stop-color:#2DA700"/>
+<stop offset="0.421" style="stop-color:#2D9700"/>
+<stop offset="0.6886" style="stop-color:#2D7C00"/>
+<stop offset="0.9762" style="stop-color:#2D5700"/>
+<stop offset="1" style="stop-color:#2D5400"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M13.111,17.446l-9.002-1.424c0,0-0.393-0.059-0.397,0.661c-0.004,1.11,0.004,16.68,0,17.294       c-0.001,0.585,0.287,0.661,0.287,0.661l9.072,2.544c0,0,0.307,0.104,0.309-0.557c0.004-0.895,0.105-16.866,0.11-18.322       C13.493,17.447,13.111,17.446,13.111,17.446z"/>
+<polygon fill="#3D3D3D" points="4.332,18.653 12.697,20.169 12.697,21.614 4.326,20.122      "/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="12.314" y1="9.9883" x2="16.0787" y2="26.295">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.0056" style="stop-color:#000000"/>
+<stop offset="0.1404" style="stop-color:#3D3D3D"/>
+<stop offset="0.3429" style="stop-color:#FFFFFF"/>
+<stop offset="0.3582" style="stop-color:#FFFFFF"/>
+<stop offset="0.5112" style="stop-color:#E9E9E9"/>
+<stop offset="0.567" style="stop-color:#E2E2E2"/>
+<stop offset="0.6503" style="stop-color:#CDCDCD"/>
+<stop offset="0.7506" style="stop-color:#ACACAC"/>
+<stop offset="0.8643" style="stop-color:#7E7E7E"/>
+<stop offset="0.9878" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_11_)" d="M22.14,13.396c-0.736-0.101-7.745-0.717-9.099-0.906c0,0-0.386-0.068-0.875-0.027       c-0.49,0.036-6.778,1.005-7.333,1.091c-0.694,0.095-1.113,0.486-1.228,0.673c0.187-0.239,0.427-0.212,0.427-0.212       c1.888,0.142,9.69,1.314,9.69,1.314s1.365,0.467,1.23,2.176l0.03,0.525l8.026,6.661l0.068-9.885       C23.077,14.807,23.042,13.52,22.14,13.396z"/>
+<path fill="#FFFFFF" d="M13.723,15.329c0,0-7.802-1.173-9.69-1.314c0,0-0.642-0.083-0.642,1.065       c-0.006,1.403,0.008,17.432,0,19.774c-0.006,1.328,0.686,1.281,0.686,1.281l9.688,2.857c0,0,1.193-0.118,1.193-1.885       c0-1.768,0-20.163,0-20.163v-0.012C14.904,15.199,13.723,15.329,13.723,15.329z M13.379,36.626       c-0.001,0.661-0.309,0.557-0.309,0.557l-9.072-2.544c0,0-0.289-0.076-0.287-0.661c0.004-0.614-0.004-16.184,0-17.294       c0.004-0.72,0.397-0.661,0.397-0.661l9.002,1.424c0,0,0.382,0.001,0.378,0.857C13.484,19.76,13.383,35.731,13.379,36.626z"/>
+<path fill="#3D3D3D" d="M13.991,18.27c0-1.149-0.649-1.307-0.649-1.307l-8.615-1.295c0,0-0.323,0.044-0.405,0.089       c-0.2,0.11-0.546,0.323-0.546,0.473c0,0.011,0.007,0.027,0.008,0.032c0.113-0.266,0.325-0.239,0.325-0.239l9.002,1.424       c0,0,0.382,0.001,0.378,0.857c-0.005,1.456-0.105,17.428-0.11,18.322c0,0.081-0.005,0.153-0.012,0.209       c-0.005,0.034-0.012,0.061-0.021,0.092c-0.003,0.015-0.008,0.037-0.014,0.057c-0.01,0.033-0.024,0.06-0.038,0.084       c-0.004,0.005-0.004,0.009-0.008,0.014c-0.018,0.027-0.036,0.047-0.052,0.061l0,0c0.113-0.046,0.776-0.324,0.776-0.605       C14.011,36.23,13.991,19.282,13.991,18.27z"/>
+</g>
+<polygon fill="#3D3D3D" points="4.282,21.262 12.648,22.777 12.648,24.222 4.278,22.729     "/>
+</g>
+</g>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="13.9858" y1="14.7031" x2="22.0724" y2="35.7693">
+<stop offset="0" style="stop-color:#2DAD00"/>
+<stop offset="0.1833" style="stop-color:#2DA700"/>
+<stop offset="0.421" style="stop-color:#2D9700"/>
+<stop offset="0.6886" style="stop-color:#2D7C00"/>
+<stop offset="0.9762" style="stop-color:#2D5700"/>
+<stop offset="1" style="stop-color:#2D5400"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M22.438,14.972c-0.158,0.027-6.151,1.513-6.601,1.648c-0.3,0.091-0.897,0.091-0.9,0.81    c-0.004,1.111,0.029,19.607,0.029,19.623c0.016,1.244-0.6,1.68-0.555,1.649c5.333-3.555,7.456-4.535,7.756-4.755    c0.659-0.525,0.699-0.758,0.82-2.135c0.086-0.997,0.074-14.592,0.079-16.047C23.072,14.908,22.597,14.941,22.438,14.972z"/>
+<g>
+<g>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="16.3066" y1="18.9346" x2="25.545" y2="43.0014">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.1191" style="stop-color:#E2E2E2"/>
+<stop offset="0.2885" style="stop-color:#CDCDCD"/>
+<stop offset="0.4927" style="stop-color:#ACACAC"/>
+<stop offset="0.724" style="stop-color:#7E7E7E"/>
+<stop offset="0.9752" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_13_)" d="M25.754,23.155l-9.003-1.423c0,0-0.394-0.058-0.396,0.661c-0.004,1.11,0.003,16.682,0,17.294      c-0.002,0.586,0.286,0.662,0.286,0.662l9.072,2.544c0,0,0.308,0.104,0.309-0.557c0.005-0.895,0.105-16.867,0.11-18.322      C26.135,23.156,25.754,23.155,25.754,23.155z"/>
+<polygon fill="#3D3D3D" points="16.974,24.363 25.34,25.88 25.34,27.324 16.969,25.833     "/>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="24.7998" y1="15.0176" x2="30.0396" y2="37.7136">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.0056" style="stop-color:#000000"/>
+<stop offset="0.1404" style="stop-color:#3D3D3D"/>
+<stop offset="0.2901" style="stop-color:#FFFFFF"/>
+<stop offset="0.3473" style="stop-color:#FFFFFF"/>
+<stop offset="0.5112" style="stop-color:#E9E9E9"/>
+<stop offset="0.567" style="stop-color:#E2E2E2"/>
+<stop offset="0.6503" style="stop-color:#CDCDCD"/>
+<stop offset="0.7506" style="stop-color:#ACACAC"/>
+<stop offset="0.8643" style="stop-color:#7E7E7E"/>
+<stop offset="0.9878" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_14_)" d="M34.783,19.106c-0.736-0.099-7.745-0.717-9.1-0.906c0,0-0.387-0.066-0.875-0.026      c-0.49,0.034-6.779,1.004-7.333,1.089c-0.695,0.095-1.114,0.488-1.228,0.673c0.187-0.238,0.427-0.212,0.427-0.212      c1.888,0.144,9.689,1.315,9.689,1.315s1.183-0.129,1.234,1.605v0.013c0,0-0.011,13.747-0.011,15.516      c0,0.629,8.061-3.761,8.061-3.761l0.07-13.894C35.72,20.519,35.685,19.23,34.783,19.106z"/>
+<path fill="#FFFFFF" d="M26.365,21.039c0,0-7.802-1.172-9.689-1.315c0,0-0.642-0.083-0.642,1.068      c-0.007,1.402,0.008,17.431,0,19.773c-0.006,1.328,0.685,1.28,0.685,1.28l9.687,2.858c0,0,1.193-0.12,1.193-1.884      c0-1.77,0-20.163,0-20.163v-0.013C27.548,20.91,26.365,21.039,26.365,21.039z M26.021,42.337      c-0.001,0.66-0.309,0.557-0.309,0.557l-9.072-2.544c0,0-0.288-0.076-0.286-0.662c0.003-0.612-0.004-16.184,0-17.294      c0.003-0.719,0.396-0.661,0.396-0.661l9.003,1.423c0,0,0.381,0.001,0.378,0.859C26.127,25.47,26.026,41.442,26.021,42.337z"/>
+<path fill="#3D3D3D" d="M26.634,23.981c0-1.151-0.65-1.31-0.65-1.31l-8.614-1.294c0,0-0.324,0.043-0.405,0.09      c-0.2,0.109-0.546,0.322-0.546,0.473c0,0.011,0.007,0.025,0.008,0.032c0.114-0.266,0.325-0.24,0.325-0.24l9.003,1.423      c0,0,0.381,0.001,0.378,0.859c-0.005,1.455-0.105,17.428-0.11,18.322c0,0.082-0.005,0.152-0.012,0.209      c-0.005,0.033-0.013,0.06-0.021,0.09c-0.004,0.018-0.009,0.039-0.016,0.057c-0.01,0.035-0.023,0.06-0.037,0.086      c-0.004,0.005-0.004,0.008-0.008,0.014c-0.018,0.028-0.035,0.047-0.053,0.061l0,0c0.114-0.047,0.777-0.324,0.777-0.607      C26.653,41.938,26.634,24.992,26.634,23.981z"/>
+</g>
+<polygon fill="#3D3D3D" points="16.925,26.971 25.29,28.488 25.29,29.932 16.92,28.439    "/>
+</g>
+<linearGradient id="XMLID_15_" gradientUnits="userSpaceOnUse" x1="19.0107" y1="31.2988" x2="23.7619" y2="43.6761">
+<stop offset="0" style="stop-color:#2D9900"/>
+<stop offset="0.2144" style="stop-color:#2D9300"/>
+<stop offset="0.4925" style="stop-color:#2D8300"/>
+<stop offset="0.8042" style="stop-color:#2D6900"/>
+<stop offset="1" style="stop-color:#2D5400"/>
+</linearGradient>
+<path fill="url(#XMLID_15_)" d="M25.743,34.009l-8.994-1.807c0,0-0.36,0.021-0.363,0.215c-0.003,0.301,0,7.215-0.009,7.382    c-0.021,0.363,0.213,0.521,0.213,0.521l9.17,2.589c0,0,0.248-0.108,0.25-0.287c0.002-0.243,0.073-7.986,0.078-8.379    C26.093,34.01,25.743,34.009,25.743,34.009z"/>
+<g>
+<linearGradient id="XMLID_16_" gradientUnits="userSpaceOnUse" x1="-34.7671" y1="53.8066" x2="-21.8119" y2="67.2221" gradientTransform="matrix(1.1364 0 0 -1.1364 38.3208 110.082)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_16_)" d="M7.661,42.945c-1.884-4.713,3.346-6.946,6.089-8.015c-0.345-0.836-0.227-0.946-0.573-1.783     C7.052,35.536,4.788,39.022,7.661,42.945"/>
+<polygon fill="#005795" points="21.552,30.297 21.319,31.856 13.523,37.29 13.28,35.526    "/>
+<path fill="#005795" d="M7.939,42.666c-1.144-0.53-3.645-4.925-3.645-4.925c-0.133,2.269,1.679,5.309,3.794,6.353L7.939,42.666z"/>
+<linearGradient id="XMLID_17_" gradientUnits="userSpaceOnUse" x1="-582.0918" y1="887.582" x2="-586.7162" y2="874.1518" gradientTransform="matrix(-1.1364 0 0 1.1364 -651.8472 -965.3837)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_17_)" d="M7.827,42.644c-7.322-4.155-2.262-9.912,5.007-12.583l-0.146-2.388l8.86,2.624l-8.312,5.286     l-0.124-2.318C7.558,35.434,4.482,39.151,7.827,42.644z"/>
+</g>
+<linearGradient id="XMLID_18_" gradientUnits="userSpaceOnUse" x1="29.208" y1="32.2803" x2="32.9708" y2="42.0826">
+<stop offset="0" style="stop-color:#2DAD00"/>
+<stop offset="0.1833" style="stop-color:#2DA700"/>
+<stop offset="0.421" style="stop-color:#2D9700"/>
+<stop offset="0.6886" style="stop-color:#2D7C00"/>
+<stop offset="0.9762" style="stop-color:#2D5700"/>
+<stop offset="1" style="stop-color:#2D5400"/>
+</linearGradient>
+<path fill="url(#XMLID_18_)" d="M34.985,31.267c-0.159,0.029-6.338,2.508-6.786,2.65c-0.285,0.09-0.591,0.245-0.601,0.78    c-0.02,1.116-0.019,8.07-0.015,8.101c0.091,0.75-0.431,1.523-0.39,1.499c5.488-3.307,7.26-4.396,7.561-4.614    c0.66-0.524,0.828-0.769,0.869-2.15c0.031-0.99,0.025-3.99,0.031-5.445C35.657,31.229,35.143,31.237,34.985,31.267z"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_phone_images.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -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/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_phone_videos.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+<?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>
+<g>
+<path fill="#FFFFFF" d="M5.252,4.396c-1.264-0.029-2.151,0.351-2.143,2.13v10.113c-0.009,1.748,0.731,2.097,2.143,2.129h10.71     c1.638,0.056,2.142-0.674,2.143-2.129V6.525c-0.001-1.575-0.741-2.159-2.143-2.13H5.252z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="3.5586" y1="5.6973" x2="17.6848" y2="17.5505">
+<stop offset="0" style="stop-color:#AFAFAE"/>
+<stop offset="1" style="stop-color:#121212"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M17.639,17.179c0,0.645-0.523,1.171-1.17,1.171H4.773c-0.646,0-1.17-0.526-1.17-1.171V6.067     c0-0.645,0.523-1.169,1.17-1.169h11.695c0.646,0,1.17,0.524,1.17,1.169V17.179z"/>
+<rect x="4.773" y="12.502" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="4.773" y="16.011" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="14.715" y="8.992" fill="#FFFFFF" width="1.754" height="1.756"/>
+<rect x="14.715" y="5.483" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="14.715" y="12.502" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="14.715" y="16.011" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="7.697" y="4.898" fill="#CBCBCB" width="5.848" height="3.509"/>
+<rect x="7.697" y="9.576" fill="#CBCBCB" width="5.848" height="4.095"/>
+<rect x="7.697" y="14.841" fill="#CBCBCB" width="5.848" height="3.509"/>
+</g>
+<g>
+<path fill="#FFFFFF" d="M10.586,1.936H9.373c0,0,0,0.719,0,1.011c-0.652,0-3.535,0-3.535,0c-0.84,0-1.522,0.711-1.522,1.584     v7.351c0,0.874,0.683,1.584,1.522,1.584h4.644c0.839,0,1.521-0.71,1.521-1.584V4.53C12,3.851,11.58,3.29,10.99,3.069     c0-0.299,0-1.134,0-1.134H10.586z"/>
+<path d="M10.586,3.362V2.34H9.777v1.011H5.838c-0.617,0-1.118,0.53-1.118,1.18v7.351c0,0.65,0.501,1.18,1.118,1.18h4.644     c0.615,0,1.117-0.529,1.117-1.18V4.53C11.597,3.916,11.151,3.421,10.586,3.362z"/>
+<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="4.5752" y1="5.1992" x2="11.7426" y2="11.2134">
+<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_5_)" d="M10.479,3.958H5.838c-0.281,0-0.512,0.256-0.512,0.572v7.351c0,0.315,0.23,0.573,0.512,0.573     h4.644c0.28,0,0.511-0.258,0.511-0.573V4.53C10.99,4.214,10.762,3.958,10.479,3.958z"/>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="5.876" y1="5.0771" x2="10.4423" y2="8.9088">
+<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="6.136" y="4.768" fill="url(#XMLID_6_)" width="4.046" height="4.45"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_red_check.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,13 @@
+<?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 d="M17.557,15.611c0,1.048-0.85,1.897-1.896,1.897H5.553c-1.046,0-1.895-0.85-1.895-1.897V5.505    c0-1.046,0.849-1.896,1.895-1.896h10.108c1.046,0,1.896,0.85,1.896,1.896V15.611z"/>
+<path fill="#BF5E5E" d="M5.553,4.872c-0.348,0-0.631,0.283-0.631,0.633v10.106c0,0.349,0.283,0.632,0.631,0.632h10.108    c0.349,0,0.632-0.283,0.632-0.632V5.505c0-0.35-0.283-0.633-0.632-0.633H5.553z"/>
+<path fill="#981515" d="M6.186,6.136h10.107V5.505c0-0.35-0.283-0.633-0.632-0.633H5.553c-0.348,0-0.631,0.283-0.631,0.633v10.106    c0,0.349,0.283,0.632,0.631,0.632h0.633V6.136z"/>
+<polygon fill="#424141" points="10.606,9.927 7.658,6.978 6.816,7.821 9.766,10.769 6.816,13.716 7.658,14.56 10.606,11.611     13.558,14.56 14.397,13.716 11.449,10.769 14.397,7.821 13.558,6.98   "/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_red_uncheck.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,12 @@
+<?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 d="M17.557,15.611c0,1.048-0.85,1.897-1.896,1.897H5.553c-1.046,0-1.895-0.85-1.895-1.897V5.505    c0-1.046,0.849-1.896,1.895-1.896h10.108c1.046,0,1.896,0.85,1.896,1.896V15.611z"/>
+<path fill="#BF5E5E" d="M5.553,4.872c-0.348,0-0.631,0.283-0.631,0.633v10.106c0,0.349,0.283,0.632,0.631,0.632h10.108    c0.349,0,0.632-0.283,0.632-0.632V5.505c0-0.35-0.283-0.633-0.632-0.633H5.553z"/>
+<path fill="#981515" d="M6.186,6.136h10.107V5.505c0-0.35-0.283-0.633-0.632-0.633H5.553c-0.348,0-0.631,0.283-0.631,0.633v10.106    c0,0.349,0.283,0.632,0.631,0.632h0.633V6.136z"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_removed_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,83 @@
+<?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>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-144.5566" y1="-370.2783" x2="-139.0283" y2="-370.2783" gradientTransform="matrix(0 1 -1 0 -364.9043 149.4043)">
+<stop offset="0" style="stop-color:#B70000"/>
+<stop offset="0.0028" style="stop-color:#B70000"/>
+<stop offset="0.055" style="stop-color:#AC0000"/>
+<stop offset="0.2344" style="stop-color:#8A0000"/>
+<stop offset="0.4177" style="stop-color:#6F0000"/>
+<stop offset="0.6042" style="stop-color:#5C0000"/>
+<stop offset="0.7957" style="stop-color:#510000"/>
+<stop offset="1" style="stop-color:#4D0000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_8_)" points="2.579,4.848 8.17,10.192 7.716,10.376 3.489,6.26   "/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-138.2822" y1="-378.8232" x2="-144.9586" y2="-381.9517" gradientTransform="matrix(0 1 -1 0 -364.9043 149.4043)">
+<stop offset="0" style="stop-color:#610000"/>
+<stop offset="0.2559" style="stop-color:#640000"/>
+<stop offset="0.4511" style="stop-color:#6E0000"/>
+<stop offset="0.6261" style="stop-color:#7E0000"/>
+<stop offset="0.7893" style="stop-color:#950000"/>
+<stop offset="0.9429" style="stop-color:#B20000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_9_)" points="12.458,10.035 17.896,4.843 18.106,6.395 13.527,10.938   "/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-490.5391" y1="-159.748" x2="-506.5916" y2="-167.27" gradientTransform="matrix(-0.7091 -0.7073 0.7062 -0.708 -227.8119 -458.4745)">
+<stop offset="0" style="stop-color:#CB0000"/>
+<stop offset="0.4669" style="stop-color:#C90000"/>
+<stop offset="0.635" style="stop-color:#C20000"/>
+<stop offset="0.7549" style="stop-color:#B70000"/>
+<stop offset="0.8518" style="stop-color:#A60000"/>
+<stop offset="0.9338" style="stop-color:#900000"/>
+<stop offset="1" style="stop-color:#780000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_10_)" points="10.255,12.445 5.049,17.506 2.619,15.047 7.764,9.862 2.564,4.833 5.084,2.36     10.255,7.465 15.374,2.372 17.896,4.843 12.721,9.862 17.879,15.102 15.473,17.474   "/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M17.164,11.91"/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="-132.9473" y1="-381.2256" x2="-132.1228" y2="-382.2082" gradientTransform="matrix(0 1 -1 0 -364.9043 149.4043)">
+<stop offset="0" style="stop-color:#690000"/>
+<stop offset="0.3698" style="stop-color:#6B0000"/>
+<stop offset="0.5521" style="stop-color:#730000"/>
+<stop offset="0.6934" style="stop-color:#800000"/>
+<stop offset="0.8136" style="stop-color:#930000"/>
+<stop offset="0.9193" style="stop-color:#AB0000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_11_)" points="15.479,17.461 17.887,15.1 17.912,16.556 15.813,18.698   "/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="-136.9248" y1="-372.3926" x2="-130.54" y2="-372.3926" gradientTransform="matrix(-0.0037 1.0036 -1.0037 0.0037 -366.4318 151.2426)">
+<stop offset="0" style="stop-color:#800000"/>
+<stop offset="0.3671" style="stop-color:#820000"/>
+<stop offset="0.579" style="stop-color:#8B0000"/>
+<stop offset="0.7514" style="stop-color:#990000"/>
+<stop offset="0.9017" style="stop-color:#AC0000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_12_)" points="5.038,17.517 10.264,12.438 10.631,13.82 5.591,18.862   "/>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="-136.96" y1="-377.9404" x2="-130.7061" y2="-377.9404" gradientTransform="matrix(0 1 -1 0 -364.9043 149.4043)">
+<stop offset="0" style="stop-color:#4D0000"/>
+<stop offset="0.1318" style="stop-color:#5D0000"/>
+<stop offset="0.6968" style="stop-color:#9E0000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_13_)" points="10.258,12.444 15.49,17.458 15.813,18.698 10.631,13.82   "/>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="-134.3643" y1="-369.0049" x2="-130.542" y2="-369.0049" gradientTransform="matrix(0 1 -1 0 -364.9043 149.4043)">
+<stop offset="0" style="stop-color:#4D0000"/>
+<stop offset="0.1661" style="stop-color:#520000"/>
+<stop offset="0.3631" style="stop-color:#600000"/>
+<stop offset="0.5758" style="stop-color:#780000"/>
+<stop offset="0.798" style="stop-color:#990000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_14_)" points="2.611,15.04 5.083,17.471 5.591,18.862 3.237,16.449   "/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M5.652,18.979"/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M18.229,6.524"/>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_skipped_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,113 @@
+<?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>
+<g>
+<polygon fill="#005447" points="9.191,14.714 8.911,13.178 8.921,14.818 9.178,16.519    "/>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-19.4399" y1="61.6865" x2="-27.6178" y2="56.3198" gradientTransform="matrix(1.1364 0 0 -1.1364 39.6101 77.1576)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M15.574,5.482c0,0-6.656,7.651-6.664,7.695c0.121,0.93,0.203,1.417,0.252,1.557      C9.264,14.708,17.703,12.409,15.574,5.482z"/>
+<polygon fill="#005447" points="9.028,15.03 9.173,16.562 2.033,14.313 1.878,12.915     "/>
+</g>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="-31.3271" y1="54.4258" x2="-21.2976" y2="63.4564" gradientTransform="matrix(1.1364 0 0 -1.1364 39.6101 77.1576)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_11_)" d="M12.961,2.976c5.91,3.354,1.826,8.002-4.042,10.158l0.119,1.925l-7.15-2.115l6.708-4.267     l0.1,1.87C13.18,8.796,15.662,5.798,12.961,2.976z"/>
+</g>
+<g>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="-140.0088" y1="-376.8369" x2="-136.9746" y2="-376.8369" gradientTransform="matrix(0 1 -1 0 -364.8564 149.7021)">
+<stop offset="0" style="stop-color:#B70000"/>
+<stop offset="0.0028" style="stop-color:#B70000"/>
+<stop offset="0.055" style="stop-color:#AC0000"/>
+<stop offset="0.2344" style="stop-color:#8A0000"/>
+<stop offset="0.4177" style="stop-color:#6F0000"/>
+<stop offset="0.6042" style="stop-color:#5C0000"/>
+<stop offset="0.7957" style="stop-color:#510000"/>
+<stop offset="1" style="stop-color:#4D0000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_12_)" points="10.403,9.693 13.559,12.627 13.303,12.728 10.916,10.469    "/>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="-136.5547" y1="-381.6787" x2="-140.244" y2="-383.4074" gradientTransform="matrix(0 1 -1 0 -364.8564 149.7021)">
+<stop offset="0" style="stop-color:#610000"/>
+<stop offset="0.2559" style="stop-color:#640000"/>
+<stop offset="0.4511" style="stop-color:#6E0000"/>
+<stop offset="0.6261" style="stop-color:#7E0000"/>
+<stop offset="0.7893" style="stop-color:#950000"/>
+<stop offset="0.9429" style="stop-color:#B20000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_13_)" points="15.98,12.541 19.05,9.692 19.168,10.545 16.584,13.036    "/>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="-499.1973" y1="-159.6934" x2="-508.0561" y2="-163.8445" gradientTransform="matrix(-0.7091 -0.7073 0.7062 -0.708 -228.1476 -458.2676)">
+<stop offset="0" style="stop-color:#CB0000"/>
+<stop offset="0.4669" style="stop-color:#C90000"/>
+<stop offset="0.635" style="stop-color:#C20000"/>
+<stop offset="0.7549" style="stop-color:#B70000"/>
+<stop offset="0.8518" style="stop-color:#A60000"/>
+<stop offset="0.9338" style="stop-color:#900000"/>
+<stop offset="1" style="stop-color:#780000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_14_)" points="14.736,13.862 11.797,16.639 10.426,15.29 13.33,12.445 10.395,9.686 11.817,8.329      14.736,11.131 17.626,8.336 19.05,9.692 16.127,12.445 19.04,15.321 17.682,16.622    "/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M18.637,13.569"/>
+<linearGradient id="XMLID_15_" gradientUnits="userSpaceOnUse" x1="-133.6494" y1="-383.0127" x2="-133.1772" y2="-383.5755" gradientTransform="matrix(0 1 -1 0 -364.8564 149.7021)">
+<stop offset="0" style="stop-color:#690000"/>
+<stop offset="0.3698" style="stop-color:#6B0000"/>
+<stop offset="0.5521" style="stop-color:#730000"/>
+<stop offset="0.6934" style="stop-color:#800000"/>
+<stop offset="0.8136" style="stop-color:#930000"/>
+<stop offset="0.9193" style="stop-color:#AB0000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_15_)" points="17.685,16.614 19.045,15.319 19.059,16.119 17.874,17.295    "/>
+<linearGradient id="XMLID_16_" gradientUnits="userSpaceOnUse" x1="-135.7896" y1="-377.8579" x2="-132.2866" y2="-377.8579" gradientTransform="matrix(-0.0037 1.0036 -1.0037 0.0037 -366.3838 151.5403)">
+<stop offset="0" style="stop-color:#800000"/>
+<stop offset="0.3671" style="stop-color:#820000"/>
+<stop offset="0.579" style="stop-color:#8B0000"/>
+<stop offset="0.7514" style="stop-color:#990000"/>
+<stop offset="0.9017" style="stop-color:#AC0000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_16_)" points="11.791,16.646 14.742,13.858 14.949,14.617 12.104,17.384    "/>
+<linearGradient id="XMLID_17_" gradientUnits="userSpaceOnUse" x1="-135.8398" y1="-381.1611" x2="-132.4072" y2="-381.1611" gradientTransform="matrix(0 1 -1 0 -364.8564 149.7021)">
+<stop offset="0" style="stop-color:#4D0000"/>
+<stop offset="0.1318" style="stop-color:#5D0000"/>
+<stop offset="0.6968" style="stop-color:#9E0000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_17_)" points="14.738,13.862 17.691,16.613 17.874,17.295 14.949,14.617    "/>
+<linearGradient id="XMLID_18_" gradientUnits="userSpaceOnUse" x1="-134.416" y1="-376.1182" x2="-132.3184" y2="-376.1182" gradientTransform="matrix(0 1 -1 0 -364.8564 149.7021)">
+<stop offset="0" style="stop-color:#4D0000"/>
+<stop offset="0.1661" style="stop-color:#520000"/>
+<stop offset="0.3631" style="stop-color:#600000"/>
+<stop offset="0.5758" style="stop-color:#780000"/>
+<stop offset="0.798" style="stop-color:#990000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_18_)" points="10.421,15.286 11.816,16.62 12.104,17.384 10.774,16.061    "/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M12.137,17.448"/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M19.237,10.615"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_store_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,36 @@
+<?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>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="-36.2856" y1="47.3623" x2="-25.528" y2="58.5022" gradientTransform="matrix(1.1364 0 0 -1.1364 39.6442 75.186)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M5.757,16.391c-1.564-3.913,2.779-5.769,5.058-6.657c-0.286-0.693-0.189-0.785-0.476-1.479    C5.251,10.237,3.371,13.134,5.757,16.391"/>
+<polygon fill="#005795" points="17.295,5.886 17.102,7.182 10.625,11.692 10.424,10.229   "/>
+<path fill="#005795" d="M5.989,16.16c-0.951-0.44-3.028-4.092-3.028-4.092c-0.109,1.885,1.395,4.408,3.153,5.274L5.989,16.16z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="-598.3599" y1="862.209" x2="-602.2009" y2="851.0539" gradientTransform="matrix(-1.1364 0 0 1.1364 -672.5748 -963.1558)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M5.895,16.143c-6.08-3.452-1.879-8.235,4.16-10.451L9.933,3.71l7.356,2.177l-6.902,4.389    l-0.102-1.923C5.67,10.152,3.116,13.24,5.895,16.143z"/>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,77 @@
+<?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 57 49.149">
+<g>
+<g>
+<radialGradient id="XMLID_6_" cx="28.2139" cy="22.5762" r="18.5007" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#A0D17C"/>
+<stop offset="0.4873" style="stop-color:#9ECF7B"/>
+<stop offset="0.6628" style="stop-color:#98C878"/>
+<stop offset="0.7875" style="stop-color:#8DBD71"/>
+<stop offset="0.8563" style="stop-color:#83B26C"/>
+<stop offset="1" style="stop-color:#5D8856"/>
+</radialGradient>
+<circle fill="url(#XMLID_6_)" cx="28.214" cy="22.576" r="18.501"/>
+<g>
+<g>
+<polygon fill="#005447" points="31.898,32.435 31.466,30.062 31.482,32.596 31.879,35.219     "/>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="6.667" y1="75.6035" x2="-5.9528" y2="67.3218" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1776 106.5269)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M41.75,18.187c0,0-10.272,11.811-10.284,11.875c0.186,1.438,0.313,2.188,0.39,2.402       C32.01,32.425,45.034,28.878,41.75,18.187z"/>
+<polygon fill="#005447" points="31.648,32.922 31.871,35.284 20.852,31.815 20.613,29.657      "/>
+</g>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-11.6782" y1="64.3945" x2="3.8001" y2="78.3313" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1776 106.5269)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M37.717,14.318c9.119,5.18,2.817,12.352-6.239,15.679l0.183,2.971l-11.035-3.266l10.352-6.585      l0.153,2.886C38.055,23.302,41.883,18.673,37.717,14.318z"/>
+</g>
+<g>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-26.2119" y1="62.7676" x2="-10.6416" y2="78.8911" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1776 106.5269)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M18.024,28.001c-2.262-5.662,4.022-8.348,7.321-9.633c-0.415-1.002-0.274-1.138-0.688-2.141      C17.293,19.096,14.572,23.288,18.024,28.001"/>
+<polygon fill="#005795" points="34.723,12.801 34.441,14.673 25.07,21.203 24.781,19.085     "/>
+<path fill="#005795" d="M18.36,27.667c-1.375-0.639-4.381-5.918-4.381-5.918c-0.159,2.726,2.019,6.378,4.563,7.631L18.36,27.667      z"/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-575.8057" y1="874.292" x2="-581.3632" y2="858.1517" gradientTransform="matrix(-1.1364 0 0 1.1364 -633.9402 -965.1567)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M18.223,27.641c-8.797-4.993-2.717-11.915,6.02-15.124L24.068,9.65l10.647,3.152l-9.989,6.351      l-0.146-2.786C17.9,18.974,14.204,23.442,18.223,27.641z"/>
+</g>
+</g>
+</g>
+<rect fill="none" width="57" height="49.149"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_from_home.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,43 @@
+<?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>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="9.5039" y1="18.9873" x2="16.1428" y2="0.7013" gradientTransform="matrix(1 0 0 -1 0.1377 18.1113)">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#4D4D4D"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M4.129,1.322L4.129,1.322L4.128,1.32c0,0,0.635-0.437,1.436-0.445l10.318,0.689      c0,0,0.665,0.05,0.996,0.362c0.303,0.288,0.273,0.728,0.273,0.728l-0.117,16.114c0,0,0.002,0.564-0.347,0.75      c-0.007,0.004-0.013,0.005-0.018,0.007c-0.128,0.08-1.396,0.669-1.378,0.66L4.129,1.322z"/>
+<path fill="#FFFFFF" d="M4.845,1.149c0,0-0.528,0.01-0.829,0.246C3.677,1.666,3.671,2.26,3.671,2.26L3.549,16.296      c0,0-0.034,0.541,0.211,0.923c0.198,0.309,0.632,0.495,0.632,0.495l9.968,2.5c0,0,0.606,0.163,0.954-0.028      c0.35-0.191,0.347-0.766,0.347-0.766l0.095-16.43c0,0,0.031-0.449-0.273-0.742c-0.331-0.317-0.994-0.369-0.994-0.369      L4.845,1.149z"/>
+<radialGradient id="XMLID_5_" cx="-394.3223" cy="-372.0498" r="49.8302" gradientTransform="matrix(0.3466 0 0 -0.3466 141.5259 -125.7637)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#F3F3F3"/>
+<stop offset="0.0056" style="stop-color:#F3F3F3"/>
+<stop offset="0.1878" style="stop-color:#EAEAEA"/>
+<stop offset="0.4819" style="stop-color:#D2D2D2"/>
+<stop offset="0.8493" style="stop-color:#ACACAC"/>
+<stop offset="1" style="stop-color:#9A9A9A"/>
+</radialGradient>
+<path fill="url(#XMLID_5_)" d="M4.318,17.247c0,0-0.331-0.098-0.428-0.291c-0.097-0.195-0.135-0.488-0.135-0.488L3.805,2.573      c0,0,0-0.35,0.195-0.466C4.195,1.99,4.57,2.03,4.57,2.03l9.404,0.856c0,0,0.438,0.042,0.604,0.235      c0.17,0.195,0.174,0.504,0.174,0.504l-0.143,15.278c0,0,0.025,0.356-0.228,0.472c-0.252,0.116-0.604,0.089-0.604,0.089      L4.318,17.247z"/>
+</g>
+<g>
+<polygon fill="#595959" points="5.738,12.132 4.853,11.966 4.853,12.449 5.736,12.62     "/>
+<polygon fill="#595959" points="7.128,12.39 7.125,12.89 13.063,14.04 13.072,13.496     "/>
+<polygon fill="#595959" points="5.72,14.428 4.898,14.253 4.898,14.804 5.717,14.984     "/>
+<polygon fill="#595959" points="7.109,14.724 7.105,15.292 13.063,16.607 13.072,15.995     "/>
+</g>
+</g>
+<g>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="-29.2617" y1="58.0576" x2="-23.7476" y2="63.0225" gradientTransform="matrix(1.1364 0 0 -1.1364 39.6925 76.5213)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_6_)" d="M11.375,3.742c3.248,1.845,1.004,4.401-2.222,5.585l0.065,1.06L5.288,9.224l3.688-2.346     L9.03,7.905C11.496,6.943,12.861,5.295,11.375,3.742z"/>
+</g>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_full.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+<?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>
+<g>
+<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="9.5977" y1="19.4063" x2="16.245" y2="1.0969" gradientTransform="matrix(1 0 0 -1 0.1377 18.3613)">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#4D4D4D"/>
+</linearGradient>
+<path fill="url(#XMLID_5_)" d="M4.216,1.155L4.216,1.155L4.216,1.155C4.215,1.154,4.851,0.717,5.652,0.708l10.332,0.69      c0,0,0.665,0.051,0.996,0.363c0.304,0.287,0.275,0.728,0.275,0.728l-0.119,16.136c0,0,0.002,0.564-0.347,0.75      c-0.007,0.005-0.013,0.006-0.017,0.008c-0.129,0.08-1.397,0.669-1.381,0.66L4.216,1.155z"/>
+<path fill="#FFFFFF" d="M4.933,0.983c0,0-0.53,0.009-0.831,0.246c-0.338,0.27-0.345,0.864-0.345,0.864L3.635,16.149      c0,0-0.034,0.54,0.211,0.924c0.199,0.309,0.633,0.495,0.633,0.495l9.98,2.504c0,0,0.607,0.162,0.957-0.029      c0.349-0.19,0.346-0.767,0.346-0.767l0.096-16.451c0,0,0.03-0.45-0.274-0.742c-0.331-0.317-0.996-0.37-0.996-0.37L4.933,0.983z"/>
+<radialGradient id="XMLID_6_" cx="-394.0942" cy="-371.0908" r="49.8949" gradientTransform="matrix(0.3466 0 0 -0.3466 141.5339 -125.5953)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#F3F3F3"/>
+<stop offset="0.0056" style="stop-color:#F3F3F3"/>
+<stop offset="0.1878" style="stop-color:#EAEAEA"/>
+<stop offset="0.4819" style="stop-color:#D2D2D2"/>
+<stop offset="0.8493" style="stop-color:#ACACAC"/>
+<stop offset="1" style="stop-color:#9A9A9A"/>
+</radialGradient>
+<path fill="url(#XMLID_6_)" d="M4.405,17.102c0,0-0.332-0.098-0.429-0.292c-0.097-0.195-0.135-0.488-0.135-0.488L3.892,2.408      c0,0,0-0.351,0.195-0.466c0.195-0.118,0.571-0.078,0.571-0.078l9.416,0.858c0,0,0.439,0.042,0.604,0.235      c0.17,0.196,0.174,0.505,0.174,0.505l-0.143,15.298c0,0,0.026,0.356-0.229,0.473c-0.252,0.115-0.604,0.088-0.604,0.088      L4.405,17.102z"/>
+</g>
+<g>
+<polygon fill="#595959" points="5.827,11.979 4.94,11.813 4.94,12.297 5.824,12.469     "/>
+<polygon fill="#595959" points="7.219,12.238 7.215,12.738 13.16,13.891 13.169,13.346     "/>
+<polygon fill="#595959" points="5.808,14.279 4.985,14.104 4.985,14.654 5.805,14.835     "/>
+<polygon fill="#595959" points="7.199,14.574 7.195,15.144 13.16,16.46 13.169,15.848     "/>
+</g>
+</g>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="-28.0317" y1="57.3115" x2="-22.5111" y2="62.2823" gradientTransform="matrix(1.1364 0 0 -1.1364 39.6908 76.7883)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M12.762,4.87c3.252,1.848,1.006,4.406-2.225,5.592l0.065,1.06l-3.935-1.164l3.692-2.349     l0.054,1.029C12.882,8.075,14.248,6.424,12.762,4.87z"/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-598.2876" y1="856.3398" x2="-600.27" y2="850.5827" gradientTransform="matrix(-1.1364 0 0 1.1364 -673.3051 -963.2581)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M5.81,9.621C2.672,7.84,4.84,5.371,7.956,4.228L7.895,3.205l3.797,1.124L8.129,6.595L8.077,5.601     C5.694,6.531,4.377,8.124,5.81,9.621z"/>
+</g>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_stop.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,93 @@
+<?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 57 49.149">
+<g>
+<rect fill="none" width="57" height="49.149"/>
+<g>
+<g>
+<g>
+<radialGradient id="XMLID_9_" cx="28.1763" cy="22.5762" r="18.6213" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FF0000"/>
+<stop offset="0.3932" style="stop-color:#FD0100"/>
+<stop offset="0.5347" style="stop-color:#F60200"/>
+<stop offset="0.6353" style="stop-color:#EB0600"/>
+<stop offset="0.6817" style="stop-color:#E20800"/>
+<stop offset="0.7493" style="stop-color:#D30D00"/>
+<stop offset="1" style="stop-color:#961B00"/>
+</radialGradient>
+<circle fill="url(#XMLID_9_)" cx="28.176" cy="22.577" r="18.621"/>
+</g>
+</g>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-131.3799" y1="-354.0645" x2="-123.4985" y2="-354.0645" gradientTransform="matrix(0 1 -1 0 -332.9604 145.9604)">
+<stop offset="0" style="stop-color:#171717"/>
+<stop offset="0.1707" style="stop-color:#212121"/>
+<stop offset="0.4607" style="stop-color:#3C3C3C"/>
+<stop offset="0.8326" style="stop-color:#676767"/>
+<stop offset="1" style="stop-color:#7D7D7D"/>
+</linearGradient>
+<polygon fill="url(#XMLID_10_)" points="17.12,14.581 25.087,22.199 24.44,22.462 18.416,16.593    "/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="-122.4365" y1="-366.2422" x2="-131.9515" y2="-370.7007" gradientTransform="matrix(0 1 -1 0 -332.9604 145.9604)">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.0879" style="stop-color:#0A0A0A"/>
+<stop offset="0.2374" style="stop-color:#252525"/>
+<stop offset="0.4303" style="stop-color:#515151"/>
+<stop offset="0.6592" style="stop-color:#8D8D8D"/>
+<stop offset="0.9156" style="stop-color:#DADADA"/>
+<stop offset="1" style="stop-color:#F5F5F5"/>
+</linearGradient>
+<polygon fill="url(#XMLID_11_)" points="31.198,21.976 38.948,14.575 39.249,16.787 32.723,23.262    "/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="-467.8496" y1="-142.1558" x2="-490.7263" y2="-152.8754" gradientTransform="matrix(-0.7091 -0.7073 0.7062 -0.708 -207.6347 -421.6206)">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.4415" style="stop-color:#FDFDFD"/>
+<stop offset="0.6005" style="stop-color:#F6F6F6"/>
+<stop offset="0.7139" style="stop-color:#EBEBEB"/>
+<stop offset="0.8055" style="stop-color:#DADADA"/>
+<stop offset="0.884" style="stop-color:#C4C4C4"/>
+<stop offset="0.9522" style="stop-color:#A9A9A9"/>
+<stop offset="1" style="stop-color:#919191"/>
+</linearGradient>
+<polygon fill="url(#XMLID_12_)" points="28.059,25.411 20.64,32.62 17.176,29.117 24.509,21.729 17.099,14.561 20.69,11.037      28.059,18.313 35.354,11.055 38.948,14.575 31.573,21.729 38.925,29.195 35.495,32.576    "/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M37.906,24.647"/>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="-114.8335" y1="-369.666" x2="-113.6588" y2="-371.066" gradientTransform="matrix(0 1 -1 0 -332.9604 145.9604)">
+<stop offset="0" style="stop-color:#171717"/>
+<stop offset="0.2575" style="stop-color:#363636"/>
+<stop offset="0.5591" style="stop-color:#555555"/>
+<stop offset="0.8173" style="stop-color:#676767"/>
+<stop offset="1" style="stop-color:#6E6E6E"/>
+</linearGradient>
+<polygon fill="url(#XMLID_13_)" points="35.503,32.559 38.934,29.192 38.971,31.269 35.98,34.323    "/>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="-120.5151" y1="-357.228" x2="-111.416" y2="-357.228" gradientTransform="matrix(-0.0037 1.0036 -1.0037 0.0037 -334.3698 147.6823)">
+<stop offset="0" style="stop-color:#171717"/>
+<stop offset="0.1019" style="stop-color:#202020"/>
+<stop offset="0.2668" style="stop-color:#383838"/>
+<stop offset="0.4744" style="stop-color:#5F5F5F"/>
+<stop offset="0.7164" style="stop-color:#959595"/>
+<stop offset="0.9845" style="stop-color:#DADADA"/>
+<stop offset="1" style="stop-color:#DEDEDE"/>
+</linearGradient>
+<polygon fill="url(#XMLID_14_)" points="20.623,32.637 28.071,25.398 28.595,27.368 21.411,34.556    "/>
+<linearGradient id="XMLID_15_" gradientUnits="userSpaceOnUse" x1="-120.5513" y1="-364.9824" x2="-111.6372" y2="-364.9824" gradientTransform="matrix(0 1 -1 0 -332.9604 145.9604)">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.0879" style="stop-color:#0A0A0A"/>
+<stop offset="0.2374" style="stop-color:#252525"/>
+<stop offset="0.4303" style="stop-color:#515151"/>
+<stop offset="0.6592" style="stop-color:#8D8D8D"/>
+<stop offset="0.9156" style="stop-color:#DADADA"/>
+<stop offset="1" style="stop-color:#F5F5F5"/>
+</linearGradient>
+<polygon fill="url(#XMLID_15_)" points="28.064,25.409 35.52,32.554 35.98,34.323 28.595,27.368    "/>
+<linearGradient id="XMLID_16_" gradientUnits="userSpaceOnUse" x1="-116.854" y1="-352.249" x2="-111.4058" y2="-352.249" gradientTransform="matrix(0 1 -1 0 -332.9604 145.9604)">
+<stop offset="0" style="stop-color:#171717"/>
+<stop offset="0.1399" style="stop-color:#212121"/>
+<stop offset="0.3777" style="stop-color:#3C3C3C"/>
+<stop offset="0.6843" style="stop-color:#676767"/>
+<stop offset="1" style="stop-color:#9C9C9C"/>
+</linearGradient>
+<polygon fill="url(#XMLID_16_)" points="17.166,29.106 20.689,32.573 21.411,34.556 18.057,31.116    "/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M21.499,34.722"/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M39.422,16.975"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_to_home.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+<?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>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="9.6191" y1="19.5234" x2="16.2336" y2="1.3046" gradientTransform="matrix(1 0 0 -1 0.1377 18.6113)">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#4D4D4D"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M4.265,1.278L4.265,1.278L4.263,1.276c0,0,0.633-0.435,1.431-0.443L15.975,1.52      c0,0,0.662,0.051,0.991,0.362c0.303,0.286,0.273,0.724,0.273,0.724L17.122,18.66c0,0,0.002,0.563-0.346,0.748      c-0.007,0.004-0.013,0.004-0.017,0.008c-0.128,0.078-1.391,0.666-1.373,0.656L4.265,1.278z"/>
+<path fill="#FFFFFF" d="M4.978,1.106c0,0-0.527,0.01-0.826,0.246c-0.338,0.269-0.344,0.86-0.344,0.86L3.687,16.197      c0,0-0.034,0.538,0.21,0.92c0.198,0.307,0.629,0.494,0.629,0.494l9.931,2.49c0,0,0.604,0.162,0.951-0.029      c0.348-0.19,0.346-0.762,0.346-0.762l0.095-16.371c0,0,0.03-0.447-0.273-0.738c-0.329-0.316-0.991-0.369-0.991-0.369      L4.978,1.106z"/>
+<radialGradient id="XMLID_5_" cx="-393.9668" cy="-370.9321" r="49.6487" gradientTransform="matrix(0.3466 0 0 -0.3466 141.5352 -125.427)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#F3F3F3"/>
+<stop offset="0.0056" style="stop-color:#F3F3F3"/>
+<stop offset="0.1878" style="stop-color:#EAEAEA"/>
+<stop offset="0.4819" style="stop-color:#D2D2D2"/>
+<stop offset="0.8493" style="stop-color:#ACACAC"/>
+<stop offset="1" style="stop-color:#9A9A9A"/>
+</radialGradient>
+<path fill="url(#XMLID_5_)" d="M4.453,17.146c0,0-0.331-0.098-0.428-0.291c-0.097-0.194-0.135-0.485-0.135-0.485L3.942,2.524      c0,0,0-0.348,0.194-0.463C4.33,1.943,4.704,1.984,4.704,1.984l9.37,0.853c0,0,0.437,0.043,0.602,0.234      c0.169,0.196,0.173,0.503,0.173,0.503l-0.143,15.222c0,0,0.027,0.354-0.227,0.47c-0.252,0.116-0.602,0.089-0.602,0.089      L4.453,17.146z"/>
+</g>
+<g>
+<polygon fill="#595959" points="5.867,12.049 4.985,11.883 4.985,12.364 5.865,12.536     "/>
+<polygon fill="#595959" points="7.252,12.306 7.249,12.804 13.165,13.95 13.174,13.408     "/>
+<polygon fill="#595959" points="5.849,14.337 5.03,14.162 5.03,14.71 5.846,14.891     "/>
+<polygon fill="#595959" points="7.233,14.631 7.229,15.197 13.165,16.507 13.174,15.897     "/>
+</g>
+</g>
+<g>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="-599.8018" y1="857.0566" x2="-601.7742" y2="851.3281" gradientTransform="matrix(-1.1364 0 0 1.1364 -673.3009 -963.2751)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_6_)" d="M7.539,10.421C4.417,8.648,6.574,6.192,9.674,5.053L9.613,4.036l3.778,1.119L9.846,7.408     L9.794,6.42C7.424,7.346,6.112,8.932,7.539,10.421z"/>
+</g>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_to_home.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,100 @@
+<?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 57 49.148">
+<g>
+<rect fill="none" width="57" height="49.148"/>
+<g>
+<g>
+<g>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="23.998" y1="142.4609" x2="36.5475" y2="175.1533" gradientTransform="matrix(0.9999 -0.0107 0.0107 0.9999 -5.8151 -136.9779)">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.1191" style="stop-color:#E2E2E2"/>
+<stop offset="0.2885" style="stop-color:#CDCDCD"/>
+<stop offset="0.4927" style="stop-color:#ACACAC"/>
+<stop offset="0.724" style="stop-color:#7E7E7E"/>
+<stop offset="0.9752" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M32.6,10.81L20.351,9.006c0,0-0.536-0.072-0.53,0.905c0.011,1.508,0.246,22.657,0.25,23.49       c0.006,0.794,0.399,0.894,0.399,0.894l12.358,3.324c0,0,0.418,0.135,0.411-0.761c-0.008-1.215-0.102-22.911-0.116-24.888       C33.117,10.806,32.6,10.81,32.6,10.81z"/>
+<polygon fill="#3D3D3D" points="20.69,12.578 32.076,14.516 32.097,16.479 20.705,14.572      "/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="35.3291" y1="136.25" x2="44.3779" y2="175.4445" gradientTransform="matrix(0.9999 -0.0107 0.0107 0.9999 -5.8151 -136.9779)">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.0056" style="stop-color:#000000"/>
+<stop offset="0.1404" style="stop-color:#3D3D3D"/>
+<stop offset="0.2303" style="stop-color:#FFFFFF"/>
+<stop offset="0.2865" style="stop-color:#FFFFFF"/>
+<stop offset="0.5112" style="stop-color:#E9E9E9"/>
+<stop offset="0.567" style="stop-color:#E2E2E2"/>
+<stop offset="0.6503" style="stop-color:#CDCDCD"/>
+<stop offset="0.7506" style="stop-color:#ACACAC"/>
+<stop offset="0.8643" style="stop-color:#7E7E7E"/>
+<stop offset="0.9878" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M44.804,5.178c-1.001-0.122-10.529-0.86-12.372-1.099c0,0-0.525-0.083-1.189-0.023       c-0.665,0.056-9.192,1.463-9.944,1.587c-0.941,0.139-1.504,0.677-1.657,0.932c0.25-0.326,0.577-0.295,0.577-0.295       c2.566,0.167,13.181,1.647,13.181,1.647s1.603-0.194,1.698,2.16l0.001,0.018c0,0,0.267,24.983,0.292,27.387       c0.01,0.854-0.193,1.419-0.455,1.805c2.518-1.505,10.197-6.186,10.197-6.186c0.983-0.531,1.086-2.435,1.086-2.435L46.098,7.082       C46.098,7.082,46.029,5.335,44.804,5.178z"/>
+<path fill="#FFFFFF" d="M33.399,7.927c0,0-10.615-1.48-13.181-1.647c0,0-0.873-0.102-0.856,1.458       c0.011,1.907,0.264,23.678,0.286,26.86c0.011,1.803,0.95,1.73,0.95,1.73l13.199,3.74c0,0,1.619-0.178,1.594-2.577       c-0.025-2.403-0.292-27.387-0.292-27.387l-0.001-0.018C35.002,7.732,33.399,7.927,33.399,7.927z M33.24,36.858       c0.007,0.896-0.411,0.761-0.411,0.761l-12.358-3.324c0,0-0.394-0.1-0.399-0.894c-0.004-0.833-0.24-21.982-0.25-23.49       c-0.006-0.978,0.53-0.905,0.53-0.905L32.6,10.81c0,0,0.518-0.004,0.524,1.161C33.139,13.947,33.232,35.644,33.24,36.858z"/>
+<path fill="#3D3D3D" d="M33.805,11.916c-0.017-1.562-0.9-1.766-0.9-1.766L21.184,8.517c0,0-0.438,0.063-0.548,0.126       c-0.271,0.152-0.737,0.446-0.735,0.651c0,0.014,0.009,0.035,0.011,0.044c0.15-0.362,0.439-0.332,0.439-0.332L32.6,10.81       c0,0,0.518-0.004,0.524,1.161c0.015,1.977,0.108,23.673,0.116,24.888c0.002,0.11-0.004,0.208-0.014,0.284       c-0.006,0.046-0.016,0.081-0.027,0.124c-0.004,0.021-0.01,0.051-0.018,0.076c-0.014,0.047-0.032,0.082-0.051,0.115       c-0.004,0.007-0.004,0.011-0.01,0.02c-0.023,0.037-0.047,0.063-0.07,0.084l0,0c0.153-0.064,1.051-0.452,1.047-0.836       C34.094,36.31,33.82,13.291,33.805,11.916z"/>
+</g>
+<polygon fill="#3D3D3D" points="20.662,16.12 32.047,18.06 32.067,20.019 20.677,18.113     "/>
+</g>
+<g>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-28.96" y1="-60.27" x2="-11.3613" y2="-42.0461" gradientTransform="matrix(1.1363 -0.0121 -0.0121 -1.1363 32.4167 -30.3922)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M12.17,30.181c-2.627-6.373,4.444-9.482,8.156-10.974c-0.482-1.129-0.323-1.28-0.804-2.413      C11.236,20.126,8.211,24.894,12.17,30.181"/>
+<polygon fill="#005795" points="30.856,12.802 30.563,14.923 20.051,22.415 19.696,20.021     "/>
+<path fill="#005795" d="M12.544,29.797c-1.561-0.703-5.021-6.635-5.021-6.635c-0.147,3.084,2.357,7.185,5.245,8.572      L12.544,29.797z"/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-574.4307" y1="996.7559" x2="-580.7122" y2="978.5131" gradientTransform="matrix(-1.1363 0.0121 0.0121 1.1363 -649.9216 -1095.0718)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M12.391,29.77c-10.004-5.539-3.215-13.432,6.62-17.164l-0.233-3.238l12.071,3.434l-11.212,7.3      l-0.201-3.147C11.921,19.979,7.798,25.073,12.391,29.77z"/>
+</g>
+</g>
+<g>
+<polygon fill="#102F02" points="25.22,28.523 25.477,28.406 26.928,28.615 26.945,30.219 26.78,30.311 25.535,29.217    "/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="29.9365" y1="-119.647" x2="31.39" y2="-121.6585" gradientTransform="matrix(0.9999 -0.0107 -0.0107 -0.9999 -5.7796 -90.6625)">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.0972" style="stop-color:#ED1C17"/>
+<stop offset="0.2366" style="stop-color:#D81A13"/>
+<stop offset="0.4066" style="stop-color:#B6170E"/>
+<stop offset="0.5989" style="stop-color:#861306"/>
+<stop offset="0.6798" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<polygon fill="url(#XMLID_11_)" points="26.78,30.311 25.236,30.081 25.22,28.523 26.764,28.753    "/>
+</g>
+<g>
+<polygon fill="#102F02" points="25.276,25.728 25.534,25.609 26.984,25.819 27.001,27.422 26.837,27.515 25.592,26.422    "/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="30.0244" y1="-116.8511" x2="31.4781" y2="-118.8628" gradientTransform="matrix(0.9999 -0.0107 -0.0107 -0.9999 -5.7796 -90.6625)">
+<stop offset="0" style="stop-color:#68D80B"/>
+<stop offset="0.0056" style="stop-color:#68D80B"/>
+<stop offset="0.1635" style="stop-color:#60D10A"/>
+<stop offset="0.4037" style="stop-color:#4BBD06"/>
+<stop offset="0.6798" style="stop-color:#2B9F00"/>
+<stop offset="1" style="stop-color:#2B9F00"/>
+</linearGradient>
+<polygon fill="url(#XMLID_12_)" points="26.837,27.515 25.293,27.284 25.276,25.728 26.821,25.959    "/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_to_home_inactive.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,97 @@
+<?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 57 49.15">
+<g>
+<rect fill="none" width="57" height="49.15"/>
+<g>
+<g>
+<g>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="19.8398" y1="5.0996" x2="32.4802" y2="38.0288">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.1191" style="stop-color:#E2E2E2"/>
+<stop offset="0.2885" style="stop-color:#CDCDCD"/>
+<stop offset="0.4927" style="stop-color:#ACACAC"/>
+<stop offset="0.724" style="stop-color:#7E7E7E"/>
+<stop offset="0.9752" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M32.766,10.875L20.448,8.928c0,0-0.539-0.08-0.543,0.904c-0.005,1.52,0.005,22.824,0,23.663       c-0.002,0.801,0.393,0.906,0.393,0.906l12.413,3.481c0,0,0.42,0.141,0.422-0.763c0.006-1.225,0.145-23.08,0.15-25.07       C33.289,10.876,32.766,10.875,32.766,10.875z"/>
+<polygon fill="#3D3D3D" points="20.753,12.527 32.2,14.604 32.2,16.579 20.746,14.537      "/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="31.2534" y1="-1.1582" x2="40.3683" y2="38.3228">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.0056" style="stop-color:#000000"/>
+<stop offset="0.1404" style="stop-color:#3D3D3D"/>
+<stop offset="0.2303" style="stop-color:#FFFFFF"/>
+<stop offset="0.2865" style="stop-color:#FFFFFF"/>
+<stop offset="0.5112" style="stop-color:#E9E9E9"/>
+<stop offset="0.567" style="stop-color:#E2E2E2"/>
+<stop offset="0.6503" style="stop-color:#CDCDCD"/>
+<stop offset="0.7506" style="stop-color:#ACACAC"/>
+<stop offset="0.8643" style="stop-color:#7E7E7E"/>
+<stop offset="0.9878" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M45.121,5.334c-1.007-0.136-10.598-0.98-12.45-1.24c0,0-0.528-0.091-1.198-0.036       c-0.67,0.048-9.275,1.374-10.032,1.491c-0.951,0.13-1.524,0.665-1.68,0.921c0.255-0.327,0.584-0.29,0.584-0.29       c2.583,0.194,13.259,1.799,13.259,1.799s1.617-0.178,1.689,2.196v0.017c0,0,0,25.17,0,27.588c0,0.862-0.211,1.428-0.479,1.814       c2.553-1.488,10.338-6.122,10.338-6.122c0.997-0.524,1.119-2.44,1.119-2.44l0.133-23.767       C46.404,7.265,46.353,5.504,45.121,5.334z"/>
+<path fill="#FFFFFF" d="M33.603,7.979c0,0-10.676-1.604-13.259-1.799c0,0-0.878-0.113-0.878,1.459       c-0.009,1.92,0.012,23.852,0,27.057c-0.008,1.817,0.938,1.754,0.938,1.754l13.256,3.91c0,0,1.633-0.163,1.633-2.58       c0-2.418,0-27.588,0-27.588v-0.017C35.22,7.801,33.603,7.979,33.603,7.979z M33.132,37.12       c-0.002,0.903-0.422,0.763-0.422,0.763l-12.413-3.481c0,0-0.396-0.105-0.393-0.906c0.005-0.839-0.005-22.144,0-23.663       c0.005-0.984,0.543-0.904,0.543-0.904l12.318,1.947c0,0,0.522,0.001,0.517,1.175C33.277,14.04,33.138,35.896,33.132,37.12z"/>
+<path fill="#3D3D3D" d="M33.969,12.002c0-1.573-0.888-1.788-0.888-1.788L21.293,8.441c0,0-0.442,0.061-0.553,0.123       c-0.273,0.15-0.748,0.44-0.748,0.647c0,0.014,0.01,0.035,0.011,0.044c0.155-0.363,0.445-0.328,0.445-0.328l12.318,1.947       c0,0,0.522,0.001,0.517,1.175c-0.006,1.99-0.145,23.846-0.15,25.07c0,0.11-0.006,0.21-0.016,0.285       c-0.007,0.047-0.018,0.083-0.029,0.126c-0.004,0.02-0.012,0.051-0.02,0.076c-0.014,0.048-0.033,0.081-0.051,0.116       c-0.005,0.006-0.005,0.011-0.012,0.021c-0.023,0.035-0.048,0.062-0.071,0.082l0,0c0.155-0.063,1.063-0.443,1.063-0.831       C33.998,36.576,33.969,13.388,33.969,12.002z"/>
+</g>
+<polygon fill="#3D3D3D" points="20.686,16.096 32.132,18.171 32.132,20.146 20.679,18.104     "/>
+</g>
+<g>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-32.8345" y1="58.9082" x2="-15.1077" y2="77.2649" gradientTransform="matrix(1.1364 0 0 -1.1364 37.1877 105.3043)">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.1765" style="stop-color:#B6B6B6"/>
+<stop offset="0.3865" style="stop-color:#7E7E7E"/>
+<stop offset="0.5814" style="stop-color:#515151"/>
+<stop offset="0.7548" style="stop-color:#313131"/>
+<stop offset="0.9002" style="stop-color:#1E1E1E"/>
+<stop offset="1" style="stop-color:#171717"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M11.981,30.168c-2.578-6.449,4.578-9.505,8.333-10.967c-0.473-1.145-0.312-1.293-0.784-2.439      C11.149,20.03,8.05,24.799,11.981,30.168"/>
+<polygon fill="#3D3D3D" points="30.99,12.861 30.67,14.995 20.003,22.43 19.67,20.017     "/>
+<path fill="#3D3D3D" d="M12.362,29.785c-1.564-0.726-4.986-6.736-4.986-6.736c-0.181,3.104,2.297,7.261,5.191,8.689      L12.362,29.785z"/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-570.9175" y1="876.1758" x2="-577.2448" y2="857.8" gradientTransform="matrix(-1.1364 0 0 1.1364 -634.0999 -965.0787)">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.1328" style="stop-color:#E4E4E4"/>
+<stop offset="0.2878" style="stop-color:#D5D5D5"/>
+<stop offset="0.4573" style="stop-color:#BCBCBC"/>
+<stop offset="0.6372" style="stop-color:#9A9A9A"/>
+<stop offset="0.8231" style="stop-color:#6E6E6E"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M12.208,29.756C2.19,24.069,9.113,16.191,19.06,12.537l-0.2-3.265l12.122,3.589L19.61,20.094      l-0.169-3.173C11.84,19.889,7.632,24.977,12.208,29.756z"/>
+</g>
+</g>
+<g>
+<polygon fill="#102F02" points="25.143,28.639 25.404,28.522 26.863,28.747 26.863,30.363 26.696,30.455 25.454,29.341    "/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="25.2202" y1="16.2852" x2="26.6843" y2="14.259" gradientTransform="matrix(1 0 0 -1 0.1377 45.0566)">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.0522" style="stop-color:#D3D3D3"/>
+<stop offset="0.1506" style="stop-color:#ACACAC"/>
+<stop offset="0.2558" style="stop-color:#898989"/>
+<stop offset="0.3671" style="stop-color:#6E6E6E"/>
+<stop offset="0.4867" style="stop-color:#585858"/>
+<stop offset="0.6186" style="stop-color:#494949"/>
+<stop offset="0.7723" style="stop-color:#404040"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<polygon fill="url(#XMLID_11_)" points="26.696,30.455 25.143,30.208 25.143,28.639 26.696,28.887    "/>
+</g>
+<g>
+<polygon fill="#102F02" points="25.23,25.823 25.491,25.707 26.951,25.933 26.951,27.547 26.784,27.64 25.541,26.524    "/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="25.3081" y1="19.1016" x2="26.7721" y2="17.0756" gradientTransform="matrix(1 0 0 -1 0.1377 45.0566)">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.6317" style="stop-color:#7A7A7A"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<polygon fill="url(#XMLID_12_)" points="26.784,27.64 25.23,27.391 25.23,25.823 26.784,26.071    "/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_unavailable_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,81 @@
+<?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>
+<g>
+<g>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="4.2344" y1="1.4326" x2="11.0151" y2="19.097">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.1191" style="stop-color:#E2E2E2"/>
+<stop offset="0.2885" style="stop-color:#CDCDCD"/>
+<stop offset="0.4927" style="stop-color:#ACACAC"/>
+<stop offset="0.724" style="stop-color:#7E7E7E"/>
+<stop offset="0.9752" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_6_)" d="M11.168,4.53L4.561,3.485c0,0-0.29-0.041-0.292,0.486c-0.003,0.814,0.002,12.244,0,12.693       c-0.001,0.429,0.211,0.486,0.211,0.486l6.658,1.866c0,0,0.226,0.076,0.228-0.408c0.003-0.657,0.076-12.38,0.08-13.448       C11.448,4.532,11.168,4.53,11.168,4.53z"/>
+<polygon fill="#3D3D3D" points="4.725,5.417 10.864,6.53 10.864,7.591 4.72,6.495      "/>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="10.3574" y1="-1.9258" x2="15.2473" y2="19.2544">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.0056" style="stop-color:#000000"/>
+<stop offset="0.1404" style="stop-color:#3D3D3D"/>
+<stop offset="0.2303" style="stop-color:#FFFFFF"/>
+<stop offset="0.2865" style="stop-color:#FFFFFF"/>
+<stop offset="0.5112" style="stop-color:#E9E9E9"/>
+<stop offset="0.567" style="stop-color:#E2E2E2"/>
+<stop offset="0.6503" style="stop-color:#CDCDCD"/>
+<stop offset="0.7506" style="stop-color:#ACACAC"/>
+<stop offset="0.8643" style="stop-color:#7E7E7E"/>
+<stop offset="0.9878" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M17.796,1.559c-0.54-0.072-5.686-0.525-6.679-0.665c0,0-0.284-0.049-0.643-0.021       c-0.36,0.026-4.976,0.739-5.382,0.801c-0.51,0.07-0.817,0.358-0.9,0.494c0.137-0.175,0.313-0.155,0.313-0.155       c1.385,0.104,7.112,0.966,7.112,0.966s0.867-0.096,0.904,1.178v0.009c0,0,0,13.501,0,14.798c0,0.465-0.111,0.766-0.254,0.975       c1.368-0.798,5.545-3.284,5.545-3.284c0.535-0.281,0.6-1.309,0.6-1.309l0.071-12.749C18.484,2.595,18.458,1.649,17.796,1.559z"/>
+<path fill="#FFFFFF" d="M11.618,2.978c0,0-5.727-0.862-7.112-0.966c0,0-0.471-0.061-0.471,0.783       c-0.005,1.03,0.006,12.794,0,14.514c-0.004,0.974,0.503,0.939,0.503,0.939l7.111,2.099c0,0,0.874-0.088,0.874-1.385       s0-14.798,0-14.798V4.155C12.485,2.882,11.618,2.978,11.618,2.978z M11.366,18.609c-0.002,0.484-0.228,0.408-0.228,0.408       L4.48,17.151c0,0-0.212-0.058-0.211-0.486c0.002-0.449-0.003-11.879,0-12.693c0.002-0.527,0.292-0.486,0.292-0.486l6.607,1.045       c0,0,0.279,0.002,0.277,0.631C11.442,6.229,11.369,17.952,11.366,18.609z"/>
+<path fill="#3D3D3D" d="M11.813,5.137c0-0.845-0.476-0.962-0.476-0.962L5.015,3.227c0,0-0.239,0.032-0.297,0.065       c-0.146,0.08-0.401,0.235-0.401,0.346c0,0.009,0.005,0.02,0.005,0.025c0.083-0.195,0.239-0.178,0.239-0.178l6.607,1.045       c0,0,0.279,0.002,0.277,0.631c-0.004,1.068-0.077,12.791-0.08,13.448c0,0.06-0.004,0.112-0.01,0.153       c-0.002,0.025-0.009,0.044-0.016,0.065c-0.002,0.013-0.006,0.029-0.01,0.044c-0.008,0.024-0.019,0.042-0.027,0.061       c-0.004,0.004-0.004,0.008-0.006,0.012c-0.013,0.018-0.026,0.033-0.039,0.044l0,0c0.084-0.034,0.57-0.238,0.57-0.446       C11.829,18.318,11.813,5.877,11.813,5.137z"/>
+</g>
+<polygon fill="#3D3D3D" points="4.688,7.331 10.829,8.445 10.829,9.505 4.685,8.409     "/>
+</g>
+<g>
+<polygon fill="#102F02" points="7.079,14.06 7.22,13.998 8.001,14.119 8.001,14.984 7.913,15.034 7.246,14.437     "/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="7.0571" y1="4.4834" x2="7.8427" y2="3.3962" gradientTransform="matrix(1 0 0 -1 0.1377 18.6133)">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.0972" style="stop-color:#ED1C17"/>
+<stop offset="0.2366" style="stop-color:#D81A13"/>
+<stop offset="0.4066" style="stop-color:#B6170E"/>
+<stop offset="0.5989" style="stop-color:#861306"/>
+<stop offset="0.6798" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<polygon fill="url(#XMLID_8_)" points="7.913,15.034 7.079,14.901 7.079,14.06 7.913,14.193     "/>
+</g>
+<g>
+<polygon fill="#102F02" points="7.126,12.55 7.266,12.487 8.049,12.606 8.049,13.474 7.959,13.524 7.292,12.927     "/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="7.1045" y1="5.9932" x2="7.8897" y2="4.9065" gradientTransform="matrix(1 0 0 -1 0.1377 18.6133)">
+<stop offset="0" style="stop-color:#68D80B"/>
+<stop offset="0.0056" style="stop-color:#68D80B"/>
+<stop offset="0.1635" style="stop-color:#60D10A"/>
+<stop offset="0.4037" style="stop-color:#4BBD06"/>
+<stop offset="0.6798" style="stop-color:#2B9F00"/>
+<stop offset="1" style="stop-color:#2B9F00"/>
+</linearGradient>
+<polygon fill="url(#XMLID_9_)" points="7.959,13.524 7.126,13.392 7.126,12.55 7.959,12.683     "/>
+</g>
+</g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="10.4985" y1="8.585" x2="9.7957" y2="7.8821" gradientTransform="matrix(1 0 0 -1 0.1377 18.6133)">
+<stop offset="0" style="stop-color:#F41D18"/>
+<stop offset="0.0056" style="stop-color:#F41D18"/>
+<stop offset="0.1419" style="stop-color:#EB1C17"/>
+<stop offset="0.364" style="stop-color:#D31A12"/>
+<stop offset="0.6444" style="stop-color:#AB160C"/>
+<stop offset="0.9694" style="stop-color:#761103"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<polygon fill="url(#XMLID_10_)" points="2.353,4.335 16.441,18.176 18.075,16.567 3.987,2.727   "/>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_video_list_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,8 @@
+<?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 16 16">
+<g>
+<rect fill="none" width="16" height="16"/>
+<path d="M13.324,3.091v0.982h-1.08V3.091h-1.462v1.967H4.803V3.091H3.341v0.982H2.273V3.091H0.812v10.815h1.462v-0.982h1.067v0.982   h1.462v-1.967h5.979v1.967h1.462v-0.982h1.08v0.982h1.463V3.091H13.324z M12.244,8.007V7.023h1.08v0.983H12.244z M13.324,8.991   v0.982h-1.08V8.991H13.324z M13.324,5.058v0.98h-1.08v-0.98H13.324z M3.341,8.007H2.273V7.023h1.067V8.007z M3.341,8.991v0.982   H2.273V8.991H3.341z M3.341,5.058v0.98H2.273v-0.98H3.341z M2.273,11.939v-0.98h1.067v0.98H2.273z M4.803,10.959V6.038h5.979v4.921   H4.803L4.803,10.959z M12.244,11.939v-0.98h1.08v0.98H12.244z"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_white_check.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,13 @@
+<?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 d="M17.557,15.611c0,1.048-0.849,1.897-1.896,1.897H5.554c-1.046,0-1.895-0.85-1.895-1.897V5.505    c0-1.046,0.849-1.896,1.895-1.896h10.107c1.047,0,1.896,0.85,1.896,1.896V15.611z"/>
+<path fill="#FFFFFF" d="M5.554,4.872c-0.348,0-0.632,0.283-0.632,0.633v10.106c0,0.349,0.284,0.632,0.632,0.632h10.107    c0.349,0,0.632-0.283,0.632-0.632V5.505c0-0.35-0.283-0.633-0.632-0.633H5.554z"/>
+<path fill="#999898" d="M6.186,6.136h10.107V5.505c0-0.35-0.283-0.633-0.632-0.633H5.554c-0.348,0-0.632,0.283-0.632,0.633v10.106    c0,0.349,0.284,0.632,0.632,0.632h0.632V6.136z"/>
+<polygon fill="#424141" points="10.607,9.927 7.659,6.978 6.817,7.821 9.766,10.769 6.817,13.716 7.659,14.56 10.607,11.611     13.558,14.56 14.397,13.716 11.45,10.769 14.397,7.821 13.558,6.98   "/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_white_uncheck.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,12 @@
+<?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 d="M17.557,15.611c0,1.048-0.849,1.897-1.895,1.897H5.555c-1.047,0-1.896-0.85-1.896-1.897V5.505    c0-1.046,0.849-1.896,1.896-1.896h10.107c1.046,0,1.895,0.85,1.895,1.896V15.611z"/>
+<path fill="#FFFFFF" d="M5.555,4.872c-0.349,0-0.633,0.283-0.633,0.633v10.106c0,0.349,0.284,0.632,0.633,0.632h10.107    c0.348,0,0.631-0.283,0.631-0.632V5.505c0-0.35-0.283-0.633-0.631-0.633H5.555z"/>
+<path fill="#999898" d="M6.186,6.136h10.107V5.505c0-0.35-0.283-0.633-0.631-0.633H5.555c-0.349,0-0.633,0.283-0.633,0.633v10.106    c0,0.349,0.284,0.632,0.633,0.632h0.631V6.136z"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_yellow_check.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,13 @@
+<?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 d="M17.557,15.611c0,1.047-0.849,1.897-1.896,1.897H5.554c-1.047,0-1.895-0.851-1.895-1.897V5.505    c0-1.046,0.848-1.896,1.895-1.896h10.107c1.047,0,1.896,0.85,1.896,1.896V15.611z"/>
+<path fill="#FFF681" d="M5.554,4.872c-0.348,0-0.632,0.283-0.632,0.633v10.106c0,0.349,0.284,0.632,0.632,0.632h10.107    c0.349,0,0.632-0.283,0.632-0.632V5.505c0-0.35-0.283-0.633-0.632-0.633H5.554z"/>
+<path fill="#BAAC26" d="M6.186,6.136h10.107V5.505c0-0.35-0.283-0.633-0.632-0.633H5.554c-0.348,0-0.632,0.283-0.632,0.633v10.106    c0,0.349,0.284,0.632,0.632,0.632h0.632V6.136z"/>
+<polygon fill="#424141" points="10.606,9.927 7.659,6.978 6.817,7.821 9.766,10.77 6.817,13.716 7.659,14.56 10.606,11.611     13.558,14.56 14.397,13.716 11.45,10.77 14.397,7.821 13.558,6.98   "/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_yellow_uncheck.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,12 @@
+<?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 d="M17.557,15.611c0,1.047-0.85,1.897-1.895,1.897H5.554c-1.046,0-1.896-0.851-1.896-1.897V5.505    c0-1.046,0.85-1.896,1.896-1.896h10.108c1.045,0,1.895,0.85,1.895,1.896V15.611z"/>
+<path fill="#FFF681" d="M5.554,4.872c-0.349,0-0.632,0.283-0.632,0.633v10.106c0,0.349,0.283,0.632,0.632,0.632h10.108    c0.348,0,0.631-0.283,0.631-0.632V5.505c0-0.35-0.283-0.633-0.631-0.633H5.554z"/>
+<path fill="#BAAC26" d="M6.186,6.136h10.107V5.505c0-0.35-0.283-0.633-0.631-0.633H5.554c-0.349,0-0.632,0.283-0.632,0.633v10.106    c0,0.349,0.283,0.632,0.632,0.632h0.632V6.136z"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_audio.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,51 @@
+<?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 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="tiny" height="72" version="1.1" viewBox="0 0 84 72" width="84">
+<rect fill="none" height="72" width="84"/>
+<path d="M21.352,50.69c-1.078-14.984-1.703-29.984-1.109-40.953c0.112-2.064,1.538-3.394,3.085-3.478  c2.089-0.352,24.657,0.893,24.657,0.893l10.534,13.654l-0.302,39.861c-2.881,0.883-2.363,1.607-6.084,0.789  c-7.25-1.594-14.594-3.328-28.516-6.922C21.647,54.025,21.446,52.001,21.352,50.69z" fill="#FFFFFF"/>
+<path d="M47.539,10.646c-0.353-0.398-18.582-1.806-23.296-1.782c-0.306,0-1.197,0.399-1.197,0.399l30.181,49.99  c1.453-0.625,1.895-1.19,2-2.344c0.118-1.287,0.479-35.658,0.479-35.986C55.706,20.618,48.197,11.398,47.539,10.646z" fill="#573A1C"/>
+<radialGradient cx="22.8672" cy="9.4873" gradientUnits="userSpaceOnUse" id="XMLID_6_" r="58.2734">
+<stop offset="0.2022" stop-color="#FEF700"/>
+<stop offset="0.334" stop-color="#FDF300"/>
+<stop offset="0.4772" stop-color="#F8E600"/>
+<stop offset="0.6258" stop-color="#F1D000"/>
+<stop offset="0.7781" stop-color="#E7B100"/>
+<stop offset="0.9318" stop-color="#DA8B00"/>
+<stop offset="1" stop-color="#D37700"/>
+</radialGradient>
+<path d="M46.907,11.022l8.14,10.276c0.05,0.563-0.238,33.931-0.537,36.037  c-0.299,2.104-1.877,2.246-2.955,2.012c-7.25-1.578-16.375-3.641-26.328-6.156c-1.708-0.45-2.687-1.69-2.797-3.375  c-0.641-10.875-1-20.625-0.797-38.109c0.047-1.877,0.827-2.606,2.633-2.584C29.943,9.356,42.52,10.412,46.907,11.022z" fill="url(#XMLID_6_)"/>
+<path d="M44.831,18.426c0.212,0.658-0.402,2.708,10.221,3.882l-0.005-1.01L44.831,18.426z"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_7_" x1="45" x2="55" y1="16" y2="16">
+<stop offset="0" stop-color="#B88B5C"/>
+<stop offset="1" stop-color="#573A1C"/>
+</linearGradient>
+<path d="M55.133,21.298l-8.188-10.276c-1.732,1.361-2.505,6.499-2.081,7.507  C45.711,20.455,53.585,21.204,55.133,21.298z" fill="url(#XMLID_7_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_8_" x1="40.4" x2="52.1" y1="2.7" y2="58.4">
+<stop offset="0" stop-color="#222221"/>
+<stop offset="0.0929" stop-color="#BFBFC0"/>
+<stop offset="0.1264" stop-color="#FFFFFF"/>
+<stop offset="0.197" stop-color="#FFFFFF"/>
+<stop offset="0.3034" stop-color="#E9E9E9"/>
+<stop offset="0.4781" stop-color="#AFAFAF"/>
+<stop offset="0.6495" stop-color="#7E7E7E"/>
+<stop offset="0.7991" stop-color="#5B5B5B"/>
+<stop offset="0.921" stop-color="#454545"/>
+<stop offset="1" stop-color="#3D3D3D"/>
+</linearGradient>
+<path d="M23.421,6.236c4.74,0.047,22.922,1.079,24.306,1.877c2.159,1.243,9.806,11.074,10.228,13.255  c0.402,2.065-0.165,32.728-0.586,38.173c-0.027,0.348-0.127,1.541-1.358,1.97c0,0,1.899-0.68,2.906-1.125  c0.987-0.423,1.646-0.729,1.971-1.784c0.949-3.834,1.224-35.398,0.963-38.431c-0.188-2.182-8.213-11.801-9.712-12.787  c-1.831-1.218-18.51-1.829-23.907-2.087C26.963,5.274,24.688,5.861,23.421,6.236z" fill="url(#XMLID_8_)"/>
+<path d="M41.137,43.794l0.787,0.484c0,0-0.143-15.878-0.143-16.041l2.76,3.654l0.626-0.164  c0,0,0.048-3.967-0.073-4.579c-0.134-0.676-1.839-3.943-2.712-5.505c-0.874-1.562-2.204-4.182-2.526-4.182  c-0.279,0-0.948,0.08-1.123,0.099L41.137,43.794z" fill="#741103"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_9_" x1="35.6177" x2="43.6063" y1="30.9414" y2="32.6394">
+<stop offset="0" stop-color="#FF7800"/>
+<stop offset="0.4" stop-color="#FF3300"/>
+<stop offset="1" stop-color="#8B1700"/>
+</linearGradient>
+<path d="M44.541,31.891l-3.492-4.32l0.185,18.61l-2.94-3.445l0.046-24.447c0,0,0-0.735,0.367-0.735  c0.617,0,2.756,3.952,3.583,5.515c0.827,1.562,1.93,3.401,2.161,4.502C44.617,28.383,44.541,31.891,44.541,31.891z" fill="url(#XMLID_9_)"/>
+<radialGradient cx="33.6167" cy="43.0811" gradientUnits="userSpaceOnUse" id="XMLID_10_" r="7.3882">
+<stop offset="0" stop-color="#FF9900"/>
+<stop offset="0.1598" stop-color="#FF7800"/>
+<stop offset="0.4433" stop-color="#FF3300"/>
+<stop offset="0.8" stop-color="#C50F00"/>
+<stop offset="1" stop-color="#721700"/>
+</radialGradient>
+<path d="M41.911,43.67c0.485,2.423-1.918,4.944-5.37,5.635c-3.452,0.689-6.641-0.716-7.124-3.139  c-0.485-2.422,1.92-4.945,5.37-5.634C38.237,39.843,41.426,41.249,41.911,43.67z" fill="url(#XMLID_10_)"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_image.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,61 @@
+<?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" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 57 48.857">
+<g>
+<rect fill="none" width="57" height="48.857"/>
+<g>
+<path fill="#FFFFFF" d="M12.696,34.437c-0.36-10.403-0.5-18.604-0.534-25.477c0.072-1.28,0.422-2.117,1.719-2.119    c1.749-0.151,20.698,1.378,20.698,1.378l8.986,8.854l0.168,24.805c-2.407,0.453-1.964,0.921-5.096,0.289    c-6.102-1.236-12.28-2.56-24.001-5.261C12.979,36.522,12.789,35.256,12.696,34.437z"/>
+<path fill="#3F3F3F" d="M34.829,10.274c-0.302-0.261-15.611-1.746-19.567-1.889c-0.257-0.011-1.176,0.32-1.176,0.32l26.033,32.026    c1.212-0.342,1.579-0.678,1.653-1.395c0.086-0.797,0.023-22.188,0.02-22.393C41.79,16.756,35.388,10.763,34.829,10.274z"/>
+<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="39.9697" y1="76.9355" x2="47.5171" y2="40.9074" gradientTransform="matrix(1.0067 0.04 -0.017 -0.9941 -10.4276 79.4283)">
+<stop offset="0" style="stop-color:#222221"/>
+<stop offset="0.0929" style="stop-color:#BFBFC0"/>
+<stop offset="0.1264" style="stop-color:#FFFFFF"/>
+<stop offset="0.197" style="stop-color:#FFFFFF"/>
+<stop offset="0.3034" style="stop-color:#E9E9E9"/>
+<stop offset="0.4944" style="stop-color:#A4A4A4"/>
+<stop offset="0.7435" style="stop-color:#646464"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#SVGID_1_)" d="M13.96,6.873c3.979,0.187,19.247,1.438,20.416,1.979c1.826,0.844,8.348,7.216,8.725,8.587    c0.359,1.299,0.209,20.352-0.086,23.726c-0.02,0.215-0.09,0.953-1.119,1.18c0,0,1.588-0.36,2.426-0.604    c0.825-0.229,1.375-0.398,1.637-1.043c0.754-2.354,0.65-21.979,0.398-23.875c-0.182-1.362-7.017-7.613-8.285-8.277    C36.522,7.729,22.519,6.79,17.987,6.45C16.923,6.393,15.02,6.683,13.96,6.873z"/>
+<g>
+<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-124.645" y1="-109.4102" x2="-97.4136" y2="-109.4102" gradientTransform="matrix(1.0324 -0.0103 -0.009 -0.9999 141.0258 -85.7971)">
+<stop offset="0" style="stop-color:#C3E1E2"/>
+<stop offset="0.2697" style="stop-color:#7AC1D7"/>
+<stop offset="0.4785" style="stop-color:#559CC2"/>
+<stop offset="0.6914" style="stop-color:#367EB1"/>
+<stop offset="0.8728" style="stop-color:#246CA7"/>
+<stop offset="1" style="stop-color:#1D65A3"/>
+</linearGradient>
+<path fill="url(#SVGID_2_)" d="M14.98,35.675c0,0-0.845-0.164-1.098-0.508c-0.25-0.345-0.353-0.862-0.353-0.862     s-0.52-19.93-0.091-24.684c0.047-0.527-0.006-0.625,0.488-0.834c0.495-0.214,1.454-0.151,1.454-0.151l18.809,1.724l7.185,6.939     l-0.096,22.55c0,0,0.07,0.63-0.574,0.844c-0.645,0.212-1.538,0.173-1.538,0.173L14.98,35.675z"/>
+<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="12.4185" y1="43.5088" x2="12.4185" y2="34.7952" gradientTransform="matrix(1.0324 -0.0103 0.009 0.9999 14.2629 -6.3593)">
+<stop offset="0" style="stop-color:#1E1B83"/>
+<stop offset="0.0112" style="stop-color:#1E1B83"/>
+<stop offset="0.223" style="stop-color:#1E1E85"/>
+<stop offset="0.3917" style="stop-color:#1F2889"/>
+<stop offset="0.5456" style="stop-color:#1F3992"/>
+<stop offset="0.6905" style="stop-color:#20519E"/>
+<stop offset="0.828" style="stop-color:#226FAD"/>
+<stop offset="0.9213" style="stop-color:#2388B9"/>
+<stop offset="1" style="stop-color:#2388B9"/>
+</linearGradient>
+<path fill="url(#SVGID_3_)" d="M41.362,33.171l-27.855-4.792l0.022,5.926c0,0,0.103,0.518,0.353,0.862     c0.253,0.344,1.339,0.736,1.339,0.736l23.943,4.962c0,0,0.895,0.039,1.539-0.173c0.643-0.214,0.573-0.844,0.573-0.844     L41.362,33.171z"/>
+<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="3.8306" y1="36.8945" x2="21.6963" y2="36.8945" gradientTransform="matrix(1.0324 -0.0103 0.009 0.9999 14.2629 -6.3593)">
+<stop offset="0" style="stop-color:#F5F021"/>
+<stop offset="0.6592" style="stop-color:#EAB118"/>
+<stop offset="1" style="stop-color:#E68E1A"/>
+</linearGradient>
+<path fill="url(#SVGID_4_)" d="M18.533,28.627c0,0,4.922,1.143,9.943,0.862c5.014-0.274,8.5-1.266,8.5-1.266l-2.835,4.198     l-14.71-1.136L18.533,28.627z"/>
+<polygon fill="#FFFFFF" points="35.097,28.524 28.032,12.924 28.233,29.297    "/>
+<polygon fill="#FFFFFF" points="27.278,28.588 16.76,25.301 26.94,12.332    "/>
+</g>
+<g>
+<path fill="#3F3F3F" d="M33.333,15.499c0.196,0.425-0.181,1.771,8.077,2.419l-0.052-0.659L33.333,15.499z"/>
+<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="170.4814" y1="-89.6299" x2="163.1468" y2="-84.2604" gradientTransform="matrix(0.9263 -0.0134 -0.0821 -1.1315 -124.5837 -80.4613)">
+<stop offset="0" style="stop-color:#404040"/>
+<stop offset="1" style="stop-color:#9C9C9C"/>
+</linearGradient>
+<path fill="url(#SVGID_5_)" d="M41.425,17.259l-6.811-6.617c-1.271,0.907-1.626,4.271-1.25,4.925     C34.109,16.813,40.226,17.213,41.425,17.259z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_video.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+<?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 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="tiny" height="72" version="1.1" viewBox="0 0 83.999 72" width="83.999">
+<rect fill="none" height="72" width="83.999"/>
+<path d="M21.352,50.689c-1.078-14.983-1.703-29.983-1.109-40.953c0.112-2.063,1.538-3.394,3.085-3.478  c2.089-0.352,24.655,0.894,24.655,0.894l10.535,13.654l-0.303,39.86c-2.881,0.883-2.363,1.606-6.084,0.789  c-7.25-1.595-14.593-3.328-28.515-6.922C21.647,54.025,21.446,52.001,21.352,50.689z" fill="#FFFFFF"/>
+<path d="M47.538,10.646c-0.354-0.398-18.581-1.807-23.295-1.782c-0.306,0-1.197,0.399-1.197,0.399l30.18,49.989  c1.453-0.625,1.896-1.19,2-2.344c0.119-1.287,0.48-35.658,0.48-35.986C55.706,20.618,48.196,11.398,47.538,10.646z" fill="#717171"/>
+<radialGradient cx="22.8677" cy="9.4863" gradientUnits="userSpaceOnUse" id="XMLID_4_" r="58.2698">
+<stop offset="0" stop-color="#F3F3F3"/>
+<stop offset="0.1838" stop-color="#ECECEC"/>
+<stop offset="0.4421" stop-color="#D9D9D9"/>
+<stop offset="0.7474" stop-color="#B9B9B9"/>
+<stop offset="1" stop-color="#9A9A9A"/>
+</radialGradient>
+<path d="M46.907,11.021l8.139,10.276c0.051,0.563-0.238,33.931-0.537,36.037  c-0.299,2.104-1.877,2.246-2.955,2.013c-7.25-1.578-16.374-3.642-26.327-6.156c-1.708-0.45-2.687-1.69-2.797-3.375  c-0.641-10.875-1-20.625-0.797-38.109c0.047-1.877,0.827-2.605,2.633-2.584C29.943,9.355,42.52,10.412,46.907,11.021z" fill="url(#XMLID_4_)"/>
+<path d="M49.911,44.829l-0.531-0.093l-0.026,3.684l3.171,0.589l0.005-0.456L49.911,44.829z M24.932,47.612   l-0.545-0.108l0.075,3.401l3.145,0.668L27.598,51.1L24.932,47.612z M27.467,43.872l-2.693-3.436l-0.545-0.095l0.075,3.396   l3.172,0.593L27.467,43.872z M26.943,14.972l-2.803-3.244l-0.543-0.042l0.074,3.4l3.278,0.291L26.943,14.972z M49.965,37.06   l-0.532-0.08l-0.026,3.682l3.197,0.516l0.004-0.442L49.965,37.06z M27.337,36.648l-2.721-3.39l-0.545-0.081l0.076,3.401   l3.197,0.515L27.337,36.648z M27.074,22.196l-2.776-3.292l-0.542-0.055l0.074,3.4l3.252,0.365L27.074,22.196z M27.206,29.422   l-2.748-3.342l-0.545-0.068l0.074,3.401l3.226,0.44L27.206,29.422z M49.857,52.602l-0.532-0.106l-0.021,3.685l3.142,0.668   l0.005-0.47L49.857,52.602z M50.068,21.513l-0.533-0.054l-0.023,3.683l3.249,0.365l0.004-0.417L50.068,21.513z M50.018,29.285   l-0.532-0.067l-0.026,3.683l3.223,0.44l0.005-0.43L50.018,29.285z" fill="#717171"/>
+<path d="M24.365,21.892l2.709,0.304l-0.032-3.019l-2.744-0.273L24.365,21.892z M24.838,43.381l2.629,0.491   l-0.029-2.977l-2.664-0.459L24.838,43.381z M24.522,29.056l2.684,0.366l-0.033-3.006l-2.715-0.336L24.522,29.056z M24.682,36.221   l2.655,0.428l-0.032-2.992l-2.688-0.398L24.682,36.221z M24.207,14.729l2.736,0.243l-0.031-3.032l-2.771-0.211L24.207,14.729z    M49.965,37.06l-0.023,3.244l2.666,0.431l0.059-3.275L49.965,37.06z M50.018,29.285l-0.023,3.259l2.692,0.368l0.059-3.289   L50.018,29.285z M50.068,21.513l-0.021,3.272l2.718,0.305l0.06-3.303L50.068,21.513z M49.857,52.602l-0.019,3.221l2.611,0.556   l0.056-3.252L49.857,52.602z M49.911,44.829l-0.022,3.234l2.641,0.489l0.059-3.261L49.911,44.829z M24.932,47.612l0.064,2.936   l2.602,0.552l-0.028-2.967L24.932,47.612z" fill="#FFFFFF"/>
+<path d="M44.831,18.426c0.211,0.658-0.402,2.708,10.221,3.883l-0.006-1.011L44.831,18.426z"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_5_" x1="54.9702" x2="44.812" y1="21.52" y2="14.0835">
+<stop offset="0" stop-color="#404040"/>
+<stop offset="1" stop-color="#9C9C9C"/>
+</linearGradient>
+<path d="M55.132,21.298l-8.188-10.276c-1.732,1.361-2.506,6.5-2.082,7.508  C45.71,20.455,53.585,21.204,55.132,21.298z" fill="url(#XMLID_5_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_6_" x1="40.4478" x2="52.1051" y1="2.7344" y2="58.3812">
+<stop offset="0" stop-color="#222221"/>
+<stop offset="0.0929" stop-color="#BFBFC0"/>
+<stop offset="0.1264" stop-color="#FFFFFF"/>
+<stop offset="0.197" stop-color="#FFFFFF"/>
+<stop offset="0.3034" stop-color="#E9E9E9"/>
+<stop offset="0.4944" stop-color="#A4A4A4"/>
+<stop offset="0.7435" stop-color="#646464"/>
+<stop offset="1" stop-color="#3D3D3D"/>
+</linearGradient>
+<path d="M23.422,6.235c4.74,0.047,22.922,1.079,24.306,1.877c2.159,1.243,9.806,11.074,10.228,13.255  c0.402,2.065-0.165,32.728-0.586,38.173c-0.027,0.348-0.127,1.541-1.358,1.97c0,0,1.899-0.68,2.906-1.125  c0.987-0.423,1.646-0.729,1.971-1.784c0.949-3.834,1.224-35.398,0.963-38.431c-0.188-2.182-8.213-11.801-9.712-12.787  c-1.831-1.218-18.51-1.829-23.907-2.087C26.964,5.273,24.689,5.86,23.422,6.235z" fill="url(#XMLID_6_)"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_icon_sub.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+<?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 57 49">
+<g>
+<rect fill="none" width="57" height="49"/>
+<g>
+<g>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-29.9404" y1="67.2036" x2="-13.5654" y2="84.1604" gradientTransform="matrix(1.1364 0 0 -1.1364 37.2653 105.8394)">
+<stop offset="0" style="stop-color:#B2DCFF"/>
+<stop offset="0.1338" style="stop-color:#AFDAFD"/>
+<stop offset="0.2458" style="stop-color:#A4D4F9"/>
+<stop offset="0.35" style="stop-color:#93C9F3"/>
+<stop offset="0.4494" style="stop-color:#7CBAEB"/>
+<stop offset="0.4857" style="stop-color:#62A5D9"/>
+<stop offset="0.5369" style="stop-color:#448DC4"/>
+<stop offset="0.5936" style="stop-color:#2B79B3"/>
+<stop offset="0.6569" style="stop-color:#186AA5"/>
+<stop offset="0.7304" style="stop-color:#0A5F9C"/>
+<stop offset="0.8234" style="stop-color:#025997"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M14.354,21.833c-2.518-5.763,4.479-8.498,8.152-9.806c-0.46-1.02-0.304-1.158-0.767-2.179     C13.542,12.767,10.51,17.036,14.354,21.833"/>
+<polygon fill="#005795" points="32.95,6.36 32.638,8.265 22.202,14.914 21.878,12.757    "/>
+<path fill="#005795" d="M14.728,21.493c-1.531-0.65-4.878-6.024-4.878-6.024c-0.177,2.774,2.248,6.491,5.081,7.768L14.728,21.493     z"/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="-574.3096" y1="868.9937" x2="-580.1138" y2="852.1368" gradientTransform="matrix(-1.1364 0 0 1.1364 -635.3151 -965.1128)">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.2589" style="stop-color:#3AB1FC"/>
+<stop offset="0.4438" style="stop-color:#35A9F3"/>
+<stop offset="0.6057" style="stop-color:#2C9CE3"/>
+<stop offset="0.7543" style="stop-color:#2088CD"/>
+<stop offset="0.8926" style="stop-color:#106FB1"/>
+<stop offset="1" style="stop-color:#005795"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M14.576,21.465C4.779,16.384,11.55,9.337,21.28,6.071l-0.195-2.917l11.858,3.208l-11.125,6.464     l-0.163-2.835C14.216,12.645,10.1,17.192,14.576,21.465z"/>
+</g>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="41.3232" y1="20.1992" x2="41.3232" y2="34.6598">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1601" style="stop-color:#F6F6F6"/>
+<stop offset="0.3124" style="stop-color:#EAEAEA"/>
+<stop offset="0.4639" style="stop-color:#D6D7D7"/>
+<stop offset="0.615" style="stop-color:#BBBBBB"/>
+<stop offset="0.7657" style="stop-color:#979797"/>
+<stop offset="0.9142" style="stop-color:#6D6D6D"/>
+<stop offset="1" style="stop-color:#505151"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M41.15,23.792c0,0-0.245-0.188-0.3-0.231c0,4.018,0,11.631,0,11.631     c0,0.963-0.809,1.509-1.307,1.591c0,0,2.592-0.7,2.967-1.011s0.591-0.771,0.591-1.258c0,0,0-6.548,0-10.564l-0.69,0.161     C41.964,24.183,41.508,24.068,41.15,23.792z"/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="28.6187" y1="8.8052" x2="45.5698" y2="22.4999">
+<stop offset="0" style="stop-color:#FAFAFA"/>
+<stop offset="0.0056" style="stop-color:#FAFAFA"/>
+<stop offset="0.1353" style="stop-color:#F3F3F3"/>
+<stop offset="0.3231" style="stop-color:#E0E0E0"/>
+<stop offset="0.5464" style="stop-color:#C0C1C1"/>
+<stop offset="0.7948" style="stop-color:#959696"/>
+<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_11_)" d="M46.103,19.31L31.948,7.594c-0.689-0.544-1.511-0.37-1.838-0.28l-1.784,0.51     c0.558-0.238,1.208-0.152,1.683,0.241l14.154,11.712c0.643,0.534,0.781,1.468,0.316,2.163l-0.977,1.464     c-0.203,0.307-0.506,0.526-0.852,0.639c0,0,1.314-0.249,1.7-0.402c0.419-0.167,0.841-0.33,1.092-0.705l0.977-1.464     C46.884,20.776,46.746,19.842,46.103,19.31z"/>
+<path fill="#FFFFFF" d="M28.175,7.894l-13.178,7.323c-0.687,0.381-1.005,1.198-0.756,1.942l0.488,1.465     c0.151,0.451,0.49,0.814,0.932,0.994c0.44,0.181,0.937,0.16,1.36-0.058c0,0,0.061-0.031,0.065-0.034c0,3.547,0,11.76,0,11.76     c0,0.782,0.556,1.456,1.327,1.603l20.499,3.904c0.477,0.092,0.971-0.034,1.345-0.347c0.375-0.31,0.593-0.77,0.593-1.255     c0,0,0-7.613,0-11.631c0.055,0.043,0.3,0.231,0.3,0.231c0.357,0.277,0.813,0.392,1.261,0.318     c0.446-0.073,0.842-0.329,1.092-0.706l0.977-1.464c0.465-0.694,0.326-1.628-0.316-2.163L30.009,8.065     C29.489,7.636,28.763,7.569,28.175,7.894z"/>
+<path fill="#9D0A00" d="M28.968,9.321L15.79,16.643l0.488,1.464l2.441-1.25v14.428l19.546,4.449l0.953-0.544V20.242l1.977,2.802     l0.951-0.544l0.977-1.465L28.968,9.321z M31.897,32.75l-6.834-1.205V21.523l6.834,0.977V32.75z"/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="42.4961" y1="10.9146" x2="16.4225" y2="36.3367">
+<stop offset="0" style="stop-color:#FF0000"/>
+<stop offset="0.0056" style="stop-color:#FF0000"/>
+<stop offset="0.3111" style="stop-color:#FC0000"/>
+<stop offset="0.5001" style="stop-color:#F40000"/>
+<stop offset="0.6575" style="stop-color:#E50000"/>
+<stop offset="0.7974" style="stop-color:#D10000"/>
+<stop offset="0.9246" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#A30000"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M28.016,9.865l-13.179,7.323l0.49,1.464l2.438-1.25V31.83l20.499,3.905V20.786l2.93,2.258     l0.977-1.465L28.016,9.865z M30.945,33.293l-6.834-1.206V22.067l6.834,0.977V33.293z"/>
+</g>
+<g>
+<polygon fill="#005447" points="36.776,38.982 36.333,36.628 36.351,39.142 36.757,41.748    "/>
+<g>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="11.0664" y1="69.1978" x2="-1.6647" y2="60.843" gradientTransform="matrix(1.1364 0 0 -1.1364 37.2653 105.8394)">
+<stop offset="0" style="stop-color:#36FF4E"/>
+<stop offset="0.1352" style="stop-color:#35FC4E"/>
+<stop offset="0.2426" style="stop-color:#32F24D"/>
+<stop offset="0.3405" style="stop-color:#2DE14C"/>
+<stop offset="0.4327" style="stop-color:#25C94B"/>
+<stop offset="0.521" style="stop-color:#1CAB49"/>
+<stop offset="0.6063" style="stop-color:#108547"/>
+<stop offset="0.6877" style="stop-color:#035A45"/>
+<stop offset="0.7042" style="stop-color:#005044"/>
+<stop offset="0.7352" style="stop-color:#004F3E"/>
+<stop offset="0.777" style="stop-color:#004B2D"/>
+<stop offset="0.7859" style="stop-color:#004A28"/>
+<stop offset="0.8535" style="stop-color:#004A26"/>
+<stop offset="1" style="stop-color:#004200"/>
+</linearGradient>
+<path fill="url(#XMLID_13_)" d="M46.864,24.841c0,0-10.52,11.723-10.531,11.787c0.191,1.425,0.32,2.172,0.399,2.385      C36.892,38.974,50.229,35.454,46.864,24.841z"/>
+<polygon fill="#005447" points="36.52,39.466 36.749,41.812 25.464,38.37 25.219,36.226     "/>
+</g>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="-7.6543" y1="57.9595" x2="8.0163" y2="72.0694" gradientTransform="matrix(1.1364 0 0 -1.1364 37.2653 105.8394)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_14_)" d="M44.404,23.62c0,0,0.378-0.13,0.593-0.276c0.215-0.147,0.441-0.414,0.441-0.414     c5.043,4.867-0.933,10.728-9.094,13.634l0.188,2.947l-11.3-3.241l10.601-6.535l0.156,2.864     C41.655,30.457,45.347,27.091,44.404,23.62z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_music.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -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.054,2.46,16.257c-0.744,1.197-0.212,2.326,1.181,2.504   c1.395,0.182,3.122-0.646,3.859-1.851c0.214-0.343,0.31-0.674,0.322-0.981c0.003-0.013,0.013-0.021,0.019-0.029   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.184-3.123,0.649-3.855,1.853c-0.747,1.201-0.215,2.324,1.174,2.505c1.398,0.18,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.221,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="-226.4541" y1="341.4932" x2="-223.2847" y2="341.4932" gradientTransform="matrix(4.7619 0 0 -4.7619 1080.4711 1636.6975)">
+<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/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_other_images.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+<?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="M2.775,3.639c-0.6,0-1.121,0.523-1.121,1.268L1.638,15.919c0,1.432,0.102,1.59,1.71,1.59h14.679     c1.028,0,1.312-0.448,1.312-1.501l0.015-10.73c0-1.05-0.213-1.636-1.241-1.636L3.506,3.639H2.775z"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="-226.7178" y1="341.917" x2="-223.2124" y2="341.917" gradientTransform="matrix(4.7619 0 0 -4.7619 1081.7422 1638.1155)">
+<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_3_)" d="M18.205,4.117H2.783l0,0c-0.352,0-0.636,0.289-0.636,0.64v10.94     c-0.031,0.028,16.669,0.028,16.693,0V4.757C18.84,4.406,18.557,4.117,18.205,4.117z"/>
+</g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="-226.7178" y1="340.7402" x2="-223.2124" y2="340.7402" gradientTransform="matrix(4.7619 0 0 -4.7619 1081.7422 1638.1155)">
+<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_4_)" d="M2.147,14.075v2.236c0,0.352,0.284,0.638,0.636,0.638h15.422c0.352,0,0.635-0.28,0.635-0.638    v-2.236H2.147z"/>
+<polygon fill="#F4A816" points="6.518,14.384 4.531,12.246 16.455,12.246 14.467,14.384   "/>
+<polygon fill="#FFFFFF" points="11.157,11.532 11.157,5.829 5.855,11.532   "/>
+<polygon fill="#FFFFFF" points="11.818,5.829 15.13,11.532 11.818,11.532   "/>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_other_videos.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,30 @@
+<?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>
+<g>
+<path fill="#FFFFFF" d="M4.214,2.083c-1.498-0.035-2.55,0.415-2.539,2.523v11.987c-0.011,2.071,0.867,2.483,2.539,2.523h12.694     c1.94,0.064,2.537-0.799,2.538-2.523V4.606c-0.001-1.865-0.877-2.56-2.538-2.523H4.214z"/>
+<path fill="url(#XMLID_2_)" d="M18.895,17.235c0,0.763-0.62,1.388-1.386,1.388H3.647c-0.767,0-1.387-0.625-1.387-1.388V4.064     c0-0.765,0.621-1.386,1.387-1.386h13.86c0.767,0,1.387,0.621,1.387,1.386L18.895,17.235L18.895,17.235z"/>
+<rect x="3.647" y="11.69" fill="#FFFFFF" width="2.079" height="2.08"/>
+<rect x="3.647" y="15.851" fill="#FFFFFF" width="2.079" height="2.078"/>
+<rect x="15.43" y="7.531" fill="#FFFFFF" width="2.079" height="2.081"/>
+<rect x="15.43" y="3.373" fill="#FFFFFF" width="2.079" height="2.079"/>
+<rect x="15.43" y="11.69" fill="#FFFFFF" width="2.079" height="2.08"/>
+<rect x="15.43" y="15.851" fill="#FFFFFF" width="2.079" height="2.078"/>
+<rect x="7.112" y="2.68" fill="#CBCBCB" width="6.932" height="4.157"/>
+<rect x="7.112" y="8.223" fill="#CBCBCB" width="6.932" height="4.854"/>
+<rect x="7.112" y="14.464" fill="#CBCBCB" width="6.932" height="4.159"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="-226.4063" y1="342.6563" x2="-222.89" y2="339.7058" gradientTransform="matrix(4.7619 0 0 -4.7619 1080.3186 1635.3358)">
+<stop offset="0" style="stop-color:#AFAFAE"/>
+<stop offset="1" style="stop-color:#121212"/>
+</linearGradient>
+</defs>
+</g>
+<rect x="3.628" y="7.524" fill="#FFFFFF" width="2.078" height="2.081"/>
+<rect x="3.628" y="3.365" fill="#FFFFFF" width="2.078" height="2.08"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_phone_images.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -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="M2.73,3.667c-0.594,0-1.108,0.515-1.108,1.251L1.607,15.8c0,1.414,0.101,1.57,1.69,1.57H17.8     c1.017,0,1.296-0.443,1.296-1.482l0.016-10.601c0-1.039-0.211-1.619-1.229-1.619L3.452,3.667H2.73z"/>
+<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="2.1104" y1="9.8672" x2="18.6035" y2="9.8672">
+<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.977,4.139H2.739l0,0c-0.349,0-0.629,0.286-0.629,0.632v10.81     c-0.001,0.021,16.494,0.021,16.494,0V4.771C18.604,4.425,18.323,4.139,17.977,4.139z"/>
+</g>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="2.1104" y1="15.3984" x2="18.6035" y2="15.3984">
+<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.11,13.979v2.21c0,0.347,0.28,0.63,0.629,0.63h15.238c0.346,0,0.627-0.278,0.627-0.63v-2.21H2.11    z"/>
+<polygon fill="#F4A816" points="6.429,14.284 4.466,12.171 16.247,12.171 14.283,14.284   "/>
+<polygon fill="#FFFFFF" points="11.012,11.466 11.012,5.831 5.773,11.466   "/>
+<polygon fill="#FFFFFF" points="11.666,5.831 14.938,11.466 11.666,11.466   "/>
+</g>
+<g>
+<path fill="#FFFFFF" d="M9.836,1.338H8.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.683,1.584,1.522,1.584h4.644c0.838,0,1.521-0.71,1.521-1.584V3.933c-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,2.765V1.742H9.027v1.011h-3.94c-0.617,0-1.118,0.53-1.118,1.18v7.351c0,0.65,0.5,1.18,1.118,1.18h4.644    c0.615,0,1.117-0.529,1.117-1.18V3.933C10.846,3.318,10.401,2.823,9.836,2.765z"/>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="3.8247" y1="4.6016" x2="10.9922" y2="10.6158">
+<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,3.36H5.087c-0.281,0-0.511,0.256-0.511,0.572v7.351c0,0.315,0.23,0.573,0.511,0.573h4.644    c0.281,0,0.51-0.258,0.51-0.573V3.933C10.239,3.616,10.012,3.36,9.729,3.36z"/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="5.1255" y1="4.4795" x2="9.6918" y2="8.3111">
+<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.17" fill="url(#XMLID_8_)" width="4.046" height="4.45"/>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_phone_videos.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+<?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="M4.296,3.133C2.819,3.099,1.781,3.542,1.792,5.622v11.823c-0.01,2.044,0.855,2.451,2.505,2.489h12.521    c1.914,0.064,2.502-0.788,2.504-2.489V5.622c-0.002-1.841-0.866-2.523-2.504-2.489H4.296z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="2.3159" y1="4.6543" x2="18.83" y2="18.5113">
+<stop offset="0" style="stop-color:#AFAFAE"/>
+<stop offset="1" style="stop-color:#121212"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M18.776,18.077c0,0.753-0.612,1.368-1.367,1.368H3.738c-0.756,0-1.369-0.615-1.369-1.368V5.087    c0-0.753,0.612-1.366,1.369-1.366h13.671c0.755,0,1.367,0.613,1.367,1.366V18.077z"/>
+<rect x="3.738" y="12.609" fill="#FFFFFF" width="2.049" height="2.051"/>
+<rect x="3.738" y="16.712" fill="#FFFFFF" width="2.049" height="2.049"/>
+<rect x="15.358" y="8.506" fill="#FFFFFF" width="2.051" height="2.053"/>
+<rect x="15.358" y="4.404" fill="#FFFFFF" width="2.051" height="2.051"/>
+<rect x="15.358" y="12.609" fill="#FFFFFF" width="2.051" height="2.051"/>
+<rect x="15.358" y="16.712" fill="#FFFFFF" width="2.051" height="2.049"/>
+<rect x="7.155" y="3.721" fill="#CBCBCB" width="6.836" height="4.102"/>
+<rect x="7.155" y="9.189" fill="#CBCBCB" width="6.836" height="4.786"/>
+<rect x="7.155" y="15.344" fill="#CBCBCB" width="6.836" height="4.102"/>
+</g>
+<g>
+<path fill="#FFFFFF" d="M10.586,1.353H9.373c0,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.584    v7.351c0,0.874,0.683,1.584,1.522,1.584h4.644c0.838,0,1.521-0.71,1.521-1.584V3.947C12,3.268,11.58,2.707,10.989,2.486    c0-0.299,0-1.134,0-1.134H10.586z"/>
+<path d="M10.586,2.779V1.757H9.777v1.011h-3.94c-0.617,0-1.118,0.53-1.118,1.18v7.351c0,0.65,0.5,1.18,1.118,1.18h4.644    c0.615,0,1.118-0.529,1.118-1.18V3.947C11.597,3.333,11.151,2.838,10.586,2.779z"/>
+<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="4.5752" y1="4.6162" x2="11.7426" y2="10.6304">
+<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_5_)" d="M10.479,3.375H5.837c-0.281,0-0.511,0.256-0.511,0.572v7.351c0,0.315,0.23,0.573,0.511,0.573h4.644    c0.281,0,0.51-0.258,0.51-0.573V3.947C10.989,3.631,10.762,3.375,10.479,3.375z"/>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="5.8755" y1="4.4941" x2="10.4418" y2="8.3258">
+<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="6.135" y="4.185" fill="url(#XMLID_6_)" width="4.046" height="4.45"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_skipped.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,115 @@
+<?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 57 48.857">
+<g>
+<rect fill="none" width="57" height="48.857"/>
+<g>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="-21.9541" y1="67.7988" x2="4.1646" y2="77.3053" gradientTransform="matrix(1.1364 0 0 -1.1364 37.2607 105.5296)">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.035" style="stop-color:#E2E2E2"/>
+<stop offset="0.0858" style="stop-color:#BCBCBC"/>
+<stop offset="0.1127" style="stop-color:#AEAEAE"/>
+<stop offset="0.1831" style="stop-color:#7E7E7E"/>
+<stop offset="0.2732" style="stop-color:#4A4A4A"/>
+<stop offset="0.4958" style="stop-color:#454545"/>
+<stop offset="0.5164" style="stop-color:#3F3F3F"/>
+<stop offset="0.5775" style="stop-color:#3D3D3D"/>
+<stop offset="0.6125" style="stop-color:#484848"/>
+<stop offset="0.6738" style="stop-color:#656565"/>
+<stop offset="0.7538" style="stop-color:#939393"/>
+<stop offset="0.8488" style="stop-color:#D4D4D4"/>
+<stop offset="0.862" style="stop-color:#DDDDDD"/>
+<stop offset="0.8698" style="stop-color:#E2E2E2"/>
+<stop offset="0.9067" style="stop-color:#F2F2F2"/>
+<stop offset="0.9476" style="stop-color:#FCFCFC"/>
+<stop offset="1" style="stop-color:#FFFFFF"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M37.65,9.646c6.79,5.601,2.893,15.34-10.806,19.976c0,0-0.01,2.206-0.01,2.649     c0,0.444-0.542,1.056-1.843,0.846c-0.304-0.05-9.845-2.998-12.35-3.745c-0.09-0.091-0.505-3.297-0.42-3.561     c0.037-0.112,5.988,0.771,6.343,0.521c0.597-0.424,7.542-5.442,7.629-4.792c0.057,0.412,0,0,0.142,2.476     C35.982,20.252,43.457,15.715,37.65,9.646z"/>
+</g>
+<g>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="-18.7168" y1="66.1836" x2="1.8293" y2="84.6834" gradientTransform="matrix(1.1364 0 0 -1.1364 37.2607 105.5296)">
+<stop offset="0" style="stop-color:#68D70B"/>
+<stop offset="1" style="stop-color:#2B7D00"/>
+</linearGradient>
+<path fill="url(#XMLID_11_)" stroke="#FFFFFF" d="M34.424,5.2c12.359,7.019,3.818,16.736-8.453,21.245     c0,0,0.186,2.443,0.186,2.874c0,0.433-0.459,0.943-1.374,0.737c-0.292-0.065-9.883-2.981-12.318-3.707     c-0.299-0.088-0.333-0.854-0.056-1.028c2.277-1.441,11.06-6.974,11.405-7.218c0.581-0.412,1.462-0.109,1.548,0.523     c0.055,0.401,0,0,0.137,2.407C34.881,17.374,40.072,11.101,34.424,5.2z"/>
+</g>
+<g>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="-122.8135" y1="-364.8525" x2="-117.5996" y2="-364.8525" gradientTransform="matrix(0 1 -1 0 -334.3516 145.7578)">
+<stop offset="0" style="stop-color:#B70000"/>
+<stop offset="0.0028" style="stop-color:#B70000"/>
+<stop offset="0.055" style="stop-color:#AC0000"/>
+<stop offset="0.2344" style="stop-color:#8A0000"/>
+<stop offset="0.4177" style="stop-color:#6F0000"/>
+<stop offset="0.6042" style="stop-color:#5C0000"/>
+<stop offset="0.7957" style="stop-color:#510000"/>
+<stop offset="1" style="stop-color:#4D0000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_12_)" points="27.864,22.944 33.139,27.986 32.711,28.158 28.722,24.275    "/>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="-116.8965" y1="-372.9141" x2="-123.1927" y2="-375.8643" gradientTransform="matrix(0 1 -1 0 -334.3516 145.7578)">
+<stop offset="0" style="stop-color:#610000"/>
+<stop offset="0.2559" style="stop-color:#640000"/>
+<stop offset="0.4511" style="stop-color:#6E0000"/>
+<stop offset="0.6261" style="stop-color:#7E0000"/>
+<stop offset="0.7893" style="stop-color:#950000"/>
+<stop offset="0.9429" style="stop-color:#B20000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_13_)" points="37.184,27.838 42.313,22.939 42.512,24.403 38.193,28.688    "/>
+<linearGradient id="XMLID_14_" gradientUnits="userSpaceOnUse" x1="-482.4448" y1="-144.1206" x2="-497.5866" y2="-151.2158" gradientTransform="matrix(-0.7091 -0.7073 0.7062 -0.708 -208.0876 -423.402)">
+<stop offset="0" style="stop-color:#CB0000"/>
+<stop offset="0.4669" style="stop-color:#C90000"/>
+<stop offset="0.635" style="stop-color:#C20000"/>
+<stop offset="0.7549" style="stop-color:#B70000"/>
+<stop offset="0.8518" style="stop-color:#A60000"/>
+<stop offset="0.9338" style="stop-color:#900000"/>
+<stop offset="1" style="stop-color:#780000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_14_)" points="35.105,30.111 30.194,34.885 27.901,32.565 32.756,27.675 27.85,22.93 30.229,20.598      35.105,25.412 39.935,20.607 42.313,22.939 37.432,27.675 42.299,32.617 40.027,34.854    "/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M41.623,29.605"/>
+<linearGradient id="XMLID_15_" gradientUnits="userSpaceOnUse" x1="-111.8633" y1="-375.1797" x2="-111.0852" y2="-376.107" gradientTransform="matrix(0 1 -1 0 -334.3516 145.7578)">
+<stop offset="0" style="stop-color:#690000"/>
+<stop offset="0.3698" style="stop-color:#6B0000"/>
+<stop offset="0.5521" style="stop-color:#730000"/>
+<stop offset="0.6934" style="stop-color:#800000"/>
+<stop offset="0.8136" style="stop-color:#930000"/>
+<stop offset="0.9193" style="stop-color:#AB0000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_15_)" points="40.033,34.842 42.305,32.615 42.329,33.988 40.349,36.01    "/>
+<linearGradient id="XMLID_16_" gradientUnits="userSpaceOnUse" x1="-115.5996" y1="-366.813" x2="-109.5762" y2="-366.813" gradientTransform="matrix(-0.0037 1.0036 -1.0037 0.0037 -335.7661 147.4848)">
+<stop offset="0" style="stop-color:#800000"/>
+<stop offset="0.3671" style="stop-color:#820000"/>
+<stop offset="0.579" style="stop-color:#8B0000"/>
+<stop offset="0.7514" style="stop-color:#990000"/>
+<stop offset="0.9017" style="stop-color:#AC0000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_16_)" points="30.184,34.895 35.113,30.104 35.46,31.408 30.705,36.164    "/>
+<linearGradient id="XMLID_17_" gradientUnits="userSpaceOnUse" x1="-115.6484" y1="-372.0801" x2="-109.748" y2="-372.0801" gradientTransform="matrix(0 1 -1 0 -334.3516 145.7578)">
+<stop offset="0" style="stop-color:#4D0000"/>
+<stop offset="0.1318" style="stop-color:#5D0000"/>
+<stop offset="0.6968" style="stop-color:#9E0000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_17_)" points="35.108,30.109 40.044,34.839 40.349,36.01 35.46,31.408    "/>
+<linearGradient id="XMLID_18_" gradientUnits="userSpaceOnUse" x1="-113.1992" y1="-363.6514" x2="-109.5938" y2="-363.6514" gradientTransform="matrix(0 1 -1 0 -334.3516 145.7578)">
+<stop offset="0" style="stop-color:#4D0000"/>
+<stop offset="0.1661" style="stop-color:#520000"/>
+<stop offset="0.3631" style="stop-color:#600000"/>
+<stop offset="0.5758" style="stop-color:#780000"/>
+<stop offset="0.798" style="stop-color:#990000"/>
+<stop offset="0.9634" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#B70000"/>
+</linearGradient>
+<polygon fill="url(#XMLID_18_)" points="27.895,32.559 30.227,34.851 30.705,36.164 28.484,33.888    "/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M30.764,36.273"/>
+<path fill="none" stroke="#000000" stroke-width="0.25" d="M42.627,24.526"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/data/mediaservant.rh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource header
+*
+*/
+
+
+STRUCT FILL_RULE
+    {
+    WORD item;
+    WORD value;
+    WORD addinfo;
+    }
+
+STRUCT TEMPLATE_ITEMS
+    {
+    STRUCT items[];
+    }    
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/data/mediaservant.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,3287 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project MediaServant
+*
+*/
+
+
+NAME    MESE // 4 letter ID
+
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <data_caging_paths_strings.hrh>
+#include <appinfo.rh>
+
+#include <mediaservant.loc>
+#include "cmcommontypes.h"
+#include "mediaservant.rh"
+#include "mediaservant.hrh"
+
+RESOURCE RSS_SIGNATURE { }
+RESOURCE TBUF { buf="MediaServant"; }
+
+RESOURCE EIK_APP_INFO
+    {
+    }
+
+//----------------------------------------------------
+//
+//    r_localisable_app_info
+//
+//----------------------------------------------------
+//
+RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info
+    {
+    short_caption = qtn_mserv_title_media_servant;
+    caption_and_icon =
+    CAPTION_AND_ICON_INFO
+        {
+        caption = qtn_mserv_title_media_servant;
+#ifdef __SCALABLE_ICONS
+        number_of_icons = 1;
+ #ifdef RD_APPS_TO_EXES
+        icon_file = "\\resource\\apps\\MediaServant_aif.mif";
+ #endif  //RD_APPS_TO_EXES
+#else
+ #ifdef RD_APPS_TO_EXES
+        number_of_icons = 2;
+        icon_file = "\\resource\\apps\\MediaServant_aif.mbm";
+ #endif //RD_APPS_TO_EXES
+#endif
+
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_main_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_ms_main_view
+    {
+    menubar = r_ms_menubar_main_view;
+    // required to define something here but cba will be
+    // changed dynamically
+    cba     = R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT;
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_fill_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_ms_fill_view
+    {
+    menubar = r_ms_menubar_fill_view;
+    // required to define something here but cba will be
+    // changed dynamically
+    cba = R_AVKON_SOFTKEYS_SELECTION_LIST;
+    }
+
+//----------------------------------------------------
+//
+//    r_fill_edit_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_ms_fill_edit_view
+    {
+    menubar = r_ms_menubar_fill_edit_view;
+    cba     = r_ms_softkeys_options_done__change;
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_store_list_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_ms_store_list_view
+    {
+    menubar = r_ms_menubar_store_list_view;
+    cba     = r_ms_softkeys_options_back__toggle;
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_store_settings_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_ms_store_settings_view
+    {
+    menubar = r_ms_menubar_store_settings_view;
+    cba     = r_ms_softkeys_options_done__change;
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_browse_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_ms_browse_view
+    {
+    menubar = r_ms_menubar_store_browse_view;
+    cba     = R_AVKON_SOFTKEYS_SELECTION_LIST;
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_fill_browse_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_ms_fill_browse_view
+    {
+    menubar = r_ms_menubar_browse_view;
+    cba     = R_AVKON_SOFTKEYS_SELECTION_LIST;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_ms_multiselection_dialog
+//
+//----------------------------------------------------------------------------
+
+RESOURCE DIALOG r_ms_multiselection_dialog
+    {
+    flags = EAknDialogMultiselectionList;
+    buttons = r_ms_softkeys_ok_cancel__change;
+
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtSingleGraphicListBox;
+            id = EMultiSelectionListBoxId;
+            control = LISTBOX
+                {
+                flags = EAknListBoxMultiselectionList;
+                };
+            },
+        DLG_LINE
+            {
+            itemflags = EEikDlgItemNonFocusing;
+            id = EFindControl;
+            type = EAknCtSelectionListPopupFind;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_menubar_main_view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_ms_menubar_main_view
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_app_menu; },
+        MENU_TITLE { menu_pane = r_main_view_menu; }
+        };
+    }
+
+
+//----------------------------------------------------
+//
+//    r_ms_menubar_fill_view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_ms_menubar_store_list_view
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_app_menu; },
+        MENU_TITLE { menu_pane = r_ms_store_list_menu; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_menubar_fill_view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_ms_menubar_fill_view
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_app_menu; },
+        MENU_TITLE { menu_pane = r_fill_view_menu; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_menubar_fill_edit_view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_ms_menubar_fill_edit_view
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_app_menu; },
+        MENU_TITLE { menu_pane = r_ms_fill_edit_menu; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_menubar_store_settings_view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_ms_menubar_store_settings_view
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_app_menu; },
+        MENU_TITLE { menu_pane = r_ms_store_list_edit_menu; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_menubar_store_browse_view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_ms_menubar_store_browse_view
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_app_menu; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_menubar_browse_view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_ms_menubar_browse_view
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_app_menu; },
+        MENU_TITLE { menu_pane = r_ms_fill_browse_menu; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_app_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_app_menu
+    {
+    items =
+        {
+        MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; },
+        MENU_ITEM { command = EEikCmdExit; txt = qtn_options_exit; }
+
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_fill_browse_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_ms_fill_browse_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EMSCmdLock;
+            txt = qtn_mserv_options_lock_on_phone;
+            },
+        MENU_ITEM
+            {
+            command = EMSCmdUnLock;
+            txt = qtn_mserv_options_unlock;
+            },
+        MENU_ITEM
+            {
+            command = EMSCmdRandomize;
+            txt = qtn_mserv_options_randomiza;
+            },
+        MENU_ITEM
+            {
+            command = EMSCmdMark;
+            cascade = r_ms_mark_menupane;
+            txt = qtn_options_list;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_fill_edit_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_ms_fill_edit_menu
+    {
+    items =
+        {
+        MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_change; },
+        MENU_ITEM
+            {
+            command = EMSCmdRemoveRule;
+            txt = qtn_mserv_options_remove_rule;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_view_main_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_main_view_menu
+    {
+    items =
+        {
+        MENU_ITEM { command = EMSCmdSelect; txt = qtn_mserv_options_select; },
+        MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_open; },
+        MENU_ITEM { command = EMSCmdStartHarvest; txt = qtn_mserv_options_refresh; },
+        MENU_ITEM { command = EMSCmdStopHarvest; txt = qtn_mserv_options_refresh_stop; },
+        MENU_ITEM { command = EMSCmdSettings; txt = qtn_mserv_options_sync_settings; },
+        MENU_ITEM { command = EMSCmdRunWizard; txt = qtn_mserv_options_run_wizard; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_fill_view_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_fill_view_menu
+    {
+    items =
+        {
+        MENU_ITEM { command = EMSCmdActivate; txt = qtn_mserv_options_select; },
+        MENU_ITEM { command = EMSCmdDeActivate; txt = qtn_mserv_options_unselect; },
+        MENU_ITEM { command = EMSCmdEditRule; txt = qtn_mserv_options_edit; },
+        MENU_ITEM { command = EMSCmdBrowse; txt = qtn_mserv_options_browse; },
+        MENU_ITEM
+            {
+            cascade = r_ms_new_list;
+            command = EAknDummyForProcessCommands;
+            txt = qtn_mserv_options_new_list;
+            },
+        MENU_ITEM { command = EMSCmdReorder; txt = qtn_mserv_options_reorder; },
+        MENU_ITEM { command = EMSCmdDelete; txt = qtn_mserv_options_delete; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_new_list
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_ms_new_list
+    {
+    items =
+        {
+        MENU_ITEM { command = EMSCmdNewImageList; txt = qtn_mserv_options_new_image; },
+        MENU_ITEM { command = EMSCmdNewVideoList; txt = qtn_mserv_options_new_video; },
+        MENU_ITEM { command = EMSCmdNewMusicList; txt = qtn_mserv_options_new_music; }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_mark_menupane
+//    Menu for marking
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_ms_mark_menupane
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EAknCmdMark;
+            txt = qtn_options_list_mark_one;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdUnmark;
+            txt = qtn_options_list_unmark_one;
+            },
+        MENU_ITEM
+            {
+            command = EAknMarkAll;
+            txt = qtn_options_list_mark_all;
+            },
+        MENU_ITEM
+            {
+            command = EAknUnmarkAll;
+            txt = qtn_options_list_unmark_all;
+            }
+        };
+    }
+
+//---------------------------------------------------------------------------
+//
+//    r_ms_store_list_menu
+//
+//---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_ms_store_list_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EMSStoreCmdActivate;
+            txt = qtn_mserv_options_select;
+            },
+        MENU_ITEM
+            {
+            command = EMSStoreCmdDeActivate;
+            txt = qtn_mserv_options_unselect;
+            },
+        MENU_ITEM
+            {
+            command = EMSStoreCmdEdit;
+            txt = qtn_mserv_options_edit;
+            },
+        MENU_ITEM
+            {
+            command = EMSCmdBrowse;
+            txt = qtn_mserv_options_browse;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_store_list_edit_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_ms_store_list_edit_menu
+    {
+    items =
+        {
+        MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_change; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_ms_setting_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_ms_setting_menu
+    {
+    items =
+        {
+        MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_change; }
+        };
+    }
+
+
+RESOURCE LISTBOX r_main_view_listbox
+    {
+    flags = EAknListBoxSelectionList;
+    }
+
+RESOURCE LISTBOX r_fill_view_listbox
+    {
+    flags = EAknListBoxSelectionList;
+    }
+
+RESOURCE LISTBOX r_fill_edit_view_listbox
+    {
+    flags = EAknListBoxSelectionList;
+    }
+
+RESOURCE LISTBOX r_store_list_view_listbox
+    {
+    flags = EAknListBoxMultiselectionList;
+    }
+
+RESOURCE LISTBOX r_browse_view_listbox
+    {
+    flags = EAknListBoxSelectionList | EAknListBoxMarkableList;
+    }
+
+/************************** FILL RULE SETTINGS *****************************/
+
+//----------------------------------------------------
+//
+//    r_ms_image_fill_rules
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_ITEM_LIST r_ms_image_fill_rules
+    {
+    flags= EAknSettingItemIncludeHiddenInOrdinal;
+    initial_number = 1;
+    items =
+        {
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSListName;
+            setting_page_resource = r_ms_fill_rule_list_name_setting_page;
+            name = qtn_mserv_rule_list_name;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSAmount;
+            setting_page_resource = r_ms_fill_rule_amount_setting_page;
+            name = qtn_mserv_rule_amount;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSStartingWith;
+            setting_page_resource = r_ms_starting_with_setting_page;
+            associated_resource = r_ms_starting_with_popup_texts;
+            name = qtn_mserv_rule_start_with;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSShrinkImages;
+            setting_page_resource = r_ms_shrink_images_setting_page;
+            associated_resource = r_ms_shrink_images_popup_texts;
+            name = qtn_mserv_rule_shrink_image;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSDateFrom;
+            setting_page_resource = r_ms_fill_rule_date_from_setting_page;
+            name = qtn_mserv_rule_from;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSDateUntil;
+            setting_page_resource = r_ms_fill_rule_date_until_setting_page;
+            name = qtn_mserv_rule_until;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSServers;
+            setting_page_resource = r_ms_fill_rule_servers_setting_page;
+            name = qtn_mserv_rule_storage;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSFreeText;
+            setting_page_resource = r_ms_fill_rule_free_text_setting_page;
+            name = qtn_mserv_rule_free_text;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EMSAddMoreRules;
+            setting_page_resource = r_ms_fill_rule_free_text_setting_page;
+            name = qtn_mserv_rule_add;
+            }
+        };
+    }
+
+
+//----------------------------------------------------
+//
+//    r_ms_video_fill_rules
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_ITEM_LIST r_ms_video_fill_rules
+  {
+  flags= EAknSettingItemIncludeHiddenInOrdinal;
+  initial_number = 1;
+  items =
+    {
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSListName;
+      setting_page_resource = r_ms_fill_rule_list_name_setting_page;
+      name = qtn_mserv_rule_list_name;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSAmount;
+      setting_page_resource = r_ms_fill_rule_amount_setting_page;
+      name = qtn_mserv_rule_amount;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSStartingWith;
+      setting_page_resource = r_ms_starting_with_setting_page;
+      associated_resource = r_ms_starting_with_popup_texts;
+      name = qtn_mserv_rule_start_with;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSTitleName;
+      setting_page_resource = r_ms_fill_rule_servers_setting_page;
+      name = qtn_mserv_rule_name;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSMinFileSize;
+      setting_page_resource = r_ms_min_file_size_setting_page;
+      name = qtn_mserv_rule_file_size_min;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSMaxFileSize;
+      setting_page_resource = r_ms_max_file_size_setting_page;
+      name = qtn_mserv_rule_file_size_max;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSDateFrom;
+      setting_page_resource = r_ms_fill_rule_date_from_setting_page;
+      name = qtn_mserv_rule_from;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSDateUntil;
+      setting_page_resource = r_ms_fill_rule_date_until_setting_page;
+      name = qtn_mserv_rule_until;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSServers;
+      setting_page_resource = r_ms_fill_rule_servers_setting_page;
+      name = qtn_mserv_rule_storage;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSFreeText;
+      setting_page_resource = r_ms_fill_rule_free_text_setting_page;
+      name = qtn_mserv_rule_free_text;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSAddMoreRules;
+      setting_page_resource = r_ms_fill_rule_free_text_setting_page;
+      name = qtn_mserv_rule_add;
+      }
+    };
+  }
+
+//----------------------------------------------------
+//
+//    r_ms_audio_fill_rules
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_ITEM_LIST r_ms_audio_fill_rules
+  {
+  flags= EAknSettingItemIncludeHiddenInOrdinal;
+  initial_number = 1;
+  items =
+    {
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSListName;
+      setting_page_resource = r_ms_fill_rule_list_name_setting_page;
+      name = qtn_mserv_rule_list_name;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSAmount;
+      setting_page_resource = r_ms_fill_rule_amount_setting_page;
+      name = qtn_mserv_rule_amount;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSStartingWith;
+      setting_page_resource = r_ms_starting_with_setting_page;
+      associated_resource = r_ms_starting_with_popup_texts;
+      name = qtn_mserv_rule_start_with;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSGenre;
+      setting_page_resource = r_ms_fill_rule_servers_setting_page;
+      name = qtn_mserv_rule_genre;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSArtist;
+      setting_page_resource = r_ms_fill_rule_servers_setting_page;
+      name = qtn_mserv_rule_artist;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSAlbum;
+      setting_page_resource = r_ms_fill_rule_servers_setting_page;
+      name = qtn_mserv_rule_album;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSTrack;
+      setting_page_resource = r_ms_fill_rule_servers_setting_page;
+      name = qtn_mserv_rule_track;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSServers;
+      setting_page_resource = r_ms_fill_rule_servers_setting_page;
+      name = qtn_mserv_rule_storage;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSFreeText;
+      setting_page_resource = r_ms_fill_rule_free_text_setting_page;
+      name = qtn_mserv_rule_free_text;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSTrackLength;
+      setting_page_resource = r_ms_track_length_setting_page;
+      associated_resource = r_ms_track_length_popup_texts;
+      name = qtn_mserv_rule_track_length;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSFileSize;
+      setting_page_resource = r_ms_file_size_setting_page;
+      associated_resource = r_ms_file_size_popup_texts;
+      name = qtn_mserv_rule_file_size;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSAddMoreRules;
+      setting_page_resource = r_ms_fill_rule_free_text_setting_page;
+      name = qtn_mserv_rule_add;
+      }
+    };
+  }
+
+/*************************** LIST NAME SETTING *****************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_free_text_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_list_name_setting_page
+    {
+    label = qtn_mserv_rule_list_name;
+    type = EEikCtEdwin;
+    editor_resource_id = r_ms_fill_rule_free_text_editor;
+    }
+
+/**************************** AMOUNT SETTING *******************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_amount_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_amount_setting_page
+    {
+    label = qtn_mserv_sett_amount;
+    type = EAknCtPopupSettingList;
+    editor_resource_id = r_ms_fill_rule_amount_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_amount_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_ms_fill_rule_amount_editor
+    {
+    }
+
+/************************** SHRINK IMAGES SETTING ****************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_shrink_images_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_shrink_images_setting_page
+    {
+    type = EAknCtPopupSettingList;
+    label = qtn_mserv_sett_shrink_image;
+    editor_resource_id = r_ms_shrink_images_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_shrink_images_popup_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_shrink_images_popup_texts
+    {
+    setting_texts_resource = r_ms_shrink_images_texts;
+    popped_up_texts_resource = r_ms_shrink_images_on_off_texts;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_shrink_images_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_ms_shrink_images_editor
+    {
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_shrink_images_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_shrink_images_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSShrinkScreenSize;
+            text = qtn_mserv_value_screen_size;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSShrinkingOff;
+            text = qtn_mserv_value_no_shrinking;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_shrink_images_on_off_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_shrink_images_on_off_texts
+    {
+    items =
+        {
+        LBUF { txt = qtn_mserv_value_screen_size; },
+        LBUF { txt = qtn_mserv_value_no_shrinking; }
+
+        };
+    }
+
+/************************** STARTING_WITH SETTING ****************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_starting_with_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_starting_with_setting_page
+    {
+    type = EAknCtPopupSettingList;
+    label = qtn_mserv_sett_start_with;
+    editor_resource_id = r_ms_starting_with_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_starting_with_popup_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_starting_with_popup_texts
+    {
+    setting_texts_resource = r_ms_starting_with_texts;
+    popped_up_texts_resource = r_ms_starting_with_item_texts;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_starting_with_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_ms_starting_with_editor
+    {
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_starting_with_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_starting_with_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = ECmLatest;
+            text = qtn_mserv_value_start_latest;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = ECmOldest;
+            text = qtn_mserv_value_start_oldest;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = ECmRandom;
+            text = qtn_mserv_value_random;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_starting_with_item_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_starting_with_item_texts
+    {
+    items =
+        {
+
+        LBUF { txt = qtn_mserv_value_start_latest; },
+        LBUF { txt = qtn_mserv_value_start_oldest; },
+        LBUF { txt = qtn_mserv_value_random; }
+        };
+    }
+
+/**************************** Date FROM *******************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_date_from_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_date_from_setting_page
+    {
+    label = qtn_mserv_sett_from;
+    type = EEikCtDateEditor;
+    editor_resource_id = r_ms_fill_rule_date_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_date_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DATE_EDITOR r_ms_fill_rule_date_editor
+    {
+    minDate = DATE { year=1900; };
+    maxDate = DATE { year=2050; };
+    flags=0;
+    }
+
+/**************************** Date UNTIL *******************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_date_until_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_date_until_setting_page
+    {
+    label = qtn_mserv_sett_until;
+    type = EEikCtDateEditor;
+    editor_resource_id = r_ms_fill_rule_date_editor;
+    }
+
+
+/**************************** SERVER SETTING *******************************/
+
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_servers_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_servers_setting_page
+    {
+    label = qtn_mserv_sett_source_devices;
+    type = EAknSetListBox;
+    editor_resource_id = r_ms_fill_rule_servers_editor;
+    softkey_resource = r_ms_softkeys_ok_cancel__select;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_servers_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_ms_fill_rule_servers_editor
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+
+
+/**************************** FREE TEXT *******************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_free_text_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_free_text_setting_page
+    {
+    label = qtn_mserv_sett_free_text;
+    type = EEikCtEdwin;
+    editor_resource_id = r_ms_fill_rule_free_text_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_free_text_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE EDWIN r_ms_fill_rule_free_text_editor
+    {
+    maxlength = 128;
+    lines = 2;
+    }
+
+/**************************** TRACK LENGTH *******************************/
+
+///-----------------------------------------------------------------------------
+//
+//    r_ms_track_length_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_track_length_setting_page
+    {
+    type = EAknCtPopupSettingList;
+    label = qtn_mserv_sett_track_length;
+    editor_resource_id = r_ms_track_length_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_track_length_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_ms_track_length_editor
+    {
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_track_length_popup_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_track_length_popup_texts
+    {
+    setting_texts_resource = r_ms_track_length_texts;
+    popped_up_texts_resource = r_ms_track_length_item_texts;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_track_length_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_track_length_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSTrackLenAny;
+            text = qtn_mserv_value_any_track_length;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSTrackLenLess_1;
+            text = qtn_mserv_value_less_1;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSTrackLen_16;
+            text = qtn_mserv_value_16_min;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSTrackLen_68;
+            text = qtn_mserv_value_68_min;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSTrackLen_830;
+            text = qtn_mserv_value_830_min;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSTrackLenMore_4;
+            text = qtn_mserv_value_more_4;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_track_length_item_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_track_length_item_texts
+    {
+    items =
+        {
+        LBUF { txt = qtn_mserv_value_any_track_length; },
+        LBUF { txt = qtn_mserv_value_less_1; },
+        LBUF { txt = qtn_mserv_value_16_min; },
+        LBUF { txt = qtn_mserv_value_68_min; },
+        LBUF { txt = qtn_mserv_value_830_min; },
+        LBUF { txt = qtn_mserv_value_more_4; }
+        };
+    }
+
+/**************************** FILE SIZE *******************************/
+
+///-----------------------------------------------------------------------------
+//
+//    r_ms_file_size_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_file_size_setting_page
+    {
+    type = EAknCtPopupSettingList;
+    label = qtn_mserv_sett_file_size;
+    editor_resource_id = r_ms_file_size_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_file_size_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_ms_file_size_editor
+    {
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_file_size_popup_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_file_size_popup_texts
+    {
+    setting_texts_resource = r_ms_file_size_texts;
+    popped_up_texts_resource = r_ms_file_size_item_texts;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_file_size_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_file_size_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSTrackLenAny;
+            text = qtn_mserv_value_any_file_size;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSFileSizeLess_1_mb;
+            text = qtn_mserv_value_less_1_mb;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSFileSize_15_mb;
+            text = qtn_mserv_value_15_mb;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSFileSize_510_mb;
+            text = qtn_mserv_value_510_mb;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSFileSize_1050_mb;
+            text = qtn_mserv_value_1050_mb;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSFileSizeMore_10;
+            text = qtn_mserv_value_more_50;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_file_size_item_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_file_size_item_texts
+    {
+    items =
+        {
+        LBUF { txt = qtn_mserv_value_any_file_size; },
+        LBUF { txt = qtn_mserv_value_less_1_mb; },
+        LBUF { txt = qtn_mserv_value_15_mb; },
+        LBUF { txt = qtn_mserv_value_510_mb; },
+        LBUF { txt = qtn_mserv_value_1050_mb; },
+        LBUF { txt = qtn_mserv_value_more_50; }
+        };
+    }
+
+/**************************** MIN FILE SIZE *****************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_min_file_size_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_min_file_size_setting_page
+    {
+    label = qtn_mserv_sett_file_size_min;
+    type = EAknCtPopupSettingList;
+    editor_resource_id = r_ms_fill_rule_file_size_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_file_size_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_ms_fill_rule_file_size_editor
+    {
+    }
+
+/**************************** MAX FILE SIZE *********************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_rule_max_file_size_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_max_file_size_setting_page
+    {
+    label = qtn_mserv_sett_file_size_max;
+    type = EAknCtPopupSettingList;
+    editor_resource_id = r_ms_fill_rule_file_size_editor;
+    }
+
+/**************************** STORE LIST RULES ****************************/
+/**************************************************************************/
+
+
+/**************************** STORE SERVERS  ****************************/
+
+//----------------------------------------------------
+//
+//    r_ms_store_settings_list
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_ITEM_LIST r_ms_store_settings_list
+  {
+  flags= EAknSettingItemIncludeHiddenInOrdinal;
+  initial_number = 1;
+  items =
+    {
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSSourceServers;
+      setting_page_resource = r_ms_store_settings_location_setting_page;
+      name = qtn_mserv_item_target_devices;
+      },
+    AVKON_SETTING_ITEM
+      {
+      identifier = EMSKeepOnPhone;
+      setting_page_resource = r_ms_store_list_keep_on_phone_setting_page;
+      associated_resource = r_ms_store_list_keep_on_phone_popup_texts;
+      name = qtn_mserv_item_local_copy;
+      }
+    };
+  }
+
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_settings_location_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_store_settings_location_setting_page
+    {
+    label = qtn_mserv_sett_target_devices;
+    type = EAknSetListBox;
+    editor_resource_id = r_ms_store_settings_source_editor;
+    softkey_resource = r_ms_softkeys_ok_cancel__select;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_settings_source_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_ms_store_settings_source_editor
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+
+
+/**************************** KEEP ON PHONE ****************************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_list_keep_on_phone_setting_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_ms_store_list_keep_on_phone_setting_page
+    {
+    label = qtn_mserv_item_local_copy;
+    type = EAknCtPopupSettingList;
+    editor_resource_id = r_ms_store_list_keep_on_phone_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_list_keep_on_phone_popup_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_store_list_keep_on_phone_popup_texts
+    {
+    setting_texts_resource = r_ms_keep_on_phone_texts;
+    popped_up_texts_resource = r_ms_keep_on_phone_item_texts;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_keep_on_phone_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_keep_on_phone_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSDontKeep;
+            text = qtn_mserv_item_no_local;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSKeep;
+            text = qtn_mserv_item_yes_local;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSKeepOriginalSize;
+            text = qtn_mserv_item_original_size;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSKeepScreenSize;
+            text = qtn_mserv_item_screen_size;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_item_texts
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_keep_on_phone_item_texts
+    {
+    items =
+        {
+        LBUF { txt = qtn_mserv_item_no_local; },
+        LBUF { txt = qtn_mserv_item_yes_local; },
+        LBUF { txt = qtn_mserv_item_original_size; },
+        LBUF { txt = qtn_mserv_item_screen_size; }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_list_keep_on_phone_editor
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_ms_store_list_keep_on_phone_editor
+    {
+    }
+
+
+/**************************** QUERIES *********************************/
+/**********************************************************************/
+
+
+//-----------------------------------------------------------------------------
+//
+//    r_mserv_template_query
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_mserv_template_query
+    {
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                heading = " "; // defined dynamically
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    // array items defined dynamically
+                    };
+                };
+            }
+        };
+    }
+
+
+//-----------------------------------------------------------------------------
+//
+//    r_mserv_delete_files_query
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mserv_delete_files_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationQueryLayout;
+                label = qtn_mserv_lists_edited;
+                };
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_mserv_delete_list_query
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mserv_delete_list_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationQueryLayout;
+                label = qtn_mserv_conf_delete_list;
+                };
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_mserv_data_query
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mserv_data_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EMSDataQueryId;
+            control = AVKON_DATA_QUERY
+                {
+                layout = ENumberLayout;
+                control = AVKON_INTEGER_EDWIN
+                    {
+                    min = 0;
+                    max = 32767;
+                    };
+                };
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_mserv_time_query
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mserv_time_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_DATA_QUERY
+                {
+                layout = ETimeLayout;
+                control = TIME_EDITOR
+                    {
+                    minTime = TIME{minute=0;hour=0;};
+                    maxTime = TIME{minute=59;hour=23;};
+                    };
+                };
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_mserv_mmc_query
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mserv_mmc_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationQueryLayout;
+                label = qtn_mserv_conf_used_memory;
+                };
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_mserv_video_rule_query
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mserv_video_rule_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationQueryLayout;
+                label = qtn_mserv_qry_add_video_date;
+                };
+            }
+        };
+    }
+	
+//-----------------------------------------------------------------------------
+//
+//    r_main_sync_now_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_main_sync_now_text
+    {
+    buf = qtn_mserv_sync_now;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_main_stop_sync_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_main_stop_sync_text
+    {
+    buf = qtn_mserv_sync_stop;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_main_to_home_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_main_to_home_text
+    {
+    buf = qtn_mserv_to_home;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_main_from_home_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_main_from_home_text
+    {
+    buf = qtn_mserv_from_home;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_view_title
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_fill_view_title
+    {
+    buf = qtn_mserv_title_from_home;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_list_view_title
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_store_list_view_title
+    {
+    buf = qtn_mserv_title_to_home;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_navi_sync_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_navi_sync_text
+    {
+    buf = qtn_mserv_navi_sync;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_navi_refreshing_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_navi_refreshing_text
+    {
+    buf = qtn_mserv_navi_refreshing;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_add_rule_query_heading
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_add_rule_query_heading
+    {
+    buf = qtn_mserv_head_add_rule;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_edit_image_rule_view_title
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_edit_image_rule_view_title
+    {
+    buf = qtn_mserv_title_edit_rules_image;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_edit_video_rule_view_title
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_edit_video_rule_view_title
+    {
+    buf = qtn_mserv_title_edit_rules_video;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_edit_music_rule_view_title
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_edit_music_rule_view_title
+    {
+    buf = qtn_mserv_title_edit_rules_music;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_amount_query_heading
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_amount_query_heading
+    {
+    buf = qtn_mserv_head_amount_count;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_size_query_heading
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_size_query_heading
+    {
+    buf = qtn_mserv_head_amount_mb;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_amount_unlimited
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_amount_unlimited
+    {
+    buf = qtn_mserv_value_amount_unlimited;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_amount_mb_number
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_amount_mb_number
+    {
+    buf = qtn_mserv_value_amount_mb_list;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_amount_mb_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_amount_mb_page
+    {
+    buf = qtn_mserv_value_amount_mb;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_amount_count_page
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_amount_count_page
+    {
+    buf = qtn_mserv_value_amount_count;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_amount_one_item
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_amount_one_item
+    {
+    buf = qtn_mserv_value_amount_item_1_list;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_amount_0_items
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_amount_0_items
+    {
+    buf = qtn_mserv_value_amount_item_0_list;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_amount_count_number
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_amount_count_number
+    {
+    buf = qtn_mserv_value_amount_item_list;
+    }
+
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_name_setting
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_name_setting
+    {
+    buf = qtn_mserv_sett_name;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_genre_setting
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_genre_setting
+    {
+    buf = qtn_mserv_sett_genre;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_artist_setting
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_artist_setting
+    {
+    buf = qtn_mserv_sett_artist;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_album_setting
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_album_setting
+    {
+    buf = qtn_mserv_sett_album;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_track_setting
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_track_setting
+    {
+    buf = qtn_mserv_sett_track;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_file_size_item_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_file_size_item_text
+    {
+    buf = qtn_mserv_min_list;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_min_file_size_page_item_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_min_file_size_page_item_text
+    {
+    buf = qtn_mserv_value_min_mb;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_max_file_size_page_item_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_max_file_size_page_item_text
+    {
+    buf = qtn_mserv_value_max_mb;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_all_in_sync_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_all_in_sync_text
+    {
+    buf = qtn_mserv_in_sync;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_one_new_item_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_sync_one_new_item_text
+    {
+    buf = qtn_mserv_one_item;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_new_items_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_sync_new_items_text
+    {
+    buf = qtn_mserv_new_items;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_time_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_sync_time_text
+    {
+    buf = qtn_mserv_sync_time;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_time_one_min_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_sync_time_one_min_text
+    {
+    buf = qtn_mserv_sync_time_one;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_sync_waiting_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_sync_waiting_text
+    {
+    buf = qtn_mserv_waiting_sync;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_title_item_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_title_item_text
+    {
+    buf = qtn_mserv_n_names;
+    }
+
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_genre_item_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_genre_item_text
+    {
+    buf = qtn_mserv_n_genre;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_genre_item_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_artist_item_text
+    {
+    buf = qtn_mserv_n_artists;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_genre_album_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_album_item_text
+    {
+    buf = qtn_mserv_n_album;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_genre_track_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_track_item_text
+    {
+    buf = qtn_mserv_n_tracks;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_list_any_name
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_list_any_name
+    {
+    buf = qtn_mserv_value_list_any_name;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_any_name
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_any_name
+    {
+    buf = qtn_mserv_value_any_name;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_any_file_size
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_any_file_size
+    {
+    buf = qtn_mserv_value_any_file_size;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_list_any_genre
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_list_any_genre
+    {
+    buf = qtn_mserv_value_list_any_genre;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_any_genre
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_any_genre
+    {
+    buf = qtn_mserv_value_any_genre;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_list_any_artist
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_list_any_artist
+    {
+    buf = qtn_mserv_value_list_any_artist;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_any_artist
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_any_artist
+    {
+    buf = qtn_mserv_value_any_artist;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_list_any_album
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_list_any_album
+    {
+    buf = qtn_mserv_value_list_any_album;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_any_album
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_any_album
+    {
+    buf = qtn_mserv_value_any_album;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_list_any_track
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_list_any_track
+    {
+    buf = qtn_mserv_value_list_any_track;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_any_track
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_any_track
+    {
+    buf = qtn_mserv_value_any_track;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_list_any_source_device
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_list_any_source_device
+    {
+    buf = qtn_mserv_value_list_any_source_device;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_value_any_source_device
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_value_any_source_device
+    {
+    buf = qtn_mserv_value_any_source_device;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_n_items_to_be_synced
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_n_items_to_be_synced
+    {
+    buf = qtn_mserv_navi_new_items;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_1_item_to_be_synced
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_1_item_to_be_synced
+    {
+    buf = qtn_mserv_navi_one_new_item;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_no_items_to_be_synced
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_no_items_to_be_synced
+    {
+    buf = qtn_mserv_navi_no_new_items;
+    }
+        
+//-----------------------------------------------------------------------------
+//
+//    r_ms_navi_list_size
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_navi_list_size
+    {
+    buf = qtn_mserv_navi_list_size;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_browse_navi_items
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_store_browse_navi_items
+    {
+    buf = qtn_mserv_navi_items_store_browse;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_browse_navi_1_item
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_store_browse_navi_1_item
+    {
+    buf = qtn_mserv_navi_items_store_browse1;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_browse_navi_0_items
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_store_browse_navi_0_items
+    {
+    buf = qtn_mserv_navi_items_store_browse_none;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_list_browse_navi_items
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_fill_list_browse_navi_items
+    {
+    buf = qtn_mserv_navi_items_fill_list;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_list_browse_navi_1_item
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_fill_list_browse_navi_1_item
+    {
+    buf = qtn_mserv_navi_items_fill_list1;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_list_browse_navi_0_items
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_fill_list_browse_navi_0_items
+    {
+    buf = qtn_mserv_navi_items_fill_list_no_items;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_navi_many_items
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_navi_many_items
+    {
+    buf = qtn_mserv_navi_rules_amount;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_navi_1_item
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_navi_1_item
+    {
+    buf = qtn_mserv_navi_rules_amount1;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_rule_navi_0_items
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_rule_navi_0_items
+    {
+    buf = qtn_mserv_navi_rules_amount0;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_wait_randomize
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_wait_randomize
+    {
+    buf = qtn_mserv_wait_randomize;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_wait_getting_data_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_wait_getting_data_text
+    {
+    buf = qtn_mserv_wait_getting_data;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_default_store_list_1
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_default_store_list_1
+    {
+    buf = qtn_mserv_store_check_phone_images;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_default_store_list_2
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_default_store_list_2
+    {
+    buf = qtn_mserv_store_check_other_images;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_default_store_list_3
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_default_store_list_3
+    {
+    buf = qtn_mserv_store_check_phone_videos;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_default_store_list_4
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_default_store_list_4
+    {
+    buf = qtn_mserv_store_check_other_videos;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_default_store_list_5
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_default_store_list_5
+    {
+    buf = qtn_mserv_store_check_music;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_title_phone_images
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_store_title_phone_images
+    {
+    buf = qtn_mserv_title_phone_images;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_title_images
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_store_title_images
+    {
+    buf = qtn_mserv_title_other_images;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_title_phone_videos
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_store_title_phone_videos
+    {
+    buf = qtn_mserv_title_phone_videos;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_title_videos
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_store_title_videos
+    {
+    buf = qtn_mserv_title_other_videos;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_store_title_music
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_store_title_music
+    {
+    buf = qtn_mserv_title_music;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_no_selected_items
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_no_selected_items
+    {
+    buf = qtn_selec_sett_val_field_none;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_item_devices
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_item_devices
+    {
+    buf = qtn_mserv_n_servers;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_access_error_note
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_access_error_note
+    {
+    buf = qtn_mserv_access_error;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_access_error_note_sync
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_access_error_note_sync
+    {
+    buf = qtn_mserv_access_error_sync;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_error_memory_full
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_error_memory_full
+    {
+    buf = qtn_memlo_not_enough_memory;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_text_target_device_needed
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_text_target_device_needed
+    {
+    buf = qtn_mserv_no_target_devices;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_last_sync_min
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_last_sync_min
+    {
+    buf = qtn_mserv_navi_last_sync_min_one;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_last_sync_mins
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_last_sync_mins
+    {
+    buf = qtn_mserv_navi_last_sync_min;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_last_sync_hour
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_last_sync_hour
+    {
+    buf = qtn_mserv_navi_last_sync_hour_one;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_last_sync_hours
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_last_sync_hours
+    {
+    buf = qtn_mserv_navi_last_sync_hour;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_last_sync_day
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_last_sync_day
+    {
+    buf = qtn_mserv_navi_last_sync_day_one;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_last_sync_days
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_last_sync_days
+    {
+    buf = qtn_mserv_navi_last_sync_day;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_fill_view_title_reorder_mode
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_fill_view_title_reorder_mode
+    {
+    buf = qtn_mserv_title_reorder;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_preprocessing_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_preprocessing_text
+    {
+    buf = qtn_mserv_wait_preprocessing;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_default_fill_list_1
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_default_fill_list_1
+    {
+    buf = qtn_mserv_def_latest_org;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_default_fill_list_2
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_default_fill_list_2
+    {
+    buf = qtn_mserv_def_latest_videos;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_default_fill_list_3
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_default_fill_list_3
+    {
+    buf = qtn_mserv_def_recent_music;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_memory_card_needed_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_memory_card_needed_text
+    {
+    buf = qtn_mserv_memory_card_needed;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_insert_memory_card_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_insert_memory_card_text
+    {
+    buf = qtn_mserv_mcard_error;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_error_devices_not_found
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_error_devices_not_found
+    {
+    buf = qtn_mserv_error_not_found;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_error_sync_interrupted
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_error_sync_interrupted
+    {
+    buf = qtn_mserv_error_sync_interrupted;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_file_size_mb
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_file_size_mb
+    {
+    buf = qtn_size_mb;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_file_size_kb
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_file_size_kb
+    {
+    buf = qtn_size_kb;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_plugin_listbox_primary_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_plugin_listbox_primary_text
+    {
+    buf = qtn_mserv_grid_media_servant_home_media;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_plugin_text_auto_sync
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_plugin_text_auto_sync
+    {
+    buf = qtn_mserv_main_sync_auto;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_plugin_synchronizing
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_plugin_synchronizing
+    {
+    buf = qtn_mserv_main_sync;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_plugin_harvesting
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_plugin_harvesting
+    {
+    buf = qtn_mserv_main_refreshing;
+    }
+        
+//-----------------------------------------------------------------------------
+//
+//    r_ms_plugin_listbox_secondary_text_1
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_plugin_text_manual_sync
+    {
+    buf = qtn_mserv_main_sync_manual;
+    }
+	
+//-----------------------------------------------------------------------------
+//
+//    r_ms_custom_list_image_name
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_custom_list_image_name
+    {
+    buf = qtn_mserv_options_new_image;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_custom_list_video_name
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_custom_list_video_name
+    {
+    buf = qtn_mserv_options_new_video;
+    }	
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_custom_list_music_name
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_custom_list_music_name
+    {
+    buf = qtn_mserv_options_new_music;
+    }
+	
+//-----------------------------------------------------------------------------
+//
+//    r_ms_list_nothing_selected
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_list_nothing_selected
+    {
+    buf = qtn_mserv_nothing_selected;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_navi_content_refreshed
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ms_navi_content_refreshed
+    {
+    buf = qtn_mserv_navi_refresh_completed;
+    }
+        	
+// CBA definitions
+
+//-----------------------------------------------------------------------------
+//
+//    r_ms_softkeys_options_done__change
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_ms_softkeys_options_done__change
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;    // left sk
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyDone;       // right sk
+            txt = text_softkey_done;
+            },
+        CBA_BUTTON
+            {
+            id = EAknCmdOpen;           // middle sk
+            txt = qtn_options_change;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+//    r_softkeys_drop_empty
+// ---------------------------------------------------------------------------
+RESOURCE CBA r_softkeys_drop_empty
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EMSCmdDrop;
+            txt = qtn_mserv_skey_drop;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+//    r_softkeys_grab_done
+// ---------------------------------------------------------------------------
+RESOURCE CBA r_softkeys_grab_done
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EMSCmdGrab;
+            txt = qtn_mserv_skey_grab;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyDone;
+            txt = text_softkey_done;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//    r_ms_softkeys_options_empty
+// --------------------------------------------------------------------------
+RESOURCE CBA r_ms_softkeys_options_empty
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//    r_ms_softkeys_options_back__toggle
+// --------------------------------------------------------------------------
+RESOURCE CBA r_ms_softkeys_options_back__toggle
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;    // left sk
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyBack;       // right sk
+            txt = text_softkey_back;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyForwardKeyEvent; // middle softkey
+            }
+        };
+    }
+
+
+// --------------------------------------------------------------------------
+//    r_ms_softkeys_options_back__deactivate
+// --------------------------------------------------------------------------
+RESOURCE CBA r_ms_softkeys_options_back__deactivate
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;            // left sk
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyBack;               // right sk
+            txt = text_softkey_back;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyForwardKeyEvent;    // middle sk
+            txt = qtn_mserv_msk_unselect;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//    r_ms_softkeys_options_back__activate
+// --------------------------------------------------------------------------
+RESOURCE CBA r_ms_softkeys_options_back__activate
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;            // left sk
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyBack;               // right sk
+            txt = text_softkey_back;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyForwardKeyEvent;    // middle sk
+            txt = qtn_msk_select;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//    r_ms_softkeys_ok_cancel__change
+// --------------------------------------------------------------------------
+RESOURCE CBA r_ms_softkeys_ok_cancel__change
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOk;                 // left sk
+            txt = text_softkey_ok;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;             // right sk
+            txt = text_softkey_cancel;
+            }
+#ifndef __SERIES60_31__
+            ,
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyChange;             // middle sk
+            bmpfile=""APP_RESOURCE_DIR"\\avkon2.mif";
+            bmpid=EMbmAvkonQgn_prop_msk_select;
+            bmpmask=EMbmAvkonQgn_prop_msk_select_mask;
+            }
+#endif
+        };
+    }
+
+// --------------------------------------------------------------------------
+//    r_ms_softkeys_ok_cancel__select
+// --------------------------------------------------------------------------
+RESOURCE CBA r_ms_softkeys_ok_cancel__select
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOk;                 // left sk
+            txt = text_softkey_ok;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;             // right sk
+            txt = text_softkey_cancel;
+            }
+#ifndef __SERIES60_31__
+            ,
+        CBA_BUTTON
+            {
+            id = EAknSoftkeySelect;
+            }
+#endif
+        };
+    }
+
+// --------------------------------------------------------------------------
+//    r_ms_softkeys_options_back__open
+// --------------------------------------------------------------------------
+RESOURCE CBA r_ms_softkeys_options_back__open
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;            // left sk
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyBack;               // right sk
+            txt = text_softkey_back;
+            }
+#ifndef __SERIES60_31__
+            ,
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOpen;               // middle sk
+            txt = text_softkey_open;
+            }
+#endif
+        };
+    }
+
+/*********************** DEFAULT LIST RULES ***********************/
+
+// ---------------------------------------------------------------------------
+//    r_ms_default_image_list_rules
+// ---------------------------------------------------------------------------
+//
+RESOURCE TEMPLATE_ITEMS r_ms_default_image_list_rules
+    {
+    items =
+        {
+        FILL_RULE { item = EMSAmount; value = 50; addinfo = EMbits; },
+        FILL_RULE { item = EMSStartingWith; value = ECMLatest; },
+        FILL_RULE { item = EMSShrinkImages; value = EMSShrinkingOff; },
+		FILL_RULE { item = EMSDateFrom; },
+        FILL_RULE { item = EMSDateUntil; }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+//    r_ms_default_video_list_rules
+// ---------------------------------------------------------------------------
+//
+RESOURCE TEMPLATE_ITEMS r_ms_default_video_list_rules
+    {
+    items =
+        {
+        FILL_RULE { item = EMSAmount;  value = 50; addinfo = EMbits; },
+        FILL_RULE { item = EMSStartingWith; value = ECMLatest; },
+        FILL_RULE { item = EMSTitleName; },
+        FILL_RULE { item = EMSMinFileSize; },
+        FILL_RULE { item = EMSMaxFileSize; }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+//    r_ms_default_music_list_rules
+// ---------------------------------------------------------------------------
+//
+RESOURCE TEMPLATE_ITEMS r_ms_default_music_list_rules
+    {
+    items =
+        {
+        FILL_RULE { item = EMSAmount; value = 200; addinfo = EMbits;},
+        FILL_RULE { item = EMSStartingWith; value = ECMLatest; },
+        FILL_RULE { item = EMSGenre; },
+        FILL_RULE { item = EMSArtist; },
+        FILL_RULE { item = EMSAlbum; },
+        FILL_RULE { item = EMSTrack; }
+        };
+    }
+
+/*********************** RULES ***************************/
+
+// ---------------------------------------------------------------------------
+//    r_ms_image_rule_list
+// ---------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_image_rule_list
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSServers;
+            text = qtn_mserv_rule_storage;
+        },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSFreeText;
+            text = qtn_mserv_rule_free_text;
+            }
+        };
+    }
+
+
+// ---------------------------------------------------------------------------
+//    r_ms_video_rule_list
+// ---------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_video_rule_list
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSServers;
+            text = qtn_mserv_rule_storage;
+        },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSFreeText;
+            text = qtn_mserv_rule_free_text;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSDateFrom;
+            text = qtn_mserv_rule_from;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSDateUntil;
+            text = qtn_mserv_rule_until;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+//    r_ms_music_rule_list
+// ---------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ms_music_rule_list
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSServers;
+            text = qtn_mserv_rule_storage;
+        },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSFreeText;
+            text = qtn_mserv_rule_free_text;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSTrackLength;
+            text = qtn_mserv_rule_track_length;
+            },
+        AVKON_ENUMERATED_TEXT
+            {
+            value = EMSFileSize;
+            text = qtn_mserv_rule_file_size;
+            }
+        };
+    }
+
+
+/************** FOR DEBUGGING **************/
+
+//-----------------------------------------------------------------------------
+//
+//    r_active_object_error_note_text
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_active_error_note_text
+    {
+    buf = "Failed with error: ";
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/data/mediaservant_reg.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project MediaServant
+*
+*/
+
+
+#include <appinfo.rh>                    // APP_REGISTRATION_INFO.
+#include <data_caging_paths_strings.hrh> // APP_RESOURCE_DIR.
+#include <mediaservant.rsg>              // R_LOCALISABLE_APP_INFO.
+#include "mediaservantuid.h"
+
+UID2 KUidAppRegistrationResourceFile
+UID3 KMediaServantUID3
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "MediaServant"; // Filename of application binary (without extension).
+    localisable_resource_file = APP_RESOURCE_DIR"\\MediaServant";
+    localisable_resource_id = R_LOCALISABLE_APP_INFO;
+    hidden = KAppIsHidden;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project MediaServant
+*
+*/
+
+
+#include "../../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+//  Help exports
+#include "../help/group/bld.inf"
+
+PRJ_EXPORTS
+../inc/msconstants.h |../../../../inc/msconstants.h
+// LOC export
+UPNP_LOC_EXPORT(mediaservant.loc)
+
+PRJ_MMPFILES
+
+mediaservant.mmp
+#include "../plugin/group/bld.inf"
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mediaservant.mif
+OPTION HEADERFILE mediaservant.mbg
+OPTION SOURCEDIR ../bitmaps
+OPTION SOURCEFILE iconlist.txt
+END
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE MediaServant_aif.mif
+OPTION SOURCEDIR ../aif
+OPTION SOURCES -c8,8 qgn_mserv_app_context_icon
+END
+
+PRJ_TESTMMPFILES
+
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/group/iconlist.txt	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+-c8,8 qgn_mserv_app_menu_icon.svg
+-c8,8 qgn_mserv_context_icon.svg
+-c8,8 qgn_mserv_fill_small.svg
+-c8,8 qgn_mserv_from_home.svg
+-c8,8 qgn_mserv_from_home_inactive.svg
+-c8,8 qgn_mserv_image_list_small.svg
+-c8,8 qgn_mserv_music.svg
+-c8,8 qgn_mserv_music_list_small.svg
+-c8,8 qgn_mserv_other_images.svg
+-c8,8 qgn_mserv_other_videos.svg
+-c8,8 qgn_mserv_partial_icon.svg
+-c8,8 qgn_mserv_partial_note_icon.svg
+-c8,8 qgn_mserv_phone_images.svg
+-c8,8 qgn_mserv_phone_videos.svg
+-c8,8 qgn_mserv_red_check.svg
+-c8,8 qgn_mserv_red_uncheck.svg
+-c8,8 qgn_mserv_removed_small.svg
+-c8,8 qgn_mserv_skipped_small.svg
+-c8,8 qgn_mserv_store_small.svg
+-c8,8 qgn_mserv_sync.svg
+-c8,8 qgn_mserv_sync_stop.svg
+-c8,8 qgn_mserv_to_home.svg
+-c8,8 qgn_mserv_to_home_inactive.svg
+-c8,8 qgn_mserv_unavailable_small.svg
+-c8,8 qgn_mserv_white_check.svg
+-c8,8 qgn_mserv_white_uncheck.svg
+-c8,8 qgn_mserv_video_list_small.svg
+-c8,8 qgn_mserv_yellow_check.svg
+-c8,8 qgn_mserv_yellow_uncheck.svg
+-c8,8 qgn_prop_file_audio.svg
+-c8,8 qgn_prop_file_video.svg
+-c8,8 qgn_prop_file_image.svg
+-c8,8 qgn_prop_skipped.svg
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/group/mediaservant.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project MediaServant
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../inc/mediaservantuid.h"
+
+TARGET                  mediaservant.exe
+TARGETTYPE              exe
+UID                     0x100039CE KMediaServantUID3
+
+// Minimum heap size 4kB, maximum heap size 8MB, stack size 32kB
+EPOCHEAPSIZE   4096 8388608
+EPOCSTACKSIZE  32768
+
+CAPABILITY              CAP_APPLICATION
+VENDORID                VID_DEFAULT
+
+USERINCLUDE             .
+USERINCLUDE             ../inc
+USERINCLUDE             ../help/inc
+USERINCLUDE             ../applicationengine/inc
+
+APP_LAYER_SYSTEMINCLUDE
+USERINCLUDE           ../../../../inc
+
+SOURCEPATH              ../src
+SOURCE                  msapp.cpp
+SOURCE                  msappui.cpp
+SOURCE                  msdocument.cpp
+SOURCE                  msbaseview.cpp
+SOURCE                  msmainview.cpp
+SOURCE                  msbasecontainer.cpp
+SOURCE                  msmaincontainer.cpp
+
+SOURCE                  msfillrulecontroller.cpp
+SOURCE                  msfillview.cpp
+SOURCE                  msfillcontainer.cpp
+SOURCE                  msfillruleeditview.cpp
+SOURCE                  msfillruleeditlist.cpp
+SOURCE                  msruleamountsetting.cpp
+SOURCE                  msrulemultiselectionsetting.cpp
+SOURCE                  msrulefilesizesetting.cpp
+SOURCE                  msruleserverssetting.cpp
+SOURCE                  msmultiselectiondialog.cpp
+
+SOURCE                  msstorelistcontroller.cpp
+SOURCE                  msstorelistview.cpp
+SOURCE                  msstorelistcontainer.cpp
+SOURCE                  msstoresettingsview.cpp
+SOURCE                  msstoresettingslist.cpp
+SOURCE                  msstoreserverssetting.cpp
+SOURCE                  msstorekeeponphonesetting.cpp
+
+SOURCE                  msparameteragent.cpp
+SOURCE                  mspropertywatcher.cpp
+
+SOURCE                  msitembrowser.cpp
+SOURCE                  msbrowseview.cpp
+SOURCE                  msbrowsecontainer.cpp
+SOURCE                  msfillbrowseview.cpp
+SOURCE                  msfillbrowsecontainer.cpp
+
+SOURCE                  msmultiselectionsettingpage.cpp
+SOURCE                  mssettingitems.cpp
+SOURCE                  msmemorycardmonitor.cpp
+SOURCE                  msmetadatacollector.cpp
+
+
+START RESOURCE          ../data/mediaservant.rss
+HEADER
+TARGETPATH              APP_RESOURCE_DIR
+LANGUAGE_IDS
+END // RESOURCE
+
+LIBRARY euser.lib apparc.lib cone.lib PlatformEnv.lib
+LIBRARY avkon.lib bafl.lib eikcore.lib eikcoctl.lib eikctl.lib
+LIBRARY AKNSKINS.lib
+LIBRARY egul.lib
+LIBRARY AknIcon.lib
+LIBRARY CommonEngine.lib
+LIBRARY msengine.lib
+LIBRARY cmcommon.lib
+LIBRARY efsrv.lib               // file server
+LIBRARY flogger.lib
+LIBRARY hlplch.lib              // help
+LIBRARY eikdlg.lib              // multiselection dialog
+LIBRARY upnpipserversutils.lib  // UPnPString
+LIBRARY msappwizard.lib         // for app wizard
+LIBRARY cmsettingsengine.lib    // drive settings
+LIBRARY charconv.lib            // ConvertToUnicodeFromUtf8
+
+// upnp
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         AVControlFramework.lib
+LIBRARY         upnpserviceframework.lib
+
+// ECom
+LIBRARY         ecom.lib
+
+#ifdef __CLEANUP_SUPPORT
+
+LIBRARY SQLiteClient.lib
+#endif // __CLEANUP_SUPPORT
+
+START RESOURCE          ../data/mediaservant_reg.rss
+DEPENDS mediaservant.rsg
+// Do not change the UID 10003a3f below.
+TARGETPATH /private/10003a3f/apps
+END
Binary file homesync/contentmanager/mediaservant/help/data/xhtml.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/help/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+* 
+* Contributors:
+* 
+* 
+* Description:
+* Export help related files.
+*
+*/
+
+#include <platform_paths.hrh>				
+PRJ_EXPORTS
+:zip ../data/xhtml.zip   /epoc32/data/z/resource/ overwrite
+:zip ../data/xhtml.zip   /epoc32/winscw/c/resource/ overwrite
+
+../inc/mserv.hlp.hrh	MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/mserv.hlp.hrh)
+../rom/mediaservanthelps_variant.iby		CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(mediaservanthelps_variant.iby)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/help/inc/mserv.hlp.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Help header for project Media Servant
+*
+*/
+	
+// mserv.hlp.hrh
+// 
+
+//
+// File generated by CSXHelp Utilities on 2009-04-17
+// 
+
+#ifndef __MSERV_HLP_HRH__
+#define __MSERV_HLP_HRH__
+
+_LIT(KMSERV_HLP_FILL_BROWSE, "MSERV_HLP_FILL_BROWSE"); // 
+_LIT(KMSERV_HLP_FILE_BROWSE, "MSERV_HLP_FILE_BROWSE"); // 
+_LIT(KMSERV_HLP_FILL_LIST, "MSERV_HLP_FILL_LIST"); // 
+_LIT(KMSERV_HLP_EDIT_RULES, "MSERV_HLP_EDIT_RULES"); // 
+_LIT(KMSERV_HLP_MAIN_VIEW, "MSERV_HLP_MAIN_VIEW"); // 
+_LIT(KMSERV_HLP_STORE_LIST, "MSERV_HLP_STORE_LIST"); // 
+_LIT(KMSERV_HLP_STORE_SETTINGS, "MSERV_HLP_STORE_SETTINGS"); // 
+_LIT(KMSERV_HLP_SYNC_SETTINGS, "MSERV_HLP_SYNC_SETTINGS"); // 
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/help/rom/mediaservanthelps_variant.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: mediaservanthelps_variant.iby
+*
+*/
+
+#ifndef __MEDIASERVANTHELPS_VARIANT_IBY__
+#define __MEDIASERVANTHELPS_VARIANT_IBY__
+
+#if defined(FF_S60_HELPS_IN_USE)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x1028290B\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x1028290B\contents.zip)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x1028290B\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x1028290B\index.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x1028290B\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x1028290B\keywords.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x1028290B\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x1028290B\meta.xml)
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/mediaservant.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project Media Servant
+*
+*/
+
+
+#ifndef MEDIASERVANT_HRH
+#define MEDIASERVANT_HRH
+
+enum TMSCommandIds
+    {
+    EMSCmdSelect = 1,
+    EMSCmdStartHarvest,
+    EMSCmdStopHarvest,
+    EMSCmdSettings,
+    EMSCmdRunWizard,
+    EMSCmdActivate,
+    EMSCmdDeActivate,
+    EMSCmdEditRule,
+    EMSCmdBrowse,
+    EMSCmdReorder,
+    EMSCmdDrop,
+    EMSCmdGrab,
+    EMSCmdDelete,
+    EMSCmdNewImageList,
+    EMSCmdNewVideoList,
+    EMSCmdNewMusicList,
+    EMSCmdRemoveRule
+    };
+
+enum TMSStoreListCommands
+    {
+    EMSStoreCmdActivate = 1,
+    EMSStoreCmdDeActivate,
+    EMSStoreCmdEdit
+    };
+
+enum TMSFillBrowseCommands
+    {
+
+    EMSCmdLock = 1,
+    EMSCmdUnLock,
+    EMSCmdRandomize,
+    EMSCmdMark
+    };
+
+enum TMSListboxItems
+    {
+    EStoreAndFill = 0,
+    EFillToPhone,
+    EStoreToNetwork
+    };
+
+enum TMSFillEditItems
+    {
+    EMSListName = 0,
+    EMSShrinkImages,
+    EMSAmount,
+    EMSStartingWith,
+    EMSDateFrom,
+    EMSDateUntil,
+    EMSServers,
+    EMSFreeText,
+    EMSTitleName,
+    EMSMinFileSize,
+    EMSMaxFileSize,
+    EMSGenre,
+    EMSArtist,
+    EMSAlbum,
+    EMSTrack,
+    EMSTrackLength,
+    EMSFileSize,
+    EMSAddMoreRules
+    };
+
+enum TMSStoreListListboxItems
+    {
+    EMSStoreImages = 0,
+    EMSStoreOtherImages,
+    EMSStorePhoneVideos,
+    EMSStoreOtherVideos,
+    EMSStoreMusic
+    };
+
+enum TMSStoreSettingsItems
+    {
+    EMSSourceServers = 0,
+    EMSKeepOnPhone
+    };
+
+enum TMSStoreKeepOnPhone
+    {
+    EMSDontKeep = 0,
+    EMSKeep,
+    EMSKeepOriginalSize,
+    EMSKeepScreenSize
+    };
+
+enum TMSReorderState
+    {
+    EMSFillNormal,
+    EMSFillReorderActive,
+    EMSFillGrabActive
+    };
+
+enum TMSTrackLengthStates
+    {
+    EMSTrackLenAny = 0,
+    EMSTrackLenLess_1,
+    EMSTrackLen_16,
+    EMSTrackLen_68,
+    EMSTrackLen_830,
+    EMSTrackLenMore_4
+    };
+
+enum TMSFileSizeStates
+    {
+    EMSFileSizeAny = 0,
+    EMSFileSizeLess_1_mb,
+    EMSFileSize_15_mb,
+    EMSFileSize_510_mb,
+    EMSFileSize_1050_mb,
+    EMSFileSizeMore_10
+    };
+
+enum TMSFileSizeSettingItems
+    {
+    EMSAny = 0,
+    EMSSetSize
+    };
+
+enum TMSFillListTemplates
+    {
+    EMSNoTemplate = 0,
+    EMSDefaultImageList,
+    EMSDefaultVideoList,
+    EMSDefaultMusicList,
+    EMSImageTemplateLatestImages,
+    EMSImageTemplateMyPhoneCaptures,
+    EMSImageTemplateLatest,
+    EMSImageTemplateLatestOriginals,
+    EMSImageTemplateCustom,
+    EMSVideoTemplateLatest,
+    EMSVideoTemplateSelectedVideos,
+    EMSVideoTemplateLatestEpisodes,
+    EMSVideoTemplateCustom,
+    EMSMusicTemplateRecentMusic,
+    EMSMusicTemplateSelectedAlbums,
+    EMSMusicTemplateSelectedTracks,
+    EMSMusicTemplateSelectedArtist,
+    EMSMusicTemplateRandom,
+    EMSMusicTemplateCustom
+    };
+
+// Rule edit list items
+
+enum TMSShrinkImages
+    {
+    EMSShrinkScreenSize = 0,
+    EMSShrinkingOff
+    };
+
+enum TMSMultiselectionDialog
+    {
+    EMultiSelectionListBoxId = 1
+    };
+
+// Queries
+enum TMSQueryID
+    {
+    EMSDataQueryId = 1
+    };
+
+// Browse
+enum TMSBrowseTarget
+    {
+    EMSStoredItems = 0,
+    EMSFillItems,
+    EMSLog
+    };
+#endif      // MEDIASERVANT_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/mediaservantuid.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UID definition for Media Servant
+*
+*/
+
+
+#ifndef __MEDIASERVANTUID_H
+#define __MEDIASERVANTUID_H
+
+//  INCLUDES
+
+// CONSTANTS
+#define KMediaServantUID3           0x1028290B // MediaServant app UID
+
+#endif      // __MEDIASERVANTUID_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msapp.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for cmediaservant class
+*
+*/
+
+
+#ifndef C_CMSAPP_H
+#define C_CMSAPP_H
+
+
+// INCLUDES
+#include <aknapp.h>
+
+/**
+ * CMediaServant application class.
+ * Provides factory to create concrete document object.
+ *
+ * @since S60 5.1
+ */
+class CMediaServantApp : public CAknApplication
+    {
+
+private:
+
+        /**
+        * Creates CCDSDocument document object.
+        * @return A pointer to the created document object.
+        */
+        CApaDocument* CreateDocumentL();
+
+        /**
+        * Returns application's UID (KMediaServantUID3).
+        * @return The value of KMediaServantUID3.
+        */
+        TUid AppDllUid() const;
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+    };
+
+#endif   // C_CMSAPP_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msappui.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant appui class
+*
+*/
+
+
+#ifndef C_CMSAPPUI_H
+#define C_CMSAPPUI_H
+
+// INCLUDES
+#include <aknViewAppUi.h>
+#include <GSPluginInterface.h>
+#include <GSFWViewUIDs.h>
+#include <GSPluginLoader.h>
+
+#include "msparameteragent.h"
+#include "msfillrulecontroller.h"
+
+// FORWARD DECLARATIONS
+class CMSEngine;
+class CMSStoreListController;
+class CCmDriveInfo;
+class CMSGSInterface;
+
+/**
+ *  Application UI class.
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSAppUi ): public CAknViewAppUi
+    {
+
+    public:
+
+
+        /**
+         * Destructor.
+         */
+        ~CMSAppUi();
+
+        /**
+         * Changes active view according to parameters.
+         * @since S60 3.1
+         * @param aOldView current view
+         * @param aNewView new view
+         */
+        void ChangeViewL(const TUid& aOldView, const TUid& aNewView);
+
+        /**
+         * Returns fill rule controller
+         * @since S60 3.1
+         * @return CMSFillRuleController, controller pointer
+         */
+        CMSFillRuleController* FillRuleController();
+
+        /**
+         * Returns store rule controller
+         * @since S60 5.0
+         * @return CCmStoreListController, pointer to controller
+         */
+        CMSStoreListController* StoreListController();
+
+        /**
+         * Refresh store and fill lists
+         * @since S60 3.1
+         */
+        void RefreshListsL();
+
+        /**
+         * File server session
+         * @since S60 3.1
+         * return RFs, file server session
+         */
+        RFs& FsSession();
+
+        /**
+         * Returns msengine
+         * @since S60 3.1
+         * @return CMSEngine, pointer to engine
+         */
+        CMSEngine* MSEngine();
+
+        /**
+         * Reads memory info
+         * @since S60 3.1
+         * @param aCapasity, size of memory
+         * @param aFreeSpace, free space of memory
+         * @return TInt, error code
+         */
+        TInt ReadMMCInfoL( TInt64& aCapasity, TInt64& aFreeSpace );
+        /**
+         * Get Filled Files Size
+         * @since S60 3.1
+         * @param aSize, size of filled files
+         * @param aID, fill rule ID
+         */
+        void GetFilledFilesSize( TInt64& aSize, const TInt aID );
+
+        /**
+         * Returns pointer to parameter agent
+         * @since S60 3.1
+         * @return CMSParameterAgent, parameter agent
+         */
+        CMSParameterAgent* ParameterAgent();
+
+        /**
+         * drive selection indicator
+         * @since S60 3.1
+         * @return TBool, ETrue if selected, EFalse otherwise
+         */
+        TBool DriveSelectedL();
+
+        /**
+         * drive selection indicator
+         * @since S60 3.1
+         * @return TBool, ETrue if selected, EFalse otherwise
+         */
+        CMSGSInterface* SettingsPlugin();
+
+        /**
+         * Compares IDs of two drives
+         * @since S60 3.1
+         * @return TBool, ETrue if match, EFalse otherwise
+         */
+
+        static TBool CompareIds( const CCmDriveInfo& aStoredDrive,
+                                 const CCmDriveInfo& aDrive );
+
+        /**
+         * Start wizard
+         * 
+         * @since S60 5.1
+         * @return TInt, wizard exit code
+         */
+        TInt RunWizardL();
+        
+protected:
+
+// From base class CAknViewAppUi
+
+        /**
+         * From CAknViewAppUi
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );
+
+private:
+        /**
+         * Performs the second phase construction.
+         */
+        void ConstructL();
+
+        /**
+         * Checks if selected memory is on the device
+         * @since S60 3.1
+         * @return TBool, ETrue if found, EFalse otherwise
+         */
+        TBool MemoryAttachedL();
+
+
+        /**
+         * Loads gs plugin ( settings view )
+         * @since S60 3.1
+         */
+        void LoadSettingsPluginL();
+
+       /**
+         * Check memory selected status, if none of drives have been selected
+         * the mass memory will be selected as default drive
+         * @since S60 3.2
+         */
+        void CheckDrivesSelectedL();
+
+private:
+
+        /**
+         * view which is currently active
+         */
+        TInt iActiveView;
+        /** 
+         * focus index of main view
+         */        
+        TInt iMainFocusIndex;
+        /**
+         * pointer to application engine
+         */
+        CMSEngine*                  iMSEngine;              // owned
+        /**
+         * parameter class
+         */
+        CMSParameterAgent*          iParameterAgent;        // owned
+        /**
+         * fill list controller
+         */
+        CMSFillRuleController*      iFillRuleController;    // owned
+        /**
+         * store list controller
+         */
+        CMSStoreListController*     iStoreListController;   // owned
+        /**
+         * GS plugin ( settings view )
+         */
+        CMSGSInterface*             iPlugin;                // owned
+    };
+#endif // C_CMSAPPUI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msbasecontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant document class
+*
+*/
+
+
+
+#ifndef __MSBASECONTAINER_H__
+#define __MSBASECONTAINER_H__
+
+// INCLUDES
+#include <coecntrl.h>
+#include <aknsfld.h>
+
+
+// FORWARD DECLARATIONS
+class CEikListBox;
+class CEikTextListBox;
+class CEikColumnListBox;
+class CEikFormattedCellListBox;
+class CTextListBoxModel;
+class CAknIconArray;
+
+// CLASS DECLARATION
+
+/**
+ * CMSBaseContainer  container control class.
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSBaseContainer ): public CCoeControl
+    {
+
+    public:
+
+        /**
+         * CMSBaseContainer default constructor.
+         */
+        CMSBaseContainer();
+        
+        /**
+         * ~CMSBaseContainer
+         * Destructor.
+        */
+        virtual ~CMSBaseContainer();
+        
+        /**
+         * Shows note
+         * @since S60 3.1
+         * @param aResource, text to be shown
+         * @param aError, error code
+         * @return None
+         */
+        void ShowNoteL ( TInt aResource, TInt aError );
+
+        /**
+         * Sets default context pane icon
+         * @since S60 3.1
+         * @param None
+         * @return None
+         */
+        void SetDefaultContextPaneIconL();
+
+    protected:
+
+        /**
+         * SetListBoxFromResourceL
+         * Sets listbox from resource using ConstructFromResourceL() of
+         * CEikColumnListBox class.
+         * @since S60 3.1
+         * @param aListBox Pointer of listbox.
+         * @param aResourceId Resource ID of listbox.
+         * @return None
+         */
+        void SetListBoxFromResourceL(
+            CEikColumnListBox* aListBox,
+            const TInt aResourceId );
+
+        /**
+         * SetListBoxFromResourceL
+         * Sets listbox from resource using ConstructFromResourceL() of
+         * CEikFormattedCellListBox class.
+         * @since S60 3.1
+         * @param aListBox Pointer of listbox.
+         * @param aResourceId Resource ID of listbox.
+         * @return None
+         */
+        void SetListBoxFromResourceL(
+            CEikFormattedCellListBox* aListBox,
+            const TInt aResourceId );
+
+        /**
+         * CreateScrollbarL
+         * Creates scrollbar.
+         * @since S60 3.1
+         * @param aListBox Pointer of created listbox.
+         * @return None
+         */
+        void CreateScrollbarL( CEikListBox* aListBox );
+
+        /**
+         * CreateFindBoxL
+         * Creates FindBox and returns it's pointer.
+         * @since S60 3.1
+         * @param aListBox Pointer of listbox.
+         * @param aModel Pointer of model.
+         * @param aStyle Style of FindBox.
+         * @return Pointer of CAknSearchField.
+         */
+        CAknSearchField* CreateFindBoxL(
+            CEikListBox* aListBox,
+            CTextListBoxModel* aModel,
+            CAknSearchField::TSearchFieldStyle aStyle );
+
+        /**
+         * Appends item to listbox array
+         * @since S60 3.1
+         * @param aListBox, pointer of listbox
+         * @param aModel, listbox model
+         * @param aIcon, icon index with "\t"
+         * @param aID, skinned icon id
+         * @param aBitmapId, bitmap id
+         * @param aMaskId, bitmap mask id
+         * @return None
+         */
+        void AppendItemToListBoxArrayL( CEikListBox* aListBox,
+                                        CTextListBoxModel* aModel,
+                                        TInt aIconIndex,
+                                        TDesC& aPrimaryText,
+                                        TDesC& aSecondaryText );
+
+        /**
+         * Appends item to listbox array
+         * @since S60 3.1
+         * @param aListBox, pointer of listbox
+         * @param aModel, listbox model
+         * @param aIconIndex, icon index
+         * @param aItemText, text to be displayed
+         * @return None
+         */
+        void AppendItemToListBoxArrayL( CEikListBox* aListBox,
+                                        CTextListBoxModel* aModel,
+                                        TInt aIconIndex,
+                                        TDesC& aItemText );
+
+        /**
+         * Loads a possibly skinned icon and adds it to icon array
+         * @since S60 3.1
+         * @param aArray, array of icons
+         * @param aSkin, skin instance
+         * @param aMbmFile, reference to icon file
+         * @param aID, skinned icon id
+         * @param aBitmapId, bitmap id
+         * @param aMaskId, bitmap mask id
+         * @return None
+         */
+        void AppendIconToArrayL(CAknIconArray* aArray,
+                                               MAknsSkinInstance* aSkin,
+                                               const TDesC& aMbmFile,
+                                               const TAknsItemID& aID,
+                                               TInt aBitmapId,
+                                               TInt aMaskId);
+
+        /**
+         * Sets context pane icon         
+         * @since S60 3.1
+         * @param aIconBitmap, bitmap
+         * @param aIconmask, bitmap mask
+         * @return None
+         */
+        void SetContextPaneIconL( const CFbsBitmap* aIconBitmap,
+                                  const CFbsBitmap* aIconMask );    
+        
+    private:
+        
+        /**
+         * control environment
+         */
+        CCoeEnv*               iCoeEnv;
+    };
+
+#endif // __MSBASECONTAINER_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msbaseview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant base view class
+*
+*/
+
+
+
+#ifndef __MSBASEVIEW_H__
+#define __MSBASEVIEW_H__
+
+// INCLUDES
+#include <aknview.h>
+
+
+// FORWARD DECLARATIONS
+class CAknTitlePane;
+class CAknNavigationDecorator;
+class CAknNavigationControlContainer;
+class CMSAppUi;
+
+// CLASS DECLARATION
+
+/**
+* CMSBaseView  base view class.
+*/
+NONSHARABLE_CLASS( CMSBaseView ) : public CAknView
+    {
+
+    protected: // Constructors and destructor
+
+        /**
+        * CMSBaseView
+        * Default constructor.
+        */
+        CMSBaseView();
+
+        /**
+        * ~CMSBaseView
+        * Destructor.
+        */
+        virtual ~CMSBaseView();
+
+    public: // New functions
+
+        /**
+        * SetTitlePaneTextL
+        * Sets text by resource ID in title pane.
+        * @since S60 3.1
+        * @param aResourceId The ID of outline number to displayed next.
+        */
+        void SetTitlePaneTextL( const TInt aResourceId );
+
+        /**
+        * SetTitlePaneTextL
+        * Sets text by resource ID in title pane.
+        * @since S60 3.1
+        * @param aText, title text
+        */
+        void SetTitlePaneTextL( const TDesC& aText );
+
+        /**
+        * SetNavigationPaneTextL
+        * Sets Navigation pane text.
+        * @since S60 3.1
+        * @param aText, text to be shown
+        */
+        void SetNavigationPaneTextL( const TDesC& aText );
+
+        /**
+        * ClearCurrentNaviPaneText
+        * Clears current navi pane text
+        * @since S60 3.1
+        */
+        void ClearCurrentNaviPaneText();
+
+        /**
+         * Cancels async operation
+         * @Since S60 3.1
+         * @param aAppUi, pointer to cmsappui class
+         */
+        void CancelAsyncOperation( CMSAppUi* aAppUi );
+
+    private:
+
+        /**
+        * iNaviPane
+        */
+        CAknNavigationControlContainer* iNaviPane;          // not owned
+        /**
+        * navi decorator
+        */
+        CAknNavigationDecorator*    iNaviDecorator;
+    };
+
+#endif // __MSBASEVIEW_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msbrowsecontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant browse container class
+*
+*/
+
+
+#ifndef C_MSBROWSECONTAINER_H
+#define C_MSBROWSECONTAINER_H
+
+// INCLUDES
+#include <aknlists.h>
+
+#include "msbasecontainer.h"
+#include "msitembrowser.h"
+
+// FORWARD DECLARATIONS
+
+class CMSAppUi;
+class CMSBrowseView;
+
+
+/**
+ * CMSBrowseContainer class
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSBrowseContainer ): public CMSItemBrowser
+    {
+public:
+    /**
+     * Constructor.
+     */
+    CMSBrowseContainer( CMSAppUi& aAppUi, CMSBrowseView& aView );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMSBrowseContainer();
+    
+protected:
+
+// From base class CoeControl
+    
+    /**
+     * From CoeControl
+     * See base class definition
+     */
+    void GetHelpContext(TCoeHelpContext& aContext) const;
+
+    /**
+     * From CoeControl
+     * See base class definition
+     */
+    void HandleResourceChange(TInt aType);
+
+// From base class CMSItemBrowser
+
+        /**
+         * From CMSItemBrowser
+         * See base class definition
+         */
+        void GetBrowseDataL();
+
+private:
+
+    /**
+     * containers view
+     */
+    CMSBrowseView*                          iView;  // not owned
+
+    };
+
+#endif // C_MSBROWSECONTAINER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msbrowseview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant browse view class
+*
+*/
+
+
+
+
+
+#ifndef C_MSBROWSEVIEW_H
+#define C_MSBROWSEVIEW_H
+
+// INCLUDES
+#include "msbaseview.h"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSBrowseContainer;
+
+/**
+ * CMSBrowseView view class. Main view is visible when
+ * application is launched
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSBrowseView ): public CMSBaseView
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        CMSBrowseView( CMSAppUi& aAppUi );
+
+        /**
+         * Symbian default constructor.
+         */
+        void ConstructL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSBrowseView();
+
+        /**
+         * Solves title pane text by media type
+         * @since S60 3.2
+         * @param aMediaType, mediatype
+         */
+        void SetTitlePaneTextL( TCmMediaType aMediaType );
+        
+    protected: 
+
+// From base class CAknView
+
+        /**
+         * From CAknView returns Uid of View
+         * See base class definition
+         */
+        TUid Id() const;
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage );
+        
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoDeactivate();                          
+                          
+// From base class MEikMenuObserver
+
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );    
+
+    private:
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi*                           iAppUi;         // not owned
+
+        /**
+         * view's container
+         */
+        CMSBrowseContainer*                 iContainer;     // owned
+    };
+
+#endif // C_MSBROWSEVIEW_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msconstants.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Constant definitions
+*
+*/
+
+
+#ifndef MSCONSTANTS_H
+#define MSCONSTANTS_H
+
+
+// INCLUDE FILES
+#include <e32std.h>
+
+
+// MediaServant UIDs
+const TUid KUidMediaServant = { 0x1028290B };
+
+//const TInt KMSMainViewIdValue = 1;
+const TUid KMSMainViewId = { 0x10282913 };
+//const TInt KMSFillViewIdValue = 2;
+const TUid KMSFillViewId = { 0x10282914 };
+//const TInt KMSSettingsViewIdValue = 3;
+//const TUid KMSSettingsViewId = { 0x10282915 };
+//const TInt KMSFillEditViewIdValue = 4;
+const TUid KMSFillEditViewId = { 0x10282915 };
+//const TInt KMSStoreListViewIdValue = 5;
+const TUid KMSStoreListViewId = { 0x10282916 };
+//const TInt KMSStoreSettingsViewIdValue = 6;
+const TUid KMSStoreSettingsViewId = { 0x10282917 };
+//const TInt KMSBrowseViewIdValue = 7;
+const TUid KMSBrowseViewId = { 0x10282918 };
+//const TInt KMSFillBrowseViewIdValue = 8;
+const TUid KMSFillBrowseViewId = { 0x10282919 };
+
+// Listbox format strings
+
+// Single graphic style listbox
+_LIT( KSingleGraphicStyleFormatString, "%d\t%S\t%d\t" );
+// Single graphic style listbox - no trailing icons
+_LIT( KSingleGraphicStyleFormatStringNoTrailIcons, "%d\t%S\t\t" );
+// Single graphic style listbox
+_LIT( KSingleStyleFormatString, "\t%S\t\t" );
+// Double large graphic style listbox
+_LIT( KDoubleLargeGraphicStyleFormatString, "%d\t%S\t%S\t");
+// Double large graphic style listbox (no secondary text)
+_LIT(KDoubleLargeGraphicStyleFormatStringEmpty, "%d\t%S\t\t");
+// Signle graphic style lis
+_LIT( KItemFormatString, "1\t%S");
+
+// Icon files
+_LIT( KAvkonMifFileName, "\\resource\\apps\\avkon2.mif" );
+_LIT( KMSMifFileName, "\\resource\\apps\\mediaservant.mif" );
+
+// TITLE PANE
+// CONSTANTS
+const TInt KMSTitleBufLength = 256 ; // for lenght.
+const TInt KMSDefaultTitleId = 0;
+
+// Setting item secondary text delimiter
+_LIT( KDelimiter, ",");
+
+// Time format strings
+_LIT(KDefaultFromDate, "19000000:000000.000000"); // 01.01.1900
+
+// File sizes
+const TInt KMSSize_0_MB = 0;
+const TInt KMSSize_1_MB = KMega;
+const TInt KMSSize_5_MB = 5*KMega;
+const TInt KMSSize_10_MB = 10*KMega;
+const TInt KMSSize_50_MB = 50*KMega;
+
+// Track lengths [s]
+const TInt KMSTrackLength_0_min = 0;
+const TInt KMSTrackLength_1_min = 60;
+const TInt KMSTrackLength_6_min = 360;
+const TInt KMSTrackLength_8_min = 480;
+const TInt KMSTrackLength_30_min = 1800;
+
+// Listbox tabulator defitions
+_LIT(KSlashT, "\t");
+_LIT(KZeroSlashT, "0\t");
+_LIT(KSPaceT, " ");
+
+
+// Array granularities
+const TInt KMetadataArrayGranularity = 5;
+
+// Default quota size [%]
+const TInt KHDDefaultQuota = 75;
+const TInt KMMCDefaultQuota = 90;
+
+// Default fill list size [MB]
+const TInt KDefaultListSize50 = 50;
+const TInt KDefaultListSize200 = 200;
+
+// Server statuses
+const TUint KServerNotActive = 0;
+const TUint KServerActive = 1;
+const TUint KServerRemoved = 2;
+
+// Settings plugin
+const TUid settinsPluginUid = { 0x10282912 };
+
+#endif      // MSCONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msdocument.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant document class
+*
+*/
+
+
+#ifndef C_CMSDOCUMENT_H
+#define C_CMSDOCUMENT_H
+
+
+// INCLUDES
+#include <AknDoc.h>
+
+/**
+ *  CMSDocument application class.
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSDocument ) : public CAknDocument
+    {
+
+    public:
+
+        /**
+         * Two-phased constructor.
+         */
+        static CMSDocument* NewL( CEikApplication& aApp );
+
+        /**
+         * Two-phased constructor.
+         */
+        static CMSDocument* NewLC( CEikApplication& aApp );
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CMSDocument();
+
+    private:
+
+        /**
+         * Symbian default constructor.
+         */
+        CMSDocument( CEikApplication& aApp );
+
+        /**
+         * Symbian second phase constructor can leave.
+         */
+        void ConstructL();
+
+// From base class CEikDocument
+
+        /**
+         * From CEikDocument
+         * See base class definition
+         */
+        CEikAppUi* CreateAppUiL();
+    };
+
+#endif // C_CMSDOCUMENT_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msfillbrowsecontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant fill list browse container class
+*
+*/
+
+
+#ifndef C_MSFILLBROWSECONTAINER_H
+#define C_MSFILLBROWSECONTAINER_H
+
+// INCLUDES
+#include <aknlists.h>
+
+#include "msengineobserver.h"
+#include "msbasecontainer.h"
+#include "msitembrowser.h"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSFillBrowseView;
+class CCmFillRule;
+
+
+/**
+ * CMSFillBrowseContainer class
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSFillBrowseContainer ): public CMSItemBrowser,
+                                             public MMSEngineObserver
+    {
+    public:
+        
+        /**
+         * Default constructor.
+         */
+        CMSFillBrowseContainer( CMSAppUi& aAppUi,
+                                CMSFillBrowseView& aView );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSFillBrowseContainer();
+
+        /**
+         * Randomizes list
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void RandomizeListL();
+
+        /**
+         * Checks if current list has random rule
+         * @since S60 5.1
+         * @param None         
+         * @return TBool, ETrue if random rule exists
+         */
+        TBool HasListRandomRule();
+
+        /**
+         * Sets file statuses
+         * @Since S60 5.1
+         * @param None
+         * @return None
+         */
+        void SetFileStatusesL();
+
+        /**
+         * Sets status of files
+         * @param aStatus, file status
+         * @return None
+         */
+        void SetStatusOfFiles( TCmListItemStatus aStatus );
+
+    protected: 
+    
+// From base class MMSEngineObserver
+
+        /**
+         * From MMSEngineObserver
+         * See base class definition
+         */
+        void ReadyL( TCmService aService, TInt aError );
+
+// From base class CoeControl
+        
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void GetHelpContext(TCoeHelpContext& aContext) const;
+
+// From base class CMSItemBrowser    
+
+        /**
+         * Gets browse data from server
+         * See base class definition
+         */
+        void GetBrowseDataL();
+
+    private:
+    
+        /**
+         * Detects the KEikDynamicLayoutVariantSwitch
+         * message and re-layouts controls from this.
+         * @since S60 5.1
+         * @param aType, change type
+         * @return None
+         */
+        void HandleResourceChange(TInt aType);
+
+        /**
+         * Checks if file status has been changed
+         * @Since S60 5.1
+         * @param None
+         * @return TBool, ETrue if changed, EFalse otherwise
+         */
+        TBool CheckIfStatusChanged();
+        
+        /**
+         * Creates and sets navi pane text
+         * @Since S60 5.1
+         * @param aCount, item count
+         * @param aSize, list size
+         * @return None
+         */
+        void CreateAndSetNaviPaneTextL( TUint32 aCount, TUint32 aSize );
+
+    private:
+        /**
+         * selected rule
+         */
+        CCmFillRule*                        iRule;  // not owned
+        /**
+         * containers view
+         */
+        CMSFillBrowseView*                  iView;  // not owned
+        /**
+         * array of item status
+         * list order can't be changed so we don't have to copy
+         * whole item
+         */
+        RArray<TCmListItemStatus>           iStatusArray;
+
+    };
+
+
+
+#endif // C_MSFILLBROWSECONTAINER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msfillbrowseview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant browse view class
+*
+*/
+
+
+
+
+
+#ifndef C_MSFILLBROWSEVIEW_H
+#define C_MSFILLBROWSEVIEW_H
+
+// INCLUDES
+#include <aknlists.h>           // listbox observer
+#include "msbaseview.h"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSFillBrowseContainer;
+
+/**
+ * CMSBrowseView view class. Main view is visible when
+ * application is launched
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSFillBrowseView ) : public CMSBaseView
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        CMSFillBrowseView( CMSAppUi& aAppUi );
+
+        /**
+         * Symbian default constructor.
+         */
+        void ConstructL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSFillBrowseView();
+
+    protected: 
+
+// From base class CAknView
+
+        /**
+         * From CAknView returns Uid of View
+         * See base class definition
+         */
+        TUid Id() const;
+
+        /**
+         * From CAknView activate the view
+         * See base class definition
+         */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage );
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoDeactivate();
+                                  
+// From base class MEikMenuObserver
+
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);        
+
+    private:
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi*                           iAppUi;             // not owned
+        /**
+         * view's container
+         */
+        CMSFillBrowseContainer*             iContainer;         // owned
+        /**
+         * Marked item indexes
+         */
+        const CListBoxView::CSelectionIndexArray* iSelections;  // not owned
+    };
+
+#endif // C_MSFillBROWSEVIEW_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msfillcontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,323 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant fill list container class
+*
+*/
+
+
+#ifndef C_MSFILLCONTAINER_H
+#define C_MSFILLCONTAINER_H
+
+// INCLUDES
+#include <aknlists.h>
+#include "msbasecontainer.h"
+#include "mediaservant.hrh"
+
+// FORWARD DECLARATIONS
+class CAknColumnListBox;
+class CAknIconArray;
+class CMSAppUi;
+class CCmFillRule;
+class CMSFillRuleController;
+class CMSFillView;
+class CMSFillList;
+
+/**
+ * CMSFillContainer class
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSFillContainer ): public CMSBaseContainer
+    {
+    private:
+
+        // icon enumerations
+        enum TMSListBoxIcons
+            {
+            EMSSelectedFits = 0,
+            EMSUnselectedFits,
+            EMSSelectedPartiallyFits,
+            EMSUnselectedPartiallyFits,
+            EMSSelectedDoesntFit,
+            EMSUnSelectedDoesntFit,
+            EVideoType,
+            EImageType,
+            EAudioType,
+            EMark,
+            EIconCount
+            };
+
+    public:
+    
+        /**
+         * Constructor.
+         */
+        CMSFillContainer( CMSAppUi& aAppUi, CMSFillView& aView );
+
+        /**
+         * Symbian default constructor.
+         */
+        void ConstructL( TRect aRect );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSFillContainer();
+
+        /**
+         * Updates listbox data
+         * @since S60 5.1
+         */
+        void UpdateListBoxDataL();
+
+        /**
+         * sets fill rule activity
+         * @since S60 5.1
+         */
+        void SetFillRules();
+
+        /**
+         * Highlighted item index
+         * @since S60 5.1
+         * @return TInt, highlighted item index
+         */
+        TInt SelectedItemIndex();
+
+        /**
+         * Count of list items
+         * @since S60 5.1
+         * @return TInt, item count
+         */
+        TInt ListItemCount();
+
+        /**
+         * Sets reorder mode states
+         * @since S60 5.1
+         * @param aState, reordering state
+         */
+        void SetReorderStateL( TMSReorderState aState );
+
+        /**
+         * Deletes current rule
+         * @since S60 5.1
+         */
+        void DeleteRuleL();
+
+        /**
+         * Checks if the list already have rule with this name
+         * @since S60 5.1
+         * @param aName, rule name
+         * @TInt number of dublicates
+         */
+        TInt CheckIfDublicateNames( const TDesC& aName );
+
+        /**
+         * Toggles list item
+         * @since S60 5.1
+         */
+        void ChangeListActivityL();
+
+        /**
+         * Checks if item is selected
+         * @since S60 5.1
+         * @return TBool, ETrue if activated
+         */
+        TBool IsCurrentListItemActive();
+
+        /**
+         * Checks if user has changed list selections
+         * @since S60 5.1
+         * @return TBool, ETrue if changed
+         */
+        TBool HasListSelectionsChanged();
+
+        /**
+         * Updates fill list size on navi pane
+         * @since S60 5.1
+         */
+        void UpdateNaviTextL();
+
+        /**
+         * Checks if list(s) have been deleted
+         * @since S60 5.1
+         * @return TBool, ETrue if deleted, EFalse otherwise
+         */
+        TBool IsListDeleted();
+
+        /**
+         * Handles pointer event on touchscreen
+         * @param aPointerEvent, touchscreen key event 
+         */
+    	void HandlePointerEventL ( const TPointerEvent& aPointerEvent );
+
+    protected:
+
+// From base class CCoeControl
+        
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void GetHelpContext(TCoeHelpContext& aContext) const;
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        TInt CountComponentControls() const;
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void SizeChanged();
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void HandleResourceChange(TInt aType);
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                 TEventCode aType );
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+		void HandleDragAndDropEventsL( const TPointerEvent& aPointerEvent );
+
+    private:
+
+
+        /**
+         * Handles up/down keys during reordering
+         * @since S60 5.1
+         * @param aKeyEvent Key event.
+         * @param aType Type of key event( EEventKey, EEventKeyUp or
+         * EEventKeyDown ).
+         */
+        TKeyResponse HandleReorderKeyEventL(const TKeyEvent& aKeyEvent,
+                                            TEventCode aType );
+
+        /**
+         * Moves item on the list
+         * @since S60 5.1
+         * @param aDirection, moving direction
+         */
+        void MoveItem( TInt aDirection );
+
+        /**
+         * Sets rule activity according to checkbox states on the list
+         * @since S60 5.1
+         */
+        void StoreSelectionStatus();
+
+        /**
+         * Gets icon for the list
+         * @since S60 5.1
+         * @param aListName, name of the list
+         * @param aIndex, item index
+         * @param aListSize, list size in bytes
+         */
+        TInt ListItemIconIndex( TInt aIndex,
+                                TInt64 aListSize,
+                                TInt64& aFreeSpace );
+
+        /**
+         * Calculates fill quota based on selected drives
+         * @since S60 5.1
+         */
+        void CalculateFillQuotaL();
+
+    private:
+
+        /**
+         * Listbox control
+         */
+        CAknColumnListBox* iListBox;
+        /**
+         * Pointer to application ui
+         */
+        CMSAppUi&                           iMSAppUi;           // not owned
+        /**
+         * Reorder state
+         */
+        TMSReorderState                     iReorderState;
+        /**
+         * Pointer array to rules
+         */
+        RPointerArray<CMSFillList>*         iFillListArray;     // not owned
+        /**
+         * Fill rule controller
+         */
+        CMSFillRuleController*              iFillRuleController;// not owned
+        /**
+         * Parent view
+         */
+        CMSFillView&                        iView;
+        /**
+         * Size of selected lists
+         */
+        TInt64                              iSizeOfSelectedLists;
+        /**
+         * Selected items on view activation
+         */
+        RArray<TInt>                        iSelectedLists;
+        /**
+         * Context pane icon
+         */
+        CFbsBitmap*                         iIcon;              // not owned
+        /**
+         * Context pane icon mask
+         */
+        CFbsBitmap*                         iIconMask;          // not owned
+        /**
+         * Selection indexes
+         */
+        const CListBoxView::CSelectionIndexArray*
+                                            iSelectedIndexes;   // not owned
+        /**
+         * MMC free space ( for navi pane text )
+         */
+        TInt64                              iFreeMemory;
+        /**
+         * MMC quota ( set by user )
+         */
+        TInt64                              iQuota;
+        /**
+         * List delete flag
+         */
+        TBool                               iListDeleted;
+        /**
+         * Previous listbox selection
+         */
+        TInt                                iPreviousItemIndex;
+        /**
+         * Index of an item that is dragged
+         */
+        TInt 								iDragItemIndex;
+    };
+
+#endif // C_MSMAINCONTAINER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msfillrulecontroller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant fill list controller class
+*
+*/
+
+
+
+
+
+#ifndef C_MSFILLRULECONTROLLER_H
+#define C_MSFILLRULECONTROLLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmcommontypes.h"
+
+
+// FORWARD DECLARATIONS
+class CMSEngine;
+class CCmFillRuleContainer;
+class CCmFillRule;
+class CMSFillList;
+
+/**
+ * CMSFillRuleController class.
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSFillRuleController ): public CBase
+    {
+    public:
+
+        /**
+         * two-phase constructor.
+         */
+        static CMSFillRuleController* NewL( CMSEngine& aMSEngine );
+
+        /**
+         * two-phase constructor.
+         */
+        static CMSFillRuleController* NewLC( CMSEngine& aMSEngine );
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CMSFillRuleController();
+
+        /**
+         * Returns rule pointer array
+         * @since S60 5.1
+         * @return RPointerArray<CMSFillList>, pointer array
+         */
+        RPointerArray<CMSFillList>* FillListArray();
+
+        /**
+         * Initialises container
+         * @since S60 5.1
+         */
+        void InitializeRuleContainersL();
+
+        /**
+         * Creates default fill lists
+         * @since S60 5.1
+         */
+        void CreateFillRulesL();
+
+        /**
+         * Deletes current rule
+         * @since S60 5.1
+         * @param TInt, index to be deleted
+         */
+        void DeleteRuleL( TInt aCurrentIndex );
+
+        /**
+         * Adds new rule
+         * @since S60 5.1
+         * @param aRule, new fill rule
+         */
+        void AddRuleL( CCmFillRule* aRule );
+
+        /**
+         * Changes priorites of two rules
+         * @since S60 5.1
+         * @param aTotalItem, items on the list
+         * @param aCurrentItem, selected item
+         * @param aDirection, move direction
+         */
+        void ChangePriority( TUint aTotalItem,
+                             TUint aCurrentItem,
+                             TInt aDirection );
+
+        /**
+         * Saves rules to server
+         * @since S60 5.1
+         */
+        void SaveRulesL();
+
+        /**
+         * Reads rule container and recreates rule array
+         * @since S60 5.1
+         */
+        void  UpdateArrayL();
+
+        /**
+         * Checks priority changes
+         * @since S60 5.1
+         * @return TBool, ETrue if changed, EFalse otherwise
+         */
+        TBool HasPriorityChangedL();
+
+        /**
+         * Checks activity changes
+         * @since S60 5.1
+         * @param aStatus, status to be checked
+         * @return TBool, ETrue if changed, EFalse otherwise
+         */
+        TBool HasSelectionsChanged( TCmFillRuleStatus aStatus );
+
+        /**
+         * Restores original list selections
+         * @since S60 5.1
+         */
+        void RestoreOriginalSelections();
+
+    private:
+        
+        /**
+         * Constructor.
+         */
+        CMSFillRuleController( CMSEngine& aMSEngine );
+
+        /**
+         * ConstructL
+         * Second phase constructor.
+         */
+        void ConstructL();
+        
+        /**
+         * Sets priorities of rules (if deleted or added)
+         * @since S60 5.1
+         */
+        void SetPriorities();
+
+        /**
+         * Sort function that arranges pointers by rule priority
+         * @since S60 5.1
+         * @param rule1, rule to be sorted
+         * @param rule2, rule to be sorted
+         */
+        static TInt compare ( const CMSFillList& rule1,
+                              const CMSFillList& rule2);
+
+
+    private:
+
+        /**
+         * pointer to application engine
+         */
+        CMSEngine*                  iMSEngine;              // not owned
+        /**
+         * Fill rules
+         */
+        CCmFillRuleContainer*       iRuleContainer;         // owned
+        /**
+         * Pointer array to fillrules
+         */
+        RPointerArray<CMSFillList>  iFillListArray;         // owned
+
+    };
+
+
+
+/**************** FILL LIST CLASS ******************/
+
+
+/**
+ * CMSFillList class.
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSFillList ) : public CBase
+    {
+    public:
+        
+        /**
+         * NewL
+         * 2-phase constructor.
+         */
+        static CMSFillList* NewL( CMSEngine& aMSEngine,
+                                  CCmFillRule& aFillList );
+
+        /**
+         * NewL
+         * 2-phase constructor.
+         */
+        static CMSFillList* NewLC( CMSEngine& aMSEngine,
+                                  CCmFillRule& aFillList );
+                                  
+        /**
+         * Destructor.
+         */
+        virtual ~CMSFillList();
+
+        /**
+         * Fill list
+         * @since S60 5.1
+         * @return CCmFillRule, fill list
+         */
+        CCmFillRule* List();
+
+        /**
+         * List Size
+         * @since S60 5.1
+         * @return TUint32, List size in bytes
+         */
+        TUint32 ListSize();
+
+        /**
+         * List's item count
+         * @since S60 5.1
+         * @return TUint64, item count
+         */
+        TUint32 ItemCount();
+
+        /**
+         * Priority
+         * @since S60 5.1
+         * @return TInt, List priority
+         */
+        TInt Priority() const;
+
+        /**
+         * Original selection status
+         * @since S60 5.1
+         * @return TCmFillRuleStatus, selection status
+         */
+        TCmFillRuleStatus OriginalSelectionStatus();
+
+    private:
+
+        /**
+         * Constructor.
+         */
+        CMSFillList( CMSEngine& aMSEngine, CCmFillRule& aFillList );
+
+        /**
+         * ConstructL
+         * Second phase constructor.
+         */
+        void ConstructL();
+
+    private:
+        /**
+         * Fill list size ( in bytes )
+         */
+        TUint32                             iListSize;
+        /**
+         * List item count
+         */
+         TUint32                            iItemCount;
+        /**
+         * MS Engine
+         */
+        CMSEngine*                          iMSEngine;  // not owned
+        /**
+         * Fill list
+         */
+        CCmFillRule*                        iFillList;  // not owned
+        /**
+         * Original selection state
+         */
+        TCmFillRuleStatus                   iSelected;
+    };
+#endif // C_MSFILLRULECONTROLLER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msfillruleeditlist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,569 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant fill rule editor class
+*
+*/
+
+
+#ifndef C_MSFILLRULEEDITLIST_H
+#define C_MSFILLRULEEDITLIST_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+
+#include "cmcommontypes.h"
+#include "msengineobserver.h"
+#include "msparameteragent.h"
+#include "mediaservant.hrh"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSFillRuleEditView;
+class CCmFillRuleContainer;
+class CCmFillRule;
+class CCmMediaServerFull;
+class CSelectionItemList;
+class CMSMetadataCollector;
+class CCmSqlPropertyContainer;
+
+// CLASS DECLARATION
+
+/**
+ * CMSFillRuleEditList general class. This class is used to
+ * create setting items to several setting item lists.
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSFillRuleEditList ): public CAknSettingItemList,
+                           public MMSEngineObserver
+    {
+    // process states
+    enum TMSFillStates
+        {
+        EMSIdle = 0,
+        EMSFillPreprocess,
+        EMSFetchMetadata
+        };
+
+    public: // Constructor and destructor
+
+        /**         
+         * two-phase constructor.         
+         */
+        static CMSFillRuleEditList* NewL( CMSAppUi& aAppUi,
+                                          CMSFillRuleEditView& aView );
+
+        /**
+         * two-phase constructor. 
+         */
+        static CMSFillRuleEditList* NewLC( CMSAppUi& aAppUi,
+                                          CMSFillRuleEditView& aView );
+                                          
+        /**
+         * Destructor.
+         */
+        virtual ~CMSFillRuleEditList();
+
+        /**
+         * Opens the selected listbox item
+         * @since S60 5.1
+         */
+        void OpenSelectedListboxItemL();
+
+        /**
+         * Removes rule
+         * @since S60 5.1
+         */
+        void RemoveCurrentRuleL();
+
+        /**
+         * Tests if rule is additional
+         * @since S60 5.1
+         * @return TBool, ETrue if additional
+         */
+        TBool IsCurrentRuleAdditional();
+
+        /**
+         * List media type
+         * @since S60 5.1
+         * @return TCmMediaType, media type of the list
+         */
+        TCmMediaType ListMediaType();
+
+        /**
+         * List media type
+         * @since S60 5.1
+         * @param aName name of fill rule
+         * @return TBool, whether names are same
+         */
+        TBool CheckSameNameL( const TDesC& aName ) const;
+
+// From base class CAknSettingItemList
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        void ActivateL();
+
+    protected:
+    
+// From base class CAknSettingItemList
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        CAknSettingItem* CreateSettingItemL( TInt aSettingId );
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        void  HandleListBoxEventL ( CEikListBox *aListBox,
+                                    TListBoxEvent aEventType);
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        void EditItemL (TInt aIndex, TBool aCalledFromMenu);
+        
+// From base class CCoeControl
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        void SizeChanged();
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        void HandleResourceChange( TInt aType );
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        void GetHelpContext(TCoeHelpContext& aContext) const;        
+
+// From base class MMSEngineObserver
+
+        /**
+         * From MMSEngineObserver
+         * See base class definition
+         */
+        void ReadyL( TCmService aService, TInt aError );
+
+    private:
+
+        /**
+         * Reads rules associated to the template
+         * @since S60 5.1
+         * @param aTemplate, Template ID
+         */
+        void ReadTemplateRulesL( TInt aTemplate );
+
+        /**
+         * Adds fill rule to the list
+         * @since S60 5.1
+         */
+        void AddFillRuleL();
+
+        /**
+         * Sets default value defined by template
+         * @since S60 5.1
+         * @param aId, setting id
+         * @param aValue, default value
+         */
+        void SetDefaultValue( TInt aId, TInt aValue );
+
+        /**
+         * Sets list type
+         * @since S60 5.1
+         * @param aType, command id
+         */
+        void SetListType( TInt aType );
+
+        /**
+         * Get values for the setting list
+         * @since S60 5.1
+         */
+        void GetRuleValuesL();
+
+        /**
+         * Deletes rule
+         * @since S60 5.1
+         * @param aField, metadatafield to be deleted
+         */
+        void DeleteRule( TCmMetadataField aField );
+
+        /**
+         * Get values for the setting list
+         * @since S60 5.1
+         * @param aField, metadatafield to be deleted
+         * @param aType, operator
+         */
+        void DeleteRule( TCmMetadataField aField, TCmOperatorType aType );
+
+        /**
+         * Adds additinal rules to fill list
+         * @since S60 5.1
+         * @param aArray, item array
+         * @param aField, metadatafield to be added
+         * @param aOperator, operator type
+         */
+        void AddAdditionalRuleL( CDesCArray* aArray,
+                                 TCmMetadataField aField,
+                                 TCmOperatorType aOperator );
+
+        /**
+         * Adds additinal rules to fill list
+         * @since S60 5.1
+         * @param aArray, item array
+         * @param aField, metadatafield to be added
+         * @param aOperator, operator type
+         */
+        void AddAdditionalRuleL( RArray<TInt>& aArray,
+                                 TCmMetadataField aField,
+                                 TCmOperatorType aOperator );
+
+        /**
+         * Adds additinal rules to fill list
+         * @since S60 5.1
+         * @param aArray, item array
+         * @param aField, metadatafield to be added
+         * @param aOperator, operator type
+         */
+        void AddAdditionalRuleL( TCmMetadataField aMetadataField,
+                                 TCmOperatorType aOperator,
+                                 TInt aValue );
+
+        /**
+         * Appends item to the list
+         * @since S60 5.1
+         * @param aArray, item array
+         * @param aParam, item
+         */
+        void AppendItemToListL( RArray<TInt>* aArray, TInt aParam );
+
+        /**
+         * Sets audio file size selection
+         * @since S60 5.1
+         */
+        void SetAudioFileSizeSelection();
+
+        /**
+         * Sets audio file size selection
+         * @since S60 5.1
+         */
+        void SaveTrackFileSizeL();
+
+        /**
+         * Sets audio file duration selection
+         * @since S60 5.1
+         */
+        void SetAudioFileDurationSelection();
+
+        /**
+         * Sets audio file size selection
+         * @since S60 5.1
+         */
+        void SaveTrackDurationL();
+
+        /**
+         * Sets modified additional rules visible
+         * @since S60 5.1
+         */
+        void DisplayModifiedAdditionalRules();
+
+        /**
+         * Searches item from the list be item ID
+         * @since S60 5.1
+         * @param aId, item id
+         * @return CAknSettingItem, item pointer
+         */
+        CAknSettingItem* SearchItemById( TMSFillEditItems aId );
+
+        /**
+         * Sets shrinking status to image list
+         * @since S60 5.1
+         */
+        void SetShrinkingStatus();
+
+        /**
+         * Initializes parameters
+         * @since S60 5.1
+         */
+        void InitializeValues();
+
+        /**
+         * Sets navi pane text
+         * @since S60 5.1
+         */
+        void CreateAndSetNaviPaneTextL();
+
+        /**
+         * Saves values to rule container
+         * @since S60 5.1
+         */
+        void SaveValueL( CAknSettingItem* aItem );
+
+        /**
+         * Checks current item setting page acceptance
+         * @since S60 5.1
+         * @param aItem, edited item
+         * @return TBool, ETrue if accepted EFalse if cancelled
+         */
+        TBool CheckSettingPageAcceptance( CAknSettingItem* aItem );
+
+        /**
+         * Constructs setting list and starts getting data from server
+         * @since S60 5.1
+         */
+        void ConstructListAndStartDataReadingL();
+
+        /**
+         * Starts list preprocessing
+         * @since S60 5.1
+         */
+        void PreprocessListL();
+
+        /**
+         * Saves list values from visible setting items
+         * @since S60 5.1
+         */
+        void SaveListValuesL();
+
+        /**
+         * Creates selection list for server setting
+         * @since S60 5.1
+         */
+        void CreateServerSettingListL();
+
+        /**
+         * Adds selected servers to rule
+         * @since S60 5.1
+         */
+        void HandleServerSelectionL();
+
+        /**
+         * Deletes servers from rule
+         * @since S60 5.1
+         */
+        void DeleteAllServersFromRuleL();
+
+        /**
+         * Saves and preprocesses list
+         * @since S60 5.1
+         * @param aItem, item to be processed
+         */
+        void SaveAndPreprocesslistL( CAknSettingItem* aItem );
+
+        /**
+         * Gets mediaservers and removes not active servers
+         * @since S60 5.1
+         */
+        void GetServersAndCheckActivityL();
+
+        /**
+         * Updates multiselection setting items
+         * @since S60 5.1
+         */
+        void UpdateSettingItemsL();
+
+        /**
+         * Handles list name change
+         * @since S60 5.1
+         * @param aItem, name setting item
+         */
+        void HandleListNameL( CAknSettingItem* aItem );
+
+    private:
+
+        /**
+         * ConstructL
+         * Second phase constructor.
+         * @param aAppUi : application ui reference
+         * @param aView : view reference
+         */
+        void ConstructL( CMSAppUi& aAppUi,
+                         CMSFillRuleEditView& aView );
+
+        /**
+         * Constructor.
+         */
+        CMSFillRuleEditList();
+
+    private:
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi*                               iAppUi;         // not owned
+        /**
+         * amount of files
+         */
+        TInt                                    iAmount;
+        /**
+         * servers
+         */
+        TBuf<KMaxFileName>                      iSettingText;
+        /**
+         * pointer to view
+         */
+        CMSFillRuleEditView*                    iView;          // not owned
+        /**
+         * Fill rule
+         */
+        CCmFillRule*                            iRule;          // not owned
+        /**
+         * MediaServers
+         */
+        RPointerArray<CCmMediaServerFull>*      iServers;       //owned
+        /**
+         * Image shrinking
+         */
+        TMSShrinkImages                         iShrinkImages;
+        /**
+         * Starting with setting
+         */
+        TInt                                    iStartWith;
+        /**
+         * date from
+         */
+        TTime                                   iDateFrom;
+        /**
+         * date until
+         */
+        TTime                                   iDateUntil;
+        /**
+         * free text
+         */
+        TBuf<KMaxFileName>                      iFreeText;
+        /**
+         * list name
+         */
+        TBuf<KMaxFileName>                      iListName;
+        /**
+         * rule template
+         */
+        TMSTemplate                             iRuleTemplate;
+        /**
+         * array of visible rules
+         */
+        RArray<TMSFillEditItems>                iVisibleRules;
+        /**
+         * limit type (pieces or MBs )
+         */
+        TCmLimitType                            iLimitType;
+        /**
+         * Dummy text buffer for "Add more rules"
+         */
+        TBuf<10>                                iDummyText;
+        /**
+         * Track lenght
+         */
+        TInt                                    iTrackLengthEnum;
+        /**
+         * Track lenght
+         */
+        TInt                                    iMinTrackLength;
+        /**
+         * Track lenght
+         */
+        TInt                                    iMaxTrackLength;
+        /**
+         * File size
+         */
+        TInt                                    iFileSize;
+        /**
+         * File size enumeration
+         */
+        TInt                                    iFileSizeEnum;
+        /**
+         * Min file size
+         */
+        TInt                                    iMinFileSize;
+        /**
+         * Min file size set
+         */
+        TInt                                    iMinFileSizeSet;
+        /**
+         * Max file size
+         */
+        TInt                                    iMaxFileSize;
+        /**
+         * Max file size set
+         */
+        TInt                                    iMaxFileSizeSet;
+        /**
+         * Previously selected rule identifier
+         */
+        TInt                                    iPreviousRuleIdentifier;
+        /**
+         * array of metadata video titles
+         */
+        CCmSqlPropertyContainer*                iMetadataTitles;    //owned
+        /**
+         * Selected video title array
+         */
+        RArray<TInt>                            iVideoTitleArray;   //owned
+        /**
+         * Selected artist array
+         */
+        RArray<TInt>                            iArtistArray;       //owned
+        /**
+         * Selected genre array
+         */
+        RArray<TInt>                            iGenreArray;        //owned
+        /**
+         * Selected album array
+         */
+        RArray<TInt>                            iAlbumArray;        //owned
+        /**
+         * Selected track array
+         */
+        RArray<TInt>                            iTrackArray;        //owned
+        /**
+         * List media type
+         */
+        TCmMediaType                            iMediaType;
+        /**
+         * New list indicator
+         */
+        TBool                                   iNewList;
+        /**
+         * Metadata request state
+         */
+        TMSFillStates                           iState;
+        /**
+         * Selected list index from CMSFillView
+         */
+        TInt                                    iSelectedList;
+        /**
+         * setting page item array (servers)
+         */
+        CSelectionItemList*                     iServerArray;       // owned
+        /**
+         * metadata collector
+         */
+        CMSMetadataCollector*                   iMetadataCollector; // owned
+    };
+
+#endif // C_MSFILLRULEEDITLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msfillruleeditview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant Fill rule edit view class
+*
+*/
+
+
+
+
+
+#ifndef C_MSFILLRULEEDITVIEW_H
+#define C_MSFILLRULEEDITVIEW_H
+
+// INCLUDES
+#include "msengineobserver.h"
+#include "msbaseview.h"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSEngine;
+class CMSFillRuleEditList;
+
+/**
+ * CMSFillRuleEditView class.
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSFillRuleEditView ): public CMSBaseView
+    {
+
+    public:
+
+        /**
+         * Constructor.
+         */
+        CMSFillRuleEditView( CMSAppUi& aAppUi );
+
+        /**
+         * Default constructor.
+         */
+        void ConstructL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSFillRuleEditView();
+
+        /**
+         * Function shows a template query
+         *
+         * @since S60 5.1
+         * @param aResourceId, Query id
+         * @param aQueryHeading, Query header id
+         * @param aRuleNames, Query rule names
+         * @param aSelected, Selected rule index
+         * @return TInt, returns ETrue, if an item has been selected,
+         *                       EFalse, if query has been cancelled
+         */
+		TBool ShowTemplateQueryL( TInt aResourceId,
+                                  TInt aQueryHeading,
+                                  CDesCArray* aRuleNames,
+                                  TInt &aSelected );
+
+        /**
+         * Function shows a query
+         *
+         * @since S60 5.1
+         * @param aResourceId, Query id
+         * @return TInt, returns ETrue, if yes has been selected,
+         * otherwise EFalse
+         */
+		TBool ShowQueryL( TInt aResourceId );
+
+    protected: 
+   
+// From base class CAknView
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        TUid Id() const;
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoActivateL(
+            const TVwsViewId& aPrevViewId,
+            TUid aCustomMessageId,
+            const TDesC8& aCustomMessage );
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoDeactivate();
+        
+// From base class MEikMenuObserver
+
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+    private:
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi*                           iAppUi;         // not owned
+        /**
+         * Views container class
+         */
+        CMSFillRuleEditList*                iContainer;     // owned
+        /**
+         * application engine
+         */
+        CMSEngine*                          iMSEngine;      // not owned
+    };
+
+#endif // C_MSFILLRULEEDITVIEW_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msfillview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant Fill List view class
+*
+*/
+
+
+
+
+
+#ifndef C_MSFILLVIEW_H
+#define C_MSFILLVIEW_H
+
+// INCLUDES
+#include "msengineobserver.h"
+#include "msbaseview.h"
+
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSFillContainer;
+class CMSEngine;
+
+/**
+ * CMSFillView class.
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSFillView ): public CMSBaseView,
+                    public MMSEngineObserver
+    {
+
+    public:
+
+        /**
+         * Constructor.
+         */
+        CMSFillView( CMSAppUi& aAppUi );
+
+        /**
+         * default constructor.
+         */
+        void ConstructL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSFillView();
+
+        /**
+         * ListBox focus index
+         * @since S60 5.1
+         * @return TInt, focus index
+         */
+        TInt FocusIndex() const;
+
+        /**
+         * Changes cba according to selection status
+         * @since S60 3.2
+         * @param aSelected, ETrue if selected
+         */
+        void SetCbaL( TBool aSelected );
+
+        /**
+         * Shows 'updating lists' text on navi pane
+         * @Since S60 5.1
+         */
+        void ShowNaviTextL();
+
+        /**
+         * Sets iListUnSelected if selections changed
+         * @Since S60 5.1
+         */
+        void SetListUnselected();
+
+// From base class MEikMenuObserver
+        
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );
+                
+    protected:
+
+// From base class CAknView
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        TUid Id() const;
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoActivateL(
+            const TVwsViewId& aPrevViewId,
+            TUid aCustomMessageId,
+            const TDesC8& aCustomMessage );
+        
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoDeactivate();
+
+// From base class MMSEngineObserver
+
+        /**
+         * From MMSEngineObserver
+         * See base class definition
+         */
+        void ReadyL( TCmService aService, TInt aError );
+
+// From base class MEikMenuObserver
+        
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+    private:
+
+        /**
+         * Opens template query
+         * @Since S60 5.1
+         * @param aCommand, template type
+         */
+        void ShowTemplateQueryL( TInt aCommand );
+
+        /**
+         * Shows delete filled files query
+         * @Since S60 5.1
+         */
+        void DoDeleteQueryL();
+
+        /**
+         * Checks if priority or activity has been changed
+         * @Since S60 5.1
+         */
+        void CheckAndHandleChangesL();
+
+    private:
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi*                           iAppUi;         // not owned
+        /**
+         * Views container
+         */
+        CMSFillContainer*                   iContainer;     // owned
+        /**
+         * Focus index
+         */
+        TInt                                iFocusIndex;
+        /**
+         * Next view id
+         */
+        TUid                                iNextView;
+        /**
+         * flag for list selection changes
+         */
+        TBool                               iNewListSelected;
+        /**
+         * flag for list selection changes
+         */
+        TBool                               iListUnSelected;
+    };
+
+#endif // C_MSFILLVIEW_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msitembrowser.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant item browser base class
+*
+*/
+
+
+
+#ifndef C_MSITEMBROWSER_H
+#define C_MSITEMBROWSER_H
+
+// INCLUDES
+#include <aknlists.h>
+#include "cmcommon.h"           // service types
+#include "cmcommontypes.h"
+#include "msbasecontainer.h"
+
+// FORWARD DECLARATIONS
+class CAknIconArray;
+class CMSAppUi;
+class CCmBaseListItem;
+
+/**
+ * CMSItemBrowser class
+ * @since S60 5.1
+ */
+class CMSItemBrowser :   public CMSBaseContainer,
+                         public MEikListBoxObserver
+    {
+    // Icon enumerations
+    enum TMSListBoxIcons
+        {
+        EMarkIcon = 0,
+        EIconImage,
+        EIconAudio,
+        EIconVideo,
+        EIconCount
+        };
+
+    public:
+
+        /**
+         * Symbian default constructor.
+         */
+        void ConstructL( TRect aRect );
+
+        /**
+         * Destructor
+         */
+        virtual ~CMSItemBrowser();    
+
+        /**
+         * Sets current file status
+         * @since S60 5.1
+         * @param aIndex, item index
+         * @param TCmListItemStatus, file status
+         */
+        void SetFileStatus( TInt aIndex, TCmListItemStatus aStatus );
+
+        /**
+         * Gets current file status
+         * @since S60 5.1
+         * @param aIndex, item index
+         * @return TCmListItemStatus, file status
+         */
+        TCmListItemStatus FileStatus( TInt aIndex );
+
+        /**
+         * Return pointer to listbox
+         * @since S60 5.1
+         * @return CEikListbox, listbox
+         */
+        CEikListBox* ListBox();
+
+    protected:
+
+        /**
+         * Updates listbox data
+         * @since S60 5.1
+         */
+        void UpdateListBoxDataL();
+
+        /**
+         * Gets browse data from server
+         * @since S60 5.1
+         */
+        virtual void GetBrowseDataL() = 0;        
+
+// From base class CCoeControl
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        TInt CountComponentControls() const;
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        void SizeChanged();
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                     TEventCode aType );
+
+// From base class MEikListBoxObserver
+
+        /**
+         * From MEikListBoxObserver
+         * See base class definition
+         */
+        void HandleListBoxEventL(
+                CEikListBox* aListBox,
+                TListBoxEvent aEventType );
+
+    protected:
+
+        /**
+         * Listbox control
+         */
+        CEikFormattedCellListBox*               iListBox;       // owned
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi*                               iAppUi;         // not owned
+        /**
+         * Item array
+         */
+        RPointerArray<CCmBaseListItem>*         iItemArray;
+        /**
+         * Internal array for listbox item texts
+         */
+        CDesCArrayFlat*                         iInternalItemArray;
+        /**
+         * Next item index for thumbnail loading
+         */
+        TInt                                    iNextItemIndex;
+        /**
+         * Icon count for thumbnails
+         */
+        TInt                                    iIconCount;
+        /**
+         * Mediatype of selected rule
+         */
+        TCmMediaType                            iMediaType;
+    };
+
+#endif // C_MSITEMBROWSER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msmaincontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant main container class
+*
+*/
+
+
+#ifndef C_MSMAINCONTAINER_H
+#define C_MSMAINCONTAINER_H
+
+// INCLUDES
+#include <aknlists.h>
+#include <eiklbo.h>             // listbox observer
+#include "cmcommon.h"           // service types
+#include "msengineobserver.h"
+#include "msbasecontainer.h"
+#include "mspropertywatcher.h"
+#include "msmemorycardmonitor.h" //mmc event observer
+
+// FORWARD DECLARATIONS
+class CAknIconArray;
+class CMSAppUi;
+class CMSEngine;
+class MMSEngineObserver;
+class CMSMainView;
+
+
+/**
+ * CMSMainContainer class
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSMainContainer ): public CMSBaseContainer,
+                         public MEikListBoxObserver,
+                         public MMSEngineObserver,
+                         public MMSPropertyObserver,
+                         public MMSMemoryCardObserver
+    {
+    // Icon enumerations
+    enum TMSListBoxIcons
+        {
+        EIconSync = 0,
+        EIconSyncStop,
+        EIconToHome,
+        EIconToHomeInactive,
+        EIconFromHome,
+        EIconFromHomeInactive,
+        EIconCount
+        };
+    // Synchronization states
+    enum TMSSyncState
+        {
+        ESyncNotRunning = 0,
+        ESyncRunning,
+        ESyncWaiting
+        };
+    
+    // Update steps
+    enum TMSUpdateStep
+        {
+        EFirstStep = 0,
+        ESecondStep,
+        EThirdStep,
+        EForthStep,
+        EEndStep
+        };
+        
+    public:
+        /**
+         * Constructor.
+         */
+        CMSMainContainer( CMSAppUi& aAppUi,
+                          CMSMainView& aView );
+
+        /**
+         * Symbian default constructor.
+         */
+        void ConstructL( TRect aRect );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSMainContainer();    
+
+        /**
+         * sets manual wizard execution info
+         * @param appWizardRun, wizard executed
+         * @since S60 5.1
+         */
+        void SetManualWizardInfo( TBool aAppWizardRun );
+
+        /**
+         * Shows refresh indiction on navi pane
+         * @since S60 5.1
+         */
+        void ShowRefreshIndicationL();
+
+        /**
+         * sets refresh state
+         * @since S60 5.1
+         */
+        void StopRefreshL();
+
+        /**
+         * return highlighted item index
+         * @since S60 5.1
+         */
+        TInt SelectedItemIndex();
+
+        /**
+         * Opens the selected listbox item
+         * @since S60 5.1
+         */
+        void OpenSelectedListboxItemL();
+
+        /**
+         * Starts asynchronous metadata delete
+         * @since S60 5.1
+         */
+        void StartMetadataDeleteL();
+    
+        void RunHarvest();
+        // From base class MMSMemoryCardObserver
+                
+                /**
+                 * From MMSMemoryCardObserver
+                 * See base class definition
+                 */
+                 void MemoryCardChangedL( TMemoryCardEvent aEvent );        
+    protected:
+    
+// From base class CCoeControl    
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        void GetHelpContext(TCoeHelpContext& aContext) const;    
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        TInt CountComponentControls() const;
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        void SizeChanged();
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                     TEventCode aType );
+
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        void HandleResourceChange( TInt aType );
+
+// From base class MEikListBoxObserver
+
+        /**
+         * From MEikListBoxObserver
+         * See base class definition
+         */
+        void HandleListBoxEventL( CEikListBox* aListBox,
+                                  TListBoxEvent aEventType );
+
+// From base class MMSEngineObserver
+
+        /**
+         * From MMSEngineObserver
+         * See base class definition
+         */
+        void ReadyL( TCmService aService, TInt aError );
+
+// From base class MMSPropertyObserver
+
+        /**
+         * From MMSPropertyObserver
+         * See base class definition
+         */
+        void PropertyChangedL( TCmService aService,
+                               TInt aTotalItems,
+                               TInt aProcessedItems,
+                               TInt /*aItemsToBeProcessed*/ );
+                               
+         
+    private:
+
+        /**
+         * Updates listbox data
+         * @since S60 5.1
+         */
+        void UpdateListBoxDataL();
+
+        /**
+         * Starts sync operation
+         * @since S60 5.1
+         */
+        void StartSyncL();
+
+        /**
+         * Shows error note
+         * @since S60 5.1
+         * @param aTextResource, error text resource
+         */
+        void ShowErrorNoteL( TInt aTextResource );
+
+        /**
+         * Shows last synchronization time on navi pane
+         * @since S60 5.1
+         */
+        void SetNaviTextLastSyncL();
+
+        /**
+         * Callback for periodic timer
+         * @since S60 5.1
+         * @param TAny, callback observer
+         */
+        static TInt TimerCallbackL(TAny* aObject);
+
+        /**
+         * Callback for navi pane timer
+         * @since S60 5.1
+         * @param TAny, callback observer
+         */
+        static TInt NaviTimerCallbackL(TAny* aObject);        
+        
+        /**
+         * Static callback method for update list box data
+         * @since S60 5.1
+         * @param TAny, callback observer
+         * @return
+         */
+        static TInt BackgroundUpdateListL( TAny* aObject );
+        
+        /**
+         * Supdate list box data step by step
+         * @since S60 5.1
+         * @return
+         */
+        TInt UpdateListByStepL();
+        
+        /**
+         * Checks if fill list is selected
+         *
+         * @since S60 5.1
+         * @param None
+         * @return TBool, ETrue if list is selected, EFalse otherwise
+         */
+        TBool CheckIfFillListSelected();
+
+        /**
+         * Shows 'refresh completed' text in navi pane
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */        
+        void ShowRefreshCompleteTextL();
+
+    private:
+
+        /**
+         * Listbox control
+         */
+        CEikFormattedCellListBox*               iListBox;       // owned
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi*                               iAppUi;         // not owned
+
+        /**
+         * active refresh operation indicator
+         */
+        TBool                                   iRefreshRunning;
+
+        /**
+         * active sync operation indicator
+         */
+        TMSSyncState                            iSyncRunning;
+
+        /**
+         * active preprocess operation indicator
+         */
+        TBool                                   iPreprocessRunning;
+
+        /**
+         * containers view
+         */
+        CMSMainView*                            iView;           // not owned
+
+        /**
+         * Transfer time
+         */
+        TInt                                    iTransferTime;
+        /**
+         * Count of items to be stored
+         */
+        TInt                                    iItemsToBeStored;
+        /**
+         * Count of items to be filled
+         */
+        TInt                                    iItemsToBeFilled;
+        /**
+         * Progress watcher
+         */
+        CMSPropertyWatcher*                     iMSPropertyWatcher; // owned
+        
+        /**
+         * MemoryCard monitor
+         */
+        CMSMemoryCardMonitor*                   iMemoryCardMonitor; // owned
+
+        /**
+         * Wizard execution flag
+         */
+        TBool                                   iAppWizardRun;
+        
+        /**
+         * Last sync timer
+         */
+        CPeriodic*                              iPeriodic;          // Owned
+        
+        /**
+         * Navi pane text timer
+         */
+        CPeriodic*                              iNaviTimer;         // Owned        
+        
+        /**
+         * Idle time active object, Owend
+         */
+        CIdle*                                  iUpdateList;        // Owned
+        
+        /**
+         *  the count of requests for refresh UI
+         */
+        TInt                                    iRequestCt;
+        
+        /**
+         * current step of update list box
+         */
+        TMSUpdateStep                           iCurStep;
+        
+        /**
+         * Fill list selection status
+         */
+        TBool                                   iFillListSelected;
+    };
+
+#endif // C_MSMAINCONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msmainview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant main view class
+*
+*/
+
+
+
+
+
+#ifndef C_MSMAINVIEW_H
+#define C_MSMAINVIEW_H
+
+// INCLUDES
+#include "msbaseview.h"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSMainContainer;
+class CMSEngine;
+class CMSSettingsView;
+class CGSPluginInterface;
+
+/**
+ * CMSMainView view class. Main view is visible when
+ * application is launched
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSMainView ): public CMSBaseView
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        CMSMainView( CMSAppUi& aAppUi );
+
+        /**
+         * Symbian default constructor.
+         */
+        void ConstructL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSMainView();
+
+        /**
+         * Changes cba according to hinghlighted item index
+         * @since S60 3.2
+         * @param aHighlightedIndex, highlighted item index
+         */
+        void SetCbaL( TInt aHighlightedIndex );
+
+        /**
+         * ListBox focus index
+         * @since S60 5.1
+         * @return TInt, focus index
+         */
+        TInt FocusIndex() const;
+
+        /**
+         * Checks if MMC card has been changed
+         * @since S60 5.1
+         */
+        void CheckMemoryCardL();
+
+    protected:
+
+// From base class CAknView
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        TUid Id() const;
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage );
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoDeactivate();
+
+// From base class MEikMenuObserver
+
+        /**
+         * From MEikMenuObserver
+         */
+        void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
+
+    private:
+
+        /**
+         * Show memory card query and handles selection
+         * @since S60 5.1
+         * @param RPointerArray<CCmDriveInfo>&, stored drive array
+         * @param RPointerArray<CCmDriveInfo>&, device drive array
+         * @param TInt, mmc drive index
+         */
+        void ShowAndHandleMMCQueryL(
+                             RPointerArray<CCmDriveInfo>& aStoredArray,
+                             RPointerArray<CCmDriveInfo>& aDriveArray,
+                             TInt index );
+
+        /**
+         * Starts the wizard when run first time, callback for CIdle
+         * @since S60 5.1
+         * @param aPtr, Pointer to this class
+         * @return TBool, EFalse because of one time call
+         */
+        static TBool InitializeWizardL( TAny* aPtr );
+
+        /**
+         * Starts the new memory card dialog when new
+         * memory card inserted, callback for CIdle
+         * @since S60 5.1
+         * @param aPtr, Pointer to this class
+         */
+        static TInt InitializeMemoryCardL( TAny* aPtr );
+
+        /**
+         * Do starts the wizard when run first time
+         * @since S60 5.1
+         * @return TBool, EFalse because of one time call
+         */
+        TBool DoInitializeWizardL();
+
+        /**
+         * Do starts the new memory card dialog when new
+         * memory card inserted
+         * @since S60 5.1
+         * @return TBool, EFalse because of one time call
+         */
+        void DoInitializeMemoryCardL();
+
+    private:
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi*                           iAppUi;         // not owned
+
+        /**
+         * view's container
+         */
+        CMSMainContainer*                   iContainer;     // owned
+
+        /**
+         * Check MMC indicator
+         */
+        TBool                               iCheckMMC;
+        /**
+         * Idle loop to initialize wizard
+         */
+        CIdle*                              iIdle;
+
+        /**
+         * Flag for wizard initialization
+         */
+        TBool                               iWizardInitialization;
+    };
+
+#endif // C_MSMAINVIEW_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msmemorycardmonitor.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for CMSMemoryCardMonitor class
+*
+*/
+
+
+#ifndef __MSMMCMONITOR_H__
+#define __MSMMCMONITOR_H__
+
+#include <e32base.h>
+#include <f32file.h>
+
+// Memory card events
+enum TMemoryCardEvent
+    {
+    EMemoryCardInsert = 0, //Insert memorycard
+    EMemoryCardRemove,     //Remove memorycard
+    EMemoryCardOthers      //Other event such as write, read, etc. 
+    };
+
+/**
+ * Observer class for memory slot events
+ *
+ *  @since S60 5.1
+ */
+class MMSMemoryCardObserver
+    {
+    public:
+        /**
+         * Implement this method to be notified when Memory Card status
+         * changes.
+         *
+         * @since S60 5.1
+         * @param aEvent, memory slot event
+         * @return None;
+         */
+        virtual void MemoryCardChangedL( TMemoryCardEvent aEvent ) = 0;
+    };
+
+/**
+ * Memory card monitor class
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSMemoryCardMonitor ) : public CActive
+    {
+    public:
+
+        /**
+         * two-phase constructor
+         *
+         * @since S60 5.1
+         * @param aObserver, memorycard
+         * @param aFs, file server session
+         * @return pointer to CMSMemoryCardMonitor
+         */
+        static CMSMemoryCardMonitor* NewL( MMSMemoryCardObserver* aObserver, 
+                                           RFs& aFs );
+
+        /**
+         * two-phase constructor
+         *
+         * @since S60 5.1
+         * @param aObserver, memorycard
+         * @param aFs, file server session
+         * @return pointer to CMSMemoryCardMonitor
+         */
+        static CMSMemoryCardMonitor* NewLC( MMSMemoryCardObserver* aObserver, 
+                                           RFs& aFs );                                           
+        
+        /**
+         * Destructor
+         */
+        virtual ~CMSMemoryCardMonitor();
+        
+        /**
+         * Start monitoring memory card slot
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void StartMonitor();
+        
+    protected:
+
+// From base class CActive
+
+        /**
+         * From CActive
+         * See base class definition         
+         */
+        void RunL();
+        
+        /**
+         * From CActive
+         * See base class definition         
+         */        
+        void DoCancel();
+        
+        /**
+         * From CActive
+         * See base class definition         
+         */
+        TInt RunError( TInt aError );
+    
+    private:
+    
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aObserver, memorycard
+         * @param aFs, file server session
+         * @return None;
+         */
+        CMSMemoryCardMonitor( MMSMemoryCardObserver* aObserver, RFs& aRfs );
+            
+        /**
+         * Performs the second phase construction.
+         *
+         * @since S60 5.1
+         * @param aObserver, memorycard
+         * @param aFs, file server session
+         * @return None         
+         */         
+        void ConstructL(); 
+        
+        /**
+         * Checks if memory card is available
+         *
+         * @since S60 5.1
+         * @return TBool, ETrue if found, EFalse otherwise         
+         */ 
+        TBool MemoryCardExist() const;
+
+    private:
+            
+        /**
+         * Memorycard observer class
+         */
+        MMSMemoryCardObserver* iObserver;                   // not owned
+
+        /**
+         * Reference to file server session
+         */
+        RFs&                   iFsSession;
+ 
+        /**
+         * Memorycard exist or not
+         */
+        TBool                  iMemoryCardExist;
+    };
+
+#endif // __MSMMCMONITOR_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msmetadatacollector.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSMetadataCollector class definition
+*
+*/
+
+
+#ifndef __CMSMETADATACOLLECTOR_H
+#define __CMSMETADATACOLLECTOR_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSMetadataCollector;
+class CCmSqlPropertyContainer;
+class CCmSqlPropertyCollector;
+
+/**
+ *  CMSMetadataCollector class
+ *  Collects metadata
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSMetadataCollector ): public CBase
+    {
+    private:
+        // Container types
+        enum TMSContainerTypes
+            {
+            ETracks = 0,
+            EArtists,
+            EGenres,
+            EAlbums            
+            };
+
+    public:
+        
+        /**
+         * two-phase constructor
+         *
+         * @Since S60 5.1
+         * @param aAppUi, application ui
+         * @param aMediaType, mediatype
+         * @param aGenreArray, genre container
+         * @param aArtistArray, artist container
+         * @param aAlbumArray, album container
+         * @param aTrackArray, track/video title container
+         * @return pointer to CMSMetadataCollector class
+         */
+        IMPORT_C static CMSMetadataCollector* NewL( CMSAppUi& aAppUi,
+                                                    TCmMediaType aMediaType,
+                                                    RArray<TInt>& aGenreArray,
+                                                    RArray<TInt>& aArtistArray,
+                                                    RArray<TInt>& aAlbumArray,
+                                                    RArray<TInt>& aTrackArray );
+    
+        /**
+         * two-phase constructor
+         *
+         * @Since S60 5.1
+         * @param aAppUi, application ui
+         * @param aMediaType, mediatype
+         * @param aGenreArray, genre container
+         * @param aArtistArray, artist container
+         * @param aAlbumArray, album container
+         * @param aTrackArray, track/video title container
+         * @return pointer to CMSMetadataCollector class
+         */
+        IMPORT_C static CMSMetadataCollector* NewLC( CMSAppUi& aAppUi,
+                                                     TCmMediaType aMediaType,
+                                                     RArray<TInt>& aGenreArray,
+                                                     RArray<TInt>& aArtistArray,
+                                                     RArray<TInt>& aAlbumArray,
+                                                     RArray<TInt>& aTrackArray );
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CMSMetadataCollector();
+    
+    public:
+    
+        /**
+         * Starts collecting metadata items
+         *
+         * @since S60 5.1         
+         * @param None
+         * @return None
+         */
+        void GetFilteredMetadataL();
+        
+        /**
+         * Returns genre array
+         *
+         * @since S60 5.1
+         * @param None
+         * @return CCmSqlPropertyContainer, genre container
+         */
+        CCmSqlPropertyContainer* Genres();
+
+        /**
+         * Returns artist array
+         *
+         * @since S60 5.1
+         * @param None
+         * @return CCmSqlPropertyContainer, artist container
+         */
+        CCmSqlPropertyContainer* Artists();
+        
+        /**
+         * Returns album array
+         *
+         * @since S60 5.1
+         * @param None
+         * @return CCmSqlPropertyContainer, album container
+         */
+        CCmSqlPropertyContainer* Albums();
+        
+        /**
+         * Returns track/video title array
+         * @since S60 5.1
+         * @param None
+         * @return CCmSqlPropertyContainer, track container
+         */
+        CCmSqlPropertyContainer* Tracks();
+                             
+    protected:
+
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aAppUi, application ui
+         * @param aMediaType, mediatype
+         * @param aGenreArray, genre container
+         * @param aArtistArray, artist container
+         * @param aAlbumArray, album container
+         * @param aTrackArray, track/video title container
+         * @return None
+         */
+        CMSMetadataCollector( CMSAppUi& aAppUi,
+                              TCmMediaType aMediaType,
+                              RArray<TInt>& aGenreArray,
+                              RArray<TInt>& aArtistArray,
+                              RArray<TInt>& aAlbumArray,
+                              RArray<TInt>& aTrackArray );
+
+        /**
+         * Performs the second phase construction.
+         */
+        void ConstructL();
+
+    private:
+        /**
+         * Deletes all items from containers
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+         
+        void DeleteAllItems();
+        /**
+         * Adds container to collector
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */        
+        void AddContainersL();
+        
+    private:
+        /**
+         * Application UI
+         */
+        CMSAppUi*                             iMSAppUi;         // not owned
+        /**
+         * MediaType indicator
+         */
+         TCmMediaType                         iMediaType;
+        /**
+         * Artist container
+         */
+        CCmSqlPropertyContainer*              iGenreContainer;  // not owned       
+        /**
+         * Artist container
+         */
+        CCmSqlPropertyContainer*              iArtistContainer; // not owned
+        /**
+         * Artist container
+         */
+        CCmSqlPropertyContainer*              iAlbumContainer;  // not owned        
+        /**
+         * Artist container
+         */
+        CCmSqlPropertyContainer*              iTrackContainer;  // not owned        
+        /**
+         * Container of MetadataContainers
+         */
+        CCmSqlPropertyCollector*              iMetadataCollector; // owned        
+        /**
+         * Selected genre array
+         */
+        RArray<TInt>*                         iGenreArray;        //owned
+        /**
+         * Selected artist array
+         */
+        RArray<TInt>*                         iArtistArray;       //owned
+        /**
+         * Selected album array
+         */
+        RArray<TInt>*                         iAlbumArray;        //owned
+        /**
+         * Selected track array
+         */
+        RArray<TInt>*                         iTrackArray;        //owned
+        
+    };
+
+#endif //  __CMSMETADATACOLLECTOR_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msmultiselectiondialog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSMultiselectionDialog class implementation
+*
+*/
+
+
+#ifndef MSMULTISELECTIONDIALOG_H
+#define MSMULTISELECTIONDIALOG_H
+
+// INCLUDES
+#include <AknDialog.h>
+#include <aknselectionlist.h>
+#include <aknsfld.h>
+#include <aknnavide.h>
+#include <AknIconArray.h>
+
+// FORWARD DECLARATIONS
+class CAknColumnListBox;
+class CAknSearchField;
+class CSelectionItemList;
+class CAknTitlePane;
+
+// CLASS DECLARATION
+
+/**
+ * CMSMultiselectionDialog dialog class
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSMultiselectionDialog ) :
+    public CAknSelectionListDialog
+    {
+    public:
+        
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aItemArray, list of items
+         * @param aTitle, dialog title
+         */
+        static CMSMultiselectionDialog* NewL(
+                            CSelectionItemList* aItemArray,
+                            const TDesC& aTitle );
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aItemArray, list of items
+         * @param aTitle, dialog title
+         */
+        static CMSMultiselectionDialog* NewLC(
+                            CSelectionItemList* aItemArray,
+                            const TDesC& aTitle );                            
+
+        /**
+         * Destructor.
+         */
+       virtual ~CMSMultiselectionDialog();
+
+
+    protected:  // New functions
+
+        void ConstructL( const TDesC& aTitle );
+
+        /**
+         * Loads a possibly skinned icon and adds it to icon array
+         *
+         * @since S60 5.1
+         * @param aArray, array of icons
+         * @param aSkin, skin instance
+         * @param aMbmFile, reference to icon file
+         * @param aID, skinned icon id
+         * @param aBitmapId, bitmap id
+         * @param aMaskId, bitmap mask id
+         */
+        void AppendIconToArrayL( CAknIconArray* aArray,
+                                 MAknsSkinInstance* aSkin,
+                                 const TDesC& aMbmFile,
+                                 const TAknsItemID& aID,
+                                 TInt aBitmapId,
+                                 TInt aMaskId) const;
+
+
+        /**
+         * Appends first item ("share all files") to the listbox
+         *
+         * @since S60 5.1
+         * @param CDesCArray, listbox array
+         * @return None
+         */
+        void AppendShareAllSelectionL(CDesCArray* aListBoxArray) const;
+
+
+    protected:
+
+// From base class CAknSelectionListDialog
+        
+        /**
+         * From CAknSelectionListDialog
+         * See base class definition
+         */
+        void PreLayoutDynInitL();
+
+        /**
+         * From CAknSelectionListDialog
+         * See base class definition
+         */
+        TBool OkToExitL( TInt aButtonId );
+
+
+    private:
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aItemArray, list item array
+         * @return None
+         */
+        CMSMultiselectionDialog( CSelectionItemList* aItemArray );
+
+        /**
+         * Generates text array for listbox
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void GenerateInternalArrayL();
+
+        /**
+         * Sets checkbox statas
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        void SetAllSelectionsL();
+
+        /**
+         * Deselects other items if first one is selected
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        void HandleSelectionsL();
+
+        /**
+         * Updates item array selections
+         *         
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void UpdateAllSelectionsL();
+        
+        /**
+         * handle for the pointer device input
+         *
+         * @since S60 5.1
+         * @param aPointerEvent, pointerevent
+         * @return None                           
+         */
+        void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+
+
+        /**
+         * Handeles selection key press
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void HandleSelectionKeyPressL();
+
+    private:
+    
+        /**
+         * dialog control
+         */
+        CAknColumnListBox*              iListBox;           // owned
+        
+        /**
+         * title pane
+         */
+        CAknTitlePane*                  iTitlePane;         // not owned
+       
+        /**
+         * previous view title
+         */
+        HBufC*                          iPreviousTitle;     // owned
+       
+        /**
+         * selected item - needed for creation of CAknSelectionListDialog
+         */
+        TInt                            iSelectedItem;
+       
+        /**
+         * array for listbox items
+         */
+        CSelectionItemList*             iItemArray;         // not owned
+
+        /**
+         * internal array for listbox item texts
+         */
+        CDesCArrayFlat*                 iInternalItemArray; // owned
+        
+        /**
+         * First item selection status
+         */
+        TBool                           iFirstItemSelected;
+        /**
+         * iNaviPane
+         */
+        CAknNavigationControlContainer* iNaviPane;          // not owned
+        
+        /**
+         * navi decorator
+         */
+        CAknNavigationDecorator*    iNaviDecorator;         // owned
+    };
+
+#endif  // MSMULTISELECTIONDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msmultiselectionsettingpage.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant multiselection setting page
+*
+*/
+
+
+#ifndef C_MSMULTISELECTIONSETTINGPAGE_H
+#define C_MSMULTISELECTIONSETTINGPAGE_H
+
+// INCLUDES
+#include <akncheckboxsettingpage.h>
+
+// FORWARD DECLARATIONS
+class CSelectionItemList;
+
+
+// CLASS DECLARATION
+
+/**
+* CMSMultiselectionSettingPage class.
+*/
+NONSHARABLE_CLASS( CMSMultiselectionSettingPage ):
+                            public CAknCheckBoxSettingPage
+    {
+    public: // Constructor and destructor
+
+        /**
+         * two-phase constructor.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, setting page resource id
+         * @param aItemArray, item list
+         * @param aFirstItemSwitch, set ETrue if 'any' item is shown, EFalse
+         *                          otherwise
+         * @return pointer to CMSMultiselectionSettingPage
+         */
+        static CMSMultiselectionSettingPage* NewL( TInt aIdentifier,
+                                      CSelectionItemList& aItemArray,
+                                      TBool aFirstItemSwitch );
+
+        /**
+         * two-phase constructor.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, setting page resource id
+         * @param aItemArray, item list
+         * @param aFirstItemSwitch, set ETrue if 'any' item is shown, EFalse
+         *                          otherwise
+         * @return pointer to CMSMultiselectionSettingPage
+         */
+        static CMSMultiselectionSettingPage* NewLC( TInt aIdentifier,
+                                      CSelectionItemList& aItemArray,
+                                      TBool aFirstItemSwitch );
+        /**
+        * Destructor.
+        */
+        virtual ~CMSMultiselectionSettingPage();
+
+
+    protected: 
+
+// From base class CAknCheckboxSettingPage
+
+        /**
+         * From CAknCheckboxSettingPage
+         * See base class definition
+         */
+        void SelectCurrentItemL();
+
+        /**
+         * From CAknCheckboxSettingPage
+         * See base class definition
+         */
+        TBool OkToExitL(TInt aButtonId);
+
+    private:
+
+        /**
+         * Deselects other items if first one is selected
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void HandleSelectionsL();
+
+    private:
+
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, setting page resource id
+         * @param aItemArray, item list
+         * @param aFirstItemSwitch, set ETrue if 'any' item is shown, EFalse
+         *                          otherwise
+         * @return None
+         */
+        CMSMultiselectionSettingPage(
+            TInt aIdentifier,
+            CSelectionItemList& aItemArray,
+            TBool aFirstItemSwitch
+            );
+
+        /**
+         * Performs the second phase construction.
+         */
+        void ConstructL();
+
+        /**
+         * Updates selections to item list
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void UpdateAllSelections();
+        
+        /**
+         * handle for the pointer device input
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void  HandlePointerEventL (const TPointerEvent &aPointerEvent);
+
+    private:
+        /**
+         * setting page item array (servers)
+         */
+        CSelectionItemList*                 iItemArray;         // not owned
+        /**
+         * Flag for indicating that special selection is needed
+         */
+        TBool                               iFirstItemSwitch;
+    };
+
+#endif // C_MSMULTISELECTIONSETTINGPAGE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msparameteragent.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSParameterAgent class definition
+*
+*/
+
+
+#ifndef C_MSPARAMETERAGENT_H
+#define C_MSPARAMETERAGENT_H
+
+// INCLUDES
+#include <e32base.h>
+#include "mediaservant.hrh"
+
+// template parameters
+struct TMSTemplate
+    {
+    TInt templateType; // mediatype
+    TInt selectedTemplate; // selected template
+    TBuf<KMaxFileName> templateName; // template name
+    };
+
+// FORWARD DECLARATIONS
+
+/**
+ * CMSParameterAgent class.
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSParameterAgent ): public CBase
+    {
+
+    public:
+
+        /**
+         * Constructor.
+         */
+        CMSParameterAgent();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSParameterAgent();
+
+        /**
+         * Sets selected rule template
+         *
+         * @since S60 5.1
+         * @param aTemplate, selected template
+         * @return None
+         */
+        void SetRuleTemplate( TMSTemplate aTemplate );
+
+        /**
+         * Returns selected rule template
+         *
+         * @since S60 5.1
+         * @return TMSRuleTemplate, selected template
+         * @return None
+         */
+        TMSTemplate GetRuleTemplate() const;
+
+        /**
+         * Sets selected index of main view
+         *
+         * @since S60 5.1
+         * @param aIndex, selected listbox item index
+         * @return None
+         */
+        void SetMainViewFocusIndex( TInt aIndex );
+
+        /**
+         * Returns focus index of main view.
+         *
+         * @since S60 5.1
+         * @return TInt, focus index of main view
+         * @return None
+         */
+        TInt MainViewFocusIndex() const;
+
+        /**
+         * Sets selected index of fill view
+         *
+         * @since S60 5.1
+         * @param aIndex, selected listbox item index
+         * @return None
+         */
+        void SetFillViewFocusIndex( TInt aIndex );
+
+        /**
+         * Returns focus index of fill view.
+         *
+         * @since S60 5.1
+         * @return TInt, focus index of fill view
+         * @return None
+         */
+        TInt FillViewFocusIndex() const;
+
+        /**
+         * Sets selected index of store view
+         *
+         * @since S60 5.1
+         * @param aIndex, selected listbox item index
+         * @return None
+         */
+        void SetStoreViewFocusIndex( TInt aIndex );
+
+        /**
+         * Returns focus index of store view.
+         *
+         * @since S60 5.1
+         * @param None
+         * @return TInt, focus index of store view
+         */
+        TInt StoreViewFocusIndex() const;
+        
+        /**
+         * Sets uid of current view
+         *
+         * @since S60 5.1
+         * @param aViewId, view id
+         * @return None
+         */
+        void SetPreviousViewId( TUid aViewId );
+
+        /**
+         * Returns uid of previous view.
+         *
+         * @since S60 5.1
+         * @param None
+         * @return TUid, focus index of previous view
+         */
+        TUid PreviousViewId() const;
+
+        /**
+         * Sets browse target
+         *
+         * @since S60 5.1
+         * @param aBrowseTarget, browse target
+         * @return None
+         */
+        void SetBrowseTarget( TMSBrowseTarget aBrowseTarget );
+
+        /**
+         * Gets browse target
+         *
+         * @since S60 5.1
+         * @param None
+         * @return TMSBrowseTarget, browse target
+         */
+        TMSBrowseTarget GetBrowseTarget() const;
+
+    private:
+
+        /**
+         * previous view focus index
+         */
+        TInt                                iPreviousFocusIndex;
+        /**
+         * previous view focus index
+         */
+        TUid                                iPreviousViewId;
+        /**
+         * selected template
+         */
+        TMSTemplate                         iTemplate;
+        /**
+         * Browse target
+         */
+        TMSBrowseTarget                     iBrowseTarget;
+        /**
+         * Main view focus index
+         */
+        TInt                                iMainViewFocusIndex;
+        /**
+         * Fill view focus index
+         */
+        TInt                                iFillViewFocusIndex;
+        /**
+         * Store view focus index
+         */
+        TInt                                iStoreViewFocusIndex;
+    };
+
+#endif // C_MSPARAMETERAGENT_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/mspropertywatcher.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSPropertyWatcher class defition
+*
+*/
+
+
+
+#ifndef __MSPROPERTYWATCHER_H__
+#define __MSPROPERTYWATCHER_H__
+
+
+// Include Files
+#include <e32base.h>
+#include <e32property.h>
+#include "cmcommon.h"
+
+// FORWARD DECLARATIONS
+class MMSPropertyObserver;
+
+// CLASS DECLARATION
+/**
+ * Active object class for MSEngine
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSPropertyWatcher ): public CActive
+    {
+
+    public:
+
+        /**
+         * Two-phased constructor.
+         */
+        static CMSPropertyWatcher* NewL();
+
+        /**
+         * Two-phased constructor.
+         */
+        static CMSPropertyWatcher* NewLC();        
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMSPropertyWatcher();
+
+        /**
+         * Sets property observer
+         * @since S60 5.1
+         * @param aObserver, property observer
+         * @return None
+         */
+        void SetObserver( MMSPropertyObserver* aObserver );
+
+        /**
+         * Starts listening property
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void StartL();
+
+        /**
+         * Stops listening property
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void Stop();
+
+    protected:
+
+// From base class CActive
+
+        /**
+         * From CActive
+         * See base class definition
+         */
+        virtual void RunL();
+
+        /**
+         * From CActive
+         * See base class definition
+         */
+        virtual void DoCancel();
+
+        /**
+         * From CActive
+         * See base class definition
+         */
+        TInt RunError( TInt aError );  
+        
+    private:
+
+        /**
+         * Performs the first phase of two phase construction.
+         */
+        CMSPropertyWatcher();
+
+        /**
+         * Performs the second phase construction.
+         */
+        void ConstructL();
+
+
+    private:
+
+        /**
+         * property
+         */
+        RProperty                       iProgressInfo;
+        /**
+         * property observer
+         */
+        MMSPropertyObserver*            iObserver;      // not owned
+
+    };
+
+
+
+
+/**
+ *  Property observer
+ *  @since Series 60 3.1
+ */
+class MMSPropertyObserver
+    {
+    public:
+ 
+    /**
+     * Informs about property changes
+     * @param aService, completed service
+     * @param aError, error code
+     * @since S60 5.1
+     */
+     virtual void PropertyChangedL( TCmService aService,
+                                    TInt aTotalItems,
+                                    TInt aProcessedItems,
+                                    TInt aItemsToBeProcessed ) = 0;
+    };
+
+#endif  // __MSPROPERTYWATCHER_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msruleamountsetting.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSRuleAmountSetting class definition
+*
+*/
+
+
+#ifndef C_MSRULEAMOUNTSETTING_H
+#define C_MSRULEAMOUNTSETTING_H
+
+// INCLUDES
+#include "mssettingitems.h"
+
+
+// CLASS DECLARATION
+
+/**
+ * CMSRuleAmountSetting class. This class is used when
+ * transfer time is modified
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSRuleAmountSetting ):
+                    public CMSEnumeratedTextPopupSettingItem
+    {
+    public:
+
+        /**
+         * Constructor.
+         */
+        CMSRuleAmountSetting( TInt aIdentifier,
+                              TInt &aLimitType,
+                              TInt &aValue );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSRuleAmountSetting();
+
+
+    protected: 
+
+// From base class CAknSettingItem
+
+        /**
+         * From CAknSettingItem
+         * See base class definition
+         */
+        void EditItemL( TBool aCalledFromMenu );
+        
+        /**
+         * From CAknSettingItem
+         * See base class definition
+         */
+        void CompleteConstructionL();
+
+    private:
+    
+        /**
+         * Limit type
+         */
+        TInt&                                   iLimitType;
+    
+        /**
+         * Amount of files
+         */
+        TInt&                                   iValue;
+    
+        /**
+         * Button event on setting page
+         */
+        TAknSettingPageEvent                    iSettingPageEvent;
+    };
+
+#endif // C_MSRULEAMOUNTSETTING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msrulefilesizesetting.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSRuleFileSizeSetting class definition
+*
+*/
+
+
+#ifndef C_MSRULEFILESIZESETTING_H
+#define C_MSRULEFILESIZESETTING_H
+
+// INCLUDES
+#include "mssettingitems.h"
+
+// CLASS DECLARATION
+
+/**
+ * CMSRuleFileSizeSetting class. This class is used when
+ * transfer time is modified
+ *
+ * @since S60 5.1
+*/
+NONSHARABLE_CLASS( CMSRuleFileSizeSetting ):
+                    public CMSEnumeratedTextPopupSettingItem
+    {
+    public:
+
+        /**
+         * Constructor.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, resource identifier
+         * @param aType, setting type ( min / max size )
+         * @param aSelection, selection index
+         * @param aValue, size value
+         * @return None
+         */
+        CMSRuleFileSizeSetting(
+            TInt aIdentifier,
+            TInt aType,
+            TInt &aSelection,
+            TInt &aValue
+            );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSRuleFileSizeSetting();
+
+
+    protected: 
+   
+// From base class CAknSettingItem
+
+        /**
+         * From CAknSettingItem
+         * See base class definition
+         */
+        void EditItemL( TBool aCalledFromMenu );
+        
+        /**
+         * From CAknSettingItem
+         * See base class definition
+         */
+        void CompleteConstructionL();
+
+    private:
+        
+        /**
+         * Setting type Min/Max
+         */
+        TInt                                    iType;
+        
+        /**
+         * File size in MBs
+         */
+        TInt&                                   iValue;
+    };
+
+#endif // C_MSRULEFILESIZESETTING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msrulemultiselectionsetting.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for multiselection setting class
+*
+*/
+
+
+#ifndef C_MSRULEMULTISELECTIONSETTING
+#define C_MSRULEMULTISELECTIONSETTING
+
+// INCLUDES
+#include "mssettingitems.h"
+
+// FORWARD DECLARATIONS
+class CSelectionItemList;
+class CCmSqlPropertyContainer;
+
+// CLASS DECLARATION
+
+/**
+ * CMSRuleMultiSelectionSetting class. This class is used when
+ * server list is modified
+ *
+ * @Since S60 5.1
+*/
+NONSHARABLE_CLASS( CMSRuleMultiselectionSetting ): public CMSTextSettingItem
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, resource identifier
+         * @param aFirstPopupItemResource, first list item text resource id
+         * @param aAnyItemTextRestource, 'any' item text resource
+         * @param aMetadataArray, metadata list
+         * @param aArray, selection list
+         * @param aItemTextResource, item text resource when multiple
+         *                           items selected
+         * @param aText, dummy parameter - needed in item creation
+         * @return None
+         */
+        static CMSRuleMultiselectionSetting* NewL( TInt aIdentifier,
+                                    TInt aTitleResource,
+                                    TInt aFirstPopupItemResource,
+                                    TInt aAnyItemTextResource,
+                                    CCmSqlPropertyContainer* aMetadataArray,
+                                    RArray<TInt>* aArray,
+                                    TInt aItemTextResource,
+                                    TDes& aText);
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, resource identifier
+         * @param aFirstPopupItemResource, first list item text resource id
+         * @param aAnyItemTextRestource, 'any' item text resource
+         * @param aMetadataArray, metadata list
+         * @param aArray, selection list
+         * @param aItemTextResource, item text resource when multiple
+         *                           items selected
+         * @param aText, dummy parameter - needed in item creation
+         * @return None
+         */
+        static CMSRuleMultiselectionSetting* NewLC( TInt aIdentifier,
+                                    TInt aTitleResource,
+                                    TInt aFirstPopupItemResource,
+                                    TInt aAnyItemTextResource,
+                                    CCmSqlPropertyContainer* aMetadataArray,
+                                    RArray<TInt>* aArray,
+                                    TInt aItemTextResource,
+                                    TDes& aText);
+                                    
+        /**
+        * Destructor.
+        */
+        virtual ~CMSRuleMultiselectionSetting();
+
+        /**
+         * Creates item list and updates listbox text
+         */
+        void CreateItemListL();
+
+    protected:
+
+// From base class CAknSettingItem
+
+        /**
+         * From CAknSettingItem
+         * See base class definition
+        */
+        void EditItemL( TBool aCalledFromMenu );
+
+    private:
+
+        /**
+         * Creates selection list for setting page
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void CreateSelectionItemListL();
+
+        /**
+         * Appends selected items to the list
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void AppendSelectedItemsToListL();
+
+        /**
+         * Sets setting item text
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        virtual void SetSettingItemTextL();
+
+    private:
+
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, resource identifier
+         * @param aFirstPopupItemResource, first list item text resource id
+         * @param aAnyItemTextRestource, 'any' item text resource
+         * @param aMetadataArray, metadata list
+         * @param aArray, selection list
+         * @param aItemTextResource, item text resource when multiple
+         *                           items selected
+         * @param aText, dummy parameter - needed in item creation
+         * @return None
+         */         
+        CMSRuleMultiselectionSetting(
+            TInt aIdentifier,
+            TInt aTitleResource,
+            TInt aFirstPopupItemResource,
+            TInt aAnyItemTextResource,
+            CCmSqlPropertyContainer* aMetadataArray,
+            RArray<TInt>* aArray,
+            TInt aItemTextResource,
+            TDes& aText
+            );
+
+        /**
+         * Performs the second phase construction.
+         */
+        void ConstructL();
+
+    private:
+
+        /**
+         * selected item count
+         */
+        TInt                                iSelectedItemCount;
+        /**
+         * item text resource
+         */
+        TInt                                iItemTextResource;
+
+        /**
+         * setting item text
+         */
+        TDesC&                              iText;
+        /**
+         * item array for selection dialog
+         */
+        CSelectionItemList*                 iItemArray;     // owned
+        /**
+         * Server name string (external set)
+         */
+        HBufC16*                            iSettingText;   // owned
+        /**
+         * list of selected items
+         */
+         RArray<TInt>*                      iList;          // not owned
+        /**
+         * array of metadata items
+         */
+         CCmSqlPropertyContainer*           iMetadataArray; // not owned
+        /**
+         * title resource for multiselection dialog
+         */
+        TInt                                iTitleResource;
+        /**
+         * first item resource for multiselection dialog
+         */
+        TInt                                iFirstPopupItemResource;
+        /**
+         * secondary text resource
+         */
+        TInt                                iAnyItemTextResource;
+        /**
+         * Last selected item index
+         */
+        TInt                                iSelectedItemIndex;
+    };
+
+#endif // C_MSRULEMULTISELECTIONSETTING
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msruleserverssetting.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSRuleServersSetting class definition
+*
+*/
+
+
+#ifndef C_MSRULESERVERSSETTING_H
+#define C_MSRULESERVERSSETTING_H
+
+// INCLUDES
+#include "mssettingitems.h"
+
+// FORWARD DECLARATIONS
+class CSelectionItemList;
+
+
+// CLASS DECLARATION
+
+/**
+ * CMSRuleServersSetting class. This class is used when
+ * server list is modified
+ *
+ *
+ * @Since S60 5.1
+*/
+NONSHARABLE_CLASS( CMSRuleServersSetting ): public CMSTextSettingItem
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         *
+         * @Since S60 5.1
+         * @param aIdentifier, setting resource id
+         * @param aText, dummy text - needed on creation
+         * @param aDefaultItemTextResource
+         * @param aSecondaryTextResource, resource id for
+         *                                text 'no items' case
+         */
+        static CMSRuleServersSetting* NewL( TInt aIdentifier,
+                                      CSelectionItemList& aServerList,
+                                      TDes& aText,
+                                      TInt aSecondaryTextResource );
+
+        /**
+         * Two-phased constructor.
+         *
+         * @Since S60 5.1
+         * @param aIdentifier, setting resource id
+         * @param aText, dummy text - needed on creation
+         * @param aDefaultItemTextResource
+         * @param aSecondaryTextResource, resource id for
+         *                                text 'no items' case
+         */
+        static CMSRuleServersSetting* NewLC( TInt aIdentifier,
+                                      CSelectionItemList& aServerList,
+                                      TDes& aText,
+                                      TInt aSecondaryTextResource );
+                                      
+        /**
+        * Destructor.
+        */
+        virtual ~CMSRuleServersSetting();
+
+        /**
+         * ConstructL
+         * Second phase constructor.
+         */
+        void ConstructL();
+
+    protected: // From CAknSettingItem
+
+        /**
+        * This method activates the transfer "setting page"
+        */
+        void EditItemL( TBool aCalledFromMenu );
+
+    protected: // New functions
+
+        /**
+         * Counts selected items
+         * @since S60 3.1
+         * @return TInt, item count
+         */
+        TInt CountSelectedItems();
+
+        /**
+         * Sets setting item secondary text according to selected devices
+         * @since S60 3.1
+         */
+        void SetSettingItemTextL();
+
+    protected:
+
+        /**
+         * Constructor.
+         */
+        CMSRuleServersSetting(
+            TInt aIdentifier,
+            CSelectionItemList& aServerList,
+            TDes& aText,
+            TInt aSecondaryTextResource
+            );
+
+    protected:
+        /**
+         * Server name string
+         */
+        TDesC&                              iText;
+        /**
+         * setting page item array (servers)
+         */
+        CSelectionItemList&                 iItemArray;
+        /**
+         * Server name string (external set)
+         */
+        HBufC16*                            iSettingText;           // owned
+        /**
+         * Selected item count
+         */
+        TInt                                iSelectedItemCount;
+        /**
+         * Default item secondary text resource
+         */
+        TInt                                iSecondaryTextResource;
+    };
+
+#endif // C_MSRULESERVERSSETTING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/mssettingitems.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant fill rule editor class
+*
+*/
+
+
+#ifndef C_MSSETTINGITEMS_H
+#define C_MSSETTINGITEMS_H
+
+#include <aknsettingitemlist.h>
+
+// CLASS DECLARATIONS
+
+/**
+ * CMSTextSettingItem
+ * Text setting item class
+ *
+ * @Since S60 5.1
+ */
+class CMSTextSettingItem : public CAknTextSettingItem
+    {
+    public:
+        /**
+         * Constructor
+         *
+         * @Since S60 5.1
+         * @param aIdentifier, resource id
+         * @param aText, setting item text
+         * @return None
+         */
+        CMSTextSettingItem( TInt aIdentifier, TDes& aText );
+    
+    protected:
+    
+// From base class MAknSettingPageObserver
+    
+        /**
+         * From MAknSettingPageObserver
+         * See base class definition
+         */
+        void  HandleSettingPageEventL ( CAknSettingPage* aSettingPage,
+                                        TAknSettingPageEvent aEventType );
+    public:
+    
+        /* Setting page acceptance status
+         * @since S60 5.1
+         * @param None
+         * @return TBool, ETrue if accepted EFalse if cancelled
+         */
+        TBool SettingAccepted();
+        
+        /**
+         * Sets setting page accept state
+         * @since S60 5.1
+         * @param aState, ETrue if accepted
+         * @return None
+         */
+        void SetAcceptState( TBool aState );
+
+        /**
+         * Gets settingitem text
+         * @since S60 5.1
+         * @param None
+         * @return TPtr&, setting item text
+         */
+        TPtr& Text(); 
+
+        /**
+         * Sets settingitem text
+         * @since S60 5.1
+         * @param text, new text
+         * @return None
+         */
+        void SetText( TDesC& text );
+
+    private:
+
+        /*
+         * Setting page acceptance status
+         */
+        TBool iOKPressed;
+    };
+
+/**
+ * CMSEnumeratedTextPopupSettingItem
+ * Enumerated text popup setting item class
+ *
+ * @Since S60 5.1 
+ */
+class CMSEnumeratedTextPopupSettingItem : 
+    public CAknEnumeratedTextPopupSettingItem
+    {
+    public:
+
+        /*
+         * Constructor
+         *
+         * @Since S60 5.1
+         * @param aIdentifier, resource id
+         * @param aValue, selected value
+         * @return None
+         */
+        CMSEnumeratedTextPopupSettingItem( TInt aResourceId, TInt& aValue );
+
+    protected:
+
+// From base class MAknSettingPageObserver
+
+        /**
+         * From MAknSettingPageObserver
+         * See base class definition
+         */
+        void  HandleSettingPageEventL ( CAknSettingPage* aSettingPage,
+                                        TAknSettingPageEvent aEventType );
+    public:
+        /* Setting page acceptance status
+         * @since S60 5.1
+         * @return TBool, ETrue if accepted EFalse if cancelled
+         */
+        TBool SettingAccepted();
+
+        /**
+         * Sets setting page accept state
+         * @since S60 5.1
+         * @param aState, ETrue if accepted
+         */
+        void SetAcceptState( TBool aState );
+
+    private:
+        /*
+         * Setting page acceptance status
+         */
+        TBool iOKPressed;
+    };
+
+/**
+ * CMSTimeOrDateSettingItem
+ * Time and date setting item class
+ *
+ * @since S60 5.1
+ */
+class CMSTimeOrDateSettingItem : public CAknTimeOrDateSettingItem
+    {
+    public:
+        /*
+         * Constructor
+         *
+         * @Since S60 5.1
+         * @param aIdentifier, resource id
+         * @param aMode, time or date mode
+         * @param aTime, time value
+         * @return None
+         */
+        CMSTimeOrDateSettingItem( TInt aCMSIdentifier,
+            TInt aIdentifier,
+            CAknTimeOrDateSettingItem::TAknTimeOrDateSettingItemMode aMode,
+            TTime& aTime );
+            
+    protected:
+    
+// From base class MAknSettingPageObserver
+        
+        /**
+         * From MAknSettingPageObserver
+         * See base class definition
+         */
+        void  HandleSettingPageEventL ( CAknSettingPage* aSettingPage,
+                                        TAknSettingPageEvent aEventType );
+    public:
+        /* Setting page acceptance status
+         * @since S60 5.1
+         * @return TBool, ETrue if accepted EFalse if cancelled
+         */
+        TBool SettingAccepted();
+
+        /**
+         * Sets setting page accept state
+         * @since S60 5.1
+         * @param aState, ETrue if accepted
+         */
+        void SetAcceptState( TBool aState );
+   
+        /**
+         * This launches the setting page for Time or Date editing
+         * @since S60 5.1
+         * @param aState, ETrue if from menu called
+         */  
+        void EditItemL( TBool aCalledFromMenu );   
+
+    private:
+        /*
+         * Setting page acceptance status
+         */
+        TBool  iOKPressed;
+        /*
+         * Internal time
+         */
+        TTime& iCMSInternalTime;
+        /*
+         * Resource identifier(From / Util)
+         */
+         TInt  iCMSIdentifier;
+         
+    };
+
+#endif // C_MSSETTINGITEMS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msstorekeeponphonesetting.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreKeepOnPhoneSetting class definition
+*
+*/
+
+
+#ifndef C_MSSTOREKEEPONPHONESETTING_H
+#define C_MSSTOREKEEPONPHONESETTING_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+#include "cmcommontypes.h"
+#include "mediaservant.hrh"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+
+
+// CLASS DECLARATION
+
+/**
+ * CMSStoreKeepOnPhoneSetting class.
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSStoreKeepOnPhoneSetting ):
+                        public CAknEnumeratedTextPopupSettingItem
+    {
+    public:
+
+        /**
+         * Constructor.
+         *
+         * @since S60 5.1
+         * @param aSettingPageResourceId, setting page resource
+         * @param aMediaType, mediatype
+         * @param aSelection, selection index
+         * return None
+         */
+        CMSStoreKeepOnPhoneSetting(
+            TInt aSettingPageResourceId,
+            TCmMediaType aMediaType,
+            TInt& aSelection
+            );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMSStoreKeepOnPhoneSetting();
+
+
+    protected:
+    
+// From base class CAknSettingItem
+
+        /**
+         * From CAknSettingItem
+         * See base class definition
+         */
+        void CompleteConstructionL();
+
+    private:
+
+        /**
+         * media type
+         */
+        TCmMediaType                            iMediaType;
+    };
+
+#endif // C_MSSTOREKEEPONPHONESETTING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msstorelistcontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition for MediaServant store list container class
+*
+*/
+
+
+#ifndef C_MSSTORELISTCONTAINER_H
+#define C_MSSTORELISTCONTAINER_H
+
+// INCLUDES
+#include <aknlists.h>
+#include "msbasecontainer.h"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CCmStoreRuleContainer;
+class CMSStoreListView;
+
+
+/**
+ * CMSStoreListContainer class definition
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSStoreListContainer ): public CMSBaseContainer,
+                              public MEikListBoxObserver
+    {
+    private:
+        // Icon enumerations
+        enum TMSListBoxIcons
+            {
+            EIconCheckboxOn = 0,
+            EIconCheckboxOff,
+            EIconCount
+            };
+
+    public:
+        /**
+         * Constructor.
+         *
+         * @since S60 5.1
+         * @param aAppUi, application UI
+         * @param aView, store list view
+         * @return None
+         */
+        CMSStoreListContainer( CMSAppUi& aAppUi, CMSStoreListView& aView );
+
+        /**
+         * Symbian default constructor.
+         */
+        void ConstructL( TRect aRect );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSStoreListContainer();
+
+    public:
+
+        /**
+         * Highlighted item index
+         * @since S60 5.1
+         * @param None
+         * @return TInt, highlighted item index
+         */
+        TInt SelectedItemIndex();
+
+        /**
+         * Sends store rules to server
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void UpdateRulesToServerL();
+
+        /**
+         * Counts new list items
+         * @Since S60 5.2
+         * @param None
+         * @return TInt, item count
+         */
+        TInt ListItemCountL();
+
+        /**
+         * Return current item's selection status
+         * @Since S60 5.1
+         * @param None
+         * @return TBool, ETrue if selected, EFalse othwerwise
+         */
+        TBool CurrentListItemSelectionStatus();
+
+        /**
+         * Toggles highlighted item's selection         
+         * @Since S60 5.1
+         * @param None
+         * @return None
+         */
+        void ToggleCurrentItemL();
+        
+        /**
+         * Sets selection statuses to store lists
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void SetServerSelectionsL();
+
+    protected: 
+
+// From base class CoeControl
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        CCoeControl* ComponentControl( TInt aIndex ) const;
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        TInt CountComponentControls() const;
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void SizeChanged();
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void HandleResourceChange(TInt aType);
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                           TEventCode aType );
+        
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+
+// From base class MEikListBoxObserver
+
+        /**
+         * From MEikListBoxObserver
+         * See base class definition
+         */
+        void HandleListBoxEventL( CEikListBox* /*aListBox*/,
+                                  TListBoxEvent aEventType );
+
+
+    private:
+
+        /**
+         * Updates listbox data
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void UpdateListBoxDataL();
+
+        /**
+         * Checks if servers are not set and shows info note
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        void CheckServersAndShowNoteL();
+
+    private:
+
+        /**
+         * Listbox control
+         */
+        CAknColumnListBox*                  iListBox;           // owned
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi&                           iMSAppUi;           // not owned
+        /**
+         * All store rules
+         */
+        CCmStoreRuleContainer*              iStoreRuleContainer;// not owned
+        /**
+         * list selection indexes
+         */
+        CArrayFix<TInt>*                    iSelectionArray;    // owned
+        /*
+         * Containers view
+         */
+        CMSStoreListView&                   iView;
+        /**
+         * Context pane icon
+         */
+        CFbsBitmap*                         iIcon;              // not owned
+        /**
+         * Context pane icon mask
+         */
+        CFbsBitmap*                         iIconMask;          // not owned
+    };
+
+#endif // C_MSSTORELISTCONTAINER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msstorelistcontroller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  StoreListController class definition
+*
+*/
+
+
+
+
+
+#ifndef C_MSSTORELISTCONTROLLER_H
+#define C_MSSTORELISTCONTROLLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmcommontypes.h"
+
+
+// FORWARD DECLARATIONS
+class CMSEngine;
+class CCmStoreRuleContainer;
+class CCmStoreRule;
+
+/**
+ * CMSStoreListController class.
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSStoreListController ): public CBase
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aMSEngine, application engine
+         * return pointer to CMSStoreListController
+         */
+        static CMSStoreListController* NewL( CMSEngine& aMSEngine );
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aMSEngine, application engine
+         * return pointer to CMSStoreListController
+         */
+        static CMSStoreListController* NewLC( CMSEngine& aMSEngine );
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CMSStoreListController();
+
+        /**
+         * Returns store list container
+         * @since S60 5.1
+         * @return CCmStoreRuleContainer, list container
+         */
+        CCmStoreRuleContainer* StoreListContainer();
+
+        /**
+         * Reads list container and re-creates rule array
+         * @since S60 5.1
+         */
+        void  UpdateListsL();
+
+    private:
+    
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aMSEngine, application engine        
+         * @return None
+         */
+        CMSStoreListController( CMSEngine& aMSEngine );
+
+        /**
+         * Performs the second phase construction.
+         */
+        void ConstructL();
+
+        /**
+         * Creates default store rules
+         * Since S60 5.1
+         * @param None
+         * @return None
+         */
+        void CreateStoreRulesL();
+
+        /**
+         * Changes names of store rules
+         * @since S60 5.1
+         * @param None
+         * @return None         
+         */
+        void ChangeStoreRuleNamesL( void );
+
+    private:
+
+        /**
+         * pointer to application engine
+         */
+        CMSEngine*                  iMSEngine;              // not owned
+        /**
+         * Fill rules
+         */
+        CCmStoreRuleContainer*      iStoreListContainer;    // owned
+    };
+
+
+#endif // C_MSSTORELISTCONTROLLER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msstorelistview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreListView class definition
+*
+*/
+
+
+
+
+
+#ifndef C_MSSTORELISTVIEW_H
+#define C_MSSTORELISTVIEW_H
+
+// INCLUDES
+#include "msengineobserver.h"
+#include "msbaseview.h"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSStoreListContainer;
+//class CMSEngine;
+
+/**
+ * CMSStoreListView view class.
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSStoreListView ): public CMSBaseView,
+                         public MMSEngineObserver
+    {
+
+    public:
+
+        /**
+         * Constructor.
+         *
+         * @since S60 5.1
+         * @param aAppUi, application UI
+         * @return None
+         */
+        CMSStoreListView( CMSAppUi& aAppUi );
+
+        /**
+         * Symbian default constructor.
+         */
+        void ConstructL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSStoreListView();
+
+        /**
+         * ListBox focus index
+         * @since S60 v3.1
+         * @return TInt, focus index
+         */
+        TInt FocusIndex() const;
+
+        /**
+         * Creates and sets navi pane text
+         * @since S60 3.2
+         */
+        void CreateAndSetNaviTextL();
+
+		/**
+	*  Returns store list preprocessing state
+	* @since S60 5.1
+	* @return TBool, ETrue if preprocessing, otherwise EFalse
+	*/
+	TBool PreProcessing();
+
+    protected:
+
+// From base class CAknView
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        TUid Id() const;
+
+        /**
+         * From CAknView activate the view
+         * See base class definition
+         */
+        void DoActivateL(
+            const TVwsViewId& aPrevViewId,
+            TUid aCustomMessageId,
+            const TDesC8& aCustomMessage );
+
+        /**
+         * From CAknView activate the view
+         * See base class definition
+         */
+         void DoDeactivate();
+         
+// From base class MEikMenuObserver
+
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);        
+
+// From base class MMSEngineObserver
+
+        /**
+         * From MMSEngineObserver
+         * See base class definition
+         */
+        void ReadyL( TCmService aService, TInt aError );
+
+    private:
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi&                           iAppUi;         // not owned
+        /**
+         * view's container
+         */
+        CMSStoreListContainer*              iContainer;     // owned
+        /**
+         * Focus index
+         */
+        TInt                                iFocusIndex;
+		/**
+         * preprocessing state
+         */
+		TBool								iPreprocessingState;
+    };
+
+#endif // C_MSSTORELISTVIEW_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msstoreserverssetting.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreServersSetting class definition
+*
+*/
+
+
+#ifndef C_MSSTORESERVERSSETTING_H
+#define C_MSSTORESERVERSSETTING_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CCmMediaServerFull;
+class CMSAppUi;
+class CSelectionItemList;
+class CCmStoreRule;
+
+
+// CLASS DECLARATION
+
+/**
+ * CMSStoreServersSetting class. This class is used when
+ * server list is modified
+ *
+ * @since S60 5.1
+*/
+NONSHARABLE_CLASS( CMSStoreServersSetting ): public CAknTextSettingItem
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, setting resource id
+         * @param aAppUi, application UI
+         * @param aText, dummy - just for setting creation
+         * @return pointer to CMSStoreServersSetting
+         */
+        static CMSStoreServersSetting* NewL( TInt aIdentifier,
+                                      CCmStoreRule* aRule,
+                                      CMSAppUi& aAppUi,
+                                      TDes& aText );
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, setting resource id
+         * @param aAppUi, application UI
+         * @param aText, dummy - just for setting creation
+         * @return None
+         */
+        static CMSStoreServersSetting* NewLC( TInt aIdentifier,
+                                      CCmStoreRule* aRule,
+                                      CMSAppUi& aAppUi,
+                                      TDes& aText );
+                                      
+        /**
+        * Destructor.
+        */
+        virtual ~CMSStoreServersSetting();
+
+
+    protected: 
+
+        /**
+         * Creates selection list for setting page
+         * @since S60 3.1
+         */
+        void CreateSelectionItemListL();
+
+        /**
+         * Counts selected items
+         * @since S60 3.1
+         * @return TInt, item count
+         */
+        TInt CountSelectedItems();
+
+        /**
+         * Sets setting item secondary text according to selected devices
+         * @since S60 3.1
+         */
+        void SetSettingItemTextL();
+        
+// From base class CAknSettingItem
+
+        /**
+         * From CAknSettingItem
+         * See base class definition
+         */
+        void EditItemL( TBool aCalledFromMenu );
+
+
+    private:
+
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aIdentifier, setting resource id
+         * @param aAppUi, application UI
+         * @param aText, dummy - just for setting creation
+         * @return None
+         */
+        CMSStoreServersSetting(
+            TInt aIdentifier,
+            CCmStoreRule* aRule,
+            CMSAppUi& aAppUi,
+            TDes& aText
+            );
+        
+        /**
+         * Performs the second phase construction.
+         */
+        void ConstructL();
+
+
+        /**
+         * Deletes all servers from rule
+         *
+         * @since S60 5.1
+         */
+        void DeleteAllServersFromRuleL();
+
+    private:
+    
+        /**
+         * server list
+         */
+        RPointerArray<CCmMediaServerFull>*  iServers;           // owned
+        /**
+         * current rule
+         */
+        CCmStoreRule*                       iRule;              // not owned
+        /**
+         * application ui
+         */
+        CMSAppUi&                           iAppUi;
+        /**
+         * setting page item array (servers)
+         */
+        CSelectionItemList*                 iItemArray;         // owned
+        /**
+         * Server name string (external set)
+         */
+        HBufC*                              iSettingText;       // owned
+        /**
+         * Selected item count
+         */
+        TInt                                iSelectedItemCount;
+    };
+
+#endif // C_MSSTORESERVERSSETTING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msstoresettingslist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreSettingsList class definition
+*
+*/
+
+
+#ifndef C_MSSTORESETTINGSLIST_H
+#define C_MSSTORESETTINGSLIST_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+#include "msengineobserver.h"
+#include "cmcommontypes.h"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CCmStoreRuleContainer;
+class CCmStoreRule;
+class CCmMediaServerFull;
+class CMSStoreSettingsView;
+
+// CLASS DECLARATION
+
+/**
+ * CMSStoreSettingsList general class.
+ *
+ * @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSStoreSettingsList ): public CAknSettingItemList,
+                            public MMSEngineObserver
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1.
+         * @param aResourceId : resource ID of setting page.
+         * @param aAppUi, application UI
+         * @param aView, store settings view
+         * @return pointer to CMSStoreSettingsList
+         */
+        static CMSStoreSettingsList* NewL( TInt aResourceId,
+                                           CMSAppUi& aAppUi,
+                                           CMSStoreSettingsView& aView );
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1.
+         * @param aResourceId : resource ID of setting page.
+         * @param aAppUi, application UI
+         * @param aView, store settings view
+         * @return pointer to CMSStoreSettingsList
+         */
+        static CMSStoreSettingsList* NewLC( TInt aResourceId,
+                                           CMSAppUi& aAppUi,
+                                           CMSStoreSettingsView& aView );
+                                           
+        /**
+         * Destructor.
+         */
+        virtual ~CMSStoreSettingsList();
+
+        /**
+         * Opens the selected listbox item
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void OpenSelectedListboxItemL();
+
+    protected: 
+    
+// From base class CAknSettingItemList
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        CAknSettingItem* CreateSettingItemL( TInt aSettingId );
+
+        /**
+         * From CAknSettingItemList
+         * See base class definition
+         */
+        void  HandleListBoxEventL ( CEikListBox *aListBox,
+                                    TListBoxEvent aEventType );
+
+// From base class CCoeControl
+        
+        /**
+         * From CCoeControl
+         * See base class definition
+         */
+        void SizeChanged();
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void HandleResourceChange( TInt aType );
+
+        /**
+         * From CoeControl
+         * See base class definition
+         */
+        void GetHelpContext(TCoeHelpContext& aContext) const;        
+
+// From base class MMSEngineObserver
+
+        /**
+         * From MMSEngineObserver
+         * See base class definition
+         */
+        void ReadyL( TCmService aService, TInt aError );
+
+    private:
+
+        /**
+         * Performs the second phase construction.
+         *
+         * @since S60 5.1
+         * @param aResourceId, settinglist resource id
+         * @return None
+         */
+        void ConstructL( TInt aResourceId );
+
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aAppUi, application UI
+         * @param aView, store settings view
+         * @return None
+         */
+        CMSStoreSettingsList( CMSAppUi& aAppUi, CMSStoreSettingsView& aView );
+
+        /**
+         * Reads rule status
+         * @since S60 5.1
+         */
+        void ReadRuleStatus();
+
+        /**
+         * Saves 'keep on phone' setting to rule
+         * @since S60 5.1
+         */
+        void SaveKeepOnPhoneSetting();
+
+        /**
+         * Sets title pane text accordin to media type
+         * @since S60 5.1
+         */
+        void SetTitlePaneTextL();
+
+    private:
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi&                               iAppUi;         // not owned
+        /**
+         * dummy text needed by CAknTextSettingItem
+         */
+        TBuf<KMaxFileName>                      iDummyText;
+        /**
+         * All store rules
+         */
+        CCmStoreRuleContainer*             iStoreRuleContainer; // not owned
+        /**
+         * Store rule
+         */
+        CCmStoreRule*                           iStoreRule;     // not owned
+        /**
+         * Keep on phone setting
+         */
+        TInt                                    iKeepOnPhone;
+        /**
+         * Media type
+         */
+        TCmMediaType                            iMediaType;
+        /**
+         * Wait note
+         */
+        CAknWaitDialog*                         iWaitNoteDialog;// owned
+        /**
+         * Parent view
+         */
+        CMSStoreSettingsView&                   iView;
+    };
+
+#endif // C_MSSTORESETTINGSLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/inc/msstoresettingsview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreSettingsView class definition
+*
+*/
+
+
+
+
+
+#ifndef C_MSSTORESETTINGSVIEW_H
+#define C_MSSTORESETTINGSVIEW_H
+
+// INCLUDES
+#include "msbaseview.h"
+
+// FORWARD DECLARATIONS
+class CMSAppUi;
+class CMSEngine;
+class CMSStoreSettingsList;
+
+/**
+ * CMSStoreSettingsView class.
+ *
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CMSStoreSettingsView ) : public CMSBaseView
+    {
+
+    public:
+
+        /**
+         * Constructor.
+         *
+         * @since S60 5.1
+         * @param aAppUi, application UI
+         * @return None
+         */
+        CMSStoreSettingsView( CMSAppUi& aAppUi );
+
+        /**
+         * default constructor.
+         */
+        void ConstructL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMSStoreSettingsView();
+
+    protected:
+    
+// From base class CAknView
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        TUid Id() const;
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoActivateL(
+                const TVwsViewId& aPrevViewId,
+                TUid aCustomMessageId,
+                const TDesC8& aCustomMessage );
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoDeactivate();
+        
+// From base class MEikMenuObserver
+        
+        /**
+         * From MEikMenuObserver
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );
+
+
+    private:
+
+        /**
+         * pointer to AppUi object
+         */
+        CMSAppUi&                           iAppUi;         // not owned
+        /**
+         * Views container class
+         */
+        CMSStoreSettingsList*               iContainer;     // owned
+    };
+
+#endif // C_MSSTORESETTINGSVIEW_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/loc/mediaservant.loc	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1433 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project MediaServant
+*
+*/
+
+
+//d:Item primary text on Home Media listbox
+//d:Name of application
+//l:list_double_large_graphic_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_grid_media_servant_home_media "Media Sync"
+
+//d:Item secondary text on Home Media listbox
+//d:Synchronization will be done automatically
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_main_sync_auto "Automatic sync"
+
+//d:Item secondary text on Home Media listbox
+//d:Synchronization will be done manually
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_main_sync_manual "Manual sync"
+
+//d:Item secondary text on Home Media listbox
+//d:Synchronization is ongoing
+//d:Parameter maximum length: 3 characters
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_main_sync "Synchronizing %N%"
+
+//d:Item secondary text on Home Media listbox
+//d:Refresh is ongoing
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_main_refreshing "Refreshing"
+
+//d:Application title
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_media_servant "Media Sync"
+
+
+// NOTES
+
+//d:Info note
+//d:Target devices not selected
+//l:popup_note_window
+//r:2.1
+//
+#define qtn_mserv_no_target_devices "You first need to set a target device where to synchronize."
+
+//d:Error note
+//d:User can't enter to other views if refresh operation is ongoing
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_mserv_access_error "Access is denied while refreshing is active"
+
+//d:Error note
+//d:User can't enter to other views if synronization is ongoing
+//l:popup_note_window/opt2
+//r:2.0
+//
+#define qtn_mserv_access_error_sync "Access is denied while synchronizing is active"
+
+//d:Error note
+//d:User can't enter to fill list view if memory card is not inserted
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_mserv_mcard_error "Insert a memory card"
+
+//d:Fill list deactivation note
+//d:Asks user if he wants to remove files on next synchronization
+//l:popup_note_window
+//r:2.0
+//
+#define qtn_mserv_lists_edited "You unselected some lists. Their files are removed on next sync."
+
+//d:Information note
+//d:Automatic sync is not performed if there is no access point selected
+//l:popup_note_window
+//r:1.0
+//
+#define qtn_mserv_info_no_ap "Only manual sync allowed when no default access point is defined."
+
+//d:Confirmation query
+//d:New memory card inserted
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_mserv_conf_used_memory "New memory card inserted. Use this for Media Sync?"
+
+//d:Confirmation query
+//d:New memory card inserted
+//l:popup_note_window
+//r:2.1
+//
+#define qtn_mserv_qry_add_video_date "Some media servers don't support search by date which concludes to an empty result. Add anyway?"
+
+//d:Confirmation query
+//d:Delete current list
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_mserv_conf_delete_list "Delete list and its content on phone?"
+
+//d:Error note
+//d:Devices not found during device search
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_mserv_error_not_found "Device(s) not found"
+
+//d:Error note
+//d:Syncronization interrupted
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_mserv_error_sync_interrupted "Sync. interrupted"
+
+//d:Error note
+//d:All target devices not found so syncronization is done only partially
+//l:popup_note_window
+//r:2.1
+//
+#define qtn_mserv_soft_partial "All target devices were not accessible for storing."
+
+// TITLE PANE
+
+//d:Fill list view title
+//d:List reordering mode is active
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_reorder "Reorder list"
+
+//d:Fill list view title
+//d:Files are moved from PC to phone
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_from_home "From Home"
+
+//d:store list view title
+//d:Files are moved from phone  to PC
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_to_home "To Home"
+
+//d:Fill list edit view
+//d:List type is image
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_edit_rules_image "Image list"
+
+//d:Fill list edit view
+//d:List type is video
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_edit_rules_video "Video list"
+
+//d:Fill list edit view
+//d:List type is music
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_edit_rules_music "Music list"
+
+//d:Store browse view title
+//d:list type is phone videos
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_phone_videos "Captured videos"
+
+//d:Store browse view title
+//d:list type is other videos
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_other_videos "Other videos"
+
+//d:Store browse view title
+//d:list type is music
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_music "Music"
+
+//d:Store settings view title
+//d:list type is phone images
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_phone_images "Captured images"
+
+//d:Store settings view title
+//d:list type is other images
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_title_other_images "Other images"
+
+//d:Multiselection view title ( video title setting )
+//d:Video title selection
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_sett_name "Name"
+
+//d:Setting page text
+//d:Genre selection
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_sett_genre "Genre"
+
+//d:Setting page text
+//d:Artist name selection
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_sett_artist "Artist"
+
+//d:Setting page text
+//d:Album name selection
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_sett_album "Album"
+
+//d:Setting page text
+//d:Track name selection
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_mserv_sett_track "Track"
+
+
+// OPTIONS MENU
+
+//d:Menu text in main view
+//d:Starts/stops sync operation
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_select "Select"
+
+//d:Menu text in main view
+//d:Starts updating metadata between phone and servers
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_refresh "Refresh information"
+
+//d:Menu text in main view
+//d:Stops updating metadata between phone and servers
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_refresh_stop "Stop refreshing"
+
+//d:Menu text in main view
+//d:Opens general settings view
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_sync_settings "Sync Settings"
+
+//d:Menu text in main view
+//d:Opens settings wizard
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_run_wizard "Run Wizard"
+
+//d:Menu text in fill list view
+//d:Deselects current fill list
+//l:list_single_pane_t1_cp2
+//r:2.0
+//
+#define qtn_mserv_options_unselect "Unselect"
+
+//d:Menu text in fill view
+//d:Opens fill list editor view
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_edit "Edit"
+
+//d:Menu text in store list view
+//d:Opens file browse view
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_browse "Show files"
+
+//d:Menu text in fill rule edit view
+//d:Removes current rule
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_remove_rule "Remove rule"
+
+//d:Menu text in browse view
+//d:Locs file so that it can't be deleted on next synchronization
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_lock_on_phone "Lock on phone"
+
+//d:Menu text in browse view
+//d:Unlocks file so it can be deleted on next synchronization
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_unlock "Unlock"
+
+//d:Menu text in browse view
+//d:Fetches new files to the list
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_randomiza "Randomize again"
+
+//d:Menu text in fill view
+//d:Creates new fill list
+//l:list_single_pane_t1_cp2/opt3
+//r:1.0
+//
+#define qtn_mserv_options_new_list "New list"
+
+//d:Submenu text in fill view
+//d:New image list
+//l:list_single_popup_submenu_pane_t1
+//r:1.0
+//
+#define qtn_mserv_options_new_image "Image"
+
+//d:Submenu text in fill view
+//d:New video list
+//l:list_single_popup_submenu_pane_t1
+//r:1.0
+//
+#define qtn_mserv_options_new_video "Video"
+
+//d:Submenu text in fill view
+//d:New music list
+//l:list_single_popup_submenu_pane_t1
+//r:1.0
+//
+#define qtn_mserv_options_new_music "Music"
+
+//d:Menu text in fill view
+//d:User can reorder fill list
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_reorder "Change priority"
+
+//d:Menu text in fill view
+//d:Deletes fill list
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_options_delete "Delete"
+
+
+// QUERIES
+
+
+//d:Add rule
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_mserv_head_add_rule "Add rule"
+
+//d:data query heading
+//d:data amount query ( amount setting item )
+//l:popup_query_data_window
+//r:1.0
+//
+#define qtn_mserv_head_amount_count "Set count"
+
+//d:data query heading
+//d:Data size query ( amount setting item )
+//l:popup_query_data_window
+//r:1.0
+//
+#define qtn_mserv_head_amount_mb "Set MB"
+
+
+// LISTBOX ITEMS
+
+//d:Starts synchronization operation
+//l:list_double_large_graphic_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_sync_now "Sync now"
+
+//d:Stops synchronization operation
+//l:list_double_large_graphic_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_sync_stop "Stop sync"
+
+//d:Opens fill list view
+//d:Settings for moving files from PC to phone
+//l:list_double_large_graphic_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_from_home "From home"
+
+//d:Listbox item secondary text
+//d:Memory card is not inserted to phone
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_memory_card_needed "No memory card"
+
+//d:Opens store list view
+//d:Settings for moving files from phone to PC
+//l:list_double_large_graphic_pane_t1_cp2
+//r:1.0
+//
+#define qtn_mserv_to_home "To Home"
+
+//d:Listbox item secondary text
+//d:All files are synchronized
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_in_sync "All in sync"
+
+//d:Listbox item secondary text
+//d:No fill lists selected
+//l:list_double_large_graphic_pane_t2_cp2
+//r:9.1
+//
+#define qtn_mserv_nothing_selected "Nothing selected"
+
+//d:Listbox item secondary text
+//d:N files are not synchronized
+//d:Parameter max length: 5 characters
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_new_items "%N new items"
+
+//d:Listbox item secondary text
+//d:One item is not synchronized
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_one_item "1 new item"
+
+//d:Listbox item secondary text
+//d:Estimated duration of next synchronization
+//d:Parameter max length: 4 characters
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_sync_time "Takes %N mins"
+
+//d:Listbox item secondary text
+//d:Estimated duration of next synchronization is 1 min
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_sync_time_one "Takes 1 min"
+
+//d:Listbox item secondary text
+//d:Synchronization is waiting for own turn
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_waiting_sync "Waiting"
+
+
+//d:Default fill list
+//l:list_single_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_def_latest_org "Latest images"
+
+//d:Default fill list
+//l:list_single_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_def_latest_videos "Latest videos"
+
+//d:Default fill list
+//l:list_single_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_def_recent_music "Latest music"
+
+
+// SETTING ITEMS
+
+
+// IMAGE LIST SETTINGS
+
+//d:Setting list item primary text
+//d:Image shrinking
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_shrink_image "Shrink images"
+
+//d:Setting page heading text
+//d:Image shrinking setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_shrink_image "Shrink images"
+
+//d:Setting page item text
+//d:Images are shrinked to screen size
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_screen_size "To phone screen size"
+
+//d:Setting page item text
+//d:Images are not shrinked
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_no_shrinking "No shrinking"
+
+
+
+//d:Setting item text
+//d:Amount of files to be fetched
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_amount "Amount"
+
+//d:Setting item text
+//d:Amount of data
+//d:Parameter length: 5 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_amount_mb_list "%N MB"
+
+//d:Setting item text
+//d:Amount of data
+//d:Parameter length: 5 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_amount_item_list "%N items"
+
+//d:Setting item text
+//d:Amount of data
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_amount_item_1_list "1 item"
+
+//d:Setting item text
+//d:Amount of data
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_amount_item_0_list "0 items"
+
+//d:Setting page heading text
+//d:Amount of files to be fetched
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_amount "Amount"
+
+//d:Setting page item text
+//d:Amount of data
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_amount_unlimited "Unlimited"
+
+//d:Setting page item text
+//d:Amount of data
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_amount_count "Set count"
+
+//d:Setting page item text
+//d:Amount of data
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_amount_mb "Set MB"
+
+
+
+//d:Setting list item primary text
+//d:Starts searching oldest, latest or random items
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_start_with "Starting with"
+
+//d:Setting page heading text
+//d:Starts searching with oldest, latest or random items
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_start_with "Starting with"
+
+//d:Setting page item text
+//d:Search latest items
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_start_latest "Latest"
+
+//d:Setting page item text
+//d:Search oldest items
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_start_oldest "Oldest"
+
+//d:Setting page item text
+//d:Search random items
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_random "Random"
+
+//d:Setting list item primary text
+//d:Starts searching from specified date
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_from "From"
+
+//d:Setting page heading text
+//d:Starts searching from specified date
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_from "From"
+
+//d:Setting list item primary text
+//d:Search end date
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_until "Until"
+
+//d:Setting page text
+//d:Search end date
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_until "Until"
+
+//d:Secondary text for video title -setting
+//d:Search criteria is "any"
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_list_any_name "Any"
+
+//d:Secondary text for music genre -setting
+//d:Search criteria is "any"
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_list_any_genre "Any"
+
+//d:Secondary text for music artist -setting
+//d:Search criteria is "any"
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_list_any_artist "Any"
+
+//d:Secondary text for music album -setting
+//d:Search criteria is "any"
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_list_any_album "Any"
+
+//d:Secondary text for music track -setting
+//d:Search criteria is "any"
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_list_any_track "Any"
+
+//d:Secondary text for source devices -setting
+//d:Search criteria is "any"
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_list_any_source_device "Any"
+
+//d:Multiselection list item text for video title
+//d:Search criteria is "any"
+//l:list_single_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_any_name "Any"
+
+//d:Multiselection list item text for file size -setting
+//d:Search criteria is "any"
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_any_file_size "Any"
+
+//d:Multiselection list item text for music genre -setting
+//d:Search criteria is "any"
+//l:list_single_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_any_genre "Any"
+
+//d:Multiselection list item text for music artist -setting
+//d:Search criteria is "any"
+//l:list_single_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_any_artist "Any"
+
+//d:Multiselection list item text for music album -setting
+//d:Search criteria is "any"
+//l:list_single_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_any_album "Any"
+
+//d:Multiselection list item text for music track -setting
+//d:Search criteria is "any"
+//l:list_single_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_any_track "Any"
+
+//d:Multiselection list item text for source devices -setting
+//d:Search criteria is "any"
+//l:list_single_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_any_source_device "Any"
+
+//d:Item text for music track length -setting
+//d:Search criteria is "any"
+//l:list_set_graphic_pane_t1
+//r:2.0
+//
+#define qtn_mserv_value_any_track_length "Any"
+
+
+//d:Setting item text
+//d:Servers where data will be searched
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_storage "Source devices"
+
+//d:Setting item text
+//d:Selected server count
+//d:Parameter maximum length: 3 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_n_servers "%N devices"
+
+//d:Setting page heading text
+//d:fill source devices
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_storage "Storage server"
+
+
+
+//d:Setting item text
+//d:Free text search criteria
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_free_text "Contains text"
+
+//d:Setting item secondary text
+//d:If no text defined
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_none "None"
+
+//d:Setting page heading text
+//d:Free text criteria
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_free_text "Contains text"
+
+
+
+
+// VIDEO LIST SETTINGS
+
+//d:Setting item text
+//d:Video title search criteria
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_name "Name"
+
+//d:Setting page heading text
+//d:N titles selected
+//d:Parameter maximum length: 3 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_n_names "%N names"
+
+
+
+//d:Setting item text
+//d:Minimum file size
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_file_size_min "Min file size"
+
+//d:Setting item text
+//d:Minimum file size setting
+//d:Parameter maximum length: 5 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_min_list "%N MB"
+
+//d:Setting page heading text
+//d:Min file size setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_file_size_min "Min file size"
+
+//d:Setting page text
+//d:Minimum file size
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_min_mb "Set min MB"
+
+//d:Setting item text
+//d:Maximum file size
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_file_size_max "Max file size"
+
+//d:Setting item text
+//d:Maximum file size setting
+//d:Parameter maximum length: 5 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_max_list "%N MB"
+
+//d:Setting page heading text
+//d:Max file size setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_file_size_max "Max file size"
+
+//d:Setting page text
+//d:Minimum file size
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_max_mb "Set max MB"
+
+
+// MUSIC LIST SETTINGS
+
+//d:Setting item primary text
+//d:Music genre setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_genre "Genre"
+
+//d:Setting item secondary text
+//d:Number of selected genres
+//d:Parameter maximum length: 5 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_n_genre "%N genres"
+
+
+
+//d:Setting item text
+//d:Artist name setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_artist "Artist"
+
+//d:Setting item secondary text
+//d:number of selected artists
+//d:Parameter maximum length: 5 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_n_artists "%N artists"
+
+
+
+//d:Setting item text
+//d:Title names
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_album "Album"
+
+//d:Setting item secondary text
+//d:number of selected albums
+//d:Parameter maximum length: 5 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_n_album "%N albums"
+
+
+
+//d:Setting item text
+//d:Track names
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_track "Track"
+
+//d:Setting item secondary text
+//d:number of selected tracks
+//d:Parameter maximum length: 5 characters
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_n_tracks "%N tracks"
+
+
+
+//d:Setting item text
+//d:Track length
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_track_length "Track length"
+
+//d:Setting page heading text
+//d:Track length setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_track_length "Track length"
+
+//d:Setting item text
+//d:Track length setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_less_1 "Less than 1 min."
+
+//d:Setting item text
+//d:Track length setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_16_min "1-6 mins."
+
+//d:Setting item text
+//d:Track length setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_68_min "6-8 mins."
+
+//d:Setting item text
+//d:Track length setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_830_min "8-30 mins."
+
+//d:Setting item text
+//d:Track length setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_more_4 "More than 30 mins."
+
+//d:Setting item text
+//d:File size setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_file_size "File size"
+
+//d:Setting page heading text
+//d:File size setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_file_size "File size"
+
+//d:Setting page text
+//d:File size setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_less_1_mb "Less than 1 MB"
+
+//d:Setting page text
+//d:File size setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_15_mb "1-5 MB"
+
+//d:Setting page text
+//d:File size setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_510_mb "5-10 MB"
+
+//d:Setting page text
+//d:File size setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_1050_mb "10-50 MB"
+
+//d:Setting page text
+//d:File size setting
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_value_more_50 "More than 50 MB"
+
+
+
+// EDIT FILL LIST SETTINGS
+
+//d:Setting list item primary text
+//d:Fill list name
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_list_name "List name"
+
+//d:Setting page heading text
+//d:Fill list name
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_rule_list_name "List name"
+
+//d:Setting list item primary text
+//d:User can add more rules
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_rule_add "Add more rules"
+
+
+// FILL LIST BROWSE VIEW
+
+//d:List item secondary text
+//d:File status is set "skipped"
+//l:list_double_large_graphic_pane_t2_cp2
+//r:1.0
+//
+#define qtn_mserv_status_skipped "Skipped"
+
+
+// STORE LIST VIEW
+
+//d:List item text
+//d:Captured images category
+//l:list_single_graphic_pane_t1
+//r:2.1
+//
+#define qtn_mserv_store_check_phone_images "Captured images"
+
+//d:List item text
+//d:Other images category
+//l:list_single_graphic_pane_t1
+//r:2.1
+//
+#define qtn_mserv_store_check_other_images "Other images"
+
+//d:List item text
+//d:Captured videos category
+//l:list_single_graphic_pane_t1
+//r:2.1
+//
+#define qtn_mserv_store_check_phone_videos "Captured videos"
+
+//d:List item text
+//d:Other videos category
+//l:list_single_graphic_pane_t1
+//r:2.1
+//
+#define qtn_mserv_store_check_other_videos "Other videos"
+
+//d:List item text
+//d:Music category
+//l:list_single_graphic_pane_t1
+//r:2.1
+//
+#define qtn_mserv_store_check_music "Music"
+
+
+// STORE SETTINGS VIEW
+
+//d:Store setting item primary text
+//d:Location where files will be copied
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_target_devices "Target devices"
+
+//d:Setting page heading text
+//d:Sets target devices for file copying
+//l:list_setting_pane_t1
+//r:1.0
+#define qtn_mserv_sett_target_devices "Target devices"
+
+//d:Setting list item primary text
+//d:Local copy setting
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_local_copy "Keep on phone"
+
+//d:Setting list item secondary text
+//d:File is not kept on the phone
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_no_local "No"
+
+//d:Setting list item secondary text
+//d:File is kept on the phone
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_yes_local "Yes"
+
+//d:Setting list item secondary text
+//d:File is kept on the phone ( just for images )
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_original_size "Original size"
+
+//d:Setting list item secondary text
+//d:Screen size version of the image file is kept on the phone
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_mserv_item_screen_size "Phone screen size"
+
+//d:Setting page heading text
+//d:Source devices where data search is done
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_mserv_sett_source_devices "Source device(s)"
+
+// NAVI PANE
+
+//d:status information
+//d:Content refreshing completed
+//l:navi_text_pane_t1
+//r:9.1
+//
+#define qtn_mserv_navi_refresh_completed "Refresh completed"
+
+//d:Process progress info
+//d:Parameter maximum length: 3 characters
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_sync "Synchronizing %N%"
+
+//d:Last sync time in minutes
+//d:Parameter maximum length: 2 characters
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_last_sync_min "Synced %N mins ago"
+
+//d:Last sync time 1 minute ago
+//d: navi pane
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_last_sync_min_one "Synced 1 min ago"
+
+//d:Last sync time in hours
+//d:Parameter maximum length: 2 characters
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_last_sync_hour "Synced %N hours ago"
+
+//d:Last sync time 1 hour ago
+//d:navi pane
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_last_sync_hour_one "Synced 1 hour ago"
+
+//d:Last sync time in days
+//d:Parameter maximum length: 3 characters
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_last_sync_day "Synced %N days ago"
+
+//d:Last sync time 1 day ago
+//d:navi pane
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_last_sync_day_one "Synced 1 day ago"
+
+//d:Process progress info
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_refreshing "Refreshing %N%"
+
+//d:list size info
+//d:Parameters maximum length: 4 characters, 4 characters
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_list_size "%0N MB (%1N free)"
+
+//d:file size & count
+//d:Parameters maximum length: 4 characters, 5 characters
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_items_fill_list "%0N MB, %1N items"
+
+//d:file size & count
+//d:Parameters maximum length: 4 characters, 5 characters
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_rules_amount "%0N MB, %1N items"
+
+//d:file size & count
+//d:Parameters maximum length: 6 characters
+//l:navi_text_pane_t1
+//r:2.0
+//
+#define qtn_mserv_navi_rules_amount1 "%N MB, 1 item"
+
+//d:file size & count
+//d:Parameters maximum length: 6 characters
+//l:navi_text_pane_t1
+//r:2.0
+//
+#define qtn_mserv_navi_rules_amount0 "%N MB, 0 items"
+
+//d:Store browser view navi pane text
+//d:Amount of items
+//d:Parameter maximum length: 5 characters
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_navi_items_store_browse "%N items"
+
+//d:Store browser view navi pane text
+//d:Amount of items
+//l:navi_text_pane_t1
+//r:2.0
+//
+#define qtn_mserv_navi_items_store_browse1 "1 item"
+
+//d:Fill list view navi pane text
+//d:Amount of items
+//l:navi_text_pane_t1
+//r:2.0
+//
+#define qtn_mserv_navi_items_fill_list1 "%N MB, 1 item"
+
+//d:Fill list view navi pane text
+//d:Amount of items
+//l:navi_text_pane_t1
+//r:2.1
+//
+#define qtn_mserv_navi_items_fill_list_no_items "No items"
+
+//d:Fill rule list -view's navi pane text
+//d:Amount of items
+//l:navi_text_pane_t1
+//r:2.1
+//
+#define qtn_mserv_navi_one_new_item "1 new item"
+
+//d:Fill rule list -view's navi pane text
+//d:Amount of items
+//l:navi_text_pane_t1
+//r:2.1
+//
+#define qtn_mserv_navi_rules_amount_no_items "No items"
+
+//d:Store list view's navi pane text
+//d:Amount of new items
+//l:navi_text_pane_t1
+//r:2.1
+//
+#define qtn_mserv_navi_no_new_items "No new items"
+
+//d:Store list view's navi pane text
+//d:Amount of new items
+//d:Parameter maximum length: 5 characters
+//l:navi_text_pane_t1
+//r:2.1
+//
+#define qtn_mserv_navi_new_items "%N new items"
+
+//d:Store browse view's navi pane text
+//d:Amount of items
+//l:navi_text_pane_t1
+//r:2.1
+//
+#define qtn_mserv_navi_items_store_browse_none "No items"
+
+//d:Navi pane text
+//d:Preprocesses files so that updated information can be seen on screen
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wait_preprocessing "Updating lists"
+
+//d:Navi pane text
+//d:Updating list
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wait_updating_list "Updating list"
+
+//d:Navi pane text
+//d:Creates new list of files with random method
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wait_randomize "Randomizing"
+
+//d:Navi pane text
+//d:Reads data e.g artist names, video titles, genres,...
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_mserv_wait_getting_data "Reading data"
+
+// SOFTKEY TEXTS
+
+//d:Left softkey text
+//d:Used with list reordering
+//l:control_pane_t1/opt7
+//r:1.0
+//
+#define qtn_mserv_skey_drop "Drop"
+
+//d:Left softkey text
+//d:Used with list reordering
+//l:control_pane_t1/opt7
+//r:1.0
+//
+#define qtn_mserv_skey_grab "Grab"
+
+//d:Right softkey text
+//d:Used to end reordering
+//l:control_pane_t1/opt7
+//r:1.0
+//
+#define qtn_mserv_skey_done "Done"
+
+//d:Middle softkey
+//d:Deselects current fill list
+//l:control_pane_t3/opt7
+//r:2.0
+//
+#define qtn_mserv_msk_unselect "Unselect"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/plugin/data/200075DD.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plugin resource definition
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+#include "pluginuids.h"
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = MSPluginUid;
+
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x200075DD;
+            implementations =
+                {
+                // Info for
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = MSPluginImplementationUid;
+                    version_no         = 1;
+                    display_name       = "mediaservantplugin";
+                    default_data       = "mediaservantplugin";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/plugin/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project MediaServant
+*
+*/
+
+
+
+PRJ_MMPFILES
+mediaservantplugin.mmp
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/plugin/group/mediaservantplugin.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET         mediaservantplugin.dll
+
+CAPABILITY CAP_ECOM_PLUGIN
+
+TARGETTYPE     PLUGIN
+
+UID            0x10009D8D 0x1028290E
+VENDORID       VID_DEFAULT
+
+SECUREID       0x1028290E
+
+
+
+SOURCEPATH      ../../src
+SOURCE          mspropertywatcher.cpp
+SOURCEPATH      ../src
+SOURCE          mediaservantplugin.cpp
+SOURCE          proxy.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc                   // for propertywathcer.h
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../../../../../inc
+
+START RESOURCE  ../data/200075DD.rss
+TARGET          mediaservantplugin.rsc
+TARGETPATH      resource/plugins
+END
+
+
+
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         fbscli.lib
+LIBRARY         AKNSKINS.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         egul.lib
+LIBRARY         msengine.lib
+LIBRARY         CommonEngine.lib     // stringloader
+LIBRARY         eikcore.lib          // CoeEnv
+LIBRARY         bafl.lib
+LIBRARY         apgrfx.lib           // apasession
+LIBRARY         apparc.lib           // appinfo
+LIBRARY         cone.lib
+LIBRARY         avkon.lib
+LIBRARY         PlatformEnv.lib      // pathinfo
+
+
+DEBUGLIBRARY    flogger.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/plugin/inc/mediaservantplugin.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMediaservantPlugin class definition
+*
+*/
+
+
+#ifndef C_MEDIASERVANTPLUGIN_H
+#define C_MEDIASERVANTPLUGIN_H
+
+// INCLUDES
+#include <gulicon.h>
+#include <upnpplugininterface.h>
+#include "mspropertywatcher.h"
+
+// FORWARD DECLARATIONS
+class CEikonEnv;
+class CMSEngine;
+
+/**
+ * MediaServant UPnP plugin class
+ *
+ * @Since S60 5.1
+ */
+class CMediaservantPlugin : public CUPnPPluginInterface,
+                            public MMSPropertyObserver
+    {
+    public:
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aPluginObserver observer for plugins
+         * @return pointer to CMediaservantPlugin
+         */
+        static CMediaservantPlugin* NewL(
+                        MUPnPPluginObserver* aPluginObserver);
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since S60 5.1
+         * @param aPluginObserver observer for plugins
+         * @return pointer to CMediaservantPlugin
+         */
+        static CMediaservantPlugin* NewLC(
+                        MUPnPPluginObserver* aPluginObserver);                        
+
+        /**
+         * Informs to ECom that it has been destroyed.
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        virtual ~CMediaservantPlugin();
+
+    protected:
+
+// From base class CUPnPPluginInterface
+        
+        /**
+         * From CUPnPPluginInterface
+         * See base class definition
+         */
+        const CGulIcon& GetIcon();
+
+        /**
+         * From CUPnPPluginInterface
+         * See base class definition
+         */
+        const TDesC& GetTitle();
+
+        /**
+         * From CUPnPPluginInterface
+         * See base class definition
+         */
+        const TDesC& GetSecondaryText();
+
+        /**
+         * From CUPnPPluginInterface
+         * See base class definition
+         */
+        void ExecuteL();
+
+        /**
+         * From CUPnPPluginInterface
+         * See base class definition
+         */
+        TBool RequiresUpnpConfiguration();
+
+// From base class MMSPropertyObserver
+
+        /**
+         * From MMSPropertyObserver
+         * See base class definition
+         */
+        void PropertyChangedL( TCmService aService,
+                               TInt aTotalItems,
+                               TInt aProcessedItems,
+                               TInt aItemsToBeProcessed );
+                               
+    private:
+
+        /**
+         * Performs the second phase construction.
+         *
+         * @since S60 5.1
+         * @param aPluginObserver observer for plugins
+         * @return None
+         */
+        void ConstructL( MUPnPPluginObserver* aPluginObserver );
+
+        /**
+         * Performs the first phase of two phase construction.
+         *
+         * @since S60 5.1
+         * @param aEcomArguments, Ecom arguments
+         * @return None
+         */
+        CMediaservantPlugin( TAny* aEcomArguments );
+
+        /**
+         * Load secondary text to plugin
+         *
+         * @since S60 5.1
+         * @param None
+         * @return None
+         */
+        void LoadPluginTextL();
+
+    private:
+        /**
+         * Required in all plugins which implement CUPnPPluginInterface
+         */
+        MUPnPPluginObserver*            iPluginObserver;
+
+        /**
+         * Plugin primary text
+         */
+        HBufC*                          iTitle;             // owned
+        /**
+         * Plugin secondary text
+         */
+        HBufC*                          iSecondaryText;     // owned
+        /**
+         * Flag for indication that IAP setup is needed
+         */
+        TBool                           iRequiresUpnpConf;
+        /**
+         * Plugin icon
+         */
+        CGulIcon*                       iIcon;              // owned
+        /**
+         * Resource file offset
+         */
+        TInt                            iResFileOffset;
+        /**
+         * Control environment for res file handling
+         */
+        CEikonEnv*                      iCoeEnv;
+        /**
+         * Progress watcher
+         */
+        CMSPropertyWatcher*             iMSPropertyWatcher; // owned
+        /**
+         * Application engine for text loading
+         */
+        CMSEngine*                      iMSEngine;          // owned
+    };
+
+
+#endif // C_MEDIASERVANTPLUGIN_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/plugin/inc/pluginuids.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plugin Uid definitions
+*
+*/
+
+
+#define MSPluginUid 0x1028290E
+#define MSPluginImplementationUid 0x1028290E
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/plugin/src/mediaservantplugin.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,359 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMediaservantPlugin class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <w32std.h>
+#include <fbs.h>
+#include <StringLoader.h>
+#include <mediaservant.mbg>
+#include <mediaservant.rsg>
+#include <bautils.h>
+#include <eikenv.h>
+#include <apgcli.h>
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <pathinfo.h>
+
+#include "msengine.h"
+#include "mediaservantplugin.h"
+#include "msconstants.h"
+#include "mediaservantuid.h"
+
+#include "msdebug.h"
+
+// CONSTANTS
+_LIT( KMediaservantRscFile, "\\resource\\apps\\mediaservant.rsc" );
+
+// ---------------------------------------------------------------------------
+// CMediaservantPlugin::NewL
+// Create instance of concrete ECOM interface implementation
+// ---------------------------------------------------------------------------
+CMediaservantPlugin* CMediaservantPlugin::NewL(
+    MUPnPPluginObserver* aPluginObserver)
+    {
+    CMediaservantPlugin* self = CMediaservantPlugin::NewLC (aPluginObserver);
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CMediaservantPlugin::NewLC
+// Create instance of concrete ECOM interface implementation
+// ---------------------------------------------------------------------------
+CMediaservantPlugin* CMediaservantPlugin::NewLC(
+    MUPnPPluginObserver* aPluginObserver)
+    {
+    CMediaservantPlugin* self = new(ELeave)
+                              CMediaservantPlugin(aPluginObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL( aPluginObserver );
+
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CMediaservantPlugin::ConstructL
+// Second phase constructor. Creates icon and sets title and secondary text
+// ---------------------------------------------------------------------------
+//
+void CMediaservantPlugin::ConstructL(MUPnPPluginObserver*
+                                                aPluginObserver)
+    {
+    LOG(_L("[MediaServant]\t CMediaservantPlugin::ConstructL start"));
+
+    // Set observer
+    iPluginObserver = aPluginObserver;
+
+    // set icon
+    LOG(_L("[MediaServant]\t CMediaservantPlugin::ConstructL create icon"));
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC(skin, KAknsIIDDefault,
+                            bitmap, mask, KMSMifFileName,
+                            EMbmMediaservantQgn_mserv_app_menu_icon,
+                            EMbmMediaservantQgn_mserv_app_menu_icon_mask);
+
+    iIcon = CGulIcon::NewL(bitmap,mask);
+    iIcon->SetBitmapsOwnedExternally(EFalse);
+
+    CleanupStack::Pop( mask );
+    CleanupStack::Pop( bitmap );
+    bitmap = NULL;
+    mask = NULL;
+
+
+
+    // Load resource file
+    LOG(_L("[MediaServant]\t CMediaservantPlugin::ConstructL load resource"));
+    TFileName rscFileName( KMediaservantRscFile );
+ 
+    iCoeEnv = CEikonEnv::Static();
+    RFs& fileSession = iCoeEnv->FsSession();
+
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+        
+    // this works for c and z drives
+    TInt err(KErrNone);
+    TRAP( err, iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ))
+    if ( err != KErrNone )
+        {
+        // not found? let's try mmc drive
+        rscFileName.Copy( PathInfo::MemoryCardRootPath() );
+        rscFileName.Delete(2, 2); // remove //
+        rscFileName.Append( KMediaservantRscFile );
+        iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName );
+        }
+
+    LOG(_L("[MediaServant]\t CMediaServantPlugin::ConstructL \
+    after resourceloader"));
+
+    // Set item text
+    iTitle = StringLoader::LoadL( R_MS_PLUGIN_LISTBOX_PRIMARY_TEXT );
+
+    iMSEngine = CMSEngine::NewL();
+
+    // load secondary text
+    LoadPluginTextL();
+
+    // Create property watcher for progress info
+    iMSPropertyWatcher = CMSPropertyWatcher::NewL();
+    // view will observe changes in property
+    iMSPropertyWatcher->SetObserver(this);
+    // start listening property
+    iMSPropertyWatcher->StartL();
+
+    LOG(_L("[MediaServant]\t CMediaservantPlugin::ConstructL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// Default constructor.
+// ---------------------------------------------------------------------------
+CMediaservantPlugin::CMediaservantPlugin(TAny* aEcomArguments)
+   : CUPnPPluginInterface( aEcomArguments )
+    {
+    iRequiresUpnpConf = ETrue;
+    iTitle = NULL;
+    iSecondaryText = NULL;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMediaservantPlugin::~CMediaservantPlugin
+// ---------------------------------------------------------------------------
+CMediaservantPlugin::~CMediaservantPlugin()
+    {
+    LOG(_L("[MediaServant]\t CMediaservantPlugin::~CMediaservantPlugin"));
+
+    delete iMSEngine;
+
+    // Un-Load resource file
+    if ( iResFileOffset )
+        {
+        iCoeEnv->DeleteResourceFile( iResFileOffset );
+        iResFileOffset = 0;
+        }
+
+    if ( iMSPropertyWatcher )
+        {
+        iMSPropertyWatcher->Stop();
+        delete iMSPropertyWatcher;
+        }
+    delete iIcon;
+    delete iTitle;
+    delete iSecondaryText;
+    }
+
+// ---------------------------------------------------------------------------
+// CMediaservantPlugin::GetIcon
+// Returns reference to the icon of the plugin
+// ---------------------------------------------------------------------------
+const CGulIcon& CMediaservantPlugin::GetIcon()
+    {
+    return *iIcon;
+    }
+
+// ---------------------------------------------------------------------------
+// CMediaservantPlugin::GetTitle
+// Returns const reference to the icon of the plugin
+// ---------------------------------------------------------------------------
+const TDesC& CMediaservantPlugin::GetTitle()
+    {
+    return *iTitle;
+    }
+
+// ---------------------------------------------------------------------------
+// CMediaservantPlugin::GetSecondaryText
+// Returns const reference to the scondary text of the plugin
+// ---------------------------------------------------------------------------
+const TDesC& CMediaservantPlugin::GetSecondaryText()
+    {
+    return *iSecondaryText;
+    }
+
+// ---------------------------------------------------------------------------
+// CMediaservantPlugin::ExecuteL
+// Executes the plugin
+// ---------------------------------------------------------------------------
+void CMediaservantPlugin::ExecuteL()
+    {
+    LOG(_L("[MediaServant]\t CMediaservantPlugin::ExecuteL"));
+
+    RApaLsSession apaLsSession;
+    User::LeaveIfError(apaLsSession.Connect());
+    CleanupClosePushL(apaLsSession);
+
+    TApaAppInfo applicationInfo;
+    TInt error = apaLsSession.GetAppInfo(
+                                    applicationInfo,
+                                    TUid::Uid( KMediaServantUID3 ) );
+
+    if(error == KErrNone)
+        {
+        CApaCommandLine* commandLine = CApaCommandLine::NewLC();
+        commandLine->SetExecutableNameL( applicationInfo.iFullName );
+        commandLine->SetCommandL( EApaCommandRun );
+        apaLsSession.StartApp( *commandLine );
+
+        CleanupStack::PopAndDestroy( commandLine );
+        }
+    else
+        {
+        LOG(_L("[MediaServant]\t CMediaservantPlugin::ExecuteL \
+        application launch failed"));
+        }
+
+    CleanupStack::PopAndDestroy( &apaLsSession );
+    }
+
+// ---------------------------------------------------------------------------
+// CMediaservantPlugin::RequiresUpnpConfiguration
+// Checks if the plugin needs upnp configuration (set IAP)
+// ---------------------------------------------------------------------------
+TBool CMediaservantPlugin::RequiresUpnpConfiguration()
+    {
+    return iRequiresUpnpConf;
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CMediaservantPlugin::PropertyChangedL
+// --------------------------------------------------------------------------
+//
+void CMediaservantPlugin::PropertyChangedL( TCmService aService,
+                                    TInt aTotalItems,
+                                    TInt aProcessedItems,
+                                    TInt /*aItemsToBeProcessed*/ )
+    {
+
+    LOG(_L("[MediaServant]\t CMediaservantPlugin::PropertyChangedL"));
+
+    switch ( aService )
+        {
+        case ECmServiceHarvest:
+            {
+            delete iSecondaryText;
+            iSecondaryText = NULL;
+            iSecondaryText = StringLoader::LoadL( R_MS_PLUGIN_HARVESTING );
+            iPluginObserver->ExtensionEvent(
+                                EExtensionSecondaryTextChanged );
+            break;
+            }
+        case ECmServiceStore:
+        // fall through
+        case ECmServiceFill:
+            {
+                {
+                TInt value( 0 );
+                // calculate procentual value
+                if ( aTotalItems > 0 && aProcessedItems >= 0 )
+                    {
+                	value = (TReal(aProcessedItems)/TReal(aTotalItems))*100;
+                    } 
+                delete iSecondaryText;
+                iSecondaryText = NULL;
+                iSecondaryText = StringLoader::LoadL(
+                                   R_MS_PLUGIN_SYNCHRONIZING, value );
+                iPluginObserver->ExtensionEvent( 
+                    EExtensionSecondaryTextChanged );
+                }
+            break;
+            }
+        case ECmServiceNone:
+            {
+            LoadPluginTextL();
+            iPluginObserver->ExtensionEvent(EExtensionSecondaryTextChanged);
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMediaservantPlugin::PropertyChangedL \
+            service not found"));
+            }
+
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMediaservantPlugin::LoadPluginTextL
+// --------------------------------------------------------------------------
+//
+void CMediaservantPlugin::LoadPluginTextL()
+    {
+    // Need to check content manager service state
+    //to determine secondary text
+    LOG(_L("[MediaServant]\t CMediaservantPlugin:LoadPluginTextL \
+    open msengine"));
+
+    TCmServiceState state = iMSEngine->ServiceState(
+                                        ECmServiceContentManager );
+    if ( iSecondaryText )
+        {
+        delete iSecondaryText;
+        iSecondaryText = NULL;
+        }
+
+    switch ( state )
+        {
+        case ECmServiceStateAutomatic:
+            {
+            iSecondaryText =  StringLoader::LoadL(
+                                            R_MS_PLUGIN_TEXT_AUTO_SYNC );
+            break;
+            }
+        case ECmServiceStateDisabled:
+            {
+            iSecondaryText =  StringLoader::LoadL(
+                                            R_MS_PLUGIN_TEXT_MANUAL_SYNC );
+            break;
+            }
+        default:
+            {
+            // don't show sync state
+            LOG(_L("[MediaServant]\t CMediaservantPlugin:LoadPluginTextL \
+            sync state not shown"));
+            break;
+            }
+        }
+    }
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/plugin/src/proxy.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  plugin proxy table
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <ecom/ecom.h>
+#include <ecom/implementationproxy.h>
+#include "mediaservantplugin.h"
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY(0x1028290E, CMediaservantPlugin::NewL),
+    };
+
+
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msapp.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMediaServantApp class implementation
+*
+*/
+
+
+#include <eikstart.h>
+#include "msdebug.h"
+#include "msapp.h"
+#include "msdocument.h"
+#include "msconstants.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------
+// CMediaServantApp::CreateDocumentL()
+// ---------------------------------------------------------
+//
+CApaDocument* CMediaServantApp::CreateDocumentL()
+    {
+    LOG(_L("[MediaServant]\t CMediaServantApp::CreateDocumentL"));
+        
+    return CMSDocument::NewL( *this );
+    }
+
+// ---------------------------------------------------------
+// CMediaServantApp::AppDllUid()
+// ---------------------------------------------------------
+//
+TUid CMediaServantApp::AppDllUid() const
+    {
+    LOG(_L("[MediaServant]\t CMediaServantApp::AppDllUid"));
+    
+    return KUidMediaServant;
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+// ---------------------------------------------------------
+// NewApplication() 
+// ---------------------------------------------------------
+//
+LOCAL_C CApaApplication* NewApplication()
+    {
+    LOG(_L("[MediaServant]\t CApaApplication* NewApplication"));    
+    
+    return new CMediaServantApp;
+    }
+
+// ---------------------------------------------------------------------------
+// Starts application
+// ---------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    LOG(_L("[MediaServant]\t E32Main"));    
+    
+    return EikStart::RunApplication( NewApplication );
+    }
+
+
+// End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msappui.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,543 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMediaServantAppUi class implementation
+*
+*/
+
+
+#include <StringLoader.h>
+#include <mediaservant.rsg>
+#include <f32file.h>
+#include <driveinfo.h>
+
+#include "cmsettingsfactory.h"
+#include "cmsettings.h"
+#include "cmdriveinfo.h"
+#include "msappui.h"
+#include "msstorelistcontroller.h"
+#include "msmainview.h"
+#include "msfillview.h"
+#include "msfillruleeditview.h"
+#include "msstorelistview.h"
+#include "msstoresettingsview.h"
+#include "msbrowseview.h"
+#include "msfillbrowseview.h"
+#include "msconstants.h"
+#include "msengine.h"
+#include "msparameteragent.h"
+#include "cmsappwizard.h"
+#include "msgsinterface.h"
+#include "msgspluginuids.h"
+
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CMSAppUi::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSAppUi::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::ConstructL"));
+
+#ifndef __SERIES60_31__
+    BaseConstructL( EAknEnableSkin | EAknEnableMSK );
+#else
+    BaseConstructL( EAknEnableSkin );
+#endif
+    
+    // Create engine
+    iMSEngine = CMSEngine::NewL();
+
+    // Create parameter agent for message passing between views
+    iParameterAgent = new ( ELeave ) CMSParameterAgent();
+
+    // Create fill list controller
+    iFillRuleController = CMSFillRuleController::NewL( *iMSEngine );
+
+    // Create store list controller
+    iStoreListController = CMSStoreListController::NewL( *iMSEngine );
+
+    LoadSettingsPluginL(); // loads gs plugin
+
+    // main view is created
+    CMSMainView* mainView = new ( ELeave )CMSMainView( *this );
+    CleanupStack::PushL( mainView );
+    mainView->ConstructL();
+    AddViewL( mainView );           // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop( mainView);
+
+    CMSFillView* fillView = new ( ELeave ) CMSFillView( *this );
+    CleanupStack::PushL( fillView );
+    fillView->ConstructL();
+    AddViewL( fillView );           // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop( fillView );
+
+    CMSFillRuleEditView* ruleEditView = new ( ELeave )
+                                            CMSFillRuleEditView( *this );
+    CleanupStack::PushL( ruleEditView );
+    ruleEditView->ConstructL();
+    AddViewL( ruleEditView );       // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop( ruleEditView );
+
+    CMSStoreListView* storelistView = new ( ELeave )
+                                CMSStoreListView( *this );
+    CleanupStack::PushL( storelistView );
+    storelistView->ConstructL();
+    AddViewL( storelistView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop( storelistView);
+
+    CMSStoreSettingsView* storesettingView = new ( ELeave )
+                                CMSStoreSettingsView( *this );
+    CleanupStack::PushL( storesettingView );
+    storesettingView->ConstructL();
+    AddViewL( storesettingView );   // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop( storesettingView );
+
+    CMSBrowseView* browseView = new ( ELeave )
+                                CMSBrowseView( *this );
+    CleanupStack::PushL( browseView );
+    browseView->ConstructL();
+    AddViewL( browseView );   // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop( browseView );
+
+    CMSFillBrowseView* fillBrowseView =
+                    new ( ELeave ) CMSFillBrowseView( *this );
+    CleanupStack::PushL( fillBrowseView );
+    fillBrowseView->ConstructL();
+    AddViewL( fillBrowseView );   // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop( fillBrowseView );
+
+
+    // default view is now main view
+    SetDefaultViewL( *mainView );
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::~CMSAppUi()
+// --------------------------------------------------------------------------
+//
+CMSAppUi::~CMSAppUi()
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::~CMSAppUi"));
+    
+    if( iPlugin )
+        {
+        // Destroy Ecom plugin
+        iPlugin->DestroyPlugin();
+        }
+
+    delete iMSEngine;
+    delete iParameterAgent;
+    delete iFillRuleController;
+    delete iStoreListController;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CMSAppUi::HandleCommandL(TInt aCommand)
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::HandleCommandL"));
+
+    switch ( aCommand )
+        {
+        case EAknSoftkeyBack:
+        // fall trough
+        case EEikCmdExit:
+            {
+            // program is exited
+            Exit();
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSAppUi::HandleCommandL \
+            invalid command"));
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::ChangeViewL()
+//
+// Changes active view according to input parameter.
+// --------------------------------------------------------------------------
+//
+void CMSAppUi::ChangeViewL(const TUid& aOldView, const TUid& aNewView)
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::ChangeViewL"));
+
+    iParameterAgent->SetPreviousViewId( aOldView );
+
+    if ( aOldView.iUid == KMSMainViewId.iUid )
+        {
+        // store focus index of main view
+        iParameterAgent->SetMainViewFocusIndex(
+                    static_cast<CMSMainView*> (iView)->FocusIndex());
+        
+        }
+    else if ( aOldView.iUid == KMSFillViewId.iUid )
+        {
+        // store focus index of main view
+        iParameterAgent->SetFillViewFocusIndex(
+                    static_cast<CMSFillView*> (iView)->FocusIndex());
+        
+        }
+    else if ( aOldView.iUid == KMSStoreListViewId.iUid )
+        {
+        // store focus index of fill view
+        iParameterAgent->SetStoreViewFocusIndex(
+                    static_cast<CMSStoreListView*> (iView)->FocusIndex());
+        }        
+    else
+        {
+        // no need to change view
+        }
+
+    // new view is activated
+    ActivateViewL(TVwsViewId(KUidMediaServant, aNewView));
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::StoreListController()
+// Returns fill rule container
+// --------------------------------------------------------------------------
+//
+CMSStoreListController* CMSAppUi::StoreListController()
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::StoreListController"));
+
+    return iStoreListController;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::MSEngine()
+// Returns msengine pointer
+// --------------------------------------------------------------------------
+//
+CMSEngine* CMSAppUi::MSEngine()
+    {
+    return iMSEngine;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::RefreshListsL()
+// Refresh store and fill lists
+// --------------------------------------------------------------------------
+//
+void CMSAppUi::RefreshListsL()    
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::RefreshListsL"));
+    
+    iStoreListController->UpdateListsL();
+    iFillRuleController->UpdateArrayL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::ReadMMCInfoL
+// Reads mmc capasity
+// --------------------------------------------------------------------------
+//
+TInt CMSAppUi::ReadMMCInfoL( TInt64& aCapasity, TInt64& aFreeSpace )
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::ReadMMCInfoL"));
+    RFs& sysFs = FsSession();
+    RPointerArray<CCmDriveInfo> storedDrives;
+    RPointerArray<CCmDriveInfo> driveArray;
+    TInt error = KErrNone;
+    aCapasity = 0;
+    aFreeSpace = 0;
+    MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC();
+
+    // read stored info of stored drives
+    MSEngine()->GetDrivesL( storedDrives );
+    // get system drive info
+    settings->DriveListL( sysFs, driveArray );
+
+    TInt count = storedDrives.Count();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TIdentityRelation<CCmDriveInfo> relation( CMSAppUi::CompareIds );
+        TInt index = driveArray.Find( storedDrives[i], relation );
+        if ( index != KErrNotFound )
+            {
+            TVolumeInfo volInfo;
+            error = sysFs.Volume( volInfo, storedDrives[i]->DriveNumber() );
+            if ( error == KErrNone )
+                {
+                TRACE(Print(_L("[MediaServant]\t CMSAppUi::ReadMMCInfoL %ld\n"),
+                            volInfo.iSize ));
+                aCapasity += volInfo.iSize;
+                aFreeSpace += volInfo.iFree;
+                }
+            }
+        }
+
+    storedDrives.ResetAndDestroy();
+    storedDrives.Close();
+
+    driveArray.ResetAndDestroy();
+    driveArray.Close();
+
+	settings->Close();
+    CleanupStack::Pop(); // settings
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::GetFilledFilesSize
+// Get filled files size
+// --------------------------------------------------------------------------
+//
+void CMSAppUi::GetFilledFilesSize( TInt64& aSize, const TInt aID )
+    {
+    iMSEngine->GetFilledFilesSize( aSize, aID );
+    }
+
+
+// CMSAppUi::ParameterAgent
+// returns pointer to parameter agent
+// --------------------------------------------------------------------------
+//
+CMSParameterAgent* CMSAppUi::ParameterAgent()
+    {
+    return iParameterAgent;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::FillRuleController
+// returns pointer to rule controller
+// --------------------------------------------------------------------------
+//
+CMSFillRuleController* CMSAppUi::FillRuleController()
+    {
+    return iFillRuleController;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::FsSession
+// returns file server session
+// --------------------------------------------------------------------------
+//
+RFs& CMSAppUi::FsSession()
+    {
+    return iEikonEnv->FsSession();
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::DriveSelectedL
+// returns drive selection status
+// --------------------------------------------------------------------------
+//
+TBool CMSAppUi::DriveSelectedL()
+    {
+    TBool status( EFalse );
+
+    if ( iMSEngine->DriveSelectionStatus() && MemoryAttachedL() )
+        {
+        status = ETrue;
+        }
+    return status;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSAppUi::MemoryAttachedL
+// Returns ETrue if selected memory is on the device
+// --------------------------------------------------------------------------
+//
+TBool CMSAppUi::MemoryAttachedL()
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::MemoryAttachedL"));
+    
+    TBool status( EFalse );
+    RFs& fileServer = FsSession();
+    RPointerArray<CCmDriveInfo> storedDrives;
+    RPointerArray<CCmDriveInfo> driveArray;
+    MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC();
+
+    // read stored info of stored drives
+    MSEngine()->GetDrivesL( storedDrives );
+    // get system drive info
+    settings->DriveListL( fileServer, driveArray );
+
+    TInt count = storedDrives.Count();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TIdentityRelation<CCmDriveInfo> relation(CMSAppUi::CompareIds );
+        TInt index = driveArray.Find( storedDrives[i], relation );
+        if ( index != KErrNotFound )
+            {
+            status = ETrue;
+            i = count; // break loop
+            }
+        }
+
+    storedDrives.ResetAndDestroy();
+    storedDrives.Close();
+
+    driveArray.ResetAndDestroy();
+    driveArray.Close();
+
+	settings->Close();
+    CleanupStack::Pop(); // settings
+
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CMSAppUi::CompareIds
+// Compares drive ids
+// --------------------------------------------------------------------------
+//
+TBool CMSAppUi::CompareIds( const CCmDriveInfo& aStoredDrive,
+                            const CCmDriveInfo& aDrive )
+    {
+    TBool retval = EFalse;
+    if ( aStoredDrive.DriveId() == aDrive.DriveId() )
+        {
+        retval = ETrue;
+        }
+
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppUi::LoadSettingsPluginL
+// ---------------------------------------------------------------------------
+//    
+void CMSAppUi::LoadSettingsPluginL()
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::LoadSettingsPluginL start"));
+   
+    TRAPD( error, iPlugin = CMSGSInterface::NewL( KMSGSImplementationUid ) );
+    if ( !error )
+        {
+        AddViewL( iPlugin ); // transfer ownership to CAknViewAppUi    
+        }    
+    
+    LOG(_L("[MediaServant]\t CMSAppUi::LoadSettingsPluginL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppUi::SettingsPlugin
+// ---------------------------------------------------------------------------
+// 
+CMSGSInterface* CMSAppUi::SettingsPlugin()
+    {
+    return iPlugin;
+    }
+    
+// ---------------------------------------------------------------------------
+// CMSAppUi::CheckDrivesSelectedL
+// ---------------------------------------------------------------------------
+// 
+void CMSAppUi::CheckDrivesSelectedL()
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::CheckDrivesSelectedL"));
+    
+    TBool status( EFalse );
+    RFs& fileServer = FsSession();
+    MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC();
+    RPointerArray<CCmDriveInfo> storedDrives;
+    RPointerArray<CCmDriveInfo> driveArray;
+    CleanupClosePushL( storedDrives );
+    CleanupClosePushL( driveArray );
+
+    // read stored info of stored drives
+    MSEngine()->GetDrivesL( storedDrives );
+    // get system drive info
+    settings->DriveListL( fileServer, driveArray );
+
+    TInt count = storedDrives.Count();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TIdentityRelation<CCmDriveInfo> relation(CMSAppUi::CompareIds );
+        TInt index = driveArray.Find( storedDrives[i], relation );
+        if ( index != KErrNotFound )
+            {
+            status = ETrue;
+            i = count; // break loop
+            }
+        }
+    
+    // none of drives have been selected
+    if( !status )
+        {
+        for ( TInt j = 0; j < driveArray.Count(); j++ )
+            {
+            // mass memory
+            if ( driveArray[j]->DriveType() != DriveInfo::EDriveRemovable )
+                {
+                RPointerArray<CCmDriveInfo> massDrives;
+                CleanupClosePushL( massDrives );
+                TInt64 quota =
+                ( driveArray[j]->DriveSize() * KHDDefaultQuota ) / 100;
+                driveArray[j]->SetDriveQuota( quota );
+                driveArray[j]->SetStatus( ETrue );
+                
+                massDrives.Append( driveArray[j] );
+                MSEngine()->SetDrivesL( massDrives );
+                CleanupStack::PopAndDestroy(  );// &massDrives
+                //break, for only one mass memory exist
+                j = driveArray.Count();
+                }
+            }
+        }
+    storedDrives.ResetAndDestroy();
+    driveArray.ResetAndDestroy();
+    
+    CleanupStack::PopAndDestroy( 2 ); // &storedDrives, &driveArray
+	settings->Close();
+    CleanupStack::Pop(); // settings
+    }
+
+// ---------------------------------------------------------------------------
+// CMSAppUi::RunWizard
+// ---------------------------------------------------------------------------
+// 
+TInt CMSAppUi::RunWizardL()
+	{
+	LOG(_L("[MediaServant]\t CMSAppUi::RunWizardL Launch Wizard"));
+	
+	TInt wizRetVal(KErrNone);
+
+    // Check drives selection status
+    CheckDrivesSelectedL();
+        
+    CMSAppWizard* appWizard = CMSAppWizard::NewL( *iMSEngine );
+    CleanupStack::PushL( appWizard );
+    wizRetVal = appWizard->StartL();
+    CleanupStack::PopAndDestroy( appWizard );
+
+    if( wizRetVal != KErrNone)
+        {
+        LOG(_L("[MediaServant]\t CMSAppUi::RunWizardL Wizard Run OK"));        
+        }
+    else
+        {
+        TRACE(Print(_L("[MediaServant]\t RunWizardL::\
+        wizard return value: %d"), wizRetVal));
+        RefreshListsL();
+        }
+    iMSEngine->SetAppWizardState();
+
+    return wizRetVal;
+	}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msbasecontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,323 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSBaseContainer class implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikclbd.h>
+
+#include <aknlists.h>
+#include <barsread.h>
+#include <AknIconArray.h>
+#include <AknQueryDialog.h>
+#include <aknnotewrappers.h>
+#include <akncontext.h>
+
+#include "msbasecontainer.h"
+#include "msconstants.h"
+#include "msdebug.h"
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::CMSBaseContainer()
+// Default constructor.
+// --------------------------------------------------------------------------
+//
+CMSBaseContainer::CMSBaseContainer()
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::CMSBaseContainer"));
+
+    iCoeEnv = CEikonEnv::Static();
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::~CMSBaseContainer()
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CMSBaseContainer::~CMSBaseContainer()
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::~CMSBaseContainer"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::SetListBoxFromResourceL()
+// Sets listbox from resource using ConstructFromResourceL() of
+// CEikColumnListBox class.
+// --------------------------------------------------------------------------
+//
+void CMSBaseContainer::SetListBoxFromResourceL(
+    CEikColumnListBox* aListBox, const TInt aResourceId )
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::SetListBoxFromResourceL \
+    column listbox"));
+
+    if ( aListBox && aResourceId )
+        {
+        aListBox->SetContainerWindowL( *this );
+
+        TResourceReader reader;
+        iCoeEnv->CreateResourceReaderLC( reader, aResourceId );
+        aListBox->ConstructFromResourceL( reader );
+        CleanupStack::PopAndDestroy(); // resource stuffs.
+
+        // Creates scrollbar.
+        CreateScrollbarL( aListBox );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::SetListBoxFromResourceL()
+// Sets listbox from resource using ConstructFromResourceL() of
+// CEikFormattedCellListBox class.
+// --------------------------------------------------------------------------
+//
+void CMSBaseContainer::SetListBoxFromResourceL(
+    CEikFormattedCellListBox* aListBox,
+    const TInt aResourceId )
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::SetListBoxFromResourceL \
+    formatted cell listbox"));
+
+    if ( aListBox && aResourceId )
+        {
+        aListBox->SetContainerWindowL( *this );
+
+        TResourceReader reader;
+        iCoeEnv->CreateResourceReaderLC( reader, aResourceId );
+        aListBox->ConstructFromResourceL( reader );
+        CleanupStack::PopAndDestroy(); // resource stuffs.
+
+        // Creates scrollbar.
+        CreateScrollbarL( aListBox );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::AppendItemToListBoxArrayL()
+// Appends item to the list
+// --------------------------------------------------------------------------
+//
+void CMSBaseContainer::AppendItemToListBoxArrayL( CEikListBox* aListBox,
+                                                  CTextListBoxModel* aModel,
+                                                  TInt aIconIndex,
+                                                  TDesC& aPrimaryText,
+                                                  TDesC& aSecondaryText )
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::AppendItemToListBoxArrayL"));
+
+
+    if ( aListBox &&  aModel )
+        {
+        MDesCArray *itemList = aModel->ItemTextArray();
+        CDesCArray *itemArray = static_cast<CDesCArray*>( itemList );
+
+    TBuf<2> iconIndex; // magic: maximum icon count is 99
+    iconIndex.AppendNum( aIconIndex );
+
+    TInt newLen = iconIndex.Length() +
+                  KSlashT().Length() +
+                  (&aPrimaryText ? aPrimaryText.Length() : 0) +
+                  KSlashT().Length() +
+                  (&aSecondaryText ? aSecondaryText.Length() : 0);
+
+    HBufC* newText = HBufC::NewMaxLC( newLen );
+
+    // Create new item string
+    TPtr newTPtr = newText->Des();
+
+    newTPtr.Copy( iconIndex );
+    newTPtr.Append( KSlashT );
+
+    if ( &aPrimaryText )
+        {
+        newTPtr.Append( aPrimaryText );
+        }
+    newTPtr.Append( KSlashT );
+
+    if ( &aSecondaryText )
+        {
+        newTPtr.Append( aSecondaryText );
+        }
+
+    itemArray->AppendL(newTPtr);
+    CleanupStack::PopAndDestroy( newText );
+
+    aListBox->HandleItemAdditionL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::AppendItemToListBoxArrayL()
+// Appends item to the list
+// --------------------------------------------------------------------------
+//
+void CMSBaseContainer::AppendItemToListBoxArrayL( CEikListBox* aListBox,
+                                                  CTextListBoxModel* aModel,
+                                                  TInt aIconIndex,
+                                                  TDesC& aItemText )
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::AppendItemToListBoxArrayL"));
+
+
+    if ( aListBox &&  aModel )
+        {
+        MDesCArray *itemList = aModel->ItemTextArray();
+        CDesCArray *itemArray = static_cast<CDesCArray*>( itemList );
+
+    TBuf<2> iconIndex; // maximum icon count is 99
+    iconIndex.AppendNum( aIconIndex );
+
+    TInt newLen = iconIndex.Length() +
+                  KSlashT().Length() +
+                  (&aItemText ? aItemText.Length() : 0) +
+                  KSlashT().Length() +
+                  iconIndex.Length();
+
+    HBufC* newText = HBufC::NewMaxLC( newLen );
+
+    // Create new item string
+    TPtr newTPtr = newText->Des();
+
+    newTPtr.Copy( iconIndex );
+    newTPtr.Append( KSlashT );
+
+    if ( &aItemText )
+        {
+        newTPtr.Append( aItemText );
+        }
+    newTPtr.Append( KSlashT );
+
+    itemArray->AppendL(newTPtr);
+    CleanupStack::PopAndDestroy( newText );
+
+    aListBox->HandleItemAdditionL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::AppendIconToArrayL()
+// Adds icon to iconarray
+// --------------------------------------------------------------------------
+//
+void CMSBaseContainer::AppendIconToArrayL(CAknIconArray* aArray,
+                                               MAknsSkinInstance* aSkin,
+                                               const TDesC& aMbmFile,
+                                               const TAknsItemID& aID,
+                                               TInt aBitmapId,
+                                               TInt aMaskId)
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::AppendIconToArrayL"));
+
+    __ASSERT_DEBUG( aArray, User::Leave(KErrArgument) );
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC(aSkin, aID,
+        bitmap, mask, aMbmFile, aBitmapId, aMaskId);
+
+    CGulIcon* icon = CGulIcon::NewL(bitmap, mask);
+    icon->SetBitmapsOwnedExternally(EFalse);
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop(mask);
+    CleanupStack::Pop(bitmap);
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL(icon);
+
+    aArray->AppendL(icon);
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop(icon);
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::CreateScrollbarL()
+// Creates scrollbar.
+// --------------------------------------------------------------------------
+//
+void CMSBaseContainer::CreateScrollbarL( CEikListBox* aListBox )
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::CreateScrollbarL"));
+
+    if ( aListBox )
+        {
+        // Creates scrollbar.
+        aListBox->CreateScrollBarFrameL( ETrue );
+        aListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+            CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::UpdateScrollBar()
+// Update scroll bar.
+// --------------------------------------------------------------------------
+//
+void CMSBaseContainer::ShowNoteL ( TInt aResource, TInt aError )
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::ShowNoteL"));
+
+    // Show error note
+    CAknInformationNote* dlg = new(ELeave)CAknInformationNote();
+    TBuf<KMaxFileName> errorText;
+    iCoeEnv->ReadResourceL(errorText, aResource );
+    errorText.AppendNum( aError );
+    dlg->ExecuteLD(errorText);
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::SetContextPaneIconL()
+// Sets context pane icon.
+// --------------------------------------------------------------------------
+//
+void CMSBaseContainer::SetContextPaneIconL( const CFbsBitmap* aIconBitmap,
+                                            const CFbsBitmap* aIconMask  )
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::SetContextPaneIconL"));
+
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    CleanupStack::PushL( statusPane );
+    CAknContextPane* contextPane = ( CAknContextPane * )statusPane->
+            ControlL( TUid::Uid( EEikStatusPaneUidContext ) );
+    CleanupStack::Pop( statusPane );
+    contextPane->SetPicture( aIconBitmap, aIconMask );
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseContainer::SetDefaultContextPaneIconL()
+// Sets default context pane icon.
+// --------------------------------------------------------------------------
+//
+void CMSBaseContainer::SetDefaultContextPaneIconL()
+    {
+    LOG(_L("[MediaServant]\t CMSBaseContainer::SetDefaultContextPaneIconL"));
+
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    CleanupStack::PushL( statusPane );
+    CAknContextPane* contextPane = ( CAknContextPane * )statusPane->
+            ControlL( TUid::Uid( EEikStatusPaneUidContext ) );
+    CleanupStack::Pop( statusPane );
+    contextPane->SetPictureToDefaultL();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msbaseview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSBaseView class implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <akntitle.h>
+#include <eikspane.h>
+#include <avkon.hrh>
+#include <aknnavide.h>
+#include <barsread.h>
+
+#include "msbaseview.h"
+#include "msconstants.h"
+#include "msappui.h"
+#include "msengine.h"
+
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CMSBaseView::CMSBaseView()
+// Default constructor.
+// --------------------------------------------------------------------------
+//
+CMSBaseView::CMSBaseView()
+    {
+    LOG(_L("[MediaServant]\t CMSBaseView::CMSBaseView"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseView::~CMSBaseView()
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CMSBaseView::~CMSBaseView()
+    {
+    LOG(_L("[MediaServant]\t CMSBaseView::~CMSBaseView"));
+    ClearCurrentNaviPaneText();
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseView::SetTitlePaneTextL()
+// Sets text to title pane.
+// --------------------------------------------------------------------------
+void CMSBaseView::SetTitlePaneTextL( TInt aResourceId )
+    {
+    LOG(_L("[MediaServant]\t CMSBaseView::SetTitlePaneTextL"));
+
+    // Fetches pointer to the default title pane control.
+    CAknTitlePane* titlePane = static_cast<CAknTitlePane*>(
+        StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+
+    // Makes and sets text which is used title pane.
+    if ( aResourceId == KMSDefaultTitleId )
+        {
+        titlePane->SetTextToDefaultL();
+        }
+    else
+        {
+        TBuf<KMSTitleBufLength> titleText( 0 );
+        iCoeEnv->ReadResourceL( titleText, aResourceId );
+        titlePane->SetTextL( titleText );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseView::SetTitlePaneTextL()
+// Sets text to title pane.
+// --------------------------------------------------------------------------
+void CMSBaseView::SetTitlePaneTextL( const TDesC& aText )
+    {
+    LOG(_L("[MediaServant]\t CMSBaseView::SetTitlePaneTextL"));
+
+    // Fetches pointer to the default title pane control.
+    CAknTitlePane* titlePane = static_cast<CAknTitlePane*>(
+        StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+
+    titlePane->SetTextL( aText );
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSBaseView::SetNavigationPaneTextL()
+// Sets navigation pane text.
+// --------------------------------------------------------------------------
+//
+void CMSBaseView::SetNavigationPaneTextL(const TDesC& aText )
+    {
+    // old decorator is popped and deleted
+    ClearCurrentNaviPaneText();
+
+    if ( !iNaviPane )
+        {
+        iNaviPane = static_cast<CAknNavigationControlContainer*>
+            ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+                // ownership of decorator is transfered to application
+        }
+
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( aText );
+    iNaviPane->PushL( *iNaviDecorator );
+    }
+
+// --------------------------------------------------------------------------
+// CMSBaseView::ClearCurrentNaviPaneText()
+// Clears navi pane text.
+// --------------------------------------------------------------------------
+//
+void CMSBaseView::ClearCurrentNaviPaneText()
+    {
+    if ( iNaviDecorator )
+        {
+        iNaviPane->Pop( iNaviDecorator );
+        delete iNaviDecorator;
+        iNaviDecorator = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::CancelAsyncOperation()
+// Cancels current operation
+// --------------------------------------------------------------------------
+//
+void CMSBaseView::CancelAsyncOperation( CMSAppUi* aAppUi )
+    {
+    // getting data not yet finished so we must cancel the operation
+    TCmServerState state;
+    aAppUi->MSEngine()->ServerState( state );
+    if ( state != ECmServerStateIdle )
+        {
+        LOG( _L( "[MediaServant]\t CMSBaseView::\
+        CancelAsyncOperation cancel operation" ) );
+        aAppUi->MSEngine()->StopOperation();
+        ClearCurrentNaviPaneText();
+        }
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msbrowsecontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSBrowseContainer class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+#include "upnpstring.h"
+
+#include "mserv.hlp.hrh"
+#include "cmstorerulecontainer.h"
+#include "cmstorerule.h"
+#include "msappui.h"
+#include "msstorelistcontroller.h"
+#include "msbrowseview.h"
+#include "msbrowsecontainer.h"
+#include "msengine.h"
+#include "mediaservantuid.h"
+
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSBrowseContainer::CMSBrowseContainer()
+// --------------------------------------------------------------------------
+//
+CMSBrowseContainer::CMSBrowseContainer( CMSAppUi& aAppUi,
+                                        CMSBrowseView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseContainer::CMSBrowseContainer"));
+
+    iAppUi = &aAppUi;
+    iView = &aView;    
+    }
+
+// --------------------------------------------------------------------------
+// CMSBrowseContainer::~CMSBrowseContainer()
+// --------------------------------------------------------------------------
+//
+CMSBrowseContainer::~CMSBrowseContainer()
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseContainer::~CMSBrowseContainer"));
+
+    delete iListBox; // Deletes listbox object.
+    }
+
+// --------------------------------------------------------------------------
+// CMSBrowseContainer::GetBrowseDataL()
+// Gets file information from engine
+// --------------------------------------------------------------------------
+//
+void CMSBrowseContainer::GetBrowseDataL()
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseContainer::GetBrowseDataL"));
+
+    CMSParameterAgent* parameterAgent = iAppUi->ParameterAgent();
+
+    TInt selected = iAppUi->ParameterAgent()->StoreViewFocusIndex();
+
+    // get list container
+    CCmStoreRuleContainer* storeRuleContainer =
+                iAppUi->StoreListController()->StoreListContainer();
+
+    // get rule
+    CCmStoreRule* storeRule = storeRuleContainer->StoreRule( selected );
+
+    // read media type
+    storeRule->StoreRule(0, &iMediaType);
+
+    iView->SetTitlePaneTextL( iMediaType );
+
+    // get items covered by rule
+    iItemArray = iAppUi->MSEngine()->GetStoreListItemsL( storeRule->Name() );
+
+    HBufC* naviText = NULL;
+
+    switch ( iItemArray->Count() )
+        {
+        case 0: // 0 items
+            {
+            naviText = StringLoader::LoadLC(
+                                R_MS_STORE_BROWSE_NAVI_0_ITEMS );
+            break;
+            }
+        case 1: // 1 item
+            {
+            naviText = StringLoader::LoadLC(
+                                R_MS_STORE_BROWSE_NAVI_1_ITEM );
+            break;
+            }
+        default: // many items
+            {
+            naviText = StringLoader::LoadLC(
+                                R_MS_STORE_BROWSE_NAVI_ITEMS,
+                                iItemArray->Count() );
+            // do number conversion
+            TPtr ptr = naviText->Des();
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+            break;
+            }
+        }
+
+    iView->SetNavigationPaneTextL( *naviText );
+    CleanupStack::PopAndDestroy( naviText );
+    }
+
+// --------------------------------------------------------------------------
+// CMSBrowseContainer::HandleResourceChange
+// Handles layout change
+// --------------------------------------------------------------------------
+//
+void CMSBrowseContainer::HandleResourceChange( TInt aType )
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseContainer::HandleResourceChange"));
+
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect( iView->ClientRect() );
+        }
+
+    CCoeControl::HandleResourceChange( aType );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSBrowseContainer::GetHelpContext
+// ---------------------------------------------------------------------------
+//
+void CMSBrowseContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseContainer::GetHelpContext"));
+
+    aContext.iMajor = TUid::Uid(KMediaServantUID3);
+    aContext.iContext = KMSERV_HLP_FILE_BROWSE;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msbrowseview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSBrowseView class implementation
+*
+*/
+
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+#include <hlplch.h>
+
+#include "msbrowsecontainer.h"
+#include "msconstants.h"
+#include "msbrowseview.h"
+#include "msappui.h"
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CMSBrowseView::CMSBrowseView()
+// --------------------------------------------------------------------------
+//
+CMSBrowseView::CMSBrowseView( CMSAppUi& aAppUi )
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseView::CMSBrowseView"));
+
+    iAppUi = &aAppUi;
+    }
+
+// --------------------------------------------------------------------------
+// CMSBrowseView::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSBrowseView::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseView::ConstructL"));
+
+    BaseConstructL( R_MS_BROWSE_VIEW );
+    }
+
+// --------------------------------------------------------------------------
+// CMSBrowseView::~CMSBrowseView()
+// --------------------------------------------------------------------------
+//
+CMSBrowseView::~CMSBrowseView()
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseView::~CMSBrowseView"));
+
+    DoDeactivate();
+    }
+// --------------------------------------------------------------------------
+// TUid CMSBrowseView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CMSBrowseView::Id() const
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseView::Id"));
+
+    return KMSBrowseViewId;
+    }
+
+// --------------------------------------------------------------------------
+// CMSBrowseView::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CMSBrowseView::HandleCommandL( TInt aCommand )
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseView::HandleCommandL"));
+
+    switch ( aCommand )
+        {
+        case EAknSoftkeyBack:
+            {
+            // back to store view
+            iAppUi->ChangeViewL( KMSBrowseViewId, KMSStoreListViewId );
+            break;
+            }
+
+        case EAknCmdHelp :
+            {
+            TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL(
+                        iEikonEnv->WsSession(),
+            iEikonEnv->EikAppUi()->AppHelpContextL() ));
+            break;
+            }
+
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CMSBrowseView::DoActivateL()
+// --------------------------------------------------------------------------
+//
+void CMSBrowseView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseView::DoActivateL"));
+
+    // Set title pane text to default
+    CMSBaseView::SetTitlePaneTextL( KMSDefaultTitleId );
+
+    if ( !iContainer )
+        {
+        iContainer = new (ELeave) CMSBrowseContainer( *iAppUi, *this );
+        iContainer->ConstructL( ClientRect() );
+        iContainer->SetMopParent( this );
+        AppUi()->AddToViewStackL( *this, iContainer );
+        iContainer->ActivateL();
+        }
+   }
+
+// --------------------------------------------------------------------------
+// CMSBrowseView::DoDeactivate()
+// --------------------------------------------------------------------------
+//
+void CMSBrowseView::DoDeactivate()
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseView::DoDeactivate"));
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        }
+
+    delete iContainer; // Deletes the container class object.
+    iContainer = NULL;
+
+    ClearCurrentNaviPaneText();
+    }
+
+// --------------------------------------------------------------------------
+// CMSBrowseView::SetTitlePaneTextL()
+// --------------------------------------------------------------------------
+//
+void CMSBrowseView::SetTitlePaneTextL( TCmMediaType aMediaType )
+    {
+    LOG(_L("[MediaServant]\t CMSBrowseView::SetTitlePaneTextL"));
+
+    TInt resourceId(0);
+
+    switch ( aMediaType )
+        {
+        case ECmImage:
+            {
+            resourceId = R_MS_STORE_TITLE_PHONE_IMAGES;
+            break;
+            }
+        case ECmOtherImage:
+            {
+            resourceId = R_MS_STORE_TITLE_IMAGES;
+            break;
+            }
+        case ECmVideo:
+            {
+            resourceId = R_MS_STORE_TITLE_PHONE_VIDEOS;
+            break;
+            }
+        case ECmOtherVideo:
+            {
+            resourceId = R_MS_STORE_TITLE_VIDEOS;
+            break;
+            }
+        case ECmAudio:
+            {
+            resourceId = R_MS_STORE_TITLE_MUSIC;
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSBrowseView::SetTitlePaneTextL \
+            mediatype not found"));
+            break;
+            }
+        }
+
+    if ( resourceId )
+        {
+        HBufC* titleText = StringLoader::LoadLC( resourceId );
+        CMSBaseView::SetTitlePaneTextL( *titleText );
+        CleanupStack::PopAndDestroy( titleText );
+        }
+    }
+    
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msdocument.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSDocument class implementation
+*
+*/
+
+
+
+#include "msdebug.h"
+#include "msdocument.h"
+#include "msappui.h"
+
+// --------------------------------------------------------------------------
+// CMSDocument::CMSDocument( CEikApplication& aApp )
+// --------------------------------------------------------------------------
+//
+CMSDocument::CMSDocument( CEikApplication& aApp )
+: CAknDocument( aApp )
+    {    LOG(_L("[MediaServant]\t CMSDocument::CMSDocument"));
+    }
+
+// --------------------------------------------------------------------------
+// void CMSDocument::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSDocument::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSDocument::ConstructL"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSDocument* CMSDocument::NewL( CEikApplication& aApp )
+// --------------------------------------------------------------------------
+//
+CMSDocument* CMSDocument::NewL(CEikApplication& aApp )
+    {
+    LOG(_L("[MediaServant]\t CMSDocument::NewL"));
+
+    CMSDocument* self = CMSDocument::NewLC( aApp );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSDocument* CMSDocument::NewLC( CEikApplication& aApp )
+// --------------------------------------------------------------------------
+//
+CMSDocument* CMSDocument::NewLC(CEikApplication& aApp )
+    {
+    LOG(_L("[MediaServant]\t CMSDocument::NewL"));
+
+    CMSDocument* self = new ( ELeave ) CMSDocument( aApp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSDocument::CreateAppUiL()
+// --------------------------------------------------------------------------
+//
+CEikAppUi* CMSDocument::CreateAppUiL()
+    {
+    LOG(_L("[MediaServant]\t CMSDocument::CreateAppUiL"));
+
+    return new ( ELeave ) CMSAppUi;
+    }
+
+// --------------------------------------------------------------------------
+// CMSDocument::~CMSDocument()
+// --------------------------------------------------------------------------
+//
+CMSDocument::~CMSDocument()
+    {
+    LOG(_L("[MediaServant]\t CMSDocument::~CMSDocument"));
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msfillbrowsecontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSFillBrowseContainer class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+#include <utf.h>
+#include <e32math.h>
+
+#include "mserv.hlp.hrh"
+#include "cmfillrule.h"
+#include "msfillbrowsecontainer.h"
+#include "msfillbrowseview.h"
+#include "msappui.h"
+#include "msengine.h"
+#include "mediaservantuid.h"
+
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::CMSFillBrowseContainer()
+// --------------------------------------------------------------------------
+//
+CMSFillBrowseContainer::CMSFillBrowseContainer(
+                                    CMSAppUi& aAppUi,
+                                    CMSFillBrowseView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseContainer::\
+    CMSFillBrowseContainer"));
+
+    iAppUi = &aAppUi;
+    iView = &aView;
+    iIconCount = 0; //default icon   
+
+    iAppUi->MSEngine()->SetObserver( this );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::~CMSFillBrowseContainer()
+// --------------------------------------------------------------------------
+//
+CMSFillBrowseContainer::~CMSFillBrowseContainer()
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseContainer::\
+    ~CMSFillBrowseContainer"));
+
+    iStatusArray.Close();
+
+    delete iListBox; // Deletes listbox object.
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::RandomizeListL()
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseContainer::RandomizeListL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseContainer::RandomizeListL"));
+
+    iAppUi->MSEngine()->PreProcessFillListL( iRule->Name() );
+    HBufC* naviText = StringLoader::LoadLC( R_MS_WAIT_RANDOMIZE );
+    iView->SetNavigationPaneTextL( *naviText );
+    CleanupStack::PopAndDestroy( naviText );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::HasListRandomRule
+// --------------------------------------------------------------------------
+//
+TBool CMSFillBrowseContainer::HasListRandomRule()
+    {
+    TBool retval = EFalse;
+    if ( iRule->Method() == ECMRandom )
+        {
+        retval = ETrue;
+        }
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::ReadyL()
+// engine observer callback
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseContainer::ReadyL( TCmService aService, TInt /*aError*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseContainer::ReadyL"));
+
+    if ( aService == ECmServicePreProcessingFilllist )
+        {
+        iView->ClearCurrentNaviPaneText();
+        // read rules again
+        iAppUi->FillRuleController()->UpdateArrayL();
+
+        GetBrowseDataL();
+        // Add data to listbox
+        UpdateListBoxDataL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::CheckIfStatusChanged()
+// Checks if status values are changed
+// --------------------------------------------------------------------------
+//
+TBool CMSFillBrowseContainer::CheckIfStatusChanged()
+    {
+    TBool status( EFalse );
+
+    TInt itemCount = iItemArray->Count();
+
+    for ( TInt i = 0; i < itemCount; i++ )
+        {
+        TCmListItemStatus status1 = (*iItemArray)[i]->Status();
+        TCmListItemStatus status2 = iStatusArray[i];
+        if ( (*iItemArray)[i]->Status() != iStatusArray[i] )
+            {
+            status = ETrue;
+            i = itemCount; // break loop
+            }
+        }
+
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::SetFileStatusesL()
+// Sets file statuses
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseContainer::SetFileStatusesL()
+    {
+    if ( CheckIfStatusChanged() )
+        {
+        iAppUi->MSEngine()->SetFillFileStatusesL( iItemArray );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::GetBrowseDataL()
+// Gets file information from engine
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseContainer::GetBrowseDataL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseContainer::GetBrowseDataL"));
+
+    CMSParameterAgent* parameterAgent = iAppUi->ParameterAgent();
+
+    TInt selected = iAppUi->ParameterAgent()->FillViewFocusIndex();
+
+    RPointerArray<CMSFillList>* fillListArray =
+                        iAppUi->FillRuleController()->FillListArray();
+
+    CMSFillList* fillList = (*fillListArray)[selected];
+    iRule = fillList->List();
+    // get media type
+    iMediaType = iRule->MediaType();
+    // get items covered by rule
+    if( iItemArray )
+        {
+        iItemArray->ResetAndDestroy();
+        iItemArray->Close();
+        delete iItemArray;
+        iItemArray = NULL;
+        }
+    iItemArray = iAppUi->MSEngine()->GetFillListItemsL( iRule->Name() );
+    // keep original statuses safe
+    for ( TInt i = 0; i < iItemArray->Count(); i++ )
+        {
+        iStatusArray.AppendL( (*iItemArray)[i]->Status() );
+        }
+
+    // Set title pane text
+    HBufC* ruleName = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+                                                    iRule->Name() );
+    CleanupStack::PushL( ruleName );
+    iView->SetTitlePaneTextL( *ruleName );
+    CleanupStack::PopAndDestroy( ruleName );
+
+    // set navi pane text
+    CreateAndSetNaviPaneTextL( fillList->ItemCount(), fillList->ListSize() );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::CreateAndSetNaviPaneTextL()
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseContainer::CreateAndSetNaviPaneTextL( TUint32 aCount,
+                                                        TUint32 aSize )
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseContainer::\
+    CreateAndSetNaviPaneTextL"));
+
+    // Set navi pane text
+    CArrayFix<TInt>* infoArray =
+        new ( ELeave ) CArrayFixFlat<TInt>(2); // only 2 numbers needed
+    CleanupStack::PushL( infoArray );
+
+    HBufC* naviText = NULL;
+
+    TReal size( 0 );
+    Math::Round( size, TReal( aSize ) / KMega, 0 );
+
+
+    switch ( aCount )
+        {
+        case 0: // 0 items
+            {
+            naviText = StringLoader::LoadLC(
+                        R_MS_FILL_LIST_BROWSE_NAVI_0_ITEMS );
+            break;
+            }
+        case 1: // 1 item
+            {
+            naviText = StringLoader::LoadLC(
+                        R_MS_FILL_LIST_BROWSE_NAVI_1_ITEM, size );
+            break;
+            }
+        default: // many items
+            {
+            infoArray->AppendL( size );
+            infoArray->AppendL( aCount );
+            naviText = StringLoader::LoadLC(
+                        R_MS_FILL_LIST_BROWSE_NAVI_ITEMS, *infoArray );
+            // do number conversion
+            TPtr ptr = naviText->Des();
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+            break;
+            }
+        }
+
+    iView->SetNavigationPaneTextL( *naviText );
+    CleanupStack::PopAndDestroy( naviText );
+    CleanupStack::PopAndDestroy( infoArray );
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::SetStatusOfFiles()
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseContainer::SetStatusOfFiles( TCmListItemStatus aStatus )
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseContainer::SetStatusOfFiles"));
+
+    const CListBoxView::CSelectionIndexArray* selections =
+                                    ListBox()->SelectionIndexes();
+    TInt count = selections->Count();
+
+    // mark used
+    if ( count )
+        {
+        for ( TInt index = 0; index < count; index++)
+            {
+            SetFileStatus( (*selections)[ index ], aStatus );
+
+            }
+        }
+    // set only highlighted item status
+    else
+        {
+        SetFileStatus( ListBox()->CurrentItemIndex(), aStatus );
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseContainer::HandleResourceChange
+// Handles layout change
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseContainer::HandleResourceChange( TInt aType )
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseContainer::\
+    HandleResourceChange"));
+
+
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect( iView->ClientRect() );
+        }
+
+    CCoeControl::HandleResourceChange( aType );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSFillBrowseContainer::GetHelpContext
+// ---------------------------------------------------------------------------
+//
+void CMSFillBrowseContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseContainer::GetHelpContext"));
+
+    aContext.iMajor = TUid::Uid(KMediaServantUID3);
+    aContext.iContext = KMSERV_HLP_FILL_BROWSE;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msfillbrowseview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSFillBrowseView class implementation
+*
+*/
+
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+#include <hlplch.h>
+
+#include "msfillbrowsecontainer.h"
+#include "msconstants.h"
+#include "msfillbrowseview.h"
+#include "msappui.h"
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseView::CMSFillBrowseView()
+// --------------------------------------------------------------------------
+//
+CMSFillBrowseView::CMSFillBrowseView(CMSAppUi& aAppUi )
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseView::CMSFillBrowseView"));
+
+    iAppUi = &aAppUi;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseView::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseView::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseView::ConstructL"));
+
+    BaseConstructL( R_MS_FILL_BROWSE_VIEW );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseView::~CMSFillBrowseView()
+// --------------------------------------------------------------------------
+//
+CMSFillBrowseView::~CMSFillBrowseView()
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseView::~CMSFillBrowseView"));
+
+    DoDeactivate();
+    }
+// --------------------------------------------------------------------------
+// TUid CMSFillBrowseView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CMSFillBrowseView::Id() const
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseView::Id"));
+
+    return KMSFillBrowseViewId;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseView::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseView::HandleCommandL( TInt aCommand )
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseView::HandleCommandL"));
+
+    switch ( aCommand )
+        {
+        case EAknSoftkeyBack:
+            {
+            // update status before exit
+            iContainer->SetFileStatusesL();            
+            // back to fill list view
+            iAppUi->ChangeViewL( KMSBrowseViewId, KMSFillViewId );
+            break;
+            }
+
+        case EMSCmdLock:
+            {
+            iContainer->SetStatusOfFiles( ECmLocalCopy );
+            break;
+            }
+
+        case EMSCmdUnLock:
+            {
+            iContainer->SetStatusOfFiles( ECmFilled );
+            break;
+            }
+
+        case EMSCmdRandomize:
+            {
+            iContainer->RandomizeListL();
+            break;
+            }
+
+        case EAknCmdMark:   // fall through
+        case EAknCmdUnmark: // fall through
+        case EAknMarkAll:   // fall through
+        case EAknUnmarkAll:
+            {
+            // Gets pointer of current listbox.
+            CEikListBox* listbox = iContainer->ListBox();
+
+            if ( listbox )
+                {
+                AknSelectionService::HandleMarkableListProcessCommandL(
+                                                        aCommand, listbox );
+                }
+            break;
+            }
+        case EAknCmdHelp :
+            {
+            TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL(
+                        iEikonEnv->WsSession(),
+            iEikonEnv->EikAppUi()->AppHelpContextL() ));
+            break;
+            }
+
+        default:
+            {
+            // update status before exit
+            iContainer->SetFileStatusesL();
+
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseView::DoActivateL(...)
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseView::DoActivateL"));
+
+    // Set title pane text to default
+    SetTitlePaneTextL( KMSDefaultTitleId );
+
+    if ( !iContainer )
+        {
+        iContainer = new (ELeave) CMSFillBrowseContainer(
+                                                    *iAppUi,
+                                                    *this );
+        iContainer->ConstructL( ClientRect() );
+        iContainer->SetMopParent( this );
+        AppUi()->AddToViewStackL( *this, iContainer );
+        iContainer->ActivateL();
+
+        // marked item indexes
+        iSelections = iContainer->ListBox()->SelectionIndexes();
+
+        }
+   }
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseView::DoDeactivate()
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseView::DoDeactivate()
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseView::DoDeactivate"));
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        }
+
+    delete iContainer; // Deletes the container class object.
+    iContainer = NULL;
+
+    ClearCurrentNaviPaneText();
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillBrowseView::DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+void CMSFillBrowseView::DynInitMenuPaneL( TInt aResourceId,
+                                         CEikMenuPane* aMenuPane)
+    {
+    LOG(_L("[MediaServant]\t CMSFillBrowseView::DynInitMenuPaneL"));
+
+    TInt numberOfItems = iContainer->ListBox()->Model()->NumberOfItems();
+
+    if ( aResourceId == R_MS_FILL_BROWSE_MENU )
+        {
+        // check if random lists exist or there is no items
+        if ( iContainer->HasListRandomRule() == EFalse )
+            {
+            aMenuPane->SetItemDimmed( EMSCmdRandomize, ETrue );
+            }
+
+        if ( numberOfItems )
+            {
+            TCmListItemStatus fileStatus = iContainer->FileStatus(
+                                iContainer->ListBox()->CurrentItemIndex() );
+
+            if (  fileStatus == ECmToBeFilled ||
+                  fileStatus == ECmToBeShrinked )
+                {
+                aMenuPane->SetItemDimmed( EMSCmdUnLock, ETrue );
+                aMenuPane->SetItemDimmed( EMSCmdLock, ETrue );
+                aMenuPane->SetItemDimmed( EMSCmdMark, ETrue );
+                }
+            else
+                {
+                if ( fileStatus == ECmFilled )
+                    {
+                    aMenuPane->SetItemDimmed( EMSCmdUnLock, ETrue );
+                    }
+                else // ECmLocalCopy
+                    {
+                    aMenuPane->SetItemDimmed( EMSCmdLock, ETrue );
+                    }
+                }
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EMSCmdLock, ETrue );
+            aMenuPane->SetItemDimmed( EMSCmdUnLock, ETrue );
+            aMenuPane->SetItemDimmed( EMSCmdMark, ETrue );
+            }
+        }
+
+    // mark submenu
+    if ( aResourceId == R_MS_MARK_MENUPANE && numberOfItems )
+        {
+
+        if ( iSelections->Count() == 0 )
+            {
+            aMenuPane->SetItemDimmed( EAknCmdUnmark, ETrue );
+            aMenuPane->SetItemDimmed( EAknUnmarkAll, ETrue );
+            }
+        else
+            {
+            // index of selected item
+            TInt itemIdx = 0;
+            // highlighted item index
+            TInt currentItem = iContainer->ListBox()->CurrentItemIndex();
+            // Sort criteria, offset = 0
+            TKeyArrayFix sortKey( 0, ECmpTUint );
+            TInt found = iSelections->Find( currentItem, sortKey, itemIdx );
+            if ( found == 0 )
+                {
+                aMenuPane->SetItemDimmed( EAknCmdMark, ETrue );
+                }
+            }
+        }
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msfillcontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1125 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSFillContainer class implementation
+*
+*/
+
+
+#include <AknIconArray.h>
+#include <aknlists.h>
+#include <AknsUtils.h>
+#include <eikclbd.h>
+#include <mediaservant.rsg>
+#include <mediaservant.mbg>
+#include <StringLoader.h>
+#include <avkon.mbg>
+#include <aknlistquerydialog.h>
+#include "upnpstring.h"
+#include <e32math.h>
+
+#include "cmdriveinfo.h"
+#include "mserv.hlp.hrh"
+#include "cmfillrule.h"
+#include "msfillview.h"
+#include "msappui.h"
+#include "mediaservantuid.h"
+#include "msengine.h"
+#include "msfillcontainer.h"
+#include "msconstants.h"
+#include "msdebug.h"
+
+// CONSTANTS
+
+// Listbox granularity
+const TInt KListGranularity = 5;
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::CMSFillContainer()
+// --------------------------------------------------------------------------
+//
+CMSFillContainer::CMSFillContainer( CMSAppUi& aAppUi, CMSFillView& aView ) :
+    iMSAppUi( aAppUi ),
+    iView( aView )
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::CMSFillContainer"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::~CMSFillContainer()
+// --------------------------------------------------------------------------
+//
+CMSFillContainer::~CMSFillContainer()
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::~CMSFillContainer"));
+
+    iSelectedLists.Close();
+
+    iView.ClearCurrentNaviPaneText();
+
+    delete iListBox; // Deletes listbox object.
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::ConstructL( TRect aRect )
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::ConstructL"));
+
+    // fill quota size
+    CalculateFillQuotaL();
+
+    CreateWindowL();
+
+    iListBox = new (ELeave) CAknSingleGraphicStyleListBox;
+
+    // This is multiselection listbox but resource defines it as SELECTION
+    // LIST because we don't want to let framework handle icon changes.
+    // Framework toggles between two icons whereas we have to show multiple
+    // icons.
+    // Special icons are changed every time item selection or priority
+    // changes. Calculations for icons are made in SetIcon()
+    SetListBoxFromResourceL(iListBox, R_FILL_VIEW_LISTBOX);
+
+    // Create icons
+    CAknIconArray* icons = new (ELeave) CAknIconArray( EIconCount );
+    CleanupStack::PushL( icons );
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    // selected and fits icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_white_check,
+                        EMbmMediaservantQgn_mserv_white_check_mask );
+
+    // unselected and fits icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_white_uncheck,
+                        EMbmMediaservantQgn_mserv_white_uncheck_mask );
+
+    // selected and partially fits icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_yellow_check,
+                        EMbmMediaservantQgn_mserv_yellow_check_mask );
+
+    // unselected and partially fits icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_yellow_uncheck,
+                        EMbmMediaservantQgn_mserv_yellow_uncheck_mask );
+
+    // selected and doesn't fit icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_red_check,
+                        EMbmMediaservantQgn_mserv_red_check_mask );
+
+    // unselected and doesn't fit icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_red_uncheck,
+                        EMbmMediaservantQgn_mserv_red_uncheck_mask );
+    // video type -icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_video_list_small,
+                        EMbmMediaservantQgn_mserv_video_list_small_mask );
+
+    // image type -icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_image_list_small,
+                        EMbmMediaservantQgn_mserv_image_list_small_mask );
+
+    // music type -icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_music_list_small,
+                        EMbmMediaservantQgn_mserv_music_list_small_mask );
+
+    // mark icon for reordering mode -icon
+    AppendIconToArrayL( icons, skin,
+                        KAvkonMifFileName,
+                        KAknsIIDDefault,
+                        EMbmAvkonQgn_indi_marked_add,
+                        EMbmAvkonQgn_indi_marked_add_mask );
+
+    iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
+    CleanupStack::Pop(icons);
+
+
+    // Create icon for context pane
+    AknsUtils::CreateIconL( skin,
+                            KAknsIIDDefault,
+                            iIcon,
+                            iIconMask,
+                            KMSMifFileName,
+                            EMbmMediaservantQgn_mserv_from_home,
+                            EMbmMediaservantQgn_mserv_from_home_mask);
+    // change context icon
+    SetContextPaneIconL( iIcon, iIconMask );
+
+    SetRect(aRect);
+
+    // Get rule controller
+    iFillRuleController = iMSAppUi.FillRuleController();
+    // Update array
+    iFillRuleController->UpdateArrayL();
+    // get fill lists
+    iFillListArray = iFillRuleController->FillListArray();
+    // keep selections safe
+    iSelectedIndexes = iListBox->SelectionIndexes();
+
+    TInt64 capasity;
+    TInt64 free;
+    iMSAppUi.ReadMMCInfoL( capasity, free );
+    iFreeMemory = Min( free, iQuota );
+
+    if ( iFillListArray->Count() > 0 )
+        {
+        // Add data to listbox
+        UpdateListBoxDataL();
+
+        // Enable text scrolling
+        iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+        // get item array
+        CDesCArray* itemArray = static_cast<CDesCArray*>
+                                (iListBox->Model()->ItemTextArray());
+
+        iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
+        }
+
+    // keep selections safe
+    const CListBoxView::CSelectionIndexArray* selected =
+                                            iListBox->SelectionIndexes();
+
+    for ( TInt index = 0; index < selected->Count(); index++ )
+        {
+        iSelectedLists.Append( (*selected)[index] );
+        }
+
+    // Set highlighted item
+    TInt currentItem = iMSAppUi.ParameterAgent()->FillViewFocusIndex();
+    if ( currentItem >= 0 )
+        {
+        //Set current item
+        iListBox->SetCurrentItemIndex( currentItem );
+        }
+    else
+        {
+        // first item
+        // This is set when new list is created without existing lists
+        iListBox->SetCurrentItemIndex( 0 );
+        }
+
+    UpdateNaviTextL();
+
+	iPreviousItemIndex = 0;
+	iDragItemIndex = 0;
+
+    // Change middle softkey according to selection
+    TBool listSelected = IsCurrentListItemActive();
+    iView.SetCbaL( listSelected );
+
+    ActivateL(); // Activates window. ( Ready to draw )
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::CountComponentControls()
+// Returns number of components.
+// --------------------------------------------------------------------------
+//
+TInt CMSFillContainer::CountComponentControls() const
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::CountComponentControls"));
+
+    return 1; // return number of controls inside this container
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::ComponentControl()
+// Returns pointer to particular component.
+// --------------------------------------------------------------------------
+//
+CCoeControl* CMSFillContainer::ComponentControl(TInt /*aIndex*/) const
+
+    {
+    return iListBox; // return a pointer to the listbox
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::OfferKeyEventL()
+// Handles the key events.
+// --------------------------------------------------------------------------
+//
+TKeyResponse CMSFillContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::OfferKeyEventL"));
+
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if ( aType != EEventKey )
+        {
+        response =  EKeyWasNotConsumed;
+        }
+
+    else if ( iListBox && iListBox->CurrentItemIndex() >= 0 )
+        {
+        // check if reordering mode is activated
+        if ( iReorderState == EMSFillReorderActive ||
+             aKeyEvent.iCode == EKeyLeftArrow ||
+             aKeyEvent.iCode == EKeyRightArrow )
+            {
+            response = HandleReorderKeyEventL( aKeyEvent, aType );
+            }
+
+        // delete list
+        else if ( aKeyEvent.iCode == EKeyBackspace )
+            {
+            DeleteRuleL();
+            response = EKeyWasConsumed;
+            }
+
+        // activate/deactivate list
+        else if ( aKeyEvent.iCode == EKeyOK )
+            {
+            CCmFillRule* rule =
+                (*iFillListArray)[iListBox->CurrentItemIndex()]->List();
+            if ( rule->Selected() == ECmSelected )
+                {
+                rule->SetSelected( ECmUnSelected );
+                }
+            else
+                {
+                rule->SetSelected( ECmSelected );
+                }
+            iView.SetListUnselected();
+            UpdateListBoxDataL();
+            response = EKeyWasConsumed;
+            }
+
+        // default
+        else
+            {
+            response = iListBox->OfferKeyEventL( aKeyEvent, aType );
+            }
+
+
+        TCmServerState state;
+        iMSAppUi.MSEngine()->ServerState( state );
+        if ( ( aKeyEvent.iCode == EKeyUpArrow ||
+             ( aKeyEvent.iCode == EKeyDownArrow )))
+            {
+            // change navi pane text to match highlighted list size
+            UpdateNaviTextL();
+            }
+        }
+
+#ifndef __SERIES60_31__
+    if ( iReorderState == EMSFillNormal )
+        {
+        // Change middle softkey according to selection
+        TBool listSelected = IsCurrentListItemActive();
+        iView.SetCbaL( listSelected );
+        }
+#endif
+
+    return response;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::HandleDragAndDropEventsL()
+// Handles drag and drop events on touch screen
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::HandleDragAndDropEventsL( const TPointerEvent& aPointerEvent )
+	{
+	if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
+	     iReorderState != EMSFillNormal )
+		{
+		iReorderState = EMSFillReorderActive;
+	   	iDragItemIndex = iListBox->CurrentItemIndex();
+		}
+	else if ( aPointerEvent.iType == TPointerEvent::EButton1Up &&
+	     iReorderState == EMSFillReorderActive )
+		{
+		iView.HandleCommandL( EMSCmdDrop );
+		TInt listBoxItem = iListBox->CurrentItemIndex();
+		iListBox->SetCurrentItemIndex( iDragItemIndex );
+
+		TKeyEvent keyEvent;
+		// Move dragged item downwards
+		if ( listBoxItem >= iDragItemIndex )
+			{
+			keyEvent.iCode = EKeyDownArrow;
+        	for( TInt c = 0; listBoxItem > iDragItemIndex + c; c++ )
+	        	{
+	        	HandleReorderKeyEventL( keyEvent, EEventKey );
+	        	}
+			}
+		// Move dragged item upwards
+		else
+			{
+			keyEvent.iCode = EKeyUpArrow;
+        	for( TInt c = 0; listBoxItem < iDragItemIndex - c; c++ )
+	        	{
+	        	HandleReorderKeyEventL( keyEvent, EEventKey );
+	        	}
+			}
+        	
+		iListBox->SetCurrentItemIndex( listBoxItem );
+		}
+	}
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::UpdateListBoxDataL()
+// Creates listbox items
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::UpdateListBoxDataL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::UpdateListBoxDataL"));
+    TInt64 freeSpace = iFreeMemory;
+
+    TCmServerState state;
+    iMSAppUi.MSEngine()->ServerState( state );
+
+    // Keep item index safe for reordering mode because we reset the list
+    TInt currentItemIndex = iListBox->CurrentItemIndex();
+
+    // reset list size
+    iSizeOfSelectedLists = 0;
+
+    TBuf<KMaxFileName> item;
+    HBufC* primary_text = HBufC::NewL( KMaxFileName );
+    CleanupStack::PushL( primary_text );
+
+    // Listbox items
+    CDesCArray* itemArray = static_cast<CDesCArray*>
+                                   (iListBox->Model()->ItemTextArray());
+    itemArray->Reset();
+
+    // Marked listbox item indexes
+    CArrayFix<TInt>* selectionArray = new (ELeave )
+                                   CArrayFixFlat<TInt>(KListGranularity);
+
+    CleanupStack::PushL( selectionArray );
+
+    TInt ruleCount = iFillListArray->Count();
+
+    for ( TInt index = 0; index < ruleCount; index++ )
+        {
+        // Get fill rule name and put it to the listbox
+        CCmFillRule* rule = (*iFillListArray)[index]->List();
+        HBufC* listName = UpnpString::ToUnicodeL( rule->Name() );
+        CleanupStack::PushL( listName );
+        primary_text->Des().Copy( *listName );
+        CleanupStack::PopAndDestroy( listName );
+
+
+        // Check if rule is active and mark it in the list
+        TCmFillRuleStatus status = rule->Selected();
+
+        TInt64 listSize = (*iFillListArray)[index]->ListSize();
+
+        if ( status == ECmSelected )
+            {
+            selectionArray->AppendL( index );
+
+            TInt id = rule->ListId();
+            TInt64 size = 0;
+            iMSAppUi.GetFilledFilesSize( size, id );
+            
+            // list selected - add used memory size
+            iSizeOfSelectedLists += ( listSize - size );
+            }
+        // calculate icon index
+        TInt iconIndex = ListItemIconIndex( index,
+                                            listSize,
+                                            freeSpace );
+
+
+        switch ( rule->MediaType() )
+            {
+            case ECmVideo:
+                {
+                item.Format( KSingleGraphicStyleFormatString,
+                             iconIndex, primary_text, EVideoType );
+                break;
+                }
+            case ECmImage:
+                {
+                item.Format( KSingleGraphicStyleFormatString,
+                             iconIndex, primary_text, EImageType );
+                break;
+                }
+            case ECmAudio:
+                {
+                item.Format( KSingleGraphicStyleFormatString,
+                             iconIndex, primary_text, EAudioType );
+                break;
+                }
+            default:
+                {
+                item.Format( KSingleGraphicStyleFormatStringNoTrailIcons,
+                             iconIndex, primary_text);
+                break;
+                }
+            }
+
+        // Check if reorder mode is active and mark current item
+        if ( iReorderState == EMSFillReorderActive &&
+             index == currentItemIndex )
+            {
+            TBuf<2> markIconStr; // Magic: 2 characters reserverd for icon
+            markIconStr.AppendNum( EMark );
+            item.Append(markIconStr);
+            }
+        itemArray->AppendL( item );
+        }
+
+    iListBox->SetSelectionIndexesL( selectionArray );
+
+    CleanupStack::PopAndDestroy( selectionArray );
+    CleanupStack::PopAndDestroy( primary_text );
+
+    UpdateNaviTextL();
+    if( currentItemIndex > KErrNotFound && currentItemIndex < ruleCount )
+        {
+        iListBox->SetCurrentItemIndex( currentItemIndex );
+        }
+    iListBox->HandleItemAdditionL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::SetFillRules()
+// Sends fill rules to server
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::SetFillRules()
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::SetFillRules"));
+
+    // Get marked items indexes
+    const CListBoxView::CSelectionIndexArray* selected =
+            iListBox->SelectionIndexes();
+
+    // Listbox item count
+    TInt itemCount = iFillListArray->Count();
+
+    // Selected item index
+    TInt itemIdx = 0;
+
+    // Sort criteria, offset = 0
+    TKeyArrayFix sortKey( 0, ECmpTUint );
+
+    // count selected items
+    TInt count = selected->Count();
+
+    for ( TInt index = 0; index < itemCount; index++ )
+        {
+        // check if listbox item is found from selected item list
+        TInt found = selected->Find( index, sortKey, itemIdx );
+
+        CCmFillRule* rule = (*iFillListArray)[index]->List();
+
+        // FOUND
+        if ( found == 0 )
+            {
+            // set rule selected
+            rule->SetSelected( ECmSelected );
+            }
+        // NOT FOUND
+        else
+            {
+            // set rule unselected
+            rule->SetSelected( ECmUnSelected );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::SelectedItemIndex()
+// Highlighted item index
+// --------------------------------------------------------------------------
+//
+TInt CMSFillContainer::SelectedItemIndex()
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::SelectedItemIndex"));
+
+    return iListBox->CurrentItemIndex();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::ListItemCount()
+// coun of list items
+// --------------------------------------------------------------------------
+//
+TInt CMSFillContainer::ListItemCount()
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::ListItemCount"));
+
+    return iListBox->Model()->NumberOfItems();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::SetReorderStateL()
+// Sets reorder state
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::SetReorderStateL( TMSReorderState aState )
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::SetReorderStateL"));
+
+    switch ( aState )
+        {
+        case EMSFillNormal:
+            {
+            iReorderState = EMSFillNormal;
+            break;
+            }
+        case EMSFillReorderActive:
+            {
+            iReorderState = EMSFillReorderActive;
+            UpdateListBoxDataL();
+            break;
+            }
+        case EMSFillGrabActive:
+            {
+            iReorderState = EMSFillGrabActive;
+            UpdateListBoxDataL();
+            break;
+            }
+        default:
+            {
+            iReorderState = EMSFillNormal;
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::MoveItem()
+// moves item up/down on the list
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::MoveItem( TInt aDirection )
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::MoveItem"));
+
+    TInt currentIdx = iListBox->CurrentItemIndex();
+    TInt totalItem = iListBox->Model()->NumberOfItems();
+
+    // store selection status of all rules
+    StoreSelectionStatus();
+
+    // up
+    if (aDirection == -1 && currentIdx)
+        {
+        iFillRuleController->ChangePriority( totalItem,
+                                             currentIdx,
+                                             aDirection );
+        }
+    // down
+    else if ( aDirection == 1 && currentIdx < totalItem - 1 )
+        {
+        iFillRuleController->ChangePriority( totalItem,
+                                             currentIdx,
+                                             aDirection );
+        }
+    else
+        {
+        // Do nothing
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::HandleReorderKeyEventL
+// Handle key events in reordering mode.
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+TKeyResponse CMSFillContainer::HandleReorderKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::HandleReorderKeyEventL"));
+
+    TKeyResponse keyResponse = EKeyWasConsumed;
+
+    TInt currentIdx = iListBox->CurrentItemIndex();
+    TInt totalItems = iListBox->Model()->NumberOfItems();
+
+    TBool reqToRedraw = EFalse;
+    if ( aType == EEventKey )
+        {
+        switch ( aKeyEvent.iCode )
+            {
+            case EKeyUpArrow:
+            // fall through
+            case EKeyLeftArrow:
+                {
+                if ( currentIdx > 0 )
+                    {
+                    MoveItem(-1);
+                    iListBox->SetCurrentItemIndex( currentIdx - 1 );
+                    reqToRedraw = ETrue;
+                    }
+                break;
+                }
+            case EKeyDownArrow:
+            // fall through
+            case EKeyRightArrow:
+                {
+                if ( currentIdx < totalItems-1 ) // because index is 0 based
+                    {
+                    MoveItem(1);
+                    iListBox->SetCurrentItemIndex( currentIdx + 1 );
+                    reqToRedraw = ETrue;
+                    }
+                break;
+                }
+            default:
+                {
+                LOG(_L("[MediaServant]\t CMSFillContainer::\
+                HandleReorderKeyEventL invalid keycode"));
+                break;
+                }
+            }
+        }
+
+    if( reqToRedraw )
+        {
+        // update selected item indexes
+        const CListBoxView::CSelectionIndexArray* selected =
+                                                iListBox->SelectionIndexes();
+        UpdateListBoxDataL();
+        iSelectedLists.Reset();
+        for ( TInt index = 0; index < selected->Count(); index++ )
+            {
+            TInt a = (*selected)[index];
+            iSelectedLists.Append( (*selected)[index] );
+            }
+        }
+
+    return keyResponse;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::StoreSelectionStatus()
+// stores fill rule selection status to rule container
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::StoreSelectionStatus()
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::StoreSelectionStatusL"));
+
+    // index of selected item
+    TInt itemIdx = 0;
+    // Sort criteria, offset = 0
+    TKeyArrayFix sortKey( 0, ECmpTUint );
+
+    // Listbox array
+    CDesCArray* itemArray = static_cast<CDesCArray*>
+                                    (iListBox->Model()->ItemTextArray());
+
+    // Listbox item count
+    TInt itemCount = itemArray->Count();
+
+    const CListBoxView::CSelectionIndexArray* selected =
+            iListBox->SelectionIndexes();
+
+    // count selected items
+    TInt count = selected->Count();
+
+    for ( TInt index = 0; index < itemCount; index++ )
+        {
+        // check if listbox item is found from selected item list
+        TInt found = selected->Find( index, sortKey, itemIdx );
+
+        if ( found == 0 )
+            {
+            // found - get correcponding index for rule table with At()
+            CCmFillRule* rule =
+                (*iFillListArray)[selected->At( itemIdx )]->List();
+            // set rule selected
+            rule->SetSelected( ECmSelected );
+            }
+        else
+            {
+            // not found
+            CCmFillRule* rule = (*iFillListArray)[index]->List();
+            // set rule unselected
+            rule->SetSelected( ECmUnSelected );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::DeleteRuleL()
+// Deletes highlighted rule
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::DeleteRuleL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::DeleteRuleL"));
+
+    // Show delete files query
+    CAknQueryDialog* query= CAknQueryDialog::NewL(
+                                   CAknQueryDialog::ENoTone );
+
+    if ( query->ExecuteLD( R_MSERV_DELETE_LIST_QUERY ) )
+        {
+        TInt currentItemIndex = iListBox->CurrentItemIndex();
+        // delete rule
+        iFillRuleController->DeleteRuleL( currentItemIndex );
+
+        // Listbox items
+        CDesCArray* itemArray = static_cast<CDesCArray*>
+                                       (iListBox->Model()->ItemTextArray());
+
+        // delete list item
+        itemArray->Delete( currentItemIndex );
+        iListBox->HandleItemRemovalL();
+        iListDeleted = ETrue;
+
+        if ( currentItemIndex > 0 )
+            {
+            // highligth previous
+            iListBox->SetCurrentItemIndexAndDraw( currentItemIndex - 1 );
+            }
+        iMSAppUi.MSEngine()->DeleteFilledFilesL();
+        iView.ShowNaviTextL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::IsListDeleted()
+// Returns list delete status
+// --------------------------------------------------------------------------
+//
+TBool CMSFillContainer::IsListDeleted()
+    {
+    return iListDeleted;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::HandlePointerEventL()
+// Handles touchscreen event
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::HandlePointerEventL ( const TPointerEvent& aPointerEvent )
+    {
+	CCoeControl::HandlePointerEventL( aPointerEvent );
+    
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+    	{
+    	// Do not change listbox item state, when highlighting an item or,
+	    // when reordering state is active
+    	if ( iListBox->CurrentItemIndex() == iPreviousItemIndex &&
+             iReorderState == EMSFillNormal )
+	    	{	
+			TKeyEvent keyEvent;
+			keyEvent.iCode = EKeyOK;
+			OfferKeyEventL( keyEvent, EEventKey );
+    		}
+    	else
+    		{
+    		UpdateListBoxDataL();
+    		}
+	   	iPreviousItemIndex = iListBox->CurrentItemIndex();
+		}
+		
+	// Handle Drag and drop events, when reorder state is active
+    if ( iReorderState != EMSFillNormal )
+    	{
+    	HandleDragAndDropEventsL( aPointerEvent );
+    	}
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::CheckIfDublicateName()
+// Checks how many dublicate items is on the fill list
+// --------------------------------------------------------------------------
+//
+TInt CMSFillContainer::CheckIfDublicateNames( const TDesC& aName )
+    {
+    CDesCArray* itemArray = static_cast<CDesCArray*>
+                                   (iListBox->Model()->ItemTextArray());
+    TInt count(0);
+
+    for ( TInt index = 0; index < itemArray->MdcaCount(); index++ )
+        {
+        if ( KErrNotFound != itemArray->MdcaPoint( index ).Match( aName ) )
+            {
+            count++;
+            }
+        }
+    return count;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::UpdateNaviTextL()
+// updates list size on navi pane
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::UpdateNaviTextL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::UpdateNaviTextL"));
+
+    TInt currentItemIndex = iListBox->CurrentItemIndex();
+
+    if ( currentItemIndex != KErrNotFound )
+        {
+        CArrayFix<TInt>* infoArray = new ( ELeave ) CArrayFixFlat<TInt>(2);
+        CleanupStack::PushL( infoArray );
+
+        CMSFillList* fillList = (*iFillListArray)[currentItemIndex];
+        CCmFillRule* rule = fillList->List();
+
+        HBufC* naviText = NULL;
+
+        TInt64 freeMemory = iFreeMemory - iSizeOfSelectedLists;
+
+        // round values
+        TReal size(0);
+        Math::Round( size, TReal(fillList->ListSize()) / KMega, 0 );
+
+        TReal freeSize(0);
+        Math::Round( freeSize, TReal(freeMemory) / KMega, 0 );
+
+        infoArray->AppendL( size );
+        infoArray->AppendL( freeSize );
+
+        naviText = StringLoader::LoadLC( R_MS_NAVI_LIST_SIZE,
+                                         *infoArray );
+        // do number conversion
+        TPtr ptr = naviText->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+        iView.SetNavigationPaneTextL( *naviText );
+        CleanupStack::PopAndDestroy( naviText );
+        CleanupStack::PopAndDestroy( infoArray );
+        }
+    else
+        {
+        iView.ClearCurrentNaviPaneText();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::ChangeListActivityL()
+// Toggles list item
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::ChangeListActivityL()
+    {
+    CCmFillRule* rule =
+        (*iFillListArray)[iListBox->CurrentItemIndex()]->List();
+    if ( rule->Selected() == ECmSelected )
+        {
+        rule->SetSelected( ECmUnSelected );
+        }
+    else
+        {
+        rule->SetSelected( ECmSelected );
+        }
+    UpdateListBoxDataL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::IsCurrentListItemActive()
+// Checks if item is selected
+// --------------------------------------------------------------------------
+//
+TBool CMSFillContainer::IsCurrentListItemActive()
+    {
+    return iListBox->View()->ItemIsSelected( iListBox->CurrentItemIndex() );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::HasListSelectionsChanged
+// Checks if item is selected
+// --------------------------------------------------------------------------
+//
+TBool CMSFillContainer::HasListSelectionsChanged()
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::HasListSelectionsChanged"));
+
+    TBool status = EFalse;
+
+    TInt originalCount = iSelectedLists.Count();
+
+    const CListBoxView::CSelectionIndexArray* selected =
+                                                iListBox->SelectionIndexes();
+
+    TKeyArrayFix sortKey( 0, ECmpTUint );
+    // dummy index - not interested of this
+    TInt dummy = 0;
+
+    for ( TInt index = 0; index < originalCount; index++ )
+        {
+        // check if listbox item is found from selected item list
+        TInt found = selected->Find(
+                             iSelectedLists[index], sortKey, dummy );
+        if ( found != 0 )
+            {
+            // something has changed on the list
+            status = ETrue;
+            index = originalCount; // break loop
+            }
+        }
+
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::ListItemIconIndex
+// Returns icon index based on list size and free space
+// --------------------------------------------------------------------------
+//
+TInt CMSFillContainer::ListItemIconIndex( TInt aIndex,
+                                          TInt64 aListSize,
+                                          TInt64& aFreeSpace )
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::ListItemIconIndex"));
+
+    TInt iconIndex( 0 );
+    // check if item is selected
+    CCmFillRule* rule = (*iFillListArray)[aIndex]->List();
+    if(  ECmSelected == rule->Selected() )
+        {
+        // doesn't fit
+        if ( aFreeSpace <= 0 )
+            {
+            iconIndex = EMSSelectedDoesntFit;
+            aFreeSpace = 0;
+            }
+        // fits
+        else if ( aFreeSpace - aListSize > 0 )
+            {
+            iconIndex = EMSSelectedFits;
+            aFreeSpace -= aListSize;
+            }
+        // fits partially
+        else
+            {
+            iconIndex = EMSSelectedPartiallyFits;
+            aFreeSpace = 0;
+            }
+        }
+    else
+        {
+        // doesn't fit
+        if ( aFreeSpace <= 0)
+            {
+            iconIndex = EMSUnSelectedDoesntFit;
+            aFreeSpace = 0;
+            }
+        // fits
+        else if ( aFreeSpace - aListSize > 0 )
+            {
+            iconIndex = EMSUnselectedFits;
+            aFreeSpace -= aListSize;
+            }
+        // fits partially
+        else
+            {
+            iconIndex = EMSUnselectedPartiallyFits;
+            aFreeSpace = 0;
+            }
+        }
+    return iconIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::CalculateFillQuotaL()
+// Gets selected drives and calculates quota size
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::CalculateFillQuotaL()
+    {
+    RPointerArray<CCmDriveInfo> drives;
+
+    iMSAppUi.MSEngine()->GetDrivesL( drives );
+    for ( TInt i = 0; i < drives.Count(); i++ )
+        {
+        iQuota += drives[i]->DriveQuota();
+        iQuota -= drives[i]->UsedDriveQuota();
+        }
+    drives.ResetAndDestroy();
+    drives.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::SizeChanged()
+// Called by framework when the view size is changed.
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::SizeChanged()
+    {
+    // container control resize code.
+    if ( iListBox )
+        {
+        iListBox->SetRect( Rect() ); // Set rectangle of listbox.
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::HandleResourceChange
+// Handles layout change
+// --------------------------------------------------------------------------
+//
+void CMSFillContainer::HandleResourceChange( TInt aType )
+    {
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect( iView.ClientRect() );
+        }
+
+    CCoeControl::HandleResourceChange( aType );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSFillContainer::GetHelpContext
+// ---------------------------------------------------------------------------
+//
+void CMSFillContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::GetHelpContext"));
+
+    aContext.iMajor = TUid::Uid(KMediaServantUID3);
+    aContext.iContext = KMSERV_HLP_FILL_LIST;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msfillrulecontroller.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,664 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSFillRuleController class implementation
+*
+*/
+
+
+#include <StringLoader.h>
+#include <mediaservant.rsg>
+#include <utf.h>
+
+#include "cmfillrulecontainer.h"
+#include "cmfillrule.h"
+#include "msfillrulecontroller.h"
+#include "msconstants.h"
+#include "mediaservant.hrh"
+#include "msengine.h"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::NewL
+// --------------------------------------------------------------------------
+//
+CMSFillRuleController* CMSFillRuleController::NewL( CMSEngine& aMSEngine )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::NewL"));
+
+    CMSFillRuleController* self = CMSFillRuleController::NewLC( aMSEngine );    
+    CleanupStack::Pop(self);
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::NewLC
+// --------------------------------------------------------------------------
+//
+CMSFillRuleController* CMSFillRuleController::NewLC( CMSEngine& aMSEngine )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::NewLC"));
+
+    CMSFillRuleController* self = new (ELeave) CMSFillRuleController(
+                                                    aMSEngine );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+        
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSFillRuleController::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleController::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::ConstructL"));
+
+    if (iMSEngine)
+        {
+        InitializeRuleContainersL();
+        }
+    }
+// --------------------------------------------------------------------------
+// CMSFillRuleController::CMSFillRuleController()
+// --------------------------------------------------------------------------
+//
+CMSFillRuleController::CMSFillRuleController( CMSEngine& aMSEngine )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::CMSFillRuleController"));
+
+    iMSEngine = &aMSEngine;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::~CMSFillRuleController()
+// --------------------------------------------------------------------------
+//
+CMSFillRuleController::~CMSFillRuleController()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::~CMSFillRuleController"));
+
+    iFillListArray.ResetAndDestroy();
+    iFillListArray.Close();
+
+    delete iRuleContainer;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::FillListArray()
+// Returns pointer to fill list array
+// --------------------------------------------------------------------------
+//
+RPointerArray<CMSFillList>* CMSFillRuleController::FillListArray()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::FillListArray"));
+
+    return &iFillListArray;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSFillRuleController::InitializeRuleContainersL
+// initializes rule containers
+// ---------------------------------------------------------------------------
+//
+void CMSFillRuleController::InitializeRuleContainersL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::\
+    InitializeRuleContainersL"));
+
+    TInt error( KErrNone );
+    // Check if wizard has been executed
+    TBool runWizard = iMSEngine->GetAppWizardState( error );
+
+    if ( !runWizard  )
+        {
+        CreateFillRulesL();
+        delete iRuleContainer;
+        iRuleContainer = NULL;
+        iRuleContainer = iMSEngine->FillRulesL();
+        }
+    else
+        {
+        // FILL RULES
+        iRuleContainer = iMSEngine->FillRulesL();
+        }
+
+    // Creates pointer array to rules so we can change rule order at UI
+    // Operations done trough pointer array affects original rules
+    // in RuleContainer
+    if ( iRuleContainer )
+        {
+        // Arrange rules by priority to pointer table
+        TInt rulecount = iRuleContainer->FillRuleCount();
+
+        for (TUint8 order = 0; order < rulecount; order++)
+            {
+            // search rule with desired priority
+            for (TInt index = 0; index < rulecount; index++)
+                {
+
+                CCmFillRule* rule = iRuleContainer->FillRule(index);
+                TUint8 priority = rule->Priority();
+
+                if ( order == priority )
+                    {
+                    CMSFillList* list =
+                        CMSFillList::NewL( *iMSEngine, *rule );
+                    // add list to array
+                    iFillListArray.Append( list );
+
+                    // stop for loop
+                    index = rulecount;
+                    }
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::CreateFillRulesL()
+// FOR TEST
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleController::CreateFillRulesL()
+    {
+    CCmFillRuleContainer* fillRuleContainer = CCmFillRuleContainer::NewLC();
+
+    // default list 1
+    CCmFillRule* defaultList1 = CCmFillRule::NewLC();
+
+    HBufC* temp = StringLoader::LoadLC( R_MS_DEFAULT_FILL_LIST_1 );
+    HBufC8* listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList1->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+
+    defaultList1->SetMediaType( ECmImage );
+    defaultList1->SetMethod( ECmLatest );
+    defaultList1->SetSelected( ECmUnSelected );
+    defaultList1->SetPriority( 0 );
+    defaultList1->SetTemplateId( EMSDefaultImageList );
+    defaultList1->SetStatus( ECmToBeFilled );
+    defaultList1->SetLimitType( EMbits );
+    defaultList1->SetAmount( KDefaultListSize50 );
+
+    fillRuleContainer->AddFillRuleL( defaultList1 );
+
+    // default list 2
+    CCmFillRule* defaultList2 = CCmFillRule::NewLC();
+
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_FILL_LIST_2 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList2->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+
+    defaultList2->SetMediaType( ECmVideo );
+    defaultList2->SetMethod( ECmLatest );
+    defaultList2->SetSelected( ECmUnSelected );
+    defaultList2->SetPriority( 1 );
+    defaultList2->SetTemplateId( EMSDefaultVideoList );
+    defaultList2->SetStatus( ECmToBeFilled );
+    defaultList2->SetLimitType( EMbits );
+    defaultList2->SetAmount( KDefaultListSize50 );
+
+    fillRuleContainer->AddFillRuleL( defaultList2 );
+
+    // default list 3
+    CCmFillRule* defaultList3 = CCmFillRule::NewLC();
+
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_FILL_LIST_3 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList3->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+
+    defaultList3->SetMediaType( ECmAudio );
+    defaultList3->SetMethod( ECmLatest );
+    defaultList3->SetSelected( ECmUnSelected );
+    defaultList3->SetPriority( 2 );
+    defaultList3->SetTemplateId( EMSDefaultMusicList );
+    defaultList3->SetStatus( ECmToBeFilled );
+    defaultList3->SetLimitType( EMbits );
+    defaultList3->SetAmount( KDefaultListSize200 );
+
+    fillRuleContainer->AddFillRuleL( defaultList3 );
+
+    iMSEngine->SetFillRulesL( fillRuleContainer );
+
+    CleanupStack::Pop( defaultList3 );
+    CleanupStack::Pop( defaultList2 );
+    CleanupStack::Pop( defaultList1 );
+    CleanupStack::PopAndDestroy( fillRuleContainer );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::DeleteRuleL()
+// Deletes current rule
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleController::DeleteRuleL( TInt aCurrentIndex )
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::DeleteRuleL"));
+
+    // get priority of selected rule
+    TInt currentPriority =
+            iFillListArray[ aCurrentIndex ]->List()->Priority();
+
+    // Rulecontainer must be scanned to find the index index of
+    // rule container.
+    // Priority can be used to compare because there can't be two rules
+    // with same priority.
+    for (TInt index = 0; index < iRuleContainer->FillRuleCount(); index++)
+        {
+        if (currentPriority == iRuleContainer->FillRule( index )->Priority())
+            {
+            iFillListArray[ aCurrentIndex ]->
+                    List()->SetSelected( ECmDeleted );
+            }
+        }
+
+    // recalculate priorities
+    SetPriorities();
+
+    // store rules to server
+    iMSEngine->SetFillRulesL( iRuleContainer );
+
+    // update pointer array
+    UpdateArrayL();
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::AddRuleL()
+// Adds new rule
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleController::AddRuleL( CCmFillRule* aRule )
+    {
+    LOG(_L("[MediaServant]\t CMSFillContainer::DeleteRuleL"));
+
+    if ( aRule )
+        {
+        TInt priority = iFillListArray.Count();
+        aRule->SetPriority( priority );
+        iRuleContainer->AddFillRuleL( aRule );
+
+        // store rules to server
+        iMSEngine->SetFillRulesL( iRuleContainer );
+
+        // update pointer array
+        UpdateArrayL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::SetPriorities()
+// Sets priorities of rule array
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleController::SetPriorities()
+    {
+    TInt priority = 0;
+
+    for ( TInt index = 0; index < iFillListArray.Count(); index++ )
+        {
+        if ( iFillListArray[index]->List()->Selected() != ECmDeleted )
+            {
+            iFillListArray[index]->List()->SetPriority( priority );
+            priority++; // next list priority
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::compare()
+// For sort. Sort is based on rule priority
+// --------------------------------------------------------------------------
+//
+TInt CMSFillRuleController::compare ( const CMSFillList& rule1,
+                                      const CMSFillList& rule2)
+
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::compare"));
+
+    TInt result = 0;
+
+    if ( rule1.Priority() < rule2.Priority() )
+        {
+        result = -1;
+        }
+    else if ( rule1.Priority() > rule2.Priority() )
+        {
+        result = 1;
+        }
+
+    return result;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::ChangePriority()
+// Change priorities of rules
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleController::ChangePriority( TUint aTotalItem,
+                                            TUint aCurrentItem,
+                                            TInt aDirection )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::ChangePriority"));
+
+    TLinearOrder<CMSFillList> key(CMSFillRuleController::compare);
+
+    // up
+    if (aDirection == -1 && aCurrentItem)
+        {
+        // swap priotities of rules
+        iFillListArray[aCurrentItem]->List()->SetPriority(aCurrentItem-1);
+        iFillListArray[aCurrentItem-1]->List()->SetPriority(aCurrentItem);
+
+        iFillListArray.Sort(key);
+        }
+    // down
+    else if ( aDirection == 1 && aCurrentItem < aTotalItem - 1 )
+        {
+        // swap priotities of rules
+        iFillListArray[aCurrentItem]->List()->SetPriority(aCurrentItem+1);
+        iFillListArray[aCurrentItem+1]->List()->SetPriority(aCurrentItem);
+
+        iFillListArray.Sort(key);
+        }
+    else
+        {
+        // Do nothing
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::UpdateArrayL()
+// Resets old fill rule array and reads new rules from server
+// --------------------------------------------------------------------------
+//
+void  CMSFillRuleController::UpdateArrayL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::UpdateArrayL"));
+
+    // FILL RULES
+    delete iRuleContainer;
+    iRuleContainer = NULL;
+    iRuleContainer = iMSEngine->FillRulesL();
+
+    // Creates pointer array to rules so we can change rule order at UI
+    // Operations done trough pointer array affects original rules
+    // in RuleContainer
+    if ( iRuleContainer )
+        {
+        iFillListArray.ResetAndDestroy();
+        // Arrange rules by priority to pointer table
+        TInt rulecount = iRuleContainer->FillRuleCount();
+
+        for (TUint8 order = 0; order < rulecount; order++)
+            {
+            // search rule with desired priority
+            for (TInt index = 0; index < rulecount; index++)
+                {
+
+                CCmFillRule* rule = iRuleContainer->FillRule(index);
+                TUint8 priority = rule->Priority();
+
+                if ( order == priority )
+                    {
+                    // stop for loop
+                    index = rulecount;
+                    CMSFillList* list =
+                            CMSFillList::NewLC( *iMSEngine, *rule );
+                    // add rule to array
+                    iFillListArray.Append( list );
+                    CleanupStack::Pop( list );
+                    }
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::SaveRulesL()
+// Sends fill rules to server
+// --------------------------------------------------------------------------
+//
+void  CMSFillRuleController::SaveRulesL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::SaveRulesL"));
+
+    iMSEngine->SetFillRulesL( iRuleContainer );
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::HasPriorityChangedL()
+// Checks if list priorities has been changed
+// --------------------------------------------------------------------------
+//
+TBool CMSFillRuleController::HasPriorityChangedL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::\
+    HasPriorityChangedL"));
+
+    TBool status( EFalse );
+
+    CCmFillRuleContainer* fillLists = iMSEngine->FillRulesL();
+    CleanupStack::PushL( fillLists );
+    TInt listCount = fillLists->FillRuleCount();
+    TInt arrayCount = iFillListArray.Count();
+
+    if ( listCount == arrayCount )
+        {
+        for ( TInt index = 0; index < listCount; index++ )
+            {
+            CCmFillRule* origList = fillLists->FillRule(index);
+            TInt origPriority = origList->Priority();
+
+            // lists are in priority order in iFillListArray
+            CCmFillRule* modList = iFillListArray[ origPriority ]->List();
+
+            // if list names are same we have the same lists
+            if ( origList->Name().Compare( modList->Name() ) )
+                {
+                status = ETrue;
+                index = listCount; // break loop
+                }
+            }
+        }
+    else
+        {
+        status = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy( fillLists );
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::HasSelectionsChanged()
+// Checks if list activity has been changed
+// --------------------------------------------------------------------------
+//
+TBool CMSFillRuleController::HasSelectionsChanged( TCmFillRuleStatus aStatus )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::\
+    HasSelectionsChanged"));
+
+    TBool status( EFalse );
+
+    TInt listCount = iFillListArray.Count();
+
+    for ( TInt index = 0; index < listCount; index++ )
+        {
+        if ( iFillListArray[ index ]->OriginalSelectionStatus() !=
+             iFillListArray[ index ]->List()->Selected() &&
+             iFillListArray[ index ]->OriginalSelectionStatus() != aStatus )
+            {
+            // activity changed
+            status = ETrue;
+            index = listCount;
+            }
+
+        }
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleController::RestoreOriginalSelections()
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleController::RestoreOriginalSelections()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::\
+    RestoreOriginalSelections"));
+    TInt listCount = iFillListArray.Count();
+
+    for ( TInt index = 0; index < listCount; index++ )
+        {
+        iFillListArray[index]->List()->SetSelected(
+                iFillListArray[index]->OriginalSelectionStatus() );
+        }
+    }
+
+
+
+
+
+/***************** CMSFillList class implementation **********************/
+
+
+// --------------------------------------------------------------------------
+// CMSFillList::NewL
+// --------------------------------------------------------------------------
+//
+CMSFillList* CMSFillList::NewL( CMSEngine& aMSEngine, CCmFillRule& aFillList )
+    {
+    LOG(_L("[MediaServant]\t CMSFillList::NewL"));
+
+    CMSFillList* self = CMSFillList::NewLC( aMSEngine, aFillList );
+    CleanupStack::Pop(self);
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillList::NewLC
+// --------------------------------------------------------------------------
+//
+CMSFillList* CMSFillList::NewLC( CMSEngine& aMSEngine,
+                                 CCmFillRule& aFillList )
+    {
+    LOG(_L("[MediaServant]\t CMSFillList::NewLC"));
+
+    CMSFillList* self = new (ELeave) CMSFillList( aMSEngine, aFillList );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSFillList::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSFillList::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillList::ConstructL"));
+
+    iListSize = iFillList->ListRealSizeInBytes();
+    iItemCount = iFillList->ListRealCount();
+    }
+// --------------------------------------------------------------------------
+// CMSFillList::CMSFillList()
+// --------------------------------------------------------------------------
+//
+CMSFillList::CMSFillList( CMSEngine& aMSEngine, CCmFillRule& aFillList )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleController::CMSFillRuleController"));
+    iFillList = &aFillList;
+    iMSEngine = &aMSEngine;
+
+    iSelected = iFillList->Selected();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillList::~CMSFillList()
+// --------------------------------------------------------------------------
+//
+CMSFillList::~CMSFillList()
+    {
+    LOG(_L("[MediaServant]\t CMSFillList::~CMSFillList"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillList::List()
+// --------------------------------------------------------------------------
+//
+CCmFillRule* CMSFillList::List()
+    {
+    LOG(_L("[MediaServant]\t CMSFillList::List"));
+
+    return iFillList;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillList::List()
+// --------------------------------------------------------------------------
+//
+TUint32 CMSFillList::ListSize()
+    {
+    LOG(_L("[MediaServant]\t CMSFillList::ListSize"));
+
+    return iListSize;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillList::List()
+// --------------------------------------------------------------------------
+//
+TUint32 CMSFillList::ItemCount()
+    {
+    LOG(_L("[MediaServant]\t CMSFillList::ItemCount"));
+
+    return iItemCount;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::Priority
+// Return list priority
+// --------------------------------------------------------------------------
+//
+TInt CMSFillList::Priority() const
+    {
+    return iFillList->Priority();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillContainer::Priority
+// Return list priority
+// --------------------------------------------------------------------------
+//
+TCmFillRuleStatus CMSFillList::OriginalSelectionStatus()
+    {
+    return iSelected;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msfillruleeditlist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,2460 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSFillRuleEditList class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <barsread.h>
+#include <akntextsettingpage.h>
+#include <StringLoader.h>
+#include <akncheckboxsettingpage.h>
+#include <e32math.h>
+#include <utf.h>
+
+#include "cmsqlpropertycontainer.h"
+#include "mserv.hlp.hrh"
+#include "cmfillrule.h"
+#include "cmfillrulecontainer.h"
+#include "cmmediaserverfull.h"
+#include "msappui.h"
+#include "mediaservantuid.h"
+#include "msengine.h"
+#include "msconstants.h"
+#include "msfillruleeditlist.h"
+#include "msfillruleeditview.h"
+#include "msruleamountsetting.h"        // Amount
+#include "msruleserverssetting.h"       // Servers
+#include "msrulemultiselectionsetting.h"// Artist, genre, album, track
+#include "msrulefilesizesetting.h"      // File size (min/max)
+#include "mediaservant.hrh"
+#include "msmetadatacollector.h"
+#include "msdebug.h"
+#include "msfillcontainer.h"
+#include "msfillview.h"
+
+// CONSTANTS
+_LIT( KSpace, " ");
+const TInt KDateBufferLength = 20;
+
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::NewL()
+// Two phase constructor.
+// --------------------------------------------------------------------------
+//
+CMSFillRuleEditList* CMSFillRuleEditList::NewL(
+                CMSAppUi& aAppUi, CMSFillRuleEditView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::NewL"));
+
+    CMSFillRuleEditList* self = CMSFillRuleEditList::NewLC( aAppUi, aView );        
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::NewLC()
+// Two phase constructor.
+// --------------------------------------------------------------------------
+//
+CMSFillRuleEditList* CMSFillRuleEditList::NewLC(
+                CMSAppUi& aAppUi, CMSFillRuleEditView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::NewLC"));
+
+    CMSFillRuleEditList* self = new ( ELeave ) CMSFillRuleEditList();
+    CleanupStack::PushL( self );
+    self->ConstructL( aAppUi, aView );
+        
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::CMSFillRuleEditList()
+// --------------------------------------------------------------------------
+//
+CMSFillRuleEditList::CMSFillRuleEditList()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::CMSFillRuleEditList"));
+
+    iDummyText.Copy(_L(""));
+    iMinFileSize = 0;
+    iMaxFileSize = 0;
+    iMinFileSizeSet = EMSAny;
+    iMaxFileSizeSet = EMSAny;
+    iFileSize = 0;
+    iFileSizeEnum = 0;
+    iTrackLengthEnum = 0;
+    iNewList = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::~CMSFillRuleEditList()
+// --------------------------------------------------------------------------
+//
+CMSFillRuleEditList::~CMSFillRuleEditList()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::~CMSFillRuleEditList"));
+
+    delete iMetadataCollector;
+
+    if ( iServers )
+        {
+        iServers->ResetAndDestroy();
+        iServers->Close();
+        delete iServers;
+        }
+
+    if ( iServerArray )
+        {
+        iServerArray->ResetAndDestroy();
+        delete iServerArray;
+        }
+
+    iVisibleRules.Close();
+
+    iArtistArray.Close();
+    iAlbumArray.Close();
+    iGenreArray.Close();
+    iTrackArray.Close();
+    iVideoTitleArray.Close();
+    
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::ConstructL()
+// Second phase constructor.
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::ConstructL( CMSAppUi& aAppUi,
+                                      CMSFillRuleEditView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::ConstructL"));
+
+    iAppUi = &aAppUi;
+    iView = &aView;
+
+    // Set engine observer
+    iAppUi->MSEngine()->SetObserver( this );
+
+    // read template
+    iRuleTemplate = iAppUi->ParameterAgent()->GetRuleTemplate();
+
+    // Edit existing list
+    if ( iRuleTemplate.templateType == EMSCmdEditRule )
+        {
+        // get selected item index from previous screen
+        iSelectedList = iAppUi->ParameterAgent()->FillViewFocusIndex();
+
+        // get selected list
+        iRule =(*iAppUi->
+               FillRuleController()->FillListArray())[iSelectedList]->List();
+        // List media type
+        iMediaType = iRule->MediaType();
+
+        // set used template
+        iRuleTemplate.selectedTemplate = iRule->TemplateId();
+
+        ReadTemplateRulesL( iRuleTemplate.selectedTemplate );
+        // Get values for rules
+        GetRuleValuesL();
+        }
+
+    else
+        {
+        iNewList = ETrue;
+
+        // New fill list will be last one - set focus index to it
+        iSelectedList =
+            iAppUi->FillRuleController()->FillListArray()->Count();
+        iAppUi->ParameterAgent()->SetFillViewFocusIndex( iSelectedList );
+
+        // Create new list
+        iRule = CCmFillRule::NewL();
+
+        // Read template rules and set default values
+        ReadTemplateRulesL( iRuleTemplate.selectedTemplate );
+
+        // Use template name as list name
+        iListName.Copy( iRuleTemplate.templateName );
+        HBufC8* temp = CnvUtfConverter::ConvertFromUnicodeToUtf8L(
+                                                            iListName );
+        CleanupStack::PushL( temp );
+        iRule->SetNameL( *temp );
+        CleanupStack::PopAndDestroy( temp );
+        // List type is determined by given menu command
+        // MediaType is also set here
+        SetListType( iRuleTemplate.templateType );
+        iRule->SetTemplateId( iRuleTemplate.selectedTemplate );
+
+        //Set rule selected by default
+        iRule->SetSelected( ECmSelected );
+
+        // Initialize fill rule status to ECmToBeFilled
+        // If rule is image rule, status is re-set
+        // according to used template
+        iRule->SetStatus( ECmToBeFilled );
+
+        InitializeValues();
+
+        // save new list
+        iAppUi->FillRuleController()->AddRuleL( iRule );
+
+        // Get list
+        iRule = (*iAppUi->FillRuleController()->
+                                    FillListArray())[iSelectedList]->List();
+        }
+     
+     // should filter the vedio array when construct first time, only selected item can be construct
+     if( iRule->MediaType() == ECmVideo )
+        {
+        // reset track array
+        iTrackArray.Reset();
+        // append the select video title in track array
+        TInt count = iVideoTitleArray.Count();
+        if( count > 0 )
+            {
+            for( TInt i=0; i<count; i++ )
+                {
+                iTrackArray.Append( iVideoTitleArray[i] );	
+                }
+            }
+        	
+        }
+    // Creates metadata collector and starts data fetching
+    iMetadataCollector = CMSMetadataCollector::NewL( *iAppUi,
+                                                     iMediaType,
+                                                     iGenreArray,
+                                                     iArtistArray,
+                                                     iAlbumArray,
+                                                     iTrackArray);
+
+    // get mediaservers and remove not activated
+    GetServersAndCheckActivityL();
+
+    CreateServerSettingListL();
+    // Construct setting list
+    ConstructListAndStartDataReadingL();
+    
+    iPreviousRuleIdentifier = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::StartDataReadingL
+// starts reading data to multiselection lists from server
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::ConstructListAndStartDataReadingL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    ConstructListAndStartDataReadingL"));
+
+    switch ( iMediaType )
+        {
+        case ECmVideo:
+            {
+             // construct item list
+            CAknSettingItemList::ConstructFromResourceL(
+                                            R_MS_VIDEO_FILL_RULES );
+            break;
+            }
+        case ECmImage:
+            {
+             // construct item list
+            CAknSettingItemList::ConstructFromResourceL(
+                                            R_MS_IMAGE_FILL_RULES );
+            if ( iNewList )
+                {
+                SaveListValuesL();
+                iAppUi->FillRuleController()->SaveRulesL();
+                PreprocessListL();
+                }
+            else
+                {
+                CreateAndSetNaviPaneTextL();
+                }
+            break;
+            }
+        case ECmAudio:
+            {
+             // construct item list
+            CAknSettingItemList::ConstructFromResourceL(
+                                            R_MS_AUDIO_FILL_RULES );
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    if ( iMediaType == ECmVideo || iMediaType == ECmAudio )
+        {
+        // Show 'reading data' text on navi pane
+        HBufC* naviText = StringLoader::LoadLC(
+                                            R_MS_WAIT_GETTING_DATA_TEXT );
+        iView->SetNavigationPaneTextL( *naviText );
+        CleanupStack::PopAndDestroy( naviText );
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SaveListValuesL
+// Saves list values from visible setting items
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SaveListValuesL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveListValuesL"));
+
+    CAknSettingItemArray* itemArray = SettingItemArray();
+    for ( TInt index  = 0; index < itemArray->Count(); index++ )
+        {
+        CAknSettingItem* item = itemArray->At( index );
+        if ( !item->IsHidden() )
+            {
+            SaveValueL( item );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::PreprocessListL
+// starts list preprocess and shows info on navi pane
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::PreprocessListL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::PreprocessListL"));
+
+    iAppUi->MSEngine()->PreProcessFillListL( iRule->Name() );
+    HBufC* naviText = StringLoader::LoadLC( R_MS_PREPROCESSING_TEXT );
+    iView->SetNavigationPaneTextL( *naviText );
+    CleanupStack::PopAndDestroy( naviText );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SaveValueL
+// Save values to rule container
+// Only values from visible rules are stored
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SaveValueL( CAknSettingItem* aItem )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveValueL"));
+
+    if ( !aItem->IsHidden() )
+        {
+        switch ( aItem->Identifier() )
+            {
+            case EMSListName:
+                {
+                // Name is always visible - set rule name
+                HBufC8* listName =
+                    CnvUtfConverter::ConvertFromUnicodeToUtf8L(
+                       SettingItemArray()->At(EMSListName)->SettingTextL() );
+                CleanupStack::PushL( listName );
+                iRule->SetNameL( *listName );
+                CleanupStack::PopAndDestroy( listName );
+                break;
+                }
+            case EMSShrinkImages:
+                {
+                // Set shrinking status for images
+                SetShrinkingStatus();
+                break;
+                }
+            case EMSAmount:
+                {
+                // set amount of files
+                iRule->SetAmount( iAmount );
+                // set limit type
+                iRule->SetLimitType( iLimitType );
+                break;
+                }
+            case EMSStartingWith:
+                {
+                iRule->SetMethod(
+                            static_cast<TCmFillMethod> (iStartWith) );
+                break;
+                }
+            case EMSDateFrom:
+                {
+                DeleteRule( ECmDate, ECmGreater );
+
+                TInt ruleIndex = iRule->AddRuleL( ECmDate,
+                                                  ECmGreater );
+                HBufC8* str = HBufC8::NewL( KDateBufferLength );
+                CleanupStack::PushL( str );
+                str->Des().AppendNum(iDateFrom.Int64());
+                iRule->AddRuleParamL( ruleIndex, *str );
+                CleanupStack::PopAndDestroy( str );
+                break;
+                }
+            case EMSDateUntil:
+                {
+                DeleteRule( ECmDate, ECmSmaller );
+
+                TInt ruleIndex = iRule->AddRuleL( ECmDate,
+                                                  ECmSmaller );
+                HBufC8* str = HBufC8::NewL( KDateBufferLength );
+                CleanupStack::PushL( str );
+                str->Des().AppendNum(iDateUntil.Int64());
+                iRule->AddRuleParamL( ruleIndex, *str );
+                CleanupStack::PopAndDestroy( str );
+
+                break;
+                }
+            case EMSServers:
+                {
+                HandleServerSelectionL();
+                break;
+                }
+            case EMSFreeText:
+                {
+                DeleteRule( ECmFreeText );
+                if ( iFreeText.Size() )
+                    {
+                    TInt ruleIndex = iRule->AddRuleL( ECmFreeText,
+                                                      ECmConsistOf );
+                    HBufC8* str = CnvUtfConverter::ConvertFromUnicodeToUtf8L(
+                                                                 iFreeText );
+                    CleanupStack::PushL( str );
+                    iRule->AddRuleParamL( ruleIndex, *str );
+                    CleanupStack::PopAndDestroy( str );
+                    }
+                break;
+                }
+            case EMSTitleName:
+                {
+                DeleteRule( ECmTitle );
+
+                if ( iVideoTitleArray.Count() > 0 )
+                    {
+                    AddAdditionalRuleL( iVideoTitleArray,
+                                        ECmTitle,
+                                        ECmEquals );
+                    }
+                break;
+                }
+            case EMSMinFileSize:
+                {
+                DeleteRule( ECmFileSize, ECmGreater );
+                if ( iMinFileSizeSet == EMSSetSize )
+                    {
+                    AddAdditionalRuleL( ECmFileSize,
+                                        ECmGreater,
+                                        iMinFileSize*KMega );
+                    }
+                break;
+                }
+            case EMSMaxFileSize:
+                {
+                DeleteRule( ECmFileSize, ECmSmaller );
+                if ( iMaxFileSizeSet == EMSSetSize )
+                    {
+                    AddAdditionalRuleL( ECmFileSize,
+                                        ECmSmaller,
+                                        iMaxFileSize*KMega );
+                    }
+                break;
+                }
+             case EMSGenre:
+                {
+                DeleteRule( ECmGenre );
+
+                if ( iGenreArray.Count() > 0 )
+                    {
+                    AddAdditionalRuleL( iGenreArray,
+                                        ECmGenre,
+                                        ECmEquals );
+                    }
+                break;
+                }
+             case EMSArtist:
+                {
+                DeleteRule( ECmArtist );
+
+                if ( iArtistArray.Count() > 0 )
+                    {
+                    AddAdditionalRuleL( iArtistArray,
+                                        ECmArtist,
+                                        ECmEquals );
+                    }
+                break;
+                }
+             case EMSAlbum:
+                {
+                DeleteRule( ECmAlbum );
+
+                if ( iAlbumArray.Count() > 0 )
+                    {
+                    AddAdditionalRuleL( iAlbumArray,
+                                        ECmAlbum,
+                                        ECmEquals );
+                    }
+                break;
+                }
+            case EMSTrack:
+                {
+                DeleteRule( ECmTitle );
+
+                if ( iTrackArray.Count() > 0 )
+                    {
+                    AddAdditionalRuleL( iTrackArray,
+                                        ECmTitle,
+                                        ECmEquals );
+                    }
+                break;
+                }
+            case EMSTrackLength:
+                {
+                DeleteRule( ECmDuration );
+                if ( iTrackLengthEnum )
+                    {
+                    SaveTrackDurationL();
+                    }
+                break;
+                }
+            case EMSFileSize:
+                {
+                DeleteRule( ECmFileSize );
+                if ( iFileSizeEnum )
+                    {
+                    SaveTrackFileSizeL();
+                    }
+                break;
+                }
+            default:
+                {
+                LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveValueL \
+                no such rule"));
+                break;
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAknSettingItem* CMSFillRuleEditList::CreateSettingItemL(TInt aIdentifier)
+// Takes care of creating actual setting items.
+// --------------------------------------------------------------------------
+//
+CAknSettingItem* CMSFillRuleEditList::CreateSettingItemL( TInt aIdentifier )
+    {
+    CAknSettingItem* settingItem = NULL;
+
+    // setting item is created according to aIdentifier
+    switch ( aIdentifier )
+        {
+        case EMSListName:
+            {
+            settingItem = new (ELeave ) CMSTextSettingItem(
+                                        aIdentifier,
+                                        iListName );
+            break;
+            }
+        case EMSShrinkImages:
+            {
+            settingItem = new (ELeave ) CMSEnumeratedTextPopupSettingItem(
+                                  aIdentifier,
+                                  reinterpret_cast<TInt&> (iShrinkImages) );
+            break;
+            }
+
+        case EMSAmount:
+            {
+            settingItem = new (ELeave ) CMSRuleAmountSetting(
+                                        aIdentifier,
+                                        reinterpret_cast<TInt&> (iLimitType),
+                                        iAmount );
+            break;
+            }
+
+        case EMSStartingWith:
+            {
+            settingItem = new (ELeave ) CMSEnumeratedTextPopupSettingItem(
+                                        aIdentifier,
+                                        iStartWith );
+            break;
+            }
+
+        case EMSDateFrom:
+            {
+            settingItem = new (ELeave ) CMSTimeOrDateSettingItem(
+                                        R_MS_FILL_RULE_DATE_FROM_SETTING_PAGE,
+                                        aIdentifier,
+                                        CAknTimeOrDateSettingItem::EDate,
+                                        iDateFrom );
+            break;
+            }
+
+        case EMSDateUntil:
+            {
+            settingItem = new (ELeave ) CMSTimeOrDateSettingItem(
+                                        R_MS_FILL_RULE_DATE_UNTIL_SETTING_PAGE,
+                                        aIdentifier,
+                                        CAknTimeOrDateSettingItem::EDate,
+                                        iDateUntil );
+            break;
+            }
+
+        case EMSServers:
+            {
+            settingItem = CMSRuleServersSetting::NewL(
+                                                aIdentifier,
+                                                *iServerArray,
+                                                iSettingText,
+                                                R_MS_VALUE_LIST_ANY_SOURCE_DEVICE);
+            break;
+            }
+
+        case EMSFreeText:
+            {
+            settingItem = new (ELeave ) CMSTextSettingItem(
+                                        aIdentifier,
+                                        iFreeText );
+            break;
+            }
+        case EMSTitleName:
+            {
+            settingItem = CMSRuleMultiselectionSetting::NewL(
+                                                aIdentifier,
+                                                R_MS_RULE_NAME_SETTING,
+                                                R_MS_VALUE_ANY_NAME,
+                                                R_MS_VALUE_LIST_ANY_NAME,
+                                                iMetadataCollector->Tracks(),
+                                                &iVideoTitleArray,
+                                                R_MS_RULE_TITLE_ITEM_TEXT,
+                                                iSettingText );
+            break;
+            }
+
+        case EMSMinFileSize:
+            {
+            settingItem = new (ELeave ) CMSRuleFileSizeSetting(
+                                        aIdentifier,
+                                        EMSMinFileSize,
+                                        iMinFileSizeSet,
+                                        iMinFileSize );
+            break;
+            }
+
+        case EMSMaxFileSize:
+            {
+            settingItem = new (ELeave ) CMSRuleFileSizeSetting(
+                                        aIdentifier,
+                                        EMSMaxFileSize,
+                                        iMaxFileSizeSet,
+                                        iMaxFileSize );
+            break;
+            }
+
+        case EMSGenre:
+            {
+
+
+            settingItem = CMSRuleMultiselectionSetting::NewL(
+                                                aIdentifier,
+                                                R_MS_RULE_GENRE_SETTING,
+                                                R_MS_VALUE_ANY_GENRE,
+                                                R_MS_VALUE_LIST_ANY_GENRE,
+                                                iMetadataCollector->Genres(),
+                                                &iGenreArray,
+                                                R_MS_RULE_GENRE_ITEM_TEXT,
+                                                iSettingText );
+            break;
+            }
+
+        case EMSArtist:
+            {
+            settingItem = CMSRuleMultiselectionSetting::NewL(
+                                                aIdentifier,
+                                                R_MS_RULE_ARTIST_SETTING,
+                                                R_MS_VALUE_ANY_ARTIST,
+                                                R_MS_VALUE_LIST_ANY_ARTIST,
+                                                iMetadataCollector->Artists(),
+                                                &iArtistArray,
+                                                R_MS_RULE_ARTIST_ITEM_TEXT,
+                                                iSettingText );
+            break;
+            }
+
+        case EMSAlbum:
+            {
+            settingItem = CMSRuleMultiselectionSetting::NewL(
+                                                aIdentifier,
+                                                R_MS_RULE_ALBUM_SETTING,
+                                                R_MS_VALUE_ANY_ALBUM,
+                                                R_MS_VALUE_LIST_ANY_ALBUM,
+                                                iMetadataCollector->Albums(),
+                                                &iAlbumArray,
+                                                R_MS_RULE_ALBUM_ITEM_TEXT,
+                                                iSettingText );
+            break;
+            }
+
+        case EMSTrack:
+            {
+            settingItem = CMSRuleMultiselectionSetting::NewL(
+                                                aIdentifier,
+                                                R_MS_RULE_TRACK_SETTING,
+                                                R_MS_VALUE_ANY_TRACK,
+                                                R_MS_VALUE_LIST_ANY_TRACK,
+                                                iMetadataCollector->Tracks(),
+                                                &iTrackArray,
+                                                R_MS_RULE_TRACK_ITEM_TEXT,
+                                                iSettingText );
+            break;
+            }
+
+        case EMSTrackLength:
+            {
+            settingItem = new (ELeave ) CMSEnumeratedTextPopupSettingItem(
+                                        aIdentifier,
+                                        iTrackLengthEnum );
+            break;
+            }
+
+         case EMSFileSize:
+            {
+            settingItem = new (ELeave ) CMSEnumeratedTextPopupSettingItem(
+                                        aIdentifier,
+                                        iFileSizeEnum );
+            break;
+            }
+
+        case EMSAddMoreRules:
+            {
+            settingItem = new (ELeave ) CMSTextSettingItem(
+                                        aIdentifier,
+                                        iDummyText );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditList::CreateSettingItemL\
+            item not found"));            
+            break;
+            }
+        }
+    return settingItem;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::OpenSelectedListboxItemL
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::OpenSelectedListboxItemL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    OpenSelectedListboxItemL"));
+
+    HandleListBoxEventL( ListBox(), EEventEnterKeyPressed );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::HandleListBoxEventL()
+// Handles listbox events
+// --------------------------------------------------------------------------
+//
+void  CMSFillRuleEditList::HandleListBoxEventL ( CEikListBox *aListBox,
+                                                 TListBoxEvent aEventType)
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::HandleListBoxEventL"));
+
+    CAknSettingItemArray* itemArray = SettingItemArray();
+    TInt currentItem = ListBox()->CurrentItemIndex();
+    TInt realIndex = itemArray->ItemIndexFromVisibleIndex(currentItem);
+    CAknSettingItem* item= (*itemArray)[realIndex];
+	
+	// Event type for non-touch UI
+	if ( aEventType == EEventEnterKeyPressed )
+		{
+  		if ( item->Identifier() == EMSAddMoreRules )
+	        {
+	        AddFillRuleL();
+	        }
+	    else
+        	{
+        	CAknSettingItemList::HandleListBoxEventL ( aListBox, aEventType );
+        	}
+		}
+	// Event type for touch UI
+	else if ( aEventType == EEventItemClicked )
+		{
+	    // show add fill rule query if last item "Add more rules" selected
+	    if ( item->Identifier() == EMSAddMoreRules &&
+	         iPreviousRuleIdentifier == EMSAddMoreRules )
+     	   {
+	        AddFillRuleL();
+	        }
+    	else
+	        {
+	        CAknSettingItemList::HandleListBoxEventL ( aListBox, aEventType );
+    	    }
+		iPreviousRuleIdentifier = item->Identifier();
+	    // values need to be stored
+		StoreSettingsL();
+		}
+    else if ( item->Identifier() != EMSAddMoreRules )
+    	{
+		CAknSettingItemList::HandleListBoxEventL ( aListBox, aEventType );
+    	}
+    
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::EditItemL()
+// Called by framework when item is opened
+// --------------------------------------------------------------------------
+//
+void  CMSFillRuleEditList::EditItemL (TInt aIndex, TBool aCalledFromMenu)
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::EditItemL"));
+
+    // cancel ongoing operation
+    iView->CancelAsyncOperation( iAppUi );
+    iState = EMSIdle;
+
+    CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
+
+    // get the item information after update
+    CAknSettingItemArray* itemArray = SettingItemArray();
+    TInt currentItem = ListBox()->CurrentItemIndex();
+    TInt realIndex = itemArray->ItemIndexFromVisibleIndex(currentItem);
+    CAknSettingItem* item= (*itemArray)[realIndex];
+
+    // check if list name is modified
+    if ( item->Identifier() == EMSListName )
+        {
+        HandleListNameL( item );
+        }
+
+    if ( CheckSettingPageAcceptance( item ) )
+        {
+        // store new value
+        StoreSettingsL();
+        // Save value to rule
+        SaveValueL( item );
+        // save rule and process it
+        SaveAndPreprocesslistL( item );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::HandleListNameL
+// Handles edit list name -case
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::HandleListNameL( CAknSettingItem* aItem )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::HandleListNameL"));
+
+    CMSTextSettingItem* settingItem =
+                            static_cast<CMSTextSettingItem*>( aItem );
+
+    TPtr searchStr = settingItem->Text();
+
+    // Deletes leading and trailing whitespace characters
+    searchStr.Trim();
+
+    HBufC* originalSearchStr =
+                CnvUtfConverter::ConvertToUnicodeFromUtf8L( iRule->Name() );
+    CleanupStack::PushL( originalSearchStr );
+
+    // whether they are same or not
+    if ( *originalSearchStr != searchStr )
+        {
+        // if there are same names in other fill rules
+        TBool isSame = CheckSameNameL( searchStr );
+
+        if ( isSame )
+            {
+            TInt postfix = 0;
+            TPtr itemText = searchStr;
+
+            // decide which number is added to the end of the name
+            for ( ; ; ++postfix )
+                {
+                HBufC* sameStr = HBufC::NewL( KMaxFileName );
+                CleanupStack::PushL( sameStr );
+                sameStr->Des().Append( itemText );
+
+                // if the name does not add number to the end is unique so keep the original name
+                if ( 0 != postfix)
+                    {
+                    sameStr->Des().Append( KSpace );
+                    sameStr->Des().AppendNum( postfix );
+                    // do number conversion
+                    TPtr ptr = sameStr->Des();
+                    AknTextUtils::
+                     DisplayTextLanguageSpecificNumberConversion( ptr );
+                    }
+                // must modify name with append a number
+                if ( !CheckSameNameL( *sameStr ) || ( *sameStr == *originalSearchStr ) )
+                    {
+                    CleanupStack::PopAndDestroy( sameStr );
+                    break;
+                    }
+                CleanupStack::PopAndDestroy( sameStr );
+                }
+
+            // do not need append a number
+            if ( 0 != postfix)
+                {
+                itemText.Append( KSpace );
+                itemText.AppendNum( postfix );
+
+                // do number conversion
+                AknTextUtils::
+                    DisplayTextLanguageSpecificNumberConversion( itemText );
+                
+                iListName.Copy( itemText );
+                settingItem->LoadL();
+
+                aItem->UpdateListBoxTextL();
+                }
+            }
+        }
+    else
+        {
+        settingItem->LoadL();
+        }
+    CleanupStack::PopAndDestroy( originalSearchStr );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::CheckSameNameL
+// check the name is same or not
+// --------------------------------------------------------------------------
+//
+TBool CMSFillRuleEditList::CheckSameNameL( const TDesC& aName ) const
+    {
+    RPointerArray<CMSFillList>* iFillListArray = 
+                iAppUi->FillRuleController()->FillListArray();
+
+    // fill rule name array is not empty
+    if ( iFillListArray->Count() > 0 )
+        {
+        for ( TInt index = 0; index < iFillListArray->Count(); ++index )
+            {
+            // Get fill rule name and put it to the listbox
+            CCmFillRule* rule = (*iFillListArray)[index]->List();
+            HBufC* listName =
+                CnvUtfConverter::ConvertToUnicodeFromUtf8L( rule->Name() );
+            CleanupStack::PushL( listName );
+            // whether there is a same name fill rule
+            if ( aName == *listName )
+                {
+                CleanupStack::PopAndDestroy( listName );
+                return ETrue;
+                }
+            CleanupStack::PopAndDestroy( listName );
+            }
+        }
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SaveAndPreprocesslistL
+// Saves modified list and preprocesses it
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SaveAndPreprocesslistL( CAknSettingItem* aItem )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    SaveAndPreprocesslistL"));
+
+    // save rules
+    iAppUi->FillRuleController()->SaveRulesL();
+    // we'll lost iRule after update...
+    iAppUi->FillRuleController()->UpdateArrayL();
+    // ...so get it again
+    iRule = (*iAppUi->FillRuleController()->
+                    FillListArray())[iSelectedList]->List();
+
+    // if multiselectionitem is edited start data reading after preprocess
+   if ( aItem->Identifier() == EMSGenre ||
+        aItem->Identifier() == EMSArtist ||
+        aItem->Identifier() == EMSAlbum ||
+        aItem->Identifier() == EMSTrack||
+        aItem->Identifier() == EMSTitleName)
+        {
+        iState = EMSFetchMetadata;
+        }
+
+    // if other item than name is changed preprocessing is needed
+    if ( aItem->Identifier() != EMSListName )
+        {
+        PreprocessListL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::ActivateL
+// Asks setting page selection status from setting item
+// --------------------------------------------------------------------------
+//
+TBool CMSFillRuleEditList::CheckSettingPageAcceptance(
+                                            CAknSettingItem* aItem )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    CheckSettingPageAcceptance"));
+
+    TBool status( EFalse );
+
+    switch ( aItem->Identifier() )
+        {
+        case EMSShrinkImages:
+        // fall through
+        case EMSAmount:
+        // fall through
+        case EMSStartingWith:
+        // fall through
+        case EMSMinFileSize:
+        // fall through
+        case EMSMaxFileSize:
+        // fall through
+        case EMSTrackLength:
+        // fall through
+        case EMSFileSize:
+            {
+            CMSEnumeratedTextPopupSettingItem* item =
+                    static_cast<CMSEnumeratedTextPopupSettingItem*>(aItem);
+            status = item->SettingAccepted();
+            break;
+            }
+        case EMSListName:
+        // fall through
+        case EMSServers:
+        // fall through
+        case EMSFreeText:
+        // fall through
+        case EMSTitleName:
+        // fall through
+        case EMSGenre:
+        // fall through
+        case EMSArtist:
+        // fall through
+        case EMSAlbum:
+        // fall through
+        case EMSTrack:
+
+            {
+            CMSTextSettingItem* item =
+                    static_cast<CMSTextSettingItem*>(aItem);
+            status = item->SettingAccepted();
+            break;
+            }
+
+        case EMSDateFrom:
+        // fall through
+        case EMSDateUntil:
+            {
+            CMSTimeOrDateSettingItem* item =
+                    static_cast<CMSTimeOrDateSettingItem*>(aItem);
+            status = item->SettingAccepted();
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+            CheckSettingPageAcceptance no such item"));
+            break;
+            }
+        }
+
+    return status;
+    }
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::ActivateL
+// Activates setting list
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::ActivateL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::ActivateL"));
+
+    // hide all items by default
+    // index starts from '1' because list name is always visible
+    // index stops to count-1 because "add more rules" is always visible
+    for (TInt index = 1 ;index < SettingItemArray()->Count()-1; index++)
+        {
+        SettingItemArray()->At( index )->SetHidden(ETrue);
+        }
+
+    CAknSettingItemArray* itemArray = SettingItemArray();
+    // set template rules visible
+    for (TInt idx = 0; idx < iVisibleRules.Count(); idx++)
+        {
+        CAknSettingItem* item = SearchItemById( iVisibleRules[idx] );
+        if ( item )
+            {
+            item->SetHidden( EFalse);
+            }
+        }
+    // Show also additional rules if user has changed the default value
+    DisplayModifiedAdditionalRules();
+    // visibility of some items may have changed
+    HandleChangeInItemArrayOrVisibilityL();
+
+    CAknSettingItemList::ActivateL();
+    }
+
+// --------------------------------------------------------------------------
+// void CMSFillRuleEditList::ReadTemplateRulesL
+// reads fill rule name
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::ReadTemplateRulesL( TInt aTemplate )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::ReadTemplateRulesL"));
+
+    TResourceReader rsReader;
+
+    switch ( aTemplate )
+        {
+        case EMSDefaultImageList:
+            {
+            iCoeEnv->CreateResourceReaderLC(rsReader,
+                            R_MS_DEFAULT_IMAGE_LIST_RULES);
+            break;
+            }
+        case EMSDefaultVideoList:
+            {
+            iCoeEnv->CreateResourceReaderLC(rsReader,
+                            R_MS_DEFAULT_VIDEO_LIST_RULES);
+            break;
+            }
+        case EMSDefaultMusicList:
+            {
+            iCoeEnv->CreateResourceReaderLC(rsReader,
+                            R_MS_DEFAULT_MUSIC_LIST_RULES);
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditList::ReadTemplateRulesL\
+             rule not found"));
+            break;
+            }
+        }
+
+    // get rule count of the template
+    TInt ruleCount( rsReader.ReadInt16() );
+
+    // List name is always visible -> index starts from EMSListName+1
+    for ( TInt index = EMSListName+1; index <= ruleCount; index++ )
+        {
+        // get rule ID
+        TMSFillEditItems ruleId =
+                    static_cast<TMSFillEditItems>(rsReader.ReadInt16());
+        // get value
+        TInt value = rsReader.ReadInt16();
+        // get addional value
+        TInt addValue = rsReader.ReadInt16();
+        if ( ruleId == EMSAmount )
+            {
+            iLimitType = static_cast<TCmLimitType> (addValue);
+            }
+        // Remember IDs of template rules - rules will be set
+        // visible later
+        iVisibleRules.Append( ruleId );
+
+        // set value of rule
+        SetDefaultValue( ruleId, value );
+        }
+
+    CleanupStack::PopAndDestroy();//reader
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SetDefaultValues
+// Sets default value defined by template
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SetDefaultValue( TInt aId, TInt aValue )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::SetDefaultValue"));
+
+    switch ( aId )
+        {
+        case EMSShrinkImages:
+            {
+            iShrinkImages = static_cast<TMSShrinkImages> (aValue);
+            break;
+            }
+        case EMSAmount:
+            {
+            iAmount = aValue;
+            break;
+            }
+        case EMSStartingWith:
+            {
+            iStartWith = aValue;
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+            SetDefaultValues item not found"));
+            }
+        }
+    }
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::AddFillRuleL
+// Sets rule visibility
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::AddFillRuleL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::AddFillRuleL"));
+
+    TResourceReader reader;
+
+    switch ( iMediaType )
+        {
+        case ECmImage:
+            {
+            // read image templates
+            iCoeEnv->CreateResourceReaderLC( reader, R_MS_IMAGE_RULE_LIST );
+            break;
+            }
+        case ECmVideo:
+            {
+            // read video templates
+            iCoeEnv->CreateResourceReaderLC( reader, R_MS_VIDEO_RULE_LIST );
+            break;
+            }
+        case ECmAudio:
+            {
+            // read music templates
+            iCoeEnv->CreateResourceReaderLC( reader, R_MS_MUSIC_RULE_LIST );
+            break;
+            }
+        default:
+            {
+            // command not found
+            return;
+            }
+        }
+
+    // read rule count
+    TInt ruleCount( reader.ReadInt16() );
+
+    CDesCArray* ruleNames = new ( ELeave ) CDesCArrayFlat( ruleCount );
+    CleanupStack::PushL( ruleNames );
+
+    // array for template ID's
+    RArray<TInt> indexArray;
+
+    // fill name array
+    for ( TInt index = 0; index < ruleCount; index++ )
+        {
+        // read rule ID
+        TMSFillEditItems value =
+                    static_cast<TMSFillEditItems>( reader.ReadInt16() );
+        // read rule name
+        TPtrC text = reader.ReadTPtrC();
+
+        // add only hidden items to the list
+        if ( SearchItemById( value )->IsHidden() )
+            {
+            indexArray.Append( value );
+            ruleNames->AppendL( text );
+            }
+        }
+
+    TInt selectedRule( 0 );
+
+    if ( iView->ShowTemplateQueryL( R_MSERV_TEMPLATE_QUERY, 
+                                    R_MS_ADD_RULE_QUERY_HEADING,
+                                    ruleNames,
+                                    selectedRule ) )
+        {
+        // search item
+        for ( TInt idx = 0; idx < SettingItemArray()->Count(); idx++ )
+            {
+            CAknSettingItem* item = SettingItemArray()->At( idx );
+            if ( item->Identifier() == indexArray[selectedRule] )
+                {
+                // Show confirmation query for "From" and for "Until"
+                if ( item->Identifier() == EMSDateFrom ||
+                     item->Identifier() == EMSDateUntil )
+                	{
+    				if ( iView->ShowQueryL( R_MSERV_VIDEO_RULE_QUERY ) )
+        				{
+                		// set item visible
+                		item->SetHidden( EFalse );
+        				}
+                	}
+	            else
+	                {
+	           		item->SetHidden( EFalse );
+	                }
+                }
+            }
+        HandleChangeInItemArrayOrVisibilityL();
+        }
+    indexArray.Close();
+    CleanupStack::PopAndDestroy( ruleNames );
+    CleanupStack::PopAndDestroy(); // resource stuff
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SetListType
+// Sets list type based on given command
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SetListType( TInt aType )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::SetListType"));
+
+    switch ( aType )
+        {
+        case EMSCmdNewImageList:
+            {
+            iRule->SetMediaType( ECmImage );
+            iMediaType = ECmImage;
+            break;
+            }
+        case EMSCmdNewVideoList:
+            {
+            iRule->SetMediaType( ECmVideo );
+            iMediaType = ECmVideo;
+            break;
+            }
+        case EMSCmdNewMusicList:
+            {
+            iRule->SetMediaType( ECmAudio );
+            iMediaType = ECmAudio;
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditList::SetListType \
+            type not set"));
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::GetRuleValuesL
+// Loads rule values for the list
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::GetRuleValuesL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::GetRuleValuesL"));
+
+    HBufC* listName = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+                                                iRule->Name() );
+    CleanupStack::PushL( listName );
+    iListName.Copy( *listName );
+    CleanupStack::PopAndDestroy( listName );
+
+    // get limit type
+    iLimitType = iRule->LimitType();
+
+    // get amount
+    iAmount = iRule->Amount();
+
+    if ( iRule->Status() == ECmToBeShrinked )
+        {
+        iShrinkImages = EMSShrinkScreenSize;
+
+        }
+    else
+        {
+        iShrinkImages = EMSShrinkingOff;
+        }
+
+    // get start with
+    iStartWith = iRule->Method();
+
+    InitializeValues();
+
+    // Read additional rules
+    TInt ruleCount = iRule->RuleCount();
+    // Cycle trough all rules
+    for ( TInt ruleIndex = 0; ruleIndex < ruleCount; ruleIndex++ )
+        {
+        TCmMetadataField metaData;
+        TCmOperatorType operatorType;
+        TInt paramCount(0);
+
+        iRule->RuleL( ruleIndex, &metaData, &operatorType, &paramCount );
+
+
+        // Cycle trough all params
+        for ( TInt paramIndex = 0; paramIndex < paramCount; paramIndex++ )
+            {
+            TPtrC8 strParam;
+            iRule->RuleParamL( ruleIndex, paramIndex, &strParam );
+
+            // read index value
+            TInt ruleParam( 0 );
+            iRule->RuleParamL( ruleIndex, paramIndex, ruleParam );
+
+            switch ( metaData )
+                {
+                case ECmArtist:
+                    {
+                    iArtistArray.Append( ruleParam );
+                    break;
+                    }
+                case ECmAlbum:
+                    {
+                    iAlbumArray.Append( ruleParam );
+                    break;
+                    }
+                case ECmGenre:
+                    {
+                    iGenreArray.Append( ruleParam );
+                    break;
+                    }
+                case ECmTitle:
+                    {
+                    if ( iMediaType == ECmAudio )
+                        {
+                        iTrackArray.Append( ruleParam );
+                        }
+                    else // video
+                        {
+                        iVideoTitleArray.Append( ruleParam );
+                        }
+
+                    break;
+                    }
+                case ECmDuration:
+                    {
+                    TLex8 lex( strParam );
+                    if ( operatorType == ECmGreater )
+                        {
+                        lex.Val( iMinTrackLength );
+                        }
+                    else if ( operatorType == ECmSmaller )
+                        {
+                        lex.Val( iMaxTrackLength );
+                        }
+                    break;
+                    }
+                case ECmDate:
+                    {
+                    TInt64 value;
+                    TLex8 lex(strParam);
+                    lex.Val(value);
+
+                    if ( operatorType == ECmGreater )
+                        {
+                        iDateFrom = TTime( value );
+                        }
+                    if ( operatorType == ECmSmaller )
+                        {
+                        iDateUntil = TTime( value );
+                        }
+                    break;
+                    }
+                case ECmFileSize:
+                    {
+                    TLex8 lex( strParam );
+                    if ( operatorType == ECmGreater )
+                        {
+                        lex.Val( iMinFileSize );
+                        iMinFileSize /= KMega;
+                        // not needed in audio case
+                        iMinFileSizeSet = EMSSetSize;
+                        }
+                    else if ( operatorType == ECmSmaller )
+                        {
+                        lex.Val( iMaxFileSize );
+                        iMaxFileSize /= KMega;
+                        // not needed in audio case
+                        iMaxFileSizeSet = EMSSetSize;
+                        }
+                    break;
+                    }
+                case ECmBitrate:
+                    {
+                    break;
+                    }
+                case ECmResolution:
+                    {
+                    break;
+                    }
+                case ECmFreeText:
+                    {
+                    HBufC* listName =
+                        CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+                                                            strParam );
+                    CleanupStack::PushL( listName );
+                    iFreeText.Copy( *listName );
+                    CleanupStack::PopAndDestroy( listName );
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+            }
+        }
+
+    if  ( iMediaType == ECmAudio )
+        {
+        SetAudioFileSizeSelection();
+        SetAudioFileDurationSelection();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::InitializeValues
+// Initializes values of rules
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::InitializeValues()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::InitializeValues"));
+
+    // set date
+    iDateFrom.Set(KDefaultFromDate);
+    // set date
+    iDateUntil.HomeTime();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::DeleteRule
+// Deletes rule from the list
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::DeleteRule( TCmMetadataField aField )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::DeleteRule"));
+
+    iRule->DeleteRule( aField );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::DeleteRule
+// Deletes rule from the list
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::DeleteRule( TCmMetadataField aField,
+                                      TCmOperatorType aType  )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::DeleteRule"));
+
+    iRule->DeleteRule( aField, aType );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::AddAdditionalRuleL
+// Adds additional rules to the list
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::AddAdditionalRuleL( RArray<TInt>& aArray,
+                                              TCmMetadataField aField,
+                                              TCmOperatorType aOperator )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::AddAdditionalRuleL"));
+
+    TInt ruleIndex = iRule->AddRuleL( aField, aOperator );
+    for ( TInt idx = 0; idx < aArray.Count(); idx++)
+        {
+        iRule->AddRuleParamL( ruleIndex, aArray[ idx ] );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::AppendItemToListL
+// Appends item to the list
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::AppendItemToListL( RArray<TInt>* aArray,
+                                          TInt aParam )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::AppendItemToListL"));
+
+    aArray->AppendL( aParam );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::AddAdditionalRuleL
+// sets numeric type rule
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::AddAdditionalRuleL( TCmMetadataField aMetadataField,
+                                              TCmOperatorType aOperator,
+                                              TInt aValue )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::AddAdditionalRuleL"));
+
+    TInt ruleIndex = iRule->AddRuleL( aMetadataField, aOperator );
+    HBufC8* str = HBufC8::NewLC( 10 );
+    str->Des().Format(_L8("%d"), aValue );
+    iRule->AddRuleParamL( ruleIndex, *str );
+    CleanupStack::PopAndDestroy( str );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SaveTrackFileSizeL
+// Saves track file size
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SaveTrackFileSizeL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveTrackFileSizeL"));
+
+    switch ( iFileSizeEnum )
+        {
+        case EMSFileSizeLess_1_mb:
+            {
+            AddAdditionalRuleL( ECmFileSize, ECmSmaller, KMSSize_1_MB );
+            break;
+            }
+        case EMSFileSize_15_mb:
+            {
+            AddAdditionalRuleL( ECmFileSize, ECmGreater, KMSSize_1_MB );
+            AddAdditionalRuleL( ECmFileSize, ECmSmaller, KMSSize_5_MB );
+            break;
+            }
+        case EMSFileSize_510_mb:
+            {
+            AddAdditionalRuleL( ECmFileSize, ECmGreater, KMSSize_5_MB );
+            AddAdditionalRuleL( ECmFileSize, ECmSmaller, KMSSize_10_MB );
+            break;
+            }
+        case EMSFileSize_1050_mb:
+            {
+            AddAdditionalRuleL( ECmFileSize, ECmGreater, KMSSize_10_MB );
+            AddAdditionalRuleL( ECmFileSize, ECmSmaller, KMSSize_50_MB );
+            break;
+            }
+        case EMSFileSizeMore_10:
+            {
+            AddAdditionalRuleL( ECmFileSize, ECmGreater, KMSSize_50_MB );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+            SetAudioFileSizeSelection enum not found"));
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SetAudioFileSizeSelection
+// set selection for audio file size
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SetAudioFileSizeSelection()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    SetAudioFileSizeSelection"));
+
+    if ( ( KMega * iMinFileSize ) == KMSSize_0_MB &&
+        ( KMega * iMaxFileSize ) == KMSSize_1_MB )
+        {
+        iFileSizeEnum = EMSFileSizeLess_1_mb;
+        }
+    else if ( ( KMega * iMinFileSize ) == KMSSize_1_MB &&
+              ( KMega * iMaxFileSize ) == KMSSize_5_MB )
+        {
+        iFileSizeEnum = EMSFileSize_15_mb;
+        }
+    else if ( ( KMega * iMinFileSize ) == KMSSize_5_MB &&
+              ( KMega * iMaxFileSize ) == KMSSize_10_MB )
+        {
+        iFileSizeEnum = EMSFileSize_510_mb;
+        }
+    else if ( ( KMega * iMinFileSize ) == KMSSize_10_MB &&
+              ( KMega * iMaxFileSize ) == KMSSize_50_MB )
+        {
+        iFileSizeEnum = EMSFileSize_1050_mb;
+        }
+    else if ( ( KMega * iMinFileSize ) == KMSSize_50_MB &&
+              ( KMega * iMaxFileSize ) == KMSSize_0_MB )
+        {
+        iFileSizeEnum = EMSFileSizeMore_10;
+        }
+    else
+        {
+        iFileSizeEnum = EMSFileSizeAny;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SaveTrackDurationL
+// Saves track duration
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SaveTrackDurationL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveTrackDurationL"));
+
+    switch ( iTrackLengthEnum)
+        {
+        case EMSTrackLenLess_1:
+            {
+            AddAdditionalRuleL( ECmDuration, ECmSmaller,
+                                KMSTrackLength_1_min );
+            break;
+            }
+        case EMSTrackLen_16:
+            {
+            AddAdditionalRuleL( ECmDuration, ECmGreater,
+                                KMSTrackLength_1_min );
+            AddAdditionalRuleL( ECmDuration, ECmSmaller,
+                                KMSTrackLength_6_min );
+            break;
+            }
+        case EMSTrackLen_68:
+            {
+            AddAdditionalRuleL( ECmDuration, ECmGreater,
+                                KMSTrackLength_6_min );
+            AddAdditionalRuleL( ECmDuration, ECmSmaller,
+                                KMSTrackLength_8_min );
+            break;
+            }
+        case EMSTrackLen_830:
+            {
+            AddAdditionalRuleL( ECmDuration, ECmGreater,
+                                KMSTrackLength_8_min );
+            AddAdditionalRuleL( ECmDuration, ECmSmaller,
+                                KMSTrackLength_30_min );
+            break;
+            }
+        case EMSTrackLenMore_4:
+            {
+            AddAdditionalRuleL( ECmDuration, ECmGreater,
+                                KMSTrackLength_30_min );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveTrackDurationL\
+            enum not found"));
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SetAudioFileDurationSelection
+// set selection for audio file duration
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SetAudioFileDurationSelection()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    SetAudioFileDurationSelection"));
+
+    if ( iMinTrackLength == KMSTrackLength_0_min &&
+         iMaxTrackLength == KMSTrackLength_1_min )
+        {
+        iTrackLengthEnum = EMSTrackLenLess_1;
+        }
+    else if ( iMinTrackLength == KMSTrackLength_1_min &&
+              iMaxTrackLength == KMSTrackLength_6_min )
+        {
+        iTrackLengthEnum = EMSTrackLen_16;
+        }
+    else if ( iMinTrackLength == KMSTrackLength_6_min &&
+              iMaxTrackLength == KMSTrackLength_8_min )
+        {
+        iTrackLengthEnum = EMSTrackLen_68;
+        }
+    else if ( iMinTrackLength == KMSTrackLength_8_min &&
+              iMaxTrackLength == KMSTrackLength_30_min )
+        {
+        iTrackLengthEnum = EMSTrackLen_830;
+        }
+    else if ( iMinTrackLength == KMSTrackLength_30_min &&
+              iMaxTrackLength == KMSTrackLength_0_min )
+        {
+        iTrackLengthEnum = EMSTrackLenMore_4;
+        }
+    else
+        {
+        iTrackLengthEnum = EMSTrackLenAny;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::DisplayModifiedAdditionalRules
+// Displays additional rule if user has set value on it.
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::DisplayModifiedAdditionalRules()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    DisplayModifiedAdditionalRules"));
+
+    CAknSettingItemArray* itemArray = SettingItemArray();
+
+    // loop trough rules
+    for ( TInt index = 0; index < itemArray->Count(); index++ )
+        {
+        CAknSettingItem* item= itemArray->At( index );
+        if ( item->IsHidden() )
+            {
+            switch ( item->Identifier() )
+                {
+                case EMSFreeText:
+                    {
+                    item->SetSettingPageFlags(
+                                CAknTextSettingPage::EZeroLengthAllowed );
+                    if ( iFreeText.Size() )
+                        {
+                        item->SetHidden( EFalse );
+                        }
+                    break;
+                    }
+                case EMSServers:
+                    {
+                    if ( iRule->MediaServerCount() )
+                        {
+                        item->SetHidden( EFalse );
+                        }
+                    break;
+                    }
+                case EMSDateFrom:
+                    {
+                    if ( iDateFrom != TTime( KDefaultFromDate ) )
+                        {
+                        item->SetHidden( EFalse );
+                        }
+                    break;
+                    }
+                case EMSDateUntil:
+                    {
+                    TTime currentDate;
+                    currentDate.HomeTime();
+					
+					if ( iDateUntil.DateTime().Day() != currentDate.DateTime().Day() || 
+					     iDateUntil.DateTime().Month() != currentDate.DateTime().Month() || 
+					     iDateUntil.DateTime().Year() != currentDate.DateTime().Year() )
+                        {
+                        item->SetHidden( EFalse );
+                        }
+                    break;
+                    }
+                case EMSTrackLength:
+                    {
+                    if ( iTrackLengthEnum )
+                        {
+                        item->SetHidden( EFalse );
+                        }
+                    break;
+                    }
+                case EMSFileSize:
+                    {
+                    if ( iFileSizeEnum )
+                        {
+                        item->SetHidden( EFalse );
+                        }
+                    break;
+                    }
+                default:
+                    {
+                    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+                    SetAudioFileSizeSelection item not found"));
+                    break;
+                    }
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SearchItemById
+// Searches item from the itemarray by given ID
+// --------------------------------------------------------------------------
+//
+CAknSettingItem* CMSFillRuleEditList::SearchItemById( TMSFillEditItems aId )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::SearchItemById"));
+
+    CAknSettingItem* item = NULL;
+    CAknSettingItemArray* itemArray = SettingItemArray();
+
+    for ( TInt index = 0; index < itemArray->Count(); index++ )
+        {
+        if ( itemArray->At( index )->Identifier() == aId )
+            {
+            item = itemArray->At( index );
+            index = itemArray->Count(); // break out from the loop
+            }
+        }
+    return item;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SetShrinkingStatus
+// Sets shrinking status to fill list
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SetShrinkingStatus()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::SetShrinkingStatus"));
+
+    switch ( iShrinkImages )
+        {
+        case EMSShrinkScreenSize:
+            {
+            iRule->SetStatus( ECmToBeShrinked );
+            break;
+            }
+        case EMSShrinkingOff:
+            {
+            iRule->SetStatus( ECmToBeFilled );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+            SetShrinkingStatus shrink status not found"));
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::ReadyL()
+// engine observer callback
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::ReadyL( TCmService aService, TInt /*aError*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::ReadyL"));
+
+    switch ( aService )
+        {
+        case ECmServicePreProcessingFilllist:
+            {
+            // we'll lost iRule after update...
+            iAppUi->FillRuleController()->UpdateArrayL();
+            // ...so get it again
+            iRule = (*iAppUi->FillRuleController()->
+                            FillListArray())[iSelectedList]->List();
+            // show file info
+            CreateAndSetNaviPaneTextL();
+
+            if ( iState == EMSFetchMetadata )
+                {
+                if( iRule->MediaType() == ECmVideo )
+	                {
+	                // reset track array
+	                iTrackArray.Reset();
+	                // append the select video title in track array
+	                TInt count = iVideoTitleArray.Count();
+	                if( count > 0 )
+		                {
+		                for( TInt i=0; i<count; i++ )
+			                {
+			                iTrackArray.Append( iVideoTitleArray[i] );	
+			                }
+		                }
+	                	
+	                }
+                iMetadataCollector->GetFilteredMetadataL();
+
+                // Show 'reading data' text on navi pane
+                HBufC* naviText = StringLoader::LoadLC(
+                                            R_MS_WAIT_GETTING_DATA_TEXT );
+                iView->SetNavigationPaneTextL( *naviText );
+                CleanupStack::PopAndDestroy( naviText );
+
+                }
+            iState = EMSIdle;
+            break;
+            }
+        case ECmServiceFill:
+            {
+            UpdateSettingItemsL();
+            if ( iNewList )
+                {
+                SaveListValuesL();
+                iAppUi->FillRuleController()->SaveRulesL();
+                PreprocessListL();
+                }
+            else
+                {
+                // show item counts
+                CreateAndSetNaviPaneTextL();
+                }
+
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditList::ReadyL \
+            service not found"));
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::UpdateSettingItemsL()
+// updates items in multiselection settings
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::UpdateSettingItemsL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::UpdateSettingItemsL"));
+
+    // update setting item text
+    CAknSettingItem* item = NULL;
+    if ( iMediaType == ECmVideo )
+        {
+         item = SearchItemById( EMSTitleName );
+        }
+    else
+        {
+         item = SearchItemById( EMSTrack );
+        }
+
+    CMSRuleMultiselectionSetting* settingItem =
+                        static_cast<CMSRuleMultiselectionSetting*> (item);
+        if ( item )
+        {
+        settingItem->CreateItemListL();
+        //DrawDeferred();
+        }
+
+    if ( iMediaType == ECmAudio )
+        {
+        // update setting item text
+        item = SearchItemById( EMSArtist );
+         settingItem =
+                     static_cast<CMSRuleMultiselectionSetting*> (item);
+        if ( item )
+            {
+            settingItem->CreateItemListL();
+            //DrawDeferred();
+            }
+
+        // update setting item text
+        item = SearchItemById( EMSGenre );
+        settingItem = static_cast<CMSRuleMultiselectionSetting*> (item);
+        if ( item )
+            {
+            settingItem->CreateItemListL();
+            //DrawDeferred();
+            }
+        // update setting item text
+        item = SearchItemById( EMSAlbum );
+        settingItem = static_cast<CMSRuleMultiselectionSetting*> (item);
+            if ( item )
+            {
+            settingItem->CreateItemListL();
+            }
+        }
+    DrawDeferred();
+    }
+
+// Sets navi pane text
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::CreateAndSetNaviPaneTextL()
+// Sets navi pane text
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::CreateAndSetNaviPaneTextL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    CreateAndSetNaviPaneTextL"));
+
+    RPointerArray<CMSFillList>* fillListArray =
+                        iAppUi->FillRuleController()->FillListArray();
+
+    // Set navi pane text
+    // magic: only two numbers
+    CArrayFix<TInt>* infoArray = new ( ELeave ) CArrayFixFlat<TInt>(2);
+    CleanupStack::PushL( infoArray );
+
+    TReal size( 0 );
+    Math::Round( size,
+                 TReal((*fillListArray)[iSelectedList]->ListSize()) / KMega,
+                 0 );
+    TUint32 count = (*fillListArray)[iSelectedList]->ItemCount();
+
+    HBufC* naviText = NULL;
+
+    switch ( count )
+        {
+        case 0:
+            {
+            naviText = StringLoader::LoadLC(
+                        R_MS_RULE_NAVI_0_ITEMS, size );
+            break;
+            }
+        case 1:
+            {
+            naviText = StringLoader::LoadLC(
+                        R_MS_RULE_NAVI_1_ITEM, size );
+            break;
+            }
+        default:
+            {
+            infoArray->AppendL( size );
+            infoArray->AppendL( count );
+            naviText = StringLoader::LoadLC(
+                        R_MS_RULE_NAVI_MANY_ITEMS, *infoArray );
+            break;
+            }
+        }
+
+    // do number conversion
+    TPtr ptr = naviText->Des();
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+    iView->SetNavigationPaneTextL( *naviText );
+    CleanupStack::PopAndDestroy( naviText );
+    CleanupStack::PopAndDestroy( infoArray );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::RemoveCurrentRule
+// Hides current rule
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::RemoveCurrentRuleL()
+    {
+    LOG( _L( "[MediaServant]\t CMSFillRuleEditList::RemoveCurrentRuleL" ) );
+
+    CAknSettingItemArray* itemArray = SettingItemArray();
+
+    TInt currentItem = ListBox()->CurrentItemIndex();
+    TInt realIndex = itemArray->ItemIndexFromVisibleIndex(currentItem);
+
+    CAknSettingItem* item= (*itemArray)[realIndex];
+
+    // free text must be deleted here because user can't enter empty text
+    switch ( item->Identifier() )
+        {
+        case EMSFreeText:
+            {
+            DeleteRule( ECmFreeText );
+            iFreeText.Zero();
+            item->LoadL();
+            break;
+            }
+        case EMSServers:
+            {
+            DeleteAllServersFromRuleL();
+            break;
+            }
+        case EMSDateFrom:
+            {
+            DeleteRule( ECmDate );
+		    iDateFrom.Set( KDefaultFromDate );
+            break;
+            }
+        case EMSDateUntil:
+            {
+            DeleteRule( ECmDate );
+    		iDateUntil.HomeTime();
+            break;
+            }
+        case EMSTrackLength:
+            {
+            DeleteRule( ECmDuration );
+            break;
+            }
+        case EMSFileSize:
+            {
+            DeleteRule( ECmFileSize );
+            break;
+            }
+        default:
+            {
+            LOG( _L( "[MediaServant]\t CMSFillRuleEditList::\
+            RemoveCurrentRuleL no such item" ) );
+            break;
+            }
+        }
+
+    // Menu command is shown only hidden items
+    item->SetHidden( ETrue );
+    // visibility changed
+    HandleChangeInItemArrayOrVisibilityL();
+    // cancel ongoing operation
+    iView->CancelAsyncOperation( iAppUi );
+    // set idle state
+    iState = EMSIdle;
+    // update list info
+    SaveAndPreprocesslistL( item );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::IsCurrentRuleAdditional
+// Tests if current rule is additional
+// --------------------------------------------------------------------------
+//
+TBool CMSFillRuleEditList::IsCurrentRuleAdditional()
+    {
+    LOG( _L( "[MediaServant]\t CMSFillRuleEditList::\
+    IsCurrentRuleAdditional" ) );
+
+    TBool isAdditional = EFalse;
+
+    TInt currentItem = ListBox()->CurrentItemIndex();
+
+    CAknSettingItemArray* itemArray = SettingItemArray();
+    TInt realIndex = itemArray->ItemIndexFromVisibleIndex(currentItem);
+    CAknSettingItem* item= (*itemArray)[realIndex];
+
+    TInt id = item->Identifier();
+
+    if ( id == EMSServers ||
+         id == EMSFreeText ||
+         id == EMSTrackLength ||
+         id == EMSFileSize )
+        {
+        isAdditional = ETrue;
+        }
+    // From and Until are additional rules in Video list    
+    else if ( iMediaType == ECmVideo && 
+              ( id == EMSDateFrom || id == EMSDateUntil ) )
+    	{
+    	isAdditional = ETrue;
+    	}
+    
+    return isAdditional;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::ListMediaType
+// Returns media type of the list
+// --------------------------------------------------------------------------
+//
+TCmMediaType CMSFillRuleEditList::ListMediaType()
+    {
+    return iMediaType;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::SizeChanged()
+// Called by framework when the view size is changed.
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::SizeChanged()
+    {
+    ListBox()->SetRect( Rect() ); // Set rectangle of listbox.
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::HandleResourceChange
+// Handles layout change
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::HandleResourceChange( TInt aType )
+    {
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect( iView->ClientRect() );
+        }
+
+    CCoeControl::HandleResourceChange( aType );
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleServersSetting::CreateServerSettingListL
+// Creates selection item list
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::CreateServerSettingListL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    CreateServerSettingListL"));
+
+    if ( iServerArray )
+        {
+        iServerArray->ResetAndDestroy();
+        delete iServerArray;
+        iServerArray = NULL;
+        }
+
+    iServerArray =
+            new ( ELeave ) CSelectionItemList( 8 );
+
+    TBuf8<KMaxFileName> itemText;
+    TInt selectedItemCount( 0 );
+
+    TInt serverCount(0);
+    if ( iServers )
+        {
+        serverCount = iServers->Count();
+        }
+
+    // Cycle trough all servers
+    for ( TInt idx = 0; idx < serverCount; idx++ )
+        {
+        // get server
+        CCmMediaServerFull* server = (*iServers)[idx];
+
+        // Add all servers to the list
+        HBufC* devName =
+            CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+                                    server->MediaServerName() );
+        CleanupStack::PushL( devName );
+        CSelectableItem* item = new ( ELeave ) CSelectableItem(
+                                                    *devName, EFalse);
+
+        CleanupStack::PushL( item );
+        // item must be constructed
+        item->ConstructL();
+
+        // count of servers set to rule
+        TInt ruleServerCount = iRule->MediaServerCount();
+
+        // Cycle trough all servers
+        for (TInt index = 0; index < ruleServerCount; index++ )
+            {
+            TInt serverId( 0 );
+            iRule->MediaServerL( index, serverId );
+
+            if ( serverId == server->DbId() ) // compare IDs
+                {
+                // found - break this loop
+                index = ruleServerCount;
+                // found - mark selected
+                item->SetSelectionStatus( ETrue );
+                selectedItemCount++;
+                }
+            }
+        // append item to list
+        iServerArray->AppendL(item);
+        CleanupStack::Pop( item );
+        CleanupStack::PopAndDestroy( devName );
+        }
+
+    // Create and append default item and put it first
+    HBufC* itemName = StringLoader::LoadLC( R_MS_VALUE_ANY_SOURCE_DEVICE );
+    CSelectableItem* item = NULL;
+    if ( selectedItemCount )
+        {
+        item = new ( ELeave ) CSelectableItem( *itemName, EFalse );
+        }
+    else
+        {
+        item = new ( ELeave ) CSelectableItem( *itemName, ETrue );
+        }
+
+    CleanupStack::PushL( item );
+    item->ConstructL();
+    iServerArray->InsertL(0, item);
+    CleanupStack::Pop( item );
+    CleanupStack::PopAndDestroy( itemName );
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::HandleServerSelectionL
+// Adds selected servers from the list to the rule
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::HandleServerSelectionL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    HandleServerSelectionL"));
+
+    DeleteAllServersFromRuleL();
+
+    // Check if first item ("Any") selected
+    if ( (*iServerArray)[0]->SelectionStatus() == EFalse )
+       {
+       for ( TInt index = 1; index < iServerArray->Count(); index++ )
+            {
+            CSelectableItem* item = (*iServerArray)[index];
+            TBool selected = item->SelectionStatus();
+
+            CCmMediaServerFull* server = (*iServers)[index-1];
+
+            // add server
+            if ( item->SelectionStatus() )
+                {
+                iRule->AddMediaServerL( server->DbId() );
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::DeleteAllServersFromRuleL
+// Deletes all servers from rule
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::DeleteAllServersFromRuleL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::\
+    DeleteAllServersFromRuleL"));
+
+    // count of servers set to rule
+    TInt ruleServerCount = iRule->MediaServerCount();
+
+    for ( TInt index = ruleServerCount-1; index >= 0; index-- )
+        {
+        TInt serverId( 0 );
+        iRule->MediaServerL( index , serverId );
+        iRule->DeleteMediaServer( serverId );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditList::GetServersAndCheckActivityL
+// Gets mediaservers and removes not active servers
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::GetServersAndCheckActivityL()
+    {
+    iServers = iAppUi->MSEngine()->GetMediaServersL();
+
+    for ( TInt i = 0; i < iServers->Count() ; i++ )
+        {
+        CCmMediaServerFull* server = (*iServers)[i];
+        // remove server if it is not tagged as fill server
+        if ( !server->FillUsage() )
+            {
+            delete server;
+            iServers->Remove(i);
+            i--;
+            }
+        }
+    iServers->Compress();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSFillRuleEditList::GetHelpContext
+// ---------------------------------------------------------------------------
+//
+void CMSFillRuleEditList::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditList::GetHelpContext"));
+
+    aContext.iMajor = TUid::Uid(KMediaServantUID3);
+    aContext.iContext = KMSERV_HLP_EDIT_RULES;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msfillruleeditview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,276 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSFillRuleEditView class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <hlplch.h>
+#include <StringLoader.h>
+#include <aknlistquerydialog.h>
+
+#include "msfillview.h"
+#include "msengine.h"
+#include "msfillruleeditlist.h"
+#include "msfillruleeditview.h"
+#include "msappui.h"
+#include "msconstants.h"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditView::CMSFillRuleEditView()
+// --------------------------------------------------------------------------
+//
+CMSFillRuleEditView::CMSFillRuleEditView( CMSAppUi& aAppUi )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditView::CMSFillRuleEditView"));
+
+    iAppUi = &aAppUi;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditView::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditView::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditView::ConstructL"));
+
+    BaseConstructL( R_MS_FILL_EDIT_VIEW );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditView::~CMSFillRuleEditView()
+// --------------------------------------------------------------------------
+//
+CMSFillRuleEditView::~CMSFillRuleEditView()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditView::~CMSFillRuleEditView"));
+
+    DoDeactivate();
+    }
+
+// --------------------------------------------------------------------------
+// TUid CMSFillRuleEditView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CMSFillRuleEditView::Id() const
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditView::Id"));
+
+    return KMSFillEditViewId;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditView::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditView::HandleCommandL( TInt aCommand )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditView::HandleCommandL"));
+
+    switch (aCommand)
+        {
+        case EAknCmdOpen:
+            {
+            iContainer->OpenSelectedListboxItemL();
+            break;
+            }
+        case EAknSoftkeyDone:
+            {
+            iAppUi->MSEngine()->StopOperation();
+            iAppUi->FillRuleController()->UpdateArrayL();
+            iAppUi->ChangeViewL( KMSFillEditViewId, KMSFillViewId );
+            break;
+            }
+        case EMSCmdRemoveRule:
+            {
+            iContainer->RemoveCurrentRuleL();
+            break;
+            }
+        case EAknCmdHelp :
+            {
+            TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL(
+                        iEikonEnv->WsSession(),
+            iEikonEnv->EikAppUi()->AppHelpContextL() ));
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL(aCommand);
+            }
+        break;
+
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditView::DoActivateL()
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditView::DoActivateL"));
+
+    if ( !iContainer )
+        {
+        // create settings screen
+        iContainer = CMSFillRuleEditList::NewL(*iAppUi,
+                                               *this );
+        iContainer->SetMopParent( this );
+
+        // now control receives keyboard events
+        iAppUi->AddToStackL( *this, iContainer );
+        iContainer->ActivateL();
+        }
+
+    // Set title text
+    HBufC* titleText = NULL;
+
+    switch ( iContainer->ListMediaType() )
+        {
+        case ECmImage:
+            {
+            titleText = StringLoader::LoadLC(
+                                        R_MS_EDIT_IMAGE_RULE_VIEW_TITLE );
+            break;
+            }
+        case ECmVideo:
+            {
+            titleText = StringLoader::LoadLC(
+                                        R_MS_EDIT_VIDEO_RULE_VIEW_TITLE );
+            break;
+            }
+        case ECmAudio:
+            {
+            titleText = StringLoader::LoadLC(
+                                        R_MS_EDIT_MUSIC_RULE_VIEW_TITLE );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillRuleEditView::DoActivateL \
+            list has no media type"));
+            break;
+            }
+        }
+
+    if ( titleText )
+        {
+        SetTitlePaneTextL( *titleText );
+        CleanupStack::PopAndDestroy ( titleText );
+        }
+   }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditView::DoDeactivate()
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditView::DoDeactivate()
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditView::DoDeactivate"));
+
+    ClearCurrentNaviPaneText();
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        }
+
+    delete iContainer; // Deletes the container class object.
+    iContainer = NULL;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditView:DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+void CMSFillRuleEditView::DynInitMenuPaneL( TInt aResourceId,
+                                            CEikMenuPane* aMenuPane )
+    {
+    LOG(_L("[MediaServant]\t CMSFillRuleEditView::DynInitMenuPaneL"));
+    
+    if ( aResourceId == R_MS_FILL_EDIT_MENU && iContainer )
+        {
+        // check if the list is empty
+        if ( iContainer->IsCurrentRuleAdditional() == EFalse )
+            {
+            // Hide command
+            aMenuPane->SetItemDimmed(EMSCmdRemoveRule, ETrue);
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditView:ShowTemplateQueryL
+// --------------------------------------------------------------------------
+//
+TBool CMSFillRuleEditView::ShowTemplateQueryL( TInt aResourceId,
+                                               TInt aQueryHeading,
+                                               CDesCArray* aRuleNames,
+                                               TInt &aSelected )
+	{
+	LOG(_L("[MediaServant]\t CMSFillRuleEditView::ShowTemplateQueryL"));
+	
+	TBool ret( EFalse );
+
+    // construct and show template query
+    CAknListQueryDialog* query =
+                     new ( ELeave ) CAknListQueryDialog( &aSelected );
+    query->PrepareLC( aResourceId );
+
+    // read header text
+    HBufC* header = StringLoader::LoadLC( aQueryHeading );
+    query->SetHeaderTextL( header->Des() );
+    
+    // set item array
+    query->SetItemTextArray( aRuleNames );
+    query->SetOwnershipType( ELbmDoesNotOwnItemArray );
+    CleanupStack::PopAndDestroy( header );
+
+	if ( query->RunLD() )
+		{
+		ret = ETrue;
+		}
+
+    return ret;
+	}
+
+// --------------------------------------------------------------------------
+// CMSFillRuleEditView:ShowQueryL
+// --------------------------------------------------------------------------
+//
+TBool CMSFillRuleEditView::ShowQueryL( TInt aResourceId )
+	{
+	LOG(_L("[MediaServant]\t CMSFillRuleEditView::ShowQueryL"));
+	
+	TBool ret( EFalse );
+	CAknQueryDialog* query= CAknQueryDialog::NewL( CAknQueryDialog::ENoTone );
+	CleanupStack::PushL( query );
+    if ( query->ExecuteLD( aResourceId ) )
+        {
+        ret = ETrue;
+        }
+    CleanupStack::Pop( query );
+    return ret;
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msfillview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,603 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSFillView class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+#include <aknlistquerydialog.h>
+#include <hlplch.h>
+#include <utf.h>
+
+#include "cmfillrule.h"
+#include "msfillview.h"
+#include "msengine.h"
+#include "msfillcontainer.h"
+#include "msappui.h"
+#include "msconstants.h"
+#include "mediaservant.hrh"
+#include "msparameteragent.h"
+#include "msdebug.h"
+
+
+// CONSTANTS
+_LIT( KWildCard, "*" );
+_LIT( KSpace, " ");
+
+const TInt KImageListTemplate = 1;
+const TInt KVideoListTemplate = 2;
+const TInt KMusicListTemplate = 3;
+
+
+// --------------------------------------------------------------------------
+// CMSFillView::CMSFillView()
+// --------------------------------------------------------------------------
+//
+CMSFillView::CMSFillView( CMSAppUi& aAppUi )
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::CMSFillView"));
+
+    iAppUi = &aAppUi;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSFillView::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::ConstructL"));
+
+    BaseConstructL( R_MS_FILL_VIEW );
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::~CMSFillView()
+// --------------------------------------------------------------------------
+//
+CMSFillView::~CMSFillView()
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::~CMSFillView"));
+    DoDeactivate();
+    }
+
+// --------------------------------------------------------------------------
+// TUid CMSFillView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CMSFillView::Id() const
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::Id"));
+
+    return KMSFillViewId;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillView::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CMSFillView::HandleCommandL(TInt aCommand)
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::HandleCommandL"));
+
+    CEikButtonGroupContainer* cba = Cba();
+
+    switch (aCommand)
+        {
+        case EAknSoftkeyBack:
+            {
+            CancelAsyncOperation( iAppUi );
+            iNextView = KMSMainViewId;
+
+            CheckAndHandleChangesL();
+
+            break;
+            }
+
+        case EAknSoftkeyDone:
+            {
+            CancelAsyncOperation(  iAppUi );
+            iContainer->SetReorderStateL( EMSFillNormal );
+            cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+            cba->DrawNow();
+
+            // Set title pane text
+            SetTitlePaneTextL( R_MS_FILL_VIEW_TITLE );
+            break;
+            }
+
+        case EMSCmdActivate: // fall through
+        case EMSCmdDeActivate:
+            {
+            iContainer->ChangeListActivityL();
+            SetListUnselected();
+            break;
+            }
+        // Edit fill rule
+        case EMSCmdEditRule:
+            {
+            CancelAsyncOperation(  iAppUi );
+            TMSTemplate ruleTemplate;
+            ruleTemplate.templateType = aCommand;
+            ruleTemplate.selectedTemplate = EMSNoTemplate;
+            iAppUi->ParameterAgent()->SetRuleTemplate( ruleTemplate );
+
+            iNextView = KMSFillEditViewId;
+            CheckAndHandleChangesL();
+
+            break;
+            }
+
+        case EMSCmdBrowse:
+            {
+            CancelAsyncOperation(  iAppUi );
+            iNextView = KMSFillBrowseViewId;
+            CheckAndHandleChangesL();
+
+            break;
+            }
+
+        case EMSCmdNewImageList: // fall through
+        case EMSCmdNewVideoList: // fall through
+        case EMSCmdNewMusicList:
+            {
+            CancelAsyncOperation(  iAppUi );
+            ShowTemplateQueryL( aCommand );
+            iNextView = KMSFillEditViewId;
+            CheckAndHandleChangesL();
+            break;
+            }
+
+        // Reorder fill rule
+        case EMSCmdReorder:
+            {
+            iContainer->SetReorderStateL( EMSFillReorderActive );
+            cba->SetCommandSetL( R_SOFTKEYS_DROP_EMPTY );
+            cba->DrawNow();
+            // Set title pane text
+            SetTitlePaneTextL( R_MS_FILL_VIEW_TITLE_REORDER_MODE );
+            break;
+            }
+
+        // Drop rule to new location
+        case EMSCmdDrop:
+            {
+            iContainer->SetReorderStateL( EMSFillGrabActive );
+            cba->SetCommandSetL( R_SOFTKEYS_GRAB_DONE );
+            cba->DrawNow();
+            break;
+            }
+        // Reorder mode active - grab item
+        case EMSCmdGrab:
+            {
+            iContainer->SetReorderStateL( EMSFillReorderActive );
+            cba->SetCommandSetL( R_SOFTKEYS_DROP_EMPTY );
+            cba->DrawNow();
+            break;
+            }
+        // Delete fill rule
+        case EMSCmdDelete:
+            {
+            iContainer->DeleteRuleL();
+            break;
+            }
+        case EAknCmdHelp :
+            {
+            TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL(
+                        iEikonEnv->WsSession(),
+            iEikonEnv->EikAppUi()->AppHelpContextL() ));
+            break;
+            }
+        default:
+            {
+            CancelAsyncOperation(  iAppUi );
+            AppUi()->HandleCommandL(aCommand);
+            break;
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSFillView::DoActivateL()
+// --------------------------------------------------------------------------
+//
+void CMSFillView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::DoActivateL"));
+
+    // Set engine observer
+    iAppUi->MSEngine()->SetObserver( this );
+
+    // Set title pane text
+    SetTitlePaneTextL( R_MS_FILL_VIEW_TITLE );
+
+    if ( !iContainer )
+        {
+        iContainer = new (ELeave) CMSFillContainer( *iAppUi, *this );
+        iContainer->ConstructL( ClientRect() );
+        iContainer->SetMopParent( this );
+        AppUi()->AddToViewStackL( *this, iContainer );
+        }
+    SetListUnselected();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::DoDeactivate()
+// --------------------------------------------------------------------------
+//
+void CMSFillView::DoDeactivate()
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::DoDeactivate"));
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        }
+
+    delete iContainer; // Deletes the container class object.
+    iContainer = NULL;
+    SetListUnselected();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::FocusIndex()
+// --------------------------------------------------------------------------
+//
+TInt CMSFillView::FocusIndex() const
+    {
+    return iContainer->SelectedItemIndex();
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
+// --------------------------------------------------------------------------
+//
+void CMSFillView::DynInitMenuPaneL( TInt aResourceId,
+                                    CEikMenuPane* aMenuPane )
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::DynInitMenuPaneL"));
+    
+    if ( aResourceId == R_FILL_VIEW_MENU && iContainer )
+        {
+        // check if the list is empty
+        if ( iContainer->ListItemCount() <= 0 )
+            {
+            // Hide commands
+            aMenuPane->SetItemDimmed(EMSCmdEditRule, ETrue);
+            aMenuPane->SetItemDimmed(EMSCmdReorder, ETrue);
+            aMenuPane->SetItemDimmed(EMSCmdDelete, ETrue);
+            aMenuPane->SetItemDimmed(EMSCmdBrowse, ETrue);
+            aMenuPane->SetItemDimmed(EMSCmdActivate, ETrue);
+            aMenuPane->SetItemDimmed(EMSCmdDeActivate, ETrue);
+            }
+
+        if ( iContainer->IsCurrentListItemActive() )
+            {
+            aMenuPane->SetItemDimmed(EMSCmdActivate, ETrue);
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed(EMSCmdDeActivate, ETrue);
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::ShowTemplateQueryL
+// shows template query
+// --------------------------------------------------------------------------
+//
+void CMSFillView::ShowTemplateQueryL( TInt aCommand )
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::ShowTemplateQueryL"));
+    
+    HBufC* defaultListName = NULL;;
+
+    TMSTemplate ruleTemplate;
+    // set template info
+    ruleTemplate.templateType = aCommand;
+
+    switch ( aCommand )
+        {
+        case EMSCmdNewImageList:
+            {
+            defaultListName = StringLoader::LoadLC(
+                                        R_MS_CUSTOM_LIST_IMAGE_NAME );
+            ruleTemplate.selectedTemplate = KImageListTemplate;
+            break;
+            }
+        case EMSCmdNewVideoList:
+            {
+            defaultListName = StringLoader::LoadLC(
+                                        R_MS_CUSTOM_LIST_VIDEO_NAME );
+            ruleTemplate.selectedTemplate = KVideoListTemplate;
+            break;
+            }
+        case EMSCmdNewMusicList:
+            {
+            defaultListName = StringLoader::LoadLC(
+                                        R_MS_CUSTOM_LIST_MUSIC_NAME );
+            ruleTemplate.selectedTemplate = KMusicListTemplate;
+            break;
+            }
+        default:
+            {
+            defaultListName = StringLoader::LoadLC(
+                                        R_MS_CUSTOM_LIST_IMAGE_NAME );
+            ruleTemplate.selectedTemplate = KImageListTemplate;
+            // command not found
+            break;
+            }
+        }
+
+    // Create search string with wildcards
+    HBufC* searchStr = HBufC::NewLC( KMaxFileName );
+    searchStr->Des().Copy( KWildCard );
+    searchStr->Des().Append( defaultListName->Des() );
+    searchStr->Des().Append( KWildCard );
+
+    // Check if fill list have dublicate names
+    TInt count = iContainer->CheckIfDublicateNames( *searchStr );
+
+    CleanupStack::PopAndDestroy( searchStr );
+    // keep template name safe
+    ruleTemplate.templateName.Copy( defaultListName->Des() );
+                        
+    // if existing items...
+    searchStr = HBufC::NewLC( KMaxFileName );
+    searchStr->Des().Append( defaultListName->Des() );
+
+    TBool same = EFalse;
+
+    RPointerArray<CMSFillList>* iFillListArray =
+                    iAppUi->FillRuleController()->FillListArray();
+
+    // if there are same name items
+    for ( TInt index = 0; index < iFillListArray->Count(); ++index )
+        {
+        CCmFillRule* rule = (*iFillListArray)[index]->List();
+        HBufC* listName =
+                CnvUtfConverter::ConvertToUnicodeFromUtf8L( rule->Name() );
+        CleanupStack::PushL( listName );
+        if ( *searchStr == *listName )
+            {
+            same = ETrue;
+            }
+        CleanupStack::PopAndDestroy( listName );
+        }
+
+    CleanupStack::PopAndDestroy( searchStr );
+    // exist same name items
+    if ( count > 0 && same )
+        {
+        TInt postfix;
+        // calculate a postfix number to add the end of the name
+        for ( postfix = 1; ; ++postfix )
+            {
+            HBufC* sameStr = HBufC::NewL( KMaxFileName );
+            CleanupStack::PushL( sameStr );
+            sameStr->Des().Copy( KWildCard );
+            sameStr->Des().Append( defaultListName->Des() );
+            sameStr->Des().Append( KSpace );
+            sameStr->Des().AppendNum( postfix );
+            sameStr->Des().Append( KWildCard );
+               
+            // do number conversion            
+            TPtr ptr = sameStr->Des();
+            AknTextUtils::
+            DisplayTextLanguageSpecificNumberConversion( ptr );
+                                
+            if ( 0 == iContainer->CheckIfDublicateNames( *sameStr ) )
+                {
+                // after append the current number, there are not
+                //same name items, so jump out the code block
+                CleanupStack::PopAndDestroy( sameStr );
+                break;
+                }
+            CleanupStack::PopAndDestroy( sameStr );
+            }
+
+        // append order number to name
+        ruleTemplate.templateName.Append( KSpace );
+        ruleTemplate.templateName.AppendNum( postfix );
+
+        // do number conversion            
+        AknTextUtils::
+            DisplayTextLanguageSpecificNumberConversion(
+                ruleTemplate.templateName );            
+        }
+
+    // store template info to parameter agent
+    iAppUi->ParameterAgent()->SetRuleTemplate( ruleTemplate );
+
+    CleanupStack::PopAndDestroy( defaultListName );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSFillView::ShowNaviTextL
+// ---------------------------------------------------------------------------
+//
+void CMSFillView::ShowNaviTextL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::ShowNaviTextL"));
+    
+    HBufC* naviText = StringLoader::LoadLC( R_MS_PREPROCESSING_TEXT );
+    SetNavigationPaneTextL( *naviText );
+    CleanupStack::PopAndDestroy( naviText );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSFillView::SetListUnselected
+// ---------------------------------------------------------------------------
+//
+void CMSFillView::SetListUnselected( )
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::SetListUnselected"));
+    
+    iListUnSelected =  iAppUi->FillRuleController()->
+                                       HasSelectionsChanged( ECmUnSelected );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSFillView::CheckAndHandleChangesL
+// ---------------------------------------------------------------------------
+//
+void CMSFillView::CheckAndHandleChangesL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::CheckAndHandleChangesL"));
+    
+    TBool priorityChanged( EFalse );
+
+    // Check if priorities has been changed
+    priorityChanged = iAppUi->FillRuleController()->
+                                   HasPriorityChangedL();
+
+    iNewListSelected = iAppUi->FillRuleController()->
+                                   HasSelectionsChanged( ECmSelected );
+    // check if there is deleted lists
+    TBool listDeleted = iContainer->IsListDeleted();
+
+    // set activity for all rules
+    iContainer->SetFillRules();
+
+    if ( iListUnSelected )
+        {
+        // unselected list(s) - show query
+        DoDeleteQueryL();
+        }
+
+    // send rules to server
+    iAppUi->FillRuleController()->SaveRulesL();
+
+    // update lists if list(s) have been deleted, created or their selection
+    // statuses or priorities have been changed
+    if ( listDeleted ||
+         priorityChanged ||
+         iListUnSelected ||
+         iNewListSelected )
+        {
+        // disable right softkey
+        CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
+        cba->SetCommandSetL( R_MS_SOFTKEYS_OPTIONS_EMPTY );
+        cba->DrawDeferred();
+
+        ShowNaviTextL();
+        iAppUi->MSEngine()->UpdateFillListsL();
+        }
+    else // no list update needed
+        {
+        // retrieve new information
+        iAppUi->FillRuleController()->UpdateArrayL();
+        iAppUi->ChangeViewL( KMSFillViewId, iNextView );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSFillView::DoDeleteQueryL
+// ---------------------------------------------------------------------------
+//
+void CMSFillView::DoDeleteQueryL()
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::DoDeleteQueryL"));
+
+    // Show delete files query
+    CAknQueryDialog* query= CAknQueryDialog::NewL(
+                                   CAknQueryDialog::ENoTone );
+
+    if ( query->ExecuteLD( R_MSERV_DELETE_FILES_QUERY ) )
+        {
+        // do nothing
+        }
+    else // canceled
+        {
+        iAppUi->FillRuleController()->RestoreOriginalSelections();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::ReadyL()
+// engine observer callback
+// --------------------------------------------------------------------------
+//
+void CMSFillView::ReadyL( TCmService aService, TInt /*aError*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::ReadyL"));
+
+    switch ( aService )
+        {
+        case ECmServiceUpdateFillLists:
+            {
+            // set original softkeys back
+            CEikButtonGroupContainer* cba =
+                            CEikButtonGroupContainer::Current();
+            cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+            cba->DrawDeferred();
+
+            // retrieve new information
+            iAppUi->FillRuleController()->UpdateArrayL();
+
+            ClearCurrentNaviPaneText();
+            iAppUi->ChangeViewL( KMSFillViewId, iNextView );
+            break;
+            }
+        case ECmServiceDeleteFilledFiles:
+            {
+            LOG(_L("[MediaServant]\t CMSFillView::ReadyL delete complete"));
+            ClearCurrentNaviPaneText();
+            // Set context pane icon
+            iContainer->SetDefaultContextPaneIconL();
+
+            iContainer->UpdateListBoxDataL();
+            break;
+            }
+
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSFillView::ReadyL \
+            service not found"));
+            }
+
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::SetCbaL()
+// Changes softkeys
+// --------------------------------------------------------------------------
+//
+void CMSFillView::SetCbaL( TBool aSelected )
+    {
+    LOG(_L("[MediaServant]\t CMSFillView::SetCbaL"));
+    
+    CEikButtonGroupContainer* cba = Cba();
+
+    if ( aSelected )
+        {
+        cba->SetCommandSetL( R_MS_SOFTKEYS_OPTIONS_BACK__DEACTIVATE );
+        }
+    else
+        {
+        cba->SetCommandSetL( R_MS_SOFTKEYS_OPTIONS_BACK__ACTIVATE );
+        }
+    cba->DrawDeferred();
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msitembrowser.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,316 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSItemBrowser class implementation
+*
+*/
+
+
+
+#include <AknIconArray.h>
+#include <mediaservant.rsg>
+#include <mediaservant.mbg>
+#include <avkon.mbg>
+#include <aknnotedialog.h>
+#include <StringLoader.h>
+#include <e32math.h>
+
+#include "cmbaselistitem.h"
+#include "msappui.h"
+#include "msitembrowser.h"
+#include "msengine.h"
+#include "msconstants.h"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSItemBrowser::ConstructL( TRect aRect )
+    {
+    LOG(_L("[MediaServant]\t CMSItemBrowser::ConstructL"));    
+
+    GetBrowseDataL();
+
+    CreateWindowL();
+
+    iListBox = new (ELeave) CAknDoubleGraphicStyleListBox;
+
+    SetListBoxFromResourceL(iListBox, R_BROWSE_VIEW_LISTBOX);
+
+    // Create icons
+    CAknIconArray* icons = new (ELeave) CAknIconArray( EIconCount );
+    CleanupStack::PushL( icons );
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    // mark icon
+    AppendIconToArrayL( icons, skin,
+                        KAvkonMifFileName,
+                        KAknsIIDDefault,
+                        EMbmAvkonQgn_indi_marked_add,
+                        EMbmAvkonQgn_indi_marked_add_mask );
+
+    // image icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_prop_file_image,
+                        EMbmMediaservantQgn_prop_file_image_mask );
+    // audio icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_prop_file_audio,
+                        EMbmMediaservantQgn_prop_file_audio_mask );
+    // video icon
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_prop_file_video,
+                        EMbmMediaservantQgn_prop_file_video_mask );
+
+
+    iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(icons);
+    CleanupStack::Pop(icons);
+
+    // Container is listbox observer
+    iListBox->SetListBoxObserver( this );
+
+    SetRect(aRect);
+
+    // Add data to listbox
+    UpdateListBoxDataL();
+
+    ActivateL(); // Activates window. ( Ready to draw )
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::~CMSItemBrowser
+// --------------------------------------------------------------------------
+CMSItemBrowser::~CMSItemBrowser()
+    {
+    if ( iItemArray )
+        {
+        iItemArray->ResetAndDestroy();
+        iItemArray->Close();
+        delete iItemArray;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::CountComponentControls()
+// Returns number of components.
+// --------------------------------------------------------------------------
+//
+TInt CMSItemBrowser::CountComponentControls() const
+    {
+    return 1; // return number of controls inside this container
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::ComponentControl()
+// Returns pointer to particular component.
+// --------------------------------------------------------------------------
+//
+CCoeControl* CMSItemBrowser::ComponentControl( TInt /*aIndex*/) const
+
+    {
+    return iListBox; // return a pointer to the listbox
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::OfferKeyEventL()
+// Handles the key events.
+// --------------------------------------------------------------------------
+//
+TKeyResponse CMSItemBrowser::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    LOG(_L("[MediaServant]\t CMSItemBrowser::OfferKeyEventL"));
+
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if ( aType != EEventKey )
+        {
+        response =  EKeyWasNotConsumed;
+        }
+
+    if ( iListBox )
+        {
+        response = iListBox->OfferKeyEventL( aKeyEvent, aType );
+        }
+
+    return response;
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::HandleListBoxEventL()
+// Handles listbox event.
+// --------------------------------------------------------------------------
+void CMSItemBrowser::HandleListBoxEventL(
+    CEikListBox* /*aListBox*/,
+    TListBoxEvent /*aEventType*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSItemBrowser::HandleListBoxEventL"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::ReadDataFromEngineL()
+// Reads data items from engine
+// --------------------------------------------------------------------------
+//
+void CMSItemBrowser::UpdateListBoxDataL()
+    {
+    LOG(_L("[MediaServant]\t CMSItemBrowser::UpdateListBoxDataL"));
+
+    // Listbox items
+    CDesCArray* itemArray = static_cast<CDesCArray*>
+                                   (iListBox->Model()->ItemTextArray());
+    // Clear list
+    itemArray->Reset();
+
+    TInt count = iItemArray->Count();
+
+    for (TInt index = 0; index < count; index++)
+        {
+        TInt iconType;
+        CCmBaseListItem* item = (*iItemArray)[index];
+        TUint32 fileSize = item->Size();
+        HBufC* fileSizeStr = NULL;
+        HBufC* primaryText = HBufC::NewLC( KMaxDataTypeLength );
+        HBufC* secondaryText = HBufC::NewLC( KMaxDataTypeLength );
+
+        switch ( iMediaType )
+            {
+            case ECmVideo:
+            // fall through
+            case ECmOtherVideo:
+                {
+                iconType = EIconVideo;
+                break;
+                }
+            case ECmImage:
+            // fall through
+            case ECmOtherImage:
+                {
+                iconType = EIconImage;
+                break;
+                }
+            case ECmAudio:
+                {
+                iconType = EIconAudio;
+
+                secondaryText->Des().Copy( item->SecondaryText() );
+                break;
+                }
+            default:
+                {
+                iconType = EIconVideo;
+                break;
+                }
+            }
+
+        // Set item secondary text
+        if ( fileSize < KMega )
+            {
+            if ( secondaryText->Length() )
+                {
+                secondaryText->Des().Append( KDelimiter);
+                }
+
+            fileSizeStr = StringLoader::LoadLC(
+                                  R_MS_FILE_SIZE_KB, fileSize / KKilo );
+            }
+        else
+            {
+            if ( secondaryText->Length() )
+                {
+                secondaryText->Des().Append( KDelimiter );
+                }
+
+            TReal size( 0 );
+            Math::Round( size, TReal( fileSize ) / KMega, 0 );
+            fileSizeStr = StringLoader::LoadLC(
+                                  R_MS_FILE_SIZE_MB, size );
+            }
+
+        secondaryText->Des().Append( *fileSizeStr );
+        if ( fileSizeStr )
+            {
+            CleanupStack::PopAndDestroy( fileSizeStr );
+            }
+
+        // do number conversion
+        TPtr ptr = secondaryText->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+        // add item
+        AppendItemToListBoxArrayL(
+                            iListBox,
+                            iListBox->Model(),
+                            iconType, // default icon
+                            (*iItemArray)[index]->PrimaryText(),
+                            *secondaryText );
+        CleanupStack::PopAndDestroy( secondaryText );
+        CleanupStack::PopAndDestroy( primaryText );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::SetCurrentFileStatus
+// --------------------------------------------------------------------------
+//
+void CMSItemBrowser::SetFileStatus( TInt aIndex,
+                                           TCmListItemStatus aStatus )
+    {
+    LOG(_L("[MediaServant]\t CMSItemBrowser::SetFileStatus"));
+
+    (*iItemArray)[aIndex]->SetStatus( aStatus );
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::GetCurrentFileStatus
+// --------------------------------------------------------------------------
+//
+TCmListItemStatus CMSItemBrowser::FileStatus( TInt aIndex )
+    {
+    LOG(_L("[MediaServant]\t CMSItemBrowser::FileStatus"));
+
+    return (*iItemArray)[ aIndex ]->Status();
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::ListBox()
+// Returns listbox
+// --------------------------------------------------------------------------
+//
+CEikListBox* CMSItemBrowser::ListBox()
+    {
+    return iListBox;
+    }
+
+// --------------------------------------------------------------------------
+// CMSItemBrowser::SizeChanged()
+// Called by framework when the view size is changed.
+// --------------------------------------------------------------------------
+//
+void CMSItemBrowser::SizeChanged()
+    {
+    // container control resize code.
+    if ( iListBox )
+        {
+        iListBox->SetRect( Rect() ); // Set rectangle of listbox.
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msmaincontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1453 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSMainContainer class implementation
+*
+*/
+
+
+
+#include <AknIconArray.h>
+#include <mediaservant.rsg>
+#include <mediaservant.mbg>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+
+#include "mserv.hlp.hrh"
+#include "cmfillrule.h"
+#include "msappui.h"
+#include "msmainview.h"
+#include "mediaservantuid.h"
+#include "msmaincontainer.h"
+#include "msengine.h"
+#include "msconstants.h"
+#include "msdebug.h"
+
+// Constants
+const TInt KTimerInterval = 60000000; // 1 min
+const TInt KNaviTimerInterval = 2000000; // 2 sec
+
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::CMSMainContainer()
+// --------------------------------------------------------------------------
+//
+CMSMainContainer::CMSMainContainer( CMSAppUi& aAppUi,
+                                    CMSMainView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::CMSMainContainer"));
+
+    iAppUi = &aAppUi;
+    iView = &aView;
+    iAppWizardRun = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::~CMSMainContainer()
+// --------------------------------------------------------------------------
+//
+CMSMainContainer::~CMSMainContainer()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::~CMSMainContainer"));
+
+    if( iPeriodic )
+        {
+        iPeriodic->Cancel();
+        }
+    delete iPeriodic;
+
+    if( iNaviTimer )
+        {
+        iNaviTimer->Cancel();
+        }    
+    delete iNaviTimer;
+    
+    if( iUpdateList )
+        {
+        iUpdateList->Cancel();
+        }
+    delete iUpdateList;
+
+    if( iMSPropertyWatcher )
+        {
+        iMSPropertyWatcher->Stop();
+        }
+    delete iMSPropertyWatcher;
+
+    if( iMemoryCardMonitor )
+        {
+        iMemoryCardMonitor->Cancel();
+        }
+    delete iMemoryCardMonitor;
+
+    delete iListBox; // Deletes listbox object.
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::ConstructL( TRect aRect )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::ConstructL"));
+
+    // Create property watcher for progress info
+    iMSPropertyWatcher = CMSPropertyWatcher::NewL();
+    // view will observe changes in property
+    iMSPropertyWatcher->SetObserver(this);
+
+    //create a mmc monitor to capture mmc event
+    RFs& systemFs = CEikonEnv::Static()->FsSession();
+    iMemoryCardMonitor = CMSMemoryCardMonitor::NewL( this, systemFs );
+    iMemoryCardMonitor->StartMonitor();
+
+    CreateWindowL();
+
+    iListBox = new (ELeave) CAknDoubleLargeStyleListBox;
+
+    SetListBoxFromResourceL(iListBox, R_MAIN_VIEW_LISTBOX);
+
+    // Create icons
+    CAknIconArray* icons = new (ELeave) CAknIconArray( EIconCount );
+    CleanupStack::PushL( icons );
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName() );
+
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_sync,
+                        EMbmMediaservantQgn_mserv_sync_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_sync_stop,
+                        EMbmMediaservantQgn_mserv_sync_stop_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_to_home,
+                        EMbmMediaservantQgn_mserv_to_home_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_to_home_inactive,
+                        EMbmMediaservantQgn_mserv_to_home_inactive_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_from_home,
+                        EMbmMediaservantQgn_mserv_from_home_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        KMSMifFileName,
+                        KAknsIIDDefault,
+                        EMbmMediaservantQgn_mserv_from_home_inactive,
+                        EMbmMediaservantQgn_mserv_from_home_inactive_mask );
+
+    iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(icons);
+
+    CleanupStack::Pop(icons);
+
+    // Container is listbox observer
+    iListBox->SetListBoxObserver( this );
+    // Set engine observer
+    iAppUi->MSEngine()->SetObserver( this );
+
+    SetRect(aRect);
+
+    // Check if automatic sync/harvest is ongoing
+    TCmServerState state;
+    iAppUi->MSEngine()->ServerState( state );
+    if ( state == ECmServerStateStoring ||
+         state == ECmServerStateFilling ||
+         state == ECmServerStateSearchingForServers )
+        {
+        iSyncRunning = ESyncRunning;
+         }
+
+    if ( state == ECmServerStateHarvesting )
+        {
+        iRefreshRunning = ETrue;
+        }
+
+    // From home secondary item text depends list selections
+    iFillListSelected = CheckIfFillListSelected();
+    
+    // Add data to listbox
+    UpdateListBoxDataL();
+
+    if ( iSyncRunning != ESyncRunning &&
+         iRefreshRunning == EFalse &&
+         state != ECmServerStateDeleting )
+        {
+        // Set last sync time to navi pane
+        SetNaviTextLastSyncL();
+        }
+
+    // Delete may be in progress so we have to inform user
+    if ( state == ECmServerStateDeleting )
+        {
+        HBufC* naviText = StringLoader::LoadLC( R_MS_PREPROCESSING_TEXT );
+        iView->SetNavigationPaneTextL( *naviText );
+        CleanupStack::PopAndDestroy( naviText );
+        }
+
+    // start listening property
+    iMSPropertyWatcher->StartL();
+
+    //Set current item
+    iListBox->SetCurrentItemIndex(
+                        iAppUi->ParameterAgent()->MainViewFocusIndex() );
+    
+    // Start timer for last sync time reading
+    iPeriodic = CPeriodic::NewL(CActive::EPriorityIdle);
+    iPeriodic->Start( 0, KTimerInterval, TCallBack(TimerCallbackL,this) );
+
+    // create navi text timer - don't start
+    iNaviTimer = CPeriodic::NewL( CActive::EPriorityIdle );
+    
+    iUpdateList = CIdle::NewL( CActive::EPriorityIdle );
+    
+    ActivateL(); // Activates window. ( Ready to draw )
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::CountComponentControls()
+// Returns number of components.
+// --------------------------------------------------------------------------
+//
+TInt CMSMainContainer::CountComponentControls() const
+    {
+    return 1; // return number of controls inside this container
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::ComponentControl()
+// Returns pointer to particular component.
+// --------------------------------------------------------------------------
+//
+CCoeControl* CMSMainContainer::ComponentControl( TInt aIndex ) const
+
+    {
+    CCoeControl* retval = NULL;
+    switch ( aIndex )
+        {
+        case 0:
+            {
+            retval = iListBox; // return a pointer to the listbox
+            break;
+            }
+        default:
+            {
+            retval = NULL;
+            break;
+            }
+        }
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::OfferKeyEventL()
+// Handles the key events.
+// --------------------------------------------------------------------------
+//
+TKeyResponse CMSMainContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::OfferKeyEventL"));
+
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if ( aType != EEventKey )
+        {
+        response =  EKeyWasNotConsumed;
+        }
+
+    if ( iListBox )
+        {
+        response = iListBox->OfferKeyEventL( aKeyEvent, aType );
+        }
+
+    iView->SetCbaL( iListBox->CurrentItemIndex() );
+
+    return response;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::OpenSelectedListboxItemL
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::OpenSelectedListboxItemL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::OpenSelectedListboxItemL"));
+    
+    HandleListBoxEventL( NULL, EEventEnterKeyPressed );
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::HandleListBoxEventL()
+// Handles listbox event.
+// --------------------------------------------------------------------------
+void CMSMainContainer::HandleListBoxEventL(
+    CEikListBox* /*aListBox*/,
+    TListBoxEvent aEventType )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::HandleListBoxEventL"));
+
+    if ( ( aEventType == MEikListBoxObserver::EEventEnterKeyPressed ) ||
+         ( aEventType == MEikListBoxObserver::EEventItemClicked ) )
+        {
+        TInt selected = iListBox->CurrentItemIndex();
+
+        switch ( selected )
+            {
+            case EStoreAndFill:
+                {
+                // refresh is not active
+                if ( !iRefreshRunning )
+                    {
+                    if ( iSyncRunning == ESyncNotRunning )
+                        {
+                        StartSyncL();
+                        }
+                    else
+                        {
+                        // Cancel current asyncronous operation
+                        iAppUi->MSEngine()->StopOperation();
+                        iSyncRunning = ESyncNotRunning;
+                        iView->ClearCurrentNaviPaneText();
+                        UpdateListBoxDataL();
+                        }
+                    }
+                 // refresh is ongoing
+                 else
+                    {
+                    if ( iSyncRunning == ESyncWaiting )
+                        {
+                        iSyncRunning = ESyncNotRunning;
+                        }
+                    else
+                        {
+                        iSyncRunning = ESyncWaiting;
+                        }
+                    UpdateListBoxDataL();
+                    }
+
+                break;
+                }
+            case EStoreToNetwork:
+                {
+                if ( !iRefreshRunning && 
+                     !iSyncRunning && 
+                     !iPreprocessRunning )
+                    {
+                    iAppUi->ChangeViewL( KMSMainViewId,
+                                         KMSStoreListViewId );
+                    }
+                else
+                    {
+                    TInt noteId = ( iRefreshRunning || iPreprocessRunning ?
+                                    R_MS_ACCESS_ERROR_NOTE : 
+                                    R_MS_ACCESS_ERROR_NOTE_SYNC );
+                    ShowErrorNoteL( noteId );
+                    }
+                break;
+                }
+            case EFillToPhone:
+                {
+                if ( iAppUi->DriveSelectedL() )
+                    {
+                    if ( !iRefreshRunning &&
+                         !iSyncRunning &&
+                         !iPreprocessRunning )
+                        {
+                        iAppUi->ChangeViewL( KMSMainViewId, KMSFillViewId );
+                        }
+                    else
+                        {
+                        TInt noteId = ( iRefreshRunning ||
+                                        iPreprocessRunning ?
+                                        R_MS_ACCESS_ERROR_NOTE : 
+                                        R_MS_ACCESS_ERROR_NOTE_SYNC );
+                        ShowErrorNoteL( noteId );
+                        }
+                    }
+                else
+                    {
+                    ShowErrorNoteL( R_MS_INSERT_MEMORY_CARD_TEXT );
+                    }
+                break;
+                }
+            default:
+                {
+                LOG(_L("[MediaServant]\t CMSMainContainer::\
+                HandleListBoxEventL no item selected"));
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::UpdateListBoxDataL()
+// Updates listbox texts
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::UpdateListBoxDataL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::UpdateListBoxDataL"));
+
+    TCmServerState state;
+    iAppUi->MSEngine()->ServerState( state );
+
+    CDesCArray* itemArray = static_cast<CDesCArray*>
+                                        (iListBox->Model()->ItemTextArray());
+
+    if ( itemArray->Count() )
+        {
+        // delete all listbox items
+        itemArray->Reset();
+        }
+
+
+    // Get file counts and sync time
+    TInt itemsToBeStored( 0 );
+    TInt itemsToBeFilled( 0 );
+    TInt syncTime( 0 );
+    TInt syncTimeStore( 0 );
+    TInt syncTimeFill( 0 );
+
+    iAppUi->MSEngine()->GetTransferInfo( ECmServiceStore,
+                                         itemsToBeStored,
+                                         syncTimeStore );
+
+    iAppUi->MSEngine()->GetTransferInfo( ECmServiceFill,
+                                         itemsToBeFilled,
+                                         syncTimeFill );
+
+    syncTime = syncTimeStore + syncTimeFill;
+
+    // Create item strings
+    HBufC* primaryText = NULL;
+    HBufC* secondaryText = NULL;
+    TInt icon = EIconSync;
+
+    switch ( iSyncRunning )
+        {
+        default:
+        // fall trough
+        case ESyncNotRunning:
+            {
+            primaryText = StringLoader::LoadLC( R_MAIN_SYNC_NOW_TEXT );
+
+            if ( itemsToBeStored > 0 || itemsToBeFilled > 0)
+                {
+                if ( syncTime/60 > 1 ) // 1 minute
+                    {
+                    secondaryText = StringLoader::LoadLC(
+                                                    R_MS_SYNC_TIME_TEXT,
+                                                    syncTime/60 );
+                    // do number conversion
+                    TPtr ptr = secondaryText->Des();
+                    AknTextUtils::
+                        DisplayTextLanguageSpecificNumberConversion( ptr );
+                    }
+                else
+                    {
+                    secondaryText = StringLoader::LoadLC(
+                                               R_MS_SYNC_TIME_ONE_MIN_TEXT );
+                    }
+
+                }
+            break;
+            }
+        case ESyncRunning:
+            {
+            primaryText = StringLoader::LoadLC( R_MAIN_STOP_SYNC_TEXT );
+            icon = EIconSyncStop;
+            break;
+            }
+        case ESyncWaiting:
+            {
+            primaryText = StringLoader::LoadLC( R_MAIN_STOP_SYNC_TEXT );
+            secondaryText = StringLoader::LoadLC( R_MS_SYNC_WAITING_TEXT );
+            icon = EIconSyncStop;
+            break;
+            }
+        }
+
+    AppendItemToListBoxArrayL( iListBox,
+                               iListBox->Model(),
+                               icon,
+                               *primaryText,
+                               *secondaryText );
+
+    if ( secondaryText )
+        {
+        CleanupStack::PopAndDestroy( secondaryText );
+        secondaryText = NULL;
+        }
+
+    if ( primaryText )
+        {
+        CleanupStack::PopAndDestroy( primaryText );
+        primaryText = NULL;
+        }
+
+
+    // From Home -item
+    primaryText = StringLoader::LoadLC( R_MAIN_FROM_HOME_TEXT );
+
+    TBool driveSelected = iAppUi->DriveSelectedL();
+
+    if ( driveSelected == EFalse )
+        {
+        secondaryText = StringLoader::LoadLC( R_MS_MEMORY_CARD_NEEDED_TEXT );
+        }
+    else if ( !iFillListSelected )
+        {
+        secondaryText = StringLoader::LoadLC( R_MS_LIST_NOTHING_SELECTED );
+        }        
+    else if ( itemsToBeFilled <= 0 )
+        {
+        secondaryText = StringLoader::LoadLC( R_MS_ALL_IN_SYNC_TEXT );
+        }
+
+    if ( iRefreshRunning ||
+         iPreprocessRunning ||
+         iSyncRunning == ESyncRunning ||
+         driveSelected == EFalse )
+        {
+        AppendItemToListBoxArrayL( iListBox,
+                                   iListBox->Model(),
+                                   EIconFromHomeInactive,
+                                   *primaryText,
+                                   *secondaryText );
+        }
+    else
+        {
+        AppendItemToListBoxArrayL( iListBox,
+                                   iListBox->Model(),
+                                   EIconFromHome,
+                                   *primaryText,
+                                   *secondaryText );
+        }
+
+    if ( secondaryText )
+        {
+        CleanupStack::PopAndDestroy( secondaryText );
+        secondaryText = NULL;
+        }
+
+    CleanupStack::PopAndDestroy( primaryText );
+    primaryText = NULL;
+
+    // To Home -item
+    primaryText = StringLoader::LoadLC( R_MAIN_TO_HOME_TEXT );
+
+    if ( itemsToBeStored < 1 )
+        {
+        secondaryText = StringLoader::LoadLC( R_MS_ALL_IN_SYNC_TEXT );
+        }
+    else if ( itemsToBeStored == 1 )
+        {
+        secondaryText = StringLoader::LoadLC( R_MS_SYNC_ONE_NEW_ITEM_TEXT );
+        }
+    else // > 1      
+        {
+        secondaryText = StringLoader::LoadLC( R_MS_SYNC_NEW_ITEMS_TEXT,
+                                              itemsToBeStored );
+        // do number conversion
+        TPtr ptr = secondaryText->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+        }
+
+    if ( iRefreshRunning ||
+         iPreprocessRunning ||
+         iSyncRunning == ESyncRunning )
+        {
+        AppendItemToListBoxArrayL( iListBox,
+                                   iListBox->Model(),
+                                   EIconToHomeInactive,
+                                   *primaryText,
+                                   *secondaryText );
+        }
+    else
+        {
+        AppendItemToListBoxArrayL( iListBox,
+                                   iListBox->Model(),
+                                   EIconToHome,
+                                   *primaryText,
+                                   *secondaryText );
+        }
+
+    if ( secondaryText )
+        {
+        CleanupStack::PopAndDestroy( secondaryText );
+        secondaryText = NULL;
+        }
+
+    CleanupStack::PopAndDestroy( primaryText );
+    primaryText = NULL;
+
+
+    iListBox->DrawNow();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::ReadyL()
+// engine observer callback
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::ReadyL( TCmService aService, TInt aError )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL"));
+
+    // Clears navi pane
+    iView->ClearCurrentNaviPaneText();
+
+    if( aError == KErrNotFound )
+        {
+        ShowErrorNoteL( R_MS_ERROR_DEVICES_NOT_FOUND );
+        }
+    else if( aError == KErrGeneral )
+        {
+        ShowErrorNoteL( R_MS_ERROR_SYNC_INTERRUPTED );
+        }
+    else if( aError == KErrDiskFull )
+        {
+        ShowErrorNoteL( R_MS_ERROR_MEMORY_FULL );
+        }		
+    else if ( aError && aError != KErrCancel )
+        {
+#ifdef __DEBUG
+        ShowNoteL( R_ACTIVE_ERROR_NOTE_TEXT, aError );
+#endif        
+        iRefreshRunning = EFalse;
+        iSyncRunning = ESyncNotRunning;
+        }
+
+    switch ( aService )
+        {
+        case ECmServiceDeleteMetadata:
+            {
+            iAppUi->MSEngine()->DeleteDeletedMediaserversL();
+            // start harvest
+            iAppUi->MSEngine()->ScanMediaServersL();
+            break;
+            }
+        case ECmServiceHarvest:
+            {
+            if( iAppWizardRun )
+                {
+                LOG(_L("[MediaServant]\t CMSMainContainer::\
+                ReadyL, HARVEST (Wizard)"));
+
+                // refreshes also fill rules
+                iAppUi->RefreshListsL();
+                
+                // "From home" secondary item text depends list selections
+                // must be read here again because list selections change
+                // after wizard run
+                iFillListSelected = CheckIfFillListSelected();
+                
+                if ( iRefreshRunning && iSyncRunning == ESyncWaiting )
+                    {
+                    StartSyncL();
+                    iRefreshRunning = EFalse;
+                    }
+
+                iRefreshRunning = EFalse;
+                iAppWizardRun = EFalse;
+                LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL, \
+                START PRE PRO"));
+                
+                // show navi pane text for 2 seconds
+                ShowRefreshCompleteTextL();
+                iNaviTimer->Start( KNaviTimerInterval,
+                                  KNaviTimerInterval,
+                                  TCallBack( NaviTimerCallbackL, this ) );
+                break;
+                }
+            else
+                {
+                if ( iRefreshRunning && iSyncRunning == ESyncWaiting )
+                    {
+                    StartSyncL();
+                    iRefreshRunning = EFalse;
+                    }
+                else
+                    {
+                    iRefreshRunning = EFalse;
+                    // refreshes also fill rules and store item
+                    iAppUi->RefreshListsL();
+                    
+                    // show navi pane text for 2 seconds
+                    ShowRefreshCompleteTextL();
+                    iNaviTimer->Start( KNaviTimerInterval,
+                                     KNaviTimerInterval,
+                                     TCallBack( NaviTimerCallbackL, this ) );
+                    }
+                }
+            break;
+            }
+
+        case ECmServiceFill:
+        // fall trough
+        case ECmServiceStore:
+            {
+            iSyncRunning = ESyncNotRunning;
+            SetNaviTextLastSyncL();
+            iAppUi->RefreshListsL();
+            break;
+            }
+
+        case ECmServicePreProcessingStore:
+            {
+            LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL, \
+            PRE PRO STORE"));
+
+            if ( iSyncRunning == ESyncWaiting )
+                {
+                StartSyncL();
+                }
+
+            iPreprocessRunning = EFalse;
+            iAppUi->RefreshListsL();
+            break;
+            }
+        case ECmServicePreProcessingFill:
+            {
+            LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL, \
+            PRE PRO FILL"));
+
+            // Set last sync time to navi pane
+            SetNaviTextLastSyncL();
+
+            iPreprocessRunning = EFalse;
+            break;
+            }
+
+        case ECmServiceDeleteFilledFiles:
+            {
+            // Set last sync time to navi pane
+            SetNaviTextLastSyncL();
+            break;
+            }
+
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL \
+            service not found"));
+            break;
+            }
+        }
+
+    UpdateListBoxDataL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::PropertyChangedL
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::PropertyChangedL( TCmService aService,
+                                    TInt aTotalItems,
+                                    TInt aProcessedItems,
+                                    TInt /*aItemsToBeProcessed*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::PropertyChangedL"));
+
+    switch ( aService )
+        {
+        case ECmServiceHarvest:
+            {
+            // Launching propertywatcher causes unwanted call of observer
+            // (server previous state is returned
+            // We want to show progress only when refresh is truly running
+            if ( iRefreshRunning )
+                {
+                TInt value( 0 );
+                if ( aTotalItems > 0 )
+                    {
+                    value = (TReal(aProcessedItems)/TReal(aTotalItems))*100;
+                    }
+
+                HBufC* progress = StringLoader::LoadLC(
+                                   R_MS_NAVI_REFRESHING_TEXT, value );
+
+                // do number conversion
+                TPtr ptr = progress->Des();
+                AknTextUtils::
+                    DisplayTextLanguageSpecificNumberConversion( ptr );
+
+                // update navi pane
+                iView->SetNavigationPaneTextL( *progress );
+                CleanupStack::PopAndDestroy( progress );
+                }
+            break;
+            }
+        case ECmServiceStore:
+        // fall through
+        case ECmServiceFill:
+            {
+            if ( aTotalItems > 0 && aProcessedItems > 0 )
+                {
+                // calculate procentual value
+                TInt value = (TReal(aProcessedItems)/TReal(aTotalItems))*100;
+                HBufC* progress = StringLoader::LoadLC(
+                                   R_MS_NAVI_SYNC_TEXT, value );
+
+                // do number conversion
+                TPtr ptr = progress->Des();
+                AknTextUtils::
+                    DisplayTextLanguageSpecificNumberConversion( ptr );
+
+                // update navi pane
+                iView->SetNavigationPaneTextL( *progress );
+                CleanupStack::PopAndDestroy( progress );
+                }
+            break;
+            }
+        case ECmServiceNone:
+            {
+            iSyncRunning = ESyncNotRunning;
+            iRefreshRunning = EFalse;
+            if ( iNaviTimer && !iNaviTimer->IsActive() )
+                {
+                SetNaviTextLastSyncL();    
+                }
+            
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSMainContainer::PropertyChangedL \
+            service not found"));
+            }
+        }
+    
+    if ( iUpdateList && !iUpdateList->IsActive() )
+        {
+        iCurStep = EFirstStep;
+        iRequestCt = 1;
+        iUpdateList->Start( TCallBack( BackgroundUpdateListL, this ) );
+        }
+    else
+        {
+        iRequestCt++;
+        LOG(_L("[MediaServant]\t S.L add to queue"));
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::SetManualWizardInfo
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::SetManualWizardInfo( TBool aAppWizardRun )
+    {
+    iAppWizardRun = aAppWizardRun;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::ShowRefreshIndicationL
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::ShowRefreshIndicationL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::ShowRefreshIndicationL"));
+
+    iRefreshRunning = ETrue;
+    // Start 0 %
+    HBufC* naviText = StringLoader::LoadLC(
+                                  R_MS_NAVI_REFRESHING_TEXT, 0 );
+
+    // do number conversion
+    TPtr ptr = naviText->Des();
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+    iView->SetNavigationPaneTextL( *naviText );
+    CleanupStack::PopAndDestroy( naviText );
+
+    UpdateListBoxDataL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::StopRefreshL
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::StopRefreshL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::StopRefreshL"));
+
+    iRefreshRunning = EFalse;
+    iSyncRunning = ESyncNotRunning;
+    iAppUi->FillRuleController()->UpdateArrayL();
+    UpdateListBoxDataL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::StartSyncL
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::StartSyncL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::StartSync"));
+
+    iSyncRunning = ESyncRunning;
+    TInt error = iAppUi->MSEngine()->ExecuteSyncL();
+
+    if ( !error )
+        {
+        UpdateListBoxDataL();
+
+        // set progress to 0%
+        HBufC* progress = StringLoader::LoadLC(
+                                       R_MS_NAVI_SYNC_TEXT, 0 );
+
+        // do number conversion
+        TPtr ptr = progress->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+        iView->SetNavigationPaneTextL( *progress );
+        CleanupStack::PopAndDestroy( progress );
+        }
+    else
+        {
+        iSyncRunning = ESyncNotRunning;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::StartMetadataDeleteL
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::StartMetadataDeleteL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::StartMetadataDeleteL"));
+
+    iAppUi->MSEngine()->DeleteMetadataL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::SelectedItemIndex
+// returns current item index
+// --------------------------------------------------------------------------
+//
+TInt CMSMainContainer::SelectedItemIndex()
+    {
+    return iListBox->CurrentItemIndex();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::ShowErrorNoteL
+// Shows error note
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::ShowErrorNoteL( TInt aTextResource )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::ShowErrorNoteL"));
+    
+    HBufC* errorText = StringLoader::LoadLC( aTextResource );
+    CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote();
+    dlg->ExecuteLD( *errorText );
+    CleanupStack::PopAndDestroy( errorText );
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::SetNaviTextLastSyncL
+// Sets last synchronization time to navi pane
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::SetNaviTextLastSyncL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::SetNaviTextLastSyncL"));
+    
+    TTimeIntervalMinutes syncMinutes;
+    TTimeIntervalHours syncHours;
+    TTimeIntervalDays syncDays;
+
+    TTime lastSync = iAppUi->MSEngine()->LastSyncTime();
+
+    if ( lastSync.Int64() > 0 )
+        {
+        // Get current time
+        TTime time;
+        time.HomeTime();
+
+        time.MinutesFrom( lastSync, syncMinutes );
+        time.HoursFrom( lastSync, syncHours );
+        syncDays = time.DaysFrom( lastSync );
+
+
+        HBufC* naviText = NULL;
+
+        TInt days = syncDays.Int();
+        TInt hours = syncHours.Int();            
+        TInt mins = syncMinutes.Int();            
+        if ( days > 0 )
+            {
+            naviText = ( days == 1 ? StringLoader::LoadLC(
+                                    R_MS_LAST_SYNC_DAY ) :
+                                     StringLoader::LoadLC(
+                                    R_MS_LAST_SYNC_DAYS, days ));
+            }        
+        else if ( hours > 0 )
+            {
+            naviText = ( hours == 1 ? StringLoader::LoadLC(
+                                    R_MS_LAST_SYNC_HOUR ) :
+                                     StringLoader::LoadLC(
+                                    R_MS_LAST_SYNC_HOURS, hours ));
+            }          
+        else if ( mins > 0 )
+            {
+            naviText = ( mins == 1 ? StringLoader::LoadLC(
+                                   R_MS_LAST_SYNC_MIN ) :
+                                     StringLoader::LoadLC(
+                                   R_MS_LAST_SYNC_MINS, mins ));
+            }
+        else
+            {
+            // do nothing - leave navi pane empty
+            }
+
+        if ( naviText )
+            {
+            // do number conversion
+            TPtr ptr = naviText->Des();
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+            iView->SetNavigationPaneTextL( *naviText );
+            CleanupStack::PopAndDestroy( naviText );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::SizeChanged()
+// Called by framework when the view size is changed.
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::SizeChanged()
+    {
+    // container control resize code.
+    if ( iListBox )
+        {
+        iListBox->SetRect( Rect() ); // Set rectangle of listbox.
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::HandleResourceChange
+// Handles layout change
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::HandleResourceChange( TInt aType )
+    {
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect( iView->ClientRect() );
+        }
+
+    CCoeControl::HandleResourceChange( aType );
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::TimerCallbackL()
+// Periodic timer callback
+// --------------------------------------------------------------------------
+//
+TInt CMSMainContainer::TimerCallbackL(TAny* aObject)
+    {        
+    CMSMainContainer* mainContainer =
+                            static_cast<CMSMainContainer*>(aObject);
+    TCmServerState state;
+    mainContainer->iAppUi->MSEngine()->ServerState( state );
+    if ( state == ECmServerStateIdle )
+        {
+        mainContainer->SetNaviTextLastSyncL();
+        }
+    return 0;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::NaviTimerCallbackL()
+// --------------------------------------------------------------------------
+//
+TInt CMSMainContainer::NaviTimerCallbackL(TAny* aObject)
+    {        
+    CMSMainContainer* mainContainer =
+                            static_cast<CMSMainContainer*>(aObject);
+    TCmServerState state;
+    mainContainer->iAppUi->MSEngine()->ServerState( state );
+    
+    // Clear old text
+    mainContainer->iView->ClearCurrentNaviPaneText();
+    
+    if ( state == ECmServerStateIdle )
+        {
+        mainContainer->SetNaviTextLastSyncL();
+        }
+    
+    mainContainer->iNaviTimer->Cancel();
+    
+    return 0;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSMainContainer::BackgroundUpdateListL
+// Static callback method for update list box data
+// --------------------------------------------------------------------------
+//
+TInt CMSMainContainer::BackgroundUpdateListL( TAny* aObject )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::BackgroundUpdateListL"));
+    TInt reslt = ( ( CMSMainContainer* )aObject )->UpdateListByStepL();
+    return reslt;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::UpdateListByStepL
+// Update list box data steps
+// --------------------------------------------------------------------------
+//
+TInt CMSMainContainer::UpdateListByStepL()
+    {
+    TRACE(Print(_L("[MediaServant]\t CMSMainContainer:UpdateListByStepL \
+        step: %d %d"), iCurStep, iUpdateList->IsActive()));
+
+    // Get file counts and sync time
+    static TInt staItemsToBeStored( 0 );
+    static TInt staItemsToBeFilled( 0 );
+    static TInt staSyncTime( 0 );
+    static TInt staSyncTimeStore( 0 );
+    static TInt staSyncTimeFill( 0 );
+    static TBool staDriveSelected( ETrue );
+
+    switch ( iCurStep )
+        {
+        case EFirstStep:
+            {
+            iAppUi->MSEngine()->GetTransferInfo( ECmServiceStore,
+                                                 staItemsToBeStored,
+                                                 staSyncTimeStore );
+            break;
+            }
+        case ESecondStep:
+            {
+            iAppUi->MSEngine()->GetTransferInfo( ECmServiceFill,
+                                                 staItemsToBeFilled,
+                                                 staSyncTimeFill );
+            break;
+            }
+        case EThirdStep:
+            {
+            staDriveSelected = iAppUi->DriveSelectedL();
+            break;
+            }
+        case EForthStep:
+        //fall through
+        default:
+            {
+            TInt icon = EIconSync;
+            // Create item strings
+            HBufC* primaryText = NULL;
+            HBufC* secondaryText = NULL;
+            
+            CDesCArray* itemArray = static_cast<CDesCArray*>
+                                        (iListBox->Model()->ItemTextArray());
+            if ( itemArray->Count() )
+                {
+                // delete all listbox items
+               itemArray->Reset();
+                }
+            staSyncTime = staSyncTimeStore + staSyncTimeFill;
+            //home-sync item
+            switch ( iSyncRunning )
+                {
+                default:
+                // fall trough
+                case ESyncNotRunning:
+                    {
+                    primaryText = StringLoader::LoadLC(
+                                      R_MAIN_SYNC_NOW_TEXT );
+                    if ( staItemsToBeStored > 0 || staItemsToBeFilled > 0 )
+                        {
+                        if ( staSyncTime/60 > 1 ) // 1 minute
+                            {
+                            secondaryText = StringLoader::LoadLC(
+                                                R_MS_SYNC_TIME_TEXT,
+                                                staSyncTime/60 );
+                            // do number conversion
+                            TPtr ptr = secondaryText->Des();
+                            AknTextUtils::
+                               DisplayTextLanguageSpecificNumberConversion( ptr );
+                            }
+                        else
+                            {
+                            secondaryText = StringLoader::LoadLC(
+                                                R_MS_SYNC_TIME_ONE_MIN_TEXT );
+                            }
+                        }
+                    break;
+                    }
+                case ESyncRunning:
+                    {
+                    primaryText = StringLoader::LoadLC(
+                                      R_MAIN_STOP_SYNC_TEXT );
+                    icon = EIconSyncStop;
+                    break;
+                    }
+                case ESyncWaiting:
+                    {
+                    primaryText = StringLoader::LoadLC( 
+                                      R_MAIN_STOP_SYNC_TEXT );
+                    secondaryText = StringLoader::LoadLC(
+                                        R_MS_SYNC_WAITING_TEXT );
+                    icon = EIconSyncStop;
+                    break;
+                    }
+                }
+            AppendItemToListBoxArrayL( iListBox,
+                                       iListBox->Model(),
+                                       icon,
+                                       *primaryText,
+                                       *secondaryText );
+
+            if ( secondaryText )
+                {
+                CleanupStack::PopAndDestroy( secondaryText );
+                secondaryText = NULL;
+                }
+
+            if ( primaryText )
+                {
+                CleanupStack::PopAndDestroy( primaryText );
+                primaryText = NULL;
+                }
+            
+            // From Home -item
+            primaryText = StringLoader::LoadLC( R_MAIN_FROM_HOME_TEXT );
+            
+            if ( staDriveSelected == EFalse )
+                {
+                secondaryText = StringLoader::LoadLC( 
+                                    R_MS_MEMORY_CARD_NEEDED_TEXT );
+                }
+            else if ( !iFillListSelected )
+                {
+                secondaryText = StringLoader::LoadLC( 
+                                    R_MS_LIST_NOTHING_SELECTED );
+                }
+            else if ( staItemsToBeFilled <= 0 )
+                {
+                secondaryText = StringLoader::LoadLC( 
+                                    R_MS_ALL_IN_SYNC_TEXT );
+                }
+
+            if ( iRefreshRunning ||
+                 iPreprocessRunning ||
+                 iSyncRunning == ESyncRunning ||
+                 staDriveSelected == EFalse )
+                {
+                AppendItemToListBoxArrayL( iListBox,
+                                           iListBox->Model(),
+                                           EIconFromHomeInactive,
+                                           *primaryText,
+                                           *secondaryText );
+                }
+            else
+                {
+                AppendItemToListBoxArrayL( iListBox,
+                                           iListBox->Model(),
+                                           EIconFromHome,
+                                           *primaryText,
+                                           *secondaryText );
+                }
+
+            if ( secondaryText )
+                {
+                CleanupStack::PopAndDestroy( secondaryText );
+                secondaryText = NULL;
+                }
+
+            CleanupStack::PopAndDestroy( primaryText );
+            primaryText = NULL;
+
+            // To Home -item
+            primaryText = StringLoader::LoadLC( R_MAIN_TO_HOME_TEXT );
+          
+
+            if ( staItemsToBeStored < 1 )
+                {
+                secondaryText = StringLoader::LoadLC(
+                                            R_MS_ALL_IN_SYNC_TEXT );
+                }
+            else if ( staItemsToBeStored == 1 )
+                {
+                secondaryText = StringLoader::LoadLC(
+                                            R_MS_SYNC_ONE_NEW_ITEM_TEXT );
+                }
+            else // > 1      
+                {
+                secondaryText = StringLoader::LoadLC(
+                                            R_MS_SYNC_NEW_ITEMS_TEXT,
+                                            staItemsToBeStored );
+                // do number conversion
+                TPtr ptr = secondaryText->Des();
+                AknTextUtils::
+                    DisplayTextLanguageSpecificNumberConversion( ptr );
+                }
+
+            if ( iRefreshRunning ||
+                 iPreprocessRunning ||
+                 iSyncRunning == ESyncRunning )
+                {
+                AppendItemToListBoxArrayL( iListBox,
+                                           iListBox->Model(),
+                                           EIconToHomeInactive,
+                                           *primaryText,
+                                           *secondaryText );
+                }
+            else
+                {
+                AppendItemToListBoxArrayL( iListBox,
+                                           iListBox->Model(),
+                                           EIconToHome,
+                                           *primaryText,
+                                           *secondaryText );
+                }
+
+            if ( secondaryText )
+                {
+                CleanupStack::PopAndDestroy( secondaryText );
+                secondaryText = NULL;
+                }
+            CleanupStack::PopAndDestroy( primaryText );
+            primaryText = NULL;
+            iListBox->DrawNow();
+            break;
+            }
+        }
+    TInt theValue = ( TInt )iCurStep;
+    theValue++;
+    iCurStep = ( TMSUpdateStep )theValue;
+    
+    //complete one refresh request
+    TInt reslt( 0 );
+    if( iCurStep == EEndStep )
+        {
+        iRequestCt--;
+        if( iRequestCt )
+            {
+            iCurStep = EFirstStep;
+            }
+        //if still have request,continue
+        reslt = iRequestCt;
+        }
+    //not the last step, contiue
+    else
+        {
+        reslt = ETrue;
+        }
+    return reslt;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMainContainer::GetHelpContext
+// ---------------------------------------------------------------------------
+//
+void CMSMainContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::GetHelpContext"));
+
+    aContext.iMajor = TUid::Uid(KMediaServantUID3);
+    aContext.iContext = KMSERV_HLP_MAIN_VIEW;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::MemoryCardChangedL
+// Callback to handle mmc insert
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::MemoryCardChangedL( TMemoryCardEvent aEvent )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::MemoryCardChangedL start"));
+    switch ( aEvent )
+        {
+        case EMemoryCardInsert:
+            {
+            if( !iAppUi->DriveSelectedL() )
+                {
+                iView->CheckMemoryCardL();
+                }
+            UpdateListBoxDataL();
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSMainContainer::MemoryCardChangedL \
+            event not found"));
+            break;
+            }
+        }
+    LOG(_L("[MediaServant]\t CMSMainContainer::MemoryCardChangedL end"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::CheckIfFillListSelected
+// --------------------------------------------------------------------------
+//
+TBool CMSMainContainer::CheckIfFillListSelected()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::CheckIfFillListSelected"));
+    
+    TBool listSelected( EFalse );
+    RPointerArray<CMSFillList>* listArray =
+                        iAppUi->FillRuleController()->FillListArray();
+    
+    for ( TInt i = 0; i < listArray->Count(); i++  )
+        {
+        CCmFillRule* list = (*listArray)[i]->List();
+        if ( list->Selected() == ECmSelected )
+            {
+            listSelected = ETrue;
+            i = listArray->Count(); // break loop
+            }
+        }
+    return listSelected;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainContainer::ShowRefreshCompleteTextL
+// --------------------------------------------------------------------------
+//
+void CMSMainContainer::ShowRefreshCompleteTextL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::ShowRefreshCompleteTextL"));
+    
+    HBufC* naviText = StringLoader::LoadLC( R_MS_NAVI_CONTENT_REFRESHED );
+    iView->SetNavigationPaneTextL( *naviText );
+    CleanupStack::PopAndDestroy( naviText );    
+    }
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msmainview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,529 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSMainView class implementation
+*
+*/
+
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+#include <hlplch.h>
+#include <driveinfo.h>
+
+#include "msgspluginuids.h"
+#include "msstorelistcontroller.h"
+#include "cmsettingsfactory.h"
+#include "cmsettings.h"
+#include "cmdriveinfo.h"
+#include "msmaincontainer.h"
+#include "mediaservant.hrh"
+#include "msgsinterface.h"
+#include "msengine.h"
+#include "msconstants.h"
+#include "msmainview.h"
+#include "msappui.h"
+#include "msdebug.h"
+#include "cmsappwizard.h"
+
+
+// --------------------------------------------------------------------------
+// CMSMainView::CMSMainView()
+// --------------------------------------------------------------------------
+//
+CMSMainView::CMSMainView(CMSAppUi& aAppUi )
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::CMSMainView"));
+
+    iAppUi = &aAppUi;
+    iCheckMMC = ETrue;
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSMainView::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::ConstructL"));
+
+    BaseConstructL( R_MS_MAIN_VIEW );
+
+    TInt error( KErrNone );
+    TBool runWizard( EFalse );
+
+    // Check if wizard has been executed:
+    runWizard = iAppUi->MSEngine()->GetAppWizardState( error );
+
+    TRACE( Print(_L("[MediaServant]\t CMSMainView::ConstructL \
+                    wizard state error = %d"), error ));
+
+    if ( error == KErrNone && !runWizard )
+        {
+        // prevent user events handling
+        iWizardInitialization = ETrue;
+        iIdle = CIdle::NewL( CActive::EPriorityIdle );
+        TCallBack cb( InitializeWizardL, this );
+        iIdle->Start( cb );
+        }
+    else
+        {
+        iIdle = CIdle::NewL( CActive::EPriorityIdle );
+        TCallBack cb( InitializeMemoryCardL, this );
+        iIdle->Start( cb );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::~CMSMainView()
+// --------------------------------------------------------------------------
+//
+CMSMainView::~CMSMainView()
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::~CMSMainView"));
+
+    delete iIdle;
+
+    DoDeactivate();
+    }
+// --------------------------------------------------------------------------
+// TUid CMSMainView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CMSMainView::Id() const
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::Id"));
+
+    return KMSMainViewId;
+    }
+
+// --------------------------------------------------------------------------
+// CMSFillView::FocusIndex()
+// --------------------------------------------------------------------------
+//
+TInt CMSMainView::FocusIndex() const
+    {
+    return iContainer->SelectedItemIndex();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CMSMainView::HandleCommandL( TInt aCommand )
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::HandleCommandL"));
+
+    if ( !iWizardInitialization )
+        {
+        switch ( aCommand )
+            {
+            case EMSCmdSelect:
+            // fall through
+            case EAknCmdOpen:
+            // fall through:
+            case EAknSoftkeyOpen:
+            // fall through:
+            case EAknSoftkeySelect:
+                {
+                iContainer->OpenSelectedListboxItemL();
+                break;
+                }
+
+            case EMSCmdStartHarvest:
+                {
+                iAppUi->MSEngine()->ScanMediaServersL();
+                iContainer->ShowRefreshIndicationL();
+                break;
+                }
+
+            case EMSCmdStopHarvest:
+                {
+                // clear navi pane
+                ClearCurrentNaviPaneText();
+
+                iAppUi->MSEngine()->StopOperation();
+                iContainer->StopRefreshL();
+                break;
+                }
+
+            case EMSCmdSettings:
+                {
+                if ( iAppUi->SettingsPlugin() )
+                    {
+                    // activate plugin
+                    iAppUi->ActivateLocalViewL(
+                                iAppUi->SettingsPlugin()->Id() );
+                    }
+                break;
+                }
+            case EMSCmdRunWizard:
+                {
+                LOG(_L("[MediaServant]\t CMSMainView::\
+                        HandleCommandL WIZARD"));
+                TBool wizRetVal(KErrNone);
+                CMSAppWizard* wiz =
+                    CMSAppWizard::NewL( *iAppUi->MSEngine() );
+                CleanupStack::PushL( wiz );
+                wizRetVal = wiz->StartL();
+
+                iAppUi->RefreshListsL();
+                CleanupStack::PopAndDestroy( wiz );
+
+                if( wizRetVal != KErrNone )
+                    {
+                    // Start harvest:
+                    LOG(_L("[MediaServant]\t CMSMainView::\
+                            HandleCommandL WIZARD, Start Harvest"));
+                    iContainer->SetManualWizardInfo( ETrue );
+                    iContainer->StartMetadataDeleteL();
+                    iContainer->ShowRefreshIndicationL();
+                    }
+
+                break;
+                }
+
+            case EAknCmdHelp :
+                {
+
+                TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL(
+                            iEikonEnv->WsSession(),
+                iEikonEnv->EikAppUi()->AppHelpContextL() ));
+                break;
+                }
+
+            default:
+                {
+                AppUi()->HandleCommandL( aCommand );
+                break;
+                }
+            }
+        }
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CMSMainView::DoActivateL(...)
+// --------------------------------------------------------------------------
+//
+void CMSMainView::DoActivateL(
+   const TVwsViewId& aPrevViewId, TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::DoActivateL"));
+    if( KMSGSImplementationUid == aPrevViewId.iViewUid )
+        {
+        // Refresh store and fill rules array from server.
+        iAppUi->RefreshListsL();
+
+        CCmStoreRuleContainer* container =
+                    ( iAppUi->StoreListController() )->StoreListContainer();
+        // update the Table transferInfo
+        iAppUi->MSEngine()->SetStoreRulesL( container );
+        }
+
+    // Set title pane text to default
+    SetTitlePaneTextL( KMSDefaultTitleId );
+
+    if ( !iContainer )
+        {
+        iContainer = new (ELeave) CMSMainContainer( *iAppUi,
+                                                    *this );
+        iContainer->ConstructL( ClientRect() );
+        iContainer->SetMopParent( this );
+        AppUi()->AddToViewStackL( *this, iContainer );
+        }
+   }
+
+// --------------------------------------------------------------------------
+// CMSMainView::DoDeactivate()
+// --------------------------------------------------------------------------
+//
+void CMSMainView::DoDeactivate()
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::DoDeactivate"));
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        }
+
+    delete iContainer; // Deletes the container class object.
+    iContainer = NULL;
+
+    ClearCurrentNaviPaneText();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+void CMSMainView::DynInitMenuPaneL( TInt aResourceId,
+                                         CEikMenuPane* aMenuPane)
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::DynInitMenuPaneL"));
+
+    TCmServerState state;
+
+    if (aResourceId == R_MAIN_VIEW_MENU )
+        {
+        iAppUi->MSEngine()->ServerState( state );
+
+        switch ( state )
+            {
+            case ECmServerStateHarvesting:
+                {
+                aMenuPane->SetItemDimmed(EMSCmdStartHarvest, ETrue);
+                aMenuPane->SetItemDimmed(EMSCmdSettings, ETrue);
+                aMenuPane->SetItemDimmed(EMSCmdRunWizard, ETrue);
+                break;
+                }
+            case ECmServerStateDeleting:
+            // fall through
+            case ECmServerStateFilling:
+            // fall through
+            case ECmServerStateStoring:
+            // fall through
+            case ECmServicePreProcessingStore:
+            // fall through
+            case ECmServicePreProcessingFill:
+                {
+                aMenuPane->SetItemDimmed(EMSCmdStartHarvest, ETrue);
+                aMenuPane->SetItemDimmed(EMSCmdStopHarvest, ETrue);
+                aMenuPane->SetItemDimmed(EMSCmdSettings, ETrue);
+                aMenuPane->SetItemDimmed(EMSCmdRunWizard, ETrue);
+                break;
+                }
+            default:
+                {
+                aMenuPane->SetItemDimmed(EMSCmdStopHarvest, ETrue);
+                }
+            }
+
+        // sync item highlighted
+        if ( iContainer->SelectedItemIndex() == 0 )
+            {
+            aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EMSCmdSelect, ETrue );
+            }
+
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::SetCbaL()
+// Changes softkeys
+// --------------------------------------------------------------------------
+//
+void CMSMainView::SetCbaL( TBool aHighlightedIndex )
+    {
+    CEikButtonGroupContainer* cba = Cba();
+
+    if ( aHighlightedIndex == EStoreAndFill )
+        {
+        cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT );
+        }
+    else
+        {
+        cba->SetCommandSetL( R_MS_SOFTKEYS_OPTIONS_BACK__OPEN );
+        }
+    cba->DrawDeferred();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::CheckMemoryCardL
+// Checks if memory card has been changed
+// --------------------------------------------------------------------------
+//
+void CMSMainView::CheckMemoryCardL()
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::CheckMemoryCardL"));
+
+    RFs& fileServer = iAppUi->FsSession();
+    RPointerArray<CCmDriveInfo> storedDrives;
+    CleanupClosePushL( storedDrives );
+    RPointerArray<CCmDriveInfo> driveArray;
+    CleanupClosePushL( driveArray );
+
+    MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC();
+
+    // read stored info of stored drives
+    iAppUi->MSEngine()->GetDrivesL( storedDrives );
+
+    // get system drive info
+    settings->DriveListL( fileServer, driveArray );
+
+    TInt count = driveArray.Count();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TRACE(
+            Print(_L("[MediaServant]\t CMSMainView::drivearray type = %d"), \
+            driveArray[i]->DriveType()));
+
+        // check if mmc card is found
+        if ( driveArray[i]->DriveType() == DriveInfo::EDriveRemovable )
+            {
+            // check if memory card is used before
+            TIdentityRelation<CCmDriveInfo> relation(CMSAppUi::CompareIds );
+            TInt index = storedDrives.Find( driveArray[i], relation );
+            if ( index == KErrNotFound )
+                {
+                ShowAndHandleMMCQueryL( *&storedDrives,
+                                        *&driveArray,
+                                        i );
+
+                iAppUi->MSEngine()->ExecuteStorePreProcessingL();
+
+                i = count; // break loop
+                }
+            }
+        }
+
+    settings->Close();
+    CleanupStack::Pop(); // settings
+    driveArray.ResetAndDestroy();
+    storedDrives.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( 2, &storedDrives );
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::ShowAndHandleMMCQueryL
+// Shows mmc query and handles selection
+// --------------------------------------------------------------------------
+//
+void CMSMainView::ShowAndHandleMMCQueryL(
+                                RPointerArray<CCmDriveInfo>& aStoredArray,
+                                RPointerArray<CCmDriveInfo>& aDriveArray,
+                                TInt index )
+    {
+    LOG(_L("[MediaServant]\t CMSMainView::ShowAndHandleMMCQueryL"));
+
+    // Show delete files query
+    CAknQueryDialog* query= CAknQueryDialog::NewL(
+                                     CAknQueryDialog::ENoTone );
+
+    if ( query->ExecuteLD( R_MSERV_MMC_QUERY ) )
+        {
+        TInt driveCount = aStoredArray.Count();
+        // search and delete existing mmc card info
+        for ( TInt i = driveCount - 1 ; i >= 0 ; i-- )
+            {
+          TRACE( Print( _L("[MediaServant]\t CMSAppUi::storedarray \
+                  type = %d"), aStoredArray[i]->DriveType() ) );
+            if ( aStoredArray[i]->DriveType() == DriveInfo::EDriveRemovable )
+                {
+                delete aStoredArray[i];
+                aStoredArray[i] = NULL;
+                aStoredArray.Remove(i);
+                LOG(_L("[MediaServant]\t CMSMainView::CheckMemoryCardL \
+                old mmc info removed"));
+                }
+            }
+        TInt64 quota =
+               ( aDriveArray[index]->DriveSize() * KMMCDefaultQuota ) / 100;
+        aDriveArray[index]->SetDriveQuota( quota );
+        aDriveArray[index]->SetStatus( ETrue );
+        // then append new one
+        aStoredArray.Append( aDriveArray[index] );
+        // ownership transferred->remove pointer from drivearray
+        aDriveArray.Remove(index);
+
+        // store drives
+        iAppUi->MSEngine()->SetDrivesL( aStoredArray );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::InitializeWizardL
+// Starts the wizard when run first time
+// --------------------------------------------------------------------------
+//
+TBool CMSMainView::InitializeWizardL( TAny* aPtr )
+    {
+    CMSMainView* main = static_cast< CMSMainView* >( aPtr );
+
+    return main->DoInitializeWizardL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::InitializeMemoryCardL
+// Starts the new memroy card when new memory card inserted
+// --------------------------------------------------------------------------
+//
+TInt CMSMainView::InitializeMemoryCardL( TAny* aPtr )
+    {
+    CMSMainView* main = static_cast< CMSMainView* >( aPtr );
+
+    main->DoInitializeMemoryCardL();
+
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::DoInitializeWizardL
+// Do starts the wizard when run first time
+// --------------------------------------------------------------------------
+//
+TBool CMSMainView::DoInitializeWizardL()
+    {
+    LOG(_L("[MediaServant]\t CMSAppUi::DoInitializeWizardL"));
+        TInt wizRetVal(KErrNone);
+
+    TRAPD( error, wizRetVal = iAppUi->RunWizardL() );
+
+    if ( error )
+        {
+        TRACE(Print(_L("[MediaServant]\t DoInitializeWizardL::\
+        wizard error value: %d"), error));
+        }
+
+    if( wizRetVal != KErrNone)
+        {
+        iContainer->SetManualWizardInfo( ETrue );
+        iAppUi->RefreshListsL();
+        iContainer->StartMetadataDeleteL();
+        iContainer->ShowRefreshIndicationL();
+        }
+    else
+        {
+        TRACE(Print(_L("[MediaServant]\t DoInitializeWizardL::\
+        wizard return value: %d"), wizRetVal));
+        // wizard cancelled. Check memory card
+        iContainer->MemoryCardChangedL(EMemoryCardInsert);
+        }
+
+    // let view to respond user events again
+    iWizardInitialization = EFalse;
+
+    // must return EFalse because this is not called anymore
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMainView::DoInitializeMemoryCardL
+// Do Starts the new memroy card when new memory card dialog inserted
+// --------------------------------------------------------------------------
+//
+void CMSMainView::DoInitializeMemoryCardL()
+    {
+    CheckMemoryCardL();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msmemorycardmonitor.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSMemoryCardMonitor implementation
+*
+*/
+
+#include <driveinfo.h>
+
+#include "msmemorycardmonitor.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::NewL
+// ---------------------------------------------------------------------------
+//
+CMSMemoryCardMonitor* CMSMemoryCardMonitor::NewL( 
+    MMSMemoryCardObserver* aObserver, RFs& aRfs )
+    {
+    LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::NewL"));
+    
+    CMSMemoryCardMonitor* self = CMSMemoryCardMonitor::NewLC( aObserver,
+                                                              aRfs );
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::NewLC
+// ---------------------------------------------------------------------------
+//
+CMSMemoryCardMonitor* CMSMemoryCardMonitor::NewLC( 
+    MMSMemoryCardObserver* aObserver, RFs& aRfs )
+    {
+    LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::NewLC"));
+    
+    CMSMemoryCardMonitor* self = 
+        new(ELeave) CMSMemoryCardMonitor( aObserver, aRfs );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+        
+    return self;
+    }    
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::ConstructL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CMSMemoryCardMonitor::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::CMSMemoryCardMonitor
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CMSMemoryCardMonitor::CMSMemoryCardMonitor( MMSMemoryCardObserver* aObserver,
+                                               RFs& aRfs ) 
+                                            : CActive( EPriorityIdle ), 
+                                              iObserver( aObserver ),
+                                              iFsSession( aRfs ),
+                                              iMemoryCardExist( EFalse )
+    {
+    LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::CMSMemoryCardMonitor"));
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::~CMSMemoryCardMonitor
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMSMemoryCardMonitor::~CMSMemoryCardMonitor()
+    {
+    LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::~CMSMemoryCardMonitor"));
+    
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::DoCancel
+// cancel monitor
+// ---------------------------------------------------------------------------
+//
+void CMSMemoryCardMonitor::DoCancel()
+    {
+    LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::DoCancel() start"));
+    iFsSession.NotifyChangeCancel();
+    LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::DoCancel() end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::RunL
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CMSMemoryCardMonitor::RunL()
+    {
+    LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::RunL() start"));
+    TMemoryCardEvent mmcevent( EMemoryCardOthers );
+    TBool mmc = MemoryCardExist();
+
+    TRACE(Print(_L("[MediaServant]\t CMSMemoryCardMonitor::Runl %d-->%d\n"),
+        iMemoryCardExist, mmc ));
+
+    if( iMemoryCardExist && !mmc )
+        {
+        mmcevent = EMemoryCardRemove;
+        }
+    else if( !iMemoryCardExist && mmc )
+        {
+        mmcevent = EMemoryCardInsert;
+        }
+
+    if( mmcevent != EMemoryCardOthers && iObserver )
+        {
+        iObserver->MemoryCardChangedL( mmcevent );
+        }
+
+    StartMonitor();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::RunError
+// RunError
+// ---------------------------------------------------------------------------
+//
+TInt CMSMemoryCardMonitor::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::StartMonitor
+// start
+// ---------------------------------------------------------------------------
+//
+void CMSMemoryCardMonitor::StartMonitor()
+    {
+    LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::StartMonitor"));
+    if ( IsActive() ) 
+        {
+        Cancel();
+        }
+    iMemoryCardExist = MemoryCardExist();
+    iFsSession.NotifyChange( ENotifyDisk, iStatus );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMemoryCardMonitor::MemoryCardExist
+// Get the mmc status
+// ---------------------------------------------------------------------------
+//
+TBool CMSMemoryCardMonitor::MemoryCardExist() const
+    {
+    LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::MemoryCardExist"));
+    
+    TBool mmcstatus( EFalse );
+    TDriveList list;
+    iFsSession.DriveList( list );
+
+    for( TInt driveNumber = 0 ; driveNumber <= EDriveZ ; driveNumber++ )
+        {
+        if( list[driveNumber] ) // Is memorycard available
+            {
+            TDriveInfo driveInfo;
+            iFsSession.Drive( driveInfo, driveNumber );
+            TUint drvStatus( 0 );
+            User::LeaveIfError( DriveInfo::GetDriveStatus( iFsSession,
+                                                          driveNumber,
+                                                          drvStatus ) );
+            TInt removableStatus = drvStatus & DriveInfo::EDriveRemovable;
+
+            // Check if drive is memory card
+            if( removableStatus && ( driveInfo.iType != EMediaNotPresent ) )
+                {
+                mmcstatus = ETrue;
+                driveNumber = EDriveZ + 1;
+                }
+            }
+        }
+    return mmcstatus;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msmetadatacollector.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Collects metadata based on user selections
+*
+*/
+
+
+// INCLUDES
+#include <e32std.h>
+#include "cmsqlpropertycontainer.h"
+#include "cmsqlpropertyitem.h"
+#include "cmsqlpropertycollector.h"
+#include "msmetadatacollector.h"
+#include "msappui.h"
+#include "msengine.h"
+#include "msdebug.h"
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMSMetadataCollector* CMSMetadataCollector::NewL(
+                                                    CMSAppUi& aMSAppUi,
+                                                    TCmMediaType aMediaType,
+                                                    RArray<TInt>& aGenreArray,
+                                                    RArray<TInt>& aArtistArray,
+                                                    RArray<TInt>& aAlbumArray,
+                                                    RArray<TInt>& aTrackArray )
+    {
+    LOG(_L("[MediaServant]\t CMSMetadataCollector::NewL"));
+    
+    CMSMetadataCollector* self = CMSMetadataCollector::NewLC(
+                                                        aMSAppUi,
+                                                        aMediaType,
+                                                        aGenreArray,
+                                                        aArtistArray,
+                                                        aAlbumArray,
+                                                        aTrackArray );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMSMetadataCollector* CMSMetadataCollector::NewLC(
+                                                    CMSAppUi& aAppUi,
+                                                    TCmMediaType aMediaType,
+                                                    RArray<TInt>& aGenreArray,
+                                                    RArray<TInt>& aArtistArray,
+                                                    RArray<TInt>& aAlbumArray,
+                                                    RArray<TInt>& aTrackArray )
+    {
+    LOG(_L("[MediaServant]\t CMSMetadataCollector::NewLC"));
+    
+    CMSMetadataCollector* self = new ( ELeave ) CMSMetadataCollector(
+                                                        aAppUi,
+                                                        aMediaType,
+                                                        aGenreArray,
+                                                        aArtistArray,
+                                                        aAlbumArray,
+                                                        aTrackArray );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMSMetadataCollector::~CMSMetadataCollector()
+    {
+    LOG(_L("[MediaServant]\t CMSMetadataCollector::~CMSMetadataCollector"));
+    
+    delete iMetadataCollector;
+    }
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CMSMetadataCollector::CMSMetadataCollector( CMSAppUi& aMSAppUi,
+                                            TCmMediaType aMediaType,
+                                            RArray<TInt>& aGenreArray,
+                                            RArray<TInt>& aArtistArray,
+                                            RArray<TInt>& aAlbumArray,
+                                            RArray<TInt>& aTrackArray ) :
+    iMSAppUi( &aMSAppUi ),
+    iMediaType( aMediaType ),
+    iGenreArray( &aGenreArray ),
+    iArtistArray( &aArtistArray ),
+    iAlbumArray( &aAlbumArray ),
+    iTrackArray( &aTrackArray )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CMSMetadataCollector::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMSMetadataCollector::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSMetadataCollector::ConstructL"));
+    
+    iMetadataCollector = CCmSqlPropertyCollector::NewL();
+    AddContainersL();
+    
+    GetFilteredMetadataL();
+    }
+
+
+// ---------------------------------------------------------------------------
+//CMSMetadataCollector::GetFilteredMetadataL
+// ---------------------------------------------------------------------------
+//
+void CMSMetadataCollector::GetFilteredMetadataL()
+    {
+    LOG(_L("[MediaServant]\t CMSMetadataCollector::GetFilteredMetadataL"));
+    
+    DeleteAllItems();
+
+    // TRACKS - this is both video titles and music tracks
+    for ( TInt index = 0; index < iTrackArray->Count(); index++ )
+        {
+        CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC();
+
+        item->SetId( (*iTrackArray)[index] );
+
+
+        CCmSqlPropertyContainer* container =
+                        iMetadataCollector->PropertyContainer( ETracks );
+        container->AddPropertyItemL( item );
+        CleanupStack::Pop( item );
+        }
+
+    if ( iMediaType == ECmAudio )
+        {
+        // ARTISTS
+        for ( TInt index = 0; index < iArtistArray->Count(); index++ )
+            {
+            CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC();
+            item->SetId( (*iArtistArray)[index] );
+
+            CCmSqlPropertyContainer* container =
+                        iMetadataCollector->PropertyContainer( EArtists );
+            container->AddPropertyItemL( item );
+            CleanupStack::Pop( item );
+            }
+
+        // GENRES
+        for ( TInt index = 0; index < iGenreArray->Count(); index++ )
+            {
+            CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC();
+            item->SetId( (*iGenreArray)[index] );
+
+            CCmSqlPropertyContainer* container =
+                        iMetadataCollector->PropertyContainer( EGenres );
+            container->AddPropertyItemL( item );
+
+            CleanupStack::Pop( item );
+            }
+
+        // ALBUMS
+        for ( TInt index = 0; index < iAlbumArray->Count(); index++ )
+            {
+            CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC();
+            item->SetId( (*iAlbumArray)[index] );
+
+            CCmSqlPropertyContainer* container =
+                        iMetadataCollector->PropertyContainer( EAlbums );
+            container->AddPropertyItemL( item );
+
+            CleanupStack::Pop( item );
+            }
+        }
+
+    // Start asynchronous metadata query.
+    // Engine observer's ReadyL will be called when ready
+    iMSAppUi->MSEngine()->GetFilteredMetadataL( iMetadataCollector );
+    }
+
+// --------------------------------------------------------------------------
+//CMSMetadataCollector::DeleteAllItems
+// --------------------------------------------------------------------------
+//
+void CMSMetadataCollector::DeleteAllItems()
+    {
+    LOG(_L("[MediaServant]\t CMSMetadataCollector::DeleteAllItems"));
+    
+    for ( TInt index = 0;
+          index < iMetadataCollector->PropertyContainerCount();
+          index++ )
+        {
+        CCmSqlPropertyContainer* container =
+                            iMetadataCollector->PropertyContainer( index );
+        for ( TInt idx = 0; idx < container->PropertyItemCount(); idx++ )
+            {
+            container->DeletePropertyItem( idx-- );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+//CMSMetadataCollector::AddContainersL
+// --------------------------------------------------------------------------
+//
+void CMSMetadataCollector::AddContainersL()
+    {
+    LOG(_L("[MediaServant]\t CMSMetadataCollector::AddContainersL"));
+    
+    // tracks
+    // this container is used both videos and music    
+    CCmSqlPropertyContainer* trackContainer =
+                                CCmSqlPropertyContainer::NewLC();
+    trackContainer->SetType( ECmTitle );
+    iMetadataCollector->AddPropertyContainerL( trackContainer );
+    CleanupStack::Pop( trackContainer );
+
+    if ( iMediaType == ECmAudio )
+        {
+        // artists  
+        CCmSqlPropertyContainer* artistContainer =
+                                CCmSqlPropertyContainer::NewLC();            
+        artistContainer->SetType( ECmArtist );
+        iMetadataCollector->AddPropertyContainerL( artistContainer );
+        CleanupStack::Pop( artistContainer );
+
+        // genres
+        CCmSqlPropertyContainer* genreContainer =
+                                CCmSqlPropertyContainer::NewLC();
+        genreContainer->SetType( ECmGenre );
+        iMetadataCollector->AddPropertyContainerL( genreContainer );
+        CleanupStack::Pop( genreContainer );
+
+        // albums
+        CCmSqlPropertyContainer* albumContainer =
+                                CCmSqlPropertyContainer::NewLC();
+        albumContainer->SetType( ECmAlbum );
+        iMetadataCollector->AddPropertyContainerL( albumContainer );
+        CleanupStack::Pop( albumContainer );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+//CMSMetadataCollector::Genres
+// ---------------------------------------------------------------------------
+//
+CCmSqlPropertyContainer* CMSMetadataCollector::Genres()
+    {
+    return iMetadataCollector->PropertyContainer( EGenres );
+    }
+
+// ---------------------------------------------------------------------------
+//CMSMetadataCollector::Artists
+// ---------------------------------------------------------------------------
+//
+CCmSqlPropertyContainer* CMSMetadataCollector::Artists()
+    {
+    return iMetadataCollector->PropertyContainer( EArtists );
+    }
+
+// ---------------------------------------------------------------------------
+//CMSMetadataCollector::Albums
+// ---------------------------------------------------------------------------
+//
+CCmSqlPropertyContainer* CMSMetadataCollector::Albums()
+    {
+    return iMetadataCollector->PropertyContainer( EAlbums );
+    }
+
+// ---------------------------------------------------------------------------
+//CMSMetadataCollector::Tracks
+// ---------------------------------------------------------------------------
+//
+CCmSqlPropertyContainer* CMSMetadataCollector::Tracks()
+    {
+    return iMetadataCollector->PropertyContainer( ETracks );
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msmultiselectiondialog.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,489 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSMultiselectionDialog class implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <akntitle.h>
+#include <avkon.mbg>
+#include <aknlists.h>
+#include <akncheckboxsettingpage.h>
+#include <mediaservant.rsg>
+
+#include "msmultiselectiondialog.h"
+#include "mediaservant.hrh"
+#include "msconstants.h"
+#include "msdebug.h"
+
+
+//CONSTANTS
+
+// Reserved list items at a time
+const TInt KListGranularity = 10;
+// Used for item icon definition
+_LIT(KOneSlashT, "1\t");
+
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::NewL
+// --------------------------------------------------------------------------
+//
+CMSMultiselectionDialog* CMSMultiselectionDialog::NewL(
+                                            CSelectionItemList* aItemArray,
+                                            const TDesC& aTitle )
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::NewL"));
+
+    CMSMultiselectionDialog* self =
+                    CMSMultiselectionDialog::NewLC( aItemArray, aTitle );                        
+    CleanupStack::Pop(self);
+
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::NewLC
+// --------------------------------------------------------------------------
+//
+CMSMultiselectionDialog* CMSMultiselectionDialog::NewLC(
+                                            CSelectionItemList* aItemArray,
+                                            const TDesC& aTitle )
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::NewLC"));
+
+    CMSMultiselectionDialog* self =
+                        new(ELeave) CMSMultiselectionDialog( aItemArray );
+
+    CleanupStack::PushL(self);
+    self->ConstructL( aTitle );
+
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionDialog::ConstructL( const TDesC& aTitle )
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\
+    ConstructL"));
+
+    // base class call
+    // menubar id has no effect because options menu is not used
+    CAknSelectionListDialog::ConstructL( R_MS_MENUBAR_MAIN_VIEW );
+    
+    // keep safe previous view title
+    iPreviousTitle = HBufC::NewL( KMaxFileName );
+
+    // set dialog title
+    CEikStatusPane* statusPane =
+                    (( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane();
+    iTitlePane = (CAknTitlePane*)statusPane->ControlL(
+                    TUid::Uid(EEikStatusPaneUidTitle));
+    // keep previous title safe
+    iPreviousTitle->Des().Copy( *iTitlePane->Text() );
+    // set new title
+    iTitlePane->SetTextL(aTitle);
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::CMSMultiselectionDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CMSMultiselectionDialog::CMSMultiselectionDialog(
+                                CSelectionItemList* aItemArray)
+: CAknSelectionListDialog(iSelectedItem, NULL, NULL),
+  iItemArray (aItemArray)
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog:: \
+    CMSMultiselectionDialog"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::CMSMultiselectionDialog
+// C++ default destructor.
+// --------------------------------------------------------------------------
+//
+CMSMultiselectionDialog::~CMSMultiselectionDialog()
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog:: \
+    ~CMSMultiselectionDialog"));
+
+    // set previous title back
+    if( iTitlePane )
+        {
+        TInt error = KErrNone;
+        TRAP( error, iTitlePane->SetTextL( *iPreviousTitle ) );
+        if( error )
+            {
+            TRACE( Print(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog\
+                  SetTextL error %d\n"),error ) );
+            }
+        }
+    
+    delete iPreviousTitle;
+
+    delete iInternalItemArray;
+
+    delete iNaviDecorator;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::OkToExitL(TInt aButtonId)
+// called by framework when the softkey is pressed
+// --------------------------------------------------------------------------
+//
+TBool CMSMultiselectionDialog::OkToExitL(TInt aButtonId)
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\
+    OkToExitL"));
+
+    TBool retval = ETrue;
+    
+    // When using middle softkey list update must be called from
+    // this way because dialog doesn't receive middle softkey key
+    // event.
+    if ( aButtonId == EAknSoftkeyChange )
+        {
+        HandleSelectionKeyPressL();
+        // don't exit dialog
+        retval = EFalse;
+        }
+
+    if ( retval ) 
+        {
+        // Update item selections to the list
+        UpdateAllSelectionsL();
+
+        // Clear navi pane text
+        iNaviPane->Pop( iNaviDecorator );
+
+        if ( aButtonId == EAknSoftkeyBack )
+            {
+            iAvkonAppUi->ProcessCommandL( EEikCmdExit );
+            }
+        }
+
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::PreLayoutDynInitL()
+// called by framework before dialog is shown
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionDialog::PreLayoutDynInitL()
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog:: \
+    PreLayoutDynInitL"));
+
+    iListBox = static_cast<CAknSingleGraphicStyleListBox*>
+                            (Control(EMultiSelectionListBoxId));
+
+    // display find box
+    SetupFind(CAknSelectionListDialog::EFixedFind);
+
+    CAknIconArray* icons = new (ELeave) CAknIconArray(2); //magic: icon count
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName() );
+
+    AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOn,
+                        EMbmAvkonQgn_indi_checkbox_on,
+                        EMbmAvkonQgn_indi_checkbox_on_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOff,
+                        EMbmAvkonQgn_indi_checkbox_off,
+                        EMbmAvkonQgn_indi_checkbox_off_mask );
+
+
+    iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons);
+    CleanupStack::Pop(icons);
+
+    GenerateInternalArrayL();
+
+    CEikStatusPane* statusPane=iEikonEnv->AppUiFactory()->StatusPane();
+
+    // Set empty navi pane text
+    iNaviPane = static_cast<CAknNavigationControlContainer*>
+            ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+                // ownership of decorator is transfered to application
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( _L("") );
+    iNaviPane->PushL( *iNaviDecorator );
+
+    iListBox->ActivateL();
+    CAknSelectionListDialog::PreLayoutDynInitL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::HandleSelectionKeyPressL()
+// handles middle softkey press
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionDialog::HandleSelectionKeyPressL()
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\
+    HandleSelectionKeyPressL"));
+    // Make special selection handling
+    HandleSelectionsL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionSettingPage::HandlePointerEventL
+// called by framework when the pointer device is pressed
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionDialog::HandlePointerEventL(
+                                const TPointerEvent& aPointerEvent ) 
+	{
+	CCoeControl::HandlePointerEventL( aPointerEvent );
+	
+	if ( TPointerEvent::EButton1Up == aPointerEvent.iType )
+		{
+		HandleSelectionKeyPressL();
+		}
+	}
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::AppendIconToArray
+// Load a possibly skinned icon (with mask) and append it to an
+// icon array.
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionDialog::AppendIconToArrayL(CAknIconArray* aArray,
+                                               MAknsSkinInstance* aSkin,
+                                               const TDesC& aMbmFile,
+                                               const TAknsItemID& aID,
+                                               TInt aBitmapId,
+                                               TInt aMaskId) const
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\
+    AppendIconToArrayL"));
+
+    __ASSERT_DEBUG( aArray, User::Leave(KErrArgument) );
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC(aSkin, aID,
+        bitmap, mask, aMbmFile, aBitmapId, aMaskId);
+
+    CGulIcon* icon = CGulIcon::NewL(bitmap, mask);
+    icon->SetBitmapsOwnedExternally(EFalse);
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop(2); // mask, bitmap
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL(icon);
+
+    aArray->AppendL(icon);
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop(icon);
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::GenerateInternalArrayL
+// Creates an internal array shown by listbox
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionDialog::GenerateInternalArrayL()
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\
+    GenerateInternalArrayL"));
+
+
+    // delete existing array
+    delete iInternalItemArray;
+    iInternalItemArray = 0;
+
+    // Make a new owned text array from the input one:
+    iInternalItemArray = new(ELeave)CDesCArrayFlat( KListGranularity );
+    TInt count = iItemArray->Count();
+
+    for (TInt index = 0; index < count; index++)
+        {
+        // Fill up the control-owned space for the modified buffers:
+        TInt newLen =
+            ((*iItemArray)[index]->ItemText()).Length() +
+            KOneSlashT().Length();
+
+        HBufC* newText = HBufC::NewMaxLC( newLen );
+
+        TPtr newTPtr = newText->Des();        
+        newTPtr.Copy( ((*iItemArray)[index])->ItemText() );
+        
+        // replace '\t' with space
+        TInt offset = newTPtr.Find( KSlashT );
+        if ( offset >= 0 )
+            {
+            TInt replaceCount = KSlashT().Length();
+            newTPtr.Replace( offset, replaceCount, KSPaceT );    
+            }        
+        
+        newTPtr.Insert( 0, KOneSlashT ); // magic: insert to the beginning
+        
+        // A copy of the new buffer goes to the internal itemarray:                
+        iInternalItemArray->AppendL(newTPtr);
+        CleanupStack::PopAndDestroy( newText );
+        }
+
+    CTextListBoxModel* model=iListBox->Model();
+    model->SetItemTextArray(iInternalItemArray);
+    model->SetOwnershipType(ELbmDoesNotOwnItemArray);
+
+    // Transfer the selected status from
+    // the input array into the listbox view
+    SetAllSelectionsL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::SetAllSelectionsL
+// Sets selection status of items
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionDialog::SetAllSelectionsL()
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\
+    SetAllSelectionsL"));
+
+    TInt count = iItemArray->Count();
+
+    CListBoxView* view = iListBox->View();
+
+    for (TInt index = 0; index < count; index++)
+        {
+        if ( (*iItemArray)[ index ]->SelectionStatus() )
+            {
+            view->SelectItemL( index );
+            }
+        else
+            {
+            view->DeselectItem( index );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionSettingPage::HandleSelectionsL
+// Removes selection marks from other items if first one is selected
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionDialog::HandleSelectionsL()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiselectionDialog::\
+    HandleSelectionsL"));
+    CAknListBoxFilterItems* filter =
+                    static_cast < CAknFilteredTextListBoxModel* >
+                    ( iListBox->Model() )->Filter();
+    const CArrayFix<TInt>* indexes = iListBox->View()->SelectionIndexes();
+    if ( indexes->Count() )
+        {
+        TKeyArrayFix sortKey(0,ECmpTUint);
+        TInt dummy;
+        if ( FindBox()->TextLength() == 0 ||
+             filter->VisibleItemIndex( 0 ) != KErrNotFound )
+            {
+            // Check if first item is selected
+            if ( indexes->Find(0, sortKey, dummy) == 0 )
+                {
+                // clear all
+                iListBox->View()->ClearSelection();
+                
+                // select current item
+                iListBox->View()->SelectItemL( iListBox->CurrentItemIndex() );
+                }
+            else // first item not selected
+                {
+                // check if first item is highlighted
+                if ( iListBox->CurrentItemIndex() == 0 )
+                    {
+                    // remove all selections...
+                    iListBox->View()->ClearSelection();
+                    }
+                //...and toggle highlighted item
+                iListBox->View()->ToggleItemL( iListBox->CurrentItemIndex() );
+                
+                // check if we don't have selected items
+                if ( indexes->Count() == 0 )
+                    {
+                    // check the first one
+                    iListBox->View()->SelectItemL(0);
+                    }
+                }
+            }
+        else
+            {
+            //...and toggle highlighted item
+            iListBox->View()->ToggleItemL( iListBox->CurrentItemIndex() );
+
+            // check if we don't have selected items
+            if ( indexes->Count() == 0 )
+                {
+                // check the first one
+                iListBox->View()->SelectItemL(0);
+                }
+            }
+        }
+    else // no items selected
+        {
+        iListBox->View()->SelectItemL(0);
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionDialog::UpdateAllSelectionsL
+// Updates selection status of the items in the item array
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionDialog::UpdateAllSelectionsL()
+    {
+    LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\
+    UpdateAllSelectionsL"));
+
+    TInt count = iItemArray->Count();
+
+    CAknListBoxFilterItems* filter
+                = static_cast < CAknFilteredTextListBoxModel* >
+                                ( iListBox->Model() )->Filter();
+    // reset filtering so that real selected indexes can be get
+    filter->ResetFilteringL();
+
+    CListBoxView* view = iListBox->View();
+
+    for (TInt index = 0; index < count; index++)
+        {
+        (*iItemArray)[ index ]->SetSelectionStatus(
+                                    view->ItemIsSelected( index ) );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msmultiselectionsettingpage.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSMultiselectionSettingPage class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include "msmultiselectionsettingpage.h"
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CMSMultiSelectionSettingPage::NewL
+// --------------------------------------------------------------------------
+//
+CMSMultiselectionSettingPage* CMSMultiselectionSettingPage::NewL(
+                                TInt aIdentifier,
+                                CSelectionItemList& aItemArray,
+                                TBool aFirstItemSwitch )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::NewL"));
+
+    CMSMultiselectionSettingPage* self =
+            CMSMultiselectionSettingPage::NewLC( aIdentifier,
+                                                 aItemArray,
+                                                 aFirstItemSwitch );
+    CleanupStack::Pop(self);
+
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiSelectionSettingPage::NewLC
+// --------------------------------------------------------------------------
+//
+CMSMultiselectionSettingPage* CMSMultiselectionSettingPage::NewLC(
+                                TInt aIdentifier,
+                                CSelectionItemList& aItemArray,
+                                TBool aFirstItemSwitch )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::NewLC"));
+
+    CMSMultiselectionSettingPage* self = new (ELeave)
+                           CMSMultiselectionSettingPage( aIdentifier,
+                                                         aItemArray,
+                                                         aFirstItemSwitch  );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+        
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSMultiSelectionSettingPage::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionSettingPage::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::ConstructL"));
+
+    CAknCheckBoxSettingPage::ConstructL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiSelectionSettingPage::CMSMultiSelectionSettingPage
+// --------------------------------------------------------------------------
+//
+CMSMultiselectionSettingPage::CMSMultiselectionSettingPage(
+    TInt aIdentifier,
+    CSelectionItemList& aItemArray,
+    TBool aFirstItemSwitch
+     ) :
+    CAknCheckBoxSettingPage( aIdentifier, &aItemArray ),
+    iItemArray ( &aItemArray ),
+    iFirstItemSwitch ( aFirstItemSwitch )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiSelectionSettingPage::~CMSMultiSelectionSettingPage()
+// --------------------------------------------------------------------------
+//
+CMSMultiselectionSettingPage::~CMSMultiselectionSettingPage()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::\
+    ~CMSMultiSelectionSettingPage"));
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiSelectionSettingPage::SelectCurrentItemL()
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionSettingPage::SelectCurrentItemL()
+    {
+    if ( iFirstItemSwitch )
+        {
+        HandleSelectionsL();
+        }
+    else
+        {
+        CAknCheckBoxSettingPage::SelectCurrentItemL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionSettingPage::HandleSelectionsL
+// Removes selection marks from other items if first one is selected
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionSettingPage::HandleSelectionsL()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::\
+    HandleSelectionsL"));
+
+    CEikListBox* listBox = ListBoxControl();
+
+    const CArrayFix<TInt>* indexes = listBox->View()->SelectionIndexes();
+
+    if ( indexes->Count() )
+        {
+        TKeyArrayFix sortKey(0,ECmpTUint);
+        TInt dummy;
+
+        // check if firs item selected
+        if ( indexes->Find(0, sortKey, dummy) == 0 )
+            {
+            // clear all
+            listBox->View()->ClearSelection();
+            // select current item
+            listBox->View()->SelectItemL( listBox->CurrentItemIndex());
+            }
+        else // first item not selected
+            {
+            // check if first item is highlighted
+            if ( listBox->CurrentItemIndex() == 0 )
+                {
+                // remove all selections...
+                listBox->View()->ClearSelection();
+                }
+            //...and toggle highlighted item
+            listBox->View()->ToggleItemL( listBox->CurrentItemIndex());
+
+            // check if we don't have selected items
+            if ( indexes->Count() == 0 )
+                {
+                // check the first one
+                listBox->View()->SelectItemL(0);
+                }
+            }
+        }
+    else // no items selected
+        {
+        listBox->View()->SelectItemL(0);
+        }
+    }
+// --------------------------------------------------------------------------
+// CMSMultiselectionSettingPage::UpdateAllSelections
+// Updates selection status of the items in the item array
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionSettingPage::UpdateAllSelections()
+    {
+    LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::\
+    UpdateAllSelections"));
+
+    TInt count = iItemArray->Count();
+
+    CListBoxView* view = ListBoxControl()->View();
+
+    for (TInt index = 0; index < count; index++)
+        {
+        (*iItemArray)[ index ]->SetSelectionStatus(
+                                    view->ItemIsSelected( index ) );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionSettingPage::HandlePointerEventL
+// called by framework when the pointer device is pressed
+// --------------------------------------------------------------------------
+//
+void CMSMultiselectionSettingPage::HandlePointerEventL(const TPointerEvent &aPointerEvent) 
+	{
+	CCoeControl::HandlePointerEventL(aPointerEvent);
+	if ( TPointerEvent::EButton1Up == aPointerEvent.iType )
+		{
+		SelectCurrentItemL();
+		}
+	}
+
+// --------------------------------------------------------------------------
+// CMSMultiselectionSettingPage::OkToExitL(TInt aButtonId)
+// called by framework when the softkey is pressed
+// --------------------------------------------------------------------------
+//
+TBool CMSMultiselectionSettingPage::OkToExitL( TInt aButtonId )
+    {
+    LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::OkToExitL"));
+
+    if ( aButtonId != EEikCmdCanceled )
+        {
+        // Update item selections to the list
+        UpdateAllSelections();
+        }
+
+    return ETrue;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msparameteragent.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSParameterAgent class implementation
+*
+*/
+
+
+#include "msparameteragent.h"
+#include "mediaservant.hrh"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::CMSParameterAgent()
+// --------------------------------------------------------------------------
+//
+CMSParameterAgent::CMSParameterAgent()
+    {
+    LOG(_L("[MediaServant]\t CMSParameterAgent::CMSParameterAgent"));
+
+    iPreviousFocusIndex = 0;
+    iTemplate.templateType = KErrNotFound;
+    iTemplate.selectedTemplate = EMSNoTemplate;
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::~CMSParameterAgent()
+// --------------------------------------------------------------------------
+//
+CMSParameterAgent::~CMSParameterAgent()
+    {
+    LOG(_L("[MediaServant]\t CMSParameterAgent::~CMSParameterAgent"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::SetRuleTemplate()
+// --------------------------------------------------------------------------
+//
+void CMSParameterAgent::SetRuleTemplate( TMSTemplate aTemplate )
+    {
+    LOG(_L("[MediaServant]\t CMSParameterAgent::SetRuleTemplate"));
+
+    iTemplate = aTemplate;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::SetRuleTemplate()
+// --------------------------------------------------------------------------
+//
+TMSTemplate CMSParameterAgent::GetRuleTemplate() const
+    {
+    LOG(_L("[MediaServant]\t CMSParameterAgent::GetRuleTemplate"));
+
+    return iTemplate;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::SetMainViewFocusIndex()
+// --------------------------------------------------------------------------
+//
+void CMSParameterAgent::SetMainViewFocusIndex( TInt aIndex )
+    {
+    TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\
+    SetMainViewFocusIndex %d"), aIndex) );
+
+    iMainViewFocusIndex = aIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::MainViewFocusIndex()
+// --------------------------------------------------------------------------
+//
+TInt CMSParameterAgent::MainViewFocusIndex() const
+    {
+    TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\
+    MainViewFocusIndex %d"), iMainViewFocusIndex) );
+
+    return iMainViewFocusIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::SetFillViewFocusIndex()
+// --------------------------------------------------------------------------
+//
+void CMSParameterAgent::SetFillViewFocusIndex( TInt aIndex )
+    {
+    TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\
+    SetFillViewFocusIndex %d"), aIndex ) );
+
+    iFillViewFocusIndex = aIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::FillViewFocusIndex()
+// --------------------------------------------------------------------------
+//
+TInt CMSParameterAgent::FillViewFocusIndex() const
+    {
+    TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\
+    FillViewFocusIndex %d"), iFillViewFocusIndex ));
+
+    return iFillViewFocusIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::SetStoreViewFocusIndex()
+// --------------------------------------------------------------------------
+//
+void CMSParameterAgent::SetStoreViewFocusIndex( TInt aIndex )
+    {
+    TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\
+    SetStoreViewFocusIndex %d"), aIndex ) );
+
+    iStoreViewFocusIndex = aIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::StoreViewFocusIndex()
+// --------------------------------------------------------------------------
+//
+TInt CMSParameterAgent::StoreViewFocusIndex() const
+    {
+    TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\
+    StoreViewFocusIndex %d"), iStoreViewFocusIndex) );
+
+    return iStoreViewFocusIndex;
+    }
+// --------------------------------------------------------------------------
+// CMSParameterAgent::SetPreviousViewId()
+// --------------------------------------------------------------------------
+//
+void CMSParameterAgent::SetPreviousViewId( TUid aViewId )
+    {
+    LOG(_L("[MediaServant]\t CMSParameterAgent::SetPreviousViewId"));
+
+    iPreviousViewId = aViewId;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::PreviousViewId()
+// --------------------------------------------------------------------------
+//
+TUid CMSParameterAgent::PreviousViewId() const
+    {
+    LOG(_L("[MediaServant]\t CMSParameterAgent::PreviousViewId"));
+
+    return iPreviousViewId;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::SetBrowseTarget()
+// --------------------------------------------------------------------------
+//
+void CMSParameterAgent::SetBrowseTarget(
+                            TMSBrowseTarget aBrowseTarget )
+    {
+    LOG(_L("[MediaServant]\t CMSParameterAgent::SetBrowseTarget"));
+
+    iBrowseTarget = aBrowseTarget;
+    }
+
+// --------------------------------------------------------------------------
+// CMSParameterAgent::GetBrowseTarget()
+// --------------------------------------------------------------------------
+//
+TMSBrowseTarget CMSParameterAgent::GetBrowseTarget() const
+    {
+    LOG(_L("[MediaServant]\t CMSParameterAgent::GetBrowseTarget"));
+
+    return iBrowseTarget;
+    }
+    
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/mspropertywatcher.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSPropertyWatcher class implementation
+*
+*/
+
+
+
+//  Include Files
+#include <mediaservant.rsg>
+
+#include "mspropertywatcher.h"
+#include "msdebug.h"
+
+
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::CMSPropertyWatcher
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMSPropertyWatcher::CMSPropertyWatcher()
+            : CActive(CActive::EPriorityStandard)
+    {
+    LOG(_L("[MediaServant]\t CMSPropertyWatcher::CMSPropertyWatcher"));
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMSPropertyWatcher* CMSPropertyWatcher::NewL()
+    {
+    LOG(_L("[MediaServant]\t CMSPropertyWatcher::NewL"));
+
+    CMSPropertyWatcher* self = CMSPropertyWatcher::NewLC();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMSPropertyWatcher* CMSPropertyWatcher::NewLC()
+    {
+    LOG(_L("[MediaServant]\t CMSPropertyWatcher::NewLC"));
+
+    CMSPropertyWatcher* self = new ( ELeave ) CMSPropertyWatcher();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMSPropertyWatcher::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSPropertyWatcher::ConstructL"));
+
+    // Define new property
+    TInt err = RProperty::Define( KCmPropertyCat,
+                                  KCmProperty,
+                                  RProperty::EByteArray,
+                                  sizeof(TCmProgressInfo));
+    if (err != KErrAlreadyExists)
+    {
+    User::LeaveIfError(err);
+    }
+
+    User::LeaveIfError(iProgressInfo .Attach(KCmPropertyCat,KCmProperty));
+    CActiveScheduler::Add(this);
+    }
+
+
+// Destructor
+CMSPropertyWatcher::~CMSPropertyWatcher()
+    {
+    LOG(_L("[MediaServant]\t CMSPropertyWatcher::~CMSPropertyWatcher"));
+
+    Cancel();
+    iProgressInfo.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::StartL
+// Starts active object
+// ---------------------------------------------------------------------------
+//
+void CMSPropertyWatcher::StartL()
+    {
+    RunL();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::Stop
+// Stops active object
+// ---------------------------------------------------------------------------
+//
+void CMSPropertyWatcher::Stop()
+    {
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::RunL
+// Called when asyncronous request is ready
+// ---------------------------------------------------------------------------
+//
+void CMSPropertyWatcher::RunL()
+    {
+    LOG(_L("[MediaServant]\t CMSPropertyWatcher::RunL"));
+
+    // resubscribe before processing new value to prevent missing updates
+    iProgressInfo.Subscribe( iStatus );
+    SetActive();
+
+    TCmProgressInfo info;
+
+    // initialise values on info to remove compilation warning
+    info.iService = ECmServiceNone;             // Service identifier
+    info.iTotalItems = KErrNone;                // Total count of items
+    info.iProcessedItems = KErrNone;            // Processed items
+    info.iItemsToTransferPerService = KErrNone; // Remaining items per service
+    
+    TPckgBuf< TCmProgressInfo > paramspkg( info );
+
+    // get value
+    if ( iProgressInfo.Get(
+            KCmPropertyCat,KCmProperty,paramspkg ) == KErrNotFound )
+        {
+        }
+    else
+        {
+        // inform observer
+        iObserver->PropertyChangedL(
+                                paramspkg().iService,
+                                paramspkg().iTotalItems,
+                                paramspkg().iProcessedItems,
+                                paramspkg().iItemsToTransferPerService );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::DoCancel
+// Cancels active object
+// ---------------------------------------------------------------------------
+//
+void CMSPropertyWatcher::DoCancel()
+    {
+    LOG(_L("[MediaServant]\t CMSPropertyWatcher::DoCancel"));
+
+    iProgressInfo.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CMSPropertyWatcher::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+    
+// ---------------------------------------------------------------------------
+// CMSPropertyWatcher::SetObserver
+// Set observer
+// ---------------------------------------------------------------------------
+//
+void CMSPropertyWatcher::SetObserver( MMSPropertyObserver* aObserver )
+    {
+    LOG(_L("[MediaServant]\t CMSPropertyWatcher::SetObserver"));
+
+    iObserver = aObserver;
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msruleamountsetting.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,251 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSRuleAmountSetting class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <AknQueryDialog.h>
+#include <StringLoader.h>
+
+#include "cmcommontypes.h"
+#include "msruleamountsetting.h"
+#include "mediaservant.hrh"
+#include "msdebug.h"
+
+
+// CONSTANTS
+const TInt KArrayGranularity = 3;
+
+
+// --------------------------------------------------------------------------
+// CMSRuleAmountSetting::~CMSRuleAmountSetting()
+// --------------------------------------------------------------------------
+//
+CMSRuleAmountSetting::~CMSRuleAmountSetting()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleAmountSetting::EditItemL( TBool aCalledFromMenu )
+// --------------------------------------------------------------------------
+//
+void CMSRuleAmountSetting::EditItemL( TBool aCalledFromMenu )
+    {
+    LOG(_L("[MediaServant]\t CMSRuleAmountSetting::EditItemL"));
+
+    // Launches setting page
+    CMSEnumeratedTextPopupSettingItem::EditItemL(aCalledFromMenu);
+    StoreL();
+
+    // selected item index
+    TInt selected = QueryValue()->CurrentValueIndex();
+
+    if ( SettingAccepted() &&
+         selected != EUnlimited )
+        {
+        // Construct Integer query
+        CAknNumberQueryDialog* query = CAknNumberQueryDialog::NewL( iValue );
+
+        // set query heading
+        if ( selected == EPieces)
+            {
+            HBufC* heading =
+                    StringLoader::LoadLC( R_MS_AMOUNT_QUERY_HEADING );
+            query->SetPromptL( *heading );
+            CleanupStack::PopAndDestroy( heading );
+            }
+        else // EMbits
+            {
+            HBufC* heading =
+                    StringLoader::LoadLC( R_MS_SIZE_QUERY_HEADING );
+            query->SetPromptL( *heading );
+            CleanupStack::PopAndDestroy( heading );
+            }
+
+        // run query
+        if ( query->ExecuteLD( R_MSERV_DATA_QUERY ) )
+            {
+            HBufC* itemText = NULL;
+
+            CArrayPtr< CAknEnumeratedText >* enumeratedTextArray =
+                                                    EnumeratedTextArray ();
+            // delete object
+            delete (*enumeratedTextArray)[selected];
+            // delete pointer
+            enumeratedTextArray->Delete( selected );
+
+            if ( selected == EPieces )
+                {
+
+                switch ( iValue )
+                    {
+                    case 0: // 0 items
+                        {
+                        itemText =
+                         StringLoader::LoadLC( R_MS_VALUE_AMOUNT_0_ITEMS );
+                        break;
+                        }
+                    case 1: // 1 item
+                        {
+                        itemText =
+                         StringLoader::LoadLC( R_MS_VALUE_AMOUNT_ONE_ITEM );
+                        break;
+                        }
+                    default: // many items
+                        {
+                        itemText = StringLoader::LoadLC(
+                                             R_MS_VALUE_AMOUNT_COUNT_NUMBER,
+                                             iValue );
+                        break;
+                        }
+                    }
+                }
+            else // EMbits
+                {
+                itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_MB_NUMBER,
+                                                iValue );
+                }
+
+            // do number conversion
+            TPtr ptr = itemText->Des();
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+            CAknEnumeratedText* enumeratedText =
+                        new (ELeave) CAknEnumeratedText( selected, itemText);
+            CleanupStack::PushL( enumeratedText );
+            // insert new text to array
+            enumeratedTextArray->InsertL( selected, enumeratedText );
+            CleanupStack::Pop( enumeratedText );
+            if ( itemText )
+                {
+                CleanupStack::Pop( itemText );
+                }
+
+            UpdateListBoxTextL();
+            }
+        else
+            {
+			EditItemL( aCalledFromMenu );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleAmountSetting::CMSRuleAmountSetting
+// --------------------------------------------------------------------------
+//
+CMSRuleAmountSetting::CMSRuleAmountSetting(
+    TInt aIdentifier,
+    TInt &aLimitType,
+    TInt &aValue
+     ) :
+    CMSEnumeratedTextPopupSettingItem( aIdentifier, aLimitType ),
+    iLimitType( aLimitType ),
+    iValue( aValue )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleAmountSetting::CompleteConstructionL
+// --------------------------------------------------------------------------
+//
+void CMSRuleAmountSetting::CompleteConstructionL()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleAmountSetting::CompleteConstructionL"));
+
+    CArrayPtr< CAknEnumeratedText > * enumeratedTextArray =
+        new (ELeave) CArrayPtrFlat<CAknEnumeratedText>(KArrayGranularity);
+    CleanupStack::PushL( enumeratedTextArray );
+
+    CArrayPtr< HBufC > * poppedUpTextArray =
+                new (ELeave) CArrayPtrFlat<HBufC> (KArrayGranularity);
+    CleanupStack::PushL( poppedUpTextArray );
+
+
+    // "UNLIMITED" setting item text
+    HBufC* itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_UNLIMITED );
+    CAknEnumeratedText* enumeratedText =
+                new (ELeave) CAknEnumeratedText( EUnlimited, itemText );
+    CleanupStack::PushL( enumeratedText );
+    enumeratedTextArray->AppendL( enumeratedText );
+    CleanupStack::Pop( 2, itemText );
+
+    // "XX items" setting item text
+    switch( iValue )
+        {
+        case 0: // 0 items
+            {
+            itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_0_ITEMS );
+            break;
+            }
+        case 1: // 1 item
+            {
+            itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_ONE_ITEM );
+            break;
+            }
+        default: // many items
+            {
+            itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_COUNT_NUMBER,
+                                             iValue);
+            // do number conversion
+            TPtr ptr = itemText->Des();
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+            break;
+            }
+        }
+
+    enumeratedText = new (ELeave) CAknEnumeratedText(EPieces, itemText);
+    CleanupStack::PushL( enumeratedText );
+    enumeratedTextArray->AppendL( enumeratedText );
+    CleanupStack::Pop( 2, itemText );
+
+    // "XX MB" setting item text
+    itemText = StringLoader::LoadLC(
+                            R_MS_VALUE_AMOUNT_MB_NUMBER, iValue );
+    // do number conversion
+    TPtr ptr = itemText->Des();
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+    enumeratedText = new (ELeave) CAknEnumeratedText(EMbits, itemText);
+    CleanupStack::PushL( enumeratedText );
+    enumeratedTextArray->AppendL( enumeratedText );
+    CleanupStack::Pop( 2, itemText );
+
+    // "UNLIMITED" popup text
+    HBufC* popupText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_UNLIMITED );
+    poppedUpTextArray->AppendL(popupText);
+    CleanupStack::Pop( popupText );
+
+    // "SET MB" popup text
+    HBufC* popupText2 = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_COUNT_PAGE );
+    poppedUpTextArray->AppendL(popupText2);
+    CleanupStack::Pop( popupText2 );
+
+    // "SET COUNT" popup text
+    HBufC* popupText3 = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_MB_PAGE );
+    poppedUpTextArray->AppendL(popupText3);
+    CleanupStack::Pop( popupText3 );
+
+    // set arrays
+    SetEnumeratedTextArrays(enumeratedTextArray, poppedUpTextArray);
+    CleanupStack::Pop( 2, enumeratedTextArray );
+
+    HandleTextArrayUpdateL();
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msrulefilesizesetting.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSRuleFileSizeSetting class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <aknsettingitemlist.h>
+#include <AknQueryDialog.h>
+#include <StringLoader.h>
+#include "cmcommontypes.h"
+#include "msrulefilesizesetting.h"
+#include "mediaservant.hrh"
+#include "msdebug.h"
+
+
+// CONSTANTS
+const TInt KArrayGranularity = 2;
+
+
+// --------------------------------------------------------------------------
+// CMSRuleFileSizeSetting::~CMSRuleFileSizeSetting()
+// --------------------------------------------------------------------------
+//
+CMSRuleFileSizeSetting::~CMSRuleFileSizeSetting()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleFileSizeSetting::EditItemL( TBool aCalledFromMenu )
+// --------------------------------------------------------------------------
+//
+void CMSRuleFileSizeSetting::EditItemL( TBool aCalledFromMenu )
+    {
+    LOG(_L("[MediaServant]\t CMSRuleFileSizeSetting::EditItemL"));
+
+    // Launches setting page
+    // Button pressed on setting page will be stored to iSettingPageEvent
+    CMSEnumeratedTextPopupSettingItem::EditItemL(aCalledFromMenu);
+    StoreL();
+
+    // selected item index
+    TInt selected = QueryValue()->CurrentValueIndex();
+
+    if ( SettingAccepted() &&
+         selected != EMSAny )
+        {
+        // Construct Integer query
+        CAknNumberQueryDialog* query = CAknNumberQueryDialog::NewL( iValue );
+
+        // set query heading
+        if ( iType == EMSMinFileSize)
+            {
+            HBufC* heading = StringLoader::LoadLC(
+                                    R_MS_MIN_FILE_SIZE_PAGE_ITEM_TEXT );
+            query->SetPromptL( *heading );
+            CleanupStack::PopAndDestroy( heading );
+            }
+        else // EMSMaxFileSize
+            {
+            HBufC* heading = StringLoader::LoadLC(
+                                    R_MS_MAX_FILE_SIZE_PAGE_ITEM_TEXT );
+            query->SetPromptL( *heading );
+            CleanupStack::PopAndDestroy( heading );
+            }
+
+        // run query
+        if ( query->ExecuteLD( R_MSERV_DATA_QUERY ) )
+            {
+            CArrayPtr< CAknEnumeratedText >* enumeratedTextArray =
+                                                    EnumeratedTextArray ();
+            // delete object
+            delete enumeratedTextArray->At(selected);
+            // delete pointer
+            enumeratedTextArray->Delete( selected );
+
+            HBufC* itemText = StringLoader::LoadLC( R_MS_FILE_SIZE_ITEM_TEXT,
+                                            iValue );
+
+            // do number conversion
+            TPtr ptr = itemText->Des();
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+            CAknEnumeratedText* enumeratedText =
+                    new (ELeave) CAknEnumeratedText( selected, itemText);
+            CleanupStack::PushL( enumeratedText );
+
+            // insert new text to array
+            enumeratedTextArray->InsertL( selected, enumeratedText );
+            CleanupStack::Pop( 2, itemText );
+
+
+            UpdateListBoxTextL();
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleFileSizeSetting::CMSRuleFileSizeSetting
+// --------------------------------------------------------------------------
+//
+CMSRuleFileSizeSetting::CMSRuleFileSizeSetting(
+    TInt aIdentifier,
+    TInt aType,
+    TInt &aSelection,
+    TInt &aValue
+     ) :
+    CMSEnumeratedTextPopupSettingItem( aIdentifier, aSelection ),
+    iType( aType ),
+    iValue( aValue )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleFileSizeSetting::CompleteConstructionL
+// --------------------------------------------------------------------------
+//
+void CMSRuleFileSizeSetting::CompleteConstructionL()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleFileSizeSetting::\
+    CompleteConstructionL"));
+
+    CArrayPtr< CAknEnumeratedText > * enumeratedTextArray =
+        new (ELeave) CArrayPtrFlat<CAknEnumeratedText>(KArrayGranularity);
+    CleanupStack::PushL( enumeratedTextArray );
+
+    CArrayPtr< HBufC > * poppedUpTextArray =
+            new (ELeave) CArrayPtrFlat<HBufC> (KArrayGranularity);
+    CleanupStack::PushL( poppedUpTextArray );
+
+    // "Any" setting item text
+    HBufC* itemText = StringLoader::LoadLC( R_MS_VALUE_ANY_FILE_SIZE );
+    CAknEnumeratedText* enumeratedText =
+            new (ELeave) CAknEnumeratedText( EMSAny, itemText );
+    CleanupStack::PushL( enumeratedText );
+    enumeratedTextArray->AppendL( enumeratedText );
+    CleanupStack::Pop( 2, itemText );
+
+    // "XX MB" setting item text
+    itemText = StringLoader::LoadLC( R_MS_FILE_SIZE_ITEM_TEXT, iValue );
+
+    // do number conversion
+    TPtr ptr = itemText->Des();
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+    enumeratedText = new (ELeave) CAknEnumeratedText(EMSSetSize, itemText);
+    CleanupStack::PushL( enumeratedText );
+    enumeratedTextArray->AppendL( enumeratedText );
+    CleanupStack::Pop( 2, itemText );
+
+    // "Any" popup text
+    HBufC* popupText = StringLoader::LoadLC( R_MS_VALUE_ANY_FILE_SIZE );
+    poppedUpTextArray->AppendL(popupText);
+    CleanupStack::Pop( popupText );
+
+    if ( iType == EMSMinFileSize )
+        {
+        // "Set min MB" setting page text
+        HBufC* popupText2 =
+                StringLoader::LoadLC( R_MS_MIN_FILE_SIZE_PAGE_ITEM_TEXT );
+        poppedUpTextArray->AppendL(popupText2);
+        CleanupStack::Pop( popupText2 );
+        }
+    else // EMSMaxFileSize
+        {
+        // "Set max MB" setting page text
+        HBufC* popupText2 = StringLoader::LoadLC(
+                                    R_MS_MAX_FILE_SIZE_PAGE_ITEM_TEXT );
+        poppedUpTextArray->AppendL(popupText2);
+        CleanupStack::Pop( popupText2 );
+        }
+
+    // set arrays
+    SetEnumeratedTextArrays(enumeratedTextArray, poppedUpTextArray);
+    CleanupStack::Pop( 2, enumeratedTextArray );
+
+    HandleTextArrayUpdateL();
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msrulemultiselectionsetting.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,349 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSRuleMultiselectionSetting class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <akncheckboxsettingpage.h>
+#include <StringLoader.h>
+#include <utf.h>
+
+#include "cmsqlpropertycontainer.h"
+#include "cmsqlpropertyitem.h"
+#include "msrulemultiselectionsetting.h"
+#include "msconstants.h"
+#include "msmultiselectiondialog.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KItemArrayGranularity = 3;
+
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::NewL
+// --------------------------------------------------------------------------
+//
+CMSRuleMultiselectionSetting* CMSRuleMultiselectionSetting::NewL(
+                                TInt aIdentifier,
+                                TInt aTitleResource,
+                                TInt aFirstPopupItemResource,
+                                TInt aAnyItemTextResource,
+                                CCmSqlPropertyContainer* aMetadataArray,
+                                RArray<TInt>* aArray,
+                                TInt aItemTextResource,
+                                TDes& aText)
+    {
+    LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::NewL"));
+
+    CMSRuleMultiselectionSetting* self =
+                        CMSRuleMultiselectionSetting::NewLC(
+                                                    aIdentifier,
+                                                    aTitleResource,
+                                                    aFirstPopupItemResource,
+                                                    aAnyItemTextResource,
+                                                    aMetadataArray,
+                                                    aArray,
+                                                    aItemTextResource,
+                                                    aText );
+
+    CleanupStack::Pop(self);
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::NewLC
+// --------------------------------------------------------------------------
+//
+CMSRuleMultiselectionSetting* CMSRuleMultiselectionSetting::NewLC(
+                                TInt aIdentifier,
+                                TInt aTitleResource,
+                                TInt aFirstPopupItemResource,
+                                TInt aAnyItemTextResource,
+                                CCmSqlPropertyContainer* aMetadataArray,
+                                RArray<TInt>* aArray,
+                                TInt aItemTextResource,
+                                TDes& aText)
+    {
+    LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::NewLC"));
+
+    CMSRuleMultiselectionSetting* self =
+                        new (ELeave) CMSRuleMultiselectionSetting(
+                                                    aIdentifier,
+                                                    aTitleResource,
+                                                    aFirstPopupItemResource,
+                                                    aAnyItemTextResource,
+                                                    aMetadataArray,
+                                                    aArray,
+                                                    aItemTextResource,
+                                                    aText );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSRuleMultiselectionSetting::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::ConstructL"));
+
+    iItemArray =
+            new ( ELeave ) CSelectionItemList( KItemArrayGranularity );
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::SetSettingItemTextL
+// --------------------------------------------------------------------------
+//
+void CMSRuleMultiselectionSetting::SetSettingItemTextL()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::\
+    SetSettingItemTextL"));
+
+    HBufC* itemText = NULL;
+
+    if ( iSelectedItemCount == 1 )
+        {
+        // only one item selected so we can use item index to find text
+        CSelectableItem* apu = (*iItemArray)[ iSelectedItemIndex ];
+        itemText = apu->ItemText().AllocLC();
+        }
+    else if ( iSelectedItemCount > 1 )
+        {
+        itemText = StringLoader::LoadLC( iItemTextResource,
+                                         iSelectedItemCount );
+        // do number conversion
+        TPtr ptr = itemText->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+        }
+    else
+        {
+        itemText = StringLoader::LoadLC( iAnyItemTextResource );
+        }
+
+    // Set new text
+    SetExternalText( *itemText );
+    // Load text
+    LoadL();
+
+    CleanupStack::PopAndDestroy( itemText );
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::CMSRuleMultiselectionSetting
+// --------------------------------------------------------------------------
+//
+CMSRuleMultiselectionSetting::CMSRuleMultiselectionSetting(
+    TInt aIdentifier,
+    TInt aTitleResource,
+    TInt aFirstPopupItemResource,
+    TInt aAnyItemTextResource,
+    CCmSqlPropertyContainer* aMetadataArray,
+    RArray<TInt>* aArray,
+    TInt aItemTextResource,
+    TDes& aText
+     ) :
+    CMSTextSettingItem( aIdentifier, aText ),
+    iItemTextResource ( aItemTextResource ),
+    iText( aText ),
+    iList (aArray),
+    iMetadataArray( aMetadataArray ),
+    iTitleResource( aTitleResource ),
+    iFirstPopupItemResource( aFirstPopupItemResource ),
+    iAnyItemTextResource( aAnyItemTextResource )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::~CMSRuleMultiselectionSetting()
+// --------------------------------------------------------------------------
+//
+CMSRuleMultiselectionSetting::~CMSRuleMultiselectionSetting()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::\
+    ~CMSRuleMultiselectionSetting"));
+
+    if ( iItemArray )
+        {
+        iItemArray->ResetAndDestroy();
+        delete iItemArray;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::EditItemL( TBool aCalledFromMenu )
+// --------------------------------------------------------------------------
+//
+void CMSRuleMultiselectionSetting::EditItemL( TBool /*aCalledFromMenu*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::EditItemL"));
+
+    HBufC* title = StringLoader::LoadLC( iTitleResource );
+    CMSMultiselectionDialog* dlg =
+                    CMSMultiselectionDialog::NewL(iItemArray, *title);
+
+    // reset dialog acceptance indicator
+    SetAcceptState( EFalse );
+
+    // launch dialog
+    if ( dlg->ExecuteLD( R_MS_MULTISELECTION_DIALOG ) )
+        {
+        // dialog accepted
+        SetAcceptState( ETrue );
+
+        // reset selected item count
+        iSelectedItemCount = 0;
+
+        // remove previous items
+        iList->Reset();
+
+        // Check if first item ("Any") is selected
+        if ( (*iItemArray)[ 0 ]->SelectionStatus() == EFalse )
+            {
+            AppendSelectedItemsToListL();
+            }
+
+        // set item text
+        SetSettingItemTextL();
+        // load and update text
+        LoadL();
+        UpdateListBoxTextL();
+        }
+    CleanupStack::PopAndDestroy( title );
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::CreateSelectionItemListL
+// Creates selection item list
+// --------------------------------------------------------------------------
+//
+void CMSRuleMultiselectionSetting::CreateSelectionItemListL()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::\
+    CreateSelectionItemListL"));
+
+    // delete old items
+    iItemArray->ResetAndDestroy();
+    iSelectedItemCount = 0;
+
+    // Cycle trough all metadata items
+    iMetadataArray->SortPropertyItem();
+    for ( TInt idx = 0; idx < iMetadataArray->PropertyItemCount(); idx++ )
+        {
+        CCmSqlPropertyItem* propertyItem =
+                            iMetadataArray->PropertyItem( idx );
+
+        HBufC* itemStr = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+                                                        propertyItem->Name() );
+        CleanupStack::PushL( itemStr );
+
+        // Check if item was selected last time
+        TInt found = iList->Find( propertyItem->Id() );
+
+        CSelectableItem* item;
+
+        if ( found != KErrNotFound )
+            {
+            // create item - selected
+            item = new ( ELeave ) CSelectableItem( *itemStr, ETrue );
+            iSelectedItemCount++;
+            iSelectedItemIndex = idx + 1; //first item is "any"
+            }
+        else
+            {
+            // create item - not selected
+            item = new ( ELeave ) CSelectableItem( *itemStr, EFalse );
+            }
+
+        CleanupStack::PushL( item );
+
+        // item must be constructed
+        item->ConstructL();
+
+        // append item to list
+        iItemArray->AppendL(item);
+
+        CleanupStack::Pop( item );
+        CleanupStack::PopAndDestroy( itemStr );
+        }
+
+    // Create and append default item (Any/None)
+    HBufC* itemName = StringLoader::LoadLC( iFirstPopupItemResource );
+    CSelectableItem* item = NULL;
+    if ( iSelectedItemCount )
+        {
+        item = new ( ELeave ) CSelectableItem( *itemName, EFalse );
+        }
+    else
+        {
+        item = new ( ELeave ) CSelectableItem( *itemName, ETrue );
+        }
+
+    CleanupStack::PushL( item );
+    item->ConstructL();
+    iItemArray->InsertL(0, item);
+    CleanupStack::Pop( item );
+    CleanupStack::PopAndDestroy( itemName );
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::AppendSelectedItemsToListL
+// Appends selected items to the list
+// --------------------------------------------------------------------------
+//
+void CMSRuleMultiselectionSetting::AppendSelectedItemsToListL()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::\
+    AppendSelectedItemsToListL"));
+
+    // first index '0' is "Any"
+    for ( TInt index = 1; index < iItemArray->Count(); index++ )
+        {
+        if ( (*iItemArray)[index]->SelectionStatus() )
+            {
+            CCmSqlPropertyItem* propertyItem =
+                            iMetadataArray->PropertyItem( index - 1 );
+            iList->AppendL( propertyItem->Id() );
+            iSelectedItemCount++;
+            iSelectedItemIndex = index;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleMultiselectionSetting::CreateItemListL
+// Creates item list and updates listbox
+// --------------------------------------------------------------------------
+//
+void CMSRuleMultiselectionSetting::CreateItemListL()
+    {
+    // Create item list
+    CreateSelectionItemListL();
+    // set item text
+    SetSettingItemTextL();
+    // update listbox
+    UpdateListBoxTextL();
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msruleserverssetting.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSRuleServersSetting class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+
+
+#include "msruleserverssetting.h"
+#include "msmultiselectionsettingpage.h"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSRuleServersSetting::NewL
+// --------------------------------------------------------------------------
+//
+CMSRuleServersSetting* CMSRuleServersSetting::NewL(
+                                TInt aIdentifier,
+                                CSelectionItemList& aServerList,
+                                TDes& aText,
+                                TInt aSecondaryTextResource )
+    {
+    LOG(_L("[MediaServant]\t CMSRuleServersSetting::NewL"));
+
+    CMSRuleServersSetting* self = CMSRuleServersSetting::NewLC(
+                                             aIdentifier,
+                                             aServerList,
+                                             aText,
+                                             aSecondaryTextResource );
+
+    CleanupStack::Pop(self);
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleServersSetting::NewLC
+// --------------------------------------------------------------------------
+//
+CMSRuleServersSetting* CMSRuleServersSetting::NewLC(
+                                TInt aIdentifier,
+                                CSelectionItemList& aServerList,
+                                TDes& aText,
+                                TInt aSecondaryTextResource )
+    {
+    LOG(_L("[MediaServant]\t CMSRuleServersSetting::NewLC"));
+
+    CMSRuleServersSetting* self = new (ELeave) CMSRuleServersSetting(
+                                             aIdentifier,
+                                             aServerList,
+                                             aText,
+                                             aSecondaryTextResource );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleServersSetting::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSRuleServersSetting::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleServersSetting::ConstructL"));
+
+    iSettingText = HBufC16::NewL( KMaxFileName );
+
+    SetSettingItemTextL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleServersSetting::CMSRuleServersSetting
+// --------------------------------------------------------------------------
+//
+CMSRuleServersSetting::CMSRuleServersSetting(
+    TInt aIdentifier,
+    CSelectionItemList& aServerList,
+    TDes& aText,
+    TInt aSecondaryTextResource
+     ) :
+    CMSTextSettingItem( aIdentifier, aText ),
+    iText( aText ),
+    iItemArray( aServerList ),
+    iSecondaryTextResource( aSecondaryTextResource )
+    {
+    }
+// --------------------------------------------------------------------------
+// CMSRuleServersSetting::~CMSRuleServersSetting()
+// --------------------------------------------------------------------------
+//
+CMSRuleServersSetting::~CMSRuleServersSetting()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleServersSetting::\
+    ~CMSRuleServersSetting"));
+
+    delete iSettingText;
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleServersSetting::EditItemL( TBool aCalledFromMenu )
+// --------------------------------------------------------------------------
+//
+void CMSRuleServersSetting::EditItemL( TBool /*aCalledFromMenu*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSRuleServersSetting::EditItemL"));
+
+    // reset dialog acceptance indicator
+    SetAcceptState( EFalse );
+
+    // Create setting page
+    CAknSettingPage* dlg = CMSMultiselectionSettingPage::NewL(
+            R_MS_FILL_RULE_SERVERS_SETTING_PAGE,
+            iItemArray, ETrue );
+    // launch setting page
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        // dialog accepted
+        SetAcceptState( ETrue );
+
+        SetSettingItemTextL();
+        LoadL();
+        // show value on screen
+        UpdateListBoxTextL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleServersSetting::CountSelectedItems
+// Counts selected items
+// --------------------------------------------------------------------------
+//
+TInt CMSRuleServersSetting::CountSelectedItems()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleServersSetting::\
+    CountSelectedItems"));
+
+    TInt count(0);
+
+    // don't calculate first item
+    for ( TInt index = 1; index < iItemArray.Count(); index++ )
+        {
+        if ( iItemArray[ index ]->SelectionStatus() )
+            {
+            count++;
+            }
+        }
+
+    return count;
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleServersSetting::SetSettingItemTextL
+// Sets setting item secondary text according to selected items
+// --------------------------------------------------------------------------
+//
+void CMSRuleServersSetting::SetSettingItemTextL()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleServersSetting::\
+    SetSettingItemTextL"));
+
+    TInt count = CountSelectedItems();
+
+    HBufC* itemText = NULL;
+    // Check if there is no selected items
+    if ( count == 0 )
+        {
+        itemText = StringLoader::LoadLC( iSecondaryTextResource );
+        iSettingText->Des().Copy( *itemText );
+        }
+    // Check if only one item is selected
+    else if ( count == 1 )
+        {
+        TInt itemCount = iItemArray.Count();
+        for ( TInt index = 1; index < itemCount; index++ )
+            {
+            CSelectableItem* item = iItemArray[ index ];
+            if ( item->SelectionStatus() )
+                {
+                iSettingText->Des().Copy( item->ItemText() );
+                index = itemCount; // break loop
+                }
+            }
+        }
+    // more than one item selected
+    else
+        {
+        itemText = StringLoader::LoadLC( R_MS_ITEM_DEVICES, count );
+
+        // do number conversion
+        TPtr ptr = itemText->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+        iSettingText->Des().Copy( *itemText );
+        }
+
+    if ( itemText )
+        {
+        CleanupStack::PopAndDestroy( itemText );
+        }
+
+     // Set new value
+    SetExternalText( *iSettingText );
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/mssettingitems.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Setting item class implementations
+*
+*/
+
+
+#include <aknsettingpage.h>
+#include <aknmfnesettingpage.h>
+#include <aknsettingitemlist.h>
+#include <mediaservant.rsg>
+#include "mssettingitems.h"
+#include "mediaservant.hrh"
+
+// --------------------------------------------------------------------------
+// CMSTextSettingItem::CMSTextSettingItem
+// --------------------------------------------------------------------------
+//
+CMSTextSettingItem::CMSTextSettingItem(  TInt aIdentifier, TDes& aText ) :
+    CAknTextSettingItem( aIdentifier, aText )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSTextSettingItem::HandleSettingPageEventL
+// --------------------------------------------------------------------------
+//
+void  CMSTextSettingItem::HandleSettingPageEventL(
+                                        CAknSettingPage* aSettingPage,
+                                        TAknSettingPageEvent aEventType )
+    {
+    if ( aEventType == EEventSettingOked )
+        {
+        iOKPressed = ETrue;
+        }
+    else
+        {
+        iOKPressed = EFalse;
+        }
+
+    CAknTextSettingItem::HandleSettingPageEventL(
+                                            aSettingPage,
+                                            aEventType );
+    }
+
+// --------------------------------------------------------------------------
+// CMSTextSettingItem::SettingAccepted
+// --------------------------------------------------------------------------
+//
+TBool CMSTextSettingItem::SettingAccepted()
+    {
+    return iOKPressed;
+    }
+
+// --------------------------------------------------------------------------
+// CMSTextSettingItem::SetAcceptState
+// --------------------------------------------------------------------------
+//
+void CMSTextSettingItem::SetAcceptState( TBool aState )
+    {
+    iOKPressed = aState;
+    }
+
+// --------------------------------------------------------------------------
+// CMSTextSettingItem::Text
+// --------------------------------------------------------------------------
+//
+TPtr& CMSTextSettingItem::Text()
+    {
+    return CAknTextSettingItem::InternalTextPtr();
+    }
+
+// --------------------------------------------------------------------------
+// CMSTextSettingItem::SetText
+// --------------------------------------------------------------------------
+//
+void CMSTextSettingItem::SetText( TDesC& text )
+    {
+    CAknTextSettingItem::SetExternalText(text);
+    }
+
+// --------------------------------------------------------------------------
+// CMSEnumeratedTextPopupSettingItem::CMSEnumeratedTextPopupSettingItem
+// --------------------------------------------------------------------------
+//
+CMSEnumeratedTextPopupSettingItem::CMSEnumeratedTextPopupSettingItem(
+                                                        TInt aResourceId,
+                                                        TInt& aValue ):
+    CAknEnumeratedTextPopupSettingItem( aResourceId, aValue )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSEnumeratedTextPopupSettingItem::HandleSettingPageEventL
+// --------------------------------------------------------------------------
+//
+void  CMSEnumeratedTextPopupSettingItem::HandleSettingPageEventL(
+                                        CAknSettingPage* aSettingPage,
+                                        TAknSettingPageEvent aEventType )
+    {
+    if ( aEventType == EEventSettingOked )
+        {
+        iOKPressed = ETrue;
+        }
+    else
+        {
+        iOKPressed = EFalse;
+        }
+
+    CAknEnumeratedTextPopupSettingItem::HandleSettingPageEventL(
+                                            aSettingPage,
+                                            aEventType );
+    }
+
+// --------------------------------------------------------------------------
+// CMSEnumeratedTextPopupSettingItem::SettingAccepted
+// --------------------------------------------------------------------------
+//
+TBool CMSEnumeratedTextPopupSettingItem::SettingAccepted()
+    {
+    return iOKPressed;
+    }
+
+// --------------------------------------------------------------------------
+// CMSEnumeratedTextPopupSettingItem::SetAcceptState
+// --------------------------------------------------------------------------
+//
+void CMSEnumeratedTextPopupSettingItem::SetAcceptState( TBool aState )
+    {
+    iOKPressed = aState;
+    }
+
+// --------------------------------------------------------------------------
+// CMSTimeOrDateSettingItem::CMSTimeOrDateSettingItem
+// --------------------------------------------------------------------------
+//
+CMSTimeOrDateSettingItem::CMSTimeOrDateSettingItem( TInt aCMSIdentifier,
+                                        TInt aIdentifier,
+                                        TAknTimeOrDateSettingItemMode aMode,
+                                        TTime& aTime ):
+    CAknTimeOrDateSettingItem( aIdentifier, aMode, aTime ),iCMSInternalTime( aTime )
+    {
+    iCMSIdentifier = aCMSIdentifier;
+    }
+
+// --------------------------------------------------------------------------
+// CMSTimeOrDateSettingItem::HandleSettingPageEventL
+// --------------------------------------------------------------------------
+//
+void  CMSTimeOrDateSettingItem::HandleSettingPageEventL(
+                                        CAknSettingPage* aSettingPage,
+                                        TAknSettingPageEvent aEventType )
+    {
+    if ( aEventType == EEventSettingOked )
+        {
+        iOKPressed = ETrue;
+        // When press OK ,the external time value should transferred to the internal time value immediately
+        LoadL();
+        }
+    else
+        {
+        iOKPressed = EFalse;
+        // When press cancel,externalizes the current setting
+        StoreL();
+        }
+
+    CAknTimeOrDateSettingItem::HandleSettingPageEventL(
+                                            aSettingPage,
+                                            aEventType );
+    }
+
+// --------------------------------------------------------------------------
+// CMSTimeOrDateSettingItem::SettingAccepted
+// --------------------------------------------------------------------------
+//
+TBool CMSTimeOrDateSettingItem::SettingAccepted()
+    {
+    return iOKPressed;
+    }
+
+// --------------------------------------------------------------------------
+// CMSTimeOrDateSettingItem::SetAcceptState
+// --------------------------------------------------------------------------
+//
+void CMSTimeOrDateSettingItem::SetAcceptState( TBool aState )
+    {
+    iOKPressed = aState;
+    }
+
+// --------------------------------------------------------------------------
+// CMSTimeOrDateSettingItem::EditItemL
+// --------------------------------------------------------------------------
+//
+void CMSTimeOrDateSettingItem::EditItemL( TBool  /*aCalledFromMenu*/ )
+    {
+    // Access to the setting Name
+    TPtrC text = SettingName();
+    CAknSettingPage* dlg = KErrNone;
+
+    // Launches the setting page resource file
+    dlg = new ( ELeave )CAknDateSettingPage( iCMSIdentifier, iCMSInternalTime );
+
+    // Set the edit page to observer
+    SetSettingPage( dlg );
+    SettingPage()->SetSettingPageObserver( this );
+
+    if( ProtectionState() == CAknSettingItem::ESettingItemViewOnly )
+        SettingPage()->SetEditState( EFalse );
+
+    // Change to EUpdateWhenAccepted flag to avoid the checking every time there is an input to the field
+    SettingPage()->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted );
+    SetSettingPage( 0 );
+   }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msstorekeeponphonesetting.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreKeepOnPhoneSetting class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <aknlistquerydialog.h>
+
+#include "msstorekeeponphonesetting.h"
+#include "mediaservant.hrh"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSStoreKeepOnPhoneSetting::~CMSStoreKeepOnPhoneSetting()
+// --------------------------------------------------------------------------
+//
+CMSStoreKeepOnPhoneSetting::~CMSStoreKeepOnPhoneSetting()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreKeepOnPhoneSetting::CMSStoreKeepOnPhoneSetting
+// --------------------------------------------------------------------------
+//
+CMSStoreKeepOnPhoneSetting::CMSStoreKeepOnPhoneSetting(
+    TInt aIdentifier,
+    TCmMediaType aMediaType,
+    TInt& aSelection
+     ) :
+    CAknEnumeratedTextPopupSettingItem( aIdentifier, aSelection),
+    iMediaType ( aMediaType )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSRuleAmountSetting::CompleteConstructionL
+// --------------------------------------------------------------------------
+//
+void CMSStoreKeepOnPhoneSetting::CompleteConstructionL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreKeepOnPhoneSetting::\
+    CompleteConstructionL"));
+
+    // base class call
+    CAknEnumeratedTextPopupSettingItem::CompleteConstructionL();
+
+    // Get text arrays - defined in resource
+    CArrayPtr< CAknEnumeratedText >* resEnumeratedTextArray =
+                                                   EnumeratedTextArray ();
+    CArrayPtr< HBufC > * resPoppedUpTextArray = PoppedUpTextArray ();
+
+    if ( iMediaType == ECmImage || iMediaType == ECmOtherImage )
+        {
+        // remove "yes" item
+        delete resEnumeratedTextArray->At( EMSKeep );
+        resEnumeratedTextArray->Delete( EMSKeep );
+        delete resPoppedUpTextArray->At( EMSKeep );
+        resPoppedUpTextArray->Delete( EMSKeep );
+        }
+
+    else // other type than image
+        {
+        // remove "keep original size" and "keep screen size" items
+        delete resEnumeratedTextArray->At( EMSKeepScreenSize );
+        delete resPoppedUpTextArray->At( EMSKeepScreenSize );
+        delete resEnumeratedTextArray->At( EMSKeepOriginalSize );
+        delete resPoppedUpTextArray->At( EMSKeepOriginalSize );
+        // delete 2 items
+        resEnumeratedTextArray->Delete( EMSKeepOriginalSize, 2 );
+        // delete 2 items
+        resPoppedUpTextArray->Delete( EMSKeepOriginalSize, 2 );
+
+        }
+
+    HandleTextArrayUpdateL();
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msstorelistcontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,485 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreListContainer class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+#include <AknIconArray.h>
+#include <mediaservant.mbg>
+#include <avkon.mbg>
+#include <eikclbd.h>
+#include <utf.h>
+#include <e32math.h>
+#include <aknnotewrappers.h>
+
+#include "mserv.hlp.hrh"
+#include "cmstorerulecontainer.h"
+#include "cmstorerule.h"
+#include "msappui.h"
+#include "msstorelistcontainer.h"
+#include "msstorelistcontroller.h"
+#include "msstorelistview.h"
+#include "msengine.h"
+#include "msconstants.h"
+#include "mediaservantuid.h"
+#include "msdebug.h"
+
+
+// CONSTANTS
+
+// list granularity
+const TInt KListGranularity = 5;
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::CMSStoreListContainer()
+// --------------------------------------------------------------------------
+//
+CMSStoreListContainer::CMSStoreListContainer( CMSAppUi& aAppUi,
+                                              CMSStoreListView& aView ):
+    iMSAppUi( aAppUi ),
+    iView( aView )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::CMSStoreListContainer"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::~CMSStoreListContainer()
+// --------------------------------------------------------------------------
+//
+CMSStoreListContainer::~CMSStoreListContainer()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::\
+    ~CMSStoreListContainer"));
+    delete iSelectionArray;
+
+    if ( iListBox )
+        {
+        delete iListBox; // Deletes listbox object.
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::ConstructL( TRect aRect )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::ConstructL"));
+
+    CreateWindowL();
+
+    iListBox = new (ELeave) CAknSingleGraphicStyleListBox;
+
+    SetListBoxFromResourceL(iListBox, R_STORE_LIST_VIEW_LISTBOX);
+
+    // Container is listbox observer
+    iListBox->SetListBoxObserver( this );
+
+    // Get list container
+    iStoreRuleContainer =
+            iMSAppUi.StoreListController()->StoreListContainer();
+
+    // creata array for selection indexes
+    iSelectionArray = new (ELeave ) CArrayFixFlat<TInt>(KListGranularity);
+
+        // Create icons
+    CAknIconArray* icons = new (ELeave) CAknIconArray( EIconCount );
+    CleanupStack::PushL( icons );
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName() );
+
+    AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOn,
+                        EMbmAvkonQgn_indi_checkbox_on,
+                        EMbmAvkonQgn_indi_checkbox_on_mask );
+
+    AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOff,
+                        EMbmAvkonQgn_indi_checkbox_off,
+                        EMbmAvkonQgn_indi_checkbox_off_mask );
+
+    iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons);
+    CleanupStack::Pop(icons);
+
+    // Create icon for context pane
+    AknsUtils::CreateIconL( skin,
+                            KAknsIIDDefault,
+                            iIcon,
+                            iIconMask,
+                            KMSMifFileName,
+                            EMbmMediaservantQgn_mserv_to_home,
+                            EMbmMediaservantQgn_mserv_to_home_mask);
+    // change context icon
+    SetContextPaneIconL( iIcon, iIconMask );
+
+
+    SetRect(aRect);
+
+    // Add data to listbox
+    UpdateListBoxDataL();
+
+    //Set current item
+    iListBox->SetCurrentItemIndex(
+                        iMSAppUi.ParameterAgent()->StoreViewFocusIndex() );
+    ActivateL(); // Activates window. ( Ready to draw )
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::CountComponentControls()
+// Returns number of components.
+// --------------------------------------------------------------------------
+//
+TInt CMSStoreListContainer::CountComponentControls() const
+    {
+    return 1; // return number of controls inside this container
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::ComponentControl()
+// Returns pointer to particular component.
+// --------------------------------------------------------------------------
+//
+CCoeControl* CMSStoreListContainer::ComponentControl(TInt aIndex) const
+
+    {
+    CCoeControl* retval = NULL;
+    switch ( aIndex )
+        {
+        case 0:
+            {
+            retval = iListBox; // return a pointer to the listbox
+            break;
+            }
+        default:
+            {
+            retval = NULL;
+            break;
+            }
+        }
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::OfferKeyEventL()
+// Handles the key events.
+// --------------------------------------------------------------------------
+//
+TKeyResponse CMSStoreListContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::OfferKeyEventL"));
+
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if ( aType != EEventKey )
+        {
+        response =  EKeyWasNotConsumed;
+        }
+
+    if ( iListBox )
+        {
+        response = iListBox->OfferKeyEventL( aKeyEvent, aType );
+        if ( aKeyEvent.iCode == EKeyOK &&
+            iListBox->View()->ItemIsSelected( SelectedItemIndex() ))
+            {
+            // check that server is set
+            CheckServersAndShowNoteL();
+            }
+
+		if ( !iView.PreProcessing() )
+			{
+			iView.CreateAndSetNaviTextL();
+			}
+        }
+
+    return response;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::HandlePointerEventL
+// called by framework when the pointer device is pressed
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) 
+	{
+	CCoeControl::HandlePointerEventL( aPointerEvent );
+	
+	if ( TPointerEvent::EButton1Up == aPointerEvent.iType && 
+	     !iView.PreProcessing() )
+		{
+		iView.CreateAndSetNaviTextL();
+		}
+	}
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::ToggleCurrentItemL()
+// Toggles item selection
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::ToggleCurrentItemL()
+    {
+    TInt itemIndex = SelectedItemIndex();
+
+    iListBox->View()->ToggleItemL( itemIndex );
+
+    if ( iListBox->View()->ItemIsSelected( itemIndex ) )
+        {
+        // check that server is set
+        CheckServersAndShowNoteL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::CheckServersAndShowNoteL()
+// Checks if server is not set and shows info note
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::CheckServersAndShowNoteL()
+    {
+    CCmStoreRule* rule =
+                iStoreRuleContainer->StoreRule( SelectedItemIndex() );
+    if ( !rule->MediaServerCount() )
+        {
+        CAknInformationNote* dlg = new(ELeave)CAknInformationNote();
+        CleanupStack::PushL( dlg );
+        HBufC* noteText =
+                StringLoader::LoadLC( R_MS_TEXT_TARGET_DEVICE_NEEDED );
+        dlg->ExecuteLD( *noteText );
+        CleanupStack::PopAndDestroy( noteText );
+        CleanupStack::Pop( dlg );
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::HandleListBoxEventL()
+// Handles listbox event.
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::HandleListBoxEventL(
+    CEikListBox* /*aListBox*/,
+    TListBoxEvent aEventType )
+    {
+    LOG(_L("[MediaServant]\t CMSMainContainer::HandleListBoxEventL"));
+
+    if ( ( aEventType == MEikListBoxObserver::EEventEnterKeyPressed ) ||
+         ( aEventType == MEikListBoxObserver::EEventItemClicked ) )
+        {
+        ToggleCurrentItemL();
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::UpdateListBoxDataL()
+// Updates listbox content
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::UpdateListBoxDataL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::UpdateListBoxDataL"));
+
+    TCmServerState state;
+    iMSAppUi.MSEngine()->ServerState( state );
+
+    CDesCArray* itemArray = static_cast<CDesCArray*>
+                                        (iListBox->Model()->ItemTextArray());
+
+
+    TInt ruleCount = iStoreRuleContainer->StoreRuleCount();
+
+    for ( TInt index = 0; index < ruleCount; index++ )
+        {
+
+
+        CCmStoreRule* rule = iStoreRuleContainer->StoreRule( index );
+        TPtrC8 ruleName = rule->Name();
+
+        HBufC* itemText =
+            CnvUtfConverter::ConvertToUnicodeFromUtf8L( rule->Name() );
+        CleanupStack::PushL( itemText );
+
+        if ( rule->Selected() )
+            {
+            iSelectionArray->AppendL( index );
+            }
+
+        AppendItemToListBoxArrayL( iListBox,
+                                   iListBox->Model(),
+                                   EIconCheckboxOff,
+                                   *itemText );
+
+        CleanupStack::PopAndDestroy( itemText );
+        }
+
+    iListBox->HandleItemAdditionL();
+
+
+    iListBox->SetSelectionIndexesL( iSelectionArray );
+
+    if ( state != ECmServerStatePreProcessingStore )
+        {
+        iView.CreateAndSetNaviTextL();
+        }
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::SelectedItemIndex()
+// Highlighted item index
+// --------------------------------------------------------------------------
+//
+TInt CMSStoreListContainer::SelectedItemIndex()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::SelectedItemIndex"));
+
+    return iListBox->CurrentItemIndex();
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::UpdateRulesToServerL()
+// Send rules to server
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::UpdateRulesToServerL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::UpdateRulesToServerL"));
+
+    // Send rules to server
+    if ( iStoreRuleContainer )
+        {
+        iMSAppUi.MSEngine()->SetStoreRulesL( iStoreRuleContainer );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::SetServerSelectionsL()
+// Sets selection statuses to servers
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::SetServerSelectionsL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::SetServerSelectionsL"));
+
+    // remove all selections
+    for ( TInt i = 0; i < iStoreRuleContainer->StoreRuleCount(); i++ )
+        {
+        CCmStoreRule* rule =
+                    iStoreRuleContainer->StoreRule( i );
+        rule->SetSelected( ECmUnSelected );
+        }
+
+    // Get marked items indexes
+        const CListBoxView::CSelectionIndexArray* selections =
+                                                iListBox->SelectionIndexes();
+    // add user selections
+    for ( TInt j = 0; j < selections->Count(); j++ )
+        {
+        TInt selectionIndex = (*selections)[j];
+        CCmStoreRule* rule =
+                    iStoreRuleContainer->StoreRule( selectionIndex );
+
+        rule->SetSelected( ECmSelected );
+
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::ListItemCountL()
+// Gets list item count & size
+// --------------------------------------------------------------------------
+//
+TInt CMSStoreListContainer::ListItemCountL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::ListItemCountL"));
+
+    TInt fileCount( 0 );
+    TInt64 size( 0 );
+
+    CCmStoreRule* rule = iStoreRuleContainer->StoreRule(
+                                SelectedItemIndex() );
+    TPtrC8 ruleName = rule->Name();
+
+    if ( ruleName.Size() )
+        {
+        iMSAppUi.MSEngine()->GetItemCountsL( ECmServiceStore,
+                                             ruleName,
+                                             fileCount,
+                                             size );
+        }
+
+    return fileCount;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::CurrentListItemSelectionStatus()
+// Return list item selection status
+// --------------------------------------------------------------------------
+//
+TBool CMSStoreListContainer::CurrentListItemSelectionStatus()
+    {
+    return iListBox->View()->ItemIsSelected( SelectedItemIndex() );
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::SizeChanged()
+// Called by framework when the view size is changed.
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::SizeChanged()
+    {
+    // container control resize code.
+    if (iListBox)
+        {
+        iListBox->SetRect(Rect()); // Set rectangle of listbox.
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListContainer::HandleResourceChange
+// Handles layout change
+// --------------------------------------------------------------------------
+//
+void CMSStoreListContainer::HandleResourceChange(TInt aType)
+    {
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect(iView.ClientRect());
+        }
+
+    CCoeControl::HandleResourceChange(aType);
+    }
+
+// ---------------------------------------------------------------------------
+// CMSStoreListContainer::GetHelpContext
+// ---------------------------------------------------------------------------
+//
+void CMSStoreListContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListContainer::GetHelpContext"));
+
+    aContext.iMajor = TUid::Uid(KMediaServantUID3);
+    aContext.iContext = KMSERV_HLP_STORE_LIST;
+    }
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msstorelistcontroller.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreListController class implementation
+*
+*/
+
+#include <StringLoader.h>
+#include <mediaservant.rsg>
+#include <utf.h>
+
+#include "cmstorerulecontainer.h"
+#include "cmstorerule.h"
+#include "msstorelistcontroller.h"
+#include "mediaservant.hrh"
+#include "msengine.h"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSStoreListController::NewL
+// --------------------------------------------------------------------------
+//
+CMSStoreListController* CMSStoreListController::NewL( CMSEngine& aMSEngine )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListController::NewL"));
+
+    CMSStoreListController* self = CMSStoreListController::NewLC(
+                                                    aMSEngine );
+
+    CleanupStack::Pop(self);
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListController::NewLC
+// --------------------------------------------------------------------------
+//
+CMSStoreListController* CMSStoreListController::NewLC( CMSEngine& aMSEngine )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListController::NewLC"));
+
+    CMSStoreListController* self = new (ELeave) CMSStoreListController(
+                                                    aMSEngine );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSStoreListController::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSStoreListController::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListController::ConstructL"));
+
+    iStoreListContainer = iMSEngine->StoreRulesL();
+    if ( iStoreListContainer &&
+         iStoreListContainer->StoreRuleCount() <= 0)
+        {
+        CreateStoreRulesL();
+        }
+    else
+        {
+        ChangeStoreRuleNamesL();
+        }
+
+    delete iStoreListContainer;
+    iStoreListContainer = NULL;
+    iStoreListContainer = iMSEngine->StoreRulesL();
+    }
+    
+// --------------------------------------------------------------------------
+// CMSStoreListController::CMSStoreListController()
+// --------------------------------------------------------------------------
+//
+CMSStoreListController::CMSStoreListController( CMSEngine& aMSEngine )
+    {
+    LOG(_L("[MediaServant]\t \
+    CMSStoreListController::CMSStoreListController"));
+
+    iMSEngine = &aMSEngine;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListController::~CMSStoreListController()
+// --------------------------------------------------------------------------
+//
+CMSStoreListController::~CMSStoreListController()
+    {
+    LOG(_L("[MediaServant]\t \
+    CMSStoreListController::~CMSStoreListController"));
+
+    delete iStoreListContainer;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListController::StoreListArray()
+// Returns pointer to store list array
+// --------------------------------------------------------------------------
+//
+CCmStoreRuleContainer* CMSStoreListController::StoreListContainer()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListController::StoreListContainer"));
+
+    return iStoreListContainer;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListController::CreateStoreRulesL()
+// --------------------------------------------------------------------------
+//
+void CMSStoreListController::CreateStoreRulesL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListController::CreateStoreRulesL"));
+    
+    CCmStoreRuleContainer* storeRuleContainer =
+                                CCmStoreRuleContainer::NewLC();
+
+    CCmStoreRule* defaultList1 = CCmStoreRule::NewLC();
+    HBufC* temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_1 );
+    HBufC8* listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList1->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+    defaultList1->AddStoreRuleL( ECmImage );
+    defaultList1->SetSelected( ECmSelected );
+    defaultList1->SetStatus( ECmKeepOnDevice );
+    storeRuleContainer->AddStoreRuleL( defaultList1 );
+
+    CCmStoreRule* defaultList2 = CCmStoreRule::NewLC();
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_2 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList2->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+    defaultList2->AddStoreRuleL( ECmOtherImage );
+    defaultList2->SetSelected( ECmSelected );
+    defaultList2->SetStatus( ECmToBeShrinked );
+    storeRuleContainer->AddStoreRuleL( defaultList2 );
+
+    CCmStoreRule* defaultList3 = CCmStoreRule::NewLC();
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_3 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList3->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+    defaultList3->AddStoreRuleL( ECmVideo );
+    defaultList3->SetSelected( ECmSelected );
+    defaultList3->SetStatus( ECmKeepOnDevice );
+    storeRuleContainer->AddStoreRuleL( defaultList3 );
+
+    CCmStoreRule* defaultList4 = CCmStoreRule::NewLC();
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_4 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList4->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+    defaultList4->AddStoreRuleL( ECmOtherVideo );
+    defaultList4->SetSelected( ECmSelected );
+    defaultList4->SetStatus( ECmKeepOnDevice );
+    storeRuleContainer->AddStoreRuleL( defaultList4 );
+
+    CCmStoreRule* defaultList5 = CCmStoreRule::NewLC();
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_5 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList5->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+    defaultList5->AddStoreRuleL( ECmAudio );
+    defaultList5->SetSelected( ECmSelected );
+    defaultList5->SetStatus( ECmKeepOnDevice );
+    storeRuleContainer->AddStoreRuleL( defaultList5 );
+
+    iMSEngine->SetStoreRulesL( storeRuleContainer );
+
+    CleanupStack::Pop( defaultList5 );
+    CleanupStack::Pop( defaultList4 );
+    CleanupStack::Pop( defaultList3 );
+    CleanupStack::Pop( defaultList2 );
+    CleanupStack::Pop( defaultList1 );
+    CleanupStack::PopAndDestroy( storeRuleContainer );
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListController::ChangeStoreRuleNamesL()
+// Changes names of store rules
+// This must be done because user may change language and rule names
+// are used in other views ( read from database )
+// --------------------------------------------------------------------------
+//
+void CMSStoreListController::ChangeStoreRuleNamesL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListController::\
+    ChangeStoreRuleNamesL"));
+
+    CCmStoreRule*  defaultlist1 = iStoreListContainer->StoreRule( 0 );
+    HBufC* temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_1 );
+    HBufC8* listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultlist1->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+
+    // other images
+    CCmStoreRule* defaultList2 = iStoreListContainer->StoreRule( 1 );
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_2 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList2->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+
+    // phone videos
+    CCmStoreRule* defaultList3 = iStoreListContainer->StoreRule( 2 );
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_3 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList3->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+
+
+    CCmStoreRule* defaultList4 = iStoreListContainer->StoreRule( 3 );
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_4 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList4->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+
+    // music
+    CCmStoreRule* defaultList5 = iStoreListContainer->StoreRule( 4 );
+    temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_5 );
+    listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp );
+    CleanupStack::PushL( listName );
+    defaultList5->SetNameL( *listName );
+    CleanupStack::PopAndDestroy( 2, temp );
+
+    iMSEngine->SetStoreRulesL( iStoreListContainer );
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListController::UpdateListsL()
+// Resets old store rule array and reads new rules from server
+// --------------------------------------------------------------------------
+//
+void  CMSStoreListController::UpdateListsL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListController::UpdateListsL"));
+
+    delete iStoreListContainer;
+    iStoreListContainer = NULL;
+
+    // load lists again
+    iStoreListContainer = iMSEngine->StoreRulesL();
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msstorelistview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,318 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreListView class implementation
+*
+*/
+
+
+
+#include <mediaservant.rsg>
+#include <hlplch.h>
+#include <StringLoader.h>
+
+#include "msstorelistcontainer.h"
+#include "mediaservant.hrh"
+#include "msconstants.h"
+#include "msstorelistview.h"
+#include "msappui.h"
+#include "msengine.h"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::CMSStoreListView()
+// --------------------------------------------------------------------------
+//
+CMSStoreListView::CMSStoreListView( CMSAppUi& aAppUi ) :
+    iAppUi( aAppUi )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::CMSStoreListView"));
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSStoreListView::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::ConstructL"));
+
+    BaseConstructL( R_MS_STORE_LIST_VIEW );
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::~CMSStoreListView()
+// --------------------------------------------------------------------------
+//
+CMSStoreListView::~CMSStoreListView()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::~CMSStoreListView"));
+
+    DoDeactivate();
+    }
+
+// --------------------------------------------------------------------------
+// TUid CMSStoreListView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CMSStoreListView::Id() const
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::Id"));
+
+    return KMSStoreListViewId;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CMSStoreListView::HandleCommandL( TInt aCommand )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::HandleCommandL"));
+
+    switch (aCommand)
+        {
+        case EAknSoftkeyBack:
+            {
+            CancelAsyncOperation( &iAppUi );
+
+            // set default icon back
+            iContainer->SetDefaultContextPaneIconL();
+            // update store rule for mainview redraw
+            iContainer->SetServerSelectionsL();
+            iContainer->UpdateRulesToServerL();
+            // back to main view
+            iAppUi.ChangeViewL( KMSStoreListViewId, KMSMainViewId );
+            break;
+            }
+
+        case EMSStoreCmdActivate: // fall through
+        case EMSStoreCmdDeActivate:
+            {
+            iContainer->ToggleCurrentItemL();
+            break;
+            }
+
+        case EMSStoreCmdEdit:
+            {
+            CancelAsyncOperation( &iAppUi );
+            // update store rule for mainview redraw
+            iContainer->SetServerSelectionsL();
+            iContainer->UpdateRulesToServerL();
+
+            iAppUi.ChangeViewL( KMSStoreListViewId, KMSStoreSettingsViewId );
+            break;
+            }
+
+        case EMSCmdBrowse:
+            {
+            CancelAsyncOperation( &iAppUi );
+
+            // update store rule for mainview redraw
+            iContainer->SetServerSelectionsL();
+            iContainer->UpdateRulesToServerL();
+
+            // set browse target
+            iAppUi.ParameterAgent()->SetBrowseTarget( EMSStoredItems );
+            iAppUi.ChangeViewL( KMSStoreListViewId, KMSBrowseViewId );
+            break;
+            }
+
+        case EAknCmdHelp :
+            {
+            TRAPD( error, HlpLauncher::LaunchHelpApplicationL(
+                        iEikonEnv->WsSession(),
+            iEikonEnv->EikAppUi()->AppHelpContextL() ));
+            if ( error != KErrNone )
+                {
+                LOG(_L("[MediaServant]\t CMSStoreListView:: \
+                                HandleCommandL help leaves in \
+                                LaunchHelpApplication"));
+                }
+            break;
+            }
+
+        default:
+            {
+            CancelAsyncOperation( &iAppUi );
+            AppUi()->HandleCommandL(aCommand);
+            break;
+            }
+        }
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::DoActivateL(...)
+// --------------------------------------------------------------------------
+//
+void CMSStoreListView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::DoActivateL"));
+
+    // Set engine observer
+    iAppUi.MSEngine()->SetObserver( this );
+    // start preprosessing if returned from edit view
+    if ( iAppUi.ParameterAgent()->PreviousViewId() ==
+         KMSStoreSettingsViewId )
+        {
+        iAppUi.MSEngine()->ExecuteStorePreProcessingL();
+        HBufC* naviText = StringLoader::LoadLC( R_MS_PREPROCESSING_TEXT );
+        SetNavigationPaneTextL( *naviText );
+        CleanupStack::PopAndDestroy( naviText );
+		iPreprocessingState = ETrue;
+        }
+
+
+    // Set title pane text to default
+    SetTitlePaneTextL( R_MS_STORE_LIST_VIEW_TITLE );
+
+    if ( !iContainer )
+        {
+        iContainer = new (ELeave) CMSStoreListContainer( iAppUi, *this );
+        iContainer->ConstructL( ClientRect() );
+        iContainer->SetMopParent( this );
+        AppUi()->AddToViewStackL( *this, iContainer );
+        }
+   }
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::DoDeactivate()
+// --------------------------------------------------------------------------
+//
+void CMSStoreListView::DoDeactivate()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::DoDeactivate"));
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        }
+
+    ClearCurrentNaviPaneText();
+
+    delete iContainer; // Deletes the container class object.
+    iContainer = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::FocusIndex()
+// --------------------------------------------------------------------------
+//
+TInt CMSStoreListView::FocusIndex() const
+    {
+    return iContainer->SelectedItemIndex();
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+void CMSStoreListView::DynInitMenuPaneL( TInt aResourceId,
+                                         CEikMenuPane* aMenuPane)
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::DynInitMenuPaneL"));
+
+    if ( aResourceId == R_MS_STORE_LIST_MENU )
+        {
+        // selection command
+        if ( iContainer->CurrentListItemSelectionStatus() )
+            {
+            aMenuPane->SetItemDimmed( EMSStoreCmdActivate, ETrue );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EMSStoreCmdDeActivate, ETrue );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::ReadyL()
+// engine observer callback
+// --------------------------------------------------------------------------
+//
+void CMSStoreListView::ReadyL( TCmService aService, TInt /*aError*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::ReadyL"));
+
+    if ( aService == ECmServicePreProcessingStore )
+        {
+        CreateAndSetNaviTextL();
+		iPreprocessingState = EFalse;
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::CreateAndSetNaviTextL()
+// Creates and sets navi pane text
+// --------------------------------------------------------------------------
+//
+void CMSStoreListView::CreateAndSetNaviTextL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreListView::CreateAndSetNaviTextL"));
+
+    HBufC* naviText = NULL;
+
+    TInt count = iContainer->ListItemCountL();
+
+    switch ( count )
+        {
+        case 0: // 0 items
+            {
+            naviText = StringLoader::LoadLC(
+                                R_MS_NO_ITEMS_TO_BE_SYNCED );
+            break;
+            }
+        case 1: // 1 item
+            {
+            naviText = StringLoader::LoadLC(
+                                R_MS_1_ITEM_TO_BE_SYNCED );
+            break;
+            }
+        default: // many items
+            {
+            naviText = StringLoader::LoadLC(
+                                R_MS_N_ITEMS_TO_BE_SYNCED,
+                                count );
+            // do number conversion
+            TPtr ptr = naviText->Des();
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+            break;
+            } 
+
+        }
+    // update navi pane
+    SetNavigationPaneTextL( *naviText );
+
+    CleanupStack::PopAndDestroy( naviText );
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreListView::PreProcessing()
+// Returns preprocessing state
+// --------------------------------------------------------------------------
+//
+TBool CMSStoreListView::PreProcessing()
+	{
+	return iPreprocessingState;
+	}
+	
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msstoreserverssetting.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,350 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreServersSetting class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+
+#include "cmmediaserverfull.h"
+#include "cmstorerule.h"
+#include "cmfillrule.h"
+#include "msstoreserverssetting.h"
+#include "msmultiselectionsettingpage.h"
+#include "msconstants.h"
+#include "msappui.h"
+#include "msengine.h"
+#include "msdebug.h"
+
+#include "upnpstring.h"
+
+// CONSTANTS
+const TInt KItemArrayGranularity = 3;
+
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::NewL
+// --------------------------------------------------------------------------
+//
+CMSStoreServersSetting* CMSStoreServersSetting::NewL(
+                                TInt aIdentifier,
+                                CCmStoreRule* aRule,
+                                CMSAppUi& aAppUi,
+                                TDes& aText )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreServersSetting::NewL"));
+
+    CMSStoreServersSetting* self = CMSStoreServersSetting::NewLC(
+                                             aIdentifier,
+                                             aRule,
+                                             aAppUi,
+                                             aText );
+
+    CleanupStack::Pop(self);
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::NewLC
+// --------------------------------------------------------------------------
+//
+CMSStoreServersSetting* CMSStoreServersSetting::NewLC(
+                                TInt aIdentifier,
+                                CCmStoreRule* aRule,
+                                CMSAppUi& aAppUi,
+                                TDes& aText )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreServersSetting::NewLC"));
+
+    CMSStoreServersSetting* self = new (ELeave) CMSStoreServersSetting(
+                                             aIdentifier,
+                                             aRule,
+                                             aAppUi,
+                                             aText );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::ConstructL
+// --------------------------------------------------------------------------
+//
+void CMSStoreServersSetting::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreServersSetting::ConstructL"));
+
+    iSettingText = HBufC::NewL( KMaxFileName );
+
+    // Get media server list
+    iServers = iAppUi.MSEngine()->GetMediaServersL();
+
+    // create item array
+    CreateSelectionItemListL();
+
+    SetSettingItemTextL();
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::CMSRuleServersSetting
+// --------------------------------------------------------------------------
+//
+CMSStoreServersSetting::CMSStoreServersSetting(
+    TInt aIdentifier,
+    CCmStoreRule* aRule,
+    CMSAppUi& aAppUi,
+    TDes& aText
+     ) :
+    CAknTextSettingItem( aIdentifier, aText ),
+    iRule( aRule ),
+    iAppUi( aAppUi )
+    {
+    }
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::~CMSStoreServersSetting()
+// --------------------------------------------------------------------------
+//
+CMSStoreServersSetting::~CMSStoreServersSetting()
+    {
+    delete iSettingText;
+
+    if ( iItemArray )
+        {
+        iItemArray->ResetAndDestroy();
+        delete iItemArray;
+        }
+
+    if ( iServers )
+        {
+        iServers->ResetAndDestroy();
+        iServers->Close();
+        delete iServers;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::EditItemL( TBool aCalledFromMenu )
+// --------------------------------------------------------------------------
+//
+void CMSStoreServersSetting::EditItemL( TBool /*aCalledFromMenu*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreServersSetting::EditItemL"));
+
+    // Create setting page
+    CAknSettingPage* dlg = CMSMultiselectionSettingPage::NewL(
+            R_MS_STORE_SETTINGS_LOCATION_SETTING_PAGE,
+            *iItemArray, EFalse );
+    // launch setting page
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        DeleteAllServersFromRuleL();
+
+        for ( TInt index = 0; index < iItemArray->Count(); index++ )
+                {
+                CSelectableItem* item = iItemArray->At( index );
+                TBool selected = item->SelectionStatus();
+
+                CCmMediaServerFull* server = (*iServers)[index];
+                // get server UDN
+                TPtrC8 serverUDN = server->MediaServer();
+
+                // add server
+                if ( item->SelectionStatus() )
+                    {
+                    // set server for rule
+                    iRule->AddMediaServerL( serverUDN );
+                    }
+                }
+
+        SetSettingItemTextL();
+        LoadL();
+        // show value on screen
+        UpdateListBoxTextL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::CreateSelectionItemListL
+// Creates selection item list
+// --------------------------------------------------------------------------
+//
+void CMSStoreServersSetting::CreateSelectionItemListL()
+    {
+    if ( iItemArray )
+        {
+        iItemArray->ResetAndDestroy();
+        delete iItemArray;
+        iItemArray = NULL;
+        }
+
+    iItemArray =
+            new ( ELeave ) CSelectionItemList( KItemArrayGranularity );
+
+    TBuf8<KMaxFileName> itemText;
+
+    TInt serverCount(0);
+    if ( iServers )
+        {
+        serverCount = iServers->Count();
+        }
+
+    // Cycle trough all servers
+    for ( TInt idx = 0; idx < serverCount; idx++ )
+        {
+        // get server
+        CCmMediaServerFull* server = (*iServers)[idx];
+        // show only copy capable devices
+        if ( server->StoreUsage() )
+            {
+            HBufC* devName =
+                    UpnpString::ToUnicodeL( server->MediaServerName() );
+            CleanupStack::PushL( devName );
+            CSelectableItem* item = new ( ELeave ) CSelectableItem(
+                                                    *devName, EFalse);
+
+            CleanupStack::PushL( item );
+            // item must be constructed
+            item->ConstructL();
+
+            // count of servers set to rule
+            TInt ruleServerCount = iRule->MediaServerCount();
+
+            // Cycle trough all servers
+            for (TInt index = 0; index < ruleServerCount; index++ )
+                {
+                const TDesC8& ruleServerUDN = iRule->MediaServerL( index );
+
+                if (ruleServerUDN == server->MediaServer()) // compare UDNs
+                    {
+                    // found - break this loop
+                    index = ruleServerCount;
+                    // found - mark selected
+                    item->SetSelectionStatus( ETrue );
+                    iSelectedItemCount++;
+                    }
+                }
+            // append item to list
+            iItemArray->AppendL(item);
+            CleanupStack::Pop( item );
+            CleanupStack::PopAndDestroy( devName );
+            }
+        else    // we don't need this kind of servers anymore so remove it
+            {
+            delete server;
+            iServers->Remove( idx );
+            idx--; // remove transfers next item to current index
+            serverCount--; // servers on the list were reduced
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::DeleteAllServersFromRuleL
+// Deletes all servers from rule
+// --------------------------------------------------------------------------
+//
+void CMSStoreServersSetting::DeleteAllServersFromRuleL()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleServersSetting::\
+    CMSStoreServersSetting"));
+
+    // count of servers set to rule
+    TInt ruleServerCount = iRule->MediaServerCount();
+
+    for ( TInt index = ruleServerCount-1; index >= 0; index-- )
+        {
+        const TDesC8& ruleServerUDN = iRule->MediaServerL( index );
+        iRule->DeleteMediaServer( ruleServerUDN );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::CountSelectedItems
+// Counts selected items
+// --------------------------------------------------------------------------
+//
+TInt CMSStoreServersSetting::CountSelectedItems()
+    {
+    LOG(_L("[MediaServant]\t CMSRuleServersSetting::\
+    CMSStoreServersSetting"));
+
+    TInt count(0);
+
+    for ( TInt index = 0; index < iItemArray->Count(); index++ )
+        {
+        if ( (*iItemArray)[index]->SelectionStatus() )
+            {
+            count++;
+            }
+        }
+
+    return count;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreServersSetting::SetSettingItemTextL
+// Sets setting item secondary text according to selected items
+// --------------------------------------------------------------------------
+//
+void CMSStoreServersSetting::SetSettingItemTextL()
+    {
+        TInt count = CountSelectedItems();
+
+        HBufC* itemText = NULL;
+        // no items selected
+        if ( count == 0 )
+            {
+            itemText = StringLoader::LoadLC( R_MS_NO_SELECTED_ITEMS );
+            iSettingText->Des().Copy( *itemText );
+            }
+        // just one item selected
+        else if ( count == 1 )
+            {
+            TInt itemCount = iItemArray->Count();
+            for ( TInt index = 0; index < itemCount; index++ )
+                {
+                CSelectableItem* item = (*iItemArray)[ index ];
+                if ( item->SelectionStatus() )
+                    {
+                    iSettingText->Des().Copy( item->ItemText() );
+                    index = itemCount; // break loop
+                    }
+                }
+            }
+        // more than one item selected
+        else
+            {
+            itemText = StringLoader::LoadLC( R_MS_ITEM_DEVICES, count );
+
+            // do number conversion
+            TPtr ptr = itemText->Des();
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+
+            iSettingText->Des().Copy( *itemText );
+            }
+
+        if ( itemText )
+            {
+            CleanupStack::PopAndDestroy( itemText );
+            }
+
+         // Set new value
+         SetExternalText( *iSettingText );
+    }
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msstoresettingslist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,410 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreSettingsList class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <StringLoader.h>
+
+#include "cmsqlpropertycontainer.h"
+#include "mserv.hlp.hrh"
+#include "cmstorerule.h"
+#include "cmstorerulecontainer.h"
+#include "msengine.h"
+#include "msstorelistcontroller.h"
+#include "msappui.h"
+#include "msstoresettingslist.h"
+#include "msstoresettingsview.h"
+#include "msconstants.h"
+#include "msstoreserverssetting.h"        // Servers
+#include "msstorekeeponphonesetting.h"    // Keep on phone
+#include "mediaservant.hrh"
+#include "mediaservantuid.h"
+#include "msdebug.h"
+
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::NewL()
+// Two phase constructor.
+// --------------------------------------------------------------------------
+//
+CMSStoreSettingsList* CMSStoreSettingsList::NewL( TInt aResourceId,
+                CMSAppUi& aAppUi, CMSStoreSettingsView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsList::NewL"));
+    
+    CMSStoreSettingsList* self =
+                    CMSStoreSettingsList::NewLC( aResourceId,
+                                                 aAppUi,
+                                                 aView );
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::NewLC()
+// Two phase constructor.
+// --------------------------------------------------------------------------
+//
+CMSStoreSettingsList* CMSStoreSettingsList::NewLC( TInt aResourceId,
+                CMSAppUi& aAppUi, CMSStoreSettingsView& aView )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsList::NewLC"));
+    
+    CMSStoreSettingsList* self =
+                    new ( ELeave ) CMSStoreSettingsList( aAppUi, aView );
+    CleanupStack::PushL( self );
+    self->ConstructL( aResourceId );
+    
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::CMSStoreSettingsList()
+// --------------------------------------------------------------------------
+//
+CMSStoreSettingsList::CMSStoreSettingsList( CMSAppUi& aAppUi,
+                                            CMSStoreSettingsView& aView )
+    : iAppUi( aAppUi ), iView( aView )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::~CMSStoreSettingsList()
+// --------------------------------------------------------------------------
+//
+CMSStoreSettingsList::~CMSStoreSettingsList()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::ConstructL()
+// Second phase constructor.
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsList::ConstructL( TInt aResourceId )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsList::ConstructL"));
+
+    iAppUi.MSEngine()->SetObserver( this );
+
+    // get selected item index from previous screen
+    TInt selected = iAppUi.ParameterAgent()->StoreViewFocusIndex();
+    
+    // get list container
+    iStoreRuleContainer =
+            iAppUi.StoreListController()->StoreListContainer();
+    
+    // get rule
+    iStoreRule = iStoreRuleContainer->StoreRule( selected );
+
+    // read media type
+    iStoreRule->StoreRule(0, &iMediaType);
+
+    // Set title pane
+    SetTitlePaneTextL();
+
+    // Read rule status
+    ReadRuleStatus();
+
+    CAknSettingItemList::ConstructFromResourceL( aResourceId );
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::SaveKeepOnPhoneSetting
+// Save value to rule
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsList::SaveKeepOnPhoneSetting()
+    {
+    // KEEP ON PHONE
+    switch ( iKeepOnPhone )
+        {
+        case EMSDontKeep:
+            {
+            iStoreRule->SetStatus( ECmToBeRemoved );
+            break;
+            }
+        case EMSKeep:
+            {
+            iStoreRule->SetStatus( ECmKeepOnDevice );
+            break;
+            }
+        case EMSKeepOriginalSize:
+            {
+            iStoreRule->SetStatus( ECmKeepOnDevice );
+            break;
+            }
+        case EMSKeepScreenSize:
+            {
+            iStoreRule->SetStatus( ECmToBeShrinked );
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSStoreSettingsList::\
+            SaveValues keep on phone setting not found"));
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::ReadRuleStatus
+// Reads rule status
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsList::ReadRuleStatus()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsList::ReadRuleStatus"));
+
+    switch ( iStoreRule->Status() )
+        {
+        case ECmToBeRemoved:
+            {
+            iKeepOnPhone = EMSDontKeep;
+            break;
+            }
+        case ECmKeepOnDevice:
+            {
+            if ( iMediaType == ECmImage || iMediaType == ECmOtherImage )
+                {
+                iKeepOnPhone = EMSKeepOriginalSize;
+                }
+            else
+                {
+                iKeepOnPhone = EMSKeep;
+                }
+            break;
+            }
+        case ECmToBeShrinked:
+            {
+            iKeepOnPhone = EMSKeepScreenSize;
+            break;
+            }
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSStoreSettingsList::\
+            SaveValues keep on phone setting not found"));
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAknSettingItem* CMSStoreSettingsList::CreateSettingItemL()
+// Takes care of creating actual setting items.
+// --------------------------------------------------------------------------
+//
+CAknSettingItem* CMSStoreSettingsList::CreateSettingItemL( TInt aIdentifier )
+    {
+    CAknSettingItem* settingItem = NULL;
+
+    // setting item is created according to aIdentifier
+    switch ( aIdentifier )
+        {
+        case EMSKeepOnPhone:
+            {
+            settingItem = new ( ELeave ) CMSStoreKeepOnPhoneSetting(
+                                            aIdentifier,
+                                            iMediaType,
+                                            iKeepOnPhone );
+            break;
+            }
+
+        case EMSSourceServers:
+            {
+            settingItem = CMSStoreServersSetting::NewL(
+                                            aIdentifier,
+                                            iStoreRule,
+                                            iAppUi,
+                                            iDummyText );
+            break;
+            }
+        default:
+            {
+            LOG( _L( "[MediaServant]\t CMSStoreSettingsList::\
+            CreateSettingItemL invalid setting item" ) );
+            break;
+            }
+        }
+    return settingItem;
+    }
+
+
+// ---------------------------------------------------------
+// CMSStoreSettingsList::OpenSelectedListboxItemL
+// ---------------------------------------------------------
+//
+void CMSStoreSettingsList::OpenSelectedListboxItemL()
+    {
+    HandleListBoxEventL( ListBox(), EEventEnterKeyPressed );
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::HandleListBoxEventL()
+// Handles listbox events
+// --------------------------------------------------------------------------
+//
+void  CMSStoreSettingsList::HandleListBoxEventL ( CEikListBox *aListBox,
+                                                 TListBoxEvent aEventType)
+    {
+    // Base class call
+    CAknSettingItemList::HandleListBoxEventL ( aListBox, aEventType );
+    // values need to be stored
+    StoreSettingsL();
+
+
+    CAknSettingItemArray* itemArray = SettingItemArray();
+
+    TInt currentItem = ListBox()->CurrentItemIndex();
+    if ( currentItem < itemArray->Count() )
+        {
+        CAknSettingItem* item= (*itemArray)[currentItem];
+
+        // show add fill rule query if last item "Add more rules" selected
+        if ( item->Identifier() == EMSKeepOnPhone )
+            {
+            SaveKeepOnPhoneSetting();
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::ReadyL()
+// engine observer callback
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsList::ReadyL( TCmService aService, TInt /*aError*/ )
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsList::ReadyL"));
+
+    switch ( aService )
+        {
+
+        case ECmServiceStore:
+            {
+            // stop showing 'reading date text
+            iView.ClearCurrentNaviPaneText();
+            break;
+            }
+
+        default:
+            {
+            LOG(_L("[MediaServant]\t CMSStoreSettingsList::ReadyL \
+            service not found"));
+            break;
+            }
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::SetTitlePaneTextL
+// Sets title pane text
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsList::SetTitlePaneTextL()
+    {
+    LOG( _L( "[MediaServant]\t CMSStoreSettingsList::SetTitlePaneTextL" ) );
+
+    HBufC* title(0);
+
+    switch ( iMediaType )
+        {
+        case ECmVideo:
+            {
+            title = StringLoader::LoadLC( R_MS_STORE_TITLE_PHONE_VIDEOS );
+            break;
+            }
+        case ECmOtherVideo:
+            {
+            title = StringLoader::LoadLC( R_MS_STORE_TITLE_VIDEOS );
+            break;
+            }
+        case ECmOtherImage:
+            {
+            title = StringLoader::LoadLC( R_MS_STORE_TITLE_IMAGES );
+            break;
+            }
+        case ECmAudio:
+            {
+            title = StringLoader::LoadLC( R_MS_STORE_TITLE_MUSIC );
+            break;
+            }
+        case ECmImage:
+            {
+            title = StringLoader::LoadLC( R_MS_STORE_TITLE_PHONE_IMAGES );
+            break;
+            }
+        default:
+            {
+            LOG( _L( "[MediaServant]\t CMSStoreSettingsList::\
+            SetTitlePaneTextL invalid mediatype" ) );
+            break;
+            }
+        }
+
+    if ( title )
+        {
+        // Set title pane text
+        iView.SetTitlePaneTextL( *title );
+        CleanupStack::PopAndDestroy( title );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::SizeChanged()
+// Called by framework when the view size is changed.
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsList::SizeChanged()
+    {
+    ListBox()->SetRect( Rect() ); // Set rectangle of listbox.
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsList::HandleResourceChange
+// Handles layout change
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsList::HandleResourceChange( TInt aType )
+    {
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect( iView.ClientRect() );
+        }
+
+    CCoeControl::HandleResourceChange( aType );
+    }
+
+// ---------------------------------------------------------------------------
+// CMSStoreSettingsList::GetHelpContext
+// ---------------------------------------------------------------------------
+//
+void CMSStoreSettingsList::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsList::GetHelpContext"));
+
+    aContext.iMajor = TUid::Uid(KMediaServantUID3);
+    aContext.iContext = KMSERV_HLP_STORE_SETTINGS;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/contentmanager/mediaservant/src/msstoresettingsview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMSStoreSettingsView class implementation
+*
+*/
+
+
+#include <mediaservant.rsg>
+#include <hlplch.h>
+
+#include "msstoresettingslist.h"
+#include "msstorelistcontroller.h"
+#include "msengine.h"
+#include "msstoresettingsview.h"
+#include "msappui.h"
+#include "msconstants.h"
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsView::CMSStoreSettingsView()
+// --------------------------------------------------------------------------
+//
+CMSStoreSettingsView::CMSStoreSettingsView( CMSAppUi& aAppUi ) :
+    iAppUi( aAppUi )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsView::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsView::ConstructL()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsView::ConstructL"));
+
+    BaseConstructL( R_MS_STORE_SETTINGS_VIEW );
+    }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsView::~CMSStoreSettingsView()
+// --------------------------------------------------------------------------
+//
+CMSStoreSettingsView::~CMSStoreSettingsView()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsView::~CMSFillRuleEditView"));
+
+    DoDeactivate();
+    }
+
+// --------------------------------------------------------------------------
+// TUid CMSStoreSettingsView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CMSStoreSettingsView::Id() const
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsView::Id"));
+
+    return KMSStoreSettingsViewId;
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsView::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsView::HandleCommandL(TInt aCommand)
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsView::HandleCommandL"));
+
+    switch (aCommand)
+        {
+        case EAknCmdOpen:
+            {
+            iContainer->OpenSelectedListboxItemL();
+            break;
+            }
+        case EAknSoftkeyDone:
+            {
+            // getting data not yet finished so we must cancel the operation
+            TCmServerState state;
+            iAppUi.MSEngine()->ServerState( state );
+            if ( state == ECmServerStateGettingStoreFields )
+                {
+                LOG( _L( "[MediaServant]\t CMSFillRuleEditList::\
+                ~CMSFillRuleEditList cancel operation" ) );
+                iAppUi.MSEngine()->StopOperation();
+                ClearCurrentNaviPaneText();
+                }
+
+            // Get store list container
+            CCmStoreRuleContainer* storeRuleContainer =                                            
+                        iAppUi.StoreListController()->StoreListContainer();
+
+            // Set rules to server
+            iAppUi.MSEngine()->SetStoreRulesL( storeRuleContainer );
+
+            iAppUi.ChangeViewL( KMSStoreSettingsViewId, KMSStoreListViewId );
+            break;
+            }
+        case EAknCmdHelp :
+            {
+            TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL(
+                        iEikonEnv->WsSession(),
+            iEikonEnv->EikAppUi()->AppHelpContextL() ));
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL(aCommand);
+            break;
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsView::DoActivateL()
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsView::DoActivateL"));
+
+    if ( !iContainer )
+        {
+        // create settings screen
+        iContainer = CMSStoreSettingsList::NewL( R_MS_STORE_SETTINGS_LIST,
+                                                 iAppUi,
+                                                 *this );
+        iContainer->SetMopParent( this );
+
+        // now control receives keyboard events
+        iAppUi.AddToStackL( *this, iContainer );
+        iContainer->ActivateL();
+        }
+   }
+
+// --------------------------------------------------------------------------
+// CMSStoreSettingsView::DoDeactivate()
+// --------------------------------------------------------------------------
+//
+void CMSStoreSettingsView::DoDeactivate()
+    {
+    LOG(_L("[MediaServant]\t CMSStoreSettingsView::DoDeactivate"));
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        }
+
+    delete iContainer; // Deletes the container class object.
+    iContainer = NULL;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for mediaservant
+*
+*/
+
+
+#include "../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+WINSCW ARMV5
+
+
+PRJ_EXPORTS
+../group/msdebug.h                  |../../inc/msdebug.h
+../install/mediaservant_stub.SIS    /epoc32/data/z/system/install/mediaservant_stub.sis
+../rom/mediaservant.iby             CORE_MW_LAYER_IBY_EXPORT_PATH(mediaservant.iby)
+../rom/mediaservantresources.iby    LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(mediaservantresources.iby)
+../conf/mediaservant.confml         APP_LAYER_CONFML(component.confml)
+../conf/mediaservant_10281fab.crml  APP_LAYER_CRML(component_10281fab.crml)
+
+
+PRJ_MMPFILES
+#include "../contentmanager/cmserver/cmmemorymanager/group/bld.inf"
+#include "../contentmanager/cmserver/cmfillmanager/group/bld.inf"
+#include "../contentmanager/cmserver/cmstoremanager/group/bld.inf"
+#include "../contentmanager/cmserver/cmscheduler/group/bld.inf"
+#include "../contentmanager/cmserver/cmserver/group/bld.inf"
+#include "../contentmanager/mediaservant/applicationengine/group/bld.inf"
+#include "../contentmanager/homesyncwizard/group/bld.inf"
+#include "../contentmanager/homesyncgsplugin/group/bld.inf"
+#include "../contentmanager/mediaservant/group/bld.inf"
+
+// end of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/group/build_mediaservant.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description: Build mediaservant
+rem
+
+echo on
+echo Building !!
+
+call bldmake bldfiles
+call abld build armv5 >"%DRIVE%"\mediaservant_2.1\group\mediaservant_armv5.txt 2>&1
+call abld build armv5 -c >"%DRIVE%"\mediaservant_2.1\group\mediaservant_armv5_check.txt 2>&1
+cd "%DRIVE%"\mediaservant_2.1\install
+call mediaservant_sis.bat
+call mediaservant_stub_sis.bat
+cd "%DRIVE%"\
+
+echo Done !!!
+echo off
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/group/clean_mediaservant.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,28 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description: Clean mediaservant
+rem
+
+echo on
+echo Cleaning !!
+
+del mediaservant_armv5.txt
+del mediaservant_armv5_check.txt
+
+call abld reallyclean
+call bldmake clean
+
+echo Done !!!
+echo off
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/group/mediaservantvariant.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MediaServant variation flags
+*
+*  The file is included by any code (cpp and resource) that needs to
+*  have static (compilation time, link time, image build time) or
+*  dynamic (run time) variation support for variant specific features.
+*
+*  Each feature is declared as follows:
+*  - declare a supported or  turned-on feature (static variation)
+*    - #define __FXX
+*  - declare an unsupported or turned-off feature (static variation)
+*    - #undef __FXX
+*  - declare ID for dynamic variation (see Feature Manager component)
+*    - #define KFeatureIdFxx KOtherFeatureFirst + nn
+*
+*
+*/
+
+
+#ifndef MEDIASERVANTVARIANT_HRH
+#define MEDIASERVANTVARIANT_HRH
+
+/**
+* This flag indicates that MdS is used as a metadata storage
+*/
+//#define __USE_MDS_FOR_METADATA
+
+/* Whether to use libxml2 or Symbian native parser in Cds Sync */
+//#define __USE_LIBXML2_PARSER
+
+//#define __USE_REDUCED_CAPABILITIES
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/group/msdebug.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common trace-information file.
+*
+*/
+
+
+#ifndef DEBUG_H
+#define DEBUG_H
+
+/**
+ *  NOTE: Link to flogger.lib in MMP file. Use DEBUGLIBRARY -keyword to avoid
+ *        warnings in release builds.
+ *        Example:  DEBUGLIBRARY    flogger.lib
+ */
+
+/**
+ * Usage: LOG(_L("[MODULE_NAME]\t Trace text here"));
+ *        TRACE(Print(_L("[MODULE_NAME]\t Trace text here with parameter %d"),
+ *              iCount));
+ *
+ *        Trace target can be changed below (file logging needs directory 
+ *        c:\logs\upnp)
+ *        #define __FLOGGING -row uncommented (default)  = File logging
+ *        #define __CLOGGING -row uncommented            = Console logging
+ */
+
+// undefine for sure
+#undef __FLOGGING__
+#undef __CLOGGING__
+
+#ifdef _DEBUG
+// Define one of these flags:
+// FLOGGING = File logging
+// CLOGGING = Console logging
+#define __FLOGGING__
+//#define __CLOGGING__
+#endif
+
+
+
+// Then actual definitions depending on the 
+// flag values.
+
+#ifdef _DEBUG
+
+    #include <e32std.h>
+
+
+    // Actual log file name
+    _LIT(KLogFile,"ComponentLog.txt");
+
+    // Subdirectory under c:\logs -directory
+    _LIT(KLogDir, "component");
+
+    #include <f32file.h>
+    #include <flogger.h>
+
+
+    // Define the top level macros
+    #define LOG(a) {Print(a);}
+    #define TRACE(a) {a;}
+
+
+    #ifdef __FLOGGING__
+
+        inline void Print(const TRefByValue<const TDesC> aFmt, ...)
+            {
+            VA_LIST list;
+            VA_START(list,aFmt);
+            TBuf<32> logFile(KLogFile);
+            RFileLogger::WriteFormat( KLogDir, 
+                                      logFile, 
+                                      EFileLoggingModeAppend, 
+                                      aFmt, 
+                                      list );
+            }
+
+    #else
+        // Console Logging on
+        #define Print RDebug::Print
+
+    #endif  // __FLOGGING__
+
+#else
+
+    // DEBUG build is not on --> no logging at all
+    #define LOG(a)
+    #define TRACE(a)
+
+#endif  // _DEBUG
+
+#endif      // DEBUG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/install/make_mediaservant_sis.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,25 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description: Mediaservant sisx
+rem
+
+makesis cenrep.pkg
+signsis cenrep.sis cenrep.sisx rd.cer rd-key.pem
+
+makesis mediaservant.pkg
+signsis mediaservant.sis mediaservant.sisx  rd.cer rd-key.pem
+del ..\sis\mediaservant.sis /F
+del ..\sis\mediaservant.sisx /F
+move .\mediaservant.sis ..\sis
+move .\mediaservant.sisx ..\sis
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/install/make_mediaservant_stub_sis.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description: Mediaservant stub sis
+rem
+
+del mediaservant_stub.sis /F
+makesis -s mediaservant_stub.pkg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/install/mediaservant.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,63 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Mediaservatn package
+;
+; mediaservant.pkg
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"Home Sync"},(0x20022D5B),1,1,0, TYPE=SA, RU
+
+;Localized Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;Supports Series 60 v 3.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+
+; Files to copy
+"\epoc32\release\armv5\urel\mediaservant.exe"-"!:\sys\bin\mediaservant.exe"
+"\epoc32\data\z\private\10003a3f\apps\mediaservant_reg.rsc"-"!:\private\10003a3f\import\apps\mediaservant_reg.rsc"
+"\epoc32\data\z\resource\apps\mediaservant_aif.mif"-"!:\resource\apps\mediaservant_aif.mif"
+"\epoc32\data\z\resource\apps\mediaservant.mif"-"!:\resource\apps\mediaservant.mif"
+"\epoc32\release\armv5\urel\msengine.dll"-"!:\sys\bin\msengine.dll"
+"\epoc32\release\armv5\urel\msappwizard.dll"-"!:\sys\bin\msappwizard.dll"
+"\epoc32\data\z\resource\apps\msappwizard.mif"-"!:\resource\apps\msappwizard.mif"
+
+; Mediaservant plugin
+"\epoc32\data\z\resource\plugins\mediaservantplugin.rsc"-"!:\resource\plugins\mediaservantplugin.rsc"
+"\epoc32\release\armv5\urel\mediaservantplugin.dll"-"!:\sys\bin\mediaservantplugin.dll"
+
+; GS plugin
+"\epoc32\data\z\resource\plugins\msgsplugin.rsc"-"!:\resource\plugins\msgsplugin.rsc"
+"\epoc32\release\armv5\urel\msgsplugin.dll"-"!:\sys\bin\msgsplugin.dll"
+
+"\epoc32\release\armv5\urel\cmfillmanager.dll"-"!:\sys\bin\cmfillmanager.dll"
+"\epoc32\release\armv5\urel\cmstoremanager.dll"-"!:\sys\bin\cmstoremanager.dll"
+"\epoc32\release\armv5\urel\cmscheduler.dll"-"!:\sys\bin\cmscheduler.dll"
+"\epoc32\release\armv5\urel\cmmemorymanager.dll"-"!:\sys\bin\cmmemorymanager.dll"
+"\epoc32\release\armv5\urel\cmclient.dll"-"!:\sys\bin\cmclient.dll"
+"\epoc32\release\armv5\urel\cmserver.exe"-"!:\sys\bin\cmserver.exe"
+
+"\epoc32\data\z\resource\apps\mediaservant.rsc"-"!:\resource\apps\mediaservant.rsc"
+"\epoc32\data\z\resource\apps\cmsappwizard.rsc"-"!:\resource\apps\cmsappwizard.rsc"
+"\epoc32\data\z\resource\apps\memorymanager.rsc"-"!:\resource\apps\memorymanager.rsc"
+"\epoc32\data\z\resource\msgspluginsrc.rsc"-"!:\resource\msgspluginsrc.rsc"
+
+; End of File
Binary file homesync/install/mediaservant_stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/install/mediaservant_stub.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,57 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Mediaservant stub package
+;
+; mediaservant_stub.pkg
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"MediaServant"},(0x20022D5B),1,1,0, TYPE=SA
+
+;Localized Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;Supports Series 60 v 3.0
+;[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+""-"z:\sys\bin\mediaservant.exe"
+""-"z:\sys\bin\msengine.dll"
+""-"z:\sys\bin\msappwizard.dll"
+""-"z:\sys\bin\mediaservantplugin.dll"
+""-"z:\sys\bin\msgsplugin.dll"
+""-"z:\sys\bin\cmfillmanager.dll"
+""-"z:\sys\bin\cmstoremanager.dll"
+""-"z:\sys\bin\cmscheduler.dll"
+""-"z:\sys\bin\cmmemorymanager.dll"
+""-"z:\sys\bin\cmclient.dll"
+""-"z:\sys\bin\cmserver.exe"
+
+""-"z:\resource\apps\mediaservant.r*"
+""-"z:\resource\apps\mediaservant.mif"
+""-"z:\resource\apps\mediaservant_aif.mif"
+""-"z:\resource\apps\msappwizard.mif"
+""-"z:\resource\apps\cmsappwizard.r*"
+""-"z:\resource\apps\memorymanager.r*"
+""-"z:\resource\msgspluginsrc.r*"
+""-"z:\resource\plugins\msgsplugin.r*"
+""-"z:\resource\plugins\mediaservantplugin.r*"
+
+""-"z:\private\10003a3f\import\apps\mediaservant_reg.r*"
+
+; End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/rom/mediaservant.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Mediaservant iby
+*
+*/
+#ifndef __MEDIASERVANT_IBY__
+#define __MEDIASERVANT_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+#include <productvariant.hrh>
+
+// Application and setup wizard
+file=ABI_DIR\BUILD_DIR\mediaservant.exe \sys\bin\mediaservant.exe
+data=\epoc32\data\z\private\10003a3f\apps\mediaservant_reg.rsc \private\10003a3f\import\apps\mediaservant_reg.rsc
+data=\epoc32\data\z\resource\apps\mediaservant_aif.mif \resource\apps\mediaservant_aif.mif
+data=\epoc32\data\z\resource\apps\mediaservant.mif \resource\apps\mediaservant.mif
+file=ABI_DIR\BUILD_DIR\msengine.dll \sys\bin\msengine.dll
+file=ABI_DIR\BUILD_DIR\msappwizard.dll \sys\bin\msappwizard.dll
+data=\epoc32\data\z\resource\apps\msappwizard.mif \resource\apps\msappwizard.mif
+data=\epoc32\data\z\resource\apps\msgsplugin.mif \resource\apps\msgsplugin.mif
+
+// Plugins
+ECOM_PLUGIN( mediaservantplugin.dll, mediaservantplugin.rsc )
+ECOM_PLUGIN( msgsplugin.dll, msgsplugin.rsc )
+
+// Engine
+file=ABI_DIR\BUILD_DIR\cmfillmanager.dll \sys\bin\cmfillmanager.dll
+file=ABI_DIR\BUILD_DIR\cmstoremanager.dll \sys\bin\cmstoremanager.dll
+file=ABI_DIR\BUILD_DIR\cmscheduler.dll \sys\bin\cmscheduler.dll
+file=ABI_DIR\BUILD_DIR\cmmemorymanager.dll \sys\bin\cmmemorymanager.dll
+file=ABI_DIR\BUILD_DIR\cmclient.dll \sys\bin\cmclient.dll
+file=ABI_DIR\BUILD_DIR\cmserver.exe \sys\bin\cmserver.exe
+
+// export mediaservant_stub.sis file
+data=ZSYSTEM\install\mediaservant_stub.sis    system\install\mediaservant_stub.sis 
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __MEDIASERVANT_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homesync/rom/mediaservantresources.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Mediaservant resources iby
+*
+*/
+#ifndef __MEDIASERVANTRESOURCES_IBY__
+#define __MEDIASERVANTRESOURCES_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+#include <productvariant.hrh>
+
+// Application and setup wizard
+data=\epoc32\data\z\resource\apps\mediaservant.rsc \resource\apps\mediaservant.rsc
+data=\epoc32\data\z\resource\apps\cmsappwizard.rsc \resource\apps\cmsappwizard.rsc
+
+// Engine
+data=\epoc32\data\z\resource\apps\memorymanager.rsc \resource\apps\memorymanager.rsc
+
+// msgsplugin
+data=DATAZ_\RESOURCE_FILES_DIR\msgspluginsrc.rsc RESOURCE_FILES_DIR\msgspluginsrc.rsc
+
+// cmserver startup disabled
+//data=\epoc32\data\z\resource\apps\cmserver_reg.rsc \private\10003a3f\import\apps\cmserver_reg.rsc
+//data=\epoc32\data\z\resource\apps\cmserver.rsc \private\101f875a\import\[100FFFFF].rsc
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __MEDIASERVANTRESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/mw/dlnasrv" >
+]>
+
+<SystemDefinition name="dlnasrv" schema="1.4.0">
+  <systemModel>
+    <layer name="mw_layer">
+      <module name="dlnasrv">
+        <unit name="dlnasrv" unitID="hcdo.dlnasrv" bldFile="&layer_real_source_path;/group" mrp="" />
+      </module>
+    </layer>
+
+    <layer name="api_test_layer">
+      <module name="hcdo_api_tests">
+<!--
+        <unit unitID="hcdo.avcontrolframework.test" name="avcontrolframework.test" bldFile="&layer_real_source_path;/upnpavcontrolpoint/avcontrolframework/tsrc/public/basic/group" mrp="" />
+        <unit unitID="hcdo.avobjects.test" name="avobjects.test" bldFile="&layer_real_source_path;/upnpmediaserver/avobjects/tsrc/public/basic/group" mrp="" />
+        <unit unitID="hcdo.mediaserverclient.test" name="mediaserverclient.test" bldFile="&layer_real_source_path;/upnpmediaserver/mediaserverclient/tsrc/public/basic/group" mrp="" />
+        <unit unitID="hcdo.controlpointbase.test" name="controlpointbase.test" bldFile="&layer_real_source_path;/upnpstack/controlpointbase/tsrc/public/basic/group" mrp="" />
+        <unit unitID="hcdo.serviceframework.test" name="serviceframework.test" bldFile="&layer_real_source_path;/upnpstack/serviceframework/tsrc/public/basic/group" mrp="" />
+        <unit unitID="hcdo.upnputils.test" name="upnputils.test" bldFile="&layer_real_source_path;/upnpstack/upnputils/tsrc/public/basic/group" mrp="" />
+        <unit unitID="hcdo.testplugin.test" name="testplugin.test" bldFile="&layer_real_source_path;/dlnasrv_plat/upnp_plugin_api/tsrc/testplugin/group" mrp="" />
+        <unit unitID="hcdo.upnpextensionpluginiftest.test" name="upnpextensionpluginiftest.test" bldFile="&layer_real_source_path;/dlnasrv_plat/upnp_plugin_api/tsrc/upnpextensionpluginiftest/group" mrp="" />
+        <unit unitID="hcdo.upnpxmlparsertes.test" name="upnpxmlparsertest.test" bldFile="&layer_real_source_path;/upnpavcontroller/upnpxmlparser/tsrc/upnpxmlparsertest/group" mrp="" />
+        <unit unitID="hcdo.upnpsecuritytest.test" name="upnpsecuritytest.test" bldFile="&layer_real_source_path;/upnpsharing/upnpsecurity/tsrc/upnpsecuritytest/group" mrp="" />
+-->
+        <unit unitID="hcdo.api.test" name="api.test" bldFile="&layer_real_source_path;/tsrc/group" mrp="" />
+    </module>
+    </layer>
+
+  </systemModel>
+</SystemDefinition>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0">
+  <package id="dlnasrv" name="DLNA Services" levels="stack server ctrl framework plugin">
+    <collection id="upnpavcontrolpoint" name="UPnP A/V Control Point" level="plugin">
+      <component id="avcontrolframework" filter="s60" name="A/V Control Famework" introduced="9.1" deprecated="^3">
+        <unit bldFile="upnpavcontrolpoint/avcontrolframework/group"/>
+      </component>
+      <component id="upnpavcontrolpoint_build" filter="s60" name="UPnP A/V Control Point Build" introduced="9.1" deprecated="^3">
+        <unit bldFile="upnpavcontrolpoint/group"/>
+      </component>
+    </collection>
+    <collection id="upnpmediaserver" name="UPnP Media Server" level="server">
+      <component id="avobjects" filter="s60" name="A/V Objects">
+        <unit bldFile="upnpmediaserver/avobjects/group"/>
+      </component>
+      <component id="mediaserverclient" filter="s60" name="Media Server Client">
+        <unit bldFile="upnpmediaserver/mediaserverclient/group"/>
+      </component>
+      <component id="connectionmanagerservice" filter="s60" name="Connection Manager Service">
+        <unit bldFile="upnpmediaserver/connectionmanagerservice/group"/>
+      </component>
+      <component id="contentdirectoryservice" filter="s60" name="Content Directory Service">
+        <unit bldFile="upnpmediaserver/contentdirectoryservice/group"/>
+      </component>
+      <component id="mediaserverengine" filter="s60" name="Media Server Engine">
+        <unit bldFile="upnpmediaserver/mediaserverengine/group"/>
+      </component>
+      <component id="upnpmediaserver_build" filter="s60" name="UPnP Media Server Build">
+		<!-- consider moving content into above components -->
+        <unit bldFile="upnpmediaserver/group"/>
+      </component>
+    </collection>
+    <collection id="upnpstack" name="UPnP Stack" level="stack">
+      <component id="upnputils" filter="s60" name="UPnP Utils">
+        <unit bldFile="upnpstack/upnputils/group"/>
+      </component>
+      <component id="upnpconnectionmanagersession" filter="s60" name="UPnP Connection Manager Session">
+        <unit bldFile="upnpstack/upnpconnectionmanagersession/group"/>
+      </component>
+      <component id="upnpconnmanager" filter="s60" name="UPnP Connection Manager">
+        <unit bldFile="upnpstack/upnpconnmanager/group"/>
+      </component>
+      <component id="dlnawebserver" filter="s60" name="DLNA Web Server">
+        <unit bldFile="upnpstack/dlnawebserver/group"/>
+      </component>
+      <component id="serviceframework" filter="s60" name="Service Framework">
+        <unit bldFile="upnpstack/serviceframework/group"/>
+      </component>
+      <component id="ssdpserver" filter="s60" name="SSDP Server">
+        <unit bldFile="upnpstack/ssdpserver/group"/>
+      </component>
+      <component id="messagehandler" filter="s60" name="Message Handler">
+        <unit bldFile="upnpstack/messagehandler/group"/>
+      </component>
+      <component id="controlpointbase" filter="s60" name="Control Point Base">
+        <unit bldFile="upnpstack/controlpointbase/group"/>
+      </component>
+      <component id="upnphttptransfer" filter="s60" name="UPnP HTTP Transfer">
+        <unit bldFile="upnpstack/upnphttptransfer/group"/>
+      </component>
+      <component id="upnpstack_build" filter="s60" name="UPnP Stack Build">
+		<!-- consider moving content into above components -->
+        <unit bldFile="upnpstack/group"/>
+      </component>
+    </collection>
+    <collection id="upnpsharing" name="UPnP Sharing" level="server">
+      <component id="upnpdlnaprofiler" filter="s60" name="UPnP DLNA Profiler" introduced="^2">
+        <unit bldFile="upnpsharing/upnpdlnaprofiler/group"/>
+      </component>
+      <component id="upnpsecurity" filter="s60" name="UPnP Security" introduced="^2">
+        <unit bldFile="upnpsharing/upnpsecurity/group"/>
+      </component>
+      <component id="upnpcontentserver" filter="s60" name="UPnP Content Server" introduced="^2">
+        <unit bldFile="upnpsharing/upnpcontentserver/group"/>
+      </component>
+      <component id="applicationengine" filter="s60" name="UPnP Application Engine" introduced="^2">
+        <unit bldFile="upnpsharing/applicationengine/group"/>
+      </component>
+      <component id="upnpsharing_build" filter="s60" name="UPnP Sharing Build" introduced="^2">
+		<!-- consider moving content into above components -->
+        <unit bldFile="upnpsharing/group"/>
+      </component>
+    </collection>
+    <collection id="upnpsettings" name="UPnP Settings" level="framework">
+      <component id="upnpsettingsengine" filter="s60" name="UPnP Settings Engine" introduced="^2">
+        <unit bldFile="upnpsettings/upnpsettingsengine/group"/>
+      </component>
+      <component id="multiselectionui" filter="s60" name="Multi-Selection UI" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpsettings/multiselectionui/group"/>
+      </component>
+      <component id="appwizard" filter="s60" name="UPnP Settings Wizard App" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpsettings/appwizard/group"/>
+      </component>
+      <component id="upnpsharingui" filter="s60" name="UPnP Sharing UI" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpsettings/upnpsharingui/group"/>
+      </component>
+      <component id="upnpgsplugin" filter="s60" name="UPnP GS Plugin" class="plugin" introduced="^2">
+        <unit bldFile="upnpsettings/upnpgsplugin/group"/>
+      </component>
+      <component id="upnpsettings_build" filter="s60" name="UPnP Settings Build" introduced="^2">
+		<!-- consider moving content into above components -->
+        <unit bldFile="upnpsettings/group"/>
+      </component>
+    </collection>
+    <collection id="upnpmpxplugins" name="UPnP MPX Plugins" level="plugin">
+      <component id="upnpplaybackplugins" filter="s60" name="UPnP Playback Plugins" class="plugin" introduced="^2">
+        <unit bldFile="upnpmpxplugins/upnpplaybackplugins/group"/>
+      </component>
+      <component id="upnpmpxplugins_build" filter="s60" name="UPnP MPX Plugins Build" introduced="^2">
+		<!-- consider moving content into above components -->
+        <unit bldFile="upnpmpxplugins/group"/>
+      </component>
+    </collection>
+    <collection id="upnpharvester" name="UPnP Harvester" level="ctrl">
+      <component id="upnpharvester_common" filter="s60" name="UPnP Harvester Common" introduced="^2" deprecated="^3">
+		<!-- need to merge or #include these to a single bld.inf -->
+        <unit bldFile="upnpharvester/common/cmlibrary/group"/>
+        <unit bldFile="upnpharvester/common/cmsettings/group"/>
+        <unit bldFile="upnpharvester/common/cmsqlwrapper/group"/>
+        <unit bldFile="upnpharvester/common/dbmanager/group"/>
+      </component>
+      <component id="cdssync" filter="s60" name="CDS Sync" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpharvester/cdssync/common"/>
+      </component>
+      <component id="mdhserver" filter="s60" name="Metadata Harvester Server" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpharvester/mdhserver/group"/>
+      </component>
+      <component id="upnpharvester_build" filter="s60" name="UPnP Harvester Build" introduced="^2" deprecated="^3">
+		<!-- consider moving content into above components -->
+        <unit bldFile="upnpharvester/group"/>
+      </component>
+    </collection>
+    <collection id="upnpframework" name="UPnP Framework" level="framework">
+      <component id="upnputilities" filter="s60" name="UPnP Utilities" introduced="^2">
+        <unit bldFile="upnpframework/upnputilities/group"/>
+      </component>
+      <component id="upnpextensionpluginif" filter="s60" name="UPnP Extension Plugin Interface" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpframework/upnpextensionpluginif/group"/>
+      </component>
+      <component id="upnpfiletransferengine" filter="s60" name="UPnP File Transfer Engine" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpframework/upnpfiletransferengine/group"/>
+      </component>
+      <component id="upnpmusicadapter" filter="s60" name="UPnP Music Adapter" introduced="^2">
+        <unit bldFile="upnpframework/upnpmusicadapter/group"/>
+      </component>
+      <component id="upnpcommonui" filter="s60" name="UPnP Common UI" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpframework/upnpcommonui/group"/>
+      </component>
+      <component id="upnpcommand" filter="s60" name="UPnP Command" introduced="^2">
+        <unit bldFile="upnpframework/upnpcommand/group"/>
+      </component>
+      <component id="upnpaiwengine" filter="s60" name="UPnP AIW Engine" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpframework/upnpaiwengine/group"/>
+      </component>
+      <component id="upnpaiwprovider" filter="s60" name="UPnP AIW Provider" class="plugin" introduced="^2" deprecated="^3">
+        <unit bldFile="upnpframework/upnpaiwprovider/group"/>
+      </component>
+      <component id="upnpframework_build" filter="s60" name="UPnP Framework Build" introduced="^2">
+		<!-- consider moving content into above components -->
+        <unit bldFile="upnpframework/group"/>
+      </component>
+    </collection>
+    <collection id="upnpavcontroller" name="UPnP A/V Controller" level="ctrl">
+      <component id="upnpxmlparser" filter="s60" name="UPnP XML Parser" introduced="^2">
+        <unit bldFile="upnpavcontroller/upnpxmlparser/group"/>
+      </component>
+      <component id="upnpavcontrollerserver" filter="s60" name="UPnP A/V Controller Server" introduced="^2">
+        <unit bldFile="upnpavcontroller/upnpavcontrollerserver/group"/>
+      </component>
+      <component id="upnpavcontrollerclient" filter="s60" name="UPnP A/V Ccontroller Client" introduced="^2">
+        <unit bldFile="upnpavcontroller/upnpavcontrollerclient/group"/>
+      </component>
+      <component id="upnpavcontrollerhelper" filter="s60" name="UPnP A/V Controller Helper" introduced="^2">
+        <unit bldFile="upnpavcontroller/upnpavcontrollerhelper/group"/>
+      </component>
+      <component id="upnpavcontroller_build" filter="s60" name="UPnP A/V Controller Build" introduced="^2">
+		<!-- consider moving content into above components -->
+        <unit bldFile="upnpavcontroller/group"/>
+      </component>
+    </collection>
+    <collection id="homesync" name="Home Sync" level="plugin">
+      <component id="contentmanager" filter="s60" name="Content Manager" introduced="^2" deprecated="^3">
+		<!-- need to merge or #include these to a single bld.inf or split into individual componens -->
+        <unit bldFile="homesync/contentmanager/cmserver/cmfillmanager/group"/>
+        <unit bldFile="homesync/contentmanager/cmserver/cmmemorymanager/group"/>
+        <unit bldFile="homesync/contentmanager/cmserver/cmscheduler/group"/>
+        <unit bldFile="homesync/contentmanager/cmserver/cmserver/group"/>
+        <unit bldFile="homesync/contentmanager/cmserver/cmstoremanager/group"/>
+        <unit bldFile="homesync/contentmanager/homesyncgsplugin/group"/>
+        <unit bldFile="homesync/contentmanager/homesyncwizard/group"/>
+        <unit bldFile="homesync/contentmanager/mediaservant/applicationengine/group"/>
+        <unit bldFile="homesync/contentmanager/mediaservant/group"/>
+      </component>
+      <component id="homesync_build" filter="s60" name="Home Sync Build" introduced="^2" deprecated="^3">
+		<!-- consider moving content into above components -->
+        <unit bldFile="homesync/group"/>
+      </component>
+    </collection>
+    <collection id="homemedia" name="Home Media" level="framework">
+      <component id="homemedia_build" filter="s60" name="Home Media" introduced="^2" deprecated="^3">
+        <unit bldFile="homemedia/group"/>
+      </component>
+    </collection>
+    <collection id="dlnasrv_info" name="DLNA Services Info" level="plugin">
+      <component id="dlnasrv_plat" filter="s60" name="DLNA Services Platform Interfaces" class="api">
+        <unit bldFile="dlnasrv_plat/group"/>
+      </component>
+      <component id="dlnasrv_build" filter="s60" name="DLNA Services Build">
+        <unit bldFile="group"/>
+      </component>
+    </collection>
+  </package>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for upnpavcontroller
+*
+*/
+
+
+
+
+
+
+#include "../../group/upnpplatformvar.hrh"
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+// ROM build
+../rom/upnpavcontroller.iby            CORE_MW_LAYER_IBY_EXPORT_PATH(upnpavcontroller.iby)
+
+PRJ_MMPFILES
+// none
+
+    // upnp xml parser
+    #include "../upnpxmlparser/group/bld.inf"
+
+    // avcontroller server
+    #include "../upnpavcontrollerserver/group/bld.inf"
+
+    // avcontroller client
+    #include "../upnpavcontrollerclient/group/bld.inf"
+
+    // avcontroller helper
+    #include "../upnpavcontrollerhelper/group/bld.inf"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/rom/upnpavcontroller.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnpavcontroller subsystem ROM include file
+*
+*/
+
+
+
+
+
+#ifndef __UPNPAVCONTROLLER_IBY__
+#define __UPNPAVCONTROLLER_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // AV Controller
+    file=ABI_DIR\BUILD_DIR\upnpavcontrollerclient.dll \sys\bin\upnpavcontrollerclient.dll
+    file=ABI_DIR\BUILD_DIR\upnpavcontrollerserver.exe \sys\bin\upnpavcontrollerserver.exe
+    file=ABI_DIR\BUILD_DIR\upnpavcontrollerhelper.dll \sys\bin\upnpavcontrollerhelper.dll
+
+    // Upnp XML Parser
+    file=ABI_DIR\BUILD_DIR\upnpxmlparser.dll \sys\bin\upnpxmlparser.dll
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __UPNPAVCONTROLLER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/bwins/upnpavcontrollerclientu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,57 @@
+EXPORTS
+	??0CUpnpAVDevice@@IAE@XZ @ 1 NONAME ; CUpnpAVDevice::CUpnpAVDevice(void)
+	??1CUpnpAVDevice@@UAE@XZ @ 2 NONAME ; CUpnpAVDevice::~CUpnpAVDevice(void)
+	??ACUpnpAVDeviceList@@QBEPAVCUpnpAVDevice@@H@Z @ 3 NONAME ; class CUpnpAVDevice * CUpnpAVDeviceList::operator[](int) const
+	?AppendDeviceL@CUpnpAVDeviceList@@QAEXAAVCUpnpAVDevice@@@Z @ 4 NONAME ; void CUpnpAVDeviceList::AppendDeviceL(class CUpnpAVDevice &)
+	?AudioCapability@CUpnpAVDevice@@QBEHXZ @ 5 NONAME ; int CUpnpAVDevice::AudioCapability(void) const
+	?CopyCapability@CUpnpAVDevice@@QBEHXZ @ 6 NONAME ; int CUpnpAVDevice::CopyCapability(void) const
+	?CopyFromL@CUpnpAVDevice@@QAEXABV1@@Z @ 7 NONAME ; void CUpnpAVDevice::CopyFromL(class CUpnpAVDevice const &)
+	?Count@CUpnpAVDeviceList@@QBEHXZ @ 8 NONAME ; int CUpnpAVDeviceList::Count(void) const
+	?DeviceType@CUpnpAVDevice@@QBE?AW4TUpnpAVDeviceType@1@XZ @ 9 NONAME ; enum CUpnpAVDevice::TUpnpAVDeviceType CUpnpAVDevice::DeviceType(void) const
+	?ExternalizeL@CUpnpAVDevice@@QBEXAAVRWriteStream@@@Z @ 10 NONAME ; void CUpnpAVDevice::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CUpnpAVDeviceList@@QBEXAAVRWriteStream@@@Z @ 11 NONAME ; void CUpnpAVDeviceList::ExternalizeL(class RWriteStream &) const
+	?FriendlyName@CUpnpAVDevice@@QBEABVTDesC8@@XZ @ 12 NONAME ; class TDesC8 const & CUpnpAVDevice::FriendlyName(void) const
+	?ImageCapability@CUpnpAVDevice@@QBEHXZ @ 13 NONAME ; int CUpnpAVDevice::ImageCapability(void) const
+	?InternalizeL@CUpnpAVDevice@@QAEXAAVRReadStream@@@Z @ 14 NONAME ; void CUpnpAVDevice::InternalizeL(class RReadStream &)
+	?InternalizeL@CUpnpAVDeviceList@@QAEXAAVRReadStream@@@Z @ 15 NONAME ; void CUpnpAVDeviceList::InternalizeL(class RReadStream &)
+	?LinkOffset@CUpnpAVDevice@@SAHXZ @ 16 NONAME ; int CUpnpAVDevice::LinkOffset(void)
+	?MSServicesInUse@UPnPAVControllerFactory@@SAHXZ @ 17 NONAME ; int UPnPAVControllerFactory::MSServicesInUse(void)
+	?MaxVolume@CUpnpAVDevice@@QBEHXZ @ 18 NONAME ; int CUpnpAVDevice::MaxVolume(void) const
+	?MuteCapability@CUpnpAVDevice@@QBEHXZ @ 19 NONAME ; int CUpnpAVDevice::MuteCapability(void) const
+	?NewL@CUpnpAVDevice@@SAPAV1@ABV1@@Z @ 20 NONAME ; class CUpnpAVDevice * CUpnpAVDevice::NewL(class CUpnpAVDevice const &)
+	?NewL@CUpnpAVDevice@@SAPAV1@XZ @ 21 NONAME ; class CUpnpAVDevice * CUpnpAVDevice::NewL(void)
+	?NewL@CUpnpAVDeviceList@@SAPAV1@XZ @ 22 NONAME ; class CUpnpAVDeviceList * CUpnpAVDeviceList::NewL(void)
+	?NewLC@CUpnpAVDevice@@SAPAV1@XZ @ 23 NONAME ; class CUpnpAVDevice * CUpnpAVDevice::NewLC(void)
+	?NewLC@CUpnpAVDeviceList@@SAPAV1@XZ @ 24 NONAME ; class CUpnpAVDeviceList * CUpnpAVDeviceList::NewLC(void)
+	?NewUPnPAVControllerL@UPnPAVControllerFactory@@SAPAVMUPnPAVController@@XZ @ 25 NONAME ; class MUPnPAVController * UPnPAVControllerFactory::NewUPnPAVControllerL(void)
+	?NewUPnPAVControllerLC@UPnPAVControllerFactory@@SAPAVMUPnPAVController@@XZ @ 26 NONAME ; class MUPnPAVController * UPnPAVControllerFactory::NewUPnPAVControllerLC(void)
+	?NextAVTransportUri@CUpnpAVDevice@@QBEHXZ @ 27 NONAME ; int CUpnpAVDevice::NextAVTransportUri(void) const
+	?PauseCapability@CUpnpAVDevice@@QBEHXZ @ 28 NONAME ; int CUpnpAVDevice::PauseCapability(void) const
+	?Remove@CUpnpAVDeviceList@@QAEXH@Z @ 29 NONAME ; void CUpnpAVDeviceList::Remove(int)
+	?RemoveAndDestroy@CUpnpAVDeviceList@@QAEXH@Z @ 30 NONAME ; void CUpnpAVDeviceList::RemoveAndDestroy(int)
+	?Reset@CUpnpAVDeviceList@@QAEXXZ @ 31 NONAME ; void CUpnpAVDeviceList::Reset(void)
+	?ResetAndDestroy@CUpnpAVDeviceList@@QAEXXZ @ 32 NONAME ; void CUpnpAVDeviceList::ResetAndDestroy(void)
+	?SearchCapability@CUpnpAVDevice@@QBEHXZ @ 33 NONAME ; int CUpnpAVDevice::SearchCapability(void) const
+	?SetAudioCapability@CUpnpAVDevice@@QAEXH@Z @ 34 NONAME ; void CUpnpAVDevice::SetAudioCapability(int)
+	?SetCapabilitiesBySupportedMimeTypesL@CUpnpAVDevice@@QAEXABVTDesC8@@@Z @ 35 NONAME ; void CUpnpAVDevice::SetCapabilitiesBySupportedMimeTypesL(class TDesC8 const &)
+	?SetCopyCapability@CUpnpAVDevice@@QAEXH@Z @ 36 NONAME ; void CUpnpAVDevice::SetCopyCapability(int)
+	?SetDeviceType@CUpnpAVDevice@@QAEXW4TUpnpAVDeviceType@1@@Z @ 37 NONAME ; void CUpnpAVDevice::SetDeviceType(enum CUpnpAVDevice::TUpnpAVDeviceType)
+	?SetFriendlyNameL@CUpnpAVDevice@@QAEXABVTDesC8@@@Z @ 38 NONAME ; void CUpnpAVDevice::SetFriendlyNameL(class TDesC8 const &)
+	?SetImageCapability@CUpnpAVDevice@@QAEXH@Z @ 39 NONAME ; void CUpnpAVDevice::SetImageCapability(int)
+	?SetMaxVolume@CUpnpAVDevice@@QAEXH@Z @ 40 NONAME ; void CUpnpAVDevice::SetMaxVolume(int)
+	?SetMuteCapability@CUpnpAVDevice@@QAEXH@Z @ 41 NONAME ; void CUpnpAVDevice::SetMuteCapability(int)
+	?SetNextAVTransportUri@CUpnpAVDevice@@QAEXH@Z @ 42 NONAME ; void CUpnpAVDevice::SetNextAVTransportUri(int)
+	?SetPauseCapability@CUpnpAVDevice@@QAEXH@Z @ 43 NONAME ; void CUpnpAVDevice::SetPauseCapability(int)
+	?SetSearchCapability@CUpnpAVDevice@@QAEXH@Z @ 44 NONAME ; void CUpnpAVDevice::SetSearchCapability(int)
+	?SetUuidL@CUpnpAVDevice@@QAEXABVTDesC8@@@Z @ 45 NONAME ; void CUpnpAVDevice::SetUuidL(class TDesC8 const &)
+	?SetVideoCapability@CUpnpAVDevice@@QAEXH@Z @ 46 NONAME ; void CUpnpAVDevice::SetVideoCapability(int)
+	?SetVolumeCapability@CUpnpAVDevice@@QAEXH@Z @ 47 NONAME ; void CUpnpAVDevice::SetVolumeCapability(int)
+	?ToDes8L@CUpnpAVDevice@@QBEPAVHBufC8@@XZ @ 48 NONAME ; class HBufC8 * CUpnpAVDevice::ToDes8L(void) const
+	?ToDes8L@CUpnpAVDeviceList@@QBEPAVHBufC8@@XZ @ 49 NONAME ; class HBufC8 * CUpnpAVDeviceList::ToDes8L(void) const
+	?Uuid@CUpnpAVDevice@@QBEABVTDesC8@@XZ @ 50 NONAME ; class TDesC8 const & CUpnpAVDevice::Uuid(void) const
+	?VideoCapability@CUpnpAVDevice@@QBEHXZ @ 51 NONAME ; int CUpnpAVDevice::VideoCapability(void) const
+	?VolumeCapability@CUpnpAVDevice@@QBEHXZ @ 52 NONAME ; int CUpnpAVDevice::VolumeCapability(void) const
+	?DlnaCompatible@CUpnpAVDevice@@QBEHXZ @ 53 NONAME ; int CUpnpAVDevice::DlnaCompatible(void) const
+	?SetDlnaCompatible@CUpnpAVDevice@@QAEXH@Z @ 54 NONAME ; void CUpnpAVDevice::SetDlnaCompatible(int)
+	?Status@UPnPAVControllerFactory@@SAHAAW4TAVControllerServerStatus@1@@Z @ 55 NONAME ; int UPnPAVControllerFactory::Status(enum UPnPAVControllerFactory::TAVControllerServerStatus &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/eabi/upnpavcontrollerclientu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,78 @@
+EXPORTS
+	_ZN13CUpnpAVDevice10LinkOffsetEv @ 1 NONAME
+	_ZN13CUpnpAVDevice12InternalizeLER11RReadStream @ 2 NONAME
+	_ZN13CUpnpAVDevice12SetMaxVolumeEi @ 3 NONAME
+	_ZN13CUpnpAVDevice13SetDeviceTypeENS_17TUpnpAVDeviceTypeE @ 4 NONAME
+	_ZN13CUpnpAVDevice16SetFriendlyNameLERK6TDesC8 @ 5 NONAME
+	_ZN13CUpnpAVDevice17SetCopyCapabilityEi @ 6 NONAME
+	_ZN13CUpnpAVDevice17SetMuteCapabilityEi @ 7 NONAME
+	_ZN13CUpnpAVDevice18SetAudioCapabilityEi @ 8 NONAME
+	_ZN13CUpnpAVDevice18SetImageCapabilityEi @ 9 NONAME
+	_ZN13CUpnpAVDevice18SetPauseCapabilityEi @ 10 NONAME
+	_ZN13CUpnpAVDevice18SetVideoCapabilityEi @ 11 NONAME
+	_ZN13CUpnpAVDevice19SetSearchCapabilityEi @ 12 NONAME
+	_ZN13CUpnpAVDevice19SetVolumeCapabilityEi @ 13 NONAME
+	_ZN13CUpnpAVDevice21SetNextAVTransportUriEi @ 14 NONAME
+	_ZN13CUpnpAVDevice36SetCapabilitiesBySupportedMimeTypesLERK6TDesC8 @ 15 NONAME
+	_ZN13CUpnpAVDevice4NewLERKS_ @ 16 NONAME
+	_ZN13CUpnpAVDevice4NewLEv @ 17 NONAME
+	_ZN13CUpnpAVDevice5NewLCEv @ 18 NONAME
+	_ZN13CUpnpAVDevice8SetUuidLERK6TDesC8 @ 19 NONAME
+	_ZN13CUpnpAVDevice9CopyFromLERKS_ @ 20 NONAME
+	_ZN13CUpnpAVDeviceC1Ev @ 21 NONAME
+	_ZN13CUpnpAVDeviceC2Ev @ 22 NONAME
+	_ZN13CUpnpAVDeviceD0Ev @ 23 NONAME
+	_ZN13CUpnpAVDeviceD1Ev @ 24 NONAME
+	_ZN13CUpnpAVDeviceD2Ev @ 25 NONAME
+	_ZN17CUpnpAVDeviceList12InternalizeLER11RReadStream @ 26 NONAME
+	_ZN17CUpnpAVDeviceList13AppendDeviceLER13CUpnpAVDevice @ 27 NONAME
+	_ZN17CUpnpAVDeviceList15ResetAndDestroyEv @ 28 NONAME
+	_ZN17CUpnpAVDeviceList16RemoveAndDestroyEi @ 29 NONAME
+	_ZN17CUpnpAVDeviceList4NewLEv @ 30 NONAME
+	_ZN17CUpnpAVDeviceList5NewLCEv @ 31 NONAME
+	_ZN17CUpnpAVDeviceList5ResetEv @ 32 NONAME
+	_ZN17CUpnpAVDeviceList6RemoveEi @ 33 NONAME
+	_ZN23UPnPAVControllerFactory15MSServicesInUseEv @ 34 NONAME
+	_ZN23UPnPAVControllerFactory20NewUPnPAVControllerLEv @ 35 NONAME
+	_ZN23UPnPAVControllerFactory21NewUPnPAVControllerLCEv @ 36 NONAME
+	_ZNK13CUpnpAVDevice10DeviceTypeEv @ 37 NONAME
+	_ZNK13CUpnpAVDevice12ExternalizeLER12RWriteStream @ 38 NONAME
+	_ZNK13CUpnpAVDevice12FriendlyNameEv @ 39 NONAME
+	_ZNK13CUpnpAVDevice14CopyCapabilityEv @ 40 NONAME
+	_ZNK13CUpnpAVDevice14MuteCapabilityEv @ 41 NONAME
+	_ZNK13CUpnpAVDevice15AudioCapabilityEv @ 42 NONAME
+	_ZNK13CUpnpAVDevice15ImageCapabilityEv @ 43 NONAME
+	_ZNK13CUpnpAVDevice15PauseCapabilityEv @ 44 NONAME
+	_ZNK13CUpnpAVDevice15VideoCapabilityEv @ 45 NONAME
+	_ZNK13CUpnpAVDevice16SearchCapabilityEv @ 46 NONAME
+	_ZNK13CUpnpAVDevice16VolumeCapabilityEv @ 47 NONAME
+	_ZNK13CUpnpAVDevice18NextAVTransportUriEv @ 48 NONAME
+	_ZNK13CUpnpAVDevice4UuidEv @ 49 NONAME
+	_ZNK13CUpnpAVDevice7ToDes8LEv @ 50 NONAME
+	_ZNK13CUpnpAVDevice9MaxVolumeEv @ 51 NONAME
+	_ZNK17CUpnpAVDeviceList12ExternalizeLER12RWriteStream @ 52 NONAME
+	_ZNK17CUpnpAVDeviceList5CountEv @ 53 NONAME
+	_ZNK17CUpnpAVDeviceList7ToDes8LEv @ 54 NONAME
+	_ZNK17CUpnpAVDeviceListixEi @ 55 NONAME
+	_ZTI13CUpnpAVDevice @ 56 NONAME ; #<TI>#
+	_ZTI17CUpnpAVDeviceList @ 57 NONAME ; #<TI>#
+	_ZTI18CUPnPAVEventActive @ 58 NONAME ; #<TI>#
+	_ZTI19CUPnPAVDeviceActive @ 59 NONAME ; #<TI>#
+	_ZTI22CUPnPAVRenderingActive @ 60 NONAME ; #<TI>#
+	_ZTI23CUPnPAVConnectionActive @ 61 NONAME ; #<TI>#
+	_ZTI23CUPnPAVControllerActive @ 62 NONAME ; #<TI>#
+	_ZTI26CUPnPAVBrowsingSessionImpl @ 63 NONAME ; #<TI>#
+	_ZTI27CUPnPAVRenderingSessionImpl @ 64 NONAME ; #<TI>#
+	_ZTV13CUpnpAVDevice @ 65 NONAME ; #<VT>#
+	_ZTV17CUpnpAVDeviceList @ 66 NONAME ; #<VT>#
+	_ZTV18CUPnPAVEventActive @ 67 NONAME ; #<VT>#
+	_ZTV19CUPnPAVDeviceActive @ 68 NONAME ; #<VT>#
+	_ZTV22CUPnPAVRenderingActive @ 69 NONAME ; #<VT>#
+	_ZTV23CUPnPAVConnectionActive @ 70 NONAME ; #<VT>#
+	_ZTV23CUPnPAVControllerActive @ 71 NONAME ; #<VT>#
+	_ZTV26CUPnPAVBrowsingSessionImpl @ 72 NONAME ; #<VT>#
+	_ZTV27CUPnPAVRenderingSessionImpl @ 73 NONAME ; #<VT>#
+	_ZN13CUpnpAVDevice17SetDlnaCompatibleEi @ 74 NONAME
+	_ZNK13CUpnpAVDevice14DlnaCompatibleEv @ 75 NONAME
+	_ZN23UPnPAVControllerFactory6StatusERNS_25TAVControllerServerStatusE @ 76 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for UPnP AV Controller Client
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+// ADO internal interfaces
+../inc/upnpavcontrollerfactory.h        |../../../inc/upnpavcontrollerfactory.h
+../inc/upnpavdevicelist.h               |../../../inc/upnpavdevicelist.h
+../inc/upnpavdevice.h                   |../../../inc/upnpavdevice.h
+../inc/upnpavcontroller.h               |../../../inc/upnpavcontroller.h
+../inc/upnpavdeviceobserver.h           |../../../inc/upnpavdeviceobserver.h
+../inc/upnpavrenderingsessionobserver.h |../../../inc/upnpavrenderingsessionobserver.h
+../inc/upnpavbrowsingsessionobserver.h  |../../../inc/upnpavbrowsingsessionobserver.h
+../inc/upnpfiletransfersessionobserver.h |../../../inc/upnpfiletransfersessionobserver.h
+../inc/upnpavsessionobserverbase.h      |../../../inc/upnpavsessionobserverbase.h
+../inc/upnpavsessionbase.h              |../../../inc/upnpavsessionbase.h
+../inc/upnpavrenderingsession.h         |../../../inc/upnpavrenderingsession.h
+../inc/upnpavbrowsingsession.h          |../../../inc/upnpavbrowsingsession.h
+../inc/upnpfiledownloadsession.h        |../../../inc/upnpfiledownloadsession.h
+../inc/upnpfileuploadsession.h          |../../../inc/upnpfileuploadsession.h
+../inc/upnpfiletransfersession.h        |../../../inc/upnpfiletransfersession.h
+../inc/upnpavcontrollerglobals.h        |../../../inc/upnpavcontrollerglobals.h
+// subsystem internal interfaces
+../inc/upnpavrequest.h                  |../../inc/upnpavrequest.h
+../inc/upnpavbrowserequest.h            |../../inc/upnpavbrowserequest.h
+../inc/upnpavbrowserespparams.h         |../../inc/upnpavbrowserespparams.h
+../inc/upnpfiletransferitem.h           |../../inc/upnpfiletransferitem.h
+
+
+PRJ_MMPFILES
+upnpavcontrollerclient.mmp
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/group/upnpavcontrollerclient.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      project file for AVController client library
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET          upnpavcontrollerclient.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x20007567
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION         10.1
+paged
+
+SOURCEPATH      ../src 
+SOURCE          upnpavcontrollerclient.cpp
+SOURCE          upnpavcontrollerfactory.cpp
+SOURCE          upnpavcontrolleractive.cpp
+SOURCE          upnpavrenderingsessionimpl.cpp
+SOURCE          upnpavbrowsingsessionimpl.cpp
+SOURCE          upnpavdevice.cpp
+SOURCE          upnpavdevicelist.cpp
+SOURCE          upnpaveventactive.cpp
+SOURCE          upnpavdeviceactive.cpp
+SOURCE          upnpavrenderingactive.cpp
+SOURCE          upnpavconnectionactive.cpp
+SOURCE          upnpfileuploadsessionimpl.cpp
+SOURCE          upnpfiledownloadsessionimpl.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../../../inc
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         upnpavobjects.lib
+LIBRARY         upnpserviceframework.lib
+LIBRARY         upnpipserversutils.lib
+LIBRARY         upnpavcontrollerhelper.lib
+LIBRARY         bafl.lib
+LIBRARY         upnputilities.lib
+LIBRARY         efsrv.lib 
+
+// XML
+LIBRARY         upnpxmlparser.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/tupnpfiletransferevent.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a data class containing filetransfer-related data
+*
+*/
+
+
+
+
+
+
+#ifndef T_TUPNPFILETRANSFEREVENT_H
+#define T_TUPNPFILETRANSFEREVENT_H
+
+#include <e32base.h>
+#include <s32mem.h>
+
+// CLASS DECLARATION
+/**
+ *  UPnP AV Controller Client/Server communication helper class
+ *  
+ *
+ *  @lib - 
+ *  @since Series 60 3.2
+ */
+class TUpnpFileTransferEvent
+    { 
+
+public:
+    
+    /**
+     * Defines filetransfer events
+     */    
+    enum TTransferEvent
+        {
+        EUndefined = 0,
+        ETransferStarted,
+        ETransferCompleted,
+        ETransferProgress,
+        EDeviceDisconnected
+        };
+        
+public:        
+    
+    /**
+     * Constructor
+     */    
+    inline TUpnpFileTransferEvent() :
+        iEvent( EUndefined ),
+        iKey( 0 ),
+        iStatus( 0 ),
+        iParam1( 0 ),
+        iParam2( 0 ),
+        iParam3( 0 )
+        {}
+        
+    /**
+     * Assigment operator
+     */    
+    inline TUpnpFileTransferEvent& operator=(
+        const TUpnpFileTransferEvent& aEvent )
+        {
+        iEvent = aEvent.iEvent;
+        iKey = aEvent.iKey;
+        iStatus = aEvent.iStatus;
+        iParam1 = aEvent.iParam1;
+        iParam2 = aEvent.iParam2;
+        iParam3 = aEvent.iParam3;
+        return *this;
+        }
+        
+public:
+       
+    /**
+     * Filetransfer event
+     */    
+    TTransferEvent  iEvent;
+
+    /**
+     * Transfer key. Identifies the file transfer
+     */    
+    TInt            iKey;
+    
+    /**
+     * Status (error) code
+     */        
+    TInt            iStatus;
+    
+    /**
+     * Undefined param 1
+     */        
+    TInt            iParam1;
+    
+    /**
+     * Undefined param 2
+     */            
+    TInt            iParam2;
+    
+    /**
+     * Undefined param 3
+     */            
+    TAny*           iParam3;
+    
+    };
+
+#endif // T_TUPNPFILETRANSFEREVENT_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowserequest.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a data class containing browse-related data
+*
+*/
+
+
+
+
+
+
+#ifndef C_CUPNPAVBROWSEREQUEST_H
+#define C_CUPNPAVBROWSEREQUEST_H
+
+
+#include <e32base.h>
+#include <s32mem.h>
+
+#include "upnpavbrowsingsession.h"
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  UPnP AV Controller Client/Server communication helper class
+*  
+*
+*  @lib - 
+*  @since Series 60 3.1
+*/
+
+class CUpnpAVBrowseRequest : public CBase
+    { 
+    
+public:  // Constructors and destructor
+        
+    /**
+     * Two-phased constructor.
+     */
+    static inline CUpnpAVBrowseRequest* NewLC();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static inline CUpnpAVBrowseRequest* NewL();
+    
+    /**
+     * Destructor.
+     */
+    inline virtual ~CUpnpAVBrowseRequest();
+    
+public:
+
+    /**
+     * Externalizes device information to stream.
+     * Leaves in case of errors.
+     * @since Series 60 3.0
+     * @param reference to RWriteStream
+     * @return none
+     */
+    inline void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+     * Internalizes device information from stream.
+     * Leaves in case of errors.
+     * @since Series 60 3.0
+     * @param reference to RReadStream
+     * @return none
+     */
+    inline void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Externalizes information to stream and returns the object as a heap
+     * desctiptor.
+     */        
+    inline HBufC8* ToDes8L() const;
+
+private: //
+
+    /**
+     * Constructor
+     */
+    inline CUpnpAVBrowseRequest();
+
+    /**
+     * Perform the second phase construction
+     */
+    inline void ConstructL();
+
+public: // New methods
+
+    /**
+     * Set Id
+     * @param aId
+     */
+    inline void SetIdL( const TDesC8& aId );
+
+    /**
+     * Get Id
+     * @return id
+     */    
+    inline const TDesC8& Id();
+
+    /**
+     * Set search criteria
+     * @param aSearchCriteria
+     */    
+    inline void SetSearchCriteriaL( const TDesC8& aSearchCriteria );
+
+    /**
+     * Get search criteria
+     * @return search criteria
+     */    
+    inline const TDesC8& SearchCriteria();
+
+    /**
+     * Set filter
+     * @param aFilter
+     */
+    inline void SetFilterL( const TDesC8& aFilter );
+        
+    /**
+     * Get filter
+     * @return filter
+     */    
+    inline const TDesC8& Filter();
+
+    /**
+     * Set browse flag
+     * @param aBrowseFlag
+     */    
+    inline void SetBrowseFlag( MUPnPAVBrowsingSession::TBrowseFlag
+        aBrowseFlag );
+    
+    /**
+     * Get browse flag
+     * @return browse flag
+     */    
+    inline MUPnPAVBrowsingSession::TBrowseFlag BrowseFlag();
+
+    /**
+     * Set start index
+     * @param aStartIndex
+     */    
+    inline void SetStartIndex( TInt aStartIndex );
+    
+    /**
+     * Get start index
+     * @return start index
+     */    
+    inline TInt StartIndex();
+
+    /**
+     * Set requested count
+     * @param aRequestedCount
+     */
+    inline void SetRequestedCount( TInt aRequestedCount );
+
+    /**
+     * Get requested count
+     * @return requested count
+     */    
+    inline TInt RequestedCount();
+
+    /**
+     * Set sort criteria
+     * @param aSortCriteria
+     */
+    inline void SetSortCriteriaL( const TDesC8& aSortCriteria );
+    
+    /**
+     * Get sort criteria
+     * @return sort criteria
+     */    
+    inline const TDesC8& SortCriteria();
+
+private:
+    
+    TInt                                iCriteriaLength;
+    HBufC8*                             iId; // Owned
+    HBufC8*                             iSearchCriteria; // Owned
+    HBufC8*                             iFilter; // Owned
+    MUPnPAVBrowsingSession::TBrowseFlag iBrowseFlag;
+    TInt                                iStartIndex;
+    TInt                                iRequestedCount;
+    HBufC8*                             iSortCriteria; // Owned
+    
+    };
+
+#include "upnpavbrowserequest.inl"
+
+#endif // C_CUPNPAVBROWSEREQUEST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowserequest.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,331 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a data class containing browse-related data
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include "upnpavbrowserequest.h"
+
+// CONSTANTS
+const TInt KBrowseMaxStringLen = 255;
+const TInt KBrowseBufferGranularity = 100;    
+
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::CUpnpAVBrowseRequest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+inline CUpnpAVBrowseRequest::CUpnpAVBrowseRequest()
+    {    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::ConstructL()
+    {
+    iId = KNullDesC8().AllocL();
+    iSearchCriteria = KNullDesC8().AllocL();
+    iFilter = KNullDesC8().AllocL();
+    iSortCriteria = KNullDesC8().AllocL();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline CUpnpAVBrowseRequest* CUpnpAVBrowseRequest::NewL()
+    {
+    CUpnpAVBrowseRequest* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline CUpnpAVBrowseRequest* CUpnpAVBrowseRequest::NewLC()
+    {
+    CUpnpAVBrowseRequest* self = new( ELeave )
+        CUpnpAVBrowseRequest;    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+    
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline CUpnpAVBrowseRequest::~CUpnpAVBrowseRequest()
+    {
+    delete iId;
+    delete iSearchCriteria;
+    delete iFilter;
+    delete iSortCriteria;         
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::ExternalizeL( RWriteStream& aStream ) const
+    {    
+    aStream.WriteInt16L( iCriteriaLength );    
+    aStream << *iId;
+    aStream << *iSearchCriteria;
+    aStream << *iFilter;
+    aStream.WriteInt16L( (TInt)iBrowseFlag );
+    aStream.WriteInt16L( iStartIndex );
+    aStream.WriteInt16L( iRequestedCount );
+    aStream << *iSortCriteria;   
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::InternalizeL
+// Internalizes object
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::InternalizeL( RReadStream& aStream )
+    {
+    iCriteriaLength = aStream.ReadInt16L();
+    
+    delete iId; iId = NULL;
+    iId = HBufC8::NewL( aStream, KBrowseMaxStringLen );
+
+    delete iSearchCriteria; iSearchCriteria = NULL;
+    iSearchCriteria = HBufC8::NewL( aStream, iCriteriaLength );
+
+    delete iFilter; iFilter = NULL;
+    iFilter = HBufC8::NewL( aStream, KBrowseMaxStringLen );
+    
+    iBrowseFlag = (MUPnPAVBrowsingSession::TBrowseFlag)aStream.ReadInt16L();
+    
+    iStartIndex = aStream.ReadInt16L();
+    
+    iRequestedCount = aStream.ReadInt16L();
+
+    delete iSortCriteria; iSortCriteria = NULL;
+    iSortCriteria = HBufC8::NewL( aStream, KBrowseMaxStringLen );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::ToDes8L
+// Externalizes object to a heap descriptor
+// --------------------------------------------------------------------------
+inline HBufC8* CUpnpAVBrowseRequest::ToDes8L() const
+    {
+    // serialize object
+    CBufFlat* tempFlatBuf = CBufFlat::NewL( KBrowseBufferGranularity );
+    CleanupStack::PushL( tempFlatBuf );
+
+    RBufWriteStream stream( *tempFlatBuf );
+    CleanupClosePushL( stream );
+    
+    stream << *this;
+    
+    // create heap descriptor
+    HBufC8* tempBuf = HBufC8::NewLC( tempFlatBuf->Size() );
+    TPtr8 ptr( tempBuf->Des() );
+    tempFlatBuf->Read( 0, ptr, tempFlatBuf->Size() );
+    
+    // clean up
+    CleanupStack::Pop( tempBuf );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( tempFlatBuf );
+    
+    return tempBuf;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::SetIdL
+// Sets id
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::SetIdL( const TDesC8& aId )
+    {
+    HBufC8* tempBuf = aId.AllocL();
+    delete iId;
+    iId = tempBuf;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::Id
+// Returns id
+// --------------------------------------------------------------------------
+inline const TDesC8& CUpnpAVBrowseRequest::Id()
+    {
+    if( iId )
+        {
+        return *iId;
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+  
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::SetSearchCriteriaL
+// Sets search criteria
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::SetSearchCriteriaL(
+    const TDesC8& aSearchCriteria )
+    {
+    HBufC8* tempBuf = aSearchCriteria.AllocL();
+	iCriteriaLength = tempBuf->Length();
+	delete iSearchCriteria;
+	iSearchCriteria = tempBuf;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::SearchCriteria
+// Returns search criteria
+// --------------------------------------------------------------------------
+inline const TDesC8& CUpnpAVBrowseRequest::SearchCriteria()
+    {
+    if( iSearchCriteria )
+        {
+        return *iSearchCriteria;
+        }
+    else
+        {
+        return KNullDesC8;
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::SetFilterL
+// Sets filter
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::SetFilterL( const TDesC8& aFilter )
+    {
+    HBufC8* tempBuf = aFilter.AllocL();
+    delete iFilter;
+    iFilter = tempBuf;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::Filter
+// Returns filter
+// --------------------------------------------------------------------------
+inline const TDesC8& CUpnpAVBrowseRequest::Filter()
+    {    
+    if( iFilter )
+        {
+        return *iFilter;
+        }
+    else
+        {
+        return KNullDesC8;
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::SetBrowseFlag
+// Sets browse flag
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::SetBrowseFlag(
+    MUPnPAVBrowsingSession::TBrowseFlag aBrowseFlag )
+    {
+    iBrowseFlag = aBrowseFlag;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::BrowseFlag
+// Returns browse flag
+// --------------------------------------------------------------------------
+inline MUPnPAVBrowsingSession::TBrowseFlag CUpnpAVBrowseRequest::BrowseFlag()
+    {
+    return iBrowseFlag;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::SetStartIndex
+// Sets start index
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::SetStartIndex( TInt aStartIndex )
+    {
+    iStartIndex = aStartIndex;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::StartIndex
+// Returns start index
+// --------------------------------------------------------------------------
+inline TInt CUpnpAVBrowseRequest::StartIndex()
+    {
+    return iStartIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::SetRequestedCount
+// Sets requested count
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::SetRequestedCount( TInt aRequestedCount )
+    {
+    iRequestedCount = aRequestedCount;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::RequestedCount
+// Returns requested count
+// --------------------------------------------------------------------------
+inline TInt CUpnpAVBrowseRequest::RequestedCount()
+    {
+    return iRequestedCount;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::SetSortCriteriaL
+// Sets sort criteria
+// --------------------------------------------------------------------------
+inline void CUpnpAVBrowseRequest::SetSortCriteriaL(
+    const TDesC8& aSortCriteria )
+    {
+    HBufC8* tempBuf = aSortCriteria.AllocL();
+    delete iSortCriteria;
+    iSortCriteria = tempBuf;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVBrowseRequest::SortCriteria
+// Returns sort criteria
+// --------------------------------------------------------------------------
+inline const TDesC8& CUpnpAVBrowseRequest::SortCriteria()
+    {
+    if( iSortCriteria )
+        {
+        return *iSortCriteria;
+        }
+    else
+        {
+        return KNullDesC8;
+        }
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowserespparams.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a data class containing browse and search response
+*                parameters
+*
+*/
+
+
+
+
+
+
+#ifndef T_TUPNPAVBROWSERESPPARAMS_H
+#define T_TUPNPAVBROWSERESPPARAMS_H
+
+
+#include <e32base.h>
+#include <s32mem.h>
+
+#include "upnpavbrowsingsession.h"
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  UPnP AV Controller Client/Server communication helper class
+*  
+*
+*  @lib - 
+*  @since Series 60 3.1
+*/
+
+class TUpnpAVBrowseRespParams
+    { 
+       
+public: // Public data members
+    
+    TInt iResponseSize;
+    TInt iUpdateIdSize;
+    TInt iMatches;
+    TInt iTotalCount;
+        
+    };
+
+
+#endif // T_TUPNPAVBROWSERESPPARAMS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowsingsession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      session towards a media server
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVBROWSINGSESSION_H
+#define C_UPNPAVBROWSINGSESSION_H
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "upnpavsessionbase.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVDeviceObserver;
+class MUPnPAVBrowsingSessionObserver;
+class MUPnPAVFileObserver;
+class CUpnpObject;
+class CUpnpItem;
+class CUpnpAVDevice;
+class CUpnpContainer;
+
+/**
+ *  AV Controller browsing session interface.
+ *
+ *  This class defines the browsing interface of AV Controller. Includes
+ *  operations to search, browse, copy, create container, delete object and
+ *  to get search capabilities.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class MUPnPAVBrowsingSession : public MUPnPAVSessionBase
+    {
+
+public:
+
+    /**
+     * Defines the type of browse (metadata or direct children)
+     *
+     * @since Series 60 3.1
+     */
+    enum TBrowseFlag
+        {
+        EDirectChildren = 0,
+        EMetadata
+        };
+
+    /**
+     * Defines the download location (default, phone memory, memory card or
+     * RAM Drive)
+     *
+     * @since Series 60 3.1
+     */
+    enum TMemoryType
+        {
+        EDefault = 0,
+        EPhone ,
+        EMemoryCard,
+        ERAMDrive
+        };
+
+    /**
+     * Defines the sharing status of a downloaded item
+     *
+     * @since Series 60 3.1
+     */
+    enum TFileSharing
+        {
+        EFileIsShared = 0,
+        EFileIsNotShared,
+        EShareBySettings
+        };
+
+    /**
+     * Defines the container type
+     *
+     * @since Series 60 3.1
+     */
+    enum TContainerType
+        {
+        EStorageContainer = 0,      // object.container
+        EPlaylistContainer          // object.container.playlistContainer
+        };
+
+public:
+
+    /**
+     * Sets the browsing session observer
+     *
+     * @since Series 60 3.1
+     * @param aObserver browsing session observer
+     */
+     virtual void SetObserver( MUPnPAVBrowsingSessionObserver&
+        aObserver) = 0;
+     
+    /**
+     * Removes the browsing session observer
+     *
+     * @since Series 60 3.1
+     * @param None
+     */
+    virtual void RemoveObserver() = 0;
+
+    /**
+     * Returns the browsing session observer
+     *
+     * @since Series 60 3.1
+     * @param None
+     */
+    virtual MUPnPAVBrowsingSessionObserver* Observer() const = 0;
+
+public:
+
+    /**
+     * Browses the content directory of a given Media
+     * Server.
+     *
+     * @since Series 60 3.1
+     * @param aId Container or object id.
+     * @param aFilter TDesC8& filter
+     * @param aBrowseFlag Metadata or DirectChildren
+     * @param aStartIndex TInt start index
+     * @param aRequestedCount TInt requested count
+     * @param aSortCriteria TDesC8& sort criteria
+     */
+    virtual void BrowseL( const TDesC8& aId,
+                          const TDesC8& aFilter,
+                          TBrowseFlag aBrowseFlag,
+                          TInt aStartIndex,
+                          TInt aRequestedCount,
+                          const TDesC8& aSortCriteria ) = 0;
+
+    /**
+     * Cancels the browse operation (ignores the result set when it
+     * is received).
+     *
+     * @since Series 60 3.1
+     * @param none
+     * @return none
+     */
+    virtual void CancelBrowse() = 0;
+
+    /**
+     * Searches the content directory of a given Media Server.
+     *
+     * @since Series 60 3.1
+     * @param aId container id
+     * @param aSearchCriteria TDesC8& search criteria
+     * @param aFilter TDesC8& filter
+     * @param aStartIndex TInt start index
+     * @param aRequestedCount TInt requested count
+     * @param aSortCriteria TDesC8& sort criteria
+     */
+    virtual void SearchL(   const TDesC8& aId,
+                            const TDesC8& aSearchCriteria,
+                            const TDesC8& aFilter,
+                            TInt aStartIndex,
+                            TInt aRequestedCount,
+                            const TDesC8& aSortCriteria ) = 0;
+
+    /**
+     * Cancels the search operation (ignores the result set when it
+     * is received).
+     *
+     * @since Series 60 3.1
+     * @param none
+     */
+    virtual void CancelSearch() = 0;
+
+    /**
+     * Gets the search capabilities of the Media Server that
+     * has been set as the "source device".
+     *
+     * @since Series 60 3.1
+     * @param None
+     */
+    virtual void GetSearchCapabilitiesL() = 0;
+
+    /**
+     * Creates a new container to the target Media Server.
+     *
+     * @since Series 60 3.1
+     * @param aTitle (const TDesC8&) title for the new container
+     * @param aParentId (const TDesC8&) container ID of the container into
+     *        which the new container is to be created
+     * @param aContainerType (TContainerType) type of the new container
+     */
+    virtual void CreateContainerL( const TDesC8& aTitle,
+                                   const TDesC8& aParentId,
+                                   TContainerType aContainerType ) = 0;
+
+    /**
+     * Deletes an UPnP item on the target UPnP media server.
+     *
+     * @since Series 60 3.1
+     * @param aId id of an object to be destroyed 
+     */
+    virtual void DeleteObjectL( const TDesC8& aId ) = 0;
+
+
+protected:
+
+    virtual ~MUPnPAVBrowsingSession() {};
+
+    };
+
+
+#endif // C_UPNPAVBROWSINGSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowsingsessionimpl.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,299 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implements a session towards a media server
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVBROWSINGSESSIONIMPL_H
+#define C_UPNPAVBROWSINGSESSIONIMPL_H
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "upnpavbrowsingsession.h"
+#include "upnpavdeviceobserver.h"
+#include "upnpavbrowserespparams.h"
+
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+class MUPnPAVBrowsingSessionObserver;
+class RUPnPAVControllerClient;
+//class CUPnPXMLParser;
+class CUPnPAVDeviceActive;
+
+/**
+ *  AV Controller browsing session implementation.
+ *
+ *  This class implements the browsing interface of AV Controller. Includes
+ *  operations to search, browse, copy, create container, delete object and
+ *  to get search capabilities.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class CUPnPAVBrowsingSessionImpl :  public CActive,
+                                    public MUPnPAVBrowsingSession,
+                                    public MUPnPAVDeviceObserver
+    {
+
+private:
+
+    /**
+     * Defines internal state of operation
+     */
+    enum TPendingOperation
+        {
+        ENone = 0,
+        EBrowseSize,
+        ESearchSize,
+        EGetSearchCapabilities,
+        ECreateContainer,
+        EDeleteObject,
+        EStartMediaServer
+        };
+
+public:
+
+    /**
+     * Static constructor
+     *
+     * @param aServer handle to AV Controller server
+     * @param aDevice target device
+     * @return a new browsing session implementation instance
+     */
+    static CUPnPAVBrowsingSessionImpl* NewL( RUPnPAVControllerClient&
+        aServer, const CUpnpAVDevice& aDevice );
+
+    /**
+     * Destructor
+     */    
+    virtual ~CUPnPAVBrowsingSessionImpl();
+    
+private:
+
+    /**
+     * 2nd phase construct
+     */    
+    CUPnPAVBrowsingSessionImpl( RUPnPAVControllerClient& aServer );
+    
+    /**
+     * 2nd phase construct
+     */        
+    void ConstructL();
+    
+protected: // From CActive
+
+    void RunL();
+    
+    void DoCancel();
+    
+    TInt RunError( TInt aError );         
+
+protected: // From MUPnPAVBrowser
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void SetObserver( MUPnPAVBrowsingSessionObserver& aObserver);
+     
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void RemoveObserver();
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    MUPnPAVBrowsingSessionObserver* Observer() const;
+    
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    const CUpnpAVDevice& Device() const;
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void ReserveLocalMSServicesL(); 
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void CancelReserveLocalMSServicesL(); 
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void ReleaseLocalMSServicesL(); 
+    
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void BrowseL(   const TDesC8& aId,
+                    const TDesC8& aFilter,
+                    TBrowseFlag aBrowseFlag,
+                    TInt aStartIndex,
+                    TInt aRequestedCount,
+                    const TDesC8& aSortCriteria );                      
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void CancelBrowse();
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void SearchL(   const TDesC8& aId,
+                    const TDesC8& aSearchCriteria,
+                    const TDesC8& aFilter,
+                    TInt aStartIndex,
+                    TInt aRequestedCount,
+                    const TDesC8& aSortCriteria );
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void CancelSearch();
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void GetSearchCapabilitiesL();
+
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void CreateContainerL( const TDesC8& aTitle, const TDesC8& aParentId,
+        TContainerType aContainerType );
+    
+    /**
+     * See upnpavbrowsingsession.h
+     */
+    void DeleteObjectL( const TDesC8& aId );
+
+public: // From MUPnPAVDeviceObserver
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void WLANConnectionLost();
+    
+private: // Internal methods
+
+    /**
+     * Handles browse
+     */    
+    void BrowseSizeCompletedL();
+
+    /**
+     * Handles browse
+     */        
+    void BrowseResultCompletedL();
+    
+    /**
+     * Handles search
+     */    
+    void SearchSizeCompletedL();
+
+    /**
+     * Handles search
+     */        
+    void SearchResultCompletedL();    
+
+    /**
+     * Handles search capabilities
+     */        
+    void SearchCapabilitiesCompletedL();
+    
+    /**
+     * Handles create container
+     */                    
+    void CreateContainerCompletedL();
+    
+    /**
+     * Handles delete object
+     */                    
+    void DeleteObjectCompletedL();
+
+    /**
+     * Handles media server start
+     */                        
+    void StartMediaServerCompleteL();
+
+    /**
+     * Reset
+     */                            
+    void ResetL();
+    
+private:
+
+    MUPnPAVBrowsingSessionObserver* iObserver; // not owned
+    
+    RUPnPAVControllerClient&    iServer; // not owned
+    
+    CUpnpAVDevice*              iDevice; // owned
+    
+    // Buffer to pass data to server
+    HBufC8*                     iBuffer; // owned
+    TPtr8                       iBufferPtr;
+
+    // Buffer to pass data to server
+    HBufC8*                     iBuffer2; // owned
+    TPtr8                       iBufferPtr2;
+
+    // Buffer to pass data to server
+    HBufC8*                     iBuffer3; // owned
+    TPtr8                       iBufferPtr3;
+    
+    //CUPnPXMLParser*             iParser; // owned
+    
+    CUPnPAVDeviceActive*        iDeviceActive; // owned
+    
+    TInt                        iRespBufSize;           
+    TPckg<TInt>                 iRespBufSizePkg;
+
+//    TInt                        iRespBufSize;           
+//    TPckg<TInt>                 iRespBufSizePkg;
+
+    TUpnpAVBrowseRespParams         iRespParams;           
+    TPckg<TUpnpAVBrowseRespParams>  iRespParamsPkg;
+    
+    TPendingOperation           iPendingOperation;
+    
+    TBool iAlive;
+    
+    TBool                       iMediaServerResourceReserved;       
+            
+    };
+
+
+#endif // C_UPNPAVBROWSERIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavbrowsingsessionobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      callback interface for browsing session
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPAVBROWSINGSESSIONOBSERVER_H
+#define M_UPNPAVBROWSINGSESSIONOBSERVER_H
+
+// INCLUDES
+#include "upnpavsessionobserverbase.h"
+
+// FORWARD DECLARATIONS
+class CUpnpDevice;
+class CUpnpObject;
+
+/**
+* Defines the response interface for the browsing session operations of the
+* UPnP AV Controller.
+*
+* @since Series 60 3.1
+*/
+class MUPnPAVBrowsingSessionObserver : public MUPnPAVSessionObserverBase
+    {
+
+    public:
+
+        /**
+         * Returns a browse result received from a Media Server.
+         *         
+         * @since Series 60 3.1
+         * @param aBrowseResponse browse response xml document
+         * @param aError system wide error code
+         * @param aMatches number of returned items
+         * @param aTotalCount total number of objects on container
+         * @param aUpdateId update id number
+         * @return None
+         */
+        virtual void BrowseResponse(
+                        const TDesC8& aBrowseResponse,
+                        TInt aError,
+                        TInt aMatches,
+                        TInt aTotalCount,
+                        const TDesC8& aUpdateId
+                        ) = 0;
+
+        /**
+         * Returns a search result received from a Media Server.
+         *
+         * @param aSearchResponse search response xml document
+         * @param aError system wide error code
+         * @param aMatches number of returned items
+         * @param aTotalCount total number of resulted items
+         * @param aUpdateId update id number
+         * @return None
+         */
+        virtual void SearchResponse( 
+                        const TDesC8& aSearchResponse,
+                         TInt aError,
+                         TInt aMatches,
+                         TInt aTotalCount,
+                         const TDesC8& aUpdateId
+                         ) = 0;
+
+        /**
+         * Returns search capabilities of the requested Media Server.
+         *
+         * @since Series 60 3.1
+         * @param status aStatus  information
+         * @param aSearchCapabilities the search capabilities
+         * @return None
+         */
+        virtual void SearchCapabilitiesResponse( 
+                         TInt aError,
+                         const TDesC8& aSearchCapabilities 
+                         ) = 0;
+
+        /**
+         * Notifies that the create container operation is complete.
+         *
+         * @since Series 60 3.1
+         * @param aError status information
+         * @param aObjectId  object ID of the new container
+         */
+        virtual void CreateContainerResponse( TInt aError, 
+            const TDesC8& aObjectId ) = 0;
+
+        /**
+         * Notifies that the requested UPnP Object deletion is complete.
+         *
+         * @since Series 60 3.1
+         * @param aStatus status information
+         * @return None
+         */
+        virtual void DeleteObjectResponse( TInt aError ) = 0;
+        
+        /**
+         * Notifies that the Media Server we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since Series 60 3.1
+         * @param aReason reason code
+         * @return None
+         */        
+        virtual void MediaServerDisappeared(
+            TUPnPDeviceDisconnectedReason aReason ) = 0;
+            
+        virtual void ReserveLocalMSServicesCompleted( TInt aError ) = 0;            
+       
+    };
+
+#endif // M_UPNPAVBROWSINGSESSIONOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavconnectionactive.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for monitoring WLAN connection breakdown
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVCONNECTIONACTIVE_H
+#define C_UPNPAVCONNECTIONACTIVE_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include "upnpavrenderingsessionobserver.h"
+
+class RUPnPAVControllerClient;
+class MUPnPConnectionMonitorObserver;
+
+/**
+ *  Active object for connection monitoring.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class CUPnPAVConnectionActive : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUPnPAVConnectionActive* NewL( RUPnPAVControllerClient& aServer,
+        MUPnPConnectionMonitorObserver& aObserver );
+
+    /**
+     * Destructor
+     */    
+    virtual ~CUPnPAVConnectionActive();
+       
+private:
+
+    /**
+     * Constructor
+     */
+    CUPnPAVConnectionActive( RUPnPAVControllerClient& aServer,
+        MUPnPConnectionMonitorObserver& aObserver );
+
+    /**
+     * Two-phased constructor.
+     */    
+    void ConstructL();
+
+protected: // From CActive
+
+    void RunL();
+    
+    void DoCancel();
+    
+    TInt RunError( TInt aError );
+
+public: // New functions    
+
+    /**
+     * Starts monitoring WLAN connection
+     */
+    void StartMonitoring();
+
+private:
+
+    RUPnPAVControllerClient& iServer;
+
+    MUPnPConnectionMonitorObserver& iObserver;       
+    
+    };
+
+#endif // C_UPNPAVCONNECTIONACTIVE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontroller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AVController interface
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPAVCONTROLLER_H
+#define M_UPNPAVCONTROLLER_H
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "upnpavcontrollerglobals.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVDeviceObserver;
+class CUpnpAVDeviceList;
+class CUpnpAVDevice;
+class MUPnPAVBrowsingSession;
+class MUPnPAVRenderingSession;
+class MUPnPFileUploadSession;
+class MUPnPFileDownloadSession;
+
+/**
+ *  Defines the AV Controller interface
+ *
+ *  This class defines the AV Controller interface. Provides methods to
+ *  get devices and to start and stop rendering and browsing sessions.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class MUPnPAVController
+    {
+
+public:
+
+    /**
+     * Sets Device observer instance
+     *
+     * @since Series 60 3.1     
+     * @param aInstance MUPnPAVDeviceObserver instance of the class that 
+     *        implements the IF
+     * @return TInt status
+     */
+    virtual void SetDeviceObserver( MUPnPAVDeviceObserver& aObserver ) = 0;
+
+    /**
+     * Removes Device observer instance
+     *
+     * @since Series 60 3.1     
+     * @param None
+     * @return None
+     */
+    virtual void RemoveDeviceObserver() = 0;
+    
+    /**
+     * Returns Device observer instance
+     *
+     * @since Series 60 3.1     
+     * @param None
+     * @return observer pointer
+     */
+    virtual MUPnPAVDeviceObserver* DeviceObserver() = 0;
+
+    /**
+     * Start a browsing session with a media server
+     *
+     * @since Series 60 3.1
+     * @param aDevice media server
+     * @return session reference
+     */    
+    virtual MUPnPAVBrowsingSession& StartBrowsingSessionL(
+        const CUpnpAVDevice& aDevice ) = 0;
+
+    /**
+     * Stop a browsing session with a media server
+     *
+     * @since Series 60 3.1
+     * @param aSession session reference
+     * @return None
+     */    
+    virtual void StopBrowsingSession( MUPnPAVBrowsingSession& aSession ) = 0;
+    
+    /**
+     * Start a rendering session with a media renderer
+     *
+     * @since Series 60 3.1
+     * @param aDevice media renderer
+     * @return session reference
+     */    
+    virtual MUPnPAVRenderingSession& StartRenderingSessionL(
+        const CUpnpAVDevice& aDevice ) = 0;
+    
+    /**
+     * Stop a rendering session with a media server
+     *
+     * @since Series 60 3.1
+     * @param aSession session reference
+     * @return None
+     */    
+    virtual void StopRenderingSession(
+        MUPnPAVRenderingSession& aSession ) = 0;
+
+    /**
+     * Start an upload session with a media server
+     *
+     * @since Series 60 3.1
+     * @param aDevice media renderer
+     * @return session reference
+     */    
+    virtual MUPnPFileUploadSession& StartUploadSessionL(
+        const CUpnpAVDevice& aDevice ) = 0;
+    
+    /**
+     * Stop an upload session
+     *
+     * @since Series 60 3.1
+     * @param aSession session reference
+     * @return None
+     */    
+    virtual void StopUploadSession(
+        MUPnPFileUploadSession& aSession ) = 0;    
+
+    /**
+     * Start a download session with a media server
+     *
+     * @since Series 60 3.1
+     * @param aDevice media renderer
+     * @return session reference
+     */    
+    virtual MUPnPFileDownloadSession& StartDownloadSessionL(
+        const CUpnpAVDevice& aDevice ) = 0;
+    
+    /**
+     * Stop a download session
+     *
+     * @since Series 60 3.1
+     * @param aSession session reference
+     * @return None
+     */    
+    virtual void StopDownloadSession(
+        MUPnPFileDownloadSession& aSession ) = 0;    
+
+// =======================================================
+// DEVICE CONTROL METHODS
+// =======================================================
+public:
+
+    /**
+     * Gets the list of online Media Server devices.
+     *
+     * The client must release the memory allocated for the items 
+     * in the array.
+     *
+     * @since Series 60 3.1
+     * @param none
+     * @return device list
+     */
+    virtual CUpnpAVDeviceList* GetMediaServersL() = 0;
+
+    /**
+     * Gets the list of online Media Renderer devices.
+     *
+     * The client must release the memory allocated for the items 
+     * in the array.
+     *
+     * @since Series 60 3.1
+     * @param none
+     * @return device list
+     */
+    virtual CUpnpAVDeviceList* GetMediaRenderersL() = 0;
+    
+public: // Destructor    
+
+    /**
+     * Destructor
+     * DEPRACATED, usage of Release() recommended. Will be removed in the
+     * future. Safe deletion is not guaranteed.
+     *
+     * @since Series 60 3.1
+     */   
+    virtual ~MUPnPAVController() {};
+    
+    /**
+     * Destructor. Ensures safe deletion (also during WLAN disconnection).
+     *
+     * @since Series 60 3.2
+     */    
+    virtual void Release() = 0;
+    };
+
+
+#endif // M_UPNPAVCONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontrolleractive.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for monitoring device events
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_UPNPAVCONTROLLERACTIVE_H
+#define C_UPNPAVCONTROLLERACTIVE_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "upnpavcontroller.h"
+
+#include "upnpconnectionmonitorobserver.h"
+#include "upnpavcontrollerclient.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVDeviceObserver;
+
+class CUPnPAVBrowsingSessionImpl;
+class CUPnPAVRenderingSessionImpl;
+class CUPnPAVDeviceActive;
+class CUPnPAVConnectionActive;
+class MUPnPFileDownloadSession;
+class MUPnPFileUploadSession;
+class CUPnPFileUploadSessionImpl;
+class CUPnPFileDownloadSessionImpl;
+
+/**
+ *  Implements the AV Controller interface
+ *
+ *  This class implements the AV Controller interface. Provides methods to
+ *  get devices and to start and stop rendering and browsing sessions.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class CUPnPAVControllerActive : public CActive,
+                                public MUPnPAVController,
+                                public MUPnPConnectionMonitorObserver
+    {
+
+private:
+
+    /**
+     * Release (delete) state. Declares state variables to determine if
+     * deletion is safe.
+     */    
+    enum TReleaseState
+        {
+        EStateReleasable = 0,
+        EStateWLANLost,
+        EStateWaitingForRelease
+        };
+
+public:
+
+    /**
+     * Static constructor
+     *
+     * @param nonr
+     * @return a new av controller instance
+     */
+    static CUPnPAVControllerActive* NewL();
+
+    /**
+     * Static constructor
+     *
+     * @param nonr
+     * @return a new av controller instance
+     */    
+    static CUPnPAVControllerActive* NewLC();
+       
+    /**
+     * Destructor. Ensures safe deletion (also during WLAN disconnection).
+     */    
+    virtual void Release();
+    
+    /**
+     * Destructor
+     * DEPRACATED, usage of Release() recommended. Will be removed in the
+     * future. Safe deletion is not guaranteed.
+     */    
+    virtual ~CUPnPAVControllerActive();
+    
+private:
+
+    /**
+     * 2nd phase construct
+     */    
+    CUPnPAVControllerActive();    
+
+    /**
+     * 2nd phase construct
+     */        
+    void ConstructL();
+    
+protected: // From CActive
+
+    void RunL();
+    
+    void DoCancel();
+    
+    TInt RunError( TInt aError );
+
+protected: // From MUPnPAVController
+
+    /**
+     * See upnpavcontroller.h
+     */
+    void SetDeviceObserver( MUPnPAVDeviceObserver& aObserver );
+
+    /**
+     * See upnpavcontroller.h
+     */
+    void RemoveDeviceObserver();
+
+    /**
+     * See upnpavcontroller.h
+     */
+    MUPnPAVDeviceObserver* DeviceObserver();
+
+    /**
+     * See upnpavcontroller.h
+     */
+    CUpnpAVDeviceList* GetMediaServersL();
+
+    /**
+     * See upnpavcontroller.h
+     */
+    CUpnpAVDeviceList* GetMediaRenderersL();
+    
+    /**
+     * See upnpavcontroller.h
+     */
+    MUPnPAVBrowsingSession& StartBrowsingSessionL(
+        const CUpnpAVDevice& aDevice );
+
+    /**
+     * See upnpavcontroller.h
+     */
+    void StopBrowsingSession( MUPnPAVBrowsingSession& aSession );
+    
+    /**
+     * See upnpavcontroller.h
+     */
+    MUPnPAVRenderingSession& StartRenderingSessionL(
+        const CUpnpAVDevice& aDevice );
+    
+    /**
+     * See upnpavcontroller.h
+     */
+    void StopRenderingSession( MUPnPAVRenderingSession& aSession );
+
+    /**
+     * See upnpavcontroller.h
+     */
+    MUPnPFileUploadSession& StartUploadSessionL(
+        const CUpnpAVDevice& aDevice );
+    
+    /**
+     * See upnpavcontroller.h
+     */
+    void StopUploadSession( MUPnPFileUploadSession& aSession );    
+
+    /**
+     * See upnpavcontroller.h
+     */
+    MUPnPFileDownloadSession& StartDownloadSessionL(
+        const CUpnpAVDevice& aDevice );
+    
+    /**
+     * See upnpavcontroller.h
+     */
+    void StopDownloadSession( MUPnPFileDownloadSession& aSession );
+    
+protected: // From CUPnPConnectionMonitorObserver
+
+    void ConnectionLost();    
+
+private:
+    
+    MUPnPAVDeviceObserver*                      iDeviceObserver; // not owned
+    
+    CUPnPAVConnectionActive*                    iConnectionActive; // owned
+    
+    RUPnPAVControllerClient                     iServer;
+    
+    RPointerArray<CUPnPAVBrowsingSessionImpl>   iBrowsingSessions;
+    
+    RPointerArray<CUPnPAVRenderingSessionImpl>  iRenderingSessions;
+
+    RPointerArray<CUPnPFileUploadSessionImpl>   iUploadSessions;
+    
+    RPointerArray<CUPnPFileDownloadSessionImpl> iDownloadSessions;
+    
+    TInt                                        iRespBufSize;           
+    TPckg<TInt>                                 iRespBufSizePkg;
+    
+    TAVControllerDeviceDiscovery                iDiscovered;
+    TPckg<TAVControllerDeviceDiscovery>         iDiscoveredPkg;
+    
+    TBool iAlive;
+    
+    CActiveSchedulerWait                        iWait;
+    
+    TReleaseState                               iReleaseState;
+
+    };
+
+#endif // C_UPNPAVCONTROLLERACTIVE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontrollerclient.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,620 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AVController client session
+*
+*/
+
+
+
+
+
+
+#ifndef C_CUPNPAVCONTROLLERCLIENT_H
+#define C_CUPNPAVCONTROLLERCLIENT_H
+
+// INCLUDES
+#include "upnpavcontrollerglobals.h"
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+class CUpnpContainer;
+class CUpnpDevice;
+class CUpnpObject;
+class RFile;
+
+// CLASS DECLARATION
+/**
+ *  Client-side interface to AV Controller Server
+ *
+ *  This class provides the client-side interface to the AV Controller
+ *  Server session.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class RUPnPAVControllerClient : public RSessionBase
+    {
+public:
+
+    /**
+     * Construct the object
+     */
+    RUPnPAVControllerClient();
+
+    /**
+     * Connects to the server and create a session
+     * @return error code
+     */
+    TInt Connect();
+    
+    /**
+     * Returns the version number
+     * @return the version
+     */
+    TVersion Version() const;
+
+    /**
+     * Startup request. Starts up the AV Control Point
+     *
+     * @param aStatus request status
+     */    
+    void StartUp( TRequestStatus& aStatus );
+
+    /**
+     * Cancels startup.
+     *
+     * @return error code
+     */    
+    TInt CancelStartUp();
+
+    /**
+     * Device discovery request
+     *
+     * @param aDiscovered type of device
+     * @param aRcvdBufSize size of device
+     * @param aStatus request status
+     */    
+    void DeviceRequest( TDes8& aDiscovered, TDes8& aRcvdBufSize,
+        TRequestStatus& aStatus );
+        
+    /**
+     * Cancels device discovery request
+     *
+     * @return error code
+     */    
+    TInt CancelDeviceRequest();
+    
+    /**
+     * Gets device
+     *
+     * @param aDevice device
+     * @return error code
+     */    
+    TInt GetDevice( TDes8& aDevice );
+    
+    /**
+     * Gets device list size
+     *
+     * @param aType type of devices
+     * @param aSize size of the list
+     * @return error code
+     */    
+    TInt GetDeviceListSize( TDes8& aType, TDes8& aSize );
+    
+    /**
+     * Gets device list
+     * 
+     * @param aList device list
+     * @return error code
+     */    
+    TInt GetDeviceList( TDes8& aList );
+    
+    /**
+     * Release media server
+     *
+     * @param aId session id
+     * @return error code
+     */    
+    TInt ReleaseMediaServer( TInt aId );
+    
+    /**
+     * Reserve media server
+     * 
+     * @param aId session id
+     * @param aStatus request status
+     */    
+    void ReserveMediaServer( TInt aId, TRequestStatus& aStatus );
+    
+    /**
+     * Cancel reserve media server
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelReserveMediaServer( TInt aId );
+
+public: // Rendering Session releated
+    
+    /**
+     * Create a rendering session
+     * 
+     * @param aId session id
+     * @param aUuid device Uuid
+     * @return error code
+     */    
+    TInt CreateRenderingSession( TInt aId, TDes8& aUuid );
+    
+    /**
+     * Destroy a rendering session
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt DestroyRenderingSession( TInt aId );
+    
+    /**
+     * AV event request
+     *
+     * @param aEvent AV Event
+     * @param aId session id
+     * @param aStatus request status
+     */    
+    void EventRequest( TDes8& aEvent, TInt aId, TRequestStatus& aStatus );
+    
+    /**
+     * Cancel event request
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelEventRequest( TInt aId );
+    
+    /**
+     * Set URI
+     *
+     * @param aId session id
+     * @param aRequest request information
+     * @param aItem item
+     * @param aType type of the item 
+     * @param aStatus request status
+     */    
+    void SetURI( TInt aId, TDes8& aRequest, TDes8& aItem,
+                                 TRequestStatus& aStatus );
+        
+    /**
+     * Cancel reserve media server
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelSetURI( TInt aId );
+    
+    /**
+     * Set Next URI
+     *
+     * @param aId session id
+     * @param aRequest request information
+     * @param aItem item
+     * @param aType type of the item 
+     * @param aStatus request status
+     */    
+    void SetNextURI( TInt aId, TDes8& Request, TDes8& aItem,
+                                    TRequestStatus& aStatus );
+        
+    /**
+     * Cancel reserve media server
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelSetNextURI( TInt aId );
+    
+    /**
+     * Send play action
+     *
+     * @param aId session id
+     * @param aStatus request status
+     */    
+    void Play( TInt aId, TRequestStatus& aStatus );
+    
+    /**
+     * Cancel play
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelPlay( TInt aId );
+    
+    /**
+     * Send stop action
+     *
+     * @param aId session id
+     * @param aStatus request status
+     */    
+    void Stop( TInt aId, TRequestStatus& aStatus );
+    
+    /**
+     * Cancel stop
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelStop( TInt aId );
+    
+    /**
+     * Send pause action
+     *
+     * @param aId session id
+     * @param aStatus request status
+     */    
+    void Pause( TInt aId, TRequestStatus& aStatus );
+    
+    /**
+     * Cancel pause
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelPause( TInt aId );
+    
+    /**
+     * Set volume level
+     *
+     * @param aId session id
+     * @param aVolumeLevel volume level
+     * @param aRetVolume (set) volume level
+     * @param aStatus request status
+     */    
+    void SetVolume( TInt aId, TInt aVolumeLevel, TDes8& aRetVolume,
+        TRequestStatus& aStatus );
+        
+    /**
+     * Cancel set volume
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelSetVolume( TInt aId );
+    
+    /**
+     * Get volume level
+     *
+     * @param aId session id
+     * @param aVolumeLevel volume level
+     * @param aStatus request status
+     */    
+    void GetVolume( TInt aId, TDes8& aVolumeLevel, TRequestStatus& aStatus );
+    
+    /**
+     * Cancel get volume
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelGetVolume( TInt aId );
+    
+    /**
+     * Set mute
+     *
+     * @param aId session id
+     * @param aMute mute
+     * @param aRetMute (set) mute
+     * @param aStatus request status
+     */    
+    void SetMute( TInt aId, TBool aMute, TDes8& aRetMute,
+        TRequestStatus& aStatus );
+    
+    /**
+     * Cancel set mute
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelSetMute( TInt aId );
+    
+    /**
+     * Get mute
+     *
+     * @param aId session id
+     * @param aMute mute
+     * @param aStatus request status
+     */    
+    void GetMute( TInt aId, TDes8& aMute, TRequestStatus& aStatus );
+    
+    /**
+     * Cancel get mute
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelGetMute( TInt aId );
+     
+    /**
+     * Get position info
+     *
+     * @param aId session id
+     * @param aPosition position info
+     * @param aLength lenght info
+     * @param aStatus request status
+     */    
+    void GetPositionInfo( TInt aId, TDes8& aPosition, TDes8& aLength,
+        TRequestStatus& aStatus );
+        
+    /**
+     * Cancel get position info
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelGetPositionInfo( TInt aId );
+
+public: // Browsing Session releated
+
+    /**
+     * Create browsing session
+     *
+     * @param aId session id
+     * @param aUuid device uuid
+     * @return error code
+     */    
+    TInt CreateBrowsingSession( TInt aId, TDes8& aUuid );
+    
+    /**
+     * Destroy browsing session
+     *
+     * @param aId session id
+     * @return error code
+     */    
+    TInt DestroyBrowsingSession( TInt aId );
+    
+    /**
+     * Get browse response size
+     *
+     * @param aId session id
+     * @param aRequest request information
+     * @param aSize response size
+     * @param aMatches count of items
+     * @param aStatus request status
+     */    
+    void BrowseResponseSize( TInt aId, TDes8& aRequest, TDes8& aParams,
+        TRequestStatus& aStatus );
+    
+    /**
+     * Cancel get browse response size
+     *
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelBrowseResponseSize( TInt aId );
+    
+    /**
+     * Get browse response
+     *
+     * @param aId session id
+     * @param aBrowseResponse browse response
+     * @return error code
+     */    
+    TInt BrowseResponse( TInt aId, TDes8& aBrowseResponse,
+        TDes8& aUpdateId );
+
+    /**
+     * Get search response size
+     *
+     * @param aId session id
+     * @param aRequest request information
+     * @param aSize response size
+     * @param aMatches count of items
+     * @param aStatus request status
+     */    
+    void SearchResponseSize( TInt aId, TDes8& aRequest, TDes8& aParams,
+        TRequestStatus& aStatus );
+    
+    /**
+     * Cancel get search response size
+     *
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelSearchResponseSize( TInt aId );
+    
+    /**
+     * Get search response
+     *
+     * @param aId session id
+     * @param aSearchResponse search response
+     * @return error code
+     */    
+    TInt SearchResponse( TInt aId, TDes8& aSearchResponse,
+        TDes8& aUpdateId );
+
+    /**
+     * Get search capabilities size
+     *
+     * @param aId session id
+     * @param aSize size
+     * @param aStatus request status
+     */    
+    void GetSearchCapabilitiesSize( TInt aId, TDes8& aSize,
+        TRequestStatus& aStatus );
+    
+    /**
+     * Cancel get search capabilities size
+     *
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelGetSearchCapabilitiesSize( TInt aId );
+    
+    /**
+     * Get search capabilities
+     *
+     * @param aId session id
+     * @param aCapabilitiesResponse search capabilities response
+     * @return error code
+     */    
+    TInt SearchCapabilitiesResponse( TInt aId,
+        TDes8& aCapabilitiesResponse );
+    
+    /**
+     * Create a container
+     *
+     * @param aId session id
+     * @param aTitle container title
+     * @param aParentId parent id
+     * @param aContainerType container type
+     * @param aStatus request status
+     */    
+    void CreateContainer( TInt aId,
+                          TDes8& aTitle,
+                          TDes8& aParentId,
+                          TInt aContainerType,
+                          TRequestStatus& aStatus );                          
+    
+    /**
+     * Cancel create container
+     *
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelCreateContainer( TInt aId );
+
+    /**
+     * Delete object
+     *
+     * @param aId session id
+     * @param aObjectId object id
+     * @param aStatus request status
+     */    
+    void DeleteObject( TInt aId, TDes8& aObjectId, TRequestStatus& aStatus );
+    
+    /**
+     * Cancel delete object
+     *
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelDeleteObject( TInt aId );
+    
+    /**
+     * Device disappeared request
+     *
+     * @param aId session id
+     * @param aStatus request status
+     */    
+    void DeviceDisappearedRequest( TInt aId, TRequestStatus& aStatus );
+    
+    /**
+     * Cancel device disappeared request
+     *
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelDeviceDisappearedRequest( TInt aId );    
+    
+    /**
+     * Monitor WLAN connection request
+     *
+     * @param aStatus request status
+     */    
+    void MonitorConnection( TRequestStatus& aStatus );
+    
+    /**
+     * Cancel monitor connection
+     *
+     * @param aId session id
+     * @return error code
+     */    
+    TInt CancelMonitorConnection();
+
+    /**
+     * 
+     *
+     * @param aInUse
+     * @return error code
+     */    
+    TInt MSServicesInUse( TDes8& aInUse );
+
+public: // Download Session releated
+
+    /**
+     * Create a download session
+     * 
+     * @param aId session id
+     * @param aUuid device Uuid
+     * @return error code
+     */    
+    TInt CreateDownloadSession( TInt aId, TDes8& aUuid );
+    
+    /**
+     * Destroy a download session
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt DestroyDownloadSession( TInt aId );
+
+    TInt StartDownload( TInt aId, TDes8& aFileTransferItem );
+    
+    TInt StartDownload( TInt aId, TDes8& aFileTransferItem,
+        const RFile& aFile );
+    
+    void GetDownloadEvent( TInt aId, TDes8& aEvent,
+        TRequestStatus& aStatus, TDes& aBuffer );
+    
+    TInt CancelDownloadEvent( TInt aId );
+        
+    TInt StartTrackingDownloadProgress( TInt aId, TInt aKey );    
+    
+    TInt CancelDownload( TInt aId, TInt aKey );
+    
+    TInt CancelAllDownloads( TInt aId );
+    
+public: // Upload Session releated
+
+    /**
+     * Create an upload session
+     * 
+     * @param aId session id
+     * @param aUuid device Uuid
+     * @return error code
+     */    
+    TInt CreateUploadSession( TInt aId, TDes8& aUuid );
+    
+    /**
+     * Destroy an upload session
+     * 
+     * @param aId session id
+     * @return error code
+     */    
+    TInt DestroyUploadSession( TInt aId );
+
+    TInt StartUpload( TInt aId, TDes8& aFileTransferItem );
+    
+    void GetUploadEvent( TInt aId, TDes8& aEvent,
+        TRequestStatus& aStatus );
+    
+    TInt CancelUploadEvent( TInt aId );
+        
+    TInt StartTrackingUploadProgress( TInt aId, TInt aKey );    
+    
+    TInt CancelUpload( TInt aId, TInt aKey );
+    
+    TInt CancelAllUploads( TInt aId );
+    };
+
+#endif // C_CUPNPAVCONTROLLERCLIENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontrollerfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Abstract factory for UPnP AV Controller
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_UPNPAVCONTROLLERFACTORY_H
+#define C_UPNPAVCONTROLLERFACTORY_H
+
+#include <e32std.h>
+
+class MUPnPAVController;
+
+/**
+ *  Abstract factory for UPnP AV Controller
+ *
+ *  Abstract factory for UPnP AV Controller. Exports methods to instantiate
+ *  the AV Controller.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class UPnPAVControllerFactory
+    {
+
+public:
+
+    enum TAVControllerServerStatus
+        {
+        EStatusOffline = 0,
+        EStatusActive
+        };
+
+public:
+
+    /**
+     * Creates a new instance of AV Controller
+     *
+     * @return instance of AV Controller
+     */
+    IMPORT_C static MUPnPAVController* NewUPnPAVControllerL();
+
+    /**
+     * Creates a new instance of AV Controller. Instance is left in
+     * cleanup stack.
+     *
+     * @return instance of AV Controller
+     */
+    IMPORT_C static MUPnPAVController* NewUPnPAVControllerLC();
+
+    /**
+     * Return ETrue is some application is using the local Media Server
+     * services via AV Controller server.
+     *
+     * @return EFalse/ETrue
+     */
+    IMPORT_C static TBool MSServicesInUse();
+
+    /**
+     * Returns the operational state of AV Controller Server
+     *
+     * @param aStatus operational state
+     * @return system wide error code
+     */
+    IMPORT_C static TInt Status( TAVControllerServerStatus& aStatus );
+    };
+
+#endif // ? C_UPNPAVCONTROLLERFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontrollerglobals.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      global definitions for AVController
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_UPNPAVCONTROLLERGLOBALS_H
+#define C_UPNPAVCONTROLLERGLOBALS_H
+
+#include <e32std.h>
+
+
+// CONSTANTS
+const TUint KAVControllerMajorVersionNumber = 0;
+const TUint KAVControllerMinorVersionNumber = 1;
+const TUint KAVControllerBuildVersionNumber = 1;
+
+_LIT( KAVControllerThreadName,      "AVController_MainThread" );
+_LIT( KAVControllerName,            "AVController" );
+_LIT( KAVControllerFilename,        "upnpavcontrollerserver" );
+_LIT8( KAVControllerDefaultName,    "Nokia AV Controller" );
+
+//_LIT8( KDownloadMemoryCard,     "e:\\Download\\Media\\" );
+//_LIT8( KDownloadPhoneMemory,    "c:\\Data\\Download\\Media\\" );
+//_LIT8( KDownloadRAMDrive,       "d:\\Download\\Media\\" );
+
+const TUint KMsFriendlyNameMaxSize = 256;
+const TUid KAVCServerUid3 = {0x20007566};
+
+// ENUMERATIONS
+// Opcodes used in message passing between client and server
+enum TAVControllerRqst
+    {
+    EAVControllerSetURI = 0,                    // 0
+    EAVControllerCancelSetURI,                  // 1
+    EAVControllerSetNextURI,                    // 2
+    EAVControllerCancelSetNextURI,              // 3
+    EAVControllerCancelCopyRemoteItemFinish,    // 4
+    EAVControllerCopyLocalItemStart,            // 5
+    EAVControllerCancelCopyLocalItemStart,      // 6
+    EAVControllerCopyLocalItemFinish,           // 7
+    EAVControllerCancelCopyLocalItemFinish,     // 8
+    EAVControllerCopyToPhoneStart,              // 9
+    EAVControllerCancelCopyToPhoneStart,        // 10
+    EAVControllerCopyToPhoneFinish,             // 11
+    EAVControllerCancelCopyToPhoneFinish,       // 12
+    EAVControllerGetBrowseResponseSize,         // 13
+    EAVControllerCancelGetBrowseResponseSize,   // 14
+    EAVControllerGetBrowseResponse,             // 15
+    EAVControllerGetSearchResponseSize,         // 16
+    EAVControllerCancelGetSearchResponseSize,   // 17
+    EAVControllerGetSearchResponse,             // 18
+    EAVControllerDeviceRequest,                 // 19
+    EAVControllerGetDeviceRequest,              // 20
+    EAVControllerCancelDeviceRequest,           // 21
+    EAVControllerGetDeviceListRequest,          // 22
+    EAVControllerGetDeviceListSizeRequest,      // 23
+    EAVControllerCreateRenderingSession,        // 24
+    EAVControllerDestroyRenderingSession,       // 25
+    EAVControllerEventRequest,                  // 26
+    EAVControllerCancelEventRequest,            // 27
+    EAVControllerPlay,                          // 28
+    EAVControllerCancelPlay,                    // 29
+    EAVControllerStop,                          // 30
+    EAVControllerCancelStop,                    // 31
+    EAVControllerPause,                         // 32
+    EAVControllerCancelPause,                   // 33
+    EAVControllerSetVolume,                     // 34
+    EAVControllerCancelSetVolume,               // 35
+    EAVControllerGetVolume,                     // 36
+    EAVControllerCancelGetVolume,               // 37
+    EAVControllerSetMute,                       // 38
+    EAVControllerCancelSetMute,                 // 39
+    EAVControllerGetMute,                       // 40
+    EAVControllerCancelGetMute,                 // 41
+    EAVControllerGetPositionInfo,               // 42
+    EAVControllerCancelGetPositionInfo,         // 43
+    EAVControllerCreateBrowsingSession,         // 44
+    EAVControllerDestroyBrowsingSession,        // 45
+    EAVControllerGetSearchCapabilitiesSize,     // 46
+    EAVControllerCancelGetSearchCapabilitiesSize, // 47   
+    EAVControllerGetSearchCapabilities,         // 48
+    EAVControllerCreateContainer,               // 49
+    EAVControllerCancelCreateContainer,         // 50
+    EAVControllerDeleteObject,                  // 51
+    EAVControllerCancelDeleteObject,            // 52
+    EAVControllerDeviceDisappearedRequest,      // 53
+    EAVControllerCancelDeviceDisappearedRequest,// 54   
+    EAVControllerStartMediaServer,              // 55
+    EAVControllerCancelStartMediaServer,        // 56
+    EAVControllerStopMediaServer,               // 57
+    EAVControllerMonitorConnection,             // 58
+    EAVControllerCancelMonitorConnection,       // 59
+    EAVControllerMSServicesInUse,               // 60
+    EAVControllerStartupRequest,                 // 61
+    EAVControllerCancelStartupRequest,           // 62
+    EAVControllerCreateDownloadSession,        // 63
+    EAVControllerCreateUploadSession,           // 64
+    EAVControllerDestroyDownloadSession,        // 65
+    EAVControllerDestroyUploadSession,          // 66
+    EAVControllerStartDownload,                 // 67
+    EAVControllerCancelDownload,                // 68
+    EAVControllerCancelAllDownloads,            // 69   
+    EAVControllerStartUpload,                   // 70
+    EAVControllerCancelUpload,                  // 71
+    EAVControllerCancelAllUploads,              // 72
+    EAVControllerStartTrackingUploadProgress,   // 73
+    EAVControllerStartTrackingDownloadProgress, // 74
+    EAVControllerGetDownloadEvent,              // 75
+    EAVControllerCancelDownloadEvent,           // 77
+    EAVControllerGetUploadEvent,                // 78
+    EAVControllerCancelUploadEvent,             // 79
+    EAVControllerStartDownloadFH                // 80
+    };
+    
+enum TAVControllerRsp
+    {
+    EAVControllerDeviceCompleted = 200,
+    EAVControllerSetURICompleted,
+    EAVControllerSetNextURICompleted,
+    EAVControllerPlayCompleted,
+    EAVControllerStopCompleted,
+    EAVControllerPauseCompleted,
+    EAVControllerSetVolumeCompleted,
+    EAVControllerGetVolumeCompleted,
+    EAVControllerSetMuteCompleted,
+    EAVControllerGetMuteCompleted,
+    EAVControllerPositionInfoCompleted,
+    EAVControllerGetBrowseResponseSizeCompleted,
+    EAVControllerGetBrowseResponseCompleted,    
+    EAVControllerGetSearchResponseSizeCompleted,
+    EAVControllerGetSearchResponseCompleted,
+    EAVControllerGetSearchCapabilitiesSizeCompleted,
+    EAVControllerGetSearchCapabilitiesCompleted,
+    EAVControllerCopyRemoteItemStartCompleted,
+    EAVControllerCopyRemoteItemFinishCompleted,
+    EAVControllerCopyLocalItemStartCompleted,
+    EAVControllerCopyLocalItemFinishCompleted,
+    EAVControllerCopyToPhoneStartCompleted,
+    EAVControllerCopyToPhoneFinishCompleted,
+    EAVControllerCreateContainerCompleted,
+    EAVControllerDeleteObjectCompleted,
+    EAVControllerDeviceDisappearedRequestCompleted,
+    EAVControllerStartMediaServerCompleted,
+    EAVControllerConnectionLost
+    };  
+
+enum TAVControllerDeviceDiscovery
+    {
+    EAVDeviceDisappeared,
+    EAVDeviceDiscovered
+    };
+
+enum TAVControllerDeviceListType
+    {
+    EAVMediaServer,
+    EAVMediaRenderer
+    };
+
+/**
+ * Defines unsolicited event
+ */
+enum TUnsolicitedEventE
+    {
+    EPlay = 0,
+    EPause,
+    EStop,
+    EVolume,
+    EMute
+    };
+
+/**
+ * Helper class to queu unsolicited events
+ */
+class TUnsolicitedEventC
+    {
+    
+public:    
+    
+    TUnsolicitedEventE  iEvent;
+    TInt                iValue;
+    };
+    
+#endif      // C_UPNPAVCONTROLLERGLOBALS_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavdevice.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,401 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      device data class
+*
+*/
+
+
+
+
+
+
+#ifndef C_CUPNPAVDEVICE_H
+#define C_CUPNPAVDEVICE_H
+
+
+#include <e32base.h>
+//#include <s32strm.h>
+#include <s32mem.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+ *  UPnP AV Device class
+ *  
+ *  UPnP AV Device class, represents a UPnP Media Server or Renderer.
+ *
+ *  @lib - 
+ *  @since Series 60 3.1
+ */
+class CUpnpAVDevice : public CBase
+    {
+public:
+
+    /**
+     * Enumeration to define the type of a device
+     */
+    enum TUpnpAVDeviceType
+        {
+        EMediaServer,
+        EMediaRenderer
+        };    
+    
+public:  // Constructors and destructor
+        
+    /**
+     * Two-phased constructor. Instance is left in cleanup stack.
+     *
+     * @return a device instance
+     */
+    IMPORT_C static CUpnpAVDevice* NewLC();
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @return a device instance
+     */
+    IMPORT_C static CUpnpAVDevice* NewL();
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @param aDevice a device to copy information from
+     * @return a device instance
+     */
+    IMPORT_C static CUpnpAVDevice* NewL( const CUpnpAVDevice& aDevice );
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CUpnpAVDevice();
+    
+public:
+
+    /**
+     * Externalizes device information to stream.
+     * Leaves in case of errors.
+     * @since Series 60 3.0
+     * @param reference to RWriteStream
+     * @return none
+     */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+     * Internalizes device information from stream.
+     * Leaves in case of errors.
+     * @since Series 60 3.0
+     * @param reference to RReadStream
+     * @return none
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+    
+    /**
+     * Externalizes device information to a heap descriptor
+     *
+     * @return externalized device
+     */
+    IMPORT_C HBufC8* ToDes8L() const;
+
+    /**
+     * Overwrites all existing data in this device and replaces it
+     * with data copied from given device.
+     * @since Series 60 3.1
+     * @param aDevice object to copy attributes from
+     */
+    IMPORT_C void CopyFromL( const CUpnpAVDevice& aDevice );
+
+protected: //
+
+    /**
+     * Constructor
+     */
+    IMPORT_C CUpnpAVDevice();
+
+    /**
+     * Perform the second phase construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+    /**
+     * Sets the friendly name of the device
+     * 
+     * @param aName name
+     */
+    IMPORT_C void SetFriendlyNameL( const TDesC8& aName );
+    
+    /**
+     * Return friendly name
+     * 
+     * @return friendly name
+     */
+    IMPORT_C const TDesC8& FriendlyName() const;
+    
+    /**
+     * Sets the Uuid of the device
+     * 
+     * @param aUuid Uuid
+     */
+    IMPORT_C void SetUuidL( const TDesC8& aUuid );
+    
+    /**
+     * Return Uuid
+     * 
+     * @return Uuid
+     */
+    IMPORT_C const TDesC8& Uuid() const;
+    
+    /**
+     * Sets the device type (Media Server/Renderer)
+     * 
+     * @param aDeviceType device type
+     */
+    IMPORT_C void SetDeviceType( TUpnpAVDeviceType aDeviceType );
+    
+    /**
+     * Return device type
+     * 
+     * @return device type
+     */
+    IMPORT_C TUpnpAVDeviceType DeviceType() const;
+            
+    /**
+     * Return link offset (used in linked list)
+     * 
+     * @return link offset
+     */
+    IMPORT_C static TInt LinkOffset();         
+
+public: // UPnP media server device capability getters and setters 
+
+    /**
+     * Sets the copy capability of the device
+     * 
+     * @param TBool the copy capability
+     * @return None
+     */
+    IMPORT_C void SetCopyCapability( TBool aCopyCap );
+
+    /**
+     * Gets the copy capability of the device
+     * 
+     * @param None
+     * @return TBool the copy capability
+     */
+    IMPORT_C TBool CopyCapability() const;
+
+    /**
+     * Sets the search capability of the device
+     * 
+     * @param TBool the search capability
+     * @return None
+     */
+    IMPORT_C void SetSearchCapability( TBool aSearchCap );
+
+    /**
+     * Gets the search capability of the device
+     * 
+     * @param None
+     * @return TBool the search capability
+     */
+    IMPORT_C TBool SearchCapability() const;
+
+public: // UPnP rendering device capability getters and setters 
+
+    /**
+     * Sets the pause capability of the device
+     * 
+     * @param TBool the pause capability
+     * @return None
+     */
+    IMPORT_C void SetPauseCapability( TBool aPauseCap );
+
+    /**
+     * Gets the pause capability of the device
+     * 
+     * @param None
+     * @return TBool the pause capability
+     */
+    IMPORT_C TBool PauseCapability() const;
+
+    /**
+     * Sets the volume capability of the device
+     * 
+     * @param TBool the volume capability
+     * @return None
+     */
+    IMPORT_C void SetVolumeCapability( TBool aVolumeCap );
+
+    /**
+     * Gets the volume capability of the device
+     * 
+     * @param None
+     * @return TBool the volume capability
+     */
+    IMPORT_C TBool VolumeCapability() const;
+
+    /**
+     * Sets the mute capability of the device
+     * 
+     * @param TBool the mute capability
+     * @return None
+     */
+    IMPORT_C void SetMuteCapability( TBool aMuteCap );
+
+    /**
+     * Gets the mute capability of the device
+     * 
+     * @param None
+     * @return TBool the mute capability
+     */
+    IMPORT_C TBool MuteCapability() const;
+
+    /**
+     * Sets the maximum volume of the device
+     * 
+     * @param TInt the maximum volume
+     * @return None
+     */
+    IMPORT_C void SetMaxVolume( TInt aVolume );
+
+    /**
+     * Gets the maximum volume of the device
+     * 
+     * @return TInt the maximum volume
+     */
+    IMPORT_C TInt MaxVolume() const;
+    
+    /**
+     * Sets the SetNextAVTransportUri capability of the device
+     * 
+     * @param aCap (TBool)
+     * @return None
+     */
+    IMPORT_C void SetNextAVTransportUri( TBool aCap );
+
+    /**
+     * Returns the SetNextAVTransportUri capability of the device
+     * 
+     * @param None
+     * @return TBool ETrue if SetNextAVTrasportUri action is supported
+     */
+    IMPORT_C TBool NextAVTransportUri() const;           
+
+public: // UPnP media rendering capability getters and setters 
+
+    IMPORT_C void SetCapabilitiesBySupportedMimeTypesL(
+        const TDesC8& aListOfMimeTypes );
+
+    /**
+     * Sets audio capability of the device
+     * 
+     * @param aCap (TBool)
+     * @return None
+     */
+    IMPORT_C void SetAudioCapability( TBool aCap );
+
+    /**
+     * Gets the audio media capability of the device
+     * 
+     * @param None
+     * @return TBool the audio media capability
+     */
+    IMPORT_C TBool AudioCapability() const;
+
+    /**
+     * Sets image capability of the device
+     * 
+     * @param aCap (TBool)
+     * @return None
+     */
+    IMPORT_C void SetImageCapability( TBool aCap );
+
+    /**
+     * Gets the image media capability of the device
+     * 
+     * @param None
+     * @return TBool the image media capability
+     */
+    IMPORT_C TBool ImageCapability() const;
+
+    /**
+     * Sets video capability of the device
+     * 
+     * @param aCap (TBool)
+     * @return None
+     */
+    IMPORT_C void SetVideoCapability( TBool aCap );
+
+    /**
+     * Gets the video media capability of the device
+     * 
+     * @param None
+     * @return TBool the video media capability
+     */
+    IMPORT_C TBool VideoCapability() const;
+
+public: // DLNA releated
+
+    /**
+     * Sets if the device is Dlna compatible
+     * 
+     * @param aDlnaCompatible
+     */    
+    IMPORT_C void SetDlnaCompatible( TBool aDlnaCompatible );
+    
+    /**
+     * Return if the device is Dlna compatible
+     * 
+     * @return ETrue if the device is dlna compatible
+     */    
+    IMPORT_C TBool DlnaCompatible() const;
+
+protected:
+    
+    TSglQueLink iSlink;
+    
+    HBufC8*     iUuid; // Owned
+    
+    HBufC8*     iName; // Owned
+    
+    TUpnpAVDeviceType iDeviceType;
+    
+    TBool iCopyCapability;
+    
+    TBool iSearchCapability;
+    
+    TBool iPauseCapability;
+    
+    TBool iVolumeCapability;
+    
+    TBool iMuteCapability;
+    
+    TBool iAudioMediaCapability;
+    
+    TBool iImageMediaCapability;
+    
+    TBool iVideoMediaCapability;
+    
+    TBool iNextAVTransportUri;
+
+    TInt iMaxVolume;            
+    
+    TBool iDlnaCompatible;            
+    };
+
+
+#endif // C_CUPNPAVDEVICE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavdeviceactive.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for monitoring device disconnections per session
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVDEVICEACTIVE_H
+#define C_UPNPAVDEVICEACTIVE_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include "upnpavrenderingsessionobserver.h"
+
+class RUPnPAVControllerClient;
+class MUPnPAVDeviceObserver;
+
+/**
+ *  Device active
+ *
+ *  Active object for listening if a device disappears.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class CUPnPAVDeviceActive : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aServer session handle
+     * @param aObserver device observer
+     * @return an instance
+     */
+    static CUPnPAVDeviceActive* NewL( RUPnPAVControllerClient& aServer,
+        MUPnPAVDeviceObserver& aObserver );
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPAVDeviceActive();
+       
+private:
+
+    /**
+     * Constructor.
+     */
+    CUPnPAVDeviceActive( RUPnPAVControllerClient& aServer,
+        MUPnPAVDeviceObserver& aObserver );
+    
+    /**
+     * 2nd phase construct
+     */
+    void ConstructL();
+
+protected: // From CActive
+
+    /**
+     * See e32base.h
+     */
+    void RunL();
+    
+    /**
+     * See e32base.h
+     */
+    void DoCancel();
+    
+    /**
+     * See e32base.h
+     */
+    TInt RunError( TInt aError );
+
+public: // New functions    
+
+    /**
+     * Starts listening
+     *
+     * @param aId session id
+     */
+    void StartListening( TInt aId );
+
+private:
+
+    RUPnPAVControllerClient& iServer;
+    
+    TInt iId;
+
+    MUPnPAVDeviceObserver& iObserver;       
+    
+    };
+
+#endif // C_UPNPAVDEVICEACTIVE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavdevicelist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implements a list of UPnP Devices
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVDEVICELIST_H
+#define C_UPNPAVDEVICELIST_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+//None
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+
+
+// CLASS DECLARATION
+
+/**
+ *  UPnP AV Device list class
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since Series 60 3.1
+ */
+class CUpnpAVDeviceList : public CBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CUpnpAVDeviceList* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CUpnpAVDeviceList* NewLC();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpAVDeviceList();
+
+public: // New functions
+    
+    /**
+     * Operator
+     */
+    IMPORT_C CUpnpAVDevice* operator[]( TInt aIndex ) const;
+        
+    /**
+     * Serialize the whole list to a heap based descriptor.
+     *
+     * @return pointer to the descriptor where the list is serialized.
+     */
+    IMPORT_C HBufC8* ToDes8L() const;       
+
+    /**
+     * Appends a new device
+     * 
+     * @param none
+     * @return TUPnPObjectType information of the type
+     */
+    IMPORT_C void AppendDeviceL( CUpnpAVDevice& aDevice );
+    
+    /**
+     * Removes a device
+     * 
+     * @param aId id of the object to be removed and destroyed
+     */
+    IMPORT_C void RemoveAndDestroy( TInt aIndex );
+
+    /**
+     * Detaches a device
+     * 
+     * @param aId id of the object to be removed and destroyed
+     */
+    IMPORT_C void Remove( TInt aIndex );
+
+    /**
+     * Removes all devices
+     */        
+    IMPORT_C void ResetAndDestroy();
+
+    /**
+     * Detaches all devices
+     */        
+    IMPORT_C void Reset();
+    
+    /**
+     * Returns the count of devices
+     *
+     * @return TInt count information
+     */
+    IMPORT_C TInt Count( ) const;  
+
+public:
+
+    /**
+     * Externalizes list
+     *
+     * @param reference to RWriteStream
+     */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+     * Internalizes itemlist information from stream.
+     * 
+     * @param reference to RReadStream
+     */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+protected:
+
+    /**
+     * C++ default constructor.
+     */
+    CUpnpAVDeviceList();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL( );
+    
+private:
+    
+    // Device array
+    RPointerArray<CUpnpAVDevice>   iDevices;
+    };
+
+
+
+#endif      // C_UPNPAVDEVICELIST_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavdeviceobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      main callback interface for AVController client
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPAVDEVICEOBSERVER_H
+#define M_UPNPAVDEVICEOBSERVER_H
+
+// INCLUDES
+
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+
+/**
+* Defines the response interface for the device control operations of the
+* UPnP AV Controller.
+*
+* @since Series 60 3.1
+*/
+class MUPnPAVDeviceObserver
+    {
+
+public:
+
+    /**
+     * Notifies that a new UPnP device was discovered.
+     *
+     * UPnPAVController releases the memory allocated for aDevice
+     * after calling the callback method.
+     *
+     * @since Series 60 3.1
+     * @param aDevice CUpnpDevice object
+     * @return None
+     */
+    virtual void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ) = 0;
+
+    /**
+     * Notifies that a UPnP device was disappeared.
+     *
+     * UPnPAVController releases the memory allocated for aDevice
+     * after calling the callback method.
+     *
+     * @since Series 60 3.1
+     * @param aDevice CUpnpDevice object
+     * @return None
+     */
+    virtual void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ) = 0;
+
+    /**
+     * Notifies that the WLAN connection has been lost. All sessions
+     * are now usable and must be closed.
+     *
+     * @since Series 60 3.1
+     * @return None
+     */        
+    virtual void WLANConnectionLost() = 0;       
+
+    };
+
+#endif // M_UPNPAVDEVICEOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpaveventactive.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for receiving events from media renderer
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVEVENTACTIVE_H
+#define C_UPNPAVEVENTACTIVE_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "upnpavrenderingsessionobserver.h"
+#include "upnpavcontrollerglobals.h"
+
+class RUPnPAVControllerClient;
+class CUPnPAVRenderingSessionImpl;
+
+/**
+ *  Active object for listening AV Events.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class CUPnPAVEventActive : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aServer session handle
+     * @param aObserver device observer
+     * @return an instance
+     */
+    static CUPnPAVEventActive* NewL( RUPnPAVControllerClient& aServer,
+        CUPnPAVRenderingSessionImpl& aObserver );
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPAVEventActive();
+       
+private:
+
+    /**
+     * Constructor
+     */
+    CUPnPAVEventActive( RUPnPAVControllerClient& aServer,
+        CUPnPAVRenderingSessionImpl& aObserver );
+    
+    /**
+     * 2nd phase construct
+     */
+    void ConstructL();
+
+protected: // From CActive
+
+    /**
+     * See e32base.h
+     */
+    void RunL();
+    
+    /**
+     * See e32base.h
+     */
+    void DoCancel();
+    
+    /**
+     * See e32base.h
+     */
+    TInt RunError( TInt aError );
+
+public: // New functions    
+
+    /**
+     * Starts listening for events
+     *
+     * @param aId session id
+     */
+    void StartListeningEvents( TInt aId );
+
+private:
+
+    RUPnPAVControllerClient& iServer;
+    
+    TInt iId;
+
+    TUnsolicitedEventC           iEvent;
+    TPckg<TUnsolicitedEventC>    iEventPkg;
+    
+    CUPnPAVRenderingSessionImpl& iObserver;       
+    
+    };
+
+#endif // C_UPNPAVEVENTACTIVE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavrenderingactive.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,285 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for performing rendering commands
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVRENDERINGACTIVE_H
+#define C_UPNPAVRENDERINGACTIVE_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include "upnpavrenderingsessionobserver.h"
+
+class RUPnPAVControllerClient;
+class CUpnpItem;
+//class CUPnPAVRenderingSessionImpl;
+
+/**
+ *  ?one_line_short_description
+ *
+ *  ?more_complete_description
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class CUPnPAVRenderingActive : public CActive
+    {
+
+private:
+
+    /**
+     * Enumeration to define the action
+     */
+    enum TPendingOperation
+        {
+        ENone = 0,
+        ESetURI,
+        ESetNextURI,
+        EPlay,
+        EStop,
+        EPause,
+        ESetVolume,
+        EGetVolume,
+        ESetMute,
+        EGetMute,
+        EPositionInfo,
+        EStartMediaServer
+        };
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aServer session handle
+     * @param aId session id
+     * @return an instance
+     */
+    static CUPnPAVRenderingActive* NewL(
+        RUPnPAVControllerClient& aServer, TInt aId );
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPAVRenderingActive();
+       
+private:
+
+    /**
+     * Constructor
+     */
+    CUPnPAVRenderingActive( RUPnPAVControllerClient& aServer, TInt aId );
+    
+    /**
+     * 2nd phase construct
+     */
+    void ConstructL();
+
+protected: // From CActive
+
+    /**
+     * See e32base.h
+     */
+    void RunL();
+    
+    /**
+     * See e32base.h
+     */
+    void DoCancel();
+    
+    /**
+     * See e32base.h
+     */
+    TInt RunError( TInt aError );
+
+public: // New functions    
+
+    /**
+     * Sets Media observer instance
+     *
+     * @since Series 60 3.1      
+     * @param aInstance MUPnPAVMediaObserver instance of the class that
+     *        implements the IF
+     * @return TInt status
+     */
+    void SetObserver( MUPnPAVRenderingSessionObserver& aObserver );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void RemoveObserver();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    MUPnPAVRenderingSessionObserver* Observer() const;
+        
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void ReserveLocalMSServicesL(); 
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void CancelReserveLocalMSServicesL(); 
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void ReleaseLocalMSServicesL(); 
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void SetURIL( const TDesC8& aURI, const CUpnpItem& aItem );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void SetNextURIL( const TDesC8& aURI, const CUpnpItem& aItem );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void PlayL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void StopL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void PauseL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void SetVolumeL( TInt aVolumeLevel );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void GetVolumeL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void SetMuteL( TBool aMute );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void GetMuteL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void GetPositionInfoL();
+        
+private:
+
+    /**
+     * Reset method
+     */
+    void ResetL();
+    
+    /**
+     * Set uri response handling
+     */
+    void SetURICompleteL();
+    
+    /**
+     * Set next uri response handling
+     */
+    void SetNextURICompleteL();
+    
+    /**
+     * Play response handling
+     */
+    void PlayCompleteL();
+    
+    /**
+     * Stop response handling
+     */
+    void StopCompleteL();
+    
+    /**
+     * Pause response handling
+     */
+    void PauseCompleteL();
+    
+    /**
+     * Set volume response handling
+     */
+    void SetVolumeCompleteL();
+    
+    /**
+     * Get volume response handling
+     */
+    void GetVolumeCompleteL();
+    
+    /**
+     * Set mute response handling
+     */
+    void SetMuteCompleteL();
+    
+    /**
+     * Get mute response handling
+     */
+    void GetMuteCompleteL();
+    
+    /**
+     * Get position info response handling
+     */
+    void PositionInfoCompleteL();
+    
+    /**
+     * Start media server response handling
+     */
+    void StartMediaServerCompleteL();    
+
+private:
+
+    RUPnPAVControllerClient&            iServer;
+
+    TInt                                iId;
+
+    // Buffer to pass data to server
+    HBufC8*                             iBuffer; // owned
+    TPtr8                               iBufferPtr;         
+
+    HBufC8*                             iBuffer2; // owned
+    TPtr8                               iBufferPtr2;         
+    
+    TInt                                iRespBufSize;           
+    TPckg<TInt>                         iRespBufSizePkg;
+    
+    TBool                               iMediaServerResourceReserved;
+    
+    TPendingOperation                   iPendingOperation;
+    
+    MUPnPAVRenderingSessionObserver*    iObserver; // Not owned      
+    
+    };
+
+#endif // C_UPNPAVRENDERINGACTIVE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavrenderingsession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      interface for session against a renderer
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVRENDERINGSESSION_H
+#define C_UPNPAVRENDERINGSESSION_H
+
+#include <e32std.h>
+#include "upnpavsessionbase.h"
+
+class MUPnPAVRenderingSessionObserver;
+class CUpnpItem;
+
+/**
+ *  AV Controller rendering session interface.
+ *
+ *  This class defines the rendering interface of AV Controller.
+ *  Includes operations to set and to set next uri, play, stop and
+ *  pause the playback, to set the volume and mute and to get the
+ *  position information
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+ class MUPnPAVRenderingSession : public MUPnPAVSessionBase
+    {
+
+public:
+
+    /**
+     * Sets the rendering session observer
+     *
+     * @since Series 60 3.1      
+     * @param aObserver rendering session observer
+     * @return none
+     */
+    virtual void SetObserver(
+        MUPnPAVRenderingSessionObserver& aObserver ) = 0;
+
+    /**
+     * Removes the rendering session observer
+     *
+     * @since Series 60 3.1     
+     * @param None
+     * @return None
+     */
+    virtual void RemoveObserver() = 0;
+    
+    /**
+     * Returns the rendering session observer
+     *
+     * @since Series 60 3.1     
+     * @param None
+     * @return observer
+     */
+    virtual MUPnPAVRenderingSessionObserver* Observer() const = 0;   
+    
+public:
+
+    /**
+     * Set the URI by providing an URI and the item  
+     * 
+     * @since Series 60 3.1
+     * @param aURI URI of the item
+     * @param aObject item
+     */
+    virtual void SetURIL( const TDesC8& aURI, const CUpnpItem& aItem ) = 0;
+    
+    /**
+     * Set the next URI by providing an URI and the item  
+     * 
+     * @since Series 60 3.1
+     * @param aURI URI of the item
+     * @param aObject item
+     */
+    virtual void SetNextURIL( const TDesC8& aURI,
+        const CUpnpItem& aItem ) = 0;
+
+    /**
+     * Starts the playback. 
+     *
+     * @since Series 60 3.1
+     * @param None
+     * @return none
+     */
+    virtual void PlayL() = 0;
+
+    /**
+     * Stops the playback.
+     *
+     * @since Series 60 3.1
+     * @param None
+     * @return none
+     */
+    virtual void StopL() = 0;
+
+    /**
+     * Pauses the playback.
+     *
+     * @since Series 60 3.1
+     * @param None
+     * @return none
+     */
+    virtual void PauseL() = 0;
+
+    /**
+     * Sets the volume level.
+     *
+     * @since Series 60 3.1
+     * @param aVolumeLevel TInt Volume level in percents (0 - 100)
+     * @return none
+     */
+    virtual void SetVolumeL( TInt aVolumeLevel ) = 0;
+
+    /**
+     * Gets the volume level.
+     *
+     * @since Series 60 3.1
+     * @param None
+     * @return none
+     */
+    virtual void GetVolumeL() = 0;
+
+    /**
+     * Sets the mute state.
+     *
+     * @since Series 60 3.1
+     * @param aMute TBool desired state of the mute (ETrue of EFalse)
+     * @return none
+     */
+    virtual void SetMuteL( TBool aMute ) = 0;
+
+    /**
+     * Gets the mute state.
+     *
+     * @since Series 60 3.1
+     * @param None
+     * @return none
+     */
+    virtual void GetMuteL() = 0;
+
+    /**
+     * Gets position info of the media that is currently
+     * rendered on the UPnP Media Renderer.
+     *
+     * @since Series 60 3.0
+     * @param none
+     * @return none
+     */
+    virtual void GetPositionInfoL() = 0;
+    
+    };
+
+
+#endif // C_UPNPAVRENDERINGSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavrenderingsessionimpl.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,233 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implements a session against a renderer
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVRENDERINGSESSIONIMPL_H
+#define C_UPNPAVRENDERINGSESSIONIMPL_H
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "upnpavrenderingsession.h"
+#include "upnpavdeviceobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+class RUPnPAVControllerClient;
+class CUPnPAVEventActive;
+class CUPnPAVDeviceActive;
+class CUPnPAVRenderingActive;
+class CUpnpItem;
+class TUnsolicitedEventC;
+
+/**
+ *  AV Controller rendering session implementation.
+ *
+ *  This class implements the rendering session. Includes operations
+ *  to set and to set next uri, play, stop and pause the playback,
+ *  to set the volume and mute and to get the position information
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class CUPnPAVRenderingSessionImpl : public CBase,
+                                    public MUPnPAVRenderingSession,
+                                    public MUPnPAVDeviceObserver
+                                    
+    {
+
+public:
+
+    /**
+     * Static constructor
+     *
+     * @param aServer handle to AV Controller server
+     * @param aDevice target device
+     * @return a new browsing session implementation instance
+     */    
+    static CUPnPAVRenderingSessionImpl* NewL(
+        RUPnPAVControllerClient& aServer,
+        const CUpnpAVDevice& aDevice );
+ 
+    /**
+     * Destructor
+     */        
+    virtual ~CUPnPAVRenderingSessionImpl();
+    
+private:
+
+    /**
+     * 2nd phase construct
+     */    
+    CUPnPAVRenderingSessionImpl( RUPnPAVControllerClient& aServer );
+    
+    /**
+     * 2nd phase construct
+     */        
+    void ConstructL();
+
+protected: // From MUPnPAVRenderingSession
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void SetObserver( MUPnPAVRenderingSessionObserver& aObserver );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void RemoveObserver();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    MUPnPAVRenderingSessionObserver* Observer() const;
+    
+    /**
+     * See upnpavrenderingsession.h
+     */
+    const CUpnpAVDevice& Device() const;
+    
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void ReserveLocalMSServicesL(); 
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void CancelReserveLocalMSServicesL(); 
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void ReleaseLocalMSServicesL(); 
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void SetURIL( const TDesC8& aURI, const CUpnpItem& aItem );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void SetNextURIL( const TDesC8& aURI, const CUpnpItem& aItem );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void PlayL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void StopL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void PauseL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void SetVolumeL( TInt aVolumeLevel );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void GetVolumeL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void SetMuteL( TBool aMute );
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void GetMuteL();
+
+    /**
+     * See upnpavrenderingsession.h
+     */
+    void GetPositionInfoL();
+
+public: // From MUPnPAVDeviceObserver
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void WLANConnectionLost();
+
+public: // Public methods
+
+    /**
+     * A method to receive an unsolicited event
+     * @param aError error code
+     * @param aEvent event
+     */     
+    void EventReceived( TInt aError,
+        TUnsolicitedEventC aEvent );
+       
+private: // Private methods
+
+    void ResetL();
+
+private:
+
+    RUPnPAVControllerClient&            iServer; // not owned
+    
+    MUPnPAVRenderingSessionObserver*    iObserver; // not owned
+    
+    CUPnPAVDeviceActive*                iDeviceActive; // owned
+    
+    CUPnPAVEventActive*                 iEventActive; // owned
+    
+    CUPnPAVRenderingActive*             iCommandActive; // owned
+    
+    CUPnPAVRenderingActive*             iSettingActive; // owned    
+    
+    CUpnpAVDevice*                      iDevice; // owned
+
+    // Buffer to pass data to server
+    HBufC8*                             iBuffer; // owned            
+    TPtr8                               iBufferPtr;         
+ 
+    TBool                               iAlive;
+        
+    TBool                               iMediaServerResourceReserved;
+    
+    };
+
+
+#endif // C_UPNPAVRENDERINGSESSIONIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavrenderingsessionobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      callback interface for a rendering session
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPAVRENDERINGSESSIONOBSERVER_H
+#define M_UPNPAVRENDERINGSESSIONOBSERVER_H
+
+// INCLUDE FILES
+#include "upnpavsessionobserverbase.h"
+
+// TYPEDEFS
+enum TUPnPAVInteractOperation
+    {
+    EUPnPAVPlay = 0,
+    EUPnPAVPause,
+    EUPnPAVStop,
+    EUPnPAVPlayUser,
+    EUPnPAVPauseUser,
+    EUPnPAVStopUser
+    };
+
+/**
+* Defines the response interface for the media control operations of the
+* UPnP AV Controller.
+*
+* @since Series 60 3.1
+*/
+class MUPnPAVRenderingSessionObserver : public MUPnPAVSessionObserverBase
+    {
+    
+public:
+
+    /**
+     * UPnP AV Controller calls this method to return the result for the
+     * 'get volume' request. Parameter contains the volume level of the
+     * media renderer device to which the 'get volume' request was sent.
+     *
+     * @since Series 60 3.1
+     * @param aError system wide error code
+     * @param aVolumeLevel TInt volume level (integer value between 0 - 100)
+     * @param aActionResponse ETrue, if this is a response to GetVolume()
+     * @return None
+     */
+    virtual void VolumeResult( TInt aError, TInt aVolumeLevel,
+        TBool aActionResponse ) = 0;
+
+    /**
+     * UPnP AV Controller calls this method to return the result for the
+     * 'get mute' request. Parameter contains the state of the mute of the
+     * media renderer device to which the 'get mute' request was sent.
+     *
+     * @since Series 60 3.1
+     * @param aError system wide error code
+     * @param aMute TBool the state of the mute (ETrue or EFalse)
+     * @param aActionResponse ETrue, if this is a response to GetMute()
+     * @return None
+     */
+    virtual void MuteResult( TInt aError, TBool aMute,
+        TBool aActionResponse ) = 0;
+
+    /**
+     * UPnP AV Controller calls this method to indicate that the requested
+     * interaction operation (play, stop, etc.) is complete. In other words,
+     * the target rendering device has changed it's state accordingly.
+     *
+     * @since Series 60 3.1
+     * @param aError system wide error code
+     * @param aOperation TInt operation (TAVInteractOperation)
+     * @return None
+     */
+    virtual void InteractOperationComplete( 
+                      TInt aError,
+                      TUPnPAVInteractOperation aOperation 
+                      ) = 0;
+
+    /**
+     * UPnP AV Controller calls this method as a response to Position 
+     * Info action. The current position and the total length of the 
+     * track that is currently playing is returned. The results are in
+     * (hh:mm:ss) format.
+     *
+     * UPnPAVController releases the memory allocated for aTrackPosition
+     * and aTrackLength.
+     *
+     * @since Series 60 3.0
+     * @param aStatus TInt error code
+     * @param aTrackPosition TDesC8& track position
+     * @param aTrackLength TDesC8& track length
+     * @return None
+     */
+    virtual void PositionInfoResult( 
+                      TInt aError, 
+                      const TDesC8& aTrackPosition, 
+                      const TDesC8& aTrackLength 
+                      ) = 0;
+
+    /**
+     * UPnP AV Controller calls this method to return the result for the
+     * 'set uri' request.
+     *
+     * @since Series 60 3.1
+     * @param aError error code
+     * @return None
+     */                      
+    virtual void SetURIResult( TInt aError ) = 0;
+
+    /**
+     * UPnP AV Controller calls this method to return the result for the
+     * 'set next uri' request.
+     *
+     * @since Series 60 3.1
+     * @param aError error code
+     * @return None
+     */                         
+    virtual void SetNextURIResult( TInt aError ) = 0;                   
+
+    /**
+     * Notifies that the Media Renderer we have a session with has
+     * disappeared. Session is now unusable and must be closed. 
+     *
+     * @since Series 60 3.1
+     * @return None
+     */        
+    virtual void MediaRendererDisappeared( 
+        TUPnPDeviceDisconnectedReason aReason ) = 0;
+        
+    virtual void ReserveLocalMSServicesCompleted( TInt aError ) = 0;        
+
+    };
+
+#endif // M_UPNPAVRENDERINGSESSIONOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavrequest.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a data class for client-server comm.
+*
+*/
+
+
+
+
+
+
+#ifndef C_CUPNPAVREQUEST_H
+#define C_CUPNPAVREQUEST_H
+
+
+#include <e32base.h>
+//#include <s32strm.h>
+#include <s32mem.h>
+#include "upnpavbrowsingsession.h"
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+
+// CLASS DECLARATION
+
+/**
+*  UPnP AV Controller Client/Server communication helper class
+*  
+*
+*  @lib -
+*  @since Series 60 3.1
+*/
+
+class CUpnpAVRequest : public CBase
+    { 
+    
+public:  // Constructors and destructor
+        
+    /**
+     * Two-phased constructor.
+     */
+    static inline CUpnpAVRequest* NewLC();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static inline CUpnpAVRequest* NewL();
+    
+    /**
+     * Destructor.
+     */
+    inline virtual ~CUpnpAVRequest();
+    
+public:
+
+    /**
+     * Externalizes information to stream.
+     * Leaves in case of errors.
+     * @since Series 60 3.1
+     * @param reference to RWriteStream
+     * @return none
+     */
+    inline void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+     * Internalizes information from stream.
+     * Leaves in case of errors.
+     * @since Series 60 3.1
+     * @param reference to RReadStream
+     * @return none
+     */
+    inline void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Externalizes information to stream and returns the object as a heap
+     * desctiptor.
+     */    
+    inline HBufC8* ToDes8L() const;
+
+private:
+
+    /**
+    * Constructor
+    */
+    inline CUpnpAVRequest();
+
+    /**
+     * Perform the second phase construction
+     */
+    inline void ConstructL();
+
+public: // New methods
+
+    /**
+     * Sets Id
+     * @param aId Id
+     */
+    inline void SetIdL( const TDesC8& aId );
+
+    /**
+     * Retuns Id
+     * @return Id
+     */    
+    inline const TDesC8& Id();
+
+    /**
+     * Sets Uuid
+     * @param aUuid Uuid
+     */    
+    inline void SetUuidL( const TDesC8& aUuid );
+
+    /**
+     * Retuns Uuid
+     * @return Uuid
+     */        
+    inline const TDesC8& Uuid();
+    
+    /**
+     * Sets filepath
+     * @param aFilePath filepath
+     */    
+    inline void SetFilePathL( const TDesC& aFilePath );
+    
+    /**
+     * Retuns filepath
+     * @return filepath
+     */        
+    inline const TDesC& FilePath();
+
+    /**
+     * Sets URI
+     * @param aURI URI
+     */    
+    inline void SetURIL( const TDesC8& aURI );
+    
+    /**
+     * Retuns URI
+     * @return URI
+     */        
+    inline const TDesC8& URI();
+    
+    /**
+     * Sets if a browse action is required
+     * @param aBrowse ETrue is a browse action is required
+     */    
+    inline void SetRequiresBrowse( TBool aBrowse );
+    
+    /**
+     * Retuns ETrue if a browse action is required
+     * @return ETrue/EFalse
+     */        
+    inline TBool RequiresBrowse();
+
+    /**
+     * Sets used memory type
+     * @param aMemoryType memory type
+     */
+    inline void SetMemoryType( MUPnPAVBrowsingSession::TMemoryType
+        aMemoryType );
+
+    /**
+     * Retuns used memory type
+     * @return memory type
+     */        
+    inline MUPnPAVBrowsingSession::TMemoryType MemoryType();
+
+    /**
+     * Sets the state of filesharing after operation
+     * @param aFileSharing state of filesharing
+     */
+    inline void SetFileSharing( MUPnPAVBrowsingSession::TFileSharing
+        aFileSharing );
+
+    /**
+     * Retuns state of filesharing
+     * @return filesharing
+     */        
+    inline MUPnPAVBrowsingSession::TFileSharing FileSharing();
+
+private:
+    
+    HBufC8*                                 iId; // Owned
+    HBufC8*                                 iUuid; // Owned
+    HBufC*                                  iFilePath; // Owned
+    HBufC8*                                 iURI; // Owned
+    TBool                                   iRequiresBrowse; // Owned
+    MUPnPAVBrowsingSession::TMemoryType     iMemoryType; // Owned
+    MUPnPAVBrowsingSession::TFileSharing    iFileSharing; // Owned
+    };
+
+#include "upnpavrequest.inl"
+
+#endif // C_CUPNPAVREQUEST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavrequest.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,330 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a data class for client-server comms
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include "upnpavrequest.h"
+
+#include <upnpitem.h>
+
+// CONSTANTS
+_LIT( KURIRequestPanicText, "CUpnpAVRequest" );
+const TInt KMaxStringLen = 256;
+const TInt KMaxStringLenLong = 1024;
+const TInt KBufferGranularity = 100;    
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::CUpnpAVRequest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+inline CUpnpAVRequest::CUpnpAVRequest()
+    {    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+inline void CUpnpAVRequest::ConstructL()
+    {
+    iId = KNullDesC8().AllocL();
+    iUuid = KNullDesC8().AllocL();
+    iFilePath = KNullDesC().AllocL();;
+    iURI = KNullDesC8().AllocL(); 
+    //iItem = CUpnpItem::NewL();                              
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline CUpnpAVRequest* CUpnpAVRequest::NewL()
+    {
+    CUpnpAVRequest* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline CUpnpAVRequest* CUpnpAVRequest::NewLC()
+    {
+    CUpnpAVRequest* self = new( ELeave )
+        CUpnpAVRequest;    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+    
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::~CUpnpAVRequest
+// Destructor
+// --------------------------------------------------------------------------
+inline CUpnpAVRequest::~CUpnpAVRequest()
+    {
+    delete iId;
+    delete iUuid;
+    delete iFilePath;
+    delete iURI;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::ExternalizeL
+// Externatizes object
+// --------------------------------------------------------------------------
+inline void CUpnpAVRequest::ExternalizeL( RWriteStream& aStream ) const
+    {    
+    aStream << *iId;
+    aStream << *iUuid;
+    aStream << *iFilePath;
+    aStream << *iURI;
+    aStream.WriteInt16L( (TInt)iRequiresBrowse );
+    aStream.WriteInt16L( (TInt)iMemoryType );
+    aStream.WriteInt16L( (TInt)iFileSharing );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::InternalizeL
+// Internalizes object
+// --------------------------------------------------------------------------    
+inline void CUpnpAVRequest::InternalizeL( RReadStream& aStream )
+    {
+    delete iId; iId = NULL;
+    iId = HBufC8::NewL( aStream, KMaxStringLen );
+
+    delete iUuid; iUuid = NULL;
+    iUuid = HBufC8::NewL( aStream, KMaxStringLen );
+    
+    delete iFilePath; iFilePath = NULL;
+    iFilePath = HBufC::NewL( aStream, KMaxStringLen );
+
+    delete iURI; iURI = NULL;
+    iURI = HBufC8::NewL( aStream, KMaxStringLenLong );
+    
+    iRequiresBrowse = (TBool)aStream.ReadInt16L();
+    
+    iMemoryType = (MUPnPAVBrowsingSession::TMemoryType)aStream.ReadInt16L();
+    
+    iFileSharing = (MUPnPAVBrowsingSession::TFileSharing)
+        aStream.ReadInt16L();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::ToDes8L
+// Externalizes object to a heap descriptor
+// --------------------------------------------------------------------------
+inline HBufC8* CUpnpAVRequest::ToDes8L() const
+    {
+    // serialize object
+    CBufFlat* tempFlatBuf = CBufFlat::NewL( KBufferGranularity );
+    CleanupStack::PushL( tempFlatBuf );
+
+    RBufWriteStream stream( *tempFlatBuf );
+    CleanupClosePushL( stream );
+    
+    stream << *this;
+    
+    // create heap descriptor
+    HBufC8* tempBuf = HBufC8::NewLC( tempFlatBuf->Size() );
+    TPtr8 ptr( tempBuf->Des() );
+    tempFlatBuf->Read( 0, ptr, tempFlatBuf->Size() );
+    
+    // clean up
+    CleanupStack::Pop( tempBuf );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( tempFlatBuf );
+    
+    return tempBuf;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::SetIdL
+// Sets id
+// --------------------------------------------------------------------------
+inline void CUpnpAVRequest::SetIdL( const TDesC8& aId )
+    {
+    HBufC8* tempBuf = aId.AllocL();
+    delete iId;
+    iId = tempBuf;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::Id
+// Returns id
+// --------------------------------------------------------------------------    
+inline const TDesC8& CUpnpAVRequest::Id()
+    {
+    if( iId )
+        {
+        return *iId;
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::SetUuidL
+// Sets uuid
+// --------------------------------------------------------------------------
+inline void CUpnpAVRequest::SetUuidL( const TDesC8& aUuid )
+    {
+    HBufC8* tempBuf = aUuid.AllocL();
+    delete iUuid;
+    iUuid = tempBuf;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::Uuid
+// Returns uuid
+// --------------------------------------------------------------------------
+inline const TDesC8& CUpnpAVRequest::Uuid()
+    {    
+    if( iUuid )
+        {
+        return *iUuid;
+        }
+    else
+        {
+        return KNullDesC8;
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::SetFilePathL
+// Sets filepath
+// --------------------------------------------------------------------------
+inline void CUpnpAVRequest::SetFilePathL( const TDesC& aFilePath )
+    {
+    HBufC* tempBuf = aFilePath.AllocL();
+    delete iFilePath;
+    iFilePath = tempBuf;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::FilePath
+// Returns filepath
+// --------------------------------------------------------------------------
+inline const TDesC& CUpnpAVRequest::FilePath()
+    {
+    if( iFilePath )
+        {
+        return *iFilePath;
+        }
+    else
+        {
+        return KNullDesC;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::SetURIL
+// Sets URI
+// --------------------------------------------------------------------------
+inline void CUpnpAVRequest::SetURIL( const TDesC8& aURI )
+    {
+    HBufC8* tempBuf = aURI.AllocL();
+    delete iURI;
+    iURI = tempBuf;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::URI
+// Returns URI
+// --------------------------------------------------------------------------
+inline const TDesC8& CUpnpAVRequest::URI()
+    {
+    if( iURI )
+        {
+        return *iURI;
+        }
+    else
+        {
+        return KNullDesC8;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::SetRequiresBrowse
+// 
+// --------------------------------------------------------------------------
+inline void CUpnpAVRequest::SetRequiresBrowse( TBool aBrowse )
+    {
+    iRequiresBrowse = aBrowse;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::RequiresBrowse
+// 
+// --------------------------------------------------------------------------
+inline TBool CUpnpAVRequest::RequiresBrowse()
+    {
+    return iRequiresBrowse;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::SetMemoryType
+// Sets used memory type
+// --------------------------------------------------------------------------
+inline void CUpnpAVRequest::SetMemoryType(
+    MUPnPAVBrowsingSession::TMemoryType aMemoryType )
+    {
+    iMemoryType = aMemoryType;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::MemoryType
+// Returns used memory type
+// --------------------------------------------------------------------------
+inline MUPnPAVBrowsingSession::TMemoryType CUpnpAVRequest::MemoryType()
+    {
+    return iMemoryType;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::SetFileSharing
+// Sets the state of filesharing
+// --------------------------------------------------------------------------
+inline void CUpnpAVRequest::SetFileSharing(
+    MUPnPAVBrowsingSession::TFileSharing aFileSharing )
+    {
+    iFileSharing = aFileSharing;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVRequest::FileSharing
+// Returns the state of filesharing
+// --------------------------------------------------------------------------
+inline MUPnPAVBrowsingSession::TFileSharing CUpnpAVRequest::FileSharing()
+    {
+    return iFileSharing;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavsessionbase.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a base class for browsing and rendering sessions
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVSESSIONBASE_H
+#define C_UPNPAVSESSIONBASE_H
+
+#include <e32std.h>
+
+class CUpnpAVDevice;
+
+/**
+ *  UPnP Session base
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class MUPnPAVSessionBase
+    {
+
+public:
+
+    /**
+     * Returns the device we have a session with
+     *
+     * @since Series 60 3.1     
+     * @return device
+     */
+    virtual const CUpnpAVDevice& Device() const = 0;
+        
+    /**
+     * Reserves local Media Server services.
+     *
+     * @since Series 60 3.1     
+     */
+    virtual void ReserveLocalMSServicesL() = 0; 
+
+    /**
+     * Cancels reserving of local Media Server services.
+     *
+     * @since Series 60 3.1     
+     */
+    virtual void CancelReserveLocalMSServicesL() = 0; 
+
+    /**
+     * Releases local Media Server services.
+     *
+     * @since Series 60 3.1     
+     */
+    virtual void ReleaseLocalMSServicesL() = 0; 
+
+protected:
+    
+    virtual ~MUPnPAVSessionBase() {};
+    
+    };
+
+
+#endif // C_UPNPAVSESSIONBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpavsessionobserverbase.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a base class for browsing and rendering sessoin observers
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPAVSESSIONOBSERVERBASE_H
+#define M_UPNPAVSESSIONOBSERVERBASE_H
+
+/**
+* Defines the response interface for the general operations of the
+* UPnP AV Controller.
+*
+* @since Series 60 3.1
+*/
+class MUPnPAVSessionObserverBase
+    {
+    
+public:
+
+    enum TUPnPDeviceDisconnectedReason
+        {
+        EDisconnected = 100,
+        EWLANLost
+        };
+    
+public:
+
+    };
+
+#endif // M_UPNPAVSESSIONOBSERVERBASE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpfiledownloadsession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File tranfer session
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPFILEDOWNLOADSESSION_H
+#define M_UPNPFILEDOWNLOADSESSION_H
+
+// EXTERNAL INCLUDES
+#include <e32std.h>
+#include <f32file.h>
+
+// INTERNAL INCLUDES
+#include "upnpfiletransfersession.h"
+
+// FORWARD DECLARATIONS
+class CUpnpElement;
+class CUpnpItem;
+
+// CLASS DECLARATION
+/**
+ *  AV Controller download session interface.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.2
+ */
+ class MUPnPFileDownloadSession : public MUPnPFileTransferSession
+    {
+
+public:
+
+    /**
+     * Start downloading an item. Original resource will be downloaded.
+     *
+     * @param aItem UPnP item to download
+     * @param aKey identifies the download operation
+     */        
+    virtual void StartDownloadL( const CUpnpItem& aItem, TInt aKey ) = 0;
+
+    /**
+     * Start downloadin and item. Resource is selected by providing the
+     * desired res-element and. The resource is downloaded to the provided
+     * file.
+     *
+     * @param aResElement points to a resource in the item to download
+     * @param aItem UPnP item to download
+     * @param aFile file handle (download target)
+     * @param aKey identifies the download operation
+     */        
+    virtual void StartDownloadL( const CUpnpElement& aResElement,
+        const CUpnpItem& aItem, RFile& aFile, TInt aKey ) = 0;
+
+protected:
+
+    /**
+     * Protected destructor
+     */        
+    virtual ~MUPnPFileDownloadSession() {};
+    
+    };
+
+
+#endif // M_UPNPFILEDOWNLOADSESSION_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpfiledownloadsessionimpl.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File tranfer session implementation
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPFILEDOWNLOADSESSIONIMPL_H
+#define C_UPNPFILEDOWNLOADSESSIONIMPL_H
+
+// EXTERNAL INCLUDES
+#include <e32base.h>
+
+// INTERNAL INCLUDES
+#include "upnpfiledownloadsession.h"
+#include "upnpavdeviceobserver.h"
+#include "tupnpfiletransferevent.h"
+
+// FORWARD DECLARATIONS
+class RUPnPAVControllerClient;
+class CUpnpAVDevice;
+class MUPnPFileTransferSessionObserver;
+
+// CLASS DECLARATION
+/**
+ *  AV Controller file download session clint-side implementation.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CUPnPFileDownloadSessionImpl ) :
+                                        public CActive, 
+                                        public MUPnPFileDownloadSession,
+                                        public MUPnPAVDeviceObserver
+    {
+public:
+
+    /**
+     * 1st phase construct
+     *
+     * @param aServer a handle to AV Controller server
+     * @param aDevice target device
+     * @return new instance
+     */
+    static CUPnPFileDownloadSessionImpl* NewL(
+        RUPnPAVControllerClient& aServer, const CUpnpAVDevice& aDevice );
+
+    /**
+     * Destructor
+     */
+    ~CUPnPFileDownloadSessionImpl();
+
+private:
+
+    /**
+     * Private constructor
+     *
+     * @param aServer a handle to AV Controller server
+     */
+    CUPnPFileDownloadSessionImpl( RUPnPAVControllerClient& aServer );
+
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+
+private: // From CActive
+
+    /**
+     * See e32base.h
+     */        
+    void RunL();
+    
+    /**
+     * See e32base.h
+     */        
+    void DoCancel();
+    
+    /**
+     * See e32base.h
+     */        
+    TInt RunError( TInt aError );         
+
+public: // From MUPnPFileUploadSession
+
+    /**
+     * See upnpfiledownloadsession.h
+     */
+    void StartDownloadL( const CUpnpItem& aItem, TInt aKey );
+
+    /**
+     * See upnpfiledownloadsession.h
+     */
+    void StartDownloadL( const CUpnpElement& aResElement,
+        const CUpnpItem& aItem, RFile& aFile, TInt aKey );
+
+public: // From MUPnPFileTransferSession
+
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void SetObserver( MUPnPFileTransferSessionObserver& aObserver );
+
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void RemoveObserver();
+    
+    /**
+     * See upnpfiletransfersession.h
+     */
+    MUPnPFileTransferSessionObserver* Observer() const;   
+
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void StartTrackingProgressL( TInt aKey );
+    
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void CancelTransfer( TInt aKey );
+    
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void CancelAllTransfers();
+
+public: // From MUPnPAVDeviceObserver
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void WLANConnectionLost();
+    
+public: // New methods
+
+    /**
+     * Returns device
+     *
+     * @return device
+     */        
+    const CUpnpAVDevice& Device() const;
+
+private:
+
+    /**
+     * Reset
+     */        
+    void ResetL();
+
+private:
+
+    /**
+     * Filetransfer session observer
+     *
+     * Not owned
+     */        
+    MUPnPFileTransferSessionObserver*   iObserver;
+    
+    /**
+     * AV Controller client handle
+     */        
+    RUPnPAVControllerClient&            iServer;
+    
+    /**
+     * Target device
+     *
+     * Owned
+     */        
+    CUpnpAVDevice*                      iDevice;
+    
+    /**
+     * Buffer to pass data to the server process
+     *
+     * Owned
+     */        
+    HBufC8*                             iBuffer;
+    
+    /**
+     * Modifiable pointer to the data buffer
+     */        
+    TPtr8                               iBufferPtr;
+
+    /**
+     * Buffer to pass data to the server process
+     *
+     * Owned
+     */        
+    HBufC*                              iBuffer2;
+    
+    /**
+     * Modifiable pointer to the data buffer
+     */        
+    TPtr                                iBufferPtr2;
+    
+    /**
+     * Flag to store the state of WLAN
+     */        
+    TBool                               iAlive;
+
+    /**
+     * Filetransfer event. Used to receive events from the server process
+     */        
+    TUpnpFileTransferEvent              iEvent;           
+    
+    /**
+     * Package buffer used in client-server comms
+     */        
+    TPckg<TUpnpFileTransferEvent>       iEventPkg;
+    
+    };
+
+#endif // C_UPNPFILEDOWNLOADSESSIONIMPL_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpfiletransferitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a data class containing filetransfer-related data
+*
+*/
+
+
+
+
+
+
+#ifndef C_CUPNPFILETRANSFERITEM_H
+#define C_CUPNPFILETRANSFERITEM_H
+
+// EXTERNAL INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+
+// CLASS DECLARATION
+/**
+*  UPnP AV Controller Client/Server communication helper class
+*  
+*  @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( CUpnpFileTransferItem ) : public CBase
+    { 
+    
+public:  // Constructors and destructor
+        
+    /**
+     * Two-phased constructor.
+     */
+    static inline CUpnpFileTransferItem* NewLC();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static inline CUpnpFileTransferItem* NewL();
+    
+    /**
+     * Destructor.
+     */
+    inline virtual ~CUpnpFileTransferItem();
+    
+public:
+
+    /**
+     * Externalizes device information to stream.
+     * Leaves in case of errors.
+     * @since Series 60 3.2
+     * @param reference to RWriteStream
+     */
+    inline void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+     * Internalizes device information from stream.
+     * Leaves in case of errors.
+     * @since Series 60 3.2
+     * @param reference to RReadStream
+     */
+    inline void InternalizeL( RReadStream& aStream );
+
+    /**
+     * Externalizes information to stream and returns the object as a heap
+     * desctiptor.
+     */        
+    inline HBufC8* ToDes8L() const;
+
+private: //
+
+    /**
+     * Constructor
+     */
+    inline CUpnpFileTransferItem();
+
+    /**
+     * Perform the second phase construction
+     */
+    inline void ConstructL();
+
+public: // New methods
+
+    /**
+     * Set Uri
+     *
+     * @param aUri Uri
+     */        
+    inline void SetUriL( const TDesC8& aUri );
+    
+    /**
+     * Return Uri
+     *
+     * @return Uri
+     */        
+    inline const TDesC8& Uri() const;
+
+    /**
+     * Set title
+     *
+     * @param aTitle title
+     */        
+    inline void SetTitleL( const TDesC8& aTitle );
+    
+    /**
+     * Return title
+     *
+     * @return title
+     */        
+    inline const TDesC8& Title() const;
+    
+    /**
+     * Set protocolinfo
+     *
+     * @param aProtocolInfo protocolinfo
+     */        
+    inline void SetProtocolInfoL( const TDesC8& aProtocolInfo );
+    
+    /**
+     * Return protocolinfo
+     *
+     * @return protocolinfo
+     */        
+    inline const TDesC8& ProtocolInfo() const;
+
+    /**
+     * Set filepath
+     *
+     * @param aPath filepath
+     */        
+    inline void SetPathL( const TDesC& aPath );
+    
+    /**
+     * Return filepath
+     *
+     * @return filepath
+     */        
+    inline const TDesC& Path() const;
+
+    /**
+     * Set key
+     *
+     * @param aKey identifier key
+     */        
+    inline void SetKey( TInt aKey );
+    
+    /**
+     * Return key
+     *
+     * @return key
+     */        
+    inline TInt Key();
+    
+private:
+    
+    /**
+     * Stores URI
+     *
+     * Owned
+     */        
+    HBufC8* iUri;
+
+    /**
+     * Stores title
+     *
+     * Owned
+     */        
+    HBufC8* iTitle;
+    
+    /**
+     * Stores protocolInfo
+     *
+     * Owned
+     */        
+    HBufC8* iProtocolInfo;
+    
+    /**
+     * Stores path
+     *
+     * Owned
+     */        
+    HBufC*  iPath;
+
+    /**
+     * Stores key (filetransfer identifier)
+     *
+     * Owned
+     */        
+    TInt    iKey;    
+    
+    };
+
+#include "upnpfiletransferitem.inl"
+
+#endif // C_CUPNPFILETRANSFERITEM_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpfiletransferitem.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a data class containing browse-related data
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpfiletransferitem.h"
+
+// CONSTANTS
+const TInt KBrowseBufferGranularity = 100;    
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::CUpnpFileTransferItem
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+inline CUpnpFileTransferItem::CUpnpFileTransferItem()
+    {    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+inline void CUpnpFileTransferItem::ConstructL()
+    {
+    iUri = KNullDesC8().AllocL();
+    iTitle = KNullDesC8().AllocL();
+    iProtocolInfo = KNullDesC8().AllocL();
+    iPath = KNullDesC().AllocL();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline CUpnpFileTransferItem* CUpnpFileTransferItem::NewL()
+    {
+    CUpnpFileTransferItem* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline CUpnpFileTransferItem* CUpnpFileTransferItem::NewLC()
+    {
+    CUpnpFileTransferItem* self = new( ELeave )
+        CUpnpFileTransferItem;    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline CUpnpFileTransferItem::~CUpnpFileTransferItem()
+    {
+    delete iUri;
+    delete iTitle;
+    delete iProtocolInfo;
+    delete iPath;         
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+inline void CUpnpFileTransferItem::ExternalizeL( RWriteStream& aStream ) const
+    {    
+    aStream.WriteInt16L( iUri->Length() ); 
+    aStream << *iUri; 
+    
+    aStream.WriteInt16L( iTitle->Length() );
+    aStream << *iTitle;
+    
+    aStream.WriteInt16L( iProtocolInfo->Length() );
+    aStream << *iProtocolInfo;     
+
+    aStream.WriteInt16L( iPath->Length() );
+    aStream << *iPath;  
+    
+    aStream.WriteInt16L( iKey );
+    //aStream.WriteL( (TUint8*)(&iEvent), 
+    //    sizeof(TUpnpFileTransferEvent) );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::InternalizeL
+// Internalizes object
+// --------------------------------------------------------------------------
+inline void CUpnpFileTransferItem::InternalizeL( RReadStream& aStream )
+    {
+    TInt length = aStream.ReadInt16L();     
+    delete iUri; iUri = NULL;
+    iUri = HBufC8::NewL( aStream, length );
+    
+    length = aStream.ReadInt16L();
+    delete iTitle; iTitle = NULL;
+    iTitle = HBufC8::NewL( aStream, length );
+
+    length = aStream.ReadInt16L();
+    delete iProtocolInfo; iProtocolInfo = NULL;
+    iProtocolInfo = HBufC8::NewL( aStream, length );  
+
+    length = aStream.ReadInt16L();
+    delete iPath; iPath = NULL;
+    iPath = HBufC::NewL( aStream, length );
+    
+    iKey = aStream.ReadInt16L();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::ToDes8L
+// Externalizes object to a heap descriptor
+// --------------------------------------------------------------------------
+inline HBufC8* CUpnpFileTransferItem::ToDes8L() const
+    {
+    // serialize object
+    CBufFlat* tempFlatBuf = CBufFlat::NewL( KBrowseBufferGranularity );
+    CleanupStack::PushL( tempFlatBuf );
+
+    RBufWriteStream stream( *tempFlatBuf );
+    CleanupClosePushL( stream );
+    
+    stream << *this;
+    
+    // create heap descriptor
+    HBufC8* tempBuf = HBufC8::NewLC( tempFlatBuf->Size() );
+    TPtr8 ptr( tempBuf->Des() );
+    tempFlatBuf->Read( 0, ptr, tempFlatBuf->Size() );
+    
+    // clean up
+    CleanupStack::Pop( tempBuf );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( tempFlatBuf );
+    
+    return tempBuf;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::SetUriL
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline void CUpnpFileTransferItem::SetUriL( const TDesC8& aUri )
+    {
+    HBufC8* tmp = aUri.AllocL();
+    delete iUri;
+    iUri = tmp;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::Uri
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline const TDesC8& CUpnpFileTransferItem::Uri() const
+    {
+    if( iUri )
+        {
+        return *iUri;
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::SetTitleL
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline void CUpnpFileTransferItem::SetTitleL( const TDesC8& aTitle )
+    {
+    HBufC8* tmp = aTitle.AllocL();
+    delete iTitle;
+    iTitle = tmp;
+    }
+        
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::Title
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline const TDesC8& CUpnpFileTransferItem::Title() const
+    {
+    if( iTitle )
+        {
+        return *iTitle;
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+        
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::SetProtocolInfoL
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline void CUpnpFileTransferItem::SetProtocolInfoL(
+    const TDesC8& aProtocolInfo )
+    {
+    HBufC8* tmp = aProtocolInfo.AllocL();
+    delete iProtocolInfo;
+    iProtocolInfo = tmp;
+    }
+        
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::ProtocolInfo
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline const TDesC8& CUpnpFileTransferItem::ProtocolInfo() const
+    {
+    if( iProtocolInfo )
+        {
+        return *iProtocolInfo;
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::SetPathL
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline void CUpnpFileTransferItem::SetPathL( const TDesC& aPath )
+    {
+    HBufC* tmp = aPath.AllocL();
+    delete iPath;
+    iPath = tmp;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::Path
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline const TDesC& CUpnpFileTransferItem::Path() const
+    {
+    if( iPath )
+        {
+        return *iPath;
+        }
+    else
+        {
+        return KNullDesC;
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::SetKey
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline void CUpnpFileTransferItem::SetKey( TInt aKey )
+    {
+    iKey = aKey;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferItem::Key
+// See upnpfiletransferitem.h
+// --------------------------------------------------------------------------
+inline TInt CUpnpFileTransferItem::Key()
+    {
+    return iKey;
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpfiletransfersession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File tranfer session
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPFILETRANSERSESSION_H
+#define M_UPNPFILETRANSERSESSION_H
+
+// EXTERNAL INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+class MUPnPFileTransferSessionObserver;
+
+// CLASS DECLARATION
+/**
+ *  AV Controller file transfer session interface.
+ *
+ *  @since S60 v3.2
+ */
+ class MUPnPFileTransferSession
+    {
+
+public:
+
+    /**
+     * Sets the file transfer session observer
+     *
+     * @param aObserver file transfer session observer
+     */
+    virtual void SetObserver(
+        MUPnPFileTransferSessionObserver& aObserver ) = 0;
+
+    /**
+     * Removes file transfer session observer
+     */
+    virtual void RemoveObserver() = 0;
+    
+    /**
+     * Returns the file transfer session observer
+     *
+     * @return observer
+     */
+    virtual MUPnPFileTransferSessionObserver* Observer() const = 0;   
+    
+public:
+
+    /**
+     * Start tracking progress
+     * NOTE: Transfer progress is not guaranteed
+     *
+     * @param aKey identifies the transfer
+     */        
+    virtual void StartTrackingProgressL( TInt aKey ) = 0;
+    
+    /**
+     * Cancel transfer
+     *
+     * @param aKey identifies the transfer
+     */        
+    virtual void CancelTransfer( TInt aKey ) = 0;
+    
+    /**
+     * Cancel all transfers
+     *
+     * @param aKey identifies the transfer
+     */        
+    virtual void CancelAllTransfers() = 0;
+    
+    };
+
+#endif // M_UPNPFILETRANSERSESSION_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpfiletransfersessionobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File tranfer session
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPFILETRANSERSESSIONOBSERVER_H
+#define M_UPNPFILETRANSERSESSIONOBSERVER_H
+
+// EXTERNAL INCLUDES
+#include <e32std.h>
+
+// INTERNAL INCLUDES
+#include "upnpavsessionobserverbase.h"
+
+// CLASS DECLARATION
+/**
+ *  AV Controller file transfer session observer interface.
+ *
+ *  @since S60 v3.2
+ */
+ class MUPnPFileTransferSessionObserver : public MUPnPAVSessionObserverBase
+    {   
+    
+public:
+
+    /**
+     * Notifies that the transfer has been started
+     *
+     * @param aKey identifies the transfer
+     * @param aStatus status (error) code
+     */        
+    virtual void TransferStarted( TInt aKey, TInt aStatus ) = 0;
+    
+    /**
+     * Notifies that the transfer has been completed
+     *
+     * @param aKey identifies the transfer
+     * @param aStatus status (error) code
+     * @param aFilePath 
+     */        
+    virtual void TransferCompleted( TInt aKey, TInt aStatus,
+        const TDesC& aFilePath ) = 0;
+    
+    /**
+     * Notifies transfer progress
+     * NOTE: Transfer progress is not guaranteed
+     *
+     * @param aKey identifies the transfer
+     * @param aBytes amount of bytes downloaded
+     * @param aTotalBytes total amount of bytes
+     */        
+    virtual void TransferProgress( TInt aKey, TInt aBytes,
+        TInt aTotalBytes ) = 0;
+
+    /**
+     * Notifies that the Media Server we have a session with has
+     * disappeared. Session is now unusable and must be closed. 
+     *
+     * @since Series 60 3.1
+     * @param aReason reason code
+     * @return None
+     */        
+    virtual void MediaServerDisappeared(
+        TUPnPDeviceDisconnectedReason aReason ) = 0;
+    
+    };
+
+#endif // M_UPNPFILETRANSERSESSIONOBSERVER_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpfileuploadsession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File tranfer session
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPFILEUPLOADSESSION_H
+#define M_UPNPFILEUPLOADSESSION_H
+
+// EXTERNAL INCLUDES
+#include <e32std.h>
+
+// INTERNAL INCLUDES
+#include "upnpfiletransfersession.h"
+
+// CLASS DECLARATION
+/**
+ *  AV Controller file upload session interface.
+ *
+ *  @since S60 v3.2
+ */
+class MUPnPFileUploadSession : public MUPnPFileTransferSession
+    {
+
+public:
+
+    /**
+     * Start upload. Uploads the given file to the remote server
+     *
+     * @param aFilePath filepath pointing to a local file
+     * @param aKey identifies the upload operation
+     */        
+    virtual void StartUploadL( const TDesC& aFilePath, TInt aKey ) = 0;
+
+protected:
+
+    /**
+     * Protected destructor
+     */        
+    virtual ~MUPnPFileUploadSession() {};
+    
+    };
+
+#endif // M_UPNPFILEUPLOADSESSION_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/inc/upnpfileuploadsessionimpl.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File tranfer session
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPFILEUPLOADSESSIONIMPL_H
+#define C_UPNPFILEUPLOADSESSIONIMPL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpfileuploadsession.h"
+#include "upnpavdeviceobserver.h"
+
+#include "tupnpfiletransferevent.h"
+
+// FORWARD DECLARATIONS
+class RUPnPAVControllerClient;
+class CUpnpAVDevice;
+class MUPnPFileTransferSessionObserver;
+
+// CLASS DECLARATION
+/**
+ *  AV Controller file upload session client-side implementation.
+ *
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CUPnPFileUploadSessionImpl ) :
+                                    public CActive, 
+                                    public MUPnPFileUploadSession,
+                                    public MUPnPAVDeviceObserver
+    {
+public:
+
+    /**
+     * 1st phase construct
+     *
+     * @param aServer a handle to AV Controller server
+     * @param aDevice target device
+     * @return new instance
+     */
+    static CUPnPFileUploadSessionImpl* NewL(
+        RUPnPAVControllerClient& aServer, const CUpnpAVDevice& aDevice );
+    
+    /**
+     * Destructor
+     */
+    ~CUPnPFileUploadSessionImpl();
+
+private:
+
+    /**
+     * Private constructor
+     *
+     * @param aServer a handle to AV Controller server
+     */
+    CUPnPFileUploadSessionImpl( RUPnPAVControllerClient& aServer );
+
+    /**
+     * 2nd phase constructor
+     */    
+    void ConstructL();
+
+private: // From CActive
+
+    /**
+     * See e32base.h
+     */        
+    void RunL();
+    /**
+     * See e32base.h
+     */        
+    
+    void DoCancel();
+    
+    /**
+     * See e32base.h
+     */        
+    TInt RunError( TInt aError );         
+
+public: // From MUPnPFileUploadSession
+
+    /**
+     * See upnpfileuploadsession.h
+     */
+    void StartUploadL( const TDesC& aFilePath, TInt aKey );
+
+public: // From MUPnPFileTransferSession
+
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void SetObserver( MUPnPFileTransferSessionObserver& aObserver );
+
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void RemoveObserver();
+    
+    /**
+     * See upnpfiletransfersession.h
+     */
+    MUPnPFileTransferSessionObserver* Observer() const;   
+
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void StartTrackingProgressL( TInt aKey );
+    
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void CancelTransfer( TInt aKey );
+    
+    /**
+     * See upnpfiletransfersession.h
+     */
+    void CancelAllTransfers();
+
+public: // From MUPnPAVDeviceObserver
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
+
+    /**
+     * See upnpavdeviceobserver.h
+     */
+    void WLANConnectionLost();
+    
+public: // New methods
+
+    /**
+     * Returns device
+     *
+     * @return device
+     */        
+    const CUpnpAVDevice& Device() const;
+
+private:
+
+    /**
+     * Reset
+     */        
+    void ResetL();    
+
+private:
+
+    /**
+     * Filetransfer observer
+     *
+     * Not owned
+     */        
+    MUPnPFileTransferSessionObserver*   iObserver;
+    
+    /**
+     * AV Controller server client handle
+     *
+     * Not owned
+     */        
+    RUPnPAVControllerClient&            iServer;
+    
+    /**
+     * Source device
+     *
+     * Owned
+     */        
+    CUpnpAVDevice*                      iDevice;
+    
+    /**
+     * Buffer to pass data to the server process
+     *
+     * Owned
+     */        
+    HBufC8*                             iBuffer;
+
+    /**
+     * Modifiable pointer to data the buffer
+     */        
+    TPtr8                               iBufferPtr;
+
+    /**
+     * Flag to store the state of WLAN
+     */        
+    TBool                               iAlive;
+
+    /**
+     * Filetransfer event. Used to receive events from the server process
+     */        
+    TUpnpFileTransferEvent              iEvent;           
+
+    /**
+     * Package buffer used in client-server comms
+     */        
+    TPckg<TUpnpFileTransferEvent>       iEventPkg;   
+    };
+
+#endif // C_UPNPFILEUPLOADSESSIONIMPL_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavbrowsingsessionimpl.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,793 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implements a session towards a media server
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+// upnp stack api
+#include <upnpcontainer.h>
+#include <upnpobjectlist.h>
+#include <upnpitem.h>
+#include <upnpstring.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdevice.h"
+#include "upnpavbrowsingsessionobserver.h"
+
+// avcontroller internal
+#include "upnpavcontrollerclient.h"
+#include "upnpavrequest.h"
+#include "upnpavbrowserequest.h"
+#include "upnpavdeviceactive.h"
+#include "upnpavbrowsingsessionimpl.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::NewL
+// Two-phase construction
+// --------------------------------------------------------------------------
+CUPnPAVBrowsingSessionImpl* CUPnPAVBrowsingSessionImpl::NewL(
+    RUPnPAVControllerClient& aServer, const CUpnpAVDevice& aDevice )
+    {
+    CUPnPAVBrowsingSessionImpl* self = new (ELeave)
+        CUPnPAVBrowsingSessionImpl( aServer );
+    CleanupStack::PushL( self );
+    self->iDevice = CUpnpAVDevice::NewL( aDevice );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::CUPnPAVBrowsingSessionImpl
+// Constructor
+// --------------------------------------------------------------------------
+CUPnPAVBrowsingSessionImpl::CUPnPAVBrowsingSessionImpl(
+    RUPnPAVControllerClient& aServer ) :
+    CActive( EPriorityStandard ),
+    iServer( aServer ),
+    iBufferPtr( 0, 0 ),
+    iBufferPtr2( 0, 0 ),
+    iBufferPtr3( 0, 0 ),
+    iRespBufSizePkg( iRespBufSize ),
+    //iMatchesPkg( iMatches ),
+    iRespParamsPkg( iRespParams ),
+    iPendingOperation( ENone ),
+    iAlive( ETrue )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::~CUPnPAVBrowsingSessionImpl
+// Destructor
+// --------------------------------------------------------------------------
+CUPnPAVBrowsingSessionImpl::~CUPnPAVBrowsingSessionImpl()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::~CUPnPAVBrowsingSessionImpl" );
+    
+    delete iBuffer;
+    iBuffer = NULL;
+    delete iBuffer2;
+    iBuffer2 = NULL;
+    delete iBuffer3;
+    iBuffer3 = NULL;
+    
+    delete iDeviceActive;
+    iDeviceActive = NULL;
+    
+    //delete iParser;
+    delete iDevice;    
+    iDevice = NULL;
+    
+    Cancel();
+    if( iMediaServerResourceReserved )
+        {
+        iServer.ReleaseMediaServer( (TInt)this );
+        }    
+    iServer.DestroyBrowsingSession( (TInt)this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::ConstructL
+// Two-phase construction
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::ConstructL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::ConstructL" );
+    
+    iBuffer = iDevice->Uuid().AllocL();
+    iBufferPtr.Set( iBuffer->Des() );
+    User::LeaveIfError( iServer.CreateBrowsingSession(
+        (TInt)this , iBufferPtr ) );
+    //iParser = CUPnPXMLParser::NewL();
+    iDeviceActive = CUPnPAVDeviceActive::NewL( iServer, *this );
+    iDeviceActive->StartListening( (TInt)this );
+    }
+
+void CUPnPAVBrowsingSessionImpl::RunL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::RunL" );
+    
+    switch( iPendingOperation )
+        {
+        case EBrowseSize:
+            {
+            iPendingOperation = ENone;
+            BrowseSizeCompletedL();
+            }
+            break;
+            
+        case ESearchSize:
+            {
+            iPendingOperation = ENone;
+            SearchSizeCompletedL();
+            }
+            break;
+            
+        case EGetSearchCapabilities:
+            {
+            SearchCapabilitiesCompletedL();
+            }
+            break;
+
+        case ECreateContainer:
+            {
+            CreateContainerCompletedL();
+            }
+            break;
+
+        case EDeleteObject:
+            {
+            DeleteObjectCompletedL();
+            }
+            break;
+
+        case EStartMediaServer:
+            {
+            StartMediaServerCompleteL();
+            }
+            break;
+            
+        default:
+            __PANICD( __FILE__, __LINE__ );
+            break;            
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::DoCancel
+// From CActive
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::DoCancel()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::DoCancel" );
+    
+    switch( iPendingOperation )
+        {
+        case EBrowseSize:
+            {
+            iServer.CancelBrowseResponseSize( (TInt)this );
+            }
+            break;
+
+        case ESearchSize:
+            {
+            iServer.CancelSearchResponseSize( (TInt)this );
+            }
+            break;
+
+        case EGetSearchCapabilities:
+            {
+            iServer.CancelGetSearchCapabilitiesSize( (TInt)this );
+            }
+            break;
+
+        case ECreateContainer:
+            {
+            iServer.CancelCreateContainer( (TInt)this );
+            }
+            break;
+
+        case EDeleteObject:
+            {
+            iServer.CancelDeleteObject( (TInt)this );
+            }
+            break;
+
+        case EStartMediaServer:
+            {
+            iServer.CancelReserveMediaServer( (TInt)this );
+            }
+            break;          
+
+        default:
+            __PANICD( __FILE__, __LINE__ );
+            break;            
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::RunError
+// From CActive
+// --------------------------------------------------------------------------
+TInt CUPnPAVBrowsingSessionImpl::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+   
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::SetObserver
+// Sets observer
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::SetObserver(
+    MUPnPAVBrowsingSessionObserver& aObserver )
+    {
+    iObserver = &aObserver;
+    }
+     
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::RemoveObserver
+// Removes observer
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::RemoveObserver()
+    {
+    iObserver = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::Observer
+// Returns observer
+// --------------------------------------------------------------------------
+MUPnPAVBrowsingSessionObserver* CUPnPAVBrowsingSessionImpl::Observer() const
+    {
+    return iObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::Device
+// Returns used device
+// --------------------------------------------------------------------------
+const CUpnpAVDevice& CUPnPAVBrowsingSessionImpl::Device() const
+    {
+    return *iDevice;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::ReserveLocalMSServicesL
+// Reserves local media server
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::ReserveLocalMSServicesL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::ReserveLocalMSServicesL" );
+    
+    ResetL();
+    
+    if( iMediaServerResourceReserved )
+        {
+        if( iObserver )
+            {
+            iObserver->ReserveLocalMSServicesCompleted( KErrNone );
+            }
+        }
+    else
+        {
+        iPendingOperation = EStartMediaServer;
+        iServer.ReserveMediaServer( (TInt)this, iStatus );
+        SetActive();            
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::CancelReserveLocalMSServicesL
+// Cancel reserve local media server
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::CancelReserveLocalMSServicesL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::CancelReserveLocalMSServicesL" );
+    
+    if( iPendingOperation == EStartMediaServer )
+        {
+        Cancel();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::ReleaseLocalMSServicesL
+// Release local media server
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::ReleaseLocalMSServicesL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::ReleaseLocalMSServicesL" );
+    
+    ResetL();
+    
+    if( iMediaServerResourceReserved )
+        {
+        iMediaServerResourceReserved = EFalse;
+        
+        User::LeaveIfError( iServer.ReleaseMediaServer( (TInt)this ) );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::BrowseL
+// Browse
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::BrowseL( const TDesC8& aId,
+                          const TDesC8& aFilter,
+                          TBrowseFlag aBrowseFlag,
+                          TInt aStartIndex,
+                          TInt aRequestedCount,
+                          const TDesC8& aSortCriteria )
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::BrowseL" );
+    
+    ResetL();
+    
+    CUpnpAVBrowseRequest* request = CUpnpAVBrowseRequest::NewLC();
+    request->SetIdL( aId );
+    request->SetFilterL( aFilter );
+    request->SetBrowseFlag( aBrowseFlag );
+    request->SetStartIndex( aStartIndex );
+    request->SetRequestedCount( aRequestedCount );
+    request->SetSortCriteriaL( aSortCriteria );
+    request->SetSearchCriteriaL( KNullDesC8 ); // Not needed in browse
+    
+    iBuffer = request->ToDes8L();
+    iBufferPtr.Set( iBuffer->Des() );
+    
+    CleanupStack::PopAndDestroy( request );
+    
+    iPendingOperation = EBrowseSize;
+    
+    iServer.BrowseResponseSize( (TInt)this, iBufferPtr,
+        iRespParamsPkg, iStatus );
+    SetActive();
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::CancelBrowse
+// Cancels browse
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::CancelBrowse()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::CancelBrowse" );
+    
+    if( iPendingOperation == EBrowseSize )
+        {
+        Cancel();
+        }     
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::SearchL
+// Search
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::SearchL(   const TDesC8& aId,
+                                            const TDesC8& aSearchCriteria,
+                                            const TDesC8& aFilter,
+                                            TInt aStartIndex,
+                                            TInt aRequestedCount,
+                                            const TDesC8& aSortCriteria )
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::SearchL" );
+    
+    ResetL();
+    
+    CUpnpAVBrowseRequest* request = CUpnpAVBrowseRequest::NewLC();
+    request->SetIdL( aId );
+    request->SetSearchCriteriaL( aSearchCriteria );
+    request->SetFilterL( aFilter );
+    //request->SetBrowseFlag( aBrowseFlag );
+    request->SetStartIndex( aStartIndex );
+    request->SetRequestedCount( aRequestedCount );
+    request->SetSortCriteriaL( aSortCriteria );
+    
+    
+    iBuffer = request->ToDes8L();
+    iBufferPtr.Set( iBuffer->Des() );
+    
+    CleanupStack::PopAndDestroy( request );
+    
+    iPendingOperation = ESearchSize;
+    
+    iServer.SearchResponseSize( (TInt)this, iBufferPtr,
+        iRespParamsPkg, iStatus );
+    SetActive();    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::CancelSearch
+// Cancel search
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::CancelSearch()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::CancelSearch" );
+    
+    if( iPendingOperation == ESearchSize )
+        {
+        Cancel();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::GetSearchCapabilitiesL
+// Get search capabilities
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::GetSearchCapabilitiesL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::GetSearchCapabilitiesL" );
+    
+    ResetL();
+    
+    iPendingOperation = EGetSearchCapabilities;
+    iServer.GetSearchCapabilitiesSize( (TInt)this,
+        iRespBufSizePkg, iStatus );
+    SetActive();
+    }                
+    
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::CreateContainerL
+// Create a container
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::CreateContainerL( 
+                                            const TDesC8& aTitle,
+                                            const TDesC8& aParentId,
+                                            TContainerType aContainerType )
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::CreateContainerL" );
+    
+    ResetL();
+
+    iBuffer = aTitle.AllocL();
+    iBufferPtr.Set( iBuffer->Des() );
+    
+    iBuffer2 = aParentId.AllocL();
+    iBufferPtr2.Set( iBuffer2->Des() );
+    
+    iServer.CreateContainer( (TInt)this, 
+                              iBufferPtr,
+                              iBufferPtr2,
+                              (TInt)aContainerType,
+                              iStatus );
+    iPendingOperation = ECreateContainer;
+    SetActive();
+    }
+ 
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::UPnPDeviceDiscovered
+// Device discovered
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::UPnPDeviceDiscovered(
+    const CUpnpAVDevice& /*aDevice*/ )
+    {
+    // No implementation needed
+    }
+
+  
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::UPnPDeviceDisappeared
+// Device disappeared
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::UPnPDeviceDisappeared(
+    const CUpnpAVDevice& /*aDevice*/ )
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::UPnPDeviceDisappeared" );
+    
+    iAlive = EFalse;
+    if( iObserver )
+        {
+        iObserver->MediaServerDisappeared( 
+            MUPnPAVSessionObserverBase::EDisconnected );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::WLANConnectionLost
+// Connection lost
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::WLANConnectionLost()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::WLANConnectionLost" );
+    
+    iAlive = EFalse;
+    if( iObserver )    
+        {
+        iObserver->MediaServerDisappeared( 
+            MUPnPAVSessionObserverBase::EWLANLost );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::DeleteObjectL
+// Delete object
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::DeleteObjectL( const TDesC8& aId )
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::DeleteObjectL" );
+    
+    ResetL();
+
+    iBuffer = aId.AllocL();
+    iBufferPtr.Set( iBuffer->Des() );    
+
+    iServer.DeleteObject( (TInt)this, iBufferPtr, iStatus );
+    iPendingOperation = EDeleteObject;
+    SetActive();   
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::BrowseSizeCompletedL
+// Handle browse
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::BrowseSizeCompletedL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::BrowseSizeCompletedL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerGetBrowseResponseSizeCompleted )
+            {
+            ResetL();
+            if( iRespParams.iResponseSize > 0 )
+                {
+                iBuffer = HBufC8::NewL( iRespParams.iResponseSize );
+                iBufferPtr.Set( iBuffer->Des() );
+                iBuffer2 = HBufC8::NewL( iRespParams.iUpdateIdSize );
+                iBufferPtr2.Set( iBuffer2->Des() );
+
+                TInt err = iServer.BrowseResponse( TInt(this), iBufferPtr,
+                    iBufferPtr2 );
+                if( err == EAVControllerGetBrowseResponseCompleted )
+                    {
+                    iObserver->BrowseResponse( *iBuffer, KErrNone,
+                        iRespParams.iMatches, iRespParams.iTotalCount,
+                        *iBuffer2 );
+                    
+                    }
+                else
+                    {
+                    iObserver->BrowseResponse( KNullDesC8, err, 0,
+                        0, KNullDesC8 );
+                    }
+
+                }
+            else
+                {
+                iObserver->BrowseResponse( KNullDesC8, KErrGeneral, 0,
+                    0, KNullDesC8 );
+                }    
+            }
+        else
+            {
+            iObserver->BrowseResponse( KNullDesC8, iStatus.Int(), 0,
+                0, KNullDesC8 );
+
+            }
+        }           
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::SearchSizeCompletedL
+// Handle search
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::SearchSizeCompletedL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::SearchSizeCompletedL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerGetSearchResponseSizeCompleted )
+            {
+            ResetL();
+            if( iRespParams.iResponseSize > 0 )
+                {
+                iBuffer = HBufC8::NewL( iRespParams.iResponseSize );
+                iBufferPtr.Set( iBuffer->Des() );
+                iBuffer2 = HBufC8::NewL( iRespParams.iUpdateIdSize );
+                iBufferPtr2.Set( iBuffer2->Des() );                
+                
+                TInt err = iServer.SearchResponse( TInt(this), iBufferPtr,
+                    iBufferPtr2 );
+                if( err == EAVControllerGetSearchResponseCompleted )
+                    {
+                    iObserver->SearchResponse( *iBuffer, KErrNone,
+                        iRespParams.iMatches, iRespParams.iTotalCount,
+                        *iBuffer2 ); 
+                    }
+                else
+                    {
+                    iObserver->SearchResponse( KNullDesC8, err, 0,
+                        0, KNullDesC8 ); 
+                    }                            
+                ResetL();
+                }
+            else
+                {
+                iObserver->SearchResponse( KNullDesC8, KErrGeneral, 0,
+                    0, KNullDesC8 ); 
+                }    
+            }
+        else
+            {
+            iObserver->SearchResponse( KNullDesC8, iStatus.Int(), 0,
+                0, KNullDesC8 ); 
+            }
+        }            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::SearchCapabilitiesCompletedL
+// Handle search capabilities
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::SearchCapabilitiesCompletedL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::SearchCapabilitiesCompletedL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() ==
+            EAVControllerGetSearchCapabilitiesSizeCompleted )
+            {
+            ResetL();
+            if( iRespBufSize > 0 )
+                {
+                iBuffer = HBufC8::NewL( iRespBufSize );
+                iBufferPtr.Set( iBuffer->Des() );
+                TInt err = iServer.SearchCapabilitiesResponse( TInt(this),
+                    iBufferPtr );
+                if( err == EAVControllerGetSearchCapabilitiesCompleted )
+                    {
+                    iObserver->SearchCapabilitiesResponse(
+                        KErrNone, *iBuffer );
+                    }
+                else
+                    {
+                    iObserver->SearchCapabilitiesResponse(
+                        iStatus.Int(), KNullDesC8 );        
+                    }                    
+                }
+            else
+                {
+                iObserver->SearchCapabilitiesResponse(
+                    KErrGeneral, KNullDesC8 );
+                }    
+            }
+        else
+            {
+ 
+            iObserver->SearchCapabilitiesResponse(
+                iStatus.Int(), KNullDesC8 );   
+            }
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::CreateContainerCompletedL
+// Handle CreateContainer
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::CreateContainerCompletedL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::CreateContainerCompletedL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerCreateContainerCompleted )
+            {
+            HBufC* objectId = HBufC::NewL( iBuffer->Des().Length() );
+            objectId->Des().Copy( *iBuffer );
+            CleanupStack::PushL( objectId );
+            
+            HBufC8* objectId8 = UpnpString::FromUnicodeL( *objectId );
+            
+            CleanupStack::PopAndDestroy( objectId );
+            objectId = NULL;
+            iObserver->CreateContainerResponse( KErrNone, *objectId8 );
+            delete objectId8;
+            
+            }
+        else
+            {
+            iObserver->CreateContainerResponse( iStatus.Int(), KNullDesC8 );
+            } 
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::DeleteObjectCompletedL
+// Handle delete object
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::DeleteObjectCompletedL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::DeleteObjectCompletedL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerDeleteObjectCompleted )
+            {
+            iObserver->DeleteObjectResponse( KErrNone );
+            }
+        else
+            {
+            iObserver->DeleteObjectResponse( iStatus.Int() );
+            } 
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::ResetL
+// Reset
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::ResetL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::ResetL" );
+    
+    if( IsActive() )
+        {
+        User::Leave( KErrServerBusy );
+        }
+    if( !iAlive )
+        {
+        User::Leave( KErrDisconnected );
+        }
+    delete iBuffer; 
+    iBuffer = NULL;
+    
+    delete iBuffer2; 
+    iBuffer2 = NULL;
+    
+    delete iBuffer3; 
+    iBuffer3 = NULL;
+
+    iPendingOperation = ENone;
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPAVBrowsingSessionImpl::StartMediaServerCompleteL
+// Handle start media server
+// --------------------------------------------------------------------------
+void CUPnPAVBrowsingSessionImpl::StartMediaServerCompleteL()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::StartMediaServerCompleteL" );
+    
+    if( iObserver )
+        {
+
+        if( iStatus.Int() == EAVControllerStartMediaServerCompleted )
+            {
+            iMediaServerResourceReserved = ETrue;
+            iObserver->ReserveLocalMSServicesCompleted( KErrNone );
+            }
+        else
+            {
+            iObserver->ReserveLocalMSServicesCompleted( iStatus.Int() );
+            }
+        
+        }
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavconnectionactive.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO that monitors WLAN connection in client side
+*
+*/
+
+
+
+
+
+
+#include "upnpavconnectionactive.h"
+
+#include "upnpavcontrollerclient.h"
+
+#include "upnpconnectionmonitorobserver.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPAVConnectionActive::NewL
+// Two-phase constructor
+// --------------------------------------------------------------------------
+CUPnPAVConnectionActive* CUPnPAVConnectionActive::NewL(
+    RUPnPAVControllerClient& aServer,
+    MUPnPConnectionMonitorObserver& aObserver )
+    {
+    CUPnPAVConnectionActive* self = new (ELeave) CUPnPAVConnectionActive(
+        aServer, aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVConnectionActive::CUPnPAVConnectionActive
+// Constructor
+// --------------------------------------------------------------------------
+CUPnPAVConnectionActive::CUPnPAVConnectionActive(
+    RUPnPAVControllerClient& aServer,
+    MUPnPConnectionMonitorObserver& aObserver ):
+    CActive( EPriorityStandard ),
+    iServer( aServer ),
+    iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVConnectionActive::~CUPnPAVConnectionActive
+// Destructor
+// --------------------------------------------------------------------------
+CUPnPAVConnectionActive::~CUPnPAVConnectionActive()
+    {
+    Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVConnectionActive::ConstructL
+// Two-phase constructor
+// --------------------------------------------------------------------------
+void CUPnPAVConnectionActive::ConstructL()
+    {
+        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVConnectionActive::RunL
+// From CActive
+// --------------------------------------------------------------------------
+void CUPnPAVConnectionActive::RunL()
+    {
+    // Connection is lost
+    if( iStatus.Int() == EAVControllerConnectionLost )
+        {
+        iObserver.ConnectionLost();
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVConnectionActive::DoCancel
+// From CActive
+// --------------------------------------------------------------------------
+void CUPnPAVConnectionActive::DoCancel()
+    {
+    iServer.CancelMonitorConnection(); // Ignore error
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVConnectionActive::RunError
+// From CActive
+// --------------------------------------------------------------------------
+TInt CUPnPAVConnectionActive::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVConnectionActive::StartMonitoring
+// Starts monitoring
+// --------------------------------------------------------------------------
+void CUPnPAVConnectionActive::StartMonitoring()
+    {
+    __ASSERTD( !IsActive(), __FILE__, __LINE__ );
+    iServer.MonitorConnection( iStatus );
+    SetActive();
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavcontrolleractive.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,651 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO that monitors for device events
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+// upnp stack api
+#include <upnpsettings.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdevice.h"
+#include "upnpavdeviceobserver.h"
+#include "upnpavdevicelist.h"
+
+// avcontroller internal
+#include "upnpavcontrolleractive.h"
+#include "upnpavrenderingsessionimpl.h"
+#include "upnpavbrowsingsessionimpl.h"
+#include "upnpavconnectionactive.h"
+#include "upnpfileuploadsessionimpl.h"
+#include "upnpfiledownloadsessionimpl.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::NewL
+// Two-phase construct
+// --------------------------------------------------------------------------
+CUPnPAVControllerActive* CUPnPAVControllerActive::NewL()
+    {
+    CUPnPAVControllerActive* self = CUPnPAVControllerActive::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::NewLC
+// Two-phase construct
+// --------------------------------------------------------------------------
+CUPnPAVControllerActive* CUPnPAVControllerActive::NewLC()
+    {
+    CUPnPAVControllerActive* self = new (ELeave) CUPnPAVControllerActive;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::CUPnPAVControllerActive
+// Two-phase construct
+// --------------------------------------------------------------------------
+CUPnPAVControllerActive::CUPnPAVControllerActive() :
+    CActive( EPriorityStandard ),
+    iRespBufSizePkg( iRespBufSize ),
+    iDiscoveredPkg( iDiscovered ),
+    iAlive( ETrue ),
+    iReleaseState( EStateReleasable )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::Release
+// Destructor
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::Release()
+    {
+    __LOG( "CUPnPAVControllerActive::Release" );
+    
+    if( iReleaseState == EStateReleasable )
+        {
+        __LOG( "Release - ok to delete" );
+        delete this;
+        }
+    else if( iReleaseState == EStateWLANLost )
+        {
+        __LOG( "Release - waiting for release" );
+        // Still sending WLAN lost messages, cannot delete
+        // To be released
+        iReleaseState = EStateWaitingForRelease;
+        }
+    else
+        {
+        __LOG( "Release - do nothing, double release" );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::~CUPnPAVControllerActive
+// Destructor
+// --------------------------------------------------------------------------
+CUPnPAVControllerActive::~CUPnPAVControllerActive()
+    {
+    __LOG( "CUPnPAVControllerActive::~CUPnPAVControllerActive" );
+    Cancel();
+    delete iConnectionActive;
+    iBrowsingSessions.ResetAndDestroy();
+    iRenderingSessions.ResetAndDestroy();
+    iDownloadSessions.ResetAndDestroy();
+    iUploadSessions.ResetAndDestroy();
+
+    iServer.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::ConstructL
+// Two-phase construct
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::ConstructL()
+    {
+    __LOG( "CUPnPAVControllerActive::ConstructL" );
+    
+    // Check the aip
+    TInt iap = 0;
+    CUpnpSettings* settings = CUpnpSettings::NewL( KCRUidUPnPStack );
+    settings->Get( CUpnpSettings::KUPnPStackIapId, iap );
+    delete settings;
+    User::LeaveIfError( iap );
+    User::LeaveIfError( iServer.Connect() );
+    
+    iConnectionActive = CUPnPAVConnectionActive::NewL( iServer, *this );
+    iConnectionActive->StartMonitoring();
+    
+    iServer.StartUp( iStatus ); // Start up the AV Control Point and wait
+    // until it has been started. 
+    SetActive();
+    iWait.Start();
+    __LOG1( "ConstructL - iStatus = %d", iStatus.Int() );
+    User::LeaveIfError( iStatus.Int() );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::RunL
+// From CActive
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::RunL()
+    {
+    __LOG( "CUPnPAVControllerActive::RunL" );
+    
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop(); // AV Control Point has been started, continue
+        // Construction
+        return;
+        }    
+    
+    switch( iStatus.Int() )
+        {
+        case EAVControllerDeviceCompleted:
+            {
+            HBufC8* tempBuf = HBufC8::NewLC( iRespBufSize );
+            TPtr8 ptr = tempBuf->Des();
+            if( iServer.GetDevice( ptr ) == KErrNone )
+                {
+                // Create a device and make a callback
+                CUpnpAVDevice* tempDev = CUpnpAVDevice::NewLC(); 
+                RDesReadStream stream( ptr );
+                CleanupClosePushL( stream );
+                stream >> *tempDev;
+                CleanupStack::PopAndDestroy( &stream );
+                
+                if( iDiscovered == EAVDeviceDiscovered )
+                    {
+                    // Discovered a device
+                    iDeviceObserver->UPnPDeviceDiscovered( *tempDev );
+                    }
+                else
+                    {
+                    // Device disappeared
+                    iDeviceObserver->UPnPDeviceDisappeared( *tempDev );
+                    }       
+                CleanupStack::PopAndDestroy( tempDev );
+                
+                // Activate again if needed (it's possible to remove and set
+                // the device obs from the UPnPDeviceDiscovered or
+                // UPnPDeviceDisappeared callbacks  
+                if( !IsActive() )
+                    {
+                    iServer.DeviceRequest( iDiscoveredPkg, iRespBufSizePkg,
+                        iStatus ); 
+                    SetActive();                      
+                    }
+                }
+            else
+                {
+                // Can't handle the error anyhow, just log it
+                __LOG1( "RunL - error: %d", iStatus.Int() );
+                }
+            CleanupStack::PopAndDestroy( tempBuf );
+            }
+            break;
+            
+        default:
+            {
+            __PANICD( __FILE__, __LINE__ );
+            }    
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::DoCancel
+// From CActive
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::DoCancel()
+    {
+    __LOG( "CUPnPAVControllerActive::DoCancel" );
+    if( !iDeviceObserver )
+        {
+        __LOG( "iServer.CancelStartUp()" );
+        // Not a real cancel, but if this is the last session, we'll shut
+        // down the server immidiately
+        iServer.CancelStartUp();
+        }
+    else
+        {
+        iServer.CancelDeviceRequest();
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::RunError
+// From CActive
+// --------------------------------------------------------------------------
+TInt CUPnPAVControllerActive::RunError(
+    TInt aError
+    )
+    {
+    // Can't handle the error anyhow, just log it
+    __LOG1( "CUPnPAVControllerActive::RunError: %d", aError );
+    
+    return KErrNone;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::SetDeviceObserver
+// Sets device observer
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::SetDeviceObserver( 
+    MUPnPAVDeviceObserver& aObserver )
+    {
+    __LOG( "CUPnPAVControllerActive::SetDeviceObserver" );
+    
+    // Set the observer and make an async request to the server to receive
+    // device callbacks
+    __ASSERTD( !iDeviceObserver, __FILE__, __LINE__ );
+    
+    if( iAlive )
+        {
+        iDeviceObserver = &aObserver;
+        
+        iServer.DeviceRequest( iDiscoveredPkg, iRespBufSizePkg, iStatus ); 
+        SetActive();  
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::DeviceObserver
+// Returns device observer
+// --------------------------------------------------------------------------
+MUPnPAVDeviceObserver* CUPnPAVControllerActive::DeviceObserver()
+    {
+    __LOG( "CUPnPAVControllerActive::DeviceObserver" );
+    
+    return iDeviceObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::RemoveDeviceObserver
+// Removes device observer
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::RemoveDeviceObserver()
+    {
+    __LOG( "CUPnPAVControllerActive::RemoveDeviceObserver" );
+    
+    Cancel();
+    
+    iDeviceObserver = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::GetMediaServersL
+// Returns a list of media servers
+// --------------------------------------------------------------------------
+CUpnpAVDeviceList* CUPnPAVControllerActive::GetMediaServersL()
+    {
+    __LOG( "CUPnPAVControllerActive::GetMediaServersL" );
+    
+    if( !iAlive )
+        {
+        User::Leave( KErrDisconnected );
+        }
+    
+    CUpnpAVDeviceList* tempList = NULL;
+    
+    TPckg<TAVControllerDeviceListType> type( EAVMediaServer );
+    
+    TInt respBufSize = 0;           
+    TPckg<TInt> respBufSizePkg( respBufSize );        
+    TInt err = iServer.GetDeviceListSize( type, respBufSizePkg );
+    
+    if( err == KErrNone )
+        {
+        
+        HBufC8* tempBuf = HBufC8::NewLC( respBufSize );
+        TPtr8 ptr = tempBuf->Des();
+
+        err = iServer.GetDeviceList( ptr );
+        if( err == KErrNone )
+            {
+            // Create a device and make a callback
+            tempList = CUpnpAVDeviceList::NewL(); 
+            RDesReadStream stream( ptr );
+            stream >> *tempList;
+            stream.Close();
+            }
+        else
+            {
+            User::Leave( err );
+            }
+        CleanupStack::PopAndDestroy( tempBuf );        
+        }
+    else
+        {
+        User::Leave( err );
+        }
+    return tempList;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::GetMediaRenderersL
+// Returns a list of media renderes
+// --------------------------------------------------------------------------
+CUpnpAVDeviceList* CUPnPAVControllerActive::GetMediaRenderersL()
+    {
+    __LOG( "CUPnPAVControllerActive::GetMediaRenderersL" );
+    
+    if( !iAlive )
+        {
+        User::Leave( KErrDisconnected );
+        }    
+    
+    CUpnpAVDeviceList* tempList = NULL;
+    
+    TPckg<TAVControllerDeviceListType> type( EAVMediaRenderer );
+    
+    TInt respBufSize = 0;           
+    TPckg<TInt> respBufSizePkg( respBufSize );
+    TInt err = iServer.GetDeviceListSize( type, respBufSizePkg );
+    
+    if( err == KErrNone )
+        {
+        
+        HBufC8* tempBuf = HBufC8::NewLC( respBufSize );
+        TPtr8 ptr = tempBuf->Des();
+
+        err = iServer.GetDeviceList( ptr );
+        if( err == KErrNone )
+            {
+            // Create a device and make a callback
+            tempList = CUpnpAVDeviceList::NewL(); 
+            RDesReadStream stream( ptr );
+            stream >> *tempList;
+            stream.Close();
+            }
+        else
+            {
+            User::Leave( err );
+            }
+        CleanupStack::PopAndDestroy( tempBuf );        
+        }
+    else
+        {
+        User::Leave( err );
+        }
+    return tempList;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::StartBrowsingSessionL
+// Starts a browsing session
+// --------------------------------------------------------------------------
+MUPnPAVBrowsingSession& CUPnPAVControllerActive::StartBrowsingSessionL(
+    const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPAVControllerActive::StartBrowsingSessionL" );
+   
+    if( !iAlive )
+        {
+        User::Leave( KErrDisconnected );
+        }
+    
+    if( aDevice.DeviceType() != CUpnpAVDevice::EMediaServer )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    CUPnPAVBrowsingSessionImpl* sessionImpl =
+        CUPnPAVBrowsingSessionImpl::NewL( iServer, aDevice );
+    iBrowsingSessions.Append( sessionImpl );
+    return *sessionImpl;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::StopBrowsingSession
+// Stops a browsing session
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::StopBrowsingSession(
+    MUPnPAVBrowsingSession& aSession )
+    {
+    __LOG( "CUPnPAVControllerActive::StopBrowsingSession" );
+    
+    CUPnPAVBrowsingSessionImpl* sessionImpl = 
+        static_cast<CUPnPAVBrowsingSessionImpl*>(&aSession);
+    TInt count = iBrowsingSessions.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ] == sessionImpl )
+            {
+            delete iBrowsingSessions[ i ];
+            iBrowsingSessions[ i ] = NULL;
+            i = count;
+            }
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::StartRenderingSessionL
+// Starts a rendering session
+// --------------------------------------------------------------------------
+MUPnPAVRenderingSession& CUPnPAVControllerActive::StartRenderingSessionL(
+    const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPAVControllerActive::StartRenderingSessionL" );
+    
+    if( !iAlive )
+        {
+        User::Leave( KErrDisconnected );
+        }
+    
+    if( aDevice.DeviceType() != CUpnpAVDevice::EMediaRenderer )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    CUPnPAVRenderingSessionImpl* sessionImpl =
+        CUPnPAVRenderingSessionImpl::NewL( iServer, aDevice );
+    iRenderingSessions.Append( sessionImpl );
+    return *sessionImpl;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::StopRenderingSession
+// Stops a rendering session
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::StopRenderingSession(
+    MUPnPAVRenderingSession& aSession )
+    {
+    __LOG( "CUPnPAVControllerActive::StopRenderingSession" );
+    
+    CUPnPAVRenderingSessionImpl* sessionImpl =
+        static_cast<CUPnPAVRenderingSessionImpl*>(&aSession);
+    TInt count = iRenderingSessions.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iRenderingSessions[ i ] == sessionImpl )
+            {
+            delete iRenderingSessions[ i ];
+            iRenderingSessions[ i ] = NULL; 
+            i = count;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::StartUploadSessionL
+// Starts an upload session
+// --------------------------------------------------------------------------
+MUPnPFileUploadSession& CUPnPAVControllerActive::StartUploadSessionL(
+    const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPAVControllerActive::StartUploadSessionL" );
+   
+    if( !iAlive )
+        {
+        User::Leave( KErrDisconnected );
+        }
+    
+    if( aDevice.DeviceType() != CUpnpAVDevice::EMediaServer )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    CUPnPFileUploadSessionImpl* sessionImpl =
+        CUPnPFileUploadSessionImpl::NewL( iServer, aDevice );
+    iUploadSessions.Append( sessionImpl );
+    return *sessionImpl;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::StopUploadSession
+// Stops an upload session
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::StopUploadSession(
+    MUPnPFileUploadSession& aSession )
+    {
+    __LOG( "CUPnPAVControllerActive::StopUploadSession" );
+  
+    CUPnPFileUploadSessionImpl* sessionImpl =
+        static_cast<CUPnPFileUploadSessionImpl*>(&aSession);
+    TInt count = iUploadSessions.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ] == sessionImpl )
+            {
+            delete iUploadSessions[ i ];
+            iUploadSessions[ i ] = NULL; 
+            i = count;
+            }
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::StartDownloadSessionL
+// Starts a download session
+// --------------------------------------------------------------------------
+MUPnPFileDownloadSession& CUPnPAVControllerActive::StartDownloadSessionL(
+    const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPAVControllerActive::StartDownloadSessionL" );
+
+    if( !iAlive )
+        {
+        User::Leave( KErrDisconnected );
+        }
+    
+    if( aDevice.DeviceType() != CUpnpAVDevice::EMediaServer )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    CUPnPFileDownloadSessionImpl* sessionImpl =
+        CUPnPFileDownloadSessionImpl::NewL( iServer, aDevice );
+    iDownloadSessions.Append( sessionImpl );
+    return *sessionImpl;
+    }   
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::StopDownloadSession
+// Stops a download session
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::StopDownloadSession(
+    MUPnPFileDownloadSession& aSession )
+    {
+    __LOG( "CUPnPAVControllerActive::StopDownloadSession" );
+
+    CUPnPFileDownloadSessionImpl* sessionImpl =
+        static_cast<CUPnPFileDownloadSessionImpl*>(&aSession);
+    TInt count = iDownloadSessions.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ] == sessionImpl )
+            {
+            delete iDownloadSessions[ i ];
+            //iRenderingSessions.Remove( i );
+            iDownloadSessions[ i ] = NULL; 
+            i = count;
+            }
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerActive::ConnectionLost
+// Wlan disconnected
+// --------------------------------------------------------------------------
+void CUPnPAVControllerActive::ConnectionLost()
+    {
+    __LOG( "CUPnPAVControllerActive::ConnectionLost" );
+    
+    iAlive = EFalse;
+    
+    iReleaseState = EStateWLANLost;
+    
+    TInt count = iRenderingSessions.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iRenderingSessions.Count() && iRenderingSessions[ i ] )
+            {
+            iRenderingSessions[ i ]->WLANConnectionLost();    
+            }   
+        }       
+
+    count = iBrowsingSessions.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions.Count() && iBrowsingSessions[ i ] )
+            {
+            iBrowsingSessions[ i ]->WLANConnectionLost();    
+            }
+        }
+
+    count = iUploadSessions.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions.Count() && iUploadSessions[ i ] )
+            {
+            iUploadSessions[ i ]->WLANConnectionLost();    
+            }   
+        }       
+
+    count = iDownloadSessions.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions.Count() && iDownloadSessions[ i ] )
+            {
+            iDownloadSessions[ i ]->WLANConnectionLost();    
+            }   
+        }       
+
+    if( iDeviceObserver )
+        {
+        iDeviceObserver->WLANConnectionLost();
+        }
+        
+    if( iReleaseState == EStateWaitingForRelease )
+        {
+        __LOG( "ConnectionLost - release" );
+        delete this;
+        }
+        
+    iReleaseState = EStateReleasable;       
+    }
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavcontrollerclient.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,897 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AV Controller client
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// Sysatem
+#include <e32math.h>
+#include <s32mem.h>
+#include <f32file.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontrollerglobals.h"
+
+// avcontroller internal
+#include "upnpavcontrollerclient.h"
+
+// Number of message slots to reserve for this client server session.
+const TInt KDefaultMessageSlots = -1;
+
+
+// Function prototypes
+static TInt StartServer( void );
+static TInt CreateServerProcess( void ); 
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::RUPnPAVControllerClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+RUPnPAVControllerClient::RUPnPAVControllerClient()
+    :RSessionBase() 
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::Connect
+// Connect to Media Server session. 
+// exist
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::Connect()
+    {
+    TInt error = ::StartServer();
+
+    if ( KErrNone == error )
+        {
+        error = CreateSession( KAVControllerName,
+                               Version(),
+                               KDefaultMessageSlots );
+        }
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::Version
+// Version information.
+// --------------------------------------------------------------------------
+TVersion RUPnPAVControllerClient::Version() const
+    {
+    return TVersion( KAVControllerMajorVersionNumber,
+                     KAVControllerMinorVersionNumber,
+                     KAVControllerBuildVersionNumber );
+    }
+
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::StartUp
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::StartUp( TRequestStatus& aStatus )
+    {
+    TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( EAVControllerStartupRequest, args, aStatus );    
+    }
+
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelStartUp
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelStartUp()
+    {
+    TIpcArgs args( TIpcArgs::ENothing );
+    return SendReceive( EAVControllerCancelStartupRequest, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::DeviceRequest
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::DeviceRequest( TDes8& aDiscovered,
+    TDes8& aRcvdBufSize, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( &aDiscovered, &aRcvdBufSize );
+    SendReceive( EAVControllerDeviceRequest, args, aStatus );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelDeviceRequest
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelDeviceRequest()
+    {
+    TIpcArgs args( TIpcArgs::ENothing );
+    return SendReceive( EAVControllerCancelDeviceRequest, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::GetDevice
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::GetDevice( TDes8& aDevice )
+    {
+    TIpcArgs args( &aDevice );
+    return SendReceive( EAVControllerGetDeviceRequest, args );
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::GetDeviceListSize
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::GetDeviceListSize( TDes8& aType, TDes8& aSize )
+    {
+    TIpcArgs args( &aType, &aSize );
+    return SendReceive( EAVControllerGetDeviceListSizeRequest, args );
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::GetDeviceList
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::GetDeviceList( TDes8& aList )
+    {
+    TIpcArgs args( &aList );
+    return SendReceive( EAVControllerGetDeviceListRequest, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::ReleaseMediaServer
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::ReleaseMediaServer( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerStopMediaServer, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::ReserveMediaServer
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::ReserveMediaServer( TInt aId,
+    TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId );
+    SendReceive( EAVControllerStartMediaServer, args, aStatus );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelReserveMediaServer
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelReserveMediaServer( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelStartMediaServer, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CreateRenderingSession
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CreateRenderingSession( TInt aId,
+    TDes8& aUuid )
+    {
+    TIpcArgs args( aId, &aUuid );
+    return SendReceive( EAVControllerCreateRenderingSession, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::DestroyRenderingSession
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::DestroyRenderingSession( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerDestroyRenderingSession, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::EventRequest
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::EventRequest( TDes8& aEvent, TInt aId,
+    TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aEvent );
+    SendReceive( EAVControllerEventRequest, args, aStatus );   
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelEventRequest
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelEventRequest( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelEventRequest, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::SetURI
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::SetURI( TInt aId, TDes8& aRequest,
+    TDes8& aItem, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aRequest, &aItem );
+    
+    SendReceive( EAVControllerSetURI, args, aStatus );   
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelSetURI
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelSetURI( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelSetURI, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::SetNextURI
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::SetNextURI( TInt aId, TDes8& aRequest,
+    TDes8& aItem, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aRequest, &aItem );
+    
+    SendReceive( EAVControllerSetNextURI, args, aStatus );       
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelSetNextURI
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelSetNextURI( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelSetNextURI, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::Play
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::Play( TInt aId, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId );
+    
+    SendReceive( EAVControllerPlay, args, aStatus );       
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelPlay
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelPlay( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelPlay, args );
+    }
+      
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::Stop
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::Stop( TInt aId, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId );
+    SendReceive( EAVControllerStop, args, aStatus ); 
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelStop
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelStop( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelStop, args ); 
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::Pause
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::Pause( TInt aId, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId );
+    SendReceive( EAVControllerPause, args, aStatus ); 
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelPause
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelPause( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelPause, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::SetVolume
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::SetVolume( TInt aId, TInt aVolumeLevel,
+    TDes8& aRetVolume, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, aVolumeLevel, &aRetVolume );
+    SendReceive( EAVControllerSetVolume, args, aStatus );      
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelSetVolume
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelSetVolume( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelSetVolume, args );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::GetVolume
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::GetVolume( TInt aId, TDes8& aVolumeLevel,
+    TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aVolumeLevel );
+    SendReceive( EAVControllerGetVolume, args, aStatus );     
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelGetVolume
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelGetVolume( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelGetVolume, args );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::SetMute
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::SetMute( TInt aId, TBool aMute,
+    TDes8& aRetMute, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, (TInt)aMute, &aRetMute );
+    SendReceive( EAVControllerSetMute, args, aStatus );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::GetMute
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::GetMute( TInt aId, TDes8& aMute,
+    TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aMute );
+    SendReceive( EAVControllerGetMute, args, aStatus );     
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelSetMute
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelSetMute( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelSetMute, args );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelGetMute
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelGetMute( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelGetMute, args );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::GetPositionInfo
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::GetPositionInfo( TInt aId, TDes8& aPosition,
+    TDes8& aLength, TRequestStatus& aStatus )    
+    {
+    TIpcArgs args( aId, &aPosition, &aLength );
+    SendReceive( EAVControllerGetPositionInfo, args, aStatus );     
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelGetPositionInfo
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelGetPositionInfo( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelGetPositionInfo, args ); 
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CreateBrowsingSession
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CreateBrowsingSession( TInt aId, TDes8& aUuid )
+    {
+    TIpcArgs args( aId, &aUuid );
+    return SendReceive( EAVControllerCreateBrowsingSession, args ); 
+    }
+
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::DestroyBrowsingSession
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::DestroyBrowsingSession( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerDestroyBrowsingSession, args );     
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::BrowseResponseSize
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::BrowseResponseSize( TInt aId, TDes8& aRequest,
+    TDes8& aParams, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aRequest, &aParams );
+    SendReceive( EAVControllerGetBrowseResponseSize, args, aStatus );         
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelBrowseResponseSize
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelBrowseResponseSize( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelGetBrowseResponseSize, args );     
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::BrowseResponse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::BrowseResponse( TInt aId,
+    TDes8& aBrowseResponse, TDes8& aUpdateId)
+    {
+    TIpcArgs args( aId, &aBrowseResponse, &aUpdateId );
+    return SendReceive( EAVControllerGetBrowseResponse, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::SearchResponseSize
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::SearchResponseSize( TInt aId, TDes8& aRequest,
+    TDes8& aParams, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aRequest, &aParams );
+    SendReceive( EAVControllerGetSearchResponseSize, args, aStatus );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelSearchResponseSize
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelSearchResponseSize( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelGetSearchResponseSize, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::SearchResponse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::SearchResponse( TInt aId,
+    TDes8& aSearchResponse, TDes8& aUpdateId )
+    {
+    TIpcArgs args( aId, &aSearchResponse,& aUpdateId );
+    return SendReceive( EAVControllerGetSearchResponse, args );             
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::GetSearchCapabilitiesSize
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::GetSearchCapabilitiesSize( TInt aId,
+    TDes8& aSize, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aSize );
+    SendReceive( EAVControllerGetSearchCapabilitiesSize, args, aStatus );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelGetSearchCapabilitiesSize
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelGetSearchCapabilitiesSize( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelGetSearchCapabilitiesSize,
+        args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::SearchCapabilitiesResponse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::SearchCapabilitiesResponse( TInt aId,
+    TDes8& aCapabilitiesResponse )
+    {
+    TIpcArgs args( aId, &aCapabilitiesResponse );
+    return SendReceive( EAVControllerGetSearchCapabilities, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CreateContainer
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::CreateContainer( TInt aId, TDes8& aTitle,
+    TDes8& aParentId, TInt aContainerType, TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aTitle, &aParentId, aContainerType );
+    SendReceive( EAVControllerCreateContainer, args, aStatus );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelCreateContainer
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelCreateContainer( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelCreateContainer, args );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::DeleteObject
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::DeleteObject( TInt aId, TDes8& aObjectId,
+    TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aObjectId );
+    SendReceive( EAVControllerDeleteObject, args, aStatus );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelDeleteObject
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelDeleteObject( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelDeleteObject, args );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::DeviceDisappearedRequest
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::DeviceDisappearedRequest( TInt aId,
+    TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId );
+    SendReceive( EAVControllerDeviceDisappearedRequest, args, aStatus );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelDeviceDisappearedRequest
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelDeviceDisappearedRequest( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelDeviceDisappearedRequest, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MonitorConnection
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::MonitorConnection( TRequestStatus& aStatus )
+    {
+    TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( EAVControllerMonitorConnection, args, aStatus );        
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CancelMonitorConnection
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelMonitorConnection()
+    {
+    TIpcArgs args( TIpcArgs::ENothing );
+    return SendReceive( EAVControllerCancelMonitorConnection, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::MSServicesInUse( TDes8& aInUse )
+    {
+    TIpcArgs args( &aInUse );
+    return SendReceive( EAVControllerMSServicesInUse, args ); 
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CreateDownloadSession
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CreateDownloadSession( TInt aId, TDes8& aUuid )
+    {
+    TIpcArgs args( aId, &aUuid );
+    return SendReceive( EAVControllerCreateDownloadSession, args );        
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::DestroyDownloadSession
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::DestroyDownloadSession( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerDestroyDownloadSession, args );    
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::CreateUploadSession
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CreateUploadSession( TInt aId, TDes8& aUuid )
+    {
+    TIpcArgs args( aId, &aUuid );
+    return SendReceive( EAVControllerCreateUploadSession, args );            
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::DestroyUploadSession( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerDestroyUploadSession, args );        
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::StartDownload( TInt aId,
+    TDes8& aFileTransferItem )
+    {
+    TIpcArgs args( aId, &aFileTransferItem );
+    return SendReceive( EAVControllerStartDownload, args );    
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::StartDownload( TInt aId,
+    TDes8& aFileTransferItem, const RFile& aFile )
+    {
+    TIpcArgs args( aId, &aFileTransferItem );
+    aFile.TransferToServer( args, 2, 3 );
+    return SendReceive( EAVControllerStartDownloadFH, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::GetDownloadEvent( TInt aId, TDes8& aEvent,
+    TRequestStatus& aStatus, TDes& aBuffer )
+    {
+    TIpcArgs args( aId, &aEvent, &aBuffer );
+    SendReceive( EAVControllerGetDownloadEvent, args, aStatus );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelDownloadEvent( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelDownloadEvent, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::StartTrackingDownloadProgress( TInt aId,
+    TInt aKey )
+    {
+    TIpcArgs args( aId, aKey );
+    return SendReceive( EAVControllerStartTrackingDownloadProgress, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelDownload( TInt aId, TInt aKey )
+    {
+    TIpcArgs args( aId, aKey );
+    return SendReceive( EAVControllerCancelDownload, args );    
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelAllDownloads( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelAllDownloads, args );
+    }
+
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::StartUpload( TInt aId, TDes8& aFileTransferItem )
+    {
+    TIpcArgs args( aId, &aFileTransferItem );
+    return SendReceive( EAVControllerStartUpload, args );    
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+void RUPnPAVControllerClient::GetUploadEvent( TInt aId, TDes8& aEvent,
+        TRequestStatus& aStatus )
+    {
+    TIpcArgs args( aId, &aEvent );
+    SendReceive( EAVControllerGetUploadEvent, args, aStatus );    
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelUploadEvent( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelUploadEvent, args );    
+    }
+        
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::StartTrackingUploadProgress( TInt aId, TInt aKey )
+    {
+    TIpcArgs args( aId, aKey );
+    return SendReceive( EAVControllerStartTrackingUploadProgress, args );    
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelUpload( TInt aId, TInt aKey )
+    {
+    TIpcArgs args( aId, aKey );
+    return SendReceive( EAVControllerCancelUpload, args );        
+    }
+    
+// --------------------------------------------------------------------------
+// RUPnPAVControllerClient::MSServicesInUse
+// See upnpavcontrollerclient.h
+// --------------------------------------------------------------------------
+TInt RUPnPAVControllerClient::CancelAllUploads( TInt aId )
+    {
+    TIpcArgs args( aId );
+    return SendReceive( EAVControllerCancelAllUploads, args );    
+    }
+
+// --------------------------------------------------------------------------
+// StartServer
+// Static method to start the server.
+// --------------------------------------------------------------------------
+static TInt StartServer()
+    {
+    TInt result;
+
+    TFindServer findAVControllerServer( KAVControllerName );
+    TFullName name;
+
+    result = findAVControllerServer.Next( name );
+    if ( result != KErrNone )
+        {
+        // server not found - try to create it.
+        result = CreateServerProcess();
+        }
+
+    return  result;
+    }
+
+// --------------------------------------------------------------------------
+// CreateServerProcess
+// Static method to create the server process.
+// --------------------------------------------------------------------------
+static TInt CreateServerProcess()
+    {
+    TInt result;
+
+    const TUidType serverUid( KNullUid, KNullUid, KAVCServerUid3 );
+    RProcess server;
+
+    result = server.Create( KAVControllerFilename, KNullDesC, serverUid );
+    if ( result != KErrNone )
+        {
+        return  result;
+        }
+
+    TRequestStatus stat = KRequestPending;
+    server.Rendezvous(stat);
+    if ( stat != KRequestPending )
+        {
+        server.Kill( 0 );       // abort startup
+        }
+    else
+        {
+        server.Resume();    // logon OK - start the server
+        }
+        
+    User::WaitForRequest(stat);     // wait for start or death
+
+    // we can't use the 'exit reason' if the server panicked as this
+    // is the panic 'reason' and may be '0' which cannot be distinguished
+    // from KErrNone
+    if ( server.ExitType() == EExitPanic )
+        {
+        result = KErrGeneral;
+        }
+    else
+        {
+        result = stat.Int();
+        }
+    
+    server.Close();   
+    return result;
+    }
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavcontrollerfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      The factory for AVController client
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+// upnpframework / avcontroller api
+#include "upnpavcontrollerfactory.h"
+#include "upnpavcontrollerglobals.h"
+
+// avcontroller internal
+#include "upnpavcontrolleractive.h"
+#include "upnpavcontrollerclient.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// UPnPAVControllerFactory::NewUPnPAVControllerL
+// Two-phase construct
+// --------------------------------------------------------------------------
+EXPORT_C MUPnPAVController* UPnPAVControllerFactory::NewUPnPAVControllerL()
+    {
+    return CUPnPAVControllerActive::NewL();
+    }
+    
+// --------------------------------------------------------------------------
+// UPnPAVControllerFactory::NewUPnPAVControllerLC
+// Two-phase construct
+// --------------------------------------------------------------------------
+EXPORT_C MUPnPAVController* UPnPAVControllerFactory::NewUPnPAVControllerLC()
+    {
+    return CUPnPAVControllerActive::NewLC();
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAVControllerFactory::MSServicesInUse
+// See upnpavcontrollerfactory.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool UPnPAVControllerFactory::MSServicesInUse()
+    {
+    TBool retVal = EFalse;
+    TFindServer findAVControllerServer( KAVControllerName );
+    TFullName name;
+
+    if ( findAVControllerServer.Next( name ) == KErrNone )
+        {
+        // Server already running, connect and check if it's using the local
+        // media server
+        RUPnPAVControllerClient avClient;
+        TInt err = avClient.Connect();
+        TBool inUse = EFalse;
+        TPckg<TBool> inUsePckg( inUse );
+        
+        if( err )
+            {
+            // Error in client/servers comms, let the client think that the
+            // local media server is in use
+            retVal = ETrue;            
+            }
+        else
+            {
+            err = avClient.MSServicesInUse( inUsePckg );
+            if( err )
+                {
+                // Error in client/servers comms, let the client think that the
+                // local media server is in use
+                retVal = ETrue;
+                }
+            else if( inUse )
+                {
+                // Local media server is in use
+                retVal = ETrue;
+                }                
+            }    
+        avClient.Close();
+        }
+    else
+        {
+        // Server not running, local media server is not used
+        }
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAVControllerFactory::Status
+// See upnpavcontrollerfactory.h
+// --------------------------------------------------------------------------
+EXPORT_C TInt UPnPAVControllerFactory::Status(
+    TAVControllerServerStatus& aStatus )
+    {
+    TFindServer findAVControllerServer( KAVControllerName );
+    TFullName name;
+
+    if ( findAVControllerServer.Next( name ) == KErrNone )
+        {
+        // Server running
+        aStatus = EStatusActive;
+        }
+    else
+        {
+        // Server not running
+        aStatus = EStatusOffline;
+        }
+    return KErrNone;    
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavdevice.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,543 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      The device object
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include "upnpavdevice.h"
+
+// CONSTANTS
+const TInt KMaxStringLen = 255;
+const TInt KBufferGranularity = 100;
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT8( KAudioSupport,        "audio/" );
+_LIT8( KImageSupport,        "image/" );
+_LIT8( KVideoSupport,        "video/" );
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::CUpnpAVDevice
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+EXPORT_C CUpnpAVDevice::CUpnpAVDevice()
+    {    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+void CUpnpAVDevice::ConstructL()
+    {                           
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+EXPORT_C CUpnpAVDevice* CUpnpAVDevice::NewL()
+    {
+    CUpnpAVDevice* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+EXPORT_C CUpnpAVDevice* CUpnpAVDevice::NewL( const CUpnpAVDevice& aDevice )
+    {
+    CUpnpAVDevice* self = NewLC();
+    
+    self->CopyFromL( aDevice );
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+EXPORT_C CUpnpAVDevice* CUpnpAVDevice::NewLC()
+    {
+    CUpnpAVDevice* self = new( ELeave )
+        CUpnpAVDevice;    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::~CUpnpAVDevice
+// Destructor
+// --------------------------------------------------------------------------
+EXPORT_C CUpnpAVDevice::~CUpnpAVDevice()
+    {
+    delete iName;
+    delete iUuid;            
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::ExternalizeL
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::ExternalizeL( RWriteStream& aStream ) const
+    {
+    __ASSERTD( iUuid, __FILE__, __LINE__ );
+    __ASSERTD( iName, __FILE__, __LINE__ );
+    
+    aStream << *iUuid;
+    aStream << *iName;
+    aStream.WriteInt32L( (TInt)iDeviceType );
+    aStream.WriteInt32L( (TInt)iCopyCapability );
+    aStream.WriteInt32L( (TInt)iSearchCapability );
+    aStream.WriteInt32L( (TInt)iPauseCapability );
+    aStream.WriteInt32L( (TInt)iVolumeCapability );
+    aStream.WriteInt32L( (TInt)iMuteCapability );
+    aStream.WriteInt32L( (TInt)iAudioMediaCapability );
+    aStream.WriteInt32L( (TInt)iImageMediaCapability );
+    aStream.WriteInt32L( (TInt)iVideoMediaCapability );
+    aStream.WriteInt32L( (TInt)iNextAVTransportUri );
+    aStream.WriteInt32L( (TInt)iMaxVolume );
+    aStream.WriteInt32L( (TInt)iDlnaCompatible );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::InternalizeL
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::InternalizeL( RReadStream& aStream )
+    {
+    delete iUuid;
+    iUuid = NULL;
+    iUuid = HBufC8::NewL( aStream, KMaxStringLen );
+
+    delete iName;
+    iName = NULL;
+    iName = HBufC8::NewL( aStream, KMaxStringLen );
+    
+    iDeviceType = (TUpnpAVDeviceType)aStream.ReadInt32L();
+    iCopyCapability = (TBool)aStream.ReadInt32L();
+    iSearchCapability = (TBool)aStream.ReadInt32L();
+    iPauseCapability = (TBool)aStream.ReadInt32L();
+    iVolumeCapability = (TBool)aStream.ReadInt32L();
+    iMuteCapability = (TBool)aStream.ReadInt32L();
+    iAudioMediaCapability = (TBool)aStream.ReadInt32L();
+    iImageMediaCapability = (TBool)aStream.ReadInt32L();
+    iVideoMediaCapability = (TBool)aStream.ReadInt32L();
+    iNextAVTransportUri = (TBool)aStream.ReadInt32L();
+    iMaxVolume = (TInt)aStream.ReadInt32L();
+    iDlnaCompatible = (TBool)aStream.ReadInt32L();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::ToDes8L
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C HBufC8* CUpnpAVDevice::ToDes8L() const
+    {
+    // serialize object
+    CBufFlat* tempFlatBuf = CBufFlat::NewL( KBufferGranularity );
+    CleanupStack::PushL( tempFlatBuf );
+
+    RBufWriteStream stream( *tempFlatBuf );
+    CleanupClosePushL( stream );
+    
+    stream << *this;
+    
+    // create heap descriptor
+    HBufC8* tempBuf = HBufC8::NewLC( tempFlatBuf->Size() );
+    TPtr8 ptr( tempBuf->Des() );
+    tempFlatBuf->Read( 0, ptr, tempFlatBuf->Size() );
+    
+    // clean up
+    CleanupStack::Pop( tempBuf );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( tempFlatBuf );
+    
+    return tempBuf;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::CopyFromL
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::CopyFromL( const CUpnpAVDevice& aDevice )
+    {
+    iDeviceType = aDevice.DeviceType();
+    SetFriendlyNameL( aDevice.FriendlyName() );
+    SetUuidL( aDevice.Uuid() );
+    iCopyCapability = aDevice.CopyCapability();
+    iSearchCapability = aDevice.SearchCapability();
+    iPauseCapability = aDevice.PauseCapability();
+    iVolumeCapability = aDevice.VolumeCapability();
+    iMuteCapability = aDevice.MuteCapability();
+    iAudioMediaCapability = aDevice.AudioCapability();
+    iImageMediaCapability = aDevice.ImageCapability();
+    iVideoMediaCapability = aDevice.VideoCapability();
+    iNextAVTransportUri = aDevice.NextAVTransportUri();
+    iMaxVolume = aDevice.MaxVolume();
+    iDlnaCompatible = aDevice.DlnaCompatible();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetFriendlyNameL
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetFriendlyNameL( const TDesC8& aName )
+    {
+    HBufC8* tempBuf = aName.AllocL();
+    delete iName;
+    iName = tempBuf;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::FriendlyName
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C const TDesC8& CUpnpAVDevice::FriendlyName() const
+    {
+    if( iName )
+        {
+        return *iName;
+        }
+    else
+        {
+        return KNullDesC8;
+        }        
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetUuidL
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetUuidL( const TDesC8& aUuid )
+    {
+    HBufC8* tempBuf = aUuid.AllocL();
+    delete iUuid;
+    iUuid = tempBuf;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::Uuid
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C const TDesC8& CUpnpAVDevice::Uuid() const
+    {
+    if( iUuid )
+        {
+        return *iUuid;
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetDeviceType
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetDeviceType( TUpnpAVDeviceType aDeviceType )
+    {
+    iDeviceType = aDeviceType;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::DeviceType
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C CUpnpAVDevice::TUpnpAVDeviceType CUpnpAVDevice::DeviceType() const
+    {
+    return iDeviceType;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetCapabilitiesBySupportedMimeTypesL
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetCapabilitiesBySupportedMimeTypesL(
+                                const TDesC8& aListOfMimeTypes )
+    {
+    if( aListOfMimeTypes == KNullDesC8 )
+        {
+        User::Leave( KErrArgument );
+        }
+    else
+        {
+        // Update the audio media capability
+        if( aListOfMimeTypes.Find( KAudioSupport ) >= 0 )
+            {
+            iAudioMediaCapability = ETrue;
+            }
+        else
+            {
+            iAudioMediaCapability = EFalse;
+            }
+
+        // Update the image media capability
+        if( aListOfMimeTypes.Find( KImageSupport ) >= 0 )
+            {
+            iImageMediaCapability = ETrue;
+            }
+        else
+            {
+            iImageMediaCapability = EFalse;
+            }
+
+        // Update the video media capability
+        if( aListOfMimeTypes.Find( KVideoSupport ) >= 0 )
+            {
+            iVideoMediaCapability = ETrue;
+            }
+        else
+            {
+            iVideoMediaCapability = EFalse;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::LinkOffset
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C TInt CUpnpAVDevice::LinkOffset()
+    {
+    return _FOFF( CUpnpAVDevice, iSlink );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetCopyCapability
+// Sets the copy capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetCopyCapability( TBool aCopyCap )
+    {
+    iCopyCapability = aCopyCap;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::CopyCapability
+// Gets the copy capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::CopyCapability() const
+    {
+    return iCopyCapability;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetSearchCapability
+// Sets the search capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetSearchCapability( TBool aSearchCap )
+    {
+    iSearchCapability = aSearchCap;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SearchCapability
+// Gets the search capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::SearchCapability() const
+    {
+    return iSearchCapability;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetPauseCapability
+// Sets the pause capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetPauseCapability( TBool aPauseCap )
+    {
+    iPauseCapability = aPauseCap;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::PauseCapability
+// Gets the pause capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::PauseCapability() const
+    {
+    return iPauseCapability;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetVolumeCapability
+// Sets the volume capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetVolumeCapability( TBool aVolumeCap )
+    {
+    iVolumeCapability = aVolumeCap;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::VolumeCapability
+// Gets the volume capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::VolumeCapability() const
+    {
+    return iVolumeCapability;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetMuteCapability
+// Sets the mute capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetMuteCapability( TBool aMuteCap )
+    {
+    iMuteCapability = aMuteCap;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::MuteCapability
+// Gets the mute capability of the device
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::MuteCapability() const
+    {
+    return iMuteCapability;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetMaxVolume
+// Sets the maximum volume of the device
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetMaxVolume( TInt aVolume )
+    {
+    iMaxVolume = aVolume;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::MaxVolume
+// Gets the maximum volume of the device
+// --------------------------------------------------------------------------
+EXPORT_C TInt CUpnpAVDevice::MaxVolume() const
+    {
+    return iMaxVolume;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetNextAVTransportUri
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetNextAVTransportUri( TBool aCap )
+    {
+    iNextAVTransportUri = aCap;
+    __LOG1( "CUpnpAVDevice::SetNextAVTransportUri: iNextAVTransportUri %d",
+            iNextAVTransportUri );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::NextAVTransportUri
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::NextAVTransportUri() const
+    {
+    __LOG1( "CUpnpAVDevice::NextAVTransportUri: iNextAVTransportUri %d",
+            iNextAVTransportUri );
+    // Do not support NextAVTransportUri for now
+    __LOG( "return EFalse" );
+    return EFalse;
+    }           
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetAudioCapability
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetAudioCapability( TBool aCap )
+    {
+    iAudioMediaCapability = aCap;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::AudioCapability
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::AudioCapability() const
+    {
+    return iAudioMediaCapability;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetImageCapability
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetImageCapability( TBool aCap )
+    {
+    iImageMediaCapability = aCap;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::ImageCapability
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::ImageCapability() const
+    {
+    return iImageMediaCapability;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetVideoCapability
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetVideoCapability( TBool aCap )
+    {
+    iVideoMediaCapability = aCap;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::VideoCapability
+// See upnpavdevice.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::VideoCapability() const
+    {
+    return iVideoMediaCapability;     
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetDlnaCompatible
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpAVDevice::SetDlnaCompatible( TBool aDlnaCompatible )
+    {
+    iDlnaCompatible = aDlnaCompatible;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::DlnaCompatible
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpAVDevice::DlnaCompatible() const
+    {
+    return iDlnaCompatible;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavdeviceactive.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for ob serving device disappeared events per session
+*
+*/
+
+
+
+
+
+
+#include "upnpavdeviceactive.h"
+
+#include "upnpavcontrollerclient.h"
+#include "upnpavrenderingsessionimpl.h"
+#include "upnpavdevice.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPAVDeviceActive::ConstructL
+// See upnpavdeviceactive.h
+// --------------------------------------------------------------------------
+CUPnPAVDeviceActive* CUPnPAVDeviceActive::NewL( RUPnPAVControllerClient&
+    aServer, MUPnPAVDeviceObserver& aObserver )
+    {
+    CUPnPAVDeviceActive* self = new (ELeave) CUPnPAVDeviceActive( aServer,
+        aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDeviceActive::ConstructL
+// See upnpavdeviceactive.h
+// --------------------------------------------------------------------------
+CUPnPAVDeviceActive::CUPnPAVDeviceActive( RUPnPAVControllerClient& aServer,
+    MUPnPAVDeviceObserver& aObserver ):
+    CActive( EPriorityStandard ),
+    iServer( aServer ),
+    iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDeviceActive::ConstructL
+// See upnpavdeviceactive.h
+// --------------------------------------------------------------------------
+CUPnPAVDeviceActive::~CUPnPAVDeviceActive()
+    {
+    Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDeviceActive::ConstructL
+// See upnpavdeviceactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVDeviceActive::ConstructL()
+    {    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDeviceActive::ConstructL
+// See upnpavdeviceactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVDeviceActive::RunL()
+    {
+    CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL(); 
+    iObserver.UPnPDeviceDisappeared( *tempDev );
+    delete tempDev;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVDeviceActive::ConstructL
+// See upnpavdeviceactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVDeviceActive::DoCancel()
+    {
+    iServer.CancelDeviceDisappearedRequest( iId );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVDeviceActive::ConstructL
+// See upnpavdeviceactive.h
+// --------------------------------------------------------------------------
+TInt CUPnPAVDeviceActive::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVDeviceActive::ConstructL
+// See upnpavdeviceactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVDeviceActive::StartListening( TInt aId )
+    {
+    __ASSERTD( !IsActive(), __FILE__, __LINE__ );
+    iId = aId;
+    iServer.DeviceDisappearedRequest( aId, iStatus );
+    SetActive();    
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavdevicelist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implements a list of UPnP Devices
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    "upnpavdevicelist.h"
+#include    "upnpavdevice.h"
+
+
+// CONSTANTS
+const TInt KBufferGranularity = 300;
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::CUpnpAVDeviceList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpAVDeviceList::CUpnpAVDeviceList()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUpnpAVDeviceList::ConstructL( )
+    {
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpAVDeviceList* CUpnpAVDeviceList::NewL()
+    {
+    CUpnpAVDeviceList* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpAVDeviceList* CUpnpAVDeviceList::NewLC()
+    {
+    CUpnpAVDeviceList* self = new( ELeave ) CUpnpAVDeviceList;
+    CleanupStack::PushL( self );
+    self->ConstructL(  );
+    return self;
+    }
+      
+// Destructor
+CUpnpAVDeviceList::~CUpnpAVDeviceList()
+    {
+    iDevices.ResetAndDestroy();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::AppendDeviceL
+// Appends a device to internal array.
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVDeviceList::AppendDeviceL( CUpnpAVDevice& aDevice )
+    {
+    iDevices.AppendL( &aDevice );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::RemoveAndDestroy
+// Removes and destroys device from internal array according to index
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVDeviceList::RemoveAndDestroy( TInt aIndex )
+    {
+    delete iDevices[ aIndex ];
+    iDevices.Remove( aIndex );
+    }
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::Remove
+// Detaches object from internal array according to index
+// (other items were commented in a header)
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVDeviceList::Remove( TInt aIndex)
+    {
+    iDevices.Remove( aIndex );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::ResetAndDestroy
+// Removes and destroys device from internal array according to index
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVDeviceList::ResetAndDestroy()
+    {
+    iDevices.ResetAndDestroy();
+    }
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::Reset
+// Detaches object from internal array according to index
+// (other items were commented in a header)
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVDeviceList::Reset()
+    {
+    iDevices.Reset();
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::Count
+// Counts objects 
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVDeviceList::Count( ) const
+    {    
+    return iDevices.Count();
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::GetObjectL
+// Returns object from object array according to index
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpAVDevice* CUpnpAVDeviceList::operator[]( TInt aIndex ) const
+    {
+    return iDevices[ aIndex ];
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::ExternalizeL
+// Writes the content to stream.
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVDeviceList::ExternalizeL( RWriteStream& aStream ) const
+    {
+    TInt count = iDevices.Count();
+
+    aStream.WriteInt16L( count );
+    
+    for ( TInt i = 0; i < count; i++ )
+        {
+        iDevices[ i ]->ExternalizeL( aStream );
+        }
+    }
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::InternalizeL
+// Fills container information from stream
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//  
+EXPORT_C void CUpnpAVDeviceList::InternalizeL( RReadStream& aStream )
+    {
+    iDevices.ResetAndDestroy();
+
+    TInt count = aStream.ReadInt16L();
+    
+    for (TInt i = 0; i< count; i++ )
+        { 
+        CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL();
+        CleanupStack::PushL( tempDev );
+        tempDev->InternalizeL( aStream );
+        AppendDeviceL( *tempDev );
+        CleanupStack::Pop(); 
+        }
+    }
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceList::ToDes8L
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//  
+EXPORT_C HBufC8* CUpnpAVDeviceList::ToDes8L() const
+    {
+    CBufFlat* buf = CBufFlat::NewL( KBufferGranularity );
+    CleanupStack::PushL(buf);
+    RBufWriteStream stream(*buf);
+    CleanupClosePushL(stream);
+    
+    stream << *this;
+    
+    HBufC8* hbuf = HBufC8::NewLC( buf->Size() );
+    TPtr8 ptr( hbuf->Des() );
+    buf->Read( 0, ptr, buf->Size() );
+    
+    CleanupStack::Pop( hbuf );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buf );
+    
+    return hbuf;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpaveventactive.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for observing events within a rendering session
+*
+*/
+
+
+
+
+
+
+#include "upnpaveventactive.h"
+
+#include "upnpavcontrollerclient.h"
+#include "upnpavrenderingsessionimpl.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPAVEventActive::NewL
+// See upnpeventactive.h
+// --------------------------------------------------------------------------
+CUPnPAVEventActive* CUPnPAVEventActive::NewL(
+    RUPnPAVControllerClient& aServer,
+    CUPnPAVRenderingSessionImpl& aObserver )
+    {
+    CUPnPAVEventActive* self = new (ELeave) CUPnPAVEventActive(
+        aServer, aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVEventActive::CUPnPAVEventActive
+// See upnpeventactive.h
+// --------------------------------------------------------------------------
+CUPnPAVEventActive::CUPnPAVEventActive(
+    RUPnPAVControllerClient& aServer,
+    CUPnPAVRenderingSessionImpl& aObserver ):
+    CActive( EPriorityStandard ),
+    iServer( aServer ),
+    iEventPkg( iEvent ),
+    iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVEventActive::~CUPnPAVEventActive
+// See upnpeventactive.h
+// --------------------------------------------------------------------------
+CUPnPAVEventActive::~CUPnPAVEventActive()
+    {
+    __LOG( "CUPnPAVEventActive::~CUPnPAVEventActive" );    
+    
+    Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVEventActive::ConstructL
+// See upnpeventactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVEventActive::ConstructL()
+    {
+    __LOG( "CUPnPAVEventActive::ConstructL" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVEventActive::RunL
+// See upnpeventactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVEventActive::RunL()
+    {
+    __LOG2( "CUPnPAVEventActive::RunL, status: %d, event: %d",
+        iStatus.Int(), iEvent );
+    // An event received
+    TInt status = iStatus.Int();
+    TUnsolicitedEventC event = iEvent;
+
+    if( status == KErrNone )
+        {
+        iServer.EventRequest( iEventPkg, iId, iStatus );
+        SetActive();        
+        }
+    
+    iObserver.EventReceived( status, event );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVEventActive::DoCancel
+// See upnpeventactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVEventActive::DoCancel()
+    {
+    iServer.CancelEventRequest( iId );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVEventActive::RunError
+// See upnpeventactive.h
+// --------------------------------------------------------------------------
+TInt CUPnPAVEventActive::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVEventActive::StartListeningEvents
+// See upnpeventactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVEventActive::StartListeningEvents( TInt aId )
+    {
+    __ASSERTD( !IsActive(), __FILE__, __LINE__ );
+    iId = aId;
+    iServer.EventRequest( iEventPkg, aId, iStatus );
+    SetActive();    
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavrenderingactive.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,791 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for rendering commands
+*
+*/
+
+
+
+
+
+
+#include "upnpavrenderingactive.h"
+
+#include "upnpavcontrollerclient.h"
+#include "upnpavrenderingsessionimpl.h"
+#include "upnpavrequest.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+const TInt KPositionInfoSize = 15;
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::NewL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+CUPnPAVRenderingActive* CUPnPAVRenderingActive::NewL(
+    RUPnPAVControllerClient& aServer, TInt aId )
+    {
+    CUPnPAVRenderingActive* self = new (ELeave) CUPnPAVRenderingActive(
+        aServer, aId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::CUPnPAVRenderingActive
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+CUPnPAVRenderingActive::CUPnPAVRenderingActive(
+    RUPnPAVControllerClient& aServer, TInt aId ):
+    CActive( EPriorityStandard ),
+    iServer( aServer ),
+    iId( aId ),
+    iBufferPtr( 0, 0 ),
+    iBufferPtr2( 0, 0 ),
+    iRespBufSizePkg( iRespBufSize )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::~CUPnPAVRenderingActive
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+CUPnPAVRenderingActive::~CUPnPAVRenderingActive()
+    {
+    __LOG( "CUPnPAVRenderingActive::~CUPnPAVRenderingActive" );
+    
+    Cancel();
+    
+    delete iBuffer;
+    delete iBuffer2;
+
+    if( iMediaServerResourceReserved )
+        {
+        iServer.ReleaseMediaServer( iId );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::ConstructL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::ConstructL()
+    {  
+    __LOG( "CUPnPAVRenderingActive::ConstructL" );  
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::RunL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::RunL()
+    {
+    __LOG( "CUPnPAVRenderingActive::RunL" );
+    
+    switch( iPendingOperation )
+        {
+        case ESetURI:
+            {
+            SetURICompleteL();
+            }
+            break;
+
+        case ESetNextURI:
+            {
+            SetNextURICompleteL();
+            }
+            break;
+
+        case EPlay:
+            {
+            PlayCompleteL();
+            }
+            break;
+
+        case EStop:
+            {
+            StopCompleteL();
+            }
+            break;
+
+        case EPause:
+            {
+            PauseCompleteL();
+            }
+            break;
+
+        case ESetVolume:
+            {
+            SetVolumeCompleteL();
+            }
+            break;
+
+        case EGetVolume:
+            {
+            GetVolumeCompleteL();
+            }
+            break;
+
+        case ESetMute:
+            {
+            SetMuteCompleteL();
+            }
+            break;
+
+        case EGetMute:
+            {
+            GetMuteCompleteL();
+            }
+            break;
+
+        case EPositionInfo:
+            {
+            PositionInfoCompleteL();
+            }
+            break;
+            
+        case EStartMediaServer:
+            {
+            StartMediaServerCompleteL();
+            }
+            break;
+            
+        default:
+            __PANICD( __FILE__, __LINE__ );
+            break;            
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::DoCancel
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::DoCancel()
+    {
+    __LOG( "CUPnPAVRenderingActive::DoCancel" );
+    
+    switch( iPendingOperation )
+        {
+        case ESetURI:
+            {
+            iServer.CancelSetURI( iId );
+            }
+            break;
+
+        case ESetNextURI:
+            {
+            iServer.CancelSetNextURI( iId );
+            }
+            break;
+
+        case EPlay:
+            {
+            iServer.CancelPlay( iId );
+            }
+            break;
+
+        case EStop:
+            {
+            iServer.CancelStop( iId );
+            }
+            break;
+
+        case EPause:
+            {
+            iServer.CancelPause( iId );
+            }
+            break;
+
+        case ESetVolume:
+            {
+            iServer.CancelSetVolume( iId );
+            }
+            break;
+
+        case EGetVolume:
+            {
+            iServer.CancelGetVolume( iId );
+            }
+            break;
+
+        case ESetMute:
+            {
+            iServer.CancelSetMute( iId );
+            }
+            break;
+
+        case EGetMute:
+            {
+            iServer.CancelGetMute( iId );
+            }
+            break;
+
+        case EPositionInfo:
+            {
+            iServer.CancelGetPositionInfo( iId );
+            }
+            break;
+
+        case EStartMediaServer:
+            {
+            iServer.CancelReserveMediaServer( iId );
+            }
+            break;          
+                       
+        default:
+            __PANICD( __FILE__, __LINE__ );
+            break;            
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::RunError
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+TInt CUPnPAVRenderingActive::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::SetObserver
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::SetObserver( 
+                                 MUPnPAVRenderingSessionObserver& aObserver )
+    {
+    // Set the observer and make an async request to the server to receive
+    // device callbacks
+    __ASSERTD( !iObserver, __FILE__, __LINE__ );
+
+        
+    iObserver = &aObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::Observer
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+MUPnPAVRenderingSessionObserver* CUPnPAVRenderingActive::Observer() const
+    {
+    return iObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::RemoveObserver
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::RemoveObserver()
+    {
+    iObserver = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::ReserveLocalMSServicesL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::ReserveLocalMSServicesL()
+    {
+    __LOG( "CUPnPAVRenderingActive::ReserveLocalMSServicesL" );
+    
+    ResetL();
+    
+    if( iMediaServerResourceReserved )
+        {
+        if( iObserver )
+            {
+            iObserver->ReserveLocalMSServicesCompleted( KErrNone );
+            }
+        }
+    else
+        {
+        iPendingOperation = EStartMediaServer;
+        iServer.ReserveMediaServer( iId, iStatus );
+        SetActive();    
+        
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::CancelReserveLocalMSServicesL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::CancelReserveLocalMSServicesL()
+    {
+    __LOG( "CUPnPAVRenderingActive::CancelReserveLocalMSServicesL" );
+    
+    if( iPendingOperation == EStartMediaServer )
+        {
+        Cancel();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::ReleaseLocalMSServicesL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::ReleaseLocalMSServicesL()
+    {
+    __LOG( "CUPnPAVRenderingActive::ReleaseLocalMSServicesL" );
+    
+    ResetL();
+    
+    if( iMediaServerResourceReserved )
+        {
+        iMediaServerResourceReserved = EFalse;
+        
+        User::LeaveIfError( iServer.ReleaseMediaServer( iId ) );        
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::SetURIL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::SetURIL( const TDesC8& aURI,
+    const CUpnpItem& aItem )
+    {
+    __LOG( "CUPnPAVRenderingActive::SetURIL" );
+    
+    ResetL();
+        
+    CUpnpAVRequest* tempRequest = CUpnpAVRequest::NewLC();
+    tempRequest->SetURIL( aURI );
+    
+    iBuffer = tempRequest->ToDes8L();
+    iBufferPtr.Set( iBuffer->Des() );
+    
+    iBuffer2 = aItem.ToDes8L();
+    iBufferPtr2.Set( iBuffer2->Des() );
+    
+    CleanupStack::PopAndDestroy( tempRequest );
+
+    iPendingOperation = ESetURI;
+        
+    iServer.SetURI( iId, iBufferPtr, iBufferPtr2, iStatus );
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::SetNextURIL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::SetNextURIL( const TDesC8& aURI,
+    const CUpnpItem& aItem )    
+    {
+    __LOG( "CUPnPAVRenderingActive::SetNextURIL" );
+    
+    ResetL();
+    
+    CUpnpAVRequest* tempRequest = CUpnpAVRequest::NewLC();
+    tempRequest->SetURIL( aURI );
+    
+    iBuffer = tempRequest->ToDes8L();
+    iBufferPtr.Set( iBuffer->Des() );
+
+    iBuffer2 = aItem.ToDes8L();
+    iBufferPtr2.Set( iBuffer2->Des() );
+    
+    CleanupStack::PopAndDestroy( tempRequest );
+            
+    iPendingOperation = ESetNextURI;
+    
+    iServer.SetNextURI( iId, iBufferPtr, iBufferPtr2, iStatus );
+    SetActive();        
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::PlayL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::PlayL()
+    {
+    __LOG( "CUPnPAVRenderingActive::PlayL" );
+    
+    ResetL();
+    iPendingOperation = EPlay;
+    iServer.Play( iId, iStatus );
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::StopL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::StopL()
+    {
+    __LOG( "CUPnPAVRenderingActive::StopL" );
+    
+    ResetL();
+    iPendingOperation = EStop;
+    iServer.Stop( iId, iStatus );
+    SetActive();    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::PauseL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::PauseL()
+    {
+    __LOG( "CUPnPAVRenderingActive::PauseL" );
+    
+    ResetL();
+    iPendingOperation = EPause;
+    iServer.Pause( iId, iStatus );
+    SetActive();    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::SetVolumeL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::SetVolumeL( TInt aVolumeLevel )
+    {
+    __LOG( "CUPnPAVRenderingActive::SetVolumeL" );
+    
+    ResetL();
+    iPendingOperation = ESetVolume;
+    iServer.SetVolume( iId, aVolumeLevel, iRespBufSizePkg, iStatus );
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::GetVolumeL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::GetVolumeL()
+    {
+    __LOG( "CUPnPAVRenderingActive::GetVolumeL" );
+    
+    ResetL();
+    iPendingOperation = EGetVolume;
+    iServer.GetVolume( iId, iRespBufSizePkg, iStatus );
+    SetActive();    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::SetMuteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::SetMuteL( TBool aMute )
+    {
+    __LOG( "CUPnPAVRenderingActive::SetMuteL" );
+    
+    ResetL();
+    iPendingOperation = ESetMute;
+    iServer.SetMute( iId, aMute, iRespBufSizePkg, iStatus );
+    SetActive();        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::NewL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::GetMuteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::GetMuteL" );
+    
+    ResetL();
+    iPendingOperation = EGetMute;
+    iServer.GetMute( iId, iRespBufSizePkg, iStatus );
+    SetActive();            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::GetPositionInfoL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::GetPositionInfoL()
+    {
+    __LOG( "CUPnPAVRenderingActive::GetPositionInfoL" );
+    
+    ResetL();
+  
+    iBuffer = HBufC8::NewL( KPositionInfoSize );
+    iBufferPtr.Set( iBuffer->Des() );
+    iBuffer2 = HBufC8::NewL( KPositionInfoSize );
+    iBufferPtr2.Set( iBuffer2->Des() );
+    iPendingOperation = EPositionInfo;
+    iServer.GetPositionInfo( iId, iBufferPtr, iBufferPtr2, iStatus );
+    SetActive();                
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::ResetL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::ResetL()
+    {
+    __LOG( "CUPnPAVRenderingActive::ResetL" );
+    
+    if( IsActive() )
+        {
+        User::Leave( KErrServerBusy );
+        }
+
+    delete iBuffer; iBuffer = NULL;
+    delete iBuffer2; iBuffer2 = NULL;
+    iPendingOperation = ENone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::SetURICompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::SetURICompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::SetURICompleteL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerSetURICompleted )
+            {
+            iObserver->SetURIResult( KErrNone );    
+            }
+        else
+            {
+            iObserver->SetURIResult( iStatus.Int() );    
+            }
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::SetNextURICompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::SetNextURICompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::SetNextURICompleteL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerSetNextURICompleted )
+            {
+            iObserver->SetNextURIResult( KErrNone );    
+            }
+        else
+            {
+            iObserver->SetNextURIResult( iStatus.Int() );    
+            }
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::PlayCompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::PlayCompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::PlayCompleteL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerPlayCompleted )
+            {
+            iObserver->InteractOperationComplete( KErrNone, EUPnPAVPlay );    
+            }
+        else
+            {
+            iObserver->InteractOperationComplete( iStatus.Int(), 
+                                                  EUPnPAVPlay ); 
+            }
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::StopCompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::StopCompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::StopCompleteL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerStopCompleted )
+            {
+            iObserver->InteractOperationComplete( KErrNone, EUPnPAVStop );    
+            }
+        else
+            {
+            iObserver->InteractOperationComplete( iStatus.Int(), 
+                                                  EUPnPAVStop ); 
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::PauseCompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::PauseCompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::PauseCompleteL" );
+
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerPauseCompleted )
+            {
+            iObserver->InteractOperationComplete( KErrNone,
+                                                  EUPnPAVPause );
+            }
+        else
+            {
+            iObserver->InteractOperationComplete( iStatus.Int(), 
+                                                  EUPnPAVPause );    
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::SetVolumeCompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::SetVolumeCompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::SetVolumeCompleteL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerSetVolumeCompleted )
+            {
+            iObserver->VolumeResult( KErrNone, iRespBufSize, ETrue );    
+            }
+        else
+            {
+            iObserver->VolumeResult( iStatus.Int(), 0, ETrue );
+            }
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::GetVolumeCompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::GetVolumeCompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::GetVolumeCompleteL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerGetVolumeCompleted )
+            {
+            iObserver->VolumeResult( KErrNone, iRespBufSize, ETrue );    
+            }
+        else
+            {
+            iObserver->VolumeResult( iStatus.Int(), 0, ETrue );
+            }
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::SetMuteCompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::SetMuteCompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::SetMuteCompleteL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerSetMuteCompleted )
+            {
+            iObserver->MuteResult( KErrNone, (TBool)iRespBufSize, ETrue );    
+            }
+        else
+            {
+            iObserver->MuteResult( iStatus.Int(), 0, ETrue );
+            }
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::GetMuteCompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::GetMuteCompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::GetMuteCompleteL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerGetMuteCompleted )
+            {
+            iObserver->MuteResult( KErrNone, iRespBufSize, ETrue );    
+            }
+        else
+            {
+            iObserver->MuteResult( iStatus.Int(), 0, ETrue );
+            }
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::PositionInfoCompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::PositionInfoCompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::PositionInfoCompleteL" );
+    
+    if( iObserver )
+        {
+        if( iStatus.Int() == EAVControllerPositionInfoCompleted )
+            {
+            iObserver->PositionInfoResult( KErrNone, *iBuffer2, *iBuffer );  
+            }
+        else
+            {
+            iObserver->PositionInfoResult( iStatus.Int(), 
+                                           KNullDesC8, 
+                                           KNullDesC8 );
+            }
+        }            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingActive::StartMediaServerCompleteL
+// See upnpavrenderingactive.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingActive::StartMediaServerCompleteL()
+    {
+    __LOG( "CUPnPAVRenderingActive::StartMediaServerCompleteL" );
+    
+    if( iObserver )
+        {
+
+        if( iStatus.Int() == EAVControllerStartMediaServerCompleted )
+            {
+            iMediaServerResourceReserved = ETrue;
+            iObserver->ReserveLocalMSServicesCompleted( KErrNone );
+            }
+        else
+            {
+            iObserver->ReserveLocalMSServicesCompleted( iStatus.Int() );
+            }
+        
+        }
+    }    
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpavrenderingsessionimpl.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,415 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implements a session towards a renderer
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+// upnp stack api
+#include <upnpitem.h>
+#include <upnpobjectlist.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdevice.h"
+#include "upnpavcontrollerglobals.h"
+#include "upnpavrenderingsessionobserver.h"
+
+// avcontroller internal
+#include "upnpaveventactive.h"
+#include "upnpavcontrollerclient.h"
+#include "upnpavdeviceactive.h"
+#include "upnpavrenderingactive.h"
+#include "upnpavrenderingsessionimpl.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::CUPnPAVRenderingSessionImpl
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+CUPnPAVRenderingSessionImpl* CUPnPAVRenderingSessionImpl::NewL( 
+                                            RUPnPAVControllerClient& aServer, 
+                                            const CUpnpAVDevice& aDevice )
+    {
+    CUPnPAVRenderingSessionImpl* self = 
+                        new (ELeave) CUPnPAVRenderingSessionImpl( aServer );
+    CleanupStack::PushL( self );
+    self->iDevice = CUpnpAVDevice::NewL( aDevice );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::CUPnPAVRenderingSessionImpl
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+CUPnPAVRenderingSessionImpl::CUPnPAVRenderingSessionImpl( 
+                                        RUPnPAVControllerClient& aServer ):
+    iServer( aServer ),
+    iBufferPtr( 0, 0 ),
+    iAlive( ETrue )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::~CUPnPAVRenderingSessionImpl
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+CUPnPAVRenderingSessionImpl::~CUPnPAVRenderingSessionImpl()
+    {
+    __LOG( "CUPnPAVRenderingSessionImpl::~CUPnPAVRenderingSessionImpl" );
+    
+    delete iDevice;
+    delete iEventActive;
+    delete iCommandActive;
+    delete iSettingActive;
+    delete iDeviceActive;
+    delete iBuffer; 
+
+    iServer.DestroyRenderingSession( (TInt)this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::ConstructL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::ConstructL()
+    {
+    __LOG( "CUPnPAVRenderingSessionImpl::ConstructL" );
+    
+    iBuffer = iDevice->Uuid().AllocL();
+    iBufferPtr.Set( iBuffer->Des() );
+    User::LeaveIfError( iServer.CreateRenderingSession( (TInt)this , 
+                                                        iBufferPtr ) );
+    iEventActive = CUPnPAVEventActive::NewL( iServer, *this );
+    iCommandActive = CUPnPAVRenderingActive::NewL( iServer, (TInt)this );
+    iSettingActive = CUPnPAVRenderingActive::NewL( iServer, (TInt)this );
+    iDeviceActive = CUPnPAVDeviceActive::NewL( iServer, *this );
+    iDeviceActive->StartListening( (TInt)this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::SetObserver
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::SetObserver( 
+                                 MUPnPAVRenderingSessionObserver& aObserver )
+    {
+    // Set the observer and make an async request to the server to receive
+    // device callbacks
+    __ASSERTD( !iObserver, __FILE__, __LINE__ );
+
+    iEventActive->StartListeningEvents( (TInt)this );        
+        
+    iObserver = &aObserver;
+    iCommandActive->SetObserver( aObserver );
+    iSettingActive->SetObserver( aObserver );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::Observer
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+MUPnPAVRenderingSessionObserver* CUPnPAVRenderingSessionImpl::Observer() const
+    {
+    return iObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::RemoveObserver
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::RemoveObserver()
+    {
+    iObserver = NULL;
+    iCommandActive->RemoveObserver();
+    iSettingActive->RemoveObserver();    
+    iEventActive->Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::Device
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+const CUpnpAVDevice& CUPnPAVRenderingSessionImpl::Device() const
+    {
+    return *iDevice;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::ReserveLocalMSServicesL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::ReserveLocalMSServicesL()
+    {  
+    ResetL();
+    
+    iCommandActive->ReserveLocalMSServicesL();       
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::CancelReserveLocalMSServicesL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::CancelReserveLocalMSServicesL()
+    {
+    ResetL();
+    
+    iCommandActive->CancelReserveLocalMSServicesL();  
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::ReleaseLocalMSServicesL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::ReleaseLocalMSServicesL()
+    {  
+    ResetL();
+    
+    iCommandActive->ReleaseLocalMSServicesL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::SetURIL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::SetURIL( const TDesC8& aURI,
+    const CUpnpItem& aItem )
+    {
+    ResetL();
+    
+    iCommandActive->SetURIL( aURI, aItem );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::SetNextURIL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::SetNextURIL( const TDesC8& aURI,
+    const CUpnpItem& aItem )    
+    {
+    ResetL();
+    
+    iCommandActive->SetNextURIL( aURI, aItem );     
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::PlayL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::PlayL()
+    {
+    ResetL();
+    
+    iCommandActive->PlayL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::StopL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::StopL()
+    {
+    ResetL();
+    
+    iCommandActive->StopL(); 
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::PauseL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::PauseL()
+    {
+    ResetL();
+    
+    iCommandActive->PauseL();   
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::SetVolumeL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::SetVolumeL( TInt aVolumeLevel )
+    {
+    ResetL();
+    
+    iSettingActive->SetVolumeL( aVolumeLevel );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::GetVolumeL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::GetVolumeL()
+    {
+    ResetL();
+    
+    iSettingActive->GetVolumeL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::SetMuteL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::SetMuteL( TBool aMute )
+    {
+    ResetL();
+    
+    iSettingActive->SetMuteL( aMute );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::GetMuteL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::GetMuteL()
+    {
+    ResetL();
+    
+    iSettingActive->GetMuteL();           
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::GetPositionInfoL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::GetPositionInfoL()
+    {
+    ResetL();
+    
+    iSettingActive->GetPositionInfoL();               
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::UPnPDeviceDiscovered
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::UPnPDeviceDiscovered( 
+                                        const CUpnpAVDevice& /*aDevice*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::UPnPDeviceDisappeared
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::UPnPDeviceDisappeared( 
+                                        const CUpnpAVDevice& /*aDevice*/ )
+    {
+    __LOG( "CUPnPAVRenderingSessionImpl::UPnPDeviceDisappeared" );
+    
+    iAlive = EFalse;
+    if( iObserver )
+        {
+        iObserver->MediaRendererDisappeared(
+            MUPnPAVSessionObserverBase::EDisconnected );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::WLANConnectionLost
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::WLANConnectionLost()
+    {
+    __LOG( "CUPnPAVRenderingSessionImpl::WLANConnectionLost" );
+    
+    iAlive = EFalse;
+    if( iObserver )    
+        {
+        iObserver->MediaRendererDisappeared(
+            MUPnPAVSessionObserverBase::EWLANLost );
+        }
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::EventReceived
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::EventReceived( TInt aError,
+    TUnsolicitedEventC aEvent )
+    {
+    if( iObserver )
+        {
+        switch( aEvent.iEvent )
+            {
+            case EPlay:
+                {
+                iObserver->InteractOperationComplete( aError,
+                    EUPnPAVPlayUser );
+                break;
+                }
+            case EPause:
+                {
+                iObserver->InteractOperationComplete( aError,
+                    EUPnPAVPauseUser );                
+                break;
+                }
+            case EStop:
+                {
+                iObserver->InteractOperationComplete( aError,
+                    EUPnPAVStopUser );                
+                break;
+                }
+            case EVolume:
+                {
+                iObserver->VolumeResult( aError, aEvent.iValue, EFalse );
+                break;
+                }
+            case EMute:
+                {
+                iObserver->MuteResult( aError, (TBool)aEvent.iValue,
+                    EFalse );
+                break;
+                }
+            default:
+                {
+                __PANICD( __FILE__, __LINE__ );
+                break;
+                }    
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVRenderingSessionImpl::ResetL
+// See upnpavrenderingsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVRenderingSessionImpl::ResetL()
+    {
+    __LOG( "CUPnPAVRenderingSessionImpl::ResetL" );
+    
+    if( !iAlive )
+        {
+        __LOG( "ResetL - disconnected, leave " );
+        User::Leave( KErrDisconnected );        
+        }
+
+    delete iBuffer; iBuffer = NULL;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpfiledownloadsessionimpl.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,442 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implements download session
+*
+*/
+
+
+
+
+
+
+// INTERNAL INCLUDES
+// upnp stack api
+#include <upnpitem.h>
+#include <upnpelement.h>
+#include <upnpstring.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdevice.h"
+#include "upnpfiletransfersessionobserver.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for upnp-specific stuff
+#include "upnpitemutility.h" // FindAttributeByName
+#include "upnpfileutility.h" // FitsInMemory
+
+// avcontroller internal
+#include "upnpfiledownloadsessionimpl.h"
+#include "upnpavcontrollerclient.h"
+#include "upnpfiletransferitem.h"
+
+// EXTERNAL INCLUDES
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::NewL
+// Two-phase construction
+// --------------------------------------------------------------------------
+CUPnPFileDownloadSessionImpl* CUPnPFileDownloadSessionImpl::NewL(
+    RUPnPAVControllerClient& aServer, const CUpnpAVDevice& aDevice )
+    {
+    CUPnPFileDownloadSessionImpl* self = new (ELeave)
+        CUPnPFileDownloadSessionImpl( aServer );
+    CleanupStack::PushL( self );
+    self->iDevice = CUpnpAVDevice::NewL( aDevice );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::CUPnPFileDownloadSessionImpl
+// Constructor
+// --------------------------------------------------------------------------
+CUPnPFileDownloadSessionImpl::CUPnPFileDownloadSessionImpl(
+    RUPnPAVControllerClient& aServer ) :
+    CActive( EPriorityStandard ),
+    iServer( aServer ),
+    iBufferPtr( 0, 0 ),
+    iBufferPtr2( 0, 0 ),
+    iAlive( ETrue ),
+    iEventPkg( iEvent )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::~CUPnPFileDownloadSessionImpl
+// Destructor
+// --------------------------------------------------------------------------
+CUPnPFileDownloadSessionImpl::~CUPnPFileDownloadSessionImpl()
+    {
+    __LOG( "CUPnPFileDownloadSessionImpl::~CUPnPFileDownloadSessionImpl" );
+    
+    CancelAllTransfers();
+    
+    Cancel();
+    iServer.DestroyDownloadSession( (TInt)this );
+    
+    delete iDevice;
+    delete iBuffer;
+    delete iBuffer2;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::ConstructL
+// Two-phase construction
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::ConstructL()
+    {
+    __LOG( "CUPnPFileDownloadSessionImpl::ConstructL" );
+    
+    iBuffer = iDevice->Uuid().AllocL();
+    iBufferPtr.Set( iBuffer->Des() );
+    User::LeaveIfError( iServer.CreateDownloadSession(
+        (TInt)this , iBufferPtr ) );
+    
+    iBuffer2 = HBufC::NewL( KMaxPath );
+    iBufferPtr2.Set( iBuffer2->Des() );    
+    iServer.GetDownloadEvent( (TInt)this, iEventPkg, iStatus, iBufferPtr2 );
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::ConstructL
+// From CActive
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::RunL()
+    {
+    __LOG( "CUPnPFileDownloadSessionImpl::RunL" );
+
+    TUpnpFileTransferEvent event = iEvent;
+
+    if( iStatus.Int() == KErrNone )
+        {
+        __LOG( "RunL - Activate again" );
+
+        iServer.GetDownloadEvent( (TInt)this, iEventPkg, iStatus,
+            iBufferPtr2 );
+        SetActive();        
+        }
+    else
+        {
+        __LOG1( "RunL - %d", iStatus.Int() );      
+        }              
+    
+    // Handle event and activate again
+    switch( event.iEvent )
+        {
+        case TUpnpFileTransferEvent::ETransferStarted:
+            {
+            if( iObserver )
+                {
+                __LOG( "RunL - ETransferStarted" );
+                
+                // iKey - 1 since it's incremented when we request the
+                // download. The reason behind of this is the fact that
+                // httptransfer does not accept value 0 which is legal from
+                // the API point of view
+                iObserver->TransferStarted( event.iKey - 1,
+                    event.iStatus );
+                }
+            break;
+            }
+
+        case TUpnpFileTransferEvent::ETransferCompleted:
+            {
+            if( iObserver )
+                {
+                __LOG( "RunL - ETransferCompleted" );
+                
+                iObserver->TransferCompleted( event.iKey - 1,
+                    event.iStatus, *iBuffer2 );   
+                }                  
+            break;
+            }
+            
+        case TUpnpFileTransferEvent::ETransferProgress:
+            {
+            if( iObserver )
+                {
+                __LOG( "RunL - ETransferProgress" );
+                
+                iObserver->TransferProgress( event.iKey - 1,
+                    event.iParam1, event.iParam2 );
+                }                  
+            break;
+            }
+            
+        case TUpnpFileTransferEvent::EDeviceDisconnected:
+            {
+            CUpnpAVDevice* tmpDev = NULL;
+            UPnPDeviceDisappeared( *tmpDev );
+            break;
+            }
+            
+        default:
+            {
+            __LOG( "RunL - default!" );      
+            break;
+            }
+        
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::DoCancel
+// From CActive
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::DoCancel()
+    {
+    __LOG( "CUPnPFileDownloadSessionImpl::DoCancel" );
+    
+    iServer.CancelDownloadEvent( (TInt)this );
+    
+    __LOG( "CUPnPFileDownloadSessionImpl::DoCancel - end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::RunError
+// From CActive
+// --------------------------------------------------------------------------
+TInt CUPnPFileDownloadSessionImpl::RunError( TInt /*aError*/ )
+    {
+    __LOG( "CUPnPFileDownloadSessionImpl::RunError" );
+    
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::StartDownloadL
+// From CActive
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::StartDownloadL(
+    const CUpnpItem& aItem, TInt aKey )
+    {
+    __LOG( "CUPnPFileDownloadSessionImpl::StartDownloadL" );
+    
+    ResetL();
+
+    CUpnpFileTransferItem* item = CUpnpFileTransferItem::NewLC();
+    item->SetTitleL( aItem.Title() );
+    // aKey + 1 
+    // the reason behind of this is the fact that httptransfer
+    // does not accept value 0 which is legal from the API point
+    // of view.    
+    item->SetKey( aKey + 1 );
+
+    // Get the most suitable (original) res-element from the item
+    const CUpnpElement& tmpEl = UPnPItemUtility::ResourceFromItemL( 
+        aItem );
+    
+    if( !UPnPFileUtility::FitsInMemory( tmpEl ) )
+        {
+        User::Leave( KErrDiskFull );
+        }
+
+    item->SetUriL( tmpEl.Value() );    
+
+    // Get the protocolinfo-attribute
+    const CUpnpAttribute* tmpPInfo = UPnPItemUtility::FindAttributeByName(
+        tmpEl, KAttributeProtocolInfo );
+    if( tmpPInfo )
+        {
+        item->SetProtocolInfoL( tmpPInfo->Value() );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }    
+
+    iBuffer = item->ToDes8L();
+    iBufferPtr.Set( iBuffer->Des() );
+    
+    CleanupStack::PopAndDestroy( item );
+    
+    User::LeaveIfError( iServer.StartDownload( (TInt)this, iBufferPtr ) );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::StartDownloadL
+// See upnpfiledownloadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::StartDownloadL( 
+    const CUpnpElement& aResElement, const CUpnpItem& aItem,
+    RFile& aFile, TInt aKey )
+    {
+    __LOG( "CUPnPFileDownloadSessionImpl::StartDownloadL" );
+    
+    ResetL();
+
+    CUpnpFileTransferItem* item = CUpnpFileTransferItem::NewLC();
+    item->SetTitleL( aItem.Title() );
+    item->SetUriL( aResElement.Value() );
+    item->SetKey( aKey + 1 );
+
+    const CUpnpAttribute* pInfo = UPnPItemUtility::FindAttributeByName(
+        aResElement, KAttributeProtocolInfo );
+    if( pInfo )
+        {
+        item->SetProtocolInfoL( pInfo->Value() );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }   
+
+    iBuffer = item->ToDes8L();
+    iBufferPtr.Set( iBuffer->Des() );
+    
+    CleanupStack::PopAndDestroy( item );
+    
+    User::LeaveIfError( iServer.StartDownload( (TInt)this, iBufferPtr,
+        aFile ) );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::SetObserver
+// See upnpfiledownloadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::SetObserver(
+    MUPnPFileTransferSessionObserver& aObserver )
+    {
+    __LOG( "CUPnPFileDownloadSessionImpl::SetObserver" );
+    
+    iObserver = &aObserver;
+    }
+     
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::RemoveObserver
+// See upnpfiledownloadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::RemoveObserver()
+    {
+    iObserver = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::Observer
+// See upnpfiledownloadsessionimpl.h
+// --------------------------------------------------------------------------
+MUPnPFileTransferSessionObserver* CUPnPFileDownloadSessionImpl::Observer()
+    const
+    {
+    return iObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::StartTrackingProgressL
+// See upnpfiledownloadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::StartTrackingProgressL( TInt aKey )
+    {
+    ResetL();
+    User::LeaveIfError( iServer.StartTrackingDownloadProgress(
+        (TInt)this, aKey + 1 ) );
+                   
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::CancelTransfer
+// See upnpfiledownloadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::CancelTransfer( TInt aKey )
+    {
+    iServer.CancelDownload( (TInt)this, aKey + 1 ); // Ignore error
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::CancelAllTransfers
+// See upnpfiledownloadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::CancelAllTransfers()
+    {
+    iServer.CancelAllDownloads( (TInt)this ); // Ignore error
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::UPnPDeviceDiscovered
+// Device discovered
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::UPnPDeviceDiscovered(
+    const CUpnpAVDevice& /*aDevice*/ )
+    {
+    // No implementation needed
+    }
+
+  
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::UPnPDeviceDisappeared
+// Device disappeared
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::UPnPDeviceDisappeared(
+    const CUpnpAVDevice& /*aDevice*/ )
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::UPnPDeviceDisappeared" );
+    
+    iAlive = EFalse;
+    if( iObserver )
+        {
+        iObserver->MediaServerDisappeared( 
+            MUPnPAVSessionObserverBase::EDisconnected );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::WLANConnectionLost
+// Connection lost
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::WLANConnectionLost()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::WLANConnectionLost" );
+    
+    iAlive = EFalse;
+    if( iObserver )    
+        {
+        iObserver->MediaServerDisappeared( 
+            MUPnPAVSessionObserverBase::EWLANLost );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::Device
+// Returns used device
+// --------------------------------------------------------------------------
+const CUpnpAVDevice& CUPnPFileDownloadSessionImpl::Device() const
+    {
+    return *iDevice;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileDownloadSessionImpl::ResetL
+// Reset
+// --------------------------------------------------------------------------
+void CUPnPFileDownloadSessionImpl::ResetL()
+    {
+    __LOG( "CUPnPFileDownloadSessionImpl::ResetL" );
+    
+    if( !iAlive )
+        {
+        User::Leave( KErrDisconnected );
+        }
+
+    delete iBuffer; iBuffer = NULL;
+    }    
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerclient/src/upnpfileuploadsessionimpl.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,380 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implements upload session
+*
+*/
+
+
+
+
+
+
+// INTERNAL INCLUDES
+// upnpframework / avcontroller api
+#include "upnpavdevice.h"
+#include "upnpfiletransfersessionobserver.h"
+
+// avcontroller internal
+#include "upnpfileuploadsessionimpl.h"
+#include "upnpavcontrollerclient.h"
+#include "upnpfiletransferitem.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerclient.txt");
+#include "upnplog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::NewL
+// Two-phase construction
+// --------------------------------------------------------------------------
+CUPnPFileUploadSessionImpl* CUPnPFileUploadSessionImpl::NewL(
+    RUPnPAVControllerClient& aServer, const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::NewL" );
+    
+    CUPnPFileUploadSessionImpl* self = new (ELeave)
+        CUPnPFileUploadSessionImpl( aServer );
+    CleanupStack::PushL( self );
+    self->iDevice = CUpnpAVDevice::NewL( aDevice );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::CUPnPFileUploadSessionImpl
+// Constructor
+// --------------------------------------------------------------------------
+CUPnPFileUploadSessionImpl::CUPnPFileUploadSessionImpl(
+    RUPnPAVControllerClient& aServer ) :
+    CActive( EPriorityStandard ),
+    iServer( aServer ),
+    iBufferPtr( 0, 0 ),
+    iAlive( ETrue ),
+    iEventPkg( iEvent )
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::NewL" );
+    
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::~CUPnPFileUploadSessionImpl
+// Destructor
+// --------------------------------------------------------------------------
+CUPnPFileUploadSessionImpl::~CUPnPFileUploadSessionImpl()
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::~CUPnPFileUploadSessionImpl" );
+    
+    CancelAllTransfers();
+    
+    Cancel();
+    iServer.DestroyUploadSession( (TInt)this );
+    
+    delete iDevice;
+    delete iBuffer;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::ConstructL
+// Two-phase construction
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::ConstructL()
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::ConstructL" );
+    
+    iBuffer = iDevice->Uuid().AllocL();
+    iBufferPtr.Set( iBuffer->Des() );
+    User::LeaveIfError( iServer.CreateUploadSession(
+        (TInt)this , iBufferPtr ) );
+
+    iServer.GetUploadEvent( (TInt)this, iEventPkg, iStatus );
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::ConstructL
+// Two-phase construction
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::RunL()
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::RunL" );
+
+    TUpnpFileTransferEvent event = iEvent;    
+
+    if( iStatus.Int() == KErrNone )
+        {
+        iServer.GetUploadEvent( (TInt)this, iEventPkg, iStatus );
+        SetActive();        
+        }
+    else
+        {
+        __LOG1( "RunL - %d", iStatus.Int() );      
+        }      
+
+    // Handle event and activate again
+    switch( event.iEvent )
+        {
+        case TUpnpFileTransferEvent::ETransferStarted:
+            {
+            if( iObserver )
+                {
+                __LOG2( "RunL - ETransferStarted, key = %d, status = %d",
+                    event.iKey, event.iStatus );
+                
+                // iKey - 1 since it's incremented when we request the upload
+                // the reason behind of this is the fact that httptransfer
+                // does not accept value 0 which is legal from the API point
+                // of view
+                iObserver->TransferStarted( event.iKey - 1,
+                    event.iStatus );
+                }
+            break;
+            }
+            
+        case TUpnpFileTransferEvent::ETransferCompleted:
+            {
+            if( iObserver )
+                {
+                __LOG2( "RunL - ETransferCompleted,key = %d, status = %d",
+                    event.iKey, event.iStatus );
+                    
+                iObserver->TransferCompleted( event.iKey - 1,
+                    event.iStatus, KNullDesC );
+                }                  
+            break;
+            }
+            
+        case TUpnpFileTransferEvent::ETransferProgress:
+            {
+            if( iObserver )
+                {
+                __LOG1( "RunL - ETransferProgress, status = %d",
+                    event.iStatus );
+                    
+                iObserver->TransferProgress( event.iKey - 1,
+                    event.iParam1, event.iParam2 );
+                }                  
+            break;
+            }
+
+        case TUpnpFileTransferEvent::EDeviceDisconnected:
+            {
+            __LOG( "RunL - EDeviceDisconnected" );
+
+            CUpnpAVDevice* tmpDev = NULL;
+            UPnPDeviceDisappeared( *tmpDev );
+            }
+            break;
+            
+        default:
+            {
+            __LOG( "RunL - default!" ); 
+            break;     
+            }
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::ConstructL
+// See upnpfileuploadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::StartUploadL( const TDesC& aFilePath,
+    TInt aKey )
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::StartUploadL" );
+    
+    ResetL();
+
+    CUpnpFileTransferItem* item = CUpnpFileTransferItem::NewLC();
+    // aKey + 1 
+    // the reason behind of this is the fact that httptransfer
+    // does not accept value 0 which is legal from the API point
+    // of view.
+    item->SetKey( aKey + 1 );
+    item->SetPathL( aFilePath );   
+
+    iBuffer = item->ToDes8L();
+    iBufferPtr.Set( iBuffer->Des() );
+    
+    CleanupStack::PopAndDestroy( item );
+    
+    User::LeaveIfError( iServer.StartUpload( (TInt)this, iBufferPtr ) );    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::DoCancel
+// From CActive
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::DoCancel()
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::DoCancel" );
+    
+    iServer.CancelUploadEvent( (TInt)this );
+    
+    __LOG( "CUPnPFileUploadSessionImpl::DoCancel - end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::RunError
+// From CActive
+// --------------------------------------------------------------------------
+TInt CUPnPFileUploadSessionImpl::RunError( TInt /*aError*/ )
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::RunError" );
+    
+    return KErrNone;
+    }
+
+   
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::SetObserver
+// See upnpfileuploadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::SetObserver(
+    MUPnPFileTransferSessionObserver& aObserver )
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::SetObserver" );
+    
+    iObserver = &aObserver;
+    }
+     
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::RemoveObserver
+// See upnpfileuploadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::RemoveObserver()
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::RemoveObserver" );
+    
+    iObserver = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::Observer
+// See upnpfileuploadsessionimpl.h
+// --------------------------------------------------------------------------
+MUPnPFileTransferSessionObserver*
+    CUPnPFileUploadSessionImpl::Observer() const
+    {
+    return iObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::StartTrackingProgressL
+// See upnpfileuploadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::StartTrackingProgressL( TInt aKey )
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::StartTrackingProgressL" );
+    
+    ResetL();
+    User::LeaveIfError( iServer.StartTrackingUploadProgress(
+        (TInt)this, aKey + 1 ) );    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::CancelTransfer
+// See upnpfileuploadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::CancelTransfer( TInt aKey )
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::CancelTransfer" );
+    
+    iServer.CancelUpload( (TInt)this, aKey + 1 ); // Ignore error
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::CancelAllTransfers
+// See upnpfileuploadsessionimpl.h
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::CancelAllTransfers()
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::CancelAllTransfers" );
+    
+    iServer.CancelAllUploads( (TInt)this ); // Ignore error
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::UPnPDeviceDiscovered
+// Device discovered
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::UPnPDeviceDiscovered(
+    const CUpnpAVDevice& /*aDevice*/ )
+    {
+    // No implementation needed
+    }
+
+  
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::UPnPDeviceDisappeared
+// Device disappeared
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::UPnPDeviceDisappeared(
+    const CUpnpAVDevice& /*aDevice*/ )
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::UPnPDeviceDisappeared" );
+    
+    iAlive = EFalse;
+    if( iObserver )
+        {
+        iObserver->MediaServerDisappeared( 
+            MUPnPAVSessionObserverBase::EDisconnected );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::WLANConnectionLost
+// Connection lost
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::WLANConnectionLost()
+    {
+    __LOG( "CUPnPAVBrowsingSessionImpl::WLANConnectionLost" );
+    
+    iAlive = EFalse;
+    if( iObserver )    
+        {
+        iObserver->MediaServerDisappeared( 
+            MUPnPAVSessionObserverBase::EWLANLost );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::Device
+// Returns used device
+// --------------------------------------------------------------------------
+const CUpnpAVDevice& CUPnPFileUploadSessionImpl::Device() const
+    {
+    return *iDevice;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileUploadSessionImpl::ResetL
+// Reset
+// --------------------------------------------------------------------------
+void CUPnPFileUploadSessionImpl::ResetL()
+    {
+    __LOG( "CUPnPFileUploadSessionImpl::ResetL" );
+    
+    if( !iAlive )
+        {
+        User::Leave( KErrDisconnected );
+        }
+
+    delete iBuffer; iBuffer = NULL;
+    }    
+
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/bwins/upnpavcontrollerhelperu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,36 @@
+EXPORTS
+	??0CUPnPAbstractBrowsingSessionObserver@@QAE@XZ @ 1 NONAME ; CUPnPAbstractBrowsingSessionObserver::CUPnPAbstractBrowsingSessionObserver(void)
+	??0CUPnPAbstractRenderingSessionObserver@@QAE@XZ @ 2 NONAME ; CUPnPAbstractRenderingSessionObserver::CUPnPAbstractRenderingSessionObserver(void)
+	??1CUPnPAbstractBrowsingSessionObserver@@UAE@XZ @ 3 NONAME ; CUPnPAbstractBrowsingSessionObserver::~CUPnPAbstractBrowsingSessionObserver(void)
+	??1CUPnPAbstractRenderingSessionObserver@@UAE@XZ @ 4 NONAME ; CUPnPAbstractRenderingSessionObserver::~CUPnPAbstractRenderingSessionObserver(void)
+	?BelongsToClass@UPnPItemUtility@@SAHABVCUpnpObject@@ABVTDesC8@@@Z @ 5 NONAME ; int UPnPItemUtility::BelongsToClass(class CUpnpObject const &, class TDesC8 const &)
+	?DisableSessionObserver@CUPnPAbstractBrowsingSessionObserver@@QAEXXZ @ 6 NONAME ; void CUPnPAbstractBrowsingSessionObserver::DisableSessionObserver(void)
+	?DisableSessionObserver@CUPnPAbstractRenderingSessionObserver@@QAEXXZ @ 7 NONAME ; void CUPnPAbstractRenderingSessionObserver::DisableSessionObserver(void)
+	?EnableSessionObserver@CUPnPAbstractBrowsingSessionObserver@@QAEXXZ @ 8 NONAME ; void CUPnPAbstractBrowsingSessionObserver::EnableSessionObserver(void)
+	?EnableSessionObserver@CUPnPAbstractRenderingSessionObserver@@QAEXXZ @ 9 NONAME ; void CUPnPAbstractRenderingSessionObserver::EnableSessionObserver(void)
+	?FindAttributeByName@UPnPItemUtility@@SAPBVCUpnpAttribute@@ABVCUpnpElement@@ABVTDesC8@@@Z @ 10 NONAME ; class CUpnpAttribute const * UPnPItemUtility::FindAttributeByName(class CUpnpElement const &, class TDesC8 const &)
+	?FindAttributeByNameL@UPnPItemUtility@@SAABVCUpnpAttribute@@ABVCUpnpElement@@ABVTDesC8@@@Z @ 11 NONAME ; class CUpnpAttribute const & UPnPItemUtility::FindAttributeByNameL(class CUpnpElement const &, class TDesC8 const &)
+	?FindElementByName@UPnPItemUtility@@SAPBVCUpnpElement@@ABVCUpnpObject@@ABVTDesC8@@@Z @ 12 NONAME ; class CUpnpElement const * UPnPItemUtility::FindElementByName(class CUpnpObject const &, class TDesC8 const &)
+	?FindElementByNameL@UPnPItemUtility@@SAABVCUpnpElement@@ABVCUpnpObject@@ABVTDesC8@@@Z @ 13 NONAME ; class CUpnpElement const & UPnPItemUtility::FindElementByNameL(class CUpnpObject const &, class TDesC8 const &)
+	?FitsInMemory@UPnPFileUtility@@SAHABVCUpnpElement@@@Z @ 14 NONAME ; int UPnPFileUtility::FitsInMemory(class CUpnpElement const &)
+	?GetResElements@UPnPItemUtility@@SAXABVCUpnpObject@@AAV?$RPointerArray@VCUpnpElement@@@@@Z @ 15 NONAME ; void UPnPItemUtility::GetResElements(class CUpnpObject const &, class RPointerArray<class CUpnpElement> &)
+	?GetSupportedProfilesL@UPnPDlnaUtility@@SAAAVCDesC8Array@@W4TDlnaMode@1@@Z @ 16 NONAME ; class CDesC8Array & UPnPDlnaUtility::GetSupportedProfilesL(enum UPnPDlnaUtility::TDlnaMode)
+	?IsFileProtectedL@UPnPFileUtility@@SAHABVTDesC16@@@Z @ 17 NONAME ; int UPnPFileUtility::IsFileProtectedL(class TDesC16 const &)
+	?IsSessionObserverEnabled@CUPnPAbstractBrowsingSessionObserver@@QAEHXZ @ 18 NONAME ; int CUPnPAbstractBrowsingSessionObserver::IsSessionObserverEnabled(void)
+	?IsSessionObserverEnabled@CUPnPAbstractRenderingSessionObserver@@QAEHXZ @ 19 NONAME ; int CUPnPAbstractRenderingSessionObserver::IsSessionObserverEnabled(void)
+	?IsSupportedDlnaProfile@UPnPDlnaUtility@@SAHABVTDesC8@@@Z @ 20 NONAME ; int UPnPDlnaUtility::IsSupportedDlnaProfile(class TDesC8 const &)
+	?IsSupportedMimeType@UPnPDlnaUtility@@SAHABVTDesC8@@@Z @ 21 NONAME ; int UPnPDlnaUtility::IsSupportedMimeType(class TDesC8 const &)
+	?NewDownloadItemResolverL@UPnPItemResolverFactory@@SAPAVMUPnPItemResolver@@ABVTDesC8@@AAVMUPnPAVController@@AAVMUPnPAVBrowsingSession@@AAVMUPnPResourceSelector@@0H@Z @ 22 NONAME ; class MUPnPItemResolver * UPnPItemResolverFactory::NewDownloadItemResolverL(class TDesC8 const &, class MUPnPAVController &, class MUPnPAVBrowsingSession &, class MUPnPResourceSelector &, class TDesC8 const &, int)
+	?NewLocalItemResolverL@UPnPItemResolverFactory@@SAPAVMUPnPItemResolver@@ABVTDesC16@@AAVMUPnPAVController@@AAVMUPnPResourceSelector@@H@Z @ 23 NONAME ; class MUPnPItemResolver * UPnPItemResolverFactory::NewLocalItemResolverL(class TDesC16 const &, class MUPnPAVController &, class MUPnPResourceSelector &, int)
+	?NewRemoteItemResolverL@UPnPItemResolverFactory@@SAPAVMUPnPItemResolver@@ABVTDesC8@@AAVMUPnPAVBrowsingSession@@AAVMUPnPResourceSelector@@0H@Z @ 24 NONAME ; class MUPnPItemResolver * UPnPItemResolverFactory::NewRemoteItemResolverL(class TDesC8 const &, class MUPnPAVBrowsingSession &, class MUPnPResourceSelector &, class TDesC8 const &, int)
+	?ResourceFromItemL@UPnPItemUtility@@SAABVCUpnpElement@@ABVCUpnpItem@@@Z @ 25 NONAME ; class CUpnpElement const & UPnPItemUtility::ResourceFromItemL(class CUpnpItem const &)
+	?SelectResourceL@TUPnPSelectDefaultResource@@UAEABVCUpnpElement@@ABVCUpnpItem@@@Z @ 26 NONAME ; class CUpnpElement const & TUPnPSelectDefaultResource::SelectResourceL(class CUpnpItem const &)
+	?SelectResourceL@TUPnPSelectFirstResource@@UAEABVCUpnpElement@@ABVCUpnpItem@@@Z @ 27 NONAME ; class CUpnpElement const & TUPnPSelectFirstResource::SelectResourceL(class CUpnpItem const &)
+	?SetSession@CUPnPAbstractBrowsingSessionObserver@@QAEXAAVMUPnPAVBrowsingSession@@@Z @ 28 NONAME ; void CUPnPAbstractBrowsingSessionObserver::SetSession(class MUPnPAVBrowsingSession &)
+	?SetSession@CUPnPAbstractRenderingSessionObserver@@QAEXAAVMUPnPAVRenderingSession@@@Z @ 29 NONAME ; void CUPnPAbstractRenderingSessionObserver::SetSession(class MUPnPAVRenderingSession &)
+	?UPnPDateAsTTime@UPnPItemUtility@@SAHABVTDesC8@@AAVTTime@@@Z @ 30 NONAME ; int UPnPItemUtility::UPnPDateAsTTime(class TDesC8 const &, class TTime &)
+	?UPnPDurationAsMilliseconds@UPnPItemUtility@@SAHABVTDesC8@@AAH@Z @ 31 NONAME ; int UPnPItemUtility::UPnPDurationAsMilliseconds(class TDesC8 const &, int &)
+	?DeleteTempDownloadFilesL@CUPnPDownloadItemResolver@@SAXXZ @ 32 NONAME ; void CUPnPDownloadItemResolver::DeleteTempDownloadFilesL(void)
+	?CreateTmpFileNameL@UPnPInternalFileUtility@@SAPAVHBufC16@@ABVCUpnpItem@@@Z @ 33 NONAME ; class HBufC16 * UPnPInternalFileUtility::CreateTmpFileNameL(class CUpnpItem const &)
+	?GetSelectedDownloadLocationL@UPnPInternalFileUtility@@SAPAVHBufC16@@XZ @ 34 NONAME ; class HBufC16 * UPnPInternalFileUtility::GetSelectedDownloadLocationL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/eabi/upnpavcontrollerhelperu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,56 @@
+EXPORTS
+	_ZN15UPnPDlnaUtility19IsSupportedMimeTypeERK6TDesC8 @ 1 NONAME
+	_ZN15UPnPDlnaUtility21GetSupportedProfilesLENS_9TDlnaModeE @ 2 NONAME
+	_ZN15UPnPDlnaUtility22IsSupportedDlnaProfileERK6TDesC8 @ 3 NONAME
+	_ZN15UPnPFileUtility12FitsInMemoryERK12CUpnpElement @ 4 NONAME
+	_ZN15UPnPFileUtility16IsFileProtectedLERK7TDesC16 @ 5 NONAME
+	_ZN15UPnPItemUtility14BelongsToClassERK11CUpnpObjectRK6TDesC8 @ 6 NONAME
+	_ZN15UPnPItemUtility14GetResElementsERK11CUpnpObjectR13RPointerArrayI12CUpnpElementE @ 7 NONAME
+	_ZN15UPnPItemUtility15UPnPDateAsTTimeERK6TDesC8R5TTime @ 8 NONAME
+	_ZN15UPnPItemUtility17FindElementByNameERK11CUpnpObjectRK6TDesC8 @ 9 NONAME
+	_ZN15UPnPItemUtility17ResourceFromItemLERK9CUpnpItem @ 10 NONAME
+	_ZN15UPnPItemUtility18FindElementByNameLERK11CUpnpObjectRK6TDesC8 @ 11 NONAME
+	_ZN15UPnPItemUtility19FindAttributeByNameERK12CUpnpElementRK6TDesC8 @ 12 NONAME
+	_ZN15UPnPItemUtility20FindAttributeByNameLERK12CUpnpElementRK6TDesC8 @ 13 NONAME
+	_ZN15UPnPItemUtility26UPnPDurationAsMillisecondsERK6TDesC8Ri @ 14 NONAME
+	_ZN23UPnPItemResolverFactory21NewLocalItemResolverLERK7TDesC16R17MUPnPAVControllerR21MUPnPResourceSelectori @ 15 NONAME
+	_ZN23UPnPItemResolverFactory22NewRemoteItemResolverLERK6TDesC8R22MUPnPAVBrowsingSessionR21MUPnPResourceSelectorS2_i @ 16 NONAME
+	_ZN23UPnPItemResolverFactory24NewDownloadItemResolverLERK6TDesC8R17MUPnPAVControllerR22MUPnPAVBrowsingSessionR21MUPnPResourceSelectorS2_i @ 17 NONAME
+	_ZN24TUPnPSelectFirstResource15SelectResourceLERK9CUpnpItem @ 18 NONAME
+	_ZN26TUPnPSelectDefaultResource15SelectResourceLERK9CUpnpItem @ 19 NONAME
+	_ZN36CUPnPAbstractBrowsingSessionObserver10SetSessionER22MUPnPAVBrowsingSession @ 20 NONAME
+	_ZN36CUPnPAbstractBrowsingSessionObserver21EnableSessionObserverEv @ 21 NONAME
+	_ZN36CUPnPAbstractBrowsingSessionObserver22DisableSessionObserverEv @ 22 NONAME
+	_ZN36CUPnPAbstractBrowsingSessionObserver24IsSessionObserverEnabledEv @ 23 NONAME
+	_ZN36CUPnPAbstractBrowsingSessionObserverC1Ev @ 24 NONAME
+	_ZN36CUPnPAbstractBrowsingSessionObserverC2Ev @ 25 NONAME
+	_ZN36CUPnPAbstractBrowsingSessionObserverD0Ev @ 26 NONAME
+	_ZN36CUPnPAbstractBrowsingSessionObserverD1Ev @ 27 NONAME
+	_ZN36CUPnPAbstractBrowsingSessionObserverD2Ev @ 28 NONAME
+	_ZN37CUPnPAbstractRenderingSessionObserver10SetSessionER23MUPnPAVRenderingSession @ 29 NONAME
+	_ZN37CUPnPAbstractRenderingSessionObserver21EnableSessionObserverEv @ 30 NONAME
+	_ZN37CUPnPAbstractRenderingSessionObserver22DisableSessionObserverEv @ 31 NONAME
+	_ZN37CUPnPAbstractRenderingSessionObserver24IsSessionObserverEnabledEv @ 32 NONAME
+	_ZN37CUPnPAbstractRenderingSessionObserverC1Ev @ 33 NONAME
+	_ZN37CUPnPAbstractRenderingSessionObserverC2Ev @ 34 NONAME
+	_ZN37CUPnPAbstractRenderingSessionObserverD0Ev @ 35 NONAME
+	_ZN37CUPnPAbstractRenderingSessionObserverD1Ev @ 36 NONAME
+	_ZN37CUPnPAbstractRenderingSessionObserverD2Ev @ 37 NONAME
+	_ZTI22CUPnPLocalItemResolver @ 38 NONAME ; #<TI>#
+	_ZTI23CUPnPRemoteItemResolver @ 39 NONAME ; #<TI>#
+	_ZTI24TUPnPSelectFirstResource @ 40 NONAME ; #<TI>#
+	_ZTI25CUPnPDownloadItemResolver @ 41 NONAME ; #<TI>#
+	_ZTI26TUPnPSelectDefaultResource @ 42 NONAME ; #<TI>#
+	_ZTI36CUPnPAbstractBrowsingSessionObserver @ 43 NONAME ; #<TI>#
+	_ZTI37CUPnPAbstractRenderingSessionObserver @ 44 NONAME ; #<TI>#
+	_ZTV22CUPnPLocalItemResolver @ 45 NONAME ; #<VT>#
+	_ZTV23CUPnPRemoteItemResolver @ 46 NONAME ; #<VT>#
+	_ZTV24TUPnPSelectFirstResource @ 47 NONAME ; #<VT>#
+	_ZTV25CUPnPDownloadItemResolver @ 48 NONAME ; #<VT>#
+	_ZTV26TUPnPSelectDefaultResource @ 49 NONAME ; #<VT>#
+	_ZTV36CUPnPAbstractBrowsingSessionObserver @ 50 NONAME ; #<VT>#
+	_ZTV37CUPnPAbstractRenderingSessionObserver @ 51 NONAME ; #<VT>#
+	_ZN25CUPnPDownloadItemResolver24DeleteTempDownloadFilesLEv @ 52 NONAME
+	_ZN23UPnPInternalFileUtility18CreateTmpFileNameLERK9CUpnpItem @ 53 NONAME
+	_ZN23UPnPInternalFileUtility28GetSelectedDownloadLocationLEv @ 54 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for AVController helper library
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+// ADO internal interfaces
+../inc/upnpitemutility.h                    |../../../inc/upnpitemutility.h
+../inc/upnpfileutility.h                    |../../../inc/upnpfileutility.h
+../inc/upnpdlnautility.h                    |../../../inc/upnpdlnautility.h
+../inc/upnpitemresolver.h                   |../../../inc/upnpitemresolver.h
+../inc/upnpitemresolverfactory.h            |../../../inc/upnpitemresolverfactory.h
+../inc/upnpitemresolverobserver.h           |../../../inc/upnpitemresolverobserver.h
+../inc/upnpdownloaditemresolver.h           |../../../inc/upnpdownloaditemresolver.h
+../inc/upnpresourceselector.h               |../../../inc/upnpresourceselector.h
+../inc/upnpconstantdefs.h                   |../../../inc/upnpconstantdefs.h
+../inc/upnpinternalfileutility.h            |../../../inc/upnpinternalfileutility.h
+
+PRJ_MMPFILES
+upnpavcontrollerhelper.mmp
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/group/upnpavcontrollerhelper.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      project file for AVController helper library
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET          upnpavcontrollerhelper.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x20009CA8
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION         10.1
+paged
+
+SOURCEPATH      ../src 
+SOURCE          upnpitemutility.cpp
+SOURCE          upnpfileutility.cpp
+SOURCE          upnpdlnautility.cpp
+SOURCE          upnpitemresolverfactory.cpp
+SOURCE          upnpremoteitemresolver.cpp
+SOURCE          upnplocalitemresolver.cpp
+SOURCE          upnpdownloaditemresolver.cpp
+SOURCE          upnpresourceselector.cpp
+SOURCE          upnpabstractbrowsingsessionobserver.cpp
+SOURCE          upnpabstractrenderingsessionobserver.cpp
+SOURCE          upnpinternalfileutility.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+MW_LAYER_SYSTEMINCLUDE 
+USERINCLUDE   ../../../inc
+
+// system
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         bafl.lib
+LIBRARY         drmcommon.lib  // OEM-DRM
+LIBRARY         caf.lib // WM-DRM
+LIBRARY         cafutils.lib // WM-DRM
+LIBRARY         efsrv.lib // RFs
+LIBRARY         PlatformEnv.lib // PathInfo
+LIBRARY         insock.lib // TInetAddr
+
+// S60 upnp stack
+LIBRARY         upnpavobjects.lib // CUpnpObject, ...
+LIBRARY         upnpipserversutils.lib // CUpnpDlnaProtocolInfo
+LIBRARY         avmediaserverclient.lib // file sharing
+
+// other upnp components
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         upnpxmlparser.lib // browse response
+LIBRARY         upnputilities.lib // CreateItemFromFileLC
+LIBRARY         upnpsettingsengine.lib // SettingsEngine
+LIBRARY         upnpsecurity.lib // SecAccessController
+
+// debug
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpabstractbrowsingsessionobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      An abstract browsing session observer implementation
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPABSTRACTBROWSINGSESSIONOBSERVER_H
+#define UPNPABSTRACTBROWSINGSESSIONOBSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavbrowsingsessionobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class MUPnPAVBrowsingSession;
+
+// CLASS DECLARATION
+
+/**
+* An abstract class for implementing a browsing session observer.
+* This class is purposed as a base class for imnplementing a
+* browsing observer. There are 2 main use cases:
+* 1. reducing implementation code so that the actual observer will
+*    only need to write the observer methods that are really used.
+* 2. implementing an observer proxy that will attach itself to a session
+*    and just handle some of the callbacks and forward a majority of the
+*    callbacks the original session observer.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class CUPnPAbstractBrowsingSessionObserver
+    : public CBase
+    , public MUPnPAVBrowsingSessionObserver
+    {
+
+public: // construction/destruction
+
+    /**
+     * default constructor.
+     */
+    IMPORT_C CUPnPAbstractBrowsingSessionObserver();
+
+    /**
+     * destructor
+     */
+    IMPORT_C virtual ~CUPnPAbstractBrowsingSessionObserver();
+
+
+public: // the abstract observer interface
+
+    /**
+     * Sets the host session for the observer. This is the session where
+     * the observer will register for callbacks. If the session already
+     * has an observer, it will become the proxy observer. The default
+     * implementatin for all observer methods is to forward the method to
+     * the observer, if it exists.
+     *
+     * @since S60 3.2
+     * @param aHostSession, browsing session
+     */
+    IMPORT_C void SetSession( MUPnPAVBrowsingSession& aHostSession );
+
+    /**
+     * Enables receiving callbacks. When enabled, the abstract observer
+     * registers to the given session and thus starts receiving callbacks.
+     * Note that only those callbacks that are overwritten in the derived
+     * class will actually provide some value. Other will be either processed
+     * in an empty method, or forwarded to the observer that previously was
+     * registered as an observer (proxy mode)
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C void EnableSessionObserver();
+
+    /**
+     * Disables receiving session callbacks. The observer interface is
+     * deregistered, and if before observer registration there was an 
+     * original observer interface (proxy mode) the original observer
+     * is restored.
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C void DisableSessionObserver();
+
+    /**
+     * Returns true if the observer is active (registered for events)
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C TBool IsSessionObserverEnabled();
+
+public: // MUPnPAVBrowsingSessionObserver
+
+    /**
+     * see MUPnPAVBrowsingSessionObserver
+     */
+    void BrowseResponse(
+        const TDesC8& aBrowseResponse,
+        TInt aError,
+        TInt aMatches,
+        TInt aTotalCount,
+        const TDesC8& aUpdateId );
+
+    /**
+     * see MUPnPAVBrowsingSessionObserver
+     */
+    void SearchResponse( 
+        const TDesC8& aSearchResponse,
+        TInt aError,
+        TInt aMatches,
+        TInt aTotalCount,
+        const TDesC8& aUpdateId );
+
+    /**
+     * see MUPnPAVBrowsingSessionObserver
+     */
+    void SearchCapabilitiesResponse( 
+        TInt aError,
+        const TDesC8& aSearchCapabilities );
+
+    /**
+     * see MUPnPAVBrowsingSessionObserver
+     */
+    void CreateContainerResponse( TInt aError, 
+        const TDesC8& aObjectId );
+
+    /**
+     * see MUPnPAVBrowsingSessionObserver
+     */
+    void DeleteObjectResponse( TInt aError );
+
+    /**
+     * see MUPnPAVBrowsingSessionObserver
+     */
+    void ReserveLocalMSServicesCompleted( TInt aError );
+
+    /**
+     * see MUPnPAVBrowsingSessionObserver
+     */
+    void MediaServerDisappeared(
+        TUPnPDeviceDisconnectedReason aReason );
+
+
+private: // members
+
+    // the host browsing session. Note: NOT OWNED!
+    MUPnPAVBrowsingSession* iObservedSession;
+
+    // The proxy observer. Note: NOT OWNED!
+    MUPnPAVBrowsingSessionObserver* iProxyObserver;
+
+    // if observer is enabled
+    TBool iObserverEnabled;
+
+    };
+
+
+#endif  // UPNPABSTRACTBROWSINGSESSIONOBSERVER_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpabstractrenderingsessionobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      An abstract proxy for a rendering session observer
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPABSTRACTRENDERINGSESSIONOBSERVER_H
+#define UPNPABSTRACTRENDERINGSESSIONOBSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavrenderingsessionobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class MUPnPAVRenderingSession;
+
+// CLASS DECLARATION
+
+/**
+* An abstract class for implementing a rendering session observer.
+* This class is purposed as a base class for imnplementing a
+* rendering session observer. There are 2 main use cases:
+* 1. reducing implementation code so that the actual observer will
+*    only need to write the observer methods that are really used.
+* 2. implementing an observer proxy that will attach itself to a session
+*    and just handle some of the callbacks and forward a majority of the
+*    callbacks the original session observer.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class CUPnPAbstractRenderingSessionObserver
+    : public CBase
+    , public MUPnPAVRenderingSessionObserver
+    {
+
+public: // construction/destruction
+
+    /**
+     * default constructor.
+     */
+    IMPORT_C CUPnPAbstractRenderingSessionObserver();
+
+    /**
+     * destructor
+     */
+    IMPORT_C virtual ~CUPnPAbstractRenderingSessionObserver();
+
+
+public: // the abstract observer interface
+
+    /**
+     * Sets the host session for the observer. This is the session where
+     * the observer will register for callbacks. If the session already
+     * has an observer, it will become the proxy observer. The default
+     * implementatin for all observer methods is to forward the method to
+     * the observer, if it exists.
+     *
+     * @since S60 3.2
+     * @param aHostSession, rendering session
+     */
+    IMPORT_C void SetSession( MUPnPAVRenderingSession& aHostSession );
+
+    /**
+     * Enables receiving callbacks. When enabled, the abstract observer
+     * registers to the given session and thus starts receiving callbacks.
+     * Note that only those callbacks that are overwritten in the derived
+     * class will actually provide some value. Other will be either processed
+     * in an empty method, or forwarded to the observer that previously was
+     * registered as an observer (proxy mode)
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C void EnableSessionObserver();
+
+    /**
+     * Disables receiving session callbacks. The observer interface is
+     * deregistered, and if before observer registration there was an 
+     * original observer interface (proxy mode) the original observer
+     * is restored.
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C void DisableSessionObserver();
+
+    /**
+     * Returns true if the observer is active (registered for events)
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C TBool IsSessionObserverEnabled();
+
+public: // MUPnPAVRenderingSessionObserver
+
+    /**
+     * see MUPnPAVRenderingSessionObserver
+     */
+    void VolumeResult( TInt aError, TInt aVolumeLevel,
+        TBool aActionResponse );
+
+    /**
+     * see MUPnPAVRenderingSessionObserver
+     */
+    void MuteResult( TInt aError, TBool aMute,
+        TBool aActionResponse );
+
+    /**
+     * see MUPnPAVRenderingSessionObserver
+     */
+    void InteractOperationComplete( TInt aError,
+        TUPnPAVInteractOperation aOperation );
+
+    /**
+     * see MUPnPAVRenderingSessionObserver
+     */
+    void PositionInfoResult( TInt aError,
+        const TDesC8& aTrackPosition, const TDesC8& aTrackLength );
+
+    /**
+     * see MUPnPAVRenderingSessionObserver
+     */
+    void SetURIResult( TInt aError );
+
+    /**
+     * see MUPnPAVRenderingSessionObserver
+     */
+    void SetNextURIResult( TInt aError );
+
+    /**
+     * see MUPnPAVRenderingSessionObserver
+     */
+    void MediaRendererDisappeared(
+        TUPnPDeviceDisconnectedReason aReason );
+
+    /**
+     * see MUPnPAVRenderingSessionObserver
+     */
+    void ReserveLocalMSServicesCompleted( TInt aError );
+
+
+private: // members
+
+    // the host rendering session. Note: NOT OWNED!
+    MUPnPAVRenderingSession* iObservedSession;
+
+    // The proxy observer. Note: NOT OWNED!
+    MUPnPAVRenderingSessionObserver* iProxyObserver;
+
+    // if observer is enabled
+    TBool iObserverEnabled;
+
+    };
+
+
+#endif  // UPNPABSTRACTRENDERINGSESSIONOBSERVER_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpconstantdefs.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,321 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      UPnP Object-related constant definitions
+*
+*/
+
+
+
+
+
+
+// System includes
+#include <e32base.h>
+
+// ***************************************************
+// * Upnp interface is full of constants that come
+// * directly from upnp specifications. This file
+// * contains some most commonly used definitions
+// * for your comfort.
+// ***************************************************
+
+
+
+// ***************************************************
+// * Classes
+// * 
+// * Note: when comparing object class, the class
+// * constant MUST be found in beginning:
+// * 
+// * if ( object.ObjectClass().Find( KClassContainer ) == 0 )
+// *     { ...
+// * 
+// * 
+// ***************************************************
+
+// item. This means the object represents something
+// rather than containing child objects
+_LIT8( KClassItem,        "object.item" );
+
+// the item represents an image media
+_LIT8( KClassImage,       "object.item.imageItem" );
+
+// the item represents a video media
+_LIT8( KClassVideo,       "object.item.videoItem" );
+
+// the item represents an audio media
+_LIT8( KClassAudio,       "object.item.audioItem" );
+
+// the item represents a music track
+_LIT8( KClassAudioMusicTrack, "object.item.audioItem.musicTrack" );
+
+// the object is a container that can contain child objects
+_LIT8( KClassContainer,   "object.container" );
+
+// container that represents a playlist
+_LIT8( KClassPlaylist,    "object.container.playlistContainer" );
+
+// container that represents an album of music tracks
+_LIT8( KClassAlbum,       "object.container.album.musicAlbum" );
+
+// container that represents a generic media storage
+_LIT8( KClassStorage,    "object.container.storageFolder" );
+
+
+
+// ***************************************************
+// * Elements
+// * 
+// * Use these when finding an apropriate element
+// * within an object. Useful with 2 helper utility
+// * functions:
+// * 
+// * const CUpnpElement* e = UPnPCommonUtils::
+// *     FindElementByName( object, KElementDate );
+// * if ( e ) {
+// *     const TDesC& d = e->Value();
+// *     ...
+// * 
+// * const TDesC8& d = UPnPCommonUtils::
+// *     FindElementByNameL( object, KElementDate ).Value();
+// * 
+// * The former is useful if we are not sure if the
+// * element exists, the latter if the element MUST
+// * exist to proceed.
+// * 
+// ***************************************************
+
+// The title. Mandatory for all objects.
+_LIT8( KElementTitle,           "dc:title" );
+
+// The class. Mandatory for all objects.
+_LIT8( KElementClass,           "upnp:class" );
+
+// media timestamp. In DLNA mandatory for images and videos
+_LIT8( KElementDate,            "dc:date" );
+
+// Creator of the media. In DLNA mandatory for music tracks and albums
+_LIT8( KElementCreator,         "dc:creator" );
+
+// The artist. De facto standard in upnp, but not mandatory.
+// could be understood as an alias to dc:creator
+_LIT8( KElementArtist,          "upnp:artist");
+
+// Album this media belongs to. in DLNA mandatory for audio tracks
+_LIT8( KElementAlbum,           "upnp:album");
+
+// Genre. in DLNA mandatory for audio and video
+_LIT8( KElementGenre,           "upnp:genre");
+
+// The res element. Defines the resource of the item.
+_LIT8( KElementRes,             "res");
+
+// The SortCriteria, Search by default 
+_LIT8( KSortCriteria,           "+dc:title");
+
+// The albumArtURI
+_LIT8( KElementAlbumArtUri,     "upnp:albumArtURI");
+
+// Song track number
+_LIT8( KElementTrackNumber,     "upnp:originalTrackNumber");
+
+
+// ***************************************************
+// * Element attributes
+// * 
+// * Use these when finding an attribute within an
+// * element.
+// * 
+// * const CUpnpElement& resource = UPnPCommonUtils
+// *     ::ResourceFromItemL( object );
+// * const TDesC8& size = UPnPCommonUtils
+// *     ::FindAttributeByNameL( resource, KAttributeSize )
+// *     .Value();
+// * const TDesC8& duration = UPnPCommonUtils
+// *     ::FindAttributeByNameL( resource, KAttributeDuration )
+// *     .Value();
+// * 
+// ***************************************************
+
+// attribute of RES element
+// media size in bytes. Used for all media.
+_LIT8( KAttributeSize,         "size" );
+
+// attribute of RES element
+// image resolution: "<XDIM>x<YDIM>", example "1024x768"
+// used for images and video.
+_LIT8( KAttributeResolution,   "resolution" );
+
+// attribute of RES element
+// song duration, "hh:mm:ss.yyy", example "00:03:15.000"
+// used for audio and video
+_LIT8( KAttributeDuration,     "duration" );
+
+// attribute of RES element
+// UPNP and DLNA specific technical data
+_LIT8( KAttributeProtocolInfo, "protocolInfo" );
+
+// attribute of RES element
+// bitrate. used in
+_LIT8( KAttributeBitrate,      "bitrate" );
+
+
+
+// ***************************************************
+// * Filters and sorting
+// * 
+// * Pre-defined constants for browse or search.
+// * The filters determine which elements the remote
+// * server is adding into the response. Querying
+// * only the required elements will speed up the
+// * application.
+// *
+// * Sort criteria defines the order of returned
+// * elements.
+// * 
+// * iBs->BrowseL( _L("0"), KFilterFull,
+// *     MUPnPAVBrowsingSession::EDirectChildren,
+// *     0, 100, KSortNone );
+// * 
+// ***************************************************
+
+// full filter, returns everything
+_LIT8( KFilterFull, "*" );
+
+// filter only minimum data (object id)
+_LIT8( KFilterMin, "" );
+
+// filter only object key data and title
+_LIT8( KFilterTitle, "dc:title" );
+
+// Filter most commonly used and mandatory DLNA field
+_LIT8( KFilterCommon, "dc:title,dc:date,dc:creator,"
+    "upnp:originalTrackNumber,"
+    "upnp:album,upnp:artist,upnp:genre,upnp:albumArtURI,"
+    "res,res@size,res@duration" );
+
+// sort criteria: let server decide
+_LIT8( KSortNone, "" );
+
+// sort criteria: sort by object title
+_LIT8( KSortTitle, "dc:title" );
+
+
+
+
+// ***************************************************
+// * Constant container ID's
+// * 
+// * Some container ID's are defined as constants
+// * and have special meaning.
+// *
+// * Root container: the container that recursively
+// * contains all other containers. This container
+// * is not contained in any other container.
+// * 
+// * Any container: used when addressing a remote
+// * container. Lets the remote mediaserver decide
+// * an apropriate container.
+// * 
+// ***************************************************
+
+// the root container
+_LIT8( KContainerIdRoot, "0" );
+
+// Anycontainer
+_LIT8( KContainerIdAny,  "DLNA.ORG_AnyContainer" );
+
+
+
+// ***************************************************
+// * Constructing search criteria
+// * 
+// * Some useful constants that are used in generating
+// * search criteria fields
+// * 
+// * Please see UPnP specifications for more details
+// * 
+// ***************************************************
+
+// searches for elements that contain given partial string
+_LIT8( KCriteriaContains, "contains" );
+
+// searches for classes or any child classes of given class
+_LIT8( KCriteriaDerivedFrom, "derivedfrom" );
+
+// searches for classes where an element exists
+_LIT8( KCriteriaExists, "exists" );
+
+// negates the boolean operator
+_LIT8( KCriteriaFalse, "false" );
+
+// logical AND
+_LIT8( KCriteriaAnd, "and" );
+
+// logical OR
+_LIT8( KCriteriaOr, "or" );
+
+// logical comparision
+_LIT8( KCriteriaEQ, "=" );
+_LIT8( KCriteriaNEQ, "!=" );
+_LIT8( KCriteriaGT, ">" );
+_LIT8( KCriteriaLT, "<" );
+_LIT8( KCriteriaGTE, ">=" );
+_LIT8( KCriteriaLTE, "<=" );
+_LIT8( KCriteriaOB, "(" );
+_LIT8( KCriteriaCB, ")" );
+
+// other useful for filling up the strings
+_LIT8( KCriteriaQuot, "\"" );
+_LIT8( KCriteriaSpace, " " );
+
+
+
+// ***************************************************
+// * DLNA Transfer modes
+// * 
+// * Please see DLNA specifications for more details
+// ***************************************************
+_LIT8( KTransferMode, "transferMode.dlna.org" );
+_LIT8( KBackgroundMode, "Background" );
+_LIT8( KStreamingMode, "Streaming" );
+_LIT8( KInteractiveMode, "Interactive" );
+
+
+// ***************************************************
+// * DLNA Content headers
+// * 
+// * Please see DLNA specifications for more details
+// ***************************************************
+_LIT8( KContentType, "Content-Type" );
+_LIT8( KContentFeatures, "contentFeatures.dlna.org" );
+
+
+// ***************************************************
+// * DLNA headers misc.
+// * 
+// * Please see DLNA specifications for more details
+// ***************************************************
+_LIT8( KExpectHeader, "Expect" );
+_LIT8( K100Continue, "100-continue" );
+
+
+// ***************************************************
+// * Misc
+// * 
+// ***************************************************
+
+// attribute value - not implemented or not supported
+_LIT8( KValueNotImplemented, "NOT_IMPLEMENTED" );
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpdlnautility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utility for working with dlna profiles
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPDLNAUTILITY_H
+#define UPNPDLNAUTILITY_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+    
+/**
+* Utility for working with dlna profiles and mime types
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class UPnPDlnaUtility
+    {
+
+public: // datatypes 
+
+    enum TDlnaMode
+        {
+        EDMSMode = 0,
+        EDMPMode,
+        EDMUMode,
+        EDMDMode
+        };
+
+public: // Business logic methods
+
+         /**
+         * Returns Dlna profiles for which playback on
+         * device might be supported.         
+         * The client must release the memory allocated for the items 
+         * in the array.          
+         * @since Series 60 3.2
+         * @param aMode, dlna mode
+         * @return Dlna profile string array
+         */
+        IMPORT_C static CDesC8Array& GetSupportedProfilesL( 
+            const TDlnaMode aMode );
+    
+         /**
+         * Returns ETrue if aMime is such a mime type for which playback on 
+         * device might be supported.
+         * @since Series 60 3.2
+         * @param aMime mime type
+         * @return TBool Can the mime type possibly be playable on device.
+         */
+        IMPORT_C static TBool IsSupportedMimeType( const TDesC8& aMime );
+        
+         /**
+         * Returns ETrue if aProfile is such a DLNA profile for which 
+         * playback on device might be supported.
+         * @since Series 60 3.2
+         * @param aProfile mime type
+         * @return TBool Can the DLNA profile possibly be playable on device.
+         */
+        IMPORT_C static TBool IsSupportedDlnaProfile( const TDesC8& aProfile );
+
+    };
+
+#endif  // UPNPDLNAUTILITY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpdownloaditemresolver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resolver for downloading remote items
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPDOWNLOADITEMRESOLVER_H
+#define UPNPDOWNLOADITEMRESOLVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+#include "upnpfiletransfersessionobserver.h" // base class
+#include "upnpitemresolver.h" // base class
+#include "upnpitemresolverobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class CUPnPSettingsEngine;
+class CUPnPRemoteItemResolver;
+class MUPnPAVController;
+class CUpnpAVDevice;
+class MUPnPFileDownloadSession;
+
+// CLASS DECLARATION
+
+/**
+* Resolves remote upnp items from a plain item id.
+* This resolving is done by executing a upnp metadata browse, or
+* possibly several ones of those.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class CUPnPDownloadItemResolver
+    : public CBase
+    , public MUPnPItemResolver
+    , public MUPnPItemResolverObserver
+    , public MUPnPFileTransferSessionObserver
+    {
+public: // construction/destruction
+
+    /**
+     * static constructor
+     *
+     * @since Series 60 3.2
+     * @param aItemId, item to be resolved
+     * @param aAvController, AVController
+     * @param aHostSession, browsing session
+     * @param aSelector, resource selector
+     * @param aBrowseFilter, filter
+     * @return DownloadItemResolver instance 
+     */
+    static CUPnPDownloadItemResolver* NewL(
+        const TDesC8& aItemId,
+        MUPnPAVController& aAvController,
+        MUPnPAVBrowsingSession& aHostSession,
+        MUPnPResourceSelector& aSelector,
+        const TDesC8& aBrowseFilter );
+
+    /**
+     * destructor
+     */
+    virtual ~CUPnPDownloadItemResolver();
+
+private:
+
+    /**
+     * default constructor
+     *
+     * @since Series 60 3.2
+     * @param aItemId, item to be resolved
+     * @param aAvController, AVController
+     * @param aHostSession, browsing session
+     * @param aSelector, resource selector
+     * @param aBrowseFilter, filter
+     */
+    CUPnPDownloadItemResolver(
+        const TDesC8& aItemId,
+        MUPnPAVController& aAvController,
+        MUPnPAVBrowsingSession& aHostSession,
+        MUPnPResourceSelector& aSelector,
+        const TDesC8& aBrowseFilter );
+
+    /**
+     * 2nd phase constructor
+     *
+     * @since Series 60 3.2
+     * @param aItemId, item to be resolved
+     * @param aAvController, AVController
+     * @param aHostSession, browsing session
+     * @param aSelector, resource selector
+     * @param aBrowseFilter, filter
+     */
+    void ConstructL(
+        const TDesC8& aItemId,
+        MUPnPAVController& aAvController,
+        MUPnPAVBrowsingSession& aHostSession,
+        MUPnPResourceSelector& aSelector,
+        const TDesC8& aBrowseFilter );
+
+public: // the interface
+
+    /**
+     * see UPnPItemResolver
+     */
+    void ResolveL(
+        MUPnPItemResolverObserver& aObserver
+        );
+
+    /**
+     * see UPnPItemResolver
+     */
+    const CUpnpItem& Item() const;
+
+
+    /**
+     * see UPnPItemResolver
+     */
+    const CUpnpElement& Resource() const;
+    
+    /**
+     * Delete upnp genereated temporary files from download locations
+     * Leave in case of fatal errors
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C static void DeleteTempDownloadFilesL();
+
+
+protected: // MUPnPItemResolverObserver
+
+    /**
+     * see MUPnPItemResolverObserver
+     */
+    void ResolveComplete(
+        const MUPnPItemResolver& aResolver, TInt aError );
+
+protected: // MUPnPFileTransferSessionObserver
+
+
+    /**
+     * see MUPnPFileTransferSessionObserver
+     */
+    void TransferStarted( TInt aKey, TInt aStatus );
+
+    /**
+     * see MUPnPFileTransferSessionObserver
+     */
+    void TransferCompleted( TInt aKey, TInt aStatus,
+        const TDesC& aFilePath );
+
+    /**
+     * see MUPnPFileTransferSessionObserver
+     */
+    void TransferProgress( TInt aKey,
+        TInt aBytes, TInt aTotalBytes );
+
+    /**
+     * see MUPnPFileTransferSessionObserver
+     */
+    void MediaServerDisappeared(
+        TUPnPDeviceDisconnectedReason aReason );
+
+private: // private methods
+
+    /**
+     * Starts download when the remote item itself has been
+     * resolved using the remote resolver
+     */
+    void InitiateDownloadL();
+
+    /**
+     * Completes ongoing async operation
+     */
+    void Complete( TInt aError );
+
+    /**
+     * Clean up all resources
+     */
+    void Cleanup();
+    
+    /**
+     * Create temporary file name for file to be download.
+     * Format is upnpfwtemp<item_id><file extension>
+     * The following characters are replaced with an underscore: 
+     * >, <, ", \, /, *, |, * : and ?
+     *
+     * @return file name. Ownership transferred.
+     */
+    HBufC* CreateTmpFileNameL();
+    
+    /**
+     * Get selected download location from settings engine.
+     *
+     * @return download location. Ownership transferred.
+     */
+    HBufC* GetSelectedDownloadLocationL();
+    
+    /**
+     * Creates RFile
+     * @param aFilePath, file name and path
+     * @return error code
+     */
+    TInt CreateRFile( const TDesC& aFilePath );
+
+    /**
+     * internal state machinery
+     */
+    enum TInternalState {
+        EStateIdle,         // no data, ready for starting
+        EStateResolving,    // using remote resolver to resolve the item
+        EStateDownloading,  // Downloading data to local file system
+        EStateReady         // Ready, can read data
+    };
+
+    /**
+    * Check if the audio is DLNA supported in remote to local playback 
+    * @since Series 60 3.1
+    * @param CUpnpObject item to be checked
+    * @return void
+    */
+    void IsLocallySupportedL( const CUpnpElement& aRes ); 
+
+private: // members
+
+    // the remote resolver is a part of this resolver
+    CUPnPRemoteItemResolver* iRemoteResolver;
+    
+    // Settings engine for get selected copy location (Owned).
+    CUPnPSettingsEngine*    iSettingsEngine;
+
+    // avcontroller
+    MUPnPAVController& iAvController;
+
+    // the remote device
+    CUpnpAVDevice* iRemoteDevice;
+
+    // the local filename
+    HBufC* iLocalFile;
+
+    // session for downloading items
+    MUPnPFileDownloadSession* iDownloadSession;
+
+    // observer for this utility. Note: NOT OWNED
+    MUPnPItemResolverObserver* iObserver;
+
+    // state of the class
+    TInternalState iState;
+    
+    // File server session
+    RFs iFsSession;
+    
+    // Download target
+    RFile iFile;
+    
+    // selector interface to use
+    MUPnPResourceSelector& iSelector;
+    };
+
+
+#endif  // UPNPDOWNLOADITEMRESOLVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpfileutility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utility for working with files in upnp context
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPFILEUTILITY_H
+#define UPNPFILEUTILITY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpElement;
+
+// CLASS DECLARATION
+
+/**
+* Utility for working with local files in upnp context. The class
+* contains static methods that can be used to check various things
+* related to downloading files to local filesystem, or when playing
+* local files via upnp.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class UPnPFileUtility
+    {
+
+public: // Business logic methods
+
+    /**
+     * Checks if given file content is protected.
+     * Note that if a file is protected, it can not be copied to
+     * a remote upnp mediaserver, nor it can be played via a remote
+     * renderer. A client should use this interface before attempting
+     * any of these operations for usability sake.
+     * Currently supports checks for OEM-DRM and WM-DRM.
+     * The method will leave if the file is not found, or if the
+     * protection status can not be checked for some reason.
+     *
+     * @since S60 3.2
+     * @param aFilePath full path to file
+     * @return ETrue if file is protected 
+     */
+    IMPORT_C static TBool IsFileProtectedL(
+        const TDesC& aFilePath );
+
+    /**
+     * Checks if the given remote object (and the given particular
+     * resource) can fit in memory when downloaded using current
+     * default copy target setting
+     * @since S60 3.2
+     *
+     * @param aResource the resource to download
+     * @return EFalse if the target drive does not have enough space
+     */
+    IMPORT_C static TBool FitsInMemory(
+        const CUpnpElement& aResource );
+
+private:
+    
+    /**
+     * Checks if the given remote object (and the given particular
+     * resource) can fit in memory when downloaded using current
+     * default copy target setting
+     * @since S60 3.2
+     *
+     * @param aResource the resource to download
+     * @return EFalse if the target drive does not have enough space
+     */
+    static TBool FitsInMemoryL(
+        const CUpnpElement& aResource );
+    
+    };
+
+
+
+#endif  // UPNPFILEUTILITY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpinternalfileutility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utility for working with files in upnp context
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPINTERNALFILEUTILITY_H
+#define UPNPINTERNALFILEUTILITY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpElement;
+class CUpnpItem;
+
+// CLASS DECLARATION
+
+/**
+* Utility for working with local files in upnp context. 
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class UPnPInternalFileUtility
+    {
+
+public: // Business logic methods
+    /**
+     * Create temporary file name for file to be download.
+     * Format is upnpfwtemp<item_id><file extension>
+     * The following characters are replaced with an underscore: 
+     * >, <, ", \, /, *, |, * : and ?
+     *
+     * @return file name. Ownership transferred.
+     */
+    IMPORT_C static HBufC* CreateTmpFileNameL( const CUpnpItem& aItem );
+    
+    /**
+     * Get selected download location from settings engine.
+     *
+     * @return download location. Ownership transferred.
+     */
+    IMPORT_C static HBufC* GetSelectedDownloadLocationL();
+    
+    };
+
+
+
+#endif  // UPNPINTERNALFILEUTILITY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpitemresolver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Tool for resolving local or remote items
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPITEMRESOLVER_H
+#define UPNPITEMRESOLVER_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class MUPnPAVBrowsingSession;
+class MUPnPResourceSelector;
+class MUPnPItemResolverObserver;
+class CUpnpItem;
+class CUpnpElement;
+
+// CLASS DECLARATION
+
+/**
+* An interface for resolving either remote or local content.
+* The interface takes in some identification of the content,
+* resolves the content and asynchronously notifies when the
+* content is available. The content itself is provided by
+* CUpnpItem, which contains item metadata, resource and URI,
+* and it can be used directly in AVController interface to
+* play content on remote renderer or download content.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class MUPnPItemResolver
+    {
+
+public: // construction/destruction
+
+
+    /**
+     * virtual destructor
+     * for deleting the resolver implementation using the API pointer
+     */
+    virtual ~MUPnPItemResolver()  {}
+
+
+public: // the interface
+
+    /**
+     * Starts resolving an object id using given session.
+     * given Callback is notified when result objects are available,
+     * or in case of an error.
+     * @since S60 3.2
+     * @param aObserver interface that will receive result callback
+     * @param aSelector selects the desider resource
+     */
+    virtual void ResolveL(
+        MUPnPItemResolverObserver& aObserver ) = 0;
+
+    /**
+     * access to the resolved item.
+     * Note that if the object represents an item, it is not necessarily
+     * safe to query the resource in this item, instead you should use
+     * this item to query all metadata.
+     * Use this method after receiving MetadataBrowseComplete( KErrNone )
+     * @return reference to the item with the given ID
+     */
+    virtual const CUpnpItem& Item() const = 0;
+
+    /**
+     * access to the pointed item's resource.
+     * The resource may be in the original or in the pointed item.
+     * This is the easiest and recommended way for accessing the
+     * resource.
+     * example:
+     * const TDesC& uri = browseUtil->Res().Value();
+     * Use this method after receiving MetadataBrowseComplete( KErrNone )
+     * @return reference to the upnp element of <res> type.
+     */
+    virtual const CUpnpElement& Resource() const = 0;
+
+    };
+
+#endif  // UPNPITEMRESOLVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpitemresolverfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Tool for resolving local or remote items - factory
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPITEMRESOLVERFACTORY_H
+#define UPNPITEMRESOLVERFACTORY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MUPnPItemResolver;
+class MUPnPAVController;
+class MUPnPAVBrowsingSession;
+class MUPnPResourceSelector;
+
+// CLASS DECLARATION
+
+/**
+* Factory class for constructing MUPnPItemResolver
+* implementations. This class only contains static methods.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class UPnPItemResolverFactory
+    {
+
+public: // construction/destruction
+
+    /**
+     * The optimisation flags
+     */
+    enum TResolverOptimisationFlags
+        {
+        ENoOptimisation = 0x0000,
+            // this is the default
+        EOmitLocalMSStart = 0x0001,
+            // do not start local MS (in this case it must
+            // already started and kept alive the whole time
+        EOmitDrmCheck     = 0x0002
+            // do not check for file protection (in this case
+            // protection check must have been done before)
+        };
+
+    /**
+     * Creates a resolver for remote content
+     * @param aItemId the item ID to resolve into an item
+     * @param aHostSession the session where to resolve items
+     * @param aSelector selects the desider resource
+     * @param aBrowseFilter filter to be used in browse
+     * @param aOptimisationFlags flags to optimise resolver behaviour
+     * @return instance of RemoteItemResolver
+     */
+    IMPORT_C static MUPnPItemResolver* NewRemoteItemResolverL(
+        const TDesC8& aItemId,
+        MUPnPAVBrowsingSession& aHostSession,
+        MUPnPResourceSelector& aSelector,
+        const TDesC8& aBrowseFilter,
+        TInt aOptimisationFlags = ENoOptimisation );
+
+    /**
+     * Creates a resolver for local content
+     * @param aFilePath the local file to be resolved into an item
+     * @param aAvController AVController resource to reserve local media server
+     * @param aSelector selects the desider resource
+     * @param aOptimisationFlags flags to optimise resolver behaviour
+     * @return instance of RemoteItemResolver
+     */
+    IMPORT_C static MUPnPItemResolver* NewLocalItemResolverL(
+        const TDesC& aFilePath,
+        MUPnPAVController& aAvController,
+        MUPnPResourceSelector& aSelector,
+        TInt aOptimisationFlags = ENoOptimisation );
+
+    /**
+     * Creates a resolver for remote content that will be resolved and
+     * then downloaded to a temporary file in local file system
+     * @param aItemId the item ID to resolve into an item
+     * @param aAvController AVController resource to reserve local media server
+     * @param aHostSession the session where to resolve items
+     * @param aSelector selects the desider resource
+     * @param aBrowseFilter filter to be used in browse
+     * @param aOptimisationFlags flags to optimise resolver behaviour
+     * @return instance of RemoteItemResolver
+     */
+    IMPORT_C static MUPnPItemResolver* NewDownloadItemResolverL(
+        const TDesC8& aItemId,
+        MUPnPAVController& aAvController,
+        MUPnPAVBrowsingSession& aHostSession,
+        MUPnPResourceSelector& aSelector,
+        const TDesC8& aBrowseFilter,
+        TInt aOptimisationFlags = ENoOptimisation );
+
+    };
+
+#endif  // UPNPITEMRESOLVERFACTORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpitemresolverobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Observer interface for item resolver interface
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPITEMRESOLVEROBSERVER_H
+#define UPNPITEMRESOLVEROBSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MUPnPItemResolver;
+
+// CLASS DECLARATION
+
+/**
+* Observer for the item resolver class.
+* MUPnPItemResolver service informs using this interface that resolve
+* operation has been completed and (if succesful) an item is ready
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class MUPnPItemResolverObserver
+    {
+
+public:
+
+    /**
+     * indicates that operation is complete and results are available
+     * (if operation was succesful) after this operation, browsing
+     * session will not be used anymore.
+     * @param aResolver the resolver object that produced the event
+     * @param aError KErrNone if operation was succesful
+     */
+    virtual void ResolveComplete(
+        const MUPnPItemResolver& aResolver,
+        TInt aError ) = 0;
+
+    };
+
+
+#endif  // UPNPITEMRESOLVEROBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpitemutility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utility for parsing upnp items
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPITEMUTILITY_H
+#define UPNPITEMUTILITY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <upnpobject.h>
+#include <f32file.h>
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+class CUpnpObject;
+class CUpnpElement;
+class CUpnpAttribute;
+
+// CLASS DECLARATION
+
+/**
+* Utility for working with classes CUpnpObject and CUpnpItem.
+* The class provides helpers to locating elements and attributes
+* within the class, locating the resource and the URI, decoding
+* some special elements like dc:date, res@duration etc.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class UPnPItemUtility
+    {
+
+public: // Business logic methods
+
+    /**
+     * Tests if given object is of given class type.
+     * Note that in upnp the object classes are organised in open
+     * hierarchies, and this method will return true even if the class
+     * is unknown, if aObject's class is derived from aClass.
+     * see upnpconstantdefs.h for defined class definitions.
+     * example:
+     * TBool isPlaylist = BelongsToClass( item, KClassPlaylist );
+     *
+     * @since S60 3.2
+     * @param aObject the object whose class is to be tested
+     * @param aClass the class (in string form) against which to test
+     * @return reference to the res-element
+     */
+    IMPORT_C static TBool BelongsToClass(
+        const CUpnpObject& aObject,
+        const TDesC8& aClass );
+
+    /**
+     * Extracts all RES elements from an item.
+     * An item can include multiple resources, for instance
+     * an item may include the same image scaled to multiple
+     * resolutions, or a music track may include the track and
+     * its CR cover art as thumbnail.
+     * example:
+     * RUPnPElementsArray array;
+     * GetResElements( array );
+     *
+     * @since S60 3.2
+     * @param aItem UPnP item where to extract the res element.
+     * @return reference to the res-element
+     */
+    IMPORT_C static void GetResElements(
+        const CUpnpObject& aObject,
+        RUPnPElementsArray& aResElementsArray );
+
+    /**
+     * Finds the original resource of given item.
+     * Note that if item has multiple resource elements,
+     * this API will select the original and recommended one to use.
+     * Also note that if an item includes a thumbnail or another
+     * supporting resource, this can not be used to retrieve it.
+     * Example:
+     * const TDesC& uri = ResourceFromItemL( item ).Value();
+     *
+     * @since S60 3.2
+     * @param aItem UPnP item where to extract the res element.
+     * @return reference to the res-element
+     */
+    IMPORT_C static const CUpnpElement& ResourceFromItemL(
+        const CUpnpItem& aItem );
+
+    /**
+     * Finds an element within an object.
+     * see upnpconstantdefs.h for element name definitions.
+     * example:
+     * CUpnpElement* date = FindElementByName( item, KElementDate );
+     *
+     * @since S60 3.2
+     * @param aObject the object where to look for elements
+     * @param aName element name
+     * @return a pointer to the element, or NULL if not found
+     */
+    IMPORT_C static  const CUpnpElement* FindElementByName(
+        const CUpnpObject& aObject, const TDesC8& aName );
+
+    /**
+     * Finds an element within an object.
+     * Leaves if not found.
+     * see upnpconstantdefs.h for element name definitions.
+     * example:
+     * TDesC& genre = FindElementByNameL( item, KElementDate ).Value();
+     *
+     * @since S60 3.2
+     * @param aObject the object where to look for elements
+     * @param aName element name
+     * @return a reference to the element found.
+     */
+    IMPORT_C static  const CUpnpElement& FindElementByNameL(
+        const CUpnpObject& aObject, const TDesC8& aName );
+
+    /**
+     * Finds an attribute within an upnp element
+     * see upnpconstantdefs.h for element name definitions.
+     * example:
+     * CUpnpAttribute* s = FindAttributeByName( resElem, KAttributeSize );
+     *
+     * @since S60 3.2
+     * @param aElement the element where to look for attributes
+     * @param aName attribute name
+     * @return a pointer to the attribute found
+     */
+    IMPORT_C static const CUpnpAttribute* FindAttributeByName(
+        const CUpnpElement& aElement, const TDesC8& aName );
+
+    /**
+     * Finds an attribute within an upnp element.
+     * Leaves if not found
+     * see upnpconstantdefs.h for attribute name definitions.
+     * example:
+     * TDesC& s = FindAttributeByNameL( resElem, KAttributeSize ).Value();
+     *
+     * @since S60 3.2
+     * @param aElement the element where to look for attributes
+     * @param aName attribute name
+     * @return a reference to the attribute found
+     */
+    IMPORT_C static const CUpnpAttribute& FindAttributeByNameL(
+        const CUpnpElement& aElement, const TDesC8& aName );
+
+    /**
+     * Converts given upnp date string into TTime.
+     * example:
+     * TTime time = UpnpDateAsTTime( FindElementByNameL(
+     *      item, KElementDate ).Value() );
+     *
+     * @since S60 3.2
+     * @param aUpnpDate value from item's dc:date element
+     * @param aTime out variable to receive corresponding TTime
+     * @return KErrNone if conversion was succesful, otherwise < 0
+     *         for error values see TTime::Parse()
+     */
+    IMPORT_C static TInt UPnPDateAsTTime(
+        const TDesC8& aUpnpDate, TTime& aTime );
+
+    /**
+     * Converts given upnp duration or position string to a value in
+     * milliseconds.
+     * Duration was received in res element duration attribute, or
+     * in PositionInfo result from renderer.
+     * example:
+     * TInt duration = UpnpDurationAsMilliseconds( FindAttributeByNameL(
+     *      ResourceFromItemL( item ), KAttributeDuration ).Value() );
+     *
+     * @since S60 3.2
+     * @param aDuration duration or position as string
+     * @param aMilliseconds out variable to receive the result
+     * @return KErrNone if conversion was succesful, otherwise < 0
+     */
+    IMPORT_C static TInt UPnPDurationAsMilliseconds(
+        const TDesC8& aDuration, TInt& aMilliseconds );
+
+private:
+
+    static void UPnPDateAsTTimeL( const TDesC8& aUpnpDate,
+        TTime& aTime );
+
+
+    };
+
+
+
+#endif  // UPNPITEMUTILITY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnplocalitemresolver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,278 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resolver for local items
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPLOCALITEMRESOLVER_H
+#define UPNPLOCALITEMRESOLVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavbrowsingsessionobserver.h" // base class
+#include "upnpitemresolver.h" // base class
+#include <upnpmediaserverclient.h> // a member
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class MUPnPAVBrowsingSession;
+class CUpnpFileSharing;
+class CUpnpItem;
+class CUpnpSecAccessController;
+class CUPnPPeriodic;
+
+// CLASS DECLARATION
+
+/**
+* Resolves remote upnp items from a plain item id.
+* This resolving is done by executing a upnp metadata browse, or
+* possibly several ones of those.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class CUPnPLocalItemResolver
+    : public CActive
+    , public MUPnPAVBrowsingSessionObserver
+    , public MUPnPItemResolver
+    {
+public: // construction/destruction
+
+    /**
+     * static constructor
+     *
+     * @since Series 60 3.2
+     * @param aFilePath, local item to be resolved
+     * @param aAvController, AVController
+     * @param aSelector, resource selector
+     * @param aOptimisationFlags flags to optimise the algorithm
+     * @return LocaltemResolver instance 
+     */
+    static CUPnPLocalItemResolver* NewL(
+        const TDesC& aFilePath,
+        MUPnPAVController& aAvController,
+        MUPnPResourceSelector& aSelector,
+        TInt aOptimisationFlags );
+
+    /**
+     * destructor
+     * @since Series 60 3.2
+     */
+    virtual ~CUPnPLocalItemResolver();
+
+private:
+
+    /**
+     * default constructor
+     *
+     * @since Series 60 3.2
+     * @param aAvController, AVController
+     * @param aSelector, resource selector
+     */
+    CUPnPLocalItemResolver(
+        MUPnPAVController& aAvController,
+        MUPnPResourceSelector& aSelector,
+        TInt aOptimisationFlags );
+
+    /**
+     * 2nd phase constructor
+     *
+     * @param aFilePath, local item to be resolved
+     */
+    void ConstructL( const TDesC& aFilePath );
+
+private: // Business logic methods
+
+    /**
+     * Allows/denied access to the files to which the given item's res-
+     * elements are pointing.
+     *
+     * @since Series 60 3.2
+     * @param aItem the item
+     * @param aAccessAllowed ETrue to allow and EFalse to deny the access
+     */
+    void SetAccesstoItemResources( CUpnpItem& aItem, TBool aAccessAllowed );
+
+public: // the interface
+
+    /**
+     * see UPnPItemResolver
+     */
+    void ResolveL(
+        MUPnPItemResolverObserver& aObserver
+        );
+
+    /**
+     * see UPnPItemResolver
+     */
+    const CUpnpItem& Item() const;
+
+
+    /**
+     * see UPnPItemResolver
+     */
+    const CUpnpElement& Resource() const;
+    
+protected: // From CActive
+
+    /**
+     * See CActive
+     */
+    void RunL();
+    
+    /**
+     * See CActive
+     */
+    void DoCancel();
+    
+    /**
+     * See CActive
+     */
+    TInt RunError( TInt aError );
+
+protected: // overrides to CUPnPBrowsingSessionObserverProxy
+
+
+    /**
+     * see MUPnPAVSessionObserverBase
+     */
+    void ReserveLocalMSServicesCompleted( TInt aError );
+
+
+private: // private methods
+
+    /**
+     * initiate the sharing process
+     */
+    void DoShareL();
+    
+    /**
+     * initiate the unsharing process
+     */
+    void DoUnshareL();
+
+    /**
+     * Completes ongoing async operation
+     */
+    void Complete( TInt aError );
+
+    /**
+     * Clean up all resources
+     */
+    void Cleanup();
+
+    /**
+     * internal state machinery
+     */
+    enum TInternalState {
+        EStateIdle,         // no data, ready for starting
+        EStateCreatingItem, // CreateItemFromFileLC called
+        EStateStartingMS,   // starting the local mediaserver
+		EStateSharing,      // sharing the local file
+		EStateUnsharing,    // unsharing the local file
+        EStateReady,        // Ready. Can free.
+		EStateCancel		// command to cancel ongoing process
+    };        
+        
+private: // Call back methods of MUPnPAVBrowsingSessionObserver
+
+    /* Not used */
+    void BrowseResponse(
+        const TDesC8& /*aBrowseResponse*/,
+        TInt /*aError*/,
+        TInt /*aMatches*/,
+        TInt /*aTotalCount*/,
+        const TDesC8& /*aUpdateId*/
+        ) {}
+    void SearchResponse( 
+        const TDesC8& /*aSearchResponse*/,
+        TInt /*aError*/,
+        TInt /*aMatches*/,
+        TInt /*aTotalCount*/,
+        const TDesC8& /*aUpdateId*/
+        ) {}
+    void SearchCapabilitiesResponse( 
+        TInt /*aError*/,
+        const TDesC8& /*aSearchCapabilities*/ 
+        ) {}
+    void CreateContainerResponse( TInt /*aError*/, 
+        const TDesC8& /*aObjectId*/ ) {}
+    void DeleteObjectResponse( TInt /*aError*/ ) {}  
+
+    void MediaServerDisappeared(
+        TUPnPDeviceDisconnectedReason /*aReason*/ ) {}
+    
+    
+private: // Timer callback
+    /**
+     * timer callback
+     * unsharing is sometimes jammed and timer is used for cancelling
+     * unshare call
+     */
+   static TInt TimerExpired( TAny* aArg );
+
+private: // members
+
+    // local file path (Owned).
+    HBufC* iFilePath;
+
+    // avcontroller
+    MUPnPAVController& iAvController;
+
+    // temporary session for starting local mediaserver
+    MUPnPAVBrowsingSession* iTempSession;
+
+    // resource selector
+    MUPnPResourceSelector& iSelector;
+
+    // observer for this utility. Note: NOT OWNED
+    MUPnPItemResolverObserver* iObserver;
+
+    // state of the class
+    TInternalState iState;
+
+    // the first level browse result item (Owned).
+    CUpnpItem* iSharedItem;
+
+    // The selected resource within the last level item.
+    const CUpnpElement* iResource;
+
+    // The mediaserver (required to get the server IP address)
+    RUpnpMediaServerClient iMediaServer;
+
+    // optimisation flags
+    TInt iOptimisationFlags;
+
+    // S60 file sharing metadata interface
+    CUpnpFileSharing* iFileSharing;
+
+    // security access controller
+    CUpnpSecAccessController* iAccessController;
+    
+    // wait until unshare finishes
+    CActiveSchedulerWait*   iWait;
+    
+    // timer to cancel unshare
+    CUPnPPeriodic*          iTimer;
+    };
+
+
+#endif  // UPNPLOCALITEMRESOLVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpremoteitemresolver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resolver for remote items
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPREMOTEITEMRESOLVER_H
+#define UPNPREMOTEITEMRESOLVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpitemresolver.h" // base class
+#include "upnpabstractbrowsingsessionobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class MUPnPAVBrowsingSession;
+class CUpnpItem;
+class CUpnpElement;
+class MUPnPResourceSelector;
+
+// CLASS DECLARATION
+
+/**
+* Resolves remote upnp items from a plain item id.
+* This resolving is done by executing a upnp metadata browse, or
+* possibly several ones of those.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class CUPnPRemoteItemResolver
+    : public CUPnPAbstractBrowsingSessionObserver
+    , public MUPnPItemResolver
+    {
+public: // construction/destruction
+
+    /**
+     * static constructor.
+     *
+     * @since Series 60 3.2
+     * @param aItemId, item to be resolved
+     * @param aHostSession, browsing session
+     * @param aSelector, resource selector
+     * @param aBrowseFilter, filter
+     * @return RemoteItemResolver instance 
+     */
+    static CUPnPRemoteItemResolver* NewL(
+        const TDesC8& aItemId,
+        MUPnPAVBrowsingSession& aHostSession,
+        MUPnPResourceSelector& aSelector,
+        const TDesC8& aBrowseFilter );
+
+    /**
+     * destructor
+     * @since Series 60 3.2
+     */
+    virtual ~CUPnPRemoteItemResolver();
+
+private: // private construction part
+
+    /**
+     * default constructor.
+     *
+     * @since Series 60 3.2
+     * @param aItemId, item to be resolved
+     * @param aHostSession, browsing session
+     * @param aSelector, resource selector
+     * @param aBrowseFilter, filter
+     */
+    CUPnPRemoteItemResolver(
+        const TDesC8& aItemId,
+        MUPnPAVBrowsingSession& aHostSession,
+        MUPnPResourceSelector& aSelector,
+        const TDesC8& aBrowseFilter );
+
+    /**
+     * 2nd phase constructor.
+     *
+     * @since Series 60 3.2
+     * @param aItemId, item to be resolved
+     * @param aHostSession, browsing session
+     * @param aSelector, resource selector
+     * @param aBrowseFilter, filter
+     */
+    void ConstructL(
+        const TDesC8& aItemId,
+        MUPnPAVBrowsingSession& aHostSession,
+        MUPnPResourceSelector& aSelector,
+        const TDesC8& aBrowseFilter );
+
+
+public: // the interface
+
+    /**
+     * see UPnPItemResolver
+     */
+    void ResolveL(
+        MUPnPItemResolverObserver& aObserver );
+
+    /**
+     * see UPnPItemResolver
+     */
+    const CUpnpItem& Item() const;
+
+
+    /**
+     * see UPnPItemResolver
+     */
+    const CUpnpElement& Resource() const;
+
+
+protected: // MUPnPAVBrowsingSessionObserver
+
+    /**
+     * see MUPnPAVBrowsingSessionObserver
+     */
+    void BrowseResponse(
+        const TDesC8& aBrowseResponse,
+        TInt aError,
+        TInt aMatches,
+        TInt aTotalCount,
+        const TDesC8& aUpdateId
+        );
+
+
+private: // private methods
+
+    /**
+     * after receiving the result object, processes it:
+     * either continues browsing recursively or calls back
+     * notifying the object is ready to be fetched.
+     */
+    void ProcessResultObjectL( const CUpnpObject* aResult );
+
+    /**
+     * Completes ongoing async operation
+     */
+    void Complete( TInt aError );
+
+    /**
+     * Clean up all resources
+     */
+    void Cleanup();
+
+    /**
+     * internal state machinery
+     */
+    enum TInternalState {
+        EStateIdle,    // no data, ready for starting
+        EStateActive,  // browsing for data
+        EStateReady    // Data exists
+    };
+
+    /**
+     * Handles the parsing of the browse response.
+     *
+     * @since S60 3.2
+     * @param aBrowseResponse (const TDesC8&) the browse response
+     */
+    void BrowseResponseL( const TDesC8& aBrowseResponse );
+
+private: // members
+
+    // item to resolve (Owned)
+    HBufC8* iItemId;
+
+    // the host browsing session
+    MUPnPAVBrowsingSession& iBrowsingSession;
+
+    // selector interface to use
+    MUPnPResourceSelector& iSelector;
+
+    // filter used in browse
+    const TDesC8& iBrowseFilter;
+
+    // observer for the resolver. NOT OWNED
+    MUPnPItemResolverObserver* iObserver;
+
+    // state of the class
+    TInternalState iState;
+
+    // counter for browse resursion
+    TInt iRecursionDepth;
+
+    // the first level browse result item (Owned).
+    CUpnpItem* iFirstLevelItem;
+
+    // optional: last level browse result item, if first level
+    // is a pointer object (Owned). 
+    CUpnpItem* iLastLevelItem;
+
+    // The selected resource within the last level item. NOT OWNED
+    const CUpnpElement* iResource;
+
+    };
+
+
+#endif  // UPNPREMOTEITEMRESOLVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnpresourceselector.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Interface for selecting a resource within an item
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPRESOURCESELECTOR_H
+#define UPNPRESOURCESELECTOR_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+class CUpnpElement;
+
+
+// CLASS DECLARATION
+
+
+/**
+* An interface for a component that selects a resource from an item.
+* In upnp items have multiple resources, and it is not necessarily
+* clear which one of them the client wants to display. This interface
+* provides a client a clear option to choose whichever resource seems
+* best.
+*
+* @lib upnpavcontrollerhelper.lib
+* @since S60 3.2
+*/
+class MUPnPResourceSelector
+    {
+public: // the interface
+
+    /**
+     * Selects the resource from given item. The implementing class
+     * should return a reference to one of the elements within the
+     * given item. If there is some problem in selecting a resource
+     * (for instance there are NO resources in the item) the method
+     * should leave
+     *
+     * @since S60 3.2
+     * @param aItem the item where to seek resources
+     * @return reference to selected resource
+     */
+    virtual const CUpnpElement& SelectResourceL(
+        const CUpnpItem& aItem ) = 0;
+
+    };
+
+
+
+
+/**
+ * A helper selector that will select the original or most likely
+ * resource from an item, using UPnPItemUtility::ResourceFromItem.
+ * Most clients will find this practical.
+ * This class could be thought as a DEFAULT implementation for
+ * MUPnPResourceSelector.
+ */
+class TUPnPSelectDefaultResource
+    : public MUPnPResourceSelector
+    {
+
+public:
+
+    /**
+     * see MUPnPResourceSelector
+     */
+    IMPORT_C const CUpnpElement& SelectResourceL(
+        const CUpnpItem& aItem );
+
+    };
+
+/**
+ * A helper selector that will select the first resource available.
+ * This selector is handy if it is certain that there is only one
+ * resource available or if the first resource is always the proper
+ * one. (as is when sharing a local item)
+ *
+ * @since S60 3.2
+ */
+class TUPnPSelectFirstResource
+    : public MUPnPResourceSelector
+    {
+
+public:
+
+    /**
+     * see MUPnPResourceSelector
+     */
+    IMPORT_C const CUpnpElement& SelectResourceL(
+        const CUpnpItem& aItem );
+
+    };
+
+
+#endif  // UPNPRESOURCESELECTOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpabstractbrowsingsessionobserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      An abstract browsing session observer implementation
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpavbrowsingsession.h"
+#include "upnpavbrowsingsessionobserver.h"
+
+#include "upnpabstractbrowsingsessionobserver.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerhelper.txt");
+#include "upnplog.h"
+
+
+// CONSTANTS
+
+
+// METHODS
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::CUPnPAbstractBrowsingSessionObserver
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPAbstractBrowsingSessionObserver::
+    CUPnPAbstractBrowsingSessionObserver()
+    {
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::~CUPnPAbstractBrowsingSessionObserver
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPAbstractBrowsingSessionObserver::
+    ~CUPnPAbstractBrowsingSessionObserver()
+    {
+    DisableSessionObserver();
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::SetSession
+//---------------------------------------------------------------------------
+EXPORT_C void CUPnPAbstractBrowsingSessionObserver::SetSession(
+    MUPnPAVBrowsingSession& aHostSession )
+    {
+    // observer bust be disabled when calling this!
+    __ASSERTD( !iObserverEnabled, __FILE__, __LINE__ );
+    iObservedSession = &aHostSession;
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::EnableSessionObserver
+//---------------------------------------------------------------------------
+EXPORT_C void CUPnPAbstractBrowsingSessionObserver::EnableSessionObserver()
+    {
+    __LOG( "AbstractObserver:EnableSessionObserver()" );
+    if ( !iObserverEnabled )
+        {
+        // take original observer as proxy
+        iProxyObserver = iObservedSession->Observer();
+        iObservedSession->RemoveObserver();
+        iObservedSession->SetObserver( *this );
+        iObserverEnabled = ETrue;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::DisableSessionObserver
+//---------------------------------------------------------------------------
+EXPORT_C void CUPnPAbstractBrowsingSessionObserver::DisableSessionObserver()
+    {
+    if ( iObserverEnabled )
+        {
+        __LOG( "AbstractObserver:DisableSessionObserver()" );
+        __ASSERTD( iObservedSession != 0, __FILE__, __LINE__ );
+        // check we still are still the observer !!!
+        if ( iObservedSession->Observer() == this )
+            {
+            iObservedSession->RemoveObserver();
+            if ( iProxyObserver )
+                {
+                // set proxy observer back
+                iObservedSession->SetObserver( *iProxyObserver );
+                iProxyObserver = 0;
+                }
+            }
+        else
+            {
+            __LOG( "Disable: Not disabling - wrong observer!" );
+            }
+        iObserverEnabled = EFalse;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::IsSessionObserverEnabled
+//---------------------------------------------------------------------------
+EXPORT_C TBool CUPnPAbstractBrowsingSessionObserver::IsSessionObserverEnabled()
+    {
+    return iObserverEnabled;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::BrowseResponse
+//---------------------------------------------------------------------------
+void CUPnPAbstractBrowsingSessionObserver::BrowseResponse(
+    const TDesC8& aBrowseResponse,
+    TInt aError,
+    TInt aMatches,
+    TInt aTotalCount,
+    const TDesC8& aUpdateId )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->BrowseResponse( aBrowseResponse, aError,
+            aMatches, aTotalCount, aUpdateId );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::SearchResponse
+//---------------------------------------------------------------------------
+void CUPnPAbstractBrowsingSessionObserver::SearchResponse( 
+    const TDesC8& aSearchResponse,
+    TInt aError,
+    TInt aMatches,
+    TInt aTotalCount,
+    const TDesC8& aUpdateId )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->SearchResponse( aSearchResponse, aError,
+            aMatches, aTotalCount, aUpdateId );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::SearchCapabilitiesResponse
+//---------------------------------------------------------------------------
+void CUPnPAbstractBrowsingSessionObserver::SearchCapabilitiesResponse( 
+    TInt aError,
+    const TDesC8& aSearchCapabilities )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->SearchCapabilitiesResponse(
+            aError, aSearchCapabilities );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::CreateContainerResponse
+//---------------------------------------------------------------------------
+void CUPnPAbstractBrowsingSessionObserver::CreateContainerResponse(
+    TInt aError, 
+    const TDesC8& aObjectId )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->CreateContainerResponse( aError, aObjectId );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::DeleteObjectResponse
+//---------------------------------------------------------------------------
+void CUPnPAbstractBrowsingSessionObserver::DeleteObjectResponse(
+    TInt aError )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->DeleteObjectResponse( aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::ReserveLocalMSServicesCompleted
+//---------------------------------------------------------------------------
+void CUPnPAbstractBrowsingSessionObserver::
+    ReserveLocalMSServicesCompleted( TInt aError )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->ReserveLocalMSServicesCompleted( aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractBrowsingSessionObserver::MediaServerDisappeared
+//---------------------------------------------------------------------------
+void CUPnPAbstractBrowsingSessionObserver::MediaServerDisappeared(
+    TUPnPDeviceDisconnectedReason aReason )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->MediaServerDisappeared( aReason );
+        }
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpabstractrenderingsessionobserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      An abstract rendering session observer implementation
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpavrenderingsession.h"
+#include "upnpavrenderingsessionobserver.h"
+
+#include "upnpabstractrenderingsessionobserver.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerhelper.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+
+
+// METHODS
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::CUPnPAbstractRenderingSessionObs
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPAbstractRenderingSessionObserver::
+    CUPnPAbstractRenderingSessionObserver()
+    {
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::~CUPnPAbstractRenderingSessionObs
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPAbstractRenderingSessionObserver::
+    ~CUPnPAbstractRenderingSessionObserver()
+    {
+    DisableSessionObserver();
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::SetSession
+//---------------------------------------------------------------------------
+EXPORT_C void CUPnPAbstractRenderingSessionObserver::SetSession(
+    MUPnPAVRenderingSession& aHostSession )
+    {
+    // observer bust be disabled when calling this!
+    __ASSERTD( !iObserverEnabled, __FILE__, __LINE__ );
+    iObservedSession = &aHostSession;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::EnableSessionObserver
+//---------------------------------------------------------------------------
+EXPORT_C void CUPnPAbstractRenderingSessionObserver::EnableSessionObserver()
+    {
+    __LOG( "AbstractObserver:EnableSessionObserver()" );
+    if ( !iObserverEnabled )
+        {
+        // take original observer as proxy
+        iProxyObserver = iObservedSession->Observer();
+        iObservedSession->RemoveObserver();
+        iObservedSession->SetObserver( *this );
+        iObserverEnabled = ETrue;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::DisableSessionObserver
+//---------------------------------------------------------------------------
+EXPORT_C void CUPnPAbstractRenderingSessionObserver::DisableSessionObserver()
+    {
+    if ( iObserverEnabled )
+        {
+        __LOG( "AbstractObserver:DisableSessionObserver()" );
+        __ASSERTD( iObservedSession != 0, __FILE__, __LINE__ );
+        // check we still are still the observer !!!
+        if ( iObservedSession->Observer() == this )
+            {
+            iObservedSession->RemoveObserver();
+            if ( iProxyObserver )
+                {
+                // set proxy observer back
+                iObservedSession->SetObserver( *iProxyObserver );
+                iProxyObserver = 0;
+                }
+            }
+        else
+            {
+            __LOG( "Disable: Not disabling - wrong observer!" );
+            }
+        iObserverEnabled = EFalse;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::IsSessionObserverEnabled
+//---------------------------------------------------------------------------
+EXPORT_C TBool CUPnPAbstractRenderingSessionObserver::
+    IsSessionObserverEnabled()
+    {
+    return iObserverEnabled;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::VolumeResult
+//---------------------------------------------------------------------------
+void CUPnPAbstractRenderingSessionObserver::VolumeResult(
+    TInt aError, TInt aVolumeLevel,
+    TBool aActionResponse )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->VolumeResult( aError, aVolumeLevel, aActionResponse );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::MuteResult
+//---------------------------------------------------------------------------
+void CUPnPAbstractRenderingSessionObserver::MuteResult(
+    TInt aError, TBool aMute,
+    TBool aActionResponse )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->MuteResult( aError, aMute, aActionResponse );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::InteractOperationComplete
+//---------------------------------------------------------------------------
+void CUPnPAbstractRenderingSessionObserver::InteractOperationComplete(
+    TInt aError, TUPnPAVInteractOperation aOperation )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->InteractOperationComplete( aError, aOperation );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::PositionInfoResult
+//---------------------------------------------------------------------------
+void CUPnPAbstractRenderingSessionObserver::PositionInfoResult( TInt aError,
+    const TDesC8& aTrackPosition, const TDesC8& aTrackLength )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->PositionInfoResult( aError,
+            aTrackPosition, aTrackLength );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::SetURIResult
+//---------------------------------------------------------------------------
+void CUPnPAbstractRenderingSessionObserver::SetURIResult( TInt aError )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->SetURIResult( aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::SetNextURIResult
+//---------------------------------------------------------------------------
+void CUPnPAbstractRenderingSessionObserver::SetNextURIResult( TInt aError )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->SetNextURIResult( aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::MediaRendererDisappeared
+//---------------------------------------------------------------------------
+void CUPnPAbstractRenderingSessionObserver::MediaRendererDisappeared(
+    TUPnPDeviceDisconnectedReason aReason )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->MediaRendererDisappeared( aReason );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAbstractRenderingSessionObserver::ReserveLocalMSServicesCompleted
+//---------------------------------------------------------------------------
+void CUPnPAbstractRenderingSessionObserver::ReserveLocalMSServicesCompleted(
+    TInt aError )
+    {
+    __ASSERTD( iObserverEnabled, __FILE__, __LINE__ );
+    if ( iProxyObserver )
+        {
+        iProxyObserver->ReserveLocalMSServicesCompleted( aError );
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpdlnautility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,458 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utility for working with files in upnp context
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+
+#include "upnpdlnautility.h"
+
+// CONSTANTS
+
+// LITERALS
+// Video mimetypes that can be played on device
+_LIT8( KVideoMp4, "video/mp4" );
+_LIT8( KVideo3Gpp, "video/3gpp" );
+
+// Audio mimetypes that can be played on device
+_LIT8( KAudioMpeg, "audio/mpeg" );
+_LIT8( KAudioWma, "audio/x-ms-wma" );
+_LIT8( KAudio3Gpp, "audio/3gpp" );
+_LIT8( KAudioMp4, "audio/mp4" );
+_LIT8( KAudioAdts, "audio/vnd.dlna.adts" );
+_LIT8( KAudioWav, "audio/x-wav" );
+_LIT8( KAudioXAac, "audio/x-aac" );
+_LIT8( KAudioAac, "audio/aac" );
+_LIT8( KAudioM4a, "audio/x-m4a" );
+
+// Image mimetypes that can be played on device
+_LIT8( KImageJpeg, "image/jpeg" );
+_LIT8( KImagePng, "image/png" );
+_LIT8( KImageGif, "image/gif" );
+_LIT8( KImageBmp, "image/bmp" );
+
+// Video profiles that can be played on device
+_LIT8( KAvcMp4BlCif15Aac520, "AVC_MP4_BL_CIF15_AAC_520" );
+_LIT8( KMpeg4H2633gppP3L10Amr, "MPEG4_H263_3GPP_P3_L10_AMR" ); 
+_LIT8( KMpeg4P23gppSpL0bAmr, "MPEG4_P2_3GPP_SP_L0B_AMR" ); 
+_LIT8( KMpeg4P2Mp4AspAac, "MPEG4_P2_MP4_ASP_AAC" ); 
+_LIT8( KMpeg4P2Mp4AspHeaac, "MPEG4_P2_MP4_ASP_HEAAC" ); 
+_LIT8( KMpeg4P2Mp4AspL4SoAac, "MPEG4_P2_MP4_ASP_L4_SO_AAC" ); 
+_LIT8( KMpeg4P2Mp4AspL4SoHeaac, "MPEG4_P2_MP4_ASP_L4_SO_HEAAC" ); 
+_LIT8( KMpeg4P2Mp4SpVgaAac, "MPEG4_P2_MP4_SP_VGA_AAC" ); 
+_LIT8( KMpeg4P2Mp4SpVgaHeaac, "MPEG4_P2_MP4_SP_VGA_HEAAC" ); 
+_LIT8( KMpeg4P2Mp4SpL2Aac, "MPEG4_P2_MP4_SP_L2_AAC" ); 
+_LIT8( KMpeg4P2Mp4spAac, "MPEG4_P2_MP4_SP_AAC" );
+
+_LIT8( KMpeg4P23gppSpL0bAac, "MPEG4_P2_3GPP_SP_L0B_AAC");
+_LIT8( KAvcMp4BlCif15Aac, "AVC_MP4_BL_CIF15_AAC" ); 
+_LIT8( KAvcMp4BlCif15AacLtp, "AVC_MP4_BL_CIF15_AAC_LTP" ); 
+_LIT8( KAvcMp4BlCif15AacLtp520, "AVC_MP4_BL_CIF15_AAC_LTP_520" ); 
+_LIT8( KAvcMp4BlCif30Aac940, "AVC_MP4_BL_CIF30_AAC_940" ); 
+_LIT8( KAvcMp4BlL12Cif15Heaac, "AVC_MP4_BL_L12_CIF15_HEAAC" );
+_LIT8( KAvcTSBlCif15Aac, "AVC_TS_BL_CIF15_AAC" );
+
+// Audio profiles that can be played on device
+_LIT8( KAacIso, "AAC_ISO" ); 
+_LIT8( KAacIso320, "AAC_ISO_320" );
+_LIT8( KAacAdts, "AAC_ADTS" ); 
+_LIT8( KAacAdts320, "AAC_ADTS_320" ); 
+_LIT8( KAacMult5Iso, "AAC_MULT5_ISO" );
+_LIT8( KHeaacL2Iso, "HEAAC_L2_ISO" ); 
+_LIT8( KHeaacL2Iso320, "HEAAC_L2_ISO_320" ); 
+_LIT8( KHeaacL2Adts, "HEAAC_L2_ADTS" ); 
+_LIT8( KHeaacL2Adts320, "HEAAC_L2_ADTS_320" ); 
+_LIT8( KHeaacMuLt5Iso, "HEAAC_MULT5_ISO" ); 
+_LIT8( KHeaacL3ADTS, "HEAAC_L3_ADTS" ); 
+_LIT8( KAmr3gpp, "AMR_3GPP" ); 
+_LIT8( KAmrWbplus, "AMR_WBplus" ); 
+_LIT8( KMp3, "MP3" );
+_LIT8( KMp3x, "MP3X" ); 
+_LIT8( KWmaBase, "WMABASE" );
+_LIT8( KWmaFull, "WMAFULL" );
+
+// Image profiles that can be played on device
+_LIT8( KJpegLrg, "JPEG_LRG" ); 
+_LIT8( KJpegMed, "JPEG_MED" ); 
+_LIT8( KJpegSm, "JPEG_SM" );
+_LIT8( KPngLrg, "PNG_LRG" );
+_LIT8( KJpegLrgIco, "JPEG_LRG_ICO" );
+_LIT8( KJpegSmIco, "JPEG_SM_ICO" );
+_LIT8( KJpegTn, "JPEG_TN" );
+_LIT8( KPngTn, "PNG_TN" );
+_LIT8( KPngSmIco, "PNG_SM_ICO" );
+_LIT8( KPngLrgIco, "PNG_LRG_ICO" );
+
+
+// ============================ LOCAL FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// UPnPDlnaUtility::GetSupportedProfilesL
+// Returns Supported dlna profiles, Only player mode supported.
+// --------------------------------------------------------------------------
+EXPORT_C CDesC8Array& UPnPDlnaUtility::GetSupportedProfilesL( 
+    const TDlnaMode aMode )
+    {
+    CDesC8Array* array = new (ELeave) CDesC8ArrayFlat( 10 );
+    CleanupStack::PushL( array );
+    // At the m
+    switch( aMode )
+        {         
+        case EDMPMode:
+            {
+            // Video profiles that can be played on device
+            array->AppendL( KAvcMp4BlCif15Aac520() );
+            array->AppendL( KMpeg4H2633gppP3L10Amr() );
+            array->AppendL( KMpeg4P23gppSpL0bAmr() );
+            array->AppendL( KMpeg4P2Mp4AspAac() );
+            array->AppendL( KMpeg4P2Mp4AspHeaac() );
+            array->AppendL( KMpeg4P2Mp4AspL4SoAac() );
+            array->AppendL( KMpeg4P2Mp4AspL4SoHeaac() );
+            array->AppendL( KMpeg4P2Mp4SpVgaAac() );
+            array->AppendL( KMpeg4P2Mp4AspL4SoHeaac() );
+            array->AppendL( KMpeg4P2Mp4SpVgaAac() );
+            array->AppendL( KMpeg4P2Mp4SpVgaHeaac() );
+            array->AppendL( KMpeg4P2Mp4SpL2Aac() );
+            array->AppendL( KMpeg4P2Mp4spAac() );
+            
+            array->AppendL( KMpeg4P23gppSpL0bAac() );
+            array->AppendL( KAvcMp4BlCif15Aac() );
+            array->AppendL( KAvcMp4BlCif15AacLtp() );
+            array->AppendL( KAvcMp4BlCif15AacLtp520() );
+            array->AppendL( KAvcMp4BlCif30Aac940() );
+            array->AppendL( KAvcMp4BlL12Cif15Heaac() );
+            array->AppendL( KAvcTSBlCif15Aac() );            
+            
+            // Audio profiles that can be played on device
+            array->AppendL( KAacIso() );
+            array->AppendL( KAacIso320() );
+            array->AppendL( KAacAdts() );
+            array->AppendL( KAacAdts320() );
+            array->AppendL( KAacMult5Iso() );
+            array->AppendL( KHeaacL2Iso() );
+            array->AppendL( KHeaacL2Iso320() );
+            array->AppendL( KHeaacL2Adts() );
+            array->AppendL( KHeaacL2Adts320() );
+            array->AppendL( KAmr3gpp() );
+            array->AppendL( KAmrWbplus() );
+            array->AppendL( KMp3() );
+            array->AppendL( KMp3x() );
+            array->AppendL( KWmaBase() );
+            array->AppendL( KWmaFull() );
+            
+            // Image profiles that can be played on device
+            array->AppendL( KJpegLrg() );
+            array->AppendL( KJpegMed() );
+            array->AppendL( KJpegSm() );            
+            array->AppendL( KPngLrg() ); //fix for EFCG-7E2DKU            
+            array->AppendL( KJpegLrgIco() );
+            array->AppendL( KJpegSmIco() );
+            array->AppendL( KJpegTn() );
+            array->AppendL( KPngTn() );
+            array->AppendL( KPngSmIco() );
+            array->AppendL( KPngLrgIco() );
+
+            break;
+            }
+        case EDMSMode:
+        case EDMUMode:      
+        case EDMDMode:    
+        default:            
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }             
+        }
+    CleanupStack::Pop( array );        
+    return *array;        
+    }
+    
+// --------------------------------------------------------------------------
+// UPnPDlnaUtility::IsSupportedMimeType
+// Returns ETrue if aMime is such a mime type for which playback on device 
+// might be supported.
+// -------------------------------------------------------------------------- 
+EXPORT_C TBool UPnPDlnaUtility::IsSupportedMimeType( const TDesC8& aMime ) 
+    {
+    TBool retval = EFalse;
+    
+    if ( aMime.Compare( KVideoMp4() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare( KVideo3Gpp() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare( KAudioMpeg() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare( KAudioWma() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare( KAudio3Gpp() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare( KAudioMp4() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare( KAudioAdts() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare( KImageJpeg() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare( KImagePng() ) == 0 )
+        {
+        retval = ETrue;
+        } 
+    else if ( aMime.Compare ( KAudioWav() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare ( KAudioXAac() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare ( KAudioAac() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare ( KAudioM4a() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare ( KImageGif() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+    else if ( aMime.Compare ( KImageBmp() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+
+    return retval;
+    }
+    
+// --------------------------------------------------------------------------
+// UPnPDlnaUtility::IsSupportedDlnaProfile
+// Returns ETrue if aProfile is such a DLNA profile for which playback on 
+// device might be supported.
+// -------------------------------------------------------------------------- 
+EXPORT_C TBool UPnPDlnaUtility::IsSupportedDlnaProfile( 
+    const TDesC8& aProfile ) 
+    {
+    TBool retval = EFalse;
+    
+    if ( aProfile.Compare( KAvcMp4BlCif15Aac520() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4H2633gppP3L10Amr() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4P23gppSpL0bAmr() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4P2Mp4AspAac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4P2Mp4AspHeaac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4P2Mp4AspL4SoAac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4P2Mp4AspL4SoHeaac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4P2Mp4SpVgaAac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4P2Mp4SpVgaHeaac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4P2Mp4SpL2Aac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMpeg4P2Mp4spAac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if( aProfile.Compare( KMpeg4P23gppSpL0bAac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAvcMp4BlCif15Aac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAvcMp4BlCif15AacLtp() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAvcMp4BlCif15AacLtp520() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAvcMp4BlCif30Aac940() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAvcMp4BlL12Cif15Heaac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAvcTSBlCif15Aac() ) == 0 )
+        {
+        retval = ETrue;
+        }
+     
+    else if ( aProfile.Compare( KAacIso() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAacIso320() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAacAdts() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAacAdts320() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAacMult5Iso() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KHeaacL2Iso() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KHeaacL2Iso320() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KHeaacL2Adts() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KHeaacL2Adts320() ) == 0 )
+        {
+        retval = ETrue;
+        }
+	else if ( aProfile.Compare( KHeaacMuLt5Iso() ) == 0 )
+        {
+        retval = ETrue;
+        }
+	else if ( aProfile.Compare( KHeaacL3ADTS() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAmr3gpp() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KAmrWbplus() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMp3() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KMp3x() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KWmaBase() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KWmaFull() ) == 0 )
+        {
+        retval = ETrue;
+        }
+
+    else if ( aProfile.Compare( KJpegLrg() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KJpegMed() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KJpegSm() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KPngLrg() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KJpegLrgIco() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KJpegSmIco() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KJpegTn() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KPngTn() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KPngSmIco() ) == 0 )
+        {
+        retval = ETrue;
+        }
+    else if ( aProfile.Compare( KPngLrgIco() ) == 0 )
+        {
+        retval = ETrue;
+        }
+
+    return retval;    
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpdownloaditemresolver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,596 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resolver for downloading remote items
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <pathinfo.h>
+#include <bautils.h>
+
+// upnp stack api's
+#include <upnpobject.h>
+#include <upnpitem.h>
+#include <upnpelement.h>
+#include <upnpattribute.h> // for getting resource protocol info
+#include <upnpdlnaprotocolinfo.h> // for resolving object mimetype
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h" // avcontrol services
+#include "upnpavdevice.h" // avcontroller device class
+#include "upnpavbrowsingsession.h" // avcontrol browsing session
+#include "upnpfiledownloadsession.h" // avcontrol download session
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for element names
+#include "upnpitemutility.h" // for FindAttributeByName
+#include "upnpresourceselector.h" // MUPnPResourceSelector
+#include "upnpitemresolverobserver.h" // observer for this class
+#include "upnpdlnautility.h"  // IsSupportedDlnaProfile
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h" // for FileExtensionByMimeTypeL
+#include "upnpsettingsengine.h" // get selected download location
+
+// avcontroller helper internal
+#include "upnpremoteitemresolver.h" // remote item resolver impl.
+#include "upnpdownloaditemresolver.h" // download item resolver impl.
+
+_LIT( KComponentLogfile, "upnpavcontrollerhelper.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KTempPrefix, "upnpfwtemp");
+
+// METHODS
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::NewL
+//---------------------------------------------------------------------------
+CUPnPDownloadItemResolver* CUPnPDownloadItemResolver::NewL(
+    const TDesC8& aItemId,
+    MUPnPAVController& aAvController,
+    MUPnPAVBrowsingSession& aHostSession,
+    MUPnPResourceSelector& aSelector,
+    const TDesC8& aBrowseFilter )
+    {
+    CUPnPDownloadItemResolver* self = new (ELeave) CUPnPDownloadItemResolver(
+        aItemId, aAvController, aHostSession, aSelector, aBrowseFilter );
+    CleanupStack::PushL( self );
+    self->ConstructL(
+        aItemId, aAvController, aHostSession, aSelector, aBrowseFilter );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::CUPnPDownloadItemResolver
+//---------------------------------------------------------------------------
+CUPnPDownloadItemResolver::CUPnPDownloadItemResolver(
+    const TDesC8& /*aItemId*/,
+    MUPnPAVController& aAvController,
+    MUPnPAVBrowsingSession& /*aHostSession*/,
+    MUPnPResourceSelector& aSelector,
+    const TDesC8& /*aBrowseFilter*/ )
+    : iAvController( aAvController ),
+      iState( EStateIdle ),iSelector(aSelector)
+    {
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::ConstructL
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::ConstructL(
+    const TDesC8& aItemId,
+    MUPnPAVController& /*aAvController*/,
+    MUPnPAVBrowsingSession& aHostSession,
+    MUPnPResourceSelector& aSelector,
+    const TDesC8& aBrowseFilter )
+    {
+    iRemoteResolver = CUPnPRemoteItemResolver::NewL(
+        aItemId, aHostSession, aSelector, aBrowseFilter );
+    iRemoteDevice = CUpnpAVDevice::NewL( aHostSession.Device() );
+    iSettingsEngine = CUPnPSettingsEngine::NewL();
+    
+    // Open File Server session
+    User::LeaveIfError( iFsSession.Connect() );
+    User::LeaveIfError( iFsSession.ShareProtected() );   
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::~CUPnPDownloadItemResolver
+//---------------------------------------------------------------------------
+CUPnPDownloadItemResolver::~CUPnPDownloadItemResolver()
+    {        
+    Cleanup();
+    delete iRemoteResolver;
+    iRemoteResolver = 0;
+    delete iRemoteDevice;
+    iRemoteDevice= 0;
+    delete iSettingsEngine;
+    iSettingsEngine = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::ResolveL
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::ResolveL(
+    MUPnPItemResolverObserver& aObserver )
+    {
+    __LOG( "DownloadItemResolver:Resolve()" );
+    __ASSERTD( iState == EStateIdle, __FILE__, __LINE__ );
+
+    // change state
+    iObserver = &aObserver;
+
+    // first resolve the item
+    iRemoteResolver->ResolveL( *this );
+    iState = EStateResolving;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::ResolveComplete
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::ResolveComplete(
+    const MUPnPItemResolver& /*aResolver*/, TInt aError )
+    {
+    __LOG1( "DownloadItemResolver:ResolveComplete(%d)", aError );
+    __ASSERTD( iState == EStateResolving, __FILE__, __LINE__ );
+
+    if ( aError == KErrNone )
+        {
+        TRAP( aError, 
+                const CUpnpElement& res =
+                        iSelector.SelectResourceL( iRemoteResolver->Item() );
+                IsLocallySupportedL( res );
+                );
+        if( aError )
+            {
+            Complete( aError );
+            }
+        else
+            {
+            TRAPD( err, InitiateDownloadL() );
+            if ( err != KErrNone )
+                {
+                Complete( err );
+                }
+            }
+        }
+    else
+        {
+        Complete( aError );
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::InitiateDownloadL
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::InitiateDownloadL()
+    {
+    __LOG( "CUPnPDownloadItemResolver::InitiateDownloadL");
+    // start a download session if not already started
+    if( !iDownloadSession )
+        {
+        iDownloadSession =
+            &iAvController.StartDownloadSessionL( *iRemoteDevice );
+        }
+    iDownloadSession->SetObserver( *this );
+
+    // Get selected download location.
+    HBufC* copyLocation = GetSelectedDownloadLocationL();
+    CleanupStack::PushL( copyLocation );
+    _LIT(KTempFolder, "temp\\");
+    // Create temp file name
+    HBufC* tempFileName = CreateTmpFileNameL();
+    CleanupStack::PushL( tempFileName );
+
+    // Create and save full file path.
+    if( iLocalFile )
+        {
+        // delete if already allocated.
+        delete iLocalFile;
+        iLocalFile = 0;
+        }
+    
+    iLocalFile = HBufC::NewL( copyLocation->Length() +
+                              KTempFolder().Length() );
+    iLocalFile->Des().Append( *copyLocation );
+    iLocalFile->Des().Append( KTempFolder );
+    //check the existence of the target folder
+    if( !BaflUtils::FolderExists( iFsSession, *iLocalFile ) )
+        {
+        User::LeaveIfError( iFsSession.MkDirAll( *iLocalFile ) );
+        }
+        
+    User::LeaveIfError( iFsSession.SetAtt( *iLocalFile, 
+                                    KEntryAttHidden, 
+                                    KEntryAttNormal ) );
+                                        
+    iLocalFile = iLocalFile->ReAllocL( 
+        iLocalFile->Length() + tempFileName->Length() );
+    
+    iLocalFile->Des().Append( *tempFileName );
+
+    // write the file path into the item
+    CUpnpElement& writableRes =
+        const_cast<CUpnpElement&>( iRemoteResolver->Resource() );
+    writableRes.SetFilePathL( *iLocalFile );
+    CleanupStack::PopAndDestroy( tempFileName );
+    CleanupStack::PopAndDestroy( copyLocation );
+    
+    // Create local target file for dowload item
+    TInt err = CreateRFile( *iLocalFile );
+
+    if( err == KErrNone )
+        {
+        __LOG( "StartDownloading...");
+        // initiate download
+        
+        iDownloadSession->StartDownloadL( writableRes, 
+                                      iRemoteResolver->Item(), 
+                                      iFile,
+                                      (TInt)this );
+                                      
+        iState = EStateDownloading;
+        }
+    else // Create download target failed!
+        {
+        __LOG( "Create download target failed!");
+        User::Leave( err );
+        }
+    __LOG( "CUPnPDownloadItemResolver::InitiateDownloadL -End");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::TransferStarted
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::TransferStarted( TInt /*aKey*/,
+    TInt /*aStatus*/ )
+    {
+    __LOG( "DownloadItemResolver:TransferStarted");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::TransferCompleted
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::TransferCompleted( TInt /*aKey*/,
+    TInt aStatus, const TDesC& /*aFilePath*/ )
+    {
+    __LOG1( "DownloadItemResolver:TransferCompleted(%d)", aStatus );
+    iFile.Close();
+    Complete( aStatus );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::TransferProgress
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::TransferProgress( TInt /*aKey*/,
+    TInt /*aBytes*/, TInt /*aTotalBytes*/ )
+    {
+    __LOG( "DownloadItemResolver:TransferProgress");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::MediaServerDisappeared
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::MediaServerDisappeared(
+    TUPnPDeviceDisconnectedReason /*aReason*/ )
+    {
+    __LOG( "DownloadItemResolver:MediaServerDisappeared" );
+    Complete( KErrDisconnected );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::Item
+//---------------------------------------------------------------------------
+const CUpnpItem& CUPnPDownloadItemResolver::Item() const
+    {
+    __ASSERTD( iState == EStateReady, __FILE__, __LINE__ );
+
+    return iRemoteResolver->Item();
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::Resource
+//---------------------------------------------------------------------------
+const CUpnpElement& CUPnPDownloadItemResolver::Resource() const
+    {
+    __ASSERTD( iState == EStateReady, __FILE__, __LINE__ );
+
+    return iRemoteResolver->Resource();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::DeleteTempFilesL
+// --------------------------------------------------------------------------
+EXPORT_C void CUPnPDownloadItemResolver::DeleteTempDownloadFilesL()
+    {
+    __LOG("CUPnPDownloadItemResolver::DeleteTempDownloadFilesL begin");
+
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+
+    CFileMan* fileMan = CFileMan::NewL( fs );
+    CleanupStack::PushL( fileMan );
+    _LIT( KAnyChar, "*");
+    _LIT( KAnyExtension, "*.*");
+    _LIT( KUpnpUploadTempDirectory, "temp\\" );
+
+    // clean selected download directory
+    HBufC* path = HBufC::NewLC( KMaxFileName );
+    CUPnPSettingsEngine* settingsEngine = CUPnPSettingsEngine::NewL();
+    CleanupStack::PushL( settingsEngine );
+    HBufC* copyLocation = HBufC::NewL( KMaxFileName );
+    CleanupStack::PushL( copyLocation );
+    TBool copyLocationIsPhoneMemory = 0; // not used in this case
+    TPtr copyLocationPtr( copyLocation->Des() );
+    settingsEngine->GetCopyLocationL( copyLocationPtr,
+        copyLocationIsPhoneMemory );
+    path->Des().Append( *copyLocation );
+    path->Des().Append( KAnyChar );
+    path->Des().Append( KTempPrefix );
+    path->Des().Append( KAnyExtension );
+    fileMan->Delete( *path );
+    
+    path->Des().Zero();
+    path->Des().Append( *copyLocation );
+    path->Des().Append( KUpnpUploadTempDirectory );
+    path->Des().Append( KAnyExtension );
+    fileMan->Delete( *path );
+
+    CleanupStack::PopAndDestroy( copyLocation );
+    CleanupStack::PopAndDestroy( settingsEngine );
+    CleanupStack::PopAndDestroy( path );
+
+    CleanupStack::PopAndDestroy( fileMan );
+    CleanupStack::PopAndDestroy( &fs );
+
+    __LOG("CUPnPDownloadItemResolver::DeleteTempDownloadFilesL End");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::Complete
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::Complete( TInt aError )
+    {
+    __ASSERTD( iState == EStateResolving || iState == EStateDownloading,
+        __FILE__, __LINE__ );
+
+    if ( iDownloadSession != 0 )
+        {
+        iAvController.StopDownloadSession( *iDownloadSession );
+        iDownloadSession = 0;
+        }
+
+    MUPnPItemResolverObserver& observer = *iObserver;
+    iObserver = 0;
+    if ( aError == KErrNone )
+        {
+        iState = EStateReady;
+        }
+    else
+        {
+        iState = EStateIdle;
+        Cleanup();
+        }
+
+    observer.ResolveComplete( *this, aError );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::Cleanup
+//---------------------------------------------------------------------------
+void CUPnPDownloadItemResolver::Cleanup()
+    {
+    iObserver = 0;
+    iFile.Close();
+    
+    if ( iDownloadSession != 0 )
+        {
+        iAvController.StopDownloadSession( *iDownloadSession );
+        iDownloadSession = 0;
+        }
+        
+    if ( iLocalFile )
+        {
+        // delete the local file
+        iFsSession.Delete( iLocalFile->Des() );       
+        __LOG1( "DownloadItemResolver: deleted local file(%d)", iLocalFile );
+        delete iLocalFile;
+        iLocalFile = 0;
+        }
+        
+    iFsSession.Close();
+
+    iState = EStateIdle;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::CreateTmpFileNameL
+//---------------------------------------------------------------------------
+HBufC* CUPnPDownloadItemResolver::CreateTmpFileNameL()
+    {
+    __LOG( "DownloadItemResolver::CreateTmpFileName" );
+    __ASSERTD( iState == EStateResolving, __FILE__, __LINE__ );
+
+    HBufC* tempfilename = NULL;
+    HBufC* fileExt = NULL;
+    
+    // Get file extension
+    const CUpnpAttribute* attr = UPnPItemUtility
+        ::FindAttributeByName( iRemoteResolver->Resource(), 
+        KAttributeProtocolInfo );
+    if ( attr != 0 )
+        {
+        CUpnpDlnaProtocolInfo* pInfo =
+            CUpnpDlnaProtocolInfo::NewL( attr->Value() );
+        CleanupStack::PushL( pInfo );
+        fileExt = UPnPCommonUtils::FileExtensionByMimeTypeL(
+            pInfo->ThirdField() );
+        CleanupStack::PopAndDestroy( pInfo );
+        pInfo = NULL;
+        }
+
+    // If file extension exist create whole file name.
+    if( fileExt )
+        {
+        CleanupStack::PushL( fileExt );
+        tempfilename = HBufC::NewL( 
+            KTempPrefix().Length() + 
+            iRemoteResolver->Item().Id().Length() + 
+            fileExt->Length() );
+        CleanupStack::PushL( tempfilename );
+        // Add prefix
+        tempfilename->Des().Append( KTempPrefix ); 
+        // Add item name. Convert 8 to 16 and replace illeagal characters.
+        HBufC8* tmpItemName8 = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+            iRemoteResolver->Item().Id() );
+        CleanupStack::PushL( tmpItemName8 );
+        HBufC* itemname = HBufC::NewL( tmpItemName8->Length() );
+        CleanupStack::PushL( itemname );
+        itemname->Des().Copy( *tmpItemName8 );
+        tempfilename->Des().Append( *itemname );
+        CleanupStack::PopAndDestroy( itemname );
+        CleanupStack::PopAndDestroy( tmpItemName8 );
+        // Add file extension
+        tempfilename->Des().Append( *fileExt );
+
+        CleanupStack::Pop( tempfilename );
+        CleanupStack::PopAndDestroy( fileExt );
+        }
+    else // Create without file extension
+        {
+        tempfilename = HBufC::NewL( 
+            KTempPrefix().Length() + iRemoteResolver->Item().Id().Length() );
+        CleanupStack::PushL( tempfilename );
+        // Add prefix
+        tempfilename->Des().Append( KTempPrefix ); 
+        // Add item name. Convert 8 to 16 and replace illeagal characters.
+        HBufC8* tmpItemName8 = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+            iRemoteResolver->Item().Id() );
+        CleanupStack::PushL( tmpItemName8 );
+        HBufC* itemname = HBufC::NewL( tmpItemName8->Length() );
+        CleanupStack::PushL( itemname );
+        itemname->Des().Copy( *tmpItemName8 );
+        tempfilename->Des().Append( *itemname );
+        CleanupStack::PopAndDestroy( itemname );
+        CleanupStack::PopAndDestroy( tmpItemName8 );
+
+        CleanupStack::Pop( tempfilename );
+        }
+
+    return tempfilename; //transfer ownership
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::GetSelectedDownloadLocationL
+//---------------------------------------------------------------------------
+HBufC* CUPnPDownloadItemResolver::GetSelectedDownloadLocationL()
+    {
+    __LOG( "DownloadItemResolver::GetSelectedDownloadLocationL" );
+
+    HBufC* copyLocation = HBufC::NewL( KMaxFileName );
+    CleanupStack::PushL( copyLocation );
+    TBool copyLocationIsPhoneMemory = 0;
+    TPtr copyLocationPtr( copyLocation->Des() );
+    TRAPD( error, iSettingsEngine->GetCopyLocationL( 
+        copyLocationPtr, copyLocationIsPhoneMemory ) )
+    
+    // Something wrong in getting copy location. Default to 
+    // phone memory.
+    if( error != KErrNone )
+        {
+        TPtrC phoneDrive( PathInfo::PhoneMemoryRootPath() );
+        copyLocation->Des().Append( phoneDrive );
+        }
+    
+    CleanupStack::Pop( copyLocation );
+    return copyLocation;
+    }
+
+// -----------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::CreateRFile
+// -----------------------------------------------------------------------------
+// 
+TInt CUPnPDownloadItemResolver::CreateRFile( const TDesC& aFilePath )
+    {
+    __LOG( "DownloadItemResolver::CreateRFile" );
+    iFile.Close();
+
+    // In some special case, the function Replace() will fail
+    // with error -14(KErrInUse) by using 'EFileWrite' mode.
+    // Maybe some other handler does not close the file. 
+    TInt err = iFile.Replace(
+                iFsSession,
+                aFilePath,
+                EFileShareReadersOrWriters );
+                
+    if( KErrPathNotFound == err )
+        {
+        __LOG( "Directory not available -> create new" );
+        iFsSession.MkDirAll( aFilePath );
+        err = iFile.Create( iFsSession, aFilePath, EFileWrite );
+        }
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadItemResolver::IsLocallySupportedL()
+// Check if the audio is DLNA supported in remote to local playback 
+// --------------------------------------------------------------------------
+//
+void CUPnPDownloadItemResolver::IsLocallySupportedL( const CUpnpElement& aRes )
+    {
+    const CUpnpAttribute* attr = 
+                       &UPnPItemUtility::FindAttributeByNameL( 
+                                              aRes, KAttributeProtocolInfo );
+    // parse protocol info
+    CUpnpDlnaProtocolInfo* pInfo = NULL;
+    pInfo = CUpnpDlnaProtocolInfo::NewL( attr->Value() );
+    
+    //if DLNA compliant item
+    if ( pInfo->PnParameter() != KNullDesC8() )
+        {
+        if( !UPnPDlnaUtility::IsSupportedDlnaProfile( 
+                                              pInfo->PnParameter() ) )
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+    else //if not, check MIME type
+        {
+        if( !UPnPDlnaUtility::IsSupportedMimeType( pInfo->ThirdField() ) )
+            {
+            User::Leave(KErrNotSupported);
+            }
+        
+        }
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpfileutility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utility for working with files in upnp context
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <e32std.h>
+#include <upnpelement.h>
+#include <DRMCommon.h>              // OEM-DRM
+#include <caf/content.h>                // CAF (WM-DRM check)
+#include <caf/agent.h>                  // CAF (WM-DRM check)
+#include <pathinfo.h>               // PathInfo
+
+// upnpframework / avcontroller helper api
+#include "upnpitemutility.h"        // FindAttributeByName
+#include "upnpconstantdefs.h"       // KAttributeSize
+#include "upnpfileutility.h"
+
+// upnpframework / internal api's
+#include "upnpsettingsengine.h"     // get target drive
+
+_LIT( KComponentLogfile, "upnpavcontrollerhelper.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KWmDrmAgentName,     "PV WMA CAF Agent" );
+_LIT( K60WmDrmAgentName,   "WM DRM Agent" );
+const TInt64 KPhoneMemoryThreshold    = 1048576; //1MB
+
+
+// ============================ LOCAL FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// UPnPFileUtility::IsFileDrmProtectedL
+//---------------------------------------------------------------------------
+EXPORT_C TBool UPnPFileUtility::IsFileProtectedL(
+    const TDesC& aFilePath )
+    {
+    __LOG( "FileUtility:IsFileDrmProtectedL( aFileName )" );
+    TBool isProtected = ETrue;
+
+    // Check if the file is OEM-DRM protected
+    DRMCommon* drmCommon = DRMCommon::NewL();
+    CleanupStack::PushL( drmCommon );
+    User::LeaveIfError( drmCommon->Connect() );
+    User::LeaveIfError( drmCommon->IsProtectedFile(
+        aFilePath, isProtected ) );
+    CleanupStack::PopAndDestroy( drmCommon );
+    drmCommon = NULL;
+
+    // If not OEM-DRM protected, check if the file is WM-DRM protected
+    if( !isProtected )
+        {
+        CContent* content = CContent::NewLC( aFilePath );
+        TAgent agent = content->Agent();
+
+        // Check if .wma file
+        if( agent.Name().CompareF( KWmDrmAgentName ) == 0 ||
+            agent.Name().CompareF( K60WmDrmAgentName ) == 0 )
+            {
+            __LOG( "FileUtility:IsFileDrmProtectedL: .wma file " );
+            CData* data = CData::NewL( (TVirtualPathPtr) aFilePath,
+                EPeek, EContentShareReadOnly );
+            data->GetAttribute( EIsProtected, isProtected );
+            delete data;
+            }
+        CleanupStack::PopAndDestroy( content );
+        content = NULL;
+        }
+    return isProtected;
+    }
+
+
+// --------------------------------------------------------------------------
+// UPnPFileUtility::FitsInMemory
+// see UPnPFileUtility.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool UPnPFileUtility::FitsInMemory(
+    const CUpnpElement& aResource )
+    {
+    TBool result( ETrue );
+    
+    //it will always return ETrue if Leave
+    TRAP_IGNORE( result = FitsInMemoryL( aResource ) );
+    return result;
+    }
+
+
+// --------------------------------------------------------------------------
+// UPnPFileUtility::FitsInMemory
+// see UPnPFileUtility.h
+// --------------------------------------------------------------------------
+TBool UPnPFileUtility::FitsInMemoryL( const CUpnpElement& aResource )
+    {
+    __LOG( "UPnPFileUtility::FitsInMemoryL" );
+    // 1. get object size
+    TInt fileSize = -1;
+    const CUpnpAttribute* attr =
+        UPnPItemUtility::FindAttributeByName( aResource, KAttributeSize );
+
+    //if "file size" not found, straightly go for downloading
+    if( !attr )   
+        {
+        __LOG( "UPnPFileUtility::size not found" );
+        return ETrue;
+        }
+
+    // 2. convert size to integer
+    TLex8 sizeconvert( attr->Value() );
+    sizeconvert.Val( fileSize );
+
+    if( fileSize < 0)
+        {
+        __LOG1( "UPnPFileUtility::file size %d", fileSize );
+        return ETrue;
+        }
+           
+    // 3. check the copy target configuration
+    CUPnPSettingsEngine* engine = NULL;
+    engine = CUPnPSettingsEngine::NewL();
+    CleanupStack::PushL( engine );
+    
+    HBufC* location = HBufC::NewLC( KMaxFileName );
+    TPtr locationPtr( location->Des() );
+    TBool isPhoneMemory;
+    
+    engine->GetCopyLocationL( locationPtr, isPhoneMemory );
+        
+    // 4. check bytes available in the drive
+    RFs fileServer;
+    CleanupClosePushL( fileServer );
+    User::LeaveIfError( fileServer.Connect() );
+
+    TVolumeInfo freeVol;
+
+    User::LeaveIfError( fileServer.SetSessionPath( locationPtr ) );
+    User::LeaveIfError( fileServer.Volume( freeVol ) );
+
+    CleanupStack::PopAndDestroy(); // close fileServer;
+    CleanupStack::PopAndDestroy(); // delete location
+    CleanupStack::PopAndDestroy( engine ); // not needed anymore
+
+    __LOG1( "UPnPFileUtility::free space: %d", freeVol.iFree );
+
+    TInt64 freeSize = 0;
+
+    // 5. result
+    // With phone memory a threshold is used. 
+    if( isPhoneMemory )
+        {
+        freeSize = freeVol.iFree - KPhoneMemoryThreshold;
+        }
+    else
+        {
+        freeSize = freeVol.iFree;
+        }
+
+    if( freeSize >= fileSize )
+        {
+        __LOG( "UPnPFileUtility::FitsInMemoryL -TRUE" );
+        return ETrue;
+        }
+    else
+        {
+        __LOG( "UPnPFileUtility::FitsInMemoryL -FALSE" );
+        return EFalse;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpinternalfileutility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utility for working with files in upnp context 
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <e32std.h>
+#include <upnpelement.h>
+#include <DRMCommon.h>              // OEM-DRM
+#include <caf/content.h>                // CAF (WM-DRM check)
+#include <caf/agent.h>                  // CAF (WM-DRM check)
+#include <pathinfo.h>               // PathInfo
+#include <upnpitem.h>
+#include <upnpattribute.h>          // for getting resource protocol info
+#include <upnpdlnaprotocolinfo.h>   // for resolving object mimetypE
+
+// upnpframework / avcontroller helper api
+#include "upnpitemutility.h"        // FindAttributeByName
+#include "upnpconstantdefs.h"       // KAttributeSize
+#include "upnpinternalfileutility.h"
+
+// upnpframework / internal api's
+#include "upnpsettingsengine.h"     // get target drive
+#include "upnpcommonutils.h"        // for FileExtensionByMimeTypeL
+
+_LIT( KComponentLogfile, "upnpavcontrollerhelper.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+//_LIT( KWmDrmAgentName,     "PV WMA CAF Agent" );
+//_LIT( K60WmDrmAgentName,   "WM DRM Agent" );
+//const TInt64 KPhoneMemoryThreshold    = 1048576; //1MB
+_LIT( KTempPrefix, "upnpfwtemp");
+
+
+// --------------------------------------------------------------------------
+// UPnPFileUtility::GetSelectedDownloadLocationL
+//---------------------------------------------------------------------------
+EXPORT_C HBufC* UPnPInternalFileUtility::GetSelectedDownloadLocationL()
+    {
+    __LOG( "UPnPFileUtility::GetSelectedDownloadLocationL" );
+
+    HBufC* copyLocation = HBufC::NewL( KMaxFileName );
+    CleanupStack::PushL( copyLocation );
+    TBool copyLocationIsPhoneMemory = 0;
+    TPtr copyLocationPtr( copyLocation->Des() );
+    
+    CUPnPSettingsEngine* settingsEngine = CUPnPSettingsEngine::NewL();
+    CleanupStack::PushL( settingsEngine );
+    TRAPD( error, settingsEngine->GetCopyLocationL( 
+        copyLocationPtr, copyLocationIsPhoneMemory ) )
+    
+    // Something wrong in getting copy location. Default to 
+    // phone memory.
+    if( error != KErrNone )
+        {
+        TPtrC phoneDrive( PathInfo::PhoneMemoryRootPath() );
+        copyLocation->Des().Append( phoneDrive );
+        }
+    CleanupStack::PopAndDestroy( settingsEngine );
+    CleanupStack::Pop( copyLocation );
+    return copyLocation; // transfer ownership
+    }
+
+
+// --------------------------------------------------------------------------
+// UPnPFileUtility::CreateTmpFileNameL
+//---------------------------------------------------------------------------
+EXPORT_C HBufC* UPnPInternalFileUtility::CreateTmpFileNameL( const CUpnpItem& aItem )
+    {
+    __LOG( "UPnPFileUtility::CreateTmpFileName" );
+
+    HBufC* tempfilename = NULL;
+    HBufC* fileExt = NULL;
+    
+    // Get file extension        
+    const CUpnpElement& res =
+        UPnPItemUtility::ResourceFromItemL( aItem );        
+    const CUpnpAttribute* attr = UPnPItemUtility
+        ::FindAttributeByName( res, KAttributeProtocolInfo );
+        if ( attr != 0 )
+        {
+        CUpnpDlnaProtocolInfo* pInfo =
+            CUpnpDlnaProtocolInfo::NewL( attr->Value() );
+        CleanupStack::PushL( pInfo );
+        fileExt = UPnPCommonUtils::FileExtensionByMimeTypeL(
+            pInfo->ThirdField() );
+        CleanupStack::PopAndDestroy( pInfo );
+        pInfo = NULL;
+        }
+
+    // If file extension exist create whole file name.
+    if( fileExt )
+        {
+        CleanupStack::PushL( fileExt );
+        tempfilename = HBufC::NewL( 
+            KTempPrefix().Length() + 
+            aItem.Id().Length() + 
+            fileExt->Length() );
+        CleanupStack::PushL( tempfilename );
+        // Add prefix
+        tempfilename->Des().Append( KTempPrefix ); 
+        // Add item name. Convert 8 to 16 and replace illeagal characters.
+        HBufC8* tmpItemName8 = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+            aItem.Id() );
+        CleanupStack::PushL( tmpItemName8 );
+        HBufC* itemname = HBufC::NewL( tmpItemName8->Length() );
+        CleanupStack::PushL( itemname );
+        itemname->Des().Copy( *tmpItemName8 );
+        tempfilename->Des().Append( *itemname );
+        CleanupStack::PopAndDestroy( itemname );
+        CleanupStack::PopAndDestroy( tmpItemName8 );
+        // Add file extension
+        tempfilename->Des().Append( *fileExt );
+
+        CleanupStack::Pop( tempfilename );
+        CleanupStack::PopAndDestroy( fileExt );
+        }
+    else // Create without file extension
+        {
+        tempfilename = HBufC::NewL( 
+            KTempPrefix().Length() + aItem.Id().Length() );
+        CleanupStack::PushL( tempfilename );
+        // Add prefix
+        tempfilename->Des().Append( KTempPrefix ); 
+        // Add item name. Convert 8 to 16 and replace illeagal characters.
+        HBufC8* tmpItemName8 = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+            aItem.Id() );
+        CleanupStack::PushL( tmpItemName8 );
+        HBufC* itemname = HBufC::NewL( tmpItemName8->Length() );
+        CleanupStack::PushL( itemname );
+        itemname->Des().Copy( *tmpItemName8 );
+        tempfilename->Des().Append( *itemname );
+        CleanupStack::PopAndDestroy( itemname );
+        CleanupStack::PopAndDestroy( tmpItemName8 );
+
+        CleanupStack::Pop( tempfilename );
+        }
+
+    return tempfilename; //transfer ownership
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpitemresolver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Tool for resolving local or remote items
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpremoteitemresolver.h"
+#include "upnplocalitemresolver.h"
+#include "upnpdownloaditemresolver.h"
+
+#include "upnpitemresolver.h"
+
+// CONSTANTS
+
+// METHODS
+
+// --------------------------------------------------------------------------
+// MUPnPItemResolver::NewRemoteItemResolverL
+// factory for implementation
+//---------------------------------------------------------------------------
+EXPORT_C MUPnPItemResolver* MUPnPItemResolver::NewRemoteItemResolverL(
+    const TDesC8& aItemId,
+    MUPnPAVBrowsingSession& aHostSession,
+    MUPnPResourceSelector& aSelector,
+    const TDesC8& aBrowseFilter )
+    {
+    return CUPnPRemoteItemResolver::NewL(
+            aItemId, aHostSession, aSelector, aBrowseFilter );
+    }
+
+// --------------------------------------------------------------------------
+// MUPnPItemResolver::NewRemoteItemResolverL
+// factory for implementation
+//---------------------------------------------------------------------------
+EXPORT_C MUPnPItemResolver* MUPnPItemResolver::NewLocalItemResolverL(
+    const TDesC& aFilePath,
+    MUPnPAVController& aAvController,
+    MUPnPResourceSelector& aSelector )
+    {
+    return CUPnPLocalItemResolver::NewL(
+            aFilePath, aAvController, aSelector );
+    }
+
+// --------------------------------------------------------------------------
+// MUPnPItemResolver::NewDownloadItemResolverL
+// factory for implementation
+//---------------------------------------------------------------------------
+EXPORT_C MUPnPItemResolver* MUPnPItemResolver::NewDownloadItemResolverL(
+    const TDesC8& aItemId,
+    MUPnPAVController& aAvController,
+    MUPnPAVBrowsingSession& aHostSession,
+    MUPnPResourceSelector& aSelector,
+    const TDesC8& aBrowseFilter )
+    {
+    return CUPnPDownloadItemResolver::NewL(
+            aItemId, aAvController, aHostSession, aSelector, aBrowseFilter );
+    }
+
+// --------------------------------------------------------------------------
+// MUPnPItemResolver::~MUPnPItemResolver
+// destructor
+//---------------------------------------------------------------------------
+MUPnPItemResolver::~MUPnPItemResolver()
+    {
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpitemresolverfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Tool for resolving local or remote items - factory
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// upnpframework / avcontroller helper api
+#include "upnpitemresolverfactory.h"
+
+// avcontrollerhelper internal
+#include "upnpremoteitemresolver.h"
+#include "upnplocalitemresolver.h"
+#include "upnpdownloaditemresolver.h"
+
+// CONSTANTS
+
+// METHODS
+
+// --------------------------------------------------------------------------
+// MUPnPItemResolver::NewRemoteItemResolverL
+// factory for implementation
+//---------------------------------------------------------------------------
+EXPORT_C MUPnPItemResolver* UPnPItemResolverFactory::NewRemoteItemResolverL(
+    const TDesC8& aItemId,
+    MUPnPAVBrowsingSession& aHostSession,
+    MUPnPResourceSelector& aSelector,
+    const TDesC8& aBrowseFilter,
+    TInt /*aOptimisationFlags*/ )
+    {
+    return CUPnPRemoteItemResolver::NewL(
+        aItemId, aHostSession, aSelector, aBrowseFilter );
+    }
+
+// --------------------------------------------------------------------------
+// MUPnPItemResolver::NewRemoteItemResolverL
+// factory for implementation
+//---------------------------------------------------------------------------
+EXPORT_C MUPnPItemResolver* UPnPItemResolverFactory::NewLocalItemResolverL(
+    const TDesC& aFilePath,
+    MUPnPAVController& aAvController,
+    MUPnPResourceSelector& aSelector,
+    TInt aOptimisationFlags )
+    {
+    return CUPnPLocalItemResolver::NewL(
+        aFilePath, aAvController, aSelector, aOptimisationFlags );
+    }
+
+// --------------------------------------------------------------------------
+// MUPnPItemResolver::NewDownloadItemResolverL
+// factory for implementation
+//---------------------------------------------------------------------------
+EXPORT_C MUPnPItemResolver* UPnPItemResolverFactory::NewDownloadItemResolverL(
+    const TDesC8& aItemId,
+    MUPnPAVController& aAvController,
+    MUPnPAVBrowsingSession& aHostSession,
+    MUPnPResourceSelector& aSelector,
+    const TDesC8& aBrowseFilter,
+    TInt /*aOptimisationFlags*/ )
+    {
+    return CUPnPDownloadItemResolver::NewL(
+        aItemId, aAvController, aHostSession, aSelector, aBrowseFilter );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpitemutility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,427 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utility for parsing upnp items
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <e32std.h>
+
+// upnp stack api
+#include <upnpitem.h>
+#include <upnpdlnaprotocolinfo.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for KValueNotImplemented
+#include "upnpitemutility.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerhelper.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KDateStringLength        = 10;
+const TInt KDateTimeStringLength    = 19;
+const TInt KMaxDateStringLength     = 30;
+const TInt KCodeSemicolon           = 58;
+_LIT( KSeparator,                   ":" );
+_LIT( KNullTime,                    "000000" );
+_LIT8( KHttp,                       "http://" );
+_LIT8( KCiParam,                    "DLNA.ORG_CI" );
+
+/* removed due to M-DMC CTT test case 7.3.26.2
+_LIT8( KAudioSupport,               "audio/" );
+_LIT8( KImageSupport,               "image/" );
+_LIT8( KVideoSupport,               "video/" );
+*/
+
+// ============================ LOCAL FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// UPnPItemUtility::BelongsToClass
+//---------------------------------------------------------------------------
+EXPORT_C TBool UPnPItemUtility::BelongsToClass(
+    const CUpnpObject& aObject,
+    const TDesC8& aClass )
+    {
+    TBool beginsWith = 
+        ( aObject.ObjectClass().Find( aClass ) == 0 );
+    return beginsWith;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPItemUtility::GetResElements
+//---------------------------------------------------------------------------
+EXPORT_C void UPnPItemUtility::GetResElements(
+    const CUpnpObject& aObject,
+    RUPnPElementsArray& aResElementsArray )
+    {
+    const RUPnPElementsArray& array =
+        const_cast<CUpnpObject&>(aObject).GetElements();
+    
+    for( TInt i = 0; i < array.Count(); i++ )
+        {
+        if( array[ i ]->Name() == KElementRes() )
+            {
+            aResElementsArray.Append( array[ i ] );
+            }
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// UPnPItemUtility::ResourceFromItemL
+//---------------------------------------------------------------------------
+EXPORT_C const CUpnpElement& UPnPItemUtility::ResourceFromItemL(
+    const CUpnpItem& aItem )
+    {
+    __LOG( "UpnpItemUtility:ResourceFromItemL" );
+
+    // Obtain list of item's res elements   
+    RUPnPElementsArray elms;
+    GetResElements( aItem, elms );
+    TInt count = elms.Count();
+
+    CUpnpDlnaProtocolInfo* pInfo = NULL;
+    TBool found = EFalse;
+    TInt i(0);
+    // bestCandidate is an index of some res element in the list. This res
+    // will be considered as the best candidate for desired res and that
+    // candidate will be returned if no res element contains false CI-flag.
+
+    const CUpnpElement* bestCandidate = 0;
+
+    // determine which resource is the original one
+    // 1. In DLNA 1.5 case, parse protocolInfo attribute and see if some res 
+    //    element has CI-flag false (=not converted so that is what we want)
+    // 2. In non-DLNA 1.5 case and in DLNA 1.5 case where CI-flag does not 
+    //    exist, do the following:
+    //      o filter out other than HTTP GET resources (internal uri's, RTP)
+    //      o filter out resources that do not match itemtype (mime type of 
+    //        audio file resources should start with "audio/" etc.)
+    for( i = 0 ; i < count; i++ )
+        {
+        // Make sure that it is a HTTP GET resource. Otherwise continue.
+        if( elms[ i ]->Value().Left( KHttp.iTypeLength ).Compare( KHttp() ) 
+            != 0 )
+            {
+            continue;
+            }
+
+        // Obtain protocolInfo of the res element.
+        const CUpnpAttribute* attr = FindAttributeByName(
+            *elms[i], KAttributeProtocolInfo() );
+        if ( attr ) 
+            {           
+            TRAP_IGNORE( pInfo = CUpnpDlnaProtocolInfo::NewL( attr->Value() ) );
+            if( !pInfo )
+                {
+                //if pInfo, start next one!
+                continue;
+                }
+            // check if CI parameter is false or it doesn't have CI parameters at all.
+            //for upnp item, always the first res element is the best, resolution
+            // should be checked in the future
+            if ( ( attr->Value().Find( KCiParam() ) != KErrNotFound && 
+                 pInfo->CiParameter() == EFalse ) || 
+                 attr->Value().Find( KCiParam() ) == KErrNotFound )
+                {
+                // end loop, we found what we were looking for. 
+                found = ETrue;
+                delete pInfo; pInfo = NULL;
+                break;                
+                }
+
+/* removed due to M-DMC CTT test case 7.3.26.2            
+            // check that mimetype corresponds to objectType
+            TPtrC8 mime = pInfo->ThirdField();
+            
+            TPtrC8 objectClass = aItem.ObjectClass();
+            if ( objectClass.Compare( KClassAudio ) == 0 ) 
+                {
+                if ( mime.Left( KAudioSupport().Length() ).CompareF( 
+                                                    KAudioSupport() ) != 0 ) 
+                    {
+                    // if mime type does not match to object type, this is 
+                    // not the correct resource.
+                    delete pInfo; pInfo = NULL;
+                    continue;
+                    }
+                }
+            else if ( objectClass.Compare( KClassVideo ) == 0 ) 
+                {
+                if ( mime.Left( KVideoSupport().Length() ).CompareF( 
+                                                    KVideoSupport() ) != 0 ) 
+                    {
+                    // if mime type does not match to object type, this is 
+                    // not the correct resource.
+                    delete pInfo; pInfo = NULL;
+                    continue;
+                    }
+                }
+            else if ( objectClass.Compare( KClassImage ) == 0 ) 
+                {
+                if ( mime.Left( KImageSupport().Length() ).CompareF( 
+                                                    KImageSupport() ) != 0 ) 
+                    {
+                    // if mime type does not match to object type, this is 
+                    // not the correct resource.
+                    delete pInfo; pInfo = NULL;
+                    continue;
+                    }
+                }
+ */
+            // use the first suitable res field as candidate which will be
+            // returned if better is not found.
+            // More sophisticated solution would be to compare resolution
+            // etc. attributes to determine the best candidate,
+            if ( 0 == bestCandidate ) 
+                {
+                bestCandidate = elms[i];
+                }
+            delete pInfo; pInfo = NULL;
+            }
+        else 
+            {
+            // No mandatory protocolinfo attribute. This is not what we want.
+            }
+        }
+    if ( found ) 
+        {
+        bestCandidate = elms[i];
+        }
+
+    // close the elements array
+    elms.Close();
+
+    if( bestCandidate == 0 )
+        {
+        User::Leave( KErrNotFound );
+        }
+    return *bestCandidate;
+    }
+
+
+// --------------------------------------------------------------------------
+// UPnPItemUtility::FindElementByName
+//---------------------------------------------------------------------------
+EXPORT_C const CUpnpElement* UPnPItemUtility::FindElementByName(
+    const CUpnpObject& aObject, const TDesC8& aName )
+    {
+    __LOG( "UpnpItemUtility:FindElementByName" );
+
+    CUpnpElement* element = NULL;
+    const RUPnPElementsArray& array =
+        const_cast<CUpnpObject&>(aObject).GetElements();
+    for( TInt i = 0; i < array.Count(); i++ )
+        {
+        if( array[ i ]->Name() == aName )
+            {
+            element = array[ i ];
+            i = array.Count();
+            }
+        }
+    return element;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPItemUtility::FindElementByNameL
+//---------------------------------------------------------------------------
+EXPORT_C const CUpnpElement& UPnPItemUtility::FindElementByNameL(
+    const CUpnpObject& aObject, const TDesC8& aName )
+    {
+    __LOG( "UpnpItemUtility:FindElementByNameL" );
+
+    const CUpnpElement* element = FindElementByName(
+        aObject, aName );
+    if( !element )
+        {
+        User::Leave( KErrNotFound );
+        }
+    return *element;    
+    }
+
+// --------------------------------------------------------------------------
+// UPnPItemUtility::FindAttributeByName
+//---------------------------------------------------------------------------
+EXPORT_C const CUpnpAttribute* UPnPItemUtility::FindAttributeByName(
+    const CUpnpElement& aElement, const TDesC8& aName )
+    {
+    __LOG( "UpnpItemUtility:FindAttributeByName" );
+
+    CUpnpAttribute* attribute = NULL;
+    const RUPnPAttributesArray& array =
+        const_cast<CUpnpElement&>(aElement).GetAttributes();
+    
+    for( TInt i = 0; i < array.Count(); i++ )
+        {
+        
+        TBufC8<255> buf(array[ i ]->Name());
+        if( array[ i ]->Name() == aName )
+            {
+            attribute = array[ i ];
+            i = array.Count();
+            }
+        }
+    return attribute;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPItemUtility::FindAttributeByNameL
+//---------------------------------------------------------------------------
+EXPORT_C const CUpnpAttribute& UPnPItemUtility::FindAttributeByNameL(
+    const CUpnpElement& aElement, const TDesC8& aName )
+    {
+    __LOG( "UpnpItemUtility:FindAttributeByNameL" );
+
+    const CUpnpAttribute* attribute = FindAttributeByName(
+        aElement, aName );
+    if( !attribute )
+        {
+        User::Leave( KErrNotFound );
+        }
+    return *attribute;        
+    }
+
+// --------------------------------------------------------------------------
+// UPnPItemUtility::UpnpDateAsTTime
+//---------------------------------------------------------------------------
+EXPORT_C TInt UPnPItemUtility::UPnPDateAsTTime(
+    const TDesC8& aUpnpDate, TTime& aTime )
+    {
+    __LOG( "UpnpItemUtility:UpnpDateAsTTime" );
+
+    TRAPD( err, UPnPItemUtility::UPnPDateAsTTimeL( aUpnpDate, aTime ) );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPItemUtility::UpnpDurationAsMilliseconds
+//---------------------------------------------------------------------------
+EXPORT_C TInt UPnPItemUtility::UPnPDurationAsMilliseconds(
+    const TDesC8& aDuration, TInt& aMilliseconds )
+    {
+    __LOG( "UpnpItemUtility:UpnpDurationAsMilliseconds" );
+
+    TInt retVal = KErrNone;    
+    if( aDuration.Length() > 0 )
+        {
+        // Check if information is actually returned by the device
+        if( aDuration.Compare( KValueNotImplemented ) != 0 )
+            {        
+            TInt time = 0;
+            TChar separator( KCodeSemicolon );
+            TInt lposit = aDuration.Locate( separator );
+            
+            if ( lposit != KErrNotFound )
+                {
+                TInt rposit = aDuration.LocateReverse( separator );
+                if( rposit != lposit )
+                    {
+                    // Hours
+                    TLex8 lex( aDuration.Left( lposit ) );
+                    retVal = lex.Val( time ); 
+                    if( retVal == KErrNone  )
+                        {
+                        // Convert to ms and add
+                        aMilliseconds += time * 3600 * 1000;
+                        // Minutes
+                        lex.Assign( aDuration.Mid(
+                            lposit + 1, rposit - lposit - 1 ) );
+                        retVal = lex.Val( time ); 
+                        if( retVal == KErrNone )
+                            {
+                            // Convert to ms and add
+                            aMilliseconds += time * 60* 1000;
+                            // Seconds
+                            lex.Assign( aDuration.Mid(
+                                rposit + 1, 2 ) );
+                            retVal = lex.Val( time ); 
+                            if( retVal  == KErrNone )
+                                {
+                                // Convert to ms and add
+                                aMilliseconds += time * 1000;
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    retVal = KErrNotSupported;
+                    }        
+                }
+            else
+                {
+                retVal = KErrNotSupported;
+                }   
+            }  
+        else
+            {
+            retVal = KErrNotSupported;
+            }
+        }
+    else
+        {
+        retVal = KErrNotSupported;
+        }
+        
+    return retVal;
+    }
+
+void UPnPItemUtility::UPnPDateAsTTimeL( const TDesC8& aUpnpDate,
+    TTime& aTime )
+    {
+    // This method is capable of handling the most common dc:date formats:
+    // CCYY-MM-DD and CCYY-MM-DDThh:mm:ss
+    // Rest of the dc:date formats are handled as well, but they might not
+    // be converted precisely
+    
+    TBuf<KMaxDateStringLength> formatDateString;
+    HBufC* dateString = HBufC::NewL( aUpnpDate.Length() );
+    dateString->Des().Copy( aUpnpDate );
+
+    if( aUpnpDate.Length() >= KDateStringLength )
+        {
+        // CCYY-MM-DD --> CCYYMMDD
+        formatDateString.Copy( dateString->Des().Left( 4 ) ); // Year
+        formatDateString.Append( dateString->Des().Mid( 5,2 ) ); // Month
+        formatDateString.Append( dateString->Des().Mid( 8,2 ) ); // Day        
+
+        if( aUpnpDate.Length() >= KDateTimeStringLength )
+            {
+            // hh:mm:ss --> hhmmss
+            formatDateString.Append( KSeparator );
+            // Hours
+            formatDateString.Append( dateString->Des().Mid( 11, 2 ) ); 
+            // Minutes
+            formatDateString.Append( dateString->Des().Mid( 14, 2 ) );
+            // Seconds 
+            formatDateString.Append( dateString->Des().Mid( 17, 2 ) ); 
+            }
+        else
+            {
+            // hh:mm:ss --> 000000
+            formatDateString.Append( KSeparator );
+            formatDateString.Append( KNullTime );
+            }
+        }
+    delete dateString;
+    
+    User::LeaveIfError( aTime.Set( formatDateString ) );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnplocalitemresolver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,553 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resolver for local items
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// upnp stack api's
+#include <upnpitem.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h" // avcontroller service
+#include "upnpavbrowsingsession.h" // browsing session
+#include "upnpavdevice.h" // device (for creating a session)
+#include <upnpfilesharing.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpitemresolverfactory.h" // optimisation flags
+#include "upnpitemresolverobserver.h" // MUPnPItemResolverObserver
+#include "upnpfileutility.h" // IsFileProtected
+#include "upnpresourceselector.h" // MUPnPResourceSelector
+
+// upnpframework / internal api's
+#include "upnpmetadatafetcher.h" // CreateItemFromFileLC
+#include "upnpcommonutils.h" // ReplacePlaceHolderInURIL
+
+// avcontrollerhelper internal
+#include "upnplocalitemresolver.h"
+
+#include "upnpconstantdefs.h" // for upnp-specific stuff
+#include "upnpitemutility.h" // for GetResElements
+#include "upnpsecaccesscontroller.h" // CUpnpSecAccessController
+#include "upnpperiodic.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerhelper.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KCancelWaitMaximum =   4000000;
+const TInt KCancelWaitResolution = 500000;
+const TInt KUnshareWait =  1000000;
+
+// METHODS
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver:: NewL
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+CUPnPLocalItemResolver* CUPnPLocalItemResolver::NewL(
+    const TDesC& aFilePath,
+    MUPnPAVController& aAvController,
+    MUPnPResourceSelector& aSelector,
+    TInt aOptimisationFlags    )
+    {
+    CUPnPLocalItemResolver* self =
+        new (ELeave )CUPnPLocalItemResolver(
+        aAvController, aSelector, aOptimisationFlags );
+    CleanupStack::PushL( self );
+    self->ConstructL( aFilePath );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::CUPnPLocalItemResolver
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+CUPnPLocalItemResolver::CUPnPLocalItemResolver(
+    MUPnPAVController& aAvController,
+    MUPnPResourceSelector& aSelector,
+    TInt aOptimisationFlags )
+    : CActive( EPriorityStandard )
+    , iAvController( aAvController )
+    , iSelector( aSelector )
+    {
+    CActiveScheduler::Add( this );
+    iOptimisationFlags = aOptimisationFlags;
+    iState = EStateIdle;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::ConstructL
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+void CUPnPLocalItemResolver::ConstructL(
+    const TDesC& aFilePath )
+    {
+    __LOG1( "LocalItemResolver:ConstructL() 0x%d", TInt(this) );
+    iFilePath = aFilePath.AllocL();
+    iFileSharing = CUpnpFileSharing::NewL();    
+    iAccessController = CUpnpSecAccessController::NewL();
+    iWait = new (ELeave) CActiveSchedulerWait();
+    iTimer = CUPnPPeriodic::NewL( CActive::EPriorityHigh );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::~CUPnPLocalItemResolver
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+CUPnPLocalItemResolver::~CUPnPLocalItemResolver()
+    {
+    __LOG1( "LocalItemResolver destructor 0x%d", TInt(this) );
+    
+    Cleanup();
+    
+    if ( iTempSession )
+        {
+        iTempSession->RemoveObserver();
+        iAvController.StopBrowsingSession( *iTempSession );
+        }
+
+    delete iFileSharing;
+    iFileSharing = NULL;
+    
+    // cancel any async calls
+    if ( IsActive() )
+        {
+         __LOG( "LocalItemResolver destructor RequestComplete" );
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, KErrNone );
+        }
+    
+    Cancel();
+      
+    delete iFilePath;
+    iFilePath = NULL;
+    
+    delete iAccessController;
+    iAccessController = NULL;
+    
+    delete iSharedItem;
+    iSharedItem = NULL;
+        
+    if( iTimer )
+        {
+        iTimer->Cancel();
+        delete iTimer;
+        iTimer = NULL;
+        }
+    
+    if( iWait->IsStarted() )
+        {
+        iWait->AsyncStop();
+        }
+    delete iWait;
+    iWait = NULL;
+        
+    __LOG( "LocalItemResolver destructor end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::ResolveL
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+void CUPnPLocalItemResolver::ResolveL(
+    MUPnPItemResolverObserver& aObserver )
+    {
+    __LOG1( "LocalItemResolver:Resolve() 0x%d", TInt(this) );
+    __ASSERTD( iState == EStateIdle, __FILE__, __LINE__ );
+    iObserver = &aObserver;
+
+    if ( iOptimisationFlags & UPnPItemResolverFactory::EOmitDrmCheck )
+        {
+        // no need to check DRM ! this branch is empty.
+        }
+    else
+        {
+        // check DRM
+        if ( UPnPFileUtility::IsFileProtectedL( iFilePath->Des() ) )
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+
+    // create item metadata
+    iState = EStateCreatingItem;
+    CUpnpItem* item = UPnPMetadataFetcher::CreateItemFromFileLC(
+        iFilePath->Des() );
+    CleanupStack::Pop( item );
+    __LOG1( "LocalItemResolver:Resolve CreateItemFromFileLC done 0x%d", TInt(this) );
+    if( iSharedItem )
+        {
+        delete iSharedItem;
+        iSharedItem = 0;
+        }
+    iSharedItem = item;
+
+    // state check
+    if ( iState == EStateCreatingItem )
+        {
+        // start local mediaserver
+        if ( iOptimisationFlags & UPnPItemResolverFactory::EOmitLocalMSStart )
+            {
+            // omit mediaserver start - go directly to sharing.
+            DoShareL();
+            }
+        else
+            {
+            // start a session for local MS keepalive
+            CUpnpAVDevice* dummyDevice = CUpnpAVDevice::NewLC();
+            dummyDevice->SetUuidL( KNullDesC8 );
+            dummyDevice->SetDeviceType(CUpnpAVDevice::EMediaServer);    
+            iTempSession = &iAvController.StartBrowsingSessionL( *dummyDevice );
+            CleanupStack::PopAndDestroy( dummyDevice );
+
+            iTempSession->SetObserver( *this );
+            // request for start local MS
+            iState = EStateStartingMS;
+            iTempSession->ReserveLocalMSServicesL();
+            }
+        
+        }
+    else
+        {
+        __LOG( "LocalItemResolver: create item interrupted" );
+		iState = EStateIdle;
+        }
+        
+    __LOG( "LocalItemResolver:Resolve() END" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::DoCancel
+// See upnplocalitemresolver.h
+// --------------------------------------------------------------------------
+void CUPnPLocalItemResolver::DoCancel()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::RunError
+// See upnplocalitemresolver.h
+// --------------------------------------------------------------------------
+TInt CUPnPLocalItemResolver::RunError( TInt aError )
+    {
+    __LOG1( "CUPnPLocalItemResolver::RunError %d", aError );
+    // should never be here.
+    __PANICD( __FILE__, __LINE__ );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::RunL
+// See upnplocalitemresolver.h
+// --------------------------------------------------------------------------
+void CUPnPLocalItemResolver::RunL()
+    {
+    __LOG2( "CUPnPLocalItemResolver::RunL iStatus=%d, iState=%d", 
+        iStatus.Int(), iState );
+
+
+	if ( iState == EStateSharing )
+		{
+		// If the sharing failed
+        if( iStatus.Int() != KErrNone )
+            {
+            // Deny access to the files listed in res-elements
+            SetAccesstoItemResources( *iSharedItem, EFalse );
+            }
+        
+        if( iStatus.Int() == KErrNone )
+    		{
+    	    // replace the IP address in the URI
+    	    __LOG( "LocalItemResolver:replacing IP in URI" );
+    	    TInetAddr address;
+    	    User::LeaveIfError( iMediaServer.Connect() );
+    	    iMediaServer.GetAddress( address );
+    	    UPnPCommonUtils::ReplacePlaceHolderInURIL(
+    	        *iSharedItem, address );
+    	    iMediaServer.Close();
+
+    	    // select the resource
+    	    iResource = &iSelector.SelectResourceL( *iSharedItem );
+            }
+               
+        Complete( iStatus.Int() );
+		}
+		
+    else if ( iState == EStateUnsharing )
+		{	
+		iTimer->Cancel();
+		
+        // Deny access to the files listed in res-elements
+        SetAccesstoItemResources( *iSharedItem, EFalse );
+        
+        iResource = 0; // NOTE: no deletion !
+        iState = EStateIdle;
+        
+        iWait->AsyncStop();
+        }
+        
+    __LOG( "CUPnPLocalItemResolver::RunL end" );
+    }
+    
+    
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::ReserveLocalMSServicesCompleted
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+void CUPnPLocalItemResolver::ReserveLocalMSServicesCompleted(
+    TInt aError )
+    {
+    __LOG( "LocalItemResolver:MSServicesComplete" );
+    __ASSERTD( iState == EStateStartingMS, __FILE__, __LINE__ );
+
+    if ( aError == KErrNone )
+        {
+        TRAPD( err, DoShareL() );
+        if( err != KErrNone )
+            {
+            __LOG1( "LocalItemResolver:MSServicesComplete\
+ DoShareL failed %d", err );
+            }
+        }
+    else
+        {
+        Complete( aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::DoShareL
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+void CUPnPLocalItemResolver::DoShareL()
+    {
+    __LOG( "CUPnPLocalItemResolver::DoShareL start" );
+    // share the item
+    iState = EStateSharing;
+    
+    // Allow access to the files listed in res-elements
+    SetAccesstoItemResources( *iSharedItem, ETrue );
+    
+    // Share the item
+    iFileSharing->ShareItemL( KContainerIdRoot, *iSharedItem, iStatus );
+        
+    SetActive();
+    __LOG( "CUPnPLocalItemResolver::DoShareL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::DoUnshareL
+// See upnplocalitemresolver.h
+// --------------------------------------------------------------------------
+void CUPnPLocalItemResolver::DoUnshareL()
+    {
+    __LOG( "CUPnPLocalItemResolver::DoUnshareL" );
+
+    iState = EStateUnsharing;
+    
+    TInt id;
+    TLex8 idParser( iSharedItem->Id() );
+    TInt status = idParser.Val( id );
+    if ( status == KErrNone )
+        {
+        iFileSharing->UnshareItemL( id, iStatus );
+
+        SetActive();
+        }
+    else
+        {
+        __LOG1( "CUPnPLocalItemResolver::DoUnshareL leave %d", status );
+        User::Leave( status );
+        }
+        
+    __LOG( "CUPnPLocalItemResolver::DoUnshareL - end" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::Item
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+const CUpnpItem& CUPnPLocalItemResolver::Item() const
+    {
+    __ASSERTD( iState == EStateReady, __FILE__, __LINE__ );
+    __ASSERTD( iSharedItem, __FILE__, __LINE__ );
+
+    return *iSharedItem;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::Resource
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+const CUpnpElement& CUPnPLocalItemResolver::Resource() const
+    {
+    __ASSERTD( iState == EStateReady, __FILE__, __LINE__ );
+    __ASSERTD( iResource, __FILE__, __LINE__ );
+
+    return *iResource;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::Complete
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+void CUPnPLocalItemResolver::Complete( TInt aError )
+    {
+    __LOG1( "LocalItemResolver:Complete() %d", aError );
+    __ASSERTD( iState == EStateStartingMS || 
+        iState == EStateSharing, __FILE__, __LINE__ );
+        
+    MUPnPItemResolverObserver& observer = *iObserver;
+    iObserver = 0;
+    if ( aError == KErrNone )
+        {
+        iState = EStateReady;
+        }
+    else
+        {
+        iState = EStateIdle;
+        Cleanup();
+        }
+
+    observer.ResolveComplete( *this, aError );
+    __LOG( "LocalItemResolver:Complete() END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::Cleanup
+// See upnplocalitemresolver.h
+//---------------------------------------------------------------------------
+void CUPnPLocalItemResolver::Cleanup()
+    {
+    __LOG1( "CUPnPLocalItemResolver:Cleanup() iState %d", iState );
+    
+    iObserver = 0;
+
+    if ( iState == EStateCreatingItem )
+        {
+        // signal cancel, wait until create item exits
+        iState = EStateCancel;
+        for ( TInt t = KCancelWaitMaximum;
+            t > 0 && iState != EStateIdle;
+            t -= KCancelWaitResolution )
+            {
+            User::After( TTimeIntervalMicroSeconds32(
+                KCancelWaitResolution ) );
+            }
+        }
+    else if ( iState == EStateStartingMS )
+        {
+        if( iTempSession )
+            {
+            TRAP_IGNORE( iTempSession->CancelReserveLocalMSServicesL() );
+            }
+        }
+    else if ( iState == EStateSharing )
+		{
+        // do nothing, cannot unshare item if sharing hasn't finished yet.
+        __LOG( "CUPnPLocalItemResolver:Cleanup() sharing in progress, do nothing" );
+		} 
+    else if ( iState == EStateUnsharing )
+		{
+        // do nothing, unsharing is still in progress. This happens,
+        // if we start shutting down while previous cleanup hasn't finished yet.
+        __LOG( "CUPnPLocalItemResolver:Cleanup() unsharing in progress, do nothing" );
+		}
+    else if ( iState == EStateCancel )
+		{
+        // do nothing, we shouldn't be here
+        __LOG( "CUPnPLocalItemResolver:Cleanup() cancelling, shouldn't be here.." );
+		}
+    else if ( iSharedItem )
+        {
+        TRAPD( error, DoUnshareL() );
+        
+        if( error == KErrNone )
+            {
+            // wait some time.. 
+            // if unshare doesn't finish in time, just cancel andcontinue
+            __LOG( "CUPnPLocalItemResolver:Cleanup() start timer" );
+            iTimer->Start( KUnshareWait, KUnshareWait, TCallBack( TimerExpired, this ) );
+            iWait->Start();
+            
+            iTimer->Cancel();
+            }
+        else
+            {
+            __LOG1( "CUPnPLocalItemResolver:Cleanup() unshare failed %d", error );
+            }
+        }
+
+    __LOG( "CUPnPLocalItemResolver:Cleanup() end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::SetAccesstoItemResources
+// See upnplocalitemresolver.h
+// --------------------------------------------------------------------------
+void CUPnPLocalItemResolver::SetAccesstoItemResources(
+                                                CUpnpItem& aItem,
+                                                TBool aAccessAllowed )
+    {
+    __LOG( "CUPnPLocalItemResolver::SetAccesstoItemResources" );
+
+    // Get all filenames and set the access for those.
+    RUPnPElementsArray resElements;
+    UPnPItemUtility::GetResElements( aItem, resElements );
+    for( TInt i=0; i<resElements.Count(); i++ )
+        {
+        if( aAccessAllowed )
+            {
+            iAccessController->AddAllowedFile( resElements[i]->FilePath() );
+            }
+        else
+            {
+            iAccessController->RemoveAllowedFile(
+                                        resElements[i]->FilePath() );
+            }
+        }
+    resElements.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalItemResolver::TimerExpired
+// See upnplocalitemresolver.h
+// -------------------------------------------------------------------------- 
+TInt CUPnPLocalItemResolver::TimerExpired( TAny* aArg )
+    {
+    __LOG( "CUPnPLocalItemResolver::TimerExpired" );
+    
+    CUPnPLocalItemResolver* resolver =
+        (static_cast<CUPnPLocalItemResolver*>( aArg ));
+    
+    resolver->iTimer->Cancel();
+    resolver->iWait->AsyncStop();
+    
+    __LOG( "CUPnPLocalItemResolver::TimerExpired end" );
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpremoteitemresolver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,360 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resolver for remote items
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// upnp stack api's
+#include <upnpobject.h>
+#include <upnpitem.h>
+#include <upnpcontainer.h>
+#include <upnpelement.h>
+#include <upnpattribute.h>
+#include <upnpdlnaprotocolinfo.h>
+
+// upnpframework / avcontroller api
+#include "upnpavbrowsingsession.h" // browsing session
+
+// upnpframework / avcontroller helper api
+#include "upnpresourceselector.h" // MUPnPResourceSelector
+#include "upnpitemresolverobserver.h" // observer for this class
+#include "upnpitemutility.h" // for ResourceFromItem
+#include "upnpconstantdefs.h" // for browsing param: KSortNone
+
+// upnpframework / xml parser api
+#include "upnpxmlparser.h" // for xml parsing
+
+// avcontrollerhelper internal
+#include "upnpremoteitemresolver.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerhelper.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+
+
+// METHODS
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::NewL
+//---------------------------------------------------------------------------
+CUPnPRemoteItemResolver* CUPnPRemoteItemResolver::NewL(
+    const TDesC8& aItemId,
+    MUPnPAVBrowsingSession& aHostSession,
+    MUPnPResourceSelector& aSelector,
+    const TDesC8& aBrowseFilter )
+    {
+    CUPnPRemoteItemResolver* self = new (ELeave) CUPnPRemoteItemResolver(
+        aItemId, aHostSession, aSelector, aBrowseFilter );
+    CleanupStack::PushL( self );
+    self->ConstructL( aItemId, aHostSession, aSelector, aBrowseFilter );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::CUPnPRemoteItemResolver
+//---------------------------------------------------------------------------
+CUPnPRemoteItemResolver::CUPnPRemoteItemResolver(
+    const TDesC8& /*aItemId*/,
+    MUPnPAVBrowsingSession& aHostSession,
+    MUPnPResourceSelector& aSelector,
+    const TDesC8& aBrowseFilter )
+    : CUPnPAbstractBrowsingSessionObserver()
+    , iBrowsingSession( aHostSession )
+    , iSelector( aSelector )
+    , iBrowseFilter( aBrowseFilter )
+    {
+    iState = EStateIdle;
+    SetSession( aHostSession );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::ConstructL
+//---------------------------------------------------------------------------
+void CUPnPRemoteItemResolver::ConstructL(
+    const TDesC8& aItemId,
+    MUPnPAVBrowsingSession& /*aHostSession*/,
+    MUPnPResourceSelector& /*aSelector*/,
+    const TDesC8& /*aBrowseFilter*/ )
+    {
+    iItemId = aItemId.AllocL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::~CUPnPRemoteItemResolver
+//---------------------------------------------------------------------------
+CUPnPRemoteItemResolver::~CUPnPRemoteItemResolver()
+    {
+    Cleanup();
+    delete iItemId;
+    iItemId = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::ResolveL
+//---------------------------------------------------------------------------
+void CUPnPRemoteItemResolver::ResolveL(
+    MUPnPItemResolverObserver& aObserver )
+    {
+    __LOG( "RemoteItemResolver:Resolve()" );
+    __ASSERTD( iState == EStateIdle, __FILE__, __LINE__ );
+
+    // enable receiving callbacks here
+    EnableSessionObserver();
+
+    // change state
+    iObserver = &aObserver;
+    iState = EStateActive;
+
+    iRecursionDepth = 0;
+
+    iBrowsingSession.BrowseL(
+        iItemId->Des(), iBrowseFilter,
+        MUPnPAVBrowsingSession::EMetadata,
+        0, 1, KSortNone );
+
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::Item
+//---------------------------------------------------------------------------
+const CUpnpItem& CUPnPRemoteItemResolver::Item() const
+    {
+    __LOG( "RemoteItemResolver:item" );
+    __ASSERTD( iState == EStateReady, __FILE__, __LINE__ );
+    __ASSERTD( iFirstLevelItem, __FILE__, __LINE__ );
+
+    return *iFirstLevelItem;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::Resource
+//---------------------------------------------------------------------------
+const CUpnpElement& CUPnPRemoteItemResolver::Resource() const
+    {
+    __LOG( "RemoteItemResolver:Resource" );
+    __ASSERTD( iState == EStateReady, __FILE__, __LINE__ );
+    __ASSERTD( iResource, __FILE__, __LINE__ );
+
+    return *iResource;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::BrowseResponse
+//---------------------------------------------------------------------------
+void CUPnPRemoteItemResolver::BrowseResponse(
+    const TDesC8& aBrowseResponse,
+    TInt aError,
+    TInt /*aMatches*/,
+    TInt /*aTotalCount*/,
+    const TDesC8& /*aUpdateId*/ )
+    {
+    __ASSERTD( iState == EStateActive, __FILE__, __LINE__ );
+    __LOG1( "RemoteItemResolver:BrowseResponse(%d)", aError );
+
+    // If the browse succeeded, parse the response and process the result
+    if ( aError == KErrNone )
+        {
+        TRAP( aError, BrowseResponseL( aBrowseResponse ) );
+        }
+
+    // It the browse failed, or the parsing/processging of the response
+    // failed, do complete.
+    if( aError != KErrNone )
+        {
+        Complete( aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::BrowseResponseL
+//---------------------------------------------------------------------------
+//
+void CUPnPRemoteItemResolver::BrowseResponseL( const TDesC8& aBrowseResponse )
+    {
+    __LOG( "RemoteItemResolver:BrowseResponseL" );
+
+    // Status code
+    TInt status = KErrNone;
+
+    // Result array
+    RPointerArray<CUpnpObject> array;
+
+    // Create parser
+    CUPnPXMLParser* parser = NULL;
+    TRAP( status, parser = CUPnPXMLParser::NewL() );
+
+    // If the parser was created succesfully...
+    if( status == KErrNone )
+        {
+        CleanupStack::PushL( parser );
+
+        // Parse the result data, and process the result object
+        TRAP( status,
+              parser->ParseResultDataL( array, aBrowseResponse );
+              if(array.Count()!= 0 )
+            	  ProcessResultObjectL( array[0] );
+              else
+            	  {
+            	  //handle error no object
+            	  Complete( KErrNotFound );
+            	  }
+            );
+
+        // Clean up
+        CleanupStack::PopAndDestroy( parser );
+        parser = NULL;
+        }
+
+    // Empty, reset and close the array
+    for( TInt i=0; i<array.Count(); i++ )
+        {
+        delete array[i];
+        }
+    array.Reset();
+    array.Close();
+
+    // If there was an error, forward the leave
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::ProcessResultObjectL
+//---------------------------------------------------------------------------
+void CUPnPRemoteItemResolver::ProcessResultObjectL(
+    const CUpnpObject* aResult )
+    {
+    if ( aResult->ObjectType() != EUPnPItem )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // copy the item
+    CUpnpItem* item = CUpnpItem::NewL();
+    CleanupStack::PushL( item );
+    item->CopyL( *aResult );
+
+    // select the resource
+    __LOG( "RemoteItemResolver:calling SelectResource" );
+    const CUpnpElement& res =
+        iSelector.SelectResourceL( *item );
+
+    if ( iRecursionDepth == 0 )
+        {
+        __ASSERTD( !iFirstLevelItem, __FILE__, __LINE__ );
+        CleanupStack::Pop( item );
+        iFirstLevelItem = item;
+        item = 0; // take ownership
+        }
+
+    HBufC8* recurringId = 0;
+
+
+    if ( recurringId )
+        {
+        // continue recursion !
+        ++iRecursionDepth;
+        __LOG1( "RemoteItemResolver:ProcessResult - recur %d",
+            iRecursionDepth );
+        iBrowsingSession.BrowseL(
+            recurringId->Des(), iBrowseFilter, 
+            MUPnPAVBrowsingSession::EMetadata,
+            0, 1, KSortNone );
+        CleanupStack::PopAndDestroy( recurringId );
+        }
+    else
+        {
+        // finished browsing the item
+        __ASSERTD( !iLastLevelItem, __FILE__, __LINE__ );
+        __LOG( "RemoteItemResolver:ProcessResult - finished" );
+        if ( iRecursionDepth > 0 )
+            {
+            // pointed object is DIFFERENT from first level object
+            iLastLevelItem = CUpnpItem::NewL();
+            iLastLevelItem->CopyL( *item );
+            }
+        iResource = &res;
+        Complete( KErrNone );
+        }
+
+    if( item )
+        {
+        CleanupStack::PopAndDestroy( item );
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::Complete
+//---------------------------------------------------------------------------
+void CUPnPRemoteItemResolver::Complete( TInt aError )
+    {
+    __ASSERTD( iState == EStateActive, __FILE__, __LINE__ );
+
+    DisableSessionObserver();
+    MUPnPItemResolverObserver& observer = *iObserver;
+    iObserver = 0;
+    if ( aError == KErrNone )
+        {
+        iState = EStateReady;
+        }
+    else
+        {
+        iState = EStateIdle;
+        Cleanup();
+        }
+
+    observer.ResolveComplete( *this, aError );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPRemoteItemResolver::Cleanup
+//---------------------------------------------------------------------------
+void CUPnPRemoteItemResolver::Cleanup()
+    {
+    DisableSessionObserver();
+
+    if ( iState == EStateActive )
+        {
+        iBrowsingSession.CancelBrowse();
+        }
+
+    iObserver = 0;
+
+    delete iFirstLevelItem;
+    iFirstLevelItem = 0;
+
+    delete iLastLevelItem;
+    iLastLevelItem = 0;
+
+    iResource = 0;
+
+    iState = EStateIdle;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnpresourceselector.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Interface for selecting a resource within an item
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <upnpitem.h>
+#include "upnpelement.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpitemutility.h" // ResourceFromItemL, GetResElements
+#include "upnpconstantdefs.h" // KElementRes
+#include "upnpresourceselector.h"
+
+
+
+
+
+
+// ==========================================================================
+// METHODS for TUPnPSelectDefaultResource
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// TUPnPSelectDefaultResource::SelectResourceL
+// this algorithm works BEST
+//---------------------------------------------------------------------------
+EXPORT_C const CUpnpElement& TUPnPSelectDefaultResource::
+    SelectResourceL(
+    const CUpnpItem& aItem )
+    {
+    return UPnPItemUtility::ResourceFromItemL( aItem );
+    }
+
+
+// ==========================================================================
+// METHODS for TUPnPSelectFirstResource
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// TUPnPSelectFirstResource::SelectResourceL
+// this algorithm works FAST
+//---------------------------------------------------------------------------
+EXPORT_C const CUpnpElement& TUPnPSelectFirstResource::
+    SelectResourceL(
+    const CUpnpItem& aItem )
+    {
+    return UPnPItemUtility::FindElementByNameL( aItem, KElementRes );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for UPnP AV Controller server
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+upnpavcontrollerserver.mmp
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/group/upnpavcontrollerserver.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      project file for AVController server library
+*
+*/
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET          upnpavcontrollerserver.exe
+TARGETTYPE      exe
+CAPABILITY      CAP_SERVER
+VENDORID        VID_DEFAULT
+UID             0x1000008d 0x20007566
+
+VERSION         10.1
+paged
+
+EPOCHEAPSIZE    4096 2097152 // 4K / 2M
+
+SOURCEPATH      ../src
+SOURCE          upnpavcontrollerserver.cpp
+SOURCE          upnpavcontrollersession.cpp
+SOURCE          upnpavdispatcher.cpp
+SOURCE          upnpavactioninfo.cpp
+SOURCE          upnpavcontrollerimpl.cpp
+SOURCE          upnpplaybacksession.cpp
+SOURCE          upnpfilesharingactive.cpp
+SOURCE          upnpbrowsingsession.cpp
+SOURCE          upnpaverrorhandler.cpp
+SOURCE          upnpavtimer.cpp
+SOURCE          upnpdevicerepository.cpp
+SOURCE          upnpavdeviceextended.cpp
+SOURCE          upnpdevicediscoverymessage.cpp
+SOURCE          upnpdownloadsession.cpp
+SOURCE          upnpuploadsession.cpp
+SOURCE          upnpfiletransfersessionbase.cpp
+SOURCE          upnpresourcehelper.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../inc
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../upnpavcontrollerclient/inc
+
+// system
+LIBRARY         euser.lib 
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         insock.lib
+LIBRARY         centralrepository.lib
+LIBRARY         charconv.lib
+
+// upnp stack
+LIBRARY         avmediaserverclient.lib
+LIBRARY         upnpserviceframework.lib
+LIBRARY         upnpcontrolpointbase.lib
+LIBRARY         upnpavobjects.lib
+LIBRARY         upnpipserversutils.lib
+LIBRARY         avcontrolframework.lib
+
+// UPnP framework
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         upnpavcontrollerhelper.lib
+LIBRARY         upnpxmlparser.lib
+LIBRARY         upnputilities.lib
+LIBRARY         upnpsecurity.lib
+LIBRARY         httptransfer.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavactioninfo.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      callback dispatcher helper class
+*
+*/
+
+
+
+
+
+
+#ifndef C_CUPNPAVACTIONINFO_H
+#define C_CUPNPAVACTIONINFO_H
+
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MUpnpAVControlPointObserver;
+class CUPnPAVControllerImpl;
+
+// CLASS DECLARATION
+
+/**
+*  UPnP AV Controller server, callback dispatcher helper class
+*  
+*
+*  @lib - 
+*  @since Series 60 3.1
+*/
+class CUPnPAVActionInfo : public CBase
+    {
+public:  // Constructors and destructor
+        
+    /**
+     * Two-phased constructor.
+     */
+    static CUPnPAVActionInfo* NewLC();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CUPnPAVActionInfo* NewL();    
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPAVActionInfo();
+
+private: //
+
+    /**
+     * Constructs the action info
+     */
+    CUPnPAVActionInfo( );
+
+    /**
+     * Perform the second phase construction
+     */
+    void ConstructL();
+
+public: // New methods
+
+    /**
+     * Sets session id
+     * @param aSessionid session id
+     */
+    void SetSessionId( TInt aSessionId );
+    
+    /**
+     * Returns session id
+     * @return session id
+     */
+    TInt SessionId() const;
+    
+    /**
+     * Sets AV Control Point observer
+     * @param aObserver AV Control Point observer
+     */
+    void SetObserver( MUpnpAVControlPointObserver& aObserver );
+    
+    /**
+     * Returns AV Control Point observer
+     * @return AV Control Point observer
+     */
+    MUpnpAVControlPointObserver& Observer() const;
+    
+    /**
+     * Sets Uuid
+     * @param Uuid
+     */
+    void SetUuidL( const TDesC8& aUuid );
+    
+    /**
+     * Returns Uuid
+     * @return Uuid
+     */
+    const TDesC8& Uuid() const;
+    
+private:
+    
+    TInt                            iSessionId;
+    
+    MUpnpAVControlPointObserver*    iObserver; // Not own
+    
+    HBufC8*                         iUuid; // Own
+        
+    };
+
+
+#endif // C_CUPNPAVACTIONINFO_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrollerimpl.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,547 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AV Controller Implementation
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_UPNPAVCONTROLLERIMPL_H
+#define C_UPNPAVCONTROLLERIMPL_H
+
+// INDLUDE FILES
+#include <e32base.h>
+#include <upnpavcontrolpointobserver.h>
+#include <upnpmediaserverclient.h>
+#include "upnpavcontrollerglobals.h"
+#include "upnpconnectionmonitorobserver.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVDeviceObserver;
+class MUPnPAVMediaObserver;
+class MUPnPAVFileObserver;
+class CUPnPPlaybackSession;
+class CUpnpAVControllerServer;
+class CUpnpAVDevice;
+class CUpnpHttpMessage;
+class CUpnpDevice;
+class CUpnpAVDeviceExtended;
+class CUPnPBrowsingSession;
+class CUpnpDeviceDiscoveryMessage;
+
+class CUPnPUploadSession;
+class CUPnPDownloadSession;
+
+/**
+ *  AV Controller server side implementation. Impmements the base session. 
+ *  Rendering and browsing sessions are created from this session.
+ *  Handles device discovery and fetching of device listst.
+ *
+ *  @lib upnpavcontrollerclient.lib
+ *  @since S60 v3.1
+ */
+class CUPnPAVControllerImpl :   public CBase,
+                                public MUPnPConnectionMonitorObserver
+                                
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aControlPoint control point reference
+     * @param aClient media server client reference
+     * @param aDispatcher callback dispatcher reference
+     * @param aServer server class reference
+     */
+    static CUPnPAVControllerImpl* NewL
+        (
+        RUpnpMediaServerClient& aClient,
+        CUpnpAVControllerServer& aServer
+        );
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPAVControllerImpl();
+    
+private:
+
+    /**
+     * Private constructor
+     *
+     * @param aControlPoint control point reference
+     * @param aClient media server client reference
+     * @param aDispatcher callback dispatcher reference
+     * @param aServer server class reference          
+     */
+    CUPnPAVControllerImpl
+    (
+    RUpnpMediaServerClient& aClient,
+    CUpnpAVControllerServer& aServer
+    );    
+    
+    /**
+     * Destructor
+     */
+    void ConstructL();    
+
+public: // From MUPnPConnectionMonitorObserver
+    
+    /**
+     * See upnpconnectionmonitorobserver.h
+     */
+    void ConnectionLost();
+    
+public: // New functions
+
+    /**
+     * Handles UPnP device discoveries.
+     * @since Series 60 2.6
+     * @param aDevice Device that is discovered.
+     */
+    void DeviceDiscoveredL( CUpnpAVDeviceExtended& aDevice );
+
+    /**
+     * Handles UPnP device disappears.
+     * @since Series 60 2.6
+     * @param aDevice Device that disappeared.
+     */
+    void DeviceDisappearedL( CUpnpAVDeviceExtended& aDevice );
+    
+
+    /**
+     * Enables device discovery by storing a message to server side, which
+     * is completed when a device has been discovered.
+     *
+     * @param aMessage message
+     */
+    void EnableDeviceDiscoveryL( const RMessage2& aMessage );
+        
+    /**
+     * Disables (cancels) device discovery (and message).
+     */
+    void DisableDeviceDiscoveryL();
+    
+    /**
+     * Returns a discovered/disappeared device to client side.
+     *
+     * @param aMessage message
+     */
+    void GetDeviceL( const RMessage2& aMessage );
+    
+    /**
+     * Returns the size of device list to client side.
+     *
+     * @param aMessage message
+     */
+    void GetDeviceListSizeL( const RMessage2& aMessage );
+    
+    /**
+     * Returns the device list to client side.
+     *
+     * @param aMessage message
+     */
+    void GetDeviceListL( const RMessage2& aMessage );
+    
+    /**
+     * Creates a rendering session.
+     *
+     * @param aMessage message
+     */
+    void CreateRenderingSessionL( const RMessage2& aMessage );
+    
+    /**
+     * Destroys a rendering session
+     *
+     * @param aMessage message
+     */
+    void DestroyRenderingSessionL( const RMessage2& aMessage );
+    
+    /**
+     * Enables (unsolicited) eventing from a remote device. Stores
+     * the message in to redering session to return an event.
+     *
+     * @param aMessage message
+     */
+    void EventRequestL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels eventing message.
+     *
+     * @param aMessage message
+     */
+    void CancelEventRequestL( const RMessage2& aMessage );
+    
+    /**
+     * Sets URI
+     *
+     * @param aMessage message
+     */
+    void SetURIL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels SetURI (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelSetURIL( const RMessage2& aMessage );
+    
+    /**
+     * Sets Next URI
+     *
+     * @param aMessage message
+     */
+    void SetNextURIL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels SetNextURI (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelSetNextURIL( const RMessage2& aMessage );
+    
+    /**
+     * Send the play-action
+     *
+     * @param aMessage message
+     */
+    void PlayL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels the play-action (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelPlayL( const RMessage2& aMessage );
+
+    /**
+     * Send the stop-action
+     *
+     * @param aMessage message
+     */
+    void StopL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels stop (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelStopL( const RMessage2& aMessage );
+
+    /**
+     * Send the pause-action
+     *
+     * @param aMessage message
+     */
+    void PauseL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels pause (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelPauseL( const RMessage2& aMessage );
+
+    /**
+     * Send the setvolume-action
+     *
+     * @param aMessage message
+     */
+    void SetVolumeL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels setvolume (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelSetVolumeL( const RMessage2& aMessage );
+    
+    /**
+     * Send the getvolume-action
+     *
+     * @param aMessage message
+     */
+    void GetVolumeL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels getvolume (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelGetVolumeL( const RMessage2& aMessage );
+    
+    /**
+     * Send the setmute-action
+     *
+     * @param aMessage message
+     */
+    void SetMuteL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels setmute (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelSetMuteL( const RMessage2& aMessage );
+    
+    /**
+     * Send the getmute-action
+     *
+     * @param aMessage message
+     */
+    void GetMuteL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels getmute (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelGetMuteL( const RMessage2& aMessage );
+    
+    /**
+     * Send the getpositioninfo-action
+     *
+     * @param aMessage message
+     */
+    void GetPositionInfoL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels getpositioninfo (basically just ignores the result)
+     *
+     * @param aMessage message
+     */
+    void CancelGetPositionInfoL( const RMessage2& aMessage );
+    
+    /**
+     * Create a browsing session
+     *
+     * @param aMessage message
+     */
+    void CreateBrowsingSessionL( const RMessage2& aMessage );
+    
+    /**
+     * Destroy a browsing session
+     *
+     * @param aMessage message
+     */
+    void DestroyBrowsingSessionL( const RMessage2& aMessage );
+    
+    /**
+     * Get browse response (return the size of it to client side)
+     *
+     * @param aMessage message
+     */
+    void GetBrowseResponseSizeL( const RMessage2& aMessage );  
+
+    /**
+     * Cancel get browse response (ignore result)
+     *
+     * @param aMessage message
+     */
+    void CancelGetBrowseResponseSizeL( const RMessage2& aMessage );
+
+    /**
+     * Return browse response to client side
+     *
+     * @param aMessage message
+     */
+    void GetBrowseResponseL( const RMessage2& aMessage );
+
+    /**
+     * Get search response (return the size of it to client side)
+     *
+     * @param aMessage message
+     */
+    void GetSearchResponseSizeL( const RMessage2& aMessage );
+
+    /**
+     * Cancel search response (ignore result)
+     *
+     * @param aMessage message
+     */
+    void CancelGetSearchResponseSizeL( const RMessage2& aMessage );
+
+    /**
+     * Return search response to client side
+     *
+     * @param aMessage message
+     */
+    void GetSearchResponseL( const RMessage2& aMessage );
+    
+    /**
+     * Get search capabilities (return the size of it to client side)
+     *
+     * @param aMessage message
+     */
+    void GetSearchCapabitiesSizeL( const RMessage2& aMessage );
+    
+    /**
+     * Cancel get search capabilities (ignore result)
+     *
+     * @param aMessage message
+     */
+    void CancelGetSearchCapabitiesSizeL( const RMessage2& aMessage );
+    
+    /**
+     * Return search capabilities to client side
+     *
+     * @param aMessage message
+     */
+    void GetSearchCapabitiesL( const RMessage2& aMessage );
+
+    /**
+     * Create container action.
+     *
+     * @param aMessage message
+     */
+    void CreateContainerL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels create container.
+     *
+     * @param aMessage message
+     */
+    void CancelCreateContainerL( const RMessage2& aMessage );
+    
+    /**
+     * Delete object action
+     *
+     * @param aMessage message
+     */
+    void DeleteObjectL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels delete object
+     *
+     * @param aMessage message
+     */
+    void CancelDeleteObjectL( const RMessage2& aMessage );
+
+    /**
+     * Stores a message in to rendering or browsing session, which is
+     * completed when the session specific device has disappeared. As a
+     * result the client knows that the device is no longer available and
+     * the session has became absolete.
+     *
+     * @param aMessage message
+     */
+    void DeviceDisappearedRequestL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels the msg.
+     *
+     * @param aMessage message
+     */
+    void CancelDeviceDisappearedRequestL( const RMessage2& aMessage );
+    
+    /**
+     * Stores a message in to base session, which is completed when the
+     * WLAN is disconnected.
+     *
+     * @param aMessage message
+     */
+    void MonitorConnectionL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels the msg.
+     *
+     * @param aMessage message
+     */
+    void CancelMonitorConnectionL( const RMessage2& aMessage );
+
+    void CreateDownloadSessionL( const RMessage2& aMessage );
+    
+    void DestroyDownloadSessionL( const RMessage2& aMessage );
+
+    void StartDownloadL( const RMessage2& aMessage );
+    
+    void StartDownloadFHL( const RMessage2& aMessage );
+    
+    void CancelDownloadL( const RMessage2& aMessage );
+
+    void CancelAllDownloadsL( const RMessage2& aMessage );
+    
+    void StartTrackingDownloadProgressL( const RMessage2& aMessage );
+
+    void StopTrackingDownloadProgressL( const RMessage2& aMessage );
+
+    void GetDownloadEventL( const RMessage2& aMessage );
+    
+    void CancelGetDownloadEventL( const RMessage2& aMessage );
+
+    void CreateUploadSessionL( const RMessage2& aMessage );
+    
+    void DestroyUploadSessionL( const RMessage2& aMessage );    
+
+    void StartUploadL( const RMessage2& aMessage );
+    
+    void CancelUploadL( const RMessage2& aMessage );
+
+    void CancelAllUploadsL( const RMessage2& aMessage );
+    
+    void StartTrackingUploadProgressL( const RMessage2& aMessage );
+
+    void StopTrackingUploadProgressL( const RMessage2& aMessage );
+
+    void GetUploadEventL( const RMessage2& aMessage );
+    
+    void CancelGetUploadEventL( const RMessage2& aMessage );
+
+private:
+
+    /**
+     * Device queu handling. Checks the queu and dequeus it if needed.
+     *
+     * @param aDevice av device
+     * @param aType discovered/disappeared
+     */
+    void DequeDeviceL( const CUpnpAVDevice& aDevice,
+        TAVControllerDeviceDiscovery aType );
+
+private:
+    
+    RUpnpMediaServerClient&     iMediaServer; // Not own       
+    
+    CUpnpAVControllerServer&    iServer; // Not own       
+    
+    RMessage2*                  iDeviceDiscoveryMsg; // Own
+    
+    TBool                       iDeviceDiscoveryEnabled;
+    
+    RMessage2*                  iConnectionMsg; // Own
+    
+    HBufC8*                     iDeviceRespBuf; // Own
+    
+    HBufC8*                     iDeviceListRespBuf; // Own
+    
+    RPointerArray<CUPnPPlaybackSession> iPlaybackSessions; // Own
+    
+    RPointerArray<CUPnPBrowsingSession> iBrowsingSessions; // Own
+    
+    RPointerArray<CUPnPUploadSession>   iUploadSessions; // Own
+    
+    RPointerArray<CUPnPDownloadSession> iDownloadSessions; // Own
+    
+    
+    TSglQue<CUpnpDeviceDiscoveryMessage>        iDeviceMsgQue; // Own
+    TSglQueIter<CUpnpDeviceDiscoveryMessage>    iDeviceMsgQueIter;
+    };
+
+#endif // C_UPNPAVCONTROLLERIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrollerserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AV Controller server
+*
+*/
+
+
+
+
+
+
+#ifndef C_CUPNPAVCONTROLLERSERVER_H
+#define C_CUPNPAVCONTROLLERSERVER_H
+
+
+// INCLUDES
+#include "upnpavcontrollerserver.pan"
+
+#include <upnpaction.h>
+#include <upnpservice.h>
+#include <upnpdevice.h>
+#include <e32base.h>
+#include <upnpmediaserverclient.h>
+#include "upnpconnectionmonitorobserver.h"
+
+#include "upnpavtimer.h"
+
+// FORWARD DECLARATIONS
+class CUpnpAVControlPoint;
+class CUPnPAVDispatcher;
+class CUPnPConnectionMonitor;
+class CUPnPDeviceRepository;
+
+// CLASS DECLARATION
+
+/**
+*  UPnP Media Server container.
+*  Provides interface for Media Server maintanace purposes.
+*
+*  @lib - 
+*  @since Series 60 3.1
+*/
+class CUpnpAVControllerServer :  public CPolicyServer,
+                                 public MUPnPAVTimerCallback,
+                                 public MUPnPConnectionMonitorObserver
+    {
+
+private: // Internal server state
+
+    enum TAVControllerServerState
+        {
+        EStateUndefined = 0,
+        EStateStartingUp,
+        EStateRunning,
+        EStateShuttingDown
+        };    
+    
+public:  // Constructors and destructor
+        
+    /**
+     * Two-phased constructor.
+     */
+    static CUpnpAVControllerServer* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpAVControllerServer();
+    
+public: // New functions        
+     
+    /**
+     * Increment the count of the active sessions for this server
+     */
+    void IncrementSessions();
+
+    /**
+     * Decrement the count of the active sessions for this server. 
+     */
+    void DecrementSessions();
+    
+    /**
+     * Handles UPnP device discoveries.
+     * 
+     * @param aDevice Device that is discovered.
+     */
+    void DeviceDiscoveredL( CUpnpDevice& aDevice);
+
+    /**
+     * Handles UPnP device disappears.
+     * 
+     * @param aDevice Device that disappeared.
+     */
+    void DeviceDisappearedL( CUpnpDevice& aDevice);
+    
+    /**
+     * Handles UPnP device disappears.
+     * 
+     * @param aUuid Device that disappeared.
+     */
+    void DeviceDisappearedL( const TDesC8& aUuid );
+    
+    /**
+     * Return a reference to the control point
+     *
+     * @return reference to the control point
+     */
+    CUpnpAVControlPoint& ControlPoint();
+
+    /**
+     * Return a reference to the s60 MS session
+     *
+     * @return reference to the s60 MS session
+     */
+    RUpnpMediaServerClient& MediaServer();
+    
+    /**
+     * Return a reference to the callback dispatcher
+     *
+     * @return reference to the callback dispatcher
+     */
+    CUPnPAVDispatcher& Dispatcher();
+    
+    /**
+     * Return a reference to the device repository
+     *
+     * @return reference to the device repository
+     */
+    CUPnPDeviceRepository& DeviceRepository();
+    
+    TInt IAP();
+    
+         
+    /**
+     * First stage startup for the server thread
+     * 
+     * @return return KErrNone or panics thread
+     */
+    static TInt ThreadFunction();
+    
+    /**
+     * Starts the s60 MS if not started. Increments the reference ocunt
+     * 
+     * @param aMessage message
+     */
+    void StartMediaServerL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels the start
+     * 
+     * @param aMessage message
+     */
+    void CancelStartMediaServerL( const RMessage2& aMessage );
+
+    /**
+     * Stops the s60 MS if reference count hits 0
+     * 
+     * @param aMessage message
+     */
+    void StopMediaServerL( const RMessage2& aMessage );
+
+    /**
+     * Returns ETrue if someone is using the local Media Server
+     * 
+     * @param aMessage message
+     */
+    void MSServicesInUse( const RMessage2& aMessage );
+    
+    /**
+     * Observer callback for Connection Manager GetProtocolInfo function.
+     * 
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSource
+     * @param aSink
+     */ 
+    void CmProtocolInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSource, 
+        const TDesC8& aSink );
+    
+protected:  // From CActive
+
+    /**
+     * Process any errors
+     * @param aError the leave code reported.
+     * @result return KErrNone if leave is handled
+     */
+    TInt RunError( TInt aError );
+    
+protected: // From MUPnPAVTimerCallback
+
+    /**
+     * See upnpavtimercallback.h
+     */
+    void UPnPAVTimerCallback( CUPnPAVTimer::TAVTimerType aType ); 
+
+protected: // From CUPnPConnectionMonitorObserver
+
+    /**
+     * See upnpconnectionmonitorobserver.h
+     */
+    void ConnectionLost();
+
+private: // 2nd phase construct
+
+    /**
+     * Constructs the server 
+     *
+     * @param aPriority CServer2 input parameter
+     */
+    CUpnpAVControllerServer(TInt aPriority);
+
+    /**
+     * Perform the second phase construction of a CUpnpMessageHandler object
+     */
+    void ConstructL() ;
+
+public:
+        
+    /**
+     * Perform the second phase startup. Starts up AV Control Point and
+     * Dispatcher
+     */
+    void StartUpL();
+
+    /**
+     * Perform the second phase startup. Starts up AV Control Point and
+     * Dispatcher
+     */
+    void CancelStartUp();
+    
+private: // New methods 
+
+    /**
+     * Panic client. 
+     *
+     * @param aMessage RMessage2
+     * @param aPanic panic code
+     */
+    static void PanicClient( const RMessage2& aMessage,
+        TAVControllerServerPanic aPanic );
+  
+    /**
+     * Panic the server. 
+     *
+     * @param param aPanic the panic code
+     * @return a updateId of container
+     */
+    static void PanicServer(TAVControllerServerPanic aPanic);
+  
+    /**
+     * Second stage startup for the server thread 
+     */
+    static void ThreadFunctionL();
+    
+    /**
+     * Handles embedded discovered device. Recoursive.
+     *
+     * @param aDevice device
+     * @param aDepth device depth
+     */
+    void HandleEmbeddedDiscoveredDevicesL( CUpnpDevice& aDevice,
+        TInt aDepth );
+    
+    /**
+     * Handles embedded disappeared device. Recoursive.
+     *
+     * @param aDevice device
+     * @param aDepth device depth
+     */
+    void HandleEmbeddedDisappearedDevicesL( CUpnpDevice& aDevice,
+        TInt aDepth );
+        
+    /**
+     * Stops the local media server
+     */
+    void StopMediaServer();
+    
+    /**
+     * Error handler for failed protocolinfo-action
+     *
+     * @param aUuid device uuid
+     * @param aDev pointer to the device in repository
+     */
+    void HandleFailedProtocolInfoResponse( const TDesC8& aUuid );                  
+
+private: // From CServer
+
+    /**
+     * Create a time server session, and return a pointer to the created
+     * object
+     * @param aVersion the client version 
+     * @result pointer to new session
+     */
+    CSession2* NewSessionL( const TVersion& aVersion,
+        const RMessage2& aMessage )  const;
+    
+private:
+    
+    /** @var iSessionCount the number of session owned by this server */
+    TInt iSessionCount;
+    
+    CUpnpAVControlPoint*        iAVControlPoint; // Own
+    RUpnpMediaServerClient      iMediaServer; // Own
+    
+    CUPnPAVDispatcher*          iDispatcher; // Own
+
+    CUPnPAVTimer*               iServerTimer; // Own
+    
+    CUPnPAVTimer*               iMSTimer; // Own
+
+    CUPnPConnectionMonitor*     iMonitor; // Own
+    
+    TInt                        iServerUserCount;
+    
+    TBool                       iMediaServerOnline;
+    
+    TBool                       iStartingMS;
+    
+    TBool                       iMSActivatedBeforeStart;
+    
+    RPointerArray<RMessage2>    iStartMessages; // Own
+    
+    CUPnPDeviceRepository*      iDeviceRepository; // Own
+    
+    TInt                        iDiscoveredDeviceCount;    
+    
+    TInt                        iDisappearedDeviceCount;
+    
+    TInt                        iShutdownTimeoutValue;
+    
+    TInt                        iIAP;    
+
+    TAVControllerServerState    iServerState;
+
+    
+    };
+
+
+#endif // C_CUPNPAVCONTROLLERSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrollerserver.pan	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:     AvController server panic codes
+*
+*/
+
+
+
+
+
+#ifndef __AVControllerServer_PAN__
+#define __AVControllerServer_PAN__
+
+/** Panic Category */
+
+/** MessageHandler panic codes */
+enum TAVControllerServerPanic
+    {
+    EAVControllerServerBadRequest = 1,
+    EAVControllerServerBadDescriptor = 2,
+    EAVControllerServerSrvCreateServer = 3,
+    EAVControllerServerMainSchedulerError = 4,
+    EAVControllerServerCreateTrapCleanup = 5,
+    EAVControllerServerSrvSessCreateTimer = 6,
+	EAVControllerServerReqAlreadyPending = 7,		//	A request is already pending
+	EAVControllerServerDifferencesInIap = 8
+    };
+
+#endif // __AVControllerServer_PAN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrollersession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AV Controller server session
+*
+*/
+
+
+
+
+
+
+#ifndef C_CUPNPAVCONTROLLERSESSION_H
+#define C_CUPNPAVCONTROLLERSESSION_H
+
+// INCLUDES
+#include "upnpavcontrollerglobals.h"
+
+#include <e32base.h>
+#include "upnpconnectionmonitorobserver.h"
+
+
+// FORWARD DECLARATIONS
+class CUpnpAVControllerServer;
+class CUPnPAVControllerImpl;
+class CUpnpAVDeviceExtended;
+class CUpnpDevice;
+
+// CLASS DECLARATION
+
+/** 
+  An instance of class CUpnpAVControllerSession is created for each client
+  */
+class CUpnpAVControllerSession :    public CSession2,
+                                    public MUPnPConnectionMonitorObserver
+{
+
+public: // New methods
+
+    /**
+    * Create a CUpnpAVControllerSession object using two phase construction,
+    * and return a pointer to the created object
+    * @result pointer to new session
+    */
+    static CUpnpAVControllerSession* NewL(
+        CUpnpAVControllerServer& aServer );
+
+    /**
+    * Create a CUpnpAVControllerSession object using two phase construction,
+    * and return a pointer to the created object
+    * @result pointer to new session
+    */
+    static CUpnpAVControllerSession* NewLC(
+        CUpnpAVControllerServer& aServer );
+
+    /**
+    * Destroy the object and release all memory objects
+    */
+    virtual ~CUpnpAVControllerSession();
+
+
+public: // From CSession
+    /**
+    * Called after a service request from client; from class CSession
+    * @param aMessage message from client
+    *        (containing requested operation and any data)
+    */
+    void ServiceL( const RMessage2& aMessage );
+public: // From MUPnPConnectionMonitorObserver
+
+    /**
+     * Handles UPnP device discoveries.
+     * @since Series 60 2.6
+     * @param aDevice Device that is discovered.
+     */
+    void DeviceDiscoveredL( CUpnpAVDeviceExtended& aDevice );
+
+    /**
+     * Handles UPnP device disappears.
+     * @since Series 60 2.6
+     * @param aDevice Device that disappeared.
+     */
+    void DeviceDisappearedL( CUpnpAVDeviceExtended& aDevice );
+
+
+    void ConnectionLost();
+
+private: // New methods
+
+    /**
+    * Perform the first phase of two phase construction 
+    */
+    CUpnpAVControllerSession( CUpnpAVControllerServer& aServer );
+
+    /**
+    * Perform the second phase construction of the object
+    */
+    void ConstructL() ;
+
+    /**
+    * Causes the client thread to panic
+    * @param panic code
+    */
+    void PanicClient( const RMessage2& aMessage, TInt aPanic ) const;
+
+private: 
+
+    /** @var iMediaServer pointer to Media Server */
+    
+    CUpnpAVControllerServer&    iAVControllerServer;
+    CUPnPAVControllerImpl*      iAVController;
+};
+
+#endif // C_CUPNPAVCONTROLLERSESSION_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavdeviceextended.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,366 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a device data class used internally in AVC server
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVDEVICEEXTENDED_H_
+#define C_UPNPAVDEVICEEXTENDED_H_
+
+// Include files
+#include <e32base.h>
+#include "upnpavdevice.h"
+
+// FORWARD DECLARATIONS
+class CUpnpDlnaProtocolInfo;
+class CUpnpItem;
+
+/**
+ * Extended UPnP device. Contains protocolinfo and a reference count for
+ * subscibe actions.
+ *
+ */
+class CUpnpAVDeviceExtended: public CUpnpAVDevice
+    {
+ 
+public:
+
+    enum TDLNADeviceType
+        {
+        EUPnP = 0,
+        EDMR,
+        EDMP,
+        EDMS
+        }; 
+ 
+public:
+
+    /**
+     * Static 1st phase constructor
+     * 
+     * @param aDevice base device
+     * @return new instance
+     */    
+    static CUpnpAVDeviceExtended* NewL( const CUpnpAVDevice& aDevice );
+
+    /**
+     * Static 1st phase constructor
+     * 
+     * @param aDevice base device
+     * @return new instance
+     */    
+    static CUpnpAVDeviceExtended* NewL(
+        const CUpnpAVDeviceExtended& aDevice );
+
+    /**
+     * Static 1st phase constructor
+     *
+     * @return new timer instance
+     */    
+    static CUpnpAVDeviceExtended* NewL();
+
+    /**
+     * Destructor
+     */    
+    virtual ~CUpnpAVDeviceExtended();
+    
+private:
+
+    /**
+     * Private constructor
+     */
+    CUpnpAVDeviceExtended();
+
+    /**
+     * 2nd phase constructor
+     */    
+    void ConstructL();
+    
+
+public: // New functions
+
+    /**
+     * Sets sink protocolinfo
+     * 
+     * @param aProtocolInfo sink protocolinfo
+     */    
+    void SetSinkProtocolInfoL( const TDesC8& aProtocolInfo );
+    
+    /**
+     * Returns devices sink protocolinfos as an array
+     * 
+     * @return array of protocolinfos
+     */    
+    const RPointerArray<CUpnpDlnaProtocolInfo>&
+        SinkProtocolInfo() const;
+    
+    /**
+     * Sets source protocolinfo
+     * 
+     * @param aProtocolInfo source protocolinfo
+     */    
+    void SetSourceProtocolInfoL( const TDesC8& aProtocolInfo );
+    
+    /**
+     * Returns devices source protocolinfos as an array
+     * 
+     * @return array of protocolinfos
+     */    
+    const RPointerArray<CUpnpDlnaProtocolInfo>&
+        SourceProtocolInfo() const;
+    
+    /**
+     * Increases devices subscription count
+     * 
+     * @return subscription count
+     */    
+    TInt IncreaseSubscriptionCount();
+    
+    /**
+     * Decreases devices subscription count
+     * 
+     * @return subscription count
+     */    
+    TInt DecreaseSubscriptionCount();
+    
+    /**
+     * Returns subscription count
+     * 
+     * @return subscription count
+     */    
+    TInt SubscriptionCount() const;
+    
+    /**
+     * Sets device capabilities
+     * 
+     * @param aListOfMimeTypes
+     */    
+    void SetCapabilitiesBySupportedMimeTypesL(
+        const TDesC8& aListOfMimeTypes );
+        
+    /**
+     * Sets if the device is a local device (S60 Media Server)
+     * 
+     * @param aLocal
+     */    
+    void SetLocal( TBool aLocal );
+    
+    /**
+     * Return if the device is local
+     * 
+     * @return ETrue if the device is local
+     */    
+    TBool Local() const;
+    
+    /**
+     * Matches protocolinfo and return ETrue if it matches
+     * 
+     * @param aProtocolInfo objects protocolinfo
+     * @return ETrue if it matches
+     */    
+    TBool MatchSinkProtocolInfo( const TDesC8& aInfo ) const;
+    
+    /**
+     * Validates transfer
+     * 
+     * @param aProtocolInfo objects protocolinfo
+     * @return ETrue if it matches
+     */    
+    TBool ValidateTransfer( const TDesC8& aInfo ) const;
+        
+    /**
+     * Sets sink protocolinfo
+     * 
+     * @param aProtocolInfo
+     */    
+    const TDesC8& FindFirstMatchingInSinkL(
+        const CUpnpItem& aItem ) const;
+
+    /**
+     * Matches objectclass to protocolInfo
+     * 
+     * @param aObjectClass
+     * @param aProtocolInfo
+     */    
+    TBool MatchType( const TDesC8& aObjectClass, const TDesC8&
+        aProtocolInfo ) const;
+    
+    /**
+     * Sets if the device supports audio upload
+     * 
+     * @param aAudioUpload
+     */    
+    void SetAudioUpload( TBool aAudioUpload );
+    
+    /**
+     * Return if the device supports audio upload
+     * 
+     * @return ETrue if the device supports audio upload
+     */    
+    TBool AudioUpload() const;
+    
+    /**
+     * Sets if the device supports image upload
+     * 
+     * @param aImageUpload
+     */    
+    void SetImageUpload( TBool aImageUpload );
+    
+    /**
+     * Return if the device supports image upload
+     * 
+     * @return ETrue if the device supports image upload
+     */    
+    TBool ImageUpload() const;
+    
+    /**
+     * Sets if the device supports video upload
+     * 
+     * @param aVideoUpload
+     */    
+    void SetVideoUpload( TBool aVideoUpload );
+    
+    /**
+     * Return if the device supports video upload
+     * 
+     * @return ETrue if the device supports video upload
+     */    
+    TBool VideoUpload() const;    
+
+    /**
+     * Sets if the device supports CreateChildContainer
+     * 
+     * @param aCreateChildContainer
+     */    
+    void SetCreateChildContainer( TBool aCreateChildContainer );
+    
+    /**
+     * Return if the device supports video upload
+     * 
+     * @return ETrue if the device supports video upload
+     */    
+    TBool CreateChildContainer() const;
+    
+    /**
+     * Sets if the device supports DestroyObject
+     * 
+     * @param aDestroyObject
+     */    
+    void SetDestroyObject( TBool aDestroyObject );
+    
+    /**
+     * Return if the device supports DestroyObject
+     * 
+     * @return ETrue if the device is local
+     */    
+    TBool DestroyObject() const;
+    
+    /**
+     * Sets if the protocolInfo has been received
+     * 
+     * @param aPInfoReceived
+     */    
+    void SetPInfoReceived( TBool aPInfoReceived );
+    
+     /**
+     * Return if the device has received protocolInfo
+     * 
+     * @return ETrue if the device has received protocolInfo
+     */    
+   TBool PInfoReceived() const;
+   
+   void SetDLNADeviceType( TDLNADeviceType aDeviceType );
+   
+   TDLNADeviceType DLNADeviceType() const;
+    
+private:
+    
+    /**
+     * Sets source protocolinfo
+     * 
+     * @param aProtocolInfo source protocolinfo
+     */    
+    void SetSourceProtocolInfoL(
+        const RPointerArray<CUpnpDlnaProtocolInfo>& aProtocolInfo );
+    
+    /**
+     * Sets sink protocolinfo
+     * 
+     * @param aProtocolInfo sink protocolinfo
+     */    
+    void SetSinkProtocolInfoL(
+        const RPointerArray<CUpnpDlnaProtocolInfo>& aProtocolInfo );
+        
+    /**
+     * Parses descriptor to a delimeter
+     * 
+     * @param aLexer lexer representing a descriptor
+     * @param aDelimeter delimeter character
+     */    
+    void ParseToDelimeter( TLex8& aLex, TChar aDelimeter );
+    
+    /**
+     * Judge character to be able remove 
+     * 
+     * @param aCharacter is a character
+     * @return ETrue if the character can be removed
+     */    
+    TBool IsIllegalCharacter( TChar aCharacter ) const;   
+    
+    /**
+     * Parses descriptor perhaps have illegal characters
+     * 
+     * @param aPtr representing a descriptor
+     * @return a new hbufc8 buffer 
+     */    
+    HBufC8* RemoveIllegalCharactersL( const TDesC8& aPtr ) const;
+    
+    TBool MatchSourceProfileId( const TDesC8& aInfo ) const;
+
+    TBool MatchSinkProfileId( const TDesC8& aInfo ) const;
+    
+    TBool MatchSinkMime( const TDesC8& aInfo ) const;
+       
+private:
+    
+    RPointerArray<CUpnpDlnaProtocolInfo> iSourceProtocolInfo;
+    
+    RPointerArray<CUpnpDlnaProtocolInfo> iSinkProtocolInfo;
+    
+    TInt iSubscriptionCount;
+    
+    TBool iLocal;
+    
+    TBool iAudioUpload;
+    
+    TBool iImageUpload;
+    
+    TBool iVideoUpload;
+    
+    TBool iCreateChildContainer;
+    
+    TBool iDestroyObject;
+    
+    TBool iPInfoReceived;
+    
+    TDLNADeviceType iDLNADeviceType;
+    };
+
+
+#endif // C_UPNPAVDEVICEEXTENDED_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavdispatcher.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,893 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      dispatches control point indications for clients
+*
+*/
+
+
+
+
+
+
+#ifndef C_CUPNPAVDISPATCHER_H
+#define C_CUPNPAVDISPATCHER_H
+
+
+#include <e32base.h>
+#include <upnpavcontrolpointobserver.h>
+
+// FORWARD DECLARATIONS
+class CUPnPAVActionInfo;
+class CUPnPAVControllerImpl;
+class CUpnpAVControllerServer;
+// CLASS DECLARATION
+
+/**
+*  UPnP AV Controller callback dispatcher
+*  
+*
+*  @lib - 
+*  @since Series 60 3.1
+*/
+
+class CUPnPAVDispatcher : public CBase,
+                          public MUpnpAVControlPointObserver
+    {
+public:  // Constructors and destructor
+        
+    /**
+    * Two-phased constructor.
+    */
+    static CUPnPAVDispatcher* NewLC( CUpnpAVControllerServer& aServer );
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUPnPAVDispatcher* NewL( CUpnpAVControllerServer& aServer );    
+
+    /**
+    * Destructor.
+    */
+    virtual ~CUPnPAVDispatcher();
+
+private: // New methods
+
+    /**
+    * Constructs the server 
+    * @param aPriority CServer2 input parameter
+    */
+    CUPnPAVDispatcher( CUpnpAVControllerServer& aServer );
+
+    /**
+     * Perform the second phase construction of a CUpnpMessageHandler object
+     */
+    void ConstructL();
+
+protected:
+
+    /**
+    * Observer callback for rendering control Set Volume.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aInstance rendering instance.
+    * @param aChannel audio channel.
+    * @param aDesiredVolume 
+    */
+    void RcSetVolumeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aDesiredVolume);
+    /**
+    * Observer callback for rendering control Get Volume.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aInstance rendering instance.
+    * @param aChannel audio channel.
+    * @param aCurrentVolume 
+    */
+    void RcVolumeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aCurrentVolume); 
+    /**
+    * Observer callback for rendering control Set Mute.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aInstance rendering instance.
+    * @param aChannel audio channel.
+    * @param aDesiredMute 
+    */
+    void RcSetMuteResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aDesiredMute);
+    /**
+    * Observer callback for rendering control Get Mute.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aInstance rendering instance.
+    * @param aChannel audio channel.
+    * @param aCurrentMute 
+    */
+    void RcMuteResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aCurrentMute); 
+
+
+    /**
+    * Observer callback for rendering control AV set transport uri.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aInstance rendering instance.
+    * @param aCurrentUri Current transport URI.
+    * @param Current transport URI Metadata. 
+    */
+    void AvtSetTransportUriResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aCurrentUri,
+        const TDesC8& aCurrentUriMetaData);
+    /**
+    * Observer callback for rendering control AV set next transport uri.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aInstance rendering instance.
+    * @param aCurrentUri Current transport URI.
+    * @param Current transport URI Metadata. 
+    */
+    void AvtSetNextTransportUriResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNextUri,
+        const TDesC8& aNextUriMetaData);
+    /**
+    * Observer callback for rendering control AV get media info response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aInstance rendering instance.
+    * @param aNrTracks Number of tracks.
+    * @param aMediaDuration 
+    * @param aCurrentUri Current transport URI.
+    * @param aCurrentUriMetaData Metadata of current trransport uri. 
+    * @param aNextUri Next transport URI.
+    * @param aNextUriMetaData Metadata of next trransport uri.
+    * @param aPlayMedium
+    * @param aRecordMedium
+    * @param aWriteStatus
+    */
+    void AvtMediaInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNrTracks,
+        const TDesC8& aMediaDuration,
+        const TDesC8& aCurrentUri,
+        const TDesC8& aCurrentUriMetaData,
+        const TDesC8& aNextUri,
+        const TDesC8& aNextUriMetaData,
+        const TDesC8& aPlayMedium,
+        const TDesC8& aRecordMedium,
+        const TDesC8& aWriteStatus);
+    /**
+    * Observer callback for rendering control AV get transport info response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId
+    * @param aErr UPnP error code.
+    * @param aInstance rendering instance.
+    * @param aCurrenTransportState
+    * @param aCurrentTransportStatus
+    * @param aCurrentUri aCurrentSpeed
+    */
+    void AvtGetTransportInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aCurrenTransportState,
+        const TDesC8& aCurrentTransportStatus,
+        const TDesC8& aCurrentSpeed);
+    /**
+    * Observer callback for rendering control AV get position info response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aTrack rendering instance.
+    * @param aTrackDuration 
+    * @param aTrackMetaData
+    * @param aTrackURI
+    * @param aRelTime
+    * @param aAbsTime
+    * @param aRelCount
+    * @param aAbsCount
+    */
+    void AvtPositionInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aTrack,
+        const TDesC8& aTrackDuration,
+        const TDesC8& aTrackMetaData,
+        const TDesC8& aTrackURI,
+        const TDesC8& aRelTime,
+        const TDesC8& aAbsTime,
+        const TDesC8& aRelCount,
+        const TDesC8& aAbsCount);
+    /**
+    * Observer callback for rendering control AV get device
+    * capabilities response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aPlayMedia
+    * @param aRecMedia 
+    * @param aRecQualityModes
+    */
+    void AvtDeviceCapabilitiesResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aPlayMedia,
+        const TDesC8& aRecMedia,
+        const TDesC8& aRecQualityMode);
+    /**
+    * Observer callback for rendering control AV get transport
+    * settings response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId
+    * @param aInstanceId
+    * @param aErr UPnP error code.        
+    * @param aPlayMode
+    * @param aRecQualityMode
+    */
+    void AvtTransportSettingsResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aPlayMode,
+        const TDesC8& aRecQualityMode);
+    /**
+    * Observer callback for rendering control AV Stop response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    */
+    void AvtStopResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+    /**
+    * Observer callback for rendering control AV Play response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aSpeed
+    */
+    void AvtPlayResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aSpeed);
+    /**
+    * Observer callback for rendering control AV Pause response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    */
+    void AvtPauseResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+    /**
+    * Observer callback for rendering control AV Record response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    */
+    void AvtRecordResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+    /**
+    * Observer callback for rendering control AV Seek response.
+    * @since Series 60 2.6
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aUnit
+    * @param aTarget
+    */
+    void AvtSeekResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aUnit,
+        const TDesC8& aTarget);
+    /**
+    * Observer callback for rendering control AV Next response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    */
+    void AvtNextResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+    /**
+    * Observer callback for rendering control AV Previous response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    */
+    void AvtPreviousResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+    /**
+    * Observer callback for rendering control AV setplay mode response.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aNewPlayMode
+    */
+    void AvtSetPlayModeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNewPlayMode);
+    /**
+    * Observer callback for rendering control AV set record qualityresponse.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aNewRecordQuality
+    */
+    void AvtSetRecordModeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNewRecordQuality);
+    /**
+    * Observer callback for Content Directory GetSearchCapabilities function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aSearchCaps
+    */
+    void CdsSearchCapabilitiesResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSearchCaps);
+    /**
+    * Observer callback for Content Directory GetSortCapabilities function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aSortCaps
+    */
+    void CdsSortCapabilitiesResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSortCaps);
+    /**
+    * Observer callback for Content Directory GetSystemUpdateID function.
+    * @since Series 60 2.6
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aSystemUpdateId
+    */
+    void CdsSystemUpdateIdResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        TInt aSystemUpdateId);
+    /**
+    * Observer callback for Content Directory Browse function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aObjectID
+    * @param aBrowseFlag
+    * @param aFilter
+    * @param aIndex
+    * @param arequest
+    * @param aSortCriteria
+    * @param aResult
+    * @param aReturned
+    * @param aMatches
+    * @param aUpdateID
+    */
+    void CdsBrowseResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aObjectID,
+        const TDesC8&  aBrowseFlag,
+        const TDesC8&  aFilter,
+        TInt aIndex,
+        TInt aRequest,
+        const TDesC8&  aSortCriteria,
+        const TDesC8&  aResult,
+        TInt aReturned,
+        TInt aMatches,
+        const TDesC8&  aUpdateID);
+    /**
+    * Observer callback for Content Directory Search function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aContainerId
+    * @param aSearchCriteria
+    * @param aFilter
+    * @param aIndex
+    * @param arequest
+    * @param aSortCriteria
+    * @param aResult
+    * @param aReturned
+    * @param aMatches
+    * @param aUpdateID
+    */
+    void CdsSearchResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerId,
+        const TDesC8& aSearchCriteria,
+        const TDesC8& aFilter,
+        TInt aIndex,
+        TInt aRequest,
+        const TDesC8& aSortCriteria,
+        const TDesC8& aResult,
+        TInt aReturned,
+        TInt aMatches,
+        const TDesC8& aUpdateID);
+    /**
+    * Observer callback for Content Directory DestroyObject function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aObjectId
+    */
+    void CdsDestroyObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aObjectId );
+    /**
+    * Observer callback for Content Directory UpdateObject function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aObjectId
+    * @param aCurrentTagValue
+    * @param aNewTagValue
+    */
+    void CdsUpdateObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aObjectId,
+        const TDesC8& aCurrentTagValue,
+        const TDesC8& aNewTagValue );
+    /**
+    * Observer callback for Content Directory ImportResource function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aSourceURI
+    * @param aDestinationURI
+    * @param aTransferId
+    */       
+    void CdsImportResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSourceURI,
+        const TDesC8& aDestinationURI,
+        const TDesC8& aTransferId );
+    /**
+    * Observer callback for Content Directory ExportResource function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aSourceURI
+    * @param aDestinationURI
+    * @param aTransferId
+    */       
+    void CdsExportResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSourceURI,
+        const TDesC8& aDestinationURI,
+        const TDesC8& aTransferId );
+    /**
+    * Observer callback for Content Directory StopTransfer function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aSourceURI
+    * @param aDestinationURI
+    * @param aTransferId
+    */       
+    void CdsStopTransferResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aTransferId );
+    /**
+    * Observer callback for Content Directory GetTransferProgress function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aTransferId
+    * @param aTransferStatus
+    * @param aTransferTotal
+    */         
+    void CdsCTransferProgressResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aTransferId,
+        const TDesC8& aTransferStatus,
+        const TDesC8& aTransferLength,            
+        const TDesC8& aTransferTotal );
+    /**
+    * Observer callback for Content Directory DeleteResource function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aResourceUri Resource to be deleted.
+    */ 
+    void CdsDeleteResourceResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aResourceUri );
+    /**
+    * Observer callback for Content Directory CreateReference function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aContainerId Destination folder.
+    * @param aObjectId Source object.
+    * @param aNewId Created reference.
+    */ 
+    void CdsCreateReferenceResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerId, 
+        const TDesC8& aObjectId, 
+        const TDesC8& aNewId );
+    /**
+    * Observer callback for Content Directory CreateReference function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aContainerID Container in which new object is created.
+    * @param aElements Elements for item creation.
+    * @param aObjectID New objects ID.
+    * @param aResult Result of the action.
+    */ 
+    void CdsCreateObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerID, 
+        const TDesC8& aElements, 
+        const TDesC8& aObjectID, 
+        const TDesC8& aResult );
+
+    /**
+    * Observer callback for Connection Manager GetProtocolInfo function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aSource
+    * @param aSink
+    */ 
+    void CmProtocolInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSource, 
+        const TDesC8& aSink );
+    /**
+    * Observer callback for Connection Manager PrepareForConnection 
+    * function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aRemoteProtocolInfo
+    * @param aPeerConnectionManager
+    * @param aPeerConnectionId
+    * @param aDirection
+    * @param aConnection
+    * @param aTransport
+    * @param aRsc
+    */        
+    void CmPrepareResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aRemoteProtocolInfo,
+        const TDesC8& aPeerConnectionManager,
+        const TDesC8& aPeerConnectionId,
+        const TDesC8& aDirection,
+        TInt aConnection,
+        TInt aTransport,
+        TInt aRsc );
+    /**
+    * Observer callback for Connection Manager ConnectionComplete 
+    * function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aConnection
+    */         
+    void CmComplete(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        TInt aConnection );
+    /**
+    * Observer callback for Connection Manager GetCurrentConnectionIDs
+    * function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aConnection
+    */         
+    void CmCurrentConnections(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aConnections);
+    /**
+    * Observer callback for Connection Manager GetCurrentConnectionInfo
+    * function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param rscId
+    * @param aProtocolInfo
+    * @param aPeerConnectionManager
+    * @param peerId
+    * @param aStatus
+    */   
+    void CmCurrentInfo(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        TInt rscId, 
+        TInt transportId, 
+        const TDesC8& aProtocolInfo,
+        const TDesC8& aPeerConnectionManager, 
+        TInt peerId, 
+        const TDesC8& aDirection, 
+        const TDesC8& aStatus );
+
+    //*****************************************************************
+    //Functions for UPnP event handling
+    //*****************************************************************
+    /**
+    * Content Directory SystemUpdateId event handler.
+    * @since Series 60 2.6
+    * @param aUuid Device UUID.
+    * @param aSystemUpdateId Device systemUpdateId.
+    */
+    void CdsUpdateEvent(
+            const TDesC8& aUuid,
+            TInt aSystemUpdateId
+            ) ;
+    /**
+    * Content Directory ContainerUpdateIDs event handler.
+    * @since Series 60 2.6
+    * @param aUuid Device UUID.
+    * @param aConteinerIds Device container update ids.
+    */
+    void CdsContainerEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aConteinerIds
+            );
+    /**
+    * Content Directory TransferIDs event handler.
+    * @since Series 60 2.6
+    * @param aUuid Device UUID.
+    * @param aTransferIds Device transfer ids.
+    */
+    void CdsTransferEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aTransferIds
+            );
+    /**
+    * Rendering Control LastChange event handler.
+    * @since Series 60 2.6
+    * @param aUuid Device UUID.
+    * @param aLastChange Device LastChange statevariable.
+    */
+    void RcLastChangeEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aLastChange
+            );
+    /**
+    * AV Transport LastChange event handler.
+    * @since Series 60 2.6
+    * @param aUuid Device UUID.
+    * @param aLastChange Device LastChange statevariable.
+    */
+    void AvtLastChangeEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aLastChange
+            );
+    /**
+    * Connection Manager SourceEvent event handler.
+    * @since Series 60 2.6
+    * @param aUuid Device UUID.
+    * @param aSource Device's source info.
+    */
+    void CmSourceEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aSource
+            );
+    /**
+    * Connection Manager SinkEvent event handler.
+    * @since Series 60 2.6
+    * @param aUuid Device UUID.
+    * @param aSink Device's sink info.
+    */
+    void CmSinkEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aSink
+            );
+    /**
+    * Connection Manager ConnectionsEvent event handler.
+    * @since Series 60 2.6
+    * @param aUuid Device UUID.
+    * @param aConnections Devices connections.
+    */
+    void CmConnectionsEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aConnections
+            );
+    //*****************************************************************
+    // Device and http functions.
+    //*****************************************************************
+    /**
+    * Handles HTTP messages.
+    * @since Series 60 2.6
+    * @param aMessage Incoming HTTP message.
+    */
+    void HttpResponseL(CUpnpHttpMessage* aMessage) ;
+
+    /**
+    * Handles UPnP device discoveries.
+    * @since Series 60 2.6
+    * @param aDevice Device that is discovered.
+    */
+    void DeviceDiscoveredL(CUpnpDevice* aDevice);
+
+    /**
+    * Handles UPnP device disappears.
+    * @since Series 60 2.6
+    * @param aDevice Device that disappeared.
+    */
+    void DeviceDisappearedL(CUpnpDevice* aDevice);
+    
+public: // New methods
+
+    void RegisterL( TInt aSessionId,
+        MUpnpAVControlPointObserver& aObserver/*, const TDesC8& aUuid*/ );
+
+    void UnRegister( TInt aSessionId /*, const TDesC8& aUuid*/ );
+
+    void RegisterForEventsL( MUpnpAVControlPointObserver& aObserver,
+        const TDesC8& aUuid );
+
+    void UnRegisterEvents( MUpnpAVControlPointObserver& aObserver );
+
+private: // New methods
+
+    MUpnpAVControlPointObserver& FindObserver( TInt aSessionId );   
+
+private:
+    
+    CUpnpAVControllerServer&            iServer;            
+
+    /** @var iSessionCount the number of session owned by this server */
+    RPointerArray<CUPnPAVActionInfo>    iActionInfos;
+
+    //RPointerArray<CUPnPAVActionInfo>    iActionInfosDevice;
+
+    RPointerArray<CUPnPAVActionInfo>    iActionInfosEvent;
+    
+    };
+
+
+#endif // C_CUPNPAVDISPATCHER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpaverrorhandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Definition of class CUPnPAVErrorHandler.
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPAVERRORHANDLER_H
+#define UPNPAVERRORHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+enum TUPnPErrorCodeType
+    {
+    EUPnPGeneralError = 0,
+    EUPnPConnectionManagerError,
+    EUPnPContentDirectoryError,
+    EUPnPRenderingControlError,
+    EUPnPAVTransportError,
+    EUPnPHTTPError
+    };
+
+// CLASS DECLARATION
+    
+/**
+* UPnP AV Error Handler class header. Provides static methods to map UPnP
+* error codes to corresponding Symbian (e32err.h) error codes.
+*
+* @since Series 60 3.0
+*/
+class UPnPAVErrorHandler
+    {
+    
+    public:
+
+        /**
+         * Returns the Symbian error code (e32err.h) corresponding to the 
+         * given UPnP error code.
+         *
+         * @param aUPnPErrorCode TInt the UPnP error code
+         * @param aErrorType TUPnPErrorCode type of the the UPnP error code
+         * @return TInt the corresponding Symbian error code
+         */
+        static TInt ConvertToSymbianErrorCode( 
+                                TInt aUPnPErrorCode,
+                                TUPnPErrorCodeType aErrorType );
+    
+    private:
+    
+        /**
+         * Returns the Symbian error code (e32err.h) corresponding to the 
+         * given general UPnP error code.
+         *
+         * @param aUPnPErrorCode TInt the UPnP error code
+         * @return TInt the corresponding Symbian error code
+         */
+        static TInt ConvertGeneralErrorCode( TInt aUPnPErrorCode );
+    
+        /**
+         * Returns the Symbian error code (e32err.h) corresponding to the 
+         * given Connection Manager error code.
+         *
+         * @param aUPnPErrorCode TInt the UPnP error code
+         * @return TInt the corresponding Symbian error code
+         */
+        static TInt ConvertCMErrorCode( TInt aUPnPErrorCode );
+
+        /**
+         * Returns the Symbian error code (e32err.h) corresponding to the 
+         * given Content Directory error code.
+         *
+         * @param aUPnPErrorCode TInt the UPnP error code
+         * @return TInt the corresponding Symbian error code
+         */
+        static TInt ConvertCDSErrorCode( TInt aUPnPErrorCode );
+
+        /**
+         * Returns the Symbian error code (e32err.h) corresponding to the 
+         * given Rendering Control error code.
+         *
+         * @param aUPnPErrorCode TInt the UPnP error code
+         * @return TInt the corresponding Symbian error code
+         */
+        static TInt ConvertRCErrorCode( TInt aUPnPErrorCode );
+
+        /**
+         * Returns the Symbian error code (e32err.h) corresponding to the 
+         * given AV Transport error code.
+         *
+         * @param aUPnPErrorCode TInt the UPnP error code
+         * @return TInt the corresponding Symbian error code
+         */
+        static TInt ConvertAVTErrorCode( TInt aUPnPErrorCode );
+
+        /**
+         * Returns the Symbian error code (e32err.h) corresponding to the 
+         * given HTTP error code.
+         *
+         * @param aUPnPErrorCode TInt the UPnP error code
+         * @return TInt the corresponding Symbian error code
+         */
+        static TInt ConvertHTTPErrorCode( TInt aUPnPErrorCode );
+    };
+
+#endif // UPNPAVERRORHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavtimer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      provides timing services for AVController server
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVTIMER_H_
+#define C_UPNPAVTIMER_H_
+
+// Include files
+#include <e32base.h>
+
+const TInt KTimerCycle3         = 3;
+const TInt KTimerCycle10        = 10;
+const TInt KTimerCycle30        = 30;
+const TInt KTimerCycle300       = 300;
+
+// Forward declarations
+class CUPnPBrowsingSession;
+class MUPnPAVTimerCallback;
+
+/**
+ * Timer class. Used as a server (AVC and S60 Media Server) shutdown timer.
+ *
+ */
+class CUPnPAVTimer: public CTimer
+    {
+
+public:
+
+    /**
+     * Timer type defination
+     */    
+    enum TAVTimerType
+        {
+        ETimerServerShutdown = 0,
+        ETimerMediaServer
+        };
+ 
+public:
+
+    /**
+     * Static 1st phase constructor
+     * @param aObserver Observer
+     * @param aType timer type
+     * @return A new timer instance
+     */    
+    static CUPnPAVTimer* NewL( MUPnPAVTimerCallback& aObserver,
+        TAVTimerType aType );
+
+    /**
+     * Destructor
+     */    
+    virtual ~CUPnPAVTimer();
+    
+    
+private:
+
+    /**
+     * Private constructor
+     * @param aObserver Observer
+     * @param aType timer type
+     */
+    CUPnPAVTimer( MUPnPAVTimerCallback& aObserver, TAVTimerType aType );
+    
+    /**
+     * 2nd phase construct
+     */
+    void ConstructL();
+    
+protected: // From CTimer (CActive)
+
+    /**
+     * See e32base.h
+     */
+    void RunL();
+
+public: // New functions
+
+    /**
+     * Starts the timer
+     * @param aType Type of timing interval
+     */
+    void Start( TInt aIntervalInSecs );
+        
+private:
+    
+    MUPnPAVTimerCallback& iObserver; // Not Own
+    
+    TAVTimerType iTimerType;
+    
+    };
+
+/**
+ * Timer observer
+ *
+ */
+class MUPnPAVTimerCallback
+    {
+public:
+
+    /**
+     * Called when timer expires
+     *
+     * @param aType time-out type
+     */
+    virtual void UPnPAVTimerCallback( CUPnPAVTimer::TAVTimerType aType ) = 0;
+    
+    };
+
+#endif // C_UPNPAVTIMER_H_
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpbrowsingsession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1290 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implementation for session towards a media server
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_UPNPBROWSINGSESSION_H
+#define C_UPNPBROWSINGSESSION_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "upnpavcontroller.h"
+#include <upnpavcontrolpointobserver.h>
+#include <upnpmediaserverobserver.h>
+#include "upnpavbrowsingsession.h"
+
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+class CUpnpObject;
+class CUpnpAVRequest;
+class CUpnpAVBrowseRequest;
+class CUPnPFileSharingActive;
+class CUpnpMediaServerNotifier;
+class RUpnpMediaServerClient;
+class CUpnpAVDeviceExtended;
+class CUpnpMediaServerSettings;
+class CRepository;
+class CUpnpAVControllerServer;
+/**
+ * Implements server side browsing session functionality. Implements
+ * browsing, searching, copying etc.  
+ *
+ * @since S60 v3.1
+ */
+class CUPnPBrowsingSession :    public CBase,
+                                public MUpnpAVControlPointObserver,
+                                public MUpnpMediaServerObserver
+    {
+
+private:
+
+    /**
+     * Defines the internal state of browsing session
+     */
+    enum TInternalBrowseState
+        {
+        ENone,
+        EBrowse,
+        EDestroyObject,
+        ECopyLocal,
+        ECreateContainer,
+        ECopyToPhone
+        };
+
+    enum TInternalCopyState
+        {
+        EIdle,
+        EObjectCreated,
+        ECopying
+        };
+
+public:
+
+    /**
+     * Static 1st phase constructor
+     *
+     * @param aControlPoint AV Control Point reference
+     * @param aClient S60 Media Server session reference
+     * @param aDispatcher observer callback dispatcher reference
+     * @param aSessionId session id
+     * @param aUuid device Uuid
+     */
+    static CUPnPBrowsingSession* NewL
+        (
+        RUpnpMediaServerClient& aClient,
+        CUpnpAVControllerServer& aServer,
+        TInt aSessionId,   
+        const TDesC8& aUuid
+        );
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPBrowsingSession();
+    
+private:
+
+    /**
+     * Private constructor
+     *
+     * @param aControlPoint AV Control Point reference
+     * @param aClient S60 Media Server session reference
+     * @param aDispatcher observer callback dispatcher reference
+     * @param aSessionId session id
+     */
+    CUPnPBrowsingSession
+        (
+        RUpnpMediaServerClient& aClient,
+        CUpnpAVControllerServer& aServer,
+        TInt aSessionId
+        );    
+    
+    /**
+     * 2ns phase constructor
+     */
+    void ConstructL( const TDesC8& aUuid );
+
+protected: // From MUpnpAVControlPointObserver
+
+    /**
+     * Observer callback for rendering control Set Volume.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aChannel audio channel.
+     * @param aDesiredVolume 
+     */
+    void RcSetVolumeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aDesiredVolume);
+        
+    /**
+     * Observer callback for rendering control Get Volume.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aChannel audio channel.
+     * @param aCurrentVolume 
+     */
+    void RcVolumeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aCurrentVolume);
+         
+    /**
+     * Observer callback for rendering control Set Mute.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aChannel audio channel.
+     * @param aDesiredMute 
+     */
+    void RcSetMuteResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aDesiredMute);
+        
+    /**
+     * Observer callback for rendering control Get Mute.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aChannel audio channel.
+     * @param aCurrentMute 
+     */
+    void RcMuteResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aCurrentMute); 
+
+
+    /**
+     * Observer callback for rendering control AV set transport uri.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aCurrentUri Current transport URI.
+     * @param Current transport URI Metadata. 
+     */
+    void AvtSetTransportUriResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aCurrentUri,
+        const TDesC8& aCurrentUriMetaData);
+        
+    /**
+     * Observer callback for rendering control AV set next transport uri.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aCurrentUri Current transport URI.
+     * @param Current transport URI Metadata. 
+     */
+    virtual void AvtSetNextTransportUriResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNextUri,
+        const TDesC8& aNextUriMetaData);
+        
+    /**
+     * Observer callback for rendering control AV get media info response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aNrTracks Number of tracks.
+     * @param aMediaDuration 
+     * @param aCurrentUri Current transport URI.
+     * @param aCurrentUriMetaData Metadata of current trransport uri. 
+     * @param aNextUri Next transport URI.
+     * @param aNextUriMetaData Metadata of next trransport uri.
+     * @param aPlayMedium
+     * @param aRecordMedium
+     * @param aWriteStatus
+     */
+    void AvtMediaInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNrTracks,
+        const TDesC8& aMediaDuration,
+        const TDesC8& aCurrentUri,
+        const TDesC8& aCurrentUriMetaData,
+        const TDesC8& aNextUri,
+        const TDesC8& aNextUriMetaData,
+        const TDesC8& aPlayMedium,
+        const TDesC8& aRecordMedium,
+        const TDesC8& aWriteStatus);
+        
+    /**
+     * Observer callback for rendering control AV get transport info response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aCurrenTransportState
+     * @param aCurrentTransportStatus
+     * @param aCurrentUri aCurrentSpeed
+     */
+    void AvtGetTransportInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aCurrenTransportState,
+        const TDesC8& aCurrentTransportStatus,
+        const TDesC8& aCurrentSpeed);
+        
+    /**
+     * Observer callback for rendering control AV get position info response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aTrack rendering instance.
+     * @param aTrackDuration 
+     * @param aTrackMetaData
+     * @param aTrackURI
+     * @param aRelTime
+     * @param aAbsTime
+     * @param aRelCount
+     * @param aAbsCount
+     */
+    void AvtPositionInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aTrack,
+        const TDesC8& aTrackDuration,
+        const TDesC8& aTrackMetaData,
+        const TDesC8& aTrackURI,
+        const TDesC8& aRelTime,
+        const TDesC8& aAbsTime,
+        const TDesC8& aRelCount,
+        const TDesC8& aAbsCount);
+        
+    /**
+     * Observer callback for rendering control AV get device
+     * capabilities response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aPlayMedia
+     * @param aRecMedia 
+     * @param aRecQualityModes
+     */
+    void AvtDeviceCapabilitiesResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aPlayMedia,
+        const TDesC8& aRecMedia,
+        const TDesC8& aRecQualityMode);
+        
+    /**
+     * Observer callback for rendering control AV get transport
+     * settings response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId
+     * @param aInstanceId
+     * @param aErr UPnP error code.        
+     * @param aPlayMode
+     * @param aRecQualityMode
+     */
+    void AvtTransportSettingsResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aPlayMode,
+        const TDesC8& aRecQualityMode);
+        
+    /**
+     * Observer callback for rendering control AV Stop response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtStopResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+        
+    /**
+     * Observer callback for rendering control AV Play response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSpeed
+     */
+    void AvtPlayResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aSpeed);
+    
+    /**
+     * Observer callback for rendering control AV Pause response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtPauseResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+        
+    /**
+     * Observer callback for rendering control AV Record response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtRecordResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+        
+    /**
+     * Observer callback for rendering control AV Seek response.
+     * @since Series 60 2.6
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aUnit
+     * @param aTarget
+     */
+    void AvtSeekResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aUnit,
+        const TDesC8& aTarget);
+        
+    /**
+     * Observer callback for rendering control AV Next response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtNextResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+        
+    /**
+     * Observer callback for rendering control AV Previous response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtPreviousResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+    
+    /**
+     * Observer callback for rendering control AV setplay mode response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aNewPlayMode
+     */
+    void AvtSetPlayModeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNewPlayMode);
+        
+    /**
+     * Observer callback for rendering control AV set record qualityresponse.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aNewRecordQuality
+     */
+    void AvtSetRecordModeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNewRecordQuality);
+        
+    /**
+     * Observer callback for Content Directory GetSearchCapabilities function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSearchCaps
+     */
+    void CdsSearchCapabilitiesResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSearchCaps);
+        
+    /**
+     * Observer callback for Content Directory GetSortCapabilities function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSortCaps
+     */
+    void CdsSortCapabilitiesResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSortCaps);
+
+    /**
+     * Observer callback for Content Directory GetSystemUpdateID function.
+     * @since Series 60 2.6
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSystemUpdateId
+     */
+    void CdsSystemUpdateIdResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        TInt aSystemUpdateId);
+    /**
+    * Observer callback for Content Directory Browse function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aObjectID
+    * @param aBrowseFlag
+    * @param aFilter
+    * @param aIndex
+    * @param arequest
+    * @param aSortCriteria
+    * @param aResult
+    * @param aReturned
+    * @param aMatches
+    * @param aUpdateID
+    */
+    
+    void CdsBrowseResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aObjectID,
+        const TDesC8&  aBrowseFlag,
+        const TDesC8&  aFilter,
+        TInt aIndex,
+        TInt aRequest,
+        const TDesC8&  aSortCriteria,
+        const TDesC8&  aResult,
+        TInt aReturned,
+        TInt aMatches,
+        const TDesC8&  aUpdateID);
+        
+    /**
+     * Observer callback for Content Directory Search function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aContainerId
+     * @param aSearchCriteria
+     * @param aFilter
+     * @param aIndex
+     * @param arequest
+     * @param aSortCriteria
+     * @param aResult
+     * @param aReturned
+     * @param aMatches
+     * @param aUpdateID
+     */
+     
+    void CdsSearchResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerId,
+        const TDesC8& aSearchCriteria,
+        const TDesC8& aFilter,
+        TInt aIndex,
+        TInt aRequest,
+        const TDesC8& aSortCriteria,
+        const TDesC8& aResult,
+        TInt aReturned,
+        TInt aMatches,
+        const TDesC8& aUpdateID);
+        
+    /**
+     * Observer callback for Content Directory DestroyObject function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aObjectId
+     */
+    void CdsDestroyObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aObjectId );
+        
+    /**
+     * Observer callback for Content Directory UpdateObject function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aObjectId
+     * @param aCurrentTagValue
+     * @param aNewTagValue
+     */
+    void CdsUpdateObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aObjectId,
+        const TDesC8& aCurrentTagValue,
+        const TDesC8& aNewTagValue );
+        
+    /**
+     * Observer callback for Content Directory ImportResource function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSourceURI
+     * @param aDestinationURI
+     * @param aTransferId
+     */       
+    void CdsImportResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSourceURI,
+        const TDesC8& aDestinationURI,
+        const TDesC8& aTransferId );
+        
+    /**
+     * Observer callback for Content Directory ExportResource function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSourceURI
+     * @param aDestinationURI
+     * @param aTransferId
+     */       
+    void CdsExportResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSourceURI,
+        const TDesC8& aDestinationURI,
+        const TDesC8& aTransferId );
+        
+    /**
+     * Observer callback for Content Directory StopTransfer function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSourceURI
+     * @param aDestinationURI
+     * @param aTransferId
+     */       
+    void CdsStopTransferResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aTransferId );
+    
+    /**
+     * Observer callback for Content Directory GetTransferProgress function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aTransferId
+     * @param aTransferStatus
+     * @param aTransferTotal
+     */         
+    virtual void CdsCTransferProgressResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aTransferId,
+        const TDesC8& aTransferStatus,
+        const TDesC8& aTransferLength,            
+        const TDesC8& aTransferTotal );
+        
+    /**
+     * Observer callback for Content Directory DeleteResource function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aResourceUri Resource to be deleted.
+     */ 
+    void CdsDeleteResourceResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aResourceUri );
+        
+    /**
+     * Observer callback for Content Directory CreateReference function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aContainerId Destination folder.
+     * @param aObjectId Source object.
+     * @param aNewId Created reference.
+     */ 
+    void CdsCreateReferenceResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerId, 
+        const TDesC8& aObjectId, 
+        const TDesC8& aNewId );
+        
+    /**
+     * Observer callback for Content Directory CreateReference function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aContainerID Container in which new object is created.
+     * @param aElements Elements for item creation.
+     * @param aObjectID New objects ID.
+     * @param aResult Result of the action.
+     */ 
+    void CdsCreateObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerID, 
+        const TDesC8& aElements, 
+        const TDesC8& aObjectID, 
+        const TDesC8& aResult );
+        
+
+    /**
+     * Observer callback for Connection Manager GetProtocolInfo function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSource
+     * @param aSink
+     */ 
+    void CmProtocolInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSource, 
+        const TDesC8& aSink );
+    
+    /**
+     * Observer callback for Connection Manager PrepareForConnection 
+     * function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aRemoteProtocolInfo
+     * @param aPeerConnectionManager
+     * @param aPeerConnectionId
+     * @param aDirection
+     * @param aConnection
+     * @param aTransport
+     * @param aRsc
+     */        
+    void CmPrepareResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aRemoteProtocolInfo,
+        const TDesC8& aPeerConnectionManager,
+        const TDesC8& aPeerConnectionId,
+        const TDesC8& aDirection,
+        TInt aConnection,
+        TInt aTransport,
+        TInt aRsc );
+    
+    /**
+     * Observer callback for Connection Manager ConnectionComplete 
+     * function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aConnection
+     */         
+    void CmComplete(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        TInt aConnection );
+        
+    /**
+     * Observer callback for Connection Manager GetCurrentConnectionIDs
+     * function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aConnection
+     */         
+    void CmCurrentConnections(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aConnections);
+        
+    /**
+     * Observer callback for Connection Manager GetCurrentConnectionInfo
+     * function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param rscId
+     * @param aProtocolInfo
+     * @param aPeerConnectionManager
+     * @param peerId
+     * @param aStatus
+     */   
+    void CmCurrentInfo(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        TInt rscId, 
+        TInt transportId, 
+        const TDesC8& aProtocolInfo,
+        const TDesC8& aPeerConnectionManager, 
+        TInt peerId, 
+        const TDesC8& aDirection, 
+        const TDesC8& aStatus );
+
+    //*****************************************************************
+    //Functions for UPnP event handling
+    //*****************************************************************
+    /**
+     * Content Directory SystemUpdateId event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aSystemUpdateId Device systemUpdateId.
+     */
+    void CdsUpdateEvent(
+            const TDesC8& aUuid,
+            TInt aSystemUpdateId
+            );
+            
+    /**
+     * Content Directory ContainerUpdateIDs event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aConteinerIds Device container update ids.
+     */
+    void CdsContainerEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aConteinerIds
+            );
+            
+    /**
+     * Content Directory TransferIDs event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aTransferIds Device transfer ids.
+     */
+    void CdsTransferEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aTransferIds
+            );
+            
+    /**
+     * Rendering Control LastChange event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aLastChange Device LastChange statevariable.
+     */
+    void RcLastChangeEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aLastChange
+            );
+            
+    /**
+     * AV Transport LastChange event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aLastChange Device LastChange statevariable.
+     */
+    void AvtLastChangeEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aLastChange
+            );
+    /**
+     * Connection Manager SourceEvent event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aSource Device's source info.
+     */
+    void CmSourceEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aSource
+            );
+            
+    /**
+     * Connection Manager SinkEvent event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aSink Device's sink info.
+     */
+    void CmSinkEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aSink
+            );
+            
+    /**
+     * Connection Manager ConnectionsEvent event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aConnections Devices connections.
+     */
+    void CmConnectionsEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aConnections
+            );
+    //*****************************************************************
+    // Device and http functions.
+    //*****************************************************************
+    /**
+     * Handles HTTP messages.
+     * @since Series 60 2.6
+     * @param aMessage Incoming HTTP message.
+     */
+    void HttpResponseL( CUpnpHttpMessage* aMessage );
+
+public:
+
+    /**
+     * Handles UPnP device discoveries.
+     * @since Series 60 2.6
+     * @param aDevice Device that is discovered.
+     */
+    void DeviceDiscoveredL( CUpnpDevice* aDevice );
+
+    /**
+     * Handles UPnP device disappears.
+     * @since Series 60 2.6
+     * @param aDevice Device that disappeared.
+     */
+    void DeviceDisappearedL( CUpnpDevice* aDevice );    
+ 
+protected: // From CUpnpMediaServerNotifier
+
+    /**
+     * Called when Content Directory file transfer is finished
+     * either with success or failure.
+     * See CUpnpFileTransferEvent class description for details.
+     *
+     * @since Series 60 3.1
+     * @param aEvents Media Server event
+     * @return notifier object
+     */
+    void FileTransferEvent( CUpnpFileTransferEvent *aEvent );
+    
+    /**
+     * Called when Content Directory file transfer is finished
+     * and iInternalState == ECopyToPhone
+     * @since Series 60 3.2
+     * @param aEvent Media Server event
+     * @param aError from FileTransferEvent
+     */
+    void HandleCopyToPhoneEventL( 
+        CUpnpFileTransferEvent& aEvent, 
+        TInt aError );
+
+    /**
+     * Called in case of CUpnpMediaServerNotifier internal error.
+     * Should be used for event handling recovery.
+     *
+     * @since Series 60 3.1
+     * @param aObserver event observer
+     * @return notifier object
+     */
+    void NotifierError( TInt aError );
+    
+public: // New functions
+
+    /**
+     * Handles UPnP device disappears.
+     *
+     * @param aDevice Device that disappeared.
+     */
+    void DeviceDisappearedL( CUpnpAVDeviceExtended& aDevice );
+
+    /**
+     * Sets local (S60) Media Server Uuid
+     *
+     * @param aUuid device Uuid
+     */
+    void SetLocalMSUuidL( const TDesC8& aUuid );
+
+    /**
+     * Returns Session Id
+     *
+     * @return session id
+     */
+    TInt SessionId() const;
+    
+    /**
+     * Returns device Uuid 
+     *
+     * @return device Uuid
+     */
+    const TDesC8& Uuid() const;
+    
+public:
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetBrowseResponseSizeL( const RMessage2& aMessage );  
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelGetBrowseResponseSizeL();
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetBrowseResponseL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetSearchResponseSizeL( const RMessage2& aMessage );
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelGetSearchResponseSizeL();
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetSearchResponseL( const RMessage2& aMessage );
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetSearchCapabitiesSizeL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelGetSearchCapabitiesSizeL();     
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetSearchCapabitiesL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CreateContainerL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelCreateContainerL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void DeleteObjectL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelDeleteObjectL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void DeviceDisappearedRequestL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelDeviceDisappearedRequestL();
+                                   
+private:
+
+    /**
+     * Parses create object -action response and returns import uri.
+     *
+     * @param aResponse create object -action response
+     * @return import uri (ownership is transferred)
+     */
+    HBufC8* ParseCreateObjectResponseL( const TDesC8& aResponse );
+
+    /**
+     * Parses browse response and checks if the container supports the 
+     * media type we are about to copy into it
+     *
+     * @param aResponse browse response
+     */
+    void CheckIsCreateObjectSupportedL( const TDesC8& aResponse );
+
+    /**
+     * Parses browse response and checks if the container supports the 
+     * media type we are about to copy into it. After that it sends
+     * a create object -action.
+     *
+     * @param aResponse browse response
+     */
+    void CheckAndSendCreateObjectActionL( const TDesC8& aResponse );
+
+    /**
+     * Parses browse response and checks if the object can be deleted. If
+     * supported, sends destroyobject-action.
+     *
+     * @param aResponse browse response
+     */
+    void CheckAndSendDestroyObjectActionL( const TDesC8& aResponse );    
+    
+    /**
+     * Sends a create object -action
+     *
+     * @param aUuid device uuid
+     * @param aContainerId container id
+     * @param aResponse elements xml
+     */
+    void SendCreateObjectActionL( const TDesC8& aUuid,
+        const TDesC8& aContainerId, const TDesC8& aResponse );
+
+    /**
+     * Sends export resource -action
+     */
+    void SendExportActionL();
+    
+    /**
+     * Sends import resource -action
+     */
+    void SendImportActionL();
+
+    /**
+     * Resets internal state
+     */
+    void ResetL();
+        
+    /**
+     * Postprocesses copy operation
+     *
+     * @param aError error code in copying
+     * @param aFinished state of copy (create object/ import/export action)
+     */
+    void CopyFinished( TInt aError, TBool aFinished ); 
+    
+    /**
+     * Reads an object from a message
+     *
+     * @param aMessage client/server message
+     * @param aSlot message slot number
+     * @param aObj UPnP object
+     */
+    void ReadObjFromMessageL( const RMessage2& aMessage, TInt aSlot,
+        CUpnpObject* aObj );
+        
+    /**
+     * Reads a request from a message
+     *
+     * @param aMessage client/server message
+     * @param aSlot message slot number
+     * @param aReq request
+     */
+    void ReadReqFromMessageL( const RMessage2& aMessage, TInt aSlot,
+        CUpnpAVRequest* aReq );
+        
+    /**
+     * Reads a browse request from a message
+     *
+     * @param aMessage client/server message
+     * @param aSlot message slot number
+     * @param aReq browse request
+     */
+    void ReadBrowseReqFromMessageL( const RMessage2& aMessage, TInt aSlot,
+        CUpnpAVBrowseRequest* aReq );
+
+    /**
+     * Reads a buffer from a message
+     *
+     * @param aMessage client/server message
+     * @param aSlot message slot number
+     * @return a buffer (heap descriptor)
+     */
+    HBufC8* ReadBufFromMessageLC( const RMessage2& aMessage, TInt aSlot );
+
+    /**
+     * Sets download settings. Not currently needed, for future use.
+     *
+     * @param aType download location
+     */
+    void SetDownloadSettingsL( MUPnPAVBrowsingSession::TMemoryType aType );
+    
+    /**
+     * Restores download settings. Not currently needed, for future use.
+     *
+     * @return error code
+     */
+    TInt RestoreDownloadSettings();
+    
+    /**
+     * Checks sharing status. Determines if the copied file is left shared or
+     * not.
+     *
+     * @return error code
+     */
+    TInt CheckSharingStatus();                      
+
+private:
+
+    RUpnpMediaServerClient&     iMediaServer; // Not own
+
+    CUpnpAVControllerServer&    iServer;
+    
+    TInt                        iSessionId;
+
+    TInt                        iInstanceId;
+    
+    TInt                        iIPSessionId;
+
+    TInt                        iTransferId;
+    
+    TBool                       iTransferEventReceived;
+    
+    TInternalBrowseState        iInternalState;
+    
+    TInternalCopyState          iCopyState;
+    
+    RMessage2*                  iActionMessage; // Own
+    
+    RMessage2*                  iDeviceMessage; // Own
+    
+    CUpnpAVDeviceExtended*      iDevice; // Own
+    
+    HBufC8*                     iLocalMediaServerUuid; // Own
+    
+    HBufC8*                     iRespBuf; // Own
+    
+    HBufC8*                     iRespBuf2; // Own  
+        
+    HBufC8*                     iImportURI; // Own
+    
+    HBufC8*                     iSourceURI; // Own
+    
+    HBufC8*                     iItemId; // Own
+    
+    HBufC8*                     iContainerId; // Own
+    
+    CUpnpItem*                  iSharedItem; // Own  
+    
+    CUPnPFileSharingActive*     iFileSharing; // Own
+      
+    CUpnpMediaServerNotifier*   iMediaServerNotifier; // Own
+    
+    HBufC8*                     iOriginalLocation; // Own
+    
+    HBufC8*                     iFilePath; // Own
+    
+    CUpnpMediaServerSettings*   iMSSettings; // Own, For future use
+    
+    CRepository*                iAppSettings; // Own
+
+    MUPnPAVBrowsingSession::TFileSharing iShareFlag;    
+    
+    TBool                       iMusic;
+    
+    TInt                        iAsyncErr;
+    
+    };
+
+#endif // C_UPNPBROWSINGSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpdevicediscoverymessage.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Device message class
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPDEVICEDISCOVERYMESSAGE_H
+#define C_UPNPDEVICEDISCOVERYMESSAGE_H
+
+// INDLUDE FILES
+#include <e32base.h>
+#include "upnpavcontrollerglobals.h"
+
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+
+/**
+ * Used to save CUpnpAVDevice object and device discovery message type.
+ *
+ * @since Series 60 3.2.3
+ */
+class CUpnpDeviceDiscoveryMessage : public CBase
+{
+public:  // Constructors and destructor
+        
+    /**
+     * Two-phased constructor. Instance is left in cleanup stack.
+     *
+     * @since Series 60 3.2.3
+     * @param aDevice pointer to device object.
+     * @param aType device discovery message type.
+     * @return a CUpnpDeviceDiscoveryMessage instance
+     */
+    static CUpnpDeviceDiscoveryMessage* NewLC( 
+            const CUpnpAVDevice* aDevice,
+            TAVControllerDeviceDiscovery aType );
+        
+    /**
+     * Two-phased constructor.
+     *
+     * @since Series 60 3.2.3
+     * @param aDevice pointer to device object.
+     * @param aType device discovery message type.
+     * @return a CUpnpDeviceDiscoveryMessage instance
+     */
+    static CUpnpDeviceDiscoveryMessage* NewL( 
+            const CUpnpAVDevice* aDevice,
+            TAVControllerDeviceDiscovery aType );
+        
+    /**
+     * Destructor
+     */
+    virtual ~CUpnpDeviceDiscoveryMessage();
+    
+public:
+    
+    /**
+     * Return link offset (used in linked list)
+     * 
+     * @since Series 60 3.2.3
+     * @return link offset
+     */
+    static TInt LinkOffset();
+    
+    /**
+     * Return link offset (used in linked list)
+     * 
+     * @since Series 60 3.2.3
+     * @return pointer to device object
+     */
+    CUpnpAVDevice* Device();
+    
+    /**
+     * Return device discovery message type
+     * 
+     * @since Series 60 3.2.3
+     * @return device discovery message type
+     */
+    TAVControllerDeviceDiscovery& MsgType();
+    
+protected: //
+
+    /**
+     * Constructor
+     */
+    CUpnpDeviceDiscoveryMessage();
+    
+private:
+    
+    /** @var iSlink  pointer to next CUpnpDeviceDiscoveryMessage object*/
+    TSglQueLink iSlink;
+    
+    /** @var iUpnpAVDevice  pointer to device object*/
+    CUpnpAVDevice* iUpnpAVDevice; //Own
+    
+    /** @var iMsgType device discovery message type */
+    TAVControllerDeviceDiscovery iMsgType;
+};
+
+#endif /*C_UPNPDEVICEDISCOVERYMESSAGE_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpdevicerepository.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      a list of devices with extended information
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPDEVICEREPOSITORY_H_
+#define C_UPNPDEVICEREPOSITORY_H_
+
+// Include files
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+class CUpnpAVDeviceExtended;
+class CUpnpDevice;
+class CUpnpAVControlPoint;
+
+/**
+ * UPnP Device Repository. Stores UPnP devices with additional (protocolinfo)
+ * information.
+ */
+class CUPnPDeviceRepository: public CBase
+    {
+ 
+public:
+
+    /**
+     * Static 1st phase constructor
+     *
+     * @param aControlPoint AV Control Point instance
+     * @return new instance
+     */    
+    static CUPnPDeviceRepository* NewL
+        (
+        CUpnpAVControlPoint& aControlPoint
+        );
+
+    /**
+     * Destructor
+     */    
+    virtual ~CUPnPDeviceRepository();
+      
+private:
+
+    /**
+     * Private constructor
+     */
+    CUPnPDeviceRepository
+        (
+        CUpnpAVControlPoint& aControlPoint
+        );
+
+    /**
+     * 2nd phase constructor
+     */    
+    void ConstructL();    
+
+public: // New functions
+
+    /**
+     * Adds a new device to repository
+     *
+     * @param aDevice UPnP Device
+     */    
+    void AddDeviceL( CUpnpDevice& aDevice );
+    
+    /**
+     * Adds protoconinfo to a device
+     *
+     * @param aUuid device uuid
+     * @param aSource source protocolinfo
+     * @param aSink sink protocolinfo
+     * @return UPnP device with protocolinfo
+     */    
+    CUpnpAVDeviceExtended& AddProtocolInfoL( const TDesC8& aUuid,
+        const TDesC8& aSource, const TDesC8& aSink );
+        
+    /**
+     * Removes a device from repository
+     *
+     * @param aUuid device Uuid
+     */    
+    void Remove( const TDesC8& aUuid );
+    
+    /**
+     * Finds and return a device
+     *
+     * @param aUuid device Uuid
+     * @return device reference
+     */    
+    CUpnpAVDeviceExtended& FindDeviceL( const TDesC8& aUuid );
+    
+    /**
+     * Return a list of devices
+     *
+     * @return list of device
+     */    
+    const RPointerArray<CUpnpAVDeviceExtended>& DeviceList() const;
+    
+    /**
+     * Subscibe device for events (sends subscribe action)
+     *
+     * @param aUuid device Uuid
+     */    
+    void SubscribeDeviceL( const TDesC8& aUuid );     
+
+    /**
+     * Unsubscibe device for events (sends unsubscribe action)
+     *
+     * @param aUuid device Uuid
+     */    
+    void UnSubscribeDeviceL( const TDesC8& aUuid );
+    
+    void ConnectionLost();
+    
+    TBool IsWlanActive(); 
+    
+private:
+
+    /**
+     * Parses devices services (goes through actions and determines what's
+     * supported.
+     *
+     * @param aSource source device
+     * @param aTarget target device
+     */    
+    void ParseDeviceServicesL( CUpnpDevice& aSource,
+        CUpnpAVDeviceExtended& aTarget );
+
+   
+private:
+
+    CUpnpAVControlPoint&        iControlPoint; // Not own        
+   
+    RPointerArray<CUpnpAVDeviceExtended> iDevices; // Own
+    
+    TBool iIsWlanActive;
+    };
+
+
+#endif // C_UPNPDEVICEREPOSITORY_H_
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpdownloadsession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implementation for session towards a media server
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_UPNPDOWNLOADSESSION_H
+#define C_UPNPDOWNLOADSESSION_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "upnpavcontroller.h"
+#include "upnpfiletransfersessionbase.h"
+#include "httptransferobserver.h"
+#include "tupnpfiletransferevent.h"
+
+class CHttpDownloader;
+class CUpnpDlnaProtocolInfo;
+
+/**
+ * Implements AV Controller server side download session
+ *
+ * @since S60 v3.2
+ */
+class CUPnPDownloadSession :    public CUPnPFileTransferSessionBase,
+                                public MHttpTransferObserver
+    {
+public:
+
+    /**
+     * Static 1st phase constructor
+     *
+     * @param aSessionId session id
+     * @param aUuid device Uuid
+     */
+    static CUPnPDownloadSession* NewL( CUpnpAVControllerServer& aServer,
+        TInt aSessionId, const TDesC8& aUuid );
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPDownloadSession();
+    
+private:
+
+    /**
+     * Private constructor
+     *
+     * @param aSessionId session id
+     */
+    CUPnPDownloadSession( CUpnpAVControllerServer& aServer,
+        TInt aSessionId );    
+    
+    /**
+     * 2ns phase constructor
+     */
+    void ConstructL( const TDesC8& aUuid );
+
+private: // From MHttpTransferObserver
+    
+    /**
+     * See httptransferobserver.h
+     */
+    void TransferProgress( TAny* aKey, TInt aBytes, TInt aTotalBytes );
+
+    /**
+     * See httptransferobserver.h
+     */
+    void ReadyForTransferL( TAny* aKey );
+
+    /**
+     * See httptransferobserver.h
+     */
+    void TransferCompleted( TAny* aKey, TInt aStatus );
+     
+public: // New functions
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void StartDownloadL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void StartDownloadFHL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelDownloadL( const RMessage2& aMessage );
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelAllDownloadsL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void StartTrackingDownloadProgressL( const RMessage2& aMessage );
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void StopTrackingDownloadProgressL( const RMessage2& aMessage );
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetDownloadEventL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelGetDownloadEventL( const RMessage2& aMessage );
+
+    /**
+     * Handles UPnP device disappears.
+     *
+     * @param aDevice Device that disappeared.
+     */
+    void DeviceDisappearedL( CUpnpAVDeviceExtended& aDevice );
+
+private: // New functions
+
+    void SetHeadersL( CUpnpDlnaProtocolInfo& aInfo, TAny* aKey );
+    
+private:
+    
+    CHttpDownloader* iDownloader; // Own
+      
+    };
+
+#endif // C_UPNPDOWNLOADSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpfilesharingactive.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for file sharing operations
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPFILESHARINGACTIVE_H
+#define C_UPNPFILESHARINGACTIVE_H
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUPnPAVRenderingSessionImpl;
+class CUpnpFileSharing;
+class CUpnpItem;
+
+/**
+ *  Used to make an asynchronous file sharing operation to synchronous
+ *  operation. Handles UPnP Security for a file.
+ *
+ *  @since S60 v3.1
+ */
+class CUPnPFileSharingActive : public CActive
+    {
+
+public:
+
+    /**
+     * Static 1st phase construct
+     */
+    static CUPnPFileSharingActive* NewL();
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPFileSharingActive();
+       
+private:
+
+    /**
+     * Constructor
+     */
+    CUPnPFileSharingActive();
+    
+    void ConstructL();
+
+private: // Private methods for accessing UPnP security
+
+    /**
+     * Allows/denied access to the files to which the given item's res-
+     * elements are pointing.
+     *
+     * @since Series 60 3.2
+     * @param aItem the item
+     * @param aAccessAllowed ETrue to allow and EFalse to deny the access
+     */
+    void SetAccesstoItemResourcesL( CUpnpItem& aItem, TBool aAccessAllowed );
+    
+protected: // From CActive
+
+    /**
+     * See e32base.h
+     */
+    void RunL();
+    
+    /**
+     * See e32base.h
+     */
+    void DoCancel();
+    
+    /**
+     * See e32base.h
+     */
+    TInt RunError( TInt aError );
+
+public: // New functions    
+
+    /**
+     * Shares an item
+     *
+     * @param item to share
+     */
+    void ShareItemL( CUpnpItem& aItem );
+    
+    /**
+     * Unshares an item
+     *
+     * @param aId item to unshare (id)
+     */
+    void UnShareItemL( const TDesC8& aId );
+
+private:
+    
+    CUpnpFileSharing* iFileSharing; // Own
+    
+    };
+
+#endif // C_UPNPAVEVENTACTIVE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpfiletransfersessionbase.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implementation for session towards a media server
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPFILETRANSFERSESSIONBASE_H
+#define C_UPNPFILETRANSFERSESSIONBASE_H
+
+// INCLUDES
+// System
+#include <e32base.h>
+
+// upnpframework
+#include "upnpavcontroller.h"
+#include "httptransferobserver.h"
+#include "tupnpfiletransferevent.h"
+
+// FORWARD DECLARATIONS
+class CUpnpAVDeviceExtended;
+class CUpnpFileTransferItem;
+class CUpnpAVControllerServer;
+
+// CLASS DECLARATION
+/**
+ * Filetransfer session base class
+ *
+ * @since S60 v3.2
+ */
+class CUPnPFileTransferSessionBase : public CBase
+    {
+
+public:
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPFileTransferSessionBase();
+    
+protected:
+
+    /**
+     * Private constructor
+     *
+     * @param aSessionId session id
+     */
+    CUPnPFileTransferSessionBase( CUpnpAVControllerServer& aServer,
+        TInt aSessionId );    
+    
+    /**
+     * 2ns phase constructor
+     */
+    void ConstructL( const TDesC8& aUuid );
+     
+public: // New functions
+
+    /**
+     * Returns Session Id
+     *
+     * @return session id
+     */
+    TInt SessionId() const;
+    
+    /**
+     * Returns device Uuid 
+     *
+     * @return device Uuid
+     */
+    const TDesC8& Uuid() const;
+     
+protected:
+    
+    /**
+     * Checks if the given key (filetransfer item) exists in the transfer
+     * que
+     *
+     * @param aKey filetransfer identifier
+     * @return ETrue if the key exists
+     */
+    TBool CheckIfKeyExists( TInt aKey );
+    
+    /**
+     * Checks if the given key (filetransfer item) exists in the transfer
+     * que and returns the index
+     *
+     * @param aKey filetransfer identifier
+     * @param aIndex reference to the index
+     * @return ETrue if the key exists
+     */
+    TBool CheckIfKeyExists( TInt aKey, TInt& aIndex );
+
+    /**
+     * Finds and returns filetransfer item
+     *
+     * @param aItem filetransfer item
+     * @param aKey filetransfer identifier
+     * @return status (error) code
+     */
+    TInt FindItemByKey( TUpnpFileTransferEvent& aItem, TInt aKey );
+    
+    /**
+     * Finds and returns filetransfer item
+     *
+     * @param aItem filetransfer item
+     * @param aKey filetransfer identifier
+     * @param aIndex reference to the index
+     * @return status (error) code
+     */
+    TInt FindItemByKey( TUpnpFileTransferEvent& aItem, TInt aKey,
+        TInt& aIndex );
+
+    /**
+     * Reads filetransfer item from the message received from the client
+     *
+     * @param aMessage message from the client side
+     * @param aSlot message slot number
+     * @param aItem filetransfer item
+     */
+    void ReadTransferItemFromMessageL( const RMessage2& aMessage, TInt aSlot,
+        CUpnpFileTransferItem* aItem );
+    
+    /**
+     * Completes an event
+     *
+     * @param aEvent event to complete
+     */
+    void Complete( const TUpnpFileTransferEvent& aEvent );
+            
+protected:
+
+    /**
+     * AV Controller server
+     *
+     * Not own
+     */
+    CUpnpAVControllerServer&        iServer;
+    
+    /**
+     * Session id
+     */
+    TInt                            iSessionId;
+    
+    /**
+     * Target/source device
+     *
+     * Own
+     */
+    CUpnpAVDeviceExtended*          iDevice;
+    
+    /**
+     * Array of filetransfer items
+     */
+    RArray<TUpnpFileTransferEvent>  iTransferItems;
+    
+    /**
+     * Que of events
+     */
+    RArray<TUpnpFileTransferEvent>  iEventQueu;
+    
+    /**
+     * Async message, used to report a filetransfer event to the client side
+     *
+     * Own
+     */
+    RMessage2*                      iEventMsg;
+    
+    /**
+     * Flag to track if progress tracking is enabled or not
+     */
+    TBool                           iProgressTrackingEnabled;
+      
+    };
+
+#endif // C_UPNPFILETRANSFERSESSIONBASE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpplaybacksession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1233 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implements playback state machinery for media renderer
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_UPNPPLAYBACKSESSION_H
+#define C_UPNPPLAYBACKSESSION_H
+
+// INCLUDE FILES
+// System
+#include <e32base.h>
+
+// upnp stack api
+#include <upnpavcontrolpointobserver.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h"
+#include "upnpavrenderingsessionobserver.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVMediaObserver;
+class CUpnpItem;
+class CUpnpObject;
+class CUPnPFileSharingActive;
+class RUpnpMediaServerClient;
+class CUpnpAVRequest;
+class CUpnpAVDeviceExtended;
+class TUnsolicitedEventC;
+class CUPnPXMLEventParser;
+class CUpnpAVControllerServer;
+class CUpnpAttribute;
+class CUpnpAVControlPoint;
+class CUPnPPeriodic;
+
+/**
+ * Implements the server side playback session. Provides functionality to
+ * Set URI/Next URI, control playback and to get position info.
+ *
+ * @since S60 v3.1
+ */
+class CUPnPPlaybackSession :    public CBase,
+                                public MUpnpAVControlPointObserver
+    {
+
+private:
+	
+    /**
+     * Defines current playback state.
+     */
+    enum TPlaybackState
+        {
+        EUninitialized = 0,
+        EStopped,
+        EPlaying,
+        EPaused,
+        EPlaySent
+        };
+        
+    enum TMuteState
+        {
+        EUnknown    = -1,
+        ENotMuted   = 0,
+        EMuted      = 1
+        };    
+
+public:
+
+    /**
+     * Static 1st phase constructor.
+     *
+     * @param aControlPoint AV Control Point reference
+     * @param aClient S60 Media Server session reference
+     * @param aDispatcher observer callback disparcher reference
+     * @param aRepository device repository
+     * @param aSessionId session id
+     * @param aUuid device Uuid
+     * @return new instance
+     */
+    static CUPnPPlaybackSession* NewL
+        (
+        RUpnpMediaServerClient& aClient,
+        CUpnpAVControllerServer& aServer,
+        TInt aSessionId,   
+        const TDesC8& aUuid
+        );
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPPlaybackSession();
+    
+private:
+
+    /**
+     * Private constructor.
+     *
+     * @param aControlPoint AV Control Point reference
+     * @param aClient S60 Media Server session reference
+     * @param aDispatcher observer callback disparcher reference
+     * @param aRepository device repository
+     * @param aSessionId session id
+     * @param aUuid device Uuid
+     */
+    CUPnPPlaybackSession
+        (
+        RUpnpMediaServerClient& aClient,
+        CUpnpAVControllerServer& aServer,
+        TInt aSessionId
+        );    
+    
+    /**
+     * 2nd phase construct
+     *
+     * @param aUuid device Uuid
+     */
+    void ConstructL( const TDesC8& aUuid );
+  
+protected: // From MUpnpAVControlPointObserver
+
+    /**
+     * Observer callback for rendering control Set Volume.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aChannel audio channel.
+     * @param aDesiredVolume 
+     */
+    void RcSetVolumeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aDesiredVolume);
+        
+    /**
+     * Observer callback for rendering control Get Volume.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aChannel audio channel.
+     * @param aCurrentVolume 
+     */
+    void RcVolumeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aCurrentVolume);
+         
+    /**
+     * Observer callback for rendering control Set Mute.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aChannel audio channel.
+     * @param aDesiredMute 
+     */
+    void RcSetMuteResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aDesiredMute);
+        
+    /**
+     * Observer callback for rendering control Get Mute.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aChannel audio channel.
+     * @param aCurrentMute 
+     */
+    void RcMuteResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr, 
+        const TDesC8& aInstance, 
+        const TDesC8& aChannel, 
+        const TDesC8& aCurrentMute); 
+
+
+    /**
+     * Observer callback for rendering control AV set transport uri.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aCurrentUri Current transport URI.
+     * @param Current transport URI Metadata. 
+     */
+    void AvtSetTransportUriResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aCurrentUri,
+        const TDesC8& aCurrentUriMetaData);
+        
+    /**
+     * Observer callback for rendering control AV set next transport uri.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aCurrentUri Current transport URI.
+     * @param Current transport URI Metadata. 
+     */
+    virtual void AvtSetNextTransportUriResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNextUri,
+        const TDesC8& aNextUriMetaData);
+        
+    /**
+     * Observer callback for rendering control AV get media info response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aNrTracks Number of tracks.
+     * @param aMediaDuration 
+     * @param aCurrentUri Current transport URI.
+     * @param aCurrentUriMetaData Metadata of current trransport uri. 
+     * @param aNextUri Next transport URI.
+     * @param aNextUriMetaData Metadata of next trransport uri.
+     * @param aPlayMedium
+     * @param aRecordMedium
+     * @param aWriteStatus
+     */
+    void AvtMediaInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNrTracks,
+        const TDesC8& aMediaDuration,
+        const TDesC8& aCurrentUri,
+        const TDesC8& aCurrentUriMetaData,
+        const TDesC8& aNextUri,
+        const TDesC8& aNextUriMetaData,
+        const TDesC8& aPlayMedium,
+        const TDesC8& aRecordMedium,
+        const TDesC8& aWriteStatus);
+        
+    /**
+     * Observer callback for rendering control AV get transport info response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId
+     * @param aErr UPnP error code.
+     * @param aInstance rendering instance.
+     * @param aCurrenTransportState
+     * @param aCurrentTransportStatus
+     * @param aCurrentUri aCurrentSpeed
+     */
+    void AvtGetTransportInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aCurrenTransportState,
+        const TDesC8& aCurrentTransportStatus,
+        const TDesC8& aCurrentSpeed);
+        
+    /**
+     * Observer callback for rendering control AV get position info response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aTrack rendering instance.
+     * @param aTrackDuration 
+     * @param aTrackMetaData
+     * @param aTrackURI
+     * @param aRelTime
+     * @param aAbsTime
+     * @param aRelCount
+     * @param aAbsCount
+     */
+    void AvtPositionInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aTrack,
+        const TDesC8& aTrackDuration,
+        const TDesC8& aTrackMetaData,
+        const TDesC8& aTrackURI,
+        const TDesC8& aRelTime,
+        const TDesC8& aAbsTime,
+        const TDesC8& aRelCount,
+        const TDesC8& aAbsCount);
+        
+    /**
+     * Observer callback for rendering control AV get device
+     * capabilities response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aPlayMedia
+     * @param aRecMedia 
+     * @param aRecQualityModes
+     */
+    void AvtDeviceCapabilitiesResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aPlayMedia,
+        const TDesC8& aRecMedia,
+        const TDesC8& aRecQualityMode);
+        
+    /**
+     * Observer callback for rendering control AV get transport
+     * settings response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId
+     * @param aInstanceId
+     * @param aErr UPnP error code.        
+     * @param aPlayMode
+     * @param aRecQualityMode
+     */
+    void AvtTransportSettingsResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aPlayMode,
+        const TDesC8& aRecQualityMode);
+        
+    /**
+     * Observer callback for rendering control AV Stop response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtStopResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+        
+    /**
+     * Observer callback for rendering control AV Play response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSpeed
+     */
+    void AvtPlayResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aSpeed);
+    
+    /**
+     * Observer callback for rendering control AV Pause response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtPauseResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+        
+    /**
+     * Observer callback for rendering control AV Record response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtRecordResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+        
+    /**
+     * Observer callback for rendering control AV Seek response.
+     * @since Series 60 2.6
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aUnit
+     * @param aTarget
+     */
+    void AvtSeekResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aUnit,
+        const TDesC8& aTarget);
+        
+    /**
+     * Observer callback for rendering control AV Next response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtNextResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+        
+    /**
+     * Observer callback for rendering control AV Previous response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     */
+    void AvtPreviousResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId);
+    
+    /**
+     * Observer callback for rendering control AV setplay mode response.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aNewPlayMode
+     */
+    void AvtSetPlayModeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNewPlayMode);
+        
+    /**
+     * Observer callback for rendering control AV set record qualityresponse.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aNewRecordQuality
+     */
+    void AvtSetRecordModeResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aInstanceId,
+        const TDesC8& aNewRecordQuality);
+        
+    /**
+     * Observer callback for Content Directory GetSearchCapabilities function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSearchCaps
+     */
+    void CdsSearchCapabilitiesResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSearchCaps);
+        
+    /**
+     * Observer callback for Content Directory GetSortCapabilities function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSortCaps
+     */
+    void CdsSortCapabilitiesResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSortCaps);
+
+    /**
+     * Observer callback for Content Directory GetSystemUpdateID function.
+     * @since Series 60 2.6
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSystemUpdateId
+     */
+    void CdsSystemUpdateIdResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        TInt aSystemUpdateId);
+    /**
+    * Observer callback for Content Directory Browse function.
+    * @since Series 60 2.6
+    * @param aUuid Source device UUID. 
+    * @param aSessionId 
+    * @param aErr UPnP error code.
+    * @param aObjectID
+    * @param aBrowseFlag
+    * @param aFilter
+    * @param aIndex
+    * @param arequest
+    * @param aSortCriteria
+    * @param aResult
+    * @param aReturned
+    * @param aMatches
+    * @param aUpdateID
+    */
+    
+    void CdsBrowseResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aObjectID,
+        const TDesC8&  aBrowseFlag,
+        const TDesC8&  aFilter,
+        TInt aIndex,
+        TInt aRequest,
+        const TDesC8&  aSortCriteria,
+        const TDesC8&  aResult,
+        TInt aReturned,
+        TInt aMatches,
+        const TDesC8&  aUpdateID);
+        
+    /**
+     * Observer callback for Content Directory Search function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aContainerId
+     * @param aSearchCriteria
+     * @param aFilter
+     * @param aIndex
+     * @param arequest
+     * @param aSortCriteria
+     * @param aResult
+     * @param aReturned
+     * @param aMatches
+     * @param aUpdateID
+     */
+     
+    void CdsSearchResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerId,
+        const TDesC8& aSearchCriteria,
+        const TDesC8& aFilter,
+        TInt aIndex,
+        TInt aRequest,
+        const TDesC8& aSortCriteria,
+        const TDesC8& aResult,
+        TInt aReturned,
+        TInt aMatches,
+        const TDesC8& aUpdateID);
+        
+    /**
+     * Observer callback for Content Directory DestroyObject function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aObjectId
+     */
+    void CdsDestroyObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aObjectId );
+        
+    /**
+     * Observer callback for Content Directory UpdateObject function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aObjectId
+     * @param aCurrentTagValue
+     * @param aNewTagValue
+     */
+    void CdsUpdateObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aObjectId,
+        const TDesC8& aCurrentTagValue,
+        const TDesC8& aNewTagValue );
+        
+    /**
+     * Observer callback for Content Directory ImportResource function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSourceURI
+     * @param aDestinationURI
+     * @param aTransferId
+     */       
+    void CdsImportResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSourceURI,
+        const TDesC8& aDestinationURI,
+        const TDesC8& aTransferId );
+        
+    /**
+     * Observer callback for Content Directory ExportResource function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSourceURI
+     * @param aDestinationURI
+     * @param aTransferId
+     */       
+    void CdsExportResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSourceURI,
+        const TDesC8& aDestinationURI,
+        const TDesC8& aTransferId );
+        
+    /**
+     * Observer callback for Content Directory StopTransfer function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSourceURI
+     * @param aDestinationURI
+     * @param aTransferId
+     */       
+    void CdsStopTransferResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aTransferId );
+    
+    /**
+     * Observer callback for Content Directory GetTransferProgress function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aTransferId
+     * @param aTransferStatus
+     * @param aTransferTotal
+     */         
+    virtual void CdsCTransferProgressResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aTransferId,
+        const TDesC8& aTransferStatus,
+        const TDesC8& aTransferLength,            
+        const TDesC8& aTransferTotal );
+        
+    /**
+     * Observer callback for Content Directory DeleteResource function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aResourceUri Resource to be deleted.
+     */ 
+    void CdsDeleteResourceResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aResourceUri );
+        
+    /**
+     * Observer callback for Content Directory CreateReference function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aContainerId Destination folder.
+     * @param aObjectId Source object.
+     * @param aNewId Created reference.
+     */ 
+    void CdsCreateReferenceResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerId, 
+        const TDesC8& aObjectId, 
+        const TDesC8& aNewId );
+        
+    /**
+     * Observer callback for Content Directory CreateReference function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aContainerID Container in which new object is created.
+     * @param aElements Elements for item creation.
+     * @param aObjectID New objects ID.
+     * @param aResult Result of the action.
+     */ 
+    void CdsCreateObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerID, 
+        const TDesC8& aElements, 
+        const TDesC8& aObjectID, 
+        const TDesC8& aResult );
+        
+
+    /**
+     * Observer callback for Connection Manager GetProtocolInfo function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aSource
+     * @param aSink
+     */ 
+    void CmProtocolInfoResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aSource, 
+        const TDesC8& aSink );
+    
+    /**
+     * Observer callback for Connection Manager PrepareForConnection 
+     * function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aRemoteProtocolInfo
+     * @param aPeerConnectionManager
+     * @param aPeerConnectionId
+     * @param aDirection
+     * @param aConnection
+     * @param aTransport
+     * @param aRsc
+     */        
+    void CmPrepareResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aRemoteProtocolInfo,
+        const TDesC8& aPeerConnectionManager,
+        const TDesC8& aPeerConnectionId,
+        const TDesC8& aDirection,
+        TInt aConnection,
+        TInt aTransport,
+        TInt aRsc );
+    
+    /**
+     * Observer callback for Connection Manager ConnectionComplete 
+     * function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aConnection
+     */         
+    void CmComplete(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        TInt aConnection );
+        
+    /**
+     * Observer callback for Connection Manager GetCurrentConnectionIDs
+     * function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param aConnection
+     */         
+    void CmCurrentConnections(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aConnections);
+        
+    /**
+     * Observer callback for Connection Manager GetCurrentConnectionInfo
+     * function.
+     * @since Series 60 2.6
+     * @param aUuid Source device UUID. 
+     * @param aSessionId 
+     * @param aErr UPnP error code.
+     * @param rscId
+     * @param aProtocolInfo
+     * @param aPeerConnectionManager
+     * @param peerId
+     * @param aStatus
+     */   
+    void CmCurrentInfo(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        TInt rscId, 
+        TInt transportId, 
+        const TDesC8& aProtocolInfo,
+        const TDesC8& aPeerConnectionManager, 
+        TInt peerId, 
+        const TDesC8& aDirection, 
+        const TDesC8& aStatus );
+
+    //*****************************************************************
+    //Functions for UPnP event handling
+    //*****************************************************************
+    /**
+     * Content Directory SystemUpdateId event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aSystemUpdateId Device systemUpdateId.
+     */
+    void CdsUpdateEvent(
+            const TDesC8& aUuid,
+            TInt aSystemUpdateId
+            );
+            
+    /**
+     * Content Directory ContainerUpdateIDs event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aConteinerIds Device container update ids.
+     */
+    void CdsContainerEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aConteinerIds
+            );
+            
+    /**
+     * Content Directory TransferIDs event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aTransferIds Device transfer ids.
+     */
+    void CdsTransferEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aTransferIds
+            );
+            
+    /**
+     * Rendering Control LastChange event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aLastChange Device LastChange statevariable.
+     */
+    void RcLastChangeEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aLastChange
+            );
+            
+    /**
+     * AV Transport LastChange event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aLastChange Device LastChange statevariable.
+     */
+    void AvtLastChangeEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aLastChange
+            );
+    /**
+     * Connection Manager SourceEvent event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aSource Device's source info.
+     */
+    void CmSourceEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aSource
+            );
+            
+    /**
+     * Connection Manager SinkEvent event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aSink Device's sink info.
+     */
+    void CmSinkEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aSink
+            );
+            
+    /**
+     * Connection Manager ConnectionsEvent event handler.
+     * @since Series 60 2.6
+     * @param aUuid Device UUID.
+     * @param aConnections Devices connections.
+     */
+    void CmConnectionsEvent(
+            const TDesC8& aUuid,
+            const TDesC8& aConnections
+            );
+    //*****************************************************************
+    // Device and http functions.
+    //*****************************************************************
+    /**
+     * Handles HTTP messages.
+     * @since Series 60 2.6
+     * @param aMessage Incoming HTTP message.
+     */
+    void HttpResponseL( CUpnpHttpMessage* aMessage );
+
+public:
+
+    /**
+     * Handles UPnP device discoveries.
+     * @since Series 60 2.6
+     * @param aDevice Device that is discovered.
+     */
+    void DeviceDiscoveredL( CUpnpDevice* aDevice );
+
+    /**
+     * Handles UPnP device disappears.
+     * @since Series 60 2.6
+     * @param aDevice Device that disappeared.
+     */
+    void DeviceDisappearedL( CUpnpDevice* aDevice );    
+   
+public: // New functions
+    
+    /**
+     * Device disappeared callback
+     *
+     * @param aDevice disappeared device
+     */
+    void DeviceDisappearedL( CUpnpAVDeviceExtended& aDevice );
+    
+    /**
+     * Sets Uuid of the local Media Server
+     *
+     * @param aUuid device Uuid
+     */
+    void SetLocalMSUuidL( const TDesC8& aUuid );
+
+    /**
+     * Returns session id
+     *
+     * @return session id
+     */
+    TInt SessionId() const;
+        
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void EventRequestL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelEventRequestL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void SetURIL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelSetURIL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void SetNextURIL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelSetNextURIL();
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void PlayL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelPlayL();
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void StopL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelStopL();
+
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void PauseL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelPauseL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void SetVolumeL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelSetVolumeL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetVolumeL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelGetVolumeL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void SetMuteL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelSetMuteL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetMuteL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelGetMuteL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void GetPositionInfoL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelGetPositionInfoL();
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void DeviceDisappearedRequestL( const RMessage2& aMessage );
+    
+    /**
+     * See upnpavcontrollerimpl.h
+     */
+    void CancelDeviceDisappearedRequestL();        
+    
+    /**
+     * Returns device Uuid
+     */
+    const TDesC8& Uuid() const;     
+    
+private:
+
+    /**
+     * Parses a browse response and returns the importuri
+     *
+     * @param aResponse browse response
+     * @return importuri (ownership is transferred) 
+     */
+    HBufC8* ParseBrowseResponseL( const TDesC8& aResponse );
+    
+    /**
+     * Encodes given xml-document
+     *
+     * @param aResult xml-document
+     * @return encoded xml-document
+     */
+    HBufC8* EncodeXmlL( const TDesC8& aResult );
+    
+    /**
+     * Reset function
+     */
+    void ResetL();
+    
+    /**
+     * Reads object from a message
+     *
+     * @param aMessage message from client
+     * @param aSlot message slot numer
+     * @param aObj object pointer
+     */
+    void ReadObjFromMessageL( const RMessage2& aMessage, TInt aSlot,
+        CUpnpObject* aObj );        
+
+    /**
+     * Reads request from a message
+     *
+     * @param aMessage message from client
+     * @param aSlot message slot numer
+     * @param aReq request pointer
+     */
+    void ReadReqFromMessageL( const RMessage2& aMessage, TInt aSlot,
+        CUpnpAVRequest* aReq );
+        
+    void ValidateProtocolInfoL( const CUpnpAttribute& aProtocolInfo );        
+   
+    /**
+     * Send Play action if it has been requested.
+     */   
+    void SendPlayIfNeededL();
+    
+   /**
+     * Play delay timer callback
+     *
+     * @param TAny* aPtr this pointer for callback
+     * @return TInt
+     */
+    static TInt PlayDelayTimeExpired( TAny* aPtr );
+        
+
+private:
+
+    CUpnpAVControllerServer&    iServer;
+    
+    RUpnpMediaServerClient&     iMediaServer; // Not own
+    
+    CUPnPFileSharingActive*     iFileSharing; // Own
+    
+    TInt                        iSessionId;
+    
+    TInt                        iInstanceId;
+
+    TInt                        iIPSessionIdCommand;
+    
+    TInt                        iIPSessionIdSetting;
+
+    TBool                       iEventingActive;
+    
+    RMessage2*                  iCommandMessage; // Own
+    
+    RMessage2*                  iSettingMessage; // Own
+    
+    RMessage2*                  iDeviceMessage; // Own
+        
+    CUpnpAVDeviceExtended*      iDevice;
+    
+    HBufC8*                     iLocalMediaServerUuid; // Own
+    
+    CUpnpItem*                  iSharedItem; // Own
+    
+    TBool                       iItemShared;
+    
+    CUpnpItem*                  iNextSharedItem; // Own    
+    
+    TBool                       iNextItemShared;
+        
+    RMessage2*                  iEventMessage; // Own
+    
+    TPlaybackState              iPlaybackState;
+    
+    CUPnPXMLEventParser*        iEventParser;
+    
+    RArray<TUnsolicitedEventC>  iEventQue; // Own
+    
+    TMuteState                  iMuteState;
+    
+    TInt                        iVolume;
+    
+    // iPlayDelayTimer is started when we set transporturi.    
+    // The meaning of the timer is to delay the sending of play action in 
+    // order to achieve better IOP with some HW renderers like Kiss DP1600.
+    CUPnPPeriodic*              iPlayDelayTimer; // Own
+
+    // iPlayRequested will be set to ETrue if the playdelay timer is running    
+    // and somebody requests play action in the meantime
+    TBool                       iPlayRequested;
+    };
+
+#endif // C_UPNPPLAYBACKSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpresourcehelper.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Filetransfer helper
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPRESOURCEHELPER_H_
+#define C_UPNPRESOURCEHELPER_H_
+
+// EXTERNAL INCLUDES 
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+
+// CLASS DECLARATION
+/**
+ * Filetransfer helper
+ *
+ * @since S60 v3.2
+ */
+class CUPnPResourceHelper: public CBase
+    {
+
+public:
+
+    /**
+     * Static 1st phase constructor
+     * @param aObserver Observer
+     * @param aType timer type
+     * @return A new timer instance
+     */    
+    static CUPnPResourceHelper* NewL();
+
+    /**
+     * Destructor
+     */    
+    virtual ~CUPnPResourceHelper();
+    
+private:
+
+    /**
+     * Private constructor
+     */
+    CUPnPResourceHelper();
+    
+    /**
+     * 2nd phase construct
+     */
+    void ConstructL();
+    
+public: // New functions
+
+    /**
+     * Sets resource (uri). Ownership is transferred
+     *
+     * @param aResource pointer to a resource
+     */
+    void SetResource( HBufC* aResource );
+    
+    /**
+     * returns resource (uri).
+     *
+     * @return pointer to a resource
+     */
+    HBufC* Resource();
+    
+    /**
+     * Sets item id. Ownership is transferred
+     *
+     * @param aItemId pointer to an item id
+     */
+    void SetItemId( HBufC8* aItemId );
+    
+    /**
+     * returns item id
+     *
+     * @return pointer to an item id
+     */
+    HBufC8* ItemId();
+    
+    /**
+     * Sets item. Ownership is transferred
+     *
+     * @param aItem pointer to an item
+     */
+    void SetItem( CUpnpItem* aItem );
+    
+    /**
+     * returns item
+     *
+     * @return pointer to an item
+     */
+    CUpnpItem* Item();
+            
+private:
+    
+    /**
+     * Resource (uri)
+     *
+     * Own
+     */
+    HBufC*      iResource;
+
+    /**
+     * Item id
+     *
+     * Own
+     */
+    HBufC8*     iItemId;
+
+    /**
+     * Item
+     *
+     * Own
+     */
+    CUpnpItem*  iItem;
+        
+    /**
+     * key
+     */
+    TInt        iKey;
+    
+    };
+
+#endif // C_UPNPRESOURCEHELPER_H_
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpuploadsession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,801 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implementation for session towards a media server
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPUPLOADSESSION_H
+#define C_UPNPUPLOADSESSION_H
+
+// EXTERNAL INCLUDES
+#include <e32base.h>
+#include <upnpavcontrolpointobserver.h>
+
+// INTERNAL INCLUDES
+#include "httptransferobserver.h"
+#include "upnpfiletransfersessionbase.h"
+#include "tupnpfiletransferevent.h"
+
+// FORWARD DECLARATIONS
+class CHttpUploader;
+class CUpnpFileTransferItem;
+class CUPnPResourceHelper;
+class CUpnpDlnaProtocolInfo;
+class CUpnpObject;
+class CUpnpAttribute;
+
+// CLASS DECLARATION
+/**
+ * Implements AV Controller server side upload session
+ *
+ * @since S60 v3.2
+ */
+class CUPnPUploadSession :  public CUPnPFileTransferSessionBase,
+                            public MHttpTransferObserver,
+                            public MUpnpAVControlPointObserver
+    {
+        
+public:
+
+    /**
+     * Static 1st phase constructor
+     *
+     * @param aServer AV Controller server handle
+     * @param aSessionId session id
+     * @param aUuid device Uuid
+     */
+    static CUPnPUploadSession* NewL( CUpnpAVControllerServer& aServer,
+        TInt aSessionId, const TDesC8& aUuid );
+    
+    /**
+     * Destructor
+     */
+    virtual ~CUPnPUploadSession();
+    
+private:
+
+    /**
+     * Private constructor
+     *
+     * @param aServer AV Controller server handle
+     * @param aSessionId session id
+     */
+    CUPnPUploadSession( CUpnpAVControllerServer& aServer,
+        TInt aSessionId );
+    
+    /**
+     * 2ns phase constructor
+     *
+     * @param aUuid device uuid
+     */
+    void ConstructL( const TDesC8& aUuid );
+
+private: // From MHttpTransferObserver
+    
+    /**
+     * See httptransferobserver.h
+     */
+    void TransferProgress( TAny* aKey, TInt aBytes, TInt aTotalBytes );
+
+    /**
+     * See httptransferobserver.h
+     */
+    void ReadyForTransferL( TAny* aKey );
+
+    /**
+     * See httptransferobserver.h
+     */
+    void TransferCompleted( TAny* aKey, TInt aStatus );
+
+private: // From MUpnpAVControlPointObserver
+
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void RcSetVolumeResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/, 
+        const TDesC8& /*aInstance*/, 
+        const TDesC8& /*aChannel*/, 
+        const TDesC8& /*aDesiredVolume*/ ) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void RcVolumeResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/, 
+        const TDesC8& /*aInstance*/, 
+        const TDesC8& /*aChannel*/, 
+        const TDesC8& /*aCurrentVolume*/) {}
+         
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void RcSetMuteResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/, 
+        const TDesC8& /*aInstance*/, 
+        const TDesC8& /*aChannel*/, 
+        const TDesC8& /*aDesiredMute*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void RcMuteResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/, 
+        const TDesC8& /*aInstance*/, 
+        const TDesC8& /*aChannel*/, 
+        const TDesC8& /*aCurrentMute*/) {} 
+
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtSetTransportUriResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aCurrentUri*/,
+        const TDesC8& /*aCurrentUriMetaData*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    virtual void AvtSetNextTransportUriResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aNextUri*/,
+        const TDesC8& /*aNextUriMetaData*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtMediaInfoResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aNrTracks*/,
+        const TDesC8& /*aMediaDuration*/,
+        const TDesC8& /*aCurrentUri*/,
+        const TDesC8& /*aCurrentUriMetaData*/,
+        const TDesC8& /*aNextUri*/,
+        const TDesC8& /*aNextUriMetaData*/,
+        const TDesC8& /*aPlayMedium*/,
+        const TDesC8& /*aRecordMedium*/,
+        const TDesC8& /*aWriteStatus*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtGetTransportInfoResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aCurrenTransportState*/,
+        const TDesC8& /*aCurrentTransportStatus*/,
+        const TDesC8& /*aCurrentSpeed*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtPositionInfoResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aTrack*/,
+        const TDesC8& /*aTrackDuration*/,
+        const TDesC8& /*aTrackMetaData*/,
+        const TDesC8& /*aTrackURI*/,
+        const TDesC8& /*aRelTime*/,
+        const TDesC8& /*aAbsTime*/,
+        const TDesC8& /*aRelCount*/,
+        const TDesC8& /*aAbsCount*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtDeviceCapabilitiesResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aPlayMedia*/,
+        const TDesC8& /*aRecMedia*/,
+        const TDesC8& /*aRecQualityMode*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtTransportSettingsResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aPlayMode*/,
+        const TDesC8& /*aRecQualityMode*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtStopResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtPlayResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aSpeed*/) {}
+    
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtPauseResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtRecordResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtSeekResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aUnit*/,
+        const TDesC8& /*aTarget*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtNextResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtPreviousResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/) {}
+    
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtSetPlayModeResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aNewPlayMode*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtSetRecordModeResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aInstanceId*/,
+        const TDesC8& /*aNewRecordQuality*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsSearchCapabilitiesResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aSearchCaps*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsSortCapabilitiesResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aSortCaps*/) {}
+
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsSystemUpdateIdResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        TInt /*aSystemUpdateId*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsBrowseResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aObjectID*/,
+        const TDesC8& /*aBrowseFlag*/,
+        const TDesC8& /*aFilter*/,
+        TInt /*aIndex*/,
+        TInt /*aRequest*/,
+        const TDesC8& /*aSortCriteria*/,
+        const TDesC8& /*aResult*/,
+        TInt /*aReturned*/,
+        TInt /*aMatches*/,
+        const TDesC8& /*aUpdateID*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsSearchResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aContainerId*/,
+        const TDesC8& /*aSearchCriteria*/,
+        const TDesC8& /*aFilter*/,
+        TInt /*aIndex*/,
+        TInt /*aRequest*/,
+        const TDesC8& /*aSortCriteria*/,
+        const TDesC8& /*aResult*/,
+        TInt /*aReturned*/,
+        TInt /*aMatches*/,
+        const TDesC8& /*aUpdateID*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsDestroyObjectResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aObjectId*/ ) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsUpdateObjectResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aObjectId*/,
+        const TDesC8& /*aCurrentTagValue*/,
+        const TDesC8& /*aNewTagValue*/ ) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsImportResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aSourceURI*/,
+        const TDesC8& /*aDestinationURI*/,
+        const TDesC8& /*aTransferId*/ ) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsExportResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aSourceURI*/,
+        const TDesC8& /*aDestinationURI*/,
+        const TDesC8& /*aTransferId*/ ) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsStopTransferResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aTransferId*/ ) {}
+    
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    virtual void CdsCTransferProgressResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aTransferId*/,
+        const TDesC8& /*aTransferStatus*/,
+        const TDesC8& /*aTransferLength*/,            
+        const TDesC8& /*aTransferTotal*/ ) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsDeleteResourceResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aResourceUri*/ ) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsCreateReferenceResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aContainerId*/, 
+        const TDesC8& /*aObjectId*/, 
+        const TDesC8& /*aNewId*/ ) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsCreateObjectResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aContainerID, 
+        const TDesC8& aElements, 
+        const TDesC8& aObjectID, 
+        const TDesC8& aResult );
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CmProtocolInfoResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aSource*/, 
+        const TDesC8& /*aSink*/ ) {}
+    
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CmPrepareResponse(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aRemoteProtocolInfo*/,
+        const TDesC8& /*aPeerConnectionManager*/,
+        const TDesC8& /*aPeerConnectionId*/,
+        const TDesC8& /*aDirection*/,
+        TInt /*aConnection*/,
+        TInt /*aTransport*/,
+        TInt /*aRsc*/ ) {}
+    
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CmComplete(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        TInt /*aConnection*/ ) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CmCurrentConnections(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        const TDesC8& /*aConnections*/) {}
+        
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CmCurrentInfo(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSessionId*/,
+        TInt /*aErr*/,
+        TInt /*rscId*/, 
+        TInt /*transportId*/, 
+        const TDesC8& /*aProtocolInfo*/,
+        const TDesC8& /*aPeerConnectionManager*/, 
+        TInt /*peerId*/, 
+        const TDesC8& /*aDirection*/, 
+        const TDesC8& /*aStatus*/ ) {}
+
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsUpdateEvent(
+            const TDesC8& /*aUuid*/,
+            TInt /*aSystemUpdateId*/
+            ) {}
+            
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsContainerEvent(
+            const TDesC8& /*aUuid*/,
+            const TDesC8& /*aConteinerIds*/
+            ) {}
+            
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CdsTransferEvent(
+            const TDesC8& /*aUuid*/,
+            const TDesC8& /*aTransferIds*/
+            ) {}
+            
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void RcLastChangeEvent(
+            const TDesC8& /*aUuid*/,
+            const TDesC8& /*aLastChange*/
+            ) {}
+            
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void AvtLastChangeEvent(
+            const TDesC8& /*aUuid*/,
+            const TDesC8& /*aLastChange*/
+            ) {}
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CmSourceEvent(
+            const TDesC8& /*aUuid*/,
+            const TDesC8& /*aSource*/
+            ) {}
+            
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CmSinkEvent(
+            const TDesC8& /*aUuid*/,
+            const TDesC8& /*aSink*/
+            ) {}
+            
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void CmConnectionsEvent(
+            const TDesC8& /*aUuid*/,
+            const TDesC8& /*aConnections*/
+            ) {}
+
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void HttpResponseL( CUpnpHttpMessage* /*aMessage*/ ) {}
+
+public:
+
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void DeviceDiscoveredL( CUpnpDevice* /*aDevice*/ ) {} 
+
+    /**
+     * See upnpavcontrolpointobserver.h
+     */
+    void DeviceDisappearedL( CUpnpDevice* /*aDevice*/ ) {}
+     
+public: // New functions
+
+    /**
+     * Starts upload
+     *
+     * @param aMessage message
+     */
+    void StartUploadL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels upload
+     *
+     * @param aMessage message
+     */
+    void CancelUploadL( const RMessage2& aMessage );
+
+    /**
+     * Cancels uploads
+     *
+     * @param aMessage message
+     */
+    void CancelAllUploadsL( const RMessage2& aMessage );
+    
+    /**
+     * Start tracking progress
+     *
+     * @param aMessage message
+     */
+    void StartTrackingUploadProgressL( const RMessage2& aMessage );
+
+    /**
+     * Stop tracking progress
+     *
+     * @param aMessage message
+     */
+    void StopTrackingUploadProgressL( const RMessage2& aMessage );
+
+    /**
+     * Saves a message to receive events
+     *
+     * @param aMessage message
+     */
+    void GetUploadEventL( const RMessage2& aMessage );
+    
+    /**
+     * Cancels events
+     *
+     * @param aMessage message
+     */
+    void CancelGetUploadEventL( const RMessage2& aMessage );
+
+    /**
+     * Handles UPnP device disappears.
+     *
+     * @param aDevice Device that disappeared.
+     */
+    void DeviceDisappearedL( CUpnpAVDeviceExtended& aDevice );
+
+private:
+
+    /**
+     * Set mandatory transfer headers
+     *
+     * @param aInfo protocolInfo
+     * @param aKey transfer id
+     */
+    void SetHeadersL( const TDesC8& aInfo, TAny* aKey );
+    
+    /**
+     * Prepares for upload
+     *
+     * @param aEvent transfer event
+     */
+    void ReadyForTransferL( TUpnpFileTransferEvent& aEvent );
+  
+    /**
+     * Parsers CreateObject-response
+     *
+     * @param aResponse CreateObject-response
+     * @return importUri
+     */
+    HBufC8* ParseCreateObjectResponseL( const TDesC8& aResponse );
+    
+    
+    /**
+     * Handles CreateObject-response
+     *
+     * @param aResponse aObjectID object id
+     * @param aResult CreateObject-response
+     */
+    void HandleObjectResponseL( const TDesC8& aObjectID,
+        const TDesC8& aResult );
+        
+    /**
+     * Finds and return importUri from an item
+     *
+     * @param aObject UPnP item
+     * @return importUri
+     */
+    HBufC8* ImportURIFromItemL( const CUpnpObject& aObject );
+    
+    /**
+     * Converts DLNA compliant protocolInfo to UPnP protocolInfo
+     *
+     * @param aInfo DLNA protolInfo
+     */
+    void ProtocolInfoToUPnPL( const CUpnpAttribute* aInfo );    
+    
+    /**
+     * Issues active scheduler's wait stop request(with/without callback)
+     *
+     * @param none
+     * @return none
+     */
+    void StopWait();
+
+    /**
+     * Callback for active scheduler's wait stop request
+     *
+     */
+    static TInt SchedulerStoppedCallBack( TAny* aPtr );
+    
+    /**
+     * Does necessary action on active scheduler's wait stop complete
+     *
+     * @param none
+     * @return none
+     */
+    void DoSchedulerStoppedCallBack();
+    
+private:
+
+    /**
+     * Http Uploader, used to upload files
+     *
+     * Owned
+     */
+    CHttpUploader*                          iUploader;
+    
+    /**
+     * Used to synchronize CreateObject-action 
+     */
+    CActiveSchedulerWait                    iWait;
+            
+    /**
+     * Resource helper array
+     *
+     * Owned
+     */
+    RPointerArray<CUPnPResourceHelper>      iResources;
+        
+    /**
+     * Resource index
+     */
+    TInt                                    iResourceIndex;
+    
+    /**
+     * Stores error (status) code from CreateObject-action
+     */
+    TInt                                    iAsyncError;
+    
+    /**
+     * Session id for CreateObject-action
+     */
+    TInt                                    iIPSessionId;
+    
+    /**
+     * Scheduler stop request
+     */
+    TBool                                   iSchedulerStopped;
+    };
+
+#endif // C_UPNPUPLOADSESSION_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpavactioninfo.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      UpnpAvAction info
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include "upnpavactioninfo.h"
+
+// CONSTANTS
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::CUPnPAVActionInfo
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPAVActionInfo::CUPnPAVActionInfo()
+    {    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+void CUPnPAVActionInfo::ConstructL()
+    {                           
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUPnPAVActionInfo* CUPnPAVActionInfo::NewL()
+    {
+    CUPnPAVActionInfo* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUPnPAVActionInfo* CUPnPAVActionInfo::NewLC()
+    {
+    CUPnPAVActionInfo* self = new( ELeave )
+        CUPnPAVActionInfo;   
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+    
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+CUPnPAVActionInfo::~CUPnPAVActionInfo()
+    {
+    delete iUuid;            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::SetSessionId
+// See upnpavcationinfo.h
+// --------------------------------------------------------------------------
+void CUPnPAVActionInfo::SetSessionId( TInt aSessionId )
+    {
+    iSessionId = aSessionId;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::SessionId
+// See upnpavcationinfo.h
+// --------------------------------------------------------------------------
+TInt CUPnPAVActionInfo::SessionId() const
+    {
+    return iSessionId;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::SetObserver
+// See upnpavcationinfo.h
+// --------------------------------------------------------------------------
+void CUPnPAVActionInfo::SetObserver( MUpnpAVControlPointObserver& aObserver )
+    {
+    iObserver = &aObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::Observer
+// See upnpavcationinfo.h
+// --------------------------------------------------------------------------
+MUpnpAVControlPointObserver& CUPnPAVActionInfo::Observer() const
+    {
+    
+    __ASSERTD( iObserver, __FILE__, __LINE__ );
+    return *iObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::SetUuidL
+// See upnpavcationinfo.h
+// --------------------------------------------------------------------------
+void CUPnPAVActionInfo::SetUuidL( const TDesC8& aUuid )
+    {
+    HBufC8* tempBuf = aUuid.AllocL();
+    delete iUuid;
+    iUuid = tempBuf;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVActionInfo::Uuid
+// See upnpavcationinfo.h
+// --------------------------------------------------------------------------
+const TDesC8& CUPnPAVActionInfo::Uuid() const
+    {
+    if( iUuid )
+        {
+        return *iUuid;
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+    
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpavcontrollerimpl.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,2144 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AVController server side root class
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// upnp stack api
+#include <upnpdevice.h>
+#include <upnpcontainer.h>
+#include <upnpservice.h>
+#include <upnpstatevariable.h>
+#include <upnpaction.h>
+#include <upnpobjectlist.h>
+#include <upnpavcontrolpoint.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdeviceobserver.h"
+#include "upnpavdevicelist.h"
+
+// avcontroller internal
+#include "upnpavcontrollerimpl.h"
+#include "upnpavcontrollerserver.h"
+#include "upnpavdispatcher.h"
+#include "upnpavdeviceextended.h"
+#include "upnpdevicerepository.h"
+#include "upnpaverrorhandler.h"
+#include "upnpplaybacksession.h"
+#include "upnpbrowsingsession.h"
+#include "upnpdevicediscoverymessage.h"
+
+#include "upnpuploadsession.h"
+#include "upnpdownloadsession.h"
+
+
+
+#include "upnpsecaccesscontroller.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::NewL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+CUPnPAVControllerImpl* CUPnPAVControllerImpl::NewL(
+    RUpnpMediaServerClient& aClient,
+    CUpnpAVControllerServer& aServer )
+    {
+    CUPnPAVControllerImpl* self = new (ELeave) CUPnPAVControllerImpl( 
+        aClient, aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CUPnPAVControllerImpl
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+CUPnPAVControllerImpl::CUPnPAVControllerImpl(
+    RUpnpMediaServerClient& aClient,
+    CUpnpAVControllerServer& aServer ) :
+    iMediaServer( aClient ),
+    iServer( aServer ),
+    iDeviceDiscoveryEnabled( EFalse),
+    iDeviceMsgQue( CUpnpDeviceDiscoveryMessage::LinkOffset() ),
+    iDeviceMsgQueIter( iDeviceMsgQue )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::~CUPnPAVControllerImpl
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+CUPnPAVControllerImpl::~CUPnPAVControllerImpl()
+    {
+    __LOG( "CUPnPAVControllerImpl::~CUPnPAVControllerImpl" );
+    
+    delete iDeviceRespBuf;
+    delete iDeviceListRespBuf;
+    
+    iPlaybackSessions.ResetAndDestroy();
+    iBrowsingSessions.ResetAndDestroy();
+    
+    iUploadSessions.ResetAndDestroy();
+    iDownloadSessions.ResetAndDestroy();
+    
+    CUpnpDeviceDiscoveryMessage* devMsg = NULL;
+    iDeviceMsgQueIter.SetToFirst(); 
+    while ( ( devMsg = iDeviceMsgQueIter++ ) != NULL )
+        {
+        iDeviceMsgQue.Remove( *devMsg );
+        delete devMsg;
+        };    
+
+    delete iConnectionMsg; iConnectionMsg = NULL;
+    delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL;        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::ConstructL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::ConstructL()
+    {
+    __LOG( "CUPnPAVControllerImpl::ConstructL" );    
+       
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::ConnectionLost
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::ConnectionLost()
+    {
+    if( iConnectionMsg )
+        {
+        iConnectionMsg->Complete( EAVControllerConnectionLost );
+        delete iConnectionMsg; iConnectionMsg = NULL;
+        
+        }
+    else
+        {
+        // No msg, no can do
+        }    
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DeviceDiscoveredL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DeviceDiscoveredL(
+    CUpnpAVDeviceExtended& aDevice )
+    {
+    __LOG( "CUPnPAVControllerImpl::DeviceDiscoveredL" );
+
+    if( aDevice.DeviceType() == CUpnpAVDevice::EMediaServer &&
+        ( aDevice.Local() ) )
+        {
+        TInt i;
+        TInt count = iPlaybackSessions.Count();
+        for( i = 0; i < count; i++ )
+            {
+            iPlaybackSessions[ i ]->SetLocalMSUuidL( aDevice.Uuid() );
+            }
+        
+        count = iBrowsingSessions.Count();
+        for( i = 0; i < count; i++ )
+            {
+            iBrowsingSessions[ i ]->SetLocalMSUuidL( aDevice.Uuid() );
+            }
+
+        }
+    else if( iDeviceDiscoveryEnabled )
+        {
+        CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL( aDevice ); 
+                             
+        if( iDeviceDiscoveryMsg )
+            {
+            CleanupStack::PushL( tempDev );
+            
+            delete iDeviceRespBuf; iDeviceRespBuf = NULL;
+            iDeviceRespBuf = tempDev->ToDes8L();
+            
+            CleanupStack::PopAndDestroy( tempDev );
+            
+            // Write back to the client that a device was discovered
+            // of the device and the size
+            TPckg<TAVControllerDeviceDiscovery> resp0( EAVDeviceDiscovered );
+            TPckg<TInt> resp1( iDeviceRespBuf->Length() );
+            
+            iDeviceDiscoveryMsg->WriteL( 0, resp0 );
+            iDeviceDiscoveryMsg->WriteL( 1, resp1 );
+            
+            iDeviceDiscoveryMsg->Complete( EAVControllerDeviceCompleted );
+            delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL;
+            }
+        else
+            {
+            // Msg not valid, client is still processing.. 
+            //add the discovered device to queue
+            CUpnpDeviceDiscoveryMessage* tmpDevMsg = 
+                    CUpnpDeviceDiscoveryMessage::NewL( 
+                    tempDev, EAVDeviceDiscovered );
+            iDeviceMsgQue.AddLast( *tmpDevMsg );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DeviceDisappearedL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DeviceDisappearedL(
+    CUpnpAVDeviceExtended& aDevice )
+    {
+    __LOG( "CUPnPAVControllerImpl::DeviceDisappearedL" );
+  
+    // Go through browsing and rendering sessions and report if their
+    // device or the local MS disappeared
+    TBool localMs = EFalse;
+    if( aDevice.DeviceType() == CUpnpAVDevice::EMediaServer &&
+        ( aDevice.Local() ) )
+        {
+        __LOG( "CUPnPAVControllerImpl::DeviceDisappearedL\
+        - Local MS disappeared!" );
+        
+         // Local MS disappeared
+         localMs = ETrue;
+        }
+        
+    TInt i;
+    TInt count = iPlaybackSessions.Count();
+    for( i = 0; i < count; i++ )
+        {
+        if( ( iPlaybackSessions[ i ]->Uuid() == aDevice.Uuid() ) ||
+            ( localMs ) )
+            {
+            iPlaybackSessions[ i ]->DeviceDisappearedL( aDevice );
+            }     
+        }
+    
+    count = iBrowsingSessions.Count();
+    for( i = 0; i < count; i++ )
+        {
+        if( ( iBrowsingSessions[ i ]->Uuid() == aDevice.Uuid() ) ||
+            ( localMs ) )
+            {
+            iBrowsingSessions[ i ]->DeviceDisappearedL( aDevice );
+            }     
+        }
+        
+    count = iUploadSessions.Count();
+    for( i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ]->Uuid() == aDevice.Uuid() )
+            {
+            iUploadSessions[ i ]->DeviceDisappearedL( aDevice );
+            }     
+        }
+
+    count = iDownloadSessions.Count();
+    for( i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->Uuid() == aDevice.Uuid() )
+            {
+            iDownloadSessions[ i ]->DeviceDisappearedL( aDevice );
+            }     
+        }
+
+    if( iDeviceDiscoveryEnabled )
+        {       
+        // Create a device (buffer)
+        CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL( aDevice );
+            
+         if( iDeviceDiscoveryMsg )
+            {
+            CleanupStack::PushL( tempDev );
+                   
+            delete iDeviceRespBuf; iDeviceRespBuf = NULL;
+            iDeviceRespBuf = tempDev->ToDes8L();
+            CleanupStack::PopAndDestroy( tempDev );
+            
+            // Write back to the client that a device was discovered
+            // and the size of the device
+            TPckg<TAVControllerDeviceDiscovery> resp0(
+                EAVDeviceDisappeared );
+            TPckg<TInt> resp1( iDeviceRespBuf->Length() );
+            
+            iDeviceDiscoveryMsg->WriteL( 0, resp0 );
+            iDeviceDiscoveryMsg->WriteL( 1, resp1 );
+            
+            iDeviceDiscoveryMsg->Complete( EAVControllerDeviceCompleted );
+            delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL;
+            }
+        else
+            {
+            // Msg not valid, client is still processing.. 
+            //add the disappeared device to queue
+
+            CUpnpDeviceDiscoveryMessage* tmpDevMsg = 
+                    CUpnpDeviceDiscoveryMessage::NewL( 
+                    tempDev, EAVDeviceDisappeared );
+            iDeviceMsgQue.AddLast( *tmpDevMsg );
+            }
+        }
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::EnableDeviceDiscoveryL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::EnableDeviceDiscoveryL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPAVControllerImpl::EnableDeviceDiscoveryL" );
+    
+    __ASSERTD( !iDeviceDiscoveryMsg, __FILE__, __LINE__ );
+    
+    if( !iDeviceDiscoveryEnabled )
+        {
+        //iDispatcher.RegisterForDeviceDiscoveryL( *this );
+        iDeviceDiscoveryEnabled = ETrue;    
+        }
+       
+    iDeviceDiscoveryMsg = new (ELeave) RMessage2( aMessage );
+
+    // Check queu's
+    if( !iDeviceMsgQue.IsEmpty() )
+        {
+        CUpnpDeviceDiscoveryMessage* devMsg = iDeviceMsgQue.First();
+        __ASSERTD( devMsg, __FILE__, __LINE__ );
+        CUpnpAVDevice* dev = devMsg->Device();
+        TAVControllerDeviceDiscovery devMsgType = devMsg->MsgType();
+        DequeDeviceL( *dev, devMsgType );
+        iDeviceMsgQue.Remove( *devMsg );
+        delete devMsg;
+        }
+    else
+        {
+        // Empty else
+        }             
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DequeDeviceL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DequeDeviceL( const CUpnpAVDevice& aDevice,
+    TAVControllerDeviceDiscovery aType )
+    {
+    __LOG( "CUPnPAVControllerImpl::DequeDeviceL" );
+    
+    TPckg<TAVControllerDeviceDiscovery> resp0( aType );
+    iDeviceDiscoveryMsg->WriteL( 0, resp0 );
+    
+    HBufC8* tmp = aDevice.ToDes8L();
+    CleanupStack::PushL( tmp );
+
+    TPckg<TInt> resp1( tmp->Length() );            
+    iDeviceDiscoveryMsg->WriteL( 1, resp1 );
+    
+    CleanupStack::Pop( tmp );
+     
+    delete iDeviceRespBuf; iDeviceRespBuf = NULL;
+    iDeviceRespBuf = tmp;
+            
+    iDeviceDiscoveryMsg->Complete( EAVControllerDeviceCompleted );
+    delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL;
+     
+
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetDeviceL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetDeviceL( const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::GetDeviceL, 0x%d", iDeviceRespBuf );
+    
+    aMessage.WriteL( 0, *iDeviceRespBuf );
+    aMessage.Complete( KErrNone );
+    delete iDeviceRespBuf; iDeviceRespBuf = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DisableDeviceDiscoveryL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DisableDeviceDiscoveryL(
+    /*const RMessage2& aMessage*/ )
+    {
+    __LOG( "CUPnPAVControllerImpl::DisableDeviceDiscoveryL" );
+    
+    if( iDeviceDiscoveryEnabled )
+        {
+        //iDispatcher.UnRegisterDeviceDiscovery( *this );
+        iDeviceDiscoveryEnabled = EFalse;    
+        }
+    
+    if( iDeviceDiscoveryMsg )
+        { 
+        iDeviceDiscoveryMsg->Complete( KErrCancel );
+        delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL;        
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetDeviceListSizeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetDeviceListSizeL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPAVControllerImpl::GetDeviceListSizeL" );
+    
+    // Get the device list from the av control point, create a response buffer
+    // and write the size of the list back to the client
+    TAVControllerDeviceListType deviceListType;
+    TPckg<TAVControllerDeviceListType> resp0( deviceListType );
+    aMessage.ReadL( 0, resp0 );
+    
+    delete iDeviceListRespBuf; iDeviceListRespBuf = NULL;
+    
+    const RPointerArray<CUpnpAVDeviceExtended>& devList =
+        iServer.DeviceRepository().DeviceList();
+    
+    if( deviceListType == EAVMediaServer )
+        {
+        CUpnpAVDeviceList* tempList = CUpnpAVDeviceList::NewLC();
+                
+        TInt count = devList.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            if( devList[ i ]->DeviceType() == CUpnpAVDevice::EMediaServer )
+                {
+                if( devList[ i ]->PInfoReceived() &&
+                    !devList[ i ]->Local() )
+                    {
+                    CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL(
+                        *devList[i] );
+                    // Ownership of tempDev transferred
+                    tempList->AppendDeviceL( *tempDev );
+                    }
+                }
+            }
+        iDeviceListRespBuf = tempList->ToDes8L();
+        CleanupStack::PopAndDestroy( tempList );
+        }
+    else
+        {
+        CUpnpAVDeviceList* tempList = CUpnpAVDeviceList::NewLC();
+                
+        TInt count = devList.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            if( devList[ i ]->DeviceType() == CUpnpAVDevice::EMediaRenderer )
+                {
+                if( devList[ i ]->PInfoReceived() )
+                    {
+                    CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL(
+                        *devList[i] );
+                    // Ownership of tempDev transferred
+                    tempList->AppendDeviceL( *tempDev );                    
+                    }
+                }
+            }
+        iDeviceListRespBuf = tempList->ToDes8L();
+        CleanupStack::PopAndDestroy( tempList ); 
+        }    
+    
+    // Write the size back to the client
+    TPckg<TInt> resp1( iDeviceListRespBuf->Length() );
+    aMessage.WriteL( 1, resp1 );
+    aMessage.Complete( KErrNone );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetDeviceListL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetDeviceListL( const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::GetDeviceListL, 0x%d",
+        iDeviceListRespBuf );
+    
+    // Write the device list back to the client
+    aMessage.WriteL( 0, *iDeviceListRespBuf );
+    aMessage.Complete( KErrNone );
+    delete iDeviceListRespBuf; iDeviceListRespBuf = NULL;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CreateRenderingSessionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CreateRenderingSessionL(
+    const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::CreateRenderingSessionL, 0x%d",
+        aMessage.Int0() );
+    
+    // Create a rendering session
+    TInt id = aMessage.Int0();
+    
+    // Read the device UID
+    TInt len = aMessage.GetDesMaxLength( 1 );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( 1, ptr ) );
+
+    CUPnPPlaybackSession* tempPtr = CUPnPPlaybackSession::NewL(
+        iMediaServer, iServer, id, *buf );
+
+    CleanupStack::PopAndDestroy( buf );
+    iPlaybackSessions.Append( tempPtr );
+    
+    aMessage.Complete( KErrNone );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DestroyRenderingSessionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DestroyRenderingSessionL(
+    const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::DestroyRenderingSessionL, 0x%d",
+        aMessage.Int0() );
+    
+    // Find and delete a rendering session
+    TInt id = aMessage.Int0();
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            delete iPlaybackSessions[ i ];
+            iPlaybackSessions.Remove( i );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( found )
+        {
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::EventRequestL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::EventRequestL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->EventRequestL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelEventRequestL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelEventRequestL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelEventRequestL();
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( found )
+        {
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::SetURIL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::SetURIL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->SetURIL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelSetURIL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelSetURIL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelSetURIL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }            
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::SetNextURIL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::SetNextURIL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->SetNextURIL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelSetNextURIL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelSetNextURIL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelSetNextURIL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::PlayL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::PlayL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->PlayL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+   
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelPlayL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelPlayL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelPlayL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::StopL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::StopL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->StopL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+   
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelStopL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelStopL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelStopL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                
+    }
+   
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::PauseL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::PauseL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->PauseL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelPauseL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelPauseL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelPauseL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::SetVolumeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::SetVolumeL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->SetVolumeL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelSetVolumeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelSetVolumeL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelSetVolumeL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                
+    }  
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetVolumeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetVolumeL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->GetVolumeL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelGetVolumeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelGetVolumeL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelGetVolumeL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::SetMuteL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::SetMuteL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->SetMuteL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelSetMuteL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelSetMuteL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelSetMuteL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                
+    }  
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetMuteL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetMuteL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->GetMuteL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelGetMuteL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelGetMuteL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelGetMuteL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetPositionInfoL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetPositionInfoL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->GetPositionInfoL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelGetPositionInfoL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelGetPositionInfoL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iPlaybackSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iPlaybackSessions[ i ]->SessionId() == id )
+            {
+            iPlaybackSessions[ i ]->CancelGetPositionInfoL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CreateBrowsingSessionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CreateBrowsingSessionL(
+    const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::CreateBrowsingSessionL, 0x%d",
+        aMessage.Int0() );
+    
+    // Create a rendering session
+    TInt id = aMessage.Int0();
+    
+    // Read the device UID
+    TInt len = aMessage.GetDesMaxLength( 1 );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( 1, ptr ) );
+    
+    CUPnPBrowsingSession* tempPtr = CUPnPBrowsingSession::NewL(
+        iMediaServer, iServer, id, *buf );
+
+    CleanupStack::PopAndDestroy( buf );
+    iBrowsingSessions.Append( tempPtr );
+    
+    aMessage.Complete( KErrNone );    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DestroyBrowsingSessionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DestroyBrowsingSessionL(
+    const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::DestroyBrowsingSessionL, 0x%d",
+        aMessage.Int0() );
+    
+    // Find and delete a rendering session
+    TInt id = aMessage.Int0();
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            delete iBrowsingSessions[ i ];
+            iBrowsingSessions.Remove( i );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( found )
+        {
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetBrowseResponseSizeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetBrowseResponseSizeL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->GetBrowseResponseSizeL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelGetBrowseResponseSizeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelGetBrowseResponseSizeL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->CancelGetBrowseResponseSizeL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetBrowseResponseL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetBrowseResponseL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->GetBrowseResponseL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetSearchResponseSizeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetSearchResponseSizeL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->GetSearchResponseSizeL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelGetSearchResponseSizeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelGetSearchResponseSizeL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->CancelGetSearchResponseSizeL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetSearchResponseL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetSearchResponseL(
+    const RMessage2& aMessage )
+    {
+     TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->GetSearchResponseL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }   
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetSearchCapabitiesSizeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetSearchCapabitiesSizeL(
+    const RMessage2& aMessage )
+    {
+     TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->GetSearchCapabitiesSizeL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }       
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelGetSearchCapabitiesSizeL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelGetSearchCapabitiesSizeL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->CancelGetSearchCapabitiesSizeL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::GetSearchCapabitiesL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::GetSearchCapabitiesL( const RMessage2& aMessage )
+    {
+     TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->GetSearchCapabitiesL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }           
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CreateContainerL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CreateContainerL( const RMessage2& aMessage )
+    {
+     TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->CreateContainerL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }               
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelCreateContainerL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelCreateContainerL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->CancelCreateContainerL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DeleteObjectL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DeleteObjectL( const RMessage2& aMessage )
+    {
+     TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->DeleteObjectL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                   
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelDeleteObjectL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelDeleteObjectL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->CancelDeleteObjectL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DeviceDisappearedRequestL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DeviceDisappearedRequestL(
+    const RMessage2& aMessage )
+    {
+     TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    TInt i;
+    for( i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->DeviceDisappearedRequestL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+        
+    if( !found )
+        {
+        count = iPlaybackSessions.Count();
+        for( i = 0; i < count; i++ )
+            {
+            if( iPlaybackSessions[ i ]->SessionId() == id )
+                {
+                iPlaybackSessions[ i ]->DeviceDisappearedRequestL(
+                    aMessage );
+                found = ETrue;
+                i = count;
+                }
+            }
+        }                       
+
+    if( !found )
+        {  
+        aMessage.Complete( KErrNotFound );
+        }                       
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelDeviceDisappearedRequestL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelDeviceDisappearedRequestL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iBrowsingSessions.Count();
+    TBool found = EFalse;
+    TInt i;
+    for( i = 0; i < count; i++ )
+        {
+        if( iBrowsingSessions[ i ]->SessionId() == id )
+            {
+            iBrowsingSessions[ i ]->CancelDeviceDisappearedRequestL();
+            found = ETrue;
+            i = count;
+            aMessage.Complete( KErrNone );
+            }
+        }
+    if( !found )
+        {
+        count = iPlaybackSessions.Count();
+        for( i = 0; i < count; i++ )
+            {
+            if( iPlaybackSessions[ i ]->SessionId() == id )
+                {
+                iPlaybackSessions[ i ]->CancelDeviceDisappearedRequestL();
+                found = ETrue;
+                i = count;
+                aMessage.Complete( KErrNone );
+                }
+            }        
+        }                    
+
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::MonitorConnectionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::MonitorConnectionL( const RMessage2& aMessage )
+    {
+    
+    if( iConnectionMsg )
+        {
+        User::Leave( KErrInUse );
+        }
+    else
+        {
+        iConnectionMsg = new (ELeave) RMessage2( aMessage );
+        }  
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CancelMonitorConnectionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CancelMonitorConnectionL(
+    const RMessage2& aMessage )
+    {
+    
+    if( iConnectionMsg )
+        {
+        iConnectionMsg->Complete( KErrCancel );
+        delete iConnectionMsg; iConnectionMsg = NULL;
+        }
+    aMessage.Complete( KErrNone );       
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::CreateDownloadSessionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CreateDownloadSessionL(
+    const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::CreateDownloadSessionL, 0x%d",
+        aMessage.Int0() );
+    
+    // Create a downloading session
+    TInt id = aMessage.Int0();
+    
+    // Read the device UID
+    TInt len = aMessage.GetDesMaxLength( 1 );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( 1, ptr ) );
+
+    CUPnPDownloadSession* tempPtr = CUPnPDownloadSession::NewL(
+        iServer, id, *buf );
+    CleanupStack::PopAndDestroy( buf );
+    iDownloadSessions.Append( tempPtr );
+    
+    aMessage.Complete( KErrNone );    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DestroyDownloadSessionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DestroyDownloadSessionL(
+    const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::DestroyDownloadSessionL, 0x%d",
+        aMessage.Int0() );
+    
+    // Find and delete a downloading session
+    TInt id = aMessage.Int0();
+    TInt count = iDownloadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->SessionId() == id )
+            {
+            delete iDownloadSessions[ i ];
+            iDownloadSessions.Remove( i );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( found )
+        {
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+
+void CUPnPAVControllerImpl::StartDownloadL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iDownloadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->SessionId() == id )
+            {
+            iDownloadSessions[ i ]->StartDownloadL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                       
+    }
+
+void CUPnPAVControllerImpl::StartDownloadFHL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iDownloadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->SessionId() == id )
+            {
+            iDownloadSessions[ i ]->StartDownloadFHL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                       
+    }
+    
+void CUPnPAVControllerImpl::CancelDownloadL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iDownloadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->SessionId() == id )
+            {
+            iDownloadSessions[ i ]->CancelDownloadL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                           
+    }
+
+void CUPnPAVControllerImpl::CancelAllDownloadsL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iDownloadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->SessionId() == id )
+            {
+            iDownloadSessions[ i ]->CancelAllDownloadsL( aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                           
+    }
+    
+void CUPnPAVControllerImpl::StartTrackingDownloadProgressL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iDownloadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->SessionId() == id )
+            {
+            iDownloadSessions[ i ]->StartTrackingDownloadProgressL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                           
+    }
+
+void CUPnPAVControllerImpl::StopTrackingDownloadProgressL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iDownloadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->SessionId() == id )
+            {
+            iDownloadSessions[ i ]->StopTrackingDownloadProgressL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                           
+    }
+
+void CUPnPAVControllerImpl::GetDownloadEventL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iDownloadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->SessionId() == id )
+            {
+            iDownloadSessions[ i ]->GetDownloadEventL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                               
+    }
+    
+void CUPnPAVControllerImpl::CancelGetDownloadEventL(
+    const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iDownloadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDownloadSessions[ i ]->SessionId() == id )
+            {
+            iDownloadSessions[ i ]->CancelGetDownloadEventL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DestroyUploadSessionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::CreateUploadSessionL(
+    const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::CreateUploadSessionL, 0x%d",
+        aMessage.Int0() );
+    
+    // Create a downloading session
+    TInt id = aMessage.Int0();
+    
+    // Read the device UID
+    TInt len = aMessage.GetDesMaxLength( 1 );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( 1, ptr ) );
+
+    CUPnPUploadSession* tempPtr = CUPnPUploadSession::NewL(
+        iServer, id, *buf );
+    CleanupStack::PopAndDestroy( buf );
+    iUploadSessions.Append( tempPtr );
+    
+    aMessage.Complete( KErrNone );        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVControllerImpl::DestroyUploadSessionL
+// See upnpavcontrollerimpl.h
+// --------------------------------------------------------------------------
+void CUPnPAVControllerImpl::DestroyUploadSessionL(
+    const RMessage2& aMessage )
+    {
+    __LOG1( "CUPnPAVControllerImpl::DestroyUploadSessionL, 0x%d",
+        aMessage.Int0() );
+    
+    // Find and delete an uploading session
+    TInt id = aMessage.Int0();
+    TInt count = iUploadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ]->SessionId() == id )
+            {
+            delete iUploadSessions[ i ];
+            iUploadSessions.Remove( i );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( found )
+        {
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+
+void CUPnPAVControllerImpl::StartUploadL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iUploadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ]->SessionId() == id )
+            {
+            iUploadSessions[ i ]->StartUploadL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    }
+    
+void CUPnPAVControllerImpl::CancelUploadL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iUploadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ]->SessionId() == id )
+            {
+            iUploadSessions[ i ]->CancelUploadL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }            
+    }
+
+void CUPnPAVControllerImpl::CancelAllUploadsL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iUploadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ]->SessionId() == id )
+            {
+            iUploadSessions[ i ]->CancelAllUploadsL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                
+    }
+    
+void CUPnPAVControllerImpl::StartTrackingUploadProgressL( const RMessage2&
+    aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iUploadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ]->SessionId() == id )
+            {
+            iUploadSessions[ i ]->StartTrackingUploadProgressL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                    
+    }
+
+void CUPnPAVControllerImpl::StopTrackingUploadProgressL( const RMessage2&
+    aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iUploadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ]->SessionId() == id )
+            {
+            iUploadSessions[ i ]->StopTrackingUploadProgressL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                        
+    }
+
+void CUPnPAVControllerImpl::GetUploadEventL( const RMessage2& aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iUploadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ]->SessionId() == id )
+            {
+            iUploadSessions[ i ]->GetUploadEventL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                            
+    }
+    
+void CUPnPAVControllerImpl::CancelGetUploadEventL( const RMessage2&
+    aMessage )
+    {
+    TInt id = aMessage.Int0();
+    
+    // Find the session
+    TInt count = iUploadSessions.Count();
+    TBool found = EFalse;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iUploadSessions[ i ]->SessionId() == id )
+            {
+            iUploadSessions[ i ]->CancelGetUploadEventL(
+                aMessage );
+            found = ETrue;
+            i = count;
+            }
+        }
+    if( !found )
+        {
+        aMessage.Complete( KErrNotFound );
+        }                                
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpavcontrollerserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1001 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AVController server
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <e32svr.h>
+#include <f32file.h> 
+
+// upnp stack
+#include <upnpdevice.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontrollerglobals.h"
+
+// upnpframework / internal api's
+#include "upnpconnectionmonitor.h"
+
+#include "upnpsecaccesscontroller.h"
+
+
+// avcontroller server internal
+#include "upnpavcontrollerserver.h"
+#include "upnpavcontrollersession.h"
+
+#include <upnpsettings.h>
+
+#include "upnpavcontrolpoint.h"
+
+
+#include "upnpavdispatcher.h"
+#include "upnpdevicerepository.h"
+#include "upnpavdeviceextended.h"
+#include "upnpaverrorhandler.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt" );
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT8( KMediaServer,                    "MediaServer" );
+_LIT8( KUPnPRootDevice,                 "upnp:rootdevice" );
+
+const TInt KMaxDepth = 4;
+const TInt KMaxDeviceCount = 6;
+
+const TUint myRangeCount = 3;
+
+const TInt myRanges[ myRangeCount ] = 
+    {
+    0, // numbers 0-18
+    18, // numbers 18-81 
+    81 // numbers 81-KMaxInt
+    };
+
+const TUint8 myElementsIndex[ myRangeCount ] = 
+    {
+    0, 
+    1, 
+    CPolicyServer::ENotSupported
+    };
+    
+const CPolicyServer::TPolicyElement myElements[] = 
+    {
+    {_INIT_SECURITY_POLICY_C3(ECapabilityNetworkServices,
+        ECapabilityReadUserData, ECapabilityWriteUserData ),
+        CPolicyServer::EFailClient },
+    {_INIT_SECURITY_POLICY_C1(ECapabilityNetworkServices),
+        CPolicyServer::EFailClient}
+    };
+    
+const CPolicyServer::TPolicy myPolicy =
+    {
+    CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass
+    myRangeCount,                   
+    myRanges,
+    myElementsIndex,
+    myElements,
+    };
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::CUpnpAVControllerServer
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+CUpnpAVControllerServer::CUpnpAVControllerServer( TInt aPriority ):
+    CPolicyServer( aPriority, myPolicy ),
+    iShutdownTimeoutValue( KTimerCycle10 ),
+    iServerState( EStateUndefined )
+    {    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::ConstructL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::ConstructL()
+    {
+    __LOG( "CUpnpAVControllerServer::ConstructL" );
+                               
+    iDispatcher = CUPnPAVDispatcher::NewL( *this );
+    
+    iServerState = EStateStartingUp;
+
+    CUpnpSettings* settings = CUpnpSettings::NewL( KCRUidUPnPStack );
+    settings->Get( CUpnpSettings::KUPnPStackIapId, iIAP );
+    delete settings;    
+
+    User::LeaveIfError( iMediaServer.Connect() );
+    iMonitor = CUPnPConnectionMonitor::NewL( *this, iIAP );
+    
+    StartL( KAVControllerName );   
+    
+    iServerTimer = CUPnPAVTimer::NewL( *this,
+        CUPnPAVTimer::ETimerServerShutdown );
+    
+    iServerTimer->Start( iShutdownTimeoutValue );
+    
+    iMSTimer = CUPnPAVTimer::NewL( *this, CUPnPAVTimer::ETimerMediaServer );
+    __LOG( "CUpnpAVControllerServer::ConstructL - Finished" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::StartUpL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::StartUpL()
+    {
+    __LOG( "CUpnpAVControllerServer::StartUpL" );
+
+    TInt error = KErrNone;
+    if( iServerState == EStateStartingUp )
+        {
+        __LOG( "StartUpL - Starting up" );
+              
+        
+        if( !iAVControlPoint )
+            {
+            __LOG( "CUpnpAVControllerServer::StartUpL - CP" );
+
+            TRAP( error, iAVControlPoint = CUpnpAVControlPoint::NewL( 
+                                                               *iDispatcher ));
+            // If operation fails for some reason , the 10 second timeout 
+            // is completely useless and wrong in this case. 
+            // The server should be shut down immediately   
+            if( error != KErrNone )
+                {
+                iShutdownTimeoutValue = 0;   
+                User::Leave( error );
+                }
+            }
+        if( !iDeviceRepository )
+            {
+            iDeviceRepository = CUPnPDeviceRepository::NewL( *iAVControlPoint );
+            }
+        iServerState = EStateRunning;  
+        }
+    else if( iServerState == EStateShuttingDown )
+        {
+        __LOG( "StartUpL - Wlan disconnected or shutting down, leave" );
+        User::Leave( KErrDisconnected );
+        }
+    else
+        {
+        __LOG( "StartUpL - Server running" );
+        }        
+
+    __LOG( "StartUpL - Completed" );    
+    }
+
+void CUpnpAVControllerServer::CancelStartUp()
+    {
+    __LOG( "CUpnpAVControllerServer::CancelStartUp" );
+    
+    // Cancel can occur only when the av controller instance is deleted
+    // right after the asyncronous part of the construction has been
+    // started. There is no proper way to cancel, but we can set the
+    // shutdown timer to 0, so the server will shutdown immidiately.
+    
+    if( iSessionCount <= 1 )
+        {
+        iShutdownTimeoutValue = 0;    
+        }  
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::NewLC
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+CUpnpAVControllerServer* CUpnpAVControllerServer::NewLC()
+    {
+    CUpnpAVControllerServer* self = new( ELeave )
+        CUpnpAVControllerServer( EPriorityNormal );   
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::~CUpnpAVControllerServer
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+CUpnpAVControllerServer::~CUpnpAVControllerServer()
+    {
+    __LOG( "CUpnpAVControllerServer::~CUpnpAVControllerServer" );
+    
+    delete iAVControlPoint;
+    delete iDispatcher;
+    delete iDeviceRepository;
+   
+    delete iMonitor;
+    delete iServerTimer;
+    delete iMSTimer;
+
+    iMediaServer.Close();
+
+    for( TInt i = 0; i < iStartMessages.Count(); i++ )
+        {
+        iStartMessages[ i ]->Complete( KErrCancel );
+        }
+    iStartMessages.ResetAndDestroy();  
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::NewSessionL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+CSession2* CUpnpAVControllerServer::NewSessionL( const TVersion& aVersion,
+    const RMessage2& aMessage ) const
+    {
+    __LOG( "CUpnpAVControllerServer::NewSessionL" );
+    
+    if( iServerState == EStateShuttingDown )
+        {
+        __LOG( "NewSessionL - server shutting down, no new sessions \
+are allowed at this point" );
+        User::Leave( KErrDisconnected );
+        }
+    else if( iServerState == EStateStartingUp && iSessionCount > 0 )
+        {
+        __LOG( "NewSessionL - server starting up, no new sessions \
+are allowed at this point" );
+        User::Leave( KErrServerBusy );
+        }
+        
+    // Check we're the right version
+    if ( !User::QueryVersionSupported( TVersion( 
+            KAVControllerMajorVersionNumber,
+            KAVControllerMinorVersionNumber,
+            KAVControllerBuildVersionNumber ),
+            aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Make new session
+    RThread client;
+    aMessage.Client(client);  
+    return CUpnpAVControllerSession::NewL(
+        *(CUpnpAVControllerServer*)this );
+    }
+    
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::UPnPAVTimerCallback
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::UPnPAVTimerCallback(
+    CUPnPAVTimer::TAVTimerType aType ) 
+    {
+    __LOG( "CUpnpAVControllerServer::UPnPAVTimerCallback" );
+
+
+    if( aType == CUPnPAVTimer::ETimerServerShutdown )
+        {
+        iServerState = EStateShuttingDown;
+           
+        if( iMSTimer->IsActive() )
+            {
+            // if the Media Server timer is still running for some reason
+            iMSTimer->Cancel();
+            StopMediaServer();
+            }
+        CActiveScheduler::Stop();
+        }
+    else if( aType == CUPnPAVTimer::ETimerMediaServer )
+        {
+        if( iStartingMS )
+            {
+            StopMediaServer();
+            TInt count = iStartMessages.Count();
+            for( TInt i = 0; i < count; i++ )
+                {
+                iStartMessages[ i ]->Complete( KErrTimedOut );
+                }
+            iStartMessages.ResetAndDestroy();
+            
+            iStartingMS = EFalse;
+            }
+        else // Shutting down
+            {
+            StopMediaServer();
+            }            
+        }
+    else
+        {
+        
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::ConnectionLost
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::ConnectionLost()
+    {
+    __LOG( "CUpnpAVControllerServer::ConnectionLost" );
+    
+    iShutdownTimeoutValue = 0; // Set shutdown timer value to 0, we want to
+    // shut down the server immidiately after the last session has been
+    // closed
+    
+    if( iServerState == EStateRunning && iDeviceRepository )
+        {
+        __LOG( "ConnectionLost - Server running" );
+        iDeviceRepository->ConnectionLost();    
+
+        CSession2* s;
+        iSessionIter.SetToFirst(); 
+        while ( ( s = iSessionIter++ ) != NULL )
+            {
+            CUpnpAVControllerSession* sess =
+                static_cast<CUpnpAVControllerSession*>(s);
+            if( sess )
+                {
+                sess->ConnectionLost();    
+                }
+            };  
+        iServerState = EStateShuttingDown;
+        }
+    else if (iServerState == EStateStartingUp )
+        {
+        __LOG( "ConnectionLost - Server starting up" );
+        iServerState = EStateShuttingDown;
+        }    
+
+    // If don't have any clients connect to server and current WLAN connection
+    // is lost, we want to shut down the server immidiately.
+    if ( iSessionCount <= 0 )
+        {
+        if ( iServerTimer->IsActive() )
+            {
+            iServerTimer->Cancel();
+            }
+        iServerTimer->Start( iShutdownTimeoutValue );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::RunError
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+TInt CUpnpAVControllerServer::RunError( TInt aError )
+    {
+    __LOG( "CUpnpAVControllerServer::RunError" );
+       
+    if ( aError == KErrBadDescriptor )
+        {
+        PanicClient( Message(), EAVControllerServerBadDescriptor );
+        }
+    else
+        {
+        Message().Complete( aError );
+        }
+        
+    // The leave will result in an early return from CServer::RunL(),
+    // skipping the call to request another message. So do that now in order
+    // to keep the server running.
+    ReStart();
+    // Handled the error fully
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::PanicClient
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::PanicClient(const RMessage2& aMessage,
+    TAVControllerServerPanic aPanic)
+    {
+    __LOG( "CUpnpAVControllerServer::PanicClient" );
+       
+    aMessage.Panic( KAVControllerName, aPanic );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::PanicServer
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::PanicServer(TAVControllerServerPanic aPanic)
+    {
+    __LOG( "CUpnpAVControllerServer::PanicServer" );
+    
+    User::Panic( KAVControllerName, aPanic );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::ThreadFunctionL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::ThreadFunctionL()
+    {
+    __LOG( "CUpnpAVControllerServer::ThreadFunctionL" );
+    
+    // Construct active scheduler
+    CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( activeScheduler );
+    // Install active scheduler
+    // We don't need to check whether an active scheduler is already
+    // installed
+    // as this is a new thread, so there won't be one
+    CActiveScheduler::Install( activeScheduler );    
+    // Construct our server        
+    CUpnpAVControllerServer* server = CUpnpAVControllerServer::NewLC();
+    
+    RProcess::Rendezvous( KErrNone );                
+    // Start handling requests
+    CActiveScheduler::Start();      
+             
+    CleanupStack::PopAndDestroy( server );  
+    CleanupStack::PopAndDestroy( activeScheduler );
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::HandleEmbeddedDiscoveredDevicesL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::HandleEmbeddedDiscoveredDevicesL(
+    CUpnpDevice& aDevice, TInt aDepth )
+    {
+    __LOG( "CUpnpAVControllerServer::HandleEmbeddedDiscoveredDevicesL" );
+    
+    if( aDepth <= KMaxDepth && iDiscoveredDeviceCount <= KMaxDeviceCount )
+        {
+        RPointerArray<CUpnpDevice>& devList = aDevice.DeviceList();
+        TInt count = devList.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            iDeviceRepository->AddDeviceL( *devList[ i ] );
+            TInt sessionId = iAVControlPoint->CmProtocolInfoActionL(
+                devList[ i ]->Uuid() );
+            iDiscoveredDeviceCount++;    
+            
+            HandleEmbeddedDiscoveredDevicesL( *devList[ i ], ++aDepth );
+            }        
+        }
+    else
+        {
+        __LOG( "HandleEmbeddedDiscoveredDevicesL - max depth \
+or count reached" );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::HandleEmbeddedDisappearedDevicesL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::HandleEmbeddedDisappearedDevicesL(
+    CUpnpDevice& aDevice, TInt aDepth )
+    {
+    __LOG( "CUpnpAVControllerServer::HandleEmbeddedDisappearedDevicesL" );
+    
+    if( aDepth <= KMaxDepth && iDisappearedDeviceCount <= KMaxDeviceCount )
+        {
+        RPointerArray<CUpnpDevice>& devList = aDevice.DeviceList();
+        TInt count = devList.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            CUpnpAVDeviceExtended& ext = iDeviceRepository->FindDeviceL(
+                devList[ i ]->Uuid() );
+            
+            CSession2* s;
+            iSessionIter.SetToFirst(); 
+            while ( ( s = iSessionIter++ ) != NULL )
+                {
+                CUpnpAVControllerSession* sess =
+                    static_cast<CUpnpAVControllerSession*>(s);
+                if( sess )
+                    {
+                    sess->DeviceDisappearedL( ext );    
+                    }
+                };        
+
+            iDeviceRepository->Remove( ext.Uuid() );
+            
+            iDisappearedDeviceCount++;    
+            
+            HandleEmbeddedDisappearedDevicesL( *devList[ i ], ++aDepth );
+            }        
+        }
+    else
+        {
+        __LOG( "HandleEmbeddedDisappearedDevicesL - max depth \
+or count reached" );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::StopMediaServer
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::StopMediaServer()
+    {
+    __LOG( "CUpnpAVControllerServer::StopMediaServer" );
+    
+    if( iShutdownTimeoutValue )
+        {
+        __LOG( "StopMediaServer - normal shutdown" );
+        iMediaServer.Stop( RUpnpMediaServerClient::EStopNormal );
+        }
+    else
+        {
+        __LOG( "StopMediaServer - silent shutdown" );
+        iMediaServer.Stop( RUpnpMediaServerClient::EStopSilent );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::ThreadFunction
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+TInt CUpnpAVControllerServer::ThreadFunction()
+    {
+    __LOG( "CUpnpAVControllerServer::ThreadFunction" );
+    
+    __UHEAP_MARK;
+    
+    User::RenameThread(KAVControllerThreadName);
+    
+    CTrapCleanup* cleanupStack = CTrapCleanup::New();
+    if ( !(cleanupStack) )
+        {
+        PanicServer( EAVControllerServerCreateTrapCleanup );
+        }
+
+    TRAPD( err, ThreadFunctionL() );
+    if ( err != KErrNone )
+        {
+        __LOG1( "ThreadFunction, creation failed: %d", err );
+        //PanicServer( EAVControllerServerSrvCreateServer );
+        }
+
+    delete cleanupStack;
+    cleanupStack = NULL;
+       
+    __UHEAP_MARKEND;
+
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::IncrementSessions
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::IncrementSessions() 
+    {
+    __LOG( "CUpnpAVControllerServer::IncrementSessions" );
+    
+    iSessionCount++;
+    if( iServerTimer->IsActive() )
+        {
+        iServerTimer->Cancel();
+        __LOG( "IncrementSessions - make a search" );
+        if( iAVControlPoint )
+            {
+            TRAP_IGNORE( iAVControlPoint->SearchL( KUPnPRootDevice ) );
+            }
+        }   
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::DecrementSessions
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::DecrementSessions()
+    {
+    __LOG( "CUpnpAVControllerServer::DecrementSessions" );
+    
+    iSessionCount--;
+    if ( iSessionCount <= 0 )
+        {
+        if( iServerTimer->IsActive() )
+            {
+            iServerTimer->Cancel();
+            }
+        iServerTimer->Start( iShutdownTimeoutValue );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::DeviceDiscoveredL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::DeviceDiscoveredL( CUpnpDevice& aDevice )
+    {
+    __LOG( "CUpnpAVControllerServer::DeviceDiscoveredL" );
+
+    if( aDevice.Local() && aDevice.DeviceType().Find( KMediaServer )
+        != KErrNotFound )
+        {
+        // It's the local S60 MS
+        
+        if( iStartingMS )
+            {
+            iMSTimer->Cancel();
+            }   
+        CUpnpSecAccessController* accessController = 
+            CUpnpSecAccessController::NewL();
+            __LOG( "CUpnpAVControllerServer::DeviceDiscoveredL \
+adding the local media server IP to the list of authorized addresses." );
+
+        accessController->AddAllowedAddress( aDevice.Address() );
+        delete accessController; 
+        accessController = NULL;
+        }
+        
+    iDeviceRepository->AddDeviceL( aDevice );
+    TInt sessionId = iAVControlPoint->CmProtocolInfoActionL(
+        aDevice.Uuid() );
+    iDiscoveredDeviceCount = 1; // First (root) device
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::DeviceDisappearedL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::DeviceDisappearedL( CUpnpDevice& aDevice )
+    {
+    __LOG( "CUpnpAVControllerServer::DeviceDisappearedL" );
+    
+    if( aDevice.Local() && aDevice.DeviceType().Find( KMediaServer )
+        != KErrNotFound )
+        {  
+        // It's the local S60 MS
+        iMediaServerOnline = EFalse;
+        }
+    
+    // Get a corresponding device from the device repository
+    CUpnpAVDeviceExtended& tmp = iDeviceRepository->FindDeviceL(
+        aDevice.Uuid() ); 
+    
+    // Let the clients know about the disappeared device
+    CSession2* s;
+    iSessionIter.SetToFirst(); 
+    while ( ( s = iSessionIter++ ) != NULL )
+        {
+        CUpnpAVControllerSession* sess =
+            static_cast<CUpnpAVControllerSession*>(s);
+        if( sess )
+            {
+            sess->DeviceDisappearedL( tmp );    
+            }
+        };        
+            // Remove from the device repository
+    iDeviceRepository->Remove( aDevice.Uuid() );
+    iDisappearedDeviceCount = 1;
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::DeviceDisappearedL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::DeviceDisappearedL( const TDesC8& aUuid )
+    {
+    __LOG( "CUpnpAVControllerServer::DeviceDisappearedL uid" );
+    // Get a corresponding device from the device repository
+    CUpnpAVDeviceExtended& tmp = iDeviceRepository->FindDeviceL(
+        aUuid ); 
+    
+    // Let the clients know about the disappeared device
+    CSession2* s;
+    iSessionIter.SetToFirst(); 
+    while ( ( s = iSessionIter++ ) != NULL )
+        {
+        CUpnpAVControllerSession* sess =
+            static_cast<CUpnpAVControllerSession*>( s );
+        if ( sess )
+            {
+            sess->DeviceDisappearedL( tmp );    
+            }
+        }       
+    // Remove from the device repository
+    iDeviceRepository->Remove( aUuid );
+    iDisappearedDeviceCount = 1;
+    __LOG( "CUpnpAVControllerServer::DeviceDisappearedL uid End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::StartMediaServerL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::StartMediaServerL( const RMessage2& aMessage )
+    {
+    __LOG( "CUpnpAVControllerServer::StartMediaServerL" );
+
+    if( iMediaServerOnline )
+        {
+        // Started already, complete the msg
+        iMSTimer->Cancel();
+        aMessage.Complete( EAVControllerStartMediaServerCompleted );
+        iServerUserCount++;
+        }
+    else
+        {
+        // Start the media server and timer
+        if( iStartMessages.Count() > 0 )
+            {
+            RMessage2* message = new (ELeave) RMessage2( aMessage );
+            iStartMessages.AppendL( message );
+            }
+        else
+            {
+            // Check if the stack's security is enabled
+            TBool upnpSecurityEnabled = EFalse;
+            TRAPD( secCheckError, upnpSecurityEnabled = 
+                CUpnpSecAccessController::IsMediaServerSecurityEnabledL() );
+
+            // If the security is not enabled, enable it now
+            if( secCheckError == KErrNone &&
+                !upnpSecurityEnabled )
+                {
+                TRAP_IGNORE( 
+                    CUpnpSecAccessController::EnableMediaServerSecurityL() );
+                }
+
+            RMessage2* message = new(ELeave) RMessage2( aMessage );
+            iStartMessages.AppendL( message );
+            User::LeaveIfError( iMediaServer.Start() );
+            iMSTimer->Start( iShutdownTimeoutValue );
+            iStartingMS = ETrue;
+            }    
+        }            
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::CancelStartMediaServerL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::CancelStartMediaServerL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUpnpAVControllerServer::CancelStartMediaServerL" );
+
+    if( !iMSActivatedBeforeStart )
+        {
+        StopMediaServer();
+        }
+
+    TInt count = iStartMessages.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        iStartMessages[ i ]->Complete( KErrCancel );
+        }
+    iStartMessages.ResetAndDestroy();
+    iMSTimer->Cancel();
+    
+    aMessage.Complete( KErrNone );
+        
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::StopMediaServerL
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::StopMediaServerL( const RMessage2& aMessage )
+    {
+    __LOG( "CUpnpAVControllerServer::StopMediaServerL" );
+    
+    if( iMediaServerOnline )
+        {
+        iServerUserCount--;
+        if( iServerUserCount <= 0 )
+            {
+            if( !iMSActivatedBeforeStart )
+                {
+                iMSTimer->Start( iShutdownTimeoutValue );
+                }
+            iServerUserCount = 0;
+            }
+        }
+    aMessage.Complete( KErrNone );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::MSServicesInUse
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::MSServicesInUse( const RMessage2& aMessage )
+    {
+    if( iServerUserCount > 0 || iStartingMS
+         || iMSTimer->IsActive()
+        )        
+        {
+        TPckg<TBool> resp0( ETrue );
+        aMessage.Write( 0, resp0 );        
+        }
+    else
+        {
+        TPckg<TBool> resp0( EFalse );
+        aMessage.Write( 0, resp0 );                
+        }    
+    aMessage.Complete( KErrNone );    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::CmProtocolInfoResponse
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+void CUpnpAVControllerServer::CmProtocolInfoResponse( const TDesC8& aUuid,
+    TInt /*aSessionId*/, TInt aErr, const TDesC8& aSource,
+    const TDesC8& aSink )
+    {
+    __LOG1( "CUpnpAVControllerServer::CmProtocolInfoResponse, \
+aErr = %d", aErr );
+
+    aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+        EUPnPConnectionManagerError );    
+
+    if( aErr == KErrNone )
+        {
+        CUpnpAVDeviceExtended* dev = NULL;
+        TRAPD( err, dev = &iDeviceRepository->AddProtocolInfoL(
+            aUuid, aSource, aSink ) );
+        
+        if( err == KErrNone )    
+            {
+            // Device discovered and protocolinfo was retrieved successfully
+            CSession2* s;
+            iSessionIter.SetToFirst(); 
+            while ( ( s = iSessionIter++ ) != NULL )
+                {
+                CUpnpAVControllerSession* sess =
+                    static_cast<CUpnpAVControllerSession*>(s);
+                if( sess )
+                    {
+                    TRAP_IGNORE( sess->DeviceDiscoveredL( *dev ) );    
+                    }
+                };        
+            
+            if( dev->Local() )
+                {
+                iMediaServerOnline = ETrue;
+                
+                if( iStartingMS )
+                    {
+                    TInt count = iStartMessages.Count();
+                    for( TInt i = 0; i < count; i++ )
+                        {
+                        iStartMessages[ i ]->Complete(
+                            EAVControllerStartMediaServerCompleted );
+                        iServerUserCount++;    
+                        }
+                    iStartMessages.ResetAndDestroy();        
+                    
+                    iStartingMS = EFalse;                
+                    }
+                else
+                    {
+                    __LOG( "Sharing was enabled before AVC server start" );
+                    iMSActivatedBeforeStart = ETrue;
+                    }    
+                
+                }    
+            }
+        else
+            {
+            // Could not add protocolinfo, it's invalid or corrupted
+            // Device cannot be used
+            HandleFailedProtocolInfoResponse( aUuid );          
+            }
+        }
+    else
+        {
+        // A problem occured fetching protocolinfo
+        // Device cannot be used
+        HandleFailedProtocolInfoResponse( aUuid );
+        }        
+    }
+
+void CUpnpAVControllerServer::HandleFailedProtocolInfoResponse(
+    const TDesC8& aUuid )
+    {
+    __LOG( "CUpnpAVControllerServer::HandleFailedProtocolInfoResponse" );
+    
+    CUpnpAVDeviceExtended* dev = NULL;
+    TRAPD( err, dev = &iDeviceRepository->FindDeviceL( aUuid ) )
+    if( err == KErrNone )
+        {
+        if( iStartingMS && dev->Local() )
+            {
+            __LOG( "HandleFailedProtocolInfoResponse - local, stop and \
+complete messages" );
+            
+            StopMediaServer();
+            
+            TInt count = iStartMessages.Count();
+            for( TInt i = 0; i < count; i++ )
+                {
+                iStartMessages[ i ]->Complete( err );
+                iServerUserCount++;    
+                }
+            iStartMessages.ResetAndDestroy();        
+            
+            iStartingMS = EFalse;
+            }                           
+        }
+    else
+        {
+        // Not found, no can do
+        __LOG( "HandleFailedProtocolInfoResponse - not found" );
+        }    
+    iDeviceRepository->Remove( aUuid );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::ControlPoint
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+CUpnpAVControlPoint& CUpnpAVControllerServer::ControlPoint()
+    {
+    return *iAVControlPoint;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::MediaServer
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+RUpnpMediaServerClient& CUpnpAVControllerServer::MediaServer()
+    {
+    return iMediaServer;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::Dispatcher
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+CUPnPAVDispatcher& CUpnpAVControllerServer::Dispatcher()
+    {
+    return *iDispatcher;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerServer::DeviceRepository
+// See upnpavcontrollerserver.h
+// --------------------------------------------------------------------------
+CUPnPDeviceRepository& CUpnpAVControllerServer::DeviceRepository()
+    {
+    return *iDeviceRepository;
+    }
+
+TInt CUpnpAVControllerServer::IAP()
+    {
+    return iIAP;
+    }
+    
+// ============================= LOCAL FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// E32Main entry point.
+// Returns: KErrNone
+// --------------------------------------------------------------------------
+TInt E32Main()
+    {
+    return CUpnpAVControllerServer::ThreadFunction();
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpavcontrollersession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,445 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implementation of a server session
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpavcontrollersession.h"
+#include "upnpavcontrollerserver.pan"
+
+#include "upnpavcontrollerserver.h"
+#include "upnpavcontrollerimpl.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerSession::CUpnpAVControllerSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpAVControllerSession::CUpnpAVControllerSession(
+    CUpnpAVControllerServer& aServer):
+    CSession2(),
+    iAVControllerServer( aServer )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerSession::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUpnpAVControllerSession::ConstructL()
+    {
+    __LOG( "CUpnpAVControllerSession::ConstructL" );
+    
+    iAVControllerServer.IncrementSessions();
+    
+    iAVController = CUPnPAVControllerImpl::NewL
+        (
+        iAVControllerServer.MediaServer(),
+        iAVControllerServer
+        );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerSession::~CUpnpAVControllerSession
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpAVControllerSession::~CUpnpAVControllerSession()
+    {
+    iAVControllerServer.DecrementSessions();        
+    
+    delete iAVController;
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerSession::ServiceL
+// Handle client requests.
+// --------------------------------------------------------------------------
+//
+void CUpnpAVControllerSession::ServiceL( const RMessage2& aMessage )
+    {   
+         
+    switch ( aMessage.Function() )
+        {
+        case EAVControllerStartupRequest:
+            iAVControllerServer.StartUpL();
+            aMessage.Complete( KErrNone );
+            break;
+        
+        case EAVControllerCancelStartupRequest:
+            iAVControllerServer.CancelStartUp();
+            aMessage.Complete( KErrNone );
+            break;        
+        
+        case EAVControllerDeviceRequest:           
+            iAVController->EnableDeviceDiscoveryL( aMessage );
+            break;
+            
+        case EAVControllerGetDeviceRequest:
+            iAVController->GetDeviceL( aMessage );
+            break;                      
+
+        case EAVControllerCancelDeviceRequest:
+            iAVController->DisableDeviceDiscoveryL();
+            aMessage.Complete( KErrNone );
+            break;                      
+        
+        case EAVControllerGetDeviceListSizeRequest:
+            iAVController->GetDeviceListSizeL( aMessage );
+            break;
+
+        case EAVControllerGetDeviceListRequest:
+            iAVController->GetDeviceListL( aMessage );
+            break;
+
+        case EAVControllerCreateRenderingSession:
+            iAVController->CreateRenderingSessionL( aMessage );
+            break;
+
+        case EAVControllerDestroyRenderingSession:
+            iAVController->DestroyRenderingSessionL( aMessage );
+            break;
+            
+        case EAVControllerEventRequest:
+            iAVController->EventRequestL( aMessage );
+            break;
+            
+        case EAVControllerCancelEventRequest:
+            iAVController->CancelEventRequestL( aMessage );
+            break;
+
+        case EAVControllerSetURI:
+            iAVController->SetURIL( aMessage );
+            break;
+            
+        case EAVControllerCancelSetURI:
+            iAVController->CancelSetURIL( aMessage );
+            break;
+    
+        case EAVControllerSetNextURI:
+            iAVController->SetNextURIL( aMessage );
+            break;
+            
+        case EAVControllerCancelSetNextURI:
+            iAVController->CancelSetNextURIL( aMessage );
+            break;
+
+        case EAVControllerPlay:
+            iAVController->PlayL( aMessage );
+            break;
+    
+        case EAVControllerCancelPlay:
+            iAVController->CancelPlayL( aMessage );
+            break;
+            
+        case EAVControllerStop:
+            iAVController->StopL( aMessage );
+            break;
+    
+        case EAVControllerCancelStop:
+            iAVController->CancelStopL( aMessage );
+            break;
+            
+        case EAVControllerPause:
+            iAVController->PauseL( aMessage );
+            break;
+            
+        case EAVControllerCancelPause:
+            iAVController->CancelPauseL( aMessage );
+            break;
+    
+        case EAVControllerSetVolume:
+            iAVController->SetVolumeL( aMessage );
+            break;
+
+        case EAVControllerCancelSetVolume:
+            iAVController->CancelSetVolumeL( aMessage );
+            break;
+    
+        case EAVControllerGetVolume:
+            iAVController->GetVolumeL( aMessage );
+            break;
+    
+        case EAVControllerCancelGetVolume:
+            iAVController->CancelGetVolumeL( aMessage );
+            break;
+    
+        case EAVControllerSetMute:
+            iAVController->SetMuteL( aMessage );
+            break;
+
+        case EAVControllerCancelSetMute:
+            iAVController->CancelSetMuteL( aMessage );
+            break;
+    
+        case EAVControllerGetMute:
+            iAVController->GetMuteL( aMessage );
+            break;
+            
+        case EAVControllerCancelGetMute:
+            iAVController->CancelGetMuteL( aMessage );
+            break;
+            
+        case EAVControllerGetPositionInfo:
+            iAVController->GetPositionInfoL( aMessage );
+            break;
+            
+        case EAVControllerCancelGetPositionInfo:
+            iAVController->CancelGetPositionInfoL( aMessage );
+            break;
+            
+        case EAVControllerCreateBrowsingSession:
+            iAVController->CreateBrowsingSessionL( aMessage );
+            break;
+            
+        case EAVControllerDestroyBrowsingSession:
+            iAVController->DestroyBrowsingSessionL( aMessage );
+            break;
+
+        case EAVControllerGetBrowseResponseSize:
+            iAVController->GetBrowseResponseSizeL( aMessage );
+            break;
+        
+        case EAVControllerCancelGetBrowseResponseSize:
+            iAVController->CancelGetBrowseResponseSizeL( aMessage );
+            break;
+        
+        case EAVControllerGetBrowseResponse:
+            iAVController->GetBrowseResponseL( aMessage );
+            break;
+                    
+        case EAVControllerGetSearchResponseSize:
+            iAVController->GetSearchResponseSizeL( aMessage );
+            break;
+            
+        case EAVControllerCancelGetSearchResponseSize:
+            iAVController->CancelGetSearchResponseSizeL( aMessage );
+            break;
+        
+        case EAVControllerGetSearchResponse:
+            iAVController->GetSearchResponseL( aMessage );
+            break;
+                    
+        case EAVControllerGetSearchCapabilitiesSize:
+            iAVController->GetSearchCapabitiesSizeL( aMessage );
+            break;    
+                            
+        case EAVControllerCancelGetSearchCapabilitiesSize:
+            iAVController->CancelGetSearchCapabitiesSizeL( aMessage );
+            break;
+            
+        case EAVControllerGetSearchCapabilities:
+            iAVController->GetSearchCapabitiesL( aMessage );
+            break;
+
+        case EAVControllerCreateContainer:
+            iAVController->CreateContainerL( aMessage );
+            break;
+        
+        case EAVControllerCancelCreateContainer:
+            iAVController->CancelCreateContainerL( aMessage );
+            break;  
+
+        case EAVControllerDeleteObject:
+            iAVController->DeleteObjectL( aMessage );
+            break;
+            
+        case EAVControllerCancelDeleteObject:
+            iAVController->CancelDeleteObjectL( aMessage );
+            break;
+            
+        case EAVControllerDeviceDisappearedRequest:
+            iAVController->DeviceDisappearedRequestL( aMessage );
+            break;
+            
+        case EAVControllerCancelDeviceDisappearedRequest:
+            iAVController->CancelDeviceDisappearedRequestL( aMessage );
+            break;              
+
+        case EAVControllerStartMediaServer:
+            iAVControllerServer.StartMediaServerL( aMessage );
+            break;
+            
+        case EAVControllerCancelStartMediaServer:
+            iAVControllerServer.CancelStartMediaServerL( aMessage );
+            break;
+
+        case EAVControllerStopMediaServer:
+            iAVControllerServer.StopMediaServerL( aMessage );
+            break;
+            
+        case EAVControllerMonitorConnection:
+            iAVController->MonitorConnectionL( aMessage );
+            break;
+
+        case EAVControllerCancelMonitorConnection:
+            iAVController->CancelMonitorConnectionL( aMessage );
+            break;
+        
+        case EAVControllerMSServicesInUse:
+            iAVControllerServer.MSServicesInUse( aMessage );
+            break;
+            
+        case EAVControllerCreateDownloadSession:
+            iAVController->CreateDownloadSessionL( aMessage );
+            break;
+            
+        case EAVControllerCreateUploadSession:
+            iAVController->CreateUploadSessionL( aMessage );       
+            break;
+        
+        case EAVControllerDestroyDownloadSession:
+            iAVController->DestroyDownloadSessionL( aMessage );
+            break;
+        
+        case EAVControllerDestroyUploadSession:
+            iAVController->DestroyUploadSessionL( aMessage );
+            break;
+        
+        case EAVControllerStartDownload:
+            iAVController->StartDownloadL( aMessage );
+            break;
+        
+        case EAVControllerCancelDownload:
+            iAVController->CancelDownloadL( aMessage );
+            break;
+        
+        case EAVControllerCancelAllDownloads:
+            iAVController->CancelAllDownloadsL( aMessage );
+            break;
+        
+        case EAVControllerStartUpload:
+            iAVController->StartUploadL( aMessage );
+            break;
+        
+        case EAVControllerCancelUpload:
+            iAVController->CancelUploadL( aMessage );
+            break;
+        
+        case EAVControllerCancelAllUploads:
+            iAVController->CancelAllUploadsL( aMessage );
+            break;
+        
+        case EAVControllerStartTrackingUploadProgress:
+            iAVController->StartTrackingUploadProgressL( aMessage );
+            break;
+        
+        case EAVControllerStartTrackingDownloadProgress:
+            iAVController->StartTrackingDownloadProgressL( aMessage );
+            break;
+        
+        case EAVControllerGetDownloadEvent:
+            iAVController->GetDownloadEventL( aMessage );
+            break;
+        
+        case EAVControllerCancelDownloadEvent:
+            iAVController->CancelGetDownloadEventL( aMessage );
+            break;
+        
+        case EAVControllerGetUploadEvent:
+            iAVController->GetUploadEventL( aMessage );
+            break;
+        
+        case EAVControllerCancelUploadEvent:
+            iAVController->CancelGetUploadEventL( aMessage );
+            break;
+        
+        case EAVControllerStartDownloadFH:
+            iAVController->StartDownloadFHL( aMessage );
+            break;
+
+        default:
+            PanicClient( aMessage, EAVControllerServerBadRequest );
+            break;
+        }
+    }
+
+
+void CUpnpAVControllerSession::DeviceDiscoveredL(
+    CUpnpAVDeviceExtended& aDevice )
+    {
+    iAVController->DeviceDiscoveredL( aDevice );
+    }
+
+ 
+void CUpnpAVControllerSession::DeviceDisappearedL(
+    CUpnpAVDeviceExtended& aDevice )
+    {
+    iAVController->DeviceDisappearedL( aDevice );
+    }
+
+
+void CUpnpAVControllerSession::ConnectionLost()
+    {
+    iAVController->ConnectionLost();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerSession::PanicClient
+// Panic client.
+// --------------------------------------------------------------------------
+//
+void CUpnpAVControllerSession::PanicClient( const RMessage2 &aMessage,
+    TInt aPanic ) const
+    {
+     // Note: this panics the client thread, not server
+    aMessage.Panic( KAVControllerName, aPanic );
+    }
+// --------------------------------------------------------------------------
+// CUpnpAVControllerSession::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpAVControllerSession* CUpnpAVControllerSession::NewL(
+    CUpnpAVControllerServer& aServer )
+    {
+    CUpnpAVControllerSession* self =
+        CUpnpAVControllerSession::NewLC(aServer); 
+    CleanupStack::Pop( self ) ;
+    return self ;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVControllerSession::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpAVControllerSession* CUpnpAVControllerSession::NewLC( 
+    CUpnpAVControllerServer& aServer )
+    {
+    CUpnpAVControllerSession* self =
+        new (ELeave) CUpnpAVControllerSession(aServer);
+    CleanupStack::PushL( self );
+    self->ConstructL() ;
+    return self ;
+    }
+
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpavdeviceextended.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,874 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      device with extended information - used in AVC server
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+// upnp stack api
+#include <upnpdlnaprotocolinfo.h>
+#include <upnpitem.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpitemutility.h"
+#include "upnpconstantdefs.h" // for upnp-specific stuff
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"
+
+// avcontroller internal
+#include "upnpavdeviceextended.h"
+
+
+_LIT8( KAudioSupport,        "audio/" );
+_LIT8( KImageSupport,        "image/" );
+_LIT8( KVideoSupport,        "video/" );
+_LIT8( KDlnaPn,              "DLNA.ORG_PN" );
+
+
+const TInt KProtocolInfoDelimeter = 44;
+const TInt KUnicodeC0RangeStart = 0;// the begin character of C0 range
+const TInt KUnicodeC0RangeEnd = 32;// the end character of C0 range 
+const TInt KUnicodeC1RangeStart = 127;// the begin character of C1 range
+const TInt KUnicodeC1RangeEnd = 159;// the end character of C1 range
+const TInt KSlash = 92;
+_LIT8( KProtocolInfo,       "protocolInfo" );
+_LIT8( KAsterisk,           "*" );
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::NewL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+CUpnpAVDeviceExtended* CUpnpAVDeviceExtended::NewL(
+    const CUpnpAVDevice& aDevice )
+    {
+    CUpnpAVDeviceExtended* dev = new(ELeave) CUpnpAVDeviceExtended();
+    CleanupStack::PushL( dev );
+    
+    dev->iDeviceType = aDevice.DeviceType();
+    dev->SetFriendlyNameL( aDevice.FriendlyName() );
+    dev->SetUuidL( aDevice.Uuid() );
+    dev->iCopyCapability = aDevice.CopyCapability();
+    dev->iSearchCapability = aDevice.SearchCapability();
+    dev->iPauseCapability = aDevice.PauseCapability();
+    dev->iVolumeCapability = aDevice.VolumeCapability();
+    dev->iMuteCapability = aDevice.MuteCapability();
+    dev->iAudioMediaCapability = aDevice.AudioCapability();
+    dev->iImageMediaCapability = aDevice.ImageCapability();
+    dev->iVideoMediaCapability = aDevice.VideoCapability();
+    dev->iNextAVTransportUri = aDevice.NextAVTransportUri();
+    dev->iMaxVolume = aDevice.MaxVolume();
+    dev->iDlnaCompatible = aDevice.DlnaCompatible();
+           
+    dev->ConstructL();
+    CleanupStack::Pop();
+    return dev;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::NewL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+CUpnpAVDeviceExtended* CUpnpAVDeviceExtended::NewL(
+    const CUpnpAVDeviceExtended& aDevice )
+    {
+    CUpnpAVDeviceExtended* dev = new(ELeave) CUpnpAVDeviceExtended();
+    CleanupStack::PushL( dev );
+    
+    dev->iDeviceType = aDevice.DeviceType();
+    dev->SetFriendlyNameL( aDevice.FriendlyName() );
+    dev->SetUuidL( aDevice.Uuid() );
+    dev->iCopyCapability = aDevice.CopyCapability();
+    dev->iSearchCapability = aDevice.SearchCapability();
+    dev->iPauseCapability = aDevice.PauseCapability();
+    dev->iVolumeCapability = aDevice.VolumeCapability();
+    dev->iMuteCapability = aDevice.MuteCapability();
+    dev->iAudioMediaCapability = aDevice.AudioCapability();
+    dev->iImageMediaCapability = aDevice.ImageCapability();
+    dev->iVideoMediaCapability = aDevice.VideoCapability();
+    dev->iNextAVTransportUri = aDevice.NextAVTransportUri();
+    dev->iMaxVolume = aDevice.MaxVolume();
+    dev->iDlnaCompatible = aDevice.DlnaCompatible();
+        
+    dev->SetSinkProtocolInfoL( aDevice.SinkProtocolInfo() );
+    dev->SetSourceProtocolInfoL( aDevice.SourceProtocolInfo() );
+    dev->iSubscriptionCount = aDevice.SubscriptionCount();   
+    dev->iLocal = aDevice.Local();
+    dev->iAudioUpload = aDevice.AudioUpload();
+    dev->iImageUpload = aDevice.ImageUpload();
+    dev->iVideoUpload = aDevice.VideoUpload(); 
+    dev->iCreateChildContainer = aDevice.CreateChildContainer();
+    dev->iDestroyObject = aDevice.DestroyObject();
+    dev->iPInfoReceived = aDevice.PInfoReceived();
+    dev->iDLNADeviceType = aDevice.DLNADeviceType();
+    
+    dev->ConstructL();
+    CleanupStack::Pop();
+    return dev;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::NewL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+CUpnpAVDeviceExtended* CUpnpAVDeviceExtended::NewL()
+    {
+    CUpnpAVDeviceExtended* dev = new(ELeave) CUpnpAVDeviceExtended();
+    CleanupStack::PushL( dev );        
+    dev->ConstructL();
+    CleanupStack::Pop();
+    return dev;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::~CUpnpAVDeviceExtended
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+CUpnpAVDeviceExtended::~CUpnpAVDeviceExtended()
+    {     
+    iSinkProtocolInfo.ResetAndDestroy();
+    iSourceProtocolInfo.ResetAndDestroy();
+    }
+    
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::CUpnpAVDeviceExtended
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+CUpnpAVDeviceExtended::CUpnpAVDeviceExtended() :
+    CUpnpAVDevice()
+    {     
+    }
+   
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::IncreaseSubscriptionCount
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TInt CUpnpAVDeviceExtended::IncreaseSubscriptionCount()
+    {
+    return ++iSubscriptionCount; 
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::DecreaseSubscriptionCount
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TInt CUpnpAVDeviceExtended::DecreaseSubscriptionCount()
+    {
+    iSubscriptionCount--;
+    if( iSubscriptionCount < 0 )
+        {
+        iSubscriptionCount = 0;
+        }
+    return iSubscriptionCount;    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SubscriptionCount
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TInt CUpnpAVDeviceExtended::SubscriptionCount() const
+    {
+    return iSubscriptionCount;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::ConstructL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::ConstructL()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetSinkProtocolInfoL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetSinkProtocolInfoL(
+    const TDesC8& aProtocolInfo )
+    {
+    __LOG( "CUpnpAVDeviceExtended::SetSinkProtocolInfoL" );
+    HBufC8* buffer = RemoveIllegalCharactersL( aProtocolInfo );
+    if( buffer )
+        {
+        CleanupStack::PushL( buffer );
+        TLex8 input( *buffer );
+        
+        while( !input.Eos() )
+            {
+            ParseToDelimeter( input, TChar( KProtocolInfoDelimeter ) );
+            CUpnpDlnaProtocolInfo* tmpInfo = NULL;
+            TRAPD( err, tmpInfo = CUpnpDlnaProtocolInfo::NewL(
+                input.MarkedToken() ) );
+             
+            if( err == KErrNone && tmpInfo )
+                {
+                // Transfer ownership of tmpInfo
+                iSinkProtocolInfo.Append( tmpInfo );
+                }
+            else
+                {
+                __LOG1( "CUpnpDlnaProtocolInfo::NewL failed: %d", err );
+                }
+                
+            if( !input.Eos() )
+                {
+                input.SkipAndMark( 1 ); // Skip the delimeter
+                }
+            }
+        CleanupStack::PopAndDestroy( buffer );
+        }
+    __LOG( "CUpnpAVDeviceExtended::SetSinkProtocolInfoL end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SinkProtocolInfo
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+const RPointerArray<CUpnpDlnaProtocolInfo>&
+    CUpnpAVDeviceExtended::SinkProtocolInfo() const
+    {
+    return iSinkProtocolInfo;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetSourceProtocolInfoL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetSourceProtocolInfoL(
+    const TDesC8& aProtocolInfo )
+    {
+    __LOG( "CUpnpAVDeviceExtended::SetSourceProtocolInfoL" );
+    HBufC8* buffer = RemoveIllegalCharactersL( aProtocolInfo );
+    if( buffer )
+        {
+        CleanupStack::PushL( buffer );
+        TLex8 input( *buffer );
+        
+        while( !input.Eos() )
+            {
+            ParseToDelimeter( input, TChar( KProtocolInfoDelimeter ) );
+            CUpnpDlnaProtocolInfo* tmpInfo = NULL;
+            TRAPD( err, tmpInfo = CUpnpDlnaProtocolInfo::NewL(
+                input.MarkedToken() ) );
+               
+            if( err == KErrNone && tmpInfo )
+                {
+                // Transfer ownership of tmpInfo
+                iSourceProtocolInfo.Append( tmpInfo );
+                }
+            else
+                {
+                __LOG1( "CUpnpDlnaProtocolInfo::NewL failed: %d", err );
+                }
+                
+            if( !input.Eos() )
+                {
+                input.SkipAndMark( 1 ); // Skip the delimeter
+                }
+            }
+        CleanupStack::PopAndDestroy( buffer );
+        }
+    __LOG( "CUpnpAVDeviceExtended::SetSourceProtocolInfoL end" );
+    }
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SourceProtocolInfo
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+const RPointerArray<CUpnpDlnaProtocolInfo>&
+    CUpnpAVDeviceExtended::SourceProtocolInfo() const
+    {
+    return iSourceProtocolInfo;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetLocal
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetLocal( TBool aLocal )
+    {
+    iLocal = aLocal;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::Local
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::Local() const
+    {
+    return iLocal;
+    }    
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::MatchSinkProtocolInfo
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::MatchSinkProtocolInfo(
+    const TDesC8& aInfo ) const
+    {
+    __LOG( "CUpnpAVDeviceExtended::MatchSinkProtocolInfo" );
+
+    TBool match = EFalse;
+
+    if( DlnaCompatible() )
+        {
+        // The device is DLNA compatible
+        
+        // Try try find PN parameter to determine if it's dlna content
+        if( aInfo.Find( KDlnaPn ) != KErrNotFound )
+            {
+            __LOG( "MatchSinkProtocolInfo - DLNA content and the renderer \
+is DLNA compatible, start matching..." );
+
+            match = MatchSinkProfileId( aInfo );
+            }
+        else
+            {
+            __LOG( "MatchSinkProtocolInfo - Non DLNA content and the \
+renderer is DLNA compatible, start matching..." );            
+            match = MatchSinkMime( aInfo );
+            }    
+        }
+    else
+        {
+        __LOG( "MatchSinkProtocolInfo - Renderer is not DLNA compatible, \
+start matching..." );            
+        match = MatchSinkMime( aInfo );
+        }    
+        
+    return match;
+    }      
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::MatchSourceProtocolInfo
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::ValidateTransfer(
+    const TDesC8& aInfo ) const
+    {
+    __LOG( "CUpnpAVDeviceExtended::MatchSourceProtocolInfo" );
+
+    // Try try find PN parameter to determine if it's dlna content
+    TBool match = EFalse;
+    if( aInfo.Find( KDlnaPn ) != KErrNotFound )
+        {
+        match = MatchSourceProfileId( aInfo );     
+        }
+
+    return match;
+    }      
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::MatchSinkProfileId
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::MatchSinkProfileId(
+    const TDesC8& aInfo ) const
+    {
+    __LOG( "CUpnpAVDeviceExtended::MatchSinkProfileId" );
+    
+    TBool match = EFalse;
+    CUpnpDlnaProtocolInfo* tmpInfo = NULL;
+    TRAPD( err, tmpInfo = CUpnpDlnaProtocolInfo::NewL( aInfo ) );
+    if ( err == KErrNone )
+        {      
+        // Match the first parameter and PN parameter
+        TInt count = iSinkProtocolInfo.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            if( iSinkProtocolInfo[ i ]->PnParameter() ==
+                tmpInfo->PnParameter() ||
+                iSinkProtocolInfo[ i ]->FourthField() == KAsterisk )
+                {
+                // PN parameter matches, try matching the first
+                // parameter
+                if( iSinkProtocolInfo[ i ]->FirstField() ==
+                    tmpInfo->FirstField() ||
+                    iSinkProtocolInfo[ i ]->FirstField() ==
+                    KAsterisk )
+                    {
+                    __LOG( "MatchSinkProfileId - a match" );
+                    
+                    // We have a match!
+                    i = count;
+                    match = ETrue;
+                    }
+                }     
+            }
+        delete tmpInfo;
+        }            
+    return match;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::MatchSourceProfileId
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::MatchSourceProfileId(
+    const TDesC8& aInfo ) const
+    {
+    __LOG( "CUpnpAVDeviceExtended::MatchSourceProfileId" );
+    
+    TBool match = EFalse;
+    CUpnpDlnaProtocolInfo* tmpInfo = NULL;
+    TRAPD( err, tmpInfo = CUpnpDlnaProtocolInfo::NewL( aInfo ) );
+    if ( err == KErrNone )
+        {      
+        // Match the first parameter and PN parameter
+        TInt count = iSourceProtocolInfo.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            if( iSourceProtocolInfo[ i ]->PnParameter() ==
+                tmpInfo->PnParameter() )
+                {
+                // PN parameter matches, try matching the first
+                // parameter
+                if( iSourceProtocolInfo[ i ]->FirstField() ==
+                    tmpInfo->FirstField() ||
+                    iSourceProtocolInfo[ i ]->FirstField() ==
+                    KAsterisk )
+                    {
+                    __LOG( "MatchSourceProfileId - a match" );
+                                        
+                    // We have a match!
+                    i = count;
+                    match = ETrue;
+                    }
+                }     
+            }
+        delete tmpInfo;
+        }            
+    return match;
+    }
+   
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::MatchSinkMime
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::MatchSinkMime( const TDesC8& aInfo ) const
+    {
+    __LOG( "CUpnpAVDeviceExtended::MatchSinkMime" );
+
+    TBool match = EFalse;
+    CUpnpDlnaProtocolInfo* tmpInfo = NULL;
+    TRAPD( err, tmpInfo = CUpnpDlnaProtocolInfo::NewL( aInfo ) );
+    if ( err == KErrNone )
+        {      
+        // Match the first parameter and mime-type
+        TInt count = iSinkProtocolInfo.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            if( iSinkProtocolInfo[ i ]->ThirdField() ==
+                tmpInfo->ThirdField() )
+                {
+                // Mime-parameter matches, try matching the first
+                // parameter
+                if( iSinkProtocolInfo[ i ]->FirstField() ==
+                    tmpInfo->FirstField() )
+                    {
+                    __LOG( "MatchSinkMime - a match" );
+                    
+                    // We have a match!
+                    i = count;
+                    match = ETrue;
+                    }
+                }     
+            }
+        delete tmpInfo;
+        }            
+    return match;    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::FindFirstMatchingInSinkL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+const TDesC8& CUpnpAVDeviceExtended::FindFirstMatchingInSinkL(
+    const CUpnpItem& aItem ) const
+    {
+    __LOG( "CUpnpAVDeviceExtended::FindFirstMatchingInSinkL" );
+    
+    RUPnPElementsArray array;
+    CleanupClosePushL( array );
+    
+    UPnPItemUtility::GetResElements( aItem, array );
+    TBool match = EFalse;
+    TInt i;
+    
+    TInt count = array.Count();
+    for( i = 0; i < count; i ++ )
+        {
+        const CUpnpAttribute& protocolInfo =
+            UPnPItemUtility::FindAttributeByNameL(
+            *array[ i ], KProtocolInfo );
+            
+        if( MatchType( aItem.ObjectClass(), protocolInfo.Value() ) )
+            {
+            if( MatchSinkProtocolInfo( protocolInfo.Value() ) )
+                {
+                // We have a match!
+                __LOG( "FindFirstMatchingInSinkL - a match" );
+                
+                match = ETrue;
+                break;
+                }
+            else
+                {
+                __LOG( "FindFirstMatchingInSinkL - not a match" );
+                }                
+            }
+        else
+            {
+            // Res-elements mime-type does not match to object-class
+            // Ignore
+            __LOG( "FindFirstMatchingInSinkL - Res doesn't match \
+to objectclass" );
+            }              
+        }
+    
+    if( !match )
+        {
+        __LOG( "FindFirstMatchingInSinkL - No match" );
+        
+        User::Leave( KErrNotSupported );
+        }
+    
+    const TDesC8& uri = array[ i ]->Value();
+    
+    CleanupStack::PopAndDestroy( &array );
+    
+    return uri;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::MatchType
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::MatchType( const TDesC8& aObjectClass,
+    const TDesC8& aProtocolInfo ) const
+    {
+    __LOG( "CUpnpAVDeviceExtended::MatchType" );
+    
+    TBool retVal = EFalse;
+    if( aObjectClass.Find( KClassAudio ) == 0 )
+        {
+        if( aProtocolInfo.Find( KAudioSupport ) >= 0 )
+            {
+            retVal = ETrue;
+            }
+        }
+    else if( aObjectClass.Find( KClassImage ) == 0 )
+        {
+        if( aProtocolInfo.Find( KImageSupport ) >= 0 )
+            {
+            retVal = ETrue;
+            }        
+        }
+    else if( aObjectClass.Find( KClassVideo ) == 0 )
+        {
+        if( aProtocolInfo.Find( KVideoSupport ) >= 0 )
+            {
+            retVal = ETrue;
+            }        
+        }
+    else
+        {
+        __PANICD( __FILE__, __LINE__ );
+        }
+    return retVal;        
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetCapabilitiesBySupportedMimeTypesL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetCapabilitiesBySupportedMimeTypesL( 
+    const TDesC8& aListOfMimeTypes )
+    {
+    __LOG( "CUpnpAVDeviceExtended::SetCapabilitiesBySupportedMimeTypesL" );
+    
+    if( aListOfMimeTypes != KNullDesC8 )
+        {
+ 	    // Update the audio media capability
+        if( UPnPCommonUtils::IsAudioSupported( aListOfMimeTypes ) )
+            {
+            iAudioMediaCapability = ETrue;
+            }
+        else
+            {	
+            iAudioMediaCapability = EFalse;
+            }
+
+	    // Update the audio media capability
+        if( UPnPCommonUtils::IsImageSupported( aListOfMimeTypes ) )
+            {
+            iImageMediaCapability = ETrue;
+            }
+        else
+            {	
+            iImageMediaCapability = EFalse;
+            }
+  
+        // Update the video media capability
+        if( UPnPCommonUtils::IsVideoSupported( aListOfMimeTypes ) )
+            {
+            iVideoMediaCapability = ETrue;
+            }
+        else
+            {	
+            iVideoMediaCapability = EFalse;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetSourceProtocolInfoL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetSourceProtocolInfoL(
+        const RPointerArray<CUpnpDlnaProtocolInfo>& aProtocolInfo )
+    {
+    __LOG( "CUpnpAVDeviceExtended::SetSourceProtocolInfoL" );
+    
+    for( TInt i = 0; i < aProtocolInfo.Count(); i++ )
+        {
+        CUpnpDlnaProtocolInfo* tmpInfo = CUpnpDlnaProtocolInfo::NewL(
+            aProtocolInfo[ i ]->ProtocolInfoL() );
+        iSourceProtocolInfo.Append( tmpInfo ); // Ownership is transferred
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetSinkProtocolInfoL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetSinkProtocolInfoL(
+        const RPointerArray<CUpnpDlnaProtocolInfo>& aProtocolInfo )
+    {
+    __LOG( "CUpnpAVDeviceExtended::SetSinkProtocolInfoL" );
+    
+    for( TInt i = 0; i < aProtocolInfo.Count(); i++ )
+        {
+        CUpnpDlnaProtocolInfo* tmpInfo = CUpnpDlnaProtocolInfo::NewL(
+            aProtocolInfo[ i ]->ProtocolInfoL() );
+        iSinkProtocolInfo.Append( tmpInfo ); // Ownership is transferred
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::ParseToDelimeter
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::ParseToDelimeter( TLex8& aLex, TChar aDelimeter )
+    {
+    aLex.Mark();
+        
+    TChar chr = 0;
+	TChar edchr = 0;
+		
+	while( !aLex.Eos() )
+		{
+		edchr = chr;
+		
+		chr = aLex.Peek();
+		if( chr == aDelimeter && edchr != TChar( KSlash ) )
+			{
+			break;
+			}
+			
+		aLex.Inc();		
+		}
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::RemoveIllegalCharactersL
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------   
+ HBufC8* CUpnpAVDeviceExtended::RemoveIllegalCharactersL(
+    const TDesC8& aPtr ) const
+    {
+    HBufC8* ptrResult = NULL;
+    TInt i = KErrNotFound;
+    if ( aPtr.Length() != 0 )
+        {
+        ptrResult = aPtr.AllocL();
+        CleanupStack::PushL( ptrResult );    
+        TPtr8 ptr = ptrResult->Des();
+        while( ++i < ptr.Length() )
+            {       
+            if( IsIllegalCharacter( ptr[i] ) )
+                {     
+                ptr.Delete( i, 1 );
+                i--;
+                }
+                               
+            }       
+        CleanupStack::Pop( ptrResult );       
+        } 
+    return ptrResult;
+   
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::IsIllegalCharacter
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::IsIllegalCharacter( TChar aCharacter ) const
+    {
+    
+    TBool retVal = EFalse;
+    if ( ( ( aCharacter >= TChar( KUnicodeC0RangeStart ) 
+        && aCharacter <= TChar( KUnicodeC0RangeEnd ) ) 
+        || ( aCharacter >= TChar( KUnicodeC1RangeStart ) 
+        && aCharacter <= TChar( KUnicodeC1RangeEnd ) ) ) )
+        {
+        retVal = ETrue;
+        }
+    return retVal;
+    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetAudioUpload
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetAudioUpload( TBool aAudioUpload )
+    {
+    iAudioUpload = aAudioUpload;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::AudioUpload
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::AudioUpload() const
+    {
+    return iAudioUpload;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetImageUpload
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetImageUpload( TBool aImageUpload )
+    {
+    iImageUpload = aImageUpload;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::ImageUpload
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::ImageUpload() const
+    {
+    return iImageUpload;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetVideoUpload
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetVideoUpload( TBool aVideoUpload )
+    {
+    iVideoUpload = aVideoUpload;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::VideoUpload
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::VideoUpload() const
+    {
+    return iVideoUpload;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetCreateChildContainer
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetCreateChildContainer(
+    TBool aCreateChildContainer )
+    {
+    iCreateChildContainer = aCreateChildContainer;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::CreateChildContainer
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::CreateChildContainer() const
+    {
+    return iCreateChildContainer;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetDestroyObject
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetDestroyObject( TBool aDestroyObject )
+    {
+    iDestroyObject = aDestroyObject;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::DestroyObject
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::DestroyObject() const
+    {
+    return iDestroyObject;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::SetPInfoReceived
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+void CUpnpAVDeviceExtended::SetPInfoReceived( TBool aPInfoReceived )
+    {
+    iPInfoReceived = aPInfoReceived;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDeviceExtended::PInfoReceived
+// See upnpavdeviceextended.h
+// --------------------------------------------------------------------------
+TBool CUpnpAVDeviceExtended::PInfoReceived() const
+    {
+    return iPInfoReceived;
+    }
+
+void CUpnpAVDeviceExtended::SetDLNADeviceType( TDLNADeviceType aDeviceType )
+    {
+    iDLNADeviceType = aDeviceType;
+    }
+   
+CUpnpAVDeviceExtended::TDLNADeviceType
+    CUpnpAVDeviceExtended::DLNADeviceType() const
+    {
+    return iDLNADeviceType;
+    }
+
+
+    
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpavdispatcher.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1072 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      dispatches control point events to AVController clients
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include "upnpavdispatcher.h"
+
+#include "upnpavactioninfo.h"
+#include "upnpavcontrolpointobserver.h"
+//#include "upnpavcontrollerimpl.h"
+#include "upnpavcontrollerserver.h"
+
+_LIT( KComponentLogfile, "CUPnPAVDispatcher.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::CUPnPAVDispatcher
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPAVDispatcher::CUPnPAVDispatcher( CUpnpAVControllerServer& aServer ) :
+    iServer( aServer )
+    {    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::ConstructL()
+    {                           
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAVDispatcher* CUPnPAVDispatcher::NewL( CUpnpAVControllerServer& aServer )
+    {
+    CUPnPAVDispatcher* self = NewLC( aServer);
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAVDispatcher* CUPnPAVDispatcher::NewLC(
+    CUpnpAVControllerServer& aServer )
+    {
+    CUPnPAVDispatcher* self = new( ELeave )
+        CUPnPAVDispatcher( aServer );   
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+    
+// Destructor
+CUPnPAVDispatcher::~CUPnPAVDispatcher()
+    {
+    iActionInfos.ResetAndDestroy(); 
+//    iActionInfosDevice.ResetAndDestroy();
+    iActionInfosEvent.ResetAndDestroy();           
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::RcSetVolumeResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr, 
+    const TDesC8& aInstance, 
+    const TDesC8& aChannel, 
+    const TDesC8& aDesiredVolume)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.RcSetVolumeResponse( aUuid, aSessionId, aErr, aInstance, aChannel,
+            aDesiredVolume );        
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::RcVolumeResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr, 
+    const TDesC8& aInstance, 
+    const TDesC8& aChannel, 
+    const TDesC8& aCurrentVolume)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.RcVolumeResponse( aUuid, aSessionId, aErr, aInstance, aChannel,
+            aCurrentVolume );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::RcSetMuteResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr, 
+    const TDesC8& aInstance, 
+    const TDesC8& aChannel, 
+    const TDesC8& aDesiredMute)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+    
+        obs.RcSetMuteResponse( aUuid, aSessionId, aErr, aInstance, aChannel,
+            aDesiredMute );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::RcMuteResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr, 
+    const TDesC8& aInstance, 
+    const TDesC8& aChannel, 
+    const TDesC8& aCurrentMute)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+       
+        obs.RcMuteResponse( aUuid, aSessionId, aErr, aInstance, aChannel,
+            aCurrentMute );
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtSetTransportUriResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aInstanceId,
+    const TDesC8& aCurrentUri,
+    const TDesC8& aCurrentUriMetaData)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.AvtSetTransportUriResponse( aUuid, aSessionId, aErr, aInstanceId,
+            aCurrentUri, aCurrentUriMetaData );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtSetNextTransportUriResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aInstanceId,
+    const TDesC8& aNextUri,
+    const TDesC8& aNextUriMetaData )
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.AvtSetNextTransportUriResponse( aUuid, aSessionId, aErr,
+            aInstanceId, aNextUri, aNextUriMetaData );
+        }
+    }
+  
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtMediaInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNrTracks*/,
+    const TDesC8& /*aMediaDuration*/,
+    const TDesC8& /*aCurrentUri*/,
+    const TDesC8& /*aCurrentUriMetaData*/,
+    const TDesC8& /*aNextUri*/,
+    const TDesC8& /*aNextUriMetaData*/,
+    const TDesC8& /*aPlayMedium*/,
+    const TDesC8& /*aRecordMedium*/,
+    const TDesC8& /*aWriteStatus*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtGetTransportInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aCurrenTransportState*/,
+    const TDesC8& /*aCurrentTransportStatus*/,
+    const TDesC8& /*aCurrentSpeed*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtPositionInfoResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aInstanceId,
+    const TDesC8& aTrack,
+    const TDesC8& aTrackDuration,
+    const TDesC8& aTrackMetaData,
+    const TDesC8& aTrackURI,
+    const TDesC8& aRelTime,
+    const TDesC8& aAbsTime,
+    const TDesC8& aRelCount,
+    const TDesC8& aAbsCount)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.AvtPositionInfoResponse( aUuid, aSessionId, aErr,
+            aInstanceId, aTrack, aTrackDuration, aTrackMetaData,
+            aTrackURI, aRelTime, aAbsTime, aRelCount, aAbsCount );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtDeviceCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aPlayMedia*/,
+    const TDesC8& /*aRecMedia*/,
+    const TDesC8& /*aRecQualityMode*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtTransportSettingsResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aPlayMode*/,
+    const TDesC8& /*aRecQualityMode*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtStopResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aInstanceId)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.AvtStopResponse( aUuid, aSessionId, aErr, aInstanceId );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtPlayResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aInstanceId,
+    const TDesC8& aSpeed)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.AvtPlayResponse( aUuid, aSessionId, aErr, aInstanceId,
+            aSpeed );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtPauseResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aInstanceId)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.AvtPauseResponse( aUuid, aSessionId, aErr, aInstanceId );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtRecordResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtSeekResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aUnit*/,
+    const TDesC8& /*aTarget*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtNextResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtPreviousResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtSetPlayModeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNewPlayMode*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtSetRecordModeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNewRecordQuality*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsSearchCapabilitiesResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aSearchCaps)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.CdsSearchCapabilitiesResponse( aUuid, aSessionId, aErr,
+            aSearchCaps );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsSortCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSortCaps*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsSystemUpdateIdResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*aSystemUpdateId*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsBrowseResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aObjectID,
+    const TDesC8&  aBrowseFlag,
+    const TDesC8&  aFilter,
+    TInt aIndex,
+    TInt aRequest,
+    const TDesC8&  aSortCriteria,
+    const TDesC8&  aResult,
+    TInt aReturned,
+    TInt aMatches,
+    const TDesC8&  aUpdateID)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.CdsBrowseResponse( aUuid, aSessionId, aErr, aObjectID,
+            aBrowseFlag, aFilter, aIndex, aRequest, aSortCriteria,
+            aResult, aReturned, aMatches, aUpdateID );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsSearchResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aContainerId,
+    const TDesC8& aSearchCriteria,
+    const TDesC8& aFilter,
+    TInt aIndex,
+    TInt aRequest,
+    const TDesC8& aSortCriteria,
+    const TDesC8& aResult,
+    TInt aReturned,
+    TInt aMatches,
+    const TDesC8& aUpdateID)
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.CdsSearchResponse( aUuid, aSessionId, aErr, aContainerId,
+            aSearchCriteria, aFilter, aIndex, aRequest, aSortCriteria,
+            aResult, aReturned, aMatches, aUpdateID );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsDestroyObjectResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aObjectId )
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.CdsDestroyObjectResponse( aUuid, aSessionId, aErr, aObjectId );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsUpdateObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aObjectId*/,
+    const TDesC8& /*aCurrentTagValue*/,
+    const TDesC8& /*aNewTagValue*/ )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsImportResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aSourceURI,
+    const TDesC8& aDestinationURI,
+    const TDesC8& aTransferId )
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.CdsImportResponse( aUuid, aSessionId, aErr, aSourceURI,
+            aDestinationURI, aTransferId );
+        }
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsExportResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aSourceURI,
+    const TDesC8& aDestinationURI,
+    const TDesC8& aTransferId )
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.CdsExportResponse( aUuid, aSessionId, aErr, aSourceURI,
+            aDestinationURI, aTransferId );
+        }
+    
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsStopTransferResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aTransferId )
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.CdsStopTransferResponse( aUuid, aSessionId, aErr, aTransferId );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsCTransferProgressResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aTransferId,
+    const TDesC8& aTransferStatus,
+    const TDesC8& aTransferLength,            
+    const TDesC8& aTransferTotal )
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.CdsCTransferProgressResponse( aUuid, aSessionId,
+            aErr, aTransferId, aTransferStatus, aTransferLength,
+            aTransferTotal );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsDeleteResourceResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aResourceUri*/ )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsCreateReferenceResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aContainerId*/, 
+    const TDesC8& /*aObjectId*/, 
+    const TDesC8& /*aNewId*/ )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsCreateObjectResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aContainerID, 
+    const TDesC8& aElements, 
+    const TDesC8& aObjectID, 
+    const TDesC8& aResult )
+    {
+    MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
+    if( &obs )
+        {
+        obs.CdsCreateObjectResponse( aUuid, aSessionId, aErr, aContainerID,
+            aElements, aObjectID, aResult );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CmProtocolInfoResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aSource, 
+    const TDesC8& aSink )
+    {
+    iServer.CmProtocolInfoResponse( aUuid, aSessionId, aErr, aSource, aSink );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CmPrepareResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aRemoteProtocolInfo*/,
+    const TDesC8& /*aPeerConnectionManager*/,
+    const TDesC8& /*aPeerConnectionId*/,
+    const TDesC8& /*aDirection*/,
+    TInt /*aConnection*/,
+    TInt /*aTransport*/,
+    TInt /*aRsc*/ )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CmComplete(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*aConnection*/ )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CmCurrentConnections(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aConnections*/)
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CmCurrentInfo(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*rscId*/, 
+    TInt /*transportId*/, 
+    const TDesC8& /*aProtocolInfo*/,
+    const TDesC8& /*aPeerConnectionManager*/, 
+    TInt /*peerId*/, 
+    const TDesC8& /*aDirection*/, 
+    const TDesC8& /*aStatus*/ )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsUpdateEvent(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSystemUpdateId*/
+        )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsContainerEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aConteinerIds*/
+        )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CdsTransferEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aTransferIds*/
+        )
+    {
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::RcLastChangeEvent(
+        const TDesC8& aUuid,
+        const TDesC8& aLastChange
+        )
+    {
+    // Forward to each observer
+    TInt tempCount = iActionInfosEvent.Count();
+    
+    for( TInt i = 0; i < tempCount; i++ )
+        {
+        if( aUuid == iActionInfosEvent[ i ]->Uuid() )
+            {
+            iActionInfosEvent[ i ]->Observer().RcLastChangeEvent(
+                aUuid, aLastChange );            
+            }
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::AvtLastChangeEvent(
+        const TDesC8& aUuid,
+        const TDesC8& aLastChange
+        )
+    {
+    // Forward to each observer
+    TInt tempCount = iActionInfosEvent.Count();
+    
+    for( TInt i = 0; i < tempCount; i++ )
+        {
+        if( aUuid == iActionInfosEvent[ i ]->Uuid() )
+            {
+            iActionInfosEvent[ i ]->Observer().AvtLastChangeEvent(
+                aUuid, aLastChange );
+            }
+        }
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CmSourceEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aSource*/
+        )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CmSinkEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aSink*/
+        )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::CmConnectionsEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aConnections*/
+        )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::HttpResponseL( CUpnpHttpMessage* /*aMessage*/ )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::DeviceDiscoveredL( CUpnpDevice* aDevice )
+    {
+    __ASSERTD( aDevice, __FILE__, __LINE__  )
+    
+    if( aDevice )
+        {
+        iServer.DeviceDiscoveredL( *aDevice );    
+        }
+    else
+        {
+        // No can do?
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVDispatcher::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPAVDispatcher::DeviceDisappearedL( CUpnpDevice* aDevice )
+    {
+    __ASSERTD( aDevice, __FILE__, __LINE__  );
+    
+    if( aDevice )
+        {
+        iServer.DeviceDisappearedL( *aDevice );    
+        }
+    else
+        {
+        // No can do?
+        }                
+    }
+
+void CUPnPAVDispatcher::RegisterL( TInt aSessionId,
+    MUpnpAVControlPointObserver& aObserver/*, const TDesC8& aUuid*/ )
+    {
+    CUPnPAVActionInfo* tempInfo = CUPnPAVActionInfo::NewLC();
+    tempInfo->SetSessionId( aSessionId );
+    tempInfo->SetObserver( aObserver );
+    //tempInfo->SetUuidL( aUuid );
+    CleanupStack::Pop( tempInfo );
+    iActionInfos.Append( tempInfo );
+    }
+
+void CUPnPAVDispatcher::UnRegister( TInt aSessionId
+    /*, const TDesC8& aUuid*/ )
+    {
+    TInt tempCount = iActionInfos.Count();
+    
+    for( TInt i = 0; i < tempCount; i++ )
+        {
+        if( iActionInfos[ i ]->SessionId() == aSessionId )
+            {
+            delete iActionInfos[ i ];
+            iActionInfos.Remove( i );
+            i = tempCount;
+            }
+        }
+    }
+
+MUpnpAVControlPointObserver& CUPnPAVDispatcher::FindObserver(
+    TInt aSessionId )
+    {
+    MUpnpAVControlPointObserver* tempObserver = NULL;
+    TInt tempCount = iActionInfos.Count();
+    
+    for( TInt i = 0; i < tempCount; i++ )
+        {
+        if( iActionInfos[ i ]->SessionId() == aSessionId )
+            {
+            tempObserver = &( iActionInfos[ i ]->Observer() );
+            i = tempCount;
+            }
+        }
+    return *tempObserver;   
+    }
+
+void CUPnPAVDispatcher::RegisterForEventsL(
+    MUpnpAVControlPointObserver& aObserver, const TDesC8& aUuid )
+    {
+    CUPnPAVActionInfo* tempInfo = CUPnPAVActionInfo::NewLC();
+    tempInfo->SetObserver( aObserver );
+    tempInfo->SetUuidL( aUuid );
+    CleanupStack::Pop( tempInfo );
+    iActionInfosEvent.Append( tempInfo );        
+    }
+    
+void CUPnPAVDispatcher::UnRegisterEvents(
+    MUpnpAVControlPointObserver& aObserver )
+    {
+    TInt tempCount = iActionInfosEvent.Count();
+    
+    for( TInt i = 0; i < tempCount; i++ )
+        {
+        if( &aObserver == &iActionInfosEvent[ i ]->Observer() )
+            {
+            delete iActionInfosEvent[ i ];
+            iActionInfosEvent.Remove( i );
+            i = tempCount;
+            }
+        }        
+    }
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpaverrorhandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,403 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      errror handling in AVController
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+#include <upnperrors.h>
+
+#include "upnpaverrorhandler.h"
+
+// CONSTANTS
+const TInt KMaxSymbianErrorCode = -100;
+const TInt KMinActionErrorCode = 700;
+
+// --------------------------------------------------------------------------
+// UPnPAVErrorHandler::ConvertToSymbianErrorCode
+// Returns the Symbian error code (e32err.h) corresponding the given UPnP
+// error code.
+// --------------------------------------------------------------------------
+TInt UPnPAVErrorHandler::ConvertToSymbianErrorCode(
+                              TInt aUPnPErrorCode,
+                              TUPnPErrorCodeType aErrorType )
+    {
+    TInt convertedErrorCode = KErrGeneral;
+
+    if( aUPnPErrorCode == EHttpOk ||  /* 200 */
+        aUPnPErrorCode == KErrNone )
+        {
+        convertedErrorCode = KErrNone;
+        }
+    // Don't convert Symbian error codes
+    else if( aUPnPErrorCode < 0 &&
+             aUPnPErrorCode > KMaxSymbianErrorCode ) 
+        {
+        convertedErrorCode = aUPnPErrorCode;
+        }
+    else
+        {
+        if ( aUPnPErrorCode > 0 && 
+             aUPnPErrorCode < KMinActionErrorCode )
+            {
+            convertedErrorCode = ConvertGeneralErrorCode( aUPnPErrorCode );
+            }
+        else if( aErrorType == EUPnPConnectionManagerError )
+            {
+            convertedErrorCode = ConvertCMErrorCode( aUPnPErrorCode );
+            }
+        else if( aErrorType == EUPnPContentDirectoryError )
+            {
+            convertedErrorCode = ConvertCDSErrorCode( aUPnPErrorCode );
+            }
+        else if( aErrorType == EUPnPRenderingControlError )
+            {
+            convertedErrorCode = ConvertRCErrorCode( aUPnPErrorCode );
+            }
+        else if( aErrorType == EUPnPAVTransportError )
+            {
+            convertedErrorCode = ConvertAVTErrorCode( aUPnPErrorCode );
+            }
+        else if( aErrorType == EUPnPHTTPError )
+            {
+            convertedErrorCode = ConvertHTTPErrorCode( aUPnPErrorCode );
+            }
+        else
+            {
+            convertedErrorCode = KErrGeneral; 
+            }
+        }
+
+    return convertedErrorCode;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAVErrorHandler::ConvertGeneralErrorCode
+// Returns the Symbian error code (e32err.h) corresponding to the
+// given general UPnP error code.
+// --------------------------------------------------------------------------
+TInt UPnPAVErrorHandler::ConvertGeneralErrorCode(
+                             TInt aUPnPErrorCode )
+    {
+    TInt convertedErrorCode = KErrGeneral;
+
+    switch( aUPnPErrorCode )
+        {
+        case EInvalidAction: /* 400 */
+            // fall through
+        case EInvalidVar: /* 404 */
+            // fall through
+        case ENotImplemented: /* 602 */
+            {
+            convertedErrorCode = KErrNotSupported;
+            break;
+            }
+        case EInvalidArgs: /* 402 */
+            // fall through
+        case EArgumentValue: /* 600 */
+            // fall through
+        case EArgumentRange: /* 601 */
+            // fall through
+        case EStringTooLong: /* 605 */
+            {
+            convertedErrorCode = KErrArgument;
+            break;
+            }
+        case EInternalServerError: /* 500 */
+            {
+            convertedErrorCode = KErrGeneral;
+            break;
+            }
+        case EActionFailed: /* 501 */
+            {
+            convertedErrorCode = KErrGeneral;
+            break;
+            }
+        case EHttpInsufficientStorage:
+            {
+            convertedErrorCode = KErrDiskFull;
+            break;
+            }     
+        case EOutOfMemory: /* 603 */
+            {
+            //Server has no memory
+            convertedErrorCode = KErrServerBusy;
+            break;
+            }
+        case EHumanIntervention: /* 604 */
+            {
+            convertedErrorCode = KErrDied;
+            break;
+            }
+        case ENotAuthorized: /* 606 */
+            // fall through
+        case ESignatureFailure: /* 607 */
+            // fall through
+        case ESignatureMissing: /* 608 */
+            // fall through
+        case ENotEncrypted: /* 609 */
+            {
+            convertedErrorCode = KErrAccessDenied;
+            break;
+            }
+        case EInvalidUrl: /* 611 */
+            // fall through
+        case ENoSession: /* 612 */
+            {
+            convertedErrorCode = KErrNotFound;
+            break;
+            }
+        default:
+            {
+            convertedErrorCode = KErrGeneral;
+            break;
+            }
+        }
+    return convertedErrorCode; 
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAVErrorHandler::ConvertCMErrorCode
+// Returns the Symbian error code (e32err.h) corresponding to the 
+// given Connection Manager error code.
+// --------------------------------------------------------------------------
+TInt UPnPAVErrorHandler::ConvertCMErrorCode(
+                              TInt aUPnPErrorCode )
+    {
+    TInt convertedErrorCode = KErrGeneral;
+    switch( aUPnPErrorCode )
+        {
+        case ENoSuchObject: /* 701 */
+            // fall through
+        case EInvalidCurrentTag: /* 702 */
+            // fall through
+        case EInvalidNewTag: /* 703 */
+            // fall through
+        case ERequiredTag: /* 704 */
+            {
+            convertedErrorCode = KErrCouldNotConnect;
+            break;
+            }
+        case EReadOnlyTag: /* 705 */
+            {
+            convertedErrorCode = KErrAccessDenied;
+            break;
+            }
+        case EParameterMismatch : /* 706 */
+            {
+            convertedErrorCode = KErrArgument;
+            break;
+            }
+        default:
+            {
+            convertedErrorCode = KErrGeneral;
+            break;
+            }
+        }
+    return convertedErrorCode; 
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAVErrorHandler::ConvertCDSErrorCode
+// Returns the Symbian error code (e32err.h) corresponding to the 
+// given Content Directory error code.
+// --------------------------------------------------------------------------
+TInt UPnPAVErrorHandler::ConvertCDSErrorCode(
+                              TInt aUPnPErrorCode )
+    {
+    TInt convertedErrorCode = KErrGeneral;
+    switch( aUPnPErrorCode )
+        {
+        case ENoSuchObject: /* 701 */
+            // fall through
+        case ENoContainer: /* 710 */
+            // fall through
+        case ENoSourceResource: /* 714 */
+            // fall through
+        case ENoDestinationResource: /* 718 */
+            {
+            convertedErrorCode = KErrNotFound;
+            break;
+            }
+        case EInvalidCurrentTag: /* 702 */
+            // fall through
+        case EInvalidNewTag: /* 703 */
+            // fall through
+        case EParameterMismatch : /* 706 */
+            // fall through
+        case EBadMetadata: /* 712 */
+            {
+            convertedErrorCode = KErrArgument;
+            break;
+            }
+        case ERequiredTag: /* 704 */
+            // fall through
+        case EReadOnlyTag: /* 705 */
+            // fall through
+        case ERestrictedObject: /* 711 */
+            // fall through
+        case ERestrictedParentObject: /* 713 */
+            // fall through
+        case ESourceAccess: /* 715 */
+            // fall through
+        case EDestinationAccess: /* 719 */
+            {
+            convertedErrorCode = KErrAccessDenied;
+            break;
+            }
+        case EInvalidSearch: /* 708 */
+            // fall through
+        case EInvalidSort: /* 709 */
+            {
+            convertedErrorCode = KErrNotSupported;
+            break;
+            }
+        case ETransferBusy: /* 716 */
+            {
+            convertedErrorCode = KErrInUse;
+            break;
+            }
+       default:
+            {
+            convertedErrorCode = KErrGeneral;
+            break;
+            }
+        }
+    return convertedErrorCode; 
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAVErrorHandler::ConvertRCErrorCode
+// Returns the Symbian error code (e32err.h) corresponding to the 
+// given Rendering Control error code.
+// --------------------------------------------------------------------------
+TInt UPnPAVErrorHandler::ConvertRCErrorCode(
+                              TInt aUPnPErrorCode )
+    {
+    TInt convertedErrorCode = KErrGeneral;
+    switch( aUPnPErrorCode )
+        {
+        case ENoSuchObject: /* 701 */
+            // fall through
+        case EInvalidCurrentTag: /* 702 */
+            {
+            convertedErrorCode = KErrArgument;
+            break;
+            }
+       default:
+            {
+            convertedErrorCode = KErrGeneral;
+            break;
+            }
+        }
+    return convertedErrorCode; 
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAVErrorHandler::ConvertAVTErrorCode
+// Returns the Symbian error code (e32err.h) corresponding to the 
+// given AV Transport error code.
+// --------------------------------------------------------------------------
+TInt UPnPAVErrorHandler::ConvertAVTErrorCode(
+                              TInt aUPnPErrorCode )
+    {
+    TInt convertedErrorCode = KErrGeneral;
+    switch( aUPnPErrorCode )
+        {
+        case ENoSuchObject: /* 701 */
+            // fall through
+        case ERequiredTag: /* 704 */
+            // fall through
+        case EInvalidSearch: /* 708 */
+            // fall through
+        case ENoContainer: /* 710 */
+            // fall through
+        case EBadMetadata: /* 712 */
+            // fall through
+        case ERestrictedParentObject: /* 713 */
+            // fall through
+        case ENoSourceResource: /* 714 */
+            // fall through
+        case ENoFileTransfer: /* 717 */
+            {
+            convertedErrorCode = KErrNotSupported;
+            break;
+            }
+        case EInvalidCurrentTag: /* 702 */
+            // fall through
+        case ETransferBusy: /* 716 */
+            {
+            convertedErrorCode = KErrNotFound;
+            break;
+            }
+        case EInvalidNewTag: /* 703 */
+            {
+            convertedErrorCode = KErrHardwareNotAvailable;
+            break;
+            }
+        case EReadOnlyTag: /* 705 */
+            {
+            convertedErrorCode = KErrLocked;
+            break;
+            }
+        case EParameterMismatch : /* 706 */
+            {
+            convertedErrorCode = KErrWrite;
+            break;
+            }
+        case EInvalidSort: /* 709 */
+            {
+            convertedErrorCode = KErrDiskFull;
+            break;
+            }
+        case ESourceAccess: /* 715 */
+            {
+            convertedErrorCode = KErrInUse;
+            break;
+            }
+        case ENoDestinationResource: /* 718 */
+            {
+            convertedErrorCode = KErrArgument;
+            break;
+            }
+       default:
+            {
+            convertedErrorCode = KErrGeneral;
+            break;
+            }
+        }
+    return convertedErrorCode;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAVErrorHandler::ConvertHTTPErrorCode
+// Returns the Symbian error code (e32err.h) corresponding to the 
+// given HTTP error code.
+// --------------------------------------------------------------------------
+TInt UPnPAVErrorHandler::ConvertHTTPErrorCode(
+                              TInt /*aUPnPErrorCode*/ )
+    {
+    TInt convertedErrorCode = KErrDisconnected;
+        
+    return convertedErrorCode;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpavtimer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      timing services for AVC server
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpavtimer.h"
+#include "upnpbrowsingsession.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KMillion = 1000000;
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPAVTimer::NewL
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+CUPnPAVTimer* CUPnPAVTimer::NewL( MUPnPAVTimerCallback& aObserver,
+    TAVTimerType aType )
+    {
+    CUPnPAVTimer* timer = new(ELeave) CUPnPAVTimer( aObserver, aType );
+    CleanupStack::PushL( timer );
+    timer->ConstructL();
+    CleanupStack::Pop();
+    return timer;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVTimer::~CUPnPAVTimer
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+CUPnPAVTimer::~CUPnPAVTimer()
+    { 
+    Cancel();
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVTimer::CUPnPAVTimer
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+CUPnPAVTimer::CUPnPAVTimer( MUPnPAVTimerCallback& aObserver,
+    TAVTimerType aType ) :
+    CTimer( EPriorityStandard ),
+    iObserver( aObserver ),
+    iTimerType( aType )
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVTimer::ConstructL
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+void CUPnPAVTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAVTimer::RunL
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+void CUPnPAVTimer::RunL()
+    {
+    iObserver.UPnPAVTimerCallback( iTimerType );        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAVTimer::Start
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+void CUPnPAVTimer::Start( TInt aIntervalInSecs )
+    {
+    __ASSERTD( !IsActive(), __FILE__, __LINE__  )
+    After( TTimeIntervalMicroSeconds32( aIntervalInSecs * KMillion ) );
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpbrowsingsession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,2618 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      server impl. of session against media server
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <utf.h> 
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include <centralrepository.h>
+
+// upnp stack api
+#include <upnpstring.h>
+#include <upnpdevice.h>
+#include <upnpcontainer.h>
+#include <upnpservice.h>
+#include <upnpitem.h>
+#include <upnpelement.h>
+#include <upnpmediaserversettings.h>
+#include <upnpmediaserverclient.h>
+#include <upnpmediaservernotifier.h>
+#include <upnpfiletransferevent.h>
+
+#include <upnpavcontrolpoint.h>
+
+// upnpframework / avcontroller api
+#include "upnpavrenderingsessionobserver.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for upnp-specific stuff
+#include "upnpfileutility.h"
+#include "upnpitemutility.h"
+
+// upnpframework / xml parser api
+#include "upnpxmlparser.h"
+
+// upnpframework / internal api's
+#include "upnpcontentservercrkeys.h"
+#include "upnpcommonutils.h"
+#include "upnpcdsreselementutility.h"
+#include "upnpmetadatafetcher.h"
+
+// avcontroller internal
+#include "upnpfilesharingactive.h"
+#include "upnpavdispatcher.h"
+#include "upnpavbrowserequest.h"
+#include "upnpavrequest.h"
+#include "upnpaverrorhandler.h"
+#include "upnpavdeviceextended.h"
+#include "upnpdevicerepository.h"
+#include "upnpavbrowserespparams.h"
+#include "upnpavcontrollerserver.h"
+#include "upnpbrowsingsession.h"
+
+// CONSTANTS
+_LIT8( KDirectChildren,         "BrowseDirectChildren" );
+_LIT8( KMetaData,               "BrowseMetadata" );
+_LIT8( KImportUri,              "importUri" );
+_LIT8( KCreateClass,            "upnp:createClass" );
+_LIT8( KBrowseMetadata,         "BrowseMetadata" );
+const TInt KDefaultInstanceId   = 0;
+const TInt KExpectedCount       = 1;
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::NewL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+CUPnPBrowsingSession* CUPnPBrowsingSession::NewL
+    (
+    RUpnpMediaServerClient& aClient,
+    CUpnpAVControllerServer& aServer,
+    TInt aSessionId,
+    const TDesC8& aUuid
+    )
+    {
+    CUPnPBrowsingSession* self = new (ELeave) CUPnPBrowsingSession(
+        aClient, aServer, aSessionId );
+    CleanupStack::PushL( self );    
+    
+    self->ConstructL( aUuid );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CUPnPBrowsingSession
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+CUPnPBrowsingSession::CUPnPBrowsingSession
+    (
+    RUpnpMediaServerClient& aClient,
+    CUpnpAVControllerServer& aServer,
+    TInt aSessionId
+    ):
+    iMediaServer( aClient ),
+    iServer( aServer ),
+    iSessionId( aSessionId ),
+    
+    iInstanceId( KDefaultInstanceId ),
+    iIPSessionId( KErrNotFound ),
+
+    iTransferId( KErrNotFound ),
+
+    iTransferEventReceived( EFalse ),
+    iInternalState( ENone ),
+    iCopyState( EIdle )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::~CUPnPBrowsingSession
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+CUPnPBrowsingSession::~CUPnPBrowsingSession()
+    {
+    iIPSessionId = KErrNotFound;
+    
+    delete iDevice;
+    delete iRespBuf;
+    delete iRespBuf2;
+    
+    delete iImportURI;
+    delete iSourceURI;
+    
+    delete iItemId;
+    
+    delete iContainerId;
+    
+    delete iSharedItem;
+    
+    delete iMediaServerNotifier;
+    
+    delete iFileSharing;      
+    
+    delete iLocalMediaServerUuid; 
+    
+    delete iOriginalLocation;
+    
+    delete iFilePath;
+    
+    delete iMSSettings; 
+    delete iAppSettings;
+    
+    delete iActionMessage;
+    delete iDeviceMessage;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::ConstructL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::ConstructL( const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPBrowsingSession::ConstructL" );
+    
+    iMediaServerNotifier = CUpnpMediaServerNotifier::NewL( this );
+    iFileSharing = CUPnPFileSharingActive::NewL();
+
+    // Get the local Media Server Uuid, if available
+    const RPointerArray<CUpnpAVDeviceExtended>& devList =
+        iServer.DeviceRepository().DeviceList();
+    TInt count = devList.Count();
+    TInt i;
+    for( i = 0; i < count; i++ )
+        {
+        if( devList[ i ]->Local() )
+            {
+            __ASSERTD( !iLocalMediaServerUuid, __FILE__, __LINE__ );
+            iLocalMediaServerUuid = devList[i]->Uuid().AllocL();
+            }
+        if( devList[ i ]->Uuid() == aUuid )
+            {
+            __ASSERTD( !iDevice, __FILE__, __LINE__ );
+            iDevice = CUpnpAVDeviceExtended::NewL( *devList[ i ] );
+            }             
+        }
+    if( !iDevice )
+        {
+        if( aUuid == KNullDesC8 ) // Fix to enable AV Controller helper usage
+            {
+            iDevice = CUpnpAVDeviceExtended::NewL();
+            }
+        else
+            {
+            User::Leave( KErrNotFound );    
+            }    
+        }
+        
+    iMSSettings = CUpnpMediaServerSettings::NewL();
+    iAppSettings = CRepository::NewL( KCrUidUpnpContentserver );   
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::RcSetVolumeResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::RcSetVolumeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& /*aDesiredVolume*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::RcVolumeResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::RcVolumeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& /*aCurrentVolume*/)
+    {
+    // No implementation required                           
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::RcSetMuteResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::RcSetMuteResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& /*aDesiredMute*/ )
+    {
+    // No implementation required   
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::RcMuteResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::RcMuteResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& /*aCurrentMute*/ )
+    {
+    // No implementation required                      
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtSetTransportUriResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtSetTransportUriResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aCurrentUri*/,
+    const TDesC8& /*aCurrentUriMetaData*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtSetNextTransportUriResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtSetNextTransportUriResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNextUri*/,
+    const TDesC8& /*aNextUriMetaData*/)
+    {
+    // No implementation required        
+    }
+  
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtMediaInfoResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtMediaInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNrTracks*/,
+    const TDesC8& /*aMediaDuration*/,
+    const TDesC8& /*aCurrentUri*/,
+    const TDesC8& /*aCurrentUriMetaData*/,
+    const TDesC8& /*aNextUri*/,
+    const TDesC8& /*aNextUriMetaData*/,
+    const TDesC8& /*aPlayMedium*/,
+    const TDesC8& /*aRecordMedium*/,
+    const TDesC8& /*aWriteStatus*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtGetTransportInfoResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtGetTransportInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aCurrenTransportState*/,
+    const TDesC8& /*aCurrentTransportStatus*/,
+    const TDesC8& /*aCurrentSpeed*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtPositionInfoResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtPositionInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aTrack*/,
+    const TDesC8& /*aTrackDuration*/,
+    const TDesC8& /*aTrackMetaData*/,
+    const TDesC8& /*aTrackURI*/,
+    const TDesC8& /*aRelTime*/,
+    const TDesC8& /*aAbsTime*/,
+    const TDesC8& /*aRelCount*/,
+    const TDesC8& /*aAbsCount*/)
+    {
+    // No implementation required                
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtDeviceCapabilitiesResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtDeviceCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aPlayMedia*/,
+    const TDesC8& /*aRecMedia*/,
+    const TDesC8& /*aRecQualityMode*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtTransportSettingsResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtTransportSettingsResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aPlayMode*/,
+    const TDesC8& /*aRecQualityMode*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtStopResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtStopResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtPlayResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtPlayResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aSpeed*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtPauseResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtPauseResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtRecordResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtRecordResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtSeekResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtSeekResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aUnit*/,
+    const TDesC8& /*aTarget*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtNextResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtNextResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtPreviousResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtPreviousResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtSetPlayModeResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtSetPlayModeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNewPlayMode*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtSetRecordModeResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtSetRecordModeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNewRecordQuality*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsSearchCapabilitiesResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsSearchCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aSearchCaps)
+    {
+    __LOG1( "CUPnPBrowsingSession::CdsSearchCapabilitiesResponse: %d",
+        aErr );
+    
+    __ASSERTD( iIPSessionId == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionId );
+    iIPSessionId = KErrNotFound;
+    //iActionPending = EFalse;
+    
+    if( iActionMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPContentDirectoryError );    
+        
+        if( aErr == KErrNone )
+            {
+            if(  aSearchCaps != KNullDesC8 )
+                {
+                delete iRespBuf; iRespBuf = NULL;
+                iRespBuf = aSearchCaps.Alloc();
+                if( iRespBuf )
+                    {
+                    TPckg<TInt> resp1( aSearchCaps.Length() );
+                    iActionMessage->Write( 1, resp1 );
+                    }
+                else
+                    {
+                    TPckg<TInt> resp1( 0 );
+                    iActionMessage->Write( 1, resp1 );
+                    }
+                
+                iActionMessage->Complete(
+                    EAVControllerGetSearchCapabilitiesSizeCompleted );      
+                delete iActionMessage; iActionMessage = NULL;
+                }
+            else
+                {
+                TPckg<TInt> resp1( 0 );
+                iActionMessage->Write( 1, resp1 );
+
+                iActionMessage->Complete(
+                    EAVControllerGetSearchCapabilitiesSizeCompleted );
+                delete iActionMessage; iActionMessage = NULL;
+                }    
+            }
+        else
+            {
+            iActionMessage->Complete( aErr );
+            delete iActionMessage; iActionMessage = NULL;
+            }        
+        }
+    else
+        {
+        __LOG( "CdsSearchCapabilitiesResponse - no msg" );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsSortCapabilitiesResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsSortCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSortCaps*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsSystemUpdateIdResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsSystemUpdateIdResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*aSystemUpdateId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsBrowseResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsBrowseResponse(
+    const TDesC8& aUuid,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aObjectID*/,
+    const TDesC8&  aBrowseFlag,
+    const TDesC8&  /*aFilter*/,
+    TInt /*aIndex*/,
+    TInt /*aRequest*/,
+    const TDesC8&  /*aSortCriteria*/,
+    const TDesC8&  aResult,
+    TInt aReturned,
+    TInt aMatches,
+    const TDesC8&  aUpdateID )
+    {
+    __LOG1( "CUPnPBrowsingSession::CdsBrowseResponse: %d", aErr );
+    
+    __ASSERTD( iIPSessionId == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionId );
+    iIPSessionId = KErrNotFound;
+    
+    if( iActionMessage )
+        {
+        if (  aBrowseFlag.CompareF( KBrowseMetadata ) == 0 && aReturned == 0 
+                && aErr != KErrCouldNotConnect && aErr != KErrHostUnreach )
+            {
+            aErr = ENoSuchObject;  //the file not exist;
+            }
+        
+        if ( aErr != KErrCouldNotConnect && aErr != KErrHostUnreach )
+            {
+            aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPContentDirectoryError );
+            __LOG1( "CUPnPBrowsingSession::CdsBrowseResponse:001 %d", aErr );
+            }    
+    
+        if( aErr == KErrNone )
+            {
+            if(  aResult != KNullDesC8 )
+                {
+                
+                if( iInternalState == ECopyToPhone )
+                    {
+                    TRAP( aErr, SendCreateObjectActionL(
+                        *iLocalMediaServerUuid, KContainerIdAny, aResult ) );
+                    if( aErr )
+                        {
+                        iInternalState = ENone;
+                        iActionMessage->Complete( aErr );
+                        delete iActionMessage; iActionMessage = NULL;
+                        }                    
+                    }
+                else if( iInternalState == ECopyLocal )
+                    {
+                    TRAP( aErr, CheckAndSendCreateObjectActionL( aResult ) );
+                    if( aErr )
+                        {
+                        iInternalState = ENone;
+                        iActionMessage->Complete( aErr );
+                        delete iActionMessage; iActionMessage = NULL;
+                        }
+                    }
+                else if( iInternalState == EDestroyObject )
+                    {
+                    TRAP( aErr, CheckAndSendDestroyObjectActionL( aResult) );
+                    if( aErr )    
+                        {
+                        iInternalState = ENone;
+                        iActionMessage->Complete( aErr );
+                        delete iActionMessage; iActionMessage = NULL;
+                        }
+                    }    
+                else // Browse
+                    {
+                    delete iRespBuf; iRespBuf = NULL;
+                    delete iRespBuf2; iRespBuf2 = NULL;
+                    iRespBuf = aResult.Alloc();
+                    iRespBuf2 = aUpdateID.Alloc();
+                         
+                    if( iRespBuf && iRespBuf2 )
+                        {
+                        TUpnpAVBrowseRespParams params;
+                        TPckg<TUpnpAVBrowseRespParams> resp2( params );
+                        params.iMatches = aReturned ;
+                        params.iTotalCount = aMatches;
+                        params.iResponseSize = aResult.Length();
+                        params.iUpdateIdSize = aUpdateID.Length();
+                        iActionMessage->Write( 2, resp2 );
+                        iActionMessage->Complete( 
+                            EAVControllerGetBrowseResponseSizeCompleted );
+                        }
+                    else
+                        {
+                        delete iRespBuf; iRespBuf = NULL;
+                        delete iRespBuf2; iRespBuf2 = NULL;
+                        iActionMessage->Complete( KErrNoMemory );
+                        }
+                    iInternalState = ENone;
+                    delete iActionMessage; iActionMessage = NULL;      
+                    }    
+                }
+            else
+                {
+                if( iInternalState == EBrowse )
+                    {
+                    TUpnpAVBrowseRespParams params;
+                    TPckg<TUpnpAVBrowseRespParams> resp2( params );
+                    params.iMatches = 0;
+                    params.iTotalCount = 0;
+                    params.iResponseSize = 0;
+                    params.iUpdateIdSize = 0;
+                    iActionMessage->Write( 2, resp2 );
+
+                    iInternalState = ENone;
+                    iActionMessage->Complete(
+                        EAVControllerGetBrowseResponseSizeCompleted );
+                    delete iActionMessage; iActionMessage = NULL;
+                    }
+                else
+                    {
+                    iInternalState = ENone;
+                    iActionMessage->Complete( aErr );
+                    delete iActionMessage; iActionMessage = NULL;
+                    }        
+                }    
+            }
+        else
+            {
+            iInternalState = ENone;
+            iActionMessage->Complete( aErr );
+            delete iActionMessage; iActionMessage = NULL;
+            if ( KErrCouldNotConnect == aErr || KErrHostUnreach == aErr )
+                {                 
+                iServer.DeviceDisappearedL( aUuid );
+                }
+            }            
+        }
+    else
+        {
+        __LOG( "CdsBrowseResponse - no msg" );
+        }    
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsSearchResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsSearchResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aContainerId*/,
+    const TDesC8& /*aSearchCriteria*/,
+    const TDesC8& /*aFilter*/,
+    TInt /*aIndex*/,
+    TInt /*aRequest*/,
+    const TDesC8& /*aSortCriteria*/,
+    const TDesC8& aResult,
+    TInt aReturned,
+    TInt aMatches,
+    const TDesC8& aUpdateID )
+    {
+    __LOG1( "CUPnPBrowsingSession::CdsSearchResponse: %d", aErr );
+    
+    __ASSERTD( iIPSessionId == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionId );
+    //iActionPending = EFalse;
+    iIPSessionId = KErrNotFound;
+    
+    if( iActionMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPContentDirectoryError );    
+        
+        if( aErr == KErrNone )
+            {
+            if(  aResult != KNullDesC8 )
+                {
+                delete iRespBuf; iRespBuf = NULL;
+                delete iRespBuf2; iRespBuf2 = NULL;
+                iRespBuf = aResult.Alloc();
+                iRespBuf2 = aUpdateID.Alloc();
+
+                if( iRespBuf && iRespBuf2 )
+                    {
+                    TUpnpAVBrowseRespParams params;
+                    TPckg<TUpnpAVBrowseRespParams> resp2( params );
+                    params.iMatches = aReturned ;
+                    params.iTotalCount = aMatches;
+                    params.iResponseSize = aResult.Length();
+                    params.iUpdateIdSize = aUpdateID.Length();
+                    iActionMessage->Write( 2, resp2 );                    
+                    iActionMessage->Complete(
+                         EAVControllerGetSearchResponseSizeCompleted );
+                    }
+                else
+                    {
+                    delete iRespBuf; iRespBuf = NULL;
+                    delete iRespBuf2; iRespBuf2 = NULL;
+                    iActionMessage->Complete( KErrNoMemory );
+                    }
+                delete iActionMessage; iActionMessage = NULL;       
+                }
+            else
+                {
+                TUpnpAVBrowseRespParams params;
+                TPckg<TUpnpAVBrowseRespParams> resp2( params );
+                params.iMatches = 0;
+                params.iTotalCount = 0;
+                params.iResponseSize = 0;
+                params.iUpdateIdSize = 0;
+                iActionMessage->Write( 2, resp2 );                    
+
+                iActionMessage->Complete(
+                    EAVControllerGetSearchResponseSizeCompleted );
+                delete iActionMessage; iActionMessage = NULL;       
+                }    
+            }
+        else
+            {
+            iActionMessage->Complete( aErr );
+            delete iActionMessage; iActionMessage = NULL;       
+            }                                     
+        }
+    else
+        {
+        __LOG( "CdsSearchResponse - no msg" );
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsDestroyObjectResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsDestroyObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aObjectId*/ )
+    {
+    __LOG1( "CUPnPBrowsingSession::CdsDestroyObjectResponse: %d", aErr );
+    
+    __ASSERTD( iIPSessionId == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionId );
+    iIPSessionId = KErrNotFound;
+    
+    iInternalState = ENone;
+    
+    if( iActionMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPContentDirectoryError );    
+        
+        if( aErr == KErrNone )
+            {
+            iActionMessage->Complete( EAVControllerDeleteObjectCompleted );
+            delete iActionMessage; iActionMessage = NULL;
+            }
+        else
+            {
+            iActionMessage->Complete( aErr );
+            delete iActionMessage; iActionMessage = NULL;
+            }            
+        }
+    else
+        {
+        __LOG( "CdsDestroyObjectResponse - no msg" );
+        }      
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsUpdateObjectResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsUpdateObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aObjectId*/,
+    const TDesC8& /*aCurrentTagValue*/,
+    const TDesC8& /*aNewTagValue*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsImportResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsImportResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aSourceURI*/,
+    const TDesC8& /*aDestinationURI*/,
+    const TDesC8& aTransferId )
+    {
+    __LOG1( "CUPnPBrowsingSession::CdsImportResponse: %d", aErr );
+    
+    __ASSERTD( iIPSessionId == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionId );
+    iIPSessionId = KErrNotFound;
+    
+    aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+        EUPnPContentDirectoryError );    
+    
+    if( aErr == KErrNone )
+        {
+        
+        TLex8 lex( aTransferId );
+        aErr = lex.Val( iTransferId );
+        
+        CopyFinished( aErr, EFalse );
+        }
+    else
+        {
+        CopyFinished( aErr, EFalse );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsExportResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsExportResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aSourceURI*/,
+    const TDesC8& /*aDestinationURI*/,
+    const TDesC8& aTransferId )
+    {
+    __LOG1( "CUPnPBrowsingSession::CdsExportResponse: %d", aErr );
+    
+    __ASSERTD( iIPSessionId == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionId );
+    iIPSessionId = KErrNotFound;
+    
+    aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+        EUPnPContentDirectoryError );    
+    
+    if( aErr == KErrNone )
+        {
+        TLex8 lex( aTransferId );
+        aErr = lex.Val( iTransferId );        
+
+        CopyFinished( aErr, EFalse );            
+        }
+    else
+        {
+                    
+        CopyFinished( aErr, EFalse );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsStopTransferResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsStopTransferResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aTransferId*/ )
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsCTransferProgressResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsCTransferProgressResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aTransferId*/,
+    const TDesC8& /*aTransferStatus*/,
+    const TDesC8& /*aTransferLength*/,            
+    const TDesC8& /*aTransferTotal*/ )
+    { 
+    // No implementation required              
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsDeleteResourceResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsDeleteResourceResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aResourceUri*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsCreateReferenceResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsCreateReferenceResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aContainerId*/, 
+    const TDesC8& /*aObjectId*/, 
+    const TDesC8& /*aNewId*/ )
+    {
+    // No implementation required            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsCreateObjectResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsCreateObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aContainerID*/, 
+    const TDesC8& /*aElements*/, 
+    const TDesC8& aObjectID, 
+    const TDesC8& aResult )
+    {
+    __LOG1( "CUPnPBrowsingSession::CdsCreateObjectResponse: %d" , aErr );
+    
+    __ASSERTD( iIPSessionId == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionId );
+    //iActionPending = EFalse;
+    iIPSessionId = KErrNotFound;
+    
+    aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+        EUPnPContentDirectoryError );
+        
+    if( aErr == KErrNone )
+        {
+        if( iInternalState == ECopyLocal ||
+            iInternalState == ECopyToPhone )
+            {      
+            delete iImportURI; iImportURI = NULL;
+            TRAP( aErr, iImportURI = ParseCreateObjectResponseL( aResult ) );
+            if( aErr == KErrNone )
+                {
+                if( iSourceURI )
+                    {
+                    if( iInternalState == ECopyLocal )
+                        {
+                        // Export from the local Media Server to the
+                        // Remote Media Server
+                        delete iItemId;
+                        iItemId = aObjectID.Alloc(); // Null ok at this point
+                        
+                        TRAP( aErr, SendExportActionL() );
+                        if( aErr )
+                            {
+                            CopyFinished( aErr, EFalse );
+                            }                                          
+                        }
+                    else // iInternalState == ECopyToPhone
+                        {
+                        TRAP( aErr, SendImportActionL() );
+                        if( aErr )
+                            {
+                            CopyFinished( aErr, EFalse );
+                            }
+                        }        
+                    }
+                else
+                    {
+                    CopyFinished( KErrGeneral, EFalse );
+                    }                
+                }
+            else
+                {
+                CopyFinished( aErr, EFalse );
+                } 
+            }
+        else // Create container
+            {
+            if( iActionMessage )
+                {
+                HBufC8* objectID = HBufC8::New( aObjectID.Length() );
+                if( objectID )
+                    {
+                    objectID->Des().Copy( aObjectID );
+                    iActionMessage->Write( 1, *objectID );
+                    iActionMessage->Complete(
+                        EAVControllerCreateContainerCompleted );
+                    delete objectID;                
+                    }
+                else
+                    {
+                    iActionMessage->Write( 1, KNullDesC8 );
+                    iActionMessage->Complete( KErrNoMemory );
+                    }    
+                delete iActionMessage; iActionMessage = NULL;
+                }
+            iInternalState = ENone;                                
+            }                
+        }
+    else
+        {
+        if( iInternalState == ECopyLocal ||
+            iInternalState == ECopyToPhone )
+            {
+            CopyFinished( aErr, EFalse );
+            }
+        else
+            {
+            // Create container failed
+            iInternalState = ENone;
+            iActionMessage->Complete( aErr );
+            delete iActionMessage; iActionMessage = NULL;                    
+            }
+        }                                       
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CmProtocolInfoResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CmProtocolInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSource*/, 
+    const TDesC8& /*aSink*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CmPrepareResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CmPrepareResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aRemoteProtocolInfo*/,
+   const TDesC8& /*aPeerConnectionManager*/,
+    const TDesC8& /*aPeerConnectionId*/,
+    const TDesC8& /*aDirection*/,
+    TInt /*aConnection*/,
+    TInt /*aTransport*/,
+    TInt /*aRsc*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CmComplete
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CmComplete(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*aConnection*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CmCurrentConnections
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CmCurrentConnections(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aConnections*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CmCurrentInfo
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CmCurrentInfo(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*rscId*/, 
+    TInt /*transportId*/, 
+    const TDesC8& /*aProtocolInfo*/,
+    const TDesC8& /*aPeerConnectionManager*/, 
+    TInt /*peerId*/, 
+    const TDesC8& /*aDirection*/, 
+    const TDesC8& /*aStatus*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsUpdateEvent
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsUpdateEvent(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSystemUpdateId*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsContainerEvent
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsContainerEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aConteinerIds*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CdsTransferEvent
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CdsTransferEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aTransferIds*/
+        )
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::RcLastChangeEvent
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::RcLastChangeEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aLastChange*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::AvtLastChangeEvent
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::AvtLastChangeEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aLastChange*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CmSourceEvent
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CmSourceEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aSource*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CmSinkEvent
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CmSinkEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aSink*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CmConnectionsEvent
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CmConnectionsEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aConnections*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::HttpResponseL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::HttpResponseL( CUpnpHttpMessage* /*aMessage*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::DeviceDiscoveredL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::DeviceDiscoveredL( CUpnpDevice* /*aDevice*/ )
+    {
+    // No implementation required            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::DeviceDisappearedL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::DeviceDisappearedL( CUpnpDevice* /*aDevice*/ )
+    {
+    // No implementation required                  
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::FileTransferEvent
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::FileTransferEvent(
+    CUpnpFileTransferEvent *aEvent )
+    {
+    __ASSERTD( aEvent, __FILE__, __LINE__ );
+    
+    __LOG1( "CUPnPBrowsingSession::FileTransferEvent, %d",
+        aEvent->ErrorCode() );
+    
+    TInt err = UPnPAVErrorHandler::ConvertToSymbianErrorCode(
+        aEvent->ErrorCode(), EUPnPContentDirectoryError );    
+
+    if( aEvent->TransferId() == iTransferId )
+        {
+        iTransferId = KErrNotFound;            
+        if( iInternalState == ECopyLocal )
+            {
+            if( iActionMessage )
+                {
+                CopyFinished( err, ETrue );    
+                }
+            else
+                {
+                // Msg not received, set the flag instead
+                iAsyncErr = err;
+                iTransferEventReceived = ETrue;
+                }                  
+            }
+        else if( iInternalState == ECopyToPhone )
+            {                  
+            TRAPD( err, HandleCopyToPhoneEventL( *aEvent, err ) );
+            if ( err )
+                {
+                 __LOG1( "CUPnPBrowsingSession::FileTransferEvent, %d",
+                         err );
+                }                                          
+            }
+        }
+
+    delete aEvent;        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::HandleCopyToPhoneEventL
+// Handle CopyToPhoneEvent,and all leave function will move 
+// to this function
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::HandleCopyToPhoneEventL( 
+         CUpnpFileTransferEvent& aEvent,
+         TInt aError )
+    {
+    HBufC8* filepath = HBufC8::NewL( KMaxPath );
+    CleanupStack::PushL( filepath );
+    
+    HBufC8* eventpath = CnvUtfConverter::ConvertFromUnicodeToUtf8L( 
+        aEvent.FilePath() );
+    filepath->Des().Copy( *eventpath );
+    delete eventpath;
+    eventpath = NULL;
+
+    if ( iActionMessage )
+        {
+        TInt res = iActionMessage->Write( 1, *filepath );
+        if ( res )
+            {
+            __LOG1( "CUPnPBrowsingSession::HandleCopyToPhoneEventL, %d",
+                    res );
+            }
+        // clean up
+        CleanupStack::PopAndDestroy( filepath );
+        }
+    else
+        {
+        iFilePath = filepath;
+        
+        // clean up
+        CleanupStack::Pop( filepath );        
+        }
+
+    if ( iActionMessage )
+        {
+        CopyFinished( aError, ETrue );
+        }
+    else
+        {
+        // Msg not received yet, set the flag instead
+        iAsyncErr = aError;
+        iTransferEventReceived = ETrue;
+        }  
+    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::NotifierError
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::NotifierError( TInt aError )
+    {
+    __LOG( "CUPnPBrowsingSession::NotifierError" );
+    
+    if( iActionMessage )
+        {
+        if( iInternalState == ECopyLocal ||
+            iInternalState == ECopyToPhone )
+            {
+            CopyFinished( aError, ETrue );
+            }
+        }
+    else
+        {
+        // Msg not received yet, set the flag instead
+        iAsyncErr = aError;
+        iTransferEventReceived = ETrue;        
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::DeviceDisappearedL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::DeviceDisappearedL(
+    CUpnpAVDeviceExtended& aDevice )
+    {
+    __LOG( "CUPnPBrowsingSession::DeviceDisappearedL" );
+    
+    if( aDevice.Local() )
+        {
+        delete iLocalMediaServerUuid; iLocalMediaServerUuid = NULL; 
+        }
+    else if( iDeviceMessage ) // Target device
+        {
+        iDeviceMessage->Complete( KErrNone );
+        delete iDeviceMessage; iDeviceMessage = NULL;
+        }     
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::SetLocalMSUuidL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::SetLocalMSUuidL( const TDesC8& aUuid )
+    {
+    HBufC8* tmp = aUuid.AllocL();
+    delete iLocalMediaServerUuid;
+    iLocalMediaServerUuid = tmp; 
+    }
+ 
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::SessionId
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+TInt CUPnPBrowsingSession::SessionId() const
+    {
+    return iSessionId;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::Uuid
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+const TDesC8& CUPnPBrowsingSession::Uuid() const
+    {
+    if( iDevice )
+        {
+        return iDevice->Uuid();
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::GetBrowseResponseSizeL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::GetBrowseResponseSizeL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPBrowsingSession::GetBrowseResponseSizeL" );
+    
+    __ASSERTD( !iActionMessage, __FILE__, __LINE__ );
+
+    ResetL();
+        
+    CUpnpAVBrowseRequest* tmpRequest = CUpnpAVBrowseRequest::NewLC();
+    
+    ReadBrowseReqFromMessageL( aMessage, 1, tmpRequest );
+        
+    if( tmpRequest->BrowseFlag() == MUPnPAVBrowsingSession::EDirectChildren )
+        {
+        iIPSessionId = iServer.ControlPoint().CdsBrowseActionL(
+                iDevice->Uuid(),
+                tmpRequest->Id(),
+                KDirectChildren,
+                tmpRequest->Filter(), 
+                tmpRequest->StartIndex(),
+                tmpRequest->RequestedCount(),
+                tmpRequest->SortCriteria() );        
+        }
+    else
+        {
+        iIPSessionId = iServer.ControlPoint().CdsBrowseActionL(
+                iDevice->Uuid(),
+                tmpRequest->Id(),
+                KMetaData,
+                tmpRequest->Filter(), 
+                tmpRequest->StartIndex(),
+                tmpRequest->RequestedCount(),
+                tmpRequest->SortCriteria() );                
+        }    
+    
+
+    CleanupStack::PopAndDestroy( tmpRequest );
+   
+     if( iIPSessionId > 0 )
+        {
+        // Register
+        iInternalState = EBrowse;
+        iServer.Dispatcher().RegisterL( iIPSessionId, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionId );
+        }
+        
+    iActionMessage = new (ELeave) RMessage2( aMessage );    
+    }
+ 
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CancelGetBrowseResponseSizeL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CancelGetBrowseResponseSizeL()
+    {
+    __LOG( "CUPnPBrowsingSession::CancelGetBrowseResponseSizeL" );
+    
+    if( iActionMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionId );
+        iActionMessage->Complete( KErrCancel );
+        delete iActionMessage; iActionMessage = NULL;         
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::GetBrowseResponseL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::GetBrowseResponseL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPBrowsingSession::GetBrowseResponseL" );
+    
+   __ASSERTD( !iActionMessage, __FILE__, __LINE__ );
+
+    iIPSessionId = KErrNotFound;
+    if( iRespBuf && iRespBuf2 )
+        {
+        aMessage.WriteL( 1, *iRespBuf );
+        aMessage.WriteL( 2, *iRespBuf2 );
+        delete iRespBuf; iRespBuf = NULL;
+        delete iRespBuf2; iRespBuf2 = NULL;
+        aMessage.Complete( EAVControllerGetBrowseResponseCompleted );    
+        }
+    else
+        {
+        //Memory allocaton failed
+        delete iRespBuf; iRespBuf = NULL;
+        delete iRespBuf2; iRespBuf2 = NULL;
+        User::Leave( KErrNoMemory );
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::GetSearchResponseSizeL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::GetSearchResponseSizeL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPBrowsingSession::GetSearchResponseSizeL" );
+    
+    __ASSERTD( !iActionMessage, __FILE__, __LINE__ );
+
+    ResetL();
+    
+    
+    CUpnpAVBrowseRequest* tmpRequest = CUpnpAVBrowseRequest::NewLC();
+    
+    ReadBrowseReqFromMessageL( aMessage, 1, tmpRequest );
+  
+    iIPSessionId = iServer.ControlPoint().CdsSearchActionL(
+        iDevice->Uuid(),
+        tmpRequest->Id(),
+        tmpRequest->SearchCriteria(),
+        tmpRequest->Filter(), 
+        tmpRequest->StartIndex(),
+        tmpRequest->RequestedCount(),
+        tmpRequest->SortCriteria() );                
+
+    CleanupStack::PopAndDestroy( tmpRequest );
+    
+     if( iIPSessionId > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionId, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionId );
+        }
+    iActionMessage = new (ELeave) RMessage2( aMessage );      
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CancelGetSearchResponseSizeL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CancelGetSearchResponseSizeL()
+    {
+    __LOG( "CUPnPBrowsingSession::CancelGetSearchResponseSizeL" );
+    
+    if( iActionMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionId );
+        iActionMessage->Complete( KErrCancel );
+        delete iActionMessage; iActionMessage = NULL;               
+        }
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::GetSearchResponseL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::GetSearchResponseL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPBrowsingSession::GetSearchResponseL" );
+    
+    __ASSERTD( !iActionMessage, __FILE__, __LINE__ );
+
+    iIPSessionId = KErrNotFound;
+    if( iRespBuf && iRespBuf2 )
+        {
+        aMessage.WriteL( 1, *iRespBuf );
+        aMessage.WriteL( 2, *iRespBuf2 );
+        delete iRespBuf; iRespBuf = NULL;
+        delete iRespBuf2; iRespBuf2 = NULL;
+        aMessage.Complete( EAVControllerGetSearchResponseCompleted );    
+        }
+    else
+        {
+        //Memory allocaton failed
+        delete iRespBuf; iRespBuf = NULL;
+        delete iRespBuf2; iRespBuf2 = NULL;
+        User::Leave( KErrNoMemory );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::GetSearchCapabitiesSizeL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::GetSearchCapabitiesSizeL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPBrowsingSession::GetSearchCapabitiesSizeL" );
+    
+    __ASSERTD( !iActionMessage, __FILE__, __LINE__ );
+
+    ResetL();
+  
+    iIPSessionId = iServer.ControlPoint().CdsSearchCapabilitiesActionL(
+        iDevice->Uuid() );
+    
+    if( iIPSessionId > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionId, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionId );
+        }
+    iActionMessage = new (ELeave) RMessage2( aMessage );    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CancelGetSearchCapabitiesSizeL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CancelGetSearchCapabitiesSizeL()
+    {
+    __LOG( "CUPnPBrowsingSession::CancelGetSearchCapabitiesSizeL" );
+    
+    if( iActionMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionId );
+        iActionMessage->Complete( KErrCancel );
+        delete iActionMessage; iActionMessage = NULL;                   
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::GetSearchCapabitiesL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::GetSearchCapabitiesL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPBrowsingSession::GetSearchCapabitiesL" );
+    
+    iIPSessionId = KErrNotFound;
+    
+    aMessage.WriteL( 1, *iRespBuf );
+    aMessage.Complete( EAVControllerGetSearchCapabilitiesCompleted );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CreateContainerL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CreateContainerL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPBrowsingSession::CreateContainerL" );       
+    
+    __ASSERTD( !iActionMessage, __FILE__, __LINE__ );
+    
+    ResetL();
+        
+    // Title
+    TInt len = aMessage.GetDesMaxLength( 1 );
+    HBufC8* tempTitle = HBufC8::NewLC( len );
+    TPtr8 ptr( tempTitle->Des() );
+    aMessage.ReadL( 1, ptr );
+
+    // Container ID
+    len = aMessage.GetDesMaxLength( 2 );
+    HBufC8* tempId = HBufC8::NewLC( len );
+    ptr.Set( tempId->Des() );
+    aMessage.ReadL( 2, ptr );
+    
+    if( iDevice->DlnaCompatible() && !iDevice->CreateChildContainer()
+        && *tempId != KContainerIdAny )
+        {
+        // The device is DLNA compatible and does not support creation
+        // of a child container
+        User::Leave( KErrNotSupported );
+        }
+            
+    // Container type
+    MUPnPAVBrowsingSession::TContainerType type =
+            (MUPnPAVBrowsingSession::TContainerType)aMessage.Int3();
+
+    // Create a container object
+    CUpnpContainer* tmpContainer = CUpnpContainer::NewL();
+    CleanupStack::PushL( tmpContainer );
+    
+    // Set the title and the parent ID
+    tmpContainer->SetTitleL( *tempTitle );
+    tmpContainer->SetParentIdL( *tempId );
+    
+    // Set the object type
+    if( type == MUPnPAVBrowsingSession::EPlaylistContainer )
+        {
+        tmpContainer->SetObjectClassL( KClassPlaylist() );
+        }
+    else
+        {
+        tmpContainer->SetObjectClassL( KClassStorage() );
+        }
+
+    HBufC8* xmlDoc = CUPnPXMLParser::ContainerToXmlLC( *tmpContainer );  
+
+    iIPSessionId = iServer.ControlPoint().CdsCreateObjectActionL(
+        iDevice->Uuid(), *tempId, *xmlDoc );
+
+
+    CleanupStack::PopAndDestroy( xmlDoc );
+    CleanupStack::PopAndDestroy( tmpContainer );
+    CleanupStack::PopAndDestroy( tempId );
+    CleanupStack::PopAndDestroy( tempTitle );
+   
+     if( iIPSessionId > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionId, *this );
+        iInternalState = ECreateContainer; 
+        }
+    else
+        {
+        User::Leave( iIPSessionId );
+        }
+    iActionMessage = new (ELeave) RMessage2( aMessage );         
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CancelCreateContainerL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CancelCreateContainerL()
+    {
+    __LOG( "CUPnPBrowsingSession::CancelCreateContainerL" );       
+    
+    if( iActionMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionId );
+        iActionMessage->Complete( KErrCancel );
+        delete iActionMessage; iActionMessage = NULL;        
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::DeleteObjectL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::DeleteObjectL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPBrowsingSession::DeleteObjectL" );       
+    
+    __ASSERTD( !iActionMessage, __FILE__, __LINE__ );
+    
+    ResetL();
+    
+    TInt len = aMessage.GetDesMaxLength( 1 );
+    HBufC8* tempId = HBufC8::NewLC( len );
+    TPtr8 ptr( tempId->Des() );
+    aMessage.ReadL( 1, ptr );
+    
+    CleanupStack::Pop( tempId );
+    delete iItemId;
+    iItemId = tempId;
+    
+            
+    iIPSessionId = iServer.ControlPoint().CdsBrowseActionL(
+        iDevice->Uuid(), *iItemId, KMetaData, KFilterCommon, 0, 1,
+        KNullDesC8 );                
+    
+    if( iIPSessionId > 0 )
+        {
+        // Register
+        iInternalState = EDestroyObject;
+        iServer.Dispatcher().RegisterL( iIPSessionId, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionId );
+        }
+    iActionMessage = new (ELeave) RMessage2( aMessage );   
+    }
+        
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CancelDeleteObjectL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CancelDeleteObjectL()
+    {
+    __LOG( "CUPnPBrowsingSession::CancelDeleteObjectL" );       
+    
+    if( iActionMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionId );
+        iActionMessage->Complete( KErrCancel );    
+        delete iActionMessage; iActionMessage = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::DeviceDisappearedRequestL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::DeviceDisappearedRequestL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPBrowsingSession::DeviceDisappearedRequestL" );       
+    
+    __ASSERTD( !iDeviceMessage, __FILE__, __LINE__ );
+    
+    iDeviceMessage = new (ELeave) RMessage2( aMessage );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CancelDeviceDisappearedRequestL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CancelDeviceDisappearedRequestL()
+    {
+    __LOG( "CUPnPBrowsingSession::CancelDeviceDisappearedRequestL" );       
+    
+    if( iDeviceMessage )
+        {
+        iDeviceMessage->Complete( KErrCancel );    
+        delete iDeviceMessage; iDeviceMessage = NULL;    
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::ParseCreateObjectResponseL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+HBufC8* CUPnPBrowsingSession::ParseCreateObjectResponseL(
+    const TDesC8& aResponse )
+    {
+    __LOG( "CUPnPBrowsingSession::ParseCreateObjectResponseL" );          
+    
+    HBufC8* importURI = NULL;
+    
+    CUPnPXMLParser* parser = CUPnPXMLParser::NewL();
+    CleanupStack::PushL( parser );
+    
+    RPointerArray<CUpnpObject> array;
+    CleanupResetAndDestroyPushL( array );
+    
+    parser->ParseResultDataL( array, aResponse );
+    
+    if( array.Count() == KExpectedCount )
+        {
+        if( array[ 0 ]->ObjectType() == EUPnPItem )
+            {
+            HBufC8* tmp = array[ 0 ]->Id().AllocL(); 
+            delete iItemId;
+            iItemId = tmp;
+            
+            if( array[ 0 ]->ObjectClass().Find( KClassAudio )
+                != KErrNotFound )
+                {
+                iMusic = ETrue;
+                }
+            
+            // Get the res-elements
+            RUPnPElementsArray elArray;
+            CleanupClosePushL( elArray );
+            UPnPItemUtility::GetResElements( *array[ 0 ], elArray );
+            
+            // Find the import uri            
+            for( TInt i = 0; i < elArray.Count(); i++ )
+                {
+                const CUpnpAttribute* attribute = NULL;
+                TRAPD( err, attribute =
+                    &UPnPItemUtility::FindAttributeByNameL(
+                    *elArray[ i ], KImportUri ) );
+                if( err == KErrNone )
+                    {
+                    // import uri found!
+                    i = elArray.Count();
+                    importURI = attribute->Value().AllocL();
+                    }
+                }
+                        
+            CleanupStack::PopAndDestroy( &elArray );
+            }
+        else
+            {
+            User::Leave( KErrGeneral );
+            }    
+        }
+    else
+        {
+        User::Leave( KErrGeneral );
+        }    
+    
+    CleanupStack::PopAndDestroy( &array );
+    CleanupStack::PopAndDestroy( parser );  
+          
+    if( !importURI )
+        {
+        User::Leave( KErrGeneral );
+        }
+    
+    if( !UpnpCdsResElementUtility::IsUriAbsolute( *importURI ) )
+        {
+        // Import uri is not absolute
+        delete importURI; importURI = NULL;
+        User::Leave( KErrGeneral );
+        }
+      
+    return importURI;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CheckIsCreateObjectSupportedL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CheckIsCreateObjectSupportedL(
+    const TDesC8& aResponse )
+    {
+    __LOG( "CUPnPBrowsingSession::CheckIsCreateObjectSupportedL" );
+    
+    CUPnPXMLParser* parser = CUPnPXMLParser::NewL();
+    CleanupStack::PushL( parser );
+    
+    RPointerArray<CUpnpObject> array;
+    CleanupResetAndDestroyPushL( array );
+    
+    parser->ParseResultDataL( array, aResponse );
+    
+    if( array.Count() == KExpectedCount )
+        {
+        if( array[ 0 ]->ObjectType() == EUPnPContainer )
+            {
+            // Try to get upnp:createClass elements
+            const CUpnpElement* elem = UPnPItemUtility::FindElementByName(
+                *array[ 0 ], KCreateClass );
+
+            if ( !elem )
+                {
+                // No createClass elements, copy not supported
+                User::Leave( KErrNotSupported );
+                }
+
+            RUPnPElementsArray resultArray;
+            CleanupClosePushL( resultArray );
+            UPnPItemUtility::GetResElements( *array[ 0 ], resultArray );
+            TInt count = resultArray.Count();
+
+            for( TInt i = 0; i < count; i++ )
+                {
+                if( iSharedItem->ObjectClass().Find( KClassAudio ) !=
+                    KErrNotFound )
+                    {
+                    // We are going to create a music item, check that the
+                    // target container supports that
+                    if( resultArray[ i ]->Value().Find( KClassAudio ) ==
+                    KErrNotFound )
+                        {
+                        User::Leave( KErrNotSupported );
+                        }
+                    }
+                else if( iSharedItem->ObjectClass().Find( KClassImage ) !=
+                    KErrNotFound )
+                    {
+                    // We are going to create an image item, check that the
+                    // target container supports that
+                    if( resultArray[ i ]->Value().Find( KClassImage ) ==
+                    KErrNotFound )
+                        {
+                        User::Leave( KErrNotSupported );
+                        }                    
+                    }
+                else if( iSharedItem->ObjectClass().Find( KClassVideo ) !=
+                    KErrNotFound )
+                    {
+                    // We are going to create a video item, check that the
+                    // target container supports that
+                    if( resultArray[ i ]->Value().Find( KClassVideo ) ==
+                    KErrNotFound )
+                        {
+                        User::Leave( KErrNotSupported );
+                        }                                        
+                    }
+                else
+                    {
+                    // Unknown object class, leave
+                    User::Leave( KErrNotSupported );
+                    }      
+                }                            
+            CleanupStack::PopAndDestroy( &resultArray );
+            }
+        else
+            {
+            User::Leave( KErrNotSupported );
+            }            
+        }
+    else
+        {
+        User::Leave( KErrGeneral );
+        }    
+    CleanupStack::PopAndDestroy( &array );
+    CleanupStack::PopAndDestroy( parser );              
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CheckAndSendDestroyObjectActionL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CheckAndSendDestroyObjectActionL(
+    const TDesC8& aResponse )
+    {
+    __LOG( "CUPnPBrowsingSession::CheckAndSendDestroyObjectActionL" );
+    
+    CUPnPXMLParser* parser = CUPnPXMLParser::NewL();
+    CleanupStack::PushL( parser );
+    
+    RPointerArray<CUpnpObject> array;
+    CleanupResetAndDestroyPushL( array );
+    
+    parser->ParseResultDataL( array, aResponse );
+    
+    if( array.Count() == KExpectedCount )
+        {
+        if( array[ 0 ]->Restricted() )
+            {
+            User::Leave( KErrArgument );
+            }
+        else
+            {
+            // Not restricted, ok to destroy
+            TInt sessionId = iServer.ControlPoint().CdsDestroyObjectActionL(
+                iDevice->Uuid(), *iItemId );
+            if( sessionId > 0 )
+                {
+                iServer.Dispatcher().RegisterL( sessionId, *this );
+                iIPSessionId = sessionId;                   
+                }
+            else
+                {
+                User::Leave( sessionId );
+                }                
+            }    
+        }
+    else
+        {
+        User::Leave( KErrGeneral );
+        }    
+    CleanupStack::PopAndDestroy( &array );
+    CleanupStack::PopAndDestroy( parser );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CheckAndSendCreateObjectActionL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CheckAndSendCreateObjectActionL( 
+    const TDesC8& aResponse )
+    {
+    __LOG( "CUPnPBrowsingSession::CheckAndSendCreateObjectActionL" );
+      
+    CheckIsCreateObjectSupportedL( aResponse );
+    
+    HBufC8* xmlDoc = CUPnPXMLParser::XmlForCreateObjectLC( *iSharedItem );
+    SendCreateObjectActionL( iDevice->Uuid(), *iContainerId, *xmlDoc );
+    CleanupStack::PopAndDestroy( xmlDoc );   
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::SendCreateObjectActionL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::SendCreateObjectActionL( const TDesC8& aUUid,
+    const TDesC8& aContainerId, const TDesC8& aResponse )
+    {
+    __LOG( "CUPnPBrowsingSession::SendCreateObjectActionL" );
+    
+    TInt sessionId = iServer.ControlPoint().CdsCreateObjectActionL( aUUid,
+        aContainerId, aResponse );
+    
+    if( sessionId > 0 )
+        {
+        iServer.Dispatcher().RegisterL( sessionId, *this );
+        iIPSessionId = sessionId;                   
+        }
+    else
+        {
+        User::Leave( sessionId );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::SendExportActionL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::SendExportActionL()
+    {
+    __LOG( "CUPnPBrowsingSession::SendExportActionL" );
+    //__LOG8( *iSourceURI );
+    //__LOG8( *iImportURI );
+    
+    HBufC8* tempSourceUri = UpnpString::EncodeXmlStringL( 
+                                            iSourceURI );
+    delete iSourceURI;
+    iSourceURI = tempSourceUri;
+    tempSourceUri = NULL;
+    
+    TInt sessionId = iServer.ControlPoint().CdsExportResourceActionL(
+        *iLocalMediaServerUuid, *iSourceURI, *iImportURI );
+    if( sessionId > 0 )
+        {
+        iServer.Dispatcher().RegisterL( sessionId, *this );
+        iIPSessionId = sessionId;
+        }
+    else
+        {
+        User::Leave( sessionId );
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::SendImportActionL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::SendImportActionL()
+    {
+    __LOG( "CUPnPBrowsingSession::SendImportActionL" );
+    //__LOG8( *iSourceURI );
+    //__LOG8( *iImportURI );
+
+    HBufC8* tempSourceUri = UpnpString::EncodeXmlStringL( 
+                                            iSourceURI );
+    delete iSourceURI;
+    iSourceURI = tempSourceUri;
+    tempSourceUri = NULL;
+    
+    TInt sessionId = iServer.ControlPoint().CdsImportResourceActionL(
+        *iLocalMediaServerUuid, *iSourceURI, *iImportURI );
+    if( sessionId > 0 )
+        {
+        iServer.Dispatcher().RegisterL( sessionId, *this );
+        iIPSessionId = sessionId;
+        }
+    else
+        {
+        User::Leave( sessionId );
+        }    
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CopyFinished
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::CopyFinished( TInt aError, TBool aFinished )
+    {
+    __LOG( "CUPnPBrowsingSession::CopyFinished" );
+          
+    if( iInternalState == ECopyLocal ) // Local to remote copy
+        {
+        if( aError == KErrNone )
+            {
+            if( aFinished )
+                {
+                // Local to remote copy completed successfully!
+
+                if( iSharedItem )
+                    {
+                    // Remove shared item
+                    TRAP_IGNORE( iFileSharing->UnShareItemL(
+                        iSharedItem->Id() ) );    
+                    delete iSharedItem; iSharedItem = NULL;        
+                    }
+
+                iInternalState = ENone;
+                if( iActionMessage )
+                    {
+                    iActionMessage->Complete(
+                        EAVControllerCopyLocalItemFinishCompleted );
+                    delete iActionMessage; iActionMessage = NULL;
+                    }
+                }
+            else
+                {
+                // First phase of copy completed (export action succeeded)
+                if( iActionMessage )
+                    {
+                    iActionMessage->Complete(
+                        EAVControllerCopyLocalItemStartCompleted );
+                    delete iActionMessage; iActionMessage = NULL;
+                    }
+                }                
+            }
+        else // Error occured, cleanup.
+            {
+            if( iSharedItem )
+                {
+                // Remove shared item     
+                TRAP_IGNORE( iFileSharing->UnShareItemL(
+                    iSharedItem->Id() ) );    
+                }
+            delete iSharedItem; iSharedItem = NULL;        
+            if( iItemId )
+                {
+                // Destroy object from the remote media server                
+                TRAP_IGNORE( iServer.ControlPoint().CdsDestroyObjectActionL( 
+                    iDevice->Uuid(), *iItemId ) );
+                delete iItemId; iItemId = NULL;
+                }
+            
+            iInternalState = ENone;
+            if( iActionMessage )
+                {
+                iActionMessage->Complete( aError );
+                delete iActionMessage; iActionMessage = NULL;    
+                }
+            
+            }    
+        }
+    else if( iInternalState == ECopyToPhone ) // Remote to local copy
+        {        
+        if( aError == KErrNone )
+            {
+            if( aFinished )
+                {
+                // Remote to local copy successful, check sharing status
+                CheckSharingStatus();
+                
+                // Restore original download settings
+                RestoreDownloadSettings(); // ignore error
+                                
+                iInternalState = ENone;
+                if( iActionMessage )
+                    {
+                    iActionMessage->Complete(
+                        EAVControllerCopyToPhoneFinishCompleted );
+                    delete iActionMessage; iActionMessage = NULL;
+                    }
+                }
+            else
+                {
+                // First phase of copy completed (import action succeeded)
+                if( iActionMessage )
+                    {
+                    iActionMessage->Complete(
+                        EAVControllerCopyToPhoneStartCompleted );
+                    delete iActionMessage; iActionMessage = NULL;
+                    }
+                }    
+            }
+        else // Error occured, cleanup.
+            {
+            // Restore original download settings
+            RestoreDownloadSettings(); // ignore error
+
+            if( iItemId )
+                {
+                // Destroy object from the local media server
+                TRAP_IGNORE( iServer.ControlPoint().CdsDestroyObjectActionL( 
+                    *iLocalMediaServerUuid, *iItemId ) );
+                delete iItemId; iItemId = NULL;
+                }
+
+            iInternalState = ENone;
+            if( iActionMessage )
+                {
+                iActionMessage->Complete( aError );
+                delete iActionMessage; iActionMessage = NULL;
+                }
+            }        
+        }
+    else
+        {      
+        __PANICD( __FILE__, __LINE__ );     
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::ResetL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::ResetL()
+    {
+    __LOG( "CUPnPBrowsingSession::ResetL" );
+    
+    iIPSessionId = KErrNotFound;
+    
+    if( !iServer.DeviceRepository().IsWlanActive() )    
+        {
+        __LOG( "Reset - disconnected" );
+        User::Leave( KErrDisconnected );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::ReadObjFromMessageL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::ReadObjFromMessageL( const RMessage2& aMessage, 
+    TInt aSlot, CUpnpObject* aObj ) 
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength( aSlot );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( aSlot, ptr ) );
+    
+    // read stream
+    RDesReadStream stream( *buf );
+    CleanupClosePushL( stream );
+    
+    // internalize object
+    stream >> *aObj;
+    
+    // clean up
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buf );
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::ReadReqFromMessageL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::ReadReqFromMessageL( const RMessage2& aMessage, 
+    TInt aSlot, CUpnpAVRequest* aReq ) 
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength( aSlot );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( aSlot, ptr ) );
+    
+    // read stream
+    RDesReadStream stream( *buf );
+    CleanupClosePushL( stream );
+    
+    // internalize object
+    stream >> *aReq;
+    
+    // clean up
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::ReadBrowseReqFromMessageL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::ReadBrowseReqFromMessageL(
+    const RMessage2& aMessage, TInt aSlot, CUpnpAVBrowseRequest* aReq ) 
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength( aSlot );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( aSlot, ptr ) );
+    
+    // read stream
+    RDesReadStream stream( *buf );
+    CleanupClosePushL( stream );
+    
+    // internalize object
+    stream >> *aReq;
+    
+    // clean up
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buf );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::ReadBufFromMessageLC
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+HBufC8* CUPnPBrowsingSession::ReadBufFromMessageLC(
+    const RMessage2& aMessage, TInt aSlot ) 
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength( aSlot );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( aSlot, ptr ) );        
+    return buf;
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::SetDownloadSettingsL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPBrowsingSession::SetDownloadSettingsL(
+    MUPnPAVBrowsingSession::TMemoryType aType )
+    {
+    if( aType == MUPnPAVBrowsingSession::EDefault )
+        {
+        // Downloading to default location is the only supported target
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }    
+    
+    // EMemoryCard, ERAMDrive or EPhone are not supported, but the code is
+    // left in place for possible future use
+    /*    
+    // Read the original download location and store it
+    HBufC8* buf = iMSSettings->GetL(
+        UpnpMediaServerSettings::EUploadDirectory );
+    delete iOriginalLocation;
+    iOriginalLocation = buf;
+   
+    // Set the new download location
+    if( aType == MUPnPAVBrowsingSession::EMemoryCard )
+        {
+        User::LeaveIfError( iMSSettings->SetL(
+            UpnpMediaServerSettings::EUploadDirectory,
+            KDownloadMemoryCard ) );
+        }
+    else if( aType == MUPnPAVBrowsingSession::ERAMDrive )
+        {
+        User::LeaveIfError( iMSSettings->SetL(
+            UpnpMediaServerSettings::EUploadDirectory,
+            KDownloadRAMDrive ) );        
+        }
+    else if( aType == MUPnPAVBrowsingSession::EPhone )
+        {
+        User::LeaveIfError( iMSSettings->SetL(
+            UpnpMediaServerSettings::EUploadDirectory,
+            KDownloadPhoneMemory ) );        
+        }
+    else
+        {
+        // Default, no change needed
+        }
+    */    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::RestoreDownloadSettings
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+TInt CUPnPBrowsingSession::RestoreDownloadSettings()
+    {
+    // Restore the download settings
+    TInt err = KErrNone;
+    
+    if( iOriginalLocation && iShareFlag !=
+        MUPnPAVBrowsingSession::EDefault )
+        {
+        TRAP( err, err = iMSSettings->SetL(
+            UpnpMediaServerSettings::EUploadDirectory,
+            *iOriginalLocation ) );        
+        }
+    else
+        {
+        err = KErrGeneral;
+        } 
+            
+    return err;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowsingSession::CheckSharingStatus
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+TInt CUPnPBrowsingSession::CheckSharingStatus()
+    {
+    TInt err = KErrNone;
+
+    if( iShareFlag == MUPnPAVBrowsingSession::EFileIsNotShared )
+        {
+        // Unshare the item
+        if( iItemId )
+            {
+            TRAP( err, iFileSharing->UnShareItemL( *iItemId ) );
+            delete iItemId; iItemId = NULL;
+            }
+        }
+    else if( MUPnPAVBrowsingSession::EShareBySettings )
+        {
+        // Check settings to determine should we keep the item shared or not
+        TInt share = 0;
+        if( iMusic ) // It's a music item
+            {       
+            err = iAppSettings->Get( KUPnPAppShareAllMusicFiles, share );
+            }
+        else // Image or video item
+            {
+            err = iAppSettings->Get( KUPnPAppShareAllVisualFiles, share );
+            }    
+        
+        if( err == KErrNone && !share )
+            {
+            if( iItemId )
+                {
+                TRAP( err, iFileSharing->UnShareItemL( *iItemId ) );
+                delete iItemId; iItemId = NULL;
+                }            
+            }
+        }
+    else
+        {
+        // File is shared already, do nothing
+        }    
+
+    return err;
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpdevicediscoverymessage.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Device message class
+*
+*/
+
+
+
+
+
+
+// include files
+#include <e32base.h>
+
+// avcontroller internal
+#include "upnpdevicediscoverymessage.h"
+#include "upnpavdevice.h"
+
+// --------------------------------------------------------------------------
+// CUpnpDeviceDiscoveryMessage::CUpnpDeviceDiscoveryMessage
+// constructor
+// --------------------------------------------------------------------------
+CUpnpDeviceDiscoveryMessage::CUpnpDeviceDiscoveryMessage()
+    {
+    // none implement
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDeviceDiscoveryMessage::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUpnpDeviceDiscoveryMessage* CUpnpDeviceDiscoveryMessage::NewL(
+        const CUpnpAVDevice* aDevice, TAVControllerDeviceDiscovery aType )
+    {
+    CUpnpDeviceDiscoveryMessage* self = NewLC( aDevice, aType );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDeviceDiscoveryMessage::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUpnpDeviceDiscoveryMessage* CUpnpDeviceDiscoveryMessage::NewLC( 
+        const CUpnpAVDevice* aDevice, TAVControllerDeviceDiscovery aType )
+    {
+    CUpnpDeviceDiscoveryMessage* self = new( ELeave )
+            CUpnpDeviceDiscoveryMessage;    
+    CleanupStack::PushL( self );
+    self->iUpnpAVDevice = ( CUpnpAVDevice* )aDevice;
+    self->iMsgType = aType;
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpDeviceDiscoveryMessage::~CUpnpDeviceDiscoveryMessage
+// Destructor
+// --------------------------------------------------------------------------
+CUpnpDeviceDiscoveryMessage::~CUpnpDeviceDiscoveryMessage()
+    {
+    delete iUpnpAVDevice;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDeviceDiscoveryMessage::LinkOffset
+// See upnpdevicediscoverymessage.h
+// --------------------------------------------------------------------------
+TInt CUpnpDeviceDiscoveryMessage::LinkOffset()
+    {
+    return _FOFF( CUpnpDeviceDiscoveryMessage, iSlink );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDeviceDiscoveryMessage::Device
+// See upnpdevicediscoverymessage.h
+// --------------------------------------------------------------------------
+CUpnpAVDevice* CUpnpDeviceDiscoveryMessage::Device()
+    {
+    return iUpnpAVDevice;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDeviceDiscoveryMessage::MsgType
+// See upnpdevicediscoverymessage.h
+// --------------------------------------------------------------------------
+TAVControllerDeviceDiscovery& CUpnpDeviceDiscoveryMessage::MsgType()
+    {
+    return iMsgType;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpdevicerepository.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,613 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      storage for devices with extended information
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpdevicerepository.h"
+
+#include "upnpavdeviceextended.h"
+
+#include <upnpservice.h>
+#include <upnpdevice.h>
+#include <upnpavcontrolpoint.h>
+
+// CONSTANTS
+_LIT8( KSearch,                     "Search" );
+_LIT8( KVolume,                     "Volume" );
+_LIT8( KCreateObject,               "CreateObject" );
+_LIT8( KPause,                      "Pause");
+_LIT8( KSetVolume,                  "SetVolume");
+_LIT8( KGetVolume,                  "GetVolume");
+_LIT8( KGetMute,                    "GetMute");
+_LIT8( KSetMute,                    "SetMute");
+_LIT8( KMediaServer,                "MediaServer" );
+_LIT8( KFriendlyName,               "friendlyName" );
+_LIT8( KAVTransportService,         "AVTransport" );
+_LIT8( KRenderingControlService,    "RenderingControl" );
+_LIT8( KSetNextUri,                 "SetNextAVTransportURI" );
+_LIT8( KDestroyObject,              "DestroyObject" );
+_LIT8( KDlnaDoc,                    "dlna:X_DLNADOC" );
+_LIT8( KDlnaCap,                    "dlna:X_DLNACAP" );
+_LIT8( KAudioUpload,                "audio-upload" );
+_LIT8( KImageUpload,                "image-upload" );
+_LIT8( KVideoUpload,                "av-upload" );
+_LIT8( KCreateChildContainer,       "create-child-container" );
+_LIT8( KDMS,                        "DMS" );
+_LIT8( KDMP,                        "DMP" );
+_LIT8( KDMR,                        "DMR" );
+
+const TInt KFirstSubscription = 1;
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::NewL
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+CUPnPDeviceRepository* CUPnPDeviceRepository::NewL
+    (
+    CUpnpAVControlPoint& aControlPoint
+    )
+    {
+    CUPnPDeviceRepository* rep= new(ELeave)
+        CUPnPDeviceRepository( aControlPoint );
+    CleanupStack::PushL( rep );
+    rep->ConstructL();
+    CleanupStack::Pop();
+    return rep;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::~CUPnPDeviceRepository
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+CUPnPDeviceRepository::~CUPnPDeviceRepository()
+    {     
+    iDevices.ResetAndDestroy();
+    iDevices.Close();
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::CUPnPDeviceRepository
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+CUPnPDeviceRepository::CUPnPDeviceRepository
+    (
+    CUpnpAVControlPoint& aControlPoint
+    ):
+    iControlPoint( aControlPoint ),
+    iIsWlanActive( ETrue )    
+    {
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::ConstructL
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+void CUPnPDeviceRepository::ConstructL()
+    {
+    __LOG( "CUPnPDeviceRepository::ConstructL" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::AddDeviceL
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+void CUPnPDeviceRepository::AddDeviceL( CUpnpDevice& aDevice )
+    {
+    __LOG( "CUPnPDeviceRepository::AddDeviceL" );
+        
+    CUpnpAVDeviceExtended* dev = CUpnpAVDeviceExtended::NewL();
+    CleanupStack::PushL( dev );
+    
+    // Check if it's a dlna device
+    TPtrC8 ptr = aDevice.GetProperty( KDlnaDoc );
+    if( ptr.Length() > 0 )
+        {
+        __LOG( "Dlna compatible device!" );
+        // It's a dlna device
+        dev->SetDlnaCompatible( ETrue );
+        
+        if( ptr.FindC( KDMS ) != KErrNotFound )
+            {
+            dev->SetDLNADeviceType( CUpnpAVDeviceExtended::EDMS );
+            }
+        else if( ptr.FindC( KDMR ) != KErrNotFound )
+            {
+            dev->SetDLNADeviceType( CUpnpAVDeviceExtended::EDMR );
+            }
+        else if( ptr.FindC( KDMP ) != KErrNotFound )
+            {
+            dev->SetDLNADeviceType( CUpnpAVDeviceExtended::EDMP );
+            }        
+        
+        // Check dlna capabilities
+        ptr.Set( aDevice.GetProperty( KDlnaCap ) );
+        if( ptr.Find( KAudioUpload ) != KErrNotFound )        
+            {
+            __LOG( "Audio upload supported!" );
+            dev->SetAudioUpload( ETrue );
+            }
+        if( ptr.Find( KImageUpload ) != KErrNotFound )
+            {
+            __LOG( "Image upload supported!" );
+            dev->SetImageUpload( ETrue );
+            }
+        if( ptr.Find( KVideoUpload ) != KErrNotFound )
+            {
+            __LOG( "Video upload supported!" );
+            dev->SetVideoUpload( ETrue );
+            }
+        if( ptr.Find( KCreateChildContainer ) != KErrNotFound )
+            {
+            __LOG( "Create child container supported!" );
+            dev->SetCreateChildContainer( ETrue );
+            }        
+        }   
+        
+    if( aDevice.DeviceType().Find( KMediaServer ) != KErrNotFound )
+        {
+        dev->SetDeviceType( CUpnpAVDevice::EMediaServer );
+        }
+    else
+        {
+        dev->SetDeviceType( CUpnpAVDevice::EMediaRenderer );
+        }
+
+    dev->SetFriendlyNameL( aDevice.DescriptionProperty( KFriendlyName ) );
+
+    dev->SetUuidL( aDevice.Uuid() );   
+    
+    dev->SetLocal( aDevice.Local() );
+    
+    ParseDeviceServicesL( aDevice, *dev );
+    CleanupStack::Pop( dev );
+    iDevices.Append( dev );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::AddProtocolInfoL
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+CUpnpAVDeviceExtended& CUPnPDeviceRepository::AddProtocolInfoL(
+    const TDesC8& aUuid, const TDesC8& aSource, const TDesC8& aSink )
+    {
+    __LOG( "CUPnPDeviceRepository::AddProtocolInfoL" );
+    
+    // Find the device
+    TInt count = iDevices.Count();
+    CUpnpAVDeviceExtended* dev = NULL;
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDevices[ i ]->Uuid() == aUuid )
+            {
+            dev = iDevices[ i ];
+            i = count;
+            }
+        }
+    if( dev )
+        {
+        if( dev->DeviceType() == CUpnpAVDevice::EMediaServer )
+            {
+            dev->SetSourceProtocolInfoL( aSource );
+            dev->SetSinkProtocolInfoL( aSink );
+            dev->SetCapabilitiesBySupportedMimeTypesL( aSource );
+            }
+        else
+            {
+            dev->SetSourceProtocolInfoL( aSource );
+            dev->SetSinkProtocolInfoL( aSink );
+            dev->SetCapabilitiesBySupportedMimeTypesL( aSink );    
+            }
+        dev->SetPInfoReceived( ETrue );        
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }    
+    return *dev;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::Remove
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+void CUPnPDeviceRepository::Remove( const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPDeviceRepository::Remove" );
+    
+    TInt count = iDevices.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDevices[ i ]->Uuid() == aUuid )
+            {
+            delete iDevices[ i ];
+            iDevices.Remove( i );
+            i = count;
+            }
+        }
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::FindDeviceL
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+CUpnpAVDeviceExtended& CUPnPDeviceRepository::FindDeviceL(
+    const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPDeviceRepository::FindDeviceL" );
+    
+    CUpnpAVDeviceExtended* tmp = NULL;
+    TInt count = iDevices.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDevices[ i ]->Uuid() == aUuid )
+            {
+            tmp = iDevices[ i ];
+            i = count;
+            }
+        }
+    if( !tmp )
+        {
+        __LOG( "FindDeviceL - not found" );
+        
+        User::Leave( KErrNotFound );
+        }
+    return *tmp;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::DeviceList
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+const RPointerArray<CUpnpAVDeviceExtended>&
+    CUPnPDeviceRepository::DeviceList() const
+    {
+    __LOG( "CUPnPDeviceRepository::DeviceList" );
+    
+    return iDevices;
+    }
+   
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::SubscribeDeviceL
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+void CUPnPDeviceRepository::SubscribeDeviceL( const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPDeviceRepository::SubscribeDeviceL" );
+    __LOG8( aUuid );
+    
+    // Find the device and increase subscription count/check if we have
+    // subscribed already
+    TInt count = iDevices.Count();
+    TInt subscriptionCount = KErrNotFound;
+    TInt index;
+    for( index = 0; index < count; index++ )
+        {
+        if( aUuid.Compare( iDevices[ index ]->Uuid() ) == 0 )
+            {
+            subscriptionCount = iDevices[ index ]->IncreaseSubscriptionCount();
+            index = count;
+            }
+        }
+    if( subscriptionCount == KFirstSubscription )
+        {
+        __LOG( "SubscribeDeviceL - First subscription" ); 
+        
+        // Start subsciption for AVTransport and RenderingControl services
+        // Find the device
+        const RPointerArray<CUpnpDevice>& devList =
+            iControlPoint.DeviceList();
+        count = devList.Count();
+        for( index = 0; index < count; index++ )
+            {
+            if( aUuid.Compare( devList[ index ]->Uuid() ) == 0 )
+                {
+                break;
+                }
+            }
+
+        // Find the AVTransport service and subscribe
+        RPointerArray<CUpnpService>& servList =
+            devList[ index ]->ServiceList();
+        count = servList.Count();
+        CUpnpService* tempService = NULL;
+        for( index = 0; index < count; index++ )
+            {
+            if( servList[ index ]->ServiceType().Find(
+                KAVTransportService ) >= 0 )
+                {
+                tempService = servList[ index ];
+                index = count;
+                }
+            }
+        if( tempService && iIsWlanActive )
+            {
+            // AVTransport service found for the device, subscribe
+            __LOG( "SubscribeDeviceL - Subscribe for AVTransport" ); 
+            iControlPoint.SubscribeL( tempService ); 
+            }
+        else
+            {     
+            // Service not found, can't subscribe
+            __LOG( "SubscribeDeviceL - AVTransport service not found" );
+            }
+            
+        tempService = NULL;
+        for( index = 0; index < count; index++ )
+            {
+            if( servList[ index ]->ServiceType().Find(
+                KRenderingControlService ) >= 0 )
+                {
+                tempService = servList[ index ];
+                index = count;
+                }
+            }
+        if( tempService && iIsWlanActive )
+            {
+            // RenderingControl service found for the device, subscribe
+            __LOG( "SubscribeDeviceL - Subscribe for RenderingControl" ); 
+            iControlPoint.SubscribeL( tempService ); 
+            }
+        else
+            {     
+            // Service not found, can't subscribe
+            __LOG( "SubscribeDeviceL - RenderingControl service not found" );
+            }                    
+        }
+    else if( subscriptionCount == KErrNotFound ) 
+        {
+        __LOG( "SubscribeDeviceL - device not found" );
+        }
+    else
+        {
+        // Subscribed already, do nothing
+        __LOG( "SubscribeDeviceL - Subscription done already, ignoring!" ); 
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::UnSubscribeDeviceL
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+void CUPnPDeviceRepository::UnSubscribeDeviceL( const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPDeviceRepository::UnSubscribeDeviceL" );
+    __LOG8( aUuid );
+    
+    // Find the device and decrease subscription count/check if it's needed
+    // to unsubscribe
+    TInt count = iDevices.Count();
+    TInt subscriptionCount = KErrNotFound;
+    TInt index;
+    for( index = 0; index < count; index++ )
+        {
+        if( aUuid.Compare( iDevices[ index ]->Uuid() ) == 0 )
+            {
+            subscriptionCount = 
+                iDevices[ index ]->DecreaseSubscriptionCount();
+            index = count;
+            }
+        }    
+    
+    if( subscriptionCount == 0 )
+        {   
+        // Start unsubsciption for AVTransport and RenderingControl services
+        // Find the device
+        const RPointerArray<CUpnpDevice>& devList =
+            iControlPoint.DeviceList();
+        count = devList.Count();
+        for( index = 0; index < count; index++ )
+            {
+            if( aUuid.Compare( devList[ index ]->Uuid() ) == 0 )
+                {
+                break;
+                }
+            }
+
+        // Find the AVTransport service and unsubscribe
+        RPointerArray<CUpnpService>& servList =
+            devList[ index ]->ServiceList();
+        count = servList.Count();
+        CUpnpService* tempService = NULL;
+        for( index = 0; index < count; index++ )
+            {
+            if( servList[ index ]->ServiceType().Find(
+                KAVTransportService ) >= 0 )
+                {
+                tempService = servList[ index ];
+                index = count;
+                }
+            }
+        if( tempService && iIsWlanActive )
+            {
+            // AVTransport service found for the device, unsubscribe
+            __LOG( "UnSubscribeDeviceL - UnSubscribe AVTransport" ); 
+            iControlPoint.UnsubscribeL( tempService ); 
+            }
+        else
+            {     
+            // Service not found, can't unsubscribe
+            __LOG( "UnSubscribeDeviceL - AVTransport service not found" );
+            }
+            
+        tempService = NULL;
+        for( index = 0; index < count; index++ )
+            {
+            if( servList[ index ]->ServiceType().Find(
+                KRenderingControlService ) >= 0 )
+                {
+                tempService = servList[ index ];
+                index = count;
+                }
+            }
+        if( tempService && iIsWlanActive )
+            {
+            // RenderingControl service found for the device, subscribe
+            __LOG( "UnSubscribeDeviceL - UnSubscribe RenderingControl" ); 
+            iControlPoint.UnsubscribeL( tempService ); 
+            }
+        else
+            {     
+            // Service not found, can't subscribe
+            __LOG( "UnSubscribeDeviceL - RenderingControl service not\
+found" );
+            }                    
+        }
+    else if( subscriptionCount == KErrNotFound ) 
+        {
+        __LOG( "UnSubscribeDeviceL - device not found" );
+        }
+    else
+        {
+        // No need to unsubscibe
+        }           
+    }
+
+void CUPnPDeviceRepository::ConnectionLost()
+    {
+    __LOG( "CUPnPDeviceRepository::ConnectionLost" );
+    iIsWlanActive = EFalse;
+    iDevices.ResetAndDestroy();
+    }
+
+TBool CUPnPDeviceRepository::IsWlanActive()
+    {
+    __LOG1( "CUPnPDeviceRepository::IsWlanActive, %d", (TInt)iIsWlanActive );
+    return iIsWlanActive;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDeviceRepository::ParseDeviceServicesL
+// See upnpdevicerepository.h
+// --------------------------------------------------------------------------
+void CUPnPDeviceRepository::ParseDeviceServicesL( CUpnpDevice& aSource,
+    CUpnpAVDeviceExtended& aTarget )
+    {
+    __LOG( "CUPnPDeviceRepository::ParseDeviceServicesL" );
+    
+    TBool createObjectSupported = EFalse;
+    TBool getMuteSupported = EFalse;
+    TBool setMuteSupported = EFalse;
+    TBool getVolumeSupported = EFalse;
+    TBool setVolumeSupported = EFalse;
+
+    RPointerArray<CUpnpService>services = aSource.ServiceList();
+
+    TInt i;
+    TInt count = services.Count(); 
+    for( i = 0; i < count; i++ )
+        {
+        // Get max volume if it exists
+        CUpnpStateVariable* volumeState = 
+                services[ i ]->StateVariable( KVolume );
+
+        // If volume info found, save it to the device
+        if( volumeState )
+            {
+            TInt maxVolume = volumeState->MaxValue();
+            // If max volume not defined, it is set to 100
+            if( maxVolume == KErrNotFound )
+                {
+                maxVolume = 100;
+                }
+            aTarget.SetMaxVolume( maxVolume );
+            }
+
+        // Get the actions
+        RPointerArray<CUpnpAction> actions;
+        services[ i ]->GetActionList( actions );
+
+        // Go through the action elements
+        TInt j;
+        TInt count2 = actions.Count();
+        for( j = 0; j < count2; j++ )
+            {
+            TDesC8& actionName = actions[ j ]->Name();
+
+            if( actionName != KNullDesC8 )
+                {
+                if( actionName.Find( KCreateObject ) >= 0 )
+                    {
+                    createObjectSupported = ETrue;
+                    }
+                if( actionName.Compare( KSearch ) == 0 )
+                    {
+                    aTarget.SetSearchCapability( ETrue );
+                    }
+                if( actionName.Find( KPause ) >= 0 )
+                    {
+                    aTarget.SetPauseCapability( ETrue );
+                    }
+                if( actionName.Find( KGetVolume ) >= 0 )
+                    {
+                    getVolumeSupported = ETrue;
+                    }
+                if( actionName.Find( KSetVolume ) >= 0 )
+                    {
+                    setVolumeSupported = ETrue;
+                    }
+                if( actionName.Find( KGetMute ) >= 0 )
+                    {
+                    getMuteSupported = ETrue;
+                    }
+                if( actionName.Find( KSetMute ) >= 0 )
+                    {
+                    setMuteSupported = ETrue;
+                    }
+                if( actionName.Find( KSetNextUri ) >= 0 )
+                    {
+                    aTarget.SetNextAVTransportUri( ETrue );
+                    }
+                if( actionName.Find( KDestroyObject ) >= 0 )
+                    {
+                    aTarget.SetDestroyObject( ETrue );
+                    }                    
+                }
+            }
+        }
+
+    // Set copy support
+    if( createObjectSupported )
+        {
+        aTarget.SetCopyCapability( ETrue );
+        }
+
+    // Set volume support
+    if( getVolumeSupported &&
+        setVolumeSupported )
+        {
+        aTarget.SetVolumeCapability( ETrue );
+        }
+
+    // Set mute support
+    if( getMuteSupported &&
+        setMuteSupported )
+        {
+        aTarget.SetMuteCapability( ETrue );
+        }
+    }        
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpdownloadsession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,589 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      server impl. of session against media server
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <f32file.h>
+
+// upnp stack api
+#include <upnpmediaserversettings.h>
+#include <upnpstring.h>
+#include <upnpdlnaprotocolinfo.h>
+#include <upnpdlnaprotocolinfocons.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for upnp-specific stuff
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"
+#include "httpdownloader.h"
+
+// avcontroller internal
+#include "upnpdownloadsession.h"
+#include "upnpavdeviceextended.h"
+#include "upnpfiletransferitem.h"
+#include "upnpavcontrollerserver.h"
+#include "upnpaverrorhandler.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TUint32 KBufferSize       = 0x40000; // 256K
+const TInt KParallerTransfers   = 1;
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::NewL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+CUPnPDownloadSession* CUPnPDownloadSession::NewL( CUpnpAVControllerServer&
+    aServer, TInt aSessionId, const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPDownloadSession::NewL" );
+    
+    CUPnPDownloadSession* self = new (ELeave) CUPnPDownloadSession(
+        aServer, aSessionId );
+    CleanupStack::PushL( self );    
+    self->ConstructL( aUuid );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::CUPnPDownloadSession
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+CUPnPDownloadSession::CUPnPDownloadSession( CUpnpAVControllerServer&
+    aServer, TInt aSessionId ) :
+    CUPnPFileTransferSessionBase( aServer, aSessionId )
+    {
+    __LOG( "CUPnPDownloadSession::CUPnPDownloadSession" );
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::~CUPnPDownloadSession
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+CUPnPDownloadSession::~CUPnPDownloadSession()
+    {
+    __LOG( "CUPnPDownloadSession::~CUPnPDownloadSession" );
+    
+    delete iDownloader;
+    
+    __LOG( "CUPnPDownloadSession::~CUPnPDownloadSession - end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::ConstructL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::ConstructL( const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPDownloadSession::ConstructL" );
+    
+    CUPnPFileTransferSessionBase::ConstructL( aUuid );
+
+    iDownloader = CHttpDownloader::NewL( *this, (TUint32)iServer.IAP(),
+        KBufferSize, KParallerTransfers );
+    }
+   
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::TransferProgress
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::TransferProgress( TAny* aKey, TInt aBytes,
+    TInt aTotalBytes )
+    {
+    __LOG( "CUPnPDownloadSession::TransferProgress" );
+    
+    if( iProgressTrackingEnabled )
+        {
+        TUpnpFileTransferEvent item;
+        TInt err = FindItemByKey( item, (TInt)aKey );
+        if( err == KErrNone )
+            {
+            item.iStatus = KErrNone;
+            item.iParam2 = aTotalBytes;
+            item.iParam1 = aBytes;
+            item.iEvent = TUpnpFileTransferEvent::ETransferProgress;
+
+            Complete( item );                            
+            }
+        else
+            {
+            __LOG( "TransferProgress - Not enabled!" );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::ReadyForTransfer
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::ReadyForTransferL( TAny* aKey )
+    {
+    __LOG( "CUPnPDownloadSession::ReadyForTransfer" );
+
+    TUpnpFileTransferEvent item;
+    TInt err = FindItemByKey( item, (TInt)aKey );
+    if( err == KErrNone )
+        {       
+        iDownloader->StartTransferL( aKey );        
+    
+        item.iEvent = TUpnpFileTransferEvent::ETransferStarted;
+        Complete( item );
+        }
+    else
+        {
+        __LOG( "ReadyForTransfer - key not found" );
+
+        // Not found
+        item.iStatus = KErrGeneral;
+        item.iParam2 = 0;
+        item.iEvent = TUpnpFileTransferEvent::ETransferCompleted;
+        
+        Complete( item );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::TransferCompleted
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::TransferCompleted( TAny* aKey, TInt aStatus )
+    {
+    __LOG( "CUPnPDownloadSession::TransferCompleted" );
+    
+    TUpnpFileTransferEvent item;
+    TInt index;
+    TInt err = FindItemByKey( item, (TInt)aKey, index );
+    if( err == KErrNone )
+        {
+        item.iStatus = UPnPAVErrorHandler::ConvertToSymbianErrorCode( 
+                aStatus,
+                EUPnPHTTPError );
+        item.iEvent = TUpnpFileTransferEvent::ETransferCompleted;
+        item.iParam3 = 0;
+
+        const HBufC* path = NULL;
+        TRAPD( err, path = iDownloader->GetPropertyL( aKey,
+            CHttpTransferBase::ETargetPath ) );
+
+        if( iEventMsg )
+            {
+            if( err == KErrNone && path )
+                {
+                // Write path using slot 2
+                iEventMsg->Write( 2, *path );                            
+                }
+            else
+                {
+                __LOG( "Error in path handling" );
+                }    
+            }
+        else
+            {
+            if( err == KErrNone && path )
+                {
+                HBufC* buf = HBufC::New( path->Length() );
+                if( buf )
+                    {
+                    buf->Des().Copy( *path );
+                    item.iParam3 = (TAny*)buf;
+                    }
+                else
+                    {
+                    __LOG( "Error in path handling" );
+                    }    
+                }
+            }    
+        Complete( item );
+        
+        iTransferItems.Remove( index );      
+        }
+    else
+        {
+        // Corresponding key was not found!
+        __LOG( "TransferCompleted - key not found" );
+
+        // Not found
+        item.iStatus = KErrGeneral;
+        item.iParam2 = 0;
+        item.iEvent = TUpnpFileTransferEvent::ETransferCompleted;
+        
+        Complete( item );        
+        }
+        
+    if( aStatus == KErrDisconnected )
+        {
+        __LOG( "TransferCompleted - Target device lost" );
+        
+        TInt count = iTransferItems.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            iDownloader->CancelTransfer( (TAny*)iTransferItems[i].iKey );
+            }
+        iTransferItems.Reset();
+        iEventQueu.Reset();            
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::StartDownloadL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::StartDownloadL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPDownloadSession::StartDownloadL" );
+    
+    CUpnpFileTransferItem* tmpTransferItem = CUpnpFileTransferItem::NewLC();
+        
+    ReadTransferItemFromMessageL( aMessage, 1 ,tmpTransferItem );
+        
+    TUpnpFileTransferEvent transferItem;
+    
+    if( CheckIfKeyExists( tmpTransferItem->Key() ) )
+        {
+        User::Leave( KErrInUse );
+        }
+        
+    transferItem.iKey = tmpTransferItem->Key();
+    
+    HBufC* path = HBufC::NewLC( KMaxPath );
+    if( tmpTransferItem->Path() == KNullDesC )
+        {
+        // Read path from the settings
+        CUpnpMediaServerSettings* msSettings =
+            CUpnpMediaServerSettings::NewL();
+        CleanupStack::PushL( msSettings );
+               
+        HBufC8* buf = msSettings->GetL(
+            UpnpMediaServerSettings::EUploadDirectory );
+            
+        CleanupStack::PopAndDestroy( msSettings );    
+        
+        path->Des().Copy( *buf );
+        delete buf;
+        }
+    else
+        {
+        // Get path from the transfer item
+        path->Des().Copy( tmpTransferItem->Path() );
+        }    
+    
+    __LOG8( tmpTransferItem->Title() );
+    
+    HBufC* title16 = UpnpString::ToUnicodeL( tmpTransferItem->Title() );
+    CleanupStack::PushL( title16 );
+    
+    HBufC* title16checked =
+        UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( *title16 );
+    CleanupStack::PopAndDestroy( title16 );
+    CleanupStack::PushL( title16checked );
+    
+    CUpnpDlnaProtocolInfo* tmpInfo = CUpnpDlnaProtocolInfo::NewL(
+        tmpTransferItem->ProtocolInfo() );
+    CleanupStack::PushL( tmpInfo );    
+    HBufC* fileExt = UPnPCommonUtils::FileExtensionByMimeTypeL(
+        tmpInfo->ThirdField() );  
+    path->Des().Append( *title16checked  );
+    
+    if( fileExt )
+        {
+        path->Des().Append( *fileExt );
+        delete fileExt;        
+        }
+
+    iDownloader->InsertFileIntoWaitQueueL( (TAny*)transferItem.iKey,
+        *path, tmpTransferItem->Uri() );
+        
+    SetHeadersL( *tmpInfo, (TAny*)transferItem.iKey );    
+    CleanupStack::PopAndDestroy( tmpInfo );    
+    CleanupStack::PopAndDestroy( title16checked );
+    
+    iTransferItems.Append( transferItem );
+           
+    iDownloader->MoveToTransferQueueL( (TAny*)transferItem.iKey );
+    
+    CleanupStack::PopAndDestroy( path );
+    
+    CleanupStack::PopAndDestroy( tmpTransferItem );
+    
+    aMessage.Complete( KErrNone );        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::StartDownloadFHL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::StartDownloadFHL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPDownloadSession::StartDownloadFHL" );
+
+    RFile fHandle;
+    // handle is stored in slots 2 and 3
+    User::LeaveIfError( fHandle.AdoptFromClient( aMessage, 2, 3 ) );
+    CleanupClosePushL( fHandle );
+    
+    CUpnpFileTransferItem* tmpTransferItem = CUpnpFileTransferItem::NewLC();
+        
+    ReadTransferItemFromMessageL( aMessage, 1 ,tmpTransferItem );
+        
+    TUpnpFileTransferEvent transferItem;
+    transferItem.iKey = tmpTransferItem->Key();
+    
+    if( CheckIfKeyExists( tmpTransferItem->Key() ) )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    CUpnpDlnaProtocolInfo* tmpInfo = CUpnpDlnaProtocolInfo::NewL(
+        tmpTransferItem->ProtocolInfo() );
+    CleanupStack::PushL( tmpInfo );     
+    
+    iDownloader->InsertFileIntoWaitQueueL( (TAny*)transferItem.iKey, fHandle,
+        tmpTransferItem->Uri() );
+    
+    SetHeadersL( *tmpInfo, (TAny*)transferItem.iKey );
+    
+    CleanupStack::PopAndDestroy( tmpInfo );
+        
+    iTransferItems.Append( transferItem );
+
+    iDownloader->MoveToTransferQueueL( (TAny*)transferItem.iKey );
+        
+    CleanupStack::PopAndDestroy( tmpTransferItem );
+    
+    CleanupStack::PopAndDestroy( &fHandle );
+    
+    aMessage.Complete( KErrNone );  
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::CancelDownloadL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::CancelDownloadL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPDownloadSession::CancelDownloadL" );
+    
+    TInt key = aMessage.Int1();
+
+    TInt index;
+    if( CheckIfKeyExists( key, index ) )
+        {
+        iDownloader->CancelTransfer( (TAny*)key );
+        aMessage.Complete( KErrNone );
+        iTransferItems.Remove( index );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::CancelAllDownloadsL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::CancelAllDownloadsL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPDownloadSession::CancelAllDownloadsL" );
+    
+    TInt count = iTransferItems.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        iDownloader->CancelTransfer( (TAny*)iTransferItems[i].iKey );
+        }
+    iTransferItems.Reset();
+    iEventQueu.Reset();    
+    aMessage.Complete( KErrNone );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::StartTrackingDownloadProgressL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::StartTrackingDownloadProgressL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPDownloadSession::StartTrackingDownloadProgressL" );
+    
+    TInt key = aMessage.Int1();
+    if( CheckIfKeyExists( key ) )
+        {
+        iDownloader->TrackProgress( (TAny*)key, ETrue );
+        iProgressTrackingEnabled = ETrue;        
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::StopTrackingDownloadProgressL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::StopTrackingDownloadProgressL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPDownloadSession::StopTrackingDownloadProgressL" );
+    
+    TInt key = aMessage.Int1();
+    if( CheckIfKeyExists( key ) )
+        {
+        iDownloader->TrackProgress( (TAny*)key, EFalse );
+        iProgressTrackingEnabled = EFalse;        
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::GetDownloadEventL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::GetDownloadEventL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPDownloadSession::GetDownloadEventL" );
+    
+    if( iEventQueu.Count() )
+        {
+        __LOG1( "GetDownloadEventL, events in queu: %d",
+            iEventQueu.Count() );
+        
+        // There are events in the queu, write the first queued event back
+        // to client
+        TUpnpFileTransferEvent event = iEventQueu[0];
+        iEventQueu.Remove( 0 );
+        TPckg<TUpnpFileTransferEvent> resp1( event );
+        
+        if( event.iEvent ==
+            TUpnpFileTransferEvent::ETransferCompleted &&
+            event.iParam3 )
+            {
+            // Write path using slot 2
+            __LOG16( *( (HBufC*)event.iParam3 ) );
+            aMessage.Write( 2, *( (HBufC*)event.iParam3 ) );
+            delete (HBufC*)event.iParam3;
+            }
+        aMessage.Write( 1, resp1  ); // Write event using slot 1    
+        aMessage.Complete( KErrNone );       
+        }
+    else
+        {
+        iEventMsg = new (ELeave) RMessage2( aMessage );    
+        }
+    __LOG( "CUPnPDownloadSession::GetDownloadEventL - end" );        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::CancelGetDownloadEventL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::CancelGetDownloadEventL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPDownloadSession::CancelGetDownloadEventL" );
+    
+    if( iEventMsg )
+        {
+        iEventMsg->Complete( KErrCancel );
+        delete iEventMsg; iEventMsg = NULL;
+        }
+    aMessage.Complete( KErrNone );
+    }
+
+void CUPnPDownloadSession::DeviceDisappearedL(
+    CUpnpAVDeviceExtended& aDevice )
+    {
+    __LOG( "CUPnPDownloadSession::DeviceDisappearedL" );
+    
+    if( aDevice.Uuid().Compare( iDevice->Uuid() ) == 0 )
+        {
+        TUpnpFileTransferEvent event;
+        event.iEvent = TUpnpFileTransferEvent::EDeviceDisconnected;
+        
+        Complete( event );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::SetHeadersL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPDownloadSession::SetHeadersL( CUpnpDlnaProtocolInfo& aInfo,
+    TAny* aKey )
+    {
+    __LOG( "CUPnPDownloadSession::SetHeadersL" );
+    
+    // Check supported transfermodes
+    // We MUST use background, if it's supported
+    if( aInfo.DlnaFlag( UpnpDlnaProtocolInfo::TM_B_FLAG ) )
+        {
+        iDownloader->SetHeaderL( aKey, KTransferMode, KBackgroundMode );
+        }
+    else if( aInfo.DlnaFlag( UpnpDlnaProtocolInfo::TM_S_FLAG ) )
+        {
+        iDownloader->SetHeaderL( aKey, KTransferMode, KStreamingMode );
+        }
+    else if( aInfo.DlnaFlag( UpnpDlnaProtocolInfo::TM_I_FLAG ) )
+        { 
+        iDownloader->SetHeaderL( aKey, KTransferMode, KInteractiveMode );
+        }      
+    else 
+        {
+        __LOG( "SetHeadersL - No DLNA flags" );
+        
+        // Transfermode is not defined by any flag
+        // Correction for HALA-7B6FA5
+        if( UPnPCommonUtils::IsImageSupported( aInfo.ProtocolInfoL() ) )
+            {
+            __LOG( "SetHeadersL - Image -> Interactive" );
+            // It's an image, we should use Interactive-mode
+            iDownloader->SetHeaderL( aKey, KTransferMode, KInteractiveMode );
+            }
+        else if(
+            UPnPCommonUtils::IsAudioSupported( aInfo.ProtocolInfoL() ) ||
+            UPnPCommonUtils::IsVideoSupported( aInfo.ProtocolInfoL() ) )
+            {
+            __LOG( "SetHeadersL - A/V -> Streaming" );
+            iDownloader->SetHeaderL( aKey, KTransferMode, KStreamingMode );
+            }
+        else
+            {
+            __LOG( "SetHeadersL - Unknown type -> No mode" );
+            // It' something other
+            }                    
+        }        
+    }
+   
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpfilesharingactive.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AO for file sharing operations
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// upnp stack api
+#include <upnpfilesharing.h>
+#include <upnpitem.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for upnp-specific stuff
+#include "upnpitemutility.h" // for GetResElements
+
+// upnpframework / internal api's
+#include "upnpsecaccesscontroller.h"
+
+// avcontroller internal
+#include "upnpfilesharingactive.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::NewL
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+CUPnPFileSharingActive* CUPnPFileSharingActive::NewL()
+    {
+    CUPnPFileSharingActive* self = new (ELeave) CUPnPFileSharingActive();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::CUPnPFileSharingActive
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+CUPnPFileSharingActive::CUPnPFileSharingActive():
+    CActive( EPriorityStandard )//,
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::~CUPnPFileSharingActive
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+CUPnPFileSharingActive::~CUPnPFileSharingActive()
+    {
+    Cancel();
+    delete iFileSharing;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::ConstructL
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+void CUPnPFileSharingActive::ConstructL()
+    {
+    __LOG( "CUPnPFileSharingActive::ConstructL" );
+    
+    iFileSharing = CUpnpFileSharing::NewL();    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::RunL
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+void CUPnPFileSharingActive::RunL()
+    {
+    CActiveScheduler::Stop(); 
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::DoCancel
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+void CUPnPFileSharingActive::DoCancel()
+    {
+    __LOG( "CUPnPFileSharingActive::DoCancel" );   
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::RunError
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+TInt CUPnPFileSharingActive::RunError( TInt /*aError*/ )
+    {
+    
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::ShareItemL
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+void CUPnPFileSharingActive::ShareItemL( CUpnpItem& aItem )
+    {
+    __LOG( "CUPnPFileSharingActive::ShareItemL" );
+
+    TInt status = KErrNone;
+
+    // Allow access to the files listed in res-elements
+    SetAccesstoItemResourcesL( aItem, ETrue );
+
+    // Share the item
+    TRAP( status,
+          iFileSharing->ShareItemL( KContainerIdRoot, aItem, iStatus ) );
+    if( status == KErrNone )
+        {
+        SetActive();
+        CActiveScheduler::Start();
+        status = iStatus.Int();
+        }
+
+    // If the sharing failed
+    if( status != KErrNone )
+        {
+        // Deny access to the files listed in res-elements
+        SetAccesstoItemResourcesL( aItem, EFalse );
+        }
+
+    // Leave if the was an error
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+
+    __LOG( "CUPnPFileSharingActive::ShareItemL - end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::UnShareItemL
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+void CUPnPFileSharingActive::UnShareItemL( const TDesC8& aId )
+    {
+    __LOG( "CUPnPFileSharingActive::ConstructL" );
+
+    TLex8 lex( aId );
+    TInt id;
+    User::LeaveIfError( lex.Val( id ) );
+    TInt status = KErrNone;
+
+    // Get the shared items data via Metadata API
+    CUpnpItem* item = CUpnpItem::NewL();
+    CleanupStack::PushL( item );
+    iFileSharing->GetSharedItemL( id, *item, iStatus );
+    SetActive();
+    CActiveScheduler::Start();
+    status = iStatus.Int();
+
+    // If the item's metadata was resolved succesfully
+    if( status == KErrNone )
+        {
+        // Unshare the item
+        TRAP( status, iFileSharing->UnshareItemL( id, iStatus ) );
+        if( status == KErrNone )
+            {
+            SetActive();
+            CActiveScheduler::Start();
+            status = iStatus.Int();
+            }
+        }
+
+    // If the unsharing succeeded
+    if( status == KErrNone )
+        {
+        // Deny access to the files listed in res-elements
+        SetAccesstoItemResourcesL( *item, EFalse );
+        }
+
+    // Clean up
+    CleanupStack::PopAndDestroy( item );
+    item = NULL;
+
+    // Leave if error
+    if( status != KErrNone )
+        {
+        User::LeaveIfError( status );
+        }
+
+    __LOG( "CUPnPFileSharingActive::UnShareItemL - end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingActive::SetAccesstoItemResourcesL
+// See upnpfilesharingactive.h
+// --------------------------------------------------------------------------
+void CUPnPFileSharingActive::SetAccesstoItemResourcesL(
+                                                CUpnpItem& aItem,
+                                                TBool aAccessAllowed )
+    {
+    __LOG( "CUPnPFileSharingActive::SetAccesstoItemResourcesL" );
+
+    // Create security access controller
+    CUpnpSecAccessController* accessController = 
+                                    CUpnpSecAccessController::NewL();
+    CleanupStack::PushL( accessController );
+
+    // Get all filenames and set the access for those.
+    RUPnPElementsArray resElements;
+    UPnPItemUtility::GetResElements( aItem, resElements );
+    for( TInt i=0; i<resElements.Count(); i++ )
+        {
+        if( aAccessAllowed )
+            {
+            accessController->AddAllowedFile( resElements[i]->FilePath() );
+            }
+        else
+            {
+            accessController->RemoveAllowedFile(
+                                        resElements[i]->FilePath() );
+            }
+        }
+
+    // Clean up
+    resElements.Close();
+    CleanupStack::PopAndDestroy( accessController );
+    accessController = NULL;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpfiletransfersessionbase.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,261 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      server impl. of session against media server
+*
+*/
+
+
+
+
+
+
+// INTERNAL INCLUDES
+#include "upnpfiletransfersessionbase.h"
+#include "upnpavdeviceextended.h"
+#include "upnpavcontrollerserver.h"
+#include "upnpdevicerepository.h"
+#include "upnpfiletransferitem.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::CUPnPFileTransferSessionBase
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+CUPnPFileTransferSessionBase::CUPnPFileTransferSessionBase(
+    CUpnpAVControllerServer& aServer, TInt aSessionId ) :
+    iServer( aServer ),
+    iSessionId( aSessionId )
+    {
+    __LOG( "CUPnPFileTransferSessionBase::CUPnPFileTransferSessionBase" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::~CUPnPFileTransferSessionBase
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+CUPnPFileTransferSessionBase::~CUPnPFileTransferSessionBase()
+    {
+    __LOG( "CUPnPFileTransferSessionBase::~CUPnPFileTransferSessionBase" );
+    
+    delete iDevice;
+    iTransferItems.Close();
+    iEventQueu.Close();
+    if( iEventMsg )
+        {
+        iEventMsg->Complete( KErrCancel );
+        delete iEventMsg;
+        }
+    
+    __LOG( "CUPnPFileTransferSessionBase::~CUPnPFileTransferSessionBase \
+- end" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::ConstructL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPFileTransferSessionBase::ConstructL( const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPFileTransferSessionBase::ConstructL" );
+    
+    const RPointerArray<CUpnpAVDeviceExtended>& devList =
+        iServer.DeviceRepository().DeviceList();
+    TInt count = devList.Count();
+    TInt i;
+    for( i = 0; i < count; i++ )
+        {
+        if( devList[ i ]->Uuid() == aUuid )
+            {
+            iDevice = CUpnpAVDeviceExtended::NewL( *devList[ i ] );
+            }             
+        }
+    if( !iDevice )
+        {
+        User::Leave( KErrNotFound );
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::SessionId
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+TInt CUPnPFileTransferSessionBase::SessionId() const
+    {
+    __LOG( "CUPnPFileTransferSessionBase::SessionId" );
+    
+    return iSessionId;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::Uuid
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+const TDesC8& CUPnPFileTransferSessionBase::Uuid() const
+    {
+    __LOG( "CUPnPFileTransferSessionBase::Uuid" );
+    
+    return iDevice->Uuid();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::CheckIfKeyExists
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+TBool CUPnPFileTransferSessionBase::CheckIfKeyExists( TInt aKey )
+    {
+    __LOG( "CUPnPFileTransferSessionBase::CheckIfKeyExists" );
+    
+    TBool retVal = EFalse;
+    TInt count = iTransferItems.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iTransferItems[ i ].iKey == aKey )
+            {
+            retVal = ETrue;
+            i = count;
+            }
+        }
+    return retVal;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::CheckIfKeyExists
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+TBool CUPnPFileTransferSessionBase::CheckIfKeyExists( TInt aKey,
+    TInt& aIndex )
+    {
+    __LOG( "CUPnPFileTransferSessionBase::CheckIfKeyExists" );
+    
+    TBool retVal = EFalse;
+    TInt count = iTransferItems.Count();
+    for( aIndex = 0; aIndex < count; aIndex++ )
+        {
+        if( iTransferItems[ aIndex ].iKey == aKey )
+            {
+            retVal = ETrue;
+            break;
+            }
+        }
+    return retVal;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::FindItemByKey
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+TInt CUPnPFileTransferSessionBase::FindItemByKey( TUpnpFileTransferEvent&
+    aItem, TInt aKey )
+    {
+    __LOG( "CUPnPFileTransferSessionBase::FindItemByKey" );
+    
+    TBool retVal = KErrNotFound;
+    TInt count = iTransferItems.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iTransferItems[ i ].iKey == aKey )
+            {
+            aItem = iTransferItems[ i ];
+            retVal = KErrNone;
+            i = count;
+            }
+        }
+    return retVal;        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::FindItemByKey
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+TInt CUPnPFileTransferSessionBase::FindItemByKey( TUpnpFileTransferEvent&
+    aItem, TInt aKey, TInt& aIndex )
+    {
+    __LOG( "CUPnPFileTransferSessionBase::FindItemByKey" );
+    
+    TBool retVal = KErrNotFound;
+    TInt count = iTransferItems.Count();
+    for( aIndex = 0; aIndex < count; aIndex++ )
+        {
+        if( iTransferItems[ aIndex ].iKey == aKey )
+            {
+            aItem = iTransferItems[ aIndex ];
+            retVal = KErrNone;
+            break;
+            }
+        }
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::ReadTransferItemFromMessageL
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPFileTransferSessionBase::ReadTransferItemFromMessageL(
+    const RMessage2& aMessage, TInt aSlot, CUpnpFileTransferItem* aItem ) 
+    {
+    __LOG( "CUPnPFileTransferSessionBase::ReadTransferItemFromMessageL" );
+    
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength( aSlot );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( aSlot, ptr ) );
+    
+    // read stream
+    RDesReadStream stream( *buf );
+    CleanupClosePushL( stream );
+    
+    // internalize object
+    stream >> *aItem;
+    
+    // clean up
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buf );
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPFileTransferSessionBase::Complete
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPFileTransferSessionBase::Complete(
+    const TUpnpFileTransferEvent& aEvent )
+    {
+    __LOG( "CUPnPFileTransferSessionBase::Complete" );          
+    
+    if( iEventMsg )
+        {
+        __LOG( "Complete" );
+        __LOG1( "iEvent = %d", aEvent.iEvent );
+        __LOG1( "iKey = %d", aEvent.iKey );
+        __LOG1( "iStatus = %d", aEvent.iStatus );        
+        TPckg<TUpnpFileTransferEvent> resp1( aEvent );
+        iEventMsg->Write( 1, resp1  ); // Write response using slot 1
+        iEventMsg->Complete( KErrNone );
+        delete iEventMsg; iEventMsg = NULL;
+        }
+    else
+        {
+        __LOG( "Complete - Add to queu" );
+        __LOG1( "iEvent = %d", aEvent.iEvent );
+        __LOG1( "iKey = %d", aEvent.iKey );
+        __LOG1( "iStatus = %d", aEvent.iStatus );        
+        iEventQueu.Append( aEvent );
+        }
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpplaybacksession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,2557 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      implements a renderer playback state machine
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <in_sock.h>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+// upnp stack api
+#include <upnpdevice.h>
+#include <upnpcontainer.h>
+#include <upnpservice.h>
+#include <upnpitem.h>
+#include <upnpelement.h>
+#include <upnpstring.h>
+#include <upnpmediaserverclient.h>
+#include <upnpdlnaprotocolinfo.h>
+#include <upnpavcontrolpoint.h>
+
+// upnpframework / xmlparser api
+#include "upnpxmlparser.h"
+
+// upnpframework / avcontroller api
+#include "upnpavcontrollerglobals.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpitemutility.h"
+#include "upnpconstantdefs.h" // for upnp-specific stuff
+
+// upnpframework / internal api's
+#include "upnpmetadatafetcher.h"
+#include "upnpcommonutils.h"
+#include "upnpcdsreselementutility.h"
+#include "upnpxmleventparser.h"
+
+// avcontroller internal
+#include "upnpavcontrollerserver.h"
+#include "upnpavrequest.h"
+#include "upnpfilesharingactive.h"
+#include "upnpavdispatcher.h"
+#include "upnpaverrorhandler.h"
+#include "upnpavdeviceextended.h"
+#include "upnpdevicerepository.h"
+#include "upnpplaybacksession.h"
+#include "upnpperiodic.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+_LIT8( KPlaying,            "PLAYING" );
+_LIT8( KPaused,             "PAUSED_PLAYBACK" );
+_LIT8( KStopped,            "STOPPED" );
+_LIT8( KNormalSpeed,        "1" );
+_LIT8( KMasterVolume,       "Master" );
+_LIT8( KMuteOn,             "1" );
+_LIT8( KMuteOff,            "0" );
+_LIT8( KAsterisk,           "*" );
+
+const TInt KDefaultInstanceId   = 0;
+const TInt KExpectedCount       = 1;
+const TInt KMaxVolume           = 100;
+
+// Timer to wait until sending the play action after set transport uri.
+// For some reason, some equipments can not responce play action 
+// immediately after set transport uri, eg. Kiss 1600.  
+const TInt KPlayDelayTimerInterval = 1000000;
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::NewL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+CUPnPPlaybackSession* CUPnPPlaybackSession::NewL
+    (
+    RUpnpMediaServerClient& aClient,
+    CUpnpAVControllerServer& aServer,
+    TInt aSessionId,
+    const TDesC8& aUuid
+    )
+    {
+    CUPnPPlaybackSession* self = new (ELeave) CUPnPPlaybackSession(
+        aClient, aServer, aSessionId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aUuid );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CUPnPPlaybackSession
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+CUPnPPlaybackSession::CUPnPPlaybackSession
+    (
+    RUpnpMediaServerClient& aClient,
+    CUpnpAVControllerServer& aServer,
+    TInt aSessionId
+    ):
+    iServer( aServer ),
+    iMediaServer( aClient ),
+    iSessionId( aSessionId ),
+    iInstanceId( KDefaultInstanceId ),
+    iIPSessionIdCommand( KErrNotFound ),
+    iIPSessionIdSetting( KErrNotFound ),
+    iEventingActive( EFalse ),
+    iMuteState( EUnknown ),
+    iVolume( -1 )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::~CUPnPPlaybackSession
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+CUPnPPlaybackSession::~CUPnPPlaybackSession()
+    {
+    __LOG( "CUPnPPlaybackSession::~CUPnPPlaybackSession" );
+    
+    if( iPlaybackState == EPlaying || iPlaybackState == EPaused ||
+        iPlaybackState == EPlaySent )
+        {
+        if( iDevice && iServer.DeviceRepository().IsWlanActive() )
+            {
+            __LOG( "~CUPnPPlaybackSession - \
+playback still ongoing, send stop" );    
+            TRAP_IGNORE( iServer.ControlPoint().AvtStopActionL( 
+                iDevice->Uuid(), iInstanceId ) );            
+            }
+        else
+            {
+            __LOG( "~CUPnPPlaybackSession - \
+playback still ongoing, wlan not active" );    
+            }    
+        }
+        
+    if( iSharedItem && iItemShared && iFileSharing )
+        {
+        TRAP_IGNORE( iFileSharing->UnShareItemL( iSharedItem->Id() ) );
+        }
+
+    if( iNextSharedItem && iNextItemShared && iFileSharing )
+        {
+        TRAP_IGNORE( iFileSharing->UnShareItemL( iNextSharedItem->Id() ) );
+        }
+    delete iFileSharing;
+        
+    //iMediaServer.Close();
+
+    delete iSharedItem;
+    delete iNextSharedItem;
+
+    delete iEventMessage;
+    delete iSettingMessage;
+    delete iCommandMessage;
+    delete iDeviceMessage;
+    
+    delete iLocalMediaServerUuid;
+    delete iEventParser;
+    
+    iEventQue.Reset();
+    iEventQue.Close();
+
+    if( iEventingActive && iDevice )
+        {
+        __LOG( "~CUPnPPlaybackSession - UnSubscribeDeviceL" );
+        TRAP_IGNORE( iServer.DeviceRepository().UnSubscribeDeviceL(
+            iDevice->Uuid() ) );
+        iServer.Dispatcher().UnRegisterEvents( *this );
+        iEventingActive = EFalse;            
+        }
+        
+    delete iDevice;        
+    
+    // delete the playdelay timer
+    if( iPlayDelayTimer )
+        {
+        iPlayDelayTimer->Cancel();
+        delete iPlayDelayTimer;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::ConstructL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::ConstructL( const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPPlaybackSession::ConstructL" );
+
+    iFileSharing = CUPnPFileSharingActive::NewL();
+    
+    iEventParser = CUPnPXMLEventParser::NewL();
+    
+    const RPointerArray<CUpnpAVDeviceExtended>& devList =
+        iServer.DeviceRepository().DeviceList();
+    TInt count = devList.Count();
+    TInt i;
+    for( i = 0; i < count; i++ )
+        {
+        if( devList[ i ]->Local() )
+            {
+            __LOG( "CUPnPPlaybackSession::ConstructL - Local MS found!" );
+            
+            __ASSERTD( !iLocalMediaServerUuid, __FILE__, __LINE__ );
+            iLocalMediaServerUuid = devList[i]->Uuid().AllocL();
+            }
+        if( devList[ i ]->Uuid() == aUuid )
+            {
+            __ASSERTD( !iDevice, __FILE__, __LINE__ );
+            iDevice = CUpnpAVDeviceExtended::NewL( *devList[ i ] );
+            }
+        }        
+    if( !iDevice )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // create the playdelaytimer
+    iPlayDelayTimer = CUPnPPeriodic::NewL( CActive::EPriorityStandard );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::RcSetVolumeResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::RcSetVolumeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& aDesiredVolume )
+    {
+    __LOG1( "CUPnPPlaybackSession::RcSetVolumeResponse: %d", aErr );
+    
+    __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+    //iSettingPending = EFalse;
+    iIPSessionIdSetting = KErrNotFound;
+    
+    if( iSettingMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPRenderingControlError );    
+        
+        if( aErr == KErrNone )
+            {
+            TInt vol;
+            TLex8 lex( aDesiredVolume );
+            TInt err = lex.Val( vol );
+            if(  err == KErrNone )
+                {
+                TInt maxVolume = iDevice->MaxVolume();
+                // If max volume not KMaxVolume
+                if( maxVolume != KMaxVolume )
+                    {
+                    // Convert volume to match max volume 100
+                    TReal tempVolumeLevel = vol;
+                    TReal tempMaxVolume = maxVolume;
+                       
+                    vol = KMaxVolume * tempVolumeLevel / tempMaxVolume;
+                    }
+                iVolume = vol;
+                TPckg<TInt> resp2( vol );
+                iSettingMessage->Write( 2, resp2 );
+
+                iSettingMessage->Complete( EAVControllerSetVolumeCompleted );
+                delete iSettingMessage; iSettingMessage = NULL;       
+                }
+            else
+                {
+                iSettingMessage->Complete( err );
+                delete iSettingMessage; iSettingMessage = NULL;
+                }    
+            }
+        else
+            {
+            iSettingMessage->Complete( aErr );
+            delete iSettingMessage; iSettingMessage = NULL;
+            }                   
+        }
+    else
+        {
+        __LOG( "RcSetVolumeResponse - no msg" );
+        }    
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::RcVolumeResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::RcVolumeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& aCurrentVolume)
+    {
+    __LOG1( "CUPnPPlaybackSession::RcVolumeResponse: %d", aErr );    
+    
+    __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+    //iSettingPending = EFalse;
+    iIPSessionIdSetting = KErrNotFound;
+
+    if( iSettingMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPRenderingControlError );
+        
+        if( aErr == KErrNone )
+            {
+            TInt vol;
+            TLex8 lex( aCurrentVolume );
+            TInt err = lex.Val( vol );
+            if(  err == KErrNone )
+                {
+                
+               // Get device's maximum volume value
+                TInt maxVolume = iDevice->MaxVolume();
+
+                // If max volume not KMaxVolume
+                if( maxVolume != KMaxVolume )
+                    {
+                    // Convert volume to match max volume KMaxVolume
+                    TReal tempVolumeLevel = vol;
+                    TReal tempMaxVolume = maxVolume;
+                    
+                    vol = KMaxVolume * tempVolumeLevel / tempMaxVolume;
+                    }            
+                iVolume = vol;
+                TPckg<TInt> resp1( vol );
+                iSettingMessage->Write( 1, resp1 );
+
+                iSettingMessage->Complete( EAVControllerGetVolumeCompleted );
+                delete iSettingMessage; iSettingMessage = NULL;      
+                }
+            else
+                {
+                iSettingMessage->Complete( err );
+                delete iSettingMessage; iSettingMessage = NULL;      
+                }    
+            }
+        else
+            {
+            iSettingMessage->Complete( aErr );
+            delete iSettingMessage; iSettingMessage = NULL;      
+            }                               
+        }
+    else
+        {
+        __LOG( "RcVolumeResponse - no msg" );
+        }    
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::RcSetMuteResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::RcSetMuteResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& aDesiredMute )
+    {
+    __LOG1( "CUPnPPlaybackSession::RcSetMuteResponse: %d", aErr );    
+    
+    __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+    //iSettingPending = EFalse;
+    iIPSessionIdSetting = KErrNotFound;
+    
+    if( iSettingMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPRenderingControlError );    
+        
+        if( aErr == KErrNone )
+            {
+            TInt mute( EUnknown );
+            TLex8 lex( aDesiredMute );
+            TInt err = lex.Val( mute );
+            
+            // If mute's value isn't ENotMuted or EMuted, 
+            // we think the value is incorrect.
+            if ( err == KErrNone && mute != ENotMuted && mute != EMuted )
+                {
+                err = KErrArgument;
+                }
+
+            if(  err == KErrNone )
+                {
+                iMuteState = (TMuteState)mute;
+                TPckg<TInt> resp2( mute );
+                iSettingMessage->Write( 2, resp2 );
+
+                iSettingMessage->Complete( EAVControllerSetMuteCompleted );
+                delete iSettingMessage; iSettingMessage = NULL;            
+                }
+            else
+                {
+                iSettingMessage->Complete( err );
+                delete iSettingMessage; iSettingMessage = NULL;      
+                }    
+            }
+        else
+            {
+            iSettingMessage->Complete( aErr );
+            delete iSettingMessage; iSettingMessage = NULL;      
+            }                           
+        }
+    else
+        {
+        __LOG( "RcSetMuteResponse - no msg" );
+        }    
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::RcMuteResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::RcMuteResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& aCurrentMute )
+    {
+    __LOG1( "CUPnPPlaybackSession::RcMuteResponse: %d" , aErr );
+    
+    __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+    iIPSessionIdSetting = KErrNotFound;
+
+    if( iSettingMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPRenderingControlError );
+        
+        if( aErr == KErrNone )
+            {
+            TInt mute( EUnknown );
+            TLex8 lex( aCurrentMute );
+            TInt err = lex.Val( mute );
+
+            // If mute's value isn't ENotMuted or EMuted, 
+            // we think the value is incorrect.
+            if ( err == KErrNone && mute != ENotMuted && mute != EMuted )
+                {
+                err = KErrArgument;
+                }
+
+            if(  err == KErrNone )
+                {
+                iMuteState = (TMuteState)mute;
+                TPckg<TInt> resp1( mute );
+                iSettingMessage->Write( 1, resp1 );
+
+                iSettingMessage->Complete( EAVControllerGetMuteCompleted );
+                delete iSettingMessage; iSettingMessage = NULL;
+                }
+            else
+                {
+                iSettingMessage->Complete( err );
+                delete iSettingMessage; iSettingMessage = NULL;
+                }    
+            }
+        else
+            {
+            iSettingMessage->Complete( aErr );
+            delete iSettingMessage; iSettingMessage = NULL;
+            }                                   
+        }
+    else
+        {
+        __LOG( "RcMuteResponse - no msg" );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtSetTransportUriResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtSetTransportUriResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aInstanceId,
+    const TDesC8& /*aCurrentUri*/,
+    const TDesC8& /*aCurrentUriMetaData*/)
+    {
+    __LOG1( "CUPnPPlaybackSession::AvtSetTransportUriResponse: %d", aErr );
+    
+    __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ );  
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+    iIPSessionIdCommand = KErrNotFound;
+    TInt temp;
+    TLex8 lex( aInstanceId );
+    TInt err = lex.Val( temp );
+    if( err == KErrNone )
+        {
+        __LOG1( "AvtSetTransportUriResponse, instance id: %d", temp );
+        iInstanceId = temp;
+        iPlaybackState = EStopped;
+        }
+    
+    if( iCommandMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPAVTransportError );    
+        
+        if( aErr == KErrNone )
+            {
+            iCommandMessage->Complete( EAVControllerSetURICompleted );
+            delete iCommandMessage; iCommandMessage = NULL;      
+            }
+        else
+            {
+            iCommandMessage->Complete( aErr );
+            delete iCommandMessage; iCommandMessage = NULL;      
+            }                
+        }
+    else
+        {
+        __LOG( "AvtSetTransportUriResponse - no msg" );
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtSetNextTransportUriResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtSetNextTransportUriResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& aInstanceId,
+    const TDesC8& /*aNextUri*/,
+    const TDesC8& /*aNextUriMetaData*/)
+    {
+    __LOG1( "CUPnPPlaybackSession::AvtSetNextTransportUriResponse: %d",
+        aErr );
+    
+    __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+    iIPSessionIdCommand = KErrNotFound;
+
+    TInt temp;
+    TLex8 lex( aInstanceId );
+    TInt err = lex.Val( temp );
+    if( err == KErrNone )
+        {
+        __LOG1( "AvtSetNextTransportUriResponse, instance id: %d", temp );
+        //iInstanceId = temp;
+        }
+
+    if( iCommandMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPAVTransportError );
+        
+        if( aErr == KErrNone )
+            {
+            iCommandMessage->Complete( EAVControllerSetNextURICompleted );
+            delete iCommandMessage; iCommandMessage = NULL;            
+            }
+        else
+            {
+            iCommandMessage->Complete( aErr );
+            delete iCommandMessage; iCommandMessage = NULL;      
+            }            
+        }
+    else
+        {
+        __LOG( "AvtSetNextTransportUriResponse - no msg" );
+        }    
+
+    }
+  
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtMediaInfoResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtMediaInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNrTracks*/,
+    const TDesC8& /*aMediaDuration*/,
+    const TDesC8& /*aCurrentUri*/,
+    const TDesC8& /*aCurrentUriMetaData*/,
+    const TDesC8& /*aNextUri*/,
+    const TDesC8& /*aNextUriMetaData*/,
+    const TDesC8& /*aPlayMedium*/,
+    const TDesC8& /*aRecordMedium*/,
+    const TDesC8& /*aWriteStatus*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtGetTransportInfoResponse
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackSession::AvtGetTransportInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aCurrenTransportState*/,
+    const TDesC8& /*aCurrentTransportStatus*/,
+    const TDesC8& /*aCurrentSpeed*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtPositionInfoResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtPositionInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aTrack*/,
+    const TDesC8& aTrackDuration,
+    const TDesC8& /*aTrackMetaData*/,
+    const TDesC8& /*aTrackURI*/,
+    const TDesC8& aRelTime,
+    const TDesC8& /*aAbsTime*/,
+    const TDesC8& /*aRelCount*/,
+    const TDesC8& /*aAbsCount*/)
+    {
+    __LOG1( "CUPnPPlaybackSession::AvtPositionInfoResponse: %d", aErr );    
+    
+    __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+    iIPSessionIdSetting = KErrNotFound;
+    
+    if( iSettingMessage )
+        {
+        TInt err = iSettingMessage->Write( 1, aTrackDuration );
+        err = iSettingMessage->Write( 2, aRelTime );
+        // Howto handle err?
+
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPAVTransportError );    
+           
+        if( aErr == KErrNone )
+            {
+            iSettingMessage->Complete( EAVControllerPositionInfoCompleted );
+            delete iSettingMessage; iSettingMessage = NULL;      
+            }
+        else
+            {
+            iSettingMessage->Complete( aErr ); 
+            delete iSettingMessage; iSettingMessage = NULL; 
+            }        
+        }
+    else
+        {
+        __LOG( "AvtPositionInfoResponse - no msg" );    
+        }       
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtDeviceCapabilitiesResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtDeviceCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aPlayMedia*/,
+    const TDesC8& /*aRecMedia*/,
+    const TDesC8& /*aRecQualityMode*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtTransportSettingsResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtTransportSettingsResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aPlayMode*/,
+    const TDesC8& /*aRecQualityMode*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtStopResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtStopResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aInstanceId*/)
+    {
+    __LOG1( "CUPnPPlaybackSession::AvtStopResponse: %d", aErr );    
+    
+    __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+    //iCommandPending = EFalse;
+    iIPSessionIdCommand = KErrNotFound;
+    
+    if( iCommandMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPAVTransportError );        
+        
+        if( aErr == KErrNone )
+            {
+            iPlaybackState = EStopped;
+            iCommandMessage->Complete( EAVControllerStopCompleted );
+            delete iCommandMessage; iCommandMessage = NULL;       
+            }
+        else
+            {
+            iCommandMessage->Complete( aErr );
+            delete iCommandMessage; iCommandMessage = NULL;       
+            }                
+        }
+    else
+        {
+        __LOG( "AvtStopResponse - no msg" );
+        }      
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtPlayResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtPlayResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aSpeed*/)
+    {
+    __LOG1( "CUPnPPlaybackSession::AvtPlayResponse: %d", aErr );    
+    
+    __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+    //iCommandPending = EFalse;
+    iIPSessionIdCommand = KErrNotFound;
+    
+    if( iCommandMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPAVTransportError );        
+        
+        if( aErr == KErrNone )
+            {
+            iPlaybackState = EPlaying;
+            iCommandMessage->Complete( EAVControllerPlayCompleted );
+            delete iCommandMessage; iCommandMessage = NULL;             
+            }
+        else
+            {
+            iCommandMessage->Complete( aErr );
+            delete iCommandMessage; iCommandMessage = NULL;
+            }                    
+        }
+    else
+        {
+        __LOG( "AvtPlayResponse - no msg" );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtPauseResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtPauseResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aInstanceId*/)
+    {
+    __LOG1( "CUPnPPlaybackSession::AvtPauseResponse: %d", aErr );    
+    
+    __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+    //iCommandPending = EFalse;
+    iIPSessionIdCommand = KErrNotFound;
+    
+    if( iCommandMessage )
+        {
+        aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+            EUPnPAVTransportError );        
+        
+        if( aErr == KErrNone )
+            {
+            iPlaybackState = EPaused;
+            iCommandMessage->Complete( EAVControllerPauseCompleted );
+            delete iCommandMessage; iCommandMessage = NULL;                   
+            }
+        else
+            {
+            iCommandMessage->Complete( aErr );
+            delete iCommandMessage; iCommandMessage = NULL;             
+            }                    
+        }
+    else
+        {
+        __LOG( "AvtPauseResponse - no msg" );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtRecordResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtRecordResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtSeekResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtSeekResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aUnit*/,
+    const TDesC8& /*aTarget*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtNextResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtNextResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtPreviousResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtPreviousResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtSetPlayModeResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtSetPlayModeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNewPlayMode*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtSetRecordModeResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtSetRecordModeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNewRecordQuality*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsSearchCapabilitiesResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsSearchCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSearchCaps*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsSortCapabilitiesResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsSortCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSortCaps*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsSystemUpdateIdResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsSystemUpdateIdResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*aSystemUpdateId*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsBrowseResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsBrowseResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aObjectID*/,
+    const TDesC8&  /*aBrowseFlag*/,
+    const TDesC8&  /*aFilter*/,
+    TInt /*aIndex*/,
+    TInt /*aRequest*/,
+    const TDesC8&  /*aSortCriteria*/,
+    const TDesC8&  /*aResult*/,
+    TInt /*aReturned*/,
+    TInt /*aMatches*/,
+    const TDesC8&  /*aUpdateID*/ )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsSearchResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsSearchResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aContainerId*/,
+    const TDesC8& /*aSearchCriteria*/,
+    const TDesC8& /*aFilter*/,
+    TInt /*aIndex*/,
+    TInt /*aRequest*/,
+    const TDesC8& /*aSortCriteria*/,
+    const TDesC8& /*aResult*/,
+    TInt /*aReturned*/,
+    TInt /*aMatches*/,
+    const TDesC8& /*aUpdateID*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsDestroyObjectResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsDestroyObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aObjectId*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsUpdateObjectResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsUpdateObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aObjectId*/,
+    const TDesC8& /*aCurrentTagValue*/,
+    const TDesC8& /*aNewTagValue*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsImportResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsImportResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSourceURI*/,
+    const TDesC8& /*aDestinationURI*/,
+    const TDesC8& /*aTransferId*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsExportResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsExportResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSourceURI*/,
+    const TDesC8& /*aDestinationURI*/,
+    const TDesC8& /*aTransferId*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsStopTransferResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsStopTransferResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aTransferId*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsCTransferProgressResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsCTransferProgressResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aTransferId*/,
+    const TDesC8& /*aTransferStatus*/,
+    const TDesC8& /*aTransferLength*/,            
+    const TDesC8& /*aTransferTotal*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsDeleteResourceResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsDeleteResourceResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aResourceUri*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsCreateReferenceResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsCreateReferenceResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aContainerId*/, 
+    const TDesC8& /*ObjectId*/,
+    const TDesC8& /*aNewId*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsCreateObjectResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsCreateObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aContainerID*/, 
+    const TDesC8& /*aElements*/, 
+    const TDesC8& /*aObjectID*/, 
+    const TDesC8& /*aResult*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CmProtocolInfoResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CmProtocolInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSource*/, 
+    const TDesC8& /*aSink*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CmPrepareResponse
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CmPrepareResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aRemoteProtocolInfo*/,
+    const TDesC8& /*aPeerConnectionManager*/,
+    const TDesC8& /*aPeerConnectionId*/,
+    const TDesC8& /*aDirection*/,
+    TInt /*aConnection*/,
+    TInt /*aTransport*/,
+    TInt /*aRsc*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CmComplete
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CmComplete(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*aConnection*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CmCurrentConnections
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CmCurrentConnections(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aConnections*/)
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CmCurrentInfo
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CmCurrentInfo(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*rscId*/, 
+    TInt /*transportId*/, 
+    const TDesC8& /*aProtocolInfo*/,
+    const TDesC8& /*aPeerConnectionManager*/, 
+    TInt /*peerId*/, 
+    const TDesC8& /*aDirection*/, 
+    const TDesC8& /*aStatus*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsUpdateEvent
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsUpdateEvent(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSystemUpdateId*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsContainerEvent
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsContainerEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aConteinerIds*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CdsTransferEvent
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CdsTransferEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aTransferIds*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::RcLastChangeEvent
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::RcLastChangeEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& aLastChange
+        )
+    {
+    // No implementation required
+    if( iPlaybackState != EUninitialized )
+        {        
+        __LOG( "CUPnPPlaybackSession::RcLastChangeEvent" );
+        //__LOG8( aLastChange );
+
+        TInt instanceId = -1;
+        TInt volume = -1;
+        TBool mute = EFalse;
+        if( iMuteState == EMuted )
+            {
+            mute = ETrue;
+            }
+
+        TRAPD( err, iEventParser->ParseResultDataL( aLastChange, instanceId,
+            volume, mute ) );
+        if( err == KErrNone && instanceId == iInstanceId )
+            {
+            TUnsolicitedEventC unEvent;
+            if( iMuteState != (TMuteState)mute )
+                {
+                // State of mute changed, create an event and send it to
+                // the client side
+                unEvent.iEvent = EMute;
+                unEvent.iValue = (TInt)mute;
+                
+                // If mute's value isn't ENotMuted or EMuted, 
+                // we think the value is incorrect.
+                if ( mute != ENotMuted && mute != EMuted )
+                    {    
+                    err = KErrArgument;
+                    }
+                else 
+                    {
+                iMuteState = (TMuteState)mute;
+                    }
+                if( iEventMessage )
+                    {
+                    TPckg<TUnsolicitedEventC> resp1( unEvent );
+                    TInt error = iEventMessage->Write( 1, resp1 );
+                    if ( error == KErrNone )
+                        {
+                        error = err;
+                        }
+                    iEventMessage->Complete( error );
+                    delete iEventMessage; iEventMessage = NULL;
+                    }
+                else if ( err == KErrNone )
+                    {
+                    // If iEventMessage is invalid and mute's value is
+                    // right, we will append event to iEventQue.
+                    // Else nothing to do.
+                    iEventQue.Append( unEvent );
+                    }                            
+                }
+
+            // Scale the volume level
+            // Get device's maximum volume value
+            TInt maxVolume = iDevice->MaxVolume();
+            // If max volume not KMaxVolume
+            if( maxVolume != KMaxVolume )
+                {
+                // Convert volume to match max volume 100
+                TReal tempVolumeLevel = volume;
+                TReal tempMaxVolume = maxVolume;
+                   
+                volume = KMaxVolume * tempVolumeLevel / tempMaxVolume;
+                }            
+            
+            if( iVolume != volume && volume >= 0 )
+                {
+                // State of volume changed, create an event and send it to
+                // the client side
+                unEvent.iEvent = EVolume;
+                unEvent.iValue = volume;
+                iVolume = volume;
+                if( iEventMessage )
+                    {
+                    TPckg<TUnsolicitedEventC> resp1( unEvent );
+                    TInt err = iEventMessage->Write( 1, resp1 );
+                    iEventMessage->Complete( err );
+                    delete iEventMessage; iEventMessage = NULL;
+                    }
+                else
+                    {
+                    iEventQue.Append( unEvent );
+                    }                            
+                }
+            
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::AvtLastChangeEvent
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::AvtLastChangeEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& aLastChange
+        )
+    {
+    // Is it for this device?
+    if( iPlaybackState != EUninitialized )
+        {
+        __LOG( "CUPnPPlaybackSession::AvtLastChangeEvent" );
+        
+        TUnsolicitedEventC event;
+        if( aLastChange.Find( KPlaying ) >= 0 )
+            {
+            __LOG( "AvtLastChangeEvent - PlayUser received" );
+            event.iEvent = EPlay;                            
+            iPlaybackState = EPlaying;
+            if( iEventMessage )
+                {
+                TPckg<TUnsolicitedEventC> resp1( event );
+                TInt err = iEventMessage->Write( 1, resp1 );
+                iEventMessage->Complete( err ); // Ok to complete with err?
+                delete iEventMessage; iEventMessage = NULL;
+                }
+            else
+                {
+                __LOG( "AvtLastChangeEvent - appending playuser" );
+                iEventQue.Append( event );
+                }            
+            }
+        else if( aLastChange.Find( KStopped ) >= 0 &&
+                 iPlaybackState != EStopped )
+            {
+            __LOG( "AvtLastChangeEvent - StopUser received" );
+            event.iEvent = EStop;                
+            iPlaybackState = EStopped;
+            if( iEventMessage )
+                {
+                TPckg<TUnsolicitedEventC> resp1( event );
+                TInt err = iEventMessage->Write( 1, resp1 );
+                iEventMessage->Complete( err ); // Ok to complete with err?
+                delete iEventMessage; iEventMessage = NULL;
+                }
+            else
+                {
+                __LOG( "AvtLastChangeEvent - appending stopuser" );
+                iEventQue.Append( event );
+                }    
+            }
+        else if( aLastChange.Find( KPaused ) >= 0 &&
+                 iPlaybackState != EPaused )
+            {
+            __LOG( "AvtLastChangeEvent - PauseUser received" );
+            event.iEvent = EPause;
+            iPlaybackState = EPaused;
+            if( iEventMessage )
+                {
+                __LOG( "CUPnPPlaybackSession::AvtLastChangeEvent" );
+                TPckg<TUnsolicitedEventC> resp1( event );
+                TInt err = iEventMessage->Write( 1, resp1 );
+                iEventMessage->Complete( err ); // Ok to complete with err?
+                delete iEventMessage; iEventMessage = NULL;
+                }
+            else
+                {
+                __LOG( "AvtLastChangeEvent - appending pauseuser" );
+                iEventQue.Append( event );
+                }
+            }
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CmSourceEvent
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CmSourceEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aSource*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CmSinkEvent
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CmSinkEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aSink*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CmConnectionsEvent
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CmConnectionsEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aConnections*/
+        )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::HttpResponseL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::HttpResponseL( CUpnpHttpMessage* /*aMessage*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::DeviceDiscoveredL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::DeviceDiscoveredL( CUpnpDevice* /*aDevice*/ )
+    {
+    // No implementation required        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::DeviceDisappearedL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::DeviceDisappearedL( CUpnpDevice* /*aDevice*/ )
+    {
+    // No implementation required                   
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::DeviceDisappearedL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::DeviceDisappearedL(
+    CUpnpAVDeviceExtended& aDevice )
+    {
+    __LOG( "CUPnPPlaybackSession::DeviceDisappearedL" );
+   
+    if( aDevice.Local() )
+        {
+        delete iLocalMediaServerUuid; iLocalMediaServerUuid = NULL; 
+        }
+    else if( iDeviceMessage ) // Target device
+        {
+        iDeviceMessage->Complete( KErrNone );
+        delete iDeviceMessage; iDeviceMessage = NULL;
+        }    
+    }
+ 
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::SetLocalMSUuidL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::SetLocalMSUuidL( const TDesC8& aUuid )
+    {
+    HBufC8* tmp = aUuid.AllocL();
+    delete iLocalMediaServerUuid;
+    iLocalMediaServerUuid = tmp; 
+    } 
+ 
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::SessionId
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+TInt CUPnPPlaybackSession::SessionId() const
+    {
+    return iSessionId;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::EventRequestL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::EventRequestL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::EventRequestL" );
+    
+    __ASSERTD( !iEventMessage, __FILE__, __LINE__ );
+    
+    TInt count = iEventQue.Count(); 
+    if( count )
+        {
+        __LOG( "EventRequestL - events in the que" );
+        // Events pending, get the event from que and complete the msg
+        TPckg<TUnsolicitedEventC> resp1( iEventQue[ count - 1 ] );
+        TInt err = aMessage.Write( 1, resp1 );
+        iEventQue.Remove( count - 1 ); 
+        aMessage.Complete( err ); // Ok to complete with err?
+        }
+    else
+        {
+        __LOG( "EventRequestL - storing the msg" );
+        iEventMessage = new (ELeave) RMessage2( aMessage );
+        
+        if( !iEventingActive )
+            {
+            __LOG( "EventRequestL - subscribing.." );
+            iServer.DeviceRepository().SubscribeDeviceL( iDevice->Uuid() );
+            iServer.Dispatcher().RegisterForEventsL( *this,
+                iDevice->Uuid() );
+            iEventingActive = ETrue;
+            }           
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelEventRequestL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelEventRequestL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelEventRequestL" );
+           
+    if( iEventingActive )
+        {
+        __LOG( "CancelEventRequestL - unsubscribing.." );
+        iServer.DeviceRepository().UnSubscribeDeviceL( iDevice->Uuid() );
+        iServer.Dispatcher().UnRegisterEvents( *this );
+        iEventingActive = EFalse;            
+        }
+        
+    if( iEventMessage )
+        {
+        __LOG( "CancelEventRequestL - cancelling the msg.." );
+        iEventMessage->Complete( KErrCancel );
+        delete iEventMessage; iEventMessage = NULL;   
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::SetURIL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::SetURIL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::SetURIL" );
+    
+    __ASSERTD( !iCommandMessage, __FILE__, __LINE__ );
+    
+    ResetL();
+
+    if( iPlaybackState == EPlaying || iPlaybackState == EPaused ||
+        iPlaybackState == EPlaySent )
+        {
+        iServer.ControlPoint().AvtStopActionL( iDevice->Uuid(),
+            iInstanceId );
+        }
+    
+    if( iItemShared )
+        {
+        iFileSharing->UnShareItemL( iSharedItem->Id() );
+        iItemShared = EFalse; 
+        }
+
+    // Uri is set by providing an item. Convert the item to xml document and
+    // send the action
+
+    __LOG( "SetURIL" );
+    
+    CUpnpAVRequest* tmpRequest = CUpnpAVRequest::NewLC();
+    
+    ReadReqFromMessageL( aMessage, 1 ,tmpRequest );
+    
+    CUpnpItem* tmpItem = CUpnpItem::NewL();
+    CleanupStack::PushL( tmpItem );
+    
+    ReadObjFromMessageL( aMessage, 2 ,tmpItem );
+
+    TPtrC8 uri = tmpRequest->URI();
+
+    const CUpnpElement& res = 
+        UPnPItemUtility::ResourceFromItemL( *tmpItem );
+    const CUpnpAttribute* protocolInfo = 
+        UPnPItemUtility::FindAttributeByName( 
+        res, KAttributeProtocolInfo );
+
+    if( !iDevice->MatchSinkProtocolInfo( protocolInfo->Value() ) )
+        {
+        // Did not match, try to find a match
+        TRAPD( err, uri.Set( iDevice->FindFirstMatchingInSinkL(
+            *tmpItem ) ) );
+        if( err == KErrNone )
+            {
+            // Suitable res-element found!
+            __LOG( "Suitable element found!" );
+            }
+        else if( err == KErrNotSupported )
+            {
+            // No suitable res-element
+            if( iDevice->DLNADeviceType() ==
+                CUpnpAVDeviceExtended::EDMR )
+                {
+                // DLNA content, DLNA device, no match -> leave
+                User::Leave( KErrNotSupported );                    
+                }
+            else
+                {
+                // Not a dlna device, try to set the uri of
+                // original res-element anyways
+                }
+            }
+        else
+            {
+            // Some error occured
+            User::Leave( err );
+            }    
+        }
+
+    ValidateProtocolInfoL( *protocolInfo );
+           
+    // Create metadata xml document
+    HBufC8* xmlDoc = CUPnPXMLParser::ItemAsXmlLC( *tmpItem );
+
+    iIPSessionIdCommand = iServer.ControlPoint().
+        AvtSetTransportUriActionL( iDevice->Uuid(), iInstanceId, uri,
+        //KNullDesC8 );
+        *xmlDoc );
+            
+    CleanupStack::PopAndDestroy( xmlDoc );
+    CleanupStack::PopAndDestroy( tmpItem );        
+    CleanupStack::PopAndDestroy( tmpRequest );      
+                         
+                
+    if( iIPSessionIdCommand > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdCommand );
+        }                             
+           
+    iCommandMessage = new (ELeave) RMessage2( aMessage );
+    
+    // after settransporturi, there is a delay to send play action.
+    if ( !iPlayDelayTimer->IsActive() )
+        {
+        iPlayDelayTimer->Start( 
+            0, KPlayDelayTimerInterval, 
+            TCallBack( PlayDelayTimeExpired , this ) );
+        }
+    else
+        {
+        iPlayDelayTimer->Cancel();
+        iPlayDelayTimer->Start( 
+            0, KPlayDelayTimerInterval, 
+            TCallBack( PlayDelayTimeExpired , this ) );
+        }
+    __LOG( "CUPnPPlaybackSession::SetURIL - end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelSetURIL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelSetURIL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelSetURIL" );
+    
+    if( iCommandMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+        iIPSessionIdCommand = KErrNotFound;
+        iCommandMessage->Complete( KErrCancel );
+        delete iCommandMessage; iCommandMessage = NULL;             
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::SetNextURIL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::SetNextURIL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::SetNextURIL" );
+    
+    __ASSERTD( !iCommandMessage, __FILE__, __LINE__ );
+    
+    ResetL();
+    
+    if( iNextItemShared )
+        {
+        iFileSharing->UnShareItemL( iNextSharedItem->Id() );
+        iNextItemShared = EFalse; 
+        }
+    
+    // Uri is set by providing an item. Convert the item to xml document and
+    // send the action
+    CUpnpAVRequest* tmpRequest = CUpnpAVRequest::NewLC();
+    
+    ReadReqFromMessageL( aMessage, 1 ,tmpRequest );
+    
+    CUpnpItem* tmpItem = CUpnpItem::NewL();
+    CleanupStack::PushL( tmpItem );
+    
+    ReadObjFromMessageL( aMessage, 2 ,tmpItem );
+
+    TPtrC8 uri = tmpRequest->URI();
+    
+    const CUpnpElement& res = 
+        UPnPItemUtility::ResourceFromItemL( *tmpItem );
+    const CUpnpAttribute* protocolInfo = 
+        UPnPItemUtility::FindAttributeByName( 
+        res, KAttributeProtocolInfo );
+          
+    if( !iDevice->MatchSinkProtocolInfo( protocolInfo->Value() ) )
+        {
+        // Did not match, try to find a match
+        TRAPD( err, uri.Set( iDevice->FindFirstMatchingInSinkL(
+            *tmpItem ) ) );
+        if( err == KErrNone )
+            {
+            // Suitable res-element found!
+            }
+        else if( err == KErrNotSupported )
+            {
+            // No suitable res-element
+            if( iDevice->DLNADeviceType() ==
+                CUpnpAVDeviceExtended::EDMR )
+                {
+                // DLNA content, DLNA device, no match -> leave
+                User::Leave( KErrNotSupported );                    
+                }
+            else
+                {
+                // Not a dlna device, try to set the uri of
+                // original res-element anyways
+                }    
+            }
+        else
+            {
+            // Some error occured
+            User::Leave( err );
+            }    
+        }
+
+    // Create metadata xml document
+    HBufC8* xmlDoc = CUPnPXMLParser::ItemAsXmlLC( *tmpItem );
+    
+    iIPSessionIdCommand = iServer.ControlPoint().
+        AvtSetNextTransportUriActionL( iDevice->Uuid(), iInstanceId, uri,
+        *xmlDoc );
+            
+
+    CleanupStack::PopAndDestroy( xmlDoc );
+    CleanupStack::PopAndDestroy( tmpItem );
+    CleanupStack::PopAndDestroy( tmpRequest );          
+                
+    if( iIPSessionIdCommand > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdCommand );
+        }                             
+           
+    iCommandMessage = new (ELeave) RMessage2( aMessage );
+    
+    __LOG( "CUPnPPlaybackSession::SetNextURIL - end" );
+ 
+   }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelSetNextURIL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelSetNextURIL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelSetNextURIL" );
+    
+    //__ASSERTD( iCommandPending, User::Panic( KPanicText, __LINE__ ) );
+    if( iCommandMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+        iIPSessionIdCommand = KErrNotFound;
+        iCommandMessage->Complete( KErrCancel );
+        delete iCommandMessage; iCommandMessage = NULL;            
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::PlayL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::PlayL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::PlayL" );
+    if ( !iPlayDelayTimer->IsActive() )
+        {
+        // timer is not running so some time has passed since subscribing
+    __ASSERTD( !iCommandMessage, __FILE__, __LINE__ );
+
+    ResetL();
+    
+    iIPSessionIdCommand = iServer.ControlPoint().AvtPlayActionL(
+        iDevice->Uuid(), iInstanceId, KNormalSpeed );
+    
+     if( iIPSessionIdCommand > 0 )
+        {
+        __LOG( "CUPnPPlaybackSession::PlayL - registering" );
+        // Register
+        iPlaybackState = EPlaySent;
+        iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdCommand );
+            }
+
+        }
+    else // less than KPlayDelayInterval passed since subscribe.
+        {
+        // issue the play after the timer expires to make sure some HW 
+        // renderers are not confused when beginning the playback.
+        iPlayRequested = ETrue;
+        }
+
+    iCommandMessage = new (ELeave) RMessage2( aMessage );
+    __LOG( "CUPnPPlaybackSession::PlayL - end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelPlayL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelPlayL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelPlayL" );
+    
+    //__ASSERTD( iCommandPending, User::Panic( KPanicText, __LINE__ ) );
+    if( iCommandMessage )
+        {
+        // cancel postponed play
+        if ( iPlayDelayTimer->IsActive() )
+            {
+            iPlayDelayTimer->Cancel();
+            }
+
+        iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+        iIPSessionIdCommand = KErrNotFound;
+        iCommandMessage->Complete( KErrCancel );
+        delete iCommandMessage; iCommandMessage = NULL;            
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::StopL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::StopL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::StopL" );
+    
+    __ASSERTD( !iCommandMessage, __FILE__, __LINE__ );
+
+    ResetL();
+    // state stopped must be check before stopped action    
+    if( iPlaybackState != EStopped )
+        {
+        iIPSessionIdCommand = iServer.ControlPoint().AvtStopActionL(
+            iDevice->Uuid(), iInstanceId );
+        }
+    
+     if( iIPSessionIdCommand > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdCommand );
+        }        
+    iCommandMessage = new (ELeave) RMessage2( aMessage );
+    
+    __LOG( "CUPnPPlaybackSession::StopL - end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelStopL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelStopL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelStopL" );
+    
+    if( iCommandMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+        iIPSessionIdCommand = KErrNotFound;
+        iCommandMessage->Complete( KErrCancel );
+        delete iCommandMessage; iCommandMessage = NULL;            
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::PauseL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::PauseL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::PauseL" );
+    
+    __ASSERTD( !iCommandMessage, __FILE__, __LINE__ );
+
+    ResetL();
+    
+    iIPSessionIdCommand = iServer.ControlPoint().AvtPauseActionL(
+        iDevice->Uuid(), iInstanceId );
+    
+     if( iIPSessionIdCommand > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdCommand );
+        }
+    iCommandMessage = new (ELeave) RMessage2( aMessage );
+    
+    __LOG( "CUPnPPlaybackSession::PauseL - end" );                
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelPauseL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelPauseL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelPauseL" );                
+    
+    if( iCommandMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionIdCommand );
+        iIPSessionIdCommand = KErrNotFound;
+        iCommandMessage->Complete( KErrCancel );
+        delete iCommandMessage; iCommandMessage = NULL;            
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::SetVolumeL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::SetVolumeL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::SetVolumeL" );                
+    
+    __ASSERTD( !iSettingMessage, __FILE__, __LINE__ );
+
+    ResetL();
+    
+    TInt volume = aMessage.Int1();
+    
+    TInt maxVolume = iDevice->MaxVolume();
+
+    // If max volume not KMaxVolume
+    if( maxVolume != KMaxVolume )
+        {
+        // Convert volume to match device's max volume
+        TReal tempVolumeLevel = volume;
+        TReal tempMaxVolume = maxVolume;
+        
+        volume = tempMaxVolume * tempVolumeLevel / KMaxVolume;
+        }
+       
+
+
+    iIPSessionIdSetting = iServer.ControlPoint().RcSetVolumetActionL(
+        iDevice->Uuid(), iInstanceId, KMasterVolume, volume );
+    
+     if( iIPSessionIdSetting > 0 )
+        {
+        __LOG( "CUPnPPlaybackSession::SetVolumeL - registering" );
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdSetting );
+        }
+        
+    iSettingMessage = new (ELeave) RMessage2( aMessage );                
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelSetVolumeL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelSetVolumeL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelSetVolumeL" );                
+    
+    if( iSettingMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+        iIPSessionIdSetting = KErrNotFound;
+        iSettingMessage->Complete( KErrCancel );
+        delete iSettingMessage; iSettingMessage = NULL;            
+        }
+    }    
+   
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::GetVolumeL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::GetVolumeL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::GetVolumeL" );                
+    
+    __ASSERTD( !iSettingMessage, __FILE__, __LINE__ );
+
+    ResetL();
+    
+    iIPSessionIdSetting = iServer.ControlPoint().RcGetVolumetActionL(
+        iDevice->Uuid(), iInstanceId, KMasterVolume );
+    
+     if( iIPSessionIdSetting > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdSetting );
+        }
+    iSettingMessage = new (ELeave) RMessage2( aMessage );                    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelGetVolumeL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelGetVolumeL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelGetVolumeL" );                
+    
+    if( iSettingMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+        iIPSessionIdSetting = KErrNotFound;
+        iSettingMessage->Complete( KErrCancel );
+        delete iSettingMessage; iSettingMessage = NULL;            
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::SetMuteL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::SetMuteL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::SetMuteL" );                
+    
+    __ASSERTD( !iSettingMessage, __FILE__, __LINE__ );
+
+    ResetL();
+
+    TInt mute = aMessage.Int1();
+    if( mute )
+        {
+        iIPSessionIdSetting = iServer.ControlPoint().RcSetMuteActionL(
+            iDevice->Uuid(), iInstanceId, KMasterVolume, KMuteOn );        
+        }
+    else
+        {
+        iIPSessionIdSetting = iServer.ControlPoint().RcSetMuteActionL(
+            iDevice->Uuid(), iInstanceId, KMasterVolume, KMuteOff );                
+        }    
+    
+     if( iIPSessionIdSetting > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdSetting );
+        }
+        
+    iSettingMessage = new (ELeave) RMessage2( aMessage );                 
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelSetMuteL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelSetMuteL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelSetMuteL" );                
+    
+    if( iSettingMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+        iIPSessionIdSetting = KErrNotFound;
+        iSettingMessage->Complete( KErrCancel );
+        delete iSettingMessage; iSettingMessage = NULL;            
+        }
+    }    
+   
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::GetMuteL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::GetMuteL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::GetMuteL" );                
+    
+    __ASSERTD( !iSettingMessage, __FILE__, __LINE__ );
+
+    ResetL();
+    
+    iIPSessionIdSetting = iServer.ControlPoint().RcGetMuteActionL(
+        iDevice->Uuid(), iInstanceId, KMasterVolume );
+    
+     if( iIPSessionIdSetting > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdSetting );
+        }
+    iSettingMessage = new (ELeave) RMessage2( aMessage );                    
+    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelGetMuteL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelGetMuteL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelGetMuteL" );                
+    
+    if( iSettingMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+        iIPSessionIdSetting = KErrNotFound;
+        iSettingMessage->Complete( KErrCancel );
+        delete iSettingMessage; iSettingMessage = NULL;            
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::GetPositionInfoL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::GetPositionInfoL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::GetPositionInfoL" );                
+    
+    __ASSERTD( !iSettingMessage, __FILE__, __LINE__ );
+
+    ResetL();
+
+    iIPSessionIdSetting = iServer.ControlPoint().AvtPositionInfoActionL(
+        iDevice->Uuid(), iInstanceId );
+    
+     if( iIPSessionIdSetting > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionIdSetting );
+        }
+    iSettingMessage = new (ELeave) RMessage2( aMessage );
+    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelGetPositionInfoL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelGetPositionInfoL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelGetPositionInfoL" );                
+    
+    if( iSettingMessage )
+        {
+        iServer.Dispatcher().UnRegister( iIPSessionIdSetting );
+        iIPSessionIdSetting = KErrNotFound;
+        iSettingMessage->Complete( KErrCancel );
+        delete iSettingMessage; iSettingMessage = NULL;            
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::DeviceDisappearedRequestL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::DeviceDisappearedRequestL(
+    const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPPlaybackSession::DeviceDisappearedRequestL" );
+    
+    __ASSERTD( !iDeviceMessage, __FILE__, __LINE__ );
+    
+    iDeviceMessage = new (ELeave ) RMessage2( aMessage );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::CancelDeviceDisappearedRequestL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::CancelDeviceDisappearedRequestL()
+    {
+    __LOG( "CUPnPPlaybackSession::CancelDeviceDisappearedRequestL" );
+    
+    if( iDeviceMessage )
+        {
+        iDeviceMessage->Complete( KErrCancel );
+        delete iDeviceMessage; iDeviceMessage = NULL;             
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::ParseBrowseResponseL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+HBufC8* CUPnPPlaybackSession::ParseBrowseResponseL( const TDesC8& aResponse )
+    {
+    __LOG( "CUPnPPlaybackSession::ParseBrowseResponseL" );                
+    
+    HBufC8* resource = NULL;
+    
+    CUPnPXMLParser* parser = CUPnPXMLParser::NewL();
+    CleanupStack::PushL( parser );
+    
+    RPointerArray<CUpnpObject> array;
+    CleanupResetAndDestroyPushL( array );
+    
+    parser->ParseResultDataL( array, aResponse );
+    
+    if( array.Count() == KExpectedCount )
+        {
+        if( array[ 0 ]->ObjectType() == EUPnPItem )
+            {
+            CUpnpItem* item = static_cast<CUpnpItem*>( array[ 0 ] );
+            resource = UPnPItemUtility::ResourceFromItemL(
+                *item ).Value().AllocL();
+            CleanupStack::PushL( resource );
+
+            const CUpnpElement& res = 
+                UPnPItemUtility::ResourceFromItemL( *item );
+            const CUpnpAttribute* protocolInfo = 
+                UPnPItemUtility::FindAttributeByName( 
+                res, KAttributeProtocolInfo );
+
+            if( !iDevice->MatchSinkProtocolInfo( protocolInfo->Value() ) )
+                {
+               TPtrC8 uri;
+                // Did not match, try to find a match
+                TRAPD( err, uri.Set( iDevice->FindFirstMatchingInSinkL(
+                    *item ) ) );
+                if( err == KErrNone )
+                    {
+                    // Suitable res-element found!
+                    CleanupStack::PopAndDestroy( resource );
+                    resource = uri.AllocL();
+                    }
+                else if( err == KErrNotSupported )
+                    {
+                    // No suitable res-element
+                    if( iDevice->DLNADeviceType() ==
+                        CUpnpAVDeviceExtended::EDMR )
+                        {
+                        // DLNA content, DLNA device, no match -> leave
+                        User::Leave( KErrNotSupported );                    
+                        }
+                    else
+                        {
+                        // Not a dlna device, try to set the uri of
+                        // original res-element anyways
+                        CleanupStack::Pop( resource );
+                        }    
+                    }
+                else
+                    {
+                    // Some error occured
+                    User::Leave( err );
+                    }    
+                }
+            }
+        else
+            {
+            User::Leave( KErrGeneral );
+            }    
+        }
+    else
+        {
+        User::Leave( KErrGeneral );
+        }    
+        
+    CleanupStack::PopAndDestroy( &array );
+    CleanupStack::PopAndDestroy( parser );
+       
+    __LOG( "CUPnPPlaybackSession::ParseBrowseResponseL - end" );
+    
+    if( !resource )
+        {
+        User::Leave( KErrGeneral );
+        }
+        
+    return resource;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::Uuid
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+const TDesC8& CUPnPPlaybackSession::Uuid() const
+    {
+    if( iDevice )
+        {
+        return iDevice->Uuid();
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::EncodeXmlL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+HBufC8* CUPnPPlaybackSession::EncodeXmlL( const TDesC8& aResult )
+    {
+    HBufC8* tmpBuf = aResult.AllocLC();
+    HBufC8* result = UpnpString::EncodeXmlStringL( tmpBuf );
+    CleanupStack::PopAndDestroy( tmpBuf );
+    return result;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::Reset
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::ResetL()
+    {
+    __LOG( "CUPnPPlaybackSession::ResetL" );
+    
+    if( !iServer.DeviceRepository().IsWlanActive() )    
+        {
+        __LOG( "Reset - disconnected" );
+        User::Leave( KErrDisconnected );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::ReadObjFromMessageL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::ReadObjFromMessageL( const RMessage2& aMessage, 
+    TInt aSlot, CUpnpObject* aObj )
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength( aSlot );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( aSlot, ptr ) );
+    
+    // read stream
+    RDesReadStream stream( *buf );
+    CleanupClosePushL( stream );
+    
+    // internalize object
+    stream >> *aObj;
+    
+    // clean up
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buf );
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::ReadReqFromMessageL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::ReadReqFromMessageL( const RMessage2& aMessage, 
+    TInt aSlot, CUpnpAVRequest* aReq ) 
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength( aSlot );
+    HBufC8* buf = HBufC8::NewLC( len );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( aSlot, ptr ) );
+    
+    // read stream
+    RDesReadStream stream( *buf );
+    CleanupClosePushL( stream );
+    
+    // internalize object
+    stream >> *aReq;
+    
+    // clean up
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buf );
+    }    
+
+void CUPnPPlaybackSession::ValidateProtocolInfoL( const CUpnpAttribute&
+    aResource )
+    {
+    __LOG( "CUPnPPlaybackSession::ValidateProtocolInfoL" );
+    
+    // Whe'd like to modify the original protocolInfo, that's why constness
+    // is casted away
+    CUpnpAttribute& attr = const_cast<CUpnpAttribute&>( aResource );
+    
+    // ProtocolInfo-wrapper takes care of 4th field validation, omitting
+    // invalid optional parameters
+    CUpnpDlnaProtocolInfo* tmpInfo = 
+        CUpnpDlnaProtocolInfo::NewL( attr.Value() );
+    CleanupStack::PushL( tmpInfo );
+    
+    tmpInfo->SetSecondFieldL( KAsterisk ); // Second field must be '*'
+    
+    attr.SetValueL( tmpInfo->ProtocolInfoL() );
+        
+    CleanupStack::PopAndDestroy( tmpInfo );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::SendPlayIfNeededL
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+void CUPnPPlaybackSession::SendPlayIfNeededL()
+    {
+    __LOG( "CUPnPPlaybackSession::SendPlayIfNeededL" );
+    if ( iPlayRequested )
+        {
+        // during the timer was running, there was a play request.
+        // handle it here
+        iPlayRequested = EFalse; // play request is being handled
+
+        ResetL();
+
+        iIPSessionIdCommand = iServer.ControlPoint().AvtPlayActionL(
+            iDevice->Uuid(), iInstanceId, KNormalSpeed );
+
+        if( iIPSessionIdCommand > 0 )
+            {
+            __LOG( "CUPnPPlaybackSession::SendPlayIfNeededL - registering" );
+            // Register
+            iPlaybackState = EPlaySent;
+            iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this );
+            }
+        else
+            {
+            User::Leave( iIPSessionIdCommand );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackSession::PlayDelayTimeExpired
+// See upnpplaybacksession.h
+// --------------------------------------------------------------------------
+TInt CUPnPPlaybackSession::PlayDelayTimeExpired( TAny* aPtr )
+    {
+    __LOG( "CUPnPPlaybackSession::PlayDelayTimeExpired" );
+    TRAPD( err, ( static_cast< CUPnPPlaybackSession* >( aPtr ) )->
+           SendPlayIfNeededL() );
+    
+    if ( err )
+        {
+        __LOG( "CUPnPPlaybackSession::PlayDelayTimeExpired error" );
+        }
+
+    return ETrue;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpresourcehelper.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resource helper for upload session
+*
+*/
+
+
+
+
+
+
+// EXTERNAL INCLUDES
+#include <upnpitem.h>
+
+// INTERNAL INCLUDES
+#include "upnpresourcehelper.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::NewL
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+CUPnPResourceHelper* CUPnPResourceHelper::NewL()
+    {
+    CUPnPResourceHelper* timer = new(ELeave) CUPnPResourceHelper();
+    CleanupStack::PushL( timer );
+    timer->ConstructL();
+    CleanupStack::Pop();
+    return timer;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::~CUPnPResourceHelper
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+CUPnPResourceHelper::~CUPnPResourceHelper()
+    { 
+    delete iResource;
+    delete iItemId;
+    delete iItem;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::CUPnPResourceHelper
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+CUPnPResourceHelper::CUPnPResourceHelper()
+    {
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::ConstructL
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+void CUPnPResourceHelper::ConstructL()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::SetResource
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+void CUPnPResourceHelper::SetResource( HBufC* aResource )
+    {
+    delete iResource;
+    iResource = aResource;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::Resource
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+HBufC* CUPnPResourceHelper::Resource()
+    {
+    return iResource;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::SetItemId
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+void CUPnPResourceHelper::SetItemId( HBufC8* aItemId )
+    {
+    delete iItemId;
+    iItemId = aItemId;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::ItemId
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+HBufC8* CUPnPResourceHelper::ItemId()
+    {
+    return iItemId;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::SetItem
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+void CUPnPResourceHelper::SetItem( CUpnpItem* aItem )
+    {
+    delete iItem;
+    iItem = aItem;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPResourceHelper::Item
+// See upnpavtimer.h
+// --------------------------------------------------------------------------
+CUpnpItem* CUPnPResourceHelper::Item()
+    {
+    return iItem;
+    }
+    
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpuploadsession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,938 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      server impl. of session against media server
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+// upnp stack api
+#include <upnpitem.h>
+#include <upnpattribute.h>
+#include <upnpstring.h>
+#include <upnpdlnaprotocolinfo.h>
+#include <upnpavcontrolpoint.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for upnp-specific stuff
+#include "upnpitemutility.h" // FindElementByNameL, GetResElements
+
+// upnpframework / xmlparser api
+#include "upnpxmlparser.h"
+
+// upnpframework / internal api's
+#include "upnpcdsreselementutility.h"
+#include "httpuploader.h"
+#include "upnpmetadatafetcher.h"
+#include "upnpcommonutils.h"
+
+// INTERNAL INCLUDES
+#include "upnpuploadsession.h"
+#include "upnpfiletransferitem.h"
+#include "upnpavcontrollerserver.h"
+#include "upnpfiletransferitem.h"
+#include "upnpavdeviceextended.h"
+#include "upnpavdispatcher.h"
+#include "upnpaverrorhandler.h"
+#include "upnpresourcehelper.h"
+
+_LIT( KComponentLogfile, "upnpavcontrollerserver.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT8( KImportUri,              "importUri" );
+_LIT8( KAsterisk,               "*" );
+const TUint32 KBufferSize       = 0x40000; // 256K
+const TInt KParallerTransfers   = 1;
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::NewL
+// See upnpuploadsession.h
+// --------------------------------------------------------------------------
+CUPnPUploadSession* CUPnPUploadSession::NewL( CUpnpAVControllerServer&
+    aServer, TInt aSessionId, const TDesC8& aUuid )
+    {
+    CUPnPUploadSession* self = new (ELeave) CUPnPUploadSession(
+        aServer, aSessionId );
+    CleanupStack::PushL( self );    
+    self->ConstructL( aUuid );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::CUPnPUploadSession
+// See upnpuploadsession.h
+// --------------------------------------------------------------------------
+CUPnPUploadSession::CUPnPUploadSession( CUpnpAVControllerServer& aServer,
+    TInt aSessionId ) :
+    CUPnPFileTransferSessionBase( aServer, aSessionId ),
+    iResourceIndex( KErrNotFound ),
+    iAsyncError( KErrNone ),
+    iIPSessionId( KErrNotFound ),
+    iSchedulerStopped( ETrue )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::~CUPnPUploadSession
+// See upnpuploadsession.h
+// --------------------------------------------------------------------------
+CUPnPUploadSession::~CUPnPUploadSession()
+    {
+    __LOG( "CUPnPUploadSession::~CUPnPUploadSession" );
+
+    delete iUploader;
+    iResources.ResetAndDestroy();
+    
+    __LOG( "CUPnPUploadSession::~CUPnPUploadSession - end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::ConstructL
+// See upnpuploadsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::ConstructL( const TDesC8& aUuid )
+    {
+    __LOG( "CUPnPUploadSession::ConstructL" );
+    
+    CUPnPFileTransferSessionBase::ConstructL( aUuid );
+
+    iUploader = CHttpUploader::NewL( *this, (TUint32)iServer.IAP(),
+        KBufferSize, KParallerTransfers );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPDownloadSession::TransferProgress
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::TransferProgress( TAny* aKey, TInt aBytes,
+    TInt aTotalBytes )
+    {
+    __LOG( "CUPnPUploadSession::TransferProgress" );
+    
+    if( iProgressTrackingEnabled )
+        {
+        TUpnpFileTransferEvent item;
+        TInt err = FindItemByKey( item, (TInt)aKey );
+        if( err == KErrNone )
+            {
+            item.iStatus = KErrNone;
+            item.iParam2 = aTotalBytes;
+            item.iParam1 = aBytes;
+            item.iEvent = TUpnpFileTransferEvent::ETransferProgress;
+
+            Complete( item );
+            }
+        else
+            {
+            __LOG( "TransferProgress - Not enabled!" );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::ReadyForTransfer
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::ReadyForTransferL( TAny* aKey )
+    {
+    __LOG( "CUPnPUploadSession::ReadyForTransferL" );
+    
+    TUpnpFileTransferEvent event;
+    if( FindItemByKey( event, (TInt)aKey, iResourceIndex ) == KErrNone )
+        {
+        ReadyForTransferL( event );
+        
+        event.iEvent = TUpnpFileTransferEvent::ETransferStarted;
+        Complete( event );
+        }
+    else
+        {
+        __LOG( "ReadyForTransfer - Key not found" );
+        
+        // Not found
+        event.iStatus = KErrGeneral;
+        event.iParam2 = 0;
+        event.iEvent = TUpnpFileTransferEvent::ETransferCompleted;
+        
+        Complete( event );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::TransferCompleted
+// See upnpdownloadsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::TransferCompleted( TAny* aKey, TInt aStatus )
+    {
+    __LOG2( "CUPnPUploadSession::TransferCompleted, key = %d, status = %d",
+            (TInt)aKey, aStatus );
+    
+    TUpnpFileTransferEvent item;
+    TInt index;
+    TInt err = FindItemByKey( item, (TInt)aKey, index );
+    if( err == KErrNone )
+        {
+        item.iStatus = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aStatus,
+        EUPnPHTTPError );
+        
+        item.iEvent = TUpnpFileTransferEvent::ETransferCompleted;
+        Complete( item );
+                
+        iTransferItems.Remove( index );
+        delete iResources[ index ];
+        iResources.Remove( index );
+        }
+    else
+        {
+        __LOG( "TransferCompleted - Key not found" );
+        
+        // Not found
+        if( aStatus == KErrCancel )
+            {
+            item.iStatus = aStatus;
+            }
+        else
+            {
+            item.iStatus = KErrGeneral;    
+            }    
+        
+        item.iParam2 = 0;
+        item.iEvent = TUpnpFileTransferEvent::ETransferCompleted;
+        
+        Complete( item );
+        } 
+    
+    if( aStatus == KErrDisconnected )
+        {
+        __LOG( "TransferCompleted - Target device lost" );
+        
+        TInt count = iTransferItems.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            iUploader->CancelTransfer( (TAny*)iTransferItems[i].iKey );
+
+            if( iResources[ i ]->ItemId() )
+                {
+                // Send destroyobject
+                __LOG( "CancelAllUploadsL - sending destroyobject" );
+                TRAP_IGNORE( iServer.ControlPoint().CdsDestroyObjectActionL(
+                    iDevice->Uuid(), *iResources[ i ]->ItemId() ) );  
+                }
+            }
+        iResources.ResetAndDestroy();    
+        iTransferItems.Reset();
+        }      
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::CdsCreateObjectResponse
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::CdsCreateObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt aSessionId,
+    TInt aErr,
+    const TDesC8& /*aContainerID*/, 
+    const TDesC8& /*aElements*/, 
+    const TDesC8& aObjectID, 
+    const TDesC8& aResult )
+    {
+    __LOG1( "CUPnPUploadSession::CdsCreateObjectResponse: %d" , aErr );
+    
+    __ASSERTD( iIPSessionId == aSessionId, __FILE__, __LINE__ );
+    
+    __ASSERTD( iTransferItems.Count() == iResources.Count(), __FILE__, 
+               __LINE__ );
+    
+    iServer.Dispatcher().UnRegister( iIPSessionId );
+    iIPSessionId = KErrNotFound;
+    
+    aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr,
+        EUPnPContentDirectoryError );
+
+    if( aErr == KErrNone )
+        {
+        TRAP( aErr, HandleObjectResponseL( aObjectID, aResult ) );
+        }        
+    
+    iAsyncError = aErr;
+    StopWait();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::StartUploadL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::StartUploadL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPUploadSession::StartUploadL" );
+    
+    __ASSERTD( iTransferItems.Count() == iResources.Count(), __FILE__, 
+               __LINE__ );
+    
+    CUpnpFileTransferItem* tmpTransferItem = CUpnpFileTransferItem::NewLC();
+        
+    ReadTransferItemFromMessageL( aMessage, 1 ,tmpTransferItem );
+        
+    if( CheckIfKeyExists( tmpTransferItem->Key() ) )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    TUpnpFileTransferEvent transferItem;        
+    transferItem.iKey = tmpTransferItem->Key();
+            
+    CUpnpItem* tmpUpnpItem = UPnPMetadataFetcher::CreateItemFromFileLC( 
+        tmpTransferItem->Path() );
+        
+    tmpUpnpItem->SetIdL( KNullDesC8 );
+    tmpUpnpItem->SetParentIdL( KContainerIdAny );
+    tmpUpnpItem->SetRestricted( EFalse );
+
+    const CUpnpElement& resEl = UPnPItemUtility::FindElementByNameL(
+        *tmpUpnpItem, KElementRes );
+
+    const CUpnpAttribute* pInfo = UPnPItemUtility::FindAttributeByName(
+        resEl, KAttributeProtocolInfo );  
+      
+    if( iDevice->DlnaCompatible() )
+        {
+        // Dlna device, additional checks required
+        __LOG( "StartUploadL - DLNA device" );
+        
+        TPtrC8 objectClass = tmpUpnpItem->ObjectClass(); 
+        if( objectClass.Find( KClassAudio ) != KErrNotFound &&
+            iDevice->AudioUpload() )
+            {
+            // Trying to upload audio and it's supported
+            }
+        else if( objectClass.Find( KClassImage ) != KErrNotFound &&
+            iDevice->ImageUpload() )
+            {
+            // Trying to upload images and it's supported
+            }
+        else if(  objectClass.Find( KClassVideo ) != KErrNotFound &&
+            iDevice->VideoUpload() )
+            {
+            // Trying to upload video and it's supported
+            }
+        else
+            {
+            // Unknown media type, or copy not supported
+            __LOG( "StartUploadL - Unknown media type, or copy not \
+supported" );
+            User::Leave( KErrNotSupported );
+            }    
+
+            if( iDevice->ValidateTransfer( pInfo->Value() ) )
+                {
+                __LOG( "StartUploadL - Match by protocolInfo succeeded" );
+                // Continue with DLNA upload
+                // ProtocolInfo is in DLNA format
+                }
+            else
+                {
+                __LOG( "StartUploadL - Match by protocolInfo failed, upload \
+as UPnP content" );
+                // Continue with UPnP upload
+                // Check the protocolInfo
+                ProtocolInfoToUPnPL( pInfo );
+                }        
+        }
+    else
+        {
+        __LOG( "StartUploadL - UPnP Device -> UPnP upload" );
+        // Continue with UPnP upload
+        // Check the protocolInfo
+        ProtocolInfoToUPnPL( pInfo );        
+        }
+        
+    iUploader->InsertFileIntoWaitQueueL( (TAny*)transferItem.iKey,
+        tmpTransferItem->Path(), KNullDesC8 );
+    
+    SetHeadersL( pInfo->Value(), (TAny*)transferItem.iKey );
+    
+    iTransferItems.Append( transferItem );
+    
+    CUPnPResourceHelper* helper = CUPnPResourceHelper::NewL();
+    CleanupStack::Pop( tmpUpnpItem );
+    helper->SetItem( tmpUpnpItem ); // Transfer ownership
+    iResources.Append( helper );
+    
+    iUploader->MoveToTransferQueueL( (TAny*)transferItem.iKey );
+    
+    CleanupStack::PopAndDestroy( tmpTransferItem );
+    
+    aMessage.Complete( KErrNone );
+    
+    __LOG( "CUPnPUploadSession::StartUploadL - end " );    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::CancelUploadL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::CancelUploadL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPUploadSession::CancelUploadL" );          
+    
+    __ASSERTD( iTransferItems.Count() == iResources.Count(), __FILE__,
+               __LINE__ );
+    
+    TInt key = aMessage.Int1();
+
+    TInt index;
+    if( CheckIfKeyExists( key, index ) )
+        {
+        iUploader->CancelTransfer( (TAny*)key );
+        aMessage.Complete( KErrNone );
+        iTransferItems.Remove( index );
+        if( iResources[ index ]->ItemId() )
+            {
+            // Send destroyobject
+            iServer.ControlPoint().CdsDestroyObjectActionL( iDevice->Uuid(),
+                *iResources[ index ]->ItemId() );
+            }
+        delete iResources[index ];
+        iResources.Remove( index );   
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }        
+    
+    __LOG( "CUPnPUploadSession::CancelUploadL - end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::CancelAllUploadsL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::CancelAllUploadsL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPUploadSession::CancelAllUploadsL" );          
+    
+    __ASSERTD( iTransferItems.Count() == iResources.Count(), __FILE__,
+               __LINE__ );
+        
+    TInt count = iTransferItems.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        iUploader->CancelTransfer( (TAny*)iTransferItems[i].iKey );
+
+        if( iResources[ i ]->ItemId() )
+            {
+            // Send destroyobject
+            __LOG( "CancelAllUploadsL - sending destroyobject" );
+            iServer.ControlPoint().CdsDestroyObjectActionL( iDevice->Uuid(),
+                *iResources[ i ]->ItemId() );  
+            }
+        }
+    iResources.ResetAndDestroy();
+    iTransferItems.Reset();
+    iEventQueu.Reset();
+
+    // Scheduler loop started, stop it and ignore createobject-resp
+    __LOG( "CancelAllUploadsL - Un register" );
+    iServer.Dispatcher().UnRegister( iIPSessionId );
+    iIPSessionId = KErrNotFound;
+    iAsyncError = KErrCancel;
+
+    __LOG( "CancelAllUploadsL - Stop scheduler loop" );
+    StopWait();
+
+    aMessage.Complete( KErrNone );
+
+    __LOG( "CUPnPUploadSession::CancelAllUploadsL - end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::StartTrackingUploadProgressL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::StartTrackingUploadProgressL( const RMessage2&
+    aMessage )
+    {
+    __LOG( "CUPnPUploadSession::StartTrackingUploadProgressL" );
+    
+    TInt key = aMessage.Int1();
+    if( CheckIfKeyExists( key ) )
+        {
+        iUploader->TrackProgress( (TAny*)key, ETrue );
+        iProgressTrackingEnabled = ETrue;
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::StopTrackingUploadProgressL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::StopTrackingUploadProgressL( const RMessage2&
+    aMessage )
+    {
+    __LOG( "CUPnPUploadSession::StopTrackingUploadProgressL" );
+    
+    TInt key = aMessage.Int1();
+    if( CheckIfKeyExists( key ) )
+        {
+        iUploader->TrackProgress( (TAny*)key, EFalse );
+        iProgressTrackingEnabled = EFalse;        
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        aMessage.Complete( KErrNotFound );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::GetUploadEventL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::GetUploadEventL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPUploadSession::GetUploadEventL" );
+    
+    if( iEventQueu.Count() )
+        {
+        // There are events in the queu, write the first queued event back
+        // to client
+        __LOG1( "GetUploadEventL - events in queu, count = %d",
+            iEventQueu.Count() );
+        TPckg<TUpnpFileTransferEvent> resp1( iEventQueu[0] );
+        aMessage.Write( 1, resp1  ); // Write response using slot 1
+        aMessage.Complete( KErrNone );
+        
+        iEventQueu.Remove( 0 );
+        }
+    else
+        {
+        __ASSERTD( !iEventMsg, __FILE__, __LINE__ );
+        __LOG( "GetUploadEventL - Store msg" );
+        iEventMsg = new (ELeave) RMessage2( aMessage );
+        } 
+    __LOG( "CUPnPUploadSession::GetUploadEventL - end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::CancelGetUploadEventL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::CancelGetUploadEventL( const RMessage2& aMessage )
+    {
+    __LOG( "CUPnPUploadSession::CancelGetUploadEventL" );          
+    
+    if( iEventMsg )
+        {
+        iEventMsg->Complete( KErrCancel );
+        delete iEventMsg; iEventMsg = NULL;
+        }
+    aMessage.Complete( KErrNone );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::DeviceDisappearedL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::DeviceDisappearedL(
+    CUpnpAVDeviceExtended& aDevice )
+    {
+    __LOG( "CUPnPUploadSession::DeviceDisappearedL" );
+
+    if( aDevice.Uuid().Compare( iDevice->Uuid() ) == 0 )
+        {
+        TUpnpFileTransferEvent event;
+        event.iEvent = TUpnpFileTransferEvent::EDeviceDisconnected;
+
+        Complete( event );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::SetHeadersL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::SetHeadersL( const TDesC8& aInfo, TAny* aKey )
+    {
+    CUpnpDlnaProtocolInfo* tmpInfo = CUpnpDlnaProtocolInfo::NewL( aInfo );
+    CleanupStack::PushL( tmpInfo );
+
+    // Set the content-type header
+    iUploader->SetHeaderL( aKey, KContentType,
+        tmpInfo->ThirdField() );
+    
+    // Set the expect header
+    iUploader->SetHeaderL( aKey, KExpectHeader, K100Continue );
+
+    CleanupStack::PopAndDestroy( tmpInfo );            
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::ReadyForTransferL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::ReadyForTransferL( TUpnpFileTransferEvent& aEvent )
+    {
+    __LOG( "CUPnPUploadSession::ReadyForTransferL" );
+    
+    if ( !iSchedulerStopped || iWait.IsStarted() )
+        {
+        __LOG1( "CUPnPUploadSession::ReadyForTransferL\
+        IsStarted = %d", (TInt)iWait.IsStarted() );
+        __LOG1( "CUPnPUploadSession::ReadyForTransferL\
+        iSchedulerStopped = %d", (TInt)iSchedulerStopped );
+        User::Leave( KErrNotReady );
+        }
+
+    __ASSERTD( iTransferItems.Count() == iResources.Count(), __FILE__, 
+               __LINE__ );
+    
+    CUpnpItem* tmpUpnpItem = iResources[ iResourceIndex ]->Item();
+    if( !tmpUpnpItem )
+        {
+        User::Leave( KErrCorrupt );
+        }
+    
+    HBufC8* xmlDoc = CUPnPXMLParser::XmlForCreateObjectLC(
+        *tmpUpnpItem );
+    
+    iIPSessionId = iServer.ControlPoint().CdsCreateObjectActionL(
+        iDevice->Uuid(), KContainerIdAny, *xmlDoc );
+
+    if( iIPSessionId > 0 )
+        {
+        // Register
+        iServer.Dispatcher().RegisterL( iIPSessionId, *this );
+        }
+    else
+        {
+        User::Leave( iIPSessionId );
+        }                             
+    
+    CleanupStack::PopAndDestroy( xmlDoc );
+    
+    iWait.Start();
+    
+    __LOG1( "CUPnPUploadSession::ReadyForTransferL\
+        iAsyncError = %d", iAsyncError );
+
+    User::LeaveIfError( iAsyncError );
+
+    const CUpnpElement& resEl = UPnPItemUtility::FindElementByNameL(
+        *iResources[ iResourceIndex ]->Item(), KElementRes );
+
+    const CUpnpAttribute* pInfo = UPnPItemUtility::FindAttributeByName(
+        resEl, KAttributeProtocolInfo );  
+
+    CUpnpDlnaProtocolInfo* tmpInfo = CUpnpDlnaProtocolInfo::NewL(
+        pInfo->Value() );
+    CleanupStack::PushL( tmpInfo );      
+    
+    // Set DLNA specific headers    
+    if( tmpInfo->PnParameter().Length() )
+        {
+        // DLNA content, set the content-features header
+        iUploader->SetHeaderL( (TAny*)aEvent.iKey, KContentFeatures,
+            tmpInfo->FourthField() );        
+
+        // Check if background mode is available and use it if it is
+        if( tmpInfo->DlnaFlag( UpnpDlnaProtocolInfo::TM_B_FLAG ) )
+            {
+            __LOG( "ReadyForTransferL - Use background mode" );
+            
+            iUploader->SetHeaderL( (TAny*)aEvent.iKey, KTransferMode,
+                KBackgroundMode );  
+            }
+        else
+            {
+            // Background is not available for some reason.
+            // Check if media specific transfer mode is available
+            if( UPnPCommonUtils::IsImageSupported( tmpInfo->ProtocolInfoL() ) )
+                {
+                // Uploading image, alternative for background is interactive
+                if( tmpInfo->DlnaFlag( UpnpDlnaProtocolInfo::TM_I_FLAG ) )
+                    {
+                    __LOG( "ReadyForTransferL - Use interactive mode" );
+                    iUploader->SetHeaderL( (TAny*)aEvent.iKey, KTransferMode,
+                        KInteractiveMode );
+                    }
+                else
+                    {
+                    // Target DMS does not support appropriate transfer mode
+                    __LOG( "ReadyForTransferL - No appropriate mode" );
+                    // Still, give a try and use background
+                    iUploader->SetHeaderL( (TAny*)aEvent.iKey, KTransferMode,
+                        KBackgroundMode );  
+                    }            
+                }
+            else if( UPnPCommonUtils::IsAudioSupported(
+                        tmpInfo->ProtocolInfoL() ) ||
+                    UPnPCommonUtils::IsVideoSupported(
+                        tmpInfo->ProtocolInfoL() ) )
+                {
+                // Uploading A/V, alternative for background is streaming
+                if( tmpInfo->DlnaFlag( UpnpDlnaProtocolInfo::TM_S_FLAG ) )
+                    {
+                    __LOG( "ReadyForTransferL - Use streaming mode" );
+                    iUploader->SetHeaderL( (TAny*)aEvent.iKey, KTransferMode,
+                    KStreamingMode );
+                    }
+                else
+                    {
+                    // Target DMS does not support appropriate transfer mode
+                    __LOG( "ReadyForTransferL - No appropriate mode" );
+                    // Still, give a try and use background
+                    iUploader->SetHeaderL( (TAny*)aEvent.iKey, KTransferMode,
+                        KBackgroundMode );  
+                    }                 
+                }
+            else
+                {
+                __LOG( "ReadyForTransferL - Unknown media type" );
+                }    
+                        
+            }            
+
+        }                
+    
+    CleanupStack::PopAndDestroy( tmpInfo ); 
+    
+    iUploader->SetPropertyL( (TAny*)aEvent.iKey,
+        CHttpTransferBase::ETargetURI,
+        *iResources[ iResourceIndex ]->Resource() );
+            
+    iUploader->StartTransferL( (TAny*)aEvent.iKey );
+        
+    __LOG( "CUPnPUploadSession::ReadyForTransferL - end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::ParseCreateObjectResponseL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::HandleObjectResponseL( const TDesC8& aObjectID,
+    const TDesC8& aResult )
+    {
+    __LOG( "CUPnPUploadSession::HandleObjectResponseL" );          
+    
+    HBufC8* importUri = ParseCreateObjectResponseL( aResult );
+    CleanupStack::PushL( importUri );
+
+    HBufC8* tmpUri = UpnpString::EncodeXmlStringL( importUri );
+    CleanupStack::PopAndDestroy( importUri );
+    CleanupStack::PushL( tmpUri );
+        
+    HBufC* tmpUri16 = UpnpString::ToUnicodeL( *tmpUri );
+    CleanupStack::PopAndDestroy( tmpUri );
+          
+    iResources[ iResourceIndex ]->SetResource( tmpUri16 );
+        
+    HBufC8* tmpID = aObjectID.AllocL();
+    iResources[ iResourceIndex ]->SetItemId( tmpID );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::ParseCreateObjectResponseL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+HBufC8* CUPnPUploadSession::ParseCreateObjectResponseL(
+    const TDesC8& aResponse )
+    {
+    __LOG( "CUPnPUploadSession::ParseCreateObjectResponseL" );          
+    
+    HBufC8* importURI = NULL;
+    
+    CUPnPXMLParser* parser = CUPnPXMLParser::NewL();
+    CleanupStack::PushL( parser );
+    
+    RPointerArray<CUpnpObject> array;
+    CleanupResetAndDestroyPushL( array );
+    
+    parser->ParseResultDataL( array, aResponse );
+    
+    TInt count = array.Count();
+    
+    // Lets find the first item with an import URI and use that
+    for( TInt i = 0; i < count; i++ )
+        {
+        importURI = ImportURIFromItemL( *array[ i ] );
+        if( importURI )
+            {
+             // Transfer ownership, casting is safe
+             // (array[ 0 ]->ObjectType() == EUPnPItem)
+            CUpnpItem* item = static_cast<CUpnpItem*>( array[ i ] );
+            iResources[ iResourceIndex ]->SetItem( item );
+            array.Remove( i );
+            i = count;
+            }
+        }
+    if( !importURI ) // no suitable items, leave
+        {
+        User::Leave( KErrGeneral );
+        }
+            
+    CleanupStack::PopAndDestroy( &array );
+    CleanupStack::PopAndDestroy( parser );  
+              
+    if( !UpnpCdsResElementUtility::IsUriAbsolute( *importURI ) )
+        {
+        // Import uri is not absolute, upload not supported. leave.
+        delete importURI; importURI = NULL;
+        User::Leave( KErrGeneral );
+        }
+      
+    return importURI;
+    }       
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::ImportURIFromItemL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+HBufC8* CUPnPUploadSession::ImportURIFromItemL( const CUpnpObject& aObject )
+    {
+    HBufC8* importURI = NULL;
+    if( aObject.ObjectType() == EUPnPItem )
+        {
+        // Get the res-elements
+        RUPnPElementsArray elArray;
+        CleanupClosePushL( elArray );
+        UPnPItemUtility::GetResElements( aObject, elArray );
+        
+        // Find the import uri 
+        TInt count = elArray.Count();           
+        for( TInt i = 0; i < count; i++ )
+            {
+            const CUpnpAttribute* attribute = NULL;
+            attribute = &UPnPItemUtility::FindAttributeByNameL(
+                *elArray[ i ], KImportUri );
+            if( attribute )
+                {
+                // import uri found
+                i = count;
+                importURI = attribute->Value().AllocL();
+                }
+            }            
+        CleanupStack::PopAndDestroy( &elArray );        
+        }
+    return importURI;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPUploadSession::ProtocolInfoToUPnPL
+// See upnpbrowsingsession.h
+// --------------------------------------------------------------------------
+void CUPnPUploadSession::ProtocolInfoToUPnPL( const CUpnpAttribute* aInfo )
+    {
+    __LOG( "CUPnPUploadSession::ProtocolInfoToUPnPL" );
+    
+    CUpnpDlnaProtocolInfo* destInfo =
+        CUpnpDlnaProtocolInfo::NewL( aInfo->Value() );
+    CleanupStack::PushL( destInfo );
+    
+    if( destInfo->PnParameter().Length() )
+        {
+        __LOG( "ProtocolInfoToUPnPL - Convert to UPnP" );
+        
+        CUpnpProtocolInfo* targetInfo = CUpnpProtocolInfo::NewL();
+        CleanupStack::PushL( targetInfo );
+        
+        targetInfo->SetFirstFieldL( destInfo->FirstField() );
+        targetInfo->SetSecondFieldL( KAsterisk );
+        targetInfo->SetThirdFieldL( destInfo->ThirdField() );
+        targetInfo->SetFourthFieldL( KAsterisk );
+        
+        // A bit dirty const cast.. but makes implementation much easier
+        CUpnpAttribute* bute = const_cast<CUpnpAttribute*>( aInfo );
+        bute->SetValueL( targetInfo->ProtocolInfoL() );
+        
+        CleanupStack::PopAndDestroy( targetInfo );
+        }
+    else
+        {
+        __LOG( "ProtocolInfoToUPnPL - UPnP content -> do nothing" );
+        // Not DLNA content, do nothing
+        }    
+        
+    CleanupStack::PopAndDestroy( destInfo );
+    }
+
+//---------------------------------------------------------------------------
+// CUPnPUploadSession::StopWait()
+// See upnpbrowsingsession.h
+//---------------------------------------------------------------------------
+//
+void CUPnPUploadSession::StopWait()
+    {
+    __LOG( "ProtocolInfoToUPnPL::StopWait" );
+    if ( iWait.IsStarted() )
+        {
+        if ( iWait.CanStopNow() )
+            {
+            __LOG( "ProtocolInfoToUPnPL::StopWait - stop" );
+            iWait.AsyncStop();
+            iSchedulerStopped = ETrue;
+            }
+        else
+            {
+            __LOG( "CUPnPUploadSession::StopWait\
+- not able to stop now, use callback" );
+            iSchedulerStopped = EFalse;
+            iWait.AsyncStop( TCallBack(
+                                SchedulerStoppedCallBack,
+                                this ) );
+            }
+        }
+    }
+
+//---------------------------------------------------------------------------
+// CUPnPUploadSession::SchedulerStoppedCallBack()
+// See upnpbrowsingsession.h
+//---------------------------------------------------------------------------
+//
+TInt CUPnPUploadSession::SchedulerStoppedCallBack( TAny* aPtr )
+    {
+    CUPnPUploadSession* self = 
+        static_cast<CUPnPUploadSession*>( aPtr );
+    self->DoSchedulerStoppedCallBack();
+    return 0;
+    }
+
+//---------------------------------------------------------------------------
+// CUPnPUploadSession::DoSchedulerStoppedCallBack()
+// See upnpbrowsingsession.h
+//---------------------------------------------------------------------------
+//
+void CUPnPUploadSession::DoSchedulerStoppedCallBack()
+    {
+    __LOG( "ProtocolInfoToUPnPL::DoSchedulerStoppedCallBack" );
+    iSchedulerStopped = ETrue;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/bwins/upnpxmlparseru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,24 @@
+EXPORTS
+	??1CUpnpObjectLite@@UAE@XZ @ 1 NONAME ; CUpnpObjectLite::~CUpnpObjectLite(void)
+	?ContainerToXmlLC@CUPnPXMLParser@@SAPAVHBufC8@@ABVCUpnpContainer@@@Z @ 2 NONAME ; class HBufC8 * CUPnPXMLParser::ContainerToXmlLC(class CUpnpContainer const &)
+	?IsTypeOf@CUpnpObjectLite@@QBEHW4TObjectType@1@@Z @ 3 NONAME ; int CUpnpObjectLite::IsTypeOf(enum CUpnpObjectLite::TObjectType) const
+	?ItemAsXmlLC@CUPnPXMLParser@@SAPAVHBufC8@@ABVCUpnpItem@@@Z @ 4 NONAME ; class HBufC8 * CUPnPXMLParser::ItemAsXmlLC(class CUpnpItem const &)
+	?NewL@CUPnPXMLEventParser@@SAPAV1@XZ @ 5 NONAME ; class CUPnPXMLEventParser * CUPnPXMLEventParser::NewL(void)
+	?NewL@CUPnPXMLParser@@SAPAV1@XZ @ 6 NONAME ; class CUPnPXMLParser * CUPnPXMLParser::NewL(void)
+	?NewL@CUPnPXMLParserLite@@SAPAV1@XZ @ 7 NONAME ; class CUPnPXMLParserLite * CUPnPXMLParserLite::NewL(void)
+	?NewL@CUpnpObjectLite@@SAPAV1@XZ @ 8 NONAME ; class CUpnpObjectLite * CUpnpObjectLite::NewL(void)
+	?NewLC@CUPnPXMLParser@@SAPAV1@XZ @ 9 NONAME ; class CUPnPXMLParser * CUPnPXMLParser::NewLC(void)
+	?NewLC@CUPnPXMLParserLite@@SAPAV1@XZ @ 10 NONAME ; class CUPnPXMLParserLite * CUPnPXMLParserLite::NewLC(void)
+	?ObjectId@CUpnpObjectLite@@QBEABVTDesC8@@XZ @ 11 NONAME ; class TDesC8 const & CUpnpObjectLite::ObjectId(void) const
+	?ParseResultDataL@CUPnPXMLEventParser@@QAEXABVTDesC8@@AAH11@Z @ 12 NONAME ; void CUPnPXMLEventParser::ParseResultDataL(class TDesC8 const &, int &, int &, int &)
+	?ParseResultDataL@CUPnPXMLParser@@QAEXAAV?$RPointerArray@VCUpnpObject@@@@ABVTDesC8@@@Z @ 13 NONAME ; void CUPnPXMLParser::ParseResultDataL(class RPointerArray<class CUpnpObject> &, class TDesC8 const &)
+	?ParseResultDataL@CUPnPXMLParserLite@@QAEXAAV?$RPointerArray@VCUpnpObjectLite@@@@ABVTDesC8@@ABVTDesC16@@@Z @ 14 NONAME ; void CUPnPXMLParserLite::ParseResultDataL(class RPointerArray<class CUpnpObjectLite> &, class TDesC8 const &, class TDesC16 const &)
+	?RemoveXmlControlCharactersL@UpnpXmlStringUtility@@SAPAVHBufC8@@ABVTDesC8@@@Z @ 15 NONAME ; class HBufC8 * UpnpXmlStringUtility::RemoveXmlControlCharactersL(class TDesC8 const &)
+	?SetObjectClass@CUpnpObjectLite@@QAEXABVTDesC8@@@Z @ 16 NONAME ; void CUpnpObjectLite::SetObjectClass(class TDesC8 const &)
+	?SetObjectIdL@CUpnpObjectLite@@QAEXABVTDesC8@@@Z @ 17 NONAME ; void CUpnpObjectLite::SetObjectIdL(class TDesC8 const &)
+	?SetObjectIdL@CUpnpObjectLite@@QAEXPAVHBufC8@@@Z @ 18 NONAME ; void CUpnpObjectLite::SetObjectIdL(class HBufC8 *)
+	?SetTitleL@CUpnpObjectLite@@QAEXABVTDesC16@@@Z @ 19 NONAME ; void CUpnpObjectLite::SetTitleL(class TDesC16 const &)
+	?SetTitleL@CUpnpObjectLite@@QAEXPAVHBufC16@@@Z @ 20 NONAME ; void CUpnpObjectLite::SetTitleL(class HBufC16 *)
+	?Title@CUpnpObjectLite@@QBEABVTDesC16@@XZ @ 21 NONAME ; class TDesC16 const & CUpnpObjectLite::Title(void) const
+	?XmlForCreateObjectLC@CUPnPXMLParser@@SAPAVHBufC8@@ABVCUpnpItem@@@Z @ 22 NONAME ; class HBufC8 * CUPnPXMLParser::XmlForCreateObjectLC(class CUpnpItem const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/eabi/upnpxmlparseru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,32 @@
+EXPORTS
+	_ZN14CUPnPXMLParser11ItemAsXmlLCERK9CUpnpItem @ 1 NONAME
+	_ZN14CUPnPXMLParser16ContainerToXmlLCERK14CUpnpContainer @ 2 NONAME
+	_ZN14CUPnPXMLParser16ParseResultDataLER13RPointerArrayI11CUpnpObjectERK6TDesC8 @ 3 NONAME
+	_ZN14CUPnPXMLParser20XmlForCreateObjectLCERK9CUpnpItem @ 4 NONAME
+	_ZN14CUPnPXMLParser4NewLEv @ 5 NONAME
+	_ZN14CUPnPXMLParser5NewLCEv @ 6 NONAME
+	_ZN15CUpnpObjectLite12SetObjectIdLEP6HBufC8 @ 7 NONAME
+	_ZN15CUpnpObjectLite12SetObjectIdLERK6TDesC8 @ 8 NONAME
+	_ZN15CUpnpObjectLite14SetObjectClassERK6TDesC8 @ 9 NONAME
+	_ZN15CUpnpObjectLite4NewLEv @ 10 NONAME
+	_ZN15CUpnpObjectLite9SetTitleLEP7HBufC16 @ 11 NONAME
+	_ZN15CUpnpObjectLite9SetTitleLERK7TDesC16 @ 12 NONAME
+	_ZN15CUpnpObjectLiteD0Ev @ 13 NONAME
+	_ZN15CUpnpObjectLiteD1Ev @ 14 NONAME
+	_ZN15CUpnpObjectLiteD2Ev @ 15 NONAME
+	_ZN18CUPnPXMLParserLite16ParseResultDataLER13RPointerArrayI15CUpnpObjectLiteERK6TDesC8RK7TDesC16 @ 16 NONAME
+	_ZN18CUPnPXMLParserLite4NewLEv @ 17 NONAME
+	_ZN18CUPnPXMLParserLite5NewLCEv @ 18 NONAME
+	_ZN19CUPnPXMLEventParser16ParseResultDataLERK6TDesC8RiS3_S3_ @ 19 NONAME
+	_ZN19CUPnPXMLEventParser4NewLEv @ 20 NONAME
+	_ZN20UpnpXmlStringUtility27RemoveXmlControlCharactersLERK6TDesC8 @ 21 NONAME
+	_ZNK15CUpnpObjectLite5TitleEv @ 22 NONAME
+	_ZNK15CUpnpObjectLite8IsTypeOfENS_11TObjectTypeE @ 23 NONAME
+	_ZNK15CUpnpObjectLite8ObjectIdEv @ 24 NONAME
+	_ZTI14CUPnPXMLParser @ 25 NONAME ; #<TI>#
+	_ZTI18CUPnPXMLParserLite @ 26 NONAME ; #<TI>#
+	_ZTI19CUPnPXMLEventParser @ 27 NONAME ; #<TI>#
+	_ZTV14CUPnPXMLParser @ 28 NONAME ; #<VT>#
+	_ZTV18CUPnPXMLParserLite @ 29 NONAME ; #<VT>#
+	_ZTV19CUPnPXMLEventParser @ 30 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Upnp XML parser build info file
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+// ADO internal interfaces
+../inc/upnpxmlparser.h                  |../../../inc/upnpxmlparser.h
+../inc/upnpxmlparserlite.h              |../../../inc/upnpxmlparserlite.h
+../inc/upnpobjectlite.h                 |../../../inc/upnpobjectlite.h
+// subsystem internal interfaces
+../inc/upnpxmleventparser.h             |../../inc/upnpxmleventparser.h
+
+PRJ_MMPFILES
+upnpxmlparser.mmp
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/group/upnpxmlparser.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project specification for XmlParser
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+// Build target
+TARGET          upnpxmlparser.dll
+TARGETTYPE      DLL
+UID             0x1000008D 0x200075D7
+
+// Platform security
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION         10.1
+paged
+
+// Include paths
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../inc
+
+// Sources
+SOURCEPATH      ../src
+SOURCE          upnpxmlparser.cpp
+SOURCE          upnpxmlparserlite.cpp
+SOURCE          upnpitemtoxml.cpp
+SOURCE          upnpxmleventparser.cpp
+SOURCE          upnpobjectlite.cpp
+SOURCE          upnpxmlstringutility.cpp
+
+// Core platform
+LIBRARY         euser.lib
+LIBRARY         bafl.lib
+LIBRARY         estor.lib 
+
+// XML
+LIBRARY         xmlframework.lib
+
+// S60 Upnp Stack
+LIBRARY         upnpavobjects.lib
+LIBRARY         upnpipserversutils.lib
+
+// upnp framework
+LIBRARY         upnputilities.lib
+LIBRARY         upnpavcontrollerhelper.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpcontainertoxml.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Generates XML from a container
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPCONTAINERTOXML_H
+#define C_UPNPCONTAINERTOXML_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUpnpContainer;
+
+// CLASS DECLARATION
+
+/**
+ * Converts a container to xml document
+ *
+ * @since Series 60 3.0
+ * @lib upnpxmlparser.lib
+ */
+class CUpnpContainerToXML : public CBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @param aContainer container to convert
+     * @return new instance
+     */
+    static CUpnpContainerToXML* NewL( const CUpnpContainer& aContainer );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @param aContainer container to convert
+     * @return new instance
+     */
+    static CUpnpContainerToXML* NewLC( const CUpnpContainer& aContainer );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpContainerToXML();
+
+public: // New functions
+             
+    /**
+     * Returns object's XML description
+     * Leaves in case of errors.
+     *
+     * @return HBufC8 pointer to buffer containing XML data
+     */
+    IMPORT_C HBufC8* AsXmlL();
+
+    /**
+     * Returns object's XML description
+     * Leaves in case of errors.
+     *
+     * @return HBufC8 pointer to buffer containing XML data
+     */
+    IMPORT_C HBufC8* AsEmptyXmlL();
+
+    /**
+     * Creates valid XML headers to source data. Do not decode the XML.
+     *
+     * @since Series 60 3.1
+     * @param TDesC8 reference to source data
+     * @return HBufC8 buffer to valid XML
+     */
+    HBufC8* CreateUnDecodedXmlL( const TDesC8& aData );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUpnpContainerToXML( const CUpnpContainer& aContainer );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private:    // Data
+
+    const CUpnpContainer& iContainer; // Not own        
+
+    };
+
+#endif      // C_UPNPCONTAINERTOXML_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpitemtoxml.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Generates XML from an UPNP Item
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPITEMTOXML_H
+#define C_UPNPITEMTOXML_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+
+/**
+ * Converts an UPnP item to xml document
+ *
+ * @since Series 60 3.2
+ * @lib upnpxmlparser.lib
+ */
+NONSHARABLE_CLASS( CUpnpItemToXML ) : public CBase
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aItem
+     * @return new instance
+     */
+    static CUpnpItemToXML* NewL( const CUpnpItem& aItem );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @param aItem
+     * @return new instance
+     */
+    static CUpnpItemToXML* NewLC( const CUpnpItem& aItem );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpItemToXML();
+
+
+public: // Functions from CUPnPObject
+
+    /**
+     * Returns object's XML description
+     * Leaves in case of errors.
+     * @since Series 60 3.1
+     * @param none
+     * @return HBufC8 pointer to buffer containing XML data
+     */
+    HBufC8* AsXmlL( const TBool aIncludeChilds = ETrue );
+
+    /**
+     * Returns object's XML description. This version of the method
+     * is used to create the XML with empty <res> tag
+     * Leaves in case of errors.
+     * @since Series 60 3.1
+     * @param None
+     * @return HBufC8 pointer to buffer containing XML data
+     */
+    HBufC8* AsXmlEmptyL();
+
+
+    /**
+     * CUpnpItemToXML::AsResultArgumentL
+     * Returns object's XML description that is embedded inside a
+     * DIDL-LITE tag. The <res> tag of xml description is empty.
+     * The returned value is xml encoded can therefore be used
+     * for example when creating a CreateObject action.
+     * @since Series 60 3.1
+     * @param none
+     * @return TDesC8& the date string
+     */
+    HBufC8* AsResultArgumentL();
+
+    /**
+     * Creates valid XML headers to source data. Do not decode the XML.
+     *
+     * @since Series 60 3.1
+     * @param TDesC8 reference to source data
+     * @return HBufC8 buffer to valid XML
+     */
+    HBufC8* CreateUnDecodedXmlL( const TDesC8& aData );
+
+private:
+
+    /**
+     * Return value from an element
+     *
+     * @param aElemenName (const TDesC8&) name of the element
+     * @return (const TDesC8&) value of the element
+     */
+    const TDesC8& GetValueFromElement(
+                                const TDesC8& aElementName );
+
+    /**
+     * Validates format of dc:date
+     *
+     * @param aDate dc:date string
+     * @return ETrue if format of dc:date is valid
+     */
+    TBool ValidateDateL( const TDesC8& aDate );
+    
+    /**
+     * Validates format of res@duration
+     *
+     * @param aDuration res@duration string
+     * @return ETrue if format of res@duration is valid
+     */
+    TBool ValidateDurationL( const TDesC8& aDuration );
+    
+    /**
+     * Parse to a delimeter
+     *
+     * @param aLexer lexer
+     * @param aDelimeter delimeter character
+     */
+    void ParseToDelimeter( TLex8& aLex, TChar aDelimeter );    
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUpnpItemToXML( const CUpnpItem& aItem );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private:    // Data
+
+    CUpnpItem*  iItem; // Not own
+    };
+
+#endif      // C_UPNPITEMTOXML_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpobjectlite.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:     UpnpObjectLite for fast browsing 
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPOBJECTLITE_H_
+#define C_UPNPOBJECTLITE_H_
+
+// INCLUDES
+#include <e32base.h>
+
+/**
+ * CUpnpObjectLite for fast browsing. Contains a minimum set of properties
+ * and memory consumption is kept low
+ *
+ * @since Series 60 3.1
+ * @lib upnpxmlparser.lib
+ */
+NONSHARABLE_CLASS( CUpnpObjectLite ) : public CBase
+    {
+
+public:
+
+    /**
+     * Enumeration to determine object class
+     */
+    enum TObjectType
+        {    
+        EItem       = 0,
+        EContainer,
+        EMusicItem,
+        EImageItem,
+        EVideoItem,
+        };
+
+protected:
+
+    /**
+     * Enumeration to determine base type
+     */
+    enum TObjectTypeBase
+        {
+        EBaseUnknown        = 0x00000000,
+        EBaseItem           = 0x01000000,
+        EBaseContainer      = 0x02000000
+        };
+    
+    /**
+     * Enumeration to determine sophisticated item type
+     */
+    enum TItemTypeBase
+        {
+        EBaseMusicItem      = 0x00010000,
+        EBaseImageItem      = 0x00020000,
+        EBaseVideoItem      = 0x00040000,
+        EBasePlaylistItem   = 0x00080000,
+        
+        EMusicTrack         = 0x00000100,
+        EPhoto              = 0x00000200,
+        EMovie              = 0x00000400
+        };
+        
+    /**
+     * Enumeration to determine sophisticated container type
+     */
+    enum TContainerTypeBase
+        {
+        EStorageFolder      = 0x00010000,
+        EPlaylistContainer  = 0x00020000,
+        //EAlbum              = 0x00040000,
+        //EGenre              = 0x00080000,
+        
+        EMusicAlbum         = 0x00000100             
+        };        
+    
+public:
+
+    /**
+     * 2-phased constructor.
+     */
+    IMPORT_C static CUpnpObjectLite* NewL();
+    
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CUpnpObjectLite();
+
+public:
+
+    /**
+     * Setter for object id
+     *
+     * @param aObjectId object id
+     */
+    IMPORT_C void SetObjectIdL( const TDesC8& aObjectId );
+    
+    /**
+     * Setter for object id
+     *
+     * @param aObjectId object id (ownership of aObjectId is transferred)
+     */
+    IMPORT_C void SetObjectIdL( HBufC8* aObjectId );
+    
+    /**
+     * Getter for object id
+     *
+     * @return object id
+     */
+    IMPORT_C const TDesC8& ObjectId() const;    
+
+    /**
+     * Setter for title
+     *
+     * @param aTitle title
+     */
+    IMPORT_C void SetTitleL( const TDesC& aTitle );
+    
+    /**
+     * Setter for title
+     *
+     * @param aTitle title (ownership of aTitle is transferred)
+     */
+    IMPORT_C void SetTitleL( HBufC* aTitle );
+    
+    /**
+     * Getter for title
+     *
+     * @return title
+     */
+    IMPORT_C const TDesC& Title() const;
+    
+    /**
+     * Setter for object id. Does not store objectid as a string, but as a
+     * bitfield to save memory
+     *
+     * @param aTitle title (ownership of aTitle is transferred)
+     */
+    IMPORT_C void SetObjectClass( const TDesC8& aObjectClass );
+    
+    /**
+     * Can be used to chech type of the object
+     *
+     * @return ETrue if the type (part of object class) matches
+     */
+    IMPORT_C TBool IsTypeOf( TObjectType aType ) const;
+    
+protected:
+
+    /**
+     * Constructor.
+     */
+    CUpnpObjectLite();
+
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+
+protected:
+
+    void ParseToDelimeter( TLex8& aLex, TChar aDelimeter ) const;
+    
+    void HandleRound( TInt aRound, TPtrC8 aString );
+    
+    void Round1( TPtrC8 aString );
+    
+    void Round2( TPtrC8 aString );
+    
+    void Round3( TPtrC8 aString );
+    
+    void Round4( TPtrC8 aString );
+
+protected:
+
+    HBufC8* iObjectId;
+        
+    HBufC* iTitle;
+    
+    TInt    iObjectClass;    
+        
+
+    };
+
+#endif // C_UPNPOBJECTLITE_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpobjectstack.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Stack for XML SAX Parser.
+*
+*/
+
+
+
+
+
+
+#ifndef _C_UPNPOBJECTSTACK_H_
+#define _C_UPNPOBJECTSTACK_H_
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpobject.h"
+
+/**
+ * A Stack class, which is used to hold UPnP objects in order while parsing 
+ * xml.
+ *
+ * @since Series 60 3.1
+ * @lib upnpxmlparser.lib
+ */
+NONSHARABLE_CLASS( CUPnPObjectStack ) : public CBase
+    {
+public:
+    /**
+     * 2-phased constructor.
+     */
+    static inline CUPnPObjectStack* NewL();
+    
+    /**
+     * Destructor.
+     */
+    inline virtual ~CUPnPObjectStack();
+
+public:
+
+    /**
+     * Pops top object from the stack.
+     * @return pointer to the popped object.
+     */
+    inline CUpnpObject* Pop();
+    
+    /**
+     * Retuns the pointer of the top object.
+     * @return pointer to the top object.
+     */
+    inline CUpnpObject* Top();
+    
+    /**
+     * Pushes object to the stack.
+     * @param aObject, an object, which is added to the stack as top object.
+     */
+    inline void PushL( CUpnpObject* aObject );
+    
+    /**
+     * Returns the current count of the stack.
+     * @return stack count.
+     */
+    inline TInt Count();
+    
+    /**
+     * Clears the stack.
+     */
+    inline void Reset();
+    
+    /**
+     * Clears the stack and deletes all the objects in it.
+     */
+    inline void ResetAndDestroy();
+
+private:
+
+    /**
+     * Constructor.
+     */
+    inline CUPnPObjectStack();
+
+private:
+
+    /**
+     * An array, which contains the objects in the stack.
+     * Own.
+     */
+    RPointerArray<CUpnpObject>* iStack;
+    };
+
+#include "upnpobjectstack.inl"
+
+#endif // _C_UPNPOBJECTSTACK_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpobjectstack.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Stack for XML SAX Parser.
+*
+*/
+
+
+
+
+
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStack::CUPnPObjectStack
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUPnPObjectStack::CUPnPObjectStack()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStack::~CUPnPObjectStack
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUPnPObjectStack::~CUPnPObjectStack()
+    {
+    iStack->ResetAndDestroy();
+    delete iStack;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStack::NewL
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUPnPObjectStack* CUPnPObjectStack::NewL()
+    {
+    CUPnPObjectStack* self = new (ELeave) CUPnPObjectStack();
+    CleanupStack::PushL(self);
+    self->iStack = new (ELeave) RPointerArray<CUpnpObject>();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStack::Pop
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUpnpObject* CUPnPObjectStack::Pop()
+    {
+    CUpnpObject* temp = NULL;
+
+    if( Count() > 0 )
+        {
+        CUpnpObject* temp = iStack->operator[](iStack->Count() - 1);
+        iStack->Remove(iStack->Count() - 1);
+        }
+    return temp;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStack::Top
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUpnpObject* CUPnPObjectStack::Top()
+    {
+    if( Count() > 0 )
+        {
+        return iStack->operator[](iStack->Count() - 1);
+        }
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStack::PushL
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline void CUPnPObjectStack::PushL( CUpnpObject* aObject )
+    {
+    iStack->AppendL( aObject );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStack::Count
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline TInt CUPnPObjectStack::Count()
+    {
+    return iStack->Count();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStack::Reset
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline void CUPnPObjectStack::Reset()
+    {
+    iStack->Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStack::ResetAndDestroy
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline void CUPnPObjectStack::ResetAndDestroy()
+    {
+    iStack->ResetAndDestroy();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpobjectstacklite.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Stack for XML SAX Parser.
+*
+*/
+
+
+
+
+
+
+#ifndef _C_UPNPOBJECTSTACKLITE_H_
+#define _C_UPNPOBJECTSTACKLITE_H_
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpobjectlite.h"
+
+/**
+ * A Stack class, which is used to hold UPnP objects in order while parsing 
+ * xml.
+ *
+ * @since Series 60 3.1
+ * @lib upnpxmlparser.lib
+ */
+NONSHARABLE_CLASS( CUPnPObjectStackLite ) : public CBase
+    {
+public:
+    /**
+     * 2-phased constructor.
+     */
+    static inline CUPnPObjectStackLite* NewL();
+    
+    /**
+     * Destructor.
+     */
+    inline virtual ~CUPnPObjectStackLite();
+
+public:
+
+    /**
+     * Pops top object from the stack.
+     * @return pointer to the popped object.
+     */
+    inline CUpnpObjectLite* Pop();
+    
+    /**
+     * Retuns the pointer of the top object.
+     * @return pointer to the top object.
+     */
+    inline CUpnpObjectLite* Top();
+    
+    /**
+     * Pushes object to the stack.
+     * @param aObject, an object, which is added to the stack as top object.
+     */
+    inline void PushL( CUpnpObjectLite* aObject );
+    
+    /**
+     * Returns the current count of the stack.
+     * @return stack count.
+     */
+    inline TInt Count();
+    
+    /**
+     * Clears the stack.
+     */
+    inline void Reset();
+    
+    /**
+     * Clears the stack and deletes all the objects in it.
+     */
+    inline void ResetAndDestroy();
+
+private:
+
+    /**
+     * Constructor.
+     */
+    inline CUPnPObjectStackLite();
+
+private:
+
+    /**
+     * An array, which contains the objects in the stack.
+     * Own.
+     */
+    RPointerArray<CUpnpObjectLite>* iStack;
+    };
+
+#include "upnpobjectstacklite.inl"
+
+#endif // _C_UPNPOBJECTSTACKLITE_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpobjectstacklite.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Stack for XML SAX Parser.
+*
+*/
+
+
+
+
+
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStackLite::CUPnPObjectStackLite
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUPnPObjectStackLite::CUPnPObjectStackLite()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStackLite::~CUPnPObjectStackLite
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUPnPObjectStackLite::~CUPnPObjectStackLite()
+    {
+    iStack->ResetAndDestroy();
+    delete iStack;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStackLite::NewL
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUPnPObjectStackLite* CUPnPObjectStackLite::NewL()
+    {
+    CUPnPObjectStackLite* self = new (ELeave) CUPnPObjectStackLite();
+    CleanupStack::PushL(self);
+    self->iStack = new (ELeave) RPointerArray<CUpnpObjectLite>();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStackLite::Pop
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUpnpObjectLite* CUPnPObjectStackLite::Pop()
+    {
+    CUpnpObjectLite* temp = NULL;
+
+    if( Count() > 0 )
+        {
+        CUpnpObjectLite* temp = iStack->operator[](iStack->Count() - 1);
+        iStack->Remove(iStack->Count() - 1);
+        }
+    return temp;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStackLite::Top
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline CUpnpObjectLite* CUPnPObjectStackLite::Top()
+    {
+    if( Count() > 0 )
+        {
+        return iStack->operator[](iStack->Count() - 1);
+        }
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStackLite::PushL
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline void CUPnPObjectStackLite::PushL( CUpnpObjectLite* aObject )
+    {
+    iStack->AppendL( aObject );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStackLite::Count
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline TInt CUPnPObjectStackLite::Count()
+    {
+    return iStack->Count();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStackLite::Reset
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline void CUPnPObjectStackLite::Reset()
+    {
+    iStack->Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPObjectStackLite::ResetAndDestroy
+// See upnpobjectstack.h
+// --------------------------------------------------------------------------
+inline void CUPnPObjectStackLite::ResetAndDestroy()
+    {
+    iStack->ResetAndDestroy();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpxmleventparser.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      XML SAX Parser for UPnP.
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPXMLEVENTPARSER_H_
+#define C_UPNPXMLEVENTPARSER_H_
+
+// INCLUDES
+#include <e32base.h>
+#include <xml/contenthandler.h>
+
+// FORWARD DECLARATIONS
+
+using namespace Xml;
+
+/**
+ * XML SAX Parser for UPnP.
+ *
+ * @since s60 3.1
+ * @lib upnpxmlparser.lib
+ */
+class CUPnPXMLEventParser :  public CBase,
+                             public MContentHandler
+    {
+
+public:
+
+    enum TParserState
+        {
+        EEvent = 0,
+        EInstanceID,
+        EVolume,
+        EMute,
+        ENotSupported // Brightness etc.
+        };    
+
+public:
+
+    /**
+     * 2-phased constructor.
+     */
+    IMPORT_C static CUPnPXMLEventParser* NewL();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPXMLEventParser();
+    
+public:
+
+    /**
+     * Parses xml data to the array of objects.
+     * @param aResultArray, An array for objects in xml root.
+     * @param aData, xml data.
+     */
+    IMPORT_C void ParseResultDataL( const TDesC8& aData,
+        TInt& aInstanceId, TInt& aVolume, TBool& aMute );
+                    
+protected: // from MContentHandler
+
+    /**
+     * From MContentHandler.
+     * @param aDocParam, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnStartDocumentL( const RDocumentParameters& aDocParam, 
+                           TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aErrorCode, not used.
+     */
+    void OnEndDocumentL( TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aElement, holds the element info.
+     * @param aAttributes, holds the element's attributes.
+     * @param aErrorCode, if not KErrNone, the method is ignored.
+     */
+    void OnStartElementL( const RTagInfo& aElement, 
+                          const RAttributeArray& aAttributes, 
+                          TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aElement, holds the element info.
+     * @param aErrorCode, if not KErrNone, the method is ignored.
+     */
+    void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aBytes, The value of the content.
+     * @param aErrorCode, if not KErrNone, the method is ignored.
+     */
+    void OnContentL( const TDesC8& aBytes, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aPrefix, not used.
+     * @param aUri, not used.
+     * @param aErrorCode, not used.
+     */    
+    void OnStartPrefixMappingL( const RString& aPrefix, 
+                                const RString& aUri, 
+                                TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aPrefix, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aBytes, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aName, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnSkippedEntityL( const RString& aName, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aTarget, not used.
+     * @param aData, not used.
+     * @param aErrorCode, not used. 
+     */
+    void OnProcessingInstructionL( const TDesC8& aTarget, 
+                                   const TDesC8& aData, 
+                                   TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aErrorCode
+     */                               
+    void OnError( TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aUid, not used.
+     * @return None.
+     */
+    TAny* GetExtendedInterface( const TInt32 aUid );
+
+                                    
+private:
+
+    /**
+     * Constructor.
+     */
+    CUPnPXMLEventParser();
+    
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+    
+private:    
+
+    void SetAttributesL( const RAttributeArray& aAttributes );
+
+    void Reset();
+    
+private: // data
+    
+    TParserState    iParserState;
+        
+    TInt            iInstanceID;
+    
+    TInt            iMute;
+
+    TInt            iVolume;
+    //ETrue:Master Volume is set.EFalse:Master Volume is not set.
+    TBool           iMasterVolumeState;
+    };
+
+#endif // C_UPNPXMLEVENTPARSER_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpxmlparser.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      XML SAX Parser for UPnP.
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPXMLPARSER_H_
+#define C_UPNPXMLPARSER_H_
+
+// INCLUDES
+#include <e32base.h>
+#include <xml/contenthandler.h>
+
+// FORWARD DECLARATIONS
+class CUpnpObject;
+class CUPnPObjectStack; 
+class CUpnpElement;
+class CUpnpItem;
+class CUpnpContainer;
+
+using namespace Xml;
+
+/**
+ * XML SAX Parser for UPnP.
+ *
+ * @since s60 3.1
+ * @lib upnpxmlparser.lib
+ */
+class CUPnPXMLParser :  public CBase,
+                        public MContentHandler
+    {
+
+public:
+
+    /**
+     * 2-phased constructor.
+     */
+    IMPORT_C static CUPnPXMLParser* NewL();
+    
+    /**
+     * 2-phased constructor.
+     */
+    IMPORT_C static CUPnPXMLParser* NewLC();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPXMLParser();
+    
+public:
+
+    /**
+     * Parses xml data to the array of objects.
+     * @param aResultArray, An array for objects in xml root.
+     * @param aData, xml data.
+     */
+    IMPORT_C void ParseResultDataL( RPointerArray<CUpnpObject>& aResultArray,
+        const TDesC8& aData );
+        
+    /**
+     * Creates an xml document from a given item 
+     *
+     * @param aItem item to convert
+     * @return xml document as a heap descriptor
+     */
+    IMPORT_C static HBufC8* ItemAsXmlLC( const CUpnpItem& aItem );
+
+    /**
+     * Creates an xml document from a given item, for CreateObject-action. 
+     *
+     * @param aItem item to convert
+     * @return xml document as a heap descriptor
+     */
+    IMPORT_C static HBufC8* XmlForCreateObjectLC( const CUpnpItem& aItem );
+
+    /**
+     * Creates an xml document from a given item container
+     *
+     * @param aContainer container to convert
+     * @return xml document as a heap descriptor
+     */
+    IMPORT_C static HBufC8* ContainerToXmlLC( 
+                                    const CUpnpContainer& aContainer );
+            
+protected: // from MContentHandler
+
+    /**
+     * From MContentHandler.
+     * @param aDocParam, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnStartDocumentL( const RDocumentParameters& aDocParam, 
+                           TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aErrorCode, not used.
+     */
+    void OnEndDocumentL( TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aElement, holds the element info.
+     * @param aAttributes, holds the element's attributes.
+     * @param aErrorCode, if not KErrNone, the method is ignored.
+     */
+    void OnStartElementL( const RTagInfo& aElement, 
+                          const RAttributeArray& aAttributes, 
+                          TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aElement, holds the element info.
+     * @param aErrorCode, if not KErrNone, the method is ignored.
+     */
+    void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aBytes, The value of the content.
+     * @param aErrorCode, if not KErrNone, the method is ignored.
+     */
+    void OnContentL( const TDesC8& aBytes, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aPrefix, not used.
+     * @param aUri, not used.
+     * @param aErrorCode, not used.
+     */    
+    void OnStartPrefixMappingL( const RString& aPrefix, 
+                                const RString& aUri, 
+                                TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aPrefix, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aBytes, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aName, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnSkippedEntityL( const RString& aName, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aTarget, not used.
+     * @param aData, not used.
+     * @param aErrorCode, not used. 
+     */
+    void OnProcessingInstructionL( const TDesC8& aTarget, 
+                                   const TDesC8& aData, 
+                                   TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aErrorCode
+     */                               
+    void OnError( TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aUid, not used.
+     * @return None.
+     */
+    TAny* GetExtendedInterface( const TInt32 aUid );
+
+                                    
+private:
+
+    /**
+     * Constructor.
+     */
+    CUPnPXMLParser();
+    
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+    
+private: 
+
+    /**
+     * Sets element's attributes to the object.
+     *
+     * @param aObject attributes will be set to this object
+     * @param aAttributes attributes to set
+     */
+    void SetAttributesL( CUpnpObject& aObject, 
+                         const RAttributeArray& aAttributes );
+                             
+    /**
+     * Set value to a element
+     * 
+     * @since Series 60 3.1
+     * @param aItem (CUpnpObject&) a item which owns the element
+     * @param aValue element value
+     */
+    void SetValueToElementL( CUpnpObject& aItem,
+        const TDesC8& aValue );
+        
+    /**
+     * Sets element's attributes to the element
+     *
+     * @param aElement attributes will be set to this element
+     * @param aAttributes attributes to set
+     */
+    void SetAttributesL( const RAttributeArray& aAttributes ); 
+
+    /**
+     * Reset member for parse again.
+     */
+	void ResetMember();
+private: // data
+
+    /**
+     * A pointer to result array from the client.
+     * Not own.
+     */      
+    RPointerArray<CUpnpObject>* iResultRoot;
+    
+    /**
+     * A stack for UPnP objects.
+     * Own.
+     */
+    CUPnPObjectStack*           iStack;
+    
+    /**
+     * Element value
+     * Own.
+     */
+    HBufC8*                     iElementValue;
+        
+    /**
+     * Upnp element
+     * Owned until ownership is transferred for an object
+     */
+    CUpnpElement*               iNewElement;
+    
+    TBool                       iTitle;
+    TBool                       iObjectClass;
+    };
+
+#endif // C_UPNPXMLPARSER_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpxmlparserlite.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,230 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      XML SAX Parser for UPnP.
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPXMLPARSERLITE_H_
+#define C_UPNPXMLPARSERLITE_H_
+
+// INCLUDES
+#include <e32base.h>
+#include <xml/contenthandler.h>
+
+// FORWARD DECLARATIONS
+class CUpnpObjectLite;
+class CUPnPObjectStackLite; 
+//class CUpnpItem;
+//class CUpnpContainer;
+
+using namespace Xml;
+
+/**
+ * XML SAX Parser for UPnP.
+ *
+ * @since s60 3.1
+ * @lib upnpxmlparser.lib
+ */
+class CUPnPXMLParserLite :  public CBase,
+                            public MContentHandler
+    {
+
+public:
+
+    /**
+     * 2-phased constructor.
+     */
+    IMPORT_C static CUPnPXMLParserLite* NewL();
+    
+    /**
+     * 2-phased constructor.
+     */
+    IMPORT_C static CUPnPXMLParserLite* NewLC();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPXMLParserLite();
+    
+public:
+
+    /**
+     * Parses xml data to the array of objects.
+     * @param aResultArray, An array for objects in xml root.
+     * @param aData, xml data.
+     * @param aFormatString the format of title. If KNullDesC title will be
+     * stored as it is. It's expected that the string is in the following
+     * format: _L( "0\t%S---" ); where "0" is a placeholder for icon index
+     * and %S is a placeholder for title
+     * 
+     */
+    IMPORT_C void ParseResultDataL( RPointerArray<CUpnpObjectLite>&
+        aResultArray, const TDesC8& aData, const TDesC& aFormatString = KNullDesC );
+                    
+protected: // from MContentHandler
+
+    /**
+     * From MContentHandler.
+     * @param aDocParam, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnStartDocumentL( const RDocumentParameters& aDocParam, 
+                           TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aErrorCode, not used.
+     */
+    void OnEndDocumentL( TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aElement, holds the element info.
+     * @param aAttributes, holds the element's attributes.
+     * @param aErrorCode, if not KErrNone, the method is ignored.
+     */
+    void OnStartElementL( const RTagInfo& aElement, 
+                          const RAttributeArray& aAttributes, 
+                          TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aElement, holds the element info.
+     * @param aErrorCode, if not KErrNone, the method is ignored.
+     */
+    void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aBytes, The value of the content.
+     * @param aErrorCode, if not KErrNone, the method is ignored.
+     */
+    void OnContentL( const TDesC8& aBytes, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aPrefix, not used.
+     * @param aUri, not used.
+     * @param aErrorCode, not used.
+     */    
+    void OnStartPrefixMappingL( const RString& aPrefix, 
+                                const RString& aUri, 
+                                TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aPrefix, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aBytes, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aName, not used.
+     * @param aErrorCode, not used.
+     */
+    void OnSkippedEntityL( const RString& aName, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aTarget, not used.
+     * @param aData, not used.
+     * @param aErrorCode, not used. 
+     */
+    void OnProcessingInstructionL( const TDesC8& aTarget, 
+                                   const TDesC8& aData, 
+                                   TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aErrorCode
+     */                               
+    void OnError( TInt aErrorCode );
+    
+    /**
+     * From MContentHandler.
+     * @param aUid, not used.
+     * @return None.
+     */
+    TAny* GetExtendedInterface( const TInt32 aUid );
+
+                                    
+private:
+
+    /**
+     * Constructor.
+     */
+    CUPnPXMLParserLite();
+    
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+    
+private: 
+
+    /**
+     * Sets element's attributes to the object.
+     *
+     * @param aObject attributes will be set to this object
+     * @param aAttributes attributes to set
+     */
+    void SetAttributesL( CUpnpObjectLite& aObject, 
+                         const RAttributeArray& aAttributes );
+                         
+    void SetIconIndex( const CUpnpObjectLite& aObject );                     
+                                         
+private: // data
+
+    /**
+     * A pointer to result array from the client.
+     * Not own.
+     */      
+    RPointerArray<CUpnpObjectLite>* iResultRoot;
+    
+    /**
+     * A stack for UPnP objects.
+     * Own.
+     */
+    CUPnPObjectStackLite*           iStack;
+    
+    /**
+     * Element value
+     * Own.
+     */
+    HBufC8*                     iElementValue;
+    
+    HBufC8*                     iTitleBuf;
+    
+    HBufC*                      iFormatString;
+            
+    TBool                       iTitle;
+    TBool                       iObjectClass;
+    };
+
+#endif // C_UPNPXMLPARSER_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/inc/upnpxmlstringutility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      String Utility for UPnPXMLParse.
+*
+*/
+
+
+
+
+
+#ifndef UPNPXMLSTRINGUTILITY_H_
+#define UPNPXMLSTRINGUTILITY_H_
+
+// INCLUDES
+
+// FORWARD DECLARATIONS
+class HBufC8;
+class TDesC8;
+
+// CLASS DECLARATION
+
+/**
+* Utility for working with string operation.The class
+* contains static methods that can be used to modify xmldata.
+* @since S60 3.2
+* @lib upnpxmlparser.lib
+*/
+class UpnpXmlStringUtility
+    {
+
+public:
+
+    /**
+     * Remove control characters from xml data
+     * @param aXmlData, a buffer for xml data.
+     * @return a buffer without control characters that are of form &#XXXX;
+     *         where XXXX is an integer number.
+     *         If no control character return NULL.
+     */
+    IMPORT_C static HBufC8* RemoveXmlControlCharactersL(
+        const TDesC8& aXmlData );
+
+   };
+
+#endif // UPNPXMLSTRINGUTILITY_H_
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/src/upnpcontainertoxml.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      XML generation from an UPNP container
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <e32base.h>
+#include <s32mem.h>
+
+// upnp stack api
+#include <upnpstring.h>
+#include <upnpcontainer.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h"
+
+// xmlparser internal
+#include    "upnpcontainertoxml.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpContainerToXML::CUpnpContainerToXML
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+CUpnpContainerToXML::CUpnpContainerToXML( const CUpnpContainer& aContainer ) :
+    iContainer( aContainer )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerToXML::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+void CUpnpContainerToXML::ConstructL()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerToXML::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUpnpContainerToXML* CUpnpContainerToXML::NewL( 
+                                        const CUpnpContainer& aContainer )
+    {
+    CUpnpContainerToXML* self = CUpnpContainerToXML::NewLC( aContainer );    
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContainerToXML::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUpnpContainerToXML* CUpnpContainerToXML::NewLC(
+    const CUpnpContainer& aContainer )
+    {
+    CUpnpContainerToXML* self = new( ELeave ) CUpnpContainerToXML(
+        aContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+    
+// Destructor
+CUpnpContainerToXML::~CUpnpContainerToXML()
+    {
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpContainerToXML::AsXmlL
+// Returns XML buffer
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+HBufC8* CUpnpContainerToXML::AsXmlL()
+    {
+    // Not implemented
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerToXML::AsEmptyXmlL
+// Returns XML buffer
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+HBufC8* CUpnpContainerToXML::AsEmptyXmlL()
+    {
+    // Not implemented
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerToXML::CreateUnDecodedXmlL
+// See upnpcontainertoxml.h
+// --------------------------------------------------------------------------
+HBufC8* CUpnpContainerToXML::CreateUnDecodedXmlL( const TDesC8& /*aData*/ )
+    {
+    // Not implemented
+    return NULL;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/src/upnpitemtoxml.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,945 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      generates XML from an UPNP item
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <e32base.h>
+
+// upnp stack api
+#include <upnpstring.h>
+#include <upnpitem.h>
+#include <upnpdlnaprotocolinfo.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for upnp definitions
+#include "upnpitemutility.h"
+
+// xmlparser internal
+#include "upnpitemtoxml.h"
+
+_LIT( KComponentLogfile, "upnpxmlparser.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT8(KItemHeading1,            "<item id=\"");
+_LIT8(KItemHeading2,            "\" parentID=\"");
+_LIT8(KItemHeading3False,       "\" restricted=\"0\">");
+_LIT8(KItemHeading3True,        "\" restricted=\"1\">");
+_LIT8(KItemTitleBegin,          "<dc:title>");
+_LIT8(KItemTitleEnd,            "</dc:title>");
+_LIT8(KItemDateBegin,           "<dc:date>");
+_LIT8(KItemDateEnd,             "</dc:date>");
+_LIT8(KItemClassBegin,          "<upnp:class>");
+_LIT8(KItemClassEnd,            "</upnp:class>");
+_LIT8(KItemPInfoEmpty,          "<res protocolInfo=\"*:*:*:*\"></res>");
+_LIT8(KItemPInfoEmptyDlna,      "<res protocolInfo=\"*:*:");
+_LIT8(KDlnaPn,                  "DLNA.ORG_PN=" );
+_LIT8(KColon,                   ":"); 
+_LIT8(KItemPInfoBegin,          "<res protocolInfo=\"");
+_LIT8(KItemPInfoMiddle,         ">");
+_LIT8(KItemPInfoEnd,            "</res>");
+_LIT8(KItemPInfoEnd2,            "\"></res>");
+_LIT8(KItemEnd,                 "</item>");
+
+_LIT8(KQuotationMark,           "\" ");
+_LIT8(KItemSize,                "size=\"");
+_LIT8(KItemDuration,            "duration=\"");
+_LIT8(KItemResolution,          "resolution=\"");
+
+// Music metadata
+_LIT8(KItemArtistBegin,         "<upnp:artist>");
+_LIT8(KItemArtistEnd,           "</upnp:artist>");
+_LIT8(KItemCreatorBegin,        "<dc:creator>");
+_LIT8(KItemCreatorEnd,          "</dc:creator>");
+_LIT8(KItemAlbumBegin,          "<upnp:album>");
+_LIT8(KItemAlbumEnd,            "</upnp:album>");
+_LIT8(KItemGenreBegin,          "<upnp:genre>");
+_LIT8(KItemGenreEnd,            "</upnp:genre>");
+_LIT8(KItemAlbumArtURIBegin,    "<upnp:albumArtURI>");
+_LIT8(KItemAlbumArtURIEnd,      "</upnp:albumArtURI>");
+
+_LIT8(KDIDLBeginXmlEscaped,
+    "&lt;DIDL-Lite "
+    "xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot; "
+    "xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; "
+    "xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot;"
+    "&gt;");
+_LIT8(KDIDLEndXmlEscaped, "&lt;/DIDL-Lite&gt;");
+
+_LIT8( KAsterisk, "*" );
+
+const TInt KBufLen = 256;
+const TInt KDateStringLength        = 10;
+const TInt KDateTimeStringLength    = 19;
+const TInt KMaxDateStringLength     = 30;
+const TInt KSeparatorAscii          = 58;
+
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::CUpnpItemToXML
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+CUpnpItemToXML::CUpnpItemToXML( const CUpnpItem& aItem ) :
+    iItem( const_cast<CUpnpItem*>(&aItem) )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+void CUpnpItemToXML::ConstructL()
+    {
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUpnpItemToXML* CUpnpItemToXML::NewL( const CUpnpItem& aItem )
+    {
+    CUpnpItemToXML* self = CUpnpItemToXML::NewLC( aItem );
+    
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUpnpItemToXML* CUpnpItemToXML::NewLC( const CUpnpItem& aItem )
+    {
+    CUpnpItemToXML* self = new( ELeave ) CUpnpItemToXML( aItem );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    
+    return self;
+    }
+    
+// Destructor
+CUpnpItemToXML::~CUpnpItemToXML()
+    {
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::AsXmlL
+// Returns XML buffer
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+HBufC8* CUpnpItemToXML::AsXmlL( const TBool /*aIncludeChilds = ETrue */ ) 
+    {
+    __LOG( "CUpnpItemToXML::AsXmlL" );
+    
+    const TInt bufferSize = 64; // Buffer size, grows dynamicly in 64b steps
+    CBufFlat *pBuf = CBufFlat::NewL( bufferSize );
+    CleanupStack::PushL( pBuf );
+
+    RBufWriteStream stream( *pBuf );
+    CleanupClosePushL( stream );
+
+    // Then add the actual data
+    stream.WriteL( KItemHeading1() );
+    // xml encoding added
+    HBufC8* encodeTemp = HBufC8::NewLC( iItem->Id().Length() );
+    encodeTemp->Des().Copy( iItem->Id() );
+
+    HBufC8* tempPtr = NULL;
+    tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+    CleanupStack::PushL( tempPtr );
+
+    stream.WriteL( *tempPtr );
+    CleanupStack::PopAndDestroy( tempPtr );
+    tempPtr = NULL;
+
+    CleanupStack::PopAndDestroy( encodeTemp );
+    encodeTemp = NULL;
+
+    stream.WriteL( KItemHeading2() );
+
+    stream.WriteL( iItem->ParentId() );
+    if (iItem->Restricted())
+        {
+        stream.WriteL( KItemHeading3True() );
+        }
+    else
+        {
+        stream.WriteL( KItemHeading3False() );
+        }
+    stream.WriteL( KItemTitleBegin() );
+
+    // xml encoding added
+    encodeTemp = HBufC8::NewLC( iItem->Title().Length() );
+    encodeTemp->Des().Copy( iItem->Title() );
+    
+    tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+    CleanupStack::PushL( tempPtr );
+
+    stream.WriteL( *tempPtr );
+    CleanupStack::PopAndDestroy( tempPtr );
+    tempPtr = NULL;
+    
+    CleanupStack::PopAndDestroy( encodeTemp );
+    encodeTemp = NULL;    
+    
+    stream.WriteL( KItemTitleEnd() );
+    stream.WriteL( KItemClassBegin() );
+
+    stream.WriteL( iItem->ObjectClass() );
+    stream.WriteL( KItemClassEnd() );
+    
+     // Music meta data information
+    const TDesC8& artist = GetValueFromElement( KElementArtist ); 
+    if ( artist != KNullDesC8 )
+
+        {
+        stream.WriteL( KItemArtistBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( artist.Length() );
+        encodeTemp->Des().Copy( artist );
+
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+        
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;
+
+        stream.WriteL( KItemArtistEnd );
+        }
+    const TDesC8& creator = GetValueFromElement( KElementCreator ); 
+    if ( creator != KNullDesC8 )
+        {
+        stream.WriteL( KItemCreatorBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( creator.Length() );
+        encodeTemp->Des().Copy( creator );
+
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+        
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;
+
+        stream.WriteL( KItemCreatorEnd );
+        }
+    const TDesC8& album = GetValueFromElement( KElementAlbum ); 
+    if ( album != KNullDesC8 )
+        {
+        stream.WriteL( KItemAlbumBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( album.Length() );
+        encodeTemp->Des().Copy( album );
+        
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+    
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;
+        //stream.WriteL( Album() );
+        stream.WriteL( KItemAlbumEnd );
+        }
+    const TDesC8& genre = GetValueFromElement( KElementGenre );     
+    if ( genre != KNullDesC8 )
+        {
+        stream.WriteL( KItemGenreBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( genre.Length() );
+        encodeTemp->Des().Copy( genre );
+
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+    
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;
+        //stream.WriteL( Genre() );
+        stream.WriteL( KItemGenreEnd );
+        } 
+    const TDesC8& albumarturi = GetValueFromElement( KElementAlbumArtUri );     
+    if ( albumarturi != KNullDesC8 )
+        {
+        stream.WriteL( KItemAlbumArtURIBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( albumarturi.Length() );
+        encodeTemp->Des().Copy( albumarturi );
+
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+    
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;        
+        stream.WriteL( KItemAlbumArtURIEnd );
+        }
+    const TDesC8& date = GetValueFromElement( KElementDate );         
+    if ( date != KNullDesC8 )
+        {        
+        if( ValidateDateL( date ) )
+            {
+            stream.WriteL( KItemDateBegin );
+            // xml encoding added
+            encodeTemp = HBufC8::NewLC( date.Length() );
+            encodeTemp->Des().Copy( date );
+
+            tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+            CleanupStack::PushL( tempPtr );
+
+            stream.WriteL( *tempPtr );
+            CleanupStack::PopAndDestroy( tempPtr );
+            tempPtr = NULL;
+
+            CleanupStack::PopAndDestroy( encodeTemp );
+            encodeTemp = NULL;
+            stream.WriteL( KItemDateEnd );
+            }
+        }
+ 
+    RUPnPElementsArray elArray;
+    CleanupClosePushL( elArray );
+    UPnPItemUtility::GetResElements( *iItem, elArray );
+    TInt count = elArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        // Res-element starts
+        stream.WriteL( KItemPInfoBegin );
+        
+        const CUpnpAttribute* attrproinfo = UPnPItemUtility
+            ::FindAttributeByName( *elArray[ i ], KAttributeProtocolInfo );
+        if ( attrproinfo )
+            {        
+            stream.WriteL( attrproinfo->Value() );
+            stream.WriteL( KCriteriaQuot );
+            stream.WriteL( KCriteriaSpace );
+            }
+        const CUpnpAttribute* attrsize = UPnPItemUtility
+            ::FindAttributeByName( *elArray[ i ], KAttributeSize );            
+        if ( attrsize )
+            {
+            stream.WriteL( KAttributeSize );
+            stream.WriteL( KCriteriaEQ );
+            stream.WriteL( KCriteriaQuot );
+            stream.WriteL( attrsize->Value() );
+            stream.WriteL( KCriteriaQuot );
+            stream.WriteL( KCriteriaSpace );                   
+            }         
+        const CUpnpAttribute* attrresolution = UPnPItemUtility
+            ::FindAttributeByName( *elArray[ i ], KAttributeResolution );
+        if ( attrresolution )
+            {
+            stream.WriteL( KAttributeResolution );
+            stream.WriteL( KCriteriaEQ );
+            stream.WriteL( KCriteriaQuot );
+            stream.WriteL( attrresolution->Value() );
+            stream.WriteL( KCriteriaQuot );
+            stream.WriteL( KCriteriaSpace );                        
+            }        
+        const CUpnpAttribute* attrduration = UPnPItemUtility
+            ::FindAttributeByName( *elArray[ i ], KAttributeDuration );        
+        if ( attrduration )
+            {           
+            if( ValidateDurationL( attrduration->Value() ) )
+                {
+                stream.WriteL( KAttributeDuration );
+                stream.WriteL( KCriteriaEQ );
+                stream.WriteL( KCriteriaQuot );
+                stream.WriteL( attrduration->Value() );
+                stream.WriteL( KCriteriaQuot );
+                stream.WriteL( KCriteriaSpace );
+                }
+            else
+                {
+                // Format of duration is not valid, do not include it
+                // Fixes ESLX-7AYFD6
+                }    
+            
+            }        
+        const CUpnpAttribute* attrbitrate = UPnPItemUtility
+            ::FindAttributeByName( *elArray[ i ], KAttributeBitrate );
+        if ( attrbitrate )
+            {
+            stream.WriteL( KAttributeBitrate );
+            stream.WriteL( KCriteriaEQ );
+            stream.WriteL( KCriteriaQuot );
+            stream.WriteL( attrbitrate->Value() );
+            stream.WriteL( KCriteriaQuot );
+            stream.WriteL( KCriteriaSpace );
+            } 
+        stream.WriteL( KItemPInfoMiddle );
+        
+        // Get the content URI
+        encodeTemp = HBufC8::NewLC( elArray[ i ]->Value().Length() );
+        encodeTemp->Des().Copy( elArray[ i ]->Value() );
+
+        // Encode the content URI
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        // Write the encoded content URI
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+        
+        // Clean up
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;
+        
+        // Res-element ends
+        stream.WriteL( KItemPInfoEnd );
+        }
+    
+    CleanupStack::PopAndDestroy( &elArray );                  
+
+    stream.WriteL( KItemEnd() );
+
+    CleanupStack::PopAndDestroy(); // stream.Close();
+
+    TPtrC8 start = pBuf->Ptr(0);
+
+    // JLi: Do NOT decode retBuffer since it will be given to XML Parser
+    HBufC8* retBuffer = start.AllocL();
+    CleanupStack::PopAndDestroy( pBuf );
+    
+    return retBuffer;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::AsXmlEmptyL
+// Returns object's XML description. This version of the method is used to
+// create the XML with empty <res> tag.
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+HBufC8* CUpnpItemToXML::AsXmlEmptyL()
+    {
+    __LOG( "CUpnpItemToXML::AsXmlEmptyL" );
+    
+    const TInt bufferSize = 64; // Buffer size, grows dynamicly in 64b steps
+    CBufFlat *pBuf = CBufFlat::NewL( bufferSize );
+    CleanupStack::PushL( pBuf );
+
+    RBufWriteStream stream( *pBuf );
+    CleanupClosePushL( stream );
+
+    // Then add the actual data
+    stream.WriteL( KItemHeading1() );
+    stream.WriteL( iItem->Id() );
+    stream.WriteL( KItemHeading2() );
+    stream.WriteL( iItem->ParentId() );
+    stream.WriteL( KItemHeading3False() );
+    //stream.WriteL( KItemEndTag() );
+    stream.WriteL( KItemTitleBegin() );
+    // xml encode name
+    HBufC8* encodeTemp = HBufC8::NewLC( iItem->Title().Length() );
+    encodeTemp->Des().Copy( iItem->Title() );
+    HBufC8* tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+    CleanupStack::PushL( tempPtr ); 
+    stream.WriteL( *tempPtr );
+    CleanupStack::PopAndDestroy( tempPtr );
+    CleanupStack::PopAndDestroy( encodeTemp );
+    stream.WriteL( KItemTitleEnd() );
+    stream.WriteL( KItemClassBegin() );
+    
+    stream.WriteL( iItem->ObjectClass() );
+    stream.WriteL( KItemClassEnd() );
+    
+    // Music meta data information
+    const TDesC8& artist = GetValueFromElement( KElementArtist ); 
+    if ( artist != KNullDesC8 )
+        {
+        stream.WriteL( KItemArtistBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( artist.Length() );
+        encodeTemp->Des().Copy( artist );
+
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+        
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;
+
+        stream.WriteL( KItemArtistEnd );
+        }
+    const TDesC8& creator = GetValueFromElement( KElementCreator ); 
+    if ( creator != KNullDesC8 )
+        {
+        stream.WriteL( KItemCreatorBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( creator.Length() );
+        encodeTemp->Des().Copy( creator );
+
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+        
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;
+
+        stream.WriteL( KItemCreatorEnd );        
+        }
+    const TDesC8& album = GetValueFromElement( KElementAlbum ); 
+    if ( album != KNullDesC8 )
+        {
+        stream.WriteL( KItemAlbumBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( album.Length() );
+        encodeTemp->Des().Copy( album );
+        
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+    
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;
+        //stream.WriteL( Album() );
+        stream.WriteL( KItemAlbumEnd );        
+        }
+    const TDesC8& genre = GetValueFromElement( KElementGenre );     
+    if ( genre != KNullDesC8 )
+        {
+        stream.WriteL( KItemGenreBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( genre.Length() );
+        encodeTemp->Des().Copy( genre );
+
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+    
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;
+        //stream.WriteL( Genre() );
+        stream.WriteL( KItemGenreEnd );        
+        }
+    const TDesC8& albumarturi = GetValueFromElement( KElementAlbumArtUri );     
+    if ( albumarturi != KNullDesC8 )
+        {
+        stream.WriteL( KItemAlbumArtURIBegin );
+        // xml encoding added
+        encodeTemp = HBufC8::NewLC( albumarturi.Length() );
+        encodeTemp->Des().Copy( albumarturi );
+
+        tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+        CleanupStack::PushL( tempPtr );
+
+        stream.WriteL( *tempPtr );
+        CleanupStack::PopAndDestroy( tempPtr );
+        tempPtr = NULL;
+    
+        CleanupStack::PopAndDestroy( encodeTemp );
+        encodeTemp = NULL;       
+        stream.WriteL( KItemAlbumArtURIEnd );        
+        }
+    const TDesC8& date = GetValueFromElement( KElementDate );         
+    if ( date != KNullDesC8 )
+        {
+        if( ValidateDateL( date ) )
+            {
+            stream.WriteL( KItemDateBegin );
+            // xml encoding added
+            encodeTemp = HBufC8::NewLC( date.Length() );
+            encodeTemp->Des().Copy( date );
+
+            tempPtr = UpnpString::EncodeXmlStringL( encodeTemp );
+            CleanupStack::PushL( tempPtr );
+
+            stream.WriteL( *tempPtr );
+            CleanupStack::PopAndDestroy( tempPtr );
+            tempPtr = NULL;
+
+            CleanupStack::PopAndDestroy( encodeTemp );
+            encodeTemp = NULL;
+            stream.WriteL( KItemDateEnd );
+            }       
+        }
+    
+    // Create dlna compliant protocolinfo
+    const RUPnPElementsArray& elms = iItem->GetElements();
+    CUpnpDlnaProtocolInfo* pInfo = NULL; 
+    HBufC8* duration  = NULL;
+    HBufC8* size  = NULL;
+    HBufC8* resolution  = NULL;
+    HBufC8* info = NULL;
+    for( TInt i = 0; i < elms.Count(); i++)
+        {
+        if( elms[ i ]->Name() == KElementRes )
+            {
+            const RUPnPAttributesArray& attr = elms[ i ]->GetAttributes();
+            for( TInt j = 0; j < attr.Count(); j++ )
+                {
+                if( attr[ j ]->Name() == KAttributeProtocolInfo )
+                    {
+                    pInfo = CUpnpDlnaProtocolInfo::NewL( attr[ j ]->Value() );
+                    if ( pInfo )
+                        {
+                        CleanupStack::PushL( pInfo );
+                        info = HBufC8::NewLC( KBufLen );
+                        }
+                    }
+                if ( attr[ j ]->Name() == KAttributeDuration )
+                    {
+                    duration= HBufC8::NewLC( attr[ j ]->Value().Length() );
+                    duration->Des().Copy( attr[ j ]->Value() );
+                    }
+                if ( attr[ j ]->Name() == KAttributeSize )
+                    {
+                    size = HBufC8::NewLC( attr[ j ]->Value().Length() );
+                    size->Des().Copy( attr[ j ]->Value() );
+                    }
+                if ( attr[ j ]->Name() == KAttributeResolution )
+                    {
+                    resolution = HBufC8::NewLC( attr[ j ]->Value().Length() );
+                    resolution->Des().Copy( attr[ j ]->Value() );
+                    }
+                }
+            i = elms.Count();
+            }
+        }
+    
+    if( pInfo )
+        {
+        info->Des().Copy( KItemPInfoEmptyDlna );
+        info->Des().Append( pInfo->ThirdField() ); // Third param )
+        info->Des().Append( KColon );
+        if( pInfo->PnParameter().Length() > 0 )
+            {
+            info->Des().Append( KDlnaPn );
+            info->Des().Append( pInfo->PnParameter() ); // Fourth param )
+            }
+        else
+            {
+            info->Des().Append( KAsterisk );
+            }    
+        if ( resolution )
+            {
+            info->Des().Append( KQuotationMark );
+            info->Des().Append( KItemResolution );
+            info->Des().Append( *resolution );
+            CleanupStack::PopAndDestroy( resolution );
+            resolution = NULL;
+            }
+        if ( duration )
+            {
+            info->Des().Append( KQuotationMark );
+            info->Des().Append( KItemDuration );
+            info->Des().Append( *duration );
+            CleanupStack::PopAndDestroy( duration );
+            duration = NULL;
+            }
+        if ( size )
+            {
+            info->Des().Append( KQuotationMark );
+            info->Des().Append( KItemSize );
+            info->Des().Append( *size );
+            CleanupStack::PopAndDestroy( size );
+            size = NULL;
+            }
+        
+        info->Des().Append( KItemPInfoEnd2 );
+        stream.WriteL( *info );
+        CleanupStack::PopAndDestroy( info );
+        CleanupStack::PopAndDestroy( pInfo );
+        
+        }
+    else
+        {
+        stream.WriteL( KItemPInfoEmpty );    
+        }    
+            
+    stream.WriteL( KItemEnd() );
+
+    CleanupStack::PopAndDestroy( &stream );
+
+    TPtrC8 start = pBuf->Ptr(0);
+
+    HBufC8* tmpBuffer = start.AllocL();
+
+    CleanupStack::PopAndDestroy( pBuf );
+
+    return tmpBuffer;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::AsResultArgumentL
+// Returns object's XML description that is embedded inside a DIDL-LITE tag. 
+// The <res> tag of xml description is empty.The returned value is xml encoded
+// can therefore be used for example when creating a CreateObject action.
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+HBufC8* CUpnpItemToXML::AsResultArgumentL()
+    {
+    __LOG( "CUpnpItemToXML::AsResultArgumentL" );
+    
+    HBufC8* asEmptyXml = this->AsXmlEmptyL();
+    CleanupStack::PushL( asEmptyXml );
+    
+    // Xml must be encoded because eventually it will be embedded inside 
+    // another Xml tag (Elements tag in CreateObject action).
+    HBufC8* encodedItem = UpnpString::EncodeXmlStringL( asEmptyXml );
+    CleanupStack::PopAndDestroy( asEmptyXml );
+    CleanupStack::PushL( encodedItem );
+    
+    // Put item xml inside DIDL-LITE tag which must also be xml encoded.
+    HBufC8* retval = CreateUnDecodedXmlL( *encodedItem );
+    CleanupStack::PopAndDestroy( encodedItem );
+    
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::CreateUnDecodedXmlL
+// Fills common DIDL-Lite XML headers over the given XML fragment.
+// --------------------------------------------------------------------------
+HBufC8* CUpnpItemToXML::CreateUnDecodedXmlL( const TDesC8& aData )
+    {
+    __LOG( "CUpnpItemToXML::CreateUnDecodedXmlL" );
+    
+    const TInt bufferSize = 128; // Buffer size
+    CBufFlat *pBuf = CBufFlat::NewL( bufferSize );
+    CleanupStack::PushL( pBuf );
+
+    RBufWriteStream stream( *pBuf );
+    CleanupClosePushL( stream );
+
+    stream.WriteL( KDIDLBeginXmlEscaped() );
+    stream.WriteL( aData );
+    stream.WriteL( KDIDLEndXmlEscaped() );
+
+    CleanupStack::PopAndDestroy( &stream ); // stream.Close();
+
+    TPtrC8 start = pBuf->Ptr(0);
+
+    HBufC8* tmpBuffer = start.AllocL();
+
+    CleanupStack::PopAndDestroy( pBuf );
+    return tmpBuffer;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::GetValueFromElement
+// Returns the value of an element.
+// --------------------------------------------------------------------------
+const TDesC8& CUpnpItemToXML::GetValueFromElement(
+    const TDesC8& aElementName )
+    {
+    const RUPnPElementsArray& elms = iItem->GetElements();
+    TInt count = elms.Count();
+    for( TInt i = 0; i < count; i++)
+        {
+        if( elms[ i ]->Name() == aElementName )
+            {
+            return elms[ i ]->Value();
+            }
+        }
+    return KNullDesC8;              
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::ValidateDateL
+// Validates dc:date
+// --------------------------------------------------------------------------
+TBool CUpnpItemToXML::ValidateDateL( const TDesC8& aDate )
+    {
+    TDateTime time;    
+    TBuf<KMaxDateStringLength> formatDateString;
+    HBufC* dateString = HBufC::NewL( aDate.Length() );
+    dateString->Des().Copy( aDate );
+    TInt err = KErrNone;
+    TInt year = 0;
+    TInt month = 1; 
+    TInt day = 1;
+    TInt hours = 0;
+    TInt minutes = 0;
+    TInt seconds = 0;
+
+    if( aDate.Length() >= KDateStringLength )
+    {
+        TLex lex( dateString->Des().Left( 4 ) ); //Year
+        err = lex.Val( year );
+        if(  err == KErrNone )
+        {
+            lex.Assign( dateString->Des().Mid( 5,2 ) ); //Month
+            TInt err = lex.Val( month );
+            if(  err == KErrNone )
+            {
+                lex.Assign( dateString->Des().Mid( 8,2 ) ); //Day
+                TInt err = lex.Val(day);
+            }
+        }
+    }
+        
+    if (err)
+    {
+        return EFalse;
+    }
+        
+    if( aDate.Length() >= KDateTimeStringLength )
+    {
+        TLex lex( dateString->Des().Mid( 11,2 ) ); //Hours
+        err = lex.Val( hours );
+        if(  err == KErrNone )
+        {
+            lex.Assign( dateString->Des().Mid( 14,2 ) ); //Minutes
+            TInt err = lex.Val( hours );
+            if(  err == KErrNone )
+            {
+                lex.Assign( dateString->Des().Mid( 17,2 ) ); //Seconds
+                TInt err = lex.Val( hours );
+            }
+        }
+    }
+
+    if (err)
+    {
+        return EFalse;
+    }
+        
+    TBool retVal = EFalse;
+    //DateTime month and day are 0-based
+    if( time.Set( year, TMonth(month - 1), 
+            day - 1, hours, minutes, seconds,0 ) == KErrNone )
+        {
+        retVal = ETrue;
+        }
+    
+    delete dateString;
+    
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::ValidateDurationL
+// Validates res@duration
+// --------------------------------------------------------------------------
+TBool CUpnpItemToXML::ValidateDurationL( const TDesC8& aDuration )
+    {
+    
+    TBool retVal = ETrue;
+    TLex8 input( aDuration );
+    
+    // Hours
+    ParseToDelimeter( input, TChar( KSeparatorAscii ) );
+    TInt hours = input.MarkedToken().Length();
+    if( !input.Eos() )
+        {
+        input.SkipAndMark( 1 ); // Skip the delimeter
+        }
+    if( hours < 1 || hours > 5 ) // hours must be 1-5 digits long
+        {
+        retVal = EFalse;
+        }
+    else
+        {
+        // Minutes
+        ParseToDelimeter( input, TChar( KSeparatorAscii ) );   
+        TInt minutes = input.MarkedToken().Length();
+        if( !input.Eos() )
+            {
+            input.SkipAndMark( 1 ); // Skip the delimeter
+            }
+
+        if( minutes != 2 ) // minutes must be 2 digits long
+            {
+            retVal = EFalse;
+            }
+        else
+            {
+            // Seconds
+            ParseToDelimeter( input, TChar( KSeparatorAscii ) );
+            TInt seconds = input.MarkedToken().Length();
+            if( seconds < 2 || seconds > 6 ) // seconds must be 2-6 digits
+            // long
+                {
+                retVal = EFalse;
+                }
+
+            if( !input.Eos() )
+                {
+                // Something is wrong, we should be in the end        
+                retVal = EFalse;
+                }            
+            }    
+        }    
+  
+    return retVal;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpItemToXML::ParseToDelimeter
+// Parse to a given delimeter
+// --------------------------------------------------------------------------
+void CUpnpItemToXML::ParseToDelimeter( TLex8& aLex, TChar aDelimeter )
+    {
+    aLex.Mark();
+        
+    TChar chr = 0;
+    
+    while( !aLex.Eos() )
+        {
+        chr = aLex.Peek();
+        if( chr == aDelimeter )
+            {
+            break;
+            }
+            
+        aLex.Inc();        
+        }
+    }    
+    
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/src/upnpobjectlite.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,397 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Light weight version of UpnpObject
+*
+*/
+
+
+
+
+
+
+#include "upnpobjectlite.h"
+
+const TInt KDelimeter = 46;
+const TInt KRound1 = 1;
+const TInt KRound2 = 2;
+const TInt KRound3 = 3; 
+const TInt KRound4 = 4;
+
+const TInt KMask1 = 0xFF000000;
+const TInt KMask2 = 0x00FF0000;
+
+_LIT8( KObject, "object" );
+_LIT8( KItem, "item" );
+_LIT8( KContainer,"container" );
+
+_LIT8( KImageItem, "imageItem" );
+_LIT8( KAudioItem, "audioItem" );
+_LIT8( KVideoItem, "videoItem" );
+_LIT8( KPlaylistItem, "playlistItem" );
+_LIT8( KStorageFolder, "storageFolder" );
+_LIT8( KPlaylistContainer, "playlistContainer" );
+
+_LIT8( KMusicTrack,"musicTrack" );
+_LIT8( KPhoto,"photo" );
+_LIT8( KVideo,"video" );
+_LIT8( KMusicAlbum,"musicAlbum" );
+
+
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::CUpnpObjectLite
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+CUpnpObjectLite::CUpnpObjectLite()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::~CUpnpObjectLite
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C CUpnpObjectLite::~CUpnpObjectLite()
+    {
+    delete iObjectId;
+    delete iTitle;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::NewL
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+void CUpnpObjectLite::ConstructL()
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::NewL
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C CUpnpObjectLite* CUpnpObjectLite::NewL()
+    {
+    CUpnpObjectLite* self = new (ELeave) CUpnpObjectLite();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::SetObjectIdL
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpObjectLite::SetObjectIdL( const TDesC8& aObjectId )
+    {
+    HBufC8* tmp = aObjectId.AllocL();
+    delete iObjectId;
+    iObjectId = tmp;
+    }
+
+    
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::SetObjectIdL
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpObjectLite::SetObjectIdL( HBufC8* aObjectId )
+    {
+    if( aObjectId )
+        {
+        delete iObjectId;
+        iObjectId = aObjectId;
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::ObjectId
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C const TDesC8& CUpnpObjectLite::ObjectId() const
+    {
+    if( iObjectId )
+        {
+        return *iObjectId;
+        }
+    else
+        {
+        return KNullDesC8;
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::SetTitleL
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpObjectLite::SetTitleL( const TDesC& aTitle )
+    {
+    HBufC* tmp = aTitle.AllocL();
+    delete iTitle;
+    iTitle = tmp;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::SetTitleL
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpObjectLite::SetTitleL( HBufC* aTitle )
+    {
+    if( aTitle )
+        {
+        delete iTitle;
+        iTitle = aTitle;
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::Title
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C const TDesC& CUpnpObjectLite::Title() const
+    {
+    if( iTitle )
+        {
+        return *iTitle;
+        }
+    else
+        {
+        return KNullDesC;
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::SetObjectClass
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUpnpObjectLite::SetObjectClass( const TDesC8& aObjectClass )
+    {
+    iObjectClass = 0;
+    TInt round = 0;
+    
+    TLex8 input( aObjectClass );
+    while( !input.Eos() )
+        {
+        round++;
+        ParseToDelimeter( input, TChar( KDelimeter ) );
+        
+        HandleRound( round, input.MarkedToken() );
+
+        if( !input.Eos() )
+            {
+            input.SkipAndMark( 1 ); // Skip the delimeter
+            }
+        }
+    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::IsTypeOf
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool CUpnpObjectLite::IsTypeOf( TObjectType aType ) const
+    {
+    TBool retVal = EFalse;
+    switch( aType )
+        {
+        case EItem:
+            {
+            if( ( iObjectClass & KMask1 ) == EBaseItem )
+                {
+                retVal = ETrue;
+                }
+            }
+            break;
+        case EContainer:
+            {
+            if( ( iObjectClass & KMask1 ) == EBaseContainer )
+                {
+                retVal = ETrue;
+                }            
+            }
+            break;
+        case EMusicItem:
+            {
+            if( ( iObjectClass & KMask2 ) == EBaseMusicItem )
+                {
+                retVal = ETrue;
+                }                                    
+            }
+            break;
+        case EImageItem:
+            {
+            if( ( iObjectClass & KMask2 ) == EBaseImageItem )
+                {
+                retVal = ETrue;
+                }                                    
+            }
+            break;
+        case EVideoItem:
+            {
+            if( ( iObjectClass & KMask2 ) == EBaseVideoItem )
+                {
+                retVal = ETrue;
+                }                                                
+            }
+            break;
+        default:
+            {
+            retVal = EFalse;                                               
+            }
+            break;
+        }
+    
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::ParseToDelimeter
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+void CUpnpObjectLite::ParseToDelimeter( TLex8& aLex, TChar aDelimeter ) const
+    {
+    aLex.Mark();
+    while( (aLex.Peek() != aDelimeter) && (!aLex.Eos()) )
+        {
+        aLex.Inc();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpObjectLite::HandleRound
+// See upnpobjectlite.h
+// --------------------------------------------------------------------------
+void CUpnpObjectLite::HandleRound( TInt aRound, TPtrC8 aString )
+    {
+    switch( aRound )
+        {
+        case KRound1:
+            {
+            Round1( aString );
+            break;
+            }
+        case KRound2:
+            {
+            Round2( aString );
+            break;
+            }
+        case KRound3:
+            {
+            Round3( aString );
+            break;
+            }
+        case KRound4:
+            {
+            Round4( aString );
+            break;
+            }
+            
+        default:
+            {
+            
+            break;
+            }
+        }
+    }
+
+void CUpnpObjectLite::Round1( TPtrC8 aString )
+    {
+    if( aString.Compare( KObject ) != 0 )
+        {
+        // Not an object
+        iObjectClass |= EBaseUnknown;
+        }
+    }
+    
+void CUpnpObjectLite::Round2( TPtrC8 aString )
+    {
+    if( aString.Compare( KItem ) == 0 )
+        {
+        iObjectClass |= EBaseItem;
+        }
+    else if( aString.Compare( KContainer ) == 0 )
+        {
+        iObjectClass |= EBaseContainer;
+        }
+    else
+        {
+        iObjectClass |= EBaseUnknown;
+        }    
+    }
+    
+void CUpnpObjectLite::Round3( TPtrC8 aString )
+    {
+    if( aString.Compare( KImageItem ) == 0 )
+        {
+        iObjectClass |= EBaseImageItem;
+        }
+    else if( aString.Compare( KAudioItem ) == 0 )
+        {
+        iObjectClass |= EBaseMusicItem;
+        }
+    else if( aString.Compare( KVideoItem ) == 0 )
+        {
+        iObjectClass |= EBaseVideoItem;
+        }
+    else if( aString.Compare( KPlaylistItem ) == 0 )
+        {
+        iObjectClass |= EBasePlaylistItem;
+        }    
+    else if( aString.Compare( KStorageFolder ) == 0 )
+        {
+        iObjectClass |= EStorageFolder;
+        }    
+    else if( aString.Compare( KPlaylistContainer ) == 0 )
+        {
+        iObjectClass |= EPlaylistContainer;
+        }
+    else
+        {
+        
+        }        
+    }
+    
+void CUpnpObjectLite::Round4( TPtrC8 aString )
+    {
+    if( aString.Compare( KMusicTrack ) == 0 )
+        {
+        iObjectClass |= EMusicTrack;
+        }
+    else if( aString.Compare( KPhoto ) == 0 )
+        {
+        iObjectClass |= EPhoto;
+        }
+    else if( aString.Compare( KVideo ) == 0 )
+        {
+        iObjectClass |= EMovie;
+        }
+    else if( aString.Compare( KMusicAlbum ) == 0 )
+        {
+        iObjectClass |= EMusicAlbum;
+        }    
+    else
+        {
+        
+        }            
+    }
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/src/upnpxmleventparser.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,391 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      XML SAX Parser for UPnP.
+*
+*/
+
+
+
+
+
+
+#include <xml/parser.h>
+#include <xml/parserfeature.h>
+#include <upnpstring.h>
+#include <xml/matchdata.h>
+
+#include "upnpxmleventparser.h"
+
+_LIT( KComponentLogfile, "upnpxmlparser.txt");
+#include "upnplog.h"
+
+_LIT8( KXmlMimeType,    "text/xml"     );
+_LIT8( KLIB2XML,        "libxml2" );
+
+_LIT8( KEvent,          "Event"         );
+_LIT8( KInstanceID,     "InstanceID"    );
+_LIT8( KVolume,         "Volume"        );
+_LIT8( KMute,           "Mute"          );
+_LIT8( KDIDL,           "DIDL-Lite"     );
+_LIT8( KDesc,           "desc"          );
+_LIT8( KDlnaDoc,        "X_DLNADOC"     );
+_LIT8( KVal,            "val"           );
+_LIT8( KChannel,        "channel"       );
+_LIT8( KMaster,         "Master"       );
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::CUPnPXMLEventParser()
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+CUPnPXMLEventParser::CUPnPXMLEventParser()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::ConstructL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::ConstructL()
+    {
+    __LOG( "CUPnPXMLEventParser::CostructL" );
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::NewL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C CUPnPXMLEventParser* CUPnPXMLEventParser::NewL()
+    {
+    __LOG( "CUPnPXMLEventParser::NewL" );
+    CUPnPXMLEventParser* self = new( ELeave ) CUPnPXMLEventParser();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(self);    
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::~CUPnPXMLEventParser
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+CUPnPXMLEventParser::~CUPnPXMLEventParser()
+    {
+    __LOG( "CUPnPXMLEventParser::~CUPnPXMLEventParser" );
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::ParseResultDataL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUPnPXMLEventParser::ParseResultDataL( const TDesC8& aData,
+        TInt& aInstanceId, TInt& aVolume, TBool& aMute )
+    {
+    __LOG( "CUPnPXMLEventParser::ParseResultDataL, begin" );
+    
+    if ( !aData.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    Reset();
+        
+    // Create parser 
+    CMatchData* matchData = CMatchData::NewLC();
+    matchData->SetMimeTypeL( KXmlMimeType ); 
+    matchData->SetVariantL( KLIB2XML ); 
+    CParser* parser = CParser::NewLC( *matchData, *this ); 
+    parser->EnableFeature( Xml::EReportNamespaceMapping );
+    
+    Xml::ParseL( *parser, aData );    
+    
+    CleanupStack::PopAndDestroy( parser );
+    CleanupStack::PopAndDestroy( matchData );
+    
+    if( iInstanceID != KErrNotFound )
+        {
+        aInstanceId = iInstanceID;
+        if( iVolume != KErrNotFound )
+            {
+            aVolume = iVolume;    
+            }
+        if( iMute != KErrNotFound )
+            {
+            aMute = iMute;    
+            }
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }    
+    
+    __LOG( "CUPnPXMLEventParser::ParseResultDataL, end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnStartDocumentL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnStartDocumentL( 
+                                const RDocumentParameters& /*aDocParam*/, 
+                                TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnEndDocumentL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnEndDocumentL( TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnStartElementL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnStartElementL( const RTagInfo& aElement, 
+                                      const RAttributeArray& aAttributes,
+                                      TInt aErrorCode )
+    {
+    __LOG1( "CUPnPXMLEventParser::OnStartElementL, error: %d", aErrorCode );
+    if ( aErrorCode != KErrNone )
+        {
+        return;
+        }
+    const TDesC8& desName = aElement.LocalName().DesC();
+    //const TDesC8& prefix = aElement.Prefix().DesC();
+      
+    if ( !desName.CompareF( KEvent ) )
+        {
+        iParserState = EEvent;
+        }
+    else if ( !desName.CompareF( KInstanceID ) )
+        {
+        iParserState = EInstanceID;
+        SetAttributesL( aAttributes );
+        }
+    else if( !desName.CompareF( KVolume ) )
+        {
+        iParserState = EVolume;
+        SetAttributesL( aAttributes );
+        }
+    else if( !desName.CompareF( KMute ) )
+        {
+        iParserState = EMute;
+        SetAttributesL( aAttributes );
+        }
+    // Ignore DIDL-Lite, desc and X_DLNADOC -elements (DLNA req)
+    else if( desName.Compare( KDIDL ) == KErrNone ||
+             desName.Compare( KDesc ) == KErrNone ||
+             desName.Compare( KDlnaDoc ) == KErrNone    
+           )
+        {
+        // Ignore
+        }
+    else 
+        {
+        __LOG( "OnStartElementL - unknown element!" );
+        __LOG8( desName );
+        }
+    
+    __LOG( "CUPnPXMLEventParser::OnStartElementL, end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnEndElementL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnEndElementL( const RTagInfo& /*aElement*/, 
+                                    TInt /*aErrorCode*/ )
+    {
+    __LOG( "CUPnPXMLSAXParser::OnEndElementL(), begin" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnContentL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnContentL( const TDesC8& /*aBytes*/,
+    TInt /*aErrorCode*/ )
+    {
+    __LOG( "CUPnPXMLSAXParser::OnContentL(), begin" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnStartPrefixMappingL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnStartPrefixMappingL( const RString& /*aPrefix*/, 
+                                               const RString& /*aUri*/, 
+                                               TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnEndPrefixMappingL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnEndPrefixMappingL( const RString& /*aPrefix*/, 
+                                             TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnIgnorableWhiteSpaceL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, 
+                                                TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnSkippedEntityL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnSkippedEntityL( const RString& /*aName*/, 
+                                          TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnProcessingInstructionL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnProcessingInstructionL( const TDesC8& /*aTarget*/, 
+                                                  const TDesC8& /*aData*/, 
+                                                  TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::OnError
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::OnError( TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::GetExtendedInterface
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+TAny* CUPnPXMLEventParser::GetExtendedInterface( const TInt32 /*aUid*/ )
+    {    
+    // No implementation needed
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::SetAttributesL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::SetAttributesL(
+    const RAttributeArray& aAttributes )
+    {
+    __LOG( "CUPnPXMLEventParser::SetAttributesL" );
+
+    RAttribute attribute;
+    TInt count = aAttributes.Count();
+    TInt volume = KErrNotFound;
+    iMasterVolumeState = EFalse;
+    for ( TInt i = 0; i < count ; i++ )
+        {
+        attribute = aAttributes[i];
+        const TDesC8& name = attribute.Attribute().LocalName().DesC();
+
+        if ( iParserState == EVolume )
+            {
+            // assign the value of Volume to volume 
+            if ( name.CompareF( KVal ) == KErrNone )
+                {
+                __LOG( "SetAttributesL - \"val\" found!" );
+                TLex8 lexer( attribute.Value().DesC() );
+                User::LeaveIfError( lexer.Val(volume) );
+                __LOG1( "SetAttributesL - volume = %d", volume );
+                }
+            else if ( name.CompareF( KChannel ) == KErrNone )
+                {
+                // channel is found, check if is Master
+                const TDesC8& channelname = attribute.Value().DesC();
+                if ( channelname.CompareF( KMaster ) == KErrNone )
+                    {
+                    __LOG( "SetAttributesL - MasterVolume found!" );
+                    iMasterVolumeState = ETrue;
+                    }
+                }
+            }
+        else
+            {
+
+            if ( name.Compare( KVal ) == KErrNone )
+                {
+                __LOG( "SetAttributesL - \"val\" found!" );
+
+                TLex8 lexer( attribute.Value().DesC() );
+                if ( iParserState == EInstanceID )
+                    {
+                    User::LeaveIfError( lexer.Val( iInstanceID ) );
+                    }
+                else
+                    if ( iParserState == EMute )
+                        {
+                        User::LeaveIfError( lexer.Val( iMute ) );
+                        }
+                    else
+                        {
+                        __LOG( "SetAttributesL - unknown state!" );
+                        }
+                }
+            }
+        }
+    
+    // check Mastervolume if was found, and volume if was found
+    if ( iParserState == EVolume && 
+         iMasterVolumeState && 
+         volume != KErrNotFound )
+        {
+        // all is found ,so assign the iVolume
+        __LOG1( "SetAttributesL - set iVolume : %d", volume );
+        iVolume = volume;       
+        }
+    
+    __LOG( "CUPnPXMLEventParser::SetAttributesL - End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLEventParser::Reset
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLEventParser::Reset()
+    {
+    iInstanceID = KErrNotFound;
+    iMute = KErrNotFound;
+    iVolume = KErrNotFound;
+    iParserState = ENotSupported;
+    iMasterVolumeState = EFalse;
+    }
+      
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/src/upnpxmlparser.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,697 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      XML SAX Parser for UPnP.
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// xml parser api
+#include <xml/parser.h>
+#include <xml/parserfeature.h>
+#include <xml/matchdata.h>
+#include <xml/xmlparsererrors.h>
+
+// upnp stack api
+#include "upnpstring.h"
+#include <upnpcontainer.h>
+#include <upnpitem.h>
+#include "upnpelement.h"
+#include "upnpxmlparser.h"
+
+// upnpframework / internal api's
+#include "upnpcdsreselementutility.h"
+
+// xmlparser internal
+#include "upnpobjectstack.h"
+#include "upnpitemtoxml.h"
+#include "upnpxmlstringutility.h"
+#include "upnpxmlparser.h"
+
+_LIT( KComponentLogfile, "upnpxmlparser.txt");
+#include "upnplog.h"
+
+
+_LIT8( KXmlMimeType,    "text/xml"     );
+_LIT8( KLIB2XML,        "libxml2" );
+
+_LIT8( KContainer,      "container"    );
+_LIT8( KItem,           "item"         );
+
+_LIT8( KTitle,          "title"        );
+
+_LIT8( KClass,          "class"        );
+_LIT8( KContentURI,     "res"          );
+_LIT8( KId,             "id"           );
+_LIT8( KParentId,       "parentId"     );
+_LIT8( KRestricted,     "restricted"   );
+_LIT8( KComma,          ":"            );
+_LIT8( KTrue,           "1"            );
+_LIT8( KDIDL,           "DIDL-Lite"    );
+_LIT8( KDesc,           "desc"         );
+_LIT8( KDlnaDoc,        "X_DLNADOC"    );
+_LIT8( KSpace,          " "            );
+_LIT8( KImportUri,      "importUri"    );
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::CUPnPXMLParser()
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+CUPnPXMLParser::CUPnPXMLParser()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::ConstructL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::ConstructL()
+    {
+    __LOG( "CUPnPXMLParser::CostructL" );
+    iStack = CUPnPObjectStack::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::NewL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C CUPnPXMLParser* CUPnPXMLParser::NewL()
+    {
+    CUPnPXMLParser* self = CUPnPXMLParser::NewLC();
+    CleanupStack::Pop( self );    
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::NewLC
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C CUPnPXMLParser* CUPnPXMLParser::NewLC()
+    {   
+    CUPnPXMLParser* self = new( ELeave ) CUPnPXMLParser();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::~CUPnPXMLParser
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+CUPnPXMLParser::~CUPnPXMLParser()
+    {
+    __LOG( "CUPnPXMLParser::~CUPnPXMLParser" );
+    if ( iStack )
+        {
+        iStack->ResetAndDestroy();
+        delete iStack;
+        }
+    
+    delete iElementValue;
+    delete iNewElement;
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::ResetMember
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::ResetMember()
+    {
+    iResultRoot->ResetAndDestroy();
+    iResultRoot = NULL;
+    iStack->ResetAndDestroy(); 
+    delete iStack;
+    iStack = NULL;
+
+    delete iElementValue; iElementValue = NULL;
+    delete iNewElement; iNewElement = NULL;
+    iTitle = 0;
+    iObjectClass = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::ParseResultDataL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUPnPXMLParser::ParseResultDataL( 
+    RPointerArray<CUpnpObject>& aResultArray,
+    const TDesC8& aData )
+    {
+    __LOG( "CUPnPXMLParser::ParseResultDataL, begin" );
+    
+    if ( !aData.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iResultRoot = &aResultArray;
+
+    // Create parser 
+    CMatchData* matchData = CMatchData::NewLC();
+    matchData->SetMimeTypeL( KXmlMimeType ); 
+    matchData->SetVariantL( KLIB2XML ); 
+    CParser* parser = CParser::NewLC( *matchData, *this );
+    parser->EnableFeature( Xml::EReportNamespaceMapping );
+    
+    TRAPD( err, Xml::ParseL( *parser,aData ) );
+    // if the xml contained control character
+    if( EXmlInvalidToken == err )
+        {
+        __LOG1 ( "CUPnPXMLParser::ParseResultDataL Can not Parse \
+        		error code %d " ,err );
+        HBufC8* FiltrateBuffer = 
+            UpnpXmlStringUtility::RemoveXmlControlCharactersL( aData );
+        //if remove some control characters.
+        if( FiltrateBuffer )
+            {
+            CleanupStack::PushL( FiltrateBuffer );
+            ResetMember();
+
+            iStack = CUPnPObjectStack::NewL();
+            iResultRoot = &aResultArray;
+
+            Xml::ParseL( *parser, *FiltrateBuffer );
+            CleanupStack::PopAndDestroy( FiltrateBuffer );
+            }
+        else
+            {
+            User::Leave( err );
+            }
+        }
+    else if ( KErrNone != err )
+        {
+        User::Leave( err );
+        }
+    CleanupStack::PopAndDestroy( parser );
+    CleanupStack::PopAndDestroy( matchData );
+    
+    iResultRoot = NULL;           
+    __LOG( "CUPnPXMLParser::ParseResultDataL, end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::ItemAsXMLLC
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C HBufC8* CUPnPXMLParser::ItemAsXmlLC( const CUpnpItem& aItem )
+    {
+    CUpnpItemToXML* tmpXmlItem =  CUpnpItemToXML::NewLC( aItem );
+    HBufC8* raw  = tmpXmlItem->AsXmlL();
+    CleanupStack::PushL( raw );
+    
+    HBufC8* encoded = UpnpString::EncodeXmlStringL( raw );
+    CleanupStack::PopAndDestroy( raw );
+    CleanupStack::PushL( encoded );
+    
+    HBufC8* tagged = tmpXmlItem->CreateUnDecodedXmlL( *encoded );
+    CleanupStack::PopAndDestroy( encoded );
+    CleanupStack::PopAndDestroy( tmpXmlItem );
+    CleanupStack::PushL( tagged );
+    
+    return tagged;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::XmlForCreateObjectLC
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C HBufC8* CUPnPXMLParser::XmlForCreateObjectLC(
+    const CUpnpItem& aItem )
+    {
+    CUpnpItemToXML* tmpXmlItem = CUpnpItemToXML::NewLC( aItem );
+    HBufC8* tempXmlDataBlock = tmpXmlItem->AsResultArgumentL();
+    CleanupStack::PopAndDestroy( tmpXmlItem );
+    CleanupStack::PushL( tempXmlDataBlock );
+    
+    return tempXmlDataBlock;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::ContainerToXmlLC
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C HBufC8* CUPnPXMLParser::ContainerToXmlLC(
+    const CUpnpContainer& /*aContainer*/ )
+    {
+    // Not implemented
+    User::Leave( KErrNotSupported );
+    
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnStartDocumentL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnStartDocumentL( 
+                                const RDocumentParameters& /*aDocParam*/, 
+                                TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnEndDocumentL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnEndDocumentL( TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnStartElementL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnStartElementL( const RTagInfo& aElement, 
+                                      const RAttributeArray& aAttributes,
+                                      TInt aErrorCode )
+    {
+    __LOG1( "CUPnPXMLParser::OnStartElementL, error code: %d", aErrorCode );
+    if ( aErrorCode != KErrNone )
+        {
+        return;
+        }
+    const TDesC8& desName = aElement.LocalName().DesC();
+    const TDesC8& prefix = aElement.Prefix().DesC();
+    
+    // Delete content, since there may be some stuff between the elements
+    // (comments, whitespace etc.)
+    delete iElementValue; iElementValue = NULL;    
+      
+    if ( !desName.CompareF( KContainer ) ) // Container element
+        {
+        CUpnpContainer* tmpContainer = CUpnpContainer::NewL();
+        CleanupStack::PushL( tmpContainer );
+
+        SetAttributesL( *tmpContainer, aAttributes );
+        //push into the stack, ownership is transferred                      
+        iStack->PushL( tmpContainer ); 
+        
+        CleanupStack::Pop( tmpContainer );
+        }
+    else if ( !desName.CompareF( KItem ) ) // Item element
+        {
+        CUpnpItem* tmpItem = CUpnpItem::NewL();
+        CleanupStack::PushL( tmpItem );
+
+        SetAttributesL( *tmpItem, aAttributes );                      
+        //push into the stack, ownership is transferred                      
+        iStack->PushL( tmpItem );
+        
+        CleanupStack::Pop( tmpItem );
+        }
+    else if( !desName.CompareF( KTitle ) ) // Title element
+        {
+        // check that we have item or container. cause leave if not
+        if ( iStack->Count() == 0)
+            {
+            User::Leave( KErrArgument );
+            }
+        // We should have an item or a container already!
+        //__ASSERTD( iStack->Top(), __FILE__, __LINE__ );
+        iTitle = ETrue;
+        }
+    else if( !desName.CompareF( KClass ) ) // Object class element
+        {
+        // check that we have item or container. cause leave if not
+        if ( iStack->Count() == 0)
+            {
+            User::Leave( KErrArgument );
+            }
+        // We should have an item or a container already!
+       // __ASSERTD( iStack->Top(), __FILE__, __LINE__ );
+        iObjectClass = ETrue;
+        }
+    // Ignore DIDL-Lite, desc and X_DLNADOC -elements (DLNA req)
+    else if( desName.Compare( KDIDL ) == KErrNone ||
+             desName.Compare( KDesc ) == KErrNone ||
+             desName.Compare( KDlnaDoc ) == KErrNone    
+           )
+        {
+        // Ignore
+        }
+    else 
+        {
+        // check that we have item or container. cause leave if not
+        if ( iStack->Count() == 0)
+            {
+            User::Leave( KErrArgument );
+            }
+        
+        // We should have an item or a container already!    
+        //__ASSERTD( iStack->Top(), __FILE__, __LINE__ );
+        
+        if( prefix.Length() > 0 ) // If there is a namespace (upnp: etc)
+            {
+            HBufC8* name = HBufC8::NewLC( prefix.Length() +
+            KComma().Length() + desName.Length() ) ;
+            name->Des().Copy( prefix );
+            name->Des().Append( KComma );
+            name->Des().Append( desName );
+            
+            // Create a new element
+            __ASSERTD( !iNewElement, __FILE__, __LINE__ );
+            iNewElement = CUpnpElement::NewL( *name );
+        
+            CleanupStack::PopAndDestroy( name );
+            }
+        else
+            {
+            // Create a new element
+            __ASSERTD( !iNewElement, __FILE__, __LINE__ );
+            iNewElement = CUpnpElement::NewL( desName );
+            }
+        
+        // Set attributes for element
+        SetAttributesL( aAttributes );
+        }
+    __LOG( "CUPnPXMLParser::OnEndElementL, end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnEndElementL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnEndElementL( const RTagInfo& aElement, 
+                                    TInt aErrorCode )
+    {
+    __LOG( "CUPnPXMLSAXParser::OnEndElementL(), begin" );
+    if ( aErrorCode != KErrNone )
+        {
+        return;
+        }
+        
+    const TDesC8& desName = aElement.LocalName().DesC();    
+    if ( !desName.CompareF( KContainer ) || !desName.CompareF( KItem ) )
+        {
+        iResultRoot->AppendL( iStack->Top() );
+        iStack->Pop(); // Remove object from stack.
+        }
+    else if( KErrNone != desName.CompareF( KDIDL ))
+        {        
+        CUpnpObject* obj = (CUpnpObject*)iStack->Top();
+        __ASSERTD( obj, __FILE__, __LINE__ );
+             
+        if ( iElementValue )
+            {
+            SetValueToElementL( *obj, *iElementValue );
+            }
+        else
+            {
+            SetValueToElementL( *obj, KNullDesC8 );
+            }    
+        
+        delete iElementValue; iElementValue = NULL;    
+        }    
+    __LOG( "CUPnPXMLSAXParser::OnEndElementL(), end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnContentL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnContentL( const TDesC8& aBytes, TInt aErrorCode )
+    {
+    __LOG( "CUPnPXMLSAXParser::OnContentL(), begin" );
+    if ( !iStack->Count() || aErrorCode != KErrNone )
+        {
+        return;
+        }
+    
+    if( !iElementValue ) //if 1st time
+        {
+        iElementValue = HBufC8::NewL(aBytes.Length());
+        iElementValue->Des().Copy(aBytes); 
+        }
+    else
+        {
+        HBufC8* previousValue = iElementValue;
+        iElementValue = HBufC8::NewL( previousValue->Des().Length() +
+                                      aBytes.Length() );
+        iElementValue->Des().Append( *previousValue );
+        iElementValue->Des().Append( aBytes );
+        delete previousValue;
+        } 
+    __LOG( "CUPnPXMLSAXParser::OnContentL(), end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnStartPrefixMappingL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnStartPrefixMappingL( const RString& /*aPrefix*/, 
+                                               const RString& /*aUri*/, 
+                                               TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnEndPrefixMappingL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnEndPrefixMappingL( const RString& /*aPrefix*/, 
+                                             TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnIgnorableWhiteSpaceL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, 
+                                                TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnSkippedEntityL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnSkippedEntityL( const RString& /*aName*/, 
+                                          TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnProcessingInstructionL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnProcessingInstructionL( const TDesC8& /*aTarget*/, 
+                                                  const TDesC8& /*aData*/, 
+                                                  TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::OnError
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::OnError( TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::GetExtendedInterface
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+TAny* CUPnPXMLParser::GetExtendedInterface( const TInt32 /*aUid*/ )
+    {    
+    // No implementation needed
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::SetAttributesL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::SetAttributesL( CUpnpObject& aObject, 
+    const RAttributeArray& aAttributes )
+    {
+    __LOG( "CUPnPXMLParser::SetAttributesL" );
+    
+    if ( iStack->Count() )
+        {
+        // Object has a parent.
+        // Should not really happen, but implemented anyways
+        __LOG( "Object has a parent!" );
+        
+        if ( iStack->Top()->ObjectType() != EUPnPContainer )
+            {
+            User::Leave( KErrArgument );
+            }
+        CUpnpContainer* container = (CUpnpContainer*)iStack->Top();
+        container->AppendObjectL( aObject );
+        }
+        
+    RAttribute attribute;
+    TInt count = aAttributes.Count();
+    for ( TInt i = 0 ; i < count; i++ ) // Read attributes.
+        {
+        attribute = aAttributes[ i ];
+        const TDesC8& name = attribute.Attribute().LocalName().DesC();
+        
+        if( !name.CompareF( KId ) )
+            {
+            aObject.SetIdL( attribute.Value().DesC() );
+            }
+        if( !name.CompareF( KParentId ) )
+            {
+            aObject.SetParentIdL( attribute.Value().DesC() );
+            }            
+        if( !name.CompareF( KRestricted ) ) 
+            {
+            if ( !attribute.Value().DesC().CompareF( KTrue ) ) // restricted
+                {
+                aObject.SetRestricted( ETrue );
+                }
+            else // no restriction
+                {
+                aObject.SetRestricted( EFalse );
+                }
+            }
+        }
+    __LOG( "CUPnPXMLParser::SetAttributesL - End" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::SetValueToElementL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::SetValueToElementL( CUpnpObject& aItem,
+    const TDesC8& aValue )
+    {
+    __LOG( "CUPnPXMLParser::SetValueToElementL()" );
+
+    if( iTitle )
+        {
+        __LOG( "SetValueToElementL() - title element" );
+        aItem.SetTitleL( aValue );
+        iTitle = EFalse;
+        }
+    else if( iObjectClass )
+        {
+        __LOG( "SetValueToElementL() - objectclass element" );
+        aItem.SetObjectClassL( aValue );  
+        iObjectClass = EFalse;
+        }
+    // See if it's the res-element   
+    else if( iNewElement && // NULL Check
+             iNewElement->Name().Compare( KContentURI ) == KErrNone )
+        {
+        __LOG( "SetValueToElementL() - res element" ); 
+                
+        // Check that uri is absolute
+        if( UpnpCdsResElementUtility::IsUriAbsolute( aValue ) )
+            {
+            __LOG( "valid res-element" );
+            iNewElement->SetValueL( aValue );
+            aItem.AddElementL( iNewElement ); // Ownership is transferred
+            iNewElement = NULL;                
+            }
+        else
+            { 
+            // if CreateObjectResponse, there is importuri
+            // no need to check res-element
+            TInt found = EFalse;
+            RUPnPAttributesArray elArray = iNewElement->GetAttributes();
+            TInt count = elArray.Count(); 
+            for( TInt i = 0; i < count; i++ )
+                {
+                if( elArray[ i ]->Name() == KImportUri )
+                    {
+                    i = count;
+                    found = ETrue;
+                    __LOG( "SetValueToElementL() - ImportUri found" );
+                    }
+                }
+                              
+            if( found )     
+                {
+                __LOG( "no res-element but import uri found" );
+                iNewElement->SetValueL( KNullDesC8 );
+                aItem.AddElementL( iNewElement ); // Ownership is transferred
+                iNewElement = NULL;                   
+                }  
+            else
+                {
+                __LOG( "invalid res-element" );
+                delete iNewElement;
+                iNewElement = NULL;                
+                }           
+            }
+  
+        }
+    else 
+        {
+        __LOG( "SetValueToElementL() - unknown element" );
+        if( iNewElement )
+            {
+            // Check for empty values
+            if( aValue == KNullDesC8 || aValue == KSpace )
+                {
+                // Do not add empty values
+                delete iNewElement; iNewElement = NULL;                
+                }
+            else
+                {
+                iNewElement->SetValueL( aValue );
+                aItem.AddElementL( iNewElement ); // Ownership is transferred
+                iNewElement = NULL;                
+                }    
+            }
+        }
+        
+    __LOG( "CUPnPXMLParser::SetValueToElementL() End" ); 
+    }
+
+    
+// --------------------------------------------------------------------------
+// CUPnPXMLParser::SetAttributesL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParser::SetAttributesL( const RAttributeArray& aAttributes )
+    {
+    __LOG( "CUPnPXMLParser::SetAttributesL" );
+    
+    RAttribute attribute;
+    TInt count = aAttributes.Count();
+    for ( TInt i = 0; i < count ; i++ )
+        {
+        attribute = aAttributes[i];
+        const TDesC8& name = attribute.Attribute().LocalName().DesC();
+        CUpnpAttribute* att = CUpnpAttribute::NewLC();
+        att->SetNameL( name );
+        att->SetValueL( attribute.Value().DesC() );
+        __ASSERTD( iNewElement, __FILE__, __LINE__ );
+        iNewElement->AddAttributeL( att );
+        CleanupStack::Pop( att );     
+        }
+    __LOG( "CUPnPXMLParser::SetAttributesL End" );    
+    }
+    
+// end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/src/upnpxmlparserlite.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,507 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      XML SAX Parser for UPnP.
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// xml parser
+#include <xml/parser.h>
+#include <xml/parserfeature.h>
+#include <xml/matchdata.h>
+
+// upnp stack api
+#include <upnpstring.h>
+
+// upnpframework / xmlparser api
+#include "upnpxmlparserlite.h"
+#include "upnpobjectlite.h"
+
+// xmlparser internal
+#include "upnpobjectstacklite.h"
+
+
+_LIT( KComponentLogfile, "upnpxmlparser.txt");
+#include "upnplog.h"
+
+_LIT8( KXmlMimeType,    "text/xml"     );
+_LIT8( KLIB2XML,        "libxml2" );
+
+_LIT8( KContainer,      "container"    );
+_LIT8( KItem,           "item"         );
+_LIT8( KTitle,          "title"        );
+_LIT8( KClass,          "class"        );
+_LIT8( KId,             "id"           );
+//_LIT8( KComma,          ":"            );
+_LIT8( KDIDL,           "DIDL-Lite"    );
+_LIT8( KDesc,           "desc"         );
+_LIT8( KDlnaDoc,        "X_DLNADOC"    );
+
+_LIT( KIndexContainer,  "1" );
+_LIT( KIndexAudio,      "2" );
+_LIT( KIndexVideo,      "3" );
+_LIT( KIndexImage,      "4" );
+_LIT( KIndexOther,      "5" );
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::CUPnPXMLParserLite()
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+CUPnPXMLParserLite::CUPnPXMLParserLite()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::ConstructL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::ConstructL()
+    {
+    __LOG( "CUPnPXMLParserLite::CostructL" );
+    iStack = CUPnPObjectStackLite::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::NewL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C CUPnPXMLParserLite* CUPnPXMLParserLite::NewL()
+    {
+    CUPnPXMLParserLite* self = CUPnPXMLParserLite::NewLC();
+    CleanupStack::Pop( self );    
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::NewLC
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C CUPnPXMLParserLite* CUPnPXMLParserLite::NewLC()
+    {   
+    CUPnPXMLParserLite* self = new( ELeave ) CUPnPXMLParserLite();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::~CUPnPXMLParserLite
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+CUPnPXMLParserLite::~CUPnPXMLParserLite()
+    {
+    __LOG( "CUPnPXMLParserLite::~CUPnPXMLParserLite" );
+    if ( iStack )
+        {
+        iStack->ResetAndDestroy();
+        delete iStack;
+        }
+    
+    delete iElementValue;
+    delete iFormatString;
+    delete iTitleBuf;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::ParseResultDataL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+EXPORT_C void CUPnPXMLParserLite::ParseResultDataL(
+    RPointerArray<CUpnpObjectLite>& aResultArray, const TDesC8& aData,
+    const TDesC& aFormatString )
+    {
+    __LOG( "CUPnPXMLParserLite::ParseResultDataL, begin" );
+    
+    delete iFormatString; iFormatString = NULL;
+    if( aFormatString != KNullDesC )
+        {
+        iFormatString = aFormatString.AllocL();
+        }
+    
+    if ( !aData.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    iResultRoot = &aResultArray;
+
+    // Create parser 
+    CMatchData* matchData = CMatchData::NewLC();
+    matchData->SetMimeTypeL( KXmlMimeType ); 
+    matchData->SetVariantL( KLIB2XML ); 
+    CParser* parser = CParser::NewLC( *matchData, *this ); 
+    parser->EnableFeature( Xml::EReportNamespaceMapping );
+    
+    Xml::ParseL( *parser, aData );    
+    
+    CleanupStack::PopAndDestroy( parser );
+    CleanupStack::PopAndDestroy( matchData );
+    
+    iResultRoot = NULL;           
+    __LOG( "CUPnPXMLParserLite::ParseResultDataL, end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnStartDocumentL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnStartDocumentL( 
+                                const RDocumentParameters& /*aDocParam*/, 
+                                TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnEndDocumentL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnEndDocumentL( TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnStartElementL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnStartElementL( const RTagInfo& aElement, 
+                                      const RAttributeArray& aAttributes,
+                                      TInt aErrorCode )
+    {
+    __LOG1( "CUPnPXMLParserLite::OnStartElementL, error code: %d", aErrorCode );
+    if ( aErrorCode != KErrNone )
+        {
+        return;
+        }
+    const TDesC8& desName = aElement.LocalName().DesC();
+    const TDesC8& prefix = aElement.Prefix().DesC();
+    
+    // Delete content, since there may be some stuff between the elements
+    // (comments, whitespace etc.)
+    delete iElementValue; iElementValue = NULL;    
+      
+    if ( !desName.CompareF( KContainer ) ) // Container element
+        {
+        CUpnpObjectLite* tmpContainer = CUpnpObjectLite::NewL();
+        CleanupStack::PushL( tmpContainer );
+
+        SetAttributesL( *tmpContainer, aAttributes );
+        //push into the stack, ownership is transferred                      
+        iStack->PushL( tmpContainer ); 
+        
+        CleanupStack::Pop( tmpContainer );
+        }
+    else if ( !desName.CompareF( KItem ) ) // Item element
+        {
+        CUpnpObjectLite* tmpItem = CUpnpObjectLite::NewL();
+        CleanupStack::PushL( tmpItem );
+
+        SetAttributesL( *tmpItem, aAttributes );                      
+        //push into the stack, ownership is transferred                      
+        iStack->PushL( tmpItem );
+        
+        CleanupStack::Pop( tmpItem );
+        }
+    else if( !desName.CompareF( KTitle ) ) // Title element
+        {
+        // check that we have item or container. cause leave if not
+        if ( iStack->Count() == 0)
+            {
+            User::Leave( KErrArgument );
+            }
+        // We should have an item or a container already!
+        //__ASSERTD( iStack->Top(), __FILE__, __LINE__ );
+        iTitle = ETrue;
+        }
+    else if( !desName.CompareF( KClass ) ) // Object class element
+        {
+        // check that we have item or container. cause leave if not
+        if ( iStack->Count() == 0)
+            {
+            User::Leave( KErrArgument );
+            }
+        // We should have an item or a container already!
+        //__ASSERTD( iStack->Top(), __FILE__, __LINE__ );
+        iObjectClass = ETrue;
+        }
+    // Ignore DIDL-Lite, desc and X_DLNADOC -elements (DLNA req)
+    else if( desName.Compare( KDIDL ) == KErrNone ||
+             desName.Compare( KDesc ) == KErrNone ||
+             desName.Compare( KDlnaDoc ) == KErrNone    
+           )
+        {
+        // Ignore
+        }
+    else 
+        {
+        // check that we have item or container. cause leave if not
+        if ( iStack->Count() == 0)
+            {
+            User::Leave( KErrArgument );
+            }
+        // Ignore rest of the elements
+                }
+    __LOG( "CUPnPXMLParserLite::OnStartElementL, end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnEndElementL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnEndElementL( const RTagInfo& aElement, 
+                                    TInt aErrorCode )
+    {
+    __LOG( "CUPnPXMLParserLite::OnEndElementL(), begin" );
+    if ( aErrorCode != KErrNone )
+        {
+        return;
+        }
+        
+    const TDesC8& desName = aElement.LocalName().DesC();    
+    if ( !desName.CompareF( KContainer ) || !desName.CompareF( KItem ) )
+        {
+        if( iTitleBuf )
+            {
+            CUpnpObjectLite* obj = iStack->Top();
+            __ASSERTD( obj, __FILE__, __LINE__ );
+
+            if( iFormatString )
+                {
+                HBufC* tempBuf = UpnpString::ToUnicodeL( *iTitleBuf );
+                CleanupStack::PushL( tempBuf );
+                HBufC* buf = HBufC::NewL( iFormatString->Length() +
+                    tempBuf->Length() );
+                buf->Des().Format( *iFormatString, tempBuf );
+                CleanupStack::PopAndDestroy( tempBuf );
+                obj->SetTitleL( buf );
+                }
+            else
+                {
+                HBufC* buf = HBufC::NewL( iTitleBuf->Length() );
+                buf->Des().Copy( *iTitleBuf );
+                obj->SetTitleL( buf );
+                }
+            delete iTitleBuf; iTitleBuf = NULL;
+            }
+               
+        iResultRoot->AppendL( iStack->Top() );
+        iStack->Pop(); // Remove object from stack.
+        }
+    else if( KErrNone != desName.CompareF( KDIDL ))
+        {        
+        CUpnpObjectLite* obj = iStack->Top();
+        __ASSERTD( obj, __FILE__, __LINE__ );
+             
+        if ( iElementValue )
+            {
+            if( !desName.CompareF( KTitle ) )
+                {
+                delete iTitleBuf; iTitleBuf = NULL;
+                iTitleBuf = iElementValue;
+                iElementValue = NULL;
+                }
+            else if( !desName.CompareF( KClass ) )
+                {
+                obj->SetObjectClass( *iElementValue );                
+                iObjectClass = EFalse;
+                if( iFormatString )
+                    {
+                    SetIconIndex( *obj );
+                    }                
+                }
+            else
+                {               
+                }          
+            }
+        else
+            {
+            }    
+        
+        delete iElementValue; iElementValue = NULL;    
+        }    
+    __LOG( "CUPnPXMLParserLite::OnEndElementL(), end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnContentL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnContentL( const TDesC8& aBytes, TInt aErrorCode )
+    {
+    __LOG( "CUPnPXMLParserLite::OnContentL(), begin" );
+    if ( !iStack->Count() || aErrorCode != KErrNone )
+        {
+        return;
+        }
+    
+    if( iTitle || iObjectClass ) // We are only interested in title or
+                                 // object class!
+        {
+        if( !iElementValue ) //if 1st time
+            {
+            iElementValue = HBufC8::NewL(aBytes.Length());
+            iElementValue->Des().Copy(aBytes); 
+            }
+        else
+            {
+            HBufC8* previousValue = iElementValue;
+            iElementValue = HBufC8::NewL( previousValue->Des().Length() +
+                                          aBytes.Length() );
+            iElementValue->Des().Append( *previousValue );
+            iElementValue->Des().Append( aBytes );
+            delete previousValue;
+            }         
+        }
+    
+    __LOG( "CUPnPXMLParserLite::OnContentL(), end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnStartPrefixMappingL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnStartPrefixMappingL( const RString& /*aPrefix*/, 
+                                               const RString& /*aUri*/, 
+                                               TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnEndPrefixMappingL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnEndPrefixMappingL( const RString& /*aPrefix*/, 
+                                             TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnIgnorableWhiteSpaceL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, 
+                                                TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnSkippedEntityL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnSkippedEntityL( const RString& /*aName*/, 
+                                          TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnProcessingInstructionL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnProcessingInstructionL( const TDesC8& /*aTarget*/, 
+                                                  const TDesC8& /*aData*/, 
+                                                  TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::OnError
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::OnError( TInt /*aErrorCode*/ )
+    {
+    // No implementation needed
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::GetExtendedInterface
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+TAny* CUPnPXMLParserLite::GetExtendedInterface( const TInt32 /*aUid*/ )
+    {    
+    // No implementation needed
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPXMLParserLite::SetAttributesL
+// See upnpxmlparser.h
+// --------------------------------------------------------------------------
+void CUPnPXMLParserLite::SetAttributesL( CUpnpObjectLite& aObject, 
+    const RAttributeArray& aAttributes )
+    {
+    __LOG( "CUPnPXMLParserLite::SetAttributesL" );
+    
+    if ( iStack->Count() )
+        {
+        // Object has a parent.
+        // Should not really happen
+        __LOG( "Object has a parent!" );
+        __PANICD(__FILE__, __LINE__);      
+        }
+        
+    RAttribute attribute;
+    TInt count = aAttributes.Count();
+    for ( TInt i = 0 ; i < count; i++ ) // Read attributes.
+        {
+        attribute = aAttributes[ i ];
+        const TDesC8& name = attribute.Attribute().LocalName().DesC();
+        
+        if( !name.CompareF( KId ) )
+            {
+            aObject.SetObjectIdL( attribute.Value().DesC() );
+            }
+        }
+    __LOG( "CUPnPXMLParserLite::SetAttributesL - End" );
+    }
+
+void CUPnPXMLParserLite::SetIconIndex( const CUpnpObjectLite& aObject )
+    {
+    if( aObject.IsTypeOf( CUpnpObjectLite::EContainer ) )
+        {
+        iFormatString->Des().Replace( 0, 1, KIndexContainer );
+        }
+    else if( aObject.IsTypeOf( CUpnpObjectLite::EMusicItem ) )
+        {
+        iFormatString->Des().Replace( 0, 1, KIndexAudio );
+        }
+    else if( aObject.IsTypeOf( CUpnpObjectLite::EImageItem ) )
+        {
+        iFormatString->Des().Replace( 0, 1, KIndexImage );
+        }
+    else if( aObject.IsTypeOf( CUpnpObjectLite::EVideoItem ) )
+        {
+        iFormatString->Des().Replace( 0, 1, KIndexVideo );
+        }
+    else
+        {
+        // Other
+        iFormatString->Des().Replace( 0, 1, KIndexOther );
+        }    
+    }
+        
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontroller/upnpxmlparser/src/upnpxmlstringutility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utility for string operations in UpnpXmlParser component
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "upnpxmlstringutility.h"
+
+_LIT( KComponentLogfile, "upnpxmlstringutility.txt" );
+#include "upnplog.h"
+
+
+// CONSTANTS
+/**
+ * Range of control characters taken from http:
+ * //www.w3.org/International/questions/qa-controls. 
+ * Remove characters that belong to "C0" range U+0000-U+001F 
+ * (0-31) and also DEL (Delete) U+007F (127). C1 range U+0080-U+009F 
+ * (128-159) is ignored for now because it seems to contain ok 
+ * characters like € (euro sign).
+ * */
+
+const TInt KC0RangeStart = 0;
+const TInt KC0RangeEnd = 31;
+const TInt KDeleteChar = 127;
+
+// All control characters start with &#
+_LIT8( KXmlControlCharStart, "&#" );
+// All xml entities end with ; because they are of for &entityname;
+_LIT8( KXmlEntityEnd, ";" );
+
+// ============================ LOCAL FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// UpnpXmlStringUtility::RemoveXmlControlCharactersL
+//---------------------------------------------------------------------------
+EXPORT_C HBufC8* UpnpXmlStringUtility::RemoveXmlControlCharactersL(
+    const TDesC8& aXmlData )
+    {
+    __LOG( "UpnpXmlStringUtility::RemoveXmlControlCharactersL Begin" );
+    HBufC8* filtrateBuf = NULL;
+    //if no data
+    if ( aXmlData.Length() != 0 )
+        {
+        //The offset of the KXmlControlCharStart from the beginning of \
+          this descriptor's data
+        
+        TInt controlCharStartOffset = aXmlData.Find( KXmlControlCharStart );
+        // to make sure the data contain control character.
+        if ( controlCharStartOffset != KErrNotFound )
+            {
+            filtrateBuf = aXmlData.AllocL();
+            CleanupStack::PushL( filtrateBuf );    
+            //The offset of the KXmlEntityEnd from the beginning of this \
+              descriptor's data
+            TInt controlCharEndOffset = 0;
+            //The offset of the buffer who not be checked
+            TInt partofBufferOffset = 0;
+   
+            //circle find control character.
+            while( controlCharStartOffset != KErrNotFound )
+                {
+                controlCharStartOffset += partofBufferOffset;
+                partofBufferOffset = controlCharStartOffset;
+                controlCharEndOffset = ( filtrateBuf->Des().
+                    Mid( controlCharStartOffset ).Find( KXmlEntityEnd ) );
+                if ( controlCharEndOffset != KErrNotFound )
+                    {
+                    TLex8 tempLex( filtrateBuf->Des().Mid( partofBufferOffset
+                      + KXmlControlCharStart().Length() ,controlCharEndOffset
+                      - KXmlControlCharStart().Length() ) );
+                    //Parses the string to extract a signed 8-bit integer.
+                    TInt tempNum;
+                    User::LeaveIfError( tempLex.Val( tempNum ) );
+                    if( ( tempNum >= KC0RangeStart && tempNum <= KC0RangeEnd )
+                         || ( tempNum == KDeleteChar ) )
+                        {
+                        __LOG( "UpnpXmlStringUtility::\
+RemoveXmlControlCharactersL delete control character" );
+                        TPtrC8 tmpBuf = filtrateBuf->Des().Mid( 
+                            partofBufferOffset, controlCharEndOffset + 
+                            KXmlEntityEnd().Length() );
+                        __LOG8( tmpBuf);
+                        
+                        filtrateBuf->Des().Delete( partofBufferOffset, 
+                        controlCharEndOffset + KXmlEntityEnd().Length() );
+                        }
+                    else 
+                        {
+                        __LOG1( "UpnpXmlStringUtility::\
+RemoveXmlControlCharactersL between &# and; the Number is %d",tempNum );
+                        }
+                    controlCharStartOffset = partofBufferOffset;
+                    controlCharStartOffset = ( filtrateBuf->Des().
+                                        Mid( controlCharStartOffset ).
+                                        Find( KXmlControlCharStart ) );
+                    }
+                else 
+                    {
+                    __LOG( "UpnpXmlStringUtility::RemoveXmlControlCharactersL\
+ Can not find EntityEnd" );
+                    User::Leave( KErrArgument );
+                    }
+                }
+            CleanupStack::Pop( filtrateBuf );
+            }
+        else
+            {
+            // not contains control character.
+            __LOG( "UpnpXmlStringUtility::RemoveXmlControlCharactersL Can \
+                   not find control character!" );
+            }
+        }
+    else
+        {
+        //xml data is NULL
+        __LOG( "UpnpXmlStringUtility::RemoveXmlControlCharactersL the \
+                            xml data is NULL" );
+        }
+    __LOG( "UpnpXmlStringUtility::RemoveXmlControlCharactersL End" );
+    return filtrateBuf;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/BWINS/AVControlFrameworkU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,55 @@
+EXPORTS
+	??0CUpnpAVControlPoint@@IAE@AAVMUpnpAVControlPointObserver@@@Z @ 1 NONAME ; CUpnpAVControlPoint::CUpnpAVControlPoint(class MUpnpAVControlPointObserver &)
+	??1CUpnpAVControlPoint@@UAE@XZ @ 2 NONAME ; CUpnpAVControlPoint::~CUpnpAVControlPoint(void)
+	?ActionResponseReceivedL@CUpnpAVControlPoint@@MAEXPAVCUpnpAction@@@Z @ 3 NONAME ; void CUpnpAVControlPoint::ActionResponseReceivedL(class CUpnpAction *)
+	?AddressChangedL@CUpnpAVControlPoint@@UAEXXZ @ 4 NONAME ABSENT ; void CUpnpAVControlPoint::AddressChangedL(void)
+	?AvtDeviceCapabilitiesActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 5 NONAME ; int CUpnpAVControlPoint::AvtDeviceCapabilitiesActionL(class TDesC8 const &, int)
+	?AvtMediaInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 6 NONAME ; int CUpnpAVControlPoint::AvtMediaInfoActionL(class TDesC8 const &, int)
+	?AvtNextActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 7 NONAME ; int CUpnpAVControlPoint::AvtNextActionL(class TDesC8 const &, int)
+	?AvtPauseActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 8 NONAME ; int CUpnpAVControlPoint::AvtPauseActionL(class TDesC8 const &, int)
+	?AvtPlayActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 9 NONAME ; int CUpnpAVControlPoint::AvtPlayActionL(class TDesC8 const &, int, class TDesC8 const &)
+	?AvtPositionInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 10 NONAME ; int CUpnpAVControlPoint::AvtPositionInfoActionL(class TDesC8 const &, int)
+	?AvtPreviousActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 11 NONAME ; int CUpnpAVControlPoint::AvtPreviousActionL(class TDesC8 const &, int)
+	?AvtRecordActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 12 NONAME ; int CUpnpAVControlPoint::AvtRecordActionL(class TDesC8 const &, int)
+	?AvtSeekActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H00@Z @ 13 NONAME ; int CUpnpAVControlPoint::AvtSeekActionL(class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &)
+	?AvtSetNextTransportUriActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H00@Z @ 14 NONAME ; int CUpnpAVControlPoint::AvtSetNextTransportUriActionL(class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &)
+	?AvtSetPlayModeActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 15 NONAME ; int CUpnpAVControlPoint::AvtSetPlayModeActionL(class TDesC8 const &, int, class TDesC8 const &)
+	?AvtSetRecordModeActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 16 NONAME ; int CUpnpAVControlPoint::AvtSetRecordModeActionL(class TDesC8 const &, int, class TDesC8 const &)
+	?AvtSetTransportUriActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H00@Z @ 17 NONAME ; int CUpnpAVControlPoint::AvtSetTransportUriActionL(class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &)
+	?AvtStopActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 18 NONAME ; int CUpnpAVControlPoint::AvtStopActionL(class TDesC8 const &, int)
+	?AvtTransportInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 19 NONAME ; int CUpnpAVControlPoint::AvtTransportInfoActionL(class TDesC8 const &, int)
+	?AvtTransportSettingsActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 20 NONAME ; int CUpnpAVControlPoint::AvtTransportSettingsActionL(class TDesC8 const &, int)
+	?AvtTransportsActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 21 NONAME ; int CUpnpAVControlPoint::AvtTransportsActionL(class TDesC8 const &, int)
+	?CdsBrowseActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@000HH0@Z @ 22 NONAME ; int CUpnpAVControlPoint::CdsBrowseActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, int, int, class TDesC8 const &)
+	?CdsCreateObjectActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00@Z @ 23 NONAME ; int CUpnpAVControlPoint::CdsCreateObjectActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &)
+	?CdsCreateReferenceActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00@Z @ 24 NONAME ; int CUpnpAVControlPoint::CdsCreateReferenceActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &)
+	?CdsDeleteResourceActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@0@Z @ 25 NONAME ; int CUpnpAVControlPoint::CdsDeleteResourceActionL(class TDesC8 const &, class TDesC8 const &)
+	?CdsDestroyObjectActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@0@Z @ 26 NONAME ; int CUpnpAVControlPoint::CdsDestroyObjectActionL(class TDesC8 const &, class TDesC8 const &)
+	?CdsExportResourceActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00@Z @ 27 NONAME ; int CUpnpAVControlPoint::CdsExportResourceActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &)
+	?CdsImportResourceActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00@Z @ 28 NONAME ; int CUpnpAVControlPoint::CdsImportResourceActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &)
+	?CdsSearchActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@000HH0@Z @ 29 NONAME ; int CUpnpAVControlPoint::CdsSearchActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, int, int, class TDesC8 const &)
+	?CdsSearchCapabilitiesActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 30 NONAME ; int CUpnpAVControlPoint::CdsSearchCapabilitiesActionL(class TDesC8 const &)
+	?CdsSortCapabilitiesActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 31 NONAME ; int CUpnpAVControlPoint::CdsSortCapabilitiesActionL(class TDesC8 const &)
+	?CdsStopTransferActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 32 NONAME ; int CUpnpAVControlPoint::CdsStopTransferActionL(class TDesC8 const &, int)
+	?CdsSystemUpdateIdActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 33 NONAME ; int CUpnpAVControlPoint::CdsSystemUpdateIdActionL(class TDesC8 const &)
+	?CdsTransferProgressActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 34 NONAME ; int CUpnpAVControlPoint::CdsTransferProgressActionL(class TDesC8 const &, int)
+	?CdsUpdateObjectActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@000@Z @ 35 NONAME ; int CUpnpAVControlPoint::CdsUpdateObjectActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &)
+	?CmConnectionCompleteActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 36 NONAME ; int CUpnpAVControlPoint::CmConnectionCompleteActionL(class TDesC8 const &, int)
+	?CmCurrentConnectionInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 37 NONAME ; int CUpnpAVControlPoint::CmCurrentConnectionInfoActionL(class TDesC8 const &, int)
+	?CmCurrentConnectionsActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 38 NONAME ; int CUpnpAVControlPoint::CmCurrentConnectionsActionL(class TDesC8 const &)
+	?CmPrepareConnectionActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00H0@Z @ 39 NONAME ; int CUpnpAVControlPoint::CmPrepareConnectionActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, int, class TDesC8 const &)
+	?CmProtocolInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 40 NONAME ; int CUpnpAVControlPoint::CmProtocolInfoActionL(class TDesC8 const &)
+	?ConstructL@CUpnpAVControlPoint@@IAEXXZ @ 41 NONAME ; void CUpnpAVControlPoint::ConstructL(void)
+	?DeviceDisappearedL@CUpnpAVControlPoint@@MAEXPAVCUpnpDevice@@@Z @ 42 NONAME ; void CUpnpAVControlPoint::DeviceDisappearedL(class CUpnpDevice *)
+	?DeviceDiscoveredL@CUpnpAVControlPoint@@MAEXPAVCUpnpDevice@@@Z @ 43 NONAME ; void CUpnpAVControlPoint::DeviceDiscoveredL(class CUpnpDevice *)
+	?HttpResponseReceivedL@CUpnpAVControlPoint@@MAEXPAVCUpnpHttpMessage@@@Z @ 44 NONAME ; void CUpnpAVControlPoint::HttpResponseReceivedL(class CUpnpHttpMessage *)
+	?InitializeCdsActionFactoryL@CUpnpAVControlPoint@@IAEXXZ @ 45 NONAME ; void CUpnpAVControlPoint::InitializeCdsActionFactoryL(void)
+	?NewL@CUpnpAVControlPoint@@SAPAV1@AAVMUpnpAVControlPointObserver@@@Z @ 46 NONAME ; class CUpnpAVControlPoint * CUpnpAVControlPoint::NewL(class MUpnpAVControlPointObserver &)
+	?RcGetMuteActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 47 NONAME ; int CUpnpAVControlPoint::RcGetMuteActionL(class TDesC8 const &, int, class TDesC8 const &)
+	?RcGetVolumetActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 48 NONAME ; int CUpnpAVControlPoint::RcGetVolumetActionL(class TDesC8 const &, int, class TDesC8 const &)
+	?RcSetMuteActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H00@Z @ 49 NONAME ; int CUpnpAVControlPoint::RcSetMuteActionL(class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &)
+	?RcSetVolumetActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0H@Z @ 50 NONAME ; int CUpnpAVControlPoint::RcSetVolumetActionL(class TDesC8 const &, int, class TDesC8 const &, int)
+	?Service@CUpnpAVControlPoint@@QAEPAVCUpnpService@@PAVCUpnpDevice@@ABVTDesC8@@@Z @ 51 NONAME ; class CUpnpService * CUpnpAVControlPoint::Service(class CUpnpDevice *, class TDesC8 const &)
+	?StateUpdatedL@CUpnpAVControlPoint@@MAEXPAVCUpnpService@@@Z @ 52 NONAME ; void CUpnpAVControlPoint::StateUpdatedL(class CUpnpService *)
+	?NetworkEvent@CUpnpAVControlPoint@@UAEXPAVCUpnpNetworkEventBase@@@Z @ 53 NONAME ; void CUpnpAVControlPoint::NetworkEvent(class CUpnpNetworkEventBase *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/EABI/AVControlFrameworkU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,74 @@
+EXPORTS
+	_ZN19CUpnpAVControlPoint10ConstructLEv @ 1 NONAME
+	_ZN19CUpnpAVControlPoint13StateUpdatedLEP12CUpnpService @ 2 NONAME
+	_ZN19CUpnpAVControlPoint14AvtNextActionLERK6TDesC8i @ 3 NONAME
+	_ZN19CUpnpAVControlPoint14AvtPlayActionLERK6TDesC8iS2_ @ 4 NONAME
+	_ZN19CUpnpAVControlPoint14AvtSeekActionLERK6TDesC8iS2_S2_ @ 5 NONAME
+	_ZN19CUpnpAVControlPoint14AvtStopActionLERK6TDesC8i @ 6 NONAME
+	_ZN19CUpnpAVControlPoint15AddressChangedLEv @ 7 NONAME ABSENT
+	_ZN19CUpnpAVControlPoint15AvtPauseActionLERK6TDesC8i @ 8 NONAME
+	_ZN19CUpnpAVControlPoint16AvtRecordActionLERK6TDesC8i @ 9 NONAME
+	_ZN19CUpnpAVControlPoint16CdsBrowseActionLERK6TDesC8S2_S2_S2_iiS2_ @ 10 NONAME
+	_ZN19CUpnpAVControlPoint16CdsSearchActionLERK6TDesC8S2_S2_S2_iiS2_ @ 11 NONAME
+	_ZN19CUpnpAVControlPoint16RcGetMuteActionLERK6TDesC8iS2_ @ 12 NONAME
+	_ZN19CUpnpAVControlPoint16RcSetMuteActionLERK6TDesC8iS2_S2_ @ 13 NONAME
+	_ZN19CUpnpAVControlPoint17DeviceDiscoveredLEP11CUpnpDevice @ 14 NONAME
+	_ZN19CUpnpAVControlPoint18AvtPreviousActionLERK6TDesC8i @ 15 NONAME
+	_ZN19CUpnpAVControlPoint18DeviceDisappearedLEP11CUpnpDevice @ 16 NONAME
+	_ZN19CUpnpAVControlPoint19AvtMediaInfoActionLERK6TDesC8i @ 17 NONAME
+	_ZN19CUpnpAVControlPoint19RcGetVolumetActionLERK6TDesC8iS2_ @ 18 NONAME
+	_ZN19CUpnpAVControlPoint19RcSetVolumetActionLERK6TDesC8iS2_i @ 19 NONAME
+	_ZN19CUpnpAVControlPoint20AvtTransportsActionLERK6TDesC8i @ 20 NONAME
+	_ZN19CUpnpAVControlPoint21AvtSetPlayModeActionLERK6TDesC8iS2_ @ 21 NONAME
+	_ZN19CUpnpAVControlPoint21CmProtocolInfoActionLERK6TDesC8 @ 22 NONAME
+	_ZN19CUpnpAVControlPoint21HttpResponseReceivedLEP16CUpnpHttpMessage @ 23 NONAME
+	_ZN19CUpnpAVControlPoint22AvtPositionInfoActionLERK6TDesC8i @ 24 NONAME
+	_ZN19CUpnpAVControlPoint22CdsCreateObjectActionLERK6TDesC8S2_S2_ @ 25 NONAME
+	_ZN19CUpnpAVControlPoint22CdsStopTransferActionLERK6TDesC8i @ 26 NONAME
+	_ZN19CUpnpAVControlPoint22CdsUpdateObjectActionLERK6TDesC8S2_S2_S2_ @ 27 NONAME
+	_ZN19CUpnpAVControlPoint23ActionResponseReceivedLEP11CUpnpAction @ 28 NONAME
+	_ZN19CUpnpAVControlPoint23AvtSetRecordModeActionLERK6TDesC8iS2_ @ 29 NONAME
+	_ZN19CUpnpAVControlPoint23AvtTransportInfoActionLERK6TDesC8i @ 30 NONAME
+	_ZN19CUpnpAVControlPoint23CdsDestroyObjectActionLERK6TDesC8S2_ @ 31 NONAME
+	_ZN19CUpnpAVControlPoint24CdsDeleteResourceActionLERK6TDesC8S2_ @ 32 NONAME
+	_ZN19CUpnpAVControlPoint24CdsExportResourceActionLERK6TDesC8S2_S2_ @ 33 NONAME
+	_ZN19CUpnpAVControlPoint24CdsImportResourceActionLERK6TDesC8S2_S2_ @ 34 NONAME
+	_ZN19CUpnpAVControlPoint24CdsSystemUpdateIdActionLERK6TDesC8 @ 35 NONAME
+	_ZN19CUpnpAVControlPoint25AvtSetTransportUriActionLERK6TDesC8iS2_S2_ @ 36 NONAME
+	_ZN19CUpnpAVControlPoint25CdsCreateReferenceActionLERK6TDesC8S2_S2_ @ 37 NONAME
+	_ZN19CUpnpAVControlPoint26CdsSortCapabilitiesActionLERK6TDesC8 @ 38 NONAME
+	_ZN19CUpnpAVControlPoint26CdsTransferProgressActionLERK6TDesC8i @ 39 NONAME
+	_ZN19CUpnpAVControlPoint26CmPrepareConnectionActionLERK6TDesC8S2_S2_iS2_ @ 40 NONAME
+	_ZN19CUpnpAVControlPoint27AvtTransportSettingsActionLERK6TDesC8i @ 41 NONAME
+	_ZN19CUpnpAVControlPoint27CmConnectionCompleteActionLERK6TDesC8i @ 42 NONAME
+	_ZN19CUpnpAVControlPoint27CmCurrentConnectionsActionLERK6TDesC8 @ 43 NONAME
+	_ZN19CUpnpAVControlPoint27InitializeCdsActionFactoryLEv @ 44 NONAME
+	_ZN19CUpnpAVControlPoint28AvtDeviceCapabilitiesActionLERK6TDesC8i @ 45 NONAME
+	_ZN19CUpnpAVControlPoint28CdsSearchCapabilitiesActionLERK6TDesC8 @ 46 NONAME
+	_ZN19CUpnpAVControlPoint29AvtSetNextTransportUriActionLERK6TDesC8iS2_S2_ @ 47 NONAME
+	_ZN19CUpnpAVControlPoint30CmCurrentConnectionInfoActionLERK6TDesC8i @ 48 NONAME
+	_ZN19CUpnpAVControlPoint4NewLER27MUpnpAVControlPointObserver @ 49 NONAME
+	_ZN19CUpnpAVControlPoint7ServiceEP11CUpnpDeviceRK6TDesC8 @ 50 NONAME
+	_ZN19CUpnpAVControlPointC1ER27MUpnpAVControlPointObserver @ 51 NONAME
+	_ZN19CUpnpAVControlPointC2ER27MUpnpAVControlPointObserver @ 52 NONAME
+	_ZN19CUpnpAVControlPointD0Ev @ 53 NONAME
+	_ZN19CUpnpAVControlPointD1Ev @ 54 NONAME
+	_ZN19CUpnpAVControlPointD2Ev @ 55 NONAME
+	_ZTI19CUpnpAVControlPoint @ 56 NONAME ; #<TI>#
+	_ZTI20CUpnpCmActionFactory @ 57 NONAME ; #<TI>#
+	_ZTI20CUpnpRcActionFactory @ 58 NONAME ; #<TI>#
+	_ZTI21CUpnpAvtActionFactory @ 59 NONAME ; #<TI>#
+	_ZTI21CUpnpCdsActionFactory @ 60 NONAME ; #<TI>#
+	_ZTI23CUpnpStateUpdateHandler @ 61 NONAME ; #<TI>#
+	_ZTI26CUpnpActionResponseHandler @ 62 NONAME ; #<TI>#
+	_ZTV19CUpnpAVControlPoint @ 63 NONAME ; #<VT>#
+	_ZTV20CUpnpCmActionFactory @ 64 NONAME ; #<VT>#
+	_ZTV20CUpnpRcActionFactory @ 65 NONAME ; #<VT>#
+	_ZTV21CUpnpAvtActionFactory @ 66 NONAME ; #<VT>#
+	_ZTV21CUpnpCdsActionFactory @ 67 NONAME ; #<VT>#
+	_ZTV23CUpnpStateUpdateHandler @ 68 NONAME ; #<VT>#
+	_ZTV26CUpnpActionResponseHandler @ 69 NONAME ; #<VT>#
+	_ZThn4_N19CUpnpAVControlPoint15AddressChangedLEv @ 70 NONAME ABSENT ; #<thunk>#
+	_ZN19CUpnpAVControlPoint12NetworkEventEP21CUpnpNetworkEventBase @ 71 NONAME
+	_ZThn8_N19CUpnpAVControlPoint12NetworkEventEP21CUpnpNetworkEventBase @ 72 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/group/avcontrolframework.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,67 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGETTYPE      dll
+
+#if defined(__HN_31__) || defined(__HN_32__)
+TARGET          hnavcontrolframework.dll
+UID             0x1000008d 0x2000F888
+#else
+TARGET          avcontrolframework.dll
+UID             0x1000008d 0x10204164
+#endif
+
+LANG            SC
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION         10.1
+paged
+
+SOURCEPATH      ../src/ 
+SOURCE          upnpavcontrolpoint.cpp
+SOURCE          upnpstateupdatehandler.cpp
+SOURCE          upnpactionresponsehandler.cpp
+SOURCE          upnpcdsactionfactory.cpp
+SOURCE          upnpavtactionfactory.cpp
+SOURCE          upnpcmactionfactory.cpp
+SOURCE          upnprcactionfactory.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../inc
+USERINCLUDE   ../../inc
+USERINCLUDE     ../inc
+
+LIBRARY         euser.lib 
+LIBRARY         bafl.lib
+
+#if defined(__HN_31__) || defined(__HN_32__)
+LIBRARY         hncontrolpointbase.lib
+LIBRARY         hnserviceframework.lib
+LIBRARY         hnipserversutils.lib 
+#else
+LIBRARY         upnpcontrolpointbase.lib
+LIBRARY         upnpserviceframework.lib
+LIBRARY         upnpipserversutils.lib 
+#endif
+
+LIBRARY         flogger.lib 
+DEFFILE         AVControlFramework
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,28 @@
+/** @file
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for the AVControlFramework component
+*
+*/
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+avcontrolframework.mmp
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/inc/upnpactionresponsehandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,113 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpActionResponseHandler handles service specific responses
+*
+*/
+
+
+
+#ifndef C_CUPNPACTIONRESPONSEHANDLER_H
+#define C_CUPNPACTIONRESPONSEHANDLER_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavcontrolpointobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpService;
+class CUpnpAVControlPoint;
+// CLASS DECLARATION
+
+/**
+*  Action response handler class.
+*  This class contains functionality to handle UPnP action responses.
+*
+*  @since Series 60 2.6
+*/
+class CUpnpActionResponseHandler : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+	    static CUpnpActionResponseHandler* NewL(
+            MUpnpAVControlPointObserver& aAVCPObserver,
+            CUpnpAVControlPoint& aAVCP );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpActionResponseHandler();
+
+    public: // New functions
+        /**
+        * The entry point for action response handling.
+        * @since Series 60 2.6
+        * @param aAction response UPnP action.
+        * @return errorcode. KErrNone if no errors. 
+        */
+        TInt ActionResponseReceived(CUpnpAction* aAction);
+        /**
+        * Rendering Control response handler.
+        * @since Series 60 2.6
+        * @param aAction response UPnP action.
+        * @return errorcode. KErrNone if no errors. 
+        */
+        TInt RenderingControlResponse(CUpnpAction* aAction);
+        /**
+        * AV Transport response handler.
+        * @since Series 60 2.6
+        * @param aAction response UPnP action.
+        * @return errorcode. KErrNone if no errors. 
+        */
+        TInt AVTransportResponse(CUpnpAction* aAction);
+        /**
+        * Connection Manager response handler.
+        * @since Series 60 2.6
+        * @param aAction response UPnP action.
+        * @return errorcode. KErrNone if no errors. 
+        */
+        TInt ConnectionManagerResponse(CUpnpAction* aAction);
+        /**
+        * Content Directory response handler.
+        * @since Series 60 2.6
+        * @param aAction response UPnP action.
+        * @return errorcode. KErrNone if no errors. 
+        */
+        TInt ContentDirectoryResponse(CUpnpAction* aAction);
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+	    CUpnpActionResponseHandler( MUpnpAVControlPointObserver& aAVCPObserver,
+	    							CUpnpAVControlPoint& aAVCP );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+	    void ConstructL();
+        
+        //observer that is intrested about AVCP actions.
+        MUpnpAVControlPointObserver& iAVControlPointObserver;
+        // AVCP main class.
+        CUpnpAVControlPoint& iAVCP;
+    };
+
+#endif      // C_CUPNPACTIONRESPONSEHANDLER_H 
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/inc/upnpavcpstring.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,154 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File contains all global literals used in this module 
+*
+*/
+
+
+
+#ifndef UPNPAVCPSTRING_H_
+#define UPNPAVCPSTRING_H_
+
+namespace UpnpAVCPStrings
+    {
+    _LIT8( KContentDirectory, "ContentDirectory:*");
+    _LIT8( KConnectionManager, "ConnectionManager:*");
+    _LIT8( KAVTransport, "AVTransport:*");
+    _LIT8( KRenderingControl, "RenderingControl:*");
+    _LIT8( KSetVolume, "SetVolume");
+    _LIT8( KInstanceID, "InstanceID");
+    _LIT8( KChannel, "Channel");
+    _LIT8( KDesiredVolume, "DesiredVolume");
+    _LIT8( KCurrentVolume, "CurrentVolume");
+    _LIT8( KDesiredMute, "DesiredMute");
+    _LIT8( KCurrentMute, "CurrentMute");
+    _LIT8( KGetVolume, "GetVolume");
+    _LIT8( KGetMute, "GetMute");
+    _LIT8( KSetMute, "SetMute");
+    _LIT8( KSetAVTransportURI, "SetAVTransportURI");
+    _LIT8( KSetNextAVTransportURI, "SetNextAVTransportURI");
+    _LIT8( KGetMediaInfo, "GetMediaInfo");
+    _LIT8( KGetTransportInfo, "GetTransportInfo");
+    _LIT8( KGetPositionInfo, "GetPositionInfo");
+    _LIT8( KGetDeviceCapabilities, "GetDeviceCapabilities");
+    _LIT8( KGetTransportSettings, "GetTransportSettings");
+    _LIT8( KStop, "Stop");
+    _LIT8( KPlay, "Play");
+    _LIT8( KPause, "Pause");
+    _LIT8( KRecord, "Record");
+    _LIT8( KSeek, "Seek");
+    _LIT8( KNext, "Next");
+    _LIT8( KPrevious, "Previous");
+    _LIT8( KSetPlayMode, "SetPlayMode");
+    _LIT8( KSetRecordQualityMode, "SetRecordQualityMode");
+    _LIT8( KGetCurrentTransportActions, "GetCurrentTransportActions");
+    _LIT8( KCurrentURI, "CurrentURI");
+    _LIT8( KCurrentURIMetaData, "CurrentURIMetaData");
+    _LIT8( KNextURI, "NextURI");
+    _LIT8( KNextURIMetaData, "NextURIMetaData");
+    _LIT8( KSpeed, "Speed");
+    _LIT8( KUnit, "Unit");
+    _LIT8( KTarget, "Target");
+    _LIT8( KNewPlayMode, "NewPlayMode");
+    _LIT8( KNewRecordQualityMode, "NewRecordQualityMode");
+    _LIT8( KMediaDuration, "MediaDuration");
+    _LIT8( KNrTracks, "NrTracks");
+    _LIT8( KPlayMedium, "PlayMedium");
+    _LIT8( KPlayMedia, "PlayMedia");
+    _LIT8( KRecordMedium, "RecordMedium");
+    _LIT8( KWriteStatus, "WriteStatus");
+    _LIT8( KCurrentTransportStatus, "CurrentTransportStatus");
+    _LIT8( KCurrentTransportState, "CurrentTransportState");
+    _LIT8( KCurrentSpeed, "CurrentSpeed");
+    _LIT8( KTrack, "Track");
+    _LIT8( KTrackDuration, "TrackDuration");
+    _LIT8( KTrackMetaData, "TrackMetaData");
+    _LIT8( KTrackURI, "TrackURI");
+    _LIT8( KRelTime, "RelTime");
+    _LIT8( KAbsTime, "AbsTime");
+    _LIT8( KAbsCount, "AbsCount");
+    _LIT8( KRecMedia, "RecMedia");
+    _LIT8( KRelCount, "RelCount");
+    _LIT8( KPlayMode, "PlayMode");
+    _LIT8( KActions, "Actions");
+    _LIT8( KRecQualityMode, "RecQualityMode");
+    _LIT8( KSearchCaps, "SearchCaps");
+    _LIT8( KSortCaps, "SortCaps");
+    _LIT8( KId, "Id");
+    _LIT8( KGetSearchCapabilities, "GetSearchCapabilities");
+    _LIT8( KGetSortCapabilities, "GetSortCapabilities");
+    _LIT8( KGetSystemUpdateID, "GetSystemUpdateID");
+    _LIT8( KCreateObject, "CreateObject");
+    _LIT8( KImportResource, "ImportResource");
+    _LIT8( KExportResource, "ExportResource");
+    _LIT8( KCreateReference, "CreateReference");
+    _LIT8( KBrowse, "Browse");
+    _LIT8( KDestinationURI, "DestinationURI");
+    _LIT8( KSourceURI, "SourceURI");
+    _LIT8( KTransferID, "TransferID");
+    _LIT8( KResourceURI, "ResourceURI");
+    _LIT8( KNumberReturned, "NumberReturned");
+    _LIT8( KTotalMatches, "TotalMatches");
+    _LIT8( KUpdateID, "UpdateID");
+    _LIT8( KBrowseFlag, "BrowseFlag");
+    _LIT8( KFilter, "Filter");
+    _LIT8( KStartingIndex, "StartingIndex");
+    _LIT8( KRequestedCount, "RequestedCount");
+    _LIT8( KSortCriteria, "SortCriteria");
+    _LIT8( KContainerID, "ContainerID");
+    _LIT8( KObjectID, "ObjectID");
+    _LIT8( KResult, "Result");
+    _LIT8( KTransferStatus, "TransferStatus");
+    _LIT8( KTransferLength, "TransferLength");
+    _LIT8( KTransferTotal, "TransferTotal");
+    _LIT8( KNewID, "NewID");
+    _LIT8( KSearch, "Search");
+    _LIT8( KDestroyObject, "DestroyObject");
+    _LIT8( KDeleteResource, "DeleteResource");
+    _LIT8( KStopTransferResource, "StopTransferResource");
+    _LIT8( KGetTransferProgress, "GetTransferProgress");
+    _LIT8( KUpdateObject, "UpdateObject");
+    _LIT8( KSearchCriteria, "SearchCriteria");
+    _LIT8( KCurrentTagValue, "CurrentTagValue");
+    _LIT8( KNewTagValue, "NewTagValue");
+    _LIT8( KPrepareForConnection, "PrepareForConnection");
+    _LIT8( KRemoteProtocolInfo, "RemoteProtocolInfo");
+    _LIT8( KPeerConnectionManager, "PeerConnectionManager");
+    _LIT8( KPeerConnectionId, "PeerConnectionID");
+    _LIT8( KDirection, "Direction");
+    _LIT8( KConnectionId, "ConnectionID");
+    _LIT8( KGetCurrentConnectionIDs, "GetCurrentConnectionIDs");
+    _LIT8( KConnectionComplete, "ConnectionComplete");
+    _LIT8( KGetCurrentConnectionInfo, "GetCurrentConnectionInfo");
+    _LIT8( KAVTransportId, "AVTransportID");
+    _LIT8( KConnectionIds, "ConnectionIDs");
+    _LIT8( KProtocolInfo, "ProtocolInfo");
+    _LIT8( KStatus, "Status");
+    _LIT8( KGetProtocolInfo, "GetProtocolInfo");
+    _LIT8( KSource, "Source");
+    _LIT8( KSink, "Sink");
+    _LIT8( KRcsID, "RcsID");
+    _LIT8( KElements, "Elements");
+    _LIT8( KPeerConnectionID, "PeerConnectionID");
+    _LIT8( KConnectionID, "ConnectionID");
+    _LIT8( KSystemUpdateID, "SystemUpdateID");
+    _LIT8( KContainerUpdateIDs, "ContainerUpdateIDs");
+    _LIT8( KSourceProtocolInfo, "SourceProtocolInfo");
+    _LIT8( KSinkProtocolInfo, "SinkProtocolInfo");
+    _LIT8( KCurrentConnectionIds, "CurrentConnectionIDs");
+    _LIT8( KLastChange, "LastChange");
+    _LIT8( KTransferIds, "TransferIDs");
+    }
+
+#endif      //UPNPAVCPSTRING_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/inc/upnpavtactionfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,299 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Produces avt actions
+*
+*/
+
+
+
+#ifndef C_CUPNPAVTACTIONFACTORY_H
+#define C_CUPNPAVTACTIONFACTORY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavcontrolpointobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpService;
+class CUpnpAVControlPoint;
+
+// CLASS DECLARATION
+
+/**
+*  AV Transport factory class.
+*  This class creates AV Transport actions.
+*
+*  @since Series 60 2.6
+*/
+class CUpnpAvtActionFactory : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+	    static CUpnpAvtActionFactory* NewL( MUpnpAVControlPointObserver& aAVCPObserver,
+	    									CUpnpAVControlPoint& aAVCP );
+        /**
+        * Destructor.
+        */
+        ~CUpnpAvtActionFactory();
+
+    public: // New functions
+        /**
+        * Cretes and places in CU-stack a SetTransportURI action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @param aCurrentUri Resource URI.
+        * @param aCurrentMetaData Resource metadata.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtSetTransportUriActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId,
+            const TDesC8& aCurrentUri,
+            const TDesC8& aCurrentMetaData );
+        /**
+        * Cretes and places in CU-stack a SetNextTransportURI action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @param aNextUri Resource URI.
+        * @param aNextMetaData Resource metadata.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtSetNextTransportUriActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId,
+            const TDesC8& aNextUri,
+            const TDesC8& aNextMetaData );
+        /**
+        * Cretes and places in CU-stack a Seek action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @param aUnit 
+        * @param aTarget 
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtSeekActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId,
+            const TDesC8& aUnit,
+            const TDesC8& aTarget);
+        /**
+        * Cretes and places in CU-stack a GetMediaInfo action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtMediaInfoActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a GetTransportInfo action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtTransportInfoActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a GetPositionInfo action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtPositionInfoActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a GetDeviceCapabilities action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtDeviceCapabilitiesActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a GetTransportSettings action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtTransportSettingsActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a Stop action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtStopActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a Play action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @param aSpeed Play speed.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtPlayActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId,
+            const TDesC8& aSpeed);
+        /**
+        * Cretes and places in CU-stack a Pause action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtPauseActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a Record action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtRecordActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a Next action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtNextActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a Previous action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtPreviousActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+        /**
+        * Cretes and places in CU-stack a SetPlayMode action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @param aPlayMode Mode of play.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtSetPlayModeActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId,
+            const TDesC8& aPlayMode);
+        /**
+        * Cretes and places in CU-stack a SetRecordQualityMode action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @param aRecordMode Mode of recording.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtSetRecordModeActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId,
+            const TDesC8& aRecordMode);
+        /**
+        * Cretes and places in CU-stack a GetTransportIDs action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaRenderer Action's target device.
+        * @param aInstanceId Media Renderer instance number.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt AvtTransportsActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaRenderer,
+            TInt aInstanceId);
+
+    private:
+        
+    /**
+    * C++ default constructor.
+        */
+        CUpnpAvtActionFactory( MUpnpAVControlPointObserver& aAVCPObserver,
+        						CUpnpAVControlPoint& aAVCP );
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+    private:    // Data
+        //observer that is intrested about AVCP actions
+        MUpnpAVControlPointObserver& iAVControlPointObserver;
+        // AVCP main class
+        CUpnpAVControlPoint& iAVCP;
+    };
+    
+#endif      // C_CUPNPAVTACTIONFACTORY_H
+    
+    // End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/inc/upnpcdsactionfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,278 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+
+
+
+#ifndef C_CUPNPCDSACTIONFACTORY_H
+#define C_CUPNPCDSACTIONFACTORY_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavcontrolpointobserver.h"
+
+// FORWARD DECLARATIONS
+
+class CUpnpService;
+class CUpnpAVControlPoint;
+// CLASS DECLARATION
+
+/**
+*  ?one_line_short_description.
+*  ?other_description_lines
+*
+*  @since Series 60 2.6
+*/
+class CUpnpCdsActionFactory : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+	    static CUpnpCdsActionFactory* NewL( 
+            MUpnpAVControlPointObserver& aAVCPObserver,
+            CUpnpAVControlPoint& aAVCP );
+        
+        /**
+        * Destructor.
+        */
+        ~CUpnpCdsActionFactory();
+
+    public: // New functions
+        
+        /**
+        * This function creates an action for content directory browse function.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Destination of action.
+        * @param aObjectId object to be browsed
+        * @param aBrowseFlag item or children browse
+        * @param aFilter 
+        * @param aStartingIndex
+        * @param aRequestedCount
+        * @param aSortCriteria
+        * @return errorcode KErrNone if no errors 
+        */
+        TInt CdsBrowseActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            const TDesC8& aObjectId,
+            const TDesC8& aBrowseFlag,
+            const TDesC8& aFilter, 
+            TInt aStartingIndex,
+            TInt aRequestedCount,
+            const TDesC8& aSortCriteria);
+        /**
+        * This function creates an action for content directory Search function.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Destination of action.
+        * @param aObjectId object to be browsed
+        * @param aSearchCriteria search parameters
+        * @param aFilter 
+        * @param aStartingIndex
+        * @param aRequestedCount
+        * @param aSortCriteria
+        * @return errorcode KErrNone if no errors 
+        */
+        TInt CdsSearchActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            const TDesC8& aObjectId,
+            const TDesC8& aSearchCriteria,
+            const TDesC8& aFilter, 
+            TInt aStartingIndex,
+            TInt aRequestedCount,
+            const TDesC8& aSortCriteria);
+
+        /**
+        * Creates and places in CU-stack a GetSystemUpdateID action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt CdsSystemUpdateIdActionLC(
+            CUpnpAction*& aAction, 
+            CUpnpDevice* aMediaServer);
+        /**
+        * Creates and places in CU-stack a GetSearchCapabilities action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt CdsSearchCapabilitiesActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer);
+        /**
+        * Creates and places in CU-stack a GetSortCapabilities action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @return Error code. KErrNone if no errors.
+        */
+        TInt CdsSortCapabilitiesActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer);
+        /**
+        * Creates and places in CU-stack a CreateObject action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @param aId A contatiner id .
+        * @param aElements new object as XML string.
+        * @return error code. KErrNone if no errors.
+        */
+        TInt CdsCreateObjectActionLC(
+        CUpnpAction*& aAction,
+        CUpnpDevice* aMediaServer,
+        const TDesC8& aId, 
+        const TDesC8& aElements);
+        /**
+        * Cretes and places in CU-stack a ImportResource action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @param aSourceUri source of import.
+        * @param aDestinationUri destination for import.
+        * @return error code. KErrNone if no errors.
+        */
+        TInt CdsImportResourceActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            const TDesC8& aSourceUri, 
+            const TDesC8& aDestinationUri);
+        /**
+        * Creates and places in CU-stack a ExportResource action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @param aSourceUri source of export.
+        * @param aDestinationUri destination for export.
+        * @return error code. KErrNone if no errors
+        */
+        TInt CdsExportResourceActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            const TDesC8& aSourceUri, 
+            const TDesC8& aDestinationUri);
+        /**
+        * Creates and places in CU-stack a CreateRefernce action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @param aDestinationContainerId ID of container 
+        *   in wher reference is created.
+        * @param aSourceObjectId object to be refered.
+        * @return error code. KErrNone if no errors
+        */
+        TInt CdsCreateReferenceActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            const TDesC8& aDestinationContainerId, 
+            const TDesC8& aSourceObjectId);
+        /**
+        * Creates and places in CU-stack a DeleteResource action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @param aResourceUri URI of target resource.
+        * @return error code. KErrNone if no errors.
+        */
+        TInt CdsDeleteResourceActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            const TDesC8& aResourceUri);
+        /**
+        * Creates and places in CU-stack a DestroyObject action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @param aObjectId URI of target resource.
+        * @return error code. KErrNone if no errors.
+        */
+        TInt CdsDestroyObjectActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            const TDesC8& aObjectId);
+        /**
+        * Creates and places in CU-stack a StopTransfer action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @param aTransferId Id of target transfer.
+        * @return error code. KErrNone if no errors.
+        */
+        TInt CdsStopTransferActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            TInt aTransferId);
+        /**
+        * Creates and places in CU-stack a GetTransferProgress action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @param aTransferId Id of target transfer.
+        * @return error code. KErrNone if no errors.
+        */
+        TInt CdsTransferProgressActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            TInt aTransferId);
+         /**
+        * Creates and places in CU-stack a UpdateObject action.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aMediaServer Action's target device.
+        * @param aObjectID object to be updated.
+        * @param aCurrentTagValue current metadata.
+        * @param aNewTagValue new metadata.
+        * @return error code. KErrNone if no errors.
+        */
+        TInt CdsUpdateObjectActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aMediaServer,
+            const TDesC8& aObjectID,
+            const TDesC8& aCurrentTagValue,
+            const TDesC8& aNewTagValue);
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+	    CUpnpCdsActionFactory( MUpnpAVControlPointObserver& aAVCPObserver,
+	    						CUpnpAVControlPoint& aAVCP );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+	    void ConstructL();
+
+    private:    // Data
+        
+        //observer that is intrested about AVCP actions
+        MUpnpAVControlPointObserver& iAVControlPointObserver;	
+        // AVCP main class
+        CUpnpAVControlPoint& iAVCP;
+    };
+
+#endif      // C_CUPNPCDSACTIONFACTORY_H   
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/inc/upnpcmactionfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,145 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Produces cm actions
+*
+*/
+
+
+
+#ifndef C_CUPNPCMACTIONFACTORY_H
+#define C_CUPNPCMACTIONFACTORY_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavcontrolpointobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpService;
+class CUpnpAVControlPoint;
+
+// CLASS DECLARATION
+
+/**
+*  Factory class.
+*  This class creates Connection Manager actions.
+*
+*  @since Series 60 2.6
+*/
+class CUpnpCmActionFactory : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+	    static CUpnpCmActionFactory* NewL( 
+            MUpnpAVControlPointObserver& aAVCPObserver, 
+            CUpnpAVControlPoint& aAVCP );
+        
+        /**
+        * Destructor.
+        */
+        ~CUpnpCmActionFactory();
+
+    public: // New functions
+        /**
+        * This function creates an action for Connection Manager 
+        *   GetProtocolInfo function.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aDevice Destination of action.
+        * @return errorcode KErrNone if no errors. 
+        */
+        TInt CmProtocolInfoActionLC(CUpnpAction*& aAction, CUpnpDevice* aDevice);
+        /**
+        * This function creates an action for Connection Manager 
+        *   GetCurrentConnections function.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aDevice Destination of action.
+        * @return errorcode KErrNone if no errors. 
+        */
+        TInt CmCurrentConnectionsActionLC(CUpnpAction*& aAction, CUpnpDevice* aDevice);
+
+        /**
+        * This function creates an action for Connection Manager 
+        *   PrepareForConnection function.
+        * @since Series 60 2.6
+        * @param aAction CUpnpAction pointer for created action.
+        * @param aDevice Destination of action.
+        * @param aRemoteProtocolInfo.
+        * @param aPeerConnectionManager.
+        * @param aPeerConnectionID connection ID.
+        * @param aDirection connection direction.
+        * @return errorcode KErrNone if no errors. 
+        */
+        TInt CmPrepareConnectionActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aDevice,
+            const TDesC8& aRemoteProtocolInfo,
+            const TDesC8& aPeerConnectionManager,
+            TInt aPeerConnectionID,
+            const TDesC8& aDirection);
+        /**
+        * This function creates an action for Connection Manager 
+        *   ConnectionComplete function.
+        * @since Series 60 2.6
+        * @param aAction created action
+        * @param aDevice Action's target device.
+        * @param aConnectionId target connection.
+        * @return errorcode KErrNone if no errors. 
+        */
+        TInt CmConnectionCompleteActionLC(
+            CUpnpAction*& aAction, 
+            CUpnpDevice* aDevice,
+            TInt aConnectionId);
+        /**
+        * This function creates an action for Connection Manager 
+        *   GetCurrentConnections function.
+        * @since Series 60 2.6
+        * @param aAction created action
+        * @param aDevice Action's target device.
+        * @param aConnectionId target connection.
+        * @return errorcode KErrNone if no errors. 
+        */
+        TInt CmCurrentConnectionInfoActionLC(
+            CUpnpAction*& aAction, 
+            CUpnpDevice* aDevice,
+            TInt aConnectionId);
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+	    CUpnpCmActionFactory( 
+            MUpnpAVControlPointObserver& aAVCPObserver,
+            CUpnpAVControlPoint& aAVCP );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+	    void ConstructL();
+
+    private:    // Data
+        // Observer that is intrested about AVCP actions.
+        MUpnpAVControlPointObserver& iAVControlPointObserver;
+        // AVCP main class.
+        CUpnpAVControlPoint& iAVCP;
+    };
+
+#endif      // C_CUPNPCMACTIONFACTORY_H   
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/inc/upnpcustomlog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,294 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares Logger Functions
+*
+*/
+
+
+
+
+
+#ifndef C_UPNPCUSTOMLOG_H
+#define C_UPNPCUSTOMLOG_H
+
+#include <flogger.h>
+#include <e32svr.h>
+
+// UPNP_LOG :
+//1 - logging, UDEB
+//0 - no logging, UREL
+
+//UPNP_FLOGGING = file logging, default in UDEB
+//UPNP_CLOGGING = console logging
+
+
+#ifndef _DEBUG
+    // UREL
+    #define UPNP_LOG  0   // No logging in UREL builds
+
+#else
+
+    // UDEB
+    #define UPNP_LOG  1
+    #define UPNP_FLOGGING //File logger
+    //#define UPNP_CLOGGING //console logger
+
+    _LIT(KEventLogFile, "EventActionLog.txt");
+    // If log file is not defined in CPP file, use UPnPStackLog as default
+    #ifndef KLogFile
+        #define KLogFile _L("UPnPStack.txt")
+    #endif
+
+#endif
+
+_LIT(KLogFolder,"upnp");
+const TInt KMaxLogLen = 256;
+//_LIT(KLogFile, LOG_FILE);
+
+// Writing some descriptor into log
+// LOGT(own_desc);
+//
+// Writing data into log
+// LOGS("My log string");
+//
+// Writing data with one decimal parameter
+// LOGS1("Log with decimal parameter %i", desimalValue);
+//
+// Writing data with one decimal and hexa parameter
+// LOGS2("Log with decimal and hexa parameters %i %x", desimalValue, hexaValue);
+//
+// Writing data with one descriptor and decimal parameters
+// LOGS2("String %S and decimal value %i", &stringData, decimalValue);
+//
+// Writing User::AllocSize
+// LOGM;
+
+#if UPNP_LOG == 1
+
+#ifdef UPNP_FLOGGING
+
+static void DoOutput(TDesC8& aData)
+    {
+    if(!aData.Length())
+        {
+        return;
+        }
+    RFileLogger logger;
+    logger.Connect();
+
+    logger.CreateLog( KLogFolder(), KLogFile, EFileLoggingModeAppend);
+    logger.Write( aData.Mid(0,(aData.Length()<KMaxLogLen)? aData.Length():KMaxLogLen) );
+
+    logger.CloseLog();
+    logger.Close();
+    }
+
+static void DebugStringNarrowL(const char* aFmt, ...)
+    {
+    VA_LIST args;
+    VA_START(args, aFmt);
+
+    TPtrC8 fmt(reinterpret_cast<const unsigned char *>(aFmt));
+
+    HBufC8* buf = HBufC8::NewLC(KMaxLogLen);
+
+    buf->Des().FormatList(fmt, args);
+    DoOutput(*buf);
+
+    VA_END(args);
+    CleanupStack::PopAndDestroy(buf);
+    }
+
+static void DebugStringWideL(const char* aFmt, ...)
+    {
+    VA_LIST args;
+    VA_START(args, aFmt);
+
+    TPtrC8 fmt(reinterpret_cast<const unsigned char *>(aFmt));
+
+    HBufC* fmt16 = HBufC::NewLC(fmt.Length());
+    fmt16->Des().Copy(fmt);
+
+    HBufC* buf = HBufC::NewLC(KMaxLogLen);
+    TPtrC pointer = fmt16->Des() ;
+    buf->Des().FormatList(pointer, args);
+
+    HBufC8* buf8 = HBufC8::NewLC(buf->Length());
+    buf8->Des().Copy(*buf);
+
+    DoOutput(*buf8);
+
+    VA_END(args);
+
+    CleanupStack::PopAndDestroy(buf8);
+    CleanupStack::PopAndDestroy(buf);
+    CleanupStack::PopAndDestroy(fmt16);
+    }
+
+
+static void DebugBufferL(const TDesC8& aBuf)
+    {
+    DebugStringNarrowL("\"%S\"", &aBuf);
+    }
+
+static void DebugBufferL(const TDesC& aBuf)
+    {
+    DebugStringWideL("\"%S\"", &aBuf);
+    }
+
+static void DebugTimeL()
+    {
+    TTime time;
+    time.UniversalTime();
+
+    TBuf<64> dateTimeString;
+
+    _LIT(KTimeString, "%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B");
+    time.FormatL(dateTimeString, KTimeString);
+    DebugBufferL(dateTimeString);
+
+    }
+
+
+// ------------ Content Directory logging specific ---------------
+_LIT(KInfoFormatString, "INFO#%S#%S#%d#%S");
+_LIT(KErrFormatString, "ERROR#%S#%S#%d#%S");
+
+static void LOGCD(const char* aInFunction, const char* aCalledFunction, TInt aErrorCode, const char* aComment)
+{
+    // Transforming parameters from 'const char *' into 'HBufC'
+    TPtrC8 InFunction8(reinterpret_cast<const unsigned char *>(aInFunction));
+    HBufC* InFunction16 = HBufC::NewLC(128);
+    InFunction16->Des().Copy(InFunction8);
+
+    TPtrC8 CalledFunction8(reinterpret_cast<const unsigned char *>(aCalledFunction));
+    HBufC* CalledFunction16 = HBufC::NewLC(128);
+    CalledFunction16->Des().Copy(CalledFunction8);
+
+    TPtrC8 Comment8(reinterpret_cast<const unsigned char *>(aComment));
+    HBufC* Comment16 = HBufC::NewLC(128);
+    Comment16->Des().Copy(Comment8);
+
+    // preparing main 16bit buffer
+    HBufC* buf = HBufC::NewLC(KMaxLogLen);
+
+    // formating all together in 16bit descriptor
+    if(aErrorCode < 0)
+    {
+        buf->Des().Format(KErrFormatString, &*InFunction16, &*CalledFunction16, aErrorCode, &*Comment16);
+    }
+    else
+    {
+        buf->Des().Format(KInfoFormatString, &*InFunction16, &*CalledFunction16, aErrorCode, &*Comment16);
+    }
+
+    // converting 16bit descriptor into 8bit one
+    HBufC8* buf8 = HBufC8::NewLC(buf->Length());
+    buf8->Des().Copy(*buf);
+
+    // main file logging
+    DoOutput(*buf8);
+
+    // cleaning
+    CleanupStack::PopAndDestroy(buf8);
+    CleanupStack::PopAndDestroy(buf);
+    CleanupStack::PopAndDestroy(Comment16);
+    CleanupStack::PopAndDestroy(CalledFunction16);
+    CleanupStack::PopAndDestroy(InFunction16);
+}
+
+
+    #define LOGTIME DebugTimeL()
+    #define LOG(x) DebugStringNarrowL x
+    #define LOG8(x) DebugStringNarrowL x
+    #define LOG16(x) DebugStringWideL x
+
+    #define LOGT(A)
+    #define LOGS(A)      LOG16((A))
+    #define LOGS1(A,B)   LOG16((A,B))
+    #define LOGS2(A,B,C) LOG16((A,B,C))
+    #define LOGM
+
+    #define LOGTH(H,A)       LOGT(A)
+    #define LOGSH(H,A)       LOGS(A)
+    #define LOGS1H(H,A,B)    LOGS1(A,B)
+    #define LOGS2H(H,A,B,C)  LOGS2(A,B,C)
+
+    #define ACTIONSEND(A)
+    #define ACTIONRECV(A,B)
+
+static void LOGSQL(const char* aInFunction, const char* aCalledFunction, TInt aErrorCode, const TDesC* aCommand)
+{
+    LOGCD(aInFunction, aCalledFunction, aErrorCode, "SQL Command:");
+
+    // log whole sql command separately
+    LOGS1("%S", aCommand);
+}
+
+
+
+#else     // UPNP_CLOGGING = console logging
+    #define LOGS(A)      RDebug::Print(_L(A));
+    #define LOGS1(A,B)   RDebug::Print(_L(A),B);
+    #define LOGS2(A,B,C) RDebug::Print(_L(A),B,C);
+
+    #define LOGT(A)
+    #define LOGM
+    #define ACTIONSEND(A)
+    #define ACTIONRECV(A,B)
+
+    #define LOGTH(H,A)       LOGT(A)
+    #define LOGSH(H,A)       LOGS(A)
+    #define LOGS1H(H,A,B)    LOGS1(A,B)
+    #define LOGS2H(H,A,B,C)  LOGS2(A,B,C)
+    #define LOGCD(A,B,C,D)
+    #define LOGSQL(A,B,C,D)
+
+    #define LOGTIME
+    #define LOG(x)
+    #define LOG8(x)
+    #define LOG16(x)
+
+
+#endif //UPNP_LOG == 1
+
+#else // UPNP_LOG == 0 or invalid
+    #define LOGT(A)
+    #define LOGS(A)
+    #define LOGS1(A,B)
+    #define LOGS2(A,B,C)
+    #define LOGM
+    #define ACTIONSEND(A)
+    #define ACTIONRECV(A,B)
+
+    #define LOGTH(H,A)
+    #define LOGSH(H,A)
+    #define LOGS1H(H,A,B)
+    #define LOGS2H(H,A,B,C)
+
+    #define LOGCD(A,B,C,D)
+    #define LOGSQL(A,B,C,D)
+
+    #define LOGTIME
+    #define LOG(x)
+    #define LOG8(x)
+    #define LOG16(x)
+
+#endif // UPNP_LOG
+
+#define LOG_FUNC_NAME LOGS( __PRETTY_FUNCTION__ )
+
+#endif // C_UPNPCUSTOMLOG_H
+
+// End Of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/inc/upnprcactionfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,142 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Produces rc actions
+*
+*/
+
+
+
+#ifndef C_CUPNPRCACTIONFACTORY_H
+#define C_CUPNPRCACTIONFACTORY_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavcontrolpointobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpService;
+class CUpnpAVControlPoint;
+
+// CLASS DECLARATION
+
+/**
+*  RC action factory class.
+*  This class provides a Rendering Control action creation services.
+*
+*  @since Series 60 2.6
+*/
+class CUpnpRcActionFactory : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+	    static CUpnpRcActionFactory* NewL( MUpnpAVControlPointObserver& aAVCPObserver,
+	    									CUpnpAVControlPoint& aAVCP );
+        
+        /**
+        * Destructor.
+        */
+        ~CUpnpRcActionFactory();
+
+    public: // New functions
+
+        /**
+        * Creates a GetVolume action.
+        * @since Series 60 2.6
+        * @param aAction Pointer for returning created action.
+        * @param aDevice Target of the action.
+        * @param aInstanceID rendering instance.
+        * @param aChannel audio channel.
+        * @return error code. KErrNone if no errors
+        */
+        TInt RcGetVolumeActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aDevice,
+            TInt aInstanceID,
+            const TDesC8& aChannel);
+        /**
+        * Creates a SetVolume action.
+        * @since Series 60 2.6
+        * @param aAction Pointer for returning created action.
+        * @param aDevice Target of the action.
+        * @param aInstanceID rendering instance.
+        * @param aChannel audio channel.
+        * @param aVolume volume.
+        * @return error code. KErrNone if no errors
+        */
+        TInt RcSetVolumeActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aDevice,
+            TInt aInstanceID,
+            const TDesC8& aChannel,
+            TInt aVolume);
+         /**
+        * Creates a GetMuteAction.
+        * @since Series 60 2.6
+        * @param aAction Pointer for returning created action.
+        * @param aDevice Target of the action.
+        * @param aInstanceID rendering instance.
+        * @param aChannel audio channel.
+        * @return error code. KErrNone if no errors
+        */
+        TInt RcGetMuteActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aDevice,
+            TInt aInstanceID,
+            const TDesC8& aChannel);
+        /**
+        * ?Creates a SetMute action.
+        * @since Series 60 2.6
+        * @param aAction Pointer for returning created action.
+        * @param aDevice Target of the action.
+        * @param aInstanceID rendering instance.
+        * @param aChannel audio channel.
+        * @param aMute 
+        * @return error code. KErrNone if no errors
+        */
+        TInt RcSetMuteActionLC(
+            CUpnpAction*& aAction,
+            CUpnpDevice* aDevice,
+            TInt aInstanceID,
+            const TDesC8& aChannel,
+            const TDesC8& aMute);
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+	    CUpnpRcActionFactory( MUpnpAVControlPointObserver& aAVCPObserver, 
+	    						CUpnpAVControlPoint& aAVCP );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+	    void ConstructL();
+
+    private:    // Data
+        //observer that is intrested about AVCP actions.
+        MUpnpAVControlPointObserver& iAVControlPointObserver;
+        // AVCP main class.
+        CUpnpAVControlPoint& iAVCP;
+
+    };
+
+#endif      // C_CUPNPRCACTIONFACTORY_H  
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/inc/upnpstateupdatehandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,125 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Watches states of control point
+*
+*/
+
+
+
+#ifndef C_CUPNPSTATEUPDATEHANDLER_H
+#define C_CUPNPSTATEUPDATEHANDLER_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavcontrolpointobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpService;
+class CUpnpAVControlPoint;
+
+// CLASS DECLARATION
+
+/**
+*  UPnP event handler.
+*  This class contain functions to handle UPnP events.
+*
+*  @since Series 60 2.6
+*/
+class CUpnpStateUpdateHandler : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+	    static CUpnpStateUpdateHandler* NewL( 
+            MUpnpAVControlPointObserver& aAVCPObserver,
+            CUpnpAVControlPoint& aAVCP );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpStateUpdateHandler();
+
+    public: // New functions
+        
+        /**
+        * MAin function for event handling
+        * @since Series 60 2.6
+        * @param aService Service that has update events.
+        * @return KErrNone 
+        */
+        TInt StateUpdated( CUpnpService*& aService );
+        /**
+        * Handler for Content Directory events.
+        * @since Series 60 2.6
+        * @param aDevice Device that has update events
+        * @param aService Service that has update events
+        * @return KErrNone, KErrNotsupported, KErrGeneral
+        */
+        TInt ContentDirectoryStateUpdated( 
+            CUpnpDevice& aDevice,
+            CUpnpService*& aService );
+        /**
+        * Handler for Connection Manager events.
+        * @since Series 60 2.6
+        * @param aDevice Device that has update events
+        * @param aService Service that has update events
+        * @return KErrNone, KErrNotsupported, KErrGeneral
+        */
+        TInt ConnectionManagerStateUpdated( 
+            CUpnpDevice& aDevice, 
+            CUpnpService*& aService);
+        /**
+        * Handler for Rendering Control events.
+        * @since Series 60 2.6
+        * @param aDevice Device that has update events
+        * @param aService Service that has update events
+        * @return KErrNone, KErrNotsupported, KErrGeneral
+        */
+        TInt RenderingControlStateUpdated( CUpnpDevice& aDevice, CUpnpService*& aService );
+        /**
+        * Handler for AV Transport events.
+        * @since Series 60 2.6
+        * @param aDevice Device that has update events
+        * @param aService Service that has update events
+        * @return KErrNone, KErrNotsupported, KErrGeneral
+        */
+        TInt AVTransportStateUpdated( CUpnpDevice& aDevice, CUpnpService*& aService );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+	    CUpnpStateUpdateHandler( MUpnpAVControlPointObserver& aAVCPObserver, 
+	    							CUpnpAVControlPoint& aAVCP );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+	    void ConstructL();
+
+    private:    // Data
+       
+        //observer that is intrested about AVCP actions
+          MUpnpAVControlPointObserver& iAVControlPointObserver;
+          //AVCP main class
+          CUpnpAVControlPoint& iAVCP;
+    };
+
+#endif      // C_CUPNPSTATEUPDATEHANDLER_H   
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/src/upnpactionresponsehandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,717 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpActionResponseHandler
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpactionresponsehandler.h"
+#include "upnpavcontrolpoint.h"
+#include "upnpavcpstring.h"
+
+// CONSTANTS]
+using namespace UpnpAVCPStrings;
+
+
+// -----------------------------------------------------------------------------
+// CUpnpActionResponseHandler::CUpnpActionResponseHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpActionResponseHandler::CUpnpActionResponseHandler( 
+            MUpnpAVControlPointObserver& aAVCPObserver, CUpnpAVControlPoint& aAVCP )
+    :iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP )
+    {
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpActionResponseHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpActionResponseHandler::ConstructL() 
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CSuperDir::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpActionResponseHandler* CUpnpActionResponseHandler::NewL( 
+            MUpnpAVControlPointObserver& aAVCPObserver,
+            CUpnpAVControlPoint& aAVCP )
+    {
+	CUpnpActionResponseHandler* self = new (ELeave) CUpnpActionResponseHandler( 
+	    aAVCPObserver, aAVCP );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// Destructor
+CUpnpActionResponseHandler::~CUpnpActionResponseHandler()	
+	{
+	}
+// -----------------------------------------------------------------------------
+// CUpnpActionResponseHandler::ActionResponseReceived
+// This is where action responses first came.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpActionResponseHandler::ActionResponseReceived(CUpnpAction* aAction)
+    {
+    CUpnpService& service = aAction->Service();
+    if( service.ServiceType().Length() <= 0 )
+        {
+        return KErrArgument;
+        }
+    TInt err( KErrNone );
+    if ( service.ServiceType().Match(KRenderingControl) != KErrNotFound )
+        {
+        err = RenderingControlResponse(aAction);
+        }
+    else if ( service.ServiceType().Match(KAVTransport) != KErrNotFound )
+        {
+        err = AVTransportResponse(aAction);
+        }
+    else if ( service.ServiceType().Match(KConnectionManager) != KErrNotFound )
+        {
+        err = ConnectionManagerResponse(aAction);
+        }
+    else if ( service.ServiceType().Match(KContentDirectory) != KErrNotFound )
+        {
+        err = ContentDirectoryResponse(aAction);
+        }
+    else
+        {
+        err = KErrNotSupported;
+        }
+    return err;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpActionResponseHandler::RenderingControlResponse
+// This is where action responses first came.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpActionResponseHandler::RenderingControlResponse(CUpnpAction* aAction)
+    {
+	CUpnpService& service = aAction->Service();
+	if( service.ServiceType().Length() <= 0 )
+		{
+		return KErrArgument;
+		}
+    const TDesC8& uuid = service.Device().Uuid();
+    if (aAction->Name().Compare(KSetVolume) == 0)
+        {
+        iAVControlPointObserver.RcSetVolumeResponse(
+             uuid,
+             aAction->SessionId(),
+             aAction->Error(),
+             aAction->ArgumentValue( KInstanceID ),
+             aAction->ArgumentValue( KChannel ),
+             aAction->ArgumentValue( KDesiredVolume ) 
+             );
+        }		
+    else if (aAction->Name().Compare(KGetVolume) == 0)
+        {
+        iAVControlPointObserver.RcVolumeResponse( 
+             uuid,
+             aAction->SessionId(),
+             aAction->Error(),
+             aAction->ArgumentValue( KInstanceID ),
+             aAction->ArgumentValue( KChannel ),
+             aAction->ArgumentValue( KCurrentVolume ) 
+             );
+        }    
+    else if (aAction->Name().Compare(KSetMute) == 0)
+        {
+        iAVControlPointObserver.RcSetMuteResponse( 
+             uuid,
+             aAction->SessionId(),
+             aAction->Error(),
+             aAction->ArgumentValue( KInstanceID ),
+             aAction->ArgumentValue( KChannel ),
+             aAction->ArgumentValue( KDesiredMute ) 
+             );
+        }	
+    else if (aAction->Name().Compare(KGetMute) == 0)
+        {				
+        iAVControlPointObserver.RcMuteResponse( 
+             uuid,
+             aAction->SessionId(),
+             aAction->Error(),
+             aAction->ArgumentValue( KInstanceID ),
+             aAction->ArgumentValue( KChannel ),
+             aAction->ArgumentValue( KCurrentMute ) 
+             );
+        }
+    else
+        {
+        return KErrNotSupported;
+        }
+    return KErrNone;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpActionResponseHandler::AVTransportResponse
+// This is where action responses fot AV transport service are handled.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpActionResponseHandler::AVTransportResponse(CUpnpAction* aAction)
+    {
+       
+    CUpnpService& service = aAction->Service();
+	if( service.ServiceType().Length() <= 0 )
+		{
+		return KErrArgument;
+		}
+    const TDesC8& uuid = service.Device().Uuid();
+    if (aAction->Name().Compare(KSetAVTransportURI) == 0)
+        {
+        iAVControlPointObserver.AvtSetTransportUriResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KCurrentURI ),
+            aAction->ArgumentValue( KCurrentURIMetaData )
+            );
+        }
+    else if (aAction->Name().Compare(KSetNextAVTransportURI) == 0)
+        {
+        iAVControlPointObserver.AvtSetNextTransportUriResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KNextURI ),
+            aAction->ArgumentValue( KNextURIMetaData )
+            );
+        }
+    else if (aAction->Name().Compare(KGetMediaInfo) == 0)
+        {
+        iAVControlPointObserver.AvtMediaInfoResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KNrTracks ),
+            aAction->ArgumentValue( KMediaDuration ),
+            aAction->ArgumentValue( KCurrentURI ),
+            aAction->ArgumentValue( KCurrentURIMetaData ),
+            aAction->ArgumentValue( KNextURI ),
+            aAction->ArgumentValue( KNextURIMetaData ),
+            aAction->ArgumentValue( KPlayMedium ),
+            aAction->ArgumentValue( KRecordMedium ),
+            aAction->ArgumentValue( KWriteStatus )
+            );
+        }
+    else if (aAction->Name().Compare(KGetTransportInfo) == 0)
+        {			
+        iAVControlPointObserver.AvtGetTransportInfoResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KCurrentTransportState ),
+            aAction->ArgumentValue( KCurrentTransportStatus ),
+            aAction->ArgumentValue( KCurrentSpeed )
+            );
+        }
+    else if (aAction->Name().Compare(KGetPositionInfo) == 0)
+        {
+        iAVControlPointObserver.AvtPositionInfoResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KTrack ),
+            aAction->ArgumentValue( KTrackDuration),
+            aAction->ArgumentValue( KTrackMetaData ),
+            aAction->ArgumentValue( KTrackURI ),
+            aAction->ArgumentValue( KRelTime ),
+            aAction->ArgumentValue( KAbsTime ),
+            aAction->ArgumentValue( KRelCount ),
+            aAction->ArgumentValue( KAbsCount )
+            );
+        }
+    else if (aAction->Name().Compare(KGetDeviceCapabilities) == 0)
+        {				
+        iAVControlPointObserver.AvtDeviceCapabilitiesResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KPlayMedia ),
+            aAction->ArgumentValue( KRecMedia ),
+            aAction->ArgumentValue( KRecQualityMode )
+            );
+        }
+    else if (aAction->Name().Compare(KGetTransportSettings) == 0)
+        {				
+        iAVControlPointObserver.AvtTransportSettingsResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KPlayMode ),
+            aAction->ArgumentValue( KRecQualityMode )
+            );
+        }
+    else if (aAction->Name().Compare(KStop) == 0)
+        {				
+        iAVControlPointObserver.AvtStopResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID )
+            );
+        }
+    else if (aAction->Name().Compare(KPlay) == 0)
+        {				
+        iAVControlPointObserver.AvtPlayResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KSpeed )
+            );
+        }
+    else if (aAction->Name().Compare(KPause) == 0)
+        {		
+        iAVControlPointObserver.AvtPauseResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID )
+            );
+        }
+    else if (aAction->Name().Compare(KRecord) == 0)
+        {		
+        iAVControlPointObserver.AvtRecordResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID )
+            );
+        }
+    else if (aAction->Name().Compare(KSeek) == 0)
+        {	
+        iAVControlPointObserver.AvtSeekResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KUnit ),
+            aAction->ArgumentValue( KTarget )
+            );
+        }
+    else if (aAction->Name().Compare(KNext) == 0)
+        {
+        iAVControlPointObserver.AvtNextResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID )
+            );
+        }
+    else if (aAction->Name().Compare(KPrevious) == 0)
+        {
+        iAVControlPointObserver.AvtPreviousResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID )
+            );
+        }
+    else if (aAction->Name().Compare(KSetPlayMode) == 0)
+        {
+        iAVControlPointObserver.AvtSetPlayModeResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KNewPlayMode )
+            );
+        }
+    else if (aAction->Name().Compare(KSetRecordQualityMode) == 0)
+        {
+        iAVControlPointObserver.AvtSetRecordModeResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KNewRecordQualityMode )
+            );
+        }
+    else if (aAction->Name().Compare(KGetCurrentTransportActions) == 0)
+        {
+        iAVControlPointObserver.AvtSetPlayModeResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KInstanceID ),
+            aAction->ArgumentValue( KActions )
+            );
+        }
+    else{
+        return KErrNotSupported;
+        }
+    return KErrNone;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpActionResponseHandler::ConnectionManagerResponse
+// This is where action responses for Connection Manager service are handled.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpActionResponseHandler::ConnectionManagerResponse(CUpnpAction* aAction)
+    {
+    CUpnpService& service = aAction->Service();
+    if( service.ServiceType().Length() <= 0 )
+        {
+        return KErrArgument;
+        }
+    const TDesC8& uuid = service.Device().Uuid();
+    if (aAction->Name().Compare( KGetProtocolInfo ) == 0)
+        {
+        iAVControlPointObserver.CmProtocolInfoResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KSource ), 
+            aAction->ArgumentValue( KSink )
+            );
+        }
+    
+    else if (aAction->Name().Compare( KPrepareForConnection ) == 0)
+        {
+        TLex8 connectionLex1( aAction->ArgumentValue( KConnectionId ) );
+        TInt connectionId;
+        connectionLex1.Val( connectionId );			
+        TLex8 transportLex1( aAction->ArgumentValue( KAVTransportId ) );
+        TInt transportId;
+        transportLex1.Val( transportId );			
+        TLex8 rscLex3( aAction->ArgumentValue( KRcsID ) );
+        TInt rscId;
+        rscLex3.Val( rscId );
+        iAVControlPointObserver.CmPrepareResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KRemoteProtocolInfo ),
+            aAction->ArgumentValue( KPeerConnectionManager ),
+            aAction->ArgumentValue( KPeerConnectionId ),
+            aAction->ArgumentValue( KDirection ),
+            connectionId,
+            transportId,
+            rscId
+            );
+        }
+    else if (aAction->Name().Compare(KConnectionComplete) == 0)
+        {
+        TLex8 connectionLex1( aAction->ArgumentValue( KConnectionId ) );
+        TInt connectionId;
+        connectionLex1.Val( connectionId );
+
+        iAVControlPointObserver.CmComplete(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            connectionId
+            );
+        }
+    else if (aAction->Name().Compare(KGetCurrentConnectionIDs) == 0)
+        {
+        iAVControlPointObserver.CmCurrentConnections(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KConnectionIds )
+            );
+        }
+    else if (aAction->Name().Compare( KGetCurrentConnectionInfo ) == 0)
+        {	
+        
+        TLex8 rscLex3( aAction->ArgumentValue( KRcsID ) );
+        TInt rscId;
+        rscLex3.Val( rscId );			
+        TLex8 transportLex1( aAction->ArgumentValue( KAVTransportId ) );
+        TInt transportId;
+        transportLex1.Val( transportId );			
+        TLex8 peerLex( aAction->ArgumentValue( KPeerConnectionId ) );
+        TInt peerId;
+        peerLex.Val( peerId );
+        
+        iAVControlPointObserver.CmCurrentInfo(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            rscId, 
+            transportId, 
+            aAction->ArgumentValue( KProtocolInfo),
+            aAction->ArgumentValue( KPeerConnectionManager), 
+            peerId, 
+            aAction->ArgumentValue( KDirection ), 
+            aAction->ArgumentValue( KStatus )
+            );
+        }
+    else
+        {       
+        return KErrNotSupported;
+        }
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpActionResponseHandler::ContentDirectoryResponse
+// This is where action responses for Content Directory service are handled.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpActionResponseHandler::ContentDirectoryResponse(CUpnpAction* aAction)
+    {
+    CUpnpService& service = aAction->Service();
+	if( service.ServiceType().Length() <= 0 )
+		{
+		return KErrArgument;
+		}
+    const TDesC8& uuid = service.Device().Uuid();
+    if (aAction->Name().Compare(KGetSearchCapabilities) == 0)
+        {
+        iAVControlPointObserver.CdsSearchCapabilitiesResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KSearchCaps )
+            );
+        }
+    else if (aAction->Name().Compare(KGetSortCapabilities) == 0)
+        {
+        iAVControlPointObserver.CdsSortCapabilitiesResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KSortCaps )
+            );
+        }
+    else if (aAction->Name().Compare(KGetSystemUpdateID) == 0)
+        {	
+        const TDesC8& systemUpdateId = aAction->ArgumentValue( KId );
+        TLex8 updateidLex( systemUpdateId );
+        TInt systemUpdate;
+        updateidLex.Val( systemUpdate );
+        
+        iAVControlPointObserver.CdsSystemUpdateIdResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            systemUpdate
+            );
+        }
+    else if (aAction->Name().Compare(KBrowse) == 0)
+        {		
+        const TDesC8& numberReturned = aAction->ArgumentValue( KNumberReturned );
+        TLex8 returnedLex( numberReturned );
+        TInt numberReturnedInt;
+        returnedLex.Val( numberReturnedInt );
+        
+        const TDesC8& totalmatches = aAction->ArgumentValue( KTotalMatches );
+        TLex8 matchesLex( totalmatches );
+        TInt totalMatchesInt;
+        matchesLex.Val( totalMatchesInt );
+        
+        const TDesC8& updateId = aAction->ArgumentValue( KUpdateID );
+        TLex8 updateLex( updateId );
+        TInt updateIdInt;
+        updateLex.Val( updateIdInt );
+
+        const TDesC8& startIndex = aAction->ArgumentValue( KStartingIndex );
+        TLex8 indexLex( startIndex );
+        TInt indexInt;
+        indexLex.Val( indexInt );
+
+        const TDesC8& requestCount = aAction->ArgumentValue( KRequestedCount );
+        TLex8 requestLex( requestCount );
+        TInt requestInt;
+        requestLex.Val( requestInt );
+        
+        iAVControlPointObserver.CdsBrowseResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KObjectID ),
+            aAction->ArgumentValue( KBrowseFlag ),
+            aAction->ArgumentValue( KFilter ),
+            indexInt,
+            requestInt,
+            aAction->ArgumentValue( KSortCriteria ),
+            aAction->ArgumentValue( KResult ),
+            numberReturnedInt,
+            totalMatchesInt,
+            aAction->ArgumentValue( KUpdateID )
+                );
+    }
+    else if (aAction->Name().Compare(KSearch) == 0)
+        {		
+
+        const TDesC8& numberReturned = aAction->ArgumentValue( KNumberReturned );
+        TLex8 returnedLex( numberReturned );
+        TInt numberReturnedInt;
+        returnedLex.Val( numberReturnedInt );
+        
+        const TDesC8& totalmatches = aAction->ArgumentValue( KTotalMatches );
+        TLex8 matchesLex( totalmatches );
+        TInt totalMatchesInt;
+        matchesLex.Val( totalMatchesInt );
+        
+        const TDesC8& updateId = aAction->ArgumentValue( KUpdateID );
+        TLex8 updateLex( updateId );
+        TInt updateIdInt;
+        updateLex.Val( updateIdInt );
+
+        const TDesC8& startingIndex = aAction->ArgumentValue( KStartingIndex );
+        TLex8 indexLex( startingIndex );
+        TInt indexInt;
+        indexLex.Val( indexInt );
+
+        const TDesC8& reqCnt = aAction->ArgumentValue( KRequestedCount );
+        TLex8 requestLex( reqCnt );
+        TInt requestInt;
+        requestLex.Val( requestInt );
+        
+        iAVControlPointObserver.CdsSearchResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KContainerID ),
+            aAction->ArgumentValue( KSearchCriteria ),
+            aAction->ArgumentValue( KFilter ),
+            indexInt,
+            requestInt,
+            aAction->ArgumentValue( KSortCriteria ),
+            aAction->ArgumentValue( KResult ),
+            numberReturnedInt,
+            totalMatchesInt,
+            aAction->ArgumentValue( KUpdateID )
+            );
+        }
+    else if (aAction->Name().Compare(KDestroyObject) == 0)
+        {		
+        iAVControlPointObserver.CdsDestroyObjectResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KObjectID )
+            );
+        }
+    else if (aAction->Name().Compare(KUpdateObject) == 0)
+        {	
+        iAVControlPointObserver.CdsUpdateObjectResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KObjectID ),
+            aAction->ArgumentValue( KCurrentTagValue ),
+            aAction->ArgumentValue( KNewTagValue )
+            );
+        }
+    else if (aAction->Name().Compare(KImportResource) == 0)
+        {		
+        iAVControlPointObserver.CdsImportResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KSourceURI ),
+            aAction->ArgumentValue( KDestinationURI  ),
+            aAction->ArgumentValue( KTransferID )
+            );
+        }
+    else if (aAction->Name().Compare(KExportResource) == 0)
+        {			
+        iAVControlPointObserver.CdsExportResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KSourceURI ),
+            aAction->ArgumentValue( KDestinationURI  ),
+            aAction->ArgumentValue( KTransferID )
+            );		
+        }
+    else if (aAction->Name().Compare(KStopTransferResource) == 0)
+        {		
+        iAVControlPointObserver.CdsStopTransferResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KTransferID )
+            );		
+        }
+    else if (aAction->Name().Compare(KGetTransferProgress) == 0)
+        {	
+        iAVControlPointObserver.CdsCTransferProgressResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue( KTransferID ),
+            aAction->ArgumentValue( KTransferStatus ),
+            aAction->ArgumentValue( KTransferLength ),            
+            aAction->ArgumentValue( KTransferTotal )
+            );
+        }
+    else if (aAction->Name().Compare(KDeleteResource) == 0)
+        {		
+        iAVControlPointObserver.CdsDeleteResourceResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue(KResourceURI)
+            );
+        }
+    else if (aAction->Name().Compare(KCreateReference) == 0)
+        {
+        iAVControlPointObserver.CdsCreateReferenceResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue(KContainerID), 
+            aAction->ArgumentValue(KObjectID), 
+            aAction->ArgumentValue(KNewID)
+            );
+        }
+    else if (aAction->Name().Compare(KCreateObject) == 0)
+        {
+        iAVControlPointObserver.CdsCreateObjectResponse(
+            uuid,
+            aAction->SessionId(),
+            aAction->Error(),
+            aAction->ArgumentValue(KContainerID), 
+            aAction->ArgumentValue(KElements), 
+            aAction->ArgumentValue(KObjectID), 
+            aAction->ArgumentValue(KResult)
+            );
+        }
+    else
+        {
+        return KErrArgument;
+        }
+    return KErrNone;
+    }
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/src/upnpavcontrolpoint.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1857 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpAVControlPoint
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpavcontrolpoint.h"
+#include "upnpargument.h"
+
+#include "upnpstateupdatehandler.h"
+#include "upnpactionresponsehandler.h"
+#include "upnpavtactionfactory.h"
+#include "upnpcdsactionfactory.h"
+#include "upnpcmactionfactory.h"
+#include "upnprcactionfactory.h"
+#define KLogFile _L("UPnPStack.txt")
+#include "upnpcustomlog.h"
+#include "upnpcons.h"
+
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpAVControlPoint* CUpnpAVControlPoint::NewL(
+            MUpnpAVControlPointObserver& aAVControlPointObserver)
+    {
+    CUpnpAVControlPoint* self = 
+        new (ELeave) CUpnpAVControlPoint(aAVControlPointObserver);    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CUpnpAVControlPoint
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpAVControlPoint::CUpnpAVControlPoint(
+     MUpnpAVControlPointObserver& aAVControlPointObserver)
+                : CUpnpControlPoint(),
+                  iAVControlPointObserver(aAVControlPointObserver)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpStateUpdateHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVControlPoint::ConstructL( )
+    {
+    _LIT8( KMediaServer, "urn:schemas-upnp-org:device:MediaServer" );
+    _LIT8( KMediaRenderer, "urn:schemas-upnp-org:device:MediaRenderer" );
+
+    CDesC8ArrayFlat* targetDeviceTypes = new(ELeave) CDesC8ArrayFlat(1);
+    CleanupStack::PushL( targetDeviceTypes );
+    targetDeviceTypes->AppendL( KMediaServer() );
+    targetDeviceTypes->AppendL( KMediaRenderer() );    
+    CUpnpControlPoint::ConstructL( *targetDeviceTypes );
+    CleanupStack::Pop( targetDeviceTypes );
+    targetDeviceTypes->Reset();
+    delete targetDeviceTypes; 
+    targetDeviceTypes = NULL;
+
+    TPtrC8 devicePtr;
+    devicePtr.Set( UpnpSSDP::KUPnPRootDevice );
+    SearchL( devicePtr );
+
+    iStateUpdateHandler = CUpnpStateUpdateHandler::NewL( 
+        iAVControlPointObserver, 
+        *this );
+    iActionResponseHandler = CUpnpActionResponseHandler::NewL(
+        iAVControlPointObserver,
+        *this );
+    
+    iAvtActionFactory = CUpnpAvtActionFactory::NewL(
+        iAVControlPointObserver,
+        *this );
+    iCdsActionFactory = CUpnpCdsActionFactory::NewL(
+        iAVControlPointObserver,
+        *this );
+    iCmActionFactory = CUpnpCmActionFactory::NewL(
+        iAVControlPointObserver,
+        *this );
+    iRcActionFactory = CUpnpRcActionFactory::NewL(
+        iAVControlPointObserver,
+        *this );
+  
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::~CUpnpAVControlPoint
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpAVControlPoint::~CUpnpAVControlPoint()
+    {
+    delete iStateUpdateHandler;
+    delete iActionResponseHandler;
+    delete iAvtActionFactory;
+    delete iCdsActionFactory;
+    delete iCmActionFactory;
+    delete iRcActionFactory;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::InitializeCdsActionFactoryL
+// Initialize CdsActionFactory if is NULL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVControlPoint::InitializeCdsActionFactoryL() 
+    {
+    
+    if (!iCdsActionFactory)
+        {
+        iCdsActionFactory = CUpnpCdsActionFactory::NewL(
+            iAVControlPointObserver,
+            *this );
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::StateUpdatedL
+// This function implements an inteface and forwards request 
+// to stateupdate handler.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVControlPoint::StateUpdatedL(CUpnpService*  aService)
+    {
+    iStateUpdateHandler->StateUpdated( aService );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::DeviceDiscoveredL
+// This function implements an inteface and notifies an observer.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVControlPoint::DeviceDiscoveredL(CUpnpDevice* aDevice)
+    {
+    iAVControlPointObserver.DeviceDiscoveredL( aDevice );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::DeviceDisappearedL
+// This function implements an inteface and notifies an observer.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVControlPoint::DeviceDisappearedL(CUpnpDevice* aDevice)
+    {    
+    iAVControlPointObserver.DeviceDisappearedL(aDevice);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::ActionResponseReceivedL
+// This function ralizes an interface. Functionality is located in separate 
+// handler class.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVControlPoint::ActionResponseReceivedL(CUpnpAction* aAction)
+    {
+    TInt err = iActionResponseHandler->ActionResponseReceived( aAction );
+#ifdef _DEBUG
+    if (err != KErrNone)
+        {
+        LOGS("Error in action response received.");
+        }
+#endif //_DEBUG
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::HttpResponseReceivedL
+// This function implements an inteface and notifies an observer.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVControlPoint::HttpResponseReceivedL(CUpnpHttpMessage* aMessage)
+    {    
+    iAVControlPointObserver.HttpResponseL( aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::Service
+// This function returns a pointer to appropriate service instance.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpService* CUpnpAVControlPoint::Service( CUpnpDevice* aMediaServer, 
+                                    const TDesC8& aServiceType )
+    {
+    RPointerArray<CUpnpService>& services = aMediaServer->ServiceList();
+    
+    for( TInt i(0); i < services.Count(); i++ )
+        {
+        if( services[i]->ServiceType().Match( aServiceType ) != KErrNotFound )
+            {
+            return services[i];
+            }
+        }
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtSetTransportUriActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtSetTransportUriActionL(const TDesC8& aUuid,
+                                                 TInt aInstanceId,
+                                                 const TDesC8& aCurrentUri,
+                                                 const TDesC8& aCurrentMetaData)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtSetTransportUriActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId,
+            aCurrentUri,
+            aCurrentMetaData
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtSetNextTransportUriActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtSetNextTransportUriActionL(
+                                                 const TDesC8& aUuid,
+                                                 TInt aInstanceId,
+                                                 const TDesC8& aNextUri,
+                                                 const TDesC8& aNextMetaData)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtSetNextTransportUriActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId,
+            aNextUri,
+            aNextMetaData
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtSeekActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtSeekActionL(const TDesC8& aUuid,
+                                      TInt aInstanceId,
+                                      const TDesC8& aUnit,
+                                      const TDesC8& aTarget)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtSeekActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId,
+            aUnit,
+            aTarget
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtMediaInfoActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtMediaInfoActionL(const TDesC8& aUuid,
+                                           TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtMediaInfoActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtTransportInfoActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtTransportInfoActionL(const TDesC8& aUuid,
+                                               TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtTransportInfoActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtPositionInfoActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtPositionInfoActionL(const TDesC8& aUuid,
+                                              TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtPositionInfoActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtDeviceCapabilitiesActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtDeviceCapabilitiesActionL(const TDesC8& aUuid,
+                                                    TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtDeviceCapabilitiesActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtTransportSettingsActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtTransportSettingsActionL(const TDesC8& aUuid,
+                                                   TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtTransportSettingsActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtStopActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtStopActionL(const TDesC8& aUuid,
+                                      TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtStopActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtPlayActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtPlayActionL(const TDesC8& aUuid,
+                                      TInt aInstanceId,
+                                      const TDesC8& aSpeed)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtPlayActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId,
+            aSpeed
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtPauseActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtPauseActionL(const TDesC8& aUuid,
+                                       TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtPauseActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtRecordActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtRecordActionL(const TDesC8& aUuid,
+                                        TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtRecordActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtNextActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtNextActionL(const TDesC8& aUuid,
+                                      TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtNextActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtPreviousActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtPreviousActionL(const TDesC8& aUuid,
+                                          TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtPreviousActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtSetPlayModeActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtSetPlayModeActionL(const TDesC8& aUuid,
+                                             TInt aInstanceId,
+                                             const TDesC8& aPlayMode)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtSetPlayModeActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId,
+            aPlayMode
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtSetRecordModeActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtSetRecordModeActionL(const TDesC8& aUuid,
+                                               TInt aInstanceId,
+                                               const TDesC8& aRecordMode)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtSetRecordModeActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId,
+            aRecordMode
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::AvtTransportsActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::AvtTransportsActionL(const TDesC8& aUuid,
+                                            TInt aInstanceId)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iAvtActionFactory->AvtTransportsActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsBrowseActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsBrowseActionL(const TDesC8& aUuid,
+                                        const TDesC8& aObjectId,
+                                        const TDesC8& aBrowseFlag,
+                                        const TDesC8& aFilter, 
+                                        TInt aStartingIndex,
+                                        TInt aRequestedCount,
+                                        const TDesC8& aSortCriteria)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsBrowseActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aObjectId,
+            aBrowseFlag,
+            aFilter,
+            aStartingIndex,
+            aRequestedCount,
+            aSortCriteria
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsSearchActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsSearchActionL(const TDesC8& aUuid,
+                                        const TDesC8& aObjectId,
+                                        const TDesC8& aSearchCriteria,
+                                        const TDesC8& aFilter, 
+                                        TInt aStartingIndex,
+                                        TInt aRequestedCount,
+                                        const TDesC8& aSortCriteria
+                                        )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsSearchActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aObjectId,
+            aSearchCriteria,
+            aFilter,
+            aStartingIndex,
+            aRequestedCount,
+            aSortCriteria
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsSystemUpdateIdActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsSystemUpdateIdActionL(const TDesC8& aUuid)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsSystemUpdateIdActionLC(
+            action,
+            (CUpnpDevice*)device
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsSearchCapabilitiesActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsSearchCapabilitiesActionL(const TDesC8& aUuid)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsSearchCapabilitiesActionLC(
+            action,
+            (CUpnpDevice*)device
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsSortCapabilitiesActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsSortCapabilitiesActionL(const TDesC8& aUuid)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsSortCapabilitiesActionLC(
+            action,
+            (CUpnpDevice*)device
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsCreateObjectActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//                                                                                               
+EXPORT_C TInt CUpnpAVControlPoint::CdsCreateObjectActionL(const TDesC8& aUuid,
+                                              const TDesC8& aId, 
+                                              const TDesC8& aElements)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsCreateObjectActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aId,
+            aElements
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsImportResourceActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsImportResourceActionL(const TDesC8& aUuid,
+                                                const TDesC8& aSourceUri, 
+                                                const TDesC8& aDestinationUri
+                                                )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsImportResourceActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aSourceUri,
+            aDestinationUri
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsExportResourceActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsExportResourceActionL(const TDesC8& aUuid,
+                                                const TDesC8& aSourceUri, 
+                                                const TDesC8& aDestinationUri )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsExportResourceActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aSourceUri,
+            aDestinationUri
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsCreateReferenceActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsCreateReferenceActionL(
+                                        const TDesC8& aUuid,
+                                        const TDesC8& aDestinationContainerId, 
+                                        const TDesC8& aSourceObjectId )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsCreateReferenceActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aDestinationContainerId,
+            aSourceObjectId
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsDeleteResourceActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsDeleteResourceActionL(const TDesC8& aUuid,
+                                                const TDesC8& aResourceUri )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsDeleteResourceActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aResourceUri
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsDestroyObjectActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsDestroyObjectActionL(const TDesC8& aUuid,
+                                               const TDesC8& aObjectId )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsDestroyObjectActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aObjectId
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsStopTransferActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsStopTransferActionL(const TDesC8& aUuid,
+                                              TInt aTransferId )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsStopTransferActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aTransferId
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsTransferProgressActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsTransferProgressActionL(const TDesC8& aUuid,
+                                                  TInt aTransferId )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsTransferProgressActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aTransferId
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CdsUpdateObjectActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CdsUpdateObjectActionL(const TDesC8& aUuid,
+                                              const TDesC8& aObjectID,
+                                              const TDesC8& aCurrentTagValue,
+                                              const TDesC8& aNewTagValue )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCdsActionFactory->CdsUpdateObjectActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aObjectID,
+            aCurrentTagValue,
+            aNewTagValue
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CmProtocolInfoActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CmProtocolInfoActionL(
+                                                        const TDesC8& aUuid)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCmActionFactory->CmProtocolInfoActionLC(
+            action,
+            (CUpnpDevice*)device
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CmCurrentConnectionsActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CmCurrentConnectionsActionL(const TDesC8& aUuid)
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCmActionFactory->CmCurrentConnectionsActionLC(
+            action,
+            (CUpnpDevice*)device
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CmPrepareConnectionActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CmPrepareConnectionActionL(
+                                          const TDesC8& aUuid,
+                                          const TDesC8& aRemoteProtocolInfo,
+                                          const TDesC8& aPeerConnectionManager,
+                                          TInt aPeerConnectionID,
+                                          const TDesC8& aDirection
+                                                  )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCmActionFactory->CmPrepareConnectionActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aRemoteProtocolInfo,
+            aPeerConnectionManager,
+            aPeerConnectionID,
+            aDirection
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CmConnectionCompleteActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CmConnectionCompleteActionL(
+                                                   const TDesC8& aUuid,
+                                                   TInt aConnectionId
+                                                   )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCmActionFactory->CmConnectionCompleteActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aConnectionId
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::CmCurrentConnectionInfoActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::CmCurrentConnectionInfoActionL(
+                                                      const TDesC8& aUuid,
+                                                      TInt aConnectionId
+                                                      )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iCmActionFactory->CmCurrentConnectionInfoActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aConnectionId
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::RcGetVolumetActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::RcGetVolumetActionL(
+                                           const TDesC8& aUuid,
+                                           TInt aInstanceID,
+                                           const TDesC8& aChannel
+                                           )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iRcActionFactory->RcGetVolumeActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceID,
+            aChannel
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::RcSetVolumetActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::RcSetVolumetActionL(
+                                           const TDesC8& aUuid,
+                                           TInt aInstanceId,
+                                           const TDesC8& aChannel,
+                                           TInt aVolume
+                                           )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iRcActionFactory->RcSetVolumeActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId,
+            aChannel,
+            aVolume
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::RcGetMuteActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::RcGetMuteActionL(
+                                        const TDesC8& aUuid,
+                                        TInt aInstanceId,
+                                        const TDesC8& aChannel
+                                        )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iRcActionFactory->RcGetMuteActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId,
+            aChannel
+            );
+
+        if( err == KErrNone )
+            {
+            
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::RcSetMuteActionL
+// This function creates and sends a action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpAVControlPoint::RcSetMuteActionL(
+                                        const TDesC8& aUuid,
+                                        TInt aInstanceId,
+                                        const TDesC8& aChannel,
+                                        const TDesC8& aMute
+                                        )
+    {
+    const CUpnpDevice* device = Device( aUuid );
+    if( !device ) 
+        {
+        return KErrBadHandle;
+        }
+    else
+        {
+        CUpnpAction* action = NULL;
+        TInt err( KErrNone );
+        err = iRcActionFactory->RcSetMuteActionLC(
+            action,
+            (CUpnpDevice*)device,
+            aInstanceId,
+            aChannel,
+            aMute
+            );
+
+        if( err == KErrNone )
+            {
+            SendL( action );
+            CleanupStack::Pop( action );
+
+            return action->SessionId();
+            }
+        else
+            {
+            return err;
+            }
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpAVControlPoint::NetworkEvent
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAVControlPoint::NetworkEvent( CUpnpNetworkEventBase* aEvent )
+    {
+    CUpnpControlPoint::NetworkEvent( aEvent );                
+    TRAP_IGNORE( SearchL( UpnpSSDP::KUPnPRootDevice ) );
+    }    
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/src/upnpavtactionfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,595 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Produces avt actions
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpavtactionfactory.h"
+#include "upnpavcontrolpoint.h"
+#include "upnpavcpstring.h"
+
+// CONSTANTS
+using namespace UpnpAVCPStrings;
+const TInt KMaxIntLength = 10;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::CUpnpAvtActionFactory
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpAvtActionFactory::CUpnpAvtActionFactory( MUpnpAVControlPointObserver& aAVCPObserver,
+                                     CUpnpAVControlPoint& aAVCP )
+:iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAvtActionFactory::ConstructL() 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAvtActionFactory* CUpnpAvtActionFactory::NewL( 
+                                      MUpnpAVControlPointObserver& aAVCPObserver,
+                                      CUpnpAVControlPoint& aAVCP )
+    {
+    CUpnpAvtActionFactory* self = new (ELeave) CUpnpAvtActionFactory( 
+        aAVCPObserver,
+        aAVCP );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::~CUpnpAvtActionFactory
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpAvtActionFactory::~CUpnpAvtActionFactory()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtSetTransportUriActionLC
+// Creates an action for setting URI for transport.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtSetTransportUriActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId,
+                                            const TDesC8& aCurrentUri,
+                                            const TDesC8& aCurrentMetaData)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KSetAVTransportURI );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        aAction->SetArgumentL( KCurrentURI, aCurrentUri );
+        aAction->SetArgumentL( KCurrentURIMetaData, aCurrentMetaData );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtSetNextTransportUriActionLC
+// Creates an action for setting URI for next transport.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtSetNextTransportUriActionLC(
+                                                   CUpnpAction*& aAction,
+                                                    CUpnpDevice* aMediaRenderer,
+                                                    TInt aInstanceId,
+                                                    const TDesC8& aNextUri,
+                                                    const TDesC8& aNextMetaData)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KSetNextAVTransportURI );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        aAction->SetArgumentL( KNextURI, aNextUri );
+        aAction->SetArgumentL( KNextURIMetaData, aNextMetaData );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtSeekActionLC
+// Creates an action for seeking through the resource.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtSeekActionLC(CUpnpAction*& aAction,
+                                        CUpnpDevice* aMediaRenderer,
+                                        TInt aInstanceId,
+                                        const TDesC8& aUnit,
+                                        const TDesC8& aTarget)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KSeek );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        aAction->SetArgumentL( KUnit, aUnit );
+        aAction->SetArgumentL( KTarget, aTarget );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtMediaInfoActionLC
+// Creates an action for gettin media info.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtMediaInfoActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KGetMediaInfo );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtTransportInfoActionLC
+// Creates an action for gettting transport info.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtTransportInfoActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+    
+    aAction = service->CreateActionLC( KGetTransportInfo );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtPositionInfoActionLC
+// Creates an action for getting position info.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtPositionInfoActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KGetPositionInfo );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtDeviceCapabilitiesActionLC
+// Creates an action for getting device capabilities.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtDeviceCapabilitiesActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KGetDeviceCapabilities );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtTransportSettingsActionLC
+// Creates an action for getting transport settings.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtTransportSettingsActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KGetTransportSettings );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtStopActionLC
+// Creates an action for stopping transport.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtStopActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KStop );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtPlayActionLC
+// Creates an action for playing.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtPlayActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId,
+                                            const TDesC8& aSpeed)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KPlay );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        aAction->SetArgumentL( KSpeed, aSpeed );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtPauseActionLC
+// Creates an action for pause.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtPauseActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KPause );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtRecordActionLC
+// Creates an action for recording.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtRecordActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KRecord );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtNextActionLC
+// Creates an action for playing next item.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtNextActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KNext );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtPreviousActionLC
+// Creates an action for palying previous item.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtPreviousActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KPrevious );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtSetPlayModeActionLC
+// Creates an action for setting playmode.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtSetPlayModeActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId,
+                                            const TDesC8& aPlayMode)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KSetPlayMode );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        aAction->SetArgumentL( KNewPlayMode, aPlayMode );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtSetRecordModeActionLC
+// Creates an action for setting record quality mode.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtSetRecordModeActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId,
+                                            const TDesC8& aRecordMode)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KSetRecordQualityMode );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        aAction->SetArgumentL( KNewRecordQualityMode, aRecordMode );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAvtActionFactory::AvtTransportsActionLC
+// Creates an action for getting current transports info.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAvtActionFactory::AvtTransportsActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaRenderer,
+                                            TInt aInstanceId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceId );
+
+    aAction = service->CreateActionLC( KGetCurrentTransportActions );
+    if( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID, instanceId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/src/upnpcdsactionfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,507 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Produces cds actions
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpcdsactionfactory.h"
+#include "upnpavcontrolpoint.h"
+
+#include "upnpavcpstring.h"
+
+// CONSTANTS
+using namespace UpnpAVCPStrings;
+const TInt KMaxIntLength = 10;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CUpnpCdsActionFactory
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpCdsActionFactory::CUpnpCdsActionFactory( MUpnpAVControlPointObserver& aAVCPObserver,
+                                     CUpnpAVControlPoint& aAVCP )
+:iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdsActionFactory::ConstructL() 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCdsActionFactory* CUpnpCdsActionFactory::NewL( 
+                                        MUpnpAVControlPointObserver& aAVCPObserver,
+                                        CUpnpAVControlPoint& aAVCP )
+    {
+    CUpnpCdsActionFactory* self = new (ELeave) CUpnpCdsActionFactory( 
+        aAVCPObserver, 
+        aAVCP );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::~CUpnpCdsActionFactory
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpCdsActionFactory::~CUpnpCdsActionFactory()	
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsBrowseActionLC
+// Creates a browsing action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsBrowseActionLC(CUpnpAction*& aAction,
+                                       CUpnpDevice* aMediaServer,
+                                       const TDesC8& aObjectId,
+                                       const TDesC8& aBrowseFlag,
+                                       const TDesC8& aFilter, 
+                                       TInt aStartingIndex,
+                                       TInt aRequestedCount,
+                                       const TDesC8& aSortCriteria)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC(KBrowse);
+   
+    if( aAction )
+        {
+        TBuf8<KMaxIntLength> startingIndexDes;
+        startingIndexDes.Num(aStartingIndex);
+        TBuf8<KMaxIntLength> requestedCount;
+        requestedCount.Num( aRequestedCount );
+
+        aAction->SetArgumentL( KObjectID(), aObjectId );
+        aAction->SetArgumentL( KBrowseFlag(), aBrowseFlag ); 
+        aAction->SetArgumentL( KFilter(), aFilter ); 
+        aAction->SetArgumentL( KStartingIndex(), startingIndexDes ); 
+        aAction->SetArgumentL( KRequestedCount(), requestedCount ); 
+        aAction->SetArgumentL( KSortCriteria(), aSortCriteria ); 
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsSearchActionLC
+// Creates a search action.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsSearchActionLC(CUpnpAction*& aAction,
+                                       CUpnpDevice* aMediaServer,
+                                       const TDesC8& aObjectId,
+                                       const TDesC8& aSearchCriteria,
+                                       const TDesC8& aFilter, 
+                                       TInt aStartingIndex,
+                                       TInt aRequestedCount,
+                                       const TDesC8& aSortCriteria)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC(KSearch);
+    
+    if( aAction )
+        {
+        TBuf8<KMaxIntLength> startingIndexDes;
+        startingIndexDes.Num(aStartingIndex);
+        TBuf8<KMaxIntLength> requestedCount;
+        requestedCount.Num( aRequestedCount );
+
+        aAction->SetArgumentL( KContainerID(), aObjectId );
+        aAction->SetArgumentL( KSearchCriteria(), aSearchCriteria ); 
+        aAction->SetArgumentL( KFilter(), aFilter ); 
+        aAction->SetArgumentL( KStartingIndex(), startingIndexDes ); 
+        aAction->SetArgumentL( KRequestedCount(), requestedCount ); 
+        aAction->SetArgumentL( KSortCriteria(), aSortCriteria ); 
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsSystemUpdateIdActionLC
+// Creates an action for content directory systemUpdateID query.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsSystemUpdateIdActionLC(CUpnpAction*& aAction,
+                                                  CUpnpDevice* aMediaServer)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KGetSystemUpdateID );
+
+    if( aAction )
+        {
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsSearchCapabilitiesActionLC
+// Creates an action for content directory systemUpdateID query.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsSearchCapabilitiesActionLC(CUpnpAction*& aAction,
+                                                      CUpnpDevice* aMediaServer)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KGetSearchCapabilities );
+
+    if( aAction )
+        {
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsSortCapabilitiesActionLC
+// Creates an action for content directory systemUpdateID query.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsSortCapabilitiesActionLC(CUpnpAction*& aAction,
+                                                    CUpnpDevice* aMediaServer)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KGetSortCapabilities );
+
+    if( aAction )
+        {
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsCreateObjectActionLC
+// Creates an action for creating new content in content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsCreateObjectActionLC(CUpnpAction*& aAction,
+                                             CUpnpDevice* aMediaServer,
+                                             const TDesC8& aId, 
+                                             const TDesC8& aElements)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KCreateObject );
+
+    if( aAction )
+        {
+        aAction->SetArgumentL( KContainerID, aId );
+        aAction->SetArgumentL( KElements, aElements);
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsImportResourceActionLC
+// Creates an action for importing content in content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsImportResourceActionLC(CUpnpAction*& aAction,
+                                               CUpnpDevice* aMediaServer,
+                                               const TDesC8& aSourceUri, 
+                                               const TDesC8& aDestinationUri)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KImportResource );
+
+    if( aAction )
+        {
+        aAction->SetArgumentL( KSourceURI, aSourceUri );
+        aAction->SetArgumentL( KDestinationURI, aDestinationUri);
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsExportResourceActionLC
+// Creates an action for exporting content in content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsExportResourceActionLC(CUpnpAction*& aAction,
+                                               CUpnpDevice* aMediaServer,
+                                               const TDesC8& aSourceUri, 
+                                               const TDesC8& aDestinationUri)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KExportResource );
+
+    if( aAction )
+        {
+        aAction->SetArgumentL( KSourceURI, aSourceUri );
+        aAction->SetArgumentL( KDestinationURI, aDestinationUri);
+
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsCreateReferenceActionLC
+// Creates an action for exporting content in content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsCreateReferenceActionLC(
+                                        CUpnpAction*& aAction,
+                                        CUpnpDevice* aMediaServer,
+                                        const TDesC8& aDestinationContainerId, 
+                                        const TDesC8& aSourceObjectId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KCreateReference );
+
+    if( aAction )
+        {
+        aAction->SetArgumentL( KContainerID, aDestinationContainerId );
+        aAction->SetArgumentL( KObjectID, aSourceObjectId);
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsDestroyObjectActionLC
+// Creates an action for destroying object from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsDestroyObjectActionLC(CUpnpAction*& aAction,
+                                             CUpnpDevice* aMediaServer,
+                                             const TDesC8& aObjectId)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KDestroyObject );
+
+    if( aAction )
+        {
+        aAction->SetArgumentL( KObjectID, aObjectId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsDeleteResourceActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsDeleteResourceActionLC(CUpnpAction*& aAction,
+                                              CUpnpDevice* aMediaServer,
+                                              const TDesC8& aResourceUri)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KDeleteResource );
+
+    if( aAction )
+        {
+        aAction->SetArgumentL( KResourceURI, aResourceUri );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsStopTransferActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsStopTransferActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaServer,
+                                            TInt aTransferId)
+    {
+   	TBuf8<KMaxIntLength> transferIdDes;
+    transferIdDes.Num(aTransferId);
+    
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KStopTransferResource );
+
+    if( aAction )
+        {
+        aAction->SetArgumentL( KTransferID, transferIdDes );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsTransferProgressActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsTransferProgressActionLC(CUpnpAction*& aAction,
+                                                CUpnpDevice* aMediaServer,
+                                                TInt aTransferId)
+    {
+   	TBuf8<KMaxIntLength> transferIdDes;
+    transferIdDes.Num(aTransferId);
+    
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KGetTransferProgress );
+
+    if( aAction )
+        {
+        aAction->SetArgumentL( KTransferID, transferIdDes );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::CdsUpdateObjectActionLC
+// Creates an action for updating objects in content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCdsActionFactory::CdsUpdateObjectActionLC(
+                                            CUpnpAction*& aAction,
+                                            CUpnpDevice* aMediaServer,
+                                            const TDesC8& aObjectID,
+                                            const TDesC8& aCurrentTagValue,
+                                            const TDesC8& aNewTagValue)
+    {
+    CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+
+    aAction = service->CreateActionLC( KUpdateObject );
+
+    if( aAction )
+        {
+   	    aAction->SetArgumentL( KObjectID, aObjectID );
+	    aAction->SetArgumentL( KCurrentTagValue, aCurrentTagValue );
+	    aAction->SetArgumentL( KNewTagValue, aNewTagValue );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/src/upnpcmactionfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,226 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Produces cm actions
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpcmactionfactory.h"
+#include "upnpavcontrolpoint.h"
+#include "upnpavcpstring.h"
+
+// CONSTANTS
+using namespace UpnpAVCPStrings;
+const TInt KMaxIntLength = 10;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CUpnpCmActionFactory::CUpnpCmActionFactory
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpCmActionFactory::CUpnpCmActionFactory( MUpnpAVControlPointObserver& aAVCPObserver,
+                                   CUpnpAVControlPoint& aAVCP )
+:iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCmActionFactory::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpCmActionFactory::ConstructL() 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCmActionFactory::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCmActionFactory* CUpnpCmActionFactory::NewL( 
+                                      MUpnpAVControlPointObserver& aAVCPObserver,
+                                      CUpnpAVControlPoint& aAVCP )
+    {
+    CUpnpCmActionFactory* self = new (ELeave) CUpnpCmActionFactory( 
+        aAVCPObserver,
+        aAVCP );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCmActionFactory::~CUpnpCmActionFactory
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCmActionFactory::~CUpnpCmActionFactory()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCmActionFactory::CmProtocolInfoActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCmActionFactory::CmProtocolInfoActionLC(CUpnpAction*& aAction,
+                                              CUpnpDevice* aDevice)
+    {
+    CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KGetProtocolInfo );
+
+    if( aAction )
+        {
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }             
+// -----------------------------------------------------------------------------
+// CUpnpCmActionFactory::CmCurrentConnectionsActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCmActionFactory::CmCurrentConnectionsActionLC(CUpnpAction*& aAction,
+                                                    CUpnpDevice* aDevice)
+    {
+    CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KGetCurrentConnectionIDs );
+
+    if( aAction )
+        {
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+ // -----------------------------------------------------------------------------
+// CUpnpCmActionFactory::CmPrepareConnectionActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCmActionFactory::CmPrepareConnectionActionLC(
+                                           CUpnpAction*& aAction,
+                                           CUpnpDevice* aDevice,
+                                           const TDesC8& aRemoteProtocolInfo,
+                                           const TDesC8& aPeerConnectionManager,
+										   TInt aPeerConnectionID,
+                                           const TDesC8& aDirection
+                                           )
+    {
+    CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+   	TBuf8<KMaxIntLength> conId;
+	conId.Num( aPeerConnectionID );
+    aAction = service->CreateActionLC( KPrepareForConnection );
+
+    if( aAction )
+        {
+        aAction->SetArgumentL( KRemoteProtocolInfo(), aRemoteProtocolInfo );
+	    aAction->SetArgumentL( KPeerConnectionManager(), aPeerConnectionManager );
+	    aAction->SetArgumentL( KPeerConnectionID(), conId );
+	    aAction->SetArgumentL( KDirection(), aDirection );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCmActionFactory::CmConnectionCompleteActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCmActionFactory::CmConnectionCompleteActionLC(CUpnpAction*& aAction, 
+                                                    CUpnpDevice* aDevice,
+                                                    TInt aConnectionId)
+    {
+    CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KConnectionComplete );
+
+    if( aAction )
+        {
+   	    TBuf8<KMaxIntLength> connectionId;
+	    connectionId.Num(aConnectionId);
+        aAction->SetArgumentL( KConnectionID, connectionId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCmActionFactory::CmCurrentConnectionInfoActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpCmActionFactory::CmCurrentConnectionInfoActionLC(CUpnpAction*& aAction, 
+                                                    CUpnpDevice* aDevice,
+                                                    TInt aConnectionId)
+    {
+    CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    aAction = service->CreateActionLC( KGetCurrentConnectionInfo );
+    
+    if( aAction )
+        {
+   	    TBuf8<KMaxIntLength> connectionId;
+	    connectionId.Num(aConnectionId);
+        aAction->SetArgumentL( KConnectionID, connectionId );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/src/upnprcactionfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,215 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Produces rc actions
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnprcactionfactory.h"
+#include "upnpavcontrolpoint.h"
+#include "upnpavcpstring.h"
+
+// CONSTANTS
+using namespace UpnpAVCPStrings;
+const TInt KMaxIntLength = 10;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CUpnpRcActionFactory::CUpnpRcActionFactory
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpRcActionFactory::CUpnpRcActionFactory( MUpnpAVControlPointObserver& aAVCPObserver,
+                                   CUpnpAVControlPoint& aAVCP )
+:iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpRcActionFactory::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpRcActionFactory::ConstructL() 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSuperDir::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpRcActionFactory* CUpnpRcActionFactory::NewL(
+                                      MUpnpAVControlPointObserver& aAVCPObserver,
+                                      CUpnpAVControlPoint& aAVCP )
+    {
+    CUpnpRcActionFactory* self = new (ELeave) CUpnpRcActionFactory( 
+        aAVCPObserver,
+        aAVCP );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpRcActionFactory::~CUpnpRcActionFactory
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpRcActionFactory::~CUpnpRcActionFactory()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpRcActionFactory::RcGetVolumeActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpRcActionFactory::RcGetVolumeActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aDevice,
+                                            TInt aInstanceID,
+                                            const TDesC8& aChannel)
+    {
+    CUpnpService* service = iAVCP.Service(aDevice, KRenderingControl);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceID );
+
+    aAction = service->CreateActionLC( KGetVolume );
+    
+    if ( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID(), instanceId );
+	    aAction->SetArgumentL( KChannel(), aChannel );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpRcActionFactory::RcSetVolumeActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpRcActionFactory::RcSetVolumeActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aDevice,
+                                            TInt aInstanceID,
+                                            const TDesC8& aChannel,
+                                            TInt aVolume)
+    {
+    CUpnpService* service = iAVCP.Service(aDevice, KRenderingControl);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceID );
+	TBuf8<KMaxIntLength> volume;
+	volume.Num( aVolume );
+
+    aAction = service->CreateActionLC( KSetVolume );
+    
+    if ( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID(), instanceId );
+        aAction->SetArgumentL( KChannel(), aChannel );
+        aAction->SetArgumentL( KDesiredVolume(), volume );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::RcGetMuteActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpRcActionFactory::RcGetMuteActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aDevice,
+                                            TInt aInstanceID,
+                                            const TDesC8& aChannel)
+    {
+    CUpnpService* service = iAVCP.Service(aDevice, KRenderingControl);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceID );
+
+    aAction = service->CreateActionLC( KGetMute );
+
+    if ( aAction )
+        {
+        aAction->SetArgumentL( KInstanceID(), instanceId );
+        aAction->SetArgumentL( KChannel(), aChannel );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpCdsActionFactory::RcSetMuteActionLC
+// Creates an action for deleting resource from content directory.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpRcActionFactory::RcSetMuteActionLC(CUpnpAction*& aAction,
+                                            CUpnpDevice* aDevice,
+                                            TInt aInstanceID,
+                                            const TDesC8& aChannel,
+                                            const TDesC8& aMute)
+    {
+    CUpnpService* service = iAVCP.Service(aDevice, KRenderingControl);
+    if( !service )
+        {
+        return KErrUnknown;
+        }
+    TBuf8<KMaxIntLength> instanceId;
+	instanceId.Num( aInstanceID );
+
+    aAction = service->CreateActionLC( KSetMute );
+	
+    if ( aAction )
+	    {
+        aAction->SetArgumentL( KInstanceID(), instanceId );
+        aAction->SetArgumentL( KChannel(), aChannel );
+        aAction->SetArgumentL( KDesiredMute(), aMute );
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcontrolframework/src/upnpstateupdatehandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,248 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpStateUpdateHandler
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpstateupdatehandler.h"
+#include "upnpavcpstring.h"
+
+// CONSTANTS
+using namespace UpnpAVCPStrings;
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CUpnpStateUpdateHandler::CUpnpStateUpdateHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpStateUpdateHandler::CUpnpStateUpdateHandler( 
+                                         MUpnpAVControlPointObserver& aAVCPObserver,
+                                         CUpnpAVControlPoint& aAVCP )
+    :iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP )
+    {
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpStateUpdateHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpStateUpdateHandler::ConstructL() 
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CSuperDir::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpStateUpdateHandler* CUpnpStateUpdateHandler::NewL(
+            MUpnpAVControlPointObserver& aAVCPObserver,
+            CUpnpAVControlPoint& aAVCP )
+    {
+	CUpnpStateUpdateHandler* self = new (ELeave) CUpnpStateUpdateHandler( 
+        aAVCPObserver, aAVCP );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpStateUpdateHandler::~CUpnpStateUpdateHandler
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpStateUpdateHandler::~CUpnpStateUpdateHandler()	
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpStateUpdateHandler::ContentDirectoryStateUpdated
+// In this function are update events from content directory handled.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpStateUpdateHandler::ContentDirectoryStateUpdated( CUpnpDevice& aDevice, 
+                                                   CUpnpService*& aService)
+    {
+    CUpnpStateVariable* systemUpdateId = 
+        aService->StateVariable( KSystemUpdateID );
+    CUpnpStateVariable* containerUpdateIds = 
+        aService->StateVariable( KContainerUpdateIDs );
+    CUpnpStateVariable* transferIds = 
+        aService->StateVariable( KTransferIds );       
+
+    if( !(systemUpdateId || containerUpdateIds || transferIds) )
+        {
+        return KErrArgument;
+        }
+        
+    //
+    if( systemUpdateId )
+        {
+        TLex8 updateidLex( systemUpdateId->Value() );
+        TInt systemUpdate;
+        updateidLex.Val( systemUpdate );
+        iAVControlPointObserver.CdsUpdateEvent(
+            aDevice.Uuid(),
+            systemUpdate
+            );
+        }
+    if( containerUpdateIds )
+        {
+        iAVControlPointObserver.CdsContainerEvent( 
+            aDevice.Uuid(),
+            containerUpdateIds->Value() 
+            );
+        }
+    if( transferIds )
+        {
+        iAVControlPointObserver.CdsTransferEvent( 
+            aDevice.Uuid(),
+            transferIds->Value() 
+            );
+        }
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpStateUpdateHandler::StateUpdatedL
+// This is the place to start handling state updates
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpStateUpdateHandler::StateUpdated(CUpnpService*& aService)
+	{
+    TInt err( KErrNone );
+	CUpnpDevice& device = aService->Device();
+    if (aService->ServiceType().Match( KRenderingControl ) != KErrNotFound )
+        {
+        err =  RenderingControlStateUpdated( device, aService );
+        }
+    else if (aService->ServiceType().Match( KConnectionManager ) != KErrNotFound )
+        {
+        err = ConnectionManagerStateUpdated( device, aService );
+        }
+    else if (aService->ServiceType().Match( KAVTransport ) != KErrNotFound )
+        {
+        err = AVTransportStateUpdated( device, aService );        
+        }
+    else if (aService->ServiceType().Match( KContentDirectory ) != KErrNotFound )
+        {
+        err = ContentDirectoryStateUpdated( device, aService );        
+        }
+    else
+        {
+        err = KErrGeneral;
+        }
+    return err;
+
+    }
+// -----------------------------------------------------------------------------
+// CUpnpStateUpdateHandler::RenderingControlStateUpdated
+// In this function are rendering control events are handled.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpStateUpdateHandler::RenderingControlStateUpdated( CUpnpDevice& aDevice,
+                                                        CUpnpService*& aService )
+    {
+    CUpnpStateVariable* lastChange = aService->StateVariable( KLastChange );
+    if( !lastChange )
+        {
+        return KErrArgument;
+        }
+    else
+        {
+        iAVControlPointObserver.RcLastChangeEvent(
+            aDevice.Uuid(),
+            lastChange->Value() 
+            );
+        return KErrNone;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpStateUpdateHandler::KAVTransportStateUpdatedL
+// In this function are updates for mediarenderer handled.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpStateUpdateHandler::AVTransportStateUpdated( CUpnpDevice& aDevice,
+                                                   CUpnpService*& aService )
+    {
+    CUpnpStateVariable* lastChange = aService->StateVariable( KLastChange );
+    if( !lastChange )
+        {
+        return KErrArgument;
+        }
+    else
+        {
+        iAVControlPointObserver.AvtLastChangeEvent(
+            aDevice.Uuid(),
+            lastChange->Value() 
+            );
+        return KErrNone;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpStateUpdateHandler::ConnectionManagerStateUpdated
+// In this function are update events from rendering control handled.
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpStateUpdateHandler::ConnectionManagerStateUpdated(CUpnpDevice& aDevice, 
+                                                        CUpnpService*& aService)
+    {
+    CUpnpStateVariable* source = 
+        aService->StateVariable( KSourceProtocolInfo );
+    CUpnpStateVariable* sink = 
+        aService->StateVariable( KSinkProtocolInfo );
+    CUpnpStateVariable* connections = 
+        aService->StateVariable( KCurrentConnectionIds );       
+    
+    if( !(source || sink || connections) )
+        {
+        return KErrArgument;
+        }
+        
+    if( source )
+        {
+        iAVControlPointObserver.CmSourceEvent(
+            aDevice.Uuid(),
+            source->Value()
+            );
+        }
+    if( sink )
+        {
+        iAVControlPointObserver.CmSinkEvent( 
+            aDevice.Uuid(),
+            sink->Value() 
+            );
+        }
+    if( connections )
+        {
+        iAVControlPointObserver.CmConnectionsEvent( 
+            aDevice.Uuid(),
+            connections->Value() 
+            );
+        }
+
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/group/avcpengine.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,71 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification for AVCPEngine
+*
+*/
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET          avcpengine.exe
+TARGETTYPE      exe
+UID             0x1000008d 0x101F977A
+CAPABILITY      CAP_SERVER
+VENDORID        VID_DEFAULT
+
+VERSION         10.1
+paged
+
+SOURCEPATH      ../src
+SOURCE          upnpavcpenginesession.cpp
+SOURCE          upnpavcpengine.cpp
+SOURCE          upnpavcpenginehelper.cpp
+SOURCE          upnpavcpmanager.cpp
+SOURCE          upnppathelement.cpp
+SOURCE          upnppathresolver.cpp
+SOURCE          upnpresolvehandler.cpp
+SOURCE          upnpcommand.cpp
+SOURCE          upnpbrowsecommand.cpp
+SOURCE          upnpdevicelistcommand.cpp
+SOURCE          upnpdownloadcommand.cpp
+SOURCE          upnpuploadcommand.cpp
+SOURCE          upnpdeletecommand.cpp
+SOURCE          upnpcreatecommand.cpp
+SOURCE          upnpmetadatacommand.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../inc
+USERINCLUDE   ../../inc
+USERINCLUDE     ../inc
+
+LIBRARY         euser.lib
+LIBRARY         insock.lib
+LIBRARY         esock.lib
+LIBRARY         upnpipserversutils.lib
+LIBRARY         ssdpserver.lib
+LIBRARY         avcontrolframework.lib
+LIBRARY         upnpserviceframework.lib
+LIBRARY         upnpcontrolpointbase.lib
+
+//XML
+LIBRARY         xmlengineutils.lib
+LIBRARY         xmlenginedom.lib
+LIBRARY         estlib.lib 
+
+// file server
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+
+LIBRARY         flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,25 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for AVCPEngine
+*
+*/
+
+#include "../../../group/upnpplatformvar.hrh"
+PRJ_EXPORTS
+../inc/upnpmdebug.h             |../../inc/upnpmdebug.h
+../inc/upnpavcpenginecommon.h   MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcpenginecommon.h)
+../inc/upnpavcpenginecommon.inl MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcpenginecommon.inl)
+
+PRJ_MMPFILES
+avcpengine.mmp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpavcpengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,111 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of CServer2
+*
+*/
+
+
+#ifndef C_CUPNPAVCPENGINE_H
+#define C_CUPNPAVCPENGINE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpavcpengine.pan"
+
+// FORWARD DECLARATIONS
+class CUpnpAVCPEngineSession;
+class CUpnpAVCPManager;
+
+// CLASS DECLARATION
+/**
+*  Simple imlementatation of server from 
+* Symbian Client/Server architecture.
+*
+*  @since Series 60 3.1
+*/
+class CUpnpAVCPEngine: public CServer2
+    {
+	public :
+		/**
+		* Two-phased constructor.
+		*/	
+		static CUpnpAVCPEngine* NewLC();
+		/**
+		* Destructor.
+		*/			
+		~CUpnpAVCPEngine();
+		/**
+		* Register new server-side session 
+		* it is used for manage life-time of server
+		*/
+		void IncrementSessions(CUpnpAVCPEngineSession* aObserver);
+		/**
+		* Unregister new server-side session
+		* it is used for manage life-time of server		
+		*/	
+		void DecrementSessions(CUpnpAVCPEngineSession* aObserver);
+		/**
+		* Function stars server, creates CleanupStack and
+		* executes ThreadFunctionL() in TRAP
+		*/
+		static TInt ThreadFunction( TAny* aStarted );
+		/**
+		* Function creates CActiveScheduler, CUpnpAVCPEngine and starts server.
+		*/
+		static void ThreadFunctionL();
+	
+	protected:  // From CActive
+		/**
+		* From CActive notify about leaves in CService2::ServiceL
+		*/
+		TInt RunError( TInt aError );
+	
+	private: // New methods
+		/**
+		* C++ default constructor.
+		*/			
+		CUpnpAVCPEngine( TInt aPriority );
+		/**
+		* Symbian 2nd phase constructor.
+		*/		
+		void ConstructL() ;
+		/**
+		* Panic client thread
+		*
+		* @param aMessage message to be panic
+		* @param aReason panic code
+		*/
+		static void PanicClient( const RMessage2& aMessage, TAVCPEnginePanic aReason );
+		/**
+		* Panic server
+		*
+		* @param aPanic panic code
+		*/
+		static void PanicServer( TAVCPEnginePanic aPanic );
+	
+	private: // From CServer
+		/**
+		* From CActive notify about leaves in ServiceL
+		*/	
+		CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const;
+			
+	private: // Data
+		// count of session 
+		TInt        iSessionCount;
+		// AVCP manager
+		CUpnpAVCPManager* iAVCPManger;
+    };
+
+
+#endif  // C_CUPNPAVCPENGINE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpavcpengine.pan	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,31 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition of AVCPEngine panic codes
+*
+*/
+
+
+#ifndef AVCPENGINE_PAN
+#define AVCPENGINE_PAN
+
+/** Panic Category */
+_LIT(KAVCPEngine, "AVCPEngine");
+
+/** AVCPEngine panic codes */
+enum TAVCPEnginePanic
+    {
+    EAVCPEngineGenerealPanic = 0,
+    EAVCPEngineBadRequest = 1    
+    };
+#endif // AVCPENGINE_PAN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpavcpenginecommon.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common data
+*
+*/
+
+
+#ifndef C_UPNPAVCPENGINECOMMON_H
+#define C_UPNPAVCPENGINECOMMON_H
+
+//INCLUDES
+#include <e32base.h>
+
+
+// CONSTANTS
+// Server name
+_LIT( KAVCPEngineName,     "AVCPEngine" );
+// Filename
+_LIT( KAVCPEngineFilename, "AVCPEngine" );
+
+_LIT8( KAVCPEngineFriendlyName, "friendlyName" ); 
+
+
+// The server version. A version must be specified when 
+// creating a session with the server
+const TUint KAVCPEngineMajorVersionNumber=0;
+const TUint KAVCPEngineMinorVersionNumber=1;
+const TUint KAVCPEngineBuildVersionNumber=1;
+
+// ENUMERATIONS
+
+// Operation codes used in message passing between client and server
+enum TAVCPEngineRqst
+	{
+	EPrepareDeviceList,
+	EDownloadDeviceList,
+	EPrepareDirList,
+	EDownloadDirList,
+	EDirAttributes,
+	EFileAttributes,
+	EGetFile,
+	EDeleteDirectory,
+	EDeleteFile,
+	ECreateDirectory,
+	ECreateFile,
+	EPutFile, 
+	EPrepareMetadata,
+	EDownloadMetadata,	
+	ESetMetadata	
+    };
+
+// maximum length of UDN
+const TInt KUUIDLength = 50;
+// maximum length of friendly-name
+const TInt KFriendlyNameLength = 50;
+// maximum length of mime type
+const TInt KMimeLength = 100;
+
+// structure describing MS device
+class TAVDevice
+    {
+    public:        
+    	TBuf8<KFriendlyNameLength> iFriendlyName;    	    
+    	TBuf8<KUUIDLength> iUDN;
+    };
+// structure describing position in file, used for partial read
+class TFilePosition
+    {
+    public:        
+    	TInt iStart;    	    
+    	TInt iLength;
+    	TBool iFlags;
+    };
+
+// structure describing file/directory
+class TFileInfo
+    {
+    public: 
+    	inline TFileInfo(); 
+    	// file/directory name
+    	TBuf8<KMaxFileName> iName;        
+		// MIME type      
+		TBuf8<KMimeLength> iMimeType;     	
+		// attribute bits
+		TUint iAtt;
+		// file size in bytes        
+		TInt iSize;      
+		// last modified         
+		TTime iModified; 
+    };
+
+#include "upnpavcpenginecommon.inl"
+
+#endif // C_UPNPAVCPENGINECOMMON_H
+
+// End Of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpavcpenginecommon.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,27 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+
+
+inline TFileInfo::TFileInfo() 
+   	{
+   	iAtt = 0;
+   	iSize = 0;
+   	iModified.UniversalTime();
+   	}    
+
+
+// End Of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpavcpenginehelper.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,95 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  helper class 
+*
+*/
+
+
+#ifndef C_UPNPAVCPENGINEHELPER_H
+#define C_UPNPAVCPENGINEHELPER_H
+
+#include <e32base.h>
+#include "upnpmdebug.h"
+
+namespace UpnpAVCPEngine 
+	{
+
+	static const TInt KHttpGetStarted = 800;   // HTTP get started  ( port number )
+	static const TInt KHttpPostStarted = 801;  // HTTP post started ( port number )
+
+	static const TInt KRequestedCountLimit = 20; 
+    
+	_LIT8( KContentDirectory, "ContentDirectory:1" );
+        
+	_LIT8(KDefaultBrowseFilter, "res,res@protocolInfo,res@size,res@importUri,dc:date");
+        
+	_LIT8(KRootId,"0");
+	_LIT8(KRootName,"Root");
+	_LIT8(KBrowseDirectChildren, "BrowseDirectChildren");
+	_LIT8(KBrowseMetadata,     "BrowseMetadata" );
+	_LIT8(KResult, "Result");
+	_LIT8(KNumberReturned, "NumberReturned" );
+	_LIT8(KTotalMatches, "TotalMatches" );
+	_LIT8(KStartingIndex, "StartingIndex");
+	_LIT8(KRequestedCount, "RequestedCount");
+	_LIT8(KSystemUpdateID, "SystemUpdateID");
+
+	_LIT8(KContainer,"container");
+	_LIT8(KItem,"item");
+	_LIT8(KRes,"res");    
+	_LIT8(KRestricted,"restricted");    
+	_LIT8(KDate,"date");        
+	_LIT8(KTitle,"title");
+	_LIT8(KId,"id");    
+	_LIT8(KSize,"size");    
+	_LIT8(KParentId,"parentID");  
+	_LIT8(KImportUri,"importUri");    
+	_LIT8(KProtocolInfo,"protocolInfo"); 
+	_LIT8(KProtocolInfoBegin,"http-get"); 
+
+	_LIT8(KOne, "1");
+	_LIT8(KTrue, "true");
+	
+                              
+	/**
+	* Convert descriptor into integer, if some problem leaves
+	*
+	* @param aValue value to be converted
+	* @return integer value
+	*/
+	TInt StrToIntL(const TDesC8& aValue);
+	/**
+	* Get last path element from pathname.
+	* From aPath last path element will be removed
+	*
+	* @param aPath original pathname 
+	* @return last path element
+	*/  
+	HBufC8* GetLastPathElementL(TDes8& aPath);
+	/**
+	* Parse path into elements
+	*/  
+	void ParsePathToElementsL(TPtr8 aPath, RPointerArray<TPtrC8>& aArray );
+	/**
+	* Removes slashes from path
+	*
+	* @param aPath original pathname , path will be updated  
+	*/  
+	void RemoveSlashes(TDes8& aPath);
+                       
+	}
+
+#endif // C_UPNPAVCPENGINEHELPER_H
+
+// End Of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpavcpenginesession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,98 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of server-side session
+*
+*/
+
+
+#ifndef C_CUPNPAVCPENGINESESSION_H
+#define C_CUPNPAVCPENGINESESSION_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpavcpengine.h"
+#include "upnpavcpenginecommon.h"
+
+// FORWARD DECLARATIONS
+class CUpnpAVCPManager;
+class CUpnpCommand;
+
+// CLASS DECLARATION
+/**
+* Implementation of server-side session
+*
+*  @since Series 60 3.1
+*/
+class CUpnpAVCPEngineSession : public CSession2
+	{
+	public: // New methods
+		/**
+		* Two-phased constructor.
+		*
+		* @param aClient client thread
+		* @param aServer server
+		* @param aManager AVCP manager
+		*/	
+		static CUpnpAVCPEngineSession* NewL( const RThread& aClient, 
+			CUpnpAVCPEngine& aServer, CUpnpAVCPManager& aManager);
+		/**
+		* Destructor.
+		*/		
+		virtual ~CUpnpAVCPEngineSession();
+
+	public: // From CSession
+		/**
+		* From CSession invoked when requests from client come.
+		*/
+		void ServiceL( const RMessage2& aMessage );
+    
+	public:    
+		/**
+		* Remove command from array of active command
+		*/
+    void RemoveCommand(CUpnpCommand* aCommand);
+    /**
+    * Get index of command in array based on command id
+    */
+    TInt CommandById(TInt aId);
+
+	private: // New methods
+		/**
+		* C++ default constructor.
+		*/	
+    CUpnpAVCPEngineSession( const RThread& aClient, 
+    					    CUpnpAVCPEngine& aServer,
+                            CUpnpAVCPManager& aManager);
+		/**
+		* Symbian 2nd phase constructor.
+		*/                            
+    void ConstructL() ;
+		/**
+		* Panic client thread
+		*
+		* @param aMessage message to be panic
+		* @param aReason panic code
+		*/
+    void PanicClient( const RMessage2& aMessage, TInt aPanic ) const;
+   
+	private: // Data
+		// server 
+    CUpnpAVCPEngine& iAVCPEngine;
+    // manager 
+    CUpnpAVCPManager& iAVCPManager;
+    // list of active command
+    RPointerArray<CUpnpCommand> iCommandList;
+    };
+
+#endif //C_CUPNPAVCPENGINESESSION_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpavcpmanager.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,159 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class comunicates with MSs
+*
+*/
+
+
+#ifndef C_CUPNPAVCPMANAGER_H
+#define C_CUPNPAVCPMANAGER_H
+
+// INCLUDES
+#include "upnpavcontrolpoint.h"
+
+// FORWARD DECLARATIONS
+class MUpnpResponseHandler;
+class MUpnpHttpResponseHandler;
+class CUpnpPathResolver;
+class CUpnpAVCPEngineSession;
+
+// CLASS DECLARATION
+/**
+* Class implements (derive CUpnpAVControlPoint).
+* It provides way to send SOAP action, HTTP request, 
+* receive notification about responses also support eventing phase.
+* Additionally class keeps path resolvers for each MS (if it is needed).
+*
+*  @since Series 60 3.1
+*/
+class CUpnpAVCPManager : public CUpnpAVControlPoint
+	{	
+	public:
+		/**
+		* Two-phased constructor.
+		*/		
+		static CUpnpAVCPManager* NewL();
+		/**
+		* Destructor.
+		*/		        
+		~CUpnpAVCPManager();
+ 		/**
+		* Get unique command id
+		* 
+		* @return command id
+		*/		
+		TInt NewCommandId();
+ 		/**
+ 		* Register a observer for receive notification about SOAP responses
+ 		*
+ 		* @param aHandler class implemented observer
+ 		*/
+		void RegisterForAction(MUpnpResponseHandler& aHandler);
+ 		/**
+ 		* Register a observer for receive notification about HTTP responses
+ 		*
+ 		* @param aHandler class implemented observer
+ 		*/        
+		void RegisterForHttp(MUpnpHttpResponseHandler& aHandler);        
+ 		/**
+ 		* Unregister a observer for receive notification about HTTP responses
+ 		*
+ 		* @param aHandler class implemented observer
+ 		*/        
+		void UnregisterForHttp(MUpnpHttpResponseHandler& aHandler);                
+	    /**
+	    * Return path resolver.
+	    * If path resolver was created, return instance, otherwise create a new one, 
+	    * subsribe for events.
+	    * Parameter aSession is used for managing life time of resolver. 
+	    * if all session used resolver has been closed, resolver is doestoyed.
+	    *
+	    * @param aUUID UDN of MS
+	    * aSession server-side session
+	    */            
+		CUpnpPathResolver& PathResolverL(const TDesC8& aUUID, CUpnpAVCPEngineSession* aSession);
+	    /**
+	    * Perform cleanup after closing server-side session.
+	    * it checks whether it was the last session used resolver and
+	    * destroy resolver if it was true.
+	    */    
+		void CleanupSessionL( CUpnpAVCPEngineSession* aSession);        
+		           
+	private: 	// Method from CUpnpAVControlPoint
+		/**
+		* From CUpnpAVControlPoint handles HTTP messages.
+		* @since Series 60 2.0
+		* @param aMessage Incoming HTTP message.
+		*/
+		void HttpResponseReceivedL(CUpnpHttpMessage* aMessage);
+		/**
+		* From CUpnpAVControlPoint handles actions' responses.
+		* @since Series 60 2.0
+		* @param aMessage Incoming HTTP message.
+		*/
+		void ActionResponseReceivedL(CUpnpAction* aAction);        
+		/**
+		* From CUpnpAVControlPoint handles events (as a response for SUBSCRIBE).
+		* @since Series 60 2.0
+		* @param aMessage Incoming HTTP message.
+		*/        
+		void StateUpdatedL(CUpnpService*  aService);
+		/**
+		* From CUpnpAVControlPoint handles UPnP device discoveries.
+		* @since Series 60 2.0
+		* @param aDevice Device that is discovered.
+		*/
+		void DeviceDiscoveredL(CUpnpDevice* aDevice);
+		/**
+		* From CUpnpAVControlPoint handles UPnP device disappears.
+		* @since Series 60 2.0
+		* @param aDevice Device that disappeared.
+		*/
+		void DeviceDisappearedL(CUpnpDevice* aDevice);
+
+	private:
+		/**
+		* C++ default constructor.
+		*/	
+		CUpnpAVCPManager(MUpnpAVControlPointObserver* aObserver);
+		/**
+		* Symbian 2nd phase constructor.
+		*/		        
+		void ConstructL();       
+    /**
+    * Return index of action handler for specific session id
+    * 
+    * @return index if found, else KErrNotFound
+    */    
+		TInt HandlerBySessionId(TInt aSessionId);
+    /**
+    * Return index of HTTP handler for specific session id
+    * 
+    * @return index if found, else KErrNotFound
+    */            
+		TInt HttpHandlerBySessionId(TInt aSessionId);   
+		                          
+	private: // Data
+		// last command id
+		TInt iLastCommandId;
+		// array of observers registered for SOAP action
+		RPointerArray<MUpnpResponseHandler> iPendingHandlers;
+		// array of observer registered for HTTP response
+		RPointerArray<MUpnpHttpResponseHandler> iHttpPendingHandlers;
+		// array of path resolvers
+		RPointerArray<CUpnpPathResolver> iPathResolvers;
+    };
+
+#endif  //C_CUPNPAVCPMANAGER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpbrowsecommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,150 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class responsible for browsing in MS 
+*
+*/
+
+
+#ifndef C_CUPNPBROWSECOMMAND_H
+#define C_CUPNPBROWSECOMMAND_H
+
+//  INCLUDES
+#include "upnpcommand.h"
+#include "upnpresponsehandler.h"
+#include "upnpresolverobserver.h"
+
+
+// FORWARD DECLARATIONS
+class CUpnpPathResolver;
+
+// CLASS DECLARATION
+/**
+* Class responsible for browsing MS structure.
+* It perfroms request related to directory listings, 
+* file/directory attributes
+*
+*  @since Series 60 3.1
+*/
+class CUpnpBrowseCommand : public CUpnpCommand, public MUpnpResponseHandler, 
+                                        public MUpnpResolverObserver,
+                                        public MUpnpHttpResponseHandler
+	{
+	public:	
+		/**
+		* Two-phased constructor.
+		*
+		* @param aAVCPManager manager
+		* @param aSession server-side session
+		* @param aMessage message
+		*/	
+		static CUpnpBrowseCommand* NewL(CUpnpAVCPManager& aAVCPManager, 
+	  	CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);
+		/**
+		* Destructor.
+		*/	       
+		virtual ~CUpnpBrowseCommand();	       
+			
+	public:	// Method from CUpnpCommand
+		/**
+		* From CUpnpCommand returns session id.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		TInt SessionId();	
+		/**
+		* From CUpnpCommand implement logic for leaves that appear during InterpretL.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		void RunError(TInt aErrorCode); 				
+		/**
+		* From CUpnpCommand perfroms operation connected with command
+		* @since Series 60 3.1
+		*/							
+		void ExecuteL();
+		/**
+		* From CUpnpCommand set result from previous performed command.
+		* It sets result from directory listing.
+		* @since Series 60 3.1
+		*/	
+		void SetResultL(const RMessage2& aMessage);
+				
+	public:	// Method from observers		
+		/**
+		* From MUpnpResponseHandler, it is notified when SOAP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aAction action with attached respone
+		* @since Series 60 3.1
+		*/	
+		void InterpretL(TInt aErrorCode, CUpnpAction* aAction);
+		/**
+		* From MUpnpHttpResponseHandler, it is notified when HTTP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aMessage response message
+		* @since Series 60 3.1
+		*/			
+		void InterpretL(TInt aErrorCode, CUpnpHttpMessage* aMessage);
+		/**
+		* From MUpnpResolverObserver, it is notified after translation path into id.
+		* 
+		* @param aErrorCode error code (KErrNone if Ok)
+		* @param aIdElement object describing searched element
+		* @since Series 60 3.1
+		*/				
+		void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement);
+	   
+	private:
+		/**
+		* C++ default constructor.
+		*/
+		CUpnpBrowseCommand(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);
+		/**
+		* Symbian 2nd phase constructor.
+		*/			
+		void ConstructL();
+		/**
+		* Helper function, iterate over list to find object with fiven name.
+		* If it find correct object set its attribute to internal member of class.
+		*
+		* @param aList list infomrmation about object
+		* @param aName name of object to find
+		* @return ETrue - found, else EFalse
+		*/
+		TBool SetAttForObject(RArray<TFileInfo>& aList, const TDesC8& aName);
+		/**
+		* Prepare message with HTTP-HEAD and send it to specific address.
+		* 
+		* @param aUrl destination address 		
+		*/
+		void SendHeadRequestL(const TDesC8& aUrl); 
+
+	private:
+		// path resolver
+		CUpnpPathResolver* iPathResolver;
+		// object id taken from path specified by request				
+		HBufC8* iObjectId;
+		// object name taken from path specified by request						
+		HBufC8* iObjectName;
+		// start index, value used to not get whole browse response at once
+		TInt iStartIndex;
+		// structure used for keep information about file/directory attribute
+		TFileInfo iAttr;
+		// array of directory elements (files/directories)
+    	RArray<TFileInfo> iResult;
+};
+
+#endif // C_CUPNPBROWSECOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpcommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,128 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base class for all commands
+*
+*/
+
+
+#ifndef C_CUPNPCOMMAND_H
+#define C_CUPNPCOMMAND_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpavcpenginecommon.h"
+#include "upnpmdebug.h"
+
+// FORWARD DECLARATIONS
+class CUpnpAVCPManager;
+class CUpnpAVCPEngineSession;
+class RMessage2;
+
+// CLASS DECLARATION
+/**
+*  Base abstract class defines common set of methods for all commands
+*
+*  @since Series 60 3.1
+*/ 
+class CUpnpCommand : public CBase
+	{
+	public:  // Constructors and destructor
+		/**
+		* Two-phased constructor.
+		* Based on type of request it creates instance of relevant derived class
+		*
+		* @param aAVCPManager manager
+		* @param aSession server-side session
+		* @param aMessage message
+		*/
+		static CUpnpCommand* NewL(CUpnpAVCPManager& aAVCPManager, 
+													CUpnpAVCPEngineSession& aSession, 
+													const RMessage2& aMessage);        
+		/**
+		* Destructor.
+		*/
+		virtual ~CUpnpCommand();
+
+	public: // New functions    
+		/**
+		* Function defines operation to perform by derived command
+		*/		    
+		virtual void ExecuteL() = 0;    
+		/**
+		* Function set result from previous performed command.
+		* Command was performed and sent information about size of result to client-side.
+		* Base on command id session find corresponding instance of command and set result.
+		*/				    
+		virtual void SetResultL(const RMessage2& aMessage) = 0;    
+		/**
+		* Return command unique id
+		*
+		* @return command id;
+		*/    
+		TInt Id();
+		/**
+		* Return session id
+		*
+		* @return session id;
+		*/  		
+		TInt SessionId();
+		/**
+		* Function defines define default behaviour when leave appear during asynchrounous operation
+		*/		    
+		virtual void RunError(TInt aErrorCode);  		
+		
+	protected:
+		/**
+		* C++ default constructor.
+		*/
+		CUpnpCommand(CUpnpAVCPManager& aAVCPManager, 
+							CUpnpAVCPEngineSession& aSession, 
+							const RMessage2& aMessage);
+		/**
+		* Symbian 2nd phase constructor.
+		*/
+		void BaseConstructL();        
+		/**
+		* Read descriptor from message connected with this command
+		* @since Series 60 3.1
+		* @param aIndex index in message
+		* @return read value
+		*/
+		HBufC8* ReadDes8FromMessageLC(TInt aIndex);      
+		/**
+		* Read descriptor from message connected with this command
+		* @since Series 60 3.1
+		* @param aIndex index in message
+		* @return read value
+		*/		  
+		HBufC* ReadDes16FromMessageLC(TInt aIndex);
+                
+	protected:
+    // session id used for registration in CUpnpAVCPManager    
+		TInt iSessionId;
+		// command id used for match with command requesting for results
+		TInt iId;
+		// type of request
+		TAVCPEngineRqst iType; 
+    // AVCP manager used for sending request            
+		CUpnpAVCPManager& iAVCPManager;
+		// server-side session 
+		CUpnpAVCPEngineSession& iSession;
+		// processing message
+		RMessage2 iMessage;        
+	};
+
+#endif      // C_CUPNPCOMMAND_H 
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpcreatecommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,119 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Create new file/directory in MS
+*
+*/
+
+
+#ifndef C_CUPNPCREATECOMMAND_H
+#define C_CUPNPCREATECOMMAND_H
+
+//  INCLUDES
+#include "upnpcommand.h"
+#include "upnpresponsehandler.h"
+#include "upnpresolverobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpPathResolver;
+
+
+// CLASS DECLARATION
+/**
+* Class responsible for creating new files/directories in MS .
+*
+*  @since Series 60 3.1
+*/
+class CUpnpCreateCommand : public CUpnpCommand, public MUpnpResponseHandler, 
+                                        public MUpnpResolverObserver
+	{
+	public:	
+		/**
+		* Two-phased constructor.
+		*
+		* @param aAVCPManager manager
+		* @param aSession server-side session
+		* @param aMessage message
+		*/	
+		static CUpnpCreateCommand* NewL(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);	       
+		/**
+		* Destructor.
+		*/			
+		virtual ~CUpnpCreateCommand();	       
+	
+	public:	// Method from CUpnpCommand
+		/**
+		* From CUpnpCommand returns session id.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		TInt SessionId();
+		/**
+		* From CUpnpCommand implement logic for leaves that appear during InterpretL.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		void RunError(TInt aErrorCode);
+		/**
+		* From CUpnpCommand perfroms operation connected with command
+		* @since Series 60 3.1
+		*/			
+		void ExecuteL();
+		/**
+		* From CUpnpCommand it is empty implementation.
+		* @since Series 60 3.1
+		*/				
+		void SetResultL(const RMessage2& aMessage);	
+
+	public:	// Method from observers	
+		/**
+		* From MUpnpResponseHandler, it is notified when SOAP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aAction action with attached respone
+		* @since Series 60 3.1
+		*/	
+		void InterpretL(TInt aErrorCode, CUpnpAction* aAction);
+		/**
+		* From MUpnpResolverObserver, it is notified after translation path into id.
+		* 
+		* @param aErrorCode error code (KErrNone if Ok)
+		* @param aIdElement object describing searched element
+		* @since Series 60 3.1
+		*/		
+		void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement);				
+	
+	private: 
+		/**
+		* C++ default constructor.
+		*/
+		CUpnpCreateCommand(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);
+		/**
+		* Symbian 2nd phase constructor.
+		*/				
+		void ConstructL();
+
+	private:
+		// path resolver
+		CUpnpPathResolver* iPathResolver;
+		// object id taken from path specified by request				
+		HBufC8* iObjectId;	
+		// element in the path resolver
+		CUpnpPathElement* iElement;	
+		// name of file/directory to be created
+    HBufC8* iTargetName;
+};
+
+#endif //C_CUPNPCREATECOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpdeletecommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,114 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Delete file/directory in MS
+*
+*/
+
+
+#ifndef C_CUPNPDELETECOMMAND_H
+#define C_CUPNPDELETECOMMAND_H
+
+//  INCLUDES
+#include "upnpcommand.h"
+#include "upnpresponsehandler.h"
+#include "upnpresolverobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpPathResolver;
+
+// CLASS DECLARATION
+/**
+* Class responsible for deleting files/directories in MS .
+*
+*  @since Series 60 3.1
+*/
+class CUpnpDeleteCommand : public CUpnpCommand, public MUpnpResponseHandler, 
+                                        public MUpnpResolverObserver
+	{
+	public:	
+		/**
+		* Two-phased constructor.
+		*
+		* @param aAVCPManager manager
+		* @param aSession server-side session
+		* @param aMessage message
+		*/	
+		static CUpnpDeleteCommand* NewL(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);
+		/**
+		* Destructor.
+		*/		       
+		virtual ~CUpnpDeleteCommand();	       
+
+
+	public:	// Method from CUpnpCommand
+		/**
+		* From CUpnpCommand returns session id.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		TInt SessionId();
+		/**
+		* From CUpnpCommand implement logic for leaves that appear during InterpretL.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		void RunError(TInt aErrorCode);		
+		/**
+		* From CUpnpCommand perfroms operation connected with command
+		* @since Series 60 3.1
+		*/			
+		void ExecuteL();
+		/**
+		* From CUpnpCommand it is empty implementation.
+		* @since Series 60 3.1
+		*/				
+		void SetResultL(const RMessage2& aMessage);	
+		
+	public:	// Method from observers	
+		/**
+		* From MUpnpResponseHandler, it is notified when SOAP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aAction action with attached respone
+		* @since Series 60 3.1
+		*/	
+		void InterpretL(TInt aErrorCode, CUpnpAction* aAction);
+		/**
+		* From MUpnpResolverObserver, it is notified after translation path into id.
+		* 
+		* @param aErrorCode error code (KErrNone if Ok)
+		* @param aIdElement object describing searched element
+		* @since Series 60 3.1
+		*/		
+		void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement);					
+	
+	private:
+		/**
+		* C++ default constructor.
+		*/	
+		CUpnpDeleteCommand(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);
+		/**
+		* Symbian 2nd phase constructor.
+		*/				
+		void ConstructL();
+		
+	private:
+		// path resolver
+		CUpnpPathResolver* iPathResolver;
+
+};
+
+#endif // C_CUPNPDELETECOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpdevicelistcommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,80 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class responsbile for MS device list
+*
+*/
+
+
+#ifndef C_CUPNPDEVICELISTCOMMAND_H
+#define C_CUPNPDEVICELISTCOMMAND_H
+
+//  INCLUDES
+#include "upnpcommand.h"
+
+// CLASS DECLARATION
+/**
+* Class responsible for getting list of active MSs.
+*
+*  @since Series 60 3.1
+*/
+class CUpnpDeviceListCommand : public CUpnpCommand
+	{
+	public:	
+		/**
+		* Two-phased constructor.
+		*
+		* @param aAVCPManager manager
+		* @param aSession server-side session
+		* @param aMessage message
+		*/		
+		static CUpnpDeviceListCommand* NewL(CUpnpAVCPManager& aAVCPManager, 
+	  	CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);
+		/**
+		* Destructor.
+		*/		       
+		virtual ~CUpnpDeviceListCommand();	       
+		
+	public:	// Method from CUpnpCommand	
+		/**
+		* From CUpnpCommand perfroms operation connected with command
+		* @since Series 60 3.1
+		*/							
+		void ExecuteL();
+		/**
+		* From CUpnpCommand set result from previous performed command.
+		* It sets result from directory listing.
+		* @since Series 60 3.1
+		*/	
+		void SetResultL(const RMessage2& aMessage);	
+
+	private:
+		/**
+		* C++ default constructor.
+		*/
+		CUpnpDeviceListCommand(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);
+		/**
+		* Symbian 2nd phase constructor.
+		*/			
+		void ConstructL();
+	
+	private:
+		// size of array with devices
+		TInt iDeviceCount;	
+		// array of devices
+		TAVDevice* iDevices;
+		
+};
+
+#endif //C_CUPNPDEVICELISTCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpdownloadcommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,130 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class responsible for reading file from MS
+*
+*/
+
+
+#ifndef C_CUPNPDOWNLOADCOMMAND_H
+#define C_CUPNPDOWNLOADCOMMAND_H
+
+//  INCLUDES
+#include "upnpcommand.h"
+#include "upnpresponsehandler.h"
+#include "upnpresolverobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpPathResolver;
+
+// CLASS DECLARATION
+/**
+* Class responsible for downloadind files from MS.
+*
+*  @since Series 60 3.1
+*/
+class CUpnpDownloadCommand :    public CUpnpCommand, 
+                            public MUpnpResponseHandler,
+                            public MUpnpHttpResponseHandler, 
+                            public MUpnpResolverObserver
+	{
+	public:	
+		/**
+		* Two-phased constructor.
+		*
+		* @param aAVCPManager manager
+		* @param aSession server-side session
+		* @param aMessage message
+		*/		
+		static CUpnpDownloadCommand* NewL(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);	       
+		/**
+		* Destructor.
+		*/			
+		virtual ~CUpnpDownloadCommand();	       
+
+	public:	// Method from CUpnpCommand
+		/**
+		* From CUpnpCommand returns session id.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		TInt SessionId();
+		/**
+		* From CUpnpCommand implement logic for leaves that appear during InterpretL.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		void RunError(TInt aErrorCode);		
+		/**
+		* From CUpnpCommand perfroms operation connected with command
+		* @since Series 60 3.1
+		*/			
+		void ExecuteL();
+		/**
+		* From CUpnpCommand it is empty implementation.
+		* @since Series 60 3.1
+		*/				
+		void SetResultL(const RMessage2& aMessage);	
+		
+	public:	// Method from observers	
+		/**
+		* From MUpnpResponseHandler, it is notified when SOAP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aAction action with attached respone
+		* @since Series 60 3.1
+		*/	
+		void InterpretL(TInt aErrorCode, CUpnpAction* aAction);
+		/**
+		* From MUpnpHttpResponseHandler, it is notified when HTTP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aMessage response message
+		* @since Series 60 3.1
+		*/			
+		void InterpretL(TInt aErrorCode, CUpnpHttpMessage* aMessage);
+		/**
+		* From MUpnpResolverObserver, it is notified after translation path into id.
+		* 
+		* @param aErrorCode error code (KErrNone if Ok)
+		* @param aIdElement object describing searched element
+		* @since Series 60 3.1
+		*/				
+		void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement);
+	
+	private:
+		/**
+		* C++ default constructor.
+		*/	
+		CUpnpDownloadCommand(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);
+		/**
+		* Symbian 2nd phase constructor.
+		*/			
+		void ConstructL();
+
+	private:
+		// path resolver
+		CUpnpPathResolver* iPathResolver;
+		// object id taken from path specified by request				
+		HBufC8* iObjectId;	
+		// path to destinnation file (local file in cache directory)        
+    HBufC8* iDestPath;
+    // flag indicates that RANGE was used
+    TBool iUseRange;
+    // structure keeps information about position of file to read
+    TFilePosition iPosition;        
+	};
+
+#endif //C_CUPNPDOWNLOADCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpmdebug.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,153 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Debug printing to a log file
+*
+*/
+
+
+#ifndef C_UPNPMDEBUG_H
+#define C_UPNPMDEBUG_H
+
+// INCLUDES
+#include <e32std.h>
+
+#ifdef _DEBUG
+#include <flogger.h>
+#include "upnpmydebug.h"
+
+// Take care that the correct upnpmydebug.h will be included
+// In upnpmydebug.h in your module inc directory,
+// define your application-specific configuration like this:
+// ----------------------------------------------------------
+// Debug file - debug output is disabled if the parent dir does not exist
+// _LIT(KDebugFileName, "C:\\logs\\remotefileengine\\remotefileengine.txt");
+
+// Replace the current debug file - if not defined appends to the file
+#ifndef APPEND_TO_DEBUG_FILE
+#define REPLACE_DEBUG_FILE
+#endif
+
+// Maximum formatted size resulting from a single DEBUG* call
+#ifndef MAX_DEBUG_STRING_LENGTH
+#define MAX_DEBUG_STRING_LENGTH 4096
+#endif
+// ----------------------------------------------------------
+
+
+// FORWARD DECLARATIONS
+static void DoOutput(TDesC8& aData);
+
+static void DebugStringNarrowL(const char* aFmt, ...)
+    {
+    VA_LIST args;
+    VA_START(args, aFmt);
+    
+    TPtrC8 fmt(reinterpret_cast<const unsigned char *>(aFmt));
+    HBufC8* buf = HBufC8::NewLC(MAX_DEBUG_STRING_LENGTH);
+    buf->Des().FormatList(fmt, args);
+    buf->Des().Append('\n');
+    DoOutput(*buf);
+    CleanupStack::PopAndDestroy(buf);
+       
+    VA_END(args);
+    }
+
+static void DebugStringWideL(const char* aFmt, ...)
+    {
+    VA_LIST args;
+    VA_START(args, aFmt);
+    
+    TPtrC8 fmt(reinterpret_cast<const unsigned char *>(aFmt));
+    HBufC* fmt16 = HBufC::NewLC(fmt.Length());
+    fmt16->Des().Copy(fmt);
+    HBufC* buf = HBufC::NewLC(MAX_DEBUG_STRING_LENGTH);
+    buf->Des().FormatList(*fmt16, args);
+    buf->Des().Append('\n');
+    HBufC8* buf8 = HBufC8::NewLC(buf->Length());
+    buf8->Des().Copy(*buf);
+    DoOutput(*buf8);
+    CleanupStack::PopAndDestroy(3); // fmt16, buf, buf8
+
+    VA_END(args);
+    }
+
+static void DebugBufferL(const TDesC8& aBuf)
+    {
+    DebugStringNarrowL("\"%S\"", &aBuf);
+    }
+
+static void DebugBufferL(const TDesC& aBuf)
+    {
+    DebugStringWideL("\"%S\"", &aBuf);
+    }
+
+static void DebugTimeL(const TTime& aTime)
+    {
+    TBuf<64> dateTimeString;
+    _LIT(KDateString, "%E%D%X%N%Y %1 %2 %3");
+    aTime.FormatL(dateTimeString, KDateString);
+    DebugBufferL(dateTimeString);
+    _LIT(KTimeString, "%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B");
+    aTime.FormatL(dateTimeString, KTimeString);
+    DebugBufferL(dateTimeString);
+    }
+
+static void DoOutput(TDesC8& aData)
+    {
+    RFileLogger::Write(KDebugDirName,
+                       KDebugFileName,
+                       EFileLoggingModeAppend,
+                       aData);
+    }
+#endif    
+
+// MACROS
+// If you output one or more narrow descriptors by using '%S',
+//    use DEBUGSTRING8
+// else if you output one or more unicode descriptors by using '%S',
+//    use DEBUGSTRING16
+// else
+//    use DEBUGSTRING
+//
+// Narrow and unicode cannot be mixed in a single DEBUGSTRINGx call.
+
+#ifdef _DEBUG
+#define DEBUGINIT() DebugInit()
+#define DEBUGINITSUSPENDED() DebugInit(ETrue)
+#define DEBUGENABLE() SetDebugEnabled(ETrue)
+#define DEBUGDISABLE() SetDebugEnabled(EFalse)
+#define DEBUGSUSPEND() SetDebugSuspended(ETrue)
+#define DEBUGCONTINUE() SetDebugSuspended(EFalse)
+#define DEBUGSTRING(x) DebugStringNarrowL x
+#define DEBUGSTRING8(x) DebugStringNarrowL x
+#define DEBUGSTRING16(x) DebugStringWideL x
+#define DEBUGBUFFER(x) DebugBufferL x
+#define DEBUGTIME(x) DebugTimeL x
+#else
+#define DEBUGINIT()
+#define DEBUGINITSUSPENDED()
+#define DEBUGENABLE()
+#define DEBUGDISABLE()
+#define DEBUGSUSPEND()
+#define DEBUGCONTINUE()
+#define DEBUGSTRING(x)
+#define DEBUGSTRING8(x)
+#define DEBUGSTRING16(x)
+#define DEBUGBUFFER(x)
+#define DEBUGTIME(x)
+#endif
+
+#endif // C_MUPNPDEBUG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpmetadatacommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,122 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Used for get/change metadata from/in MS
+*
+*/
+
+
+#ifndef C_CUPNPMETADATACOMMAND_H
+#define C_CUPNPMETADATACOMMAND_H
+
+//  INCLUDES
+#include "upnpcommand.h"
+#include "upnpresponsehandler.h"
+#include "upnpresolverobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpPathResolver;
+
+// CLASS DECLARATION
+/**
+* Class responsible for operating on MS's metadata.
+* It is used for get/change file/directory metadata
+*
+*  @since Series 60 3.1
+*/
+class CUpnpMetadataCommand : public CUpnpCommand, public MUpnpResponseHandler, 
+                                          public MUpnpResolverObserver
+{
+	public:	
+		/**
+		* Two-phased constructor.
+		*
+		* @param aAVCPManager manager
+		* @param aSession server-side session
+		* @param aMessage message
+		*/		
+		static CUpnpMetadataCommand* NewL(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);	       
+		/**
+		* Destructor.
+		*/			
+		virtual ~CUpnpMetadataCommand();	       	
+		
+	public:	// Method from CUpnpCommand
+		/**
+		* From CUpnpCommand returns session id.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		TInt SessionId();
+		/**
+		* From CUpnpCommand implement logic for leaves that appear during InterpretL.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		void RunError(TInt aErrorCode);		
+		/**
+		* From CUpnpCommand perfroms operation connected with command
+		* @since Series 60 3.1
+		*/			
+		void ExecuteL();
+		/**
+		* From CUpnpCommand it is empty implementation.
+		* @since Series 60 3.1
+		*/				
+		void SetResultL(const RMessage2& aMessage);	
+		
+	public:	// Method from observers	
+		/**
+		* From MUpnpResponseHandler, it is notified when SOAP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aAction action with attached respone
+		* @since Series 60 3.1
+		*/	
+		void InterpretL(TInt aErrorCode, CUpnpAction* aAction);
+		/**
+		* From MUpnpResolverObserver, it is notified after translation path into id.
+		* 
+		* @param aErrorCode error code (KErrNone if Ok)
+		* @param aIdElement object describing searched element
+		* @since Series 60 3.1
+		*/		
+		void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement);	
+		
+	private:
+		/**
+		* C++ default constructor.
+		*/		
+		CUpnpMetadataCommand(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);			
+		/**
+		* Symbian 2nd phase constructor.
+		*/				
+		void ConstructL();
+
+	private: // Data
+		// path resolver
+		CUpnpPathResolver* iPathResolver;
+		// object id taken from path specified by request				
+		HBufC8* iObjectId;	
+		// result from browse, waiting for request about result			            
+    HBufC8* iResult;
+    // old metadata
+    HBufC8* iOldMetadata;
+    // new changed metadata
+    HBufC8* iNewMetadata;
+        
+};
+
+#endif //C_CUPNPMETADATACOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpmydebug.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,31 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Debug definitions for UPnPAccess
+*
+*/
+
+
+#ifndef C_UPNPMYDEBUG_H
+#define C_UPNPMYDEBUG_H
+
+// MACROS
+#define APPEND_TO_DEBUG_FILE
+
+// CONSTANTS
+_LIT(KDebugDirName, "avcp");
+_LIT(KDebugFileName, "avcpengine.txt");
+
+#endif // C_UPNPMYDEBUG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnppathelement.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,158 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Describe a path element
+*
+*/
+
+
+#ifndef C_CUPNPPATHELEMENT_H
+#define C_CUPNPPATHELEMENT_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CLASS DECLARATION
+/**
+*  Describe a path element
+*
+*  @since Series 60 3.1
+*/
+class CUpnpPathElement: public CBase
+	{
+	public:  // Constructors and destructor        
+		/**
+		* Two-phased constructor.
+		*/
+		static CUpnpPathElement* NewL();        
+		/**
+		* Destructor.
+		*/
+		virtual ~CUpnpPathElement();
+
+	public: // New functions     
+		/**
+	    * Get value of parent id
+	    * @since Series 60 3.1
+	    * @return parent id
+	    */      	   
+		const TDesC8& ParentId() const;   
+		/**
+	    * Set value of parent id
+	    * @since Series 60 3.1
+	    * @param aParentId new value of parent id
+	    */		             
+		void SetParentIdL(const TDesC8& aParentId);
+		/**
+	    * Get value of id
+	    * @since Series 60 3.1
+	    * @return id value
+	    */   		
+		const TDesC8& Id() const;  
+		/**
+	    * Set value of id
+	    * @since Series 60 3.1
+	    * @param aId new value of id
+	    */				      
+		void SetIdL(const TDesC8& aId);
+		/**
+	    * Get value of name
+	    * @since Series 60 3.1
+	    * @return name
+	    */   		
+		const TDesC8& Name() const;   
+		/**
+	    * Set value of name
+	    * @since Series 60 3.1
+	    * @param aName new value of name
+	    */			             
+		void SetNameL(const TDesC8& aName);        
+		
+		/**
+	    * Get value of ImportURI
+	    * @since Series 60 3.2
+	    * @return ImportURI
+	    */      	   
+		const TDesC8& ImportURI() const;   
+		/**
+	    * Set value of ImportURI
+	    * @since Series 60 3.2
+	    * @param aImportURI a new value of importURI
+	    */		             
+		void SetImportURIL(const TDesC8& aImportURI);        		
+		
+		/**
+	    * Get value of original name
+	    * @since Series 60 3.2
+	    * @return OriginalName
+	    */      	   
+		const TDesC8& OriginalName() const; 
+		  
+		/**
+	    * Set value of original name
+	    * @since Series 60 3.2
+	    * @param aIOriginalName a new value of original name
+	    */		             
+		void SetOriginalNameL(const TDesC8& aOriginalName);    
+		
+		/**
+	    * Deletes value of original name
+	    * @since Series 60 3.2	   
+	    */		             
+		void DeleteOriginalName();    
+		
+		/**
+		Compares if two path elements have the same name and parent id.
+		@param aFirst First message to compare.
+		@param aSecond Second message to compare.
+		@result ETrue if same session id, EFalse otherwise.
+		**/
+		static TBool MatchName(const CUpnpPathElement& aElement1, 
+                            const CUpnpPathElement& aElement2);        
+		/**
+		Compares if two path elements have the same name, id and parent id.
+		@param aFirst First message to compare.
+		@param aSecond Second message to compare.
+		@result ETrue if same session id, EFalse otherwise.
+		**/                            
+		static TBool MatchAll(const CUpnpPathElement& aElement1, 
+                            const CUpnpPathElement& aElement2);                              
+
+	private:
+		/**
+		* C++ default constructor.
+		*/
+		CUpnpPathElement();
+
+		/**
+		* Symbian 2nd phase constructor
+		*/
+		void ConstructL();
+        
+	private:
+		// id attrbute of UPnP object
+		HBufC8* iId;
+		// parent id attrbute of UPnP object
+		HBufC8* iParentId;
+		// name path element, name is taken from title element, 
+		// but if duplication occurs, name is followed by index string
+		HBufC8* iName;   
+		//hidden import URI
+		HBufC8* iImportURI;
+		//original name if change by creating resource   	
+		HBufC8* iOriginalName;
+	};
+
+#endif      // C_CUPNPPATHELEMENT_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnppathresolver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,240 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpPathResolver
+*
+*/
+
+
+
+#ifndef C_CUPNPPATHRESOLVER_H
+#define C_CUPNPPATHRESOLVER_H
+
+//  INCLUDES
+#include <e32base.h>
+
+#include <xmlengdom.h>
+
+// FORWARD DECLARATIONS
+class CUpnpPathElement;
+class CUpnpResolveHandler;
+class MUpnpResolverObserver;
+class CUpnpAVCPManager;
+class TFileInfo;
+class CUpnpAVCPEngineSession;
+
+// CLASS DECLARATION
+/**
+* Class responsible for managing path element for one MS.
+* It helps in translating pathname into id.
+*
+*  @since Series 60 3.1
+*/
+class CUpnpPathResolver : public CBase
+	{
+	public:  
+		/**
+		* Two-phased constructor.
+		*/
+		static CUpnpPathResolver* NewL(CUpnpAVCPManager& aManager,const TDesC8& aUUID);
+		
+		/**
+		* Destructor.
+		*/
+		virtual ~CUpnpPathResolver();
+
+  public: // New functions
+		/**
+		*  Return UDN of MS that resolver is related
+		*/     
+		const TDesC8& UUID() const;
+		
+		/**
+		* Add new path element into resolver.
+		* if resolver has element with the same name and ids ignore.
+		* if resolver has element with the same naem but different id,
+		*  perform duplicatione mechanism by adding '(inx)' at the end of name, new name is returned.
+		*
+		* @param aParentId parent id
+		* @param aId id
+		* @param aName name of element
+		* @param aImportURI importURI of element
+		* @return approved name, it may be the same as aName if we don't have duplication, ale is followed by index
+		*/
+		const TDesC8& AddElementL(const TDesC8& aParentId, const TDesC8& aId, const TDesC8& aName, const TDesC8& aImportURI = KNullDesC8);
+		
+		/**
+		* Gets path element for object with given parent id and name.
+		* Ownership is not passed to caller.
+		* 
+		* @param aParentId parent id 
+		* @param aName name
+		* @return NULL if not found, else instance describing path element
+		*/
+		CUpnpPathElement* GetElementL(const TDesC8& aParentId, const TDesC8& aName) const;
+		/**
+		* Remove given element from cache array (if found in cache it destroys also given instance)
+		*
+		* @param aElement param to remove
+		*/
+		void RemoveElementD(CUpnpPathElement* aElement);  
+		/**
+		* Request for resolving pathname and notify given observer after process will be finished.
+		*/
+		void ResolveIdL(const TDesC8& aPath, MUpnpResolverObserver& aObserver);
+		/**
+		* Remove instance of resolver's handler from array of active handlers
+		*/
+		void RemoveHandler(CUpnpResolveHandler* aHandler);							
+		/**
+		Compares if two path resolvers have the UDN
+		@param aFirst First message to compare.
+		@param aSecond Second message to compare.
+		@result ETrue if same session id, EFalse otherwise.
+		**/
+		static TBool Match(const CUpnpPathResolver& aElement1, const CUpnpPathResolver& aElement2) ;        
+		/**
+		* Notify if event comes from CDS with system id, 
+		* If system id is changed path elements will be removed
+		*/
+		void StateChangedL(const TDesC8& aSystemId);
+		/**
+		* Set modification time based on date element from CDS's object.
+		*
+		* @param aDateElement XML element with date
+		* @param aEntry structure to be updated 
+		*/
+		void SetModifiedTimeL(TXmlEngElement& aDateElement, TFileInfo& aEntry); 		
+		/**
+		* Parse Browse response and updates information about path elements
+		* If aDirList is defined, update array by parsed path element 
+		*	(set also file/directory attributes)
+		* If aObjectId is not equal KNullDesC8, then also try to find resource URI for aObjectId.
+		*
+		* @param aResponse response
+		* @param aDirList array of directory entry elements
+		* @param aObjectId object id for resource URI
+		* @param	aResUri	found resource
+		*/
+		void ParseBrowseResponseL(const TDesC8& aResponse, RArray<TFileInfo>* aDirList = NULL, 
+		        const TDesC8& aObjectId = KNullDesC8, HBufC8** aResUri = NULL);
+		/**
+		* Parse Browse response and find resourse URI for object with given id.
+		* 
+		* @param aResponse response
+		* @param aId id of object
+		* @param aResUri parameter to be set with found resoursce URI
+		* @return ETrue if found, else EFalse
+		*/
+		TBool GetResUriL(const TDesC8& aResponse, const TDesC8& aId, HBufC8*& aResUri);
+		/**
+		* Parse Browse response and find resourse for object with given id.
+		* 
+		* @param aResponse response
+		* @param aId id of object		
+		* @return ETrue if found, else EFalse
+		*/		
+		TInt GetItemL(const TDesC8& aResponse, const TDesC8& aId);		
+		
+		/**
+		* Parse Browse response of CreateObject
+		* 
+		* @param aResponse response				
+		* @return ETrue if found, else EFalse
+		*/
+		TBool BrowseCreateObjectL(const TDesC8& aResponse ) ;
+		
+		/**
+		* Register session that is interested of this resolver
+		*
+		* @param aSession session
+		*/
+		void RegisterSession(CUpnpAVCPEngineSession* aSession);
+		/**
+		* Unregister session that is not interested of this resolver
+		*
+		* @param aSession session
+		* @return number of session still being interested
+		*/		
+		TInt UnregisterSession(CUpnpAVCPEngineSession* aSession);
+		/**
+		* Lock resolver to not accept resets as a result of state variable changes 
+		* Reset will be postpone until unlock method is invoked
+		*
+		*/
+		void LockReset();
+		/**
+		* Unlock reset.
+		* If between lock-unlock operation occurs state variable change, 
+		* it'll reset all entries.
+		*/
+		void UnlockReset(); 			
+	private:
+
+		/**
+		* C++ default constructor.
+		*/
+		CUpnpPathResolver(CUpnpAVCPManager& aManager);
+		
+		/**
+		* By default Symbian 2nd phase constructor is private.
+		*/
+		void ConstructL(const TDesC8& aUUID);        
+		/**
+		* Parse XML given as parameter and return DOM tree
+		*
+		* @param aXml buffer with XML
+		* @return DOM document
+		*/	
+		RXmlEngDocument ParseXmlL(const TDesC8& aXml); 	
+		/**
+		* Get prefer resource element
+		*
+		* @param aElements array of elements
+		* @return chosen one
+		*/
+		TXmlEngElement GetPreferResourceL(const RArray<TXmlEngElement>& aElements); 
+		/**
+		* Get first resource element with import URI
+		*
+		* @param aElements array of elements
+		* @param aImportURI if found
+		* @return chosen one
+		*/
+		TXmlEngElement GetResourceWithImportURIL(const RArray<TXmlEngElement>& aElements, TPtrC8& aImportURI); 
+		
+	private:    // Data
+		// last known system id (statevariable of CDS)
+		TInt iSystemId;
+		// UDN of MS 
+		HBufC8* iUUID;
+		// manager
+		CUpnpAVCPManager& iManager;
+		// array of path elements
+		RPointerArray<CUpnpPathElement> iPathElements;
+		// array of resolver's handlers
+		RPointerArray<CUpnpResolveHandler> iResolveHandlers;
+		// array of session being interested of this resolver
+		RPointerArray<CUpnpAVCPEngineSession> iAVCPSessions;
+		// indicate whether path resolver is reseted to remove all entries 
+		// when state variable changes
+		TBool iLocked;
+		// indicate whether entries are up-to-date
+		TBool iUptodate;
+		
+		RXmlEngDOMImplementation iDOMImpl;
+    };
+
+#endif      // C_CUPNPPATHRESOLVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpresolvehandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,127 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resolve path(FS) into id (UPnP)
+*
+*/
+
+
+#ifndef C_CUPNPRESOLVEHANDLER_H
+#define C_CUPNPRESOLVEHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpresponsehandler.h"
+#include "upnpresolverobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpPathResolver;
+class CUpnpAVCPManager;
+
+// CLASS DECLARATION
+/**
+* Class responsible for translating path into id.
+*
+*  @since Series 60 3.1
+*/
+class CUpnpResolveHandler: public CBase, public MUpnpResponseHandler
+	{	
+	public:
+		/**
+		* Two-phased constructor.
+		*
+		* @param aAVCPManager manager
+		* @param aResolver path resolver
+		* @param aObserver observer to nofity
+		*/		
+		static CUpnpResolveHandler* NewL(CUpnpAVCPManager& aAVCPManager,
+			CUpnpPathResolver& aResolver, MUpnpResolverObserver& aObserver);	
+		/**
+		* Destructor.
+		*/			
+		virtual ~CUpnpResolveHandler();
+		/**
+		* Request for tranlating given path in to id.
+		* Method parses path into element and tries to match.
+		* Inform use about result by observer,
+		*
+		* @param aPath path
+		*/
+		void ResolveL(const TDesC8& aPath);
+		
+	public:	// Method from observers	
+		/**
+		* From MUpnpResponseHandler returns session id.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		TInt SessionId();
+		/**
+		* From MUpnpResponseHandler, it is notified when SOAP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aAction action with attached respone
+		* @since Series 60 3.1
+		*/	
+		void InterpretL(TInt aErrorCode, CUpnpAction* aAction);
+		/**
+		* From MUpnpResponseHandler, it is notified when leave appears 
+		* during InterpretL
+		* @param aErrorCode error code
+		* @since Series 60 3.1
+		*/
+		void RunError(TInt aErrorCode);
+				
+	private:
+		/**
+		* C++ default constructor.
+		*/	
+		CUpnpResolveHandler(CUpnpAVCPManager& aAVCPManager,
+			CUpnpPathResolver& aResolver, MUpnpResolverObserver& aObserver);
+			
+		/**
+		* Symbian 2nd phase constructor.
+		*/					
+		void ConstructL();
+		/**
+		* Check next element in path, if it is the last notify observer.
+		* If matching elemrnt wasn't found inform observer.
+		*
+		* @param aSendAction indicate whether use browse action 
+		*	if not found or inform used about error.
+		*/		
+		void CheckNextElementL(TBool aSendAction = ETrue);    
+		
+	private:
+		// manager
+  	CUpnpAVCPManager& iAVCPManager;	
+  	// resolver instance
+		CUpnpPathResolver& iResolver;
+		// observer
+		MUpnpResolverObserver& iObserver;
+		// array of path elements
+		RPointerArray<TPtrC8> iPathElements;	
+		// session id of last send SOAP action
+		TInt iSessionId; 	
+		// original pathname
+		HBufC8* iPath;
+		// last matched object id
+		HBufC8* iLastId;
+		// index of path elements, last checked
+		TInt iPathIndex;	
+		// index used to no get whole browse result
+		TInt iStartIndex;			
+		
+};
+
+#endif // C_CUPNPRESOLVEHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpresolverobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MUpnpResolverObserver
+*
+*/
+
+
+#ifndef C_CUPNPRESOLVEROBSERVER_H
+#define C_CUPNPRESOLVEROBSERVER_H
+
+// FORWARD DECLARATIONS
+class CUpnpPathElement;
+
+// CLASS DECLARATION
+/**
+*  This observer class has to be implemented to receive notification about result of path resolving.
+*
+*  @see CUpnpPathResolver
+*  @see ResolveHandler
+*  @since Series 60 3.1
+*/
+class MUpnpResolverObserver
+	{
+	public: // New functions
+		/**
+		* Method invoke when resolving process has finished and result are ready.
+		* @since Series 60 3.1
+		* @param aErrCode status of resolving, if ok, value equal KErrNone
+		* @param aPathElement object describing searched element
+		*/
+		virtual void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aPathElement) = 0;
+	};
+
+#endif // C_CUPNPRESOLVEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpresponsehandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,98 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observers which receive notifications about responses of SOAP actions and HTTP requests
+*
+*/
+
+
+#ifndef C_CUPNPRESPONSEHANDLER_H
+#define C_CUPNPRESPONSEHANDLER_H
+
+// FORWARD DECLARATIONS
+class CUpnpAction;
+class CUpnpHttpMessage;
+
+// CLASS DECLARATION
+/**
+*  This observer class has to be implemented to receive notification 
+*  about response on SOAP action.
+*	 The observer is used by CUpnpAVCPManager, it use session id 
+*  (taken from SessionId method) for match incoming response with corresponding
+*  handler instance. After notify handler, handler is removed from 
+*  registered handlers.
+*
+*  @see CUpnpAVCPManager
+*  @since Series 60 3.1
+*/
+class MUpnpResponseHandler
+	{
+	public: // New functions 
+		/**
+		* This callback function is notified when Soap respone
+		* with relevant session id (@see SessionId) comes.
+		* @param aErrorCode error code
+		* @param aMessage response message
+		* @since Series 60 3.1
+		*/		
+		virtual void InterpretL(TInt aErrorCode, CUpnpAction* aAction) = 0;
+		/**
+		* Function returns session id that identifies on which response handler is waiting
+		*
+		* @return session id
+		*/		
+		virtual TInt SessionId() = 0;
+		/**
+		* This callback function is notified when leave appears during execution of InterpretL
+		* @param aErrorCode error code of leave
+		*/		
+		virtual void RunError(TInt aErrorCode) = 0;
+		
+
+	};
+
+/**
+*  This observer class has to be implemented to receive notification 
+*  about response on HTTP requests.
+*	 The observer is used by CUpnpAVCPManager, it use session id 
+*  (taken from SessionId method) for match incoming response with corresponding
+*  handler instance. After notify handler, handler is not removed from 
+*  registered handlers. Handler instance has to use unregister itself.
+*
+*  @see CUpnpAVCPManager
+*  @since Series 60 3.1
+*/
+class MUpnpHttpResponseHandler
+	{
+	public: // New functions
+		/**
+		* This callback function is notified when HTTP respone
+		* with relevant session id (@see SessionId) comes.
+		* @param aErrorCode error code
+		* @param aMessage response message
+		* @since Series 60 3.1
+		*/	
+		virtual void InterpretL(TInt aErrorCode, CUpnpHttpMessage* aAction) = 0;
+		/**
+		* Function returns session id that identifies on which response handler is waiting
+		*
+		* @return session id
+		*/
+		virtual TInt SessionId() = 0;
+		/**
+		* This callback function is notified when leave appears during execution of InterpretL
+		* @param aErrorCode error code of leave
+		*/		
+		virtual void RunError(TInt aErrorCode) = 0;		
+	};
+#endif // C_CUPNPRESPONSEHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/inc/upnpuploadcommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,132 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class responsible for writing file from MS
+*
+*/
+
+
+#ifndef C_CUPNPUPLOADCOMMAND_H
+#define C_CUPNPUPLOADCOMMAND_H
+
+//  INCLUDES
+#include "upnpcommand.h"
+#include "upnpresponsehandler.h"
+#include "upnpresolverobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpPathResolver;
+
+// CLASS DECLARATION
+/**
+* Class responsible for uploading files from MS.
+*
+*  @since Series 60 3.1
+*/
+class CUpnpUploadCommand : public CUpnpCommand, 
+                       public MUpnpResponseHandler,
+                       public MUpnpHttpResponseHandler, 
+                       public MUpnpResolverObserver
+	{
+	public:	
+		/**
+		* Two-phased constructor.
+		*
+		* @param aAVCPManager manager
+		* @param aSession server-side session
+		* @param aMessage message
+		*/		
+		static CUpnpUploadCommand* NewL(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);	       
+		/**
+		* Destructor.
+		*/				
+		virtual ~CUpnpUploadCommand();	       	
+			
+	public:	// Method from CUpnpCommand
+		/**
+		* From CUpnpCommand returns session id.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		TInt SessionId();
+		/**
+		* From CUpnpCommand implement logic for leaves that appear during InterpretL.
+		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
+		* @since Series 60 3.1
+		*/	
+		void RunError(TInt aErrorCode);			
+		/**
+		* From CUpnpCommand perfroms operation connected with command
+		* @since Series 60 3.1
+		*/							
+		void ExecuteL();
+		/**
+		* From CUpnpCommand set result from previous performed command.
+		* It sets result from directory listing.
+		* @since Series 60 3.1
+		*/	
+		void SetResultL(const RMessage2& aMessage);
+				
+	public:	// Method from observers		
+		/**
+		* From MUpnpResponseHandler, it is notified when SOAP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aAction action with attached respone
+		* @since Series 60 3.1
+		*/	
+		void InterpretL(TInt aErrorCode, CUpnpAction* aAction);
+		/**
+		* From MUpnpHttpResponseHandler, it is notified when HTTP respone 
+		* with relevant session id comes.
+		* @param aErrorCode error code
+		* @param aMessage response message
+		* @since Series 60 3.1
+		*/			
+		void InterpretL(TInt aErrorCode, CUpnpHttpMessage* aMessage);
+		/**
+		* From MUpnpResolverObserver, it is notified after translation path into id.
+		* 
+		* @param aErrorCode error code (KErrNone if Ok)
+		* @param aIdElement object describing searched element
+		* @since Series 60 3.1
+		*/				
+		void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement);
+
+	private:
+		/**
+		* C++ default constructor.
+		*/			
+		CUpnpUploadCommand(CUpnpAVCPManager& aAVCPManager, 
+			CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage);
+		/**
+		* Symbian 2nd phase constructor.
+		*/			
+		void ConstructL();
+
+		
+	private:
+		// path resolver
+		CUpnpPathResolver* iPathResolver;
+		// object id taken from path specified by request				
+		HBufC8* iObjectId;	
+    	// location to local file, it is file to be sent    
+    	HBufC8* iSrcPath;
+    	// import URI
+    	HBufC8* iImportURI;
+    
+        
+};
+
+#endif // C_CUPNPUPLOADCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpavcpengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,238 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpAVCPEngine
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include "upnpavcpengine.h"
+#include "upnpavcpenginesession.h"
+#include "upnpavcpmanager.h"
+#include "upnpavcpenginecommon.h"
+#include "upnpmdebug.h"
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::CUpnpAVCPEngine
+// constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAVCPEngine::CUpnpAVCPEngine( TInt aPriority )
+    : CServer2( aPriority )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::~CUpnpAVCPEngine
+// destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAVCPEngine::~CUpnpAVCPEngine()
+    {   
+    delete iAVCPManger;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAVCPEngine* CUpnpAVCPEngine::NewLC()
+    {
+    CUpnpAVCPEngine* engine = new (ELeave) CUpnpAVCPEngine( EPriorityNormal );
+    CleanupStack::PushL( engine );
+    engine->ConstructL() ;
+    return engine;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngine::ConstructL()
+    {
+     DEBUGSTRING(("CUpnpAVCPEngine::ConstructL "));
+    iAVCPManger = CUpnpAVCPManager::NewL();
+    StartL( KAVCPEngineName );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::NewSessionL
+// Create new session.
+// -----------------------------------------------------------------------------
+//
+CSession2* CUpnpAVCPEngine::NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const
+    {
+    // Check it's the right version
+    if ( !User::QueryVersionSupported( TVersion( 
+            KAVCPEngineMajorVersionNumber,
+            KAVCPEngineMinorVersionNumber,
+            KAVCPEngineBuildVersionNumber ),
+            aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+	RThread client;
+	aMessage.Client(client); 
+    return CUpnpAVCPEngineSession::NewL( client, *const_cast<CUpnpAVCPEngine*> ( this ), *const_cast<CUpnpAVCPManager*> (iAVCPManger) );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::IncrementSessions
+// Increment sessions.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngine::IncrementSessions(CUpnpAVCPEngineSession* /*aObserver*/)
+    {    
+    iSessionCount++;   
+    DEBUGSTRING(("IncrementSessions (%d)", iSessionCount));
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::DecrementSessions
+// Decrement sessions.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngine::DecrementSessions( CUpnpAVCPEngineSession* aObserver)
+    {
+    TRAP_IGNORE( iAVCPManger->CleanupSessionL(aObserver) );
+    iSessionCount--; 
+    DEBUGSTRING(("DecrementSessions (%d)", iSessionCount));    
+    if ( iSessionCount <= 0 )
+		{
+		CActiveScheduler::Stop();
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::RunError
+// RunError is called when RunL leaves.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAVCPEngine::RunError( TInt aError )
+    {
+    DEBUGSTRING(("CUpnpAVCPEngine::RunError (%d)", aError));    
+    
+    if ( aError == KErrBadDescriptor )
+        {
+        // A bad descriptor error implies a badly programmed client, so panic it;
+        // otherwise report the error to the client
+        PanicClient( Message(), /*EMessageHandlerBadDescriptor*/EAVCPEngineGenerealPanic );
+        }
+    else
+        {
+        Message().Complete( aError );
+        }
+
+    // The leave will result in an early return from CServer::RunL(), skipping
+    // the call to request another message. So do that now in order to keep the
+    // server running.
+    ReStart();
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::PanicClient
+// Panic client.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngine::PanicClient( const RMessage2& aMessage, 
+                                   TAVCPEnginePanic aPanic )
+    {
+    aMessage.Panic( KAVCPEngine, aPanic );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::PanicServer
+// Panic server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngine::PanicServer( TAVCPEnginePanic aPanic )
+    {
+    User::Panic( KAVCPEngine, aPanic );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::ThreadFunctionL
+// Create and start the server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngine::ThreadFunctionL()
+    {
+    // Construct active scheduler
+    CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( activeScheduler );
+
+    // Install active scheduler
+    // We don't need to check whether an active scheduler is already installed
+    // as this is a new thread, so there won't be one
+    CActiveScheduler::Install( activeScheduler );
+
+	User::RenameThread( KAVCPEngineName );
+    // Construct our server
+    CUpnpAVCPEngine* engine = CUpnpAVCPEngine::NewLC();    // Anonymous
+
+    RProcess::Rendezvous(KErrNone);
+
+	// Start handling requests
+	CActiveScheduler::Start();	
+
+    CleanupStack::PopAndDestroy( engine );
+	CleanupStack::PopAndDestroy( activeScheduler );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngine::ThreadFunctionL
+// Create and start the server.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAVCPEngine::ThreadFunction( TAny* /*aNone*/ )
+    {
+    __UHEAP_MARK;
+    
+    CTrapCleanup* cleanupStack = CTrapCleanup::New();
+    if ( !(cleanupStack) )
+        {
+        PanicServer( EAVCPEngineGenerealPanic );
+        }
+
+    TRAPD( err, ThreadFunctionL() );
+    if ( err != KErrNone )
+        {
+        PanicServer( EAVCPEngineGenerealPanic );
+        }
+
+    delete cleanupStack;
+    cleanupStack = NULL;
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+TInt E32Main()
+    {
+	return CUpnpAVCPEngine::ThreadFunction(NULL);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpavcpenginehelper.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,99 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  helper class
+*
+*/
+
+
+#include "upnpavcpenginehelper.h"
+
+namespace UpnpAVCPEngine 
+{
+
+// -----------------------------------------------------------------------------
+// UpnpAVCPEngine::StrToIntL
+// -----------------------------------------------------------------------------
+//    
+TInt StrToIntL(const TDesC8& aValue)  
+	{
+	TLex8 returnedLex( aValue );
+	TInt value;
+	User::LeaveIfError( returnedLex.Val( value ));
+	return value;    
+	}
+
+// -----------------------------------------------------------------------------
+// UpnpAVCPEngine::GetLastPathElementL
+// -----------------------------------------------------------------------------
+//   
+HBufC8* GetLastPathElementL(TDes8& aPath) 
+	{        
+	RemoveSlashes(aPath);
+	TInt index = aPath.LocateReverse('/');
+	if (index == KErrNotFound) 
+	    index = 0;
+	                        
+	HBufC8* result = aPath.Right(aPath.Length() - index).AllocL();
+	TPtr8 ptr = result->Des();
+	RemoveSlashes(ptr);
+	aPath.Delete( index, aPath.Length() - index);
+	return result;                          
+	}
+
+// -----------------------------------------------------------------------------
+// UpnpAVCPEngine::ParsePathToElementsL
+// -----------------------------------------------------------------------------
+//   
+void ParsePathToElementsL(TPtr8 aPath, RPointerArray<TPtrC8>& aArray ) 
+	{
+	TChar delimiter('/');
+	RemoveSlashes(aPath);
+
+	TPtrC8 ptr(aPath);
+    TInt i = 0;
+
+	while(KErrNotFound != ptr.Locate(delimiter))
+	    {	
+	    aArray.Append( new (ELeave)TPtrC8() );
+		aArray[i]->Set(ptr.Left((ptr.Locate(delimiter))));
+    	ptr.Set(ptr.Right(ptr.Length() - (ptr.Locate(delimiter) + 1)) ); 
+	    i++;
+	    }
+	    
+	aArray.Append( new (ELeave) TPtrC8() );
+   	aArray[i]->Set(ptr);    		
+	}
+
+// -----------------------------------------------------------------------------
+// UpnpAVCPEngine::RemoveSlashes
+// -----------------------------------------------------------------------------
+//   
+void RemoveSlashes(TDes8& aPath) 
+	{
+	if (aPath.Length() > 0 && aPath[0] == '/' ) 
+		{        
+		aPath.Delete(0,1);
+		}
+
+	// remove ending '/' 
+	TInt length = aPath.Length();                
+	if (length > 0 && aPath[length-1] == '/' ) 
+		{
+		aPath.Delete(length-1,1);   
+		}	   
+	}
+
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpavcpenginesession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,178 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpAVCPEngineSession
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpavcpenginesession.h"
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+#include "upnpcommand.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngineSession::CContentControlSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpAVCPEngineSession::CUpnpAVCPEngineSession( const RThread& /*aClient*/, 
+                                                CUpnpAVCPEngine& aAVCPEngine, 
+                                                CUpnpAVCPManager& aManager)
+    : CSession2(),
+    iAVCPEngine( aAVCPEngine ),
+    iAVCPManager( aManager )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngineSession::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngineSession::ConstructL()
+    {    
+    iAVCPEngine.IncrementSessions(this);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngineSession::~CUpnpAVCPEngineSession
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAVCPEngineSession::~CUpnpAVCPEngineSession()
+    {
+    iAVCPEngine.DecrementSessions(this);
+    iCommandList.ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngineSession::ServiceL
+// Handle client requests.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngineSession::ServiceL( const RMessage2& aMessage )
+    {
+	TInt index = KErrNotFound;
+    switch ( aMessage.Function() )
+        {
+        // getting result from previous invoked command
+        case EDownloadDeviceList:  
+        case EDownloadDirList:                    
+        case EDownloadMetadata:   
+        	DEBUGSTRING(("Command for results with id %d", aMessage.Int0()));
+            index = CommandById(aMessage.Int0());
+            
+            if (index != KErrNotFound) 
+            {
+                CUpnpCommand* resultCommand =  iCommandList[index];
+                CleanupStack::PushL(resultCommand);
+                resultCommand->SetResultL(aMessage);
+                CleanupStack::PopAndDestroy(resultCommand);
+                aMessage.Complete(KErrNone);
+            }
+            else 
+            {
+            	DEBUGSTRING(("Results not found %d", aMessage.Int0()));
+                aMessage.Complete(KErrNotFound);
+            }
+            break;
+        // all else commands
+        default:
+            CUpnpCommand* command = CUpnpCommand::NewL(iAVCPManager, *this, aMessage);            
+            if (command) 
+            {            	
+                iCommandList.Append(command);
+                CleanupStack::PushL(command);
+                command->ExecuteL();
+                CleanupStack::Pop(command); // it will be destroyed after completion
+            }
+            else 
+            {                            
+                PanicClient( aMessage, EAVCPEngineBadRequest );
+            }
+            break;
+        }
+        
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngineSession::RemoveCommand
+// remove command
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngineSession::RemoveCommand(CUpnpCommand* aCommand) 
+	{
+    TInt index = iCommandList.Find(aCommand); 
+    if (index != KErrNotFound) 
+	    {
+	    DEBUGSTRING8(("CUpnpAVCPEngineSession::RemoveCommand with index %d", index));
+	    iCommandList.Remove(index); 
+	    }
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngineSession::CommandById
+//  Index of command with given id
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAVCPEngineSession::CommandById(TInt aId) 
+	{
+    TInt i = KErrNotFound;
+
+    for ( i=0; i < iCommandList.Count() && iCommandList[i]->Id() != aId; i++ )
+    {}
+
+    if ( i != iCommandList.Count() )
+	    {
+        return i;
+	    }
+    return KErrNotFound;   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngineSession::PanicClient
+//  Panic client
+// -----------------------------------------------------------------------------
+//
+void CUpnpAVCPEngineSession::PanicClient( const RMessage2 &aMessage, TInt aPanic ) const
+	{
+	aMessage.Panic( KAVCPEngine, aPanic ) ; // Note: this panics the client thread, not server
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPEngineSession::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAVCPEngineSession* CUpnpAVCPEngineSession::NewL( 
+                                             const RThread& aClient, 
+                                             CUpnpAVCPEngine& aServer, 
+                                             CUpnpAVCPManager& aManager )
+    {
+    CUpnpAVCPEngineSession* self = new (ELeave) CUpnpAVCPEngineSession( 
+        aClient, aServer, aManager);
+    CleanupStack::PushL( self );
+    self->ConstructL() ;
+    CleanupStack::Pop( self ) ;
+    return self ;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpavcpmanager.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,324 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpAVCPManager
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "upnpavcpmanager.h"
+#include "upnpavcpenginehelper.h"
+#include "upnppathresolver.h"
+#include "upnpresponsehandler.h"
+#include "upnpmdebug.h"
+#include "upnpavcpenginecommon.h"
+
+
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::NewL
+// Creates an instance of the implementation.
+// -----------------------------------------------------------------------------
+CUpnpAVCPManager* CUpnpAVCPManager::NewL()
+	{ 
+	CUpnpAVCPManager* self = new (ELeave) CUpnpAVCPManager(NULL);
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::CUpnpAVCPManager
+// First phase construction.
+// -----------------------------------------------------------------------------
+CUpnpAVCPManager::CUpnpAVCPManager(MUpnpAVControlPointObserver* aObserver):CUpnpAVControlPoint((MUpnpAVControlPointObserver&)aObserver)
+	{
+    
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::ConstructL
+// Second phase construction.
+// -----------------------------------------------------------------------------
+void CUpnpAVCPManager::ConstructL()
+	{	    
+    
+    _LIT8( KMediaServer, "MediaServer" );
+	//CUpnpControlPoint::ConstructL( KMediaServer, value );	
+	CUpnpControlPoint::ConstructL( KMediaServer );	
+	InitializeCdsActionFactoryL();
+        
+	// maybe we should look for something different??
+	TPtrC8 devicePtr;
+    devicePtr.Set( UpnpSSDP::KSearchTargetAll );
+    //SSDP search for mediaserver UPnP devices
+	DEBUGSTRING(("Search for devices"));    
+	SearchL( devicePtr );
+	}
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+CUpnpAVCPManager::~CUpnpAVCPManager()
+	{
+	iPendingHandlers.Reset();
+	iHttpPendingHandlers.Reset();
+	iPathResolvers.ResetAndDestroy();    
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::NewCommandId
+// return new command id
+// -----------------------------------------------------------------------------	
+TInt CUpnpAVCPManager::NewCommandId() 
+	{
+	return ++iLastCommandId;
+	}	
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::PathResolver
+// return resolver or creates a new one
+// -----------------------------------------------------------------------------	
+CUpnpPathResolver& CUpnpAVCPManager::PathResolverL(const TDesC8& aUUID, CUpnpAVCPEngineSession* aSession) 
+    {
+	    
+    CUpnpPathResolver* resolver = CUpnpPathResolver::NewL(*this,aUUID);
+    CleanupStack::PushL(resolver);
+
+    TIdentityRelation<CUpnpPathResolver> matcher( CUpnpPathResolver::Match );
+	TInt idx = iPathResolvers.Find( resolver, matcher ); 
+	
+		
+	if (idx != KErrNotFound)   
+    	{
+	    CleanupStack::PopAndDestroy(resolver);	
+	    resolver = iPathResolvers[idx];
+    	}
+	else 
+    	{	    
+	    //subscribe
+	    CUpnpDevice* device = const_cast<CUpnpDevice*>(Device(aUUID));
+	    if (device) 
+	    	{
+	        CUpnpService* service  = Service(device, UpnpAVCPEngine::KContentDirectory);
+			DEBUGSTRING8(("Subscribe for events"));	        
+	        SubscribeL( service );
+	    	} 
+	    else 
+	    	{
+	    	User::Leave(KErrNotFound);
+	    	}
+	    CleanupStack::Pop(resolver);	
+	    iPathResolvers.Append(resolver);	    
+    	}  
+    	
+    resolver->RegisterSession(aSession);	
+    return *resolver;	
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::CleanupSession
+// cleanup after closed client session
+// -----------------------------------------------------------------------------		
+void CUpnpAVCPManager::CleanupSessionL( CUpnpAVCPEngineSession* aSession) 
+	{
+	DEBUGSTRING8(("CleanupSessionL"));	        	
+    for (TInt i = 0; i < iPathResolvers.Count(); i++ ) 
+    {
+        if (iPathResolvers[i]->UnregisterSession(aSession) == 0 ) 
+        {
+            //unsubscribe
+            CUpnpDevice* device = const_cast<CUpnpDevice*>(Device(iPathResolvers[i]->UUID()));
+	        if (device) 
+	        {
+	            CUpnpService* service  = Service(device, UpnpAVCPEngine::KContentDirectory);
+	            DEBUGSTRING8(("UnsubscribeL for events"));
+	            UnsubscribeL( service );
+	        }
+	    
+            //remove
+            delete iPathResolvers[i];
+            iPathResolvers.Remove(i);
+            i--;
+        }
+    }    
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::RegisterForAction
+// register for get action responses
+// -----------------------------------------------------------------------------			
+void CUpnpAVCPManager::RegisterForAction(MUpnpResponseHandler& aHandler)	 
+  {
+      iPendingHandlers.Append(&aHandler);
+  }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::HandlerBySessionId
+// return index of handler for specific session
+// -----------------------------------------------------------------------------	
+TInt CUpnpAVCPManager::HandlerBySessionId(TInt aSessionId) 
+    {
+    TInt i = KErrNotFound;
+
+    for ( i=0; i < iPendingHandlers.Count() && iPendingHandlers[i]->SessionId() != aSessionId; i++ )
+    {}
+
+    if ( i != iPendingHandlers.Count() )
+        {
+        return i;
+        }
+    return KErrNotFound;   
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::HandlerBySessionId
+// return index of handler for specific session
+// -----------------------------------------------------------------------------	
+void CUpnpAVCPManager::RegisterForHttp(MUpnpHttpResponseHandler& aHandler)	 
+    {
+    iHttpPendingHandlers.Append(&aHandler);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::HandlerBySessionId
+// return index of handler for specific session
+// -----------------------------------------------------------------------------	    
+void CUpnpAVCPManager::UnregisterForHttp(MUpnpHttpResponseHandler& aHandler)	 
+    {
+    TInt index = iHttpPendingHandlers.Find(&aHandler);
+    if (index != KErrNotFound) 
+        {
+        iHttpPendingHandlers.Remove(index);    
+        }        
+    }    
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::HandlerBySessionId
+// return index of handler for specific session
+// -----------------------------------------------------------------------------	
+TInt CUpnpAVCPManager::HttpHandlerBySessionId(TInt aSessionId) 
+    {
+    TInt i = KErrNotFound;
+
+    for ( i=0; i < iHttpPendingHandlers.Count() && iHttpPendingHandlers[i]->SessionId() != aSessionId; i++ )
+    {}
+
+    if ( i != iHttpPendingHandlers.Count() )
+        {
+            return i;
+        }
+    return KErrNotFound;   
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::HandlerBySessionId
+// return index of handler for specific session
+// -----------------------------------------------------------------------------	
+void CUpnpAVCPManager::ActionResponseReceivedL(CUpnpAction* aAction) 
+    {
+    TInt sessionId = aAction->SessionId();	
+    TInt index = HandlerBySessionId(sessionId);
+    if (index != KErrNotFound) 
+        {
+        MUpnpResponseHandler* handler = iPendingHandlers[index];
+        iPendingHandlers.Remove(index);        
+        handler->InterpretL(aAction->Error(), aAction);    
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAVCPManager::StateUpdatedL
+//  Handles UPnP device events.
+// -----------------------------------------------------------------------------	
+void CUpnpAVCPManager::StateUpdatedL(CUpnpService*  aService) 
+    {
+    CUpnpPathResolver* resolver = CUpnpPathResolver::NewL(*this,aService->Device().Uuid());
+    CleanupStack::PushL(resolver);
+
+    TIdentityRelation<CUpnpPathResolver> matcher( CUpnpPathResolver::Match );
+	TInt idx = iPathResolvers.Find( resolver, matcher ); 
+	CleanupStack::PopAndDestroy(resolver);	    	    	
+	
+	if (idx != KErrNotFound)   
+    	{	   
+	    CUpnpStateVariable* systemUpdateId = aService->StateVariable( UpnpAVCPEngine::KSystemUpdateID );
+        if (systemUpdateId) 
+            {
+            (iPathResolvers[idx])->StateChangedL(systemUpdateId->Value()); 
+            }
+    	     
+    	}
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVCPManager::HttpResponseReceivedL
+// Handles HTTP messages.
+// --------------------------------------------------------------------------
+void CUpnpAVCPManager::HttpResponseReceivedL(CUpnpHttpMessage* aMessage)
+    {
+    TInt sessionId = aMessage->SessionId();    
+	
+    TInt index = HttpHandlerBySessionId(sessionId);
+    if (index != KErrNotFound) 
+        {
+        MUpnpHttpResponseHandler* handler = iHttpPendingHandlers[index];        
+        handler->InterpretL(aMessage->Error(), aMessage);    
+        } 
+    else 
+    	{
+    	index = index;
+       	}   
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVCPManager::DeviceDiscoveredL
+// Handles UPnP device discoveries.
+// --------------------------------------------------------------------------
+void CUpnpAVCPManager::DeviceDiscoveredL(CUpnpDevice* aDevice)
+    {
+	TPtrC8 uuid = aDevice->Uuid();    
+	TPtrC8 fn = aDevice->DescriptionProperty(KAVCPEngineFriendlyName);    	
+	DEBUGSTRING8(("DeviceDiscoveredL %S %S", &uuid, &fn));     
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVCPManager::DeviceDisappearedL(
+// Handles UPnP device disappears.
+// --------------------------------------------------------------------------
+void CUpnpAVCPManager::DeviceDisappearedL(CUpnpDevice* aDevice)
+    {
+	TPtrC8 uuid = aDevice->Uuid();
+	DEBUGSTRING8(("DeviceDiscoveredL %S", &uuid));     
+
+    CUpnpPathResolver* resolver = CUpnpPathResolver::NewL(*this,aDevice->Uuid());
+    CleanupStack::PushL(resolver);
+
+    TIdentityRelation<CUpnpPathResolver> matcher( CUpnpPathResolver::Match );
+	TInt idx = iPathResolvers.Find( resolver, matcher ); 
+	CleanupStack::PopAndDestroy(resolver);	    	    	
+	
+	if (idx != KErrNotFound)   
+		{    	    
+		   delete iPathResolvers[idx];   
+		   iPathResolvers.Remove(idx);
+		}	        
+    }
+    
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpbrowsecommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,345 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpBrowseCommand
+*
+*/
+
+
+#include "upnpbrowsecommand.h"
+
+#include "upnppathresolver.h"
+#include "upnppathelement.h"
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+
+#include "upnphttpmessagefactory.h"
+#include "upnpstring.h"
+#include "upnpcons.h"
+
+#include "upnpavcpenginehelper.h"
+using namespace UpnpAVCPEngine;
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpBrowseCommand* CUpnpBrowseCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage)
+	{
+    CUpnpBrowseCommand* self = new( ELeave ) CUpnpBrowseCommand(aAVCPManager, aSession, aMessage);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;   
+	}	
+  
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//  
+void CUpnpBrowseCommand::ConstructL() 
+	{
+	CUpnpCommand::BaseConstructL();
+	} 
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::CUpnpBrowseCommand
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------   
+CUpnpBrowseCommand::CUpnpBrowseCommand(CUpnpAVCPManager& aAVCPManager, 
+                   CUpnpAVCPEngineSession& aSession, 
+                   const RMessage2& aMessage):
+                   CUpnpCommand( aAVCPManager,
+                   		     aSession, 
+                   		     aMessage)
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::~CUpnpBrowseCommand
+// desctructor
+// -----------------------------------------------------------------------------
+// 
+CUpnpBrowseCommand::~CUpnpBrowseCommand()
+	{
+    delete iObjectId;
+    delete iObjectName;
+    iResult.Reset();
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::SessionId
+// -----------------------------------------------------------------------------
+// 
+TInt CUpnpBrowseCommand::SessionId() 
+	{
+    return CUpnpCommand::SessionId();   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::RunError
+// -----------------------------------------------------------------------------
+// 
+void CUpnpBrowseCommand::RunError(TInt aErrorCode) 
+	{
+    return CUpnpCommand::RunError(aErrorCode);   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::ExecuteL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpBrowseCommand::ExecuteL()
+	{
+	//ASSERT(iType == EPrepareDirList || iType == EDirAttributes || iType == EFileAttributes);
+    
+    HBufC8* uuid = NULL;
+    HBufC8* path = NULL;
+    if (iType == EPrepareDirList) 
+    	{
+    	DEBUGSTRING(("Execute Browse command (dir listing)"));
+    	// set command id
+        TPckg<TInt> numPckg(iId);               
+        iMessage.WriteL(0, numPckg);            
+        
+        uuid = ReadDes8FromMessageLC(2);    	            
+        DEBUGSTRING8(("  uuid: %S",uuid));	
+    	path = ReadDes8FromMessageLC(3);
+    	DEBUGSTRING8(("  path: %S",path));	    	    	    		    	
+    	}
+    else 
+    	{    	
+    	DEBUGSTRING(("Execute Browse command (attributes)"));
+    	uuid = ReadDes8FromMessageLC(0);
+    	DEBUGSTRING8(("  uuid: %S",uuid));	    	            	
+    	path = ReadDes8FromMessageLC(1);
+    	DEBUGSTRING8(("  path: %S",path));	      	    	
+    	}
+    
+    iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession));
+    DEBUGSTRING(("Resolve path %S", path));	 
+    iPathResolver->ResolveIdL(*path, *this);
+
+	CleanupStack::PopAndDestroy(path);        
+	CleanupStack::PopAndDestroy(uuid);          
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::SetResultL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpBrowseCommand::SetResultL(const RMessage2& aMessage) 
+	{
+	//ASSERT(aMessage.Function() == EDownloadDirList);
+
+     TInt size = iResult.Count();
+      TFileInfo* dirs = new  TFileInfo[size];
+      for (TInt i = 0; i < size; i++) 
+      	{
+         dirs[i] = iResult[i];
+      	}
+      TPtr8 result(reinterpret_cast<TUint8*>(dirs), sizeof(TFileInfo)*size, sizeof(TFileInfo)*size);          
+      aMessage.WriteL(1, result);  
+      delete[] dirs;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::SetAttForObject
+// -----------------------------------------------------------------------------
+// 
+TBool CUpnpBrowseCommand::SetAttForObject(RArray<TFileInfo>& aList, const TDesC8& aName)
+	{
+	TBool result(EFalse);
+    for (TInt i = 0; i < aList.Count(); i++) 
+    	{
+        if (aList[i].iName.Compare(aName) == 0) 
+        	{   
+            iAttr = aList[i]; 
+            result = ETrue;
+            break;   
+        	}
+    	}
+	return result;    	
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::SendHeadRequestL
+// -----------------------------------------------------------------------------
+//
+void CUpnpBrowseCommand::SendHeadRequestL(const TDesC8& aUrl) 
+	{
+	DEBUGSTRING8(("Send HTTP HEAD request for %S", &aUrl));
+	
+	HBufC8* resURIencoded = UpnpString::StringReplaceL(aUrl, _L8(" "), _L8("%20"));    			
+
+	// we want wait for HEAD to get more info
+	CleanupStack::PushL(resURIencoded);
+	CUpnpHttpMessage* msg = RUpnpHttpMessageFactory::HttpHeadL( *resURIencoded );
+	CleanupStack::PopAndDestroy(resURIencoded);
+
+	CleanupStack::PushL( msg );    	            
+
+	iAVCPManager.SendL(msg);  
+	iSessionId = msg->SessionId();
+	iAVCPManager.RegisterForHttp(*this);         
+
+	CleanupStack::PopAndDestroy( msg ); 
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::Interpret
+// -----------------------------------------------------------------------------
+// 
+void CUpnpBrowseCommand::InterpretL(TInt aErrorCode, CUpnpAction* aAction) 
+	{
+	DEBUGSTRING(("Interpret action response %d", aErrorCode));
+    if (aErrorCode == EHttp200Ok ) 
+    	{
+
+        TInt startIndex = StrToIntL( aAction->ArgumentValue( KStartingIndex ) );         
+        TInt requestCount = StrToIntL( aAction->ArgumentValue( KRequestedCount ) );         
+        
+        TInt numberReturned = StrToIntL( aAction->ArgumentValue( KNumberReturned ) ); 
+        TInt totalMatches = StrToIntL( aAction->ArgumentValue( KTotalMatches ) );         
+                                        
+        HBufC8* resURI = NULL;
+
+        if (iType == EFileAttributes) 
+        	{
+        	iPathResolver->ParseBrowseResponseL( aAction->ArgumentValue( KResult ), &iResult, *iObjectId, &resURI);        	
+        	}
+        else 
+        	{
+        	iPathResolver->LockReset();
+         	iPathResolver->ParseBrowseResponseL( aAction->ArgumentValue( KResult ), &iResult);
+        	}
+
+        if (iType == EPrepareDirList)  
+        	{            
+        	
+            if ( startIndex+numberReturned < totalMatches)  
+            	{
+                iStartIndex +=  KRequestedCountLimit;
+               	iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(),*iObjectId, KBrowseDirectChildren, KDefaultBrowseFilter, iStartIndex, KRequestedCountLimit, KNullDesC8);                
+                iAVCPManager.RegisterForAction(*this);
+            	}
+            else 
+            	{
+            	iPathResolver->UnlockReset();
+                TInt num(iResult.Count());                                    
+                TPckg<TInt> numPckg(num);       
+                // size of directory list
+                iMessage.WriteL(1, numPckg); 
+                iMessage.Complete(KErrNone);
+                // don't destroy and wait for next command
+            	}
+        	}
+        else 
+        	{            
+            if (SetAttForObject(iResult, *iObjectName))
+            	{
+                if (iType == EFileAttributes && resURI) 
+                	{
+                	CleanupStack::PushL(resURI);
+                	SendHeadRequestL(*resURI);
+                	CleanupStack::PopAndDestroy(resURI);                	                 
+                	resURI = NULL;
+                	}
+                else 
+                	{                        
+                    TPckg<TFileInfo> attrPckg(iAttr); 
+                    iMessage.WriteL(2,attrPckg);
+                    iMessage.Complete(KErrNone);                     
+                    delete this;                  
+                	}
+            	}
+            else 
+            	{
+                iMessage.Complete(KErrNotFound);
+				delete resURI;
+                delete this;   
+            	}
+        	}       
+    	}
+    else 
+    	{
+    	iPathResolver->UnlockReset();
+        iMessage.Complete(KErrAbort); 
+        delete this;
+    	}  
+     
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::Interpret
+// -----------------------------------------------------------------------------
+// 
+void CUpnpBrowseCommand::InterpretL(TInt aErrorCode, CUpnpHttpMessage* aMessage)  
+	{
+	DEBUGSTRING(("HTTP Interpret %d", aErrorCode));
+      // transfer pending   
+    if (aErrorCode == KHttpGetStarted) 
+    	{
+      	return;
+    	}    
+    iAVCPManager.UnregisterForHttp(*this);     
+    if (aErrorCode == EHttp200Ok || aErrorCode == EHttpPartialContent) 
+    	{
+		// set some attrs
+		iAttr.iMimeType = aMessage->GetHeaderValue(UpnpHTTP::KHdrContentType);  
+		TDesC8& size = aMessage->GetHeaderValue(UpnpHTTP::KHdrContentLength);  
+		TLex8 intLex( size );                			    	
+		intLex.Val( iAttr.iSize );
+	    }
+    
+	TPckg<TFileInfo> attrPckg(iAttr); 
+	iMessage.WriteL(2,attrPckg);       
+	iMessage.Complete(KErrNone);
+	delete this; 
+	}
+    
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::ResolvedId
+// -----------------------------------------------------------------------------
+//     
+void CUpnpBrowseCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement)
+	{
+    DEBUGSTRING(("ResolvedId %d", aErrCode));	 
+    if (aErrCode == KErrNone)  
+    	{    	
+        iObjectId = aIdElement->Id().AllocL();
+        iObjectName = aIdElement->Name().AllocL();
+        DEBUGSTRING(("Resolved object %S %S", iObjectId, iObjectName));
+        if (iType == EPrepareDirList) 
+        	{            
+            iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseDirectChildren, KDefaultBrowseFilter, iStartIndex, KRequestedCountLimit, KNullDesC8);
+        	}
+        else 
+        	{
+            iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseMetadata, KDefaultBrowseFilter, 0, 0, KNullDesC8);    
+        	}        
+        iAVCPManager.RegisterForAction(*this);        
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrNotFound);
+        delete this;
+    	}
+	}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpcommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,169 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpCommand
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpcommand.h"
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+#include "upnpavcpenginesession.h"
+// commands
+#include "upnpdevicelistcommand.h"
+#include "upnpbrowsecommand.h"
+#include "upnpdownloadcommand.h"
+#include "upnpuploadcommand.h"
+#include "upnpcreatecommand.h"
+#include "upnpdeletecommand.h"
+#include "upnpmetadatacommand.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpCommand::CUpnpCommand
+// C++ default constructor can NOT contain any code, that
+// might leae.
+// -----------------------------------------------------------------------------
+CUpnpCommand::CUpnpCommand(CUpnpAVCPManager& aAVCPManager, 
+                   CUpnpAVCPEngineSession& aSession, 
+                   const RMessage2& aMessage):
+                   iAVCPManager(aAVCPManager),
+                   iSession(aSession),
+                   iMessage(aMessage)                       
+    {
+    iType = (TAVCPEngineRqst)iMessage.Function();
+    iId = aAVCPManager.NewCommandId();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCommand::BaseConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpCommand::BaseConstructL()
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCommand::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCommand* CUpnpCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage)
+    {
+    	CUpnpCommand* command = NULL;
+		switch (aMessage.Function()) 
+			{  
+	        case EPrepareDeviceList:	        
+		        command = CUpnpDeviceListCommand::NewL(aAVCPManager, aSession, aMessage);
+	        break;
+	        case EPrepareDirList:
+            case EDirAttributes:          
+            case EFileAttributes:	        
+		        command = CUpnpBrowseCommand::NewL(aAVCPManager, aSession, aMessage);	        
+	        break;
+	        case EGetFile:
+		        command = CUpnpDownloadCommand::NewL(aAVCPManager, aSession, aMessage);	        
+	        break;
+	        case EPutFile:
+		        command = CUpnpUploadCommand::NewL(aAVCPManager, aSession, aMessage);	        
+	        break;	        
+	        case EDeleteFile:
+            case EDeleteDirectory:	        
+		        command = CUpnpDeleteCommand::NewL(aAVCPManager, aSession, aMessage);	        
+	        break;	       
+	        case ECreateFile:
+            case ECreateDirectory:	        
+		        command = CUpnpCreateCommand::NewL(aAVCPManager, aSession, aMessage);	        
+	        break;	 	        
+	        case EPrepareMetadata:
+            case ESetMetadata:                      
+		        command = CUpnpMetadataCommand::NewL(aAVCPManager, aSession, aMessage);	        
+	        break;	        
+			}    
+
+    return command;
+    }	
+
+// -----------------------------------------------------------------------------
+// CUpnpCommand::~CUpnpCommand
+// desctructor
+// -----------------------------------------------------------------------------
+//    
+CUpnpCommand::~CUpnpCommand()
+    {
+        iSession.RemoveCommand(this);
+    }
+    	
+// -----------------------------------------------------------------------------
+// CUpnpCommand::Id
+// -----------------------------------------------------------------------------
+//	
+TInt CUpnpCommand::Id() 
+	{
+	return iId;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCommand::SessionId
+// -----------------------------------------------------------------------------
+//	
+TInt CUpnpCommand::SessionId() 
+	{
+	return iSessionId;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCommand::ReadDes8FromMessageLC
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpCommand::ReadDes8FromMessageLC(TInt aIndex) 
+	{
+	HBufC8* result = NULL;
+    TInt length = iMessage.GetDesLength( aIndex );	    
+    result = HBufC8::NewLC(length);                             
+   	TPtr8 resultPtr = result->Des();
+    iMessage.ReadL( aIndex, resultPtr );     
+	return result;	
+	}
+ 
+// -----------------------------------------------------------------------------
+// CUpnpCommand::ReadDes16FromMessageLC
+// -----------------------------------------------------------------------------
+//        
+HBufC* CUpnpCommand::ReadDes16FromMessageLC(TInt aIndex) 
+	{
+	HBufC* result = NULL;
+    TInt length = iMessage.GetDesLength( aIndex );	    
+    result = HBufC::NewLC(length);                             
+   	TPtr resultPtr = result->Des();
+    iMessage.ReadL( aIndex, resultPtr );     
+	return result;
+	}
+       
+// -----------------------------------------------------------------------------
+// CUpnpCommand::RunError
+// -----------------------------------------------------------------------------
+//        
+void CUpnpCommand::RunError(TInt /*aErrorCode*/)
+	{
+    if (iMessage.Handle() != 0)
+    	iMessage.Complete(KErrAbort);
+	delete this;
+	}        
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpcreatecommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,228 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpCreateCommand
+*
+*/
+
+
+#include "upnpcreatecommand.h"
+
+#include "upnppathresolver.h"
+#include "upnppathelement.h"
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+
+#include "upnpavcpenginehelper.h"
+using namespace UpnpAVCPEngine;
+#include "upnpstring.h"
+
+
+_LIT8(KCreateFileTemplate, 
+    "<DIDL-Lite xmlns:dc=\"http://purl.org/dc/elements/1.1/\" \
+        xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" \
+        xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"> \
+	        <item  parentID=\"%S\" restricted=\"false\"> \
+	            <dc:title>%S</dc:title> \
+	            <upnp:class>object.item</upnp:class> \
+	            <res protocolInfo=\"*:*:*:*\"></res> \
+            </item> \
+        </DIDL-Lite>");
+        
+_LIT8(KCreateDirTemplate,     
+"<DIDL-Lite xmlns:dc=\"http://purl.org/dc/elements/1.1/\" \
+        xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" \
+        xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"> \
+	        <container parentID=\"%S\" restricted=\"false\"> \
+	            <dc:title>%S</dc:title> \
+	            <upnp:class>object.container</upnp:class> \
+            </container> \
+        </DIDL-Lite>");
+
+
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCreateCommand* CUpnpCreateCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage)
+	{
+    CUpnpCreateCommand* self = new( ELeave ) CUpnpCreateCommand(aAVCPManager, aSession, aMessage);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;   
+	}	
+  
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//   
+void CUpnpCreateCommand::ConstructL() 
+	{
+ 	CUpnpCommand::BaseConstructL();
+	} 
+
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::CUpnpCreateCommand
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------   
+//       
+CUpnpCreateCommand::CUpnpCreateCommand(CUpnpAVCPManager& aAVCPManager, 
+                   CUpnpAVCPEngineSession& aSession, 
+                   const RMessage2& aMessage):
+                   CUpnpCommand( aAVCPManager,
+                   		     aSession, 
+                   		     aMessage)
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::~CUpnpCreateCommand
+// desctructor
+// -----------------------------------------------------------------------------
+// 
+CUpnpCreateCommand::~CUpnpCreateCommand()
+	{
+    delete iObjectId;
+    delete iTargetName;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::SessionId
+// -----------------------------------------------------------------------------
+// 
+TInt CUpnpCreateCommand::SessionId() 
+	{
+    return CUpnpCommand::SessionId();   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::RunError
+// -----------------------------------------------------------------------------
+// 
+void CUpnpCreateCommand::RunError(TInt aErrorCode) 
+	{
+    return CUpnpCommand::RunError(aErrorCode);   
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::ExecuteL
+// -----------------------------------------------------------------------------
+//
+void CUpnpCreateCommand::ExecuteL()
+	{
+	//ASSERT(iType == ECreateDirectory || iType == ECreateFile );
+    
+    HBufC8* uuid = NULL;
+    HBufC8* path = NULL;       
+    DEBUGSTRING(("Execute Create command "));        	
+    uuid = ReadDes8FromMessageLC(0);    	            	
+    DEBUGSTRING8(("  uuid: %S",uuid));	    
+    path = ReadDes8FromMessageLC(1);       	            	  
+    DEBUGSTRING8(("  path: %S",path));
+    
+	TPtr8 pathPtr = path->Des();	  
+	// removes also last element of path  
+    iTargetName = GetLastPathElementL(pathPtr);
+    
+    iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession));    
+    iPathResolver->ResolveIdL(*path, *this);    
+
+	CleanupStack::PopAndDestroy(path);        
+	CleanupStack::PopAndDestroy(uuid);          
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::SetResultL
+// -----------------------------------------------------------------------------
+//
+void CUpnpCreateCommand::SetResultL(const RMessage2& /*aMessage*/) 
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::Interpret
+// -----------------------------------------------------------------------------
+//
+void CUpnpCreateCommand::InterpretL(TInt aErrorCode, CUpnpAction* aAction) 
+	{
+	DEBUGSTRING(("Interpret action response %d", aErrorCode));	
+    if (aErrorCode == EHttp200Ok )    	 
+    	{    	 
+        if (iType == ECreateDirectory)
+        	{
+        	iMessage.Complete(KErrNone);
+        	}
+        else
+        	{
+        	if(iPathResolver->BrowseCreateObjectL( aAction->ArgumentValue( KResult )))
+        		{
+        		iMessage.Complete(KErrNone);            
+        		}
+        	else
+        		{
+        		iMessage.Complete(KErrAbort);
+        		}       
+        	}
+        	
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrAbort); 
+    	}  
+    delete this;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCreateCommand::ResolvedId
+// -----------------------------------------------------------------------------
+//
+void CUpnpCreateCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement)
+	{       
+    if (aErrCode == KErrNone)  
+    	{
+    	iElement = aIdElement;
+        iObjectId = aIdElement->Id().AllocL();
+        HBufC8* createMsg;
+        if (iType == ECreateDirectory )  
+        	{            
+            createMsg = HBufC8::NewLC(KCreateDirTemplate().Length() + iObjectId->Length() +  iTargetName->Length());
+            createMsg->Des().AppendFormat(KCreateDirTemplate, iObjectId, iTargetName);
+        	}
+        else 
+        	{
+            createMsg = HBufC8::NewLC(KCreateFileTemplate().Length() + iObjectId->Length() +  iTargetName->Length());                        
+            createMsg->Des().AppendFormat(KCreateFileTemplate, iObjectId, iTargetName);
+        	}
+        HBufC8* encoded = UpnpString::EncodeXmlStringL( createMsg );
+        CleanupStack::PopAndDestroy(createMsg);
+	    CleanupStack::PushL(encoded);	      
+        
+        iSessionId = iAVCPManager.CdsCreateObjectActionL(iPathResolver->UUID(), *iObjectId, *encoded);          
+        iAVCPManager.RegisterForAction(*this);
+        
+        CleanupStack::PopAndDestroy(encoded);	         
+        
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrNotFound);
+        delete this;
+    	}
+    
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpdeletecommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,169 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpDeleteCommand
+*
+*/
+
+
+#include "upnpdeletecommand.h"
+
+#include "upnppathresolver.h"
+#include "upnppathelement.h"
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+
+
+#include "upnpavcpenginehelper.h"
+using namespace UpnpAVCPEngine;
+
+
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpDeleteCommand* CUpnpDeleteCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage)
+	{
+    CUpnpDeleteCommand* self = new( ELeave ) CUpnpDeleteCommand(aAVCPManager, aSession, aMessage);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;   
+	}	
+  
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//   
+void CUpnpDeleteCommand::ConstructL() 
+	{
+ 	CUpnpCommand::BaseConstructL();
+ 	} 
+
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::CUpnpDeleteCommand
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------   
+//       
+CUpnpDeleteCommand::CUpnpDeleteCommand(CUpnpAVCPManager& aAVCPManager, 
+                   CUpnpAVCPEngineSession& aSession, 
+                   const RMessage2& aMessage):
+                   CUpnpCommand( aAVCPManager,
+                   		     aSession, 
+                   		     aMessage)
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::~CUpnpDeleteCommand
+// desctructor
+// -----------------------------------------------------------------------------
+// 
+CUpnpDeleteCommand::~CUpnpDeleteCommand()
+	{    
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::SessionId
+// -----------------------------------------------------------------------------
+// 
+TInt CUpnpDeleteCommand::SessionId() 
+	{
+    return CUpnpCommand::SessionId();   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::RunError
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDeleteCommand::RunError(TInt aErrorCode) 
+	{
+    return CUpnpCommand::RunError(aErrorCode);   
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::ExecuteL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDeleteCommand::ExecuteL()
+	{
+	//ASSERT(iType == EDeleteDirectory || iType == EDeleteFile );
+    
+    HBufC8* uuid = NULL;
+    HBufC8* path = NULL;       
+    DEBUGSTRING(("Execute Delete command"));
+            	
+    uuid = ReadDes8FromMessageLC(0);    
+    DEBUGSTRING8(("  uuid: %S",uuid)); 	            	
+    path = ReadDes8FromMessageLC(1);       	         	    		  
+    DEBUGSTRING8(("  path: %S",path)); 
+    
+    iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession));
+    	 
+    iPathResolver->ResolveIdL(*path, *this);
+
+	CleanupStack::PopAndDestroy(path);        
+	CleanupStack::PopAndDestroy(uuid);          
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::SetResultL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDeleteCommand::SetResultL(const RMessage2& /*aMessage*/) 
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::Interpret
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDeleteCommand::InterpretL(TInt aErrorCode, CUpnpAction* /*aAction*/) 
+	{
+	DEBUGSTRING(("Interpret action response %d", aErrorCode));	
+    if (aErrorCode == EHttp200Ok) 
+    	{
+		iMessage.Complete(KErrNone); 		            
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrAbort); 
+    	}   
+	delete this;    	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDeleteCommand::ResolvedId
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDeleteCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement)
+	{    
+    if (aErrCode == KErrNone)  
+    	{        
+    	//remove from remote MS
+        iSessionId = iAVCPManager.CdsDestroyObjectActionL(iPathResolver->UUID(), aIdElement->Id());    
+        iAVCPManager.RegisterForAction(*this);              
+    	// remove from local cache
+    	iPathResolver->RemoveElementD(aIdElement);     	
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrNotFound);
+        delete this;
+    	}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpdevicelistcommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,128 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpDeviceListCommand
+*
+*/
+
+
+#include "upnpdevicelistcommand.h"
+
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+
+
+// -----------------------------------------------------------------------------
+// CUpnpDeviceListCommand::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpDeviceListCommand* CUpnpDeviceListCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage)
+	{
+    CUpnpDeviceListCommand* self = new( ELeave ) CUpnpDeviceListCommand(aAVCPManager, aSession, aMessage);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;   
+	}	
+  
+// -----------------------------------------------------------------------------
+// CUpnpDeviceListCommand::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//   
+void CUpnpDeviceListCommand::ConstructL() 
+	{
+ 	CUpnpCommand::BaseConstructL();
+	} 
+  
+// -----------------------------------------------------------------------------
+// CUpnpDeviceListCommand::CUpnpDeviceListCommand
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------   
+//    
+CUpnpDeviceListCommand::CUpnpDeviceListCommand(CUpnpAVCPManager& aAVCPManager, 
+                   CUpnpAVCPEngineSession& aSession, 
+                   const RMessage2& aMessage):
+                   CUpnpCommand( aAVCPManager,
+                   		     aSession, 
+                   		     aMessage)
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDeviceListCommand::~CUpnpDeviceListCommand
+// desctructor
+// -----------------------------------------------------------------------------
+// 
+CUpnpDeviceListCommand::~CUpnpDeviceListCommand()
+	{
+    delete[] iDevices;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpDeviceListCommand::ExecuteL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDeviceListCommand::ExecuteL()
+	{
+	//ASSERT(iType == EPrepareDeviceList);
+
+	RPointerArray<CUpnpDevice> devices = iAVCPManager.DeviceList();
+	iDeviceCount = devices.Count();
+    DEBUGSTRING8(("Execute DeviceListCommand no. %d",iDeviceCount));
+
+	// set command id	
+    TPckg<TInt> idPckg(iId);       		
+	iMessage.WriteL(0, idPckg);         
+	   
+	// set device count - list only MS devices
+	TPckg<TInt> devCountPckg(iDeviceCount);       		
+	iMessage.WriteL(1, devCountPckg);            
+	
+	iMessage.Complete(KErrNone);
+	
+    if ( iDeviceCount > 0) 
+    	{                
+        iDevices = new(ELeave)TAVDevice[iDeviceCount];
+        for (TInt i = 0; i < iDeviceCount; i++) 
+        	{
+            CUpnpDevice* device = devices[i];
+            iDevices[i].iUDN.Copy( device->Uuid() );
+            iDevices[i].iFriendlyName.Copy( device->DescriptionProperty(KAVCPEngineFriendlyName) );  
+        	}
+    	}
+    else 
+    	{
+        delete this;   
+    	}   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDeviceListCommand::SetResultL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDeviceListCommand::SetResultL(const RMessage2& aMessage) 
+	{
+	DEBUGSTRING8(("Set Result from DeviceListCommand"));
+	//ASSERT(aMessage.Function() == EDownloadDeviceList);
+    if (iDevices) 
+    	{
+      	TPtr8 result(reinterpret_cast<TUint8*>(iDevices), sizeof(TAVDevice)*iDeviceCount, sizeof(TAVDevice)*iDeviceCount);
+      	aMessage.WriteL(1, result);  
+    	}	
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpdownloadcommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,257 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpDownloadCommand
+*
+*/
+
+
+#include "upnpdownloadcommand.h"
+
+#include "upnppathresolver.h"
+#include "upnppathelement.h"
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+#include "upnphttpmessagefactory.h"
+
+#include "upnpstring.h"
+
+#include "upnpavcpenginehelper.h"
+using namespace UpnpAVCPEngine;
+
+_LIT8(KFilterFlag, "res,res@protocolInfo");
+
+// Operation option flags
+const TUint KRemoteAccessOptionGetToStartOfFile = 0x01;
+
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpDownloadCommand* CUpnpDownloadCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage)
+	{
+    CUpnpDownloadCommand* self = new( ELeave ) CUpnpDownloadCommand(aAVCPManager, aSession, aMessage);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;   
+	}	
+  
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//   
+void CUpnpDownloadCommand::ConstructL() 
+	{
+	CUpnpCommand::BaseConstructL();
+	} 
+
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::CUpnpDownloadCommand
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------   
+//     
+CUpnpDownloadCommand::CUpnpDownloadCommand(CUpnpAVCPManager& aAVCPManager, 
+                   CUpnpAVCPEngineSession& aSession, 
+                   const RMessage2& aMessage):
+                   CUpnpCommand( aAVCPManager,
+                   		     aSession, 
+                   		     aMessage)
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::~CUpnpDownloadCommand
+// desctructor
+// -----------------------------------------------------------------------------
+// 
+CUpnpDownloadCommand::~CUpnpDownloadCommand()
+	{
+    delete iObjectId;   
+    delete iDestPath;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::SessionId
+// -----------------------------------------------------------------------------
+// 
+TInt CUpnpDownloadCommand::SessionId() 
+	{
+    return CUpnpCommand::SessionId();   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::RunError
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDownloadCommand::RunError(TInt aErrorCode) 
+	{
+    return CUpnpCommand::RunError(aErrorCode);   
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::ExecuteL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDownloadCommand::ExecuteL()
+	{
+	//ASSERT(iType == EGetFile);
+    
+    HBufC8* uuid = NULL;
+    HBufC8* srcPath = NULL;
+    HBufC* destPath = NULL;    
+            
+    DEBUGSTRING(("Execute Download command "));
+    	    
+    uuid = ReadDes8FromMessageLC(0); 
+    DEBUGSTRING8(("  uuid: %S",uuid));    
+	srcPath = ReadDes8FromMessageLC(1);     
+	DEBUGSTRING8(("  srcPath: %S",srcPath));                    	
+	destPath = ReadDes16FromMessageLC(2); 		
+	DEBUGSTRING16(("  destPath: %S",destPath));    
+
+    TPckg<TFilePosition> posPkg(iPosition);
+	iMessage.ReadL( 3,posPkg );    
+	
+    // convert to 8-bit representation 
+    iDestPath = HBufC8::NewL(destPath->Length()); 
+    iDestPath->Des().Copy(*destPath);
+            
+    iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession));
+    	 
+    iPathResolver->ResolveIdL(*srcPath, *this);
+    
+    
+    CleanupStack::PopAndDestroy(destPath);          
+    CleanupStack::PopAndDestroy(srcPath);          
+	CleanupStack::PopAndDestroy(uuid);          
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::SetResultL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDownloadCommand::SetResultL(const RMessage2& /*aMessage*/) 
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::Interpret
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDownloadCommand::InterpretL(TInt aErrorCode, CUpnpAction* aAction) 
+	{
+	DEBUGSTRING(("Interpret action response %d", aErrorCode));	
+    HBufC8* resURI = NULL;
+    if (aErrorCode == EHttp200Ok && 
+        iPathResolver->GetResUriL( aAction->ArgumentValue( KResult ), *iObjectId, resURI)) 
+    	{    	    	    	    	
+    
+    	DEBUGSTRING8(("Send HTTP GET request for %S", resURI));
+    	// encode URI
+    	CleanupStack::PushL(resURI);
+    	HBufC8* resURIencoded = UpnpString::StringReplaceL(*resURI, _L8(" "), _L8("%20"));    	
+    	CleanupStack::PopAndDestroy(resURI);
+    	
+        CleanupStack::PushL(resURIencoded);
+        CUpnpHttpMessage* msg = RUpnpHttpMessageFactory::HttpGetL( *resURIencoded );
+        CleanupStack::PopAndDestroy(resURIencoded);
+        
+	    CleanupStack::PushL( msg );
+		msg->SetInFilenameL( *iDestPath, ETrue );		
+    	msg->SetHttpPriority( EPriorityLess );
+    	
+    	if (iPosition.iStart != 0 || iPosition.iLength != 0 ) 
+    		{
+    		DEBUGSTRING8(("  Use ramge header. From %d to %d (flag:%d) ", 
+    			iPosition.iStart, iPosition.iLength, iPosition.iFlags));
+    		iUseRange = ETrue;
+    		if (iPosition.iFlags == KRemoteAccessOptionGetToStartOfFile)
+    			msg->SetRangeL(iPosition.iStart, iPosition.iLength, ETrue);
+    		else 
+    			msg->SetRangeL(iPosition.iStart, iPosition.iLength, EFalse);    	    
+    		}	
+    	
+        iAVCPManager.SendL(msg);  
+        iSessionId = msg->SessionId();
+        iAVCPManager.RegisterForHttp(*this);         
+        
+        CleanupStack::PopAndDestroy( msg );              
+    	}
+    else 
+    	{
+    	DEBUGSTRING8(("   No resouse URI found"));
+        iMessage.Complete(KErrAbort); 
+        delete this;
+    	}   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::Interpret
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDownloadCommand::InterpretL(TInt aErrorCode, CUpnpHttpMessage* /*aMessage*/) 
+	{
+	DEBUGSTRING(("HTTP Interpret %d", aErrorCode));	
+    if (aErrorCode == KHttpGetStarted) 
+    	{
+      	// transfer pending   
+      	return;
+    	}
+    iAVCPManager.UnregisterForHttp(*this); 
+    if (aErrorCode == EHttp200Ok || aErrorCode == EHttpPartialContent) 
+    	{
+    	if (iUseRange && aErrorCode == EHttp200Ok) 
+    		{
+    		iPosition.iLength = 0;
+    	    TPckg<TFilePosition> posPkg(iPosition);
+			iMessage.WriteL( 3,posPkg );
+    		}
+       	iMessage.Complete(KErrNone); 
+       	delete this;
+    	}
+    else  
+    	{
+       	iMessage.Complete(KErrAbort);         
+       	delete this;
+    	}    
+	}	
+
+// -----------------------------------------------------------------------------
+// CUpnpDownloadCommand::ResolvedId
+// -----------------------------------------------------------------------------
+// 
+void CUpnpDownloadCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement)
+	{
+    DEBUGSTRING(("ResolvedId %d", aErrCode));    
+    if (aErrCode == KErrNone)  
+    	{
+        iObjectId = aIdElement->Id().AllocL();
+                    
+        iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseMetadata,KFilterFlag , 0, 0, KNullDesC8);    
+      
+        iAVCPManager.RegisterForAction(*this);        
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrNotFound);
+        delete this;
+    	}
+};
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpmetadatacommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,232 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpMetadataCommand
+*
+*/
+
+
+#include "upnpmetadatacommand.h"
+
+#include "upnppathresolver.h"
+#include "upnppathelement.h"
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+
+#include "upnpavcpenginehelper.h"
+using namespace UpnpAVCPEngine;
+
+#include "upnpstring.h"
+
+
+_LIT8(KFilterFlag, "*");
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMetadataCommand* CUpnpMetadataCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage)
+	{
+    CUpnpMetadataCommand* self = new( ELeave ) CUpnpMetadataCommand(aAVCPManager, aSession, aMessage);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;   
+	}	
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//     
+void CUpnpMetadataCommand::ConstructL() 
+	{
+ 	CUpnpCommand::BaseConstructL();
+	} 
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::CUpnpMetadataCommand
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------   
+//       
+CUpnpMetadataCommand::CUpnpMetadataCommand(CUpnpAVCPManager& aAVCPManager, 
+                   CUpnpAVCPEngineSession& aSession, 
+                   const RMessage2& aMessage):
+                   CUpnpCommand( aAVCPManager,
+                   		     aSession, 
+                   		     aMessage)
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::~CUpnpMetadataCommand
+// desctructor
+// -----------------------------------------------------------------------------
+// 
+CUpnpMetadataCommand::~CUpnpMetadataCommand()
+	{
+    delete iObjectId;
+    delete iResult;
+    delete iOldMetadata;    
+    delete iNewMetadata;    
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::SessionId
+// -----------------------------------------------------------------------------
+// 
+TInt CUpnpMetadataCommand::SessionId() 
+{
+    return CUpnpCommand::SessionId();   
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::RunError
+// -----------------------------------------------------------------------------
+// 
+void CUpnpMetadataCommand::RunError(TInt aErrorCode) 
+	{
+    return CUpnpCommand::RunError(aErrorCode);   
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::ExecuteL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpMetadataCommand::ExecuteL()
+	{
+	//ASSERT(iType == EPrepareMetadata || iType == ESetMetadata);
+    
+    HBufC8* uuid = NULL;
+    HBufC8* path = NULL;
+    if (iType == EPrepareMetadata) 
+    	{
+    	DEBUGSTRING(("Execute Metadata command (EPrepareMetadata)"));    	
+    	// set command id
+        TPckg<TInt> numPckg(iId);               
+        iMessage.WriteL(0, numPckg);            
+            	
+		uuid = ReadDes8FromMessageLC(2); 
+  		DEBUGSTRING8(("  uuid: %S",uuid));		           	
+		path = ReadDes8FromMessageLC(3);   
+		DEBUGSTRING8(("  path: %S",path));		         	    	    		
+    	}
+    else 
+    	{
+    	DEBUGSTRING(("Execute Metadata command (ESetMetadata)"));
+		uuid = ReadDes8FromMessageLC(0);          
+		DEBUGSTRING8(("  uuid: %S",uuid));		           	
+    	path = ReadDes8FromMessageLC(1);
+    	DEBUGSTRING8(("  path: %S",path));
+    	
+    	HBufC8* old =  ReadDes8FromMessageLC(2);
+		iOldMetadata = UpnpString::EncodeXmlStringL(old);  		
+		CleanupStack::PopAndDestroy( old );
+		
+		HBufC8* newXML =  ReadDes8FromMessageLC(3);
+		iNewMetadata = UpnpString::EncodeXmlStringL( newXML );  		
+		CleanupStack::PopAndDestroy( newXML);		  	  	    	    
+    	}
+    
+    iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession));
+    	 
+    iPathResolver->ResolveIdL(*path, *this);
+
+	CleanupStack::PopAndDestroy(path);        
+	CleanupStack::PopAndDestroy(uuid);          
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::SetResultL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpMetadataCommand::SetResultL(const RMessage2& aMessage) 
+	{
+	//ASSERT(aMessage.Function() == EDownloadMetadata);
+	if (iResult) 
+		{        	        
+        TPtr8 result = iResult->Des();
+        aMessage.WriteL(1, result);          
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::Interpret
+// -----------------------------------------------------------------------------
+// 
+void CUpnpMetadataCommand::InterpretL(TInt aErrorCode, CUpnpAction* aAction) 
+	{
+	DEBUGSTRING(("Interpret action response %d", aErrorCode));	
+    if (aErrorCode == EHttp200Ok) 
+    	{
+
+        if (iType == EPrepareMetadata) 
+        	{
+            iResult = aAction->ArgumentValue( KResult ).AllocL();       
+            TInt num = iResult->Length();                                    
+            TPckg<TInt> numPckg(num);       
+            // size of  metadata information
+            iMessage.WriteL(1, numPckg); 
+            iMessage.Complete(KErrNone);
+            // don't destroy and wait for next command           
+        	}
+        else 
+        	{
+            // for set metadata
+            iMessage.Complete(KErrNone);  
+            delete this; 
+        	}
+                          
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrAbort); 
+        delete this;
+    	}   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataCommand::ResolvedId
+// -----------------------------------------------------------------------------
+// 
+void CUpnpMetadataCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement)
+	{
+    
+    if (aErrCode == KErrNone)  
+    	{
+        iObjectId = aIdElement->Id().AllocL();       
+        if (iType == EPrepareMetadata) 
+        	{            
+            iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseMetadata, KFilterFlag, 0, 0, KNullDesC8);                
+        	}
+        else //set metadata 
+        	{            
+            iSessionId = iAVCPManager.CdsUpdateObjectActionL(iPathResolver->UUID(), *iObjectId, *iOldMetadata, *iNewMetadata);    
+            delete iOldMetadata;
+            iOldMetadata = NULL;
+            delete iNewMetadata;
+            iNewMetadata = NULL;
+        	}
+        iAVCPManager.RegisterForAction(*this);        
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrNotFound);
+        delete this;
+    	}
+	}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnppathelement.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,247 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpPathElement
+*
+*/
+
+
+// INCLUDE FILES
+#include    "upnppathelement.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::CUpnpPathElement
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpPathElement::CUpnpPathElement()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpPathElement::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpPathElement* CUpnpPathElement::NewL()
+    {
+    CUpnpPathElement* self = new( ELeave ) CUpnpPathElement;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::~CUpnpPathElement
+// Destructor
+// -----------------------------------------------------------------------------
+//    
+CUpnpPathElement::~CUpnpPathElement()
+    {
+    delete iParentId;
+    delete iId;
+    delete iName;  
+    delete iOriginalName;  
+    delete iImportURI;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::SetParentIdL
+// -----------------------------------------------------------------------------
+//    
+void CUpnpPathElement::SetParentIdL(const TDesC8& aParentId) 
+    {
+    
+        delete  iParentId;
+        iParentId = NULL;  
+	    
+        iParentId = aParentId.AllocL();
+        
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::SetIdL
+// -----------------------------------------------------------------------------
+//    
+void CUpnpPathElement::SetIdL(const TDesC8& aId) 
+    {
+
+        delete  iId;
+        iId = NULL;  
+
+        iId = aId.AllocL();    
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::SetNameL
+// -----------------------------------------------------------------------------
+//    
+void CUpnpPathElement::SetNameL(const TDesC8& aName) 
+    {
+        delete  iName;
+        iName = NULL;  
+        
+        iName = aName.AllocL();  
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::SetImportURIL
+// -----------------------------------------------------------------------------
+//    
+void CUpnpPathElement::SetImportURIL(const TDesC8& aImportURI) 
+    {
+        delete  iImportURI;
+        iImportURI = NULL;  
+        
+        iImportURI = aImportURI.AllocL();  
+    }
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::SetOriginalNameL
+// -----------------------------------------------------------------------------
+//    
+void CUpnpPathElement::SetOriginalNameL(const TDesC8& aOriginalName) 
+    {
+        delete  iOriginalName;
+        iOriginalName = NULL;  
+        
+        iOriginalName = aOriginalName.AllocL();  
+    }
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::DeleteOriginalName
+// -----------------------------------------------------------------------------
+//    
+void CUpnpPathElement::DeleteOriginalName() 
+    {
+        delete  iOriginalName;
+        iOriginalName = NULL;          
+    }    
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::OriginalName
+// -----------------------------------------------------------------------------
+//    
+const TDesC8& CUpnpPathElement::OriginalName() const
+    {
+    if (iOriginalName) 
+	    {        
+	    return *iOriginalName;
+	    }
+    else 
+	    {
+        return KNullDesC8;
+	    }  
+    }    
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::ParentId
+// -----------------------------------------------------------------------------
+//    
+const TDesC8& CUpnpPathElement::ParentId() const 
+	{
+    if (iParentId) 
+	    {        
+	    return *iParentId;
+	    }
+    else 
+	    {
+        return KNullDesC8;
+	    }
+   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::Id
+// -----------------------------------------------------------------------------
+//    
+const TDesC8& CUpnpPathElement::Id() const
+	{
+    if (iId) 
+		{       
+		return *iId;
+		}
+    else 
+		{
+		return KNullDesC8;
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::Name
+// -----------------------------------------------------------------------------
+//    
+const TDesC8& CUpnpPathElement::Name() const
+	{
+    if (iName) 
+		{  
+		return *iName;
+		}
+    else 
+		{
+		return KNullDesC8;
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::ImportURI
+// -----------------------------------------------------------------------------
+//    
+const TDesC8& CUpnpPathElement::ImportURI() const
+	{
+    if (iImportURI) 
+		{  
+		return *iImportURI;
+		}
+    else 
+		{
+		return KNullDesC8;
+		}
+	}
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::MatchName
+// -----------------------------------------------------------------------------
+//    
+TBool CUpnpPathElement::MatchName(const CUpnpPathElement& aElement1, const CUpnpPathElement& aElement2) 
+	{
+    return   (aElement1.Name().Compare(aElement2.Name()) == 0) && 
+             (aElement1.ParentId().Compare(aElement2.ParentId()) == 0); 
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathElement::MatchAll
+// -----------------------------------------------------------------------------
+//    
+TBool CUpnpPathElement::MatchAll(const CUpnpPathElement& aElement1, const CUpnpPathElement& aElement2) 
+	{
+    return   (aElement1.Name().Compare(aElement2.Name()) == 0) && 
+             (aElement1.ParentId().Compare(aElement2.ParentId()) == 0) && 
+             (aElement1.Id().Compare(aElement2.Id()) == 0); 
+	}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnppathresolver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,695 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpPathResolver
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "upnppathresolver.h"
+#include    "upnppathelement.h"
+#include    "upnpresolvehandler.h"
+#include    "upnpavcpmanager.h"
+
+#include "upnpavcpenginecommon.h"
+#include "upnpavcpenginehelper.h"
+using namespace UpnpAVCPEngine;
+
+#include "upnpstring.h"
+
+#include <xmlengdom.h>
+#include <xmlengdomparser.h>
+
+#include "upnpdominterface.h"
+
+_LIT8(KIndexFormat, "(%d)");
+
+const static TInt KMaxElementsLimit = 1000;
+        			    	    
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::CUpnpPathResolver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpPathResolver::CUpnpPathResolver(CUpnpAVCPManager& aManager):
+    iManager(aManager), iUptodate(ETrue)
+    {
+    iSystemId = -1;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpPathResolver::ConstructL(const TDesC8& aUUID)
+    {
+    iUUID = aUUID.AllocL();
+    iDOMImpl.OpenL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpPathResolver* CUpnpPathResolver::NewL(CUpnpAVCPManager& aManager, const TDesC8& aUUID)
+    {
+    CUpnpPathResolver* self = new( ELeave ) CUpnpPathResolver(aManager);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL(aUUID);
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+ 
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::~CUpnpPathResolver
+// Destructor
+// -----------------------------------------------------------------------------
+//   
+CUpnpPathResolver::~CUpnpPathResolver()
+    {
+	delete iUUID;
+	iAVCPSessions.Reset();
+	iPathElements.ResetAndDestroy(); 
+	iResolveHandlers.ResetAndDestroy(); 
+	iDOMImpl.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::UUID
+// -----------------------------------------------------------------------------
+//   
+const TDesC8& CUpnpPathResolver::UUID() const
+    {
+	return *iUUID;                
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::Match
+// -----------------------------------------------------------------------------
+//   
+TBool CUpnpPathResolver::Match(const CUpnpPathResolver& aElement1, const CUpnpPathResolver& aElement2) 
+	{
+	return   (aElement1.UUID().Compare(aElement2.UUID()) == 0); 
+	}    
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::RegisterSession
+// -----------------------------------------------------------------------------
+//   
+void CUpnpPathResolver::RegisterSession(CUpnpAVCPEngineSession* aSession) 
+	{    
+	TInt index = iAVCPSessions.Find(aSession); 
+    if (index == KErrNotFound) 
+	    {
+	    iAVCPSessions.Append(aSession); 
+	    }
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::UnregisterSession
+// -----------------------------------------------------------------------------
+//   
+TInt CUpnpPathResolver::UnregisterSession(CUpnpAVCPEngineSession* aSession) 
+	{
+  	TInt index = iAVCPSessions.Find(aSession); 
+    if (index != KErrNotFound) 
+	    {
+	    iAVCPSessions.Remove(index); 
+	    }  
+    return iAVCPSessions.Count();
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::AddElementL
+// -----------------------------------------------------------------------------
+//   
+const TDesC8& CUpnpPathResolver::AddElementL(const TDesC8& aParentId, const TDesC8& aId, const TDesC8& aName, const TDesC8& aImportURI) 
+	{
+	// if we exceed max capacity for our cache, set to destroy all elements
+	if (iPathElements.Count() > KMaxElementsLimit)
+		iUptodate = EFalse;		
+		
+	
+    CUpnpPathElement* elem = CUpnpPathElement::NewL();
+    CleanupStack::PushL(elem);
+    elem->SetParentIdL(aParentId);
+    elem->SetIdL(aId);
+    elem->SetNameL(aName);
+    
+    TIdentityRelation<CUpnpPathElement> matcher( CUpnpPathElement::MatchAll );
+    // check if exist the same element
+	TInt idx = iPathElements.Find( elem, matcher ); 
+	
+	if (idx != KErrNotFound)   
+		{
+		if(aImportURI != KNullDesC8())
+			{
+			iPathElements[idx]->SetImportURIL(aImportURI);
+			}
+	    CleanupStack::PopAndDestroy(elem);
+	    return iPathElements[idx]->Name();
+		}
+	else 
+		{
+		// check name duplication
+		TIdentityRelation<CUpnpPathElement> matcherName( CUpnpPathElement::MatchName );
+	    TInt index = 0;
+	    TInt dupIndex = iPathElements.Find( elem, matcherName ); 
+	    
+	    while (dupIndex != KErrNotFound)
+	    	{
+	    	HBufC8* newName = HBufC8::NewLC(aName.Length() + 10 /*integer*/);
+	    	*newName = aName;
+           	newName->Des().AppendFormat(KIndexFormat, ++index ); 	
+           	// change to new name
+           	elem->SetNameL(*newName); 
+           	CleanupStack::PopAndDestroy( newName );
+           	dupIndex = iPathElements.Find( elem, matcherName );
+           	// check if exists the same element
+           	idx = iPathElements.Find( elem, matcher ); 
+           	if (idx != KErrNotFound)   
+				{
+				if(aImportURI != KNullDesC8())
+					{
+					iPathElements[idx]->SetImportURIL(aImportURI);
+					}
+	    		CleanupStack::PopAndDestroy(elem);
+	    		return iPathElements[idx]->Name();
+				}
+	    	} 
+	    if(aImportURI != KNullDesC8())
+			{
+			elem->SetImportURIL(aImportURI);
+			}
+	    CleanupStack::Pop(elem);
+        iPathElements.Append(elem);
+        return elem->Name();
+		}
+	  
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::GetElementId
+// -----------------------------------------------------------------------------
+//   
+CUpnpPathElement*  CUpnpPathResolver::GetElementL(const TDesC8& aParentId, const TDesC8& aName) const 
+	{
+    CUpnpPathElement* elem = CUpnpPathElement::NewL();
+    CleanupStack::PushL(elem);
+    elem->SetNameL(aName);
+    elem->SetParentIdL(aParentId);
+    TIdentityRelation<CUpnpPathElement> matcher( CUpnpPathElement::MatchName );
+	TInt idx = iPathElements.Find( elem, matcher ); 
+	CleanupStack::PopAndDestroy(elem);	
+	if (idx != KErrNotFound)   
+		{
+	   	return  iPathElements[idx];   
+		}
+	else 
+		{
+	    return NULL;
+		}  
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::RemoveElement
+// -----------------------------------------------------------------------------
+//   
+void CUpnpPathResolver::RemoveElementD(CUpnpPathElement* aElement)  
+	{
+	TInt index = iPathElements.Find(aElement);
+	if (index != KErrNotFound)   
+		{
+		iPathElements.Remove(index);
+		delete aElement;
+		} 
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::ResolveIdL
+// -----------------------------------------------------------------------------
+//   
+void CUpnpPathResolver::ResolveIdL(const TDesC8& aPath, MUpnpResolverObserver& aObserver) 
+	{
+	CUpnpResolveHandler* handler = CUpnpResolveHandler::NewL(iManager,*this, aObserver);	
+	CleanupStack::PushL(handler);
+	iResolveHandlers.Append(handler);
+	handler->ResolveL(aPath);	
+	CleanupStack::Pop(handler);	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::RemoveHandler
+// -----------------------------------------------------------------------------
+//   
+void CUpnpPathResolver::RemoveHandler(CUpnpResolveHandler* aHandler) 
+	{
+	TInt index = iResolveHandlers.Find(aHandler); 
+    if (index != KErrNotFound) 
+    	{
+        iResolveHandlers.Remove(index); 
+    	}
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::LockReset
+// -----------------------------------------------------------------------------
+//  
+void CUpnpPathResolver::LockReset() 
+	{
+	DEBUGSTRING8(("-> Obtain lock for resets")); 
+	iLocked = ETrue;	
+	}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::UnlockReset
+// -----------------------------------------------------------------------------
+//  
+void CUpnpPathResolver::UnlockReset() 	
+	{
+	DEBUGSTRING8(("<- Release lock for resets")); 
+	iLocked = EFalse;
+	if (!iUptodate) 
+		{
+ 		DEBUGSTRING8(("Remove all path elements"));        	
+       	iPathElements.ResetAndDestroy();  				
+       	iUptodate = ETrue;
+		}	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::StateChangedL
+// -----------------------------------------------------------------------------
+//   
+void CUpnpPathResolver::StateChangedL(const TDesC8& aSystemId) 
+	{
+	
+    TLex8 updateidLex( aSystemId );
+    TInt systemUpdate;
+    TInt err = updateidLex.Val( systemUpdate );
+    if (err == KErrNone) 
+    	{
+    	DEBUGSTRING8(("StateChangedL (old: %d)->(new: %d) ", iSystemId,systemUpdate));  
+        if (iSystemId != -1 && iSystemId != systemUpdate) 
+        	{
+        	if (!iLocked) 
+        		{
+	     		DEBUGSTRING8(("Remove all path elements"));        	
+    	       	iPathElements.ResetAndDestroy();        		
+        		}
+        	else 
+        		{        		
+        		iUptodate = EFalse;
+        		}
+        	}
+        iSystemId =  systemUpdate;
+    	}            
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::SetModifiedTimeL
+// -----------------------------------------------------------------------------
+//   
+void CUpnpPathResolver::SetModifiedTimeL(TXmlEngElement& aDateElement, TFileInfo& aEntry) 
+	{	
+	if (aDateElement.Value().Length())
+		{
+		HBufC8* date = aDateElement.Value().AllocLC(); 
+				
+		TPtrC8 datePtr =  date->Des();
+		
+		TInt position = datePtr.Locate('-');
+		TInt step = 0;
+		TInt dateParts[3];
+		while (position != KErrNotFound && step <3) 
+			{
+			TLex8 lex(datePtr.Left(position));
+			TInt value(0) ;
+			lex.Val(value);
+			
+			dateParts[step] = value;
+			step++;					
+		
+			
+			datePtr.Set(datePtr.Mid(position+1));							   	
+		   	position = datePtr.Locate('-');
+			}
+		
+		TLex8 lex(datePtr);
+		TInt value(0) ;
+		lex.Val(value);
+		
+		dateParts[step] = value;
+		
+		// implement data validation	
+	    aEntry.iModified = TDateTime(dateParts[0], TMonth(dateParts[1] -1), dateParts[2] -1, 0, 0, 0, 0); 
+	   	CleanupStack::PopAndDestroy(date);
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::ParseBrowseResponse
+// -----------------------------------------------------------------------------
+//   
+void CUpnpPathResolver::ParseBrowseResponseL(const TDesC8& aResponse, RArray<TFileInfo>* aDirList, const TDesC8& aObjectId, HBufC8** aResUri) 
+	{           
+	
+	RXmlEngDocument doc = ParseXmlL(aResponse);	
+        	
+	// Does return resorce URI?
+	TBool isReturnUri = aObjectId.Compare(KNullDesC8) != 0;
+	//Start browsing document tree
+	TXmlEngElement root = doc.DocumentElement();
+	CleanupClosePushL( doc );
+		
+	if(root.NotNull())
+		{		
+		
+	    RArray<TXmlEngElement> elements;
+		CleanupClosePushL( elements );
+		// get list of containers	    
+        UpnpDomInterface::GetElementListL(root, elements, KContainer, EFalse);  
+        // get list of items
+        UpnpDomInterface::GetElementListL(root, elements, KItem, EFalse);
+                    
+        for (TInt i = 0; i < elements.Count(); i++) 
+        	{
+            TXmlEngElement objElem = elements[i];   
+            TXmlEngElement titleElem;
+            // check title
+            if ( UpnpDomInterface::GetElementL(objElem, titleElem, KTitle ) &&
+            	titleElem.Value().Length()) 
+            	{
+            	// check if it's item or container
+                TBool isItem = UpnpDomInterface::CheckTagL(objElem, KItem);
+                
+                TPtrC8 id = UpnpDomInterface::GetAttrValueL( objElem, KId);
+                TPtrC8 parentId = UpnpDomInterface::GetAttrValueL( objElem, KParentId);
+                TPtrC8 title = titleElem.Value();                    			    			    
+			    
+				// try to add new path element, if name is taken, new name will be given
+				const TDesC8& newTitle = AddElementL(parentId, id, title);                       
+				// check if return dir list
+                if (aDirList) 
+                	{                        
+                    TFileInfo entry;   
+                    // set name                                                                             
+			        entry.iName = newTitle;			        
+			        
+					// set date			        		        
+			        TXmlEngElement dateElem;
+			        if (UpnpDomInterface::GetElementL(objElem, dateElem, KDate ) )
+			        	{
+			        	SetModifiedTimeL(dateElem, entry);    			        
+			        	}
+			  
+			        if (isItem) // for items
+			        	{
+			            entry.iAtt |= KEntryAttNormal;  
+			            // get size from res if exist 
+			            RArray<TXmlEngElement> resElements;
+						CleanupClosePushL( resElements );			            
+			            if (UpnpDomInterface::GetElementListL(objElem, resElements, KRes, EFalse)) 
+			            	{
+			            	// get prefer resource
+    	    				TXmlEngElement res = GetPreferResourceL(resElements);			            	
+			            	// maybe res URI should be returned
+			                if (isReturnUri && UpnpDomInterface::CheckAttributeValueL(objElem, KId, aObjectId)) 
+			                	{
+			                	if (res.NotNull() && res.Value().Length()) 
+			                		{
+			                		*aResUri = res.Value().AllocL();
+			                		}			                    
+			                	}			             
+    			            // set size base on res@size
+    			    	    TPtrC8 size = UpnpDomInterface::GetAttrValueL( res, KSize);	        			    	        			    	
+    			    	    TLex8 intLex( size );                			    	
+    			    	    intLex.Val( entry.iSize );
+    			    	    
+    			    	    //TPtrC8 importUri = UpnpDomInterface::GetAttrValueL( res, KImportUri);	
+    			    	    TPtrC8 restricted = UpnpDomInterface::GetAttrValueL( objElem, KRestricted);	
+							// check if read-only flag should be set
+    			    	    if (restricted.Compare(KOne) == 0 || restricted.CompareF(KTrue) == 0)
+    			    	    	{
+    			    	    	entry.iAtt |= KEntryAttReadOnly;
+    			    	    	}
+    			    	    
+			            	}
+						CleanupStack::PopAndDestroy(&resElements);	    			    	    			            	
+			        	}
+			        else // for containers
+			        	{
+			            entry.iAtt |= KEntryAttDir;  
+			        	}
+			            			    				   				   			        			    				    
+			        // add to dir result
+			        aDirList->Append(entry);
+                	}                    
+            	}
+        	}            
+		CleanupStack::PopAndDestroy(&elements);	        
+		}			
+	
+	//Cleanup
+	CleanupStack::PopAndDestroy(&doc);
+	}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::GetResUri
+// -----------------------------------------------------------------------------
+//   
+TBool CUpnpPathResolver::GetResUriL(const TDesC8& aResponse, const TDesC8& aId, HBufC8*& aResUri) 
+	{
+    TInt found(EFalse);
+    delete aResUri;
+    aResUri = NULL;
+        
+	RXmlEngDocument doc = ParseXmlL(aResponse);				
+	CleanupClosePushL( doc );
+				
+	//Start browsing document tree
+	TXmlEngElement root = doc.DocumentElement();
+	
+	if(root.NotNull())
+		{		    	
+        TXmlEngElement item;
+        if ( UpnpDomInterface::GetDirectoryElementL(root, item, KItem, KId, aId) )
+        	{
+    	    RArray<TXmlEngElement> resElements;
+    	    CleanupClosePushL(resElements);
+    	    if (UpnpDomInterface::GetElementListL(item, resElements, KRes, EFalse) ) 
+    	    	{
+    	    	TXmlEngElement res = GetPreferResourceL(resElements);
+                
+                if (res.Value().Length()) 
+                	{
+	                found = ETrue;	               
+    	            aResUri = res.Value().AllocL();                	
+                	}                
+    	    	}		
+    	    CleanupStack::PopAndDestroy(&resElements);		  				    
+        	}	              
+		}				
+
+	CleanupStack::PopAndDestroy(&doc);
+
+	return found;	
+	}
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::BrowseCreateObjectL
+// -----------------------------------------------------------------------------
+//   
+TBool CUpnpPathResolver::BrowseCreateObjectL(const TDesC8& aResponse) 
+	{
+    TInt found(EFalse);   
+	RXmlEngDocument doc = ParseXmlL(aResponse);			
+	CleanupClosePushL( doc );
+	//Start browsing document tree
+	TXmlEngElement root = doc.DocumentElement();
+	
+	if(root.NotNull())
+		{		
+        TXmlEngElement item;
+        if ( UpnpDomInterface::GetElementL(root, item, KItem) )
+            {    	    
+    	    
+    	    TPtrC8 id = UpnpDomInterface::GetAttrValueL( item, KId);
+            TPtrC8 parentid = UpnpDomInterface::GetAttrValueL( item, KParentId);    
+                    
+    	    if (id.Length() && parentid.Length()) 
+        	    {        	    	        	    	
+                    RArray<TXmlEngElement> resElements;
+    	    		CleanupClosePushL(resElements);
+                    
+                    if(UpnpDomInterface::GetElementListL(item, resElements, KRes, EFalse)) 
+                    	{
+                    	TPtrC8 import;
+                    	TXmlEngElement resElement = GetResourceWithImportURIL(resElements, import);
+		                
+		                
+		                if(import.Length())
+		                	{
+		             
+		    				TXmlEngElement titleElem;
+		    				
+		    				if(UpnpDomInterface::GetElementL(item, titleElem, KTitle))
+		    					{
+		    					if ( titleElem.Value().Length()) 
+		                        	{
+		                        	found = ETrue;   
+		                        	TPtrC8 title = titleElem.Value();                         	                       	
+		                        	AddElementL(parentid, id, title, import);                    	
+		                        	}
+		    					} 
+		                	}		                
+							
+						CleanupStack::PopAndDestroy(&resElements);	                   	                                          
+
+                    	}
+        	    }				  				        	    
+            }                         			    	      
+		}			
+	
+
+	//Cleanup
+	CleanupStack::PopAndDestroy(&doc);
+	
+    return found;	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::GetItemL
+// -----------------------------------------------------------------------------
+//   
+TBool CUpnpPathResolver::GetItemL(const TDesC8& aResponse, const TDesC8& aId) 
+	{
+    TInt found(EFalse);    
+
+	RXmlEngDocument doc = ParseXmlL(aResponse);			
+	CleanupClosePushL( doc );
+	//Start browsing document tree
+	TXmlEngElement root = doc.DocumentElement();
+	
+	if(root.NotNull())
+		{		
+        TXmlEngElement item;
+        if ( UpnpDomInterface::GetDirectoryElementL(root, item, KItem, KId, aId) )
+            {
+    	    RArray<TXmlEngElement> resElements;
+    	    CleanupClosePushL(resElements);
+    	    if (UpnpDomInterface::GetElementListL(item, resElements, KRes, EFalse) ) 
+        	    {        	    	
+                found = ETrue;                       
+        	    }				  				    
+    	    CleanupStack::PopAndDestroy(&resElements);	
+            }                         			    	      
+		}				
+
+	//Cleanup
+	CleanupStack::PopAndDestroy(&doc);
+	
+    return found;	
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::ParseXmlL
+// -----------------------------------------------------------------------------
+//   
+RXmlEngDocument CUpnpPathResolver::ParseXmlL(const TDesC8& aXml) 	
+	{
+		
+	//Create a parser
+	RXmlEngDOMParser parser;
+	User::LeaveIfError( parser.Open(iDOMImpl) );
+	CleanupClosePushL(parser);
+		
+	//Handler to the parsed document
+	RXmlEngDocument doc;				
+		
+	doc = parser.ParseL(aXml);	
+	CleanupClosePushL( doc );	
+        	
+	if(doc.IsNull()) 
+		{
+		User::Leave(KErrUnknown);
+		}
+		
+	CleanupStack::Pop(&doc);
+	CleanupStack::PopAndDestroy(&parser);			
+	return doc;		
+	}
+	
+
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::GetPreferResource
+// -----------------------------------------------------------------------------
+//   
+TXmlEngElement CUpnpPathResolver::GetPreferResourceL(const RArray<TXmlEngElement>& aElements) 	
+	{
+	//DEBUGSTRING8(("GetPreferResource "));   
+	if (aElements.Count() > 0)	
+		{
+		for (TInt i = 0; i < aElements.Count(); i++) 
+			{
+			TXmlEngElement elem = aElements[i];
+			TPtrC8 protocol = UpnpDomInterface::GetAttrValueL(elem, KProtocolInfo);
+			if (protocol.Left(KProtocolInfoBegin().Length()).Compare(KProtocolInfoBegin) == 0) 
+				{				
+				return elem;
+				}
+			}
+		DEBUGSTRING8(("GetPreferResource:   Return empty element (no http-get elements) "));   			
+		}
+	else 
+		{
+		DEBUGSTRING8(("GetPreferResource:   Return empty element (size of list = 0) "));   		
+		}
+	return TXmlEngElement();		
+	}
+// -----------------------------------------------------------------------------
+// CUpnpPathResolver::GetResourceWithImportURIL
+// -----------------------------------------------------------------------------
+//   
+TXmlEngElement CUpnpPathResolver::GetResourceWithImportURIL(const RArray<TXmlEngElement>& aElements, TPtrC8& aImportURI) 	
+	{	
+	aImportURI.Set(KNullDesC8);
+	
+	if (aElements.Count() > 0)	
+		{
+		for (TInt i = 0; i < aElements.Count(); i++) 
+			{
+			TXmlEngElement elem = aElements[i];
+			
+			aImportURI.Set(UpnpDomInterface::GetAttrValueL(elem, KImportUri));
+			if (aImportURI != KNullDesC8) 
+				{				
+				return elem;
+				}
+			}
+		}
+	return TXmlEngElement();		
+	}	
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpresolvehandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,229 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpResolveHandler
+*
+*/
+
+
+#include "upnpresolvehandler.h"
+#include "upnppathresolver.h"
+#include "upnppathelement.h"
+
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+
+
+#include "upnpstring.h"
+
+#include "upnpavcpenginehelper.h"
+#include "upnpmdebug.h"
+using namespace UpnpAVCPEngine;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpResolveHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpResolveHandler* CUpnpResolveHandler::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpPathResolver& aResolver, MUpnpResolverObserver& aObserver) 
+	{
+    CUpnpResolveHandler* self = new( ELeave ) CUpnpResolveHandler(aAVCPManager,aResolver, aObserver);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;    
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpResolveHandler::CUpnpResolveHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpResolveHandler::CUpnpResolveHandler(CUpnpAVCPManager& aAVCPManager,
+                            CUpnpPathResolver& aResolver, 
+                            MUpnpResolverObserver& aObserver):
+                            iAVCPManager(aAVCPManager),
+                            iResolver(aResolver),
+                            iObserver(aObserver),
+                            iPathIndex(-1)    
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpResolveHandler::~CUpnpResolveHandler
+// -----------------------------------------------------------------------------
+//
+CUpnpResolveHandler::~CUpnpResolveHandler()
+	{    
+	iResolver.RemoveHandler(this);
+	
+	delete iPath;
+	delete iLastId;
+	iPathElements.ResetAndDestroy();
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpResolveHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CUpnpResolveHandler::ConstructL() 
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpResolveHandler::SessionId
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpResolveHandler::SessionId() 
+	{
+    return iSessionId;    
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpResolveHandler::ResolveL
+// -----------------------------------------------------------------------------
+//
+void CUpnpResolveHandler::ResolveL(const TDesC8& aPath) 
+	{
+
+    delete iPath;
+    iPath = NULL;   
+
+    iPath = aPath.AllocL();
+    DEBUGSTRING8(("\tCResolveHandler::ResolveL %S", iPath));
+
+    UpnpAVCPEngine::ParsePathToElementsL(iPath->Des(),iPathElements);
+    
+    DEBUGSTRING8(("\tCount of path elements %d", iPathElements.Count()));
+    if (iPathElements.Count() == 0 || (iPathElements.Count() == 1 && iPathElements[0]->Length() == 0))	 
+    	{
+        CUpnpPathElement* elem = CUpnpPathElement::NewL();
+        CleanupStack::PushL(elem);
+        elem->SetIdL(KRootId());  
+        elem->SetNameL(KRootName());  
+       
+        iObserver.ResolvedIdL(KErrNone, elem);
+        CleanupStack::PopAndDestroy(elem);
+        delete this;
+    	}
+    else 
+    	{
+        iPathIndex = 0;
+        iLastId = KRootId().AllocL();
+        iResolver.LockReset();
+        CheckNextElementL();
+    	}
+	}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpResolveHandler::CheckNextElementL
+// -----------------------------------------------------------------------------
+//
+void CUpnpResolveHandler::CheckNextElementL(TBool aSendAction) 
+	{	
+	DEBUGSTRING8(("\tCheckNextElementL %d", aSendAction));
+    CUpnpPathElement* element = iResolver.GetElementL(*iLastId,*iPathElements[iPathIndex]);
+    
+    if (element) 
+    	{
+    	
+        iPathIndex++;
+                     
+        delete iLastId;
+        iLastId = NULL;
+        
+        iLastId = element->Id().AllocL();
+        DEBUGSTRING8(("\tFind element for index  %d with id %S", iPathIndex,iLastId));
+        if (iPathIndex == iPathElements.Count() ) 
+        	{
+            iObserver.ResolvedIdL(KErrNone, element);  
+            iResolver.UnlockReset();
+            delete this; 
+        	}
+        else 
+        	{
+            CheckNextElementL();
+        	}
+    	}	 
+    else if (aSendAction) 
+    	{
+        DEBUGSTRING8(("\tSend browse action for %S", iLastId));
+        iSessionId = iAVCPManager.CdsBrowseActionL(iResolver.UUID(),*iLastId, KBrowseDirectChildren, KDefaultBrowseFilter, iStartIndex, KRequestedCountLimit, KNullDesC8);                
+        DEBUGSTRING8(("\tSend browse action for %S with session id %d", iLastId, iSessionId));
+        iAVCPManager.RegisterForAction(*this);
+    	}
+    else 
+    	{
+        iObserver.ResolvedIdL(KErrNotFound, NULL); 
+        iResolver.UnlockReset();
+        delete this;
+    	}
+    
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpResolveHandler::Interpret
+// -----------------------------------------------------------------------------
+//
+void CUpnpResolveHandler::InterpretL(TInt aErrorCode, CUpnpAction* aAction) 
+	{
+	DEBUGSTRING(("\tInterpret %d", aErrorCode));
+    if (aErrorCode == EHttp200Ok) 
+    	{
+
+        TInt startIndex = StrToIntL( aAction->ArgumentValue( KStartingIndex ) );         
+        TInt requestCount = StrToIntL( aAction->ArgumentValue( KRequestedCount ) );         
+        
+        TInt numberReturned = StrToIntL( aAction->ArgumentValue( KNumberReturned ) ); 
+        TInt totalMatches = StrToIntL( aAction->ArgumentValue( KTotalMatches ) );         
+                                                  
+        iResolver.ParseBrowseResponseL(aAction->ArgumentValue( KResult ));  
+        
+        if ( startIndex+numberReturned < totalMatches)  
+        	{
+            iStartIndex +=  KRequestedCountLimit;
+            iSessionId = iAVCPManager.CdsBrowseActionL(iResolver.UUID(),*iLastId, KBrowseDirectChildren, KDefaultBrowseFilter, iStartIndex, KRequestedCountLimit, KNullDesC8);                
+            iAVCPManager.RegisterForAction(*this);
+        	}
+        else 
+        	{
+            CheckNextElementL(EFalse);
+        	}
+        
+    	}
+    else 
+    	{
+        iObserver.ResolvedIdL(KErrNotFound, NULL); 
+        iResolver.UnlockReset();
+        delete this;  
+    	}            
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpResolveHandler::RunError
+// -----------------------------------------------------------------------------
+//
+void CUpnpResolveHandler::RunError(TInt aErrorCode) 
+	{
+	DEBUGSTRING(("\tRunError %d", aErrorCode));	
+	TRAP_IGNORE( iObserver.ResolvedIdL(KErrNotFound, NULL) ); 
+	delete this;
+	}  	
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengine/src/upnpuploadcommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,226 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpUploadCommand
+*
+*/
+
+
+#include "upnpuploadcommand.h"
+
+#include "upnppathresolver.h"
+#include "upnppathelement.h"
+#include "upnpavcpmanager.h"
+#include "upnpavcontrolpoint.h"
+#include "upnphttpmessagefactory.h"
+
+#include "upnpavcpenginehelper.h"
+using namespace UpnpAVCPEngine;
+
+
+_LIT8(KBrowseFilter, "res,res@protocolInfo,res@importUri");
+
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpUploadCommand* CUpnpUploadCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage)
+	{
+    CUpnpUploadCommand* self = new( ELeave ) CUpnpUploadCommand(aAVCPManager, aSession, aMessage);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;   
+	}	
+  
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//    
+void CUpnpUploadCommand::ConstructL() 
+	{
+	CUpnpCommand::BaseConstructL();
+	} 
+
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::CUpnpUploadCommand
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------   
+//     
+CUpnpUploadCommand::CUpnpUploadCommand(CUpnpAVCPManager& aAVCPManager, 
+                   CUpnpAVCPEngineSession& aSession, 
+                   const RMessage2& aMessage):
+                   CUpnpCommand( aAVCPManager,
+                   		     aSession, 
+                   		     aMessage)
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::~CUpnpUploadCommand
+// desctructor
+// -----------------------------------------------------------------------------
+// 
+CUpnpUploadCommand::~CUpnpUploadCommand()
+	{
+    delete iObjectId;
+    delete iImportURI;   
+    delete iSrcPath;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::SessionId
+// -----------------------------------------------------------------------------
+// 
+TInt CUpnpUploadCommand::SessionId() 
+	{
+    return CUpnpCommand::SessionId();   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::RunError
+// -----------------------------------------------------------------------------
+// 
+void CUpnpUploadCommand::RunError(TInt aErrorCode) 
+	{
+    return CUpnpCommand::RunError(aErrorCode);   
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::ExecuteL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpUploadCommand::ExecuteL()
+	{
+	//ASSERT(iType == EPutFile);
+    
+    HBufC8* uuid = NULL;
+    HBufC8* dstPath = NULL;
+    HBufC* srcPath = NULL;
+
+   	DEBUGSTRING(("Execute Upload command"));
+    	            
+    uuid = ReadDes8FromMessageLC(0); 
+    DEBUGSTRING8(("  uuid: %S",uuid));       
+	srcPath = ReadDes16FromMessageLC(1);                     	
+	DEBUGSTRING16(("  srcPath: %S",srcPath));   			
+	dstPath = ReadDes8FromMessageLC(2); 
+	DEBUGSTRING8(("  dstPath: %S",dstPath));   		
+
+    // convert to 8-bit representation 
+    iSrcPath = HBufC8::NewL(srcPath->Length()); 
+    iSrcPath->Des().Copy(*srcPath);
+                      
+    iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession));
+    	 
+    iPathResolver->ResolveIdL(*dstPath, *this);
+    
+    CleanupStack::PopAndDestroy(dstPath);          
+    CleanupStack::PopAndDestroy(srcPath);          
+	CleanupStack::PopAndDestroy(uuid);          
+	}
+
+// -----------------------------------------------------------------------------
+// CCUploadCommand::SetResultL
+// -----------------------------------------------------------------------------
+// 
+void CUpnpUploadCommand::SetResultL(const RMessage2& /*aMessage*/) 
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::Interpret
+// -----------------------------------------------------------------------------
+// 
+void CUpnpUploadCommand::InterpretL(TInt aErrorCode, CUpnpAction* /*aAction*/) 
+	{
+	DEBUGSTRING(("Interpret action response %d", aErrorCode));	
+   
+    if (aErrorCode == EHttp200Ok)
+    	{    	
+    	if( iImportURI) 
+    		{    	    	        
+        	CUpnpHttpMessage* msg = RUpnpHttpMessageFactory::HttpPostL( *iImportURI );       
+	    	CleanupStack::PushL( msg );
+			msg->SetOutFilenameL( *iSrcPath );		    	    			
+        	iAVCPManager.SendL(msg);  
+        	iSessionId = msg->SessionId();
+        	iAVCPManager.RegisterForHttp(*this);         
+        
+        	CleanupStack::PopAndDestroy( msg );              
+    		}
+    	else
+    		{
+    		iMessage.Complete(KErrPathNotFound); 
+        	delete this;	
+    		}
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrAbort); 
+        delete this;
+    	}   
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::Interpret
+// -----------------------------------------------------------------------------
+// 
+void CUpnpUploadCommand::InterpretL(TInt aErrorCode, CUpnpHttpMessage* /*aMessage*/) 
+	{
+	DEBUGSTRING(("HTTP Interpret %d", aErrorCode));	
+    if (aErrorCode == KHttpPostStarted) 
+    	{
+      	// transfer pending   
+      	return;
+    	}
+    iAVCPManager.UnregisterForHttp(*this); 
+    if (aErrorCode == EHttp200Ok) 
+    	{
+    	iMessage.Complete(KErrNone);
+    	delete this; 
+    	}
+    else  
+    	{
+       	iMessage.Complete(KErrNotFound);         
+       	delete this;
+    	}    
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpUploadCommand::ResolvedId
+// -----------------------------------------------------------------------------
+// 
+void CUpnpUploadCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement)
+	{
+    
+    if (aErrCode == KErrNone)  
+    	{
+        iObjectId = aIdElement->Id().AllocL();
+        iImportURI = (aIdElement->ImportURI()!= KNullDesC8()) ? aIdElement->ImportURI().AllocL(): NULL;
+            
+        iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseMetadata, KBrowseFilter, 0, 0, KNullDesC8);    
+      
+        iAVCPManager.RegisterForAction(*this);        
+    	}
+    else 
+    	{
+        iMessage.Complete(KErrNotFound);
+        delete this;
+    	}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/BWINS/AVCPEngineClientU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+EXPORTS
+	??0RUpnpAVCPEngineMSClient@@QAE@XZ @ 1 NONAME ; RUpnpAVCPEngineMSClient::RUpnpAVCPEngineMSClient(void)
+	??0RUpnpAVCPEngineRFSClient@@QAE@XZ @ 2 NONAME ; RUpnpAVCPEngineRFSClient::RUpnpAVCPEngineRFSClient(void)
+	?AlbumL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 3 NONAME ; class TPtrC8 CUpnpMetadata::AlbumL(void)
+	?ArtistL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 4 NONAME ; class TPtrC8 CUpnpMetadata::ArtistL(void)
+	?AsXmlL@CUpnpMetadata@@QAEAAVRXmlEngDocument@@XZ @ 5 NONAME ; class RXmlEngDocument & CUpnpMetadata::AsXmlL(void)
+	?ClassL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 6 NONAME ; class TPtrC8 CUpnpMetadata::ClassL(void)
+	?CommitL@CUpnpMetadata@@QAEXAAVTRequestStatus@@@Z @ 7 NONAME ; void CUpnpMetadata::CommitL(class TRequestStatus &)
+	?CommitL@CUpnpMetadata@@QAEXXZ @ 8 NONAME ; void CUpnpMetadata::CommitL(void)
+	?Connect@RUpnpAVCPEngineClient@@UAEHXZ @ 9 NONAME ; int RUpnpAVCPEngineClient::Connect(void)
+	?CreateFileL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@@Z @ 10 NONAME ; int RUpnpAVCPEngineRFSClient::CreateFileL(class TDesC8 const &, class TDesC16 const &)
+	?CreatorL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 11 NONAME ; class TPtrC8 CUpnpMetadata::CreatorL(void)
+	?DeleteDirectoryL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@@Z @ 12 NONAME ; int RUpnpAVCPEngineRFSClient::DeleteDirectoryL(class TDesC8 const &, class TDesC16 const &)
+	?DeleteFileL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@@Z @ 13 NONAME ; int RUpnpAVCPEngineRFSClient::DeleteFileL(class TDesC8 const &, class TDesC16 const &)
+	?FetchL@CUpnpMetadata@@QAEXABVTDesC16@@@Z @ 14 NONAME ; void CUpnpMetadata::FetchL(class TDesC16 const &)
+	?FetchL@CUpnpMetadata@@QAEXABVTDesC16@@AAVTRequestStatus@@@Z @ 15 NONAME ; void CUpnpMetadata::FetchL(class TDesC16 const &, class TRequestStatus &)
+	?GenreL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 16 NONAME ; class TPtrC8 CUpnpMetadata::GenreL(void)
+	?GetDeviceListL@RUpnpAVCPEngineMSClient@@QAEHAAV?$RArray@VTAVDevice@@@@@Z @ 17 NONAME ; int RUpnpAVCPEngineMSClient::GetDeviceListL(class RArray<class TAVDevice> &)
+	?GetDirectoryAttributeL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@AAPAVCRsfwDirEntAttr@@@Z @ 18 NONAME ; int RUpnpAVCPEngineRFSClient::GetDirectoryAttributeL(class TDesC8 const &, class TDesC16 const &, class CRsfwDirEntAttr * &)
+	?GetDirectoryL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@AAV?$RPointerArray@VCRsfwDirEnt@@@@@Z @ 19 NONAME ; int RUpnpAVCPEngineRFSClient::GetDirectoryL(class TDesC8 const &, class TDesC16 const &, class RPointerArray<class CRsfwDirEnt> &)
+	?GetFileAttributeL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@AAPAVCRsfwDirEntAttr@@@Z @ 20 NONAME ; int RUpnpAVCPEngineRFSClient::GetFileAttributeL(class TDesC8 const &, class TDesC16 const &, class CRsfwDirEntAttr * &)
+	?GetFileL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@1HHIAAH@Z @ 21 NONAME ; int RUpnpAVCPEngineRFSClient::GetFileL(class TDesC8 const &, class TDesC16 const &, class TDesC16 const &, int, int, unsigned int, int &)
+	?IdL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 22 NONAME ; class TPtrC8 CUpnpMetadata::IdL(void)
+	?MakeDirectoryL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@@Z @ 23 NONAME ; int RUpnpAVCPEngineRFSClient::MakeDirectoryL(class TDesC8 const &, class TDesC16 const &)
+	?NewL@CUpnpMetadata@@SAPAV1@AAVRUpnpAVCPEngineMSClient@@@Z @ 24 NONAME ; class CUpnpMetadata * CUpnpMetadata::NewL(class RUpnpAVCPEngineMSClient &)
+	?PutFileL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@1@Z @ 25 NONAME ; int RUpnpAVCPEngineRFSClient::PutFileL(class TDesC8 const &, class TDesC16 const &, class TDesC16 const &)
+	?SetAlbumL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 26 NONAME ; void CUpnpMetadata::SetAlbumL(class TDesC8 const &)
+	?SetArtistL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 27 NONAME ; void CUpnpMetadata::SetArtistL(class TDesC8 const &)
+	?SetClassL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 28 NONAME ; void CUpnpMetadata::SetClassL(class TDesC8 const &)
+	?SetCreatorL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 29 NONAME ; void CUpnpMetadata::SetCreatorL(class TDesC8 const &)
+	?SetGenreL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 30 NONAME ; void CUpnpMetadata::SetGenreL(class TDesC8 const &)
+	?SetTitleL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 31 NONAME ; void CUpnpMetadata::SetTitleL(class TDesC8 const &)
+	?TitleL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 32 NONAME ; class TPtrC8 CUpnpMetadata::TitleL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/EABI/AVCPEngineClientU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,40 @@
+EXPORTS
+	_ZN13CUpnpMetadata10SetArtistLERK6TDesC8 @ 1 NONAME
+	_ZN13CUpnpMetadata11SetCreatorLERK6TDesC8 @ 2 NONAME
+	_ZN13CUpnpMetadata3IdLEv @ 3 NONAME
+	_ZN13CUpnpMetadata4NewLER23RUpnpAVCPEngineMSClient @ 4 NONAME
+	_ZN13CUpnpMetadata6AlbumLEv @ 5 NONAME
+	_ZN13CUpnpMetadata6AsXmlLEv @ 6 NONAME
+	_ZN13CUpnpMetadata6ClassLEv @ 7 NONAME
+	_ZN13CUpnpMetadata6FetchLERK7TDesC16 @ 8 NONAME
+	_ZN13CUpnpMetadata6FetchLERK7TDesC16R14TRequestStatus @ 9 NONAME
+	_ZN13CUpnpMetadata6GenreLEv @ 10 NONAME
+	_ZN13CUpnpMetadata6TitleLEv @ 11 NONAME
+	_ZN13CUpnpMetadata7ArtistLEv @ 12 NONAME
+	_ZN13CUpnpMetadata7CommitLER14TRequestStatus @ 13 NONAME
+	_ZN13CUpnpMetadata7CommitLEv @ 14 NONAME
+	_ZN13CUpnpMetadata8CreatorLEv @ 15 NONAME
+	_ZN13CUpnpMetadata9SetAlbumLERK6TDesC8 @ 16 NONAME
+	_ZN13CUpnpMetadata9SetClassLERK6TDesC8 @ 17 NONAME
+	_ZN13CUpnpMetadata9SetGenreLERK6TDesC8 @ 18 NONAME
+	_ZN13CUpnpMetadata9SetTitleLERK6TDesC8 @ 19 NONAME
+	_ZN21RUpnpAVCPEngineClient7ConnectEv @ 20 NONAME
+	_ZN23RUpnpAVCPEngineMSClient14GetDeviceListLER6RArrayI9TAVDeviceE @ 21 NONAME
+	_ZN23RUpnpAVCPEngineMSClientC1Ev @ 22 NONAME
+	_ZN23RUpnpAVCPEngineMSClientC2Ev @ 23 NONAME
+	_ZN24RUpnpAVCPEngineRFSClient11CreateFileLERK6TDesC8RK7TDesC16 @ 24 NONAME
+	_ZN24RUpnpAVCPEngineRFSClient11DeleteFileLERK6TDesC8RK7TDesC16 @ 25 NONAME
+	_ZN24RUpnpAVCPEngineRFSClient13GetDirectoryLERK6TDesC8RK7TDesC16R13RPointerArrayI11CRsfwDirEntE @ 26 NONAME
+	_ZN24RUpnpAVCPEngineRFSClient14MakeDirectoryLERK6TDesC8RK7TDesC16 @ 27 NONAME
+	_ZN24RUpnpAVCPEngineRFSClient16DeleteDirectoryLERK6TDesC8RK7TDesC16 @ 28 NONAME
+	_ZN24RUpnpAVCPEngineRFSClient17GetFileAttributeLERK6TDesC8RK7TDesC16RP15CRsfwDirEntAttr @ 29 NONAME
+	_ZN24RUpnpAVCPEngineRFSClient22GetDirectoryAttributeLERK6TDesC8RK7TDesC16RP15CRsfwDirEntAttr @ 30 NONAME
+	_ZN24RUpnpAVCPEngineRFSClient8GetFileLERK6TDesC8RK7TDesC16S5_iijRi @ 31 NONAME
+	_ZN24RUpnpAVCPEngineRFSClient8PutFileLERK6TDesC8RK7TDesC16S5_ @ 32 NONAME
+	_ZN24RUpnpAVCPEngineRFSClientC1Ev @ 33 NONAME
+	_ZN24RUpnpAVCPEngineRFSClientC2Ev @ 34 NONAME
+	_ZTI13CUpnpMetadata @ 35 NONAME ; #<TI>#
+	_ZTI21RUpnpAVCPEngineClient @ 36 NONAME ; #<TI>#
+	_ZTV13CUpnpMetadata @ 37 NONAME ; #<VT>#
+	_ZTV21RUpnpAVCPEngineClient @ 38 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/group/avcpengineclient.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,61 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification for AVCPEngineClient
+*
+*/
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET          avcpengineclient.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x101F977B
+CAPABILITY      CAP_CLIENT_DLL
+VENDORID        VID_DEFAULT
+
+VERSION         10.1
+paged
+
+SOURCEPATH      ../src
+
+SOURCE          upnpavcpengineclient.cpp
+SOURCE          upnpavcpenginemsclient.cpp
+SOURCE          upnpavcpenginerfsclient.cpp
+SOURCE          upnpmetadata.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../inc
+USERINCLUDE   ../../inc
+USERINCLUDE     ../inc
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         insock.lib
+LIBRARY         estlib.lib
+
+LIBRARY         inetprotutil.lib
+LIBRARY         upnpipserversutils.lib
+//LibXml2
+LIBRARY         xmlengineutils.lib
+LIBRARY         xmlenginedom.lib
+
+// remote storage
+LIBRARY         rsfwcommon.lib
+LIBRARY         rsfwmountman.lib
+
+//to be removed when mountentry moved to mountman
+LIBRARY         rsfwmountstore.lib
+DEFFILE         AVCPEngineClient
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for AVCPEngineClient
+*
+*/
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_EXPORTS
+../inc/upnpavcpenginerfsclient.h |../../inc/upnpavcpenginerfsclient.h
+../inc/upnpavcpenginemsclient.h  MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcpenginemsclient.h)
+../inc/upnpavcpengineclient.h    MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcpengineclient.h)
+../inc/upnpmetadata.h            MW_LAYER_PLATFORM_EXPORT_PATH(upnpmetadata.h)
+
+PRJ_MMPFILES
+avcpengineclient.mmp
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/inc/upnpavcpengineclient.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,55 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RUpnpAVCPEngineClient
+*
+*/
+
+
+#ifndef C_RUPNPAVCPENGINECLIENT_H
+#define C_RUPNPAVCPENGINECLIENT_H
+
+// INCLUDES
+#include <e32base.h>
+#include <in_sock.h>
+#include "upnpavcpenginecommon.h"
+
+// CLASS DECLARATION
+/**
+* Generic class for client-interface. 
+* It enables to connect to server and starts server if it is not started.
+*/
+class RUpnpAVCPEngineClient : public RSessionBase
+	{
+	public:
+		/**
+		* C++ default constructor.
+		*/	
+		RUpnpAVCPEngineClient();
+		/**
+		* Connect to server, if server is not started, it starts.
+		* 
+		* @return status of operation, if OK, KErrNone
+		*/
+		IMPORT_C virtual TInt Connect();
+		/**
+		* Return version of client, used for connect
+		*
+		* @return version
+		*/
+		TVersion Version() const;		
+	};
+
+#endif // C_RUPNPAVCPENGINECLIENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/inc/upnpavcpenginemsclient.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,112 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RUpnpAVCPEngineMSClient
+*
+*/
+
+
+#ifndef C_RUPNPAVCPENGINEMSCLIENT_H
+#define C_RUPNPAVCPENGINEMSCLIENT_H
+
+// INCLUDES
+#include <e32base.h>
+#include <in_sock.h>
+#include "upnpavcpengineclient.h"
+
+// FORWARD DECLARATIONS
+class TAVDevice;
+class CUpnpMetadata;
+
+
+// CLASS DECLARATION
+/**
+* Class used for accessing MS's metadata. 
+* Also it provides list of currently active MSs
+*/
+class RUpnpAVCPEngineMSClient : public RUpnpAVCPEngineClient
+	{
+	public:
+		/**
+		* C++ default constructor.
+		*/	    
+		IMPORT_C RUpnpAVCPEngineMSClient();
+		/**
+		* Get list of available MS devices
+		* 
+		* @param aDeviceList array to update
+		*/
+		IMPORT_C TInt GetDeviceListL(RArray<TAVDevice>& aDeviceList);		    
+	    /**
+	    * Requests for preparing metadata for given path
+	    *
+	    * @param aUUID UDN of MS
+	    * @param aPathName pathname
+	    * @param aIdPckg id of command with result (metadata)
+	    * @param aSizePckg size of metadata
+	    */ 	    
+		void PrepareMetadataL(const TDesC8& aUUID, const TDesC8& aPathName, 
+			TPckg<TInt>& aIdPckg, TPckg<TInt>& aSizePckg); 	
+
+	    /**
+	    * Requests for preparing metadata for given path
+	    *
+	    * @param aUUID UDN of MS
+	    * @param aPathName pathname
+	    * @param aIdPckg id of command with result (metadata)
+	    * @param aSizePckg size of metadata
+	    */ 	    
+		void PrepareMetadata(TRequestStatus& aStatus, const TDesC8& aUUID, const TDesC8& aPathName, 
+			TPckg<TInt>& aIdPckg, TPckg<TInt>& aSizePckg); 	
+
+					
+	    /**
+	    * Requests for downloading metadata from result of previous run command
+	    *
+	    * @param aId id of command with result (metadata)
+	    * @param aMetaData buffer for metadata
+	    */
+		void DownloadMetadataL(TInt aId, TDes8& aMetaData);
+					
+	    /**
+	    * Requests for downloading metadata from result of previous run command
+	    *
+	    * @param aId id of command with result (metadata)
+	    * @param aMetaData buffer for metadata
+	    */
+		void DownloadMetadata(TRequestStatus& aStatus, TInt aId, TDes8& aMetaData);
+			      
+	    /**
+	    * Requests for set metadata for given path
+	    *
+	    * @param aUUID UDN of MS
+	    * @param aPathName pathname
+	    * @param aOldMetaData old metadata
+			* @param aNewMetaData new metadata
+	    */    
+	    void SetMetadataL(const TDesC8& aUUID, const TDesC8& aPathName, const TDesC8& aOldMetaData, const TDesC8& aNewMetaData);    
+	    
+	    /**
+	    * Requests for set metadata for given path
+	    *
+	    * @param aUUID UDN of MS
+	    * @param aPathName pathname
+	    * @param aOldMetaData old metadata
+			* @param aNewMetaData new metadata
+	    */    
+	    void SetMetadata(TRequestStatus& aStatus, const TDesC8& aUUID, const TDesC8& aPathName, const TDesC8& aOldMetaData, const TDesC8& aNewMetaData);   	    
+	};
+
+#endif // C_RUPNPAVCPENGINEMSCLIENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/inc/upnpavcpenginerfsclient.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,145 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RUpnpAVCPEngineRFSClient
+*
+*/
+
+
+#ifndef C_RUPNPAVCPENGINERFSCLIENT_H
+#define C_RUPNPAVCPENGINERFSCLIENT_H
+
+// INCLUDES
+#include <e32base.h>
+#include <in_sock.h>
+
+#include "upnpavcpengineclient.h"
+
+// FORWARD DECLARATIONS
+class CRsfwDirEnt;
+class CRsfwDirEntAttr;
+
+
+// CLASS DECLARATION
+/**
+* Class provides function used by UPnPAccess plugin 
+* It makes possible to pass requests to AVCPEngine.
+*/
+class RUpnpAVCPEngineRFSClient : public RUpnpAVCPEngineClient
+	{
+	public:
+		/**
+		* C++ default constructor.
+		*/		    
+		IMPORT_C RUpnpAVCPEngineRFSClient();
+		/**
+		* Requests for get directory listing
+		*
+		* @param aUUID UDN of MS
+		* @param aPathName path of directory
+		* @param aDirList array of directory to be updated
+		* @return KErrNone if successful, otherwise one of the other system-wide error codes
+		*/
+		IMPORT_C TInt GetDirectoryL(const TDesC8& aUUID, const TDesC& aPathName, RPointerArray<CRsfwDirEnt>& aDirList); 
+		/**
+		* Requests for get directory attribute
+		*
+		* @param aUUID UDN of MS
+		* @param aPathName path of directory
+		* @param aDirAtt structure to be updated
+		* @return KErrNone if successful, otherwise one of the other system-wide error codes
+		*/	
+    	IMPORT_C TInt GetDirectoryAttributeL(const TDesC8& aUUID, const TDesC& aPathName, CRsfwDirEntAttr*& aDirAtt);
+		/**
+		* Requests for get file attribute
+		*
+		* @param aUUID UDN of MS
+		* @param aPathName path of file
+		* @param aDirAtt structure to be updated
+		* @return KErrNone if successful, otherwise one of the other system-wide error codes
+		*/	    
+    	IMPORT_C TInt GetFileAttributeL(const TDesC8& aUUID, const TDesC& aPathName, CRsfwDirEntAttr*& aFileAtt);
+		/**
+		* Requests for get (download) file from MS and store it in local cached file
+		*
+		* @param aUUID UDN of MS
+		* @param aSrcPathName source file (MS)
+		* @param aDstPathName destination file (local)		
+		* @param aStart start position to read
+		* @param aLength length to read
+		* @param aRead number of byte that were read
+		* @return KErrNone if successful, otherwise one of the other system-wide error codes		
+		*/	
+    	IMPORT_C TInt GetFileL(const TDesC8& aUUID, const TDesC& aSrcPathName, const TDesC& aDstPathName, 
+    			TInt aStart, TInt aLength, TUint aFlags, TInt& aRead);
+		/**
+		* Requests for delete file
+		*
+		* @param aUUID UDN of MS
+		* @param aPathName path of file
+		* @return KErrNone if successful, otherwise one of the other system-wide error codes		
+		*/    
+    	IMPORT_C TInt DeleteFileL(const TDesC8& aUUID, const TDesC& aPathName);
+		/**
+		* Requests for delete directory
+		*
+		* @param aUUID UDN of MS
+		* @param aPathName path of directory
+		* @return KErrNone if successful, otherwise one of the other system-wide error codes		
+		*/       
+    	IMPORT_C TInt DeleteDirectoryL(const TDesC8& aUUID, const TDesC& aPathName);
+		/**
+		* Requests for create file
+		*
+		* @param aUUID UDN of MS
+		* @param aPathName path of file
+		* @return KErrNone if successful, otherwise one of the other system-wide error codes		
+		*/   
+    	IMPORT_C TInt CreateFileL(const TDesC8& aUUID, const TDesC& aPathName);
+		/**
+		* Requests for create directory
+		*
+		* @param aUUID UDN of MS
+		* @param aPathName path of directory
+		* @return KErrNone if successful, otherwise one of the other system-wide error codes		
+		*/      
+    	IMPORT_C TInt MakeDirectoryL(const TDesC8& aUUID, const TDesC& aPathName);
+		/**
+		* Requests for put (upload) file from local to MS 
+		*
+		* @param aUUID UDN of MS
+		* @param aSrcPathName source file (local)
+		* @param aDstPathName destination file (MS)	
+		* @return KErrNone if successful, otherwise one of the other system-wide error codes			
+		*/   
+    	IMPORT_C TInt PutFileL(const TDesC8& aUUID, const TDesC& aSrcPathName, const TDesC& aDstPathName);     
+	private:
+		/**
+		* Convert information about attributes store in TFileInfo into CDirEntAttr
+		*
+		* @param aFileInfo file information
+		* @return converted object of CDirEntAttr
+		*/
+		CRsfwDirEntAttr* RUpnpAVCPEngineRFSClient::GetFileAttributesL(TFileInfo& aFileInfo);
+		/**
+		* Convert information about file store in TFileInfo into CDirEnt
+		*
+		* @param aFileInfo file information
+		* @return converted object of CDirEnt
+		*/
+		CRsfwDirEnt* RUpnpAVCPEngineRFSClient::GetFileInformationL(TFileInfo& aFileInfo);
+	};
+
+#endif // C_RUPNPAVCPENGINERFSCLIENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/inc/upnpmetadata.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,273 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Describes UPnP metadata for item/container
+*
+*/
+
+
+#ifndef C_CUPNPMETADATA_H
+#define C_CUPNPMETADATA_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32cmn.h>
+ 
+#include <xmlengdom.h>
+#include <xmlengdocument.h>
+
+//rsfw
+#include <rsfwmountman.h>
+#include <rsfwmountentry.h>
+
+// FORWARD DECLARATIONS
+class RUpnpAVCPEngineMSClient;
+
+enum TMetadataStatus 
+{
+	EPreparingMetadata, 
+	EDownloadingMetadata, 
+	EUploadingMetadata		
+};
+		
+// CLASS DECLARATION
+/**
+*  Describes UPnP metadata for item/container
+*
+*  @lib AVCPEngineClient.lib
+*  @since Series 60 3.1
+*/
+class CUpnpMetadata : public CActive
+	{
+	
+	public:  // Constructors and destructor	
+		/**
+		* Two-phased constructor.
+		*/
+		IMPORT_C static CUpnpMetadata* NewL(RUpnpAVCPEngineMSClient& aSession);        
+		/**
+		* Destructor.
+		*/
+		virtual ~CUpnpMetadata();
+
+	public: // New functions            	
+		/**
+		* Return ID of object
+		*
+		* @return id
+		*/
+		IMPORT_C TPtrC8 IdL();
+		/**
+		* Return title of object
+		*
+		*  @return title
+		*/
+		IMPORT_C TPtrC8 TitleL();
+		/**
+		* Set new title 
+		* 
+		* @param aTitle new title
+		*/
+		IMPORT_C void SetTitleL(const TDesC8& aTitle) ;
+		/**
+		* Return creator of object
+		*
+		*  @return creator
+		*/		
+		IMPORT_C TPtrC8 CreatorL();
+		/**
+		* Set new creator 
+		* 
+		* @param aCreator new creator
+		*/		
+		IMPORT_C void SetCreatorL(const TDesC8& aCreator);
+		/**
+		* Return class of object
+		*
+		*  @return class
+		*/		
+		IMPORT_C TPtrC8 ClassL();	
+		/**
+		* Set new class 
+		* 
+		* @param aClass new clas
+		*/		
+		IMPORT_C void SetClassL(const TDesC8& aClass);	
+		/**
+		* Return atrist of object
+		*
+		*  @return atrist
+		*/		
+		IMPORT_C TPtrC8 ArtistL();	
+		/**
+		* Set new atrist 
+		* 
+		* @param aArtist new atrist
+		*/			
+		IMPORT_C void SetArtistL(const TDesC8& aArtist); 
+		/**
+		* Return genre of object
+		*
+		*  @return genre
+		*/		
+		IMPORT_C TPtrC8 GenreL();	
+		/**
+		* Set new genre 
+		* 
+		* @param aGenre new genre
+		*/		
+		IMPORT_C void SetGenreL(const TDesC8& aGenre);
+		/**
+		* Return album of object
+		*
+		*  @return album
+		*/		
+		IMPORT_C TPtrC8 AlbumL();
+		/**
+		* Set new album 
+		* 
+		* @param aAlbum new album
+		*/		
+		IMPORT_C void SetAlbumL(const TDesC8& aAlbum);
+		/**
+		* Return whole metada as XML
+		*
+		*  @return document with metadata
+		*/			
+		IMPORT_C RXmlEngDocument& AsXmlL();		
+		/**
+		* Fetch metadata for given path
+		*
+		* @param aPathName path name on MS's drive
+		*/
+		IMPORT_C void FetchL( const TDesC& aPathName ); 	
+		/**
+		* Fetch metadata for given path
+		*
+		* @param aPathName path name on MS's drive
+		*/
+		IMPORT_C void FetchL(const TDesC& aPathName, TRequestStatus& aStatus );			
+		/**
+		* Approve changes made in metadata and send them to update in MS
+		*/
+		IMPORT_C void CommitL(); 
+		/**
+		* Approve changes made in metadata and send them to update in MS
+		*/
+		IMPORT_C void CommitL( TRequestStatus& aStatus );		
+	protected: // from CActive
+        /**
+        * From CActive invoke when local request should be cancelled
+        */
+        void DoCancel();
+        /**
+        * From CActive invoke when RunL leaves
+        */        
+        TInt RunError( TInt aError );
+        /**
+        * From CActive invoke when asynchronous action is completed
+        */
+        void RunL();  
+	private:
+		/**
+		* C++ default constructor.
+		*/
+		CUpnpMetadata(RUpnpAVCPEngineMSClient& aSession);
+		
+		/**
+		* By default Symbian 2nd phase constructor is private.
+		*/
+		void ConstructL();
+	    /**
+	    * Get object XML element from inside stored XML 
+	    *
+	    * @param aObject element for object XML
+	    * @return ETrue if found, else EFalse
+	    */   
+		TBool ObjectL(TXmlEngElement& aObject);
+	    /**
+	    * Get value of element with given name 
+	    * (it has to be child of object element)
+	    *
+	    * @param aName name of element
+	    * @return value of element
+	    */   		
+		TPtrC8 GetElementL( const TDesC8& aName);
+	    /**
+	    * Set value of element with given name 
+	    * (it is child of object element)
+	    *
+		* @param aNamespace namespace of element    
+	    * @param aName name of element
+		* @param aValue value of element    
+	    */   				
+		void SetElementL( const TDesC8& aNamespace, const TDesC8& aName, const TDesC8& aValue);
+		/**
+	    * Normalize slashes in path
+	    *
+	    * @param aData path to normalize
+	    */
+		void Normalize(TDes8& aData);
+		/**
+	    * Get metadata synchnronous
+	    */		
+		void GetMetadataL(); 
+		/**
+	    * Get metadata asynchnronous
+	    */			
+		void GetMetadataL(TRequestStatus& aStatus);
+		/**
+	    * Parse metadata
+	    */				
+		void ParseMetadataL();
+		/**
+	    * Prepare information about file, check if drive is upnp, normalize path slashes
+	    *
+	    * @param aPathName path to check
+	    */
+		void PrepareDataL(const TDesC& aPathName ); 				
+	private:
+		// sesion to server AVCPEngine
+		RUpnpAVCPEngineMSClient& iSession;
+		// UDN of MS
+		HBufC8* iUuid;
+		// pathname
+		HBufC8* iPathName;
+		// metadata
+		HBufC8* iMetaData;
+		// new metadata (used during Commit operation
+		HBufC8* iUpdatedMetaData;		
+		// pointer to metadata
+		TPtr8 iMetaDataPtr;
+		// document with parsed metadata
+		RXmlEngDocument iDocument;
+		// client-interface to RS Fwk
+	//	RRsfwControl iRsfwControl;	
+		// command id (it's id of command used to fetch metadata)
+		TInt iId;
+		// package for id
+		TPckg<TInt> iIdPckg;
+		// size of metadata
+		TInt iSize;
+		// package for size
+		TPckg<TInt> iSizePckg;	
+		// request status fo 
+		TRequestStatus* iClientStatus;	
+		// state of asynchrounus performing
+		TMetadataStatus iState;		
+		RXmlEngDOMImplementation iDOMImpl;
+	};
+
+#endif      // C_CUPNPMETADATA_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/src/upnpavcpengineclient.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,136 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base class to connect with server AVCPEngine
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "upnpavcpengineclient.h"
+
+#include <Uri16.h>
+
+// Number of message slots to reserve for this client server session.
+const TUint KDefaultMessageSlots = 10;
+const TUid KServerUid3 = {0x101F977A};
+
+// Function prototypes
+static TInt StartServer( void );
+static TInt CreateServerProcess( void );
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineClient::RUpnpAVCPEngineClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RUpnpAVCPEngineClient::RUpnpAVCPEngineClient()
+    :RSessionBase()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineClient::Connect
+// Connect to ... session.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineClient::Connect()
+    {
+    TInt error = ::StartServer();
+
+    if ( KErrNone == error )
+        {
+        error = CreateSession( KAVCPEngineName,
+                               Version(),
+                               KDefaultMessageSlots );
+        }
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineClient::Version
+// Version information.
+// -----------------------------------------------------------------------------
+//
+TVersion RUpnpAVCPEngineClient::Version() const
+    {
+	return( TVersion( KAVCPEngineMajorVersionNumber,
+                      KAVCPEngineMinorVersionNumber,
+                      KAVCPEngineBuildVersionNumber ) );
+    }
+
+// -----------------------------------------------------------------------------
+// StartServer
+// Static method to start the server.
+// -----------------------------------------------------------------------------
+//
+static TInt StartServer()
+    {
+    TInt result;
+
+    TFindServer findMessageHandler( KAVCPEngineName );
+    TFullName name;
+
+	result = findMessageHandler.Next( name );
+	if ( result == KErrNone )
+        {
+		// Server already running
+		return KErrNone;
+	    }
+    result = CreateServerProcess();
+    if ( result != KErrNone )
+        {
+        return  result;
+        }
+    return  KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CreateServerProcess
+// Static method to create the server process.
+// -----------------------------------------------------------------------------
+//
+static TInt CreateServerProcess()
+    {
+    TInt result;
+
+	const TUidType serverUid( KNullUid, KNullUid, KServerUid3 );
+	RProcess server;
+
+	result = server.Create( KAVCPEngineFilename, KNullDesC, serverUid );
+    if ( result != KErrNone )
+        {
+        return  result;
+        }
+        
+    TRequestStatus stat = KRequestPending;
+    server.Rendezvous(stat);
+    if ( stat != KRequestPending )
+        {
+        server.Kill( 0 );       // abort startup
+        }
+    else
+        {
+        server.Resume();    // logon OK - start the server
+        }
+        
+    User::WaitForRequest(stat);     // wait for start or death
+    result = (server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();    
+    server.Close(); 
+        
+    return result;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/src/upnpavcpenginemsclient.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,114 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class used for accessing MS's metadata.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "upnpavcpenginemsclient.h"
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineMSClient::RUpnpAVCPEngineMSClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RUpnpAVCPEngineMSClient::RUpnpAVCPEngineMSClient()
+    :RUpnpAVCPEngineClient()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineMSClient::GetDeviceListL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineMSClient::GetDeviceListL(RArray<TAVDevice>& aDeviceList) 
+	{    
+    TInt id;
+    TInt size;
+    TPckg<TInt> idPckg(id); 
+    TPckg<TInt> sizePckg(size); 
+    SendReceive(EPrepareDeviceList,TIpcArgs(&idPckg,&sizePckg));
+    if ( size > 0 )   
+    	{        
+        TAVDevice* devices = new(ELeave)TAVDevice[size];
+        TPtr8 result(reinterpret_cast<TUint8*>(devices), sizeof(TAVDevice)*size, sizeof(TAVDevice)*size);
+        SendReceive(EDownloadDeviceList,TIpcArgs(id, &result));
+
+        for (TInt i = 0; i < size; i++) 
+        	{
+           	aDeviceList.Append(devices[i]);
+        	}
+        delete[] devices;
+    	}
+    return size;
+	}
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineMSClient::PrepareMetadataL
+// -----------------------------------------------------------------------------
+//
+void RUpnpAVCPEngineMSClient::PrepareMetadataL(const TDesC8& aUUID, const TDesC8& aPathName, TPckg<TInt>& aIdPckg, TPckg<TInt>& aSizePckg) 
+	{    
+    User::LeaveIfError( SendReceive(EPrepareMetadata,TIpcArgs(&aIdPckg,&aSizePckg, &aUUID, &aPathName )) );
+	}
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineMSClient::PrepareMetadata
+// -----------------------------------------------------------------------------
+//
+void RUpnpAVCPEngineMSClient::PrepareMetadata(TRequestStatus& aStatus, const TDesC8& aUUID, const TDesC8& aPathName, TPckg<TInt>& aIdPckg, TPckg<TInt>& aSizePckg) 
+	{    
+    SendReceive(EPrepareMetadata,TIpcArgs(&aIdPckg,&aSizePckg, &aUUID, &aPathName ), aStatus) ;
+	}
+	
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineMSClient::DownloadMetadataL
+// -----------------------------------------------------------------------------
+//
+void RUpnpAVCPEngineMSClient::DownloadMetadataL(TInt aId, TDes8& aMetaData) 
+	{           
+	User::LeaveIfError( SendReceive(EDownloadMetadata,TIpcArgs(aId, &aMetaData)));
+    }
+    
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineMSClient::DownloadMetadataL
+// -----------------------------------------------------------------------------
+//
+void RUpnpAVCPEngineMSClient::DownloadMetadata(TRequestStatus& aStatus, TInt aId, TDes8& aMetaData) 
+	{           
+	SendReceive(EDownloadMetadata,TIpcArgs(aId, &aMetaData), aStatus);
+    }
+	    	
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineMSClient::SetMetadataL
+// -----------------------------------------------------------------------------
+//
+void RUpnpAVCPEngineMSClient::SetMetadataL(const TDesC8& aUUID, const TDesC8& aPathName, const TDesC8& aOldMetaData, const TDesC8& aNewMetaData) 
+	{
+    User::LeaveIfError( SendReceive(ESetMetadata,TIpcArgs(&aUUID, &aPathName, &aOldMetaData, &aNewMetaData) ) );   
+	}
+	
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineMSClient::SetMetadata
+// -----------------------------------------------------------------------------
+//
+void RUpnpAVCPEngineMSClient::SetMetadata(TRequestStatus& aStatus, const TDesC8& aUUID, const TDesC8& aPathName, const TDesC8& aOldMetaData, const TDesC8& aNewMetaData) 
+	{
+    SendReceive(ESetMetadata,TIpcArgs(&aUUID, &aPathName, &aOldMetaData, &aNewMetaData), aStatus);   
+	}	
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/src/upnpavcpenginerfsclient.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,231 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class provides function used by UPnPAccess plugin 
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include <RsfwDirEnt.h>
+#include <f32file.h>
+#include <rsfwdirentattr.h>
+#include <rsfwdirent.h>
+
+
+#include "upnpavcpenginecommon.h"
+#include "upnpavcpenginerfsclient.h"
+
+typedef TBuf8<KMaxFileName> TFileName8;
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::RUpnpAVCPEngineRFSClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RUpnpAVCPEngineRFSClient::RUpnpAVCPEngineRFSClient()
+    :RUpnpAVCPEngineClient()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::GetDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineRFSClient::GetDirectoryL(const TDesC8& aUUID, const TDesC& aPathName, RPointerArray<CRsfwDirEnt>& aDirList) 
+	{
+    TFileName8 pathname;
+    pathname.Copy(aPathName);
+    
+    TInt id;
+    TInt size;
+    TPckg<TInt> idPckg(id); 
+    TPckg<TInt> sizePckg(size);
+    TInt err = SendReceive(EPrepareDirList,TIpcArgs(&idPckg,&sizePckg, &aUUID, &pathname )) ;
+    if (err != KErrNone) 
+    	{
+        return err;    
+    	}
+    
+    if ( size > 0 )   
+    	{        
+        TFileInfo* dirs = new TFileInfo[size];
+        // put array on cleanup stack
+        TPtr8 result(reinterpret_cast<TUint8*>(dirs), sizeof(TFileInfo)*size, sizeof(TFileInfo)*size);
+        err = SendReceive(EDownloadDirList,TIpcArgs(id, &result));
+
+        for (TInt i = 0; i < size; i++) 
+        	{
+        	CRsfwDirEnt* entry = GetFileInformationL(dirs[i]);
+            aDirList.Append(entry);
+        	}
+        delete[] dirs;
+    	}
+    return err;
+	}
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::GetDirectoryAttributeL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineRFSClient::GetDirectoryAttributeL(const TDesC8& aUUID, const TDesC& aPathName, CRsfwDirEntAttr*& aDirAtt) 
+	{
+	if (aPathName.Compare(KNullDesC) == 0) 
+		{
+		TFileInfo fi;
+		fi.iAtt |= KEntryAttDir; 
+		aDirAtt = GetFileAttributesL(fi);
+		return KErrNone;
+		}
+	
+    TFileName8 pathname;
+    pathname.Copy(aPathName);	
+	TFileInfo fileInfo;
+    TPckg<TFileInfo> attrPckg(fileInfo);        
+    TInt err = SendReceive(EDirAttributes, TIpcArgs(&aUUID, &pathname,  &attrPckg) );
+    //convert TFileInfo to CDirEntAttr
+    if (err == KErrNone)
+    	aDirAtt = GetFileAttributesL(fileInfo);
+    
+    return err;
+	} 
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::GetFileAttributeL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineRFSClient::GetFileAttributeL(const TDesC8& aUUID, const TDesC& aPathName, CRsfwDirEntAttr*& aFileAtt) 
+	{
+    TFileName8 pathname;
+    pathname.Copy(aPathName);
+    	
+	TFileInfo fileInfo;
+    TPckg<TFileInfo> attrPckg(fileInfo);       
+    TInt err =  SendReceive(EFileAttributes, TIpcArgs(&aUUID, &pathname,  &attrPckg) ) ;
+    //convert TFileInfo to CDirEntAttr
+    if (err == KErrNone)
+    	aFileAtt = GetFileAttributesL(fileInfo);
+    
+    return err;
+	} 
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::GetFileL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineRFSClient::GetFileL(const TDesC8& aUUID, const TDesC& aSrcPathName, const TDesC& aDstPathName,
+						TInt aStart, TInt aLength, TUint aFlags, TInt& aRead) 
+	{
+    TFileName8 srcpathname;
+    srcpathname.Copy(aSrcPathName);
+    	
+    TFilePosition position;
+    position.iStart = aStart;
+    position.iLength = aLength;
+    position.iFlags = aFlags;
+    
+    TPckg<TFilePosition> posPckg(position);       
+
+    TInt err = SendReceive(EGetFile, TIpcArgs(&aUUID, &srcpathname,  &aDstPathName, &posPckg) ) ;
+    aRead = position.iLength;
+    return err;
+	} 
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::DeleteFileL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineRFSClient::DeleteFileL(const TDesC8& aUUID, const TDesC& aPathName) 
+	{   
+    TFileName8 pathname;
+    pathname.Copy(aPathName);    	 
+    TInt err = SendReceive(EDeleteFile, TIpcArgs(&aUUID, &pathname) );
+    return err;
+	} 
+ 
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::DeleteDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineRFSClient::DeleteDirectoryL(const TDesC8& aUUID, const TDesC& aPathName) 
+	{  
+    TFileName8 pathname;
+    pathname.Copy(aPathName);    	  
+    TInt err = SendReceive(EDeleteDirectory, TIpcArgs(&aUUID, &pathname) );
+    return err;    
+	} 
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::CreateFileL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineRFSClient::CreateFileL(const TDesC8& aUUID, const TDesC& aPathName) 
+	{ 
+    TFileName8 pathname;
+    pathname.Copy(aPathName);    	 	   
+    TInt err =  SendReceive(ECreateFile, TIpcArgs(&aUUID, &pathname) );
+    return err;     
+	}  
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::MakeDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineRFSClient::MakeDirectoryL(const TDesC8& aUUID, const TDesC& aPathName) 
+	{ 
+    TFileName8 pathname;
+    pathname.Copy(aPathName);	   
+    TInt err =  SendReceive(ECreateDirectory, TIpcArgs(&aUUID, &pathname) );
+    return err;     
+	} 
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::PutFileL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpAVCPEngineRFSClient::PutFileL(const TDesC8& aUUID, const TDesC& aSrcPathName, const TDesC& aDstPathName) 
+	{
+    TFileName8 dstpathname;
+    dstpathname.Copy(aDstPathName);	
+	TInt err =  SendReceive(EPutFile, TIpcArgs(&aUUID, &aSrcPathName,  &dstpathname) );
+    return err;     
+	} 
+	
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::GetAttributes
+// -----------------------------------------------------------------------------
+//	
+CRsfwDirEntAttr* RUpnpAVCPEngineRFSClient::GetFileAttributesL(TFileInfo& aFileInfo) 
+	{
+	CRsfwDirEntAttr* result = CRsfwDirEntAttr::NewLC();
+	
+	result->SetMimeTypeL(aFileInfo.iMimeType);
+	result->SetModified(aFileInfo.iModified);
+	result->SetAtt(aFileInfo.iAtt);
+	result->SetSize(aFileInfo.iSize);
+	CleanupStack::Pop(result);
+	return result;
+	}
+
+// -----------------------------------------------------------------------------
+// RUpnpAVCPEngineRFSClient::GetFileInformation
+// -----------------------------------------------------------------------------
+//	
+ CRsfwDirEnt* RUpnpAVCPEngineRFSClient::GetFileInformationL(TFileInfo& aFileInfo) 
+	{
+	return  CRsfwDirEnt::NewL(aFileInfo.iName, GetFileAttributesL(aFileInfo));
+	}	
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/avcpengineclient/src/upnpmetadata.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,556 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class for fetching and updating MS metadata
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "upnpmetadata.h"
+#include "upnpavcpenginemsclient.h"
+#include <upnpdominterface.h>
+#include <XmlEngDOMParser.h>
+#include <XmlEngSerializationOptions.h>
+#include <Uri16.h>
+
+
+_LIT(KUPnP16,    "upnp");
+
+_LIT8(KId,      "id");
+_LIT8(KUPnP,    "upnp");
+_LIT8(KDc,      "dc");
+_LIT8(KArtist,  "artist");
+_LIT8(KAlbum,   "album");
+_LIT8(KGenre,   "genre");
+_LIT8(KClass,   "class");
+_LIT8(KCreator, "creator");
+_LIT8(KTitle,   "title");
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::CUpnpMetadata
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpMetadata::CUpnpMetadata(RUpnpAVCPEngineMSClient& aSession): 
+	CActive(EPriorityStandard), 
+	iSession(aSession), 
+	iMetaDataPtr(NULL,0),	
+	iIdPckg(iId), 
+	iSizePckg(iSize)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadata::ConstructL()
+    {     		
+//    User::LeaveIfError( iRsfwControl.Connect() );
+    iDOMImpl.OpenL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpMetadata* CUpnpMetadata::NewL(RUpnpAVCPEngineMSClient& aSession)
+    {
+    CUpnpMetadata* self = new( ELeave ) CUpnpMetadata(aSession);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::~CUpnpMetadata
+// Destructor
+// -----------------------------------------------------------------------------
+//    
+CUpnpMetadata::~CUpnpMetadata()
+    {
+	delete iUuid;
+	delete iPathName;
+	delete iMetaData;
+	delete iUpdatedMetaData;
+	iDocument.Close();    
+	iDOMImpl.Close();
+	//iRsfwControl.Close();   
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::FetchL
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C void CUpnpMetadata::FetchL(const TDesC& aPathName ) 
+	{
+	
+	PrepareDataL(aPathName);
+	GetMetadataL();
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::FetchL
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C void CUpnpMetadata::FetchL(const TDesC& aPathName, TRequestStatus& aStatus ) 
+	{
+	PrepareDataL(aPathName);
+	GetMetadataL(aStatus);
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::CommitL
+// -----------------------------------------------------------------------------
+//   		
+EXPORT_C void CUpnpMetadata::CommitL() 
+	{	        
+    //Dump XML tree into buffer
+    RBuf8 xmlBuf;
+    CleanupClosePushL(xmlBuf);
+    TXmlEngSerializationOptions options(TXmlEngSerializationOptions::KOptionIndent);
+      
+    iDocument.SaveL( xmlBuf, iDocument.DocumentElement(), options);
+    
+    iSession.SetMetadataL(*iUuid, *iPathName, *iMetaData, xmlBuf);    	    
+    
+	CleanupStack::PopAndDestroy(&xmlBuf); 
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::CommitL
+// -----------------------------------------------------------------------------
+//   		
+EXPORT_C void CUpnpMetadata::CommitL(TRequestStatus& aStatus) 
+	{	 
+	
+	iClientStatus = &aStatus;
+	*iClientStatus = KRequestPending;
+							
+    //Dump XML tree into buffer
+    RBuf8 xmlBuf;
+    CleanupClosePushL(xmlBuf);
+    TXmlEngSerializationOptions options(TXmlEngSerializationOptions::KOptionIndent);
+      
+    iDocument.SaveL( xmlBuf, iDocument.DocumentElement(), options);
+    delete iUpdatedMetaData;
+    iUpdatedMetaData = NULL;
+    
+    iUpdatedMetaData = xmlBuf.AllocL();
+    CleanupStack::PopAndDestroy(&xmlBuf);
+    
+    iSession.SetMetadata(iStatus, *iUuid, *iPathName, *iMetaData, *iUpdatedMetaData);    	    
+    SetActive();
+	iState = EUploadingMetadata;    	
+	}	
+		
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::PrepareData
+// -----------------------------------------------------------------------------
+//   
+void CUpnpMetadata::PrepareDataL(const TDesC& aPathName ) 
+	{
+
+	TParse parseFilename;
+	parseFilename.Set( aPathName, NULL, NULL );	
+	
+
+	TChar drive = parseFilename.Drive()[0];
+	drive.UpperCase();
+
+	CRsfwMountMan* mountman = NULL;
+			mountman = CRsfwMountMan::NewL(0, NULL);
+			User::LeaveIfNull(mountman);
+			CleanupStack::PushL(mountman);
+	
+			const CRsfwMountEntry* entry = 
+				mountman->MountEntryL(drive);
+
+			if (!entry)
+			  {
+			  CleanupStack::PopAndDestroy(mountman);
+			  User::Leave(KErrNotFound);
+			  }
+			  
+	HBufC* uri = entry->Item(EMountEntryItemUri)->Alloc();
+	
+	if (!uri)
+		User::Leave(KErrNoMemory);
+	
+	CleanupStack::PushL(uri);	
+	// parse URI 
+	TUriParser uriParser;
+	User::LeaveIfError( uriParser.Parse(*uri) );	
+	
+	if ( uriParser.Extract( EUriScheme ).Compare(KUPnP16) == 0) 
+		{
+		delete iUuid;
+		iUuid = NULL;
+		
+		delete iPathName;
+		iPathName = NULL;	
+			
+		// filename normalize		
+		iPathName = HBufC8::NewL( parseFilename.FullName().Length());
+		iPathName->Des().Append(parseFilename.Path());
+		TPtr8 path = iPathName->Des();
+		Normalize( path );		
+		iPathName->Des().Append(parseFilename.NameAndExt());				
+		
+		// uuid 
+		iUuid = HBufC8::NewL(uriParser.Extract( EUriHost ).Length());			
+		iUuid->Des().Copy(uriParser.Extract( EUriHost ));						
+		}
+	else 
+		{
+		CleanupStack::PopAndDestroy(uri);
+		CleanupStack::PopAndDestroy(mountman);
+		User::Leave( KErrNotFound );
+		}	
+	CleanupStack::PopAndDestroy(uri);
+	CleanupStack::PopAndDestroy(mountman);
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::Normalize
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadata::Normalize(TDes8& aData)
+	{
+   	for (TInt i = 0; i < aData.Length(); i++)
+		{
+		if (aData[i] == '\\')
+    		{
+        	aData[i] = '/';
+     		}
+    	}
+ 	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::ParseMetadataL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadata::ParseMetadataL()
+	{
+	iDocument.Close();
+	// Create a parser
+	RXmlEngDOMParser parser;
+	User::LeaveIfError( parser.Open(iDOMImpl) );
+	CleanupClosePushL(parser);
+	// Handler to DOM document
+	iDocument = parser.ParseL( *iMetaData );     	
+	CleanupStack::PopAndDestroy(&parser);
+ 	} 		
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::GetMetadataL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadata::GetMetadataL()
+	{
+	iSession.PrepareMetadataL(*iUuid, *iPathName, iIdPckg, iSizePckg);
+	if (iSize > 0) 
+		{
+		delete iMetaData;
+		iMetaData = NULL;		
+		iMetaData = HBufC8::NewL(iSize);
+		iMetaDataPtr.Set(iMetaData->Des());
+		iSession.DownloadMetadataL(iId, iMetaDataPtr);
+		ParseMetadataL();
+		}
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::GetMetadataL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadata::GetMetadataL(TRequestStatus& aStatus)
+	{
+	iClientStatus = &aStatus;
+	*iClientStatus = KRequestPending;
+	iSession.PrepareMetadata(iStatus, *iUuid, *iPathName, iIdPckg, iSizePckg);
+	SetActive();
+	iState = EPreparingMetadata;	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadata::DoCancel()
+	{
+	if (iClientStatus) 
+		{	
+		User::RequestComplete(iClientStatus, KErrCancel);			
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadata::RunError( TInt aError ) 
+	{
+	if (iClientStatus) 
+		{
+		User::RequestComplete(iClientStatus, aError);			
+		}
+	return KErrNone;
+	}
+        		
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::RunL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadata::RunL() 
+	{
+	if (iStatus.Int() == KErrNone) 
+		{
+		switch (iState) 
+			{
+			case EPreparingMetadata:
+			if (iSize > 0) 
+				{
+				delete iMetaData;
+				iMetaData = NULL;
+				iMetaData = HBufC8::NewL(iSize);
+				iMetaDataPtr.Set(iMetaData->Des());
+				iSession.DownloadMetadata(iStatus, iId, iMetaDataPtr);
+				SetActive();
+				iState = EDownloadingMetadata;				
+				}
+				break;
+			case EDownloadingMetadata:
+				ParseMetadataL();
+				User::RequestComplete(iClientStatus, iStatus.Int());
+				break;
+			case EUploadingMetadata:
+				delete iUpdatedMetaData;
+				iUpdatedMetaData = NULL;
+				User::RequestComplete(iClientStatus, iStatus.Int());
+				break;							
+			}		
+		} 
+	else 
+		{
+		User::RequestComplete(iClientStatus, iStatus.Int());		
+		}
+	}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::ObjectL
+// -----------------------------------------------------------------------------
+//   
+TBool CUpnpMetadata::ObjectL(TXmlEngElement& aObject) 
+	{
+	TXmlEngElement root = iDocument.DocumentElement();
+	
+    RXmlEngNodeList<TXmlEngElement> argElems;
+    CleanupClosePushL(argElems);
+    root.GetChildElements( argElems ); 
+                
+    if ( argElems.Count() == 1 ) 
+    	{
+    	aObject = argElems.Next();
+    	
+    	} 
+    	
+    CleanupStack::PopAndDestroy(&argElems);
+    return !aObject.IsNull();	             	
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::GetElementL
+// -----------------------------------------------------------------------------
+//   
+TPtrC8 CUpnpMetadata::GetElementL( const TDesC8& aName) 	 
+	{
+	TXmlEngElement result;
+	TXmlEngElement object;
+	if (ObjectL(object) &&  UpnpDomInterface::GetElementL(  object, result, aName) ) 
+		{
+		return result.Value();	
+		}
+                                
+	return KNullDesC8();	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::SetElementL
+// -----------------------------------------------------------------------------
+//   	
+void CUpnpMetadata::SetElementL( const TDesC8& aNamespace, const TDesC8& aName, const TDesC8& aValue) 	 
+	{
+	TXmlEngElement result;
+	TXmlEngElement object;
+	if (ObjectL(object))
+		{
+		if (!UpnpDomInterface::GetElementL(  object, result, aName) ) 
+			{			
+			result = object.AddNewElementUsePrefixL(aName, aNamespace);
+			}
+		result.SetTextL( aValue );
+		}
+	}	
+		
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::Id
+// -----------------------------------------------------------------------------
+//   	
+EXPORT_C  TPtrC8 CUpnpMetadata::IdL() 
+	{ 	
+	TXmlEngElement object;
+	if (ObjectL(object)) 
+		{
+		return UpnpDomInterface::GetAttrValueL( object, KId );
+		} 
+	else 
+		{
+		return KNullDesC8();		
+		}
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::Title
+// -----------------------------------------------------------------------------
+//   	
+EXPORT_C TPtrC8 CUpnpMetadata::TitleL() 
+	{
+	return GetElementL(KTitle);
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::SetTitleL
+// -----------------------------------------------------------------------------
+//   	
+EXPORT_C void CUpnpMetadata::SetTitleL(const TDesC8& aTitle) 
+	{
+	SetElementL(KDc, KTitle, aTitle);
+	}	
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::Creator
+// -----------------------------------------------------------------------------
+//   		
+EXPORT_C TPtrC8 CUpnpMetadata::CreatorL() 
+	{
+	return GetElementL(KCreator);
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::SetCreator
+// -----------------------------------------------------------------------------
+//   	
+EXPORT_C void CUpnpMetadata::SetCreatorL(const TDesC8& aCreator)
+	{
+	SetElementL(KDc,KCreator, aCreator);	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::Class
+// -----------------------------------------------------------------------------
+//   	
+EXPORT_C TPtrC8 CUpnpMetadata::ClassL() 
+	{
+	return GetElementL(KClass);
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::SetClass
+// -----------------------------------------------------------------------------
+//   		
+EXPORT_C void CUpnpMetadata::SetClassL(const TDesC8& aClass)
+	{
+	SetElementL(KUPnP, KClass, aClass);	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::Artist
+// -----------------------------------------------------------------------------
+//   		
+EXPORT_C TPtrC8 CUpnpMetadata::ArtistL() 
+	{
+	return GetElementL(KArtist);
+	}
+		
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::SetArtist
+// -----------------------------------------------------------------------------
+//   			
+EXPORT_C void CUpnpMetadata::SetArtistL(const TDesC8& aArtist)
+	{
+	SetElementL(KUPnP, KArtist, aArtist);		
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::Genre
+// -----------------------------------------------------------------------------
+//   		
+EXPORT_C TPtrC8 CUpnpMetadata::GenreL() 
+	{
+	return GetElementL(KGenre);
+	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::SetGenre
+// -----------------------------------------------------------------------------
+//   			
+EXPORT_C void CUpnpMetadata::SetGenreL(const TDesC8& aGenre)
+	{
+	SetElementL(KUPnP, KGenre, aGenre);		
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::Album
+// -----------------------------------------------------------------------------
+//   			
+EXPORT_C TPtrC8 CUpnpMetadata::AlbumL() 
+	{
+	return GetElementL(KAlbum);
+	}		
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::SetAlbum
+// -----------------------------------------------------------------------------
+//   	
+EXPORT_C void CUpnpMetadata::SetAlbumL(const TDesC8& aAlbum)
+	{
+	SetElementL(KUPnP, KAlbum, aAlbum);	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadata::AsXmlL
+// -----------------------------------------------------------------------------
+//   		
+EXPORT_C RXmlEngDocument& CUpnpMetadata::AsXmlL() 
+	{
+	return iDocument;
+	}
+
+	
+	
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,38 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for the UPnP Stack subsystem
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+WINSCW ARMV5
+//DEFAULT
+
+PRJ_EXPORTS
+../rom/upnpavcontrolpoint.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpavcontrolpoint.iby)
+
+PRJ_MMPFILES
+
+#include "../avcontrolframework/group/bld.inf"
+/*
+commented-out due to s60 distribution policy
+#include "../avcpengine/group/bld.inf"
+#include "../avcpengineclient/group/bld.inf"
+#include "../upnpaccessplugin/group/bld.inf"
+*/
+
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/rom/upnpavcontrolpoint.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,39 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the UPnP UPnP AVControl Point subsystem
+*
+*/
+
+
+#ifndef __UPNPAVCONTROLPOINT_IBY__
+#define __UPNPAVCONTROLPOINT_IBY__
+
+#ifdef __UPNP_STACK
+#ifdef __UPNP_AVCP
+
+file=ABI_DIR\BUILD_DIR\avcontrolframework.dll \sys\bin\avcontrolframework.dll 
+#ifdef __UPNP_REMOTE_STORAGE
+#ifdef __REMOTE_STORAGE_FW
+file=ABI_DIR\BUILD_DIR\avcpengine.exe \Sys\Bin\avcpengine.exe 
+file=ABI_DIR\BUILD_DIR\avcpengineclient.dll \sys\bin\avcpengineclient.dll
+ECOM_PLUGIN(upnpaccess.dll, upnpaccess.rsc)
+#endif // __REMOTE_STORAGE_FW
+#endif // __UPNP_REMOTE_STORAGE 
+
+#endif // __UPNP_AVCP
+#endif // __UPNP_STACK
+
+#endif // __UPNPAVCONTROLPOINT_IBY__
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/upnpaccessplugin/data/101F9779.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,57 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration for UPnPAccess
+*
+*/
+
+
+// INCLUDES
+#include "ecom/registryinfo.rh"
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// REGISTRY_INFO theInfo
+// Declares info for the "remoteaccess/upnp" implementation
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// UID for the DLL
+	dll_uid = 0x101F9779;
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = 0x101F96E3;
+			implementations = 
+				{
+				// Info for CUpnpAccess
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x101F9779; // why is it the same UID as UID3?
+					version_no = 1;
+					display_name = "upnp";
+					default_data = "remoteaccess/upnp||UPnP";
+					opaque_data = "params";
+					}
+				};
+			}
+		};
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/upnpaccessplugin/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,23 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for UPnPAccess
+*
+*/
+
+
+
+PRJ_MMPFILES
+upnpaccessplugin.mmp
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/upnpaccessplugin/group/upnpaccessplugin.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,59 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification for UPnPAccess
+*
+*/
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET          upnpaccess.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101F9779
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          upnpaccess.cpp
+
+VERSION         10.1
+paged
+
+MW_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../../../inc
+USERINCLUDE   ../../inc
+USERINCLUDE     ../inc
+
+SOURCEPATH      ../data
+
+START RESOURCE  101F9779.rss 
+HEADER
+TARGET          upnpaccess.rsc
+TARGETPATH      resource/plugins 
+END
+
+LIBRARY         bafl.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         euser.lib
+LIBRARY         inetprotutil.lib
+
+// UPnP
+LIBRARY         avcpengineclient.lib
+
+// Remote Storage
+LIBRARY         rsfwcommon.lib
+
+LIBRARY         flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/upnpaccessplugin/inc/upnpaccess.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,327 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP plugin interface for RSFW
+*
+*/
+
+
+#ifndef C_CUPNPACCESS_H
+#define C_CUPNPACCESS_H
+
+// INCLUDES
+#include <rsfwremoteaccess.h>
+#include "upnpavcpenginerfsclient.h"
+
+// CLASS DECLARATION
+
+/**
+ *  UPnP plugin for Rsfw.
+ *  It enables mounting MS as new filesystem.
+ *
+ *  @lib upnpaccess.lib
+ *  @since Series 60 3.1
+ */
+class CUpnpAccess: public CRsfwRemoteAccess
+	{
+	public: // Constructors and destructor
+		/**
+		 * Two-phased constructor.
+		 */
+		static CUpnpAccess* NewL();
+		
+		/**
+		 * Destructor.
+		 */
+    virtual ~CUpnpAccess();
+    /**
+     * Set up parameters for operation.
+     * @param aRsfwRemoteAccessObserver MRsfwRemoteAccessObserver for receiving
+     *  asynchronous events from the accessor plugin,
+     *  e.g. changes in connectivity.
+     *  This parameter may be NULL
+     *  NOTICE: this function is not supported by UPnP access plugin
+     */
+    void SetupL(MRsfwRemoteAccessObserver* /* aRsfwRemoteAccessObserver */);
+
+    /**
+     * Opens a connection to the server given by aServerName parameter.
+     * For UPnPAccess only serve has to be defined and 
+     * value should be equal to UDN of MS
+     * So format URI for mounting has to be:
+     * upnp://UDN
+     *
+     * @param aUri URI of the remote repository.
+     *   The URI must not contain authority part (user name/password)
+     * @param aFriendlyName server friendly name for access control dialog 
+     *                                  (can be empty)
+     * @param aUserName user name for access control (can be empty)
+     * @param aPassword password for access control (can be empty)
+     * @param aAuxData auxiliary parameters for connection setup (eg IAP info)
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */
+    TUint OpenL(const TUriC& aUri,
+    	    const TDesC& aFriendlyName,
+			const TDesC& aUserName,
+			const TDesC& aPassword,
+			const TDesC& aAuxData,
+			MRsfwRemoteAccessResponseHandler* aResponseHandler) ;
+
+		/**
+		* Gets contents of the directory given by aPathName parameter.
+		*
+		* @param aPathName path name of the directory
+		* @param aDirentsp an array of directory entries to be filled.
+		* @param aResponseHandler response handler
+		* @return identifier of the created transaction
+		*/    
+		TUint GetDirectoryL(const TDesC& aPathName,
+                        RPointerArray<CRsfwDirEnt>& aDirEnts,
+                        MRsfwRemoteAccessResponseHandler* aResponseHandler);
+
+		/**
+		* Gets attributes of the directory given by aPathName parameter.
+		* This function may also be called if the type of the object is
+		* not yet known (e.g., the object could be a file).
+		*
+		* @param aPathName path name of the directory
+		* @param aAttr attribute structure to be filled
+		* @param aResponseHandler response handler
+		* @return identifier of the created transaction
+		*/    
+    TUint GetDirectoryAttributesL(
+			const TDesC& aPathName,
+			CRsfwDirEntAttr*& aAttr,
+			MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Gets attributes of the file given by aPathName parameter.
+     *
+     * @param aPathName path name of the file
+     * @param aAttr attribute structure to be filled
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */         
+		TUint GetFileAttributesL(const TDesC& aPathName,	CRsfwDirEntAttr*& aAttr,
+			MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /** 
+     * Sets attributes of the file or directory given by aPathName parameter.
+     * This function is typically only used for files and even then
+     * the implementation may do nothing since standard file attributes
+     * are implied by the contents of the file or set in conjunction with
+     * other operations on the file system object.
+     * NOTICE: this function is not supported by UPnP access plugin
+     *
+     * @param aPathName path name of the file or directory
+     * @param aAttr attribute structure
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */    
+    TUint SetAttributesL(const TDesC& aPathName,
+                         CRsfwDirEntAttr& aAttr,
+                         MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Gets a remote file and copies it to a local file.
+     * Note that byte ranges are not be implemented by all
+     * file access protocols.
+     *
+     * @param aRemotePathName path name of the remote file
+     * @param aLocalPathName path name of the local file
+     * @param aOffset offset of the first byte to be accessed
+     * @param aLength length of data to be accessed/was accessed (NULL/0=all)
+     * @param aFlags operation qualifier.
+     *   The following flags have been defined:
+     *   KRemoteAccessOptionGetToStartOfFile: even if an offset is specified
+     *      the fetched data is still put at the beginning of the local file.     
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */    
+    TUint GetFileL(const TDesC& aRemotePathName,
+                   const TDesC& aLocalPathName,
+                   TInt aOffset,
+                   TInt* aLength,
+                   TUint aFlags,
+                   MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Puts a file to the server.
+     * NOTICE: this function is not supported by UPnP access plugin     
+     *
+     * @param aLocalPathName path name of the local file
+     * @param aRemotePathName path name of the remote file
+     * @param aMimeType MIME-type of the file
+     *   (will be put to Content-Type, e.g. text/plain or
+     *   application/octet-stream)     
+     * @param aOffset offset of the first byte to be accessed
+     * @param aLength length of data to be accessed (NULL/0=all)
+     * @param aTotalLength total length of the file     
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */   
+    TUint PutFileL(const TDesC& aLocalPathName,
+                   const TDesC& aRemotePathName,
+                   const TDesC8& aMimeType,                   
+                   TInt aOffset,
+                   TInt aLength,
+                   TInt aTotalLength,                   
+                   MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Puts a file to the server.
+     *
+     * @param aLocalPathName path name of the local file
+     * @param aRemotePathName path name of the remote file
+     * @param aMimeType MIME-type of the file (will be put to Content-Type,
+     *   e.g. text/plain or application/octet-stream)    
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */    
+    TUint PutFileL(const TDesC& aLocalPathName,
+                   const TDesC& aRemotePathName,
+                   const TDesC8& aMimeType,                   
+                   MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Creates an empty file on the remote server
+     *
+     * @param aPathName path name of the new file
+     * @param aOverWriting whether we are overwriting an existing file     
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */    
+    TUint CreateFileL(const TDesC& aPathName, TBool aOverWriting,
+                      MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Makes a directory.
+     *
+     * @param aPathName path name of the new directory
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */
+    TUint MakeDirectoryL(const TDesC& aPathName,
+                         MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Deletes a directory.
+     *
+     * @param aPathName path name of the directory to be deleted
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */    
+    TUint DeleteDirectoryL(const TDesC& aPathName,
+                           MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Deletes a file.
+     *
+     * @param aPathName path name of the file to be deleted
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */
+    TUint DeleteFileL(const TDesC& aPathName,
+                      MRsfwRemoteAccessResponseHandler* aResponseHandler);
+		/**
+     * Renames a file or a directory.
+     * (may involve movement to another directory).
+     * NOTICE: this function is not supported by UPnP access plugin        
+     *
+     * @param aSrcPathName path name of the object to be renamed
+     * @param aDstPathName new path name of the object
+     * @param aOverwrite allow overwriting an existing object
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */
+    TUint RenameL(const TDesC& aSrcPathName,
+                  const TDesC& aDstPathName,
+                  TBool aOverwrite,
+                  MRsfwRemoteAccessResponseHandler* aResponseHandler);
+
+    /**
+     * Obtains a lock for the given file system object
+     * NOTICE: this function is not supported by UPnP access plugin       
+     *
+     * @param aPathName path name of the object to be locked
+     * @param aLockFlags indicates whether a write or read lock is requested
+     * @param aTimeout the timeout that is requested and granted
+     * @param aLockToken lock token
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */
+    TUint ObtainLockL(const TDesC& aPathName,
+                      TUint aLockFlags,
+                      TUint& aTimeout,
+                      TDesC8*& aLockToken,
+                      MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Releases the lock of the given file system object
+     * NOTICE: this function is not supported by UPnP access plugin       
+     *
+     * @param aPathName path name of the object to be locked
+     * @param aResponseHandler response handler
+     */    
+    TUint ReleaseLockL(const TDesC& aPathName,
+                       MRsfwRemoteAccessResponseHandler* aResponseHandler);
+    /**
+     * Refreshes the lock of the given file system object
+     * NOTICE: this function is not supported by UPnP access plugin       
+     *
+     * @param aPathName path name of the object to be locked
+     * @param aTimeout the timeout that is requested and granted
+     * @param aResponseHandler response handler
+     * @return identifier of the created transaction
+     */    
+    TUint RefreshLockL(const TDesC& aPathName,
+                       TUint& aTimeout,
+                       MRsfwRemoteAccessResponseHandler* aResponseHandler);
+
+    /**
+     * Sets lock token for the a given resource
+     * This lock token value replaces any previously cached token value
+     *
+     * @param aPathName path name
+     * @param aLockToken lock token
+     * @return error code
+     */
+    TInt SetLockToken(const TDesC& aPathName, const TDesC8& aLockToken);
+                           
+    /**
+     * Cancels a transaction
+     * Eventually the transaction will/should call HandleRemoteAccessResponseL
+     * with status KErrCancel
+     * NOTICE: this function is not supported by UPnP access plugin       
+     *
+     * @param aId the identifier of the transaction to be canceled
+     */
+    void Cancel(TUint aId);
+    
+    /**
+     * Cancels a transaction
+     * Eventually the transaction will/should call HandleRemoteAccessResponseL
+     * with status KErrCancel
+     * NOTICE: this function is not supported by UPnP access plugin       
+     *
+     * @param aTargetPath the identifier of the transaction to be canceled
+     */    
+    void Cancel(TDesC& aTargetPath);
+
+	private:
+		/**
+		* Symbian 2nd phase constructor.
+		*/	
+    void ConstructL();
+
+	private:
+    // UDN of MS
+    HBufC8* iUUID;
+    // client to target server
+    RUpnpAVCPEngineRFSClient iAVCPEngineClient;
+    };
+
+#endif // C_CUPNPACCESS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/upnpaccessplugin/inc/upnpmydebug.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,31 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Debug definitions for UPnPAccess
+*
+*/
+
+
+#ifndef C_UPNPMYDEBUG_H
+#define C_UPNPMYDEBUG_H
+
+// MACROS
+#define APPEND_TO_DEBUG_FILE
+
+// CONSTANTS
+_LIT(KDebugDirName, "avcp");
+_LIT(KDebugFileName, "upnpaccess.txt");
+
+#endif // MYDEBUG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpavcontrolpoint/upnpaccessplugin/src/upnpaccess.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,406 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements remote access plugin API - loopback to File Server
+ *
+*/
+
+
+// INCLUDE FILES
+#include "upnpaccess.h"
+#include "upnpmdebug.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] = 
+    {
+        {{0x101F9779}, (TProxyNewLPtr)CUpnpAccess::NewL}
+    };
+
+// ----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Exported proxy for instantiation method resolution
+// ----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy*
+ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    
+    return ImplementationTable;
+    }
+
+// ============================ MEMBER FUNCTIONS ==============================
+// ----------------------------------------------------------------------------
+// CUpnpAccess::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CUpnpAccess::ConstructL()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CUpnpAccess* CUpnpAccess::NewL()
+    {
+    CUpnpAccess* self = new (ELeave) CUpnpAccess;
+    DEBUGSTRING(("in NewL 0x%x", self));
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// Destructor
+CUpnpAccess::~CUpnpAccess()
+    {
+    DEBUGSTRING(("in destructor 0x%x", this));
+    delete iUUID;
+    iAVCPEngineClient.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::SetupL
+// ----------------------------------------------------------------------------
+//
+    void CUpnpAccess::SetupL(MRsfwRemoteAccessObserver*)
+    {    
+    DEBUGSTRING(("in SetupL"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::OpenL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::OpenL(const TUriC& aUri,
+	                    const TDesC& /* aFriendlyName */,
+						const TDesC& /* aUserName */,
+                        const TDesC& /* aPassword */,                     
+                        const TDesC& /* aAuxData */,
+                        MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+   
+    TPtrC host(aUri.Extract(EUriHost));
+    DEBUGSTRING16(("open plugin for '%S'", &host));
+        
+    iUUID = HBufC8::NewL(host.Length());
+    iUUID->Des().Copy(host);
+    
+    User::LeaveIfError(iAVCPEngineClient.Connect());
+    
+    aResponseHandler->HandleRemoteAccessResponse(0, KErrNone);
+    return 0;
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::GetDirectoryL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::GetDirectoryL(const TDesC& aPathName,
+                                RPointerArray<CRsfwDirEnt>& aDirEnts,
+                                MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("get directory '%S'", &aPathName));
+
+    TInt err = iAVCPEngineClient.GetDirectoryL(*iUUID, aPathName, aDirEnts);
+    
+    aResponseHandler->HandleRemoteAccessResponse(0, err);
+    return 0;
+    
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::GetDirectoryAttributesL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::GetDirectoryAttributesL(const TDesC& aPathName,
+                                          CRsfwDirEntAttr*& aAttr,
+                                          MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    // This function reads attributes of a directory
+    // (not attributes of the files in the directory)
+    DEBUGSTRING16(("Get directory attributes of '%S'", &aPathName));
+    
+    TInt err = iAVCPEngineClient.GetDirectoryAttributeL(*iUUID, aPathName, aAttr);
+
+    aResponseHandler->HandleRemoteAccessResponse(0, err);
+    return 0;
+    
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::GetFileAttributesL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::GetFileAttributesL(const TDesC& aPathName,
+                               CRsfwDirEntAttr*& aAttr,
+                               MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("Get file attributes of '%S'", &aPathName));
+    
+    TInt err = iAVCPEngineClient.GetFileAttributeL(*iUUID, aPathName, aAttr);
+        
+    aResponseHandler->HandleRemoteAccessResponse(0, err);
+    return 0;  
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::SetAttributesL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::SetAttributesL(const TDesC& aPathName,
+                           CRsfwDirEntAttr& /*aAttr*/,
+                           MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("Set attributes of '%S'",
+                  &aPathName));
+
+    aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported);
+    return 0;  
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::GetFileL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::GetFileL(const TDesC& aRemotePathName,
+                           	const TDesC& aLocalPathName,
+                           	TInt aOffset,
+                           	TInt* aLength,
+                   			TUint aFlags,                           
+                           	MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+       
+    DEBUGSTRING16(("get file '%S'", &aRemotePathName));
+    DEBUGSTRING16(("     into file '%S'", &aLocalPathName));
+    
+    TInt length = 0;
+    if (aLength) 
+    {
+        length = *aLength;
+    }
+    DEBUGSTRING(("offset=%d, length=%d", aOffset, length));        
+    	
+    TInt read;
+    TInt err = iAVCPEngineClient.GetFileL(*iUUID, 
+    		aRemotePathName, aLocalPathName, aOffset, length, aFlags, read);
+    		
+    if (aLength) {
+    	*aLength = read;    	
+    }
+             
+    aResponseHandler->HandleRemoteAccessResponse(0, err);
+    return 0; 
+
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::MakeDirectoryL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::MakeDirectoryL(const TDesC& aPathName,
+                           MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("Make directory '%S'", &aPathName));
+    
+    TInt err = iAVCPEngineClient.MakeDirectoryL(*iUUID, aPathName);    
+
+    aResponseHandler->HandleRemoteAccessResponse(0, err);
+    return 0;  
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::CreateFileL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::CreateFileL(const TDesC& aPathName, TBool aOverWriting,
+                              MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("Create file '%S'", &aPathName));
+    
+    TInt err(0);
+    if (aOverWriting) 
+    	{
+    	DEBUGSTRING16(("delete file '%S'", &aPathName));    
+    	err = iAVCPEngineClient.DeleteFileL(*iUUID, aPathName);       	
+    	}
+    
+    if (err == KErrNone) 
+    	err = iAVCPEngineClient.CreateFileL(*iUUID, aPathName);    
+
+    aResponseHandler->HandleRemoteAccessResponse(0, err);
+    return 0;  
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::PutFileL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::PutFileL(const TDesC& aLocalPathName,
+                        	const TDesC& aRemotePathName,
+                   			const TDesC8& /*aMimeType*/,                             
+                           	MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("put file '%S'", &aLocalPathName));
+    DEBUGSTRING16(("     to remote file '%S'", &aRemotePathName));
+        
+    TInt err = iAVCPEngineClient.PutFileL(*iUUID, aLocalPathName, aRemotePathName);    
+
+    aResponseHandler->HandleRemoteAccessResponse(0, err);
+    return 0;   
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::PutFileL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::PutFileL(const TDesC& aLocalPathName,
+                           	const TDesC& aRemotePathName,
+							const TDesC8& /*aMimeType*/,                                                        	
+                           	TInt /* aOffset */,
+                           	TInt /* aLength */,
+                           	TInt /* aTotalLength */,                   			
+                           	MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("put file '%S'", &aLocalPathName));
+    DEBUGSTRING16(("     to remote file '%S'", &aRemotePathName));
+
+    aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported);
+    return 0; 
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::DeleteDirectoryL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::DeleteDirectoryL(const TDesC& aPathName,
+                             MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("delete directory '%S'", &aPathName));
+    
+    TInt err = iAVCPEngineClient.DeleteDirectoryL(*iUUID, aPathName);    
+
+    aResponseHandler->HandleRemoteAccessResponse(0, err);
+    return 0;  
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::DeleteFileL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::DeleteFileL(const TDesC& aPathName,
+                              MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("delete file '%S'", &aPathName));
+    
+    TInt err = iAVCPEngineClient.DeleteFileL(*iUUID, aPathName);    
+
+    aResponseHandler->HandleRemoteAccessResponse(0, err);
+    return 0;     
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::RenameL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::RenameL(const TDesC& aSrcPathName,
+                          const TDesC& aDstPathName,
+                          TBool /*aOverwrite*/,
+                          MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    
+    DEBUGSTRING16(("Rename '%S' to '%S'", &aSrcPathName, &aDstPathName));
+    aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported);
+    return 0;
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::ObtainLockL
+// ----------------------------------------------------------------------------
+//
+
+TUint CUpnpAccess::ObtainLockL(const TDesC&  aPathName ,
+                        TUint /* aLockFlags */,
+                        TUint& /*aTimeOut*/,
+                        TDesC8*& /* aLockToken */,
+                        MRsfwRemoteAccessResponseHandler*  aResponseHandler )
+    {
+    DEBUGSTRING16(("obtain lock '%S'", &aPathName));    
+
+    aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported);    
+    return 0;
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::ReleaseLockL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::ReleaseLockL(const TDesC&  aPathName,
+                         MRsfwRemoteAccessResponseHandler*  aResponseHandler)
+    {
+    DEBUGSTRING16(("release lock '%S'", &aPathName));
+
+    aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported);
+    return 0;
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpAccess::RefreshLockL
+// ----------------------------------------------------------------------------
+//
+TUint CUpnpAccess::RefreshLockL(const TDesC&  aPathName, TUint& /*aTimeOut*/,
+                         MRsfwRemoteAccessResponseHandler* aResponseHandler)
+    {
+    DEBUGSTRING16(("refresh lock '%S'", &aPathName));
+    
+    aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported);    
+    return 0;
+    }
+    
+// ----------------------------------------------------------------------------
+// CUpnpAccess::SetLockToken
+// ----------------------------------------------------------------------------
+//
+TInt CUpnpAccess::SetLockToken(const TDesC& /* aPathName */,
+                              const TDesC8& /* aLockToken */)
+    {
+    return KErrNotSupported;
+    }
+    
+// ----------------------------------------------------------------------------
+// CUpnpAccess::CancelL
+// ----------------------------------------------------------------------------
+//
+void CUpnpAccess::Cancel(TDesC& /* aTargetPath */)
+    {
+    // Nothing to cancel
+    }
+// ----------------------------------------------------------------------------
+// CUpnpAccess::CancelL
+// ----------------------------------------------------------------------------
+//
+void CUpnpAccess::Cancel(TUint /* aId */)
+    {
+    // Nothing to cancel
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for upnpframework
+*
+*/
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// ROM build
+../rom/upnpframework.iby               CORE_MW_LAYER_IBY_EXPORT_PATH(upnpframework.iby)
+../rom/upnpframeworkresources.iby      CORE_MW_LAYER_IBY_EXPORT_PATH(upnpframeworkresources.iby)
+// LOC files
+UPNP_LOC_EXPORT(upnpframework.loc)
+// IAD support
+../install/20009cae.cre                /epoc32/release/arm5/urel/z/private/20009cae.cre
+../install/20007564.cre                /epoc32/release/arm5/urel/z/private/20007564.cre
+../install/upnpframework_stub.sis      /epoc32/data/z/system/install/upnpframework_stub.sis
+// upnpframework common headers
+../inc/upnpframeworkfeatures_mmp.hrh   |../../inc/upnpframeworkfeatures_mmp.hrh
+../inc/upnplogging.h                   |../../inc/upnplogging.h
+../inc/upnppanic.h                     |../../inc/upnppanic.h
+../inc/upnplog.h                       |../../inc/upnplog.h
+
+PRJ_MMPFILES
+// none
+
+    // Build subprojects
+
+    // UpnpUtilities
+    #include "../upnputilities/group/bld.inf"
+#ifdef FF_UPNP_FRAMEWORK_2_0  // UPnP feature flag
+     // UPnP (Home Media) Extension plugin interface
+    #include "../upnpextensionpluginif/group/bld.inf"
+
+    // UpnpFileTransferEngine
+    #include "../upnpfiletransferengine/group/bld.inf"
+
+    // UpnpCommonUi
+    #include "../upnpcommonui/group/bld.inf"
+
+        // UpnpAiwEngine
+    #include "../upnpaiwengine/group/bld.inf"
+
+    // UpnpAiwProvider
+    #include "../upnpaiwprovider/group/bld.inf"
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+    // UpnpMusicAdapter
+    #include "../upnpmusicadapter/group/bld.inf"
+    
+    // UpnpCommand
+    #include "../upnpcommand/group/bld.inf"
+
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/inc/upnpframeworkfeatures_mmp.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defines the set of features included to UPnP FW
+*
+*/
+
+
+#ifndef UPNPFRAMEWORKFEATURES_MMP_HRH
+#define UPNPFRAMEWORKFEATURES_MMP_HRH
+
+// Add changes to the default values here.
+
+// Generic upnp console module testing flag. Enables special MT features and
+// toggles console mode (user interfaces will trigger OFF)
+// MACRO __UPNP_CONSOLE_MT__
+
+#endif // UPNPFRAMEWORKFEATURES_MMP_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/inc/upnplog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  log/assert facility of upnp framework
+*
+*/
+
+
+// **************************************************************************
+// *
+// *  HOW TO USE THIS LOGGING FACILITY
+// *
+// * 1. enable log facility in the code.
+// *     _LIT( KComponentLogfile, "component.txt");
+// *     #include "upnplog.h"
+// *
+// * 2. have flogger in mmp-file
+// *     DEBUGLIBRARY FLOGGER.LIB
+// *
+// * 3. use the log interface in the source
+// *     __LOG( char* strz )
+// *     __LOG1( char* strz, p1 )
+// *     __LOG2( char* strz, p1, p2 )
+// *     __LOG3( char* strz, p1, p2, p3 )
+// *     __LOG8( const TDesC8& msg )
+// *     __LOG16( const TDesC16& msg )
+// *     __ASSERTD( test, file, line )
+// *     __ASSERT( test, file, line )
+// *     __PANICD( file, line )
+// *     __PANIC( file, line )
+// *
+// * 4. The default logging/assertion modes are following:
+// *     DEBUG build:    log to console, assertion mode on.
+// *     RELEASE build:  log turned off, assertion mode off.
+// *     To override this preset, you can use following macros:
+// *     MACRO __UPNP_LOG_FILE          (logging to file)
+// *     MACRO __UPNP_LOG_CONSOLE       (logging to console)
+// *     MACRO __UPNP_LOG_OFF           (logging turned off in DEBUG build)
+// *     MACRO __UPNP_DEBUG_ASSERT      (enable D-panic and D-assert)
+// *     MACRO __UPNP_DEBUG_ASSERT_OFF  (disable D-panic and D-assert)
+// *     in case of using logging in RELEASE build, remember to switch
+// *     LIBRARY FLOGGER.LIB instead of DEBUGLIBRARY.
+// *
+// **************************************************************************
+
+
+#ifndef __UPNPLOG_H__
+#define __UPNPLOG_H__
+
+
+#include <e32std.h>
+
+
+// in DEBUG build activate the default modes
+#ifdef _DEBUG
+
+    #if !( defined(__UPNP_LOG_FILE) || \
+        defined(__UPNP_LOG_CONSOLE) || \
+        defined(__UPNP_LOG_OFF) )
+        // activate default logging mode
+        #define __UPNP_LOG_CONSOLE
+    #endif
+
+    #if !( defined(__UPNP_DEBUG_ASSERT) || \
+        defined(__UPNP_DEBUG_ASSERT_OFF) )
+        // activate debug assertion mode
+        #define __UPNP_DEBUG_ASSERT
+    #endif
+
+#endif //_DEBUG
+
+
+// this dummy function is to avoid compiler warning #177-D:
+// variable was declared but never referenced
+inline void __Dummy_KComponentLogfile()
+    {
+    TUint16 c = KComponentLogfile().Size();
+    c = 0;
+    }
+
+//
+// **************************************************************************
+// LOGGING MACROS
+// **************************************************************************
+//
+
+#if defined(__UPNP_LOG_FILE)
+
+    #include <flogger.h>
+
+    // Subdirectory under c:\logs -directory
+    _LIT( KLogDir, "upnpframework" );
+
+    #define __LOG( strz ) Print16(_L(strz))
+    #define __LOG1( strz,p1 ) Print16(_L(strz),p1)
+    #define __LOG2( strz,p1,p2 ) Print16(_L(strz),p1,p2)
+    #define __LOG3( strz,p1,p2,p3 ) \
+        Print16(_L(strz),p1,p2,p3)
+    #define __LOG8( msg ) Print8( _L8( "%S" ), &msg )
+    #define __LOG16( msg ) Print16( _L16( "%S" ), &msg )
+    #define __LOG8_1( strz,p1 ) Print8(_L8(strz),p1)
+
+    // Writes a log text to a file using file logger
+    inline void Print16( const TRefByValue<const TDesC> aFmt, ... )
+        {
+        VA_LIST list;
+        VA_START(list,aFmt);
+        RFileLogger::WriteFormat( KLogDir, KComponentLogfile,
+            EFileLoggingModeAppend, aFmt, list );
+        VA_END( list );
+        }    
+
+        // Writes a log text to a file using file logger
+    inline void Print8( const TRefByValue<const TDesC8> aFmt, ... )
+        {
+        VA_LIST list;
+        VA_START(list,aFmt);
+        RFileLogger::WriteFormat( KLogDir, KComponentLogfile,
+            EFileLoggingModeAppend, aFmt, list );
+        VA_END( list );
+        }
+
+#elif defined(__UPNP_LOG_CONSOLE)
+
+    #include <f32file.h>
+
+    #define __LOG( strz ) RDebug::Print(_L(strz))
+    #define __LOG1( strz,p1 ) RDebug::Print(_L(strz),p1)
+    #define __LOG2( strz,p1,p2 ) RDebug::Print(_L(strz),p1,p2)
+    #define __LOG3( strz,p1,p2,p3 ) \
+        RDebug::Print(_L(strz),p1,p2,p3)
+    #define __LOG8( msg ) Debug8(msg)
+    #define __LOG16( msg ) RDebug::Print(msg)
+    #define __LOG8_1( strz,p1 ) RDebug::Printf(strz, p1)
+
+    inline void Debug8( const TDesC8& aMsg )
+        {
+        __Dummy_KComponentLogfile();
+        RDebug::RawPrint( aMsg );
+        }
+
+#else // __UPNP_LOG_OFF
+
+    #define __LOG( strz ) __Dummy_KComponentLogfile();
+    #define __LOG1( fmt,p1 ) __Dummy_KComponentLogfile();
+    #define __LOG2( fmt,p1,p2 ) __Dummy_KComponentLogfile();
+    #define __LOG3( fmt,p1,p2,p3 ) __Dummy_KComponentLogfile();
+    #define __LOG8( msg ) __Dummy_KComponentLogfile();
+    #define __LOG16( msg ) __Dummy_KComponentLogfile();
+    #define __LOG8_1( strz,p1 ) __Dummy_KComponentLogfile();
+
+#endif // __UPNP_LOG_FILE || __UPNP_LOG_CONSOLE || __UPNP_LOG_OFF
+
+
+//
+// **************************************************************************
+// ASSERTION MACROS
+// **************************************************************************
+//
+
+#define __ASSERT( test, file, line ) \
+    if( !( test ) ) \
+        { \
+        __LOG2( "Assertion failed: %s %d", \
+            file, line ); \
+        User::Panic( _L(file), line ); \
+        }
+
+#define __PANIC( file, line ) \
+    { \
+    __LOG2( "Panic: %s %d", \
+        file, line ); \
+    User::Panic( _L(file), line ) \
+    }
+
+#ifdef __UPNP_DEBUG_ASSERT
+
+    #define __ASSERTD( test, file, line ) \
+        if( !( test ) ) \
+            { \
+            __LOG2( "Assertion failed: %s %d", \
+                file, line ); \
+            User::Panic( _L(file), line ); \
+            }
+
+    #define __PANICD( file, line ) \
+        { \
+        __LOG2( "Panic: %s %d", \
+            file, line ); \
+        User::Panic( _L(file), line ); \
+        }
+
+#else // __UPNP_DEBUG_ASSERT_OFF
+
+    #define __ASSERTD( test, file, line )
+    #define __PANICD( file, line )
+
+#endif // __UPNP_DEBUG_ASSERT || __UPNP_DEBUG_ASSERT_OFF
+
+
+
+#endif // __UPNPLOG_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/inc/upnplogging.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Logging facility for UPnP framework
+*
+*/
+
+
+// ***************************************************
+// * How to use UPnP framework logging facility
+// * 1. define KComponentLogfile
+// *     _LIT( KComponentLogfile, "AVControlServer.txt");
+// * 2. if you want, define one of these macros:
+// *     __FILE_LOGGING__     (logging to file)
+// *     __CONSOLE_LOGGING__  (logging to console)
+// * 3. have flogger in mmp-file
+// *     DEBUGLIBRARY FLOGGER.LIB
+// * 4. now you can use the log interface
+// *     __LOG( char* strz )
+// *     __LOG1( char* strz, p1 )
+// *     __LOG2( char* strz, p1, p2 )
+// *     __LOG3( char* strz, p1, p2, p3 )
+// *     __LOG8( const TDesC8& msg )
+// *     __LOG16( const TDesC16& msg )
+// ***************************************************
+
+
+#ifndef __UPNPLOGGING_H__
+#define __UPNPLOGGING_H__
+
+
+#include <e32std.h>
+
+
+#ifdef _DEBUG
+  // activate default logging mode in debug builds
+  #define __CONSOLE_LOGGING__
+  //#define __FILE_LOGGING__
+#endif //_DEBUG
+
+
+
+#if defined(__CONSOLE_LOGGING__)
+
+    #include <f32file.h>
+
+    #define __LOG( strz ) RDebug::Print(_L(strz))
+    #define __LOG1( strz,p1 ) RDebug::Print(_L(strz),p1)
+    #define __LOG2( strz,p1,p2 ) RDebug::Print(_L(strz),p1,p2)
+    #define __LOG3( strz,p1,p2,p3 ) \
+        RDebug::Print(_L(strz),p1,p2,p3)
+    #define __LOG8( msg ) Debug8(msg)
+    #define __LOG16( msg ) RDebug::Print(msg)
+    #define __LOG8_1( strz,p1 ) RDebug::Printf(strz, p1)
+
+    inline void Debug8( const TDesC8& aMsg )
+        {
+        RDebug::RawPrint( aMsg );
+        }
+
+    inline void __Dummy_KComponentLogfile()
+        {
+        // this dummy function is to avoid compiler warning #177-D:
+        // variable was declared but never referenced
+        TUint16 c = KComponentLogfile()[0];
+        c = 0;
+        }
+
+#elif defined(__FILE_LOGGING__)
+
+    #include <flogger.h>
+
+    // Subdirectory under c:\logs -directory
+    _LIT(KLogDir, "upnpframework");
+
+    #define __LOG( strz ) Print16(_L(strz))
+    #define __LOG1( strz,p1 ) Print16(_L(strz),p1)
+    #define __LOG2( strz,p1,p2 ) Print16(_L(strz),p1,p2)
+    #define __LOG3( strz,p1,p2,p3 ) \
+        Print16(_L(strz),p1,p2,p3)
+    #define __LOG8( msg ) Print8( _L8( "%S" ), &msg )
+    #define __LOG16( msg ) Print16( _L16( "%S" ), &msg )
+    #define __LOG8_1( strz,p1 ) Print8(_L8(strz),p1)
+
+    // Writes a log text to a file using file logger
+    inline void Print16( const TRefByValue<const TDesC> aFmt, ... )
+        {
+        VA_LIST list;
+        VA_START(list,aFmt);
+        RFileLogger::WriteFormat( KLogDir, KComponentLogfile,
+            EFileLoggingModeAppend, aFmt, list );
+        VA_END( list );
+        }    
+
+        // Writes a log text to a file using file logger
+    inline void Print8( const TRefByValue<const TDesC8> aFmt, ... )
+        {
+        VA_LIST list;
+        VA_START(list,aFmt);
+        RFileLogger::WriteFormat( KLogDir, KComponentLogfile,
+            EFileLoggingModeAppend, aFmt, list );
+        VA_END( list );
+        }
+
+#else // !(__CONSOLE_LOGGING__ | __FILE_LOGGING__)
+
+    #define __LOG( strz )
+    #define __LOG1( fmt,p1 )
+    #define __LOG2( fmt,p1,p2 )
+    #define __LOG3( fmt,p1,p2,p3 )
+    #define __LOG8( msg )
+    #define __LOG16( msg )
+    #define __LOG8_1( strz,p1 )
+
+#endif // __CONSOLE_LOGGING__ | __FILE_LOGGING__
+
+
+#endif // __UPNPLOGGING_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/inc/upnppanic.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Panic facility for UPnP framework
+*
+*/
+
+
+// ***************************************************
+// * How to use UPnP framework panic facility
+// * 1. define KModuleName and KComponentLogfile (at least in _DEBUG)
+// *     _LIT( KModuleName, "upnpplaybacksession");
+// *     _LIT( KComponentLogfile, "AVControlServer.txt");
+// * 2. if you like, define __UPNP_DEBUG_PANIC__
+// *     by default this is only active in debug builds
+// * 3. use the panic interface
+// *     __ASSERTD(check, line) to assert id debug builds, panic if fail
+// *     __ASSERT(check, line) to assert and panic if fail
+// *     __PANICD(line) to panic instantly in debug builds
+// *     __PANIC(line) to panic instantly
+// *     panics will use module name and line number (use __LINE__)
+// *     and create an entry to module logfile, if logging is enabled
+// ***************************************************
+
+
+#ifndef __UPNPPANIC_H__
+#define __UPNPPANIC_H__
+
+
+#include <e32std.h>
+#include "upnplogging.h"
+
+#ifdef _DEBUG
+  // activate panic in debug builds
+  #define __UPNP_DEBUG_PANIC__
+#endif //_DEBUG
+
+
+// define panics that work in all builds
+#define __ASSERT( check, line ) \
+    if(!(check)) \
+        { \
+        __LOG2( "Assertion failed: %S %d", \
+            &KModuleName, line ); \
+        User::Panic( KModuleName, line ); \
+        }
+
+#define __PANIC(line) \
+    __LOG2( "Panic: %S %d", \
+        &KModuleName, line ); \
+    User::Panic( KModuleName, line )
+
+#ifdef __UPNP_DEBUG_PANIC__
+
+    // panics that work only in debug  builds
+    #define __ASSERTD( check, line ) \
+        if(!(check)) \
+            { \
+            __LOG2( "Assertion failed: %S %d", \
+                &KModuleName, line ); \
+            User::Panic( KModuleName, line ); \
+            }
+
+    #define __PANICD( line ) \
+        __LOG2( "Panic: %S %d", \
+            &KModuleName, line ); \
+        User::Panic( KModuleName, line )
+
+#else // !__UPNP_DEBUG_PANIC__
+
+    // these are optimized away
+    #define __ASSERTD( check, line )
+    #define __PANICD( line )
+
+#endif // __UPNP_DEBUG_PANIC__
+
+
+#endif // __UPNPPANIC_H__
Binary file upnpframework/install/20007564.cre has changed
Binary file upnpframework/install/20009cae.cre has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/install/cenrep.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,32 @@
+;
+; Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:   pkg file for upnpfw central repositories
+;
+
+;Languages
+&EN
+
+; Header
+#{ "UPnPFramework CenRep file"}, (0x10202BE9), 1, 0, 0, TYPE=SP
+
+; Supports Series 60 v3.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Localised vendor name
+%{"Nokia-EN"}
+; Unique vendor name
+:"Nokia"
+
+"\epoc32\release\arm5\urel\z\private\20009cae.cre"-"!:\private\10202be9\persists\20009cae.cre"
+"\epoc32\release\arm5\urel\z\private\20007564.cre"-"!:\private\10202be9\persists\20007564.cre"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/install/homesynccenrep.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,32 @@
+;
+; Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:   pkg file for homesync central repository
+;
+
+
+;Languages
+&EN
+
+; Header
+#{ "MediaServant CenRep file"}, (0x10202BE9), 1, 0, 0, TYPE=SP
+
+; Supports Series 60 v3.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Localised vendor name
+%{"Nokia-EN"}
+; Unique vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\urel\z\private\10202be9\10281fab.cre"-"!:\private\10202be9\persists\10281fab.cre"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/install/make_upnpframework_sis.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,21 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:   Bat for creating and signing upnpframework sis-files
+rem
+
+makesis cenrep.pkg
+signsis cenrep.sis cenrep.sisx rd.cer rd-key.pem
+
+makesis upnpframework.pkg
+signsis upnpframework.sis upnpframework.sisx  rd.cer rd-key.pem
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/install/make_upnpframework_stub_sis.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,17 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:   Bat for creating upnpframework_stub.sis
+rem
+
+makesis -s upnpframework_stub.pkg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/install/upnpframework.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,129 @@
+;
+; Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:   pkg file for upnp framework
+;
+
+
+; upnpframework.pkg
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"UPnPFramework"},(0x10006CCA),1,1,0, TYPE=SA, RU
+
+;Localized Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;Supports Series 60 v 3.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+
+; UpnpSettings
+"\epoc32\release\armv5\urel\upnpsettingsengine.dll"-"!:\sys\bin\upnpsettingsengine.dll"
+
+;UPnP utilities
+"\epoc32\release\armv5\urel\upnputilities.dll"-"!:\sys\bin\upnputilities.dll"
+
+; UPnP (Home Media) Extension Plugin interface
+"\epoc32\release\armv5\urel\upnpextensionpluginif.dll"-"!:\sys\bin\upnpextensionpluginif.dll"
+
+;UPnP AV Controller
+"\epoc32\release\armv5\urel\upnpavcontrollerclient.dll"-"!:\sys\bin\upnpavcontrollerclient.dll"
+"\epoc32\release\armv5\urel\upnpavcontrollerserver.exe"-"!:\sys\bin\upnpavcontrollerserver.exe"
+"\epoc32\release\armv5\urel\upnpavcontrollerhelper.dll"-"!:\sys\bin\upnpavcontrollerhelper.dll"
+
+;UPnP Security
+"\epoc32\release\armv5\urel\upnpsecuritymanagerclient.dll"-"!:\sys\bin\upnpsecuritymanagerclient.dll"
+"\epoc32\release\armv5\urel\upnpsecuritymanagerserver.exe"-"!:\sys\bin\upnpsecuritymanagerserver.exe"
+"\epoc32\data\Z\resource\UPnPNotifier.RSC"-"!:\resource\UPnPNotifier.RSC"
+"\epoc32\release\armv5\urel\upnpsecurity.dll"-"!:\sys\bin\upnpsecurity.dll"
+"\epoc32\release\armv5\urel\upnpsecuritymanagerplugin.dll"-"!:\sys\bin\upnpsecuritymanagerplugin.dll"
+"\epoc32\data\Z\resource\plugins\upnpsecuritymanagerplugin.rsc"-"!:\resource\plugins\upnpsecuritymanagerplugin.rsc"
+
+;UPnP musicadapter
+"\epoc32\release\armv5\urel\upnpmusicadapter.dll"-"!:\sys\bin\upnpmusicadapter.dll"
+
+;UPnP CommonUI
+"\epoc32\release\armv5\urel\UPnPCommonUI.dll"-"!:\sys\bin\UPnPCommonUI.dll"
+"\epoc32\data\Z\resource\apps\upnpcommonui.mif"-"!:\resource\apps\upnpcommonui.mif"
+"\epoc32\data\Z\resource\UPnPCommonUI.rsc"-"!:\resource\UPnPCommonUI.rsc"
+
+;UPnP AIW Engine
+"\epoc32\release\armv5\urel\upnpaiwengine.dll"-"!:\sys\bin\upnpaiwengine.dll"
+
+;UPnP File Transfer Engine
+"\epoc32\release\armv5\urel\upnpfiletransferengine.dll"-"!:\sys\bin\upnpfiletransferengine.dll"
+"\epoc32\data\Z\resource\UPnPFileTransferEngineResources.rsc"-"!:\resource\UPnPFileTransferEngineResources.rsc"
+
+;UPnP AIW Provider
+"\epoc32\release\armv5\urel\upnpaiwprovider.dll"-"!:\sys\bin\upnpaiwprovider.dll"
+"\epoc32\data\Z\resource\plugins\upnpaiwprovider.rsc"-"!:\resource\plugins\upnpaiwprovider.rsc"
+"\epoc32\data\Z\resource\UPnPAiwEngineResources.rsc"-"!:\resource\UPnPAiwEngineResources.rsc"
+"\epoc32\data\Z\resource\UPnPAiwMenuResources.rsc"-"!:\resource\UPnPAiwMenuResources.rsc"
+
+;UPnP Command
+"\epoc32\release\armv5\urel\upnpcommand.dll"-"!:\sys\bin\upnpcommand.dll"
+"\epoc32\data\Z\resource\upnpcommandresources.rsc"-"!:\resource\upnpcommandresources.rsc"
+"\epoc32\release\armv5\urel\upnpcommandplugin.dll"-"!:\sys\bin\upnpcommandplugin.dll"
+"\epoc32\data\Z\resource\plugins\upnpcommandplugin.rsc"-"!:\resource\plugins\upnpcommandplugin.rsc"
+
+;UPnP Sharing Application Engine
+"\epoc32\release\armv5\urel\upnpapplicationengine.dll"-"!:\sys\bin\upnpapplicationengine.dll"
+"\epoc32\release\armv5\urel\z\system\apps\upnp\upnp_ms_jpeg_lrg.jpg"-"!:\system\apps\upnp\upnp_ms_jpeg_lrg.jpg"
+"\epoc32\release\armv5\urel\z\system\apps\upnp\upnp_ms_jpeg_sm.jpg"-"!:\system\apps\upnp\upnp_ms_jpeg_sm.jpg"
+"\epoc32\release\armv5\urel\z\system\apps\upnp\upnp_ms_png_lrg.png"-"!:\system\apps\upnp\upnp_ms_png_lrg.png"
+"\epoc32\release\armv5\urel\z\system\apps\upnp\upnp_ms_png_sm.png"-"!:\system\apps\upnp\upnp_ms_png_sm.png"
+
+;UPnP Settings UI
+"\epoc32\release\armv5\urel\upnpmultiselectionui.dll"-"!:\sys\bin\upnpmultiselectionui.dll"
+"\epoc32\data\Z\resource\CUPnPMultiselectionUi.RSC"-"!:\resource\CUPnPMultiselectionUi.RSC"
+"\epoc32\release\armv5\urel\upnpsharingui.dll"-"!:\sys\bin\upnpsharingui.dll"
+"\epoc32\data\Z\resource\upnpsharingui.rsc"-"!:\resource\upnpsharingui.rsc"
+
+
+
+;UPnP Wizard
+"\epoc32\release\armv5\urel\upnpappwizard.dll"-"!:\sys\bin\upnpappwizard.dll"
+"\epoc32\data\Z\resource\cupnpappwizard.rsc"-"!:\resource\cupnpappwizard.rsc"
+
+;UPnP content sharing server
+"\epoc32\release\armv5\urel\upnpcontentserver.exe"-"!:\sys\bin\upnpcontentserver.exe"
+"\epoc32\release\armv5\urel\upnpcontentserverclient.dll"-"!:\sys\bin\upnpcontentserverclient.dll"
+
+;DLNA Profiler
+"\epoc32\release\armv5\urel\dlnaprofiler.dll"-"!:\sys\bin\dlnaprofiler.dll"
+
+;UPnP XML Parser
+"\epoc32\release\armv5\urel\upnpxmlparser.dll"-"!:\sys\bin\upnpxmlparser.dll"
+
+
+;UPnP Playback plugins
+"\epoc32\release\armv5\urel\upnpplaybackplugins.dll"-"!:\sys\bin\upnpplaybackplugins.dll"
+"\epoc32\data\Z\resource\plugins\upnpplaybackplugins.rsc"-"!:\resource\plugins\upnpplaybackplugins.rsc"
+
+;UPnP Gs plugins
+"\epoc32\release\armv5\urel\upnpgsplugin.dll"-"!:\sys\bin\upnpgsplugin.dll"
+"\epoc32\data\Z\resource\upnpgspluginrsc.rsc"-"!:\resource\upnpgspluginrsc.rsc"
+"\epoc32\data\Z\resource\apps\upnpgspluginrsc.mif"-"!:\resource\apps\upnpgspluginrsc.mif"
+"\epoc32\data\Z\resource\plugins\upnpgsplugin.rsc"-"!:\resource\plugins\upnpgsplugin.rsc"
+
+
+; cenrtral repository
+;@"cenrep.sisx", (0x10202BE9)
+
+; End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/install/upnpframework_stub.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,30 @@
+;
+; Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:   pkg file for upnp framework stubs
+;
+
+
+; upnpframework_stub.pkg
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"UPnPFramework"},(0x10006CCA),1,1,0, TYPE=SA
+
+;Localized Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
Binary file upnpframework/install/upnpframework_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/install/upnpframework_udeb.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,118 @@
+;
+; Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:   pkg file for udeb version of upnp framework
+;
+
+
+; upnpframework_udeb.pkg
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"UPnPFramework"},(0x10006CCA),1,0,0, TYPE=SA, RU
+
+;Localized Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;Supports Series 60 v 3.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; UpnpSettings
+"\epoc32\release\armv5\udeb\upnpsettingsengine.dll"-"!:\sys\bin\upnpsettingsengine.dll"
+
+;UPnP utilities
+"\epoc32\release\armv5\udeb\upnputilities.dll"-"!:\sys\bin\upnputilities.dll"
+
+; UPnP (Home Media) Extension Plugin interface
+"\epoc32\release\armv5\udeb\upnpextensionpluginif.dll"-"!:\sys\bin\upnpextensionpluginif.dll"
+
+;UPnP AV Controller
+"\epoc32\release\armv5\udeb\upnpavcontrollerclient.dll"-"!:\sys\bin\upnpavcontrollerclient.dll"
+"\epoc32\release\armv5\udeb\upnpavcontrollerserver.exe"-"!:\sys\bin\upnpavcontrollerserver.exe"
+"\epoc32\release\armv5\udeb\upnpavcontrollerhelper.dll"-"!:\sys\bin\upnpavcontrollerhelper.dll"
+
+;UPnP Security
+"\epoc32\release\armv5\udeb\upnpsecuritymanagerclient.dll"-"!:\sys\bin\upnpsecuritymanagerclient.dll"
+"\epoc32\release\armv5\udeb\upnpsecuritymanagerserver.exe"-"!:\sys\bin\upnpsecuritymanagerserver.exe"
+"\epoc32\data\Z\resource\UPnPNotifier.RSC"-"!:\resource\UPnPNotifier.RSC"
+"\epoc32\release\armv5\udeb\upnpsecurity.dll"-"!:\sys\bin\upnpsecurity.dll"
+"\epoc32\release\armv5\udeb\upnpsecuritymanagerplugin.dll"-"!:\sys\bin\upnpsecuritymanagerplugin.dll"
+"\epoc32\data\Z\resource\plugins\upnpsecuritymanagerplugin.rsc"-"!:\resource\plugins\upnpsecuritymanagerplugin.rsc"
+
+;UPnP musicadapter
+"\epoc32\release\armv5\udeb\upnpmusicadapter.dll"-"!:\sys\bin\upnpmusicadapter.dll"
+
+;UPnP CommonUI
+"\epoc32\release\armv5\udeb\UPnPCommonUI.dll"-"!:\sys\bin\UPnPCommonUI.dll"
+"\epoc32\data\Z\resource\apps\upnpcommonui.mif"-"!:\resource\apps\upnpcommonui.mif"
+"\epoc32\data\Z\resource\UPnPCommonUI.rsc"-"!:\resource\UPnPCommonUI.rsc"
+
+;UPnP AIW Engine
+"\epoc32\release\armv5\udeb\upnpaiwengine.dll"-"!:\sys\bin\upnpaiwengine.dll"
+
+;UPnP File Transfer Engine
+"\epoc32\release\armv5\udeb\upnpfiletransferengine.dll"-"!:\sys\bin\upnpfiletransferengine.dll"
+"\epoc32\data\Z\resource\UPnPFileTransferEngineResources.rsc"-"!:\resource\UPnPFileTransferEngineResources.rsc"
+
+;UPnP AIW Provider
+"\epoc32\release\armv5\udeb\upnpaiwprovider.dll"-"!:\sys\bin\upnpaiwprovider.dll"
+"\epoc32\data\Z\resource\plugins\upnpaiwprovider.rsc"-"!:\resource\plugins\upnpaiwprovider.rsc"
+"\epoc32\data\Z\resource\UPnPAiwEngineResources.rsc"-"!:\resource\UPnPAiwEngineResources.rsc"
+"\epoc32\data\Z\resource\UPnPAiwMenuResources.rsc"-"!:\resource\UPnPAiwMenuResources.rsc"
+
+;UPnP Command
+"\epoc32\release\armv5\udeb\upnpcommand.dll"-"!:\sys\bin\upnpcommand.dll"
+"\epoc32\data\Z\resource\upnpcommandresources.rsc"-"!:\resource\upnpcommandresources.rsc"
+"\epoc32\release\armv5\udeb\upnpcommandplugin.dll"-"!:\sys\bin\upnpcommandplugin.dll"
+"\epoc32\data\Z\resource\plugins\upnpcommandplugin.rsc"-"!:\resource\plugins\upnpcommandplugin.rsc"
+
+;UPnP Sharing Application Engine
+"\epoc32\release\armv5\udeb\upnpapplicationengine.dll"-"!:\sys\bin\upnpapplicationengine.dll"
+"\epoc32\release\armv5\udeb\z\system\apps\upnp\upnp_ms_jpeg_lrg.jpg"-"!:\system\apps\upnp\upnp_ms_jpeg_lrg.jpg"
+"\epoc32\release\armv5\udeb\z\system\apps\upnp\upnp_ms_jpeg_sm.jpg"-"!:\system\apps\upnp\upnp_ms_jpeg_sm.jpg"
+"\epoc32\release\armv5\udeb\z\system\apps\upnp\upnp_ms_png_lrg.png"-"!:\system\apps\upnp\upnp_ms_png_lrg.png"
+"\epoc32\release\armv5\udeb\z\system\apps\upnp\upnp_ms_png_sm.png"-"!:\system\apps\upnp\upnp_ms_png_sm.png"
+
+;UPnP Settings UI
+"\epoc32\release\armv5\udeb\upnpmultiselectionui.dll"-"!:\sys\bin\upnpmultiselectionui.dll"
+"\epoc32\data\Z\resource\CUPnPMultiselectionUi.RSC"-"!:\resource\CUPnPMultiselectionUi.RSC"
+"\epoc32\release\armv5\udeb\upnpsharingui.dll"-"!:\sys\bin\upnpsharingui.dll"
+"\epoc32\data\Z\resource\upnpsharingui.rsc"-"!:\resource\upnpsharingui.rsc"
+
+;UPnP Wizard
+"\epoc32\release\armv5\udeb\upnpappwizard.dll"-"!:\sys\bin\upnpappwizard.dll"
+"\epoc32\data\Z\resource\cupnpappwizard.rsc"-"!:\resource\cupnpappwizard.rsc"
+
+;UPnP content sharing server
+"\epoc32\release\armv5\udeb\upnpcontentserver.exe"-"!:\sys\bin\upnpcontentserver.exe"
+"\epoc32\release\armv5\udeb\upnpcontentserverclient.dll"-"!:\sys\bin\upnpcontentserverclient.dll"
+
+;DLNA Profiler
+"\epoc32\release\armv5\udeb\dlnaprofiler.dll"-"!:\sys\bin\dlnaprofiler.dll"
+
+;UPnP XML Parser
+"\epoc32\release\armv5\udeb\upnpxmlparser.dll"-"!:\sys\bin\upnpxmlparser.dll"
+
+;UPnP Playback plugins
+"\epoc32\release\armv5\udeb\upnpplaybackplugins.dll"-"!:\sys\bin\upnpplaybackplugins.dll"
+"\epoc32\data\Z\resource\plugins\upnpplaybackplugins.rsc"-"!:\resource\plugins\upnpplaybackplugins.rsc"
+
+; cenrtral repository
+;@"cenrep.sisx", (0x10202BE9)
+
+; End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/loc/upnpframework.loc	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,404 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for upnpframework subsystem.
+*
+*/
+
+
+// --------------------------------------------------------------------------
+// 
+// LOCALISATION STRINGS OF SERVICES PROVIDED FOR EXTERNAL APPLICATIONS
+// (UPnPAiwEngine, UPnPAiwProvider, UPnPCommand) 
+//
+// --------------------------------------------------------------------------
+
+//d:Application interworking (AIW) menu command.
+//d:Enables usage of external UPnP Media Rendering device.
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_iupnp_aiw_enable_external_string             "Show via home net."
+
+//d:Application interworking (AIW) menu command.
+//d:Disables usage of external UPnP Media Rendering device.
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_iupnp_aiw_disable_external_string            "Stop showing"
+
+//d:Application interworking (AIW) menu command.
+//d:Copies the selected files to an external UPnP Media Server device.
+//l:list_single_popup_submenu_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_aiw_copy_to_external_string            "Copy to home network"
+
+//d:Application interworking (AIW) menu command.
+//d:Moves the selected files to an external UPnP Media Server device.
+//l:list_single_popup_submenu_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_aiw_move_to_external_string            "Move to home network"
+
+//d:Connecting wait note.
+//d:Shown while waiting for connection to get established. 
+//l:popup_note_wait_window
+//r:wk49/2008
+//
+#define qtn_iupnp_command_connecting            "Connecting"
+
+//d:Preparing playback wait note.
+//d:Shown while waiting playback on remote device to start.
+//l:popup_note_wait_window
+//r:wk49/2008
+//
+#define qtn_iupnp_command_prep_playback         "Preparing playback"
+
+//d:Note shown when one file has been copied to 
+//d:remote server device.
+//l:popup_note_window/opt2
+//r:wk49/2008
+//
+#define qtn_iupnp_info_copy_ext_one             "1 file copied to %U"
+
+//d:Note shown when multiple files have been copied to 
+//d:remote server device. Shown also when no files have been
+//d:copied to remote server device. Happens when all files 
+//d:are drm protected.
+//l:popup_note_window/opt2
+//r:wk49/2008
+//
+#define qtn_iupnp_info_copy_ext_many            "%N files copied to %U"
+
+//d:Note shown when one file has been moved to 
+//d:remote server device. 
+//l:popup_note_window/opt2
+//r:wk49/2008
+//
+#define qtn_iupnp_info_move_ext_one             "1 file moved to %U"
+
+//d:Note shown when multiple files have been copied to 
+//d:remote server device. Shown also when no files have been
+//d:moved to remote server device. Happens when all files 
+//d:are drm protected.
+//l:popup_note_window/opt2
+//r:wk49/2008
+//
+#define qtn_iupnp_info_move_ext_many            "%N files moved to %U"
+
+
+// --------------------------------------------------------------------------
+// 
+// LOCALISATION STRINGS FOR SEARCHING SERVICES
+// (UPnPAdvFind, UPnPBrowseSearchUI)
+//
+// --------------------------------------------------------------------------
+
+//d:Media type selection title
+//l:list_setting_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_media_type               "Media type"
+
+//d:Media type selection list title
+//l:main_pane_set_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_media_type_title         "Media type"
+
+//d:media type selection item
+//d:when selected, images, video clips and music files are searched
+//l:list_set_graphic_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_mt_all                   "All"
+
+//d:media type selection item
+//d:when selected only images are searched
+//l:list_set_graphic_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_mt_image                 "Images"
+
+//d:media type selection item
+//d:when selected only videos are searched
+//l:list_set_graphic_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_mt_video                 "Video clips"
+
+//d:media type selection item
+//d:when selected only music files are searched
+//l:list_set_graphic_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_mt_music                 "Music files"
+
+//d:file name editor title
+//l:list_setting_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_find_file                "Title"
+
+//d:artist editor item title
+//l:list_setting_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_find_artist              "Artist"
+
+//d:album editor item title
+//l:list_setting_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_find_album               "Album name"
+
+//d:genre editor item title
+//l:list_setting_pane_t1
+//r:wk49/2008
+// 
+#define qtn_iupnp_find_genre               "Genre"
+
+//d:date from editor item title
+//l:list_setting_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_find_date_from           "Date from"
+
+//d:date until editor item title
+//l:list_setting_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_find_date_until          "Date until"
+
+//d:find results window title
+//l:title_pane_t2/opt9
+//r:wk49/2008
+//
+#define qtn_iupnp_search_results           "Find results"
+
+//d:wait note text when search is ongoing
+//l:popup_note_wait_window
+//r:wk49/2008
+//
+#define qtn_iupnp_finding_results_note     "Finding results"
+
+//d:text for navi pane. tells the user how many files were found
+//l:navi_text_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_nof_files                 "%N files"
+
+//d:text for navi pane. tells the user how many files were found
+//l:navi_text_pane_t1
+//r:wk49/2008
+//
+#define qtn_iupnp_nof_file                  "%N file"
+
+//d:result window error note text
+//d:error note is shown when too many result files are found
+//l:popup_note_window/opt1
+//r:wk49/2008
+//
+#define qtn_iupnp_too_big_cache_note_text   "Too many items, showing only %N"
+
+
+// --------------------------------------------------------------------------
+// 
+// LOCALISATION STRINGS FOR BROWSING AND RENDERING SERVICES
+// (UPnPCommonUI) 
+//
+// --------------------------------------------------------------------------
+
+//d:Command in options list in short term memories.
+//d:Show image or video on external device.
+//l:list_single_pane_t1_cp2/opt3
+//r:1.0
+//
+#define qtn_iupnp_show_ext_main                "Show"
+
+//d:Command in options list in short term memories.
+//d:Play music file on external device.
+//l:list_single_pane_t1_cp2/opt3
+//r:1.0
+//
+#define qtn_iupnp_play_ext_main                "Play"
+
+//d:Shows or plays an item on the handset
+//d:Item in qtn_iupnp_show_ext_main or qtn_iupnp_play_ext_main
+//l:list_single_popup_submenu_pane_t1
+//r:2.1
+//
+#define qtn_iupnp_on_device                    "On device"
+
+//d:Shows or plays an item via network - on a remote device
+//d:Item in qtn_iupnp_show_ext_main or qtn_iupnp_play_ext_main
+//l:list_single_popup_submenu_pane_t1
+//r:2.1
+//
+#define qtn_iupnp_via_homenet                  "Via home net"
+
+//d:External server dialog navi pane text when searching media servers
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_server_search_main           "Searching" 
+
+//d:External server dialog text if folder is empty
+//l:main_list_empty_pane
+//r:1.0
+//
+#define qtn_iupnp_main_empty                   "(empty)"
+
+//d:Find dialog / container view text if folder is empty
+//l:main_list_empty_pane
+//r:1.0
+//
+#define qtn_iupnp_no_files_found               "No files found"
+
+//d:Time format on navigation pane when playing video on remote device
+//l:navi_text_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_sep_slash                     "%0U/%1U"
+
+//d:Softkey command
+//d:Continue video display
+//l:control_pane_t1/opt7
+//r:1.0
+//
+#define qtn_iupnp_sk_continue                  "Continue"
+
+//d:Softkey command
+//d:Replay video display
+//l:control_pane_t1/opt7
+//r:1.0
+//
+#define qtn_iupnp_sk_replay                    "Replay"
+
+//d:Information note header for UPnP media renderer selection
+//l:heading_pane_t1/opt2
+//r:1.0
+//
+#define qtn_iupnp_select_player                "Select player:"
+
+//d:Information note header for UPnP device selection
+//l:heading_pane_t1/opt2
+//r:1.0
+//
+#define qtn_iupnp_select_device                "Select device:"
+
+//d:Title pane text
+//l:title_pane_t2/opt9
+//r:2.1
+//
+#define qtn_iupnp_title_ext_media_2            "Home Media"   
+
+//d:submenu title when copying file from external device to handset
+//l:list_single_pane_t1_cp2
+//r:2.1
+//
+#define qtn_iupnp_copy_main                     "Copy" 
+
+//d:Dialog title when image showing on a remote renderer is active
+//l:title_pane_t2/opt9
+//r:2.1
+//
+#define qtn_iupnp_title_showing                 "Showing"
+
+//d:Used to describe the result of copying one file
+//l:popup_note_window/opt2
+//r:2.1
+//
+#define qtn_iupnp_info_copy_one                 "1 file copied"
+
+//d:Used to describe the result of copying multiple files
+//l:popup_note_window/opt2
+//r:2.1
+//
+#define qtn_iupnp_info_copy_many                "%N files copied"
+
+//d:Used to describe when UPnP device does not support the operation 
+//d:or is not compatible with given media 
+//l:popup_note_window/opt2
+//r:2.1
+//
+#define qtn_iupnp_err_not_supported             "Selected device does not support this operation"
+
+//d:Wait note shown while content list is updating
+//l:popup_note_wait_window
+//r:wk50/2008
+//
+#define qtn_iupnp_wait_list_update              "Updating list"
+
+//d:Wait note running until the playback starts
+//l:popup_note_wait_window
+//r:2.1
+//
+#define qtn_iupnp_prog_prep_playback            "Preparing playback"
+
+//d:Used when user tries to copy an empty folder 
+//l:popup_note_window/opt2
+//r:2.1
+//
+#define qtn_iupnp_no_items_to_play_text         "Container does not contain any supported items"
+
+
+// --------------------------------------------------------------------------
+// 
+// COMMON LOCALISATION STRINGS
+// Strings are used by multiple components.
+//
+// --------------------------------------------------------------------------
+
+//d:Skipping DRM files note.
+//d:Indicates that DRM protected files will be skipped
+//d:during processing of files (show, play, copy, move).
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_iupnp_drm_file_text                 "Skipping DRM protected files."
+
+//d:Connection failed note
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_iupnp_err_con_failed                "Connection failed"
+
+//d:Used to describe media rendering fails due to unknown error 
+//l:popup_note_window
+//r:2.1
+//
+#define qtn_iupnp_err_rendering_failed_unknown  "Playback failed on the remote device for unknown error. Try again"
+
+//d:Used to describe when an UPnP operation failed on the remote device
+//l:popup_note_window/opt2
+//r:2.1
+//
+#define qtn_iupnp_err_general_failure           "Selected device refused the operation"
+
+//d:Used to describe when the connection is lost 
+//d:while the user is copying files
+//l:popup_note_window/opt2
+//r:2.1
+//
+#define qtn_iupnp_err_conn_lost_copy            "Connection lost, some files may not be copied"
+
+//d:Used to describe when the connection is lost 
+//d:while the user is moving files
+//l:popup_note_window/opt2
+//r:2.1
+//
+#define qtn_iupnp_err_conn_lost                 "Connection lost, some files may not be moved"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/rom/upnpframework.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  upnpframework subsystem ROM include file
+*
+*/
+
+#ifndef __UPNPFRAMEWORK_IBY__
+#define __UPNPFRAMEWORK_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // UPNP utilities
+    file=ABI_DIR\BUILD_DIR\upnputilities.dll \sys\bin\upnputilities.dll
+
+    
+    // UPNP (Home Media) Extension plugin interface
+    file=ABI_DIR\BUILD_DIR\upnpextensionpluginif.dll \sys\bin\upnpextensionpluginif.dll
+
+    // musicadapter
+    file=ABI_DIR\BUILD_DIR\upnpmusicadapter.dll \sys\bin\upnpmusicadapter.dll
+
+    // CommonUI
+    file=ABI_DIR\BUILD_DIR\upnpcommonui.dll \sys\bin\UPnPCommonUI.dll
+    data=DATAZ_\resource\apps\upnpcommonui.mif \resource\apps\upnpcommonui.mif
+
+    // UPnP AIW Engine
+    file=ABI_DIR\BUILD_DIR\upnpaiwengine.dll \sys\bin\upnpaiwengine.dll
+
+    // UPnP AIW Provider (AIW Provider)
+    ECOM_PLUGIN(upnpaiwprovider.dll,upnpaiwprovider.rsc)
+
+    // UPnP File Transfer Engine
+    file=ABI_DIR\BUILD_DIR\upnpfiletransferengine.dll \sys\bin\upnpfiletransferengine.dll
+
+    // UpnpCommand ECom plugin
+    ECOM_PLUGIN( upnpcommandplugin.dll, upnpcommandplugin.rsc )
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+    // UPnPCommand static linked library
+    file=ABI_DIR\BUILD_DIR\upnpcommand.dll \sys\bin\upnpcommand.dll
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag	
+
+    // The stub sis file
+    data=ZSYSTEM\install\upnpframework_stub.sis system\install\upnpframework_stub.sis
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __UPNPFRAMEWORK_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/rom/upnpframeworkresources.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  includes binaries for rombuild
+*
+*/
+
+#ifndef __UPNPFRAMEWORKRESOURCES_IBY__
+#define __UPNPFRAMEWORKRESOURCES_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // Common UI
+    data=DATAZ_\resource\UPnPCommonUI.rsc \resource\UPnPCommonUI.rsc
+
+    // AIW provider
+    data=DATAZ_\resource\UPnPAiwEngineResources.RSC \resource\UPnPAiwEngineResources.rsc
+    data=DATAZ_\resource\UPnPAiwMenuResources.rsc \resource\UPnPAiwMenuResources.rsc
+
+#endif // FF_UPNP_FRAMEWORK_2_0	
+
+    // UpnpCommand
+    data=DATAZ_\resource\upnpcommandresources.RSC \resource\upnpcommandresources.rsc
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // File transfer engine
+    data=DATAZ_\resource\UPnPFileTransferEngineResources.rsc \resource\UPnPFileTransferEngineResources.rsc
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __UPNPFRAMEWORKRESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/bwins/upnpaiwengineU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+EXPORTS
+	?CopyPlaylistToExternalL@CUPnPAiwEngine@@QAEXABVTDesC16@@AAV?$RPointerArray@VTDesC16@@@@@Z @ 1 NONAME ; void CUPnPAiwEngine::CopyPlaylistToExternalL(class TDesC16 const &, class RPointerArray<class TDesC16> &)
+	?CopyToExternalL@CUPnPAiwEngine@@QAEXAAV?$RPointerArray@VTDesC16@@@@@Z @ 2 NONAME ; void CUPnPAiwEngine::CopyToExternalL(class RPointerArray<class TDesC16> &)
+	?DisableExternal@CUPnPAiwEngine@@QAEXXZ @ 3 NONAME ; void CUPnPAiwEngine::DisableExternal(void)
+	?EnableExternalL@CUPnPAiwEngine@@QAEXXZ @ 4 NONAME ; void CUPnPAiwEngine::EnableExternalL(void)
+	?EngineState@CUPnPAiwEngine@@QAE?AW4TUPnPEngineState@@XZ @ 5 NONAME ; enum TUPnPEngineState CUPnPAiwEngine::EngineState(void)
+	?FilterDrmL@CUpnpDrmFilter@@QAEXXZ @ 6 NONAME ; void CUpnpDrmFilter::FilterDrmL(void)
+	?MoveToExternalL@CUPnPAiwEngine@@QAEXAAV?$RPointerArray@VTDesC16@@@@@Z @ 7 NONAME ; void CUPnPAiwEngine::MoveToExternalL(class RPointerArray<class TDesC16> &)
+	?NewL@CUPnPAiwEngine@@SAPAV1@XZ @ 8 NONAME ; class CUPnPAiwEngine * CUPnPAiwEngine::NewL(void)
+	?NewL@CUpnpDrmFilter@@SAPAV1@AAV?$RPointerArray@VTDesC16@@@@0@Z @ 9 NONAME ; class CUpnpDrmFilter * CUpnpDrmFilter::NewL(class RPointerArray<class TDesC16> &, class RPointerArray<class TDesC16> &)
+	?OpenExternalMediaL@CUPnPAiwEngine@@QAEXXZ @ 10 NONAME ; void CUPnPAiwEngine::OpenExternalMediaL(void)
+	?PlayL@CUPnPAiwEngine@@QAEXABVTDesC16@@@Z @ 11 NONAME ; void CUPnPAiwEngine::PlayL(class TDesC16 const &)
+	?ReleaseInstance@CUPnPAiwEngine@@SAXXZ @ 12 NONAME ; void CUPnPAiwEngine::ReleaseInstance(void)
+	?RemoveEngineObserver@CUPnPAiwEngine@@QAEXXZ @ 13 NONAME ; void CUPnPAiwEngine::RemoveEngineObserver(void)
+	?SetEngineObserver@CUPnPAiwEngine@@QAEXPAVMUPnPAiwEngineObserver@@@Z @ 14 NONAME ; void CUPnPAiwEngine::SetEngineObserver(class MUPnPAiwEngineObserver *)
+	?ShowConnectionErrorL@CUPnPAiwEngine@@QAEXXZ @ 15 NONAME ; void CUPnPAiwEngine::ShowConnectionErrorL(void)
+	?TimerCallback@CUPnPAiwEngine@@UAEXXZ @ 16 NONAME ; void CUPnPAiwEngine::TimerCallback(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/data/upnpaiwengineresources.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project UpnpAiwEngine
+*
+*/
+
+
+NAME UPAE
+
+// INCLUDES
+#include <avkon.rh>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <eikon.rh>
+#include <avkon.loc>            // For "Processing" wait note.
+#include <upnpframework.loc>
+
+// RESOURCE IDENTIFIERS
+
+RESOURCE RSS_SIGNATURE { }
+RESOURCE TBUF { buf=""; }
+
+// --------------------------------------------------------------------------
+// R_AIW_DRM_SKIP_INFO_NOTE
+// "Skipping DRM protected files." - note
+// Used to indicate that DRM protected files will be skipped.
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_aiw_drm_skip_info_note
+    {
+    flags = EAknInformationNoteFlags | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EGeneralLayout;
+                singular_label = qtn_iupnp_drm_file_text;
+                imageid = EMbmAvkonQgn_note_info;
+                imagemask = EMbmAvkonQgn_note_info_mask;
+                animation = R_QGN_NOTE_INFO_ANIM;
+                };
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+// R_AIW_ENABLE_SHARING_WAIT_NOTE
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_aiw_enable_sharing_wait_note
+    {
+    flags = EAknWaitNoteFlags | EEikDialogFlagWait;
+    buttons=R_AVKON_SOFTKEYS_CANCEL;
+    items=
+        {
+        DLG_LINE
+            {
+            type=EAknCtNote;
+            id=EGeneralNote;
+            control=AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                singular_label = qtn_iupnp_command_prep_playback;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// R_AIW_DRM_FILTERING_WAIT_NOTE
+// ---------------------------------------------------------------------------
+RESOURCE DIALOG r_aiw_drm_filtering_wait_note   
+    {   
+    flags = EAknWaitNoteFlags; 
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =   
+        {   
+        DLG_LINE   
+            {   
+            type = EAknCtNote;   
+            id = EGeneralNote;  
+            control = AVKON_NOTE   
+                {   
+                layout = EWaitLayout;
+                singular_label = qtn_gen_note_processing;
+                imageid = EMbmAvkonQgn_note_progress;   
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;   
+                };   
+            }   
+        };   
+    }  
+
+// --------------------------------------------------------------------------
+// r_aiw_info_copy_ext_one_text
+// Note shown when one file has been copied to extenal server device.
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_aiw_info_copy_ext_one_text
+    { 
+    buf = qtn_iupnp_info_copy_ext_one;
+    }
+
+// --------------------------------------------------------------------------
+// r_aiw_info_copy_ext_many_text
+// Note shown when many files have been copied to extenal server device.
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_aiw_info_copy_ext_many_text
+    { 
+    buf = qtn_iupnp_info_copy_ext_many;
+    }
+
+// --------------------------------------------------------------------------
+// r_aiw_info_move_ext_one_text
+// Note shown when one file has been moved to extenal server device.
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_aiw_info_move_ext_one_text
+    { 
+    buf = qtn_iupnp_info_move_ext_one;
+    }
+
+// --------------------------------------------------------------------------
+// r_aiw_info_move_ext_many_text
+// Note shown when many files have been copied to extenal server device.
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_aiw_info_move_ext_many_text
+    { 
+    buf = qtn_iupnp_info_move_ext_many;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/eabi/upnpaiwengineU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,24 @@
+EXPORTS
+	_ZN14CUPnPAiwEngine11EngineStateEv @ 1 NONAME
+	_ZN14CUPnPAiwEngine13TimerCallbackEv @ 2 NONAME
+	_ZN14CUPnPAiwEngine15CopyToExternalLER13RPointerArrayI7TDesC16E @ 3 NONAME
+	_ZN14CUPnPAiwEngine15DisableExternalEv @ 4 NONAME
+	_ZN14CUPnPAiwEngine15EnableExternalLEv @ 5 NONAME
+	_ZN14CUPnPAiwEngine15MoveToExternalLER13RPointerArrayI7TDesC16E @ 6 NONAME
+	_ZN14CUPnPAiwEngine15ReleaseInstanceEv @ 7 NONAME
+	_ZN14CUPnPAiwEngine17SetEngineObserverEP22MUPnPAiwEngineObserver @ 8 NONAME
+	_ZN14CUPnPAiwEngine18OpenExternalMediaLEv @ 9 NONAME
+	_ZN14CUPnPAiwEngine20RemoveEngineObserverEv @ 10 NONAME
+	_ZN14CUPnPAiwEngine20ShowConnectionErrorLEv @ 11 NONAME
+	_ZN14CUPnPAiwEngine23CopyPlaylistToExternalLERK7TDesC16R13RPointerArrayIS0_E @ 12 NONAME
+	_ZN14CUPnPAiwEngine4NewLEv @ 13 NONAME
+	_ZN14CUPnPAiwEngine5PlayLERK7TDesC16 @ 14 NONAME
+	_ZN14CUpnpDrmFilter10FilterDrmLEv @ 15 NONAME
+	_ZN14CUpnpDrmFilter4NewLER13RPointerArrayI7TDesC16ES3_ @ 16 NONAME
+	_ZTI13CUPnPAiwTimer @ 17 NONAME ; #<TI>#
+	_ZTI14CUPnPAiwEngine @ 18 NONAME ; #<TI>#
+	_ZTI14CUpnpDrmFilter @ 19 NONAME ; #<TI>#
+	_ZTV13CUPnPAiwTimer @ 20 NONAME ; #<VT>#
+	_ZTV14CUPnPAiwEngine @ 21 NONAME ; #<VT>#
+	_ZTV14CUpnpDrmFilter @ 22 NONAME ; #<VT>#
+	_ZThn8_N14CUPnPAiwEngine13TimerCallbackEv @ 23 NONAME ; #<thunk>#
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project UpnpAiwEngine
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// None
+
+PRJ_MMPFILES
+upnpaiwengine.mmp
+
+PRJ_TESTMMPFILES
+// None
+
+PRJ_TESTEXPORTS
+// None
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/group/upnpaiwengine.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project UpnpAiwEngine
+*
+*/
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+#include "../inc/upnpaiwengineuids.hrh"
+
+// Build target
+TARGET          upnpaiwengine.dll
+CAPABILITY      CAP_GENERAL_DLL
+TARGETTYPE      DLL
+UID             0x10009D8D KUPnPAiwEngineDllUid
+VENDORID        VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+SOURCEPATH      ../data
+START RESOURCE  upnpaiwengineresources.rss
+HEADER
+TARGET          upnpaiwengineresources.rsc
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../inc
+USERINCLUDE     ../data
+USERINCLUDE     ../../upnputilities/inc
+
+MW_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+SOURCEPATH      ../src
+SOURCE          upnpaiwtimer.cpp
+SOURCE          upnpaiwengine.cpp
+SOURCE          upnpdrmfilter.cpp
+
+// Core
+LIBRARY         euser.lib
+LIBRARY         bafl.lib
+LIBRARY         cone.lib
+LIBRARY         efsrv.lib 
+LIBRARY         charconv.lib            // For Unicode
+LIBRARY         CommonEngine.lib        // For StringLoader
+
+// UPnP
+LIBRARY         upnpavobjects.lib
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         upnpavcontrollerhelper.lib
+LIBRARY         upnpcommonui.lib
+LIBRARY         upnpipserversutils.lib
+LIBRARY         upnpfiletransferengine.lib
+
+// Dialogs
+LIBRARY         avkon.lib
+
+// UPnP Utilities
+LIBRARY         upnputilities.lib
+
+// DRM
+LIBRARY         drmcommon.lib
+
+// MIME 
+LIBRARY         apgrfx.lib
+LIBRARY         apmime.lib
+
+// commDB
+LIBRARY         commdb.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/inc/upnpaiwengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,583 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUPnPAiwEngine class.
+*
+*/
+
+
+#ifndef UPNP_AIW_ENGINE_H
+#define UPNP_AIW_ENGINE_H
+
+//  INCLUDES
+// System
+#include <e32base.h>
+#include <AknProgressDialog.h>
+
+// avcontroller api
+#include "upnpavrenderingsessionobserver.h"
+#include "upnpavdeviceobserver.h"
+#include "upnpitemresolverobserver.h"
+
+// upnpframework / internal api's
+#include "upnpcommonui.h"
+
+// aiwengine internal
+#include "upnpaiwengineobserver.h"
+#include "upnpaiwtimerobserver.h"
+
+
+// ENUMERATIONS
+enum TUPnPEngineState
+    {
+    EUPnPEngineNotConnected = 1,
+    EUPnPEngineConnectionLost,
+    EUPnPEngineConnected,
+    EUPnPEngineActive,
+    EUPnPEngineBrowsingHomeNetwork
+    };
+
+enum TUPnPAiwEngineDeviceType
+    {
+    EUPnPAiwEngineTargetDeviceWithAudioSupport = 1,
+    EUPnPAiwEngineTargetDeviceWithImageAndVideoSupport,
+    EUPnPAiwEngineTargetDeviceWithImageSupport
+    };
+
+enum TUPnPAiwEngineTransferMode
+    {
+    EAiwEngineCopy = 0,
+    EAiwEngineCopyPlaylist,
+    EAiwEngineMove
+    };    
+
+// FORWARD DECLARATIONS
+class CAknWaitDialog;
+class CUPnPAiwTimer;
+class MUPnPAVController;
+class MUPnPAVRenderingSession;
+class MUPnPAVSessionBase;
+
+// CLASS DECLARATION
+
+/**
+*  CUPnPAiwEngine
+*  The class works as an engine component between the UPnP AIW, UPnP Common 
+*  UI components and UPnPAVController components.
+*  @since S60 3.0
+*/
+class CUPnPAiwEngine : public CBase,
+                       public MUPnPAVRenderingSessionObserver,
+                       public MUPnPAiwTimerObserver,
+                       public MProgressDialogCallback,
+                       public MUPnPAVDeviceObserver,
+                       public MUPnPItemResolverObserver
+    {
+
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         */
+        IMPORT_C static CUPnPAiwEngine* NewL();
+
+        /**
+         * Releases the instance.
+         *
+         * @since S60 3.0
+         */
+        IMPORT_C static void ReleaseInstance();
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CUPnPAiwEngine();
+
+    public: // Methods from MUPnPAVDeviceObserver
+
+        // Unnecessary callback methods
+        void UPnPDeviceDiscovered( const CUpnpAVDevice& /*aDevice*/ ) {}
+        void UPnPDeviceDisappeared (const CUpnpAVDevice& /*aDevice*/ ) {}
+
+        /**
+         * Notifies that the WLAN connection has been lost. All sessions
+         * are now usable and must be closed.
+         *
+         * @since Series 60 3.1
+         * @return None
+         */ 
+        void WLANConnectionLost();
+        
+    public: // UPnP Aiw Engine call back
+
+        /**
+         * Sets the observer instance.
+         *
+         * @since S60 3.0
+         * @param aObserver (MUPnPAiwEngineObserver*) observer instance
+         */
+        IMPORT_C void SetEngineObserver( MUPnPAiwEngineObserver* aObserver );
+
+        /**
+         * Removes the observer instance.
+         *
+         * @since S60 3.0
+         */
+        IMPORT_C void RemoveEngineObserver();
+
+    public:
+
+        /**
+         * Returns the state of the UPnP AIW Engine.
+         *
+         * @since S60 3.0
+         * @return TUPnPEngineState State of the engine
+         */
+        IMPORT_C TUPnPEngineState EngineState();
+
+        /**
+         * Opens the External media UI.
+         *
+         * Leaves if the UpnpAiwEngine is already in use, if the
+         * UpnpAvController instantiation fails, or if the device selection/
+         * browse dialog leaves.
+         *
+         * @since S60 3.0
+         */
+        IMPORT_C void OpenExternalMediaL();
+
+        /**
+         * Enables the showing of local media files on a remote renderer 
+         * device.
+         *
+         * Leaves if the UpnpAiwEngine is already in use, if the
+         * UpnpAvController instantiation fails, or if the device selection
+         * dialog leaves.
+         *
+         * @since S60 3.0
+         */
+        IMPORT_C void EnableExternalL();
+
+        /**
+         * Disables the showing of local media files on remote renderer 
+         * device.
+         *
+         * @since S60 3.0
+         */
+        IMPORT_C void DisableExternal();
+
+        /**
+         * Copies local files to a remote media server.
+         *
+         * @since S60 3.0
+         * @param aFileNames (RPointerArray<TDesC>&) Reference to an array
+         *        of TDesC objects containing the list of file names. All 
+         *        files that are successfully copied are removed from the
+         *        list.
+         */
+        IMPORT_C void CopyToExternalL( RPointerArray<TDesC>& aFileNames );
+
+        /**
+         * Copies a local playlist to a remote media server.
+         *
+         * @since S60 3.0
+         * @param aFileNames (RPointerArray<TDesC>&) Reference to an array
+         *        of TDesC objects containing the list of file names. All
+         *        files that are successfully copied are removed from the 
+         *        list.
+         * @param aPlaylistName (const TDesC&) name of the playlist
+         */
+        IMPORT_C void CopyPlaylistToExternalL(
+                                    const TDesC& aPlaylistName,
+                                    RPointerArray<TDesC>& aFileNames );
+
+        /**
+         * Moves local files to a remote media server.
+         *
+         * @since S60 3.0
+         * @param aFileNames (RPointerArray<TDesC>&) Reference to an array
+         *        of TDesC objects containing the list of file names. All
+         *        files that are successfully moved removed from the list.
+         */
+        IMPORT_C void MoveToExternalL( RPointerArray<TDesC>& aFileNames );
+
+        /**
+         * Plays (sends for rendering) local media file using the selected
+         * UPnP Media renderer. Only image and video files are supported
+         * after Upnp Fw 2.0.
+         *
+         * Leaves if the given filename is not valid, file is not a media
+         * file, if the UpnpAiwEngine is not ready (enable external to done),
+         * or if the bearer or remote upnp device is lost.
+         *
+         * @since S60 3.0
+         * @param aFileName (const TDesC&) reference to the file name of
+         *        the media file.
+         */
+        IMPORT_C void PlayL( const TDesC& aFileName );
+
+        /**
+         * Displays connection error if creating of control point fails.
+         *
+         * @since S60 3.1
+         */
+        IMPORT_C void ShowConnectionErrorL();
+
+    public: // Methods to update the singleton reference counter
+
+        /**
+         * Sets the initial value of the user counter to zero.
+         *
+         * @since S60 3.0
+         */
+        void InitialiseUserCounter();
+
+        /**
+         * Increases the value of the user counter.
+         *
+         * @since S60 3.0
+         */
+        void IncreaseUserCounter();
+
+        /**
+         * Decreases the value of the user counter.
+         *
+         * @since S60 3.0
+         */
+        void DecreaseUserCounter();
+
+        /**
+         * Gets the value of the user counter.
+         *
+         * @since S60 3.0
+         * @return TInt
+         */
+        TInt UserCounter() const;
+
+        /**
+         * Displays connection lost error if copying files fails.
+         *
+         * @since S60 3.2.3
+         */
+        void ShowConnectionLostCopyErrorL();
+
+    private:
+
+        /**
+         * Transfers (copies/moves) local files/playlist to a remote media
+         * server.
+         *
+         * Leaves if the given parameters are not valid, if the UpnpAiwEngine
+         * is already in use, if user cancels the operation, or if the bearer
+         * or remote upnp device is lost.
+         *
+         * @since S60 3.0
+         * @param aMode (TUPnPAiwEngineTransferMode) transfer mode
+         * @param aFileNames (RPointerArray<TDesC>&) Reference to an array
+         *        of TDesC objects containing the list of file names. All
+         *        files that are successfully copied are removed from the
+         *        list.
+         * @param aPlaylistName (const TDesC&) name of the playlist
+         */
+        void TransferToExternalL( TUPnPAiwEngineTransferMode aMode,
+                                  RPointerArray<TDesC>& aFilePaths,
+                                  const TDesC& aPlaylistName );
+
+        /**
+         * Starts a rendering session with UpnpAvController. Queries the
+         * target rendering device.
+         *
+         * Leaves if any instantiation fails or used cancels the device
+         * selection.
+         *
+         * @since S60 3.0
+         * @param aDeviceType (TUPnPAiwEngineDeviceType) type of the device
+         */
+         void StartRenderingSessionL( TUPnPAiwEngineDeviceType aDeviceType );
+
+        /**
+         * Handles the UPnP device disappeared call back method.
+         *
+         * @since S60 3.0
+         * @param aDevice (const CUpnpAVDevice&) pointer to the device info
+         */
+        void HandleUPnPDeviceDisappearedL( const CUpnpAVDevice& aDevice );
+
+        /**
+         * Waits for local media server file sharing activation (or user 
+         * cancel).
+         *
+         * @since S60 3.1
+         * @param aSession (MUPnPAVSessionBase*) pointer to the AVController
+         *        session.
+         */
+        void StartLocalFileSharingL( MUPnPAVSessionBase *aSession );
+
+    public: // Call back methods of MUPnPAVRenderingSessionObserver
+
+        // Unused callback methods
+        void VolumeResult( TInt /*aError*/,
+                           TInt /*aVolumeLevel*/,
+                           TBool /*aActionResponse*/ ) {}
+        void MuteResult( TInt /*aError*/,
+                         TBool /*aMute*/,
+                         TBool /*aActionResponse*/ ) {}
+        void PositionInfoResult( TInt /*aError*/,
+                                 const TDesC8& /*aTrackPosition*/,
+                                 const TDesC8& /*aTrackLength*/ ) {}
+        void SetNextURIResult( TInt /*aError*/ ) {}
+
+        /**
+         * UPnP AV Controller calls this method to indicate that the requested
+         * interaction operation (play, stop, etc.) is complete. In other
+         * words, the target rendering device has changed it's state 
+         * accordingly.
+         *
+         * @since Series 60 3.1
+         * @param aError (TInt) error code
+         * @param aOperation (TAVInteractOperation) operation Id
+         */
+        void InteractOperationComplete( TInt aError,
+                                        TUPnPAVInteractOperation aOperation );
+
+        /**
+         * UPnP AV Controller calls this method as a response to SetUri
+         * action.
+         *
+         * @since Series 60 3.1
+         * @param aError (TInt) error code
+         */
+        void SetURIResult( TInt aError );
+
+        /**
+         * Notifies that the Media Renderer we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since Series 60 3.1
+         * @param aReason (TUPnPDeviceDisconnectedReason) reason code
+         */
+        void MediaRendererDisappeared(
+                            TUPnPDeviceDisconnectedReason aReason );
+
+    public: // Call back methods of MUPnPAVSessionObserverBase
+    
+         /**
+         * Notifies that the Media Server startup has completed. 
+         *
+         * @since Series 60 3.1
+         * @return aError (TInt) error code
+         */        
+        void ReserveLocalMSServicesCompleted( TInt aError );
+
+    public: // Call back methods of MAknProgressDialogCallback
+
+        /**
+         * ProgressDialog call back method.
+         * Get's called when a dialog is dismissed.
+         *
+         * @since S60 3.0
+         * @param aButtonId (TInt) ID of the button pressed
+         */
+        void DialogDismissedL( TInt aButtonId );
+
+    public: // Timer related methods
+
+        /**
+         * Starts the UPnPAiWTimer.
+         *
+         * @since S60 3.0
+         */
+        void StartTimer();
+
+        /**
+         * Stops the UPnPAiWTimer.
+         *
+         * @since S60 3.0
+         */
+        void StopTimer();
+
+        /**
+         * Callback method for the UPnPAiwTimer.
+         *
+         * @since S60 3.0
+         */
+        void TimerCallback();
+
+    private: // Helper methods
+
+        /**
+         * Method for selecting a device.
+         *
+         * Leaves if the engine is not ready (UpnpAvController not 
+         * instantiated), if the user cancels the operation, or if the bearer
+         * is lost during the device selection.
+         *
+         * @since S60 3.1
+         * @param aDeviceType (TUPnPDeviceTypesToSearch) type of device
+         * @param aDlgTitle title used in device selection dialog
+         * @return CUpnpAVDevice* selected upnp av device.
+         */
+        CUpnpAVDevice* SelectDeviceL( 
+                TUPnPDeviceTypesToSearch aDeviceType,
+                TUPnPDialogTitle aDlgTitle );
+        
+        /**
+         * Method for releasing upnp resource.
+         *
+         * @since S60 3.1
+         * @param none
+         * @return none
+         */
+        void ReleaseUpnpResourceL();
+        
+        /**
+         * Method for playing a local file
+         *
+         * @since S60 3.1
+         * @param none
+         * @return none
+         */
+        void InitPlayL();
+        
+        /**
+         * Method for playing a local video
+         *
+         * @since S60 3.1
+         * @param aFilePath file path
+         * @return none
+         */
+        void StartVideoPlayL( const TDesC& aFileName );
+        
+        /**
+         * Shows info note after the file transfer has been completed.
+         * 
+         * @since S60 5.1
+         * @param aMode Type of file transfer (copy or move)
+         * @param aCount Number of files copied to server
+         * @param aDevice Device files were copied to
+         * @return none
+         */
+        void ShowTransferInfoNoteL( 
+                TUPnPAiwEngineTransferMode aMode,
+                TInt aCount, 
+                const CUpnpAVDevice& aServerName ) const;
+
+        /**
+         * creates upnpitem using helper resolve local item
+         * 
+         * @since S60 5.1
+         * @param aFileName 
+         */
+        void CreateUpnpItemAndSetUriL( const TDesC& aFileName );
+        
+        /**
+         * Helper method to create MUPnPItemResolver.
+         * 
+         * @since S60 5.1
+         * @param aFilePath file path
+         * @return Pointer to resolver instance that is put to cleanupstack.
+         */
+        MUPnPItemResolver* CreateResolverLC( const TDesC& aFilePath );
+        
+        /**
+         * Static cleanup function for MUPnPItemResolver.
+         * Method makes sure that MUPnPItemResolver is properly cleaned up.
+         * 
+         * @since S60 5.1
+         * @param aResolver TAny pointer to CUPnPAiwEngine object.
+         */
+        static void CleanupResolver( TAny* aAiwEngine );
+
+        /**
+         * starts asynchronous CActiveSchedulerWait
+         */
+        void Wait();
+        
+        /**
+         * stops asynchronous CActiveSchedulerWait
+         */
+        void StopWait();
+        
+    private: // Construction methods
+
+        // Constructor
+        CUPnPAiwEngine();
+
+        /**
+         * ConstructL.
+         */
+        void ConstructL();
+        
+    private: // from MUPnPItemResolverObserver
+        
+        /**
+         * see MUPnPItemResolverObserver
+         */
+        void ResolveComplete( 
+                const MUPnPItemResolver& aResolver,
+                TInt aError );
+
+    private: // Data members
+
+        // State of the engine
+        TUPnPEngineState iEngineState;
+
+        // Reference to the AV Controller ECom plug-in
+        MUPnPAVController* iAVController;                   // owned
+
+        // Reference to the AIW Provider instance
+        MUPnPAiwEngineObserver* iObserver;                  // not owned
+
+        // File sharing activation wait note and related member vars
+        CAknWaitDialog* iFileSharingActivationWaitNote;     // owned;
+        TBool iLocalFileSharingActivated;
+        TInt iFileSharingError;
+
+        // CoeEnv and the resource offset (needed when loading and
+        // unloading resources)
+        CEikonEnv* iCoeEnv;                                 // not owned
+        TInt iResFileOffset;
+
+        // Wait note dialog
+        CAknWaitDialog* iWaitNoteDialog;                    // owned
+
+        // Timer
+        CUPnPAiwTimer* iUPnPAiwTimer;                       // owned
+
+        MUPnPAVRenderingSession* iRenderingSession;         // owned
+        
+        CUPnPCommonUI* iCommonUI;                            //owned 
+        HBufC16*       iFileName;               
+
+        TBool   iRenderingSessionInUse;
+        TBool   iVideoPlay;
+        TBool    iVideoPlayCancel;
+        TBool   iVideoPlayWait;
+    private: // Singleton data members
+
+         // Counter, which maintains the number of users of this singleton
+        TInt iNumberOfUsers;
+        
+        /**
+         * For async operations
+         */
+        CActiveSchedulerWait             iWait;
+        
+        MUPnPItemResolver*               iResolver;
+        
+        TInt                             iResolveResult;
+    };
+
+#endif // UPNP_AIW_ENGINE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/inc/upnpaiwengine.rh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project UpnpAiwEngine
+*
+*/
+
+
+#ifndef UPNP_AIW_ENGINE_RH
+#define UPNP_AIW_ENGINE_RH
+
+// --------------------------------------------------------------------------
+// Enumeration for identifying the UPnPAiwEngine resources.
+// --------------------------------------------------------------------------
+//
+enum TUPnPAiwProviderResources
+    {
+    EUPnPAiwFileTransferProgressNote = 1,
+    EUPnPAiwWaitingNote
+    };
+
+#endif // UPNP_AIW_ENGINE_RH
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/inc/upnpaiwengineobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This interface class defines the call back interface for the
+*                UpnpAiwEngine.
+*
+*/
+
+
+#ifndef UPNP_AIW_ENGINE_OBSERVER_H
+#define UPNP_AIW_ENGINE_OBSERVER_H
+
+/**
+* Defines the call back interface for the UPnP AIW Engine.
+*
+* @since S60 3.0
+*/
+class MUPnPAiwEngineObserver
+    {
+
+    public:
+
+        /**
+         * Indicates that the play operation is complete.
+         *
+         * @since S60 3.0
+         * @param aStatus Status information
+         */
+        virtual void PlayCompleteL( TInt aStatus ) = 0;
+
+        /**
+         * Indicates that the connection with the target UPnP
+         * device has been lost.
+         *
+         * @since S60 3.0
+         */
+        virtual void ConnectionLostL() = 0;
+
+    };
+
+#endif // UPNP_AIW_ENGINE_OBSERVER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/inc/upnpaiwengineuids.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project UpnpAiwEngine
+*
+*/
+
+
+#ifndef UPNP_AIW_ENGINE_UIDS_HRH
+#define UPNP_AIW_ENGINE_UIDS_HRH
+
+#define KUPnPAiwEngineDllUid                   0x10208A4D
+
+#endif // UPNP_AIW_ENGINE_UIDS_HRH
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/inc/upnpaiwtimer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUPnPAIWTimer class.
+*
+*/
+
+
+#ifndef UPNP_AIW_TIMER_H
+#define UPNP_AIW_TIMER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32cons.h>
+#include <coecntrl.h>
+#include <AknUtils.h>
+#include "upnpaiwtimerobserver.h"
+
+// CLASS DECLARATION
+
+/**
+* CUPnPAiWTimer class.
+*/
+class CUPnPAiwTimer : public CBase,
+                      public MBeating
+    {
+
+    public:
+
+        /**
+         * Static NewL method to construct the timer.
+         *
+         * @since S60 3.0
+         * @param aInterval (TInt) Timer interval in seconds
+         * @param aCallback (MUPnPAiwTimerObserver*) call back reference 
+         * @return CUPnPAVTimer* timer instance
+         */
+        static CUPnPAiwTimer* NewL( TInt aInterval,
+                                    MUPnPAiwTimerObserver* aCallback );
+
+        // Destructor
+        virtual ~CUPnPAiwTimer();
+
+    private:
+
+        /**
+         * ConstructL.
+         *
+         * @since S60 3.0
+         * @param aInterval (TInt) Timer interval in seconds
+         * @param aCallback (MUPnPAiwTimerObserver*) call back reference 
+        */
+        void ConstructL( TInt aInterval,
+                         MUPnPAiwTimerObserver* aCallback );
+
+        /**
+         * Constructor.
+         *
+         * @since S60 3.0
+        */
+        CUPnPAiwTimer();
+
+    private: // for MBeating
+
+        /**
+         * Called when the beat is in sync.
+         *
+         * @since S60 3.0
+         */
+        void Beat();
+
+        /**
+         * Called when the beat needs to be syncronized.
+         *
+         * @since S60 3.0
+         */
+        void Synchronize();
+
+    private: // Data members
+
+        // Heartbeat active object
+        CHeartbeat* iHeartbeat;                     // owned
+
+        // Call back pointer
+        MUPnPAiwTimerObserver *iCallback;           // not owned
+
+        // Interval in seconds
+        TInt iInterval;
+
+        // Heartbeat counter
+        TInt iCounter;
+
+    };
+
+#endif // UPNP_AIW_TIMER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/inc/upnpaiwtimerobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This interface class defines the call back interface for the
+*                UPnPAiwEngineTimer.
+*
+*/
+
+
+#ifndef UPNP_AIW_TIMER_OBSERVER_H
+#define UPNP_AIW_TIMER_OBSERVER_H
+
+/**
+* Defines the call back interface for the timer of the UPnP Aiw Engine.
+*
+* @since S60 3.0
+*/
+class MUPnPAiwTimerObserver
+    {
+
+    public:
+
+        /**
+         * Callback method for the UPnPAiWTimer.
+         *
+         * @since S60 3.0
+         */
+        virtual void TimerCallback() = 0;
+
+    };
+
+#endif // UPNP_AIW_TIMER_OBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/inc/upnpdrmfilter.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpDrmFilter class.
+*
+*/
+
+
+#ifndef C_UPNPDRMFILTER_H
+#define C_UPNPDRMFILTER_H
+
+#include <e32base.h>
+#include <badesca.h>
+#include <e32cmn.h>
+#include <AknWaitNoteWrapper.h> 
+
+
+/**
+ *  Class for filtering Drm files out from a list of files. 
+ *  @since S60 3.2
+ *  @lib upnpaiwengine.dll
+ */
+class CUpnpDrmFilter  : public CActive,
+                        public MAknBackgroundProcess
+    {
+    
+public:
+
+    /** state for filtering DRM */
+    enum TDrmFilterState
+        {
+        EIdle = 1,
+        EFilter,
+        EFilterComplete,
+        EFilterStop
+        };
+     
+    /**
+     * Two-Phased Constructor
+     * @param aFiles (RPointerArray<TDesC>&) Reference to an array of
+     *        TDesC objects containing the list of file names. 
+     * @param aDRMProtectedFiles (RPointerArray<TDesC>&) Reference to an
+     *        empty array of TDesC objects, the method will append DRM
+     *        protected files on this list.
+     * @return new instance of CUpnpDrmFilter
+     */
+    IMPORT_C static CUpnpDrmFilter* NewL( RPointerArray<TDesC>& aFiles,
+            RPointerArray<TDesC>& aDRMProtectedFiles );
+
+    /**
+     * Constructor
+     * @param aFiles (RPointerArray<TDesC>&) Reference to an array of
+     *        TDesC objects containing the list of file names. 
+     * @param aDRMProtectedFiles (RPointerArray<TDesC>&) Reference to an
+     *        empty array of TDesC objects, the method will append DRM
+     *        protected files on this list.
+     */
+     CUpnpDrmFilter( RPointerArray<TDesC>& aFiles,
+                     RPointerArray<TDesC>& aDRMProtectedFiles );
+    /**
+     * Virtual Destructor
+     */
+    virtual ~CUpnpDrmFilter();
+    
+    /**
+     * Start filter music files.
+     */
+    IMPORT_C void FilterDrmL();
+        
+private:
+      
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+
+    /** 
+     * Filter 20 files every time 
+     */
+    void Filter();
+    
+    /**
+     *  From CActive
+     *  Handles an active object's request completion event.
+     */
+    void RunL();
+    
+    /**
+     *  From CActive
+     *  Handles an active error.
+     */    
+    void RunError();
+
+    /**
+     * From CActive
+     * Implements cancellation of an outstanding request.
+     */
+   void DoCancel();
+
+    /**
+     * Performs incremental filter operation.
+     */
+    void DoTaskStep();
+
+    /**
+     * End filter operation.
+     */
+    void Complete();    
+
+    /**
+     * Completes one cycle of the process.
+     * From MProgressDialogCallback.
+     */
+    void StepL(); 
+
+    /**
+     * Return true when the process is done. 
+     * From MProgressDialogCallback.
+     */
+    TBool IsProcessDone() const;    
+ 
+    /**
+     * Show the wait note when filtering files.
+     */
+    void ShowWaitNoteL();
+     
+
+private: // data 
+
+    /**
+     * Reference to an array of TDesC objects containing 
+     * the list of file names.
+     */
+    RPointerArray<TDesC>&     iFiles;               //Not own
+    
+   /**
+    * Reference to an empty array of TDesC objects used to append DRM
+    * protected files on this list.
+    */
+    RPointerArray<TDesC>&     iDRMProtectedFiles;   //Not own   
+
+    
+    /**
+     * The state of current operation.
+     */
+    TDrmFilterState           iState;
+    
+    /**
+     * The next start point to filter DRM file from iFiles array
+     */
+    TInt                      iStartPoint; 
+    
+    /**
+     * The latest point has been filter 
+     */
+    TInt                      iCurrentPoint;
+
+    /**
+     * The total number of file need to filter.
+     */
+    TInt                      iTotalNum; 
+    
+    /**
+     * Used to append the DRM file index in iFile array.
+     */
+    RArray<TInt>              iRemovedIndexArray;  
+    
+    /**
+     * The total number of filtered files.
+     */
+    TInt                      iFilteredCount;
+    
+    /**
+     * The total number of abnormal files except DRM files.
+     */
+    TInt                      iAbnormalFileCount;
+    
+    };
+
+#endif // C_UPNPDRMFILTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/src/upnpaiwengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1709 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the class CUPnPAiwEngine.
+ *
+*/
+
+
+// INCLUDE FILES
+// System
+#include <bautils.h>
+#include <AknWaitDialog.h>
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+#include <utf.h>
+
+// Upnp stack
+#include <upnpitem.h>
+
+// avcontroller api
+#include "upnpavcontroller.h"
+#include "upnpavcontrollerfactory.h"
+#include "upnpavrenderingsession.h"
+#include "upnpavsessionbase.h"
+#include "upnpavdevice.h"
+
+// avcontroller / avcontroller helper api
+#include "upnpitemresolver.h"
+#include "upnpitemresolverfactory.h"
+#include "upnpitemutility.h"
+#include "upnpresourceselector.h"
+
+// upnpframework internal api's
+#include "upnpfiletransferengine.h"     // Upnp Fw / UpnpFileTransferEngine
+#include "upnpcommonutils.h"            // Upnp Fw / UpnpUtilities
+
+// aiw engine internal
+#include <upnpaiwengineresources.rsg>   // Upnp Fw / UpnpAiwEngine
+#include "upnpaiwengine.h"                // Upnp Fw / UpnpAiwEngine
+#include "upnpaiwtimer.h"               // Upnp Fw / UpnpAiwEngine
+
+// logging
+_LIT( KComponentLogfile, "upnpaiwengine.log" );
+#include "upnplog.h"
+
+const TInt KSlash = 92;
+const TInt KDot = 46;
+
+// CONSTANTS
+_LIT( KResFileName, "\\resource\\upnpaiwengineresources.rsc" );
+const TInt KAiwTimerIntervalInSeconds = 1;
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::NewL
+// NewL.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPAiwEngine* CUPnPAiwEngine::NewL()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::NewL" );
+
+    CUPnPAiwEngine* self = NULL;
+
+    // If this is the first time we are getting the instance of this
+    // singleton class, create the instance and store it into the
+    // Thread Local Storage
+    if( !Dll::Tls() )
+        {
+        self = new (ELeave) CUPnPAiwEngine;
+
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        CleanupStack::Pop( self );
+
+        TInt err = Dll::SetTls( static_cast<TAny*>( self ) );
+        if( err != KErrNone )
+            {
+            delete self;
+            self = NULL;
+            }
+        else
+            {
+            // Initialise the user counter to zero
+            self->InitialiseUserCounter();
+            }
+        }
+    else
+        {
+        self = static_cast<CUPnPAiwEngine*>( Dll::Tls() );
+        }
+
+    // Increase number of users by one
+    self->IncreaseUserCounter();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::ReleaseInstance
+// Releases the instance.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::ReleaseInstance()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ReleaseInstance" );
+
+    CUPnPAiwEngine* instance = NULL;
+
+    // Get the instance from the TLS if there is an instance
+    if( Dll::Tls() )
+        {
+        instance = static_cast<CUPnPAiwEngine*>( Dll::Tls() );
+        }
+
+    // If there still were an instance in the TLS
+    if( instance )
+        {
+
+        // Decrease the number of instance
+        instance->DecreaseUserCounter();
+
+        // If the instance count is now 0, empty the TLS
+        if( instance->UserCounter() <= 0 )
+            {
+            // Empty the TLS
+            TInt err = Dll::SetTls( NULL );
+            if( err )
+                {
+                // ignore
+                }
+
+            // Delete the instance
+            delete instance;
+            instance = NULL;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUPnPAiwEngine::CUPnPAiwEngine()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CUPnPAiwEngine" );
+
+    iRenderingSessionInUse = EFalse;
+    iVideoPlay = EFalse;
+    iFileName = NULL;
+    iVideoPlayCancel = EFalse;
+    iVideoPlayWait = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPAiwEngine::~CUPnPAiwEngine()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::~CUPnPAiwEngine" );
+    // Delete resolvers
+    // Delete for resolvers is done using temporary variables so that we can
+    // first nullify the members and then delete the actual objects.
+    // This is because local resolver deletion uses active scheduler loops
+    // and therefore other asynchronous events may orrur. So we may end
+    // up here in Cleanup again, during the resolver is being deleted.
+    // if deletion is done the conventional way, the objects get deleted
+    // twice, which is not what we want. :-)
+    MUPnPItemResolver* tempResolver = iResolver;
+    iResolver = NULL;
+    delete tempResolver;
+    StopTimer();
+
+    // If wait note is shown, finish it
+    if (iWaitNoteDialog)
+        {
+        TRAP_IGNORE( iWaitNoteDialog->ProcessFinishedL() );
+        }
+
+    if (iRenderingSession && iAVController)
+        {
+        TRAP_IGNORE( iAVController->StopRenderingSession(
+                        *iRenderingSession ) );
+        iRenderingSession = NULL;
+        }
+
+    delete iCommonUI;
+
+    // Delete the UPnP AV Controller
+    delete iAVController;
+    delete iFileName;
+
+    // Un-load resource file
+    if (iResFileOffset)
+        {
+        CEikonEnv::Static()->DeleteResourceFile(iResFileOffset);
+        iResFileOffset = 0;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::ConstructL()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ConstructL" );
+
+    iCoeEnv = CEikonEnv::Static();
+    RFs& fileSession = iCoeEnv->FsSession();
+
+    // Load resource file
+    TFileName rscFileName(KResFileName);
+    TFileName dllName;
+    Dll::FileName(dllName);
+    TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive);
+
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile(fileSession, rscFileName);
+
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists(fileSession, rscFileName) )
+        {
+        __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, resource file does not \
+exist!" );
+        User::Leave(KErrNotFound);
+        }
+
+    if (iCoeEnv)
+        {
+        // Read the resource file offset
+        iResFileOffset = iCoeEnv->AddResourceFileL(rscFileName);
+        }
+
+    // Set initial state of the connection to the UPnPAVController
+    iCommonUI = CUPnPCommonUI::NewL();
+    iAVController = NULL;
+    iRenderingSession = NULL;
+    iEngineState = EUPnPEngineNotConnected;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::SetEngineObserver
+// Sets the observer instance.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::SetEngineObserver(
+        MUPnPAiwEngineObserver* aObserver )
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::SetEngineObserver" );
+
+    if( aObserver )
+        {
+        iObserver = aObserver;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::RemoveEngineObserver
+// Sets the observer instance.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::RemoveEngineObserver()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::RemoveEngineObserver" );
+
+    iObserver = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::EngineState
+// Gets the state of the UPnP AIW Engine.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TUPnPEngineState CUPnPAiwEngine::EngineState()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::EngineState" );
+
+    return iEngineState;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::OpenExternalMediaL
+// Opens the External media UI.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::OpenExternalMediaL()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::OpenExternalMediaL" );
+
+    TInt status = KErrNone;
+
+    if( !iAVController &&
+            iEngineState == EUPnPEngineNotConnected )
+        {
+        TRAP( status,
+                iAVController =
+                UPnPAVControllerFactory::NewUPnPAVControllerL() );
+
+        if( status == KErrNone &&
+                iAVController )
+            {
+            // Update engine state
+            iEngineState = EUPnPEngineBrowsingHomeNetwork;
+            TInt leaveCode = KErrNone;
+
+            TRAP( leaveCode,
+                    status = iCommonUI->ExecuteDeviceDialogL( *iAVController ) );
+
+            // Handle status and leave codes
+            if( leaveCode != KErrNone &&
+                    status == KErrNone )
+                {
+                status = leaveCode;
+                }
+
+            // Clean up and return the engine state
+            delete iAVController;
+            iAVController = NULL;
+            iEngineState = EUPnPEngineNotConnected;
+            }
+        else // If the instantiation of UpnpAvController fails
+
+            {
+            TRAP_IGNORE( ShowConnectionErrorL() );
+            status = KErrCouldNotConnect;
+            }
+        }
+    else // If the UpnpAvController is already instantiated
+
+        {
+        status = KErrInUse;
+        }
+
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::EnableExternalL
+// Enables the showing of local media files on a remote renderer device.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::EnableExternalL()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::EnableExternalL" );
+
+    TInt status = KErrNone;
+
+    if( !iAVController &&
+            iEngineState == EUPnPEngineNotConnected )
+        {
+        TRAP( status,
+                iAVController =
+                UPnPAVControllerFactory::NewUPnPAVControllerL() );
+
+        if( status == KErrNone &&
+                iAVController )
+            {
+            iAVController->SetDeviceObserver( *this );
+            TRAP( status, StartRenderingSessionL(
+                            EUPnPAiwEngineTargetDeviceWithImageSupport ) );
+
+            // If the rendering session was created successfully
+            if( status == KErrNone &&
+                    iRenderingSession )
+                {
+                // Start local file sharing
+                TRAP( status,
+                        StartLocalFileSharingL( iRenderingSession ) );
+                    {
+                    // If the file sharing failed to start, undo the enable
+                    // external by calling disable external.
+                    if( status != KErrNone )
+                        {
+                        DisableExternal();
+                        }
+                    }
+                }
+            else
+                {
+                delete iAVController;
+                iAVController = NULL;
+                iEngineState = EUPnPEngineNotConnected;
+                }
+            }
+        else // If the instantiation of UpnpAvController fails
+
+            {
+            TRAP_IGNORE( ShowConnectionErrorL() );
+            status = KErrCouldNotConnect;
+            }
+        }
+    else
+        {
+        status = KErrInUse;
+        }
+
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::DisableExternal
+// Disables the showing of local media files on a remote renderer device.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::DisableExternal()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::DisableExternal" );
+
+    if( iAVController )
+        {
+        if( iRenderingSession )
+            {
+            // If STOP action is required, use the timer to delay the
+            // destruction (give some time for AvController to send the STOP
+            // action message)
+            if( iEngineState == EUPnPEngineActive )
+                {
+                TRAP_IGNORE( iRenderingSession->StopL() );
+                StartTimer();
+                }
+            else
+                {
+                // Stop local file sharing
+                TRAP_IGNORE( iRenderingSession->ReleaseLocalMSServicesL() );
+
+                // Stop the rendering session
+                TRAP_IGNORE( iAVController->StopRenderingSession(
+                                *iRenderingSession ) );
+                iRenderingSession = NULL;
+                }
+            }
+
+        // Delete the UPnP AV Controller
+        delete iAVController;
+        iAVController = NULL;
+        }
+
+    // Update engine state
+    iRenderingSessionInUse = EFalse;
+    iEngineState = EUPnPEngineNotConnected;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::PlayL
+// Plays (sends for rendering) local media file using the selected
+// UPnP Media renderer.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::PlayL( const TDesC& aFileName )
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::PlayL" );
+
+    TInt status = KErrNone;
+
+    if( aFileName != KNullDesC )
+        {
+
+        if( iAVController &&
+                iRenderingSession &&
+                ( iEngineState == EUPnPEngineConnected ||
+                        iEngineState == EUPnPEngineActive ) )
+            {
+
+            // Check the file type
+            TUPnPItemType fileType = ETypeOther;
+            TRAPD( mimeError,
+                    fileType = UPnPCommonUtils::ResolveFileTypeL(
+                            aFileName ) );
+            if( mimeError == KErrNone )
+                {
+                if( fileType == ETypeAudio )
+                    {
+                    status = KErrNotSupported;
+                    if( iObserver )
+                        {
+                        iObserver->PlayCompleteL( status );
+                        }
+                    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \
+audio files not supported!" );
+                    }
+                else if ( fileType == ETypeVideo )
+                    {
+                    if( iRenderingSessionInUse )
+                        {
+                        //if the previous operation not finished
+                        delete iFileName; iFileName = NULL;
+                        iFileName = aFileName.AllocL();
+                        iVideoPlayWait = ETrue;
+                        }
+                    else
+                        {
+                        TRAP( status, StartVideoPlayL( aFileName ) );
+                        }
+                    }
+                else if ( fileType == ETypeImage )
+                    {
+                    if( !iVideoPlay ) //if no video is being played
+
+                        {
+                        if( iRenderingSessionInUse )
+                            {
+                            //if the previous operation not finished
+                            iVideoPlayWait = EFalse;
+                            __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \
+iRenderingSessionInUse: ETrue" );
+                            delete iFileName;
+                            iFileName = NULL;
+                            iFileName = aFileName.AllocL();
+                            }
+                        else
+                            {
+                            __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \
+iRenderingSessionInUse: EFalse" );
+                            TRAP( status , CreateUpnpItemAndSetUriL( aFileName ) );
+                            if( KErrNone == status )
+                                {
+                                iRenderingSessionInUse = ETrue;
+                                }
+                            else
+                                {
+                                // Failed, notify MG, the image playing is
+                                // complete
+                                if( iObserver )
+                                    {
+                                    iObserver->PlayCompleteL( status );
+                                    }
+                                }
+                            }
+                        }
+                    else
+                        {
+                        //notify MG, the music playing is complete
+                        if( iObserver )
+                            {
+                            iObserver->PlayCompleteL( status );
+                            }
+                        }
+
+                    }
+                else // Unsupported file
+
+                    {
+                    status = KErrNotSupported;
+                    }
+                }
+            else // Failed to resolve MIME type
+
+                {
+                status = KErrArgument;
+                }
+            }
+        else // Rendering session not available (Enable External not done)
+
+            {
+            status = KErrNotReady;
+            }
+        }
+    else
+        {
+        status = KErrArgument;
+        }
+
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::CopyToExternalL
+// Copies local files to a remote media server.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::CopyToExternalL(
+        RPointerArray<TDesC>& aFileNames )
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CopyToExternalL" );
+
+    // Check parameters
+    if( aFileNames.Count() <= 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Check engine state
+    if( iAVController )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Create UPnPAVController
+    TRAPD( avControllerError,
+            iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL() );
+    if( avControllerError != KErrNone )
+        {
+        TRAP_IGNORE( ShowConnectionErrorL() );
+        User::Leave( KErrCouldNotConnect );
+        }
+
+    // Update engine state
+    iEngineState = EUPnPEngineConnected;
+
+    // Do the transfer
+    TRAPD( transferError,
+            TransferToExternalL( EAiwEngineCopy, aFileNames, KNullDesC ) );
+
+    // Clean up
+    delete iAVController;
+    iAVController = NULL;
+
+    // Update engine state
+    iEngineState = EUPnPEngineNotConnected;
+
+    if( transferError != KErrNone )
+        {
+        User::Leave( transferError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::CopyToExternalL
+// Copies local files to a remote media server.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::CopyPlaylistToExternalL(
+        const TDesC& aPlaylistName,
+        RPointerArray<TDesC>& aFileNames )
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CopyPlaylistToExternalL" );
+
+    // Check parameters
+    if( aFileNames.Count() <= 0 ||
+            aPlaylistName == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Check engine state
+    if( iAVController )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Create UPnPAVController
+    TRAPD( avControllerError,
+            iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL() );
+    if( avControllerError != KErrNone )
+        {
+        TRAP_IGNORE( ShowConnectionErrorL() );
+        User::Leave( KErrCouldNotConnect );
+        }
+
+    // Update engine state
+    iEngineState = EUPnPEngineConnected;
+
+    // Do the transfer
+    TRAPD( transferError,
+            TransferToExternalL( EAiwEngineCopyPlaylist,
+                    aFileNames,
+                    aPlaylistName ) );
+
+    // Clean up
+    delete iAVController;
+    iAVController = NULL;
+
+    // Update engine state
+    iEngineState = EUPnPEngineNotConnected;
+
+    if( transferError != KErrNone )
+        {
+        User::Leave( transferError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::MoveToExternalL
+// Moves local files to a remote media server.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::MoveToExternalL(
+        RPointerArray<TDesC>& aFileNames )
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::MoveToExternalL" );
+
+    // Check parameters
+    if( aFileNames.Count() <= 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Check engine state
+    if( iAVController )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Create UPnPAVController
+    TRAPD( avControllerError,
+            iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL() );
+    if( avControllerError != KErrNone )
+        {
+        TRAP_IGNORE( ShowConnectionErrorL() );
+        User::Leave( KErrCouldNotConnect );
+        }
+
+    // Update engine state
+    iEngineState = EUPnPEngineConnected;
+
+    // Do the transfer
+    TRAPD( transferError,
+            TransferToExternalL( EAiwEngineMove, aFileNames, KNullDesC ) );
+
+    // Clean up
+    delete iAVController;
+    iAVController = NULL;
+
+    // Update engine state
+    iEngineState = EUPnPEngineNotConnected;
+
+    if( transferError != KErrNone )
+        {
+        User::Leave( transferError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::TransferToExternalL
+// Transfers (copies/moves) local files/playlists to a remote media server.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::TransferToExternalL(TUPnPAiwEngineTransferMode aMode,
+        RPointerArray<TDesC>& aFilePaths, const TDesC& aPlaylistName)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::TransferToExternalL" );
+
+    // Parameters were already checked
+
+    // Select the target server device
+    // Title should be according to ui spec.
+    TUPnPDialogTitle title = EUPnPCopyToTitle;
+    if (aMode == EAiwEngineMove)
+        {
+        title = EUPnPMoveToTitle;
+        }
+    CUpnpAVDevice* targetDevice = SelectDeviceL(
+            EUPnPSearchServerDevicesWithCopyCapability, title);
+
+    CleanupStack::PushL(targetDevice);
+
+    // Create a browsing session
+    TInt status = KErrNone;
+    MUPnPAVBrowsingSession* browsingSession= NULL;
+    TRAP( status, browsingSession =
+            &iAVController->StartBrowsingSessionL( *targetDevice ) );
+
+    if (status == KErrNone && browsingSession)
+        {
+        // Create a file transfer engine instance
+        CUpnpFileTransferEngine* ftEngine= NULL;
+        TRAP( status, 
+                ftEngine = CUpnpFileTransferEngine::NewL( browsingSession ) );
+        if ( status == KErrNone && ftEngine )
+            {
+            CleanupStack::PushL( ftEngine );
+
+            // Update engine state
+            iEngineState = EUPnPEngineActive;
+            
+            // Number of files in the array.
+            TInt count = aFilePaths.Count();
+
+            // Do the copy/move
+            if ( aMode == EAiwEngineMove )
+                {
+                TRAP( status, ftEngine->MoveLocalFilesToRemoteServerL(
+                                &aFilePaths ) );
+                }
+            else if ( aMode == EAiwEngineCopyPlaylist)
+                {
+                TRAP( status, ftEngine->CopyLocalPlaylistToRemoteServerL(
+                                aPlaylistName,
+                                &aFilePaths ) );
+                }
+            else
+                {
+                TRAP( status, ftEngine->CopyLocalFilesToRemoteServerL(
+                                &aFilePaths ) );
+                }
+        
+            // Clean up
+            // aFilePaths is not updates until ftEngine is deleted!
+            CleanupStack::PopAndDestroy( ftEngine );
+            ftEngine = NULL;
+            
+            // Update engine state
+            if ( status == KErrNone )
+                {
+                iEngineState = EUPnPEngineConnected;
+
+                // Shows proper info note.
+                //
+                // Calculate number of transferred files based on original 
+                // file count and items remaining in aFilePaths 
+                // (those were NOT transferred)
+                ShowTransferInfoNoteL( 
+                        aMode, 
+                        count - aFilePaths.Count(), 
+                        *targetDevice );
+                }
+            else if (KErrSessionClosed == status || KErrCouldNotConnect == status 
+			           || KErrDisconnected == status )
+                {
+                iEngineState = EUPnPEngineConnectionLost;
+                if ( aMode != EAiwEngineMove )
+                    {
+                    ShowConnectionLostCopyErrorL();
+                    }
+                else
+                    {
+                    ShowConnectionErrorL();
+                    }
+                }
+            else if ( KErrNotFound == status )
+                {
+                 ShowTransferInfoNoteL (
+                                       aMode,
+                                       0,
+                                       *targetDevice );
+                }
+            else
+                {
+                iEngineState = EUPnPEngineConnected;
+                }
+            }
+
+        // Stop browsing session
+        iAVController->StopBrowsingSession( *browsingSession );
+        }
+
+    // Clean up
+    CleanupStack::PopAndDestroy( targetDevice );
+    targetDevice = NULL;
+
+    // Get the titles (of the files that failed to be transfered) from
+    // the item array and store them in the file name array. 
+    TChar slash( KSlash );
+    TChar dot( KDot );
+    TInt fileCount = aFilePaths.Count();
+    RPointerArray<TDesC16> fileTitles;
+    for ( TInt index = 0; index < fileCount; index++ )
+        {
+        TInt offset1 = aFilePaths[index]->LocateReverse( slash );
+        TInt offset2 = aFilePaths[index]->LocateReverse( dot );
+
+        HBufC16* fileTitle= NULL;
+
+        if ( KErrNotFound != offset1 && KErrNotFound != offset2 && 
+             offset2 > ( offset1 + 1 ) )
+            {
+
+            fileTitle = aFilePaths[index]->
+            Mid( ( offset1 + 1 ), ( offset2 - offset1 - 1 ) ).Alloc();
+
+            }
+        if (fileTitle)
+            {
+            fileTitles.Append(fileTitle);
+            }
+        }
+    aFilePaths.ResetAndDestroy();
+    for (TInt index = 0; index < fileTitles.Count(); index++)
+        {
+        aFilePaths.Append(fileTitles[index]);
+        }
+
+    fileTitles.Reset();
+    fileTitles.Close();
+
+    if (status != KErrNone)
+        {
+        User::Leave(status);
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::StartRenderingSessionL
+// Starts a rendering session with UpnpAvController. Queries the target
+// rendering device.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::StartRenderingSessionL(TUPnPAiwEngineDeviceType aType)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::StartRenderingSessionL" );
+
+    TInt status = KErrNone;
+
+    if (iAVController)
+        {
+        if ( !iRenderingSession)
+            {
+            CUpnpAVDevice* tempDevice = CUpnpAVDevice::NewL();
+            CleanupStack::PushL(tempDevice);
+
+            // Launch the device selection dialog
+
+            if (aType == EUPnPAiwEngineTargetDeviceWithAudioSupport)
+                {
+                status = iCommonUI->SelectDeviceL( *iAVController,
+                        *tempDevice,
+                        EUPnPSearchRenderingDevicesWithAudioCapability,
+                        EUPnPSelectDeviceTitle);
+                }
+            else
+                if (aType
+                        == EUPnPAiwEngineTargetDeviceWithImageAndVideoSupport)
+                    {
+                    status = iCommonUI->SelectDeviceL( *iAVController,
+                            *tempDevice,
+                            EUPnPSearchRenderingDevicesWithVideoCapability,
+                            EUPnPSelectDeviceTitle);
+                    }
+                else
+                    if (aType == EUPnPAiwEngineTargetDeviceWithImageSupport)
+                        {
+                        status
+                                = iCommonUI->SelectDeviceL(
+                                        *iAVController,
+                                        *tempDevice,
+                                        EUPnPSearchRenderingDevicesWithImageCapability,
+                                        EUPnPSelectDeviceTitle);
+                        }
+                    else
+                        {
+                        status = KErrNotSupported;
+                        }
+
+            if (status == KErrNone)
+                {
+                // Create a rendering session and register to observe the
+                // callbacks
+                __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \
+creating rendering session." );
+                iRenderingSession
+                        = &(iAVController->StartRenderingSessionL( *tempDevice) );
+                iRenderingSession->SetObserver( *this);
+                __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \
+rendering session created." );
+
+                // Update the engine state
+                iEngineState = EUPnPEngineConnected;
+                }
+
+            // Clean up
+            CleanupStack::PopAndDestroy(tempDevice);
+            tempDevice = NULL;
+            }
+        else
+            {
+            status = KErrInUse;
+            }
+        }
+    else
+        {
+        status = KErrNotReady;
+        }
+
+    if (status != KErrNone)
+        {
+        User::Leave(status);
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::InteractOperationComplete
+// UPnP AV Controller calls this method to indicate that the requested
+// interaction operation (play, stop, etc.) is complete.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::InteractOperationComplete(TInt aError,
+        TUPnPAVInteractOperation aOperation)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::InteractOperationComplete" );
+
+    if (iObserver && !iVideoPlayCancel)
+        {
+        // If the play operation is complete (stop) or the play fails, do
+        // the call back
+        if (aOperation == EUPnPAVPlay || aOperation == EUPnPAVPlayUser
+                || aOperation == EUPnPAVStop || aOperation == EUPnPAVStopUser)
+            {
+            iEngineState = EUPnPEngineConnected;
+            TRAP_IGNORE( iObserver->PlayCompleteL( aError ) );
+            }
+        }
+    if (aOperation == EUPnPAVPlay || aOperation == EUPnPAVStop)
+        {
+        iRenderingSessionInUse = EFalse;
+        if (iFileName) // If there is a pending item
+            {
+            __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, pending item" );
+            TRAP_IGNORE( InitPlayL() );
+            delete iFileName;
+            iFileName = NULL;
+            iVideoPlayCancel = EFalse; // No need to send StopL
+            }
+        else
+            {
+            __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, no pending item" );
+
+            if (iVideoPlayCancel)
+                {
+                __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, stop previous \
+video item," );
+                iRenderingSessionInUse = ETrue;
+                TRAP_IGNORE( iRenderingSession->StopL() );
+                iVideoPlayCancel = EFalse; //StopL sent
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::SetURIResult
+// UPnP AV Controller calls this method to indicate that ...
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::SetURIResult(TInt aError)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::SetURIResult" );
+
+    iRenderingSessionInUse = EFalse;
+    if (aError != KErrNone && iObserver && !iVideoPlayCancel)
+        {
+        TRAP_IGNORE( iObserver->PlayCompleteL( aError ) );
+        }
+    else
+        if ( !iRenderingSession)
+            {
+            if (iObserver)
+                {
+                TRAP_IGNORE( iObserver->PlayCompleteL( KErrNotReady ) );
+                }
+            }
+
+    if (iFileName) //if there is a pending item
+        {
+        __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, pending item" );
+        TRAP_IGNORE( InitPlayL() );
+        delete iFileName;
+        iFileName = NULL;
+        iVideoPlayCancel = EFalse; //no need to send StopL        
+        }
+    else
+        if ( !iVideoPlayCancel)
+            {
+            __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, no pending item" );
+            __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, no cancellation from \
+video play" );
+            TRAP( aError, iRenderingSession->PlayL() );
+            //if play failed, send the result right way
+            if (aError && iObserver)
+                {
+                TRAP_IGNORE( iObserver->PlayCompleteL( aError ) );
+                }
+            else
+                if (KErrNone == aError)
+                    {
+                    iRenderingSessionInUse = ETrue;
+                    }
+            }
+        else
+            if (iVideoPlayCancel)
+                {
+                __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, no pending item" );
+                __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, stop previous \
+video item" );
+                TRAP_IGNORE( iRenderingSession->StopL() );
+                iRenderingSessionInUse = ETrue;
+                iVideoPlayCancel = EFalse; //StopL sent
+                }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::ReleaseUpnpResourceL
+// Release Upnp resouces
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::ReleaseUpnpResourceL()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ReleaseUpnpResourceL" );
+
+    // Inform the client about the connection lost
+    if (iObserver)
+        {
+        iObserver->ConnectionLostL();
+        }
+
+    // Stop the rendering session
+    if ( iRenderingSession && iAVController )
+        {
+        //iRenderingSession->ReleaseLocalMSServicesL();
+        iRenderingSession->RemoveObserver();
+        iAVController->StopRenderingSession( *iRenderingSession);
+        iRenderingSession = NULL;
+        }
+
+    // Disconnect UPnPAVController
+    delete iAVController;
+    iAVController = NULL;
+
+    iRenderingSessionInUse = EFalse;
+    // Update engine state
+    iEngineState = /*EUPnPEngineConnectionLost;*/EUPnPEngineNotConnected;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::WLANConnectionLost
+// UPnP AV Controller calls this method to indicate that ...
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::WLANConnectionLost()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::WLANConnectionLost" );
+
+    iFileSharingError = KErrDisconnected;
+    if ( iFileSharingActivationWaitNote )
+        {
+        TRAP_IGNORE( iFileSharingActivationWaitNote->ProcessFinishedL() );
+        }
+    TRAP_IGNORE( iCommonUI->DismissDialogL( KErrDisconnected ) );
+    TRAP_IGNORE( ReleaseUpnpResourceL() );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::MediaRendererDisappeared
+// Notifies that the Media Renderer we have a session with has disappeared. 
+// Session is now unusable and must be closed. 
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::MediaRendererDisappeared(
+        TUPnPDeviceDisconnectedReason aReason)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::MediaRendererDisappeared" );
+
+    if (EDisconnected == aReason)
+        {
+        TRAP_IGNORE( ShowConnectionErrorL() );
+        TRAP_IGNORE( ReleaseUpnpResourceL() );
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::InitialiseUserCounter
+// Sets the initial value of the user counter to zero.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::InitialiseUserCounter()
+    {
+    iNumberOfUsers = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::IncreaseUserCounter
+// Increases the value of the user counter by one.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::IncreaseUserCounter()
+    {
+    iNumberOfUsers++;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::DecreaseUserCounter
+// Decreases the value of the user counter by one.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::DecreaseUserCounter()
+    {
+    iNumberOfUsers--;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::UserCounter
+// Gets the value of the user counter.
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAiwEngine::UserCounter() const
+    {
+    return iNumberOfUsers;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::StartTimer()
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::StartTimer()
+    {
+    // Stop the timer 
+    StopTimer();
+
+    // Start the timer 
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, starting timer" );
+    TRAPD( err,
+            iUPnPAiwTimer = CUPnPAiwTimer::NewL( KAiwTimerIntervalInSeconds,
+                    this ) )
+    ;
+    if (err)
+        {
+        __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, timer start failed!" );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::StopTimer()
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::StopTimer()
+    {
+    // Stop the timer if it is running
+    if (iUPnPAiwTimer)
+        {
+        __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, stopping timer" );
+        delete iUPnPAiwTimer;
+        iUPnPAiwTimer = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::TimerCallback
+// Callback method for the UPnPAiWTimer.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::TimerCallback()
+    {
+    StopTimer();
+    if( iAVController )
+        {
+        if( iRenderingSession )
+            {
+            // Stop local file sharing
+            TRAP_IGNORE( iRenderingSession->ReleaseLocalMSServicesL() );
+
+            // Stop the rendering session
+            TRAP_IGNORE( iAVController->StopRenderingSession(
+                            *iRenderingSession ) );
+            iRenderingSession = NULL;
+            }
+
+        // Disconnect UPnPAVController
+        delete iAVController;
+        iAVController = NULL;
+
+        // Update engine state
+        iEngineState = EUPnPEngineNotConnected;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::ShowConnectionErrorL()
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAiwEngine::ShowConnectionErrorL()
+    {
+    iCommonUI->DisplayConnectionErrorNoteL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::ShowConnectionLostCopyErrorL()
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::ShowConnectionLostCopyErrorL()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ShowConnectionLostErrorL" );
+    iCommonUI->DisplayConnectionLostCopyErrorNoteL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::ShowTransferInfoNoteL
+// Show correct info note after file transfer is completed.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::ShowTransferInfoNoteL(
+        TUPnPAiwEngineTransferMode aMode,
+        TInt aCount, 
+        const CUpnpAVDevice& aServerName ) const
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ShowTransferInfoNoteL" );
+
+    // Converts device name into unicode string.
+    HBufC* deviceString = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+            aServerName.FriendlyName() );
+    CleanupStack::PushL( deviceString );
+
+    HBufC* infoText= NULL;
+    if ( aCount == 1 )
+        {
+        if ( aMode == EAiwEngineMove )
+            {
+            // File moved.
+            infoText = StringLoader::LoadLC( 
+                    R_AIW_INFO_MOVE_EXT_ONE_TEXT, 
+                    *deviceString );
+            }
+        else
+            {
+            // File copied.
+            infoText = StringLoader::LoadLC( 
+                    R_AIW_INFO_COPY_EXT_ONE_TEXT,
+                    *deviceString );
+            }
+        }
+    else
+        {
+        if ( aMode == EAiwEngineMove )
+            {
+            // Files moved.
+            infoText = StringLoader::LoadLC(
+                    R_AIW_INFO_MOVE_EXT_MANY_TEXT,
+                    *deviceString,
+                    aCount);
+            }
+        else
+            {
+            // Files copied.
+            infoText = StringLoader::LoadLC( 
+                    R_AIW_INFO_COPY_EXT_MANY_TEXT,
+                    *deviceString,
+                    aCount );
+            }
+        }
+
+    // Shows the dialog.
+    CAknInformationNote* infoNote = 
+        new ( ELeave ) CAknInformationNote( ETrue );
+    infoNote->ExecuteLD( *infoText );
+    
+    CleanupStack::PopAndDestroy( infoText );
+    CleanupStack::PopAndDestroy( deviceString );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::ReserveLocalMSServicesCompleted
+// Notifies that the Media Server startup has completed.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::ReserveLocalMSServicesCompleted(TInt aError)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::\
+ReserveLocalMSServicesCompleted" );
+
+    iFileSharingError = aError;
+    if (aError == KErrNone)
+        {
+        iLocalFileSharingActivated = ETrue;
+        }
+    if (iFileSharingActivationWaitNote)
+        {
+        TRAP_IGNORE( iFileSharingActivationWaitNote->ProcessFinishedL() );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::StartLocalFileSharingL
+// Waits for local media server file sharing activation (or user cancel).
+// --------------------------------------------------------------------------
+void CUPnPAiwEngine::StartLocalFileSharingL(MUPnPAVSessionBase *aSession)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::StartLocalFileSharingL" );
+
+    // Leave if the parameter is not valid
+    if ( !aSession)
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // Initialize the sharing error variable
+    iFileSharingError = KErrNone;
+    iLocalFileSharingActivated = EFalse;
+
+    // Start the local media server
+    aSession->ReserveLocalMSServicesL();
+
+    // Instantiate and launch the wait note until the sharing is
+    // enabled of user cancels the operation
+    if ( !iLocalFileSharingActivated && iFileSharingError == KErrNone)
+        {
+        // Instantiate and launch the wait note until the sharing is
+        // enabled of user cancels the operation
+        iFileSharingActivationWaitNote = new(ELeave)CAknWaitDialog(
+                ( REINTERPRET_CAST( CEikDialog**,
+                                &iFileSharingActivationWaitNote ) ), ETrue );
+        iFileSharingActivationWaitNote->SetCallback( this);
+        TRAPD( fileSharingActivationError,
+                iFileSharingActivationWaitNote->ExecuteLD(
+                        R_AIW_ENABLE_SHARING_WAIT_NOTE ) )
+        ;
+
+        // Cancel sharing activation is user pressed cancel
+        if (iFileSharingError == KErrCancel)
+            {
+            TRAP_IGNORE( aSession->CancelReserveLocalMSServicesL() );
+            }
+
+        // If sharing failed, and the user did not cancel the operations,
+        // forward the leave code.
+        if (fileSharingActivationError != KErrNone && iFileSharingError
+                != KErrCancel)
+            {
+            iFileSharingError = fileSharingActivationError;
+            }
+        }
+
+    if (iFileSharingError != KErrNone)
+        {
+        User::Leave(iFileSharingError);
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::DialogDismissedL
+// ProgressDialog call back method. Get's called when a dialog is
+// dismissed.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::DialogDismissedL(TInt aButtonId)
+    {
+    if (aButtonId == EAknSoftkeyCancel)
+        {
+        __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, user cancelled the file \
+sharing activation" );
+        iFileSharingError = KErrCancel;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::DialogDismissedL
+// Method for selecting a device.
+// --------------------------------------------------------------------------
+//
+CUpnpAVDevice* CUPnPAiwEngine::SelectDeviceL(
+        TUPnPDeviceTypesToSearch aDeviceType, TUPnPDialogTitle aDlgTitle)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::SelectDeviceL" );
+
+    CUpnpAVDevice* device= NULL;
+
+    // Leave if the engine is not in right state
+    if ( !iAVController)
+        {
+        User::Leave(KErrNotReady);
+        }
+    else
+        {
+        // Create new UpnpAvDevice instance
+        device = CUpnpAVDevice::NewL();
+        CleanupStack::PushL(device);
+
+        // Do the device selection
+        TInt ret = iCommonUI->SelectDeviceL( *iAVController, *device,
+                aDeviceType, aDlgTitle);
+
+        if (ret != KErrNone)
+            {
+            CleanupStack::PopAndDestroy(device);
+            device = NULL;
+            User::Leave(ret);
+            }
+        CleanupStack::Pop(device); // Will be returned from the method
+        }
+
+    return device;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::StarVideoPlayL
+// Method for Playing a local video
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::StartVideoPlayL(const TDesC& aFileName)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::StartVideoPlayL" );
+
+    //check if selected renderer supports playing video
+    TInt status = KErrNone;
+    if (iRenderingSession->Device().VideoCapability() )
+        {
+        // Launch the video player dialog to render the
+        // item on the selected rendering device.
+        MUPnPItemResolver* resolver = CreateResolverLC( aFileName );
+        
+        // Update engine state
+        iEngineState = EUPnPEngineActive;
+        iRenderingSessionInUse = ETrue;
+        iVideoPlay = ETrue;
+
+        status = iCommonUI->ExecuteVideoPlayerL( *iRenderingSession,
+                resolver->Item() );
+        iVideoPlay = EFalse;
+        iRenderingSessionInUse = EFalse;
+        
+        if (KErrSessionClosed == status || KErrDisconnected == status)
+            {
+            if (KErrSessionClosed == status)
+                {
+                ReleaseUpnpResourceL();
+                }
+            }
+        else
+            {
+            // Re-register to observe the rendering
+            // session and update engine state
+            iRenderingSession->RemoveObserver();
+            iRenderingSession->SetObserver( *this);
+            iEngineState = EUPnPEngineConnected;
+            }
+
+        //notify MG, the video playing is complete
+        if (iObserver)
+            {
+            iObserver->PlayCompleteL(status);
+            }
+
+        if (KErrCancel == status)
+            {
+            TRAP_IGNORE( iRenderingSession->StopL() );
+            iRenderingSessionInUse = ETrue;
+            iVideoPlayCancel = ETrue;
+            }
+        
+        CleanupStack::PopAndDestroy(); // resolver
+        }
+    else //if not
+        {
+        status = KErrNotSupported;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::InitPlayL
+// Method for Playing a local file
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::InitPlayL()
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::InitPlayL" );
+
+    //if pending an item
+    TInt error = KErrNone;
+
+    if (iVideoPlay || iVideoPlayWait)
+        {
+        __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, start video play" );
+        TRAP_IGNORE( StartVideoPlayL( *iFileName ) );
+        iVideoPlayWait = EFalse;
+        }
+    else
+        {
+        __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, start image play" );
+        TRAP( error , CreateUpnpItemAndSetUriL( *iFileName ) );
+        if (KErrNone == error)
+            {
+            iRenderingSessionInUse = ETrue;
+            }
+        else
+            {
+            iObserver->PlayCompleteL(error);
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::Wait
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::Wait()
+    {
+    StopWait();
+    iWait.Start();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::StopWait
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::StopWait()
+    {
+    if (iWait.IsStarted() )
+        {
+        if (iWait.CanStopNow() )
+            {
+            iWait.AsyncStop();
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::CreateUpnpItemAndSetUriL
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::CreateUpnpItemAndSetUriL(const TDesC& aFileName)
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CreateUpnpItemAndSetUriL" );
+    
+    // Creates resolver to iResolver member variable.
+    MUPnPItemResolver* resolver = CreateResolverLC( aFileName );
+    
+    // Sets uri.
+    const CUpnpElement& element = UPnPItemUtility::ResourceFromItemL( 
+            iResolver->Item() );
+    iRenderingSession->SetURIL( element.Value(), iResolver->Item() );
+    
+    // Cleanup
+    CleanupStack::PopAndDestroy(); // resolver
+    
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CreateUpnpItemAndSetUriL -END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::ResolveComplete
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::ResolveComplete(
+        const MUPnPItemResolver& /*aResolver*/, 
+        TInt aError )
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ResolveComplete" );
+    
+    iResolveResult = aError;
+    StopWait();
+    
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ResolveComplete -END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::CreateResolverLC
+// --------------------------------------------------------------------------
+//
+ MUPnPItemResolver* CUPnPAiwEngine::CreateResolverLC( const TDesC& aFilePath )
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CreateResolverLC" );
+    
+    // If member variable exists, resolving operation is ongoing.
+    if ( iResolver )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    // Creates resolver
+    TUPnPSelectDefaultResource selector;
+    iResolver = UPnPItemResolverFactory::NewLocalItemResolverL( 
+            aFilePath,
+            *iAVController, 
+            selector );
+    CleanupStack::PushL( TCleanupItem( CleanupResolver, this ) );
+    
+    // Starts async resolver.
+    iResolveResult = KErrNone;
+    iResolver->ResolveL( *this );
+    Wait();
+    
+    // If error occured, resolves it in here. It will cleanup resolver.
+    User::LeaveIfError( iResolveResult );
+    
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CreateResolverLC -END" );
+    
+    return iResolver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEngine::CleanupResolver
+// Static method to cleanup resolver object.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwEngine::CleanupResolver( TAny* aAiwEngine )
+    {
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CleanupResolver" );
+    
+    CUPnPAiwEngine* aiwEngine = reinterpret_cast<CUPnPAiwEngine*>( aAiwEngine );
+    if ( aiwEngine )
+        {
+        MUPnPItemResolver* tempResolver = aiwEngine->iResolver;
+        aiwEngine->iResolver = NULL;
+        delete tempResolver;
+        __LOG( "[UpnpAiwEngine]\t\t Resolver cleaned up." );
+        }
+    
+    __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CleanupResolver -END" );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/src/upnpaiwtimer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the class CUPnPAiwTimer.
+*
+*/
+
+
+// INCLUDES
+#include "upnpaiwtimer.h"
+#include "upnpaiwtimerobserver.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPAiwTimer::NewL
+// Construct the timer, add CHeartbeat to Active Scheduler and start it.
+// --------------------------------------------------------------------------
+//
+CUPnPAiwTimer* CUPnPAiwTimer::NewL( TInt aInterval,
+                                    MUPnPAiwTimerObserver* aCallback 
+                                )
+    {
+    CUPnPAiwTimer* self = new (ELeave) CUPnPAiwTimer();
+    CleanupStack::PushL( self );
+    self->ConstructL( aInterval, aCallback );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwTimer::CUPnPAiwTimer
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUPnPAiwTimer::CUPnPAiwTimer()
+    {
+    // No implementation
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwTimer::ConstructL
+// Constructs the timer.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwTimer::ConstructL( TInt aInterval,
+                                MUPnPAiwTimerObserver* aCallback )
+    {
+
+    // Check the parameters
+    if( aInterval <= 0 ||
+        !aCallback )
+        {
+        User::Leave( KErrArgument );
+        }
+    else
+        {
+        iInterval = aInterval;
+        iCallback = aCallback;
+        }
+
+    // Create CHeartbeat object
+    iHeartbeat = CHeartbeat::NewL( EPriorityLow );
+
+    iCounter = 0;
+
+    // Start the heartbeat timer (beating exactly on the second)
+    iHeartbeat->Start( ETwelveOClock, this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwTimer::~CUPnPAiwTimer()
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAiwTimer::~CUPnPAiwTimer()
+    {
+    // Cancel any outstanding request
+    if( iHeartbeat )
+        {
+        iHeartbeat->Cancel();
+        delete iHeartbeat;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwTimer::Beat()
+// Called when the beat is in sync.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwTimer::Beat()
+    {
+    // Increase heartbeat counter
+    iCounter++;
+
+    // If interval is reached, do the call back
+    if( iCounter == iInterval )
+        {
+        if( iCallback )
+            {
+            iCallback->TimerCallback();
+            }
+        iCounter = 0;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwTimer::Synchronize()
+// Called when the beat needs to be syncronized.
+// --------------------------------------------------------------------------
+//
+void CUPnPAiwTimer::Synchronize()
+    {
+    // not used
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwengine/src/upnpdrmfilter.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,363 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpDrmFilter class.
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <e32base.h>
+#include <f32file.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpfileutility.h"
+
+// aiwengine internal
+#include <upnpaiwengineresources.rsg>   // Upnp Fw / UpnpAiwEngine
+#include "upnpdrmfilter.h"
+
+// logging
+_LIT( KComponentLogfile,                "upnpaiwengine.log" );
+#include "upnplog.h"
+
+// Constants
+// The number of filtering file Every loop. 
+const TInt KStepFileNumber = 20; 
+
+// ---------------------------------------------------------------------------
+// Two-Phased Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CUpnpDrmFilter* CUpnpDrmFilter::NewL(
+          RPointerArray<TDesC>& aFiles,
+          RPointerArray<TDesC>& aDRMProtectedFiles )
+    {    
+    __LOG( "CUpnpDrmFilter::NewL Begin" );
+    
+    CUpnpDrmFilter* self =
+        new( ELeave )CUpnpDrmFilter( aFiles, aDRMProtectedFiles );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );   
+    return self;    
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CUpnpDrmFilter::CUpnpDrmFilter( RPointerArray<TDesC>& aFiles,
+                                RPointerArray<TDesC>& aDRMProtectedFiles ):
+    CActive( CActive::EPriorityStandard ),
+    iFiles( aFiles ),
+    iDRMProtectedFiles( aDRMProtectedFiles )
+    {  
+    __LOG( "CUpnpDrmFilter::CUpnpDrmFilter Begin" );
+    
+    iState = EIdle;
+    CActiveScheduler::Add( this );
+    
+    __LOG( "CUpnpDrmFilter::CUpnpDrmFilter End" );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CUpnpDrmFilter::~CUpnpDrmFilter()
+    {
+    __LOG( "CUpnpDrmFilter::~CUpnpDrmFilter Begin" );
+    
+    iRemovedIndexArray.Close(); 
+    
+    __LOG( "CUpnpDrmFilter::~CUpnpDrmFilter End" );
+    }
+
+// ---------------------------------------------------------------------------
+// Start the delete operation
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpDrmFilter::FilterDrmL()
+    {   
+    __LOG( "CUpnpDrmFilter::FilterDrmL Begin" );
+    
+    iFilteredCount = 0;
+    iTotalNum = iFiles.Count();
+    iState = EFilter;    
+    
+    // Start filter.
+    TRequestStatus* status = &iStatus;
+    *status = KRequestPending;
+    User::RequestComplete( status, KErrNone );    
+    SetActive();  
+    ShowWaitNoteL();
+    
+    if (iFilteredCount > 0 )
+        {
+        CAknNoteDialog* dlg = new( ELeave ) CAknNoteDialog();
+        dlg->ExecuteDlgLD( R_AIW_DRM_SKIP_INFO_NOTE );
+        }
+    
+    __LOG( "CUpnpDrmFilter::FilterDrmL End" );
+    }
+
+// ---------------------------------------------------------------------------
+// 2nd Phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CUpnpDrmFilter::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Filters the drm file name from the file name array
+// which file will be copied to the home network.
+// ---------------------------------------------------------------------------
+//
+void CUpnpDrmFilter::Filter()
+    {  
+    __LOG( "CUpnpDrmFilter::Filter Begin" );
+    
+    if ( iTotalNum <= KStepFileNumber + iStartPoint )
+        {
+        for ( TInt index = 0; index < iTotalNum - iStartPoint; index++ )
+            {
+            TBool isProtected = ETrue;
+            TRAPD( drmError,
+                   isProtected = UPnPFileUtility::IsFileProtectedL(
+                       *iFiles[index+iStartPoint] ) );
+            
+            iCurrentPoint++;
+            
+            __LOG1( "[UpnpAiwEngine]\t CUpnpDrmFilter::\
+                   Filter complete , iCurrentPoint :%d" , iCurrentPoint );        
+            
+            if ( drmError || isProtected )
+                {                
+                __LOG1( "[UpnpAiwEngine]\t CUpnpDrmFilter::\
+                       Filter , drmError :%d" , drmError );        
+                
+                // Add the file to aDRMProtectedFiles array.
+                iDRMProtectedFiles.Append( iFiles[index + iStartPoint] );
+                // save the drm file index to array. These files will be removed
+                // from the aFiles array soon.
+                iRemovedIndexArray.Append( index + iStartPoint );
+                }            
+            if ( KErrNone != drmError )
+                {
+                iAbnormalFileCount ++;
+                }
+            }
+        iState = EFilterComplete; 
+        iStartPoint = 0;        
+        }
+    else
+        {
+        for ( TInt index = 0; index < KStepFileNumber; index++ )
+            {
+            TBool isProtected = ETrue;
+            TRAPD( drmError,
+                   isProtected = UPnPFileUtility::IsFileProtectedL(
+                       *iFiles[index+iStartPoint] ) );
+            
+            iCurrentPoint++;
+            
+            __LOG1( "[UpnpAiwEngine]\t CUpnpDrmFilter::\
+                   Filter , iCurrentPoint :%d" , iCurrentPoint );        
+            if ( drmError || isProtected )
+                {                
+                __LOG1( "[UpnpAiwEngine]\t CUpnpDrmFilter::\
+                        Filter , drmError :%d" , drmError );        
+                 
+                // Add the file to aDRMProtectedFiles array.
+                iDRMProtectedFiles.Append( iFiles[index + iStartPoint] );
+                // save the drm file index to array. These files will be removed
+                // from the aFiles array soon.
+                iRemovedIndexArray.Append( index + iStartPoint );
+                } 
+            if ( KErrNone != drmError )
+                {
+                iAbnormalFileCount ++;
+                }            
+            }  
+        iStartPoint += KStepFileNumber;
+        }    
+    
+    //Set a new request to filter the next 20 files
+    TRequestStatus* status = &iStatus;
+    *status = KRequestPending;
+    User::RequestComplete( status, KErrNone );
+    SetActive(); 
+    
+    __LOG( "CUpnpDrmFilter::Filter End" );
+    }
+
+// ----------------------------------------------------------------------------
+// Handles request completion event
+// ----------------------------------------------------------------------------
+//
+void CUpnpDrmFilter::RunL()
+    {
+    __LOG( "CUpnpDrmFilter::RunL End" );
+    if ( KErrNone == iStatus.Int() )
+        {
+        DoTaskStep();
+        }
+    else 
+        {
+        __LOG( "CUpnpDrmFilter::RunL iStatus != KErrNone" );
+        }
+    __LOG( "CUpnpDrmFilter::RunL End" );
+    }
+
+//----------------------------------------------------------------------------
+// Handles exception
+//----------------------------------------------------------------------------
+//
+void CUpnpDrmFilter::RunError()
+    {   
+    __LOG( "CUpnpDrmFilter::RunError Begin" ); 
+    
+    Complete(); 
+    
+    __LOG( "CUpnpDrmFilter::RunError End" ); 
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel the filter operation
+// ---------------------------------------------------------------------------
+//
+void CUpnpDrmFilter::DoCancel()
+    {
+    __LOG( "CUpnpDrmFilter::DoCancel Begin" ); 
+    
+    Complete();
+    
+    __LOG( "CUpnpDrmFilter::DoCancel End" ); 
+    }
+
+// ---------------------------------------------------------------------------
+// filter files
+// ---------------------------------------------------------------------------
+//
+void CUpnpDrmFilter::DoTaskStep()
+    {    
+    __LOG( "CUpnpDrmFilter::DoTaskStep Begin" ); 
+    
+    switch( iState )
+        {
+        case EFilter:
+            {
+            Filter();
+            break;
+            }
+        case EFilterComplete:
+            {
+            Complete();
+            break;
+            }            
+        default:
+            {
+            break;
+            }
+        }
+    
+    __LOG( "CUpnpDrmFilter::DoTaskStep End" ); 
+    }
+
+// ---------------------------------------------------------------------------
+// End state for a delete operation
+// ---------------------------------------------------------------------------
+//
+void CUpnpDrmFilter::Complete()
+    {
+    __LOG( "CUpnpDrmFilter::Complete Begin" ); 
+    
+    if ( iTotalNum > iCurrentPoint )
+        {
+        
+        for ( TInt index = iCurrentPoint; index < iTotalNum ; index++ )
+            {
+            //remove the drm files from iFiles array.
+            iFiles.Remove( index ); 
+            }
+        } 
+        
+        iFilteredCount = iRemovedIndexArray.Count() - iAbnormalFileCount;
+        iAbnormalFileCount = 0;
+        
+        
+    for ( TInt index = iRemovedIndexArray.Count() - 1; index >= 0 ; index-- )
+        {
+        //remove the drm files from iFiles array.
+        iFiles.Remove( iRemovedIndexArray[index] ); 
+        }
+
+    // Remove the empty slots in the array
+    iFiles.Compress();
+    //close the iRemovedIndexArray
+    iRemovedIndexArray.Close();
+    
+    //filter complete, start to copy file
+    __LOG1( "CUpnpDrmFilter::Complete() iFiles.Count = %d ",\
+            iFiles.Count());
+    iCurrentPoint = 0;    
+    iState = EFilterStop;
+    
+    __LOG( "CUpnpDrmFilter::Complete End" ); 
+    }
+
+// --------------------------------------------------------------------------
+// Completes one cycle of the process.
+// ---------------------------------------------------------------------------
+void CUpnpDrmFilter::StepL()
+    {
+    
+    }
+// ---------------------------------------------------------------------------
+// Return when the progress finish.
+// ---------------------------------------------------------------------------
+TBool CUpnpDrmFilter::IsProcessDone(void) const
+    {
+    __LOG( "CUpnpDrmFilter::IsProcessDone" ); 
+    
+    TBool ret(EFalse);
+    if ( iState == EFilterStop )
+        {
+        ret = ETrue;
+        }
+    else
+        {        
+        __LOG( "CUpnpDrmFilter::IsProcessDone iState != EFilterComplete" );
+        }
+    return ret;
+    }
+
+void CUpnpDrmFilter::ShowWaitNoteL()
+    {
+    __LOG( "CUpnpDrmFilter::ShowWaitNoteL Begin" ); 
+    
+    CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL();
+    CleanupStack::PushL(reinterpret_cast<CBase*>(waitNoteWrapper));
+    waitNoteWrapper->ExecuteL(
+                    R_AIW_DRM_FILTERING_WAIT_NOTE,      // TInt aResId,
+                    *this,  // MAknBackgroundProcess& aBackgroundProcess
+                    ETrue );
+    CleanupStack::PopAndDestroy( waitNoteWrapper );
+    
+    __LOG( "CUpnpDrmFilter::ShowWaitNoteL End" ); 
+    }
+
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/data/10208a15.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file for the UpnpAiwProvider interface.
+*
+*/
+
+
+// RESOURCE IDENTIFIER
+// n/a
+
+// INCLUDES
+#include <eikon.rh>
+#include <AiwCommon.hrh>
+#include "ecom/registryinfov2.rh"
+#include "upnpaiwprovideruids.hrh"
+
+// RESOURCE DEFINITIONS
+
+// --------------------------------------------------------------------------
+// theInfo
+// AIW interface definition for the UPnP AIW Media Provider.
+// --------------------------------------------------------------------------
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = KUPnPAiwProviderDllUid;
+    interfaces =
+        {
+
+        // -------------------------------------------------------------------
+        // Menu services
+        // -------------------------------------------------------------------
+        INTERFACE_INFO
+            {
+            interface_uid = KAiwClassMenu;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUPnPAiwEnableExternalMenuServiceUid;
+                    version_no = 2;
+                    display_name = "EnableExternal";
+                    default_data = "*";
+                    opaque_data = KAiwCmdUPnPEnableExternalStr;
+                    },
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUPnPAiwCopyToExternalMenuServiceUid;
+                    version_no = 2;
+                    display_name = "CopyToExternal";
+                    default_data = "*";
+                    opaque_data = KAiwCmdUPnPCopyStr;
+                    },
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUPnPAiwMoveToExternalMenuServiceUid;
+                    version_no = 2;
+                    display_name = "MoveToExternal";
+                    default_data = "*";
+                    opaque_data = KAiwCmdUPnPMoveStr;
+                    },
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUPnPAiwPlayOnExternalMenuServiceUid;
+                    version_no = 2;
+                    display_name = "PlayOnExternal";
+                    default_data = "*";
+                    opaque_data = KAiwCmdUPnPPlayStr;
+                    }
+                };
+            },
+
+        // -------------------------------------------------------------------
+        // Base services
+        // -------------------------------------------------------------------
+        INTERFACE_INFO
+            {
+            interface_uid = KAiwClassBase;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUPnPAiwEnableExternalMenuServiceUid;
+                    version_no = 2;
+                    display_name = "EnableExternal";
+                    default_data = "*";
+                    opaque_data = KAiwCmdUPnPEnableExternalStr;
+                    },
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUPnPAiwPlayOnExternalBaseServiceUid;
+                    version_no = 2;
+                    display_name = "PlayOnExternal";
+                    default_data = "*";
+                    opaque_data = KAiwCmdUPnPPlayStr;
+                    },
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUPnPAiwOpenExternalBaseServiceUid;
+                    version_no = 2;
+                    display_name = "OpenExternal";
+                    default_data = "*";
+                    opaque_data = KAiwCmdUPnPOpenStr;
+                    }
+                };
+            }
+        };
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/data/upnpaiwmenuresources.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AIW menu resource definitions for UpnpAiwProvider.
+*
+*/
+
+
+// RESOURCE IDENTIFIER
+NAME UPAM
+
+// INCLUDES
+#include <eikon.rh>
+#include <AiwCommon.hrh>
+#include <upnpframework.loc>
+
+// RESOURCE DEFINITIONS
+
+// --------------------------------------------------------------------------
+// R_AIW_ENABLE_EXTERNAL_MENU
+// Menu item for the "Enable External" menu service. This menu item is shown,
+// when the UPnP External screen is OFF (not active).
+// --------------------------------------------------------------------------
+RESOURCE MENU_PANE r_aiw_enable_external_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = KAiwCmdUPnPEnableExternal;
+            txt = qtn_iupnp_aiw_enable_external_string;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+// R_AIW_DISABLE_EXTERNAL_MENU
+// Menu item for the "Disable External" menu service. This menu item is shown,
+// when the UPnP External screen is ON (active).
+// --------------------------------------------------------------------------
+RESOURCE MENU_PANE r_aiw_disable_external_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = KAiwCmdUPnPEnableExternal;
+            txt = qtn_iupnp_aiw_disable_external_string;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+// R_AIW_COPY_TO_EXTERNAL_MENU
+// Menu item for the "Copy to External" menu service.
+// --------------------------------------------------------------------------
+RESOURCE MENU_PANE r_aiw_copy_to_external_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = KAiwCmdUPnPCopy;
+            txt = qtn_iupnp_aiw_copy_to_external_string;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+// R_AIW_MOVE_TO_EXTERNAL_MENU
+// Menu item for the "Move to External" menu service.
+// --------------------------------------------------------------------------
+RESOURCE MENU_PANE r_aiw_move_to_external_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = KAiwCmdUPnPMove;
+            txt = qtn_iupnp_aiw_move_to_external_string;
+            }
+        };
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for the UpnpAiwProvider component
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// None
+
+PRJ_MMPFILES
+upnpaiwprovider.mmp
+
+PRJ_TESTMMPFILES
+// None
+
+PRJ_TESTEXPORTS
+// None
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/group/upnpaiwprovider.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification file for UpnpAiwProvider
+*
+*/
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh"
+#include "../inc/upnpaiwprovideruids.hrh"
+#include <data_caging_paths.hrh>
+
+// Build target
+TARGET          upnpaiwprovider.dll
+CAPABILITY      CAP_ECOM_PLUGIN
+TARGETTYPE      PLUGIN
+UID             0x10009D8D KUPnPAiwProviderDllUid
+VENDORID        VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+SOURCEPATH      ../data
+START RESOURCE  10208a15.rss
+HEADER
+TARGET          upnpaiwprovider.rsc
+TARGETPATH      resource/plugins
+END
+
+SOURCEPATH      ../data
+START RESOURCE  upnpaiwmenuresources.rss
+HEADER
+TARGET          upnpaiwmenuresources.rsc
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../inc
+USERINCLUDE     ../data
+USERINCLUDE     ../../upnpaiwengine/inc
+
+MW_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+SOURCEPATH      ../src
+SOURCE          upnpaiwprovider.cpp
+SOURCE          upnpaiwenableexternalservice.cpp
+SOURCE          upnpaiwcopytoexternalservice.cpp
+SOURCE          upnpaiwmovetoexternalservice.cpp
+SOURCE          upnpaiwopenexternalservice.cpp
+SOURCE          upnpaiwplayonexternalbaseservice.cpp
+SOURCE          upnpaiwplayonexternalmenuservice.cpp
+
+// Core
+LIBRARY         euser.lib
+
+// AIW and ECom
+LIBRARY         servicehandler.lib
+
+// UPnP
+LIBRARY         upnpaiwengine.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/inc/upnpaiwcopytoexternalservice.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UpnpAiwCopyToExternalService.
+*
+*/
+
+
+#ifndef _UPNP_AIW_COPY_TO_EXTERNAL_SERVICE_H
+#define _UPNP_AIW_COPY_TO_EXTERNAL_SERVICE_H
+
+//  INCLUDES
+#include <AiwServiceIfMenu.h>
+#include "upnpaiwengineobserver.h"
+
+// FUNCTION PROTOTYPES
+class CUPnPAiwEngine;
+class CUpnpDrmFilter;
+
+// CLASS DECLARATION
+
+/**
+*  CUPnPAiwCopyToExternalService
+*  The class implements the "Copy to external" service of the
+*  UPnP AIW Media Provider.
+*  @since Series S60 3.0
+*/
+class CUPnPAiwCopyToExternalService : public CAiwServiceIfMenu,
+                                      public MUPnPAiwEngineObserver
+    {
+
+    public: // Constructors and destructor
+
+        // Two-phased constructor.
+        static CUPnPAiwCopyToExternalService* NewL();
+
+        // Destructor.
+        virtual ~CUPnPAiwCopyToExternalService();
+
+    public: // Methods from the CAiwServiceIfMenu
+
+        // Unnecessary methods 
+        void InitialiseL(   MAiwNotifyCallback& /*aFrameworkCallback*/,
+                            const RCriteriaArray& /*aInterest*/ ) {}
+        void HandleServiceCmdL(
+                            const TInt& /*aCmdId*/,
+                            const CAiwGenericParamList& /*aInParamList*/,
+                            CAiwGenericParamList& /*aOutParamList*/,
+                            TUint /*aCmdOptions*/,
+                            const MAiwNotifyCallback* /*aCallback*/ ) {}
+
+        /**
+        * Initialises menu pane by adding provider specific menu items.
+        * The AIW Framework gives the parameters to be used in addition.
+        * @param aMenuPane Menu pane handle
+        * @param aIndex position of item where to add menu items.
+        * @param aCascadeId ID of cascade menu item.
+        * @param aInParamList input parameter list for provider's parameters 
+        *        checking
+        */
+        void InitializeMenuPaneL( CAiwMenuPane& aMenuPane,
+                                  TInt aIndex,
+                                  TInt aCascadeId,
+                                  const CAiwGenericParamList& aInParamList);
+
+        /**
+        * Handle a menu command invoked by the Handler.
+        * @param aMenuCmdId Command ID for the menu command,
+        *        defined by the provider when adding the menu commands.
+        * @param aInParamList Input parameters, could be empty list
+        * @param aOutParamList Output parameters, could be empty list
+        * @param aCmdOptions Options for the command, see KAiwCmdOpt* 
+        *        constants.
+        * @param aCallback callback if asynchronous command handling is wanted
+        *        by consumer. The provider may or may not support this, leaves
+        *        with KErrNotSupported, it not.
+        */
+        void HandleMenuCmdL( TInt aMenuCmdId,
+                             const CAiwGenericParamList& aInParamList,
+                             CAiwGenericParamList& aOutParamList,
+                             TUint aCmdOptions = 0,
+                             const MAiwNotifyCallback* aCallback = NULL);
+
+    public:  // MUPnPAiwEngineObserver
+
+        /**
+         * Indicates that the play operation is complete.
+         *
+         * @since Series 60 3.0
+         * @param aStatus status information
+         * @return None
+         */
+        void PlayCompleteL( TInt /*aStatus*/ ) {}
+
+        /**
+         * Indicates that the connection with the target UPnP
+         * device has been lost.
+         *
+         * @since Series 60 3.0
+         * @param None
+         * @return None
+         */
+        void ConnectionLostL();
+
+    private: // private methods
+
+       /**
+       * Deletes the contents of the iFileNames pointer array
+       *
+       * @since Series 60 3.0
+       * @param None
+       * @returns None
+       */
+       void EmptyFileNameArray();
+
+
+    private: // construction
+
+        // Constructor
+        CUPnPAiwCopyToExternalService();
+
+        // ConstructL
+        void ConstructL();
+
+    private: // Data members
+
+        // reference to the engine component
+        CUPnPAiwEngine* iEngine;                // not owned (singleton)
+
+        // reference to the client (call back reference)
+        MAiwNotifyCallback* iClient;            // not owned
+
+        // The list of file names received as a parameter
+        RPointerArray<TDesC16> iFileNames;      // owned
+        
+        // The playlist name (if we are doing a playlist copy)
+        HBufC* iPlaylistName;                   // owned
+    };
+
+#endif // _UPNP_AIW_COPY_TO_EXTERNAL_SERVICE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/inc/upnpaiwenableexternalservice.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UpnpAiwEnableExternalService.
+*
+*/
+
+
+#ifndef _UPNP_AIW_ENABLE_EXTERNAL_SERVICE_H
+#define _UPNP_AIW_ENABLE_EXTERNAL_SERVICE_H
+
+//  INCLUDES
+#include <AiwServiceIfMenu.h>
+
+// FUNCTION PROTOTYPES
+class CUPnPAiwEngine;
+
+// CLASS DECLARATION
+
+/**
+*  CUPnPAiwEnableExternalService
+*  The class implements the "Enable external" service of the
+*  UPnP AIW Media Provider.
+*  @since Series S60 3.0
+*/
+class CUPnPAiwEnableExternalService : public CAiwServiceIfMenu
+    {
+
+    public: // Constructors and destructor
+
+        // Two-phased constructor.
+        static CUPnPAiwEnableExternalService* NewL();
+
+        // Destructor.
+        virtual ~CUPnPAiwEnableExternalService();
+
+    public: // Methods from the CAiwServiceIfMenu
+
+        // Unnecessary method
+        void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/,
+                          const RCriteriaArray& /*aInterest*/) {}
+
+        /**
+        * Executes generic service commands included in criteria.
+        * @param aCmdId Command to be executed
+        * @param aInParamList Input parameters, can be an empty list
+        * @param aOutParamList Output parameters, can be an empty list
+        * @param aCmdOptions Options for the command, see KAiwCmdOpt* 
+        *        constants.
+        * @param aCallback callback for asynchronous command handling, 
+        *        parameter checking, etc.
+        * @see enum TServiceCmdOptions in GENERICPARAM.HRH
+        * @exception KErrArgument if callback is missing when required.
+        * @exception KErrNotSupported if no provider support service
+        */
+        void HandleServiceCmdL( const TInt& aCmdId,
+                                const CAiwGenericParamList& aInParamList,
+                                CAiwGenericParamList& aOutParamList,
+                                TUint aCmdOptions = 0,
+                                const MAiwNotifyCallback* aCallback = NULL);
+
+        /**
+        * Initialises menu pane by adding provider specific menu items.
+        * The AIW Framework gives the parameters to be used in addition.
+        * @param aMenuPane Menu pane handle
+        * @param aIndex position of item where to add menu items.
+        * @param aCascadeId ID of cascade menu item.
+        * @param aInParamList input parameter list for provider's parameters 
+        *        checking
+        */
+        void InitializeMenuPaneL( CAiwMenuPane& aMenuPane,
+                                  TInt aIndex,
+                                  TInt aCascadeId,
+                                  const CAiwGenericParamList& aInParamList);
+
+        /**
+        * Handle a menu command invoked by the Handler.
+        * @param aMenuCmdId Command ID for the menu command,
+        *        defined by the provider when adding the menu commands.
+        * @param aInParamList Input parameters, could be empty list
+        * @param aOutParamList Output parameters, could be empty list
+        * @param aCmdOptions Options for the command, see KAiwCmdOpt* 
+        *        constants.
+        * @param aCallback callback if asynchronous command handling is wanted
+        *        by consumer. The provider may or may not support this, leaves
+        *        with KErrNotSupported, it not.
+        */
+        void HandleMenuCmdL( TInt aMenuCmdId,
+                             const CAiwGenericParamList& aInParamList,
+                             CAiwGenericParamList& aOutParamList,
+                             TUint aCmdOptions = 0,
+                             const MAiwNotifyCallback* aCallback = NULL);
+
+    private: // construction
+
+        // Constructor
+        CUPnPAiwEnableExternalService();
+
+        // ConstructL
+        void ConstructL();
+
+    private: // Data members
+
+        // reference to the engine component
+        CUPnPAiwEngine* iEngine;            // not owned (singleton pointer)
+
+        // reference to the client (call back reference)
+        MAiwNotifyCallback* iClient;                // not owned
+
+    };
+
+#endif // _UPNP_AIW_ENABLE_EXTERNAL_SERVICE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/inc/upnpaiwmovetoexternalservice.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UpnpAiwMoveToExternalService.
+*
+*/
+
+
+#ifndef _UPNP_AIW_MOVE_TO_EXTERNAL_SERVICE_H
+#define _UPNP_AIW_MOVE_TO_EXTERNAL_SERVICE_H
+
+//  INCLUDES
+#include <AiwServiceIfMenu.h>
+#include "upnpaiwengineobserver.h"
+
+// FUNCTION PROTOTYPES
+class CUPnPAiwEngine;
+class CUpnpDrmFilter;
+
+// CLASS DECLARATION
+
+/**
+*  CUPnPAiwMoveToExternalService
+*  The class implements the "Move to external" service of the
+*  UPnP AIW Media Provider.
+*  @since Series S60 3.0
+*/
+class CUPnPAiwMoveToExternalService : public CAiwServiceIfMenu,
+                                      public MUPnPAiwEngineObserver
+    {
+
+    public: // Constructors and destructor
+
+        // Two-phased constructor.
+        static CUPnPAiwMoveToExternalService* NewL();
+
+        // Destructor.
+        virtual ~CUPnPAiwMoveToExternalService();
+
+    public: // Methods from the CAiwServiceIfMenu
+
+        // Unnecessary methods
+        void InitialiseL(   MAiwNotifyCallback& /*aFrameworkCallback*/,
+                            const RCriteriaArray& /*aInterest*/ ) {}
+        void HandleServiceCmdL(
+                            const TInt& /*aCmdId*/,
+                            const CAiwGenericParamList& /*aInParamList*/,
+                            CAiwGenericParamList& /*aOutParamList*/,
+                            TUint /*aCmdOptions*/,
+                            const MAiwNotifyCallback* /*aCallback*/) {}
+
+        /**
+        * Initialises menu pane by adding provider specific menu items.
+        * The AIW Framework gives the parameters to be used in addition.
+        * @param aMenuPane Menu pane handle
+        * @param aIndex position of item where to add menu items.
+        * @param aCascadeId ID of cascade menu item.
+        * @param aInParamList input parameter list for provider's parameters 
+        *        checking
+        */
+        void InitializeMenuPaneL( CAiwMenuPane& aMenuPane,
+                                  TInt aIndex,
+                                  TInt aCascadeId,
+                                  const CAiwGenericParamList& aInParamList);
+
+        /**
+        * Handle a menu command invoked by the Handler.
+        * @param aMenuCmdId Command ID for the menu command,
+        *        defined by the provider when adding the menu commands.
+        * @param aInParamList Input parameters, could be empty list
+        * @param aOutParamList Output parameters, could be empty list
+        * @param aCmdOptions Options for the command, see KAiwCmdOpt* 
+        *        constants.
+        * @param aCallback callback if asynchronous command handling is wanted
+        *        by consumer. The provider may or may not support this, leaves
+        *        with KErrNotSupported, it not.
+        */
+        void HandleMenuCmdL( TInt aMenuCmdId,
+                             const CAiwGenericParamList& aInParamList,
+                             CAiwGenericParamList& aOutParamList,
+                             TUint aCmdOptions = 0,
+                             const MAiwNotifyCallback* aCallback = NULL);
+
+    public:  // MUPnPAiwEngineObserver
+
+        // Unnecessary callback method
+        void PlayCompleteL( TInt /*aStatus*/ ) {}
+
+        /**
+         * Indicates that the connection with the target UPnP
+         * device has been lost.
+         *
+         * @since Series 60 3.0
+         * @param None
+         * @return None
+         */
+        void ConnectionLostL();
+
+    private: // private methods
+
+       /**
+       * Deletes the contents of the iFileNames pointer array
+       *
+       * @since Series 60 3.0
+       * @param None
+       * @returns None
+       */
+       void EmptyFileNameArray();
+
+
+    private: // construction
+
+        // Constructor
+        CUPnPAiwMoveToExternalService();
+
+        // ConstructL
+        void ConstructL();
+
+    private: // Data members
+
+        // reference to the engine component
+        CUPnPAiwEngine* iEngine;            // not owned (singleton)
+        
+        // reference to the client (call back reference)
+        MAiwNotifyCallback* iClient;        // not owned
+
+        // The list of file names received as a parameter
+        RPointerArray<TDesC16> iFileNames;  // owned
+    };
+
+#endif // _UPNP_AIW_MOVE_TO_EXTERNAL_SERVICE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/inc/upnpaiwopenexternalservice.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UpnpAiwOpenExternalService.
+*
+*/
+
+
+#ifndef _UPNP_AIW_OPEN_EXTERNAL_SERVICE_H
+#define _UPNP_AIW_OPEN_EXTERNAL_SERVICE_H
+
+//  INCLUDES
+#include <AiwServiceIfBase.h>
+
+// FUNCTION PROTOTYPES
+class CUPnPAiwEngine;
+
+// CLASS DECLARATION
+
+/**
+*  CUPnPAiwOpenExternalService
+*  The class implements the "Open external" service of the
+*  UPnP AIW Media Provider.
+*  @since Series S60 3.0
+*/
+class CUPnPAiwOpenExternalService : public CAiwServiceIfBase
+    {
+
+    public: // Constructors and destructor
+
+        // Two-phased constructor.
+        static CUPnPAiwOpenExternalService* NewL();
+        
+        // Destructor.
+        virtual ~CUPnPAiwOpenExternalService();
+
+    public: // Methods from the CAiwServiceIfMenu
+
+        // Unnecessary method
+        void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/,
+                          const RCriteriaArray& /*aInterest*/) {}
+
+        /**
+        * Executes generic service commands included in criteria.
+        * @param aCmdId Command to be executed
+        * @param aInParamList Input parameters, can be an empty list
+        * @param aOutParamList Output parameters, can be an empty list
+        * @param aCmdOptions Options for the command, see KAiwCmdOpt* 
+        *        constants.
+        * @param aCallback callback for asynchronous command handling, 
+        *        parameter
+        *        checking, etc.
+        * @see enum TServiceCmdOptions in GENERICPARAM.HRH
+        * @exception KErrArgument if callback is missing when required.
+        * @exception KErrNotSupported if no provider support service
+        */
+        void HandleServiceCmdL( const TInt& aCmdId,
+                                const CAiwGenericParamList& aInParamList,
+                                CAiwGenericParamList& aOutParamList,
+                                TUint aCmdOptions = 0,
+                                const MAiwNotifyCallback* aCallback = NULL);
+
+    private: // construction
+
+        // Constructor
+        CUPnPAiwOpenExternalService();
+
+        // ConstructL
+        void ConstructL();
+
+    private: // Data members
+
+        // reference to the engine component
+        CUPnPAiwEngine* iEngine;                // not owned (singleton)
+
+    };
+
+#endif // _UPNP_AIW_OPEN_EXTERNAL_SERVICE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/inc/upnpaiwplayonexternalbaseservice.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UpnpAiwPlayOnExternalBaseService.
+*
+*/
+
+
+#ifndef _UPNP_AIW_PLAY_ON_EXTERNAL_BASE_SERVICE_H
+#define _UPNP_AIW_PLAY_ON_EXTERNAL_BASE_SERVICE_H
+
+//  INCLUDES
+#include <AiwServiceIfBase.h>
+#include "upnpaiwengineobserver.h"
+
+// FUNCTION PROTOTYPES
+class CUPnPAiwEngine;
+class CUpnpDrmFilter;
+
+// CLASS DECLARATION
+
+/**
+*  CUPnPAiwPlayOnExternalBaseService
+*  The class implements the "Play on external" base service of the
+*  UPnP AIW Media Provider.
+*  @since Series S60 3.0
+*/
+class CUPnPAiwPlayOnExternalBaseService : public CAiwServiceIfBase,
+                                          public MUPnPAiwEngineObserver
+    {
+
+    public: // Constructors and destructor
+
+        // Two-phased constructor.
+        static CUPnPAiwPlayOnExternalBaseService* NewL();
+
+        // Destructor.
+        virtual ~CUPnPAiwPlayOnExternalBaseService();
+
+    public: // Methods from the CAiwServiceIfBase
+
+        // Unnecessary method
+        void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/,
+                          const RCriteriaArray& /*aInterest*/ ) {}
+
+        /**
+        * Executes generic service commands included in criteria.
+        * @param aCmdId Command to be executed
+        * @param aInParamList Input parameters, can be an empty list
+        * @param aOutParamList Output parameters, can be an empty list
+        * @param aCmdOptions Options for the command, see KAiwCmdOpt* 
+        *        constants.
+        * @param aCallback callback for asynchronous command handling, 
+        *        parameter checking, etc.
+        * @see enum TServiceCmdOptions in GENERICPARAM.HRH
+        * @exception KErrArgument if callback is missing when required.
+        * @exception KErrNotSupported if no provider support service
+        */
+        void HandleServiceCmdL( const TInt& aCmdId,
+                                const CAiwGenericParamList& aInParamList,
+                                CAiwGenericParamList& aOutParamList,
+                                TUint aCmdOptions = 0,
+                                const MAiwNotifyCallback* aCallback = NULL);
+
+    public:  // MUPnPAiwEngineObserver
+
+        /**
+         * Indicates that the play operation is complete.
+         *
+         * @since Series 60 3.0
+         * @param aStatus status information
+         * @return None
+         */
+        void PlayCompleteL( TInt aStatus );
+
+        /**
+         * Indicates that the connection with the target UPnP
+         * device has been lost.
+         *
+         * @since Series 60 3.0
+         * @param None
+         * @return None
+         */
+        void ConnectionLostL();
+
+    private: // private methods
+
+       /**
+       * Deletes the contents of the iFileNames pointer array
+       *
+       * @since Series 60 3.0
+       * @param None
+       * @returns None
+       */
+       void EmptyFileNameArray();
+
+
+    private: // construction
+
+        // Constructor
+        CUPnPAiwPlayOnExternalBaseService();
+
+        // ConstructL
+        void ConstructL();
+
+    private: // Data members
+
+        // reference to the engine component
+        CUPnPAiwEngine* iEngine;                    // not owned (singleton)
+
+        // iActiveDrmFilter does the filtering DRM file work
+        CUpnpDrmFilter* iActiveDrmFilter;           // owned
+        
+        // reference to the client (call back reference)
+        MAiwNotifyCallback* iClient;                // not owned
+
+        // The list of file names received as a parameter
+        RPointerArray<TDesC16> iFileNames;          // owned
+
+        // Filename of the file that is played
+        HBufC16* iFileName;                         // owned
+    };
+
+#endif // _UPNP_AIW_PLAY_ON_EXTERNAL_BASE_SERVICE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/inc/upnpaiwplayonexternalmenuservice.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UpnpAiwPlayOnExternalMenuService.
+*
+*/
+
+
+#ifndef _UPNP_AIW_PLAY_ON_EXTERNAL_MENU_SERVICE_H
+#define _UPNP_AIW_PLAY_ON_EXTERNAL_MENU_SERVICE_H
+
+//  INCLUDES
+#include <AiwServiceIfMenu.h>
+#include "upnpaiwengineobserver.h"
+
+// FUNCTION PROTOTYPES
+class CUPnPAiwEngine;
+
+// CLASS DECLARATION
+
+/**
+*  CUPnPAiwPlayOnExternalMenuService
+*  The class implements the "Play on external" menu service of the
+*  UPnP AIW Media Provider.
+*  @since Series S60 3.0
+*/
+class CUPnPAiwPlayOnExternalMenuService : public CAiwServiceIfMenu,
+                                          public MUPnPAiwEngineObserver
+    {
+
+    public: // Constructors and destructor
+
+        // Two-phased constructor.
+        static CUPnPAiwPlayOnExternalMenuService* NewL();
+
+        // Destructor.
+        virtual ~CUPnPAiwPlayOnExternalMenuService();
+
+    public: // Methods from the CAiwServiceIfMenu
+
+        // Unnecessary methods
+        void InitialiseL(   MAiwNotifyCallback& /*aFrameworkCallback*/,
+                            const RCriteriaArray& /*aInterest*/ ) {}
+        void HandleServiceCmdL(
+                            const TInt& /*aCmdId*/,
+                            const CAiwGenericParamList& /*aInParamList*/,
+                            CAiwGenericParamList& /*aOutParamList*/,
+                            TUint /*aCmdOptions*/,
+                            const MAiwNotifyCallback* /*aCallback*/ ) {}
+
+        /**
+        * Initialises menu pane by adding provider specific menu items.
+        * The AIW Framework gives the parameters to be used in addition.
+        * @param aMenuPane Menu pane handle
+        * @param aIndex position of item where to add menu items.
+        * @param aCascadeId ID of cascade menu item.
+        * @param aInParamList input parameter list for provider's parameters 
+        *        checking
+        */
+        void InitializeMenuPaneL( CAiwMenuPane& aMenuPane,
+                                  TInt aIndex,
+                                  TInt aCascadeId,
+                                  const CAiwGenericParamList& aInParamList);
+
+        /**
+        * Handle a menu command invoked by the Handler.
+        * @param aMenuCmdId Command ID for the menu command,
+        *        defined by the provider when adding the menu commands.
+        * @param aInParamList Input parameters, could be empty list
+        * @param aOutParamList Output parameters, could be empty list
+        * @param aCmdOptions Options for the command, see KAiwCmdOpt* 
+        *        constants.
+        * @param aCallback callback if asynchronous command handling is wanted
+        *        by consumer.The provider may or may not support this, leaves 
+        *        with KErrNotSupported, it not.
+        */
+        void HandleMenuCmdL( TInt aMenuCmdId,
+                             const CAiwGenericParamList& aInParamList,
+                             CAiwGenericParamList& aOutParamList,
+                             TUint aCmdOptions = 0,
+                             const MAiwNotifyCallback* aCallback = NULL);
+
+    public:  // MUPnPAiwEngineObserver
+
+        /**
+         * Indicates that the play operation is complete.
+         *
+         * @since Series 60 3.0
+         * @param aStatus status information
+         * @return None
+         */
+        void PlayCompleteL( TInt aStatus );
+
+        /**
+         * Indicates that the connection with the target UPnP
+         * device has been lost.
+         *
+         * @since Series 60 3.0
+         * @param None
+         * @return None
+         */
+        void ConnectionLostL();
+
+    private: // private methods
+
+       /**
+       * Deletes the contents of the iFileNames pointer array
+       *
+       * @since Series 60 3.0
+       * @param None
+       * @returns None
+       */
+       void EmptyFileNameArray();
+
+    private: // construction
+
+        // Constructor
+        CUPnPAiwPlayOnExternalMenuService();
+
+        // ConstructL
+        void ConstructL();
+
+    private: // Data members
+
+        // reference to the engine component
+        CUPnPAiwEngine* iEngine;                // not owned (singleton)
+
+        // reference to the client (call back reference)
+        MAiwNotifyCallback* iClient;            // not owned
+
+        // The list of file names received as a parameter
+        RPointerArray<TDesC16> iFileNames;      // owned
+
+        // Filename of the file that is played
+        HBufC16* iFileName;                     // owned
+    };
+
+#endif // _UPNP_AIW_PLAY_ON_EXTERNAL_MENU_SERVICE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/inc/upnpaiwprovideruids.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Specifies the interface and DLL UIDs used in the Upnp
+                 Framework's AIW Provider interface.
+*
+*/
+
+
+#ifndef _UPNP_AIW_PROVIDER_UIDS_HRH
+#define _UPNP_AIW_PROVIDER_UIDS_HRH
+
+// The UPnP AIW Provider Interface UID
+#define KUPnPAiwProviderDllUid                 0x10208A15
+
+// The implementation UID(s)
+#define KUPnPAiwEnableExternalMenuServiceUid   0x10208A16
+#define KUPnPAiwCopyToExternalMenuServiceUid   0x10208A17
+#define KUPnPAiwMoveToExternalMenuServiceUid   0x10208A18
+#define KUPnPAiwPlayOnExternalMenuServiceUid   0x10208A19
+#define KUPnPAiwPlayOnExternalBaseServiceUid   0x10208A0C
+#define KUPnPAiwOpenExternalBaseServiceUid     0x10208A0D
+
+#endif // _UPNP_AIW_PROVIDER_UIDS_HRH
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/src/upnpaiwcopytoexternalservice.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,297 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the UpnpAiwCopyToExternalService
+*
+*/
+
+
+#include <AiwCommon.hrh>
+#include <AiwMenu.h>
+#include <aknnotewrappers.h>
+#include <upnpaiwmenuresources.rsg>
+#include "upnpaiwengine.h"
+#include "upnpaiwcopytoexternalservice.h"
+
+_LIT( KComponentLogfile, "upnpaiwprovider.log" );
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KResFileName, "\\resource\\upnpaiwmenuresources.rsc" );
+
+// --------------------------------------------------------------------------
+// CUPnPAiwCopyToExternalService::NewL
+// NewL.
+// --------------------------------------------------------------------------
+CUPnPAiwCopyToExternalService* CUPnPAiwCopyToExternalService::NewL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::NewL" );
+
+    CUPnPAiwCopyToExternalService* self = 
+                    new (ELeave) CUPnPAiwCopyToExternalService;
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwCopyToExternalService::CUPnPAiwMoveToExternalService
+// Constructor.
+// --------------------------------------------------------------------------
+CUPnPAiwCopyToExternalService::CUPnPAiwCopyToExternalService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\
+CUPnPAiwCopyToExternalService" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwCopyToExternalService::~CUPnPAiwCopyToExternalService
+// Destructor.
+// --------------------------------------------------------------------------
+CUPnPAiwCopyToExternalService::~CUPnPAiwCopyToExternalService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\
+~CUPnPAiwCopyToExternalService" );
+
+    // Empty the file name array and close it
+    EmptyFileNameArray();
+    iFileNames.Close();
+
+    // Delete the playlist name (if not yet deleted)
+    delete iPlaylistName;
+
+    // Release the engine instance
+    if( iEngine )
+        {
+        CUPnPAiwEngine::ReleaseInstance();
+        iEngine = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwCopyToExternalService::ConstructL
+// Second phase constructor.
+// --------------------------------------------------------------------------
+void CUPnPAiwCopyToExternalService::ConstructL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\
+ConstructL" );
+
+    // Create the engine and register as an observer for call backs
+    iEngine = CUPnPAiwEngine::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwCopyToExternalService::InitializeMenuPaneL
+// AIW Framework's method for initialising the menu
+// --------------------------------------------------------------------------
+void CUPnPAiwCopyToExternalService::InitializeMenuPaneL( 
+                CAiwMenuPane& aMenuPane,
+                TInt aIndex,
+                TInt /*aCascadeId*/,
+                const CAiwGenericParamList& /*aInParamList*/ )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\
+InitializeMenuPaneL" );
+
+    // Update the drive letter to the path of the resource file name
+    TUPnPEngineState engineState = iEngine->EngineState();
+    if( engineState == EUPnPEngineNotConnected ||
+        engineState == EUPnPEngineConnectionLost )
+        {
+
+        TFileName resFile( KResFileName );
+        TFileName dllName;
+        Dll::FileName( dllName );
+        TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' 
+        resFile.Insert( 0, drive );
+    
+        // Add the play menu item to the menu pane
+        aMenuPane.AddMenuItemsL( resFile,
+                                 R_AIW_COPY_TO_EXTERNAL_MENU,
+                                 KAiwCmdUPnPCopy,
+                                 aIndex );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwCopyToExternalService::HandleMenuCmdL
+// AIW Framework's method for handling menu commands
+// --------------------------------------------------------------------------
+void CUPnPAiwCopyToExternalService::HandleMenuCmdL( 
+                TInt aMenuCmdId,
+                const CAiwGenericParamList& aInParamList,
+                CAiwGenericParamList& aOutParamList,
+                TUint /*aCmdOptions*/,
+                const MAiwNotifyCallback* /*aCallback*/ )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\
+HandleMenuCmdL" );
+
+    // Empty the file name array
+    EmptyFileNameArray();
+
+    // The playlist name (if we are doing a playlist copy)
+    delete iPlaylistName;
+    iPlaylistName = NULL;
+
+    // Get the file name parameters
+    if( aInParamList.Count() > 0 )
+        {
+        for( TInt index = 0; index < aInParamList.Count(); index++ )
+            {
+            // Get the filenames
+            if ( aInParamList[index].SemanticId() == EGenericParamFile )
+                {
+                // Store the file name in the array
+                HBufC* fileName = HBufC::NewLC( 
+                        aInParamList[index].Value().AsDes().Length() );
+                fileName->Des().Append( aInParamList[index].Value().AsDes() );
+                iFileNames.AppendL( fileName );
+                CleanupStack::Pop( fileName );
+                }
+            // Get the playlist name if it is not set already (only the first
+            // playlist name will be used)
+            if( aInParamList[index].SemanticId() == EGenericParamAlbumName &&
+                !iPlaylistName )
+                {
+                iPlaylistName = HBufC::NewL( 
+                        aInParamList[index].Value().AsDes().Length() );
+                iPlaylistName->Des().Append( 
+                        aInParamList[index].Value().AsDes() );
+                }
+            }
+        }
+
+    if( aMenuCmdId == KAiwCmdUPnPCopy )
+        {
+        if( iEngine )
+            {
+            if( iFileNames.Count()>0 )
+                {
+                // Do the copy
+                TInt returnValue = KErrArgument;
+                if( iPlaylistName == NULL )
+                    {
+                    // Normal copy
+                    TRAP( returnValue,
+                          iEngine->CopyToExternalL( iFileNames ) );
+                    }
+                else
+                    {
+                    // Playlist copy
+                    TRAP( returnValue,
+                          iEngine->CopyPlaylistToExternalL(
+                                                    *iPlaylistName,
+                                                    iFileNames ) );
+                    }
+
+                // Do some error translation regarding DRM protected files
+                if ( returnValue == KErrNotSupported ||
+                    returnValue == KErrPermissionDenied )
+                    {
+                    returnValue = KErrAccessDenied;
+                    }
+
+                // Add the return value on the out param list
+                TAiwGenericParam statusParameter( 
+                            EGenericParamError, 
+                            returnValue );
+                aOutParamList.AppendL( statusParameter );
+
+                // Add the files that FAILED to copy to out param list.
+                // finally, reset the array.
+                for( TInt index=0; index<iFileNames.Count(); index++ )
+                    {
+                    if( iFileNames[index] )
+                        {
+                        // Create TAIWGenericParam for the filename
+                        TFileName fileName( *iFileNames[index] );
+                        TAiwGenericParam fileParameter( 
+                                        EGenericParamFile, 
+                                        fileName );
+
+                        // Append the file filename param on the out list
+                        aOutParamList.AppendL( fileParameter );
+                        }
+                    }
+                iFileNames.ResetAndDestroy();
+
+                }
+            else
+                {
+                __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService, \
+no files!" );
+                }
+            }
+        else
+            {
+            __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService, \
+engine is dead!" );
+            }
+        }
+
+    // Clean up
+    delete iPlaylistName;
+    iPlaylistName = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwCopyToExternalService::EmptyFileNameArray
+// Empties the file name array (data member variable).
+// --------------------------------------------------------------------------
+void CUPnPAiwCopyToExternalService::EmptyFileNameArray()
+    {
+    // delete the list of file names and close the file name array
+    for( TInt index=0;index< iFileNames.Count();index++ )
+        {
+        delete iFileNames[index];
+        iFileNames[index] = NULL;
+        }
+    iFileNames.Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwCopyToExternalService::ConnectionLostL
+// Indicates that the connection with the target UPnP device has
+// been lost.
+// --------------------------------------------------------------------------
+void CUPnPAiwCopyToExternalService::ConnectionLostL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\
+ConnectionLostL" );
+
+    // If there is a client that has registered as an observer
+    if( iClient )
+        {
+        // Create parameter lists
+        CAiwGenericParamList* emptyParamlist = CAiwGenericParamList::NewLC();
+
+        TInt eventCode = KAiwEventStopped;
+
+        // Make the call back
+        iClient->HandleNotifyL( KAiwCmdUPnPCopy,
+                                eventCode,
+                                *emptyParamlist,
+                                *emptyParamlist );
+
+        // Clean up
+        CleanupStack::PopAndDestroy( emptyParamlist );
+        emptyParamlist = NULL;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/src/upnpaiwenableexternalservice.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the UpnpAiwEnableExternalService
+*
+*/
+
+
+#include <AiwMenu.h>
+#include <AiwCommon.hrh>
+#include <aknnotewrappers.h>
+#include <upnpaiwmenuresources.rsg>
+#include "upnpaiwengine.h"
+#include "upnpaiwenableexternalservice.h"
+
+_LIT( KComponentLogfile, "upnpaiwprovider.log" );
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KResFileName, "\\resource\\upnpaiwmenuresources.rsc" );
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEnableExternalService::NewL
+// NewL.
+// --------------------------------------------------------------------------
+CUPnPAiwEnableExternalService* CUPnPAiwEnableExternalService::NewL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::NewL" );
+
+    CUPnPAiwEnableExternalService* self = 
+                    new (ELeave) CUPnPAiwEnableExternalService;
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEnableExternalService::CUPnPAiwEnableExternalService
+// Constructor.
+// --------------------------------------------------------------------------
+CUPnPAiwEnableExternalService::CUPnPAiwEnableExternalService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\
+CUPnPAiwEnableExternalService" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEnableExternalService::~CUPnPAiwEnableExternalService
+// Destructor.
+// --------------------------------------------------------------------------
+CUPnPAiwEnableExternalService::~CUPnPAiwEnableExternalService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\
+~CUPnPAiwEnableExternalService" );
+
+    // Release the engine instance
+    if( iEngine )
+        {
+
+        // If the UPnP is enabled, disable it
+        TInt engineState = KErrGeneral;
+        engineState = iEngine->EngineState();
+
+        if( engineState != EUPnPEngineNotConnected )
+            {
+            iEngine->DisableExternal();
+            }
+
+        CUPnPAiwEngine::ReleaseInstance();
+        iEngine = NULL;
+        }
+
+    // Set the client call back reference to NULL
+    iClient = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEnableExternalService::ConstructL
+// Second phase constructor.
+// --------------------------------------------------------------------------
+void CUPnPAiwEnableExternalService::ConstructL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::ConstructL" );
+
+    // Create the engine and register as an observer for call backs
+    iEngine = CUPnPAiwEngine::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEnableExternalService::HandleServiceCmdL
+// AIW Framework's method for handling service commands
+// --------------------------------------------------------------------------
+void CUPnPAiwEnableExternalService::HandleServiceCmdL( 
+                const TInt& aCmdId,
+                const CAiwGenericParamList& /*aInParamList*/,
+                CAiwGenericParamList& aOutParamList,
+                TUint /*aCmdOptions*/,
+                const MAiwNotifyCallback* aCallback )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\
+HandleServiceCmdL" );
+
+    // Cast the aCallback reference to non-const and store the reference
+    iClient = const_cast<MAiwNotifyCallback*>( aCallback );
+
+    if( aCmdId == KAiwCmdUPnPEnableExternal )
+        {
+
+        TInt status = KErrNone;
+
+        if( iEngine )
+            {
+            TInt engineState = KErrGeneral;
+            engineState = iEngine->EngineState();
+
+            if( engineState == EUPnPEngineNotConnected )
+                {
+                TRAP( status, iEngine->EnableExternalL() );
+                }
+            else
+                {
+                iEngine->DisableExternal();
+
+                __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService, \
+send stopped event." );
+                
+                // send STOPPED event
+                CAiwGenericParamList* emptyParamlist =
+                    CAiwGenericParamList::NewLC();
+                if( iClient )
+                    {
+                iClient->HandleNotifyL( KAiwCmdUPnPPlay,
+                                        KAiwEventStopped,
+                                        *emptyParamlist,
+                                        *emptyParamlist );
+                    }
+                CleanupStack::PopAndDestroy( emptyParamlist );
+                emptyParamlist = NULL;
+                }
+            }
+        else
+            {
+            status = KErrDied;
+            __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService, \
+engine is dead!" );
+            }
+
+        // Add the return value on the out param list
+        TAiwGenericParam statusParameter( EGenericParamError, status );
+        aOutParamList.AppendL( statusParameter );
+
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEnableExternalService::InitializeMenuPaneL
+// AIW Framework's method for initialising the menu
+// --------------------------------------------------------------------------
+void CUPnPAiwEnableExternalService::InitializeMenuPaneL( 
+                CAiwMenuPane& aMenuPane,
+                TInt aIndex,
+                TInt /*aCascadeId*/,
+                const CAiwGenericParamList& /*aInParamList*/ )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\
+InitializeMenuPaneL" );
+    
+    // Update the drive letter to the path of the resource file name
+    TFileName resFile( KResFileName );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' 
+    resFile.Insert( 0, drive );
+
+    // Select the correct menu resource, depending on the state of Provider
+    if( iEngine )
+        {
+        TUPnPEngineState engineState = iEngine->EngineState();
+        if( engineState == EUPnPEngineNotConnected || 
+            engineState == EUPnPEngineConnectionLost )
+            {
+            aMenuPane.AddMenuItemsL( resFile,
+                                     R_AIW_ENABLE_EXTERNAL_MENU,
+                                     KAiwCmdUPnPEnableExternal,
+                                     aIndex );
+            }
+        else
+            {
+            aMenuPane.AddMenuItemsL( resFile,
+                                     R_AIW_DISABLE_EXTERNAL_MENU,
+                                     KAiwCmdUPnPEnableExternal,
+                                     aIndex );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwEnableExternalService::HandleMenuCmdL
+// AIW Framework's method for handling menu commands
+// --------------------------------------------------------------------------
+void CUPnPAiwEnableExternalService::HandleMenuCmdL( 
+                TInt aMenuCmdId,
+                const CAiwGenericParamList& /*aInParamList*/,
+                CAiwGenericParamList& aOutParamList,
+                TUint /*aCmdOptions*/,
+                const MAiwNotifyCallback* aCallback )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\
+HandleMenuCmdL" );
+
+    // Cast the aCallback reference to non-const and store the reference
+    iClient = const_cast<MAiwNotifyCallback*>( aCallback );
+
+    TInt status = KErrNone;
+
+    if( iEngine )
+        {
+        TInt engineState = iEngine->EngineState();
+
+        if( aMenuCmdId == KAiwCmdUPnPEnableExternal )
+            {
+            if( engineState == EUPnPEngineNotConnected )
+                {
+                TRAP( status, iEngine->EnableExternalL() );
+                }
+            else
+                {
+                iEngine->DisableExternal();
+
+                __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService, \
+send stopped event." );
+
+                // send STOPPED event
+                CAiwGenericParamList* emptyParamlist =
+                    CAiwGenericParamList::NewLC();
+                if( iClient )
+                    {
+                iClient->HandleNotifyL( KAiwCmdUPnPPlay,
+                                        KAiwEventStopped,
+                                        *emptyParamlist,
+                                        *emptyParamlist );
+                    }
+                CleanupStack::PopAndDestroy( emptyParamlist );
+                emptyParamlist = NULL;
+                }
+            }
+        }
+    else
+        {
+        status = KErrDied;
+        __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService, \
+engine is dead!" );
+        }
+
+    // Add the return value on the out param list
+    TAiwGenericParam statusParameter( EGenericParamError, status );
+    aOutParamList.AppendL( statusParameter );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/src/upnpaiwmovetoexternalservice.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the UpnpAiwMoveToExternalService
+*
+*/
+
+
+#include <AiwCommon.hrh>
+#include <AiwMenu.h>
+#include <aknnotewrappers.h>
+#include <upnpaiwmenuresources.rsg>
+#include "upnpaiwengine.h"
+#include "upnpaiwmovetoexternalservice.h"
+#include "upnpdrmfilter.h"
+
+_LIT( KComponentLogfile, "upnpaiwprovider.log" );
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KResFileName, "\\resource\\upnpaiwmenuresources.rsc" );
+
+// --------------------------------------------------------------------------
+// CUPnPAiwMoveToExternalService::NewL
+// NewL.
+// --------------------------------------------------------------------------
+CUPnPAiwMoveToExternalService* CUPnPAiwMoveToExternalService::NewL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::NewL" );
+
+    CUPnPAiwMoveToExternalService* self = 
+                new (ELeave) CUPnPAiwMoveToExternalService;
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwMoveToExternalService::CUPnPAiwMoveToExternalService
+// Constructor.
+// --------------------------------------------------------------------------
+CUPnPAiwMoveToExternalService::CUPnPAiwMoveToExternalService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\
+CUPnPAiwMoveToExternalService" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwMoveToExternalService::~CUPnPAiwMoveToExternalService
+// Destructor.
+// --------------------------------------------------------------------------
+CUPnPAiwMoveToExternalService::~CUPnPAiwMoveToExternalService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\
+~CUPnPAiwMoveToExternalService" );
+
+    // Empty the file name array and close it
+    EmptyFileNameArray();
+    iFileNames.Close();
+
+    // Release the engine instance
+    if( iEngine )
+        {
+        CUPnPAiwEngine::ReleaseInstance();
+        iEngine = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwMoveToExternalService::ConstructL
+// Second phase constructor.
+// --------------------------------------------------------------------------
+void CUPnPAiwMoveToExternalService::ConstructL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::ConstructL" );
+
+    // Create the engine and register as an observer for call backs
+    iEngine = CUPnPAiwEngine::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwMoveToExternalService::InitializeMenuPaneL
+// AIW Framework's method for initialising the menu
+// --------------------------------------------------------------------------
+void CUPnPAiwMoveToExternalService::InitializeMenuPaneL( 
+                CAiwMenuPane& aMenuPane,
+                TInt aIndex,
+                TInt /*aCascadeId*/,
+                const CAiwGenericParamList& /*aInParamList*/ )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\
+InitializeMenuPaneL" );
+
+    TUPnPEngineState engineState = iEngine->EngineState();
+    if( engineState == EUPnPEngineNotConnected ||
+        engineState == EUPnPEngineConnectionLost )
+        {
+        // Update the drive letter to the path of the resource file name
+        TFileName resFile( KResFileName );
+        TFileName dllName;
+        Dll::FileName( dllName );
+        TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' 
+        resFile.Insert( 0, drive );
+    
+        // Add the play menu item to the menu pane
+        aMenuPane.AddMenuItemsL( resFile,
+                                 R_AIW_MOVE_TO_EXTERNAL_MENU,
+                                 KAiwCmdUPnPMove,
+                                 aIndex );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwMoveToExternalService::HandleMenuCmdL
+// AIW Framework's method for handling menu commands
+// --------------------------------------------------------------------------
+void CUPnPAiwMoveToExternalService::HandleMenuCmdL( 
+                TInt aMenuCmdId,
+                const CAiwGenericParamList& aInParamList,
+                CAiwGenericParamList& aOutParamList,
+                TUint /*aCmdOptions*/,
+                const MAiwNotifyCallback* /*aCallback*/ )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\
+HandleMenuCmdL" );
+
+    // Empty the file name array
+    EmptyFileNameArray();
+
+    // Get the file name parameters
+    if( aInParamList.Count() > 0 )
+        {
+        for( TInt index = 0; index < aInParamList.Count(); index++ )
+            {
+            // Get the filenames
+            if ( aInParamList[index].SemanticId() == EGenericParamFile )
+                {
+                // Store the file name in the array
+                HBufC* fileName = HBufC::NewLC( 
+                    aInParamList[index].Value().AsDes().Length() );
+                fileName->Des().Append( 
+                    aInParamList[index].Value().AsDes() );
+                iFileNames.AppendL( fileName );
+                CleanupStack::Pop( fileName );
+                }
+            }
+        }
+
+    if( aMenuCmdId == KAiwCmdUPnPMove )
+        {
+        if( iEngine )
+            {
+            if( iFileNames.Count()>0 )
+                {
+                // Do the move
+                TInt returnValue = KErrArgument;
+                TRAP( returnValue,
+                      iEngine->MoveToExternalL( iFileNames ) );
+
+                // Do some error translation regarding DRM protected files
+                if ( returnValue == KErrNotSupported ||
+                    returnValue == KErrPermissionDenied )
+                    {
+                    returnValue = KErrAccessDenied;
+                    }
+
+                // Add the return value on the out param list
+                TAiwGenericParam statusParameter( 
+                                    EGenericParamError,
+                                    returnValue );
+                aOutParamList.AppendL( statusParameter );
+
+                // Add the files that FAILED to copy to out param list.
+                // finally, reset the array.
+                for( TInt index=0; index<iFileNames.Count(); index++ )
+                    {
+                    if( iFileNames[index] )
+                        {
+                        // Create TAIWGenericParam for the filename
+                        TFileName fileName( *iFileNames[index] );
+                        TAiwGenericParam fileParameter( 
+                                    EGenericParamFile, 
+                                    fileName );
+
+                        // Append the file filename param on the out list
+                        aOutParamList.AppendL( fileParameter );
+                        }
+                    }
+                iFileNames.ResetAndDestroy();
+
+                }
+            else
+                {
+                __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService, \
+no files!" );
+                }
+            }
+        else
+            {
+            __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService, \
+engine is dead!" );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwMoveToExternalService::EmptyFileNameArray
+// Empties the file name array (data member variable).
+// --------------------------------------------------------------------------
+void CUPnPAiwMoveToExternalService::EmptyFileNameArray()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\
+EmptyFileNameArray" );
+
+    // delete the list of file names and close the file name array
+    for( TInt index=0; index<iFileNames.Count(); index++ )
+        {
+        delete iFileNames[index];
+        iFileNames[index] = NULL;
+        }
+    iFileNames.Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwMoveToExternalService::ConnectionLostL
+// Indicates that the connection with the target UPnP device has 
+// been lost.
+// --------------------------------------------------------------------------
+void CUPnPAiwMoveToExternalService::ConnectionLostL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\
+ConnectionLostL" );
+
+    // If there is a client that has registered as an observer
+    if( iClient )
+        {
+        // Create parameter lists
+        CAiwGenericParamList* emptyParamlist = CAiwGenericParamList::NewLC();
+
+        TInt eventCode = KAiwEventStopped;
+
+        // Make the call back
+        iClient->HandleNotifyL( KAiwCmdUPnPMove,
+                                eventCode,
+                                *emptyParamlist,
+                                *emptyParamlist );
+
+        // Clean up
+        CleanupStack::PopAndDestroy( emptyParamlist );
+        emptyParamlist = NULL;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/src/upnpaiwopenexternalservice.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the UpnpAiwOpenExternalService
+*
+*/
+
+
+#include <AiwMenu.h>
+#include <AiwCommon.hrh>
+#include <aknnotewrappers.h>
+#include "upnpaiwengine.h"
+#include "upnpaiwopenexternalservice.h"
+
+_LIT( KComponentLogfile, "upnpaiwprovider.log" );
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUPnPAiwOpenExternalService::NewL
+// NewL.
+// --------------------------------------------------------------------------
+CUPnPAiwOpenExternalService* CUPnPAiwOpenExternalService::NewL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::NewL" );
+
+    CUPnPAiwOpenExternalService* self = 
+                new (ELeave) CUPnPAiwOpenExternalService;
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwOpenExternalService::CUPnPAiwOpenExternalService
+// Constructor.
+// --------------------------------------------------------------------------
+CUPnPAiwOpenExternalService::CUPnPAiwOpenExternalService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\
+CUPnPAiwOpenExternalService" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwOpenExternalService::~CUPnPAiwOpenExternalService
+// Destructor.
+// --------------------------------------------------------------------------
+CUPnPAiwOpenExternalService::~CUPnPAiwOpenExternalService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\
+~CUPnPAiwOpenExternalService" );
+
+    // Release the engine instance
+    if( iEngine )
+        {
+        CUPnPAiwEngine::ReleaseInstance();
+        iEngine = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwOpenExternalService::ConstructL
+// Second phase constructor.
+// --------------------------------------------------------------------------
+void CUPnPAiwOpenExternalService::ConstructL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\
+ConstructL" );
+
+    // Create the engine
+    iEngine = CUPnPAiwEngine::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwOpenExternalService::HandleServiceCmdL
+// AIW Framework's method for handling service commands
+// --------------------------------------------------------------------------
+void CUPnPAiwOpenExternalService::HandleServiceCmdL( 
+                    const TInt& aCmdId,
+                    const CAiwGenericParamList& /*aInParamList*/,
+                    CAiwGenericParamList& aOutParamList,
+                    TUint /*aCmdOptions*/,
+                    const MAiwNotifyCallback* /*aCallback*/ )
+    {
+    // Process the command only if the id matches
+    if( aCmdId == KAiwCmdUPnPOpen )
+        {
+        __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\
+HandleServiceCmdL" );
+ 
+        TInt returnValue = KErrNone;
+
+        if( iEngine )
+            {
+            TRAP( returnValue,
+                  iEngine->OpenExternalMediaL() );
+            }
+        else
+            {
+            returnValue = KErrDied;
+            __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService, \
+engine is dead!" );
+            }
+
+        // Add the return value on the out param list
+        TAiwGenericParam statusParameter( 
+                            EGenericParamError, 
+                            returnValue );
+        aOutParamList.AppendL( statusParameter );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/src/upnpaiwplayonexternalbaseservice.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,339 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the UpnpAiwPlayOnExternalBaseService
+*
+*/
+
+
+#include <AiwMenu.h>
+#include <AiwCommon.hrh>
+#include <aknnotewrappers.h>
+#include "upnpaiwengine.h"
+#include "upnpaiwplayonexternalbaseservice.h"
+#include "upnpdrmfilter.h"
+
+_LIT( KComponentLogfile, "upnpaiwprovider.log" );
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalBaseService::NewL
+// NewL.
+// --------------------------------------------------------------------------
+CUPnPAiwPlayOnExternalBaseService* CUPnPAiwPlayOnExternalBaseService::NewL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::NewL" );
+
+    CUPnPAiwPlayOnExternalBaseService* self = 
+                    new (ELeave) CUPnPAiwPlayOnExternalBaseService;
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalBaseService::CUPnPAiwPlayOnExternalBaseService
+// Constructor.
+// --------------------------------------------------------------------------
+CUPnPAiwPlayOnExternalBaseService::CUPnPAiwPlayOnExternalBaseService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\
+CUPnPAiwPlayOnExternalBaseService" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalBaseService::~CUPnPAiwPlayOnExternalBaseService
+// Destructor.
+// --------------------------------------------------------------------------
+CUPnPAiwPlayOnExternalBaseService::~CUPnPAiwPlayOnExternalBaseService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\
+~CUPnPAiwPlayOnExternalBaseService" );
+
+    // Empty the file name array and close it
+    EmptyFileNameArray();
+    iFileNames.Close();
+
+    // Delete the filename of the file that is played
+    delete iFileName;
+    iFileName = NULL;
+
+    // Set the client call back reference to NULL
+    iClient = NULL;
+
+    // Release the engine instance
+    if( iEngine )
+        {
+        CUPnPAiwEngine::ReleaseInstance();
+        iEngine = NULL;
+        }
+    
+    // Release the DRM filter AO
+    delete iActiveDrmFilter;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalBaseService::ConstructL
+// Second phase constructor.
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalBaseService::ConstructL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\
+ConstructL" );
+
+    // Create the engine and register as an observer for call backs
+    iEngine = CUPnPAiwEngine::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalBaseService::HandleServiceCmdL
+// AIW Framework's method for handling service commands
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalBaseService::HandleServiceCmdL( 
+                                const TInt& aCmdId,
+                                const CAiwGenericParamList& aInParamList,
+                                CAiwGenericParamList& aOutParamList,
+                                TUint /*aCmdOptions*/,
+                                const MAiwNotifyCallback* aCallback )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\
+HandleServiceCmdL" );
+
+    // Cast the aCallback reference to non-const and store the reference
+    iClient = const_cast<MAiwNotifyCallback*>(aCallback);
+
+    // Empty the file name array
+    EmptyFileNameArray();
+
+    // Get the file name parameters
+    if( aInParamList.Count() > 0 )
+        {
+        for( TInt index = 0; index < aInParamList.Count(); index++ )
+            {
+            if ( aInParamList[index].SemanticId() == EGenericParamFile )
+                {
+                // Store the file name in the array
+                HBufC* fileName = HBufC::NewLC(
+                    aInParamList[index].Value().AsDes().Length() );
+                fileName->Des().Append(
+                    aInParamList[index].Value().AsDes() );
+                iFileNames.AppendL( fileName );
+                CleanupStack::Pop( fileName );
+                }
+            }
+        }
+
+    // Process the command only if the command ID matches
+    if( aCmdId == KAiwCmdUPnPPlay )
+        {
+        if( iEngine )
+            {
+            if( iFileNames.Count() == 1 )
+                {
+
+                // Filter out the DRM protected files
+                RPointerArray<TDesC16> drmFiles;
+
+                iActiveDrmFilter = CUpnpDrmFilter::NewL( iFileNames,
+                            drmFiles );
+
+                iActiveDrmFilter->FilterDrmL();
+                
+                TInt returnValue = KErrArgument;
+                if( iFileNames.Count() == 1 )
+                    {
+                    // Delete and reallocate the filename of the file that is 
+                    // going to be played
+                    delete iFileName; iFileName = NULL;
+                    iFileName = iFileNames[0]->AllocL();
+
+                    // Register to observe the Engine call backs and then call
+                    // Play on UPnP AIW Engine
+                    iEngine->SetEngineObserver( this );
+                    TRAP( returnValue, iEngine->PlayL( *iFileNames[0] ) );
+                    }
+
+                // If there were DRM protected files, return code is
+                // KErrAccessDenied
+                if( drmFiles.Count() > 0 )
+                    {
+                    returnValue = KErrAccessDenied;
+                    }
+
+                // Add the return value on the out param list
+                TAiwGenericParam statusParameter( 
+                                    EGenericParamError, 
+                                    returnValue );
+                aOutParamList.AppendL( statusParameter );
+
+                // Add the drm protected files into the outparameter list
+                for( TInt index=0; index<drmFiles.Count(); index++ )
+                    {
+                    if( drmFiles[index] )
+                        {
+                        // Create TAIWGenericParam for the filename
+                        TFileName fileName( *drmFiles[index] );
+                        TAiwGenericParam fileParameter( 
+                                            EGenericParamFile, 
+                                            fileName );
+
+                        // Append the file filename param on the out list
+                        aOutParamList.AppendL( fileParameter );
+
+                        // Clean up
+                        // Delete the file name item from the array
+                        delete drmFiles[index];
+                        drmFiles[index] = NULL;
+                        }
+                    }
+
+                // Clean up the drm files array
+                drmFiles.Reset();
+                drmFiles.Close();
+
+                // In case of play, the file item is not removed from the 
+                // list if the play operation fails, so in this case the list
+                // can be just emptied, no need to append the items on
+                // the outparam list.
+                EmptyFileNameArray();
+                
+                delete iActiveDrmFilter;
+                iActiveDrmFilter = NULL;
+                }
+            else
+                {
+                __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService, \
+invalid number of files!" );
+                }
+            }
+        else
+            {
+            __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService, \
+engine is dead!" );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalBaseService::EmptyFileNameArray
+// Empties the file name array (data member variable).
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalBaseService::EmptyFileNameArray()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\
+HandleServiceCmdL" );
+
+    // delete the list of file names and close the file name array
+    for( TInt index=0; index<iFileNames.Count(); index++ )
+        {
+        delete iFileNames[index];
+        iFileNames[index] = NULL;
+        }
+    iFileNames.Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalBaseService::PlayCompleteL
+// Indicates that the play operation is complete.
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalBaseService::PlayCompleteL( TInt aStatus )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\
+PlayCompleteL" );
+
+    // If there is a client that has registered as an observer
+    if( iClient )
+        {
+        if( iFileName )
+            {
+
+            // Create parameter lists
+            CAiwGenericParamList* eventParamList =
+                                    CAiwGenericParamList::NewLC();
+            CAiwGenericParamList* inParamList = 
+                                    CAiwGenericParamList::NewLC();
+
+            // Create TAIWGenericParam for the filename
+            TFileName fileName( *iFileName );
+            TAiwGenericParam fileParameter( EGenericParamFile, fileName );
+
+            // Append the file filename param on the out list
+            eventParamList->AppendL( fileParameter );
+
+            // Convert the error code into AIW event code
+            TInt eventCode;
+            if( aStatus == KErrNone )
+                {
+                eventCode = KAiwEventCompleted;
+                }
+            else
+                {
+                eventCode = KAiwEventError;
+                }
+
+            // Make the call back
+            iClient->HandleNotifyL( KAiwCmdUPnPPlay,
+                                    eventCode,
+                                    *eventParamList,
+                                    *inParamList );
+
+            // Clean up
+            CleanupStack::PopAndDestroy( inParamList );
+            inParamList = NULL;
+            CleanupStack::PopAndDestroy( eventParamList );
+            eventParamList = NULL;
+            delete iFileName;
+            iFileName = NULL;
+
+            }
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalBaseService::ConnectionLostL
+// Indicates that the connection with the target UPnP device has 
+// been lost.
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalBaseService::ConnectionLostL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\
+ConnectionLostL" );
+   
+    // If there is a client that has registered as an observer
+    if( iClient )
+        {
+        // Create parameter lists
+        CAiwGenericParamList* emptyParamlist = CAiwGenericParamList::NewLC();
+
+        TInt eventCode = KAiwEventStopped;
+
+        // Make the call back
+        iClient->HandleNotifyL( KAiwCmdUPnPPlay,
+                                eventCode,
+                                *emptyParamlist,
+                                *emptyParamlist );
+
+        // Clean up
+        CleanupStack::PopAndDestroy( emptyParamlist );
+        emptyParamlist = NULL;
+        if( iEngine )
+            {
+            iEngine->RemoveEngineObserver();
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/src/upnpaiwplayonexternalmenuservice.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the UpnpAiwPlayOnExternalMenuService
+*
+*/
+
+
+#include <AiwMenu.h>
+#include <AiwCommon.hrh>
+#include <aknnotewrappers.h>
+#include "upnpaiwengine.h"
+#include "upnpaiwplayonexternalmenuservice.h"
+
+_LIT( KComponentLogfile, "upnpaiwprovider.log" );
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalMenuService::NewL
+// NewL.
+// --------------------------------------------------------------------------
+CUPnPAiwPlayOnExternalMenuService* CUPnPAiwPlayOnExternalMenuService::NewL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::NewL" );
+
+    CUPnPAiwPlayOnExternalMenuService* self = 
+        new (ELeave) CUPnPAiwPlayOnExternalMenuService;
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalMenuService::CUPnPAiwPlayOnExternalMenuService
+// Constructor.
+// --------------------------------------------------------------------------
+CUPnPAiwPlayOnExternalMenuService::CUPnPAiwPlayOnExternalMenuService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\
+CUPnPAiwPlayOnExternalMenuService" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalMenuService::~CUPnPAiwPlayOnExternalMenuService
+// Destructor.
+// --------------------------------------------------------------------------
+CUPnPAiwPlayOnExternalMenuService::~CUPnPAiwPlayOnExternalMenuService()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\
+~CUPnPAiwPlayOnExternalMenuService" );
+
+    // Empty the file name array and close it
+    EmptyFileNameArray();
+    iFileNames.Close();
+
+    // Delete the filename of the file that is played
+    delete iFileName;
+    iFileName = NULL;
+
+    // Set the client call back reference to NULL
+    iClient = NULL;
+
+    // Release the engine instance
+    if( iEngine )
+        {
+        CUPnPAiwEngine::ReleaseInstance();
+        iEngine = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalMenuService::ConstructL
+// Second phase constructor.
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalMenuService::ConstructL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\
+ConstructL" );
+
+    // Create the engine and register as an observer for call backs
+    iEngine = CUPnPAiwEngine::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalMenuService::InitializeMenuPaneL
+// AIW Framework's method for initialising the menu
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalMenuService::InitializeMenuPaneL(
+                              CAiwMenuPane& /*aMenuPane*/,
+                              TInt /*aIndex*/,
+                              TInt /*aCascadeId*/,
+                              const CAiwGenericParamList& /*aInParamList*/ )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\
+InitializeMenuPaneL" );
+
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService, \
+supported anymore (after Upnp Fw 2.0)!" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalMenuService::HandleMenuCmdL
+// AIW Framework's method for handling menu commands
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalMenuService::HandleMenuCmdL( 
+                            TInt /*aMenuCmdId*/,
+                            const CAiwGenericParamList& /*aInParamList*/,
+                            CAiwGenericParamList& /*aOutParamList*/,
+                            TUint /*aCmdOptions*/,
+                            const MAiwNotifyCallback* /*aCallback*/ )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\
+HandleMenuCmdL" );
+
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService, \
+supported anymore (after Upnp Fw 2.0)!" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalMenuService::EmptyFileNameArray
+// Empties the file name array (data member variable).
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalMenuService::EmptyFileNameArray()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\
+EmptyFileNameArray" );
+
+    // delete the list of file names and close the file name array
+    for( TInt index=0; index<iFileNames.Count(); index++ )
+        {
+        delete iFileNames[index];
+        iFileNames[index] = NULL;
+        }
+    iFileNames.Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalMenuService::PlayCompleteL
+// Indicates that the play operation is complete.
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalMenuService::PlayCompleteL( TInt aStatus )
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\
+PlayCompleteL" );
+
+    // If there is a client that has registered as an observer
+    if( iClient )
+        {
+        if( iFileName )
+            {
+
+            // Create parameter lists
+            CAiwGenericParamList* eventParamList =
+                                    CAiwGenericParamList::NewLC();
+            CAiwGenericParamList* inParamList = 
+                                    CAiwGenericParamList::NewLC();
+
+
+            // Create TAIWGenericParam for the filename
+            TFileName fileName( *iFileName );
+            TAiwGenericParam fileParameter( EGenericParamFile, fileName );
+
+            // Append the file filename param on the out list
+            eventParamList->AppendL( fileParameter );
+
+            // Convert the error code into AIW event code
+            TInt eventCode;
+            if( aStatus == KErrNone )
+                {
+                eventCode = KAiwEventCompleted;
+                }
+            else
+                {
+                eventCode = KAiwEventError;
+                }
+
+            // Make the call back
+            iClient->HandleNotifyL( KAiwCmdUPnPPlay,
+                                    eventCode,
+                                    *eventParamList,
+                                    *inParamList );
+
+            // Clean up
+            CleanupStack::PopAndDestroy( inParamList );
+            inParamList = NULL;
+            CleanupStack::PopAndDestroy( eventParamList );
+            eventParamList = NULL;
+            delete iFileName;
+            iFileName = NULL;
+
+            // Stop observing the AIW Engine
+            if( iEngine )
+                {
+                iEngine->RemoveEngineObserver();
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAiwPlayOnExternalMenuService::ConnectionLostL
+// Indicates that the connection with the target UPnP device has 
+// been lost.
+// --------------------------------------------------------------------------
+void CUPnPAiwPlayOnExternalMenuService::ConnectionLostL()
+    {
+    __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\
+ConnectionLostL" );
+
+    // If there is a client that has registered as an observer
+    if( iClient )
+        {
+        // Create parameter lists
+        CAiwGenericParamList* emptyParamlist = CAiwGenericParamList::NewLC();
+
+        TInt eventCode = KAiwEventStopped;
+
+        // Make the call back
+        iClient->HandleNotifyL( KAiwCmdUPnPPlay,
+                                eventCode,
+                                *emptyParamlist,
+                                *emptyParamlist );
+
+        // Clean up
+        CleanupStack::PopAndDestroy( emptyParamlist );
+        emptyParamlist = NULL;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpaiwprovider/src/upnpaiwprovider.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the UpnpAiwProvider.
+*
+*/
+
+
+#include <ecom/implementationproxy.h>
+#include "upnpaiwprovideruids.hrh"
+#include "upnpaiwenableexternalservice.h"
+#include "upnpaiwcopytoexternalservice.h"
+#include "upnpaiwmovetoexternalservice.h"
+#include "upnpaiwplayonexternalbaseservice.h"
+#include "upnpaiwplayonexternalmenuservice.h"
+#include "upnpaiwopenexternalservice.h"
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwEnableExternalMenuServiceUid,
+                               CUPnPAiwEnableExternalService::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwCopyToExternalMenuServiceUid,
+                               CUPnPAiwCopyToExternalService::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwMoveToExternalMenuServiceUid,
+                               CUPnPAiwMoveToExternalService::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwPlayOnExternalMenuServiceUid,
+                               CUPnPAiwPlayOnExternalMenuService::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwPlayOnExternalBaseServiceUid,
+                               CUPnPAiwPlayOnExternalBaseService::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwOpenExternalBaseServiceUid,
+                               CUPnPAiwOpenExternalService::NewL)
+    };
+
+// --------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// --------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+                                        TInt& aTableCount )
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/bwins/upnpcommandu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,24 @@
+EXPORTS
+	?BrowseHomeNetworkL@CUpnpBrowseCommand@@QAEXXZ @ 1 NONAME ; void CUpnpBrowseCommand::BrowseHomeNetworkL(void)
+	?CopyFilesL@CUpnpCopyCommand@@QAEXPAVCDesC16ArrayFlat@@@Z @ 2 NONAME ; void CUpnpCopyCommand::CopyFilesL(class CDesC16ArrayFlat *)
+	?CopyPlaylistL@CUpnpCopyCommand@@QAEXABVTDesC16@@PAVCDesC16ArrayFlat@@@Z @ 3 NONAME ; void CUpnpCopyCommand::CopyPlaylistL(class TDesC16 const &, class CDesC16ArrayFlat *)
+	?IsAvailableL@CUpnpBrowseCommand@@SAHXZ @ 4 NONAME ; int CUpnpBrowseCommand::IsAvailableL(void)
+	?IsAvailableL@CUpnpCopyCommand@@SAHXZ @ 5 NONAME ; int CUpnpCopyCommand::IsAvailableL(void)
+	?IsAvailableL@CUpnpMoveCommand@@SAHXZ @ 6 NONAME ; int CUpnpMoveCommand::IsAvailableL(void)
+	?IsAvailableL@CUpnpRunSetupCommand@@SAHXZ @ 7 NONAME ; int CUpnpRunSetupCommand::IsAvailableL(void)
+	?IsAvailableL@CUpnpShowCommand@@SAHXZ @ 8 NONAME ; int CUpnpShowCommand::IsAvailableL(void)
+	?MoveFilesL@CUpnpMoveCommand@@QAEXPAVCDesC16ArrayFlat@@@Z @ 9 NONAME ; void CUpnpMoveCommand::MoveFilesL(class CDesC16ArrayFlat *)
+	?NewL@CUpnpBrowseCommand@@SAPAV1@XZ @ 10 NONAME ; class CUpnpBrowseCommand * CUpnpBrowseCommand::NewL(void)
+	?UpnpCommandReserved1@@YAXXZ @ 11 NONAME ; void UpnpCommandReserved1(void)
+	?UpnpCommandReserved2@@YAXXZ @ 12 NONAME ; void UpnpCommandReserved2(void)
+	?NewL@CUpnpCopyCommand@@SAPAV1@XZ @ 13 NONAME ; class CUpnpCopyCommand * CUpnpCopyCommand::NewL(void)
+	?NewL@CUpnpMoveCommand@@SAPAV1@XZ @ 14 NONAME ; class CUpnpMoveCommand * CUpnpMoveCommand::NewL(void)
+	?NewL@CUpnpRunSetupCommand@@SAPAV1@XZ @ 15 NONAME ; class CUpnpRunSetupCommand * CUpnpRunSetupCommand::NewL(void)
+	?NewL@CUpnpShowCommand@@SAPAV1@PAVMUpnpCommandObserver@@@Z @ 16 NONAME ; class CUpnpShowCommand * CUpnpShowCommand::NewL(class MUpnpCommandObserver *)
+	?NewL@CUpnpShowCommand@@SAPAV1@XZ @ 17 NONAME ; class CUpnpShowCommand * CUpnpShowCommand::NewL(void)
+	?RunSetupL@CUpnpRunSetupCommand@@QAEXXZ @ 18 NONAME ; void CUpnpRunSetupCommand::RunSetupL(void)
+	?ShowImageL@CUpnpShowCommand@@QAEXABVTDesC16@@@Z @ 19 NONAME ; void CUpnpShowCommand::ShowImageL(class TDesC16 const &)
+	?ShowVideoL@CUpnpShowCommand@@QAEXABVTDesC16@@@Z @ 20 NONAME ; void CUpnpShowCommand::ShowVideoL(class TDesC16 const &)
+	?StartShowingL@CUpnpShowCommand@@QAEXXZ @ 21 NONAME ; void CUpnpShowCommand::StartShowingL(void)
+	?StopShowingL@CUpnpShowCommand@@QAEXXZ @ 22 NONAME ; void CUpnpShowCommand::StopShowingL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/data/200075DB.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project UpnpCommand component
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include "upnpcommanduids.hrh"
+
+// RESOURCE DEFINITIONS
+
+// ---------------------------------------------------------------------------
+// theInfo
+// ECom interface definition for the UpnpCommand API.
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = KUpnpCommandPluginDllUid;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KUpnpCommandPluginIfUid;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUpnpCommandPluginImplementationUid;
+                    version_no = 2;
+                    display_name       = "UpnpCommand plugin";
+                    default_data       = "UpnpCommand";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/data/upnpcommandresources.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project UpnpCommand
+*
+*/
+
+
+NAME UPCR
+
+// INCLUDES
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <eikon.rh>
+#include <upnpframework.loc>
+#include "upnpcommand.rh"
+
+// RESOURCE IDENTIFIERS
+
+RESOURCE RSS_SIGNATURE { }
+RESOURCE TBUF { buf=""; }
+
+// --------------------------------------------------------------------------
+// r_command_drm_file_text
+// "Skipping DRM protected files." - note
+// Used to indicate that DRM protected files will be skipped.
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_command_drm_file_text
+    { 
+    buf = qtn_iupnp_drm_file_text;
+    }
+
+// --------------------------------------------------------------------------
+// r_command_err_rendering_failed_unknown_text
+// "Playback failed on the remote device for unknown error. Try again" - note
+// General error when playing from local to remote
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_command_err_rendering_failed_unknown_text
+    { 
+    buf = qtn_iupnp_err_rendering_failed_unknown;
+    }
+
+// --------------------------------------------------------------------------
+// r_command_connecting_wait_note
+// A wait note shown when preparing media to be shown on home network
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_command_connecting_wait_note
+    {
+    flags = EAknWaitNoteFlags | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EUPnPBrowseDialogProgressNote;
+            control = AVKON_NOTE
+                {
+                layout         = EWaitLayout;
+                singular_label = qtn_iupnp_command_connecting;
+                imageid        = EMbmAvkonQgn_note_progress;
+                imagemask      = EMbmAvkonQgn_note_progress_mask;
+                animation      = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+// r_command_info_copy_ext_one_text
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_command_info_copy_ext_one_text
+    {
+    buf = qtn_iupnp_info_copy_ext_one;
+    }
+
+
+// --------------------------------------------------------------------------
+// r_command_info_copy_ext_many_text
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_command_info_copy_ext_many_text
+    {
+    buf = qtn_iupnp_info_copy_ext_many;
+    }
+
+// --------------------------------------------------------------------------
+// r_command_info_move_ext_one_text
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_command_info_move_ext_one_text
+    {
+    buf = qtn_iupnp_info_move_ext_one;
+    }
+
+
+// --------------------------------------------------------------------------
+// r_command_info_move_ext_many_text
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_command_info_move_ext_many_text
+    {
+    buf = qtn_iupnp_info_move_ext_many;
+    }
+
+// --------------------------------------------------------------------------
+// r_command_err_general_failure_text
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_command_err_general_failure_text
+    {
+    buf = qtn_iupnp_err_general_failure;
+    }
+
+// --------------------------------------------------------------------------
+// r_command_err_conn_lost_copy_text
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_command_err_conn_lost_copy_text
+    {
+    buf = qtn_iupnp_err_conn_lost_copy;
+    }
+
+// --------------------------------------------------------------------------
+// r_command_err_conn_lost_move_text
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_command_err_conn_lost_move_text
+    {
+    buf = qtn_iupnp_err_conn_lost;
+    }
+
+// --------------------------------------------------------------------------
+// r_command_err_con_failed_text
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_command_err_con_failed_text
+    {
+    buf = qtn_iupnp_err_con_failed;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/eabi/upnpcommandu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+EXPORTS
+	_Z20UpnpCommandReserved1v @ 1 NONAME
+	_Z20UpnpCommandReserved2v @ 2 NONAME
+	_ZN16CUpnpCopyCommand10CopyFilesLEP16CDesC16ArrayFlat @ 3 NONAME
+	_ZN16CUpnpCopyCommand12IsAvailableLEv @ 4 NONAME
+	_ZN16CUpnpCopyCommand13CopyPlaylistLERK7TDesC16P16CDesC16ArrayFlat @ 5 NONAME
+	_ZN16CUpnpCopyCommand4NewLEv @ 6 NONAME
+	_ZN16CUpnpMoveCommand10MoveFilesLEP16CDesC16ArrayFlat @ 7 NONAME
+	_ZN16CUpnpMoveCommand12IsAvailableLEv @ 8 NONAME
+	_ZN16CUpnpMoveCommand4NewLEv @ 9 NONAME
+	_ZN16CUpnpShowCommand10ShowImageLERK7TDesC16 @ 10 NONAME
+	_ZN16CUpnpShowCommand10ShowVideoLERK7TDesC16 @ 11 NONAME
+	_ZN16CUpnpShowCommand12IsAvailableLEv @ 12 NONAME
+	_ZN16CUpnpShowCommand12StopShowingLEv @ 13 NONAME
+	_ZN16CUpnpShowCommand13StartShowingLEv @ 14 NONAME
+	_ZN16CUpnpShowCommand4NewLEP20MUpnpCommandObserver @ 15 NONAME
+	_ZN16CUpnpShowCommand4NewLEv @ 16 NONAME
+	_ZN18CUpnpBrowseCommand12IsAvailableLEv @ 17 NONAME
+	_ZN18CUpnpBrowseCommand18BrowseHomeNetworkLEv @ 18 NONAME
+	_ZN18CUpnpBrowseCommand4NewLEv @ 19 NONAME
+	_ZN20CUpnpRunSetupCommand12IsAvailableLEv @ 20 NONAME
+	_ZN20CUpnpRunSetupCommand4NewLEv @ 21 NONAME
+	_ZN20CUpnpRunSetupCommand9RunSetupLEv @ 22 NONAME
+	_ZTI16CUpnpCopyCommand @ 23 NONAME ; #<TI>#
+	_ZTI16CUpnpMoveCommand @ 24 NONAME ; #<TI>#
+	_ZTI16CUpnpShowCommand @ 25 NONAME ; #<TI>#
+	_ZTI18CUpnpBrowseCommand @ 26 NONAME ; #<TI>#
+	_ZTI20CUpnpRunSetupCommand @ 27 NONAME ; #<TI>#
+	_ZTV16CUpnpCopyCommand @ 28 NONAME ; #<VT>#
+	_ZTV16CUpnpMoveCommand @ 29 NONAME ; #<VT>#
+	_ZTV16CUpnpShowCommand @ 30 NONAME ; #<VT>#
+	_ZTV18CUpnpBrowseCommand @ 31 NONAME ; #<VT>#
+	_ZTV20CUpnpRunSetupCommand @ 32 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project UpnpCommand component
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+    // both the command interface and the interface implementation
+    #ifdef FF_UPNP_FRAMEWORK_2_0  // UPnP feature flag
+    upnpcommandplugin.mmp
+    #endif // FF_UPNP_FRAMEWORK_2_0
+    upnpcommand.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/group/upnpcommand.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project UpnpCommand component
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+#include "../inc/upnpcommanduids.hrh"
+
+// Build target
+TARGET          upnpcommand.dll
+TARGETTYPE      DLL
+UID             0x1000008d KUpnpCommandDllUid
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+// Source files
+SOURCEPATH      ../src
+SOURCE          upnpcommandmain.cpp
+SOURCE          upnpbrowsecommand.cpp
+SOURCE          upnpcopycommand.cpp
+SOURCE          upnpmovecommand.cpp
+SOURCE          upnpshowcommand.cpp
+SOURCE          upnprunsetupcommand.cpp
+SOURCE          upnpcommandcallbackadapter.cpp
+
+// Include directories
+USERINCLUDE     ../data
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// System
+LIBRARY         euser.lib
+LIBRARY         bafl.lib            // BaflUtils
+LIBRARY         ecom.lib
+
+// Logging
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/group/upnpcommandplugin.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project UpnpCommand component
+*
+*/
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+#include "../inc/upnpcommanduids.hrh"
+
+
+// Build target
+TARGET          upnpcommandplugin.dll
+CAPABILITY      CAP_ECOM_PLUGIN
+TARGETTYPE      PLUGIN
+UID             0x10009D8D KUpnpCommandPluginDllUid
+VENDORID        VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+// Build UI resources
+SOURCEPATH      ../data
+START RESOURCE  upnpcommandresources.rss
+HEADER
+TARGET          upnpcommandresources.rsc
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+// Build ECom plugin resources
+START RESOURCE  ../data/200075DB.rss
+TARGET          upnpcommandplugin.rsc
+TARGETPATH      resource/plugins
+END
+
+// Source files
+SOURCEPATH      ../src
+SOURCE          upnpcommandproxy.cpp
+SOURCE          upnpfilepipe.cpp
+SOURCE          upnpnotehandler.cpp
+SOURCE          upnpcommandparameters.cpp
+SOURCE          upnpcommandimplementation.cpp
+SOURCE          upnptask.cpp
+SOURCE          upnpshowtask.cpp
+SOURCE          upnpcopytask.cpp
+SOURCE          upnpmovetask.cpp
+SOURCE          upnpbrowsetask.cpp
+SOURCE          upnprunsetuptask.cpp
+SOURCE          upnpfiletransferbasetask.cpp
+SOURCE          upnptaskresourceallocator.cpp
+SOURCE          upnpimagerenderingengine.cpp
+
+// Include directories
+USERINCLUDE     ../data
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../../upnputilities/inc
+
+MW_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+// Core
+LIBRARY         euser.lib
+LIBRARY         bafl.lib            // BaflUtils
+LIBRARY         cone.lib            // CCoeEnv
+LIBRARY         centralrepository.lib // CRepository
+
+// Dialogs
+LIBRARY         avkon.lib
+
+// StringLoader
+LIBRARY         CommonEngine.lib
+
+// ECom
+LIBRARY         ecom.lib
+
+// Logging
+DEBUGLIBRARY    flogger.lib
+
+// Char conversion
+LIBRARY         charconv.lib
+
+// Upnp Framework
+LIBRARY         upnputilities.lib
+LIBRARY         upnpavobjects.lib
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         upnpavcontrollerhelper.lib
+LIBRARY         upnpcommonui.lib
+LIBRARY         upnpfiletransferengine.lib
+LIBRARY         upnpappwizard.lib
+LIBRARY         upnpapplicationengine.lib
+LIBRARY         upnpsettingsengine.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/loadupnpcommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  helper function for loading CUpnpCommand plugin
+*
+*/
+
+
+#include <e32base.h>
+#include <ecom/ecom.h>          // REComSession
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include "upnpcommand.h"
+
+/**
+ * -------------------------------------------------------------------------
+ * LoadUpnpCommandL
+ * A helper inline function to load the upnp plugin.
+ * The method guarantees the correct instance is loaded in a secure way.
+ * If plugin can not be located, leaves with KErrNotSupported
+ *
+ * @param aCommandId the identity of command to load
+ * @param aCalback callback interface pointer (may be left NULL)
+ * -------------------------------------------------------------------------
+ */
+inline CUpnpCommand* LoadUpnpCommandL(
+    UpnpCommand::TUpnpCommandId aCommandId,
+    MUpnpCommandCallback* aCallback = 0 )
+    {
+    CUpnpCommand* command = NULL;
+
+    // Create resolver parameters to pin point the implementation
+    TEComResolverParams resolverParams;
+    _LIT8( KCommandDataType, "UpnpCommand" );
+    resolverParams.SetDataType( KCommandDataType );
+    resolverParams.SetWildcardMatch( EFalse );
+
+    RImplInfoPtrArray implArray;
+   CleanupResetAndDestroyPushL( implArray );
+
+    // Find implementation for the interface
+    const TUid implIFUid = {0x200075DB};
+    REComSession::ListImplementationsL( implIFUid, implArray );
+    for( TInt i=0; i<implArray.Count() && command==0; ++i )
+        {
+        CImplementationInformation* implInfo = implArray[i];
+
+        if( implInfo->VendorId() == VID_DEFAULT && implInfo->RomBased() )
+            {
+            TAny* impl = REComSession::CreateImplementationL(
+                implIFUid,
+                CUpnpCommand::DtorKeyOffset(),
+                resolverParams );
+
+            // Cast the object to correct type before returning
+            command = REINTERPRET_CAST( CUpnpCommand*, impl );
+
+            // Set the command ID
+            CleanupStack::PushL( command );
+            command->SetCommandIdL( aCommandId );
+            if ( aCallback )
+                {
+                command->SetObserver( aCallback );
+                }
+            CleanupStack::Pop( command );
+            }
+        }
+    CleanupStack::PopAndDestroy(); // empties implArray
+
+    if ( command == 0 )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Return the object
+    return command;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpbrowsetask.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpBrowseTask class.
+*
+*/
+
+
+#ifndef UPNP_BROWSE_TASK_H
+#define UPNP_BROWSE_TASK_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpavsessionobserverbase.h"
+#include "upnpavbrowsingsessionobserver.h"
+#include "upnpavdeviceobserver.h"
+#include "upnptask.h"
+
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+class MUPnPAVController;
+class MUPnPAVBrowsingSession;
+class MUPnPAVSessionBase;
+
+/**
+* This class defines the CUpnpBrowseTask used in UpnpCommand component.
+*
+* @since S60 3.2
+*/
+class CUpnpBrowseTask : public CUpnpTask,
+                        public MUPnPAVDeviceObserver
+    {
+    public: // Methods from CUpnpTask
+
+        /**
+         * Creates a new CUpnpBrowseTask object. Allocates Upnp Fw resources.
+         * Resources will be released when the task is destroyed.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpBrowseTask, casted to type CUpnpTask
+         */
+        static CUpnpTask* NewL();
+
+        /**
+         * Allocates the Upnp Fw resources.
+         *
+         * @since S60 3.2
+         */
+        void AllocateResourcesL();
+
+        /**
+         * Executes the task.
+         *
+         * @since S60 3.2
+         */
+        void ExecuteL();
+
+    public: // Call back methods of MUPnPAVDeviceObserver
+
+        /* Not used */
+        void UPnPDeviceDiscovered( const CUpnpAVDevice& /*aDevice*/ ) {}
+        void UPnPDeviceDisappeared( const CUpnpAVDevice& /*aDevice*/ ) {}
+
+        /**
+         * Notifies that the WLAN connection has been lost. All sessions
+         * are now usable and must be closed.
+         *
+         * @since Series 60 3.1
+         * @return None
+         */
+        void WLANConnectionLost();
+
+    public: // Public destructor
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpBrowseTask();
+
+    private: // Private construct/destruct methods
+
+        /**
+         * Perform the first phase of two phase construction.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpShowTask, casted to type CUpnpTask
+         */
+        CUpnpBrowseTask();
+
+        /**
+         * Perform the second phase of two phase construction. Reserves the
+         * Upnp Fw resources (they are released when the task is destroyed).
+         */
+        void ConstructL();
+
+    private: // Data members
+
+        /**
+         * Pointer to the UpnpAvController instance. Owned.
+         */
+        MUPnPAVController* iAVController;
+
+    };
+
+#endif // UPNP_BROWSE_TASK_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcommand.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,189 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UpnpCommand plugin interface
+*
+*/
+
+
+#ifndef UPNP_COMMAND_H
+#define UPNP_COMMAND_H
+
+// INCLUDES
+#include <ecom/ecom.h>                       // REComSession
+#include <e32std.h>                     // RLibrary
+#include "upnpcommandcons.h"
+
+// FORWARD DECLARATION
+class MUpnpCommandCallback;
+
+// CONSTANTS
+
+
+// CLASS DEFINITION
+
+/**
+* UpnpCommand ECom plugin interface definition.
+*/
+class CUpnpCommand : public CBase
+    {
+    public: // constructing / destructing
+
+        /**
+         * the DtorKey offset
+         * to pass in REComSession::CreateImplementationL
+         */
+        static inline TInt32 DtorKeyOffset()
+            {
+            return _FOFF( CUpnpCommand, iDtor_ID_Key );
+            }
+
+        /**
+         * Sets the command identity.
+         *
+         * @param aCommandId (UpnpCommand::TUpnpCommandId) the command ID
+         */
+        virtual void SetCommandIdL(
+            UpnpCommand::TUpnpCommandId aCommandId ) = 0;
+
+        /**
+         * Sets the observer.
+         *
+         * @param aCallback The callback interface
+         */
+        virtual void SetObserver( MUpnpCommandCallback* aCallback ) = 0;
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpCommand();
+
+    public: // Method for querying the availablity
+
+        /**
+         * Checks if this command is available for execution.
+         *
+         * @return ETrue if command is available and can be executed
+         */
+        virtual TBool IsAvailableL() = 0;
+
+        /**
+         * Checks if given command is available for execution.
+         *
+         * @param aCommandId (UpnpCommand::TUpnpCommandId) the command ID
+         * @return ETrue if command is available and can be executed
+         */
+        virtual TBool IsAvailableL( UpnpCommand::TUpnpCommandId aCommandId ) = 0;
+
+    public: // Business logic methods
+
+        /**
+         * Allocates the Upnp Framework resources.
+         */
+        virtual void AllocateResourcesL() = 0;
+
+        /**
+         * Releases the Upnp Framework resources. Stops command execution if
+         * it is ongoing.
+         */
+        virtual void ReleaseResources() = 0;
+
+        /**
+         * Executes the command. If Upnp Framework resources are not yet
+         * allocated, they are allocated.
+         */
+        virtual void ExecuteL() = 0;
+
+        /**
+         * Sets a parameter.
+         *
+         * Leaves if the given param type or value is not valid.
+         *
+         * @param aParamType parameter category
+         * @param aParamValue (const TDesC&) parameter value
+         */
+        virtual void SetParameterL(
+                                UpnpCommand::TUpnpParameterType aParamType,
+                                const TDesC& aParamValue ) = 0;
+
+        /**
+         * Returns a parameter, either set by client or returned
+         * as an out parameter after command execution
+         *
+         * @param aParamType (UpnpCommand::TUpnpParameterType)
+         * @return value of the parameter
+         */
+        virtual const TDesC& Parameter(
+            UpnpCommand::TUpnpParameterType aParamType ) = 0;
+
+        /**
+         * Resets all parameter values
+         */
+        virtual void ResetParameters() = 0;
+
+        /**
+         * Pushes one file into the file pipe.
+         *
+         * @param aParamvalue (const TDesC&) parameter value
+         */
+        virtual void PushFileL( const TDesC& aParam ) = 0;
+
+        /**
+         * number of files in the file pipe
+         *
+         * @return number of files in the pipe
+         */
+        virtual TInt FileCount() = 0;
+
+        /**
+         * Returns a file in the file pipe
+         *
+         * @param aIndex index of the file in pipe
+         * @return the file reference
+         */
+        virtual const TDesC& File( TInt aIndex ) = 0;
+
+        /**
+         * Resets files in the file pipe
+         */
+        virtual void ResetFiles() = 0;
+
+        /**
+         * Returns the state of the command
+         *
+         * @return UpnpCommand::TUpnpCommandState the state
+         */
+        virtual UpnpCommand::TUpnpCommandState State() = 0;
+
+    private: // Private data members
+
+        /**
+         * ECom instance identifier key.
+         */
+        TUid iDtor_ID_Key;
+
+    };
+
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+inline CUpnpCommand::~CUpnpCommand()
+    {
+    REComSession::DestroyedImplementation( iDtor_ID_Key );
+    }
+
+#endif // UPNP_COMMAND_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcommand.rh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project UpnpCommand
+*
+*/
+
+
+#ifndef UPNP_COMMAND_RH
+#define UPNP_COMMAND_RH
+
+// --------------------------------------------------------------------------
+// Enumeration for identifying the UpnpCommand UI resources.
+// --------------------------------------------------------------------------
+//
+enum TUpnpCommandResources
+    {
+    EUpnpSharingActivationWaitNote = 1,
+    EUPnPBrowseDialogProgressNote
+    };
+
+#endif // UPNP_COMMAND_RH
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcommandcallback.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UpnpCommand callback API
+*
+*/
+
+
+#ifndef UPNP_COMMAND_CALLBACK_H
+#define UPNP_COMMAND_CALLBACK_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpcommandcons.h"
+
+
+/**
+* UpnpCommand callback interface definition.
+*/
+class MUpnpCommandCallback
+    {
+
+    public:
+
+        /**
+         * Indicates a command execution event occurred.
+         * The event typically indicates command being completed.
+         *
+         * @param aEventType (see upnpcommandcons.h) type of event occurred
+         *     during command execution
+         * @param aStatusCode (TInt) Additional data, meaning of which depends
+         *     on the event type.
+         */
+        virtual void CommandEvent(
+            UpnpCommand::TUpnpCommandEvent aEventType,
+            TInt aStatusCode ) = 0;
+ 
+    };
+
+#endif // UPNP_COMMAND_CALLBACK_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcommandcallbackadapter.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Converts from upnp callback to upnp command observer
+*
+*/
+
+
+#ifndef UPNP_COMMAND_CALLBACK_ADAPTER_H
+#define UPNP_COMMAND_CALLBACK_ADAPTER_H
+
+// INCLUDES
+#include <e32base.h>                // CBase
+#include "upnpcommandcallback.h"    // MUpnpCommandCallback
+
+// FORWARD DECLARATIONS
+class MUpnpCommandObserver;
+
+// CLASS DEFINITION
+NONSHARABLE_CLASS(CUpnpCommandCallbackAdapter)
+    : public CBase
+    , public MUpnpCommandCallback
+    {
+
+    public: // Construction/destruction methods
+
+        /**
+         * Constructor
+         * 
+         */
+        CUpnpCommandCallbackAdapter(
+            MUpnpCommandObserver* aObserver );
+
+        /**
+         * Destructor.
+         *
+         * @since S60 3.2
+         */
+        virtual ~CUpnpCommandCallbackAdapter();
+
+    public: // From MUpnpCommandCallback
+
+       /**
+        * Callback event
+        */
+        void CommandEvent(
+            UpnpCommand::TUpnpCommandEvent aEventType,
+            TInt aStatusCode );
+
+    private:
+
+        // the observer to convert to
+        MUpnpCommandObserver* iObserver;
+
+    };
+
+#endif // UPNP_COMMAND_CALLBACK_ADAPTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcommandcons.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  constants and enumerations used in UpnpCommand API
+*
+*/
+
+
+#ifndef UPNP_COMMAND_CONS_H
+#define UPNP_COMMAND_CONS_H
+
+namespace UpnpCommand
+    {
+
+    // ENUMS
+
+    /**
+     * The command ids
+     */
+    enum TUpnpCommandId
+        {
+        ECommandUndefined = 100,
+        ECommandShow =      101,   // Renders an image or a video file
+        ECommandCopy =      102,   // Copies file(s) or a collection (playlist/album)
+        ECommandMove =      103,   // Moves file(s) or a collection (playlist/album)
+        ECommandBrowse =    104,   // Browses the Upnp home network
+        ECommandSetup =     105,   // Runs the Upnp Fw's setup wizard
+        ECommandLast               // for boundary checking
+        };
+
+    /**
+     * Defines the parameter types used to control command behaviour and to get
+     * parameter output from the command
+     */
+    enum TUpnpParameterType
+        {
+        EParamCollectionName = 201,    // Name of collection (playlist/album)
+        EParamMediaType = 202,         // "m" (music), "i" (image) or "v" (video)
+        EParamDeviceUuid = 203,        // UUID of target device
+        EParamDeviceName = 204         // Name of target device
+        };
+
+    /**
+     * States of UpnpCommand
+     */
+    enum TUpnpCommandState
+        {
+        EStateIdle =      301,     // Upnp Fw resources not allocated
+        EStateAllocated = 302,     // Upnp Fw resources allocated
+        EStateExecuting = 303      // Upnp command execution ongoing
+        };
+
+    /**
+     * Callback event types from UpnpCommand API
+     */
+    enum TUpnpCommandEvent
+        {
+        EEventComplete =  401,  // Indicates that async command has been completed
+        EEventProgress =  402   // Progress event during execution of a command
+        };
+
+    // constant statuses for EEventProgress
+    const TInt KUpnpCommandStatusStartPlayVideo = 6; // video ready to be played
+
+    } // namespace UpnpCommand
+
+#endif // UPNP_COMMAND_CONS_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcommandimplementation.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UpnpCommand plugin implementation.
+*
+*/
+
+
+#ifndef UPNP_COMMAND_IMPLEMENTATION_H
+#define UPNP_COMMAND_IMPLEMENTATION_H
+
+// INCLUDES
+#include "upnpcommandcons.h"
+#include "upnpcommand.h"
+#include "upnptaskhandler.h"
+
+// FORWARD DECLARATIONS
+class CUpnpFilePipe;
+class CUpnpCommandParameters;
+class CUpnpTask;
+class CUpnpNoteHandler;
+class MUpnpCommandCallback;
+
+/**
+* This class provides an easy to use ECom plugin interface to access the
+* features of the Upnp Framework.
+*/
+class CUpnpCommandImplementation : public CUpnpCommand,
+                                   public MUpnpTaskHandler
+    {
+    public: // Instantiation methods
+
+        /**
+         * Creates an instance of UpnpCommand implementation. Upnp Fw
+         * resources are not allowated yet at this point.
+         *
+         * @return instance of this class.
+         */
+        static CUpnpCommandImplementation* NewL();
+
+    public: // Business logic methods, from CUpnpCommand
+
+        /**
+         * Checks if the command is available for execution.
+         */
+        TBool IsAvailableL();
+
+        /**
+         * Checks if given command is available for execution.
+         */
+        TBool IsAvailableL( UpnpCommand::TUpnpCommandId aCommandId );
+
+        /**
+         * Allocates the Upnp Framework resources.
+         */
+        void AllocateResourcesL();
+
+        /**
+         * Releases the Upnp Framework resources. Stops command execution if
+         * it is ongoing.
+         */
+        void ReleaseResources();
+
+        /**
+         * Executes the command. If Upnp Framework resources are not yet
+         * allocated, they are allocated.
+         */
+        void ExecuteL();
+
+        /**
+         * Sets a parameter.
+         *
+         * @param aParamType the parameter category
+         * @param aParamValue value of the parameter
+         */
+        void SetParameterL( UpnpCommand::TUpnpParameterType aParamType,
+                            const TDesC& aParamValue );
+
+        /**
+         * Returns a parameter
+         *
+         * @param aParamType (UpnpCommand::TUpnpParameterType)
+         * @return value of the parameter
+         */
+        const TDesC& Parameter(
+            UpnpCommand::TUpnpParameterType aParamType );
+
+        /**
+         * Resets parameteres.
+         */
+        void ResetParameters();
+
+        /**
+         * Pushes one file into the file pipe.
+         *
+         * @param aFilename (const TDesC&) parameter value
+         */
+        void PushFileL( const TDesC& aFilename );
+
+        /**
+         * number of files in the file pipe
+         *
+         * @return number of files in the pipe
+         */
+        TInt FileCount();
+
+        /**
+         * Returns a file in the file pipe
+         *
+         * @param aIndex index of the file in pipe
+         * @return the file reference
+         */
+        const TDesC& File( TInt aIndex );
+
+        /**
+         * Resets all files in the pipe
+         */
+        void ResetFiles();
+
+        /**
+         * Returns the state of the command.
+         *
+         * @return UpnpCommand::TUpnpCommandState the state
+         */
+        UpnpCommand::TUpnpCommandState State();
+
+    public: // From MUpnpTaskHandler
+
+        /**
+         * Destroys the ongoing task.
+         */
+        void DestroyTask();
+
+    public: // Methods for UpnpCommand internal use, from CUpnpCommand
+
+        /**
+         * Sets the command ID. Leaves with KErrNotSupported if the given
+         * is not supported.
+         *
+         * @param aCommandId (UpnpCommand::TUpnpCommandId) the command ID
+         */
+        void SetCommandIdL( UpnpCommand::TUpnpCommandId aCommandId );
+
+        /**
+         * Sets the observer.
+         *
+         * @param aCallback the callback interface
+         */
+        void SetObserver( MUpnpCommandCallback* aCallback );
+
+    private: // Private construction methods
+
+        /**
+         * Perform the first phase of two phase construction.
+         */
+        CUpnpCommandImplementation();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpCommandImplementation();
+
+        /**
+         * Perform the second phase of two phase construction.
+         */
+        void ConstructL();
+
+    private: // methods for own use
+
+        TBool IsUpnpConfiguredL();
+
+    private: // Data members
+
+        /**
+         * The Id of the command.
+         */
+        UpnpCommand::TUpnpCommandId iCommandId;
+
+        /**
+         * The state of the command.
+         */
+        UpnpCommand::TUpnpCommandState iState;
+
+        /**
+         * Pointer to the file pipe. Owned.
+         */
+        CUpnpFilePipe* iFilePipe;
+
+        /**
+         * Pointer to the command parameters. Owned.
+         */
+        CUpnpCommandParameters* iParameters;
+
+        /**
+         * Pointer to the note handler. Owned.
+         */
+        CUpnpNoteHandler* iNoteHandler;
+
+        /**
+         * Pointer to the command task. Owned.
+         */
+        CUpnpTask* iTask;
+
+        /**
+         * A boolean value indicating the state of the DRM note showing.
+         * The note is shown only once per session.
+         */
+        TBool iDrmNoteShown;
+
+    };
+
+#endif // UPNP_COMMAND_IMPLEMENTATION_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcommandmain.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UpnpCommand helper API main module
+*
+*/
+
+
+#ifndef UPNP_COMMAND_MAIN_H
+#define UPNP_COMMAND_MAIN_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpcommand.h"
+
+// FORWARD DECLARATIONS
+class MUpnpCommandCallback;
+
+// CONSTANTS
+
+// CLASS DEFINITION
+
+/**
+ * Suport class for Upnp command helper API
+ * implementation
+ */
+class UpnpCommandMain
+    {
+    public:
+        /**
+         * Loads upnp command by given ID
+         */
+        static CUpnpCommand* LoadL(
+            UpnpCommand::TUpnpCommandId aCommandId,
+            MUpnpCommandCallback* aCallback = 0 );
+
+    };
+
+// These methods are here to preserve binary compatibility of
+// upnpcommand.dll by keeping the DLL export table ordinals
+// unchanged.
+
+IMPORT_C void UpnpCommandReserved1();
+IMPORT_C void UpnpCommandReserved2();
+
+#endif // UPNP_COMMAND_MAIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcommandparameters.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpCommandParameters class.
+*
+*/
+
+
+#ifndef UPNP_COMMAND_PARAMETERS_H
+#define UPNP_COMMAND_PARAMETERS_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpcommandcons.h"
+
+// FORWARD DECLARATIONS
+class MUpnpCommandCallback;
+
+/**
+* This class works as a storage class, storing parameter values used in
+* UpnpCommand component.
+*/
+class CUpnpCommandParameters : public CBase
+    {
+    public: // Instantiation methods
+
+        /**
+         * Creates an instance of the implementation.
+         *
+         * @return instance of this class.
+         */
+        static CUpnpCommandParameters* NewL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpCommandParameters();
+
+    public: // Business logic methods
+
+        /**
+         * Sets the callback interface
+         */
+        void SetObserver( MUpnpCommandCallback* aCallback );
+
+        /**
+         * The callback interface
+         */
+        MUpnpCommandCallback* Observer();
+
+        /**
+         * Sets a parameter
+         *
+         * @param aParamType the parameter category (see upnpcommandcons.h)
+         * @param aParamValue value to be set for the parameter
+         */
+        void SetL( UpnpCommand::TUpnpParameterType aParamType,
+            const TDesC& aParamValue );
+
+        /**
+         * Returns a parameter
+         *
+         * @param aParamType the parameter category (see upnpcommandcons.h)
+         * @return the parameter value
+         */
+        const TDesC& Get( UpnpCommand::TUpnpParameterType aParamType );
+
+        /**
+         * Clears all parameters
+         */
+        void Reset();
+
+    private: // Private construction methods
+
+        /**
+         * Perform the first phase of two phase construction.
+         */
+        CUpnpCommandParameters();
+
+    private: // Data members
+
+        /**
+         * Stores the collection name parameter. Owned.
+         */
+        HBufC* iCollectionName;
+
+        /**
+         * Pointer to the command callback interface. Not owned.
+         */
+        MUpnpCommandCallback* iCallback;
+
+    };
+
+#endif // UPNP_COMMAND_PARAMETERS_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcommanduids.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Uid constant definitions for UpnpCommand component
+*
+*/
+
+
+#ifndef UPNP_COMMAND_UIDS_HRH
+#define UPNP_COMMAND_UIDS_HRH
+
+// The UpnpCommand API DLL Uid
+#define KUpnpCommandDllUid                        0x20009CA5
+
+// The UpnpCommandPlugin Interface UID
+#define KUpnpCommandPluginDllUid                  0x200075DA
+#define KUpnpCommandPluginIfUid                   0x200075DB
+
+// The UpnpCommandPlugin implementation UID(s)
+#define KUpnpCommandPluginImplementationUid       0x200075DC
+
+#endif // UPNP_COMMAND_UIDS_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpcopytask.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpCopyTask class.
+*
+*/
+
+
+#ifndef UPNP_COPY_TASK_H
+#define UPNP_COPY_TASK_H
+
+// INCLUDES
+// System
+#include <e32base.h>
+// base class
+#include "upnpfiletransferbasetask.h"
+
+// FORWARD DECLARATIONS
+
+
+/**
+* This class defines the CUpnpCopyTask used in UpnpCommand component.
+*
+* @since S60 3.2
+*/
+class CUpnpCopyTask : public CUpnpFileTransferBaseTask
+    {
+    public: // Methods from CUpnpTask
+
+        /**
+         * Creates a new CUpnpCopyTask object. Allocates Upnp Fw resources.
+         * Resources will be released when the task is destroyed.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpCopyTask, casted to type CUpnpTask
+         */
+        static CUpnpTask* NewL();
+
+        /**
+         * Allocates the Upnp Fw resources.
+         *
+         * @since S60 3.2
+         */
+        void AllocateResourcesL();
+
+        /**
+         * Executes the task.
+         *
+         * @since S60 3.2
+         */
+        void ExecuteL();
+
+
+    public: // Public destructor
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpCopyTask();
+
+    private: // Private construct/destruct methods
+
+        /**
+         * Perform the first phase of two phase construction.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpCopyTask, casted to type CUpnpTask
+         */
+        CUpnpCopyTask();
+
+        /**
+         * Perform the second phase of two phase construction. Reserves the
+         * Upnp Fw resources (they are released when the task is destroyed).
+         */
+        void ConstructL();
+
+    };
+
+#endif // UPNP_COPY_TASK_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpfilepipe.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpFilePipe class.
+*
+*/
+
+
+#ifndef UPNP_FILE_PIPE_H
+#define UPNP_FILE_PIPE_H
+
+// INCLUDES
+#include <e32base.h>
+
+/**
+* This class works as a pipe-like storage class.
+*
+* @since S60 3.2
+*/
+class CUpnpFilePipe : public CBase
+    {
+    public: // Instantiation methods
+
+        /**
+         * Creates a new file pipe with unlimited length.
+         *
+         * @since S60 3.2
+         * @return instance of this class.
+         */
+        static CUpnpFilePipe* NewL();
+
+        /**
+         * Creates a new file pipe with a set length. In this case, when the
+         * pipe if full and client tries to push more files into the pipe, 
+         * the newest file in the pipe (the last file pushed into the pipe)
+         * will be replaced.
+         *
+         * @since S60 3.2
+         * @param aMaxSize (TInt) maximum length of the pipe.
+         * @return instance of this class.
+         */
+        static CUpnpFilePipe* NewL( TInt aMaxSize );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpFilePipe();
+
+    public: // Business logic methods
+
+        /**
+         * Pushes one file into the pipe.
+         *
+         * Leaves if the given parameter is not valid.
+         *
+         * @since S60 3.2
+         * @param aParamvalue (const TDesC&) filename
+         */
+        void PushL( const TDesC& aParameter );
+
+        /**
+         * Returns a file from the queue at given index
+         *
+         * @param aIndex the index at queue
+         * @return reference to the file name
+         */
+        const TDesC& FileAt( TInt aIndex );
+
+        /**
+         * Empties the pipe.
+         *
+         * @since S60 3.2
+         */
+        void Reset();
+
+        /**
+         * Returns the count of the items in the pipe.
+         *
+         * @since S60 3.2
+         * @return TInt the item count
+         */
+        TInt Count();
+
+        /**
+         * returns the entire pipe as an array
+         */
+        RPointerArray<TDesC>& AsArray();
+
+    private: // Private business logic methods
+
+        /**
+         * Removes the newest file from the pipe.
+         *
+         * @since S60 3.2
+         */
+        void RemoveNewestFileFromPipe();
+
+    private: // Private construction methods
+
+        /**
+         * Perform the first phase of two phase construction.
+         *
+         * @since S60 3.2
+         * @param aMaxSize (TInt) maximum length of the pipe.
+         */
+        CUpnpFilePipe( TInt aMaxSize );
+
+    private: // Data members
+
+        /**
+         * The array storing the file pipe files (filenames). Owned.
+         */
+        RPointerArray<TDesC>  iValues;
+
+        /**
+         * The maximum size of the pipe. 0 if unlimited.
+         */
+        TInt                    iMaxSize;
+
+    };
+
+#endif // UPNP_FILE_PIPE_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpfiletransferbasetask.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpFileTransferBaseTask class.
+*
+*/
+
+
+#ifndef UPNP_FILETRANSFER_BASE_TASK_H
+#define UPNP_FILETRANSFER_BASE_TASK_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpavbrowsingsessionobserver.h"
+#include "upnptask.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVBrowsingSession;
+class MUPnPAVSessionBase;
+class CUPnPCommonUI;
+class CUpnpTaskResourceAllocator;
+
+
+
+/**
+* This class defines the CUpnpFileTransferBaseTask 
+* used in UpnpCommand component.
+*
+* @since S60 3.2
+*/
+class CUpnpFileTransferBaseTask : public CUpnpTask, 
+                            public MUPnPAVBrowsingSessionObserver
+    {
+    public: // Methods from CUpnpFileTransferBaseTask
+
+        /**
+         * Allocates the Upnp Fw resources.
+         *
+         * @since S60 3.2
+         */
+        void AllocateFileTransferResourcesL( TInt aMode );
+
+        /**
+         * Executes the task.
+         *
+         * @since S60 3.2
+         */
+        void ExecuteFileTransferL( TBool aRemoveFiles, 
+                                TInt& aTransferredFiles);
+        
+        /**
+         * return CUpnpTaskResourceAllocator
+         *
+         * @since S60 3.2
+         */
+        CUpnpTaskResourceAllocator* ResourceAllocator();
+        
+    public: // Methods from CUpnpTask, not used
+    
+        void AllocateResourcesL() {}
+        void ExecuteL() {}
+
+    public: // Public destructor
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpFileTransferBaseTask();
+
+        /**
+         * Perform the first phase of two phase construction.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpFileTransferBaseTask, 
+         * casted to type CUpnpTask
+         */
+        CUpnpFileTransferBaseTask();
+        
+    
+    protected:
+ 
+        /**
+         * Returns connection state
+         */
+        TBool IsWlanActive();
+       
+    private: // Call back methods of MUPnPAVBrowsingSessionObserver
+
+        /* Not used */
+        void BrowseResponse(
+            const TDesC8& /*aBrowseResponse*/,
+            TInt /*aError*/,
+            TInt /*aMatches*/,
+            TInt /*aTotalCount*/,
+            const TDesC8& /*aUpdateId*/
+            ) {}
+        void SearchResponse( 
+            const TDesC8& /*aSearchResponse*/,
+            TInt /*aError*/,
+            TInt /*aMatches*/,
+            TInt /*aTotalCount*/,
+            const TDesC8& /*aUpdateId*/
+            ) {}
+        void SearchCapabilitiesResponse( 
+            TInt /*aError*/,
+            const TDesC8& /*aSearchCapabilities*/ 
+            ) {}
+        void CreateContainerResponse( TInt /*aError*/, 
+            const TDesC8& /*aObjectId*/ ) {}
+        void DeleteObjectResponse( TInt /*aError*/ ) {}  
+        void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){}
+
+        
+        /**
+         * Notifies that the Media Renderer we have a 
+         * session which has disappeared.
+         *
+         * @since S60 3.2
+         */
+        void MediaServerDisappeared(
+            TUPnPDeviceDisconnectedReason aReason ) ;
+    
+
+    private: // Data members
+   
+        /**
+         * Connection state
+         */       
+        enum TConnectionState{
+            EStateConnected = 0,
+            EStateMSLost,
+            EStateWLANLost
+            };
+               
+                        
+        /**
+         * Pointer to the UpnpAvController's browsing session instance. Owned.
+         */
+        MUPnPAVBrowsingSession*             iBrowsingSession;
+        
+        /**
+         * Pointer to the UPnPCommonUI. Owned.
+         */
+        CUPnPCommonUI*                      iCommonUI;
+        
+        /**
+         * The resource allocator. Owned.
+         */
+        CUpnpTaskResourceAllocator*         iResourceAllocator;
+        
+        /**
+         *  Connection state
+         */        
+         TConnectionState                   iState;
+
+    };
+
+#endif // UPNP_FILETRANSFER_BASE_TASK_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpimagerenderingengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Engine for rendering images remotely
+*
+*/
+
+
+#ifndef UPNP_IMAGERENDERINGENGINE_H
+#define UPNP_IMAGERENDERINGENGINE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpavrenderingsessionobserver.h" // base class
+#include "upnpitemresolverobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class MUPnPAVRenderingSession;
+class MUpnpImageRenderingEngineObserver;
+class MUPnPItemResolver;
+class CUPnPPeriodic;
+
+/**
+* This class defines the UpnpShowTask used in UpnpCommand component.
+*
+* @since S60 3.2
+*/
+class CUpnpImageRenderingEngine
+    : public CBase
+    , public MUPnPItemResolverObserver
+    , public MUPnPAVRenderingSessionObserver
+    {
+
+    public: // construction
+
+        /**
+         * static constructor
+         * @param aAVController avcontroller resource
+         * @param aSession the rendering session to work with
+         * @param aObserver the client for this engine
+         */
+        static CUpnpImageRenderingEngine* NewL(
+            MUPnPAVController& aAVController,
+            MUPnPAVRenderingSession& aSession,
+            MUpnpImageRenderingEngineObserver& aObserver);
+
+        /**
+         * destructor
+         */
+        virtual ~CUpnpImageRenderingEngine();
+
+    private: // private part of construction
+
+        /**
+         * constructor
+         */
+        CUpnpImageRenderingEngine(
+            MUPnPAVController& aAVController,
+            MUPnPAVRenderingSession& aSession,
+            MUpnpImageRenderingEngineObserver& aObserver);
+        
+     
+        /**
+         * Second phase constructor
+         */
+        void ConstructL();
+        
+        
+        /**
+         * Cleans up used resources
+         */
+        void Cleanup();
+
+    public: // the interface
+
+        /**
+         * Requests to start rendering. This will cause the engine to query
+         * the media to render using the callback interface.
+         * This method can be called in all states and all conditions
+         * and subsequently very fast. The engine will keep track of
+         * states and indicate errors etc.
+         */
+        void PlayL();
+
+        /**
+         * Requests to stop rendering. This method can be called in all states.
+         */
+        void StopL();
+
+
+    protected: // Call back methods of MUPnPAVRenderingSessionObserver
+
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'set uri' request.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @return None
+         */
+        void SetURIResult( TInt aError );
+
+        /**
+         * UPnP AV Controller calls this method to indicate that the requested
+         * interaction operation (play, stop, etc.) is complete. In other
+         * words, the target rendering device has changed it's state 
+         * accordingly.
+         *
+         * @since Series 60 3.1
+         * @param aError (TInt) error code
+         * @param aOperation (TAVInteractOperation) operation Id
+         */
+        void InteractOperationComplete( TInt aError,
+            TUPnPAVInteractOperation aOperation );
+
+        /**
+         * Notifies that the Media Renderer we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since Series 60 3.1
+         * @param aReason (TUPnPDeviceDisconnectedReason) reason code
+         */
+        void MediaRendererDisappeared(
+            TUPnPDeviceDisconnectedReason aReason );
+
+        // Methods that are not used
+        void VolumeResult(
+                        TInt /*aError*/,
+                        TInt /*aVolumeLevel*/,
+                        TBool /*aActionResponse*/) {}
+        void MuteResult(
+                        TInt /*aError*/,
+                        TBool /*aMute*/,
+                        TBool /*aActionResponse*/ ) {}
+        void PositionInfoResult(
+                        TInt /*aError*/,
+                        const TDesC8& /*aTrackPosition*/,
+                        const TDesC8& /*aTrackLength*/ ) {}
+        void SetNextURIResult(
+                        TInt /*aError*/ ) {}
+            
+        void ReserveLocalMSServicesCompleted( TInt /*aError*/ ) {}
+
+    protected: // Methods from MUPnPItemResolverObserver
+
+        /**
+         * See UpnpAvControllerHelper API for more info.
+         */
+        void ResolveComplete(
+            const MUPnPItemResolver& aResolver, TInt aError );
+
+    public: // methods for the timer
+
+        /**
+         * the timeout callback
+         */
+        static TInt Timer( TAny* aArg );
+
+        /**
+         * handles the timeout internally
+         */
+        void RunTimerL();
+
+        /**
+         * handles errors in the timeout callback body
+         */
+        TInt RunError( TInt );
+        
+         /**
+         * checks if wlan is active
+         */       
+        TBool IsWlanActive();
+        
+    private: // Private methods
+
+        /**
+         * Handles the initiation of rendering (SetUri or video player 
+         * launching).
+         *
+         * @since S60 3.2
+         */
+        void InitiateShowingL();
+
+        /**
+         * Handles the start up of the item resolving.
+         *
+         * @since S60 3.2
+         */
+        void StartResolvingL();
+        
+        
+        /**
+         * Sends an acknowledgement
+		 */
+		void SendRenderAck( TInt aError );
+
+    private: // Data members
+
+        // avcontroller
+        MUPnPAVController&          iAVController;
+    
+        // the rendering session
+        MUPnPAVRenderingSession&    iRenderingSession;
+
+        // The observer interface
+        MUpnpImageRenderingEngineObserver&  iObserver;
+
+        // internal states
+        enum TRenderingState
+            {
+            EIdle = 100,            // doing nothing
+            EResolvingItem,         // resolving (preparing the item to be played)
+            EResolveComplete,       // resolve done succesfully. Starting to play
+            EStopping,              // calling Stop (for previoysly playing item)
+            ESettingUri,            // calling SetAVTransportURI
+            EStartingPlay,          // calling Play
+            EPlaying,               // play OK, just displaying the image :-)
+            EShuttingDown
+            };
+
+        // internal state
+        TRenderingState             iState;
+
+        // current resolver. owned.
+        MUPnPItemResolver*          iCurrentResolver;
+
+        // Buffered next resolver. Owned.
+        MUPnPItemResolver*          iBufferedResolver;
+
+        // flag that indicates a new image is in buffer
+        TBool                       iBufferingNewImage;
+
+		// timer support
+		CUPnPPeriodic*              iTimer;
+		
+		TBool                       iWlanActive;
+
+	};
+
+
+#endif // UPNP_IMAGERENDERINGENGINE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpimagerenderingengineobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  observer for CUpnpImageRenderingEngine
+*
+*/
+
+
+#ifndef UPNP_IMAGERENDERINGENGINEOBSERVER_H
+#define UPNP_IMAGERENDERINGENGINEOBSERVER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpavrenderingsessionobserver.h" // base class
+#include "upnpitemresolverobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+class MUPnPAVController;
+class MUPnPAVRenderingSession;
+class MUPnPAVSessionBase;
+class MUPnPItemResolver;
+class CUPnPCommonUI;
+
+/**
+* Observer interface for image rendering engine.
+*
+* @since S60 3.2
+*/
+class MUpnpImageRenderingEngineObserver
+    {
+    public:
+
+        /**
+         * Requests for media to be rendered.
+         * this method is called soon after calling PlayL().
+         * the client is expected to provide an item resolver prepared with
+         * the media to be played back (but not resolved yet)
+         * ownership is transferred in this transaction.
+         * if client returns NULL playback will fail to KErrCancelled
+         * 
+         * @return the resolver representing media to be played
+         */
+        virtual MUPnPItemResolver* GetMedia() = 0;
+
+        /**
+         * Acknowledge for render request
+         * @param aError any errors that occurred
+         * @param aItem the actual item that is playing, trying to play, or
+         *        NULL if such is not available for some error condition
+		 * @return response error code
+		 *         KErrNone if the engine should carry on working
+		 *         KErrDisconnected if engine should disconnect
+         */
+        virtual TInt RenderAck(
+            TInt aError,
+            const CUpnpItem* aItem ) = 0; 
+
+        /**
+         * Notifies that rendering engine will shut down due to
+         * communication failure.
+         * @param aError the error code (some kind of reason)
+         */
+        virtual void EngineShutdown(
+            TInt aError ) = 0;
+            
+    };
+
+
+#endif // UPNP_IMAGERENDERINGENGINEOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpmovetask.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpMoveTask class.
+*
+*/
+
+
+#ifndef UPNP_MOVE_TASK_H
+#define UPNP_MOVE_TASK_H
+
+// INCLUDES
+// System
+#include <e32base.h>
+// upnpcommand internal
+#include "upnpfiletransferbasetask.h"
+
+/**
+* This class defines the CUpnpMoveTask used in UpnpCommand component.
+*
+* @since S60 3.2
+*/
+class CUpnpMoveTask : public CUpnpFileTransferBaseTask
+    {
+    public: // Methods from CUpnpTask
+
+        /**
+         * Creates a new CUpnpMoveTask object. Allocates Upnp Fw resources.
+         * Resources will be released when the task is destroyed.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpMoveTask, casted to type CUpnpTask
+         */
+        static CUpnpTask* NewL();
+
+        /**
+         * Allocates the Upnp Fw resources.
+         *
+         * @since S60 3.2
+         */
+        void AllocateResourcesL();
+
+
+        /**
+         * Executes the task.
+         *
+         * @since S60 3.2
+         */
+        void ExecuteL();
+
+
+
+    public: // Public destructor
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpMoveTask();
+
+    private: // Private construct/destruct methods
+
+        /**
+         * Perform the first phase of two phase construction.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpMoveTask, casted to type CUpnpTask
+         */
+        CUpnpMoveTask();
+
+        /**
+         * Perform the second phase of two phase construction. Reserves the
+         * Upnp Fw resources (they are released when the task is destroyed).
+         */
+        void ConstructL();
+        
+    };
+
+#endif // UPNP_MOVE_TASK_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpnotehandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpNoteHandler class.
+*
+*/
+
+
+#ifndef UPNP_COMMAND_NOTE_HANDLER_TASK_H
+#define UPNP_COMMAND_NOTE_HANDLER_TASK_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CAknWaitDialog;
+
+/**
+* This class does all UI note handling of UpnpCommand component.
+*
+* @since S60 3.2
+*/
+class CUpnpNoteHandler : public CBase
+    {
+    public: // Construction methods
+
+        /**
+         * Creates a new CUpnpNoteHandler instance.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpNoteHandler
+         */
+        static CUpnpNoteHandler* NewL();
+
+    public: // Business logic methods
+
+        /**
+         * Run the "Connecting" wait note.
+         *
+         * @since Series 60 3.2
+         * @return TInt return value
+         */
+        TInt RunConnectingWaitNote();
+
+        /**
+         * Closes the currently displaying wait note.
+         *
+         * @since Series 60 3.2
+         */
+        void CloseWaitNote();
+
+        /**
+         * Show "DRM protected files not supported." info note.
+         *
+         * @since Series 60 3.2
+         */
+        void ShowDrmNoteL();
+
+        /**
+         * Show "Connection lost." info note.
+         *
+         * @since Series 60 3.2
+         */
+        void ShowConnectionLostNoteL();
+        
+        /**
+         * Show info note when local MS fails to start
+         * 
+         * @since Series 60 3.2
+         */
+        void ShowLocalMSStartErrorNoteL();
+        
+        /**
+         * Show "N File copied." info note.
+         *
+         * @since Series 60 3.2
+         */
+        void ShowCopyInfoNoteL( TInt aCount, const TDesC& aServerName );
+        
+        /**
+         * Show "N Files moved." info note.
+         *
+         * @since Series 60 3.2
+         */
+        void ShowMoveInfoNoteL( TInt aCount, const TDesC& aServerName );
+        
+        /**
+         * Show "Copy failed." info note.
+         *
+         * @since Series 60 3.2
+         */
+        void ShowCopyErrorNoteL();
+        
+        /**
+         * Show "Move failed" info note.
+         *
+         * @since Series 60 3.2
+         */
+        void ShowMoveErrorNoteL();
+
+        /**
+         * Show "Connection lost" info note.
+         *
+         * @since Series 60 3.2
+         */
+        void ShowCopyDisconnectionErrorNoteL();
+        
+        /**
+         * Show "Connection lost" info note.
+         *
+         * @since Series 60 3.2
+         */
+        void ShowMoveDisconnectionErrorNoteL();
+
+        /**
+         * Show "Playback failed" info note.
+         *
+         * @since Series 60 3.2
+         */
+        void ShowPlaybackFailedNoteL();
+
+        /**
+         * Reset iDrmNoteShown
+         *
+         * @since Series 60 3.2
+         */
+        void ResetDrmNoteCount();
+
+    public: // Public destructor
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpNoteHandler();
+        
+    private: // Businnes l
+    
+        /**
+         * Runs general wait note.
+         *
+         * @since Series 60 3.2
+         * @return TInt return value
+         */
+        TInt RunWaitNote( TInt aResource );
+        
+        /**
+         * Show error note
+         *
+         * @since Series 60 3.2
+         */
+        void ShowErrorNoteL( TInt aResource );
+
+        /**
+         * Show info note
+         *
+         * @since Series 60 3.2
+         */
+        void ShowInfoNoteL( const TDesC& aText );
+
+    private: // Private construct/destruct methods
+
+        /**
+         * Perform the first phase of two phase construction.
+         *
+         * @since S60 3.2
+         */
+        CUpnpNoteHandler();
+
+        /**
+         * Perform the second phase of two phase construction. Reserves the
+         * Upnp Fw resources (they are released when the task is destroyed).
+         */
+        void ConstructL();
+        
+    private: // Data members
+    
+        /**
+         * Currently showing wait note. Owned.
+         */
+        CAknWaitDialog* iWaitNote;
+
+        /**
+         * The resource file offset.
+         */
+        TInt iResFileOffset;
+        
+        /**
+         * A boolean value indicating the state of the DRM note showing.
+         * The note is shown only once per session.
+         */
+        TBool iDrmNoteShown;
+
+    };
+
+#endif // UPNP_COMMAND_NOTE_HANDLER_TASK_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnprunsetuptask.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpRunSetupTask class.
+*
+*/
+
+
+#ifndef UPNP_RUN_SETUP_TASK_H
+#define UPNP_RUN_SETUP_TASK_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnptask.h"
+
+/**
+* This class defines the CUpnpRunSetupTask used in UpnpCommand component.
+*
+* @since S60 3.2
+*/
+class CUpnpRunSetupTask : public CUpnpTask
+    {
+    public: // Methods from CUpnpTask
+
+        /**
+         * Creates a new CUpnpRunSetupTask object. Allocates Upnp Fw
+         * resources. Resources will be released when the task is destroyed.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpRunSetupTask, casted to CUpnpTask
+         */
+        static CUpnpTask* NewL();
+
+        /**
+         * Allocates the Upnp Fw resources.
+         *
+         * @since S60 3.2
+         */
+        void AllocateResourcesL();
+
+        /**
+         * Executes the task.
+         *
+         * @since S60 3.2
+         */
+        void ExecuteL();
+
+    public: // Public destructor
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpRunSetupTask();
+
+    private: // Private construct/destruct methods
+
+        /**
+         * Perform the first phase of two phase construction.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpRunSetupTask, casted to CUpnpTask
+         */
+        CUpnpRunSetupTask();
+
+        /**
+         * Perform the second phase of two phase construction. Reserves the
+         * Upnp Fw resources (they are released when the task is destroyed).
+         */
+        void ConstructL();
+
+    };
+
+#endif // UPNP_RUN_SETUP_TASK_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnpshowtask.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpShowTask class.
+*
+*/
+
+
+#ifndef UPNP_SHOW_TASK_H
+#define UPNP_SHOW_TASK_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpresourceselector.h" // a member located here
+#include "upnptask.h" // base class
+#include "upnpimagerenderingengineobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class MUPnPAVRenderingSession;
+class CUPnPCommonUI;
+class CUpnpTaskResourceAllocator;
+class CUpnpImageRenderingEngine;
+
+
+/**
+* This class defines the UpnpShowTask used in UpnpCommand component.
+*
+* @since S60 3.2
+*/
+class CUpnpShowTask : public CUpnpTask,
+                      public MUpnpImageRenderingEngineObserver
+    {
+    public: // Methods from CUpnpTask
+
+        /**
+         * Creates a new UpnpShowTask object. Allocates Upnp Fw resources.
+         * Resources will be released when the task is destroyed.
+         *
+         * @since S60 3.2
+         * @return a new instance of CUpnpShowTask, casted to type CUpnpTask
+         */
+        static CUpnpTask* NewL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpShowTask();
+
+        /**
+         * Allocates the Upnp Fw resources.
+         *
+         * @since S60 3.2
+         */
+        void AllocateResourcesL();
+
+        /**
+         * Executes the task.
+         *
+         * @since S60 3.2
+         */
+        void ExecuteL();
+
+
+    private: // Private construct/destruct methods
+
+        /**
+         * constructor
+         */
+        CUpnpShowTask();
+
+        /**
+         * Perform the second phase of two phase construction. Reserves the
+         * Upnp Fw resources (they are released when the task is destroyed).
+         */
+        void ConstructL();
+        
+        /**
+         * Cleans up used resources
+         */
+        void Cleanup();
+
+    protected: // methods from MUpnpImageRenderingEngineObserver
+
+        MUPnPItemResolver* GetMedia();
+
+        TInt RenderAck(
+            TInt aError,
+            const CUpnpItem* aItem ); 
+
+        void EngineShutdown(
+            TInt aError );
+
+
+    private: // Private methods
+
+        /**
+         * Launches the video player dialog for playing a video file on remote
+         * @param aItem the item to play
+         * @return an error code
+         */
+        TInt PlayVideo( const CUpnpItem& aItem );
+
+
+    private: // Data members
+
+        // Pointer to the UpnpAvController's rendering session.
+        MUPnPAVRenderingSession*            iRenderingSession;
+        
+        // Pointer to the UpnpAvController's rendering session.
+        MUPnPAVRenderingSession*            iVideoRenderingSession;
+
+        // flag for video playing
+        TBool                               iPlayingVideo;
+
+        // Pointer to the UPnPCommonUI;
+        CUPnPCommonUI*                      iCommonUI;
+
+        // Default resource selector. Owned.
+        TUPnPSelectDefaultResource          iSelector;
+
+        // The resource allocator
+        CUpnpTaskResourceAllocator*         iResourceAllocator;
+
+        // the image rendering engine
+        CUpnpImageRenderingEngine*          iRenderingEngine;
+        
+        // flag to show note when image showing failed
+        TBool                               iShowPlaybackFailedNote;
+        
+        };
+
+
+#endif // UPNP_SHOW_TASK_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnptask.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpTask class.
+*
+*/
+
+
+#ifndef UPNP_TASK_H
+#define UPNP_TASK_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpcommandcons.h"
+
+// FORWARD DECLARATIONS
+class CUpnpCommandParameters;
+class CUpnpFilePipe;
+class CUpnpNoteHandler;
+class MUpnpTaskHandler;
+
+
+/**
+* This class defines the UpnpTask base class used in UpnpCommand component.
+*
+* @since S60 3.2
+*/
+class CUpnpTask : public CBase
+    {
+    public: // Methods for constructing
+
+        /**
+         * Destructor
+         *
+         * @since S60 3.2
+         */
+        virtual ~CUpnpTask();
+
+        /**
+         * Default constructor
+         *
+         * @since S60 3.2
+         */
+        CUpnpTask();
+
+    public: // Methods for sub classes to implement
+
+        /**
+         * Allocates the Upnp Fw resources.
+         *
+         * @since S60 3.2
+         */
+        virtual void AllocateResourcesL() = 0;
+
+        /**
+         * Executes the task.
+         *
+         * @since S60 3.2
+         */
+        virtual void ExecuteL() = 0;
+
+    public: // Methods for sub class use
+
+        /**
+         * Notifies the client for a general command event
+         *
+         * @param aEventType see upnpcommandcons.h
+         * @param aStatus (TInt) status related to the event type
+         * @param aKillTask if true, kills the task (typically error condition)
+         */
+        void CommandEvent(
+            UpnpCommand::TUpnpCommandEvent aEventType,
+            TInt aStatus,
+            TBool aKillTask = EFalse );
+
+        /**
+         * Sets the pointer to the task handler. The ownership of the
+         * pointer is not transfered.
+         *
+         * Leaves with KErrArgument, if the provided pointer is invalid.
+         *
+         * @since S60 3.2
+         * @param aTaskHandler (MUpnpTaskHandler*) the pointer to the task
+         *        handler
+         */
+        void SetTaskHandlerL( MUpnpTaskHandler* aTaskHandler );
+
+        /**
+         * Returns the pointer to the task handler. The ownership of the
+         * pointer is not transfered.
+         *
+         * @since S60 3.2
+         * @return (MUpnpTaskHandler*) the pointer to the task handler
+         */
+        MUpnpTaskHandler* TaskHandler();
+
+        /**
+         * Sets the pointer to the command parameters. The ownership of the
+         * pointer is not transfered.
+         *
+         * Leaves with KErrArgument, if the provided pointer is invalid.
+         *
+         * @since S60 3.2
+         * @param aCommandParameters (CUpnpCommandParameters*) the pointer to
+         *        the command parameters
+         */
+        void SetCommandParametersL(
+                            CUpnpCommandParameters* aCommandParameters );
+
+        /**
+         * Returns the pointer to the parameters. The ownership of the
+         * pointer is not transfered.
+         *
+         * @since S60 3.2
+         * @return (CUpnpCommandParameters*) the pointer to the parameters
+         */
+        CUpnpCommandParameters* CommandParameters();
+
+        /**
+         * Sets the pointer to the file pipe. The ownership of the pointer is
+         * not transfered.
+         *
+         * Leaves with KErrArgument, if the provided pointer is invalid.
+         *
+         * @since S60 3.2
+         * @param aFilePipe (CUpnpFilePipe*) the pointer to the file pipe
+         */
+        void SetFilePipeL( CUpnpFilePipe* aFilePipe );
+
+        /**
+         * Returns the pointer to the file pipe. The ownership of the
+         * pointer is not transfered.
+         *
+         * @since S60 3.2
+         * @return (CUpnpFilePipe*) the pointer to the file pipe
+         */
+        CUpnpFilePipe* FilePipe();
+
+        /**
+         * Sets the pointer to the note handler. The ownership of the pointer
+         * is not transfered.
+         *
+         * Leaves with KErrArgument, if the provided pointer is invalid.
+         *
+         * @since S60 3.2
+         * @param aNoteHandler (CUpnpNoteHandler*) the pointer to the note
+         *        handler
+         */
+        void SetNoteHandlerL( CUpnpNoteHandler* aNoteHandler );
+
+        /**
+         * Returns the pointer to the note handler. The ownership of the
+         * pointer is not transfered.
+         *
+         * @since S60 3.2
+         * @return (CUpnpNoteHandler*) the pointer to the note handler
+         */
+        CUpnpNoteHandler* NoteHandler();
+
+
+    private: // Private data members
+
+        /**
+         * Pointer to the class who instantiated the task. Not owned.
+         */
+        MUpnpTaskHandler* iTaskHandler;
+
+        /**
+         * Pointer to the parameters class of the UpnpCommand. Not owned.
+         */
+        CUpnpCommandParameters* iParameters;
+
+        /**
+         * Pointer to the file pipe class of the UpnpCommand. Not owned.
+         */
+        CUpnpFilePipe* iFilePipe;
+
+        /**
+         * Pointer to the note handler class of the UpnpCommand. Not owned.
+         */
+        CUpnpNoteHandler* iNoteHandler;
+        
+    };
+
+#endif // UPNP_TASK_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnptaskhandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the MUpnpTaskHandler interface class.
+*
+*/
+
+
+#ifndef UPNP_TASK_HANDLER_H
+#define UPNP_TASK_HANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+
+/**
+* This class defines the UpnpTaskHandler interface class, that is used in
+* the communication between the UpnpCommandImplementation and UpnpTask 
+* classes.
+*
+* @since S60 3.2
+*/
+class MUpnpTaskHandler
+    {
+    public:
+
+        /**
+         * Destroys the ongoing task.
+         *
+         * @since S60 3.2
+         */
+        virtual void DestroyTask() = 0;
+    };
+
+#endif // UPNP_TASK_HANDLER_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/inc/upnptaskresourceallocator.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,262 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  A class that allocates resources for a task
+*
+*/
+
+
+#ifndef UPNP_TASKRESOURCEALLOCATOR_H
+#define UPNP_TASKRESOURCEALLOCATOR_H
+
+// INCLUDES
+// System
+#include <e32base.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdeviceobserver.h" // base class
+#include "upnpavbrowsingsessionobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class CUPnPCommonUI;
+class CUpnpNoteHandler;
+class MUPnPAVController;
+class CUpnpAVDevice;
+class MUPnPAVBrowsingSession;
+class CUpnpNoteHandler;
+
+/**
+ * A helper class that makes a method async.
+ */
+class CUpnpTaskResourceAllocator
+    : public CAsyncOneShot
+    , public MUPnPAVDeviceObserver
+    , public MUPnPAVBrowsingSessionObserver
+    {
+    public:
+
+        /**
+         * List of upnp resource types available.
+         * These types can be combined by masking.
+         */
+        enum TUpnpResourceTypes
+            {
+            // open AV controller resource
+            EResourceAvController            = 0x0001,
+            // start local mediaserver
+            EResourceLocalMediaServer        = 0x0002,
+            // select an image-capable renderer
+            EResourceSelectImageRenderer     = 0x0100,
+            // select a copy-capable server
+            EResourceSelectCopyServer        = 0x0200,
+            // select a copy-capable server (display move title)
+            EResourceSelectMoveServer        = 0x0400,
+            // a mask, USED ONLY INTERNALLY !!!
+            EResourceSelectDevice            = 0xFF00,
+            };
+
+        /**
+         * static constructor
+         * @param aCommonUI common UI reference to use
+         * @param aNoteHandler note handler reference to use
+         * @param aMode which resources are needed
+         */
+        static CUpnpTaskResourceAllocator* NewL(
+            CUPnPCommonUI& aCommonUI,
+            TInt aMode );
+
+        /**
+         * destructor
+         */
+        virtual ~CUpnpTaskResourceAllocator();
+         
+    private:
+
+        /**
+         * constructor
+         */
+        CUpnpTaskResourceAllocator(
+            CUPnPCommonUI& aCommonUI,
+            TInt aMode );
+
+    public: // the interface
+        
+        /**
+         * Allocates the resources, returns when complete.
+         * A wait note will be displayed during the process.
+         * displays any necessary errors that occur during the process
+         */
+        void AllocateL();
+
+        /**
+         * returns the AVController resource after allocation.
+         * Note: This method panics if EResourceAvController was not set.
+         */
+        MUPnPAVController& AVController();
+
+        /**
+         * returns the selected device
+         * Note: the method panics if neither EResourceSelectRenderer nor
+         * EResourceSelectServer was set.
+         */
+        const CUpnpAVDevice& SelectedDevice();
+        
+        
+         /**
+         * Sets the pointer to the note handler. The ownership of the pointer
+         * is not transfered.
+         *
+         * Leaves with KErrArgument, if the provided pointer is invalid.
+         *
+         * @since S60 3.2
+         * @param aNoteHandler (CUpnpNoteHandler*) the pointer to the note
+         *        handler
+         */
+        void SetNoteHandlerL( CUpnpNoteHandler* aNoteHandler );
+        
+         
+    public: // from CAsyncOneShot
+        
+        /**
+         * Asynchronous execution
+         */
+        void RunL();
+
+        /**
+         * Execution of the error branch
+         */
+        TInt RunError( TInt aError );
+
+    private: // own methods
+
+        /**
+         * cleans up all resources
+         */
+        void Cleanup();
+
+        /**
+         * creates the AVController resource
+         */
+        void StartAvControllerL();
+
+        /**
+         * Starts the local mediaserver
+         */
+        void StartLocalMediaServerL();
+
+
+        /**
+         * shows a device selection popup
+         */
+        void SelectDeviceL();
+
+        /**
+         * sets an asynchronous error code
+         */
+        void SetErrorCode( TInt aError );
+
+    public: // Call back methods of MUPnPAVDeviceObserver
+
+        void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
+
+        void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
+
+        void WLANConnectionLost();
+       
+        
+    public: // Call back methods of MUPnPAVBrowsingSessionObserver
+
+        void BrowseResponse(
+            const TDesC8& aBrowseResponse,
+            TInt aError,
+            TInt aMatches,
+            TInt aTotalCount,
+            const TDesC8& aUpdateId
+            );
+
+        void SearchResponse( 
+            const TDesC8& aSearchResponse,
+            TInt aError,
+            TInt aMatches,
+            TInt aTotalCount,
+            const TDesC8& aUpdateId
+            );
+
+        void SearchCapabilitiesResponse( 
+            TInt aError,
+            const TDesC8& aSearchCapabilities 
+            );
+
+        void CreateContainerResponse( TInt aError, 
+            const TDesC8& aObjectId );
+
+        void DeleteObjectResponse( TInt aError );
+
+        void MediaServerDisappeared(
+            TUPnPDeviceDisconnectedReason aReason );
+
+        void ReserveLocalMSServicesCompleted( TInt aError );
+
+    protected:
+
+        /**
+         * states of the allocator
+         */
+        enum TAllocatorState
+            {
+            EStateIdle = 0, // class constructed, allocation not started yet
+            EStateAllocating, // allocation in progress
+            EStateWaitingForLMS, // rest done,waiting for local media server
+            EStateReady, // allocation succesful
+            EStateError  // allocation failed
+            };
+
+    private:
+
+        // internal state
+        TAllocatorState               iState;
+    
+        // the common UI resource
+        CUPnPCommonUI&                iCommonUI;
+
+        // the note handler
+        CUpnpNoteHandler*             iNoteHandler;
+
+        // resource allocation mode
+        TInt                          iMode;
+
+        // avcontroller resource
+        MUPnPAVController*            iAVController;
+
+        // selected device
+        CUpnpAVDevice*                iSelectedDevice;
+
+        // the mediaserver keepalive browsing session
+        MUPnPAVBrowsingSession*       iMediaServerSession;
+
+        // error occurred in some asynchronous operation
+        TInt                          iErrorCode;
+
+        // flag for local mediaserver start state
+        TBool                         iLocalMSStarted;
+
+        // flag for local mediaserver callback
+        TBool                         iLocalMSSCompleted;
+
+        
+    };
+
+
+#endif // UPNP_TASKRESOURCEALLOCATOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpbrowsecommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpBrowseCommand class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <upnpbrowsecommand.h>          // CUpnpBrowseCommand
+#include "upnpcommand.h"                // CUpnpCommand
+#include "upnpcommandmain.h"            // UpnpCommandMain::LoadL
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseCommand::NewL
+// Creates a new UpnpCommand for Upnp home network browsing purposes.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpBrowseCommand* CUpnpBrowseCommand::NewL()
+    {
+    // Create new CUpnpBrowseCommand instance
+    CUpnpBrowseCommand* self = new (ELeave) CUpnpBrowseCommand();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseCommand::CUpnpBrowseCommand
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUpnpBrowseCommand::CUpnpBrowseCommand()
+    {
+    // No implementation
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseCommand::~CUpnpBrowseCommand
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpBrowseCommand::~CUpnpBrowseCommand()
+    {
+    delete iCommand;
+    iCommand = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseCommand::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpBrowseCommand::ConstructL()
+    {
+    iCommand = UpnpCommandMain::LoadL( UpnpCommand::ECommandBrowse );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseCommand::BrowseHomeNetworkL
+// Allocates Upnp Framework resources, and initiates Upnp home network
+// browsing.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpBrowseCommand::BrowseHomeNetworkL()
+    {
+    // Allocate Upnp Framework resources
+    iCommand->AllocateResourcesL();
+
+    // Execute the command (Synchronous. Will not return until the user
+    // stops browsing)
+    TRAPD( executeError, iCommand->ExecuteL() );
+
+    // Release Upnp Framework resources
+    iCommand->ReleaseResources(); 
+
+    // Leave if operation failed
+    if( executeError != KErrNone )
+        {
+        User::Leave( executeError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseCommand::IsAvailableL
+// Returns the availability information of the command.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpBrowseCommand::IsAvailableL()
+    {
+    // create a temporary plugin instance
+    // then query command availability.
+    TBool available = EFalse;
+    TRAP_IGNORE(
+        CUpnpCommand* temp = UpnpCommandMain::LoadL( UpnpCommand::ECommandBrowse );
+        CleanupStack::PushL( temp );
+        available = temp->IsAvailableL();
+        CleanupStack::PopAndDestroy( temp );
+        );
+    return available;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpbrowsetask.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpBrowseTask class.
+*
+*/
+
+
+// INCLUDE FILES
+// upnpframework / avcontroller api
+#include "upnpavcontrollerfactory.h"    // UPnPAVControllerFactory
+#include "upnpavcontroller.h"           // MUPnPAVController
+
+// upnpframework / commonui api's
+#include "upnpcommonui.h"
+
+// command internal
+#include "upnpfilepipe.h"               // CUpnpFilePipe
+#include "upnpcommandparameters.h"      // CUpnpCommandParameters
+#include "upnptaskhandler.h"            // MUpnpTaskHandler
+#include "upnpnotehandler.h"            // CUpnpNoteHandler
+#include "upnpbrowsetask.h"
+#include "upnpcommand.h"
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseTask::NewL
+// Creates an instance of the implementation.
+// --------------------------------------------------------------------------
+//
+CUpnpTask* CUpnpBrowseTask::NewL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpBrowseTask::NewL" );
+
+    // Create instance
+    CUpnpBrowseTask* self = NULL;
+    self = new (ELeave) CUpnpBrowseTask();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    // Cast the object and return
+    return (CUpnpTask*)self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseTask::CUpnpBrowseTask
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpBrowseTask::CUpnpBrowseTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpBrowseTask::Constructor" );
+
+    // Initialise member variables
+    iAVController = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpBrowseTask::~CUpnpBrowseTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpBrowseTask::Destructor" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseTask::ConstructL
+// Perform the second phase of two phase construction. Reserves the Upnp Fw
+// resources (they are released when the task is destroyed).
+// --------------------------------------------------------------------------
+//
+void CUpnpBrowseTask::ConstructL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpBrowseTask::ConstructL" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseTask::AllocateResourcesL
+// Allocates the Upnp Fw resources.
+// --------------------------------------------------------------------------
+//
+void CUpnpBrowseTask::AllocateResourcesL()
+    {
+     __LOG( "[UpnpCommand]\t CUpnpBrowseTask::AllocateResourcesL" );
+ 
+    // Upnp Fw resources are allocated when the command is executed.
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseTask::ExecuteL
+// Executes the task.
+// --------------------------------------------------------------------------
+//
+void CUpnpBrowseTask::ExecuteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpBrowseTask::ExecuteL" );
+
+    // Leave if the command has been allocated already
+    if( iAVController )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Create UpnpAvControllerClient
+    iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL();
+
+    TInt status = KErrNone;
+    TInt leaveCode = KErrNone;
+
+    // If the improved browse feature is available (introduced in Upnp Fw 2.1)
+    // use it, otherwise use the old browse implementation (UpnpCommonUi).
+    TRAP( leaveCode,
+        CUPnPCommonUI *commonUi = CUPnPCommonUI::NewL();
+        CleanupStack::PushL( commonUi );
+
+        status = commonUi->ExecuteDeviceDialogL( *iAVController );
+
+        // Clean up
+        CleanupStack::PopAndDestroy( commonUi );
+        commonUi = NULL;
+        );
+
+    // Show connection lost info note
+    if( status == KErrDisconnected )
+        {
+        TRAP_IGNORE( NoteHandler()->ShowConnectionLostNoteL() );
+        }
+
+    // Fix UpnpCommonUi return value
+    if( status > 0 )
+        {
+        status = KErrNone;
+        }
+
+    // If UpnpCommonUi leaved, handle the leave code (if necessary)
+    if( status == KErrNone &&
+        leaveCode != KErrNone )
+        {
+        status = leaveCode;
+        }
+
+    // Clean up
+    delete iAVController;
+    iAVController = NULL;
+
+    // If there was an error, leave
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpBrowseTask::WLANConnectionLost
+// Notifies that the WLAN connection has been lost. All sessions are now
+// usable and must be closed.
+// --------------------------------------------------------------------------
+void CUpnpBrowseTask::WLANConnectionLost()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpBrowseTask::WLANConnectionLost" );
+
+    // Inform the client that connection was lost.
+    CommandEvent( UpnpCommand::EEventComplete, KErrDisconnected );
+
+    // Call task handler (UpnpCommandImplementation) to destroy this task
+    if( TaskHandler() )
+        {
+        TaskHandler()->DestroyTask();
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpcommandcallbackadapter.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper for upnp SHOW command
+*
+*/
+
+
+// INCLUDE FILES
+#include <upnpcommandobserver.h>
+#include "upnpcommandcallbackadapter.h"
+
+// --------------------------------------------------------------------------
+// CUpnpCommandCallbackAdapter::CUpnpCommandCallbackAdapter
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUpnpCommandCallbackAdapter::CUpnpCommandCallbackAdapter(
+    MUpnpCommandObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandCallbackAdapter::~CUpnpCommandCallbackAdapter
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpCommandCallbackAdapter::~CUpnpCommandCallbackAdapter()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandCallbackAdapter::CommandEvent
+// Indicates that the command has been completed.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandCallbackAdapter::CommandEvent(
+    UpnpCommand::TUpnpCommandEvent aEventType,
+    TInt aStatusCode )
+    {
+    // If there is an observer, forward the callback
+    if ( iObserver )
+        {
+        if ( aEventType == UpnpCommand::EEventComplete )
+            {
+            iObserver->CommandComplete( aStatusCode );
+            }
+        else if ( aEventType == UpnpCommand::EEventProgress && aStatusCode > 0 )
+            {
+            // Convert progress events to CommandComplete methods of the observer
+            // ONLY if the progress code is a positive value. Therefore it does not
+            // get mixed up with real CommandComplete notifications with either
+            // KErrNone or an error value.
+            iObserver->CommandComplete( aStatusCode );
+            }
+        else
+            {
+            // eat the event
+            }
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpcommandimplementation.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,474 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpCommandImplementation class.
+*
+*/
+
+
+// INCLUDE FILES
+// system
+#include <centralrepository.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpfileutility.h"                    // IsFileProtectedL()
+
+// upnpframework / command api
+#include "upnpcommand.h"                        // CUpnpCommand
+#include "upnpcommandcallback.h"                // MUpnpCommandCallback
+
+// command internal
+#include "upnpcommandimplementation.h"
+#include "upnpfilepipe.h"
+#include "upnpcommandparameters.h"
+#include "upnpnotehandler.h"
+#include "upnpshowtask.h"
+#include "upnpcopytask.h"
+#include "upnpmovetask.h"
+#include "upnpbrowsetask.h"
+#include "upnprunsetuptask.h"
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+// CONSTANTS
+const TUid KCRUidUPnPApplication = {0x20009cae};
+const TUint32 KUPnPAppAccessPointSetting = 0x00000001;
+
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::NewL
+// Creates an instance of the implementation.
+// --------------------------------------------------------------------------
+//
+CUpnpCommandImplementation* CUpnpCommandImplementation::NewL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::NewL" );
+    
+    CUpnpCommandImplementation* self = NULL;
+    self = new (ELeave) CUpnpCommandImplementation();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::CUpnpCommandImplementation
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpCommandImplementation::CUpnpCommandImplementation()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::Constructor" );
+
+    // Set command ID to unknown by default. Client is forced to set this
+    // (inline code in the NewL method of CUpnpCommand interface class).
+    iCommandId = UpnpCommand::ECommandUndefined;
+
+    // By default there is no task
+    iTask = NULL;
+
+    // By default the state is IDLE (resources not allocated nor executing)
+    iState = UpnpCommand::EStateIdle;
+
+    // DRM note will be shown only once
+    iDrmNoteShown = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::ConstructL
+// Second phase construction.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::ConstructL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::ConstructL" );
+
+    iFilePipe = CUpnpFilePipe::NewL();
+    iParameters = CUpnpCommandParameters::NewL();
+    iNoteHandler = CUpnpNoteHandler::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpCommandImplementation::~CUpnpCommandImplementation()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::Destructor" );
+
+    delete iTask;
+    iTask = NULL;
+    delete iFilePipe;
+    iFilePipe = NULL;
+    delete iParameters;
+    iParameters = NULL;
+    delete iNoteHandler;
+    iNoteHandler = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::SetCommandIdL
+// Sets the command ID.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::SetCommandIdL(
+    UpnpCommand::TUpnpCommandId aCommandId )
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpCommandImplementation::SetCommandIdL %d",
+        TInt( aCommandId ) );
+
+    // command ID can only be set ONCE !
+    __ASSERTD( iCommandId == UpnpCommand::ECommandUndefined,
+        __FILE__, __LINE__ );
+    if( iCommandId != UpnpCommand::ECommandUndefined )
+        {
+        User::Leave( KErrServerBusy );
+        }
+
+    iCommandId = aCommandId;
+
+    // If the command is to Show images & video, re-create the file pipe.
+    // In this case we are using a file pipe of a limited size (1)
+    if( iCommandId == UpnpCommand::ECommandShow )
+        {
+        delete iFilePipe;
+        iFilePipe = NULL; // In case the following method leaves
+        iFilePipe = CUpnpFilePipe::NewL( 1 );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::SetObserver
+// Sets the callback interface
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::SetObserver(
+    MUpnpCommandCallback* aCallback )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::SetObserver" );
+
+    // Set the observer
+    iParameters->SetObserver( aCallback );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::IsAvailableL
+// Checks if a command is available for execution
+// --------------------------------------------------------------------------
+//
+TBool CUpnpCommandImplementation::IsAvailableL()
+    {
+    return IsAvailableL( iCommandId );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::IsAvailableL
+// Checks if a command is available for execution
+// --------------------------------------------------------------------------
+//
+TBool CUpnpCommandImplementation::IsAvailableL(
+    UpnpCommand::TUpnpCommandId aCommandId )
+    {
+    switch( aCommandId )
+        {
+        case UpnpCommand::ECommandShow: // flow through
+        case UpnpCommand::ECommandCopy: // flow through
+        case UpnpCommand::ECommandMove: // flow through
+        case UpnpCommand::ECommandBrowse:
+            {
+            // available if upnp is configured
+            return IsUpnpConfiguredL();
+            }
+        case UpnpCommand::ECommandSetup:
+            {
+            // setup is always available
+            return ETrue;
+            }
+        default:
+            __PANICD( __FILE__, __LINE__ );
+        }
+
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::AllocateResourcesL
+// Allocates the Upnp Framework resources.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::AllocateResourcesL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::AllocateResourcesL" );
+
+    // Leave if a task is already going (resources allocated)
+    if( iTask )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    // Instantiate a task according to the command ID
+    if( iCommandId == UpnpCommand::ECommandShow )
+        {
+        iTask = CUpnpShowTask::NewL();
+        }
+    else if( iCommandId == UpnpCommand::ECommandCopy )
+        {
+        iTask = CUpnpCopyTask::NewL();
+        }
+    else if( iCommandId == UpnpCommand::ECommandMove )
+        {
+        iTask = CUpnpMoveTask::NewL();
+        }
+    else if( iCommandId == UpnpCommand::ECommandBrowse )
+        {
+        iTask = CUpnpBrowseTask::NewL();
+        }
+    else if( iCommandId == UpnpCommand::ECommandSetup )
+        {
+        iTask = CUpnpRunSetupTask::NewL();
+        }
+    else
+        {
+        __PANICD( __FILE__, __LINE__ );
+        User::Leave( KErrNotSupported );
+        }
+
+    // Set the pointers for the task (using base class CUpnpTask methods)
+    iTask->SetTaskHandlerL( this );
+    iTask->SetCommandParametersL( iParameters );
+    iTask->SetFilePipeL( iFilePipe );
+    iTask->SetNoteHandlerL( iNoteHandler );
+
+    // Allocate the resources
+    TRAPD( allocateError, iTask->AllocateResourcesL() );
+    
+    // If allocating resources failed, delete the task and forward the
+    // leave code.
+    if( allocateError != KErrNone )
+        {
+        __LOG1( "[UpnpCommand]\t CUpnpCommandImplementation::AllocateResourcesL \
+failed %d", allocateError );
+        // show note only if operation was not cancelled by user
+        if( allocateError != KErrCancel )
+            {
+            TRAP_IGNORE( iNoteHandler->ShowConnectionLostNoteL() );
+            }
+            
+        delete iTask;
+        iTask = NULL;
+        iState = UpnpCommand::EStateIdle;
+        User::Leave( allocateError );
+        }
+
+    // Update the state
+    iState = UpnpCommand::EStateAllocated;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::ReleaseResources
+// Releases the Upnp Framework resources.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::ReleaseResources()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::ReleaseResources" );
+
+    // Destroy the task
+    if( iTask )
+        {
+        delete iTask;
+        iTask = NULL;
+        }
+
+    // Update the state
+    iState = UpnpCommand::EStateIdle;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::ExecuteL
+// Executes the command.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::ExecuteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::ExecuteL" );
+
+    // Allocates Upnp Fw resources if not yet allocated
+    if( !iTask )
+        {
+	    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::ExecuteL task deleted, leave" );
+        User::Leave( KErrNotReady );
+        }
+
+    // Update the state
+    iState = UpnpCommand::EStateExecuting;
+
+    // Execute the task
+    TInt status = KErrNone;
+    TRAP( status, iTask->ExecuteL() );
+
+    // Update the state
+    iState = UpnpCommand::EStateAllocated;
+
+    // If operation failed, leave
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::SetParameterL
+// Set a parameter.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::SetParameterL(
+    UpnpCommand::TUpnpParameterType aParamType,
+    const TDesC& aParamValue )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::SetParameterL" );
+    __ASSERTD( iParameters!=0, __FILE__, __LINE__ );
+
+    iParameters->SetL( aParamType, aParamValue );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::Parameter
+// --------------------------------------------------------------------------
+//
+const TDesC& CUpnpCommandImplementation::Parameter(
+    UpnpCommand::TUpnpParameterType aParamType )
+    {
+    __ASSERTD( iParameters!=0, __FILE__, __LINE__ );
+    return iParameters->Get( aParamType );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::ResetParameters
+// Resets parameteres.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::ResetParameters()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::ResetParameters" );
+
+    // Reset parameters
+    iParameters->Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::PushFileL
+// Pushes one file into the file pipe.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::PushFileL( const TDesC& aFilename )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::PushFileL" );
+        
+    // Push it in the file pipe
+    iFilePipe->PushL( aFilename );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::CountFiles
+// --------------------------------------------------------------------------
+//
+TInt CUpnpCommandImplementation::FileCount()
+    {
+    return iFilePipe->Count();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::File
+// Pops oldest file from the file pipe.
+// --------------------------------------------------------------------------
+//
+const TDesC& CUpnpCommandImplementation::File( TInt aIndex )
+    {
+    return iFilePipe->FileAt( aIndex );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::ResetFiles
+// Resets files.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::ResetFiles()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::ResetFiles" );
+
+    // Reset files
+    iFilePipe->Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::State
+// Returns the state of the command.
+// --------------------------------------------------------------------------
+//
+UpnpCommand::TUpnpCommandState CUpnpCommandImplementation::State()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::State" );
+
+    return iState;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::DestroyTask
+// Destroys the ongoing task.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandImplementation::DestroyTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandImplementation::DestroyTask" );
+
+    // Release resources (delete the ongoing UpnpTask).
+    ReleaseResources();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandImplementation::IsUpnpConfigured
+// --------------------------------------------------------------------------
+//
+TBool CUpnpCommandImplementation::IsUpnpConfiguredL()
+    {
+    TBool returnValue = EFalse;
+    // Access the Upnp Fw central repository key
+    CRepository* repository = NULL;
+    TRAPD( error, repository = CRepository::NewL( KCRUidUPnPApplication ) );
+
+    if ( error == KErrNone )
+        {
+        // Read the IAP setting
+        TInt iapDefined = KErrNotFound;
+        TInt getError = repository->Get( KUPnPAppAccessPointSetting,
+                                         iapDefined );
+    
+        delete repository;
+    
+        // Define the return value (min. valid IAP Id value is 1,
+        // 0=None selected)
+        if( getError == KErrNone &&
+            iapDefined > 0 )
+            {
+            returnValue = ETrue;
+            }
+        }
+    
+    return returnValue;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpcommandmain.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UpnpCommand helper API main module
+*
+*/
+
+
+#include <e32base.h>
+#include "loadupnpcommand.h" // LoadUpnpCommandL inline method
+#include "upnpcommandmain.h" // this class
+
+// These methods are here to preserve binary compatibility of
+// upnpcommand.dll by keeping the DLL export table ordinals
+// unchanged.
+
+
+// METHOD IMPLEMENTATION
+
+CUpnpCommand* UpnpCommandMain::LoadL(
+        UpnpCommand::TUpnpCommandId aCommandId,
+        MUpnpCommandCallback* aCallback )
+    {
+    return LoadUpnpCommandL( aCommandId, aCallback );
+    }
+
+EXPORT_C void UpnpCommandReserved1()
+    {
+    }
+
+EXPORT_C void UpnpCommandReserved2()
+    {
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpcommandparameters.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpCommandParameters class.
+*
+*/
+
+
+// INCLUDE FILES
+// upnpframework / command api
+#include "upnpcommandcallback.h"        // MUpnpCommandCallback
+
+// command internal
+#include "upnpcommandparameters.h"
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUpnpCommandParameters::NewL
+// Creates an instance of the implementation.
+// --------------------------------------------------------------------------
+//
+CUpnpCommandParameters* CUpnpCommandParameters::NewL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandParameters::NewL" );
+
+    return new (ELeave) CUpnpCommandParameters;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandParameters::CUpnpCommandParameters
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpCommandParameters::CUpnpCommandParameters()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandParameters::Constructor" );
+
+    iCollectionName = NULL;
+    iCallback = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpCommandParameters::~CUpnpCommandParameters()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandParameters::Destructor" );
+
+    // Reset the parameters
+    Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandParameters::SetObserver
+// Sets the observer.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandParameters::SetObserver( MUpnpCommandCallback* aCallback )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandParameters::SetObserver" );
+
+    // Parameter check
+    __ASSERTD( aCallback!=0, __FILE__, __LINE__ );
+
+    // Set the variable
+    iCallback = aCallback;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandParameters::Observer
+// Gets the observer.
+// --------------------------------------------------------------------------
+//
+MUpnpCommandCallback* CUpnpCommandParameters::Observer()
+    {
+    return iCallback;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandParameters::SetL
+// Sets a parameter
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandParameters::SetL(
+    UpnpCommand::TUpnpParameterType aParamType,
+    const TDesC& aParamValue )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandParameters::SetL" );
+
+    switch( aParamType )
+        {
+        case UpnpCommand::EParamCollectionName:
+            {
+            // Parameter check
+            if( aParamValue == KNullDesC )
+                {
+                User::Leave( KErrArgument );
+                }
+            // allocation
+            HBufC* newCollectionName = aParamValue.AllocL();
+            delete iCollectionName;
+            iCollectionName = newCollectionName;
+            newCollectionName = NULL;
+            }
+            break;
+        case UpnpCommand::EParamMediaType: // flow through
+        case UpnpCommand::EParamDeviceUuid: // flow through
+        case UpnpCommand::EParamDeviceName:
+            // do nothing
+            break;
+        default:
+            __PANICD( __FILE__, __LINE__ );
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandParameters::Get
+// Returns a parameter by given type
+// --------------------------------------------------------------------------
+//
+const TDesC& CUpnpCommandParameters::Get(
+    UpnpCommand::TUpnpParameterType aParamType )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandParameters::Get" );
+
+    switch( aParamType )
+        {
+        case UpnpCommand::EParamCollectionName:
+            {
+            if( iCollectionName )
+                {
+                return *iCollectionName;
+                }
+            }
+            break;
+        case UpnpCommand::EParamMediaType: // flow through
+        case UpnpCommand::EParamDeviceUuid: // flow through
+        case UpnpCommand::EParamDeviceName:
+            return KNullDesC;
+        default:
+            __PANICD( __FILE__, __LINE__ );
+        }
+
+    return KNullDesC;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCommandParameters::Reset
+// Resets variables.
+// --------------------------------------------------------------------------
+//
+void CUpnpCommandParameters::Reset()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCommandParameters::Reset" );
+
+    // Delete/reset the variables
+    delete iCollectionName;
+    iCollectionName = NULL;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpcommandproxy.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for UpnpCommand ECom plugin proxy.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <ecom/implementationproxy.h>
+#include "upnpcommandimplementation.h"
+#include "upnpcommanduids.hrh"
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KUpnpCommandPluginImplementationUid,
+                                CUpnpCommandImplementation::NewL )
+    };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+                                         TInt& aTableCount )
+    {
+    aTableCount = sizeof( ImplementationTable ) /
+                  sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpcopycommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpCopyCommand class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <upnpcopycommand.h>            // CUpnpCopyCommand
+#include "upnpcommand.h"                // CUpnpCommand
+#include "upnpcommandmain.h"            // UpnpCommandMain::LoadL
+
+// --------------------------------------------------------------------------
+// CUpnpCopyCommand::NewL
+// Creates a new UpnpCommand for file copying purposes.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpCopyCommand* CUpnpCopyCommand::NewL()
+    {
+    // Create new CUpnpCopyCommand instance
+    CUpnpCopyCommand* self = new (ELeave) CUpnpCopyCommand();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyCommand::CUpnpCopyCommand
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUpnpCopyCommand::CUpnpCopyCommand()
+    {
+    // No implementation
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyCommand::~CUpnpCopyCommand
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpCopyCommand::~CUpnpCopyCommand()
+    {
+    delete iCommand;
+    iCommand = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyCommand::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpCopyCommand::ConstructL()
+    {
+    iCommand = UpnpCommandMain::LoadL( UpnpCommand::ECommandCopy );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyCommand::CopyFilesL
+// Copies the given list of files to a remote Upnp Media Server.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpCopyCommand::CopyFilesL( CDesCArrayFlat* aFiles )
+    {
+    TInt status = KErrNone;
+
+    // Check param
+    if( !aFiles ||
+        aFiles->Count() <= 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Push the filenames into the file pipe
+    for( TInt index=0; index<aFiles->Count(); index++ )
+        {
+        if( status == KErrNone )
+            {
+            TRAP( status,
+                  iCommand->PushFileL( aFiles->MdcaPoint( index ) ) );
+            }
+        }
+
+    // If all files were pushed ok
+    if( status == KErrNone )
+        {
+        // Allocate Upnp Fw only for the duration of the command execution
+        TRAP( status, iCommand->AllocateResourcesL() );
+        if( status == KErrNone )
+            {
+            // Execute the command
+            TRAP( status, iCommand->ExecuteL() );
+
+            // Move the failed files back to client file array
+            aFiles->Reset();
+            for ( TInt i=0; i<iCommand->FileCount(); ++i )
+                {
+                TRAP_IGNORE( aFiles->AppendL( iCommand->File( i ) ) );
+                }
+
+            // Release Upnp Fw
+            iCommand->ReleaseResources();
+            }
+        }
+
+    // Reset the file pipe
+    iCommand->ResetFiles();
+
+    // Reset parameters
+    iCommand->ResetParameters();
+
+    // Leave if operation failed
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyCommand::CopyPlaylistL
+// Copies the given playlist (playlist name + filenames) to a remote Upnp
+// Media Server.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpCopyCommand::CopyPlaylistL( const TDesC& aPlaylistName,
+                                               CDesCArrayFlat* aFiles )
+    {
+    // Check playlist name parameter, aFiles will be checked later
+    if( aPlaylistName == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Set the playlist parameter
+    iCommand->SetParameterL(
+        UpnpCommand::EParamCollectionName, aPlaylistName );
+
+    // Use CopyFilesL to do the copy (and to handle cleanup)
+    CopyFilesL( aFiles );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyCommand::IsAvailable
+// Inline implementation of the IsAvailable method.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpCopyCommand::IsAvailableL()
+    {
+    // create a temporary plugin instance
+    // then query command availability.
+    TBool available = EFalse;
+    TRAP_IGNORE(
+        CUpnpCommand* temp = UpnpCommandMain::LoadL( UpnpCommand::ECommandCopy );
+        CleanupStack::PushL( temp );
+        available = temp->IsAvailableL();
+        CleanupStack::PopAndDestroy( temp );
+        );
+    return available;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpcopytask.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpCopyTask class.
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <utf.h>                        // ConvertToUnicodeFromUtf8L
+
+// upnp stack api
+#include <upnpitem.h>                   // CUpnpItem
+#include <upnpobject.h>                 // CUpnpObject (cast)
+
+// upnp framework / avcontroller api
+#include "upnpavcontroller.h"           // MUPnPAVController
+#include "upnpavcontrollerfactory.h"    // UPnPAVControllerFactory
+#include "upnpavbrowsingsession.h"      // MUPnPAVBrowsingSession
+#include "upnpavsessionbase.h"          // ReserveLocalMSServicesCompleted()
+#include "upnpavdevice.h"               // CUpnpAVDevice
+
+// upnp framework / commonutils api
+#include "upnpcommonutils.h"            // TUPnPItemType
+#include "upnpmetadatafetcher.h"        // UPnPMetadataFetcher
+
+// upnp framework / filetransferengine api
+#include "upnpfiletransferengine.h"     // CUpnpFileTransferEngine
+
+// upnp framework / command internal
+#include "upnpfilepipe.h"               // CUpnpFilePipe
+#include "upnpcommandparameters.h"      // CUpnpCommandParameters
+#include "upnptaskhandler.h"            // MUpnpTaskHandler
+#include "upnpnotehandler.h"            // CUpnpNoteHandler
+#include "upnpcopytask.h"
+#include "upnpcommand.h"
+#include "upnptaskresourceallocator.h"  // CUpnpTaskResourceAllocator
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUpnpCopyTask::NewL
+// Creates an instance of the implementation.
+// --------------------------------------------------------------------------
+//
+CUpnpTask* CUpnpCopyTask::NewL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCopyTask::NewL" );
+
+    // Create instance
+    CUpnpCopyTask* self = new (ELeave) CUpnpCopyTask();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyTask::CUpnpCopyTask
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpCopyTask::CUpnpCopyTask()
+    : CUpnpFileTransferBaseTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCopyTask::Constructor" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpCopyTask::~CUpnpCopyTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCopyTask::Destructor" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyTask::ConstructL
+// Perform the second phase of two phase construction. Reserves the Upnp Fw
+// resources (they are released when the task is destroyed).
+// --------------------------------------------------------------------------
+//
+void CUpnpCopyTask::ConstructL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCopyTask::ConstructL" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyTask::AllocateResourcesL
+// Allocates the Upnp Fw resources.
+// --------------------------------------------------------------------------
+//
+void CUpnpCopyTask::AllocateResourcesL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCopyTask::AllocateResourcesL" );
+
+    AllocateFileTransferResourcesL(
+        CUpnpTaskResourceAllocator::EResourceAvController |
+        CUpnpTaskResourceAllocator::EResourceSelectCopyServer );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCopyTask::ExecuteL
+// Executes the task.
+// --------------------------------------------------------------------------
+//
+void CUpnpCopyTask::ExecuteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpCopyTask::ExecuteL" );
+
+    if( !ResourceAllocator() )
+        {
+        __LOG( "[UpnpCommand]\t CUpnpCopyTask::ExecuteL \
+resources not allocated, leave" );
+        User::Leave( KErrNotReady );
+        }
+
+    TInt transferredFiles = 0;
+
+    TRAPD( status, ExecuteFileTransferL
+        ( EFalse, transferredFiles ) );
+    __LOG1( "[UpnpCommand]\t CUpnpCopyTask::ExecuteL done status %d", status );
+
+    // inform user
+    if( status == KErrNone )
+        {
+        HBufC* deviceString = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+            ResourceAllocator()->SelectedDevice().FriendlyName() );
+        CleanupStack::PushL( deviceString );
+        NoteHandler()->ShowCopyInfoNoteL( 
+            transferredFiles,  *deviceString );
+        CleanupStack::PopAndDestroy( deviceString );
+        }
+    else if( status == KErrDisconnected || status == KErrSessionClosed 
+            || status == KErrCouldNotConnect )
+        {
+        // check if wlan is active
+        // note shown only in device disappeared cases
+        if( IsWlanActive() )
+            {
+            NoteHandler()->ShowCopyDisconnectionErrorNoteL();
+            }
+        }                 
+    else if( status != KErrCancel )
+        {
+        // some other generic error EXCEPT cancel
+        NoteHandler()->ShowCopyErrorNoteL();
+        }
+
+    // If there was an error, leave
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpfilepipe.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,194 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpFilePipe class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpfilepipe.h"
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUpnpFilePipe::NewL
+// Creates a new file pipe with unlimited length.
+// --------------------------------------------------------------------------
+//
+CUpnpFilePipe* CUpnpFilePipe::NewL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFilePipe::NewL" );
+
+    // Create a new file pipe with unlimited length (0).
+    return new (ELeave) CUpnpFilePipe( 0 );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFilePipe::NewL
+// Creates a new file pipe with a set length.
+// --------------------------------------------------------------------------
+//
+CUpnpFilePipe* CUpnpFilePipe::NewL( TInt aMaxSize )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFilePipe::NewL" );
+
+    // Check param
+    if( aMaxSize <= 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Create a new file pipe with the given length.
+    return new (ELeave) CUpnpFilePipe( aMaxSize );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFilePipe::CUpnpFilePipe
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpFilePipe::CUpnpFilePipe( TInt aMaxSize )
+    : iMaxSize( aMaxSize )
+    {
+    // No implementation
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpFilePipe::~CUpnpFilePipe()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFilePipe::Destructor" );
+
+    // Reset the content of the array
+    Reset();
+
+    // Close the array
+    iValues.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFilePipe::PushL
+// Pushes one file into the pipe.
+// --------------------------------------------------------------------------
+//
+void CUpnpFilePipe::PushL( const TDesC& aParam )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFilePipe::PushL" );
+
+    // Parameter check
+    if( aParam == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // If we are using a pipe with a limited size
+    if( iMaxSize > 0 )
+        {
+        // If the pipe is already full (max size reached) remove the newest
+        // file from the pipe
+        if( iValues.Count() >= iMaxSize )
+            {
+            RemoveNewestFileFromPipe();
+            }
+        }
+
+    // Create a new parameter value
+    HBufC* temp = aParam.AllocL();
+    CleanupStack::PushL( temp );
+
+    // Append the new parameter value to the array
+    iValues.AppendL( temp );
+
+    // Just pop, ownership transfered to iValues array
+    CleanupStack::Pop( temp ); 
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFilePipe::FileAt
+// --------------------------------------------------------------------------
+//
+const TDesC& CUpnpFilePipe::FileAt( TInt aIndex )
+    {
+    __ASSERTD( aIndex >= 0 && aIndex < iValues.Count(),
+        __FILE__, __LINE__ );
+    TDesC* file = iValues[aIndex];
+    return *file;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFilePipe::Reset
+// Resets the pipe.
+// --------------------------------------------------------------------------
+//
+void CUpnpFilePipe::Reset()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFilePipe::Reset" );
+
+    // Simply reset the array
+    iValues.ResetAndDestroy();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFilePipe::Count
+// Returns the count of the items in the pipe.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpFilePipe::Count()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFilePipe::Count" );
+
+    // Simply retun the array's item count
+    return iValues.Count();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFilePipe::AsArray
+// returns the entire pipe as an array
+// --------------------------------------------------------------------------
+//
+RPointerArray<TDesC>& CUpnpFilePipe::AsArray()
+    {
+    return iValues;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFilePipe::RemoveNewestFileFromPipe
+// Removes the newest file from the pipe.
+// --------------------------------------------------------------------------
+//
+void CUpnpFilePipe::RemoveNewestFileFromPipe()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFilePipe::RemoveNewestFileFromPipe" );
+
+    // Remove item only if there are items in the pipe
+    if( iValues.Count() > 0 )
+        {
+        // Get the index of the newest item (last item in the array)
+        TInt newestIndex = iValues.Count() - 1; // indexing starts from 0
+
+        // Get the pointer to the data, and delete it
+        HBufC* temp = static_cast<HBufC*>( iValues[newestIndex] );
+        delete temp;
+        temp = NULL;
+
+        // Remove the pointer from the array, this will also compress the
+        // array
+        iValues.Remove( newestIndex );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpfiletransferbasetask.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpFileTransferBaseTask class.
+*
+*/
+
+
+// INCLUDE FILES
+// system
+#include <utf.h>                        // ConvertToUnicodeFromUtf8L
+
+// upnp stack api
+#include <upnpitem.h>                   // CUpnpItem
+#include <upnpobject.h>                 // CUpnpObject (cast)
+
+// upnp framework / avcontroller api
+#include "upnpavcontrollerfactory.h"    // UPnPAVControllerFactory
+#include "upnpavcontroller.h"           // MUPnPAVController
+#include "upnpavbrowsingsession.h"      // MUPnPAVBrowsingSession
+#include "upnpavsessionobserverbase.h"  // MUPnPAVSessionObserverBase
+#include "upnpavdevice.h"               // CUpnpAVDevice
+
+// upnp framework / common utils api
+#include "upnpcommonutils.h"            // TUPnPItemType
+#include "upnpmetadatafetcher.h"        // UPnPMetadataFetcher
+
+// upnp framework / fte
+#include "upnpfiletransferengine.h"     // CUpnpFileTransferEngine
+// upnp framework / common ui
+#include "upnpcommonui.h"               // CUpnpCommonUI
+
+// upnpcommand internal
+#include "upnpfilepipe.h"               // CUpnpFilePipe
+#include "upnpcommandparameters.h"      // CUpnpCommandParameters
+#include "upnptaskhandler.h"            // MUpnpTaskHandler
+#include "upnpnotehandler.h"            // CUpnpNoteHandler
+#include "upnpcommand.h"                // CUpnpCommand
+#include "upnptaskresourceallocator.h"  // CUpnpTaskResourceAllocator
+#include "upnpfiletransferbasetask.h"   // CUpnpFileTransferBaseTask
+
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferBaseTask::CUpnpFileTransferBaseTask
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpFileTransferBaseTask::CUpnpFileTransferBaseTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask::Constructor" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpFileTransferBaseTask::~CUpnpFileTransferBaseTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask::Destructor" );
+
+    // delete the resource allocator
+    // Local mediaserver and AVController resources will be freed.
+    delete iResourceAllocator;
+    delete iCommonUI;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferBaseTask::AllocateFileTransferResourcesL
+// Allocates the Upnp Fw resources.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferBaseTask::AllocateFileTransferResourcesL( TInt aMode)
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask::AllocateResourcesL" );
+    
+    // create common UI
+    iCommonUI = CUPnPCommonUI::NewL();
+    
+    // create the resource allocator
+    iResourceAllocator = CUpnpTaskResourceAllocator::NewL(
+        *iCommonUI, aMode);
+        
+    iState = EStateConnected; 
+    
+    iResourceAllocator->SetNoteHandlerL( NoteHandler() );
+    
+    // now allocate!
+    iResourceAllocator->AllocateL();
+
+     // start a browsing session
+    iBrowsingSession =
+        &iResourceAllocator->AVController().StartBrowsingSessionL(
+            iResourceAllocator->SelectedDevice() );
+            
+    iBrowsingSession->SetObserver( *this );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferBaseTask::ResourceAllocator
+// Executes the task.
+// --------------------------------------------------------------------------
+//
+CUpnpTaskResourceAllocator* CUpnpFileTransferBaseTask::ResourceAllocator()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask::ResourceAllocator" );
+ 
+    return iResourceAllocator;
+    }
+
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferBaseTask::ExecuteFileTransferL
+// Executes the task.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferBaseTask::ExecuteFileTransferL( TBool aRemoveFiles, 
+    TInt& aTransferredFiles)
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask::ExecuteL" );
+
+
+    // Leave if command has not been allocated yet
+    if( !FilePipe() ||
+        !CommandParameters() ||
+        !NoteHandler() ||
+        !iBrowsingSession ||
+        !iResourceAllocator )
+        {
+        __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask::\
+ExecuteFileTransferL resources not allocated, leave" );
+        User::Leave( KErrNotReady );
+        }
+
+    // reset drm-note calculator ( note is shown once per operation )
+    NoteHandler()->ResetDrmNoteCount();
+    
+    TInt status = KErrNone;
+    TInt origFileCount = FilePipe()->Count();;    
+    TInt failedFileCount = 0;   
+
+    // Initialise and execute the UpnpFileTransferEngine
+    CUpnpFileTransferEngine* ftEngine = NULL;
+    ftEngine = CUpnpFileTransferEngine::NewL( iBrowsingSession );
+    if( status == KErrNone &&
+        ftEngine )
+        {
+        CleanupStack::PushL( ftEngine );
+        
+        // move operation
+        if( aRemoveFiles )
+            {
+            __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask, move files" );
+            ftEngine->MoveLocalFilesToRemoteServerL(
+                 &FilePipe()->AsArray() );
+            }
+        // copy operation
+        else
+            {  
+            // Read the collection name (if any)
+            const TDesC& collectionName =
+                CommandParameters()->Get( UpnpCommand::EParamCollectionName );
+
+            // If collection name is not set, the operation is file copy
+            if( collectionName != KNullDesC )
+                {
+                __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask,\
+ copy playlist" );
+                ftEngine->CopyLocalPlaylistToRemoteServerL(
+                              collectionName, &FilePipe()->AsArray() );
+                }
+            // If collection name is set, the operation is playlist copy
+            else
+                {
+                __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask,\
+ copy files" );
+                ftEngine->CopyLocalFilesToRemoteServerL(
+                              &FilePipe()->AsArray() );
+                }
+            }
+
+        // Clean up
+        CleanupStack::PopAndDestroy( ftEngine );
+        ftEngine = NULL;
+        }
+
+    // calculate number of transferred files based on original file count and
+    // items remaining in filepipe (those were NOT transferred)
+    failedFileCount = FilePipe()->Count();
+    aTransferredFiles = origFileCount - failedFileCount;
+
+    // check if connection was lost during transfer
+    if( iState != EStateConnected )
+        {
+        status = KErrDisconnected;
+        }
+
+    __LOG1( "[UpnpCommand]\t CUpnpFileTransferBaseTask::\
+ExecuteL done status %d", status );
+    
+    // If there was an error, leave
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferBaseTask::MediaServerDisappeared
+// Notifies that the Media Renderer we have a session with has disappeared.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferBaseTask::MediaServerDisappeared( 
+    TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpFileTransferBaseTask::\
+MediaServerDisappeared aReason %d", aReason );
+
+    // need to know if wlan or server was lost
+    if( aReason == MUPnPAVSessionObserverBase::EWLANLost )
+        {
+        iState = EStateWLANLost;
+        }
+    else
+        {
+        iState = EStateMSLost;
+        }
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferBaseTask::IsWlanActive
+// Returns connection state
+// --------------------------------------------------------------------------
+//
+TBool CUpnpFileTransferBaseTask::IsWlanActive()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpFileTransferBaseTask::IsWlanActive" );
+
+    return (iState != EStateWLANLost);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpimagerenderingengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,683 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Engine for rendering images remotely
+*
+*/
+
+
+// INCLUDE FILES
+// upnp stack api
+#include <upnpitem.h>                   // CUpnpItem
+#include <upnpobject.h>                 // CUpnpObject (cast)
+
+// upnpframework / avcontroller api
+#include "upnpavrenderingsession.h"     // MUPnPAVRenderingSession
+#include "upnpavsessionobserverbase.h" 
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h"           // KFilterCommon
+#include "upnpitemresolver.h"           // MUPnPItemResolver
+#include "upnpitemresolverobserver.h"   // MUPnPItemResolverObserver
+#include "upnpitemresolverfactory.h"    // UPnPItemResolverFactory
+#include "upnpitemutility.h"            // UPnPItemUtility::BelongsToClass
+
+// upnpframework / commonui
+#include "upnpcommonui.h"               // common UI for upnp video player dlg
+
+// command internal
+#include "upnpimagerenderingengineobserver.h"   // the observer interface
+#include "upnpimagerenderingengine.h"   // myself
+#include "upnpperiodic.h"
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+// CONSTANT DEFINITIONS
+const TInt KReactionTimerMicrosec = 100000; // 100 millisec.
+
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::NewL
+// --------------------------------------------------------------------------
+//
+CUpnpImageRenderingEngine* CUpnpImageRenderingEngine::NewL(
+            MUPnPAVController& aAVController,
+            MUPnPAVRenderingSession& aSession,
+            MUpnpImageRenderingEngineObserver& aObserver )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine::NewL" );
+
+    // Create instance
+    CUpnpImageRenderingEngine* self = NULL;
+    self = new (ELeave) CUpnpImageRenderingEngine(
+            aAVController, aSession, aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::CUpnpImageRenderingEngine
+// --------------------------------------------------------------------------
+//
+CUpnpImageRenderingEngine::CUpnpImageRenderingEngine(
+            MUPnPAVController& aAVController,
+            MUPnPAVRenderingSession& aSession,
+            MUpnpImageRenderingEngineObserver& aObserver )
+    : iAVController( aAVController )
+    , iRenderingSession( aSession )
+    , iObserver( aObserver )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine: Constructor" );
+
+    // Initialise member variables
+    iState = EIdle;
+    iCurrentResolver = 0;
+    iBufferedResolver = 0;
+
+    // set observer
+    iRenderingSession.SetObserver( *this );
+    }
+
+// --------------------------------------------------------------------------
+// Second phase constructor.
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::ConstructL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine::ConstructL" );
+    iTimer = CUPnPPeriodic::NewL( CActive::EPriorityStandard );
+    
+    iWlanActive = ETrue;
+    }
+    
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpImageRenderingEngine::~CUpnpImageRenderingEngine()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine: Destructor" );
+
+    Cleanup();
+
+    // Stop observing the rendering session
+    iRenderingSession.RemoveObserver();
+
+    __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine::~CUpnpImageRenderingEngine delete iCurrentResolver" );
+    MUPnPItemResolver* tempCurrentResolver = iCurrentResolver;
+    iCurrentResolver = NULL;
+    delete tempCurrentResolver;
+    
+       if( iTimer )
+        {    
+        iTimer->Cancel();
+        delete iTimer;
+        iTimer = 0;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::Cleanup
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::Cleanup()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine::Cleanup" );
+
+    // reset state
+    if ( iState != EShuttingDown )
+        {
+        iState = EIdle;
+        }
+
+    if( iTimer )
+        {    
+        iTimer->Cancel();
+        }
+
+    iBufferingNewImage = EFalse;
+
+    // Delete resolvers
+    // Delete for resolvers is done using temporary variables so that we can
+    // first nullify the members and then delete the actual objects.
+    // This is because local resolver deletion uses active scheduler loops
+    // and therefore other asynchronous events may orrur. So we may end
+    // up here in Cleanup again, during the resolver is being deleted.
+    // if deletion is done the conventional way, the objects get deleted
+    // twice, which is not what we want. :-)
+    
+    __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine::Cleanup delete iBufferedResolver" );
+    MUPnPItemResolver* tempBufferedResolver = iBufferedResolver;
+    iBufferedResolver = NULL;
+    delete tempBufferedResolver;
+
+    __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine::Cleanup end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::PlayL
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::PlayL()
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::PlayL in state %d",
+        iState);
+
+    if ( iState != EShuttingDown )
+        {
+        if( iTimer->IsActive() )
+            {
+            __LOG( "[UpnpCommand]\t timer already active" );
+            }
+        else
+            {
+            TTimeIntervalMicroSeconds32 delay( KReactionTimerMicrosec );
+            iTimer->Start( delay, delay, TCallBack( Timer, this ) );
+            }
+        }
+    else
+        {
+        __LOG( "[UpnpCommand]\t not doing play in shutting down state" );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::StopL
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::StopL()
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::StopL in state %d",
+        iState);
+
+    // cancel any timers that are going on
+    iTimer->Cancel();
+
+    // remove buffered images
+    iBufferingNewImage = EFalse;
+    delete iBufferedResolver;
+    iBufferedResolver = 0;
+
+    switch( iState )
+        {
+        case EIdle:
+        case EResolvingItem:
+        case EResolveComplete:
+        case ESettingUri: // fall through
+            {
+            // just cancel the sequence and do nothing
+            iState = EIdle;
+            break;
+            }
+        case EStartingPlay:
+            {
+            // wait for PLAY complete, then do STOP
+            // then wait for STOP complete
+            iState = EStopping;
+            break;
+            }
+        case EPlaying:
+            {
+            // Send stop action.
+            iRenderingSession.StopL();
+            iState = EStopping;
+            break;
+            }
+        case EStopping:
+            {
+            // already stopping - do nothing
+            break;
+            }
+        case EShuttingDown:
+            {
+            // command not allowed in this state
+            break;
+            }
+        default:
+            {
+            __PANICD( __FILE__, __LINE__ );
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::Timer
+// timer callback
+// --------------------------------------------------------------------------
+//
+TInt CUpnpImageRenderingEngine::Timer( TAny* aArg )
+    {    
+    CUpnpImageRenderingEngine* self =
+        static_cast<CUpnpImageRenderingEngine*>( aArg );
+    TRAPD( error, self->RunTimerL() )
+    if ( error != KErrNone )
+        self->RunError( error );
+    return 0; // do not call again
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::RunTimerL
+// Timer has triggered, start rendering media.
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::RunTimerL()
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::RunTimerL, state %d",
+        iState );
+        
+    iTimer->Cancel();
+
+    delete iBufferedResolver;
+    iBufferedResolver = iObserver.GetMedia();
+    if ( iBufferedResolver == 0 )
+        {
+        __LOG( "[UpnpCommand]\t resolver returned zero" );
+        User::Leave( KErrCancel );
+        }
+
+    switch( iState )
+        {
+        case EIdle: // fall through
+            {
+            StartResolvingL();
+            break;
+            }
+        case EResolvingItem: // fall through
+        case EResolveComplete:
+        case ESettingUri: // fall through
+        case EStartingPlay:
+            {
+            // indicate that new image is being buffered. It will be popped
+            // from buffer in next callback.
+            iBufferingNewImage = ETrue;
+            break;
+            }
+        case EPlaying:
+            {
+            // indicate that new image is being buffered. Send stop signal.
+            // new item will be handled after stop completed.
+            iBufferingNewImage = ETrue;
+            iRenderingSession.StopL();
+            iState = EStopping;
+            break;
+            }
+        case EStopping:
+            {
+            // indicate that new image is being buffered. It will be popped
+            // from buffer in next callback.
+            iBufferingNewImage = ETrue;
+            break;
+            }
+        case EShuttingDown:
+            {
+            // command not allowed in this state
+            break;
+            }
+        default:
+            {
+            __PANICD( __FILE__, __LINE__ );
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::StartResolvingL
+// Handles the start up of the item resolving.
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::StartResolvingL()
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::StartResolvingL\
+ in state %d",
+        iState );
+
+    __ASSERTD( iBufferedResolver, __FILE__, __LINE__ );
+    if ( !iBufferedResolver )
+        {
+        // something is very wrong
+        User::Leave( KErrDisconnected );
+        }
+    
+    // delete old resolver
+    // destruction takes time due to unsharing, so set to null first
+    // so that this wont be used else where
+    MUPnPItemResolver* tempCurrentResolver = iCurrentResolver;
+    iCurrentResolver = NULL;
+    delete tempCurrentResolver;
+    
+    // take queued resolver in use
+    iCurrentResolver = iBufferedResolver;
+    iBufferedResolver = NULL;
+    iBufferingNewImage = EFalse;
+
+    // Update the state
+    iState = EResolvingItem;
+
+    // Start resolving the item
+    iCurrentResolver->ResolveL( *this );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::ResolveComplete
+// Indicates that resolving of an item is complete.
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::ResolveComplete(
+    const MUPnPItemResolver& aResolver,
+    TInt aError )
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::ResolveComplete\
+ in state %d", iState );
+
+    // if engine is shutting down, no need to check these
+    if ( iState == EResolvingItem )
+        {
+        __ASSERTD( &aResolver == iCurrentResolver, __FILE__, __LINE__ );
+        if( iBufferingNewImage )
+            {
+            TRAP( aError, StartResolvingL() );
+            }
+        else if( aError == KErrNone )
+            {
+            iState = EResolveComplete;
+            
+            // Now that we have the full metadata of the item available, we
+            // can start the rendering
+            TRAP( aError, InitiateShowingL() );
+            }
+        // error handling
+        if( aError != KErrNone && iState != EShuttingDown )
+            {
+            SendRenderAck( aError );
+            }
+        }
+    else if( iState == EShuttingDown )
+        {
+        // do nothing.
+        iState = EIdle;
+        }
+    else
+        {
+        __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine: state error." );
+        __PANICD( __FILE__, __LINE__ );
+        iState = EIdle;
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::InitiateShowingL
+// Handles the initiation of rendering (SetUri or video player launching).
+// --------------------------------------------------------------------------
+void CUpnpImageRenderingEngine::InitiateShowingL()
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::InitiateShowingL\
+ in state %d",
+        iState );
+    __ASSERTD( iCurrentResolver, __FILE__, __LINE__ );
+
+    if ( UPnPItemUtility::BelongsToClass(
+        iCurrentResolver->Item(), KClassImage ) )
+        {
+         // Send the setUri action
+        iRenderingSession.SetURIL(
+            iCurrentResolver->Resource().Value(),
+            iCurrentResolver->Item() );
+        // update the state
+        iState = ESettingUri;
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::SetURIResult
+// UPnP AV Controller calls this method as a result for the 'set uri' request.
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::SetURIResult( TInt aError )
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::SetURIResult\
+ in state %d",
+        iState );
+
+    if ( iState == ESettingUri )
+        {
+        //need check the aError in case of SetURIL cause a error.
+        if( aError != KErrNone )
+            {
+            Cleanup();
+            return;         
+            }
+        __ASSERTD( iCurrentResolver, __FILE__, __LINE__ );
+        if( iBufferingNewImage )
+            {
+            TRAP( aError, StartResolvingL() );
+            }
+        else if( aError == KErrNone )
+            {
+            TRAP( aError, iRenderingSession.PlayL() );
+            if( aError == KErrNone )
+                {
+                // Update the state
+                iState = EStartingPlay;
+                }
+            }
+        // error handling
+        if( aError != KErrNone )
+            {
+            SendRenderAck( aError );
+            }
+        }
+    else if ( iState == EShuttingDown )
+        {
+        // do nothing
+        }
+    else
+        {
+        __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine: state error." );
+        __PANICD( __FILE__, __LINE__ );
+        iState = EIdle;
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::InteractOperationComplete
+// Called by UpnpAvController to indicate that play is complete.
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::InteractOperationComplete(
+    TInt aError,
+    TUPnPAVInteractOperation aOperation )
+    {
+    __LOG2( "[UpnpCommand]\t CUpnpImageRenderingEngine::\
+InteractOperationComplete (%d) in state %d", aOperation, iState );
+
+    if ( iState == EStartingPlay )
+        {
+        __ASSERTD( iCurrentResolver, __FILE__, __LINE__ );
+        if( aOperation == EUPnPAVPlay && iBufferingNewImage )
+            {
+            // New image in buffer! call stop, then play new item.
+            TRAP( aError, iRenderingSession.StopL() );
+            if ( aError == KErrNone )
+                {
+                iState = EStopping;
+                }
+            }
+        else if ( aOperation == EUPnPAVPlay && aError == KErrNone )
+            {
+            // update status
+            iState = EPlaying;
+            // response for play request
+            SendRenderAck( KErrNone );
+            }
+        // error handling
+        if ( aError != KErrNone )
+            {
+            SendRenderAck( aError );
+            }
+        }
+    else if ( iState == EPlaying )
+        {
+        if( aOperation == EUPnPAVPlayUser )
+            {
+            // state change event notification
+            // no need to do anything here
+            }
+        else if( aOperation == EUPnPAVStopUser )
+            {
+            // user stop notification
+            // state to idle, so that no stop event will be sent
+            // if starting to process new item
+            iState = EIdle;
+            }
+        }
+    else if ( iState == EStopping )
+        {
+        __ASSERTD( iCurrentResolver, __FILE__, __LINE__ );
+        if( aOperation == EUPnPAVStop && iBufferingNewImage )
+            {
+            TRAP( aError, StartResolvingL() );
+            }
+        else if ( aOperation == EUPnPAVStop && aError == KErrNone )
+            {
+            // succesful stop - go IDLE
+            iState = EIdle;
+            }
+        // error handling
+        if ( aError != KErrNone )
+            {
+            SendRenderAck( aError );
+            }
+        }
+    else if ( iState == EShuttingDown )
+        {
+        if ( aOperation == EUPnPAVStop || aOperation == EUPnPAVPlay )
+            {
+            iState = EIdle;
+            }
+        }
+
+    __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine::InteractOperationComplete end " );
+    }
+
+
+
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::MediaRendererDisappeared
+// Notifies that the Media Renderer we have a session with has disappeared.
+// Session is now unusable and must be closed. 
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::MediaRendererDisappeared(
+    TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::\
+MediaRendererDisappeared in state %d", iState );
+
+    if( iState == EShuttingDown )
+        {
+        __LOG( "[UpnpCommand]\t CUpnpImageRenderingEngine::\
+        MediaRendererDisappeared engine already shutting down, do nothing" );
+        }
+    else
+        {
+        if( aReason == MUPnPAVSessionObserverBase::EWLANLost )
+            {
+            iWlanActive = EFalse;
+            }
+        iState = EShuttingDown; // avoid all callbacks
+        iObserver.EngineShutdown( KErrDisconnected );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::RunError
+// Exception occurred in the timer body
+// --------------------------------------------------------------------------
+//
+TInt CUpnpImageRenderingEngine::RunError( TInt aError )
+    {
+    __LOG2( "[UpnpCommand]\t CUpnpImageRenderingEngine::\
+RunError in state %d aError %d", iState, aError );
+    Cleanup();
+    SendRenderAck( aError );
+    return KErrNone;
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::SendRenderAck
+// Exception occurred in the timer body
+// --------------------------------------------------------------------------
+//
+void CUpnpImageRenderingEngine::SendRenderAck( TInt aError )
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::\
+SendRenderAck(%d)", aError );
+
+    // take a stack copy of some members
+    MUpnpImageRenderingEngineObserver& observer = iObserver;
+    const CUpnpItem* item = NULL;
+    if ( iCurrentResolver  && 
+        !( iState == EIdle || iState == EResolvingItem ) )
+        {
+        item = &iCurrentResolver->Item();
+        }
+
+    // cleanup if this was an error
+    if ( aError != KErrNone )
+        {
+        __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::\
+SendRenderAck aError=%d -> Cleanup", aError );
+        Cleanup();
+        }
+
+    // call the observer
+    TInt resp = observer.RenderAck( aError, item );
+
+    // in case of disconnected error, do engine shutdown
+    if ( resp == KErrDisconnected )
+        {
+        __LOG1( "[UpnpCommand]\t CUpnpImageRenderingEngine::\
+SendRenderAck resp=%d -> EngineShutdown", resp );
+        iState = EShuttingDown;
+        observer.EngineShutdown( resp );
+        }
+
+    }
+    
+    
+// --------------------------------------------------------------------------
+// CUpnpImageRenderingEngine::IsWlanActive
+// If connection to renderer is lost, checks if wlan is still active
+// --------------------------------------------------------------------------
+//
+TBool CUpnpImageRenderingEngine::IsWlanActive()
+    {        
+    return iWlanActive;
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpmovecommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpCopyCommand class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <upnpmovecommand.h>            // CUpnpMoveCommand
+#include "upnpcommand.h"                // CUpnpCommand
+#include "upnpcommandmain.h"            // UpnpCommandMain::LoadL
+
+// --------------------------------------------------------------------------
+// CUpnpMoveCommand::NewL
+// Creates a new UpnpCommand for file moving purposes.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpMoveCommand* CUpnpMoveCommand::NewL()
+    {
+    // Create new CUpnpMoveCommand instance
+    CUpnpMoveCommand* self = new (ELeave) CUpnpMoveCommand();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMoveCommand::CUpnpMoveCommand
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUpnpMoveCommand::CUpnpMoveCommand()
+    {
+    // No implementation
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMoveCommand::~CUpnpMoveCommand
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpMoveCommand::~CUpnpMoveCommand()
+    {
+    delete iCommand;
+    iCommand = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMoveCommand::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpMoveCommand::ConstructL()
+    {
+    iCommand = UpnpCommandMain::LoadL( UpnpCommand::ECommandMove );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMoveCommand::MoveFilesL
+// Moves the given list of files to a remote Upnp Media Server.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpMoveCommand::MoveFilesL( CDesCArrayFlat* aFiles )
+    {
+    TInt status = KErrNone;
+
+    // Check params
+    if( !aFiles ||
+        aFiles->Count() <= 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Push the filenames into the file pipe
+    for( TInt index=0; index<aFiles->Count(); index++ )
+        {
+        if( status == KErrNone )
+            {
+            TRAP( status,
+                  iCommand->PushFileL( aFiles->MdcaPoint( index ) ) );
+            }
+        }
+
+    // If all files were pushed ok
+    if( status == KErrNone )
+        {
+        // Allocate Upnp Fw only for the duration of the command execution
+        TRAP( status, iCommand->AllocateResourcesL() );
+        if( status == KErrNone )
+            {
+            // Execute the command
+            TRAP( status, iCommand->ExecuteL() );
+
+            // Move the failed files back to client file array
+            aFiles->Reset();
+            for ( TInt i=0; i<iCommand->FileCount(); ++i )
+                {
+                TRAP_IGNORE( aFiles->AppendL( iCommand->File( i ) ) );
+                }
+
+            // Release Upnp Fw
+            iCommand->ReleaseResources();
+            }
+        }
+
+    // Reset the file pipe
+    iCommand->ResetFiles();
+
+    // Reset parameters
+    iCommand->ResetParameters();
+
+    // Leave if operation failed
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMoveCommand::IsAvailableL
+// Inline implementation of the IsAvailable method.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpMoveCommand::IsAvailableL()
+    {
+    // create a temporary plugin instance
+    // then query command availability.
+    TBool available = EFalse;
+    TRAP_IGNORE(
+        CUpnpCommand* temp = UpnpCommandMain::LoadL( UpnpCommand::ECommandMove );
+        CleanupStack::PushL( temp );
+        available = temp->IsAvailableL();
+        CleanupStack::PopAndDestroy( temp );
+        );
+    return available;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpmovetask.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpMoveTask class.
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <utf.h>                        // ConvertToUnicodeFromUtf8L
+
+// upnp stack api
+#include <upnpitem.h>                   // CUpnpItem
+#include <upnpobject.h>                 // CUpnpObject (cast)
+
+// upnp framework / avcontroller api
+#include "upnpavcontroller.h"           // MUPnPAVController
+#include "upnpavcontrollerfactory.h"    // UPnPAVControllerFactory
+#include "upnpavbrowsingsession.h"      // MUPnPAVBrowsingSession
+#include "upnpavsessionbase.h"          // ReserveLocalMSServicesCompleted()
+#include "upnpavdevice.h"               // CUpnpAVDevice
+
+// upnp framework / internal api's
+#include "upnpcommonutils.h"            // TUPnPItemType
+#include "upnpmetadatafetcher.h"        // UPnPMetadataFetcher
+#include "upnpfiletransferengine.h"     // CUpnpFileTransferEngine
+
+// upnp framework / command internal
+#include "upnpfilepipe.h"               // CUpnpFilePipe
+#include "upnpcommandparameters.h"      // CUpnpCommandParameters
+#include "upnptaskhandler.h"            // MUpnpTaskHandler
+#include "upnpnotehandler.h"            // CUpnpNoteHandler
+#include "upnpmovetask.h"
+#include "upnpcommand.h"
+#include "upnptaskresourceallocator.h"  // CUpnpTaskResourceAllocator
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUpnpMoveTask::NewL
+// Creates an instance of the implementation.
+// --------------------------------------------------------------------------
+//
+CUpnpTask* CUpnpMoveTask::NewL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpMoveTask::NewL" );
+
+    // Create instance
+    CUpnpMoveTask* self = new (ELeave) CUpnpMoveTask();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMoveTask::CUpnpMoveTask
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpMoveTask::CUpnpMoveTask()
+    : CUpnpFileTransferBaseTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpMoveTask::Constructor" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpMoveTask::~CUpnpMoveTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpMoveTask::Destructor" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMoveTask::ConstructL
+// Perform the second phase of two phase construction. Reserves the Upnp Fw
+// resources (they are released when the task is destroyed).
+// --------------------------------------------------------------------------
+//
+void CUpnpMoveTask::ConstructL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpMoveTask::ConstructL" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMoveTask::AllocateResourcesL
+// Allocates the Upnp Fw resources.
+// --------------------------------------------------------------------------
+//
+void CUpnpMoveTask::AllocateResourcesL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpMoveTask::AllocateResourcesL" );
+
+    AllocateFileTransferResourcesL(
+        CUpnpTaskResourceAllocator::EResourceAvController |
+        CUpnpTaskResourceAllocator::EResourceSelectMoveServer );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMoveTask::ExecuteL
+// Executes the task.
+// --------------------------------------------------------------------------
+//
+void CUpnpMoveTask::ExecuteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpMoveTask::ExecuteL" );
+
+    if( !ResourceAllocator() )
+        {
+        __LOG( "[UpnpCommand]\t CUpnpCopyTask::ExecuteL \
+resources not allocated, leave" );
+        User::Leave( KErrNotReady );
+        }
+
+    TInt transferredFiles = 0;
+        
+    TRAPD( status, ExecuteFileTransferL
+        ( ETrue, transferredFiles ) );
+    __LOG1( "[UpnpCommand]\t CUpnpMoveTask::ExecuteL done status %d", status );
+
+    // inform user
+    if( status == KErrNone )
+        {
+        HBufC* deviceString = CnvUtfConverter::ConvertToUnicodeFromUtf8L( 
+            ResourceAllocator()->SelectedDevice().FriendlyName() );
+        CleanupStack::PushL( deviceString );
+        NoteHandler()->ShowMoveInfoNoteL( 
+            transferredFiles,  *deviceString );
+        CleanupStack::PopAndDestroy( deviceString );
+        }
+    else if( status == KErrNotSupported )
+        {
+        NoteHandler()->ShowDrmNoteL();
+        }
+    else if( status == KErrDisconnected || status == KErrSessionClosed )
+        {
+        // check from if wlan is active
+        // note shown only in device disappeared cases
+        if( IsWlanActive() )
+            {
+            NoteHandler()->ShowMoveDisconnectionErrorNoteL();
+            }
+        }                   
+    else if( status != KErrCancel )
+        {
+        // some other generic error EXCEPT cancel
+        NoteHandler()->ShowMoveErrorNoteL();
+        }
+
+    // If there was an error, leave
+    if( status != KErrNone )
+        {
+        User::Leave( status );
+        }
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpnotehandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,432 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpNoteHandler class.
+*
+*/
+
+
+// INCLUDE FILES
+// system
+#include <bautils.h>                            // BaflUtils
+#include <eikenv.h>                             // CEikonEnv
+#include <AknWaitDialog.h>                      // CAknWaitDialog
+#include <StringLoader.h>                       // StringLoader
+#include <aknnotewrappers.h>                    // CAknErrorNote
+// upnpframework / common ui
+#include "upnpcommonui.h"                       // CUPnPCommonUI
+// command internal
+#include <upnpcommandresources.rsg>             // UpnpCommand resource file
+#include "upnpnotehandler.h"
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+
+// CONSTANTS
+_LIT( KResFileName,     "\\resource\\upnpcommandresources.rsc" );
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::NewL
+// Creates an instance of the implementation.
+// --------------------------------------------------------------------------
+//
+CUpnpNoteHandler* CUpnpNoteHandler::NewL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::NewL" );
+
+    // Create instance
+    CUpnpNoteHandler* self = NULL;
+    self = new (ELeave) CUpnpNoteHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::CUpnpNoteHandler
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpNoteHandler::CUpnpNoteHandler()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::Constructor" );
+
+    iWaitNote = NULL;
+    
+    // DRM note will be shown only once
+    iDrmNoteShown = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpNoteHandler::~CUpnpNoteHandler()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::Destructor" );
+
+    // If wait note is running, finish it
+    if( iWaitNote )
+        {
+        TRAP_IGNORE( iWaitNote->ProcessFinishedL() );
+        }
+
+    // Un-load resource file
+    if ( iResFileOffset )
+        {
+        CEikonEnv::Static()->DeleteResourceFile( iResFileOffset );
+        iResFileOffset = 0;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ConstructL
+// Perform the second phase of two phase construction. Reserves the Upnp Fw
+// resources (they are released when the task is destroyed).
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ConstructL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ConstructL" );
+
+    // Get the pointer to coe env (owned by Eikon env)
+    CEikonEnv* coeEnv = CEikonEnv::Static();
+    if( !coeEnv )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Get the filesession reference from coe env
+    RFs& fileSession = coeEnv->FsSession();
+
+    // Load resource file
+    TFileName rscFileName( KResFileName );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive );
+
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( fileSession, rscFileName ) )
+        {
+        __LOG( "[UpnpCommand]\t Resource file does not exist!" );
+        User::Leave( KErrNotFound );
+        }
+
+    // Read the resource file offset
+    iResFileOffset = coeEnv->AddResourceFileL( rscFileName );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::RunConnectingWaitNote
+// Launches the "Connecting" wait note.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpNoteHandler::RunConnectingWaitNote()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::\
+RunConnectingWaitNote" );
+
+    TInt status = KErrNone;
+    status = RunWaitNote( R_COMMAND_CONNECTING_WAIT_NOTE );
+    return status;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowDrmNoteL
+// Show "DRM protected files not supported." info note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowDrmNoteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowDrmNoteL" );
+
+    if( !iDrmNoteShown )
+        {
+        iDrmNoteShown = ETrue;
+        ShowErrorNoteL( R_COMMAND_DRM_FILE_TEXT );
+        }
+    else
+        {
+        __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowDrmNoteL, skipped" );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowConnectionLostNoteL
+// Show "Connection failed." info note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowConnectionLostNoteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowConnectionLostNoteL" );
+
+    ShowErrorNoteL( R_COMMAND_ERR_CON_FAILED_TEXT );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowLocalMSStartErrorNoteL
+// Show "Connection failed." info note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowLocalMSStartErrorNoteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowLocalMSStartErrorNoteL" );
+
+    // local mediaserver refuses to start.
+    // use "connection failed" - this describes the error best.
+    ShowErrorNoteL( R_COMMAND_ERR_CON_FAILED_TEXT );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowCopyInfoNoteL
+// Show "%N files copied to %U" info note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowCopyInfoNoteL( TInt aCount, 
+        const TDesC& aServerName )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowCopyInfoNoteL" );
+
+    HBufC* infoText = NULL;
+    
+    if( aCount == 1 )
+        {                               
+        infoText = StringLoader::LoadLC( 
+                R_COMMAND_INFO_COPY_EXT_ONE_TEXT,
+                aServerName );
+        }
+    else
+        {
+        infoText = StringLoader::LoadLC( 
+                R_COMMAND_INFO_COPY_EXT_MANY_TEXT,
+                aServerName,
+                aCount );
+        }
+
+    ShowInfoNoteL( *infoText );
+    
+    CleanupStack::PopAndDestroy( infoText );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowMoveInfoNoteL
+// Show "1 file moved to %U" info note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowMoveInfoNoteL( TInt aCount, 
+        const TDesC& aServerName )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowMoveInfoNoteL" );
+    // NOTE: defect in UI spec. Missing loc text. Using
+    // "N files copied" localisation instead.
+
+    HBufC* infoText = NULL;
+
+    if( aCount == 1 )
+        {                                       
+        infoText = StringLoader::LoadLC( 
+                R_COMMAND_INFO_MOVE_EXT_ONE_TEXT,
+                aServerName );
+        }
+    else
+        {
+        infoText = StringLoader::LoadLC( 
+                R_COMMAND_INFO_MOVE_EXT_MANY_TEXT,
+                aServerName,
+                aCount );
+        }
+
+    ShowInfoNoteL( *infoText );
+    
+    CleanupStack::PopAndDestroy( infoText );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowCopyErrorNoteL
+// Show "Selected device does not support this operation" error note
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowCopyErrorNoteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowCopyErrorNoteL" );
+  
+    ShowErrorNoteL( R_COMMAND_ERR_GENERAL_FAILURE_TEXT );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowMoveErrorNoteL
+// Show "Selected device does not support this operation" error note
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowMoveErrorNoteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowMoveErrorNoteL" );
+
+    ShowErrorNoteL( R_COMMAND_ERR_GENERAL_FAILURE_TEXT );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowCopyDisconnectionErrorNoteL
+// Show "Connection lost, some files may not be copied" error note
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowCopyDisconnectionErrorNoteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::\
+ShowCopyDisconnectionErrorNoteL" );
+ 
+    ShowErrorNoteL( R_COMMAND_ERR_CONN_LOST_COPY_TEXT );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowMoveDisconnectionErrorNoteL
+// Show "Connection lost. Some files might not be moved" error note
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowMoveDisconnectionErrorNoteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::\
+ShowMoveDisconnectionErrorNoteL" );
+
+    ShowErrorNoteL( R_COMMAND_ERR_CONN_LOST_MOVE_TEXT);
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowPlaybackFailedNoteL
+// Show "Playback failed on the remote device for unknown error. 
+// Try again" info note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowPlaybackFailedNoteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowPlaybackFailedNoteL" );
+    
+    ShowErrorNoteL( R_COMMAND_ERR_RENDERING_FAILED_UNKNOWN_TEXT );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::RunWaitNote
+// Launches the wait note.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpNoteHandler::RunWaitNote( TInt aResource )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::RunWaitNote" );
+
+    TInt status = KErrNone;
+    
+    
+    // If the note is already showing
+    if( iWaitNote )
+        {
+        status = KErrInUse;
+        }
+    else
+        {
+        // Create the wait note
+        iWaitNote = new CAknWaitDialog(
+            ( REINTERPRET_CAST( CEikDialog**, &iWaitNote ) ), ETrue );
+        if( iWaitNote )
+            {
+            // Execute the wait note
+            TBool noteResult = EFalse;
+            TRAP( status, noteResult =
+                iWaitNote->ExecuteLD(
+                aResource ) );
+            if( !noteResult )
+                {
+                status = KErrCancel;
+                }
+
+            // Clean up
+            iWaitNote = NULL;
+            }
+        else
+            {
+            // If we failed to allocate memory for the note
+            status = KErrNoMemory;
+            }
+
+        }
+
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::CloseWaitNote
+// Closes the "Activating sharing" wait note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::CloseWaitNote()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::CloseWaitNote" );
+
+    // If wait note is running, finish it
+    if( iWaitNote )
+        {
+        TRAP_IGNORE( iWaitNote->ProcessFinishedL() );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowInfoNoteL
+// Show info note
+// --------------------------------------------------------------------------
+//    
+void CUpnpNoteHandler::ShowInfoNoteL( const TDesC& aText )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowInfoNoteL" );
+    
+    CAknInformationNote* infoNote = 
+        new ( ELeave ) CAknInformationNote( ETrue );
+    infoNote->ExecuteLD( aText );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowErrorNoteL
+// Show error note
+// --------------------------------------------------------------------------
+//    
+void CUpnpNoteHandler::ShowErrorNoteL( TInt aResource )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ShowInfoNoteL" );
+
+    // Load the string, and show the note
+    HBufC* errorText = StringLoader::LoadLC( aResource );
+    CAknInformationNote* errorNote = 
+        new ( ELeave ) CAknInformationNote( ETrue );
+    errorNote->ExecuteLD( *errorText );
+    CleanupStack::PopAndDestroy( errorText );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ResetDrmNoteCount
+// Drm note can shoud be shown only one in operation
+// this reset calculator so that note can be shown again
+// --------------------------------------------------------------------------
+//     
+void CUpnpNoteHandler::ResetDrmNoteCount()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpNoteHandler::ResetDrmNoteCount" );
+    iDrmNoteShown = EFalse;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnprunsetupcommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpRunSetupCommand class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <upnprunsetupcommand.h>        // CUpnpRunSetupCommand
+#include "upnpcommand.h"                // CUpnpCommand
+#include "upnpcommandmain.h"            // UpnpCommandMain::LoadL
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupCommand::NewL
+// Creates a new UpnpCommand for running the Upnp Fw's setup wizard.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpRunSetupCommand* CUpnpRunSetupCommand::NewL()
+    {
+    // Create new CUpnpRunSetupCommand instance
+    CUpnpRunSetupCommand* self = new (ELeave) CUpnpRunSetupCommand();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupCommand::CUpnpRunSetupCommand
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUpnpRunSetupCommand::CUpnpRunSetupCommand()
+    {
+    // No implementation
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupCommand::~CUpnpRunSetupCommand
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpRunSetupCommand::~CUpnpRunSetupCommand()
+    {
+    delete iCommand;
+    iCommand = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupCommand::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpRunSetupCommand::ConstructL()
+    {
+    iCommand = UpnpCommandMain::LoadL( UpnpCommand::ECommandSetup );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupCommand::BrowseHomeNetworkL
+// Allocates Upnp Framework resources, and starts up the Upnp Fw's setup
+// wizard.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpRunSetupCommand::RunSetupL()
+    {
+    // Allocate Upnp Framework resources
+    iCommand->AllocateResourcesL();
+
+    // Execute the command
+    TRAPD( executeError, iCommand->ExecuteL() );
+
+    // Release Upnp Framework resources
+    iCommand->ReleaseResources(); 
+
+    // Leave if operation failed
+    if( executeError != KErrNone )
+        {
+        User::Leave( executeError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupCommand::IsAvailableL
+// Returns the availability information of the command.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpRunSetupCommand::IsAvailableL()
+    {
+    // create a temporary plugin instance
+    // then query command availability.
+    TBool available = EFalse;
+    TRAP_IGNORE(
+        CUpnpCommand* temp = UpnpCommandMain::LoadL( UpnpCommand::ECommandSetup );
+        CleanupStack::PushL( temp );
+        available = temp->IsAvailableL();
+        CleanupStack::PopAndDestroy( temp );
+        );
+    return available;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnprunsetuptask.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpRunSetupTask class.
+*
+*/
+
+
+// FORWARD DECLARATIONS
+class CUpnpIcon;
+
+// INCLUDE FILES
+// upnpframework / setup wizard
+#include "cupnpappwizard.h"             // CUPnPAppWizard
+#include "upnpfilesharingengine.h"      // CUPnPFileSharingEngine
+// command internal
+#include "upnpnotehandler.h"
+#include "upnprunsetuptask.h"
+#include "upnpcommand.h"
+
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupTask::NewL
+// Creates an instance of the implementation.
+// --------------------------------------------------------------------------
+//
+CUpnpTask* CUpnpRunSetupTask::NewL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::NewL" );
+
+    // Create instance
+    CUpnpRunSetupTask* self = NULL;
+    self = new (ELeave) CUpnpRunSetupTask();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    // Cast the object and return
+    return (CUpnpTask*)self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupTask::CUpnpRunSetupTask
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpRunSetupTask::CUpnpRunSetupTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::Constructor" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpRunSetupTask::~CUpnpRunSetupTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::Destructor" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupTask::ConstructL
+// Perform the second phase of two phase construction. Reserves the Upnp Fw
+// resources (they are released when the task is destroyed).
+// --------------------------------------------------------------------------
+//
+void CUpnpRunSetupTask::ConstructL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::ConstructL" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupTask::AllocateResourcesL
+// Allocates the Upnp Fw resources.
+// --------------------------------------------------------------------------
+//
+void CUpnpRunSetupTask::AllocateResourcesL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::AllocateResourcesL" );
+
+    // Upnp Fw resources are allocated when the command is executed.
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpRunSetupTask::ExecuteL
+// Executes the task.
+// --------------------------------------------------------------------------
+//
+void CUpnpRunSetupTask::ExecuteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpRunSetupTask::ExecuteL" );
+
+    // Create file sharing engine, it is needed to run the wizard.
+    CUPnPFileSharingEngine* sharingEngine = CUPnPFileSharingEngine::NewL();
+    CleanupStack::PushL( sharingEngine );
+
+    // Create app wizard (use default text for the first step)
+    CUPnPAppWizard* wizard = CUPnPAppWizard::NewL( KNullDesC,
+                                                   sharingEngine );
+    CleanupStack::PushL( wizard );
+
+    // Run the wizard
+    wizard->StartL();
+
+    // Clean up
+    CleanupStack::PopAndDestroy( wizard );
+    wizard = NULL;
+    CleanupStack::PopAndDestroy( sharingEngine );
+    sharingEngine = NULL;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpshowcommand.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpShowCommand class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <upnpshowcommand.h>            // CUpnpShowCommand
+#include <upnpcommandobserver.h>        // CUpnpCommandObserver
+#include "upnpcommand.h"                // CUpnpCommand
+#include "upnpcommandmain.h"            // UpnpCommandMain::LoadL
+#include "upnpcommandcallbackadapter.h" // CUpnpCommandCallbackAdapter
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::NewL
+// Creates a new UpnpCommand for image and video showing purposes.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpShowCommand* CUpnpShowCommand::NewL()
+    {
+    // Create new CUpnpShowCommand instance
+    CUpnpShowCommand* self = new (ELeave) CUpnpShowCommand( NULL );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::NewL
+// Creates a new UpnpCommand for image and video showing purposes.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpShowCommand* CUpnpShowCommand::NewL(
+                                        MUpnpCommandObserver* aObserver )
+    {
+    // Check the availability
+    if( !IsAvailableL() )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    // Create new CUpnpShowCommand instance
+    CUpnpShowCommand* self = new (ELeave) CUpnpShowCommand( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::CUpnpShowCommand
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUpnpShowCommand::CUpnpShowCommand( MUpnpCommandObserver* aObserver)
+    {
+    iObserver = NULL;
+    if( aObserver )
+        {
+        iObserver = aObserver;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::~CUpnpShowCommand
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpShowCommand::~CUpnpShowCommand()
+    {
+    delete iCommand;
+    iCommand = NULL;
+    delete iAdapter;
+    iAdapter = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpShowCommand::ConstructL()
+    {
+    iCommand = UpnpCommandMain::LoadL( UpnpCommand::ECommandShow );
+
+    // Register to observer
+    if( iObserver )
+        {
+        iAdapter = new (ELeave) CUpnpCommandCallbackAdapter( iObserver );
+        iCommand->SetObserver( iAdapter );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::StartShowingL
+// Starts showing. Allocates Upnp Framework resources.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpShowCommand::StartShowingL()
+    {
+    // Allocate Upnp Fw resources
+    iCommand->AllocateResourcesL();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::StopShowingL
+// Stops showing. Releases all Upnp Framework resources.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpShowCommand::StopShowingL()
+    {
+    // Release Upnp Fw resources
+    iCommand->ReleaseResources();
+
+    // Reset the file pipe
+    iCommand->ResetFiles(); 
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::ShowImageL
+// Shows the given images on a remote Upnp Media Rendering device.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpShowCommand::ShowImageL( const TDesC& aFilename )
+    {
+    // Check param
+    if( aFilename == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+
+    // Push the filename into the parameter pipe
+    iCommand->PushFileL( aFilename ); 
+
+    // Execute the command
+    iCommand->ExecuteL();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::ShowVideoL
+// Shows the given video on a remote Upnp Media Rendering device.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpShowCommand::ShowVideoL( const TDesC& aFilename )
+    {
+    // Check param
+    if( aFilename == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+
+    // Push the filename into the file pipe
+    iCommand->PushFileL( aFilename ); 
+
+    // Execute the command
+    iCommand->ExecuteL(); 
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowCommand::IsAvailableL
+// Returns the availability information of the command.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpShowCommand::IsAvailableL()
+    {
+    // create a temporary plugin instance
+    // then query command availability.
+    TBool available = EFalse;
+    TRAP_IGNORE(
+        CUpnpCommand* temp = UpnpCommandMain::LoadL( UpnpCommand::ECommandShow );
+        CleanupStack::PushL( temp );
+        available = temp->IsAvailableL();
+        CleanupStack::PopAndDestroy( temp );
+        );
+    return available;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnpshowtask.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,381 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpShowTask class.
+*
+*/
+
+
+// INCLUDE FILES
+// upnp stack api
+#include <upnpitem.h>                   // CUpnpItem
+#include <upnpobject.h>                 // CUpnpObject (cast)
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h"           // MUPnPAVController
+#include "upnpavrenderingsession.h"     // MUPnPAVRenderingSession
+#include "upnpavsessionobserverbase.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h"           // KFilterCommon, KClassVideo
+#include "upnpitemresolver.h"           // MUPnPItemResolver
+#include "upnpitemresolverobserver.h"   // MUPnPItemResolverObserver
+#include "upnpitemresolverfactory.h"    // UPnPItemResolverFactory
+#include "upnpitemutility.h"            // UPnPItemUtility::BelongsToClass
+
+// upnpframework / commonui
+#include "upnpcommonui.h"
+
+// command internal
+#include "upnpfilepipe.h"               // CUpnpFilePipe
+#include "upnptaskhandler.h"            // MUpnpTaskHandler
+#include "upnptaskresourceallocator.h"  // CUpnpTaskResourceAllocator
+#include "upnpimagerenderingengine.h"   // CUpnpImageRenderingEngine
+#include "upnpshowtask.h"
+#include "upnpcommand.h"
+#include "upnpnotehandler.h"            // CUpnpNoteHandler
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+
+// --------------------------------------------------------------------------
+// CUpnpShowTask::NewL
+// Creates an instance of the implementation.
+// --------------------------------------------------------------------------
+//
+CUpnpTask* CUpnpShowTask::NewL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::NewL" );
+
+    // Create instance
+    CUpnpShowTask* self = new (ELeave) CUpnpShowTask();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowTask::CUpnpShowTask
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpShowTask::CUpnpShowTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::Constructor" );
+
+    // Initialise member variables
+    iCommonUI = NULL;
+    iPlayingVideo = EFalse;
+    iRenderingSession = NULL;
+    iVideoRenderingSession = NULL;
+    iResourceAllocator = NULL;
+    iRenderingEngine = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpShowTask::~CUpnpShowTask()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::Destructor" );
+
+    Cleanup();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowTask::Cleanup
+// --------------------------------------------------------------------------
+//
+void CUpnpShowTask::Cleanup()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::Cleanup" );
+
+    if ( iRenderingEngine )
+        {
+        delete iRenderingEngine;
+        iRenderingEngine = NULL;
+        }       
+        
+    // delete the resource allocator
+    // Local mediaserver and AVController resources will be freed.
+    delete iResourceAllocator;
+    iResourceAllocator = NULL;
+
+    iRenderingSession = NULL;
+    iVideoRenderingSession = NULL;
+
+    delete iCommonUI;
+    iCommonUI = NULL;
+
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::Cleanup - end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowTask::ConstructL
+// Perform the second phase of two phase construction. Reserves the Upnp Fw
+// resources (they are released when the task is destroyed).
+// --------------------------------------------------------------------------
+//
+void CUpnpShowTask::ConstructL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::ConstructL" );
+
+    // create common UI
+    iCommonUI = CUPnPCommonUI::NewL();
+
+    // create the resource allocator
+    iResourceAllocator = CUpnpTaskResourceAllocator::NewL(
+        *iCommonUI,
+        CUpnpTaskResourceAllocator::EResourceAvController |
+        CUpnpTaskResourceAllocator::EResourceLocalMediaServer |
+        CUpnpTaskResourceAllocator::EResourceSelectImageRenderer );
+        
+    iShowPlaybackFailedNote = ETrue;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowTask::AllocateResourcesL
+// Allocates the Upnp Fw resources.
+// --------------------------------------------------------------------------
+//
+void CUpnpShowTask::AllocateResourcesL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::AllocateResourcesL" );
+
+    iResourceAllocator->SetNoteHandlerL( NoteHandler() );
+    
+    NoteHandler()->ResetDrmNoteCount();
+    
+    // now allocate!
+    iResourceAllocator->AllocateL();
+
+    // start a rendering session
+    iRenderingSession =
+        &iResourceAllocator->AVController().StartRenderingSessionL(
+            iResourceAllocator->SelectedDevice() );
+
+    // create image rendering engine
+    iRenderingEngine = CUpnpImageRenderingEngine::NewL(
+        iResourceAllocator->AVController(),
+        *iRenderingSession,
+        *this );
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CUpnpShowTask::ExecuteL
+// Executes the task.
+// --------------------------------------------------------------------------
+//
+void CUpnpShowTask::ExecuteL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::ExecuteL" );
+    // assert that required resources exist
+    __ASSERTD( iRenderingEngine, __FILE__, __LINE__ );
+
+
+    if( iPlayingVideo )
+        {
+        // if videoplayerdlg is active, we cannot start rendering new file
+        // before user closes the dialog
+        __LOG( "[UpnpCommand]\t CUpnpShowTask::ExecuteL\
+            video already playing, do nothing" );
+        }
+    else
+        {
+        // start rendering process on the engine
+        iRenderingEngine->PlayL();
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpShowTask::GetMedia
+// provide media to be played back
+// --------------------------------------------------------------------------
+MUPnPItemResolver* CUpnpShowTask::GetMedia()
+    {
+    __ASSERTD( FilePipe(), __FILE__, __LINE__ );
+
+    MUPnPItemResolver* resolver = 0;
+
+    if ( FilePipe()->Count() > 0 )
+        {
+        const TDesC& filename = FilePipe()->FileAt( 0 );
+        __LOG1( "[UpnpCommand]\t CUpnpShowTask::GetMedia: %S", &filename );
+        TRAP_IGNORE (
+            resolver =
+                UPnPItemResolverFactory::NewLocalItemResolverL(
+                    filename,
+                    iResourceAllocator->AVController(),
+                    iSelector,
+                    UPnPItemResolverFactory::EOmitLocalMSStart );
+            );
+        }
+
+    return resolver;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowTask::RenderAck
+// Callback from image rendering engine.
+// --------------------------------------------------------------------------
+TInt CUpnpShowTask::RenderAck(
+    TInt aError,
+    const CUpnpItem* aItem )
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpShowTask::RenderAck aError %D", aError );
+    if ( aError == KErrNotSupported && aItem &&
+        UPnPItemUtility::BelongsToClass( *aItem, KClassVideo ) )
+        {
+        // NOTE!
+        // This is a special case. For video playback we use the image
+        // rendering engine for resolving, and then it fails with
+        // KErrNotSupported, because it is not an image. Now we catch the
+        // error here and play the resolved item. Why that complicated ?
+        // - to keep image rendering engine for image rendering ONLY
+        //   and not to mix video UI stuff in there
+        // - to enable image rendering engine reuse in the future
+        // - so that we do not have to rewrite the resolving code in
+        //   another place, it already exists in image rendering engine.
+        aError = PlayVideo( *aItem );
+        }
+
+    if ( aError != KErrDisconnected )
+        {
+        // disconnect message is handled in EngineShutdown
+        // other errors are handled here
+        if ( aError == KErrNotSupported || aError == KErrPermissionDenied )
+            {
+            TRAP_IGNORE( NoteHandler()->ShowDrmNoteL() );
+            }
+        else if( aError != KErrNone && iShowPlaybackFailedNote )
+            {
+            // note is shown only once per session
+            TRAP_IGNORE( NoteHandler()->ShowPlaybackFailedNoteL() );
+            iShowPlaybackFailedNote = EFalse;
+            }
+            
+        // inform observer
+        CommandEvent( UpnpCommand::EEventComplete, aError );
+        }
+        __LOG1( "[UpnpCommand]\t CUpnpShowTask::RenderAck end, resp=%d", aError );
+    return aError;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpShowTask::EngineShutdown
+// Callback from image rendering engine.
+// --------------------------------------------------------------------------
+void CUpnpShowTask::EngineShutdown(
+    TInt aError )
+    {
+    __ASSERTD( iRenderingEngine, __FILE__, __LINE__ );
+    
+    if ( iPlayingVideo )
+        {
+        __LOG1( "[UpnpCommand]\t CUpnpShowTask::EngineShutdown(%d)\
+while video playing",
+            aError );
+        TRAP_IGNORE( iCommonUI->DismissDialogL( aError ) );
+        }
+    else
+        {
+        __LOG1( "[UpnpCommand]\t CUpnpShowTask::EngineShutdown(%d)",
+            aError );
+            
+        if( aError == KErrDisconnected )
+            {
+            // check from rendering engine if wlan is active
+            // note shown only in device disappeared cases
+            if( iRenderingEngine->IsWlanActive() )
+                {
+                TRAP_IGNORE( NoteHandler()->ShowConnectionLostNoteL() );
+                }
+            }
+            
+            
+        // Inform the observer
+        __ASSERTD( TaskHandler(), __FILE__, __LINE__ );
+
+        CommandEvent( UpnpCommand::EEventComplete, aError);
+        }
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::EngineShutdown END" );
+    }
+
+
+    
+// --------------------------------------------------------------------------
+// CUpnpShowTask::PlayVideo
+// Launches the video player dialog for playing a video file on remote
+// --------------------------------------------------------------------------
+TInt CUpnpShowTask::PlayVideo( const CUpnpItem& aItem )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::CUpnpShowTask::PlayVideo start" );
+    
+    TInt videoPlayerError = KErrNone;
+    TInt videoStatus = KErrNone;
+
+    // Update the state
+    iPlayingVideo = ETrue;
+            
+            
+    // Launch the video player dialog to render the item.
+    TRAP( videoPlayerError,
+    
+        // start a rendering session ( used only for video playing )
+        if( !iVideoRenderingSession )
+            {
+            iVideoRenderingSession =
+                &iResourceAllocator->AVController().StartRenderingSessionL(
+                    iResourceAllocator->SelectedDevice() );
+            }
+        
+        // inform observer that we are launching dialog
+        __LOG( "[UpnpCommand]\t CUpnpShowTask::CUpnpShowTask::PlayVideo \
+launching videoplayerdialog" );
+        CommandEvent( UpnpCommand::EEventProgress,
+            UpnpCommand::KUpnpCommandStatusStartPlayVideo, EFalse );
+
+        // plays video     
+        videoStatus = iCommonUI->ExecuteVideoPlayerL(
+             *iVideoRenderingSession, aItem );
+        )
+
+    // Update the state
+    iPlayingVideo = EFalse;
+
+    // Fix UpnpCommonUi's return value
+    if( videoStatus > 0 )
+        {
+        videoStatus = KErrNone;
+        }
+
+    if( videoPlayerError != KErrNone &&
+        videoStatus == KErrNone )
+        {
+        videoStatus = videoPlayerError;
+        }
+
+    __LOG( "[UpnpCommand]\t CUpnpShowTask::CUpnpShowTask::PlayVideo end" );
+
+    // Inform the observer, no matter if the playing succeeded or failed.
+    return videoStatus;
+    }
+    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnptask.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for CUpnpTask base class.
+*
+*/
+
+
+// INCLUDE FILES
+// upnpframework / command api
+#include "upnpcommand.h"
+#include "upnpcommandcallback.h"
+
+// command internal
+#include "upnptask.h"
+#include "upnptaskhandler.h"
+#include "upnpcommandparameters.h"
+#include "upnpfilepipe.h"
+#include "upnpnotehandler.h"
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+
+
+// --------------------------------------------------------------------------
+// CUpnpTask::CUpnpTask
+// First phase construction.
+// --------------------------------------------------------------------------
+//
+CUpnpTask::CUpnpTask()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpTask::~CUpnpTask()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTask::CommandEvent
+// Notifies the client of an asynchronous command related event
+// --------------------------------------------------------------------------
+void CUpnpTask::CommandEvent(
+    UpnpCommand::TUpnpCommandEvent aEventType,
+    TInt aStatus,
+    TBool aKillTask )
+    {
+    __ASSERTD( iParameters!=0, __FILE__, __LINE__ );
+
+    // the callback interface
+    MUpnpCommandCallback* callback = NULL;
+    if( iParameters &&
+        iParameters->Observer() )
+        {
+        callback = iParameters->Observer();
+        }
+
+    // kill the task if instructed
+    if ( aKillTask )
+        {
+        TaskHandler()->DestroyTask();
+        }
+
+    // notify
+    if ( callback )
+        {
+        callback->CommandEvent( aEventType, aStatus );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTask::SetTaskHandlerL
+// Sets the pointer to the task handler.
+// --------------------------------------------------------------------------
+void CUpnpTask::SetTaskHandlerL( MUpnpTaskHandler* aTaskHandler )
+    {
+    // Check parameter
+    if( !aTaskHandler )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iTaskHandler = aTaskHandler;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTask::TaskHandler
+// Returns the pointer to the task handler.
+// --------------------------------------------------------------------------
+MUpnpTaskHandler* CUpnpTask::TaskHandler()
+    {
+    return iTaskHandler;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTask::SetCommandParametersL
+// Sets the pointer to the parameters.
+// --------------------------------------------------------------------------
+void CUpnpTask::SetCommandParametersL( CUpnpCommandParameters* aParameters )
+    {
+    // Check parameter
+    if( !aParameters )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iParameters = aParameters;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTask::CommandParameters
+// Returns the pointer to the parameters.
+// --------------------------------------------------------------------------
+CUpnpCommandParameters* CUpnpTask::CommandParameters()
+    {
+    return iParameters;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTask::SetFilePipeL
+// Sets the pointer to the file pipe.
+// --------------------------------------------------------------------------
+void CUpnpTask::SetFilePipeL( CUpnpFilePipe* aFilePipe )
+    {
+    // Check parameter
+    if( !aFilePipe )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iFilePipe = aFilePipe;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTask::FilePipeL
+// Returns the pointer to the file pipe.
+// --------------------------------------------------------------------------
+CUpnpFilePipe* CUpnpTask::FilePipe()
+    {
+    return iFilePipe;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTask::SetNoteHandlerL
+// Sets the pointer to the note handler.
+// --------------------------------------------------------------------------
+void CUpnpTask::SetNoteHandlerL( CUpnpNoteHandler* aNoteHandler )
+    {
+    // Check parameter
+    if( !aNoteHandler )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iNoteHandler = aNoteHandler;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTask::NoteHandler
+// Returns the pointer to the note handler.
+// --------------------------------------------------------------------------
+CUpnpNoteHandler* CUpnpTask::NoteHandler()
+    {
+    return iNoteHandler;
+    }
+
+    
+  
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommand/src/upnptaskresourceallocator.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,541 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  A class that allocates resources for a task
+*
+*/
+
+
+// INCLUDE FILES
+// upnpframework / avcontroller api
+#include "upnpavcontrollerfactory.h"    // UPnPAVControllerFactory
+#include "upnpavcontroller.h"           // MUPnPAVController
+#include "upnpavdevice.h"               // CUpnpAVDevice
+#include "upnpavbrowsingsession.h"      // MUPnPAVBrowsingSession
+
+// upnpframework / common ui
+#include "upnpcommonui.h"               // CUPnPCommonUI
+
+// command internal
+#include "upnpnotehandler.h"            // CUpnpNoteHandler
+#include "upnptaskresourceallocator.h"  // myself
+
+_LIT( KComponentLogfile, "upnpcommand.log");
+#include "upnplog.h"
+
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::NewL
+// --------------------------------------------------------------------------
+CUpnpTaskResourceAllocator* CUpnpTaskResourceAllocator::NewL(
+    CUPnPCommonUI& aCommonUI,
+    TInt aMode )
+    {
+    CUpnpTaskResourceAllocator* self = new (ELeave)
+        CUpnpTaskResourceAllocator( aCommonUI, aMode );
+
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::CUpnpTaskResourceAllocator
+// --------------------------------------------------------------------------
+CUpnpTaskResourceAllocator::CUpnpTaskResourceAllocator(
+    CUPnPCommonUI& aCommonUI,
+    TInt aMode )
+    : CAsyncOneShot( EPriorityStandard )
+    , iCommonUI( aCommonUI )
+    {
+    __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator: constructor" );
+
+    iState = EStateIdle;
+    iErrorCode = KErrNone;
+    iMode = aMode;
+    iLocalMSSCompleted = EFalse;
+
+    if ( iMode & EResourceLocalMediaServer ||
+         iMode & EResourceSelectDevice )
+        {
+        // if any of these flags are set, AVCONTROLLER flag is mandatory.
+        // assert that.
+        __ASSERTD( iMode & EResourceAvController, __FILE__, __LINE__ );
+        }
+
+    if ( iMode & EResourceLocalMediaServer )
+        {
+        // if this flag is set, one of the device selection flags is mandatory.
+        __ASSERTD( iMode & EResourceSelectDevice, __FILE__, __LINE__ );
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::~CUpnpTaskResourceAllocator
+// --------------------------------------------------------------------------
+CUpnpTaskResourceAllocator::~CUpnpTaskResourceAllocator()
+    {
+    if ( iState == EStateAllocating )
+        {
+        __ASSERTD( iNoteHandler, __FILE__, __LINE__ );
+        
+        SetErrorCode( KErrCancel );
+        if ( iNoteHandler )
+            {
+            iNoteHandler->CloseWaitNote();
+            }
+        }
+
+    Cleanup();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::Cleanup
+// --------------------------------------------------------------------------
+void CUpnpTaskResourceAllocator::Cleanup()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator::Cleanup" );
+
+    delete iSelectedDevice;
+    iSelectedDevice = 0;
+    
+    if ( iMediaServerSession )
+        {
+        // Stop local file sharing (release)
+        TRAPD( error, iMediaServerSession->ReleaseLocalMSServicesL() );
+        if( error != KErrNone )
+            {
+            __LOG1( "[UpnpCommand]\t CUpnpTaskResourceAllocator::\
+ReleaseLocalMSService failed %d", error );
+            }
+        
+        // Stop observing the rendering session
+        iMediaServerSession->RemoveObserver();
+
+        // Stop session
+        iAVController->StopBrowsingSession( *iMediaServerSession );
+        iMediaServerSession = NULL;
+        }
+
+    if( iAVController )
+        {
+        iAVController->RemoveDeviceObserver();
+        iAVController->Release(); // Fixes ESLX-7BMJBN
+        iAVController = NULL;
+        }
+
+    }
+
+
+
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::AllocateL
+// --------------------------------------------------------------------------
+void CUpnpTaskResourceAllocator::AllocateL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator::AllocateL" );
+
+    __ASSERTD( iNoteHandler, __FILE__, __LINE__ );
+    
+    // make CAsyncOneShot to do its trick in parallel
+    Call();
+
+    // show progress note in sync.
+    iState = EStateAllocating;
+    TInt status = iNoteHandler->RunConnectingWaitNote();
+    SetErrorCode( status );
+    iState = EStateReady;
+
+    // progress note has exited. Monitor errors from the progress note
+
+    // in error situation clean up resources and leave
+    if ( iErrorCode != KErrNone )
+        {
+        iState = EStateError;
+        Cleanup();
+        User::Leave( iErrorCode );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::AVController
+// --------------------------------------------------------------------------
+MUPnPAVController& CUpnpTaskResourceAllocator::AVController()
+    {
+    __ASSERT( iState == EStateReady, __FILE__, __LINE__ );
+    __ASSERT( iMode & EResourceAvController, __FILE__, __LINE__ );
+
+    return *iAVController;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::SelectedDevice
+// --------------------------------------------------------------------------
+const CUpnpAVDevice& CUpnpTaskResourceAllocator::SelectedDevice()
+    {
+    __ASSERT( iState == EStateReady, __FILE__, __LINE__ );
+    __ASSERT( iMode & EResourceSelectDevice, __FILE__, __LINE__ );
+    __ASSERT( iSelectedDevice, __FILE__, __LINE__ );
+
+    return *iSelectedDevice;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::RunL
+// --------------------------------------------------------------------------
+void CUpnpTaskResourceAllocator::RunL()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator::RunL" );
+
+    // make sure we are still on the go
+    if ( iState == EStateAllocating )
+        {
+        // starting of AVController
+        StartAvControllerL();
+        }
+    else
+        {
+        __LOG1( "[UpnpCommand]\t CUpnpTaskResourceAllocator::RunL \
+    StartAvControllerL not done in state %d", iState );
+        }
+    // make sure we are still on the go
+    if ( iState == EStateAllocating )
+        {
+        // select device
+        SelectDeviceL();
+        }
+    else
+        {
+        __LOG1( "[UpnpCommand]\t CUpnpTaskResourceAllocator::RunL \
+    SelectDeviceL not done in state %d", iState );
+        }
+    // make sure we are still on the go
+    if ( iState == EStateAllocating )
+        {
+        // start the local mediaserver
+        StartLocalMediaServerL();
+        }
+    else
+        {
+        __LOG1( "[UpnpCommand]\t CUpnpTaskResourceAllocator::RunL \
+    StartLocalMediaServerL not done in state %d", iState );
+        }        
+    // make sure we are still on the go
+    if ( iState == EStateAllocating )
+        {
+        // if local media server was started but not yet completed,
+        // wait for callback
+        if ( iMode & EResourceLocalMediaServer
+            && !iLocalMSSCompleted )
+            {
+            __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator::RunL \
+    waiting for ReserveLocalMSServicesCompleted" );
+            iState = EStateWaitingForLMS;
+            }
+        // otherwise we are done now
+        else
+            {
+            // close the wait note
+            __ASSERTD( iNoteHandler, __FILE__, __LINE__ );
+            iNoteHandler->CloseWaitNote();
+            }
+        }
+    else
+        {
+        __LOG1( "[UpnpCommand]\t CUpnpTaskResourceAllocator::RunL \
+    CloseWaitNote not done in state %d", iState );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::RunError
+// --------------------------------------------------------------------------
+TInt CUpnpTaskResourceAllocator::RunError( TInt aError )
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpTaskResourceAllocator::RunError: %d",
+        aError );
+
+    __ASSERTD( iNoteHandler, __FILE__, __LINE__ );
+    
+    // asynchronous operation leaves. store the error code and make the
+    // wait note exit.
+    SetErrorCode( aError );
+    iNoteHandler->CloseWaitNote();
+        
+    return KErrNone;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::StartAvControllerL
+// --------------------------------------------------------------------------
+void CUpnpTaskResourceAllocator::StartAvControllerL()
+    {
+    if ( iMode & EResourceAvController )
+        {
+        __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator::\
+StartAvControllerL" );
+
+        // Create new UpnpAvController client instance
+        iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL();
+
+        // Register as an observer (for WLAN lost notification) 
+        iAVController->SetDeviceObserver( *this );
+        }
+    else
+        {
+        __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator::\
+    AvController not started" );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::StartLocalMediaServerL
+// --------------------------------------------------------------------------
+void CUpnpTaskResourceAllocator::StartLocalMediaServerL()
+    {
+    if ( iMode & EResourceLocalMediaServer )
+        {
+        __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator::\
+StartLocalMediaServerL" );
+
+        // create a dummy device
+        CUpnpAVDevice* dummyDevice = CUpnpAVDevice::NewLC();
+        dummyDevice->SetUuidL( KNullDesC8 );
+        dummyDevice->SetDeviceType(CUpnpAVDevice::EMediaServer);    
+        // create a session for mediaserver resources keepalive
+        iMediaServerSession =
+            &iAVController->StartBrowsingSessionL( *dummyDevice );
+        iMediaServerSession->SetObserver( *this );
+        CleanupStack::PopAndDestroy( dummyDevice );
+        // now reserve
+        iMediaServerSession->ReserveLocalMSServicesL();
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::SelectDeviceL
+// --------------------------------------------------------------------------
+//
+void CUpnpTaskResourceAllocator::SelectDeviceL()
+    {
+    if ( iMode & EResourceSelectDevice )
+        {
+        __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator::SelectDeviceL" );
+
+        TInt status = KErrNone;
+        
+        // decide device filters and popup title
+        TUPnPDeviceTypesToSearch deviceFilter =
+            EUPnPSearchAllDevices;
+        TUPnPDialogTitle popupTitle = EUPnPSelectDeviceTitle;
+
+        if ( iMode & EResourceSelectImageRenderer )
+            {
+            deviceFilter = EUPnPSearchRenderingDevicesWithImageCapability;
+            }
+        else if ( iMode & EResourceSelectCopyServer )
+            {
+            deviceFilter = EUPnPSearchServerDevicesWithCopyCapability;
+            popupTitle = EUPnPCopyToTitle;
+            }
+        else if ( iMode & EResourceSelectMoveServer )
+            {
+            deviceFilter = EUPnPSearchServerDevicesWithCopyCapability;
+            popupTitle = EUPnPMoveToTitle;
+            }
+        
+        // Launch the device selection dialog
+        CUpnpAVDevice* tempDevice = CUpnpAVDevice::NewL();
+        CleanupStack::PushL( tempDevice );
+        status = iCommonUI.SelectDeviceL(
+                  *iAVController,
+                  *tempDevice,
+                  deviceFilter,
+                  popupTitle );
+
+        // Fix UpnpCommonUi return value
+        if( status > 0 )
+            {
+            status = KErrNone;
+            }
+
+        if( status != KErrNone )
+            {
+            // failed
+            User::Leave( status );
+            }
+
+        CleanupStack::Pop( tempDevice );
+        iSelectedDevice = tempDevice;
+
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::SetErrorCode
+// --------------------------------------------------------------------------
+void CUpnpTaskResourceAllocator::SetErrorCode( TInt aErrorCode )
+    {
+    __LOG2( "[UpnpCommand]\t CUpnpTaskResourceAllocator::SetErrorCode \
+%d -> %d", iErrorCode, aErrorCode );
+
+    if ( iErrorCode == KErrNone )
+        {
+        __LOG( "error code changed");
+        iErrorCode = aErrorCode;
+        } 
+    // if user cancelled operation, we don't need other error codes
+    // so it's ok to reset old error code
+    else if ( aErrorCode == KErrCancel )
+        {
+        __LOG( "error code reseted");
+        iErrorCode = aErrorCode;
+        }
+    }
+
+// ==========================================================================
+// Methods for AVController device observer
+// ==========================================================================
+    
+    
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::WLANConnectionLost
+// --------------------------------------------------------------------------
+void CUpnpTaskResourceAllocator::WLANConnectionLost()
+    {
+    __LOG( "[UpnpCommand]\t CUpnpTaskResourceAllocator::WLANConnectionLost" );
+
+    if ( iState == EStateAllocating || iState == EStateWaitingForLMS )
+        {
+        __ASSERTD( iNoteHandler, __FILE__, __LINE__ );
+        SetErrorCode( KErrDisconnected );
+        iNoteHandler->CloseWaitNote();
+        iState = EStateError;
+        }
+    }
+
+void CUpnpTaskResourceAllocator::UPnPDeviceDiscovered(
+    const CUpnpAVDevice& /*aDevice*/ )
+    {
+    }
+
+void CUpnpTaskResourceAllocator::UPnPDeviceDisappeared(
+    const CUpnpAVDevice& aDevice )
+    {
+    __ASSERTD( iNoteHandler, __FILE__, __LINE__ );
+    if ( ( iState == EStateAllocating || iState == EStateWaitingForLMS )
+         && iSelectedDevice != 0 )
+        {
+        if ( aDevice.Uuid() == iSelectedDevice->Uuid() )
+            {
+            __LOG( "[UpnpCommand]\t selected device lost !" );
+            SetErrorCode( KErrDisconnected );
+            iNoteHandler->CloseWaitNote();
+            iState = EStateError;
+            }
+        }
+    }
+    
+    
+// ==========================================================================
+// Methods for AVController browsing session observer
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::ReserveLocalMSServicesCompleted
+// --------------------------------------------------------------------------
+void CUpnpTaskResourceAllocator::ReserveLocalMSServicesCompleted( TInt aError )
+    {
+    __LOG1( "[UpnpCommand]\t CUpnpTaskResourceAllocator::\
+ReserveLocalMSServicesCompleted: %d", aError );
+
+    if ( iState == EStateAllocating 
+        || iState == EStateWaitingForLMS )
+        {
+        iLocalMSSCompleted = ETrue;
+        SetErrorCode( aError );
+        if ( aError == KErrNone )
+            {
+            iLocalMSStarted = ETrue;
+            iMediaServerSession->RemoveObserver();
+            }
+        // allocation done, just waiting for this callback
+        // close note and we are done
+        if( iState == EStateWaitingForLMS )
+            {
+            iNoteHandler->CloseWaitNote();
+            }
+        }
+    }
+
+
+void CUpnpTaskResourceAllocator::BrowseResponse(
+    const TDesC8& /*aBrowseResponse*/,
+    TInt /*aError*/,
+    TInt /*aMatches*/,
+    TInt /*aTotalCount*/,
+    const TDesC8& /*aUpdateId*/ )
+    {
+    }
+
+void CUpnpTaskResourceAllocator::SearchResponse( 
+    const TDesC8& /*aSearchResponse*/,
+    TInt /*aError*/,
+    TInt /*aMatches*/,
+    TInt /*aTotalCount*/,
+    const TDesC8& /*aUpdateId*/ )
+    {
+    }
+
+void CUpnpTaskResourceAllocator::SearchCapabilitiesResponse( 
+    TInt /*aError*/,
+    const TDesC8& /*aSearchCapabilities*/ )
+    {
+    }
+
+void CUpnpTaskResourceAllocator::CreateContainerResponse(
+    TInt /*aError*/, 
+    const TDesC8& /*aObjectId*/ )
+    {
+    }
+
+void CUpnpTaskResourceAllocator::DeleteObjectResponse(
+    TInt /*aError*/ )
+    {
+    }
+ 
+void CUpnpTaskResourceAllocator::MediaServerDisappeared(
+    TUPnPDeviceDisconnectedReason /*aReason*/ )
+    {
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CUpnpTaskResourceAllocator::SetNoteHandlerL
+// Sets the pointer to the note handler.
+// --------------------------------------------------------------------------
+void CUpnpTaskResourceAllocator::SetNoteHandlerL( 
+                                        CUpnpNoteHandler* aNoteHandler )
+    {
+    // Check parameter
+    if( !aNoteHandler )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iNoteHandler = aNoteHandler;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/BWINS/upnpcommonuiu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,27 @@
+EXPORTS
+	?DismissDialogL@CUPnPCommonUI@@QAEXH@Z @ 1 NONAME ; void CUPnPCommonUI::DismissDialogL(int)
+	?GetUpperMostItem@CUPnPBrowseCacheItem@@QBEHXZ @ 2 NONAME ; int CUPnPBrowseCacheItem::GetUpperMostItem(void) const
+	??1CUPnPCommonUI@@UAE@XZ @ 3 NONAME ; CUPnPCommonUI::~CUPnPCommonUI(void)
+	?SelectDeviceL@CUPnPCommonUI@@QAEHAAVMUPnPAVController@@AAVCUpnpAVDevice@@W4TUPnPDeviceTypesToSearch@@W4TUPnPDialogTitle@@@Z @ 4 NONAME ; int CUPnPCommonUI::SelectDeviceL(class MUPnPAVController &, class CUpnpAVDevice &, enum TUPnPDeviceTypesToSearch, enum TUPnPDialogTitle)
+	?SetFirstItem@CUPnPBrowseCacheItem@@QAEXH@Z @ 5 NONAME ; void CUPnPBrowseCacheItem::SetFirstItem(int)
+	??1CUPnPBrowseDialog@@UAE@XZ @ 6 NONAME ; CUPnPBrowseDialog::~CUPnPBrowseDialog(void)
+	?NewL@CUPnPNaviPaneContainer@@SAPAV1@ABVTRect@@VTPoint@@PAVCAknNavigationControlContainer@@@Z @ 7 NONAME ; class CUPnPNaviPaneContainer * CUPnPNaviPaneContainer::NewL(class TRect const &, class TPoint, class CAknNavigationControlContainer *)
+	?GetItem@CUPnPBrowseCacheItem@@QAEPBVCUpnpObject@@H@Z @ 8 NONAME ; class CUpnpObject const * CUPnPBrowseCacheItem::GetItem(int)
+	?GetHighlightedItem@CUPnPBrowseCacheItem@@QBEHXZ @ 9 NONAME ; int CUPnPBrowseCacheItem::GetHighlightedItem(void) const
+	?ContainerId@CUPnPBrowseCacheItem@@QBEABVHBufC8@@XZ @ 10 NONAME ; class HBufC8 const & CUPnPBrowseCacheItem::ContainerId(void) const
+	?ExecuteBrowseDialogL@CUPnPCommonUI@@QAEHAAVMUPnPAVController@@ABVCUpnpAVDevice@@@Z @ 11 NONAME ; int CUPnPCommonUI::ExecuteBrowseDialogL(class MUPnPAVController &, class CUpnpAVDevice const &)
+	?ExecuteDeviceDialogL@CUPnPCommonUI@@QAEHAAVMUPnPAVController@@@Z @ 12 NONAME ; int CUPnPCommonUI::ExecuteDeviceDialogL(class MUPnPAVController &)
+	?NewL@CUPnPCommonUI@@SAPAV1@XZ @ 13 NONAME ; class CUPnPCommonUI * CUPnPCommonUI::NewL(void)
+	?PlayL@CUPnPLocalPlayer@@QAEXABVCUpnpObject@@@Z @ 14 NONAME ; void CUPnPLocalPlayer::PlayL(class CUpnpObject const &)
+	?DisplayConnectionErrorNoteL@CUPnPCommonUI@@QAEXXZ @ 15 NONAME ; void CUPnPCommonUI::DisplayConnectionErrorNoteL(void)
+	?NewL@CUPnPBrowseDialog@@SAPAV1@HAAVMUPnPAVController@@ABVCUpnpAVDevice@@AAVCUPnPCommonUI@@@Z @ 16 NONAME ; class CUPnPBrowseDialog * CUPnPBrowseDialog::NewL(int, class MUPnPAVController &, class CUpnpAVDevice const &, class CUPnPCommonUI &)
+	?NewL@CUPnPLocalPlayer@@SAPAV1@AAVMUPnPAVController@@AAVMUPnPAVBrowsingSession@@AAVCUPnPCommonUI@@@Z @ 17 NONAME ; class CUPnPLocalPlayer * CUPnPLocalPlayer::NewL(class MUPnPAVController &, class MUPnPAVBrowsingSession &, class CUPnPCommonUI &)
+	?ExecuteVideoPlayerL@CUPnPCommonUI@@QAEHAAVMUPnPAVRenderingSession@@ABVCUpnpObject@@@Z @ 18 NONAME ; int CUPnPCommonUI::ExecuteVideoPlayerL(class MUPnPAVRenderingSession &, class CUpnpObject const &)
+	?ExecuteMusicPlayerL@CUPnPCommonUI@@QAEHAAVMUPnPAVController@@PAVCUPnPPlayListFiller@@PBVCUpnpAVDevice@@@Z @ 19 NONAME ; int CUPnPCommonUI::ExecuteMusicPlayerL(class MUPnPAVController &, class CUPnPPlayListFiller *, class CUpnpAVDevice const *)
+	?NewL@CUPnPBrowseCacheItem@@SAPAV1@ABVTDesC8@@HH@Z @ 20 NONAME ; class CUPnPBrowseCacheItem * CUPnPBrowseCacheItem::NewL(class TDesC8 const &, int, int)
+	?SetHighLightedItem@CUPnPBrowseCacheItem@@QAEXH@Z @ 21 NONAME ; void CUPnPBrowseCacheItem::SetHighLightedItem(int)
+	??1CUPnPBrowseCacheItem@@UAE@XZ @ 22 NONAME ; CUPnPBrowseCacheItem::~CUPnPBrowseCacheItem(void)
+	?SetItemArrayL@CUPnPBrowseCacheItem@@QAEXABV?$RPointerArray@VCUpnpObject@@@@@Z @ 23 NONAME ; void CUPnPBrowseCacheItem::SetItemArrayL(class RPointerArray<class CUpnpObject> const &)
+	?GetNumberOfItems@CUPnPBrowseCacheItem@@QBEHXZ @ 24 NONAME ; int CUPnPBrowseCacheItem::GetNumberOfItems(void) const
+	?DisplayConnectionLostCopyErrorNoteL@CUPnPCommonUI@@QAEXXZ @ 25 NONAME ; void CUPnPCommonUI::DisplayConnectionLostCopyErrorNoteL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/EABI/upnpcommonuiu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,40 @@
+EXPORTS
+	_ZN13CUPnPCommonUI13SelectDeviceLER17MUPnPAVControllerR13CUpnpAVDevice24TUPnPDeviceTypesToSearch16TUPnPDialogTitle @ 1 NONAME
+	_ZN13CUPnPCommonUI14DismissDialogLEi @ 2 NONAME
+	_ZN13CUPnPCommonUI19ExecuteMusicPlayerLER17MUPnPAVControllerP19CUPnPPlayListFillerPK13CUpnpAVDevice @ 3 NONAME
+	_ZN13CUPnPCommonUI19ExecuteVideoPlayerLER23MUPnPAVRenderingSessionRK11CUpnpObject @ 4 NONAME
+	_ZN13CUPnPCommonUI20ExecuteBrowseDialogLER17MUPnPAVControllerRK13CUpnpAVDevice @ 5 NONAME
+	_ZN13CUPnPCommonUI20ExecuteDeviceDialogLER17MUPnPAVController @ 6 NONAME
+	_ZN13CUPnPCommonUI27DisplayConnectionErrorNoteLEv @ 7 NONAME
+	_ZN13CUPnPCommonUI35DisplayConnectionLostCopyErrorNoteLEv @ 8 NONAME
+	_ZN13CUPnPCommonUI4NewLEv @ 9 NONAME
+	_ZN13CUPnPCommonUID0Ev @ 10 NONAME
+	_ZN13CUPnPCommonUID1Ev @ 11 NONAME
+	_ZN13CUPnPCommonUID2Ev @ 12 NONAME
+	_ZN16CUPnPLocalPlayer4NewLER17MUPnPAVControllerR22MUPnPAVBrowsingSessionR13CUPnPCommonUI @ 13 NONAME
+	_ZN16CUPnPLocalPlayer5PlayLERK11CUpnpObject @ 14 NONAME
+	_ZN20CUPnPBrowseCacheItem12SetFirstItemEi @ 15 NONAME
+	_ZN20CUPnPBrowseCacheItem13SetItemArrayLERK13RPointerArrayI11CUpnpObjectE @ 16 NONAME
+	_ZN20CUPnPBrowseCacheItem18SetHighLightedItemEi @ 17 NONAME
+	_ZN20CUPnPBrowseCacheItem4NewLERK6TDesC8ii @ 18 NONAME
+	_ZN20CUPnPBrowseCacheItem7GetItemEi @ 19 NONAME
+	_ZN22CUPnPNaviPaneContainer4NewLERK5TRect6TPointP30CAknNavigationControlContainer @ 20 NONAME
+	_ZNK20CUPnPBrowseCacheItem11ContainerIdEv @ 21 NONAME
+	_ZNK20CUPnPBrowseCacheItem16GetNumberOfItemsEv @ 22 NONAME
+	_ZNK20CUPnPBrowseCacheItem16GetUpperMostItemEv @ 23 NONAME
+	_ZNK20CUPnPBrowseCacheItem18GetHighlightedItemEv @ 24 NONAME
+	_ZTI13CUPnPCommonUI @ 25 NONAME
+	_ZTI16CUPnPLocalPlayer @ 26 NONAME
+	_ZTI17CUPnPBrowseDialog @ 27 NONAME
+	_ZTI20CUPnPBrowseCacheItem @ 28 NONAME
+	_ZTI22CUPnPNaviPaneContainer @ 29 NONAME
+	_ZTI27CCustomCtrlDlgCustomControl @ 30 NONAME
+	_ZTI6CImage @ 31 NONAME
+	_ZTV13CUPnPCommonUI @ 32 NONAME
+	_ZTV16CUPnPLocalPlayer @ 33 NONAME
+	_ZTV17CUPnPBrowseDialog @ 34 NONAME
+	_ZTV20CUPnPBrowseCacheItem @ 35 NONAME
+	_ZTV22CUPnPNaviPaneContainer @ 36 NONAME
+	_ZTV27CCustomCtrlDlgCustomControl @ 37 NONAME
+	_ZTV6CImage @ 38 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_graf_upnp_ext_renderer.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,527 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="245.3867 439.0518" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="352" height="286"
+	 viewBox="0 0 352 286" overflow="visible" enable-background="new 0 0 352 286" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="&ns_vars;">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="153.052" x="245.387" width="352" height="286" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about=''
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-08-31T11:03:11Z</xap:CreateDate>
+  <xap:ModifyDate>2005-08-31T11:03:17Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>256</xapGImg:width>
+     <xapGImg:height>208</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgA0AEAAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7&#xA;FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F&#xA;XYqp3FzbW0RluJUhiHWSRgqj6TQYql8fmryvK/pxaxYvIDQotzETXp0DYqmMNxBMvKGRZV/mRgw3&#xA;+WKr8VdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdiqSa&#xA;x5dvNRQhdd1CyX+W2MEY/wCCEXP/AIbFWCan+Rkl8/rnzFPNIRUPcx+sTX/L9QYKVJ5fyE12M1g1&#xA;G1l8PUEkf6lkxpUP/wAqh85WrcooopWHRoplU/8AD8MaVExeX/zIsPsi/jp/vmZmH/JNj4YqjIta&#xA;/MGz/vZrxKf7/iLf8nFPjiqOtvPvmlNpJY5SNjzjUH/heOKprb/mHqx/vrWBv9Tmv6y2NqmMHn0N&#xA;T1bEr7rJX8CoxtUfF5y05/tRTIfkpH/EsKouPzHpL/7tK/6yt/AHFUSmqac/2bhPpPH9dMVV0mhf&#xA;7Eit8iDiq/FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXnHm2NNZuri01DlLaRyM&#xA;i2/N1j+BqAlVIBPucyYRADWSxuLyPo8H+8Ml3YeBtrmVKfezZKkIyLSvMtuP9D81aolOn1iRbkf8&#xA;OMHAFsouK+/M63/u9ftr2nQXVmkf3mEg4PDCeIoqPzh+Z0H9/p2lXoHa3kmhY/8AIzkK5HwgnjRK&#xA;fmX5ki/3u8o3CgdWtbmG4r7haIfoweEvGqH81vLzgDUtF1S07E3FlyX6Cheo3yJxFPEHRef/AMpL&#xA;s8TdW0Un7SzW8kDA7dSyJ+vI+GU8QTK2k/Lm+p9Uv7KRj2iulLf8Dz/hg4Sto8eVNJdQ8MknE9Cr&#xA;Ky/qwJWnypEPsXBH+stf1EYq1/hudfsyofnUf1xV36EvF7K3yP8AWmKr0sb2PorD/VP9DiqqpvU6&#xA;tIPnX+OKqyXVyOrV+YGKqy3U3cA4qqLct3XFV4mB7HFVwkU4q3yGKt1GKuxV2KuxV2KuxV2KuxV2&#xA;KuxV2KvPNTH+5O7/AOM8n/EzmVHkGo80PJJHDE8sh4xxqXdtzRVFSdskhi0H5u/lpJcPbHzDaQzR&#xA;sUdLhmgowNCKyhBkeIJosg0/zP5Z1Cn1DV7K8r09C4ilr/wDHDYRScKMKqijCqooxV0lrbzjjNEk&#xA;q+DqGH44qgJ/JvlS5/vtItCT1ZYUQ/eoB7Yqgx+WnlJWL2ttLZyHq9tcTRn/AInT8MaVVXyZfQb2&#xA;PmfWbfwR7n1ox16LIp8fHI8ATZVBZfmNbf7z+a1uFH2YrqxhPj1kQq2ROILxFeutfmtbfaTRr5B4&#xA;fWIJD/xJMHhBPGqJ5+87QbXnlL1VHWW1vYm+6N1VvxyPgp41VPzXt49r7y9rFqf2nFsJox0/aR/f&#xA;wweEU8StF+b/AJAchZ797SQ/7rubeeM9u/Ar38cj4ZTxBNbXzv5Hu6ehrVgzHopnjRv+BYq2DhK2&#xA;nEEllcJzt5ElT+aNgw/AnIpVfSXFXemMVb44q6mKt0xV2KuxV2KuxV2KuxV2KuxV2KvP9SH+5K7/&#xA;AOM0n/EzmVHkGo80v1Uf7ib3/jBL/wAQOSQ+O9KsbW78w+YBPCkwW4WgkUNSrP4j2zO7MxxkZ8QB&#xA;5fpdb2pklHhokc/0JlJ5T0OX7Vmg/wBWqf8AESM2UtDhP8IdbHXZh/EVW10F7Kn6N1G/06n2fqt1&#xA;JHT5bnKT2ZiPKx8W2PamUc6PwTi11z8yLL/eLzlqW3T60wu/Hr61a5VLsodJH726Pax6xCc2v5p/&#xA;nRaD/jsWOoEf8tVmkdev++AmVS7MyDlIFtj2tDrEpza/n/8AmfB/vb5f0u9p/wAss01vXr09Vpfb&#xA;/PpUdDmHQH4t0e0sJ6kfBObX/nJm4T/jpeS76Hx+qXEV14/5MXtlR0+Uc4n726OrwnlIfcnNp/zk&#xA;7+XbU+vWuraZ4/WrM0H/ACKeXKjY5gj4N0ZxlyIPxT2x/Pz8ob6gh8y26E/8tCTW/wDyeSPI+IGf&#xA;CWR2HnfybqVP0fr2n3ZPQQXUMh+5WOHiCKTbkCAQag7gjCqwnFVhOKqUiq6lXAZT1BFRiqWXPl3y&#xA;/cf3+m2sh8WhjJ++lcCpXN+X/lB25rp4ikHR4ZJIyO37DDFW18qyQf7w67q9mOyxXjlO/VW5V64O&#xA;EJtWWPz5bf7yea5io/YuraCevXYsQGyPhhPEVLUfO35l6HaNezfo/VrSD4rhRFJDMEHVhxbj89jT&#xA;wwHEF4i9D8o+Z7PzNoFtrFqhiScESQsQWjkQ8XUkddxse4yiQoswU2eRV64ErIZfUZh4Yqq4q7FX&#xA;Yq7FXYq7FXYq7FWBaiP9yV3/AMZpP+JHMuPINR5pfqw/3E3v/GCX/iBwofJHlSFpfMnmNVBZjcRh&#xA;VG5JLSbDNj2Tzn8P0uo7Y/g+P6Get5K80JCJm0i8EZ35ehJ08Tttm18aHeHT8Eu4sj8l/lTfeYLd&#xA;ry6n+oWauY1qnKV2XZqKSvEA7VP3ZRn1QgaG5bcWAy35JrrP5G6jBwbSbxLsMwV45h6TKCacuQLB&#xA;gOp6HwrlcNcD9QpnPSnoU6sPyL0NYF+v39zLPQcjB6caA9wA6yE5VLXyvYBmNIOpY35y/Ka40S0f&#xA;UNOnN5Yx7zo60ljH822zL49KZkYNWJmjsWnLpzEWOTBRb+2Zji2uFv7Yrad+WfJdvrH6RvLuwjub&#xA;CxsruSZ5VBAmFpM8FPcOgb6MxNVKIoGrJH3i3L0ombIuog/caYlN5L8tzfb06Ef6i+n/AMQ44ZaP&#xA;Ef4Qxjrsw/iKy38k6baNy02e805q1BtbmWM123+0fDKT2bh6Aj4t0e1cw5kH4Jpbf47sqfUPOmsI&#xA;F+ytzN9bUUptSUUptlR7Lj0kW+PbM+sQmdv50/Oizpw8yWuoKvRbyxiTYU2LQhWPTrlR7Mn0l9jd&#xA;HtmPWJ+aYwfm/wDm7bgC70jRtQA720k8DHp19QuK5UdBmH80t8e1sJ/nD4JhB+fnmGPbUvJFygH2&#xA;ns7yK4r7heKH6K5UdNmHOLdHX4Dykjov+ciPKYoL/SNa04/tNPZ1T6Gjd6j6MqMZDnGQ+DfHNjly&#xA;lE/FkflX81fIvmu+bT9E1L6xfqjSvavDPE4RSAx/eIq7ch0OQEgW2mUk5JUu14/7hNQ/5hpv+TZx&#xA;VF/84/8A/KCSf8xs3/EI8x8vNnHkza7uOMjivQ0ytku0mb1JJfYD+OKplirsVdirsVdirsVdirsV&#xA;YLqA/wByN1/xmk/4kcy48g1Hml+rD/cTe/8AMPL/AMQOFD5u/I3VtO0n8xtfvdQj526zKnqU5GJn&#xA;MoEgHt7ZlaGBlGYHl+l1nacxGUCfP9D6utrq2uoEntpVmhkFUkQhlI9iMBBBotAIO4VcCXYq7FVk&#xA;0Uc0TwyqHikUo6HoVYUIOINIIt5X5u/KyCwsZdQ0iV5I4AXntpaFgg3ZkYAdPA/fmywaziNSdfm0&#xA;vCLiwS20+a5njt4IzJPMwjijXcszGgA+ZzOlIAWXCiCTQ5l76fKUHl78uptLjANw9tdvdyj9uZ7O&#xA;YMfkv2R7DOc/MHJn4ulivdxB6n8sMWn4etG/fwl4NLYyQzPDItJI2KOPAqaHOijISAI6vLTBiSDz&#xA;DQt/bJMbXC39sUWuFv7Yra4W/tii1wt/bFbXC29sVtJfy1Xh+f8AqA/7VR/VDnO67+/Puet7K/xc&#xA;e8/e+gScoc9LtdP+4XUP+Yab/k2cVRv/ADj/AP8AKCyf8x03/EI8x8vNnHkyLU7jjdzCvRjlbJFe&#xA;WZfUluPYL+s4qn2KuxV2KuxV2KuxV2KuxVg9+P8Achdf8ZZP+JHMuPINR5oDVh/uIvv+YeX/AIgc&#xA;KHyl+XgDeZfNKftGeMj5BpR/HNh2UfVP4fpdL23yh8f0PTNL1LVtLk9TT7qS3JNSEPwn/WU/CfpG&#xA;baeOMuYdFDLKPIst0/8ANHXYQFvLeG7UdWFYnP0iq/8AC5iy0UTyNOTHXSHMWntr+aekuALm0nhY&#xA;9eHGRR9NUP4ZRLQy6EN8dfHqCmcX5g+VXFWumjPg0Un/ABqrZWdJk7mwazH3qj+evKqUrfA1/ljl&#xA;P6lwDS5O5J1ePvQHmDzzoY0u4hs5vrVxPG0aIqsFHMFasWAFBXplmLSz4gTsGvNq4cJANlD/AJPe&#xA;UBJdN5gukrHATHYqe8lKPJ/sQaD3+WQ7U1NDwx15uR2NpLPinkOT0fzSFOkzK37UdwKHv/osuanB&#xA;9Xy+8O81P0/P/cl4l520f6vq5nVaR3I5f7Ndm/gc3fZebix8PWLzfbODgy8Q5S+9j4tvbNk6i1wt&#xA;vbFFrxbe2K2uFt7YotcLb2xW1wtvbFbYt5BXh/zkLqQ/7VX/ABrBnPa3+/Puew7J/wAWHvP3veSc&#xA;odgl+uH/AHDX/wDzDTf8mzgVH/8AOP8A/wAoLJ/zHTf8QjyjLzZx5I7WrjjqNyK9JG/XlbJMfJUv&#xA;qT3fsqfrOKsrxV2KuxV2KuxV2KuxV2KsKvx/p9z/AMZX/wCJHMuPINR5oDVx/uIvv+YeX/iBwofL&#xA;P5bxBvN/mgAdGhP3l8z+y/qn8HSdun0w+P6HpAtvbNy85a4W3titrhbe2KLXC29sVtcLb2xW0fou&#xA;hT6pqUFjCKNK1GfsqjdmPyGVZswxwMj0btNhllmIDq9+0uztrCxgsrVeEECBI19h3Puepzk8kzOR&#xA;keZe7xYxCIjHkEJ5oP8AuMY9aLOaf9Gs2W6Yer5f7oNGsNQ+f+5kwnzrpIuNPd1WskB9RfkPtfhl&#xA;3Z2bgyjuls4/a+DxMJI5x3/W8+Ft7Z0zxdrhbe2KLXC29sVtcLb2xRa4W3titrhbe2K2wbyavD/n&#xA;IvUx/wBqr/jWDOe1v9+fc9l2R/i0fefve5k5juyS/XD/ALhr/wD5h5f+IHFUx/5x/wD+UFk/5jpv&#xA;+IR5Rl5s48lLzDccdYvBXpK/68rZJz+XcvO4vvZY/wBbYqzbFXYq7FXYq7FWN65+YGhaLN6N3BqT&#xA;yVP9xpt9Mm3UiRITGfobFUnH55flkoH1jVJbM0BIurK9goGNBVpIVXr74qmNl+a/5Z3tBB5o0zk2&#xA;yrJdRRMTWlAshQ1xVLX1bSry8ne0vYLhWlYq0UqODyY0pxJ65lxOwaip6uP9xF9/zDy/8QOFD4/8&#xA;s+ZX0Lzb5glFuLhJnjV1LFCOPI7GjfqzP7L+qfw/S6rtfDxxiL7/AND0Gy/Mry7NQXMc1q3clQ6D&#xA;6VJb/hc3FvPS0cxy3T6y8yeWrugg1GAs3RXb02P+xficbaJYZjmE3jiR1DoQyHowNQfpGFqJVBbe&#xA;2KLXC29sVt6J5C0VbG1N9Kv+k3Q+CvVYuo/4Lr92c92lqeOXAOUfveu7F0fhw8SX1S+79rNYpM1j&#xA;u0H5hBfTmUbkpPQfO2lGZGm+r5f7oOHrfo+f+5kgtStQysCKgihGY4LlkW8wvdNNtdywU2Rjx/1T&#xA;uPwzrdPl8SAl3vnusw+FllDuP2dFIW3tlzjWuFt7Yra4W3tii1wtvbFbXC3xRbzfyyvD/nJDVB/2&#xA;qh/xCDOe1v8Afn3Pbdjf4tH3n73tZOUOzQGtn/cNf/8AMPL/AMQOKpn/AM4//wDKCyf8x03/ABCP&#xA;KMvNnHklHmi4469fivSd/wBeVsk//KyXnc6j7JF+tsVehYq7FXYq7FWC+c/P11p17JpmmKgmjAE1&#xA;y45cWYVoi9KgHqa/LN52f2VHJDjmdjyDz/aXbEsU+CAFjmSxCLz75zjcsdUaUdkkht+P/CRo345n&#xA;y7GwnlYdfHt/MOYiURH+annKJv3w0+aMdP8AR5kcj3YTla/7HKZdhw6SLkQ9oZdYfahrr8xtOu2K&#xA;6t5O0y+U/akd1Yn/AJ5yW0nif28x5dhy6SDlQ7fxnnEoP/EP5P3D8b3yU9qT1e0WBYxua/3c0Dd+&#xA;y5jy7HzDlRcmHbOA8yR8E20tPyfvj6Gm6vLpUzjgLe6aSFCTtwrOFVya9FkOYuTR5sfOJczFq8WT&#xA;6ZBEX3/ON35c3yzvJDJbXtzQteWjCIllrxPA80PX+XIYNTPEbHVlm08cg3fOv5nflvqfkTzD+jLm&#xA;QXVpOnrWF6q8RJHUghl34up+0K+B750Ol1AyxsOl1GE45UWIcGzJpx7V7ae8tn5200kLfzRsyH7w&#xA;RjTE0eadWfnbzfa09PUpXA7TcZa/TIGOGmmWDGej0b8q/MXmjzPr62d3Fbvp1svq3twEZXC9EUUb&#xA;jV226dKntmJrdR4UL/iPJs0nZkMkxzoc30JbygAAdBnLvWphDL0xVR1i4iS2QO6rz9ZV5ECpFtKx&#xA;pX2UnMjTjc/D/dBxNZ9I+P8AuZIm8hqDmO5bBvNNiElS4A6/A36xm67Jzc4fF5f2h0/05B7j+j9K&#xA;Q8R4ZuXmG6DFXYq7FXYq8u09VX/nJMkAAtpZLEdz6dN/oGc/r/7/AOD2vYn+LD3l7UTmO7VL9bP+&#xA;4e//AOYeX/iBxVNv+cf/APlBZP8AmOm/4hHlGXmzjyYr5vnp5k1IeFxJ/wASytkyf8nped1qnskP&#xA;63xV6birsVdirsVeMz20V/58ntbmrRTahJE4BoePqlevyzsozMNKJR5iAP2PCzgMmsMZcjkI+1GX&#xA;UX5RfX7mx/xELK8tZXt54p5BGqSRsUZayotaMOoama6Gv1VAmAIP473az7L0hJAmYn8eSonkHQtR&#xA;FdI8y2l3y+wqGOSvh8Uch8R2yf8ALEo/XjI/Hua/5CifoyA/j3oK9/J/zKtTBPazDsObq33FKfjl&#xA;ke2sR5iQa5dhZhyMT+Pcx2//ACx88Q1P6NaVfGKSJ/wDcvwzIj2ngP8AF97TLsvUR/h+5i2seWtf&#xA;sIXk1DTLm3gGzySwuse9B9ojj3pl8M+Oe0ZA/Fplp8kN5RI+D0b/AJx/80Xcsep+Vbh2nWwRL3Su&#xA;bElIXYo8NTSipIoK+Aamc72ppxCdjkXp+zNQcmPfmFf/AJyY0KLUfJEGqKtZ9IuVbn4Q3FInH0v6&#xA;f3YOyclZeH+cPuT2nC8fF3F8uiD2zpeF57jXCDHhRxomw0ye+vbezgAM9zIsUYOw5OQoqfDfBMiM&#xA;TI8gyhciAOZfRHkHynfeTtBSK9tY1a6cyS3sc8TLI/QLuVpxXanzzl9dmjlnYlt8Xo9HilijRG/w&#xA;ZnbavY0HK4iU+BkT+BOa8ucnNrcI6hkYMp6EGoxVA+are4u7O3WCMyFDdFgu9A2nXUY+9nAzI08g&#xA;Cb8v90GjPEkCvP8A3JZVPHUZjt7FPOGl3d7ol7b2UhhvWiY2sgANJV+JPtAihYUPtl+ly+HkEujj&#xA;avTjLiMD1fNtv+ZHmy3bjMYZ2XZhLFxNRtvwKZ2vhAvDSwRTa2/Ne5G1zpyP4mOQr+DK368HgNZw&#xA;DvTS2/NDQ5Npre4hPjRXX8Gr+GROAsDhKaW/njyvPSl6EY/syK6U+kin45E4pdzA45Jnb6tpdzT6&#xA;veQy16BJFY/cDkTEhiQXnVl/60kP+2Uf+IZzuv8A7/4Padif4sPeXsxOY7tUs8xn/cBqf/MJP/yb&#xA;bFU8/wCcf/8AlBZP+Y6b/iEeUZebOPJgfnO6U+aNWodhdTL9KuQf1ZWyZd+SMvO81f2jh/W+KvWM&#xA;VdirsVdirx63/wDJjH/tqP8A8njnXy/xP/kn+h4iH+Pf8lD/ALpJfzN/KO2mn1LXNHM0l9LcS3F1&#xA;Zn956hkkLOYgByBBatN8wdHq9hGXKnY6zB6pEd5eRtpckbtHIhR0JDIwoQR1BBza260yZJcWnmPy&#xA;/aaZJBf3llLeQfWBHHNJHxQsRGRxK05IA2Y0eDITsDRcicp4xHcixaNsfzF/MS0p6WuXLU6etxn/&#xA;AOTqvkZaLCf4Qse0Mw5SLNm82a/5i/KXzLLrMyzTW0tqkbqixniZ4iahAB+GYkNPDFqYCPW/uLnH&#xA;UzzaWZl0I+8JD/zj+7f8rPvFBPE6LKSvYkXcFD+OPbPIfjvbexeR/Hc9N/M9Vvfy71qGShJtDKf9&#xA;aIiQfiuavQms8fe7LWi8Evc+ThBnacLx3G2IMPCjjR2i3A0/V7K+IJFtPHKwHUhGBI+7Ks+HjhKP&#xA;eC2Yc3BMS7i+pPL9/bXtirROlzZXKiqmjxup8Qf9vOGnAxNSFEPbwmJCwbBSvzB+V+o3BN35cuUh&#xA;Vqk2V0z8R/xjlUO1PZh9OQZMLvNF/NjQ3MiaTcSAH+8sZFmr/sI2L/euKo7yl+YPmfUNbXRNdtJr&#xA;Q+hdSLJdW728gZLaUBTyCDv4VxVUm/5yr8ssD6OmO38vO4Va/OiNiqEl/wCcm9DmH/HKAr/y9A/8&#xA;ysVSR9RPmS9nvLTQV+pytz9e5gi4JWnL9/Iijr4GuXw1OWP0ykPi0T02KXOMT8GMebYtFjmittPt&#xA;41mSpubiLmqsT0VFJpQeNKnOm7HyZskTKZuPIPNdrwxY5CMBUuZY+Ic3XC6XiXCHDwo4mxDjwrxI&#xA;j8uwV/OmxH/aql/4k+cn2wP8I/zQ9b2Ibwf5x/Q+gic1ztUs8xH/AHAan/zCz/8AJtsVT7/nH/8A&#xA;5QWT/mOm/wCIR5Rl5s48nl3nKenmrWh4X1yP+SzZWyZz+QknO91n2jg/4k+KvYsVdirsVdirxe3l&#xA;/wCQllf+1q4/5LnOvl/if/JP9DxUB/h3/JQ/7pkWq+fvL9rql3bStL6sE8kUlIyRyRyDvXxGarFp&#xA;JmAPkHYZ9ZAZJA95YtY6FY+ePPn1qKAppVuqPeuw4mTh0Bp/P9nxoMyMuU6fDR+o8mnTYhqc230D&#xA;n+PNM/zi0Fbi4S/jXe2CRsB0CMNvuOY3Zmajwn+K/m5nbGC4mY/hr5PMl072zePOcTLbWD0Pyj80&#xA;jpWe0P8AyXizAyf41j9x+4u20pvS5PfH7wlP/OPhr+aF5/2xJv8AqLt8p7Z+kfjvc/sbkfx3PRPM&#xA;nDVLfUNAEzW6XyTWAmXdoxMDFyG43XlXrmhgSJAh3cgCCDyeSX//ADjt5wglY6b5hingSpRbpFDN&#xA;4CiR/wDMz6c20O0M8f4r99Otn2bgl/DXuJY/eflX+bFh6kj6ZbXsCVp6D8Hb3Cq1yx/4HMqHbGUf&#xA;VGJ+Y/W4s+xcZ+mUh9v6khvbPzTpcfPVvLl7aqSeLAKVNPD1fRb/AIXMmHbcf4oke6j+pxJ9hz/h&#xA;kD77H60x8tfmhqnliRXsrq4sUc1e2ubaRoCSBUsGRogdvtA198OXU6PP9fP3G/mxxabW4Po5e8V8&#xA;nrvlr/nKPTbkpBqlrBPJtyl06dC3/Ih2/wCN8wZ9k4p/3WSJ8j+z9Tmx7Wyw/vcch5gfr/W9B038&#xA;3vIOpABdSFrKesV0rQkfNyPT/wCGzDy9k6iH8N+7f9rmYu19PP8Air37fsT2LVrC8j9SxuormPqG&#xA;hkWRafNScwJ45R+oEe9z4ZIyHpIPuSTUrDSZW5TWNtMwrRpIY3O/uynIM2O3clrY8ntLe3tSNy0U&#xA;MUZ271VRiFLz7zT5qWUsgnN1L2AYso+np92bfR9j5cpuQ4Yef6A6jW9sYsIqJ4p+X6SwWRXkkaRz&#xA;VmNSc7HFhjjiIx5B4zLnlkkZS5loQ5bwtfEuEOPCjibEOHhRxLPIi8fzssh/2qpf+JPnH9tf4z/m&#xA;h7PsE3p/84/oe+E5rHcJb5hP+4HUv+YWf/k22Ksg/wCcf/8AlBZP+Y6b/iEeUZebOPJ4952np5v1&#xA;weGoXQ/5LNlbJn//ADjxJzvtc9o7f/iUmKvbMVdirsVdirw5GCfmsUHQ6qT9LSkn9edYTej/AMz9&#xA;DxwjWt/5KfpQ3mLTjJ5k1Qhal7yegHcmVsOnNYo/1R9zhaw/v5j+mfvepeSdGh0XSUgAH1iU+pct&#xA;4uR9n5KNs5zWajxZ306PYdn6TwcQB+o7lvzBYR37XsTiqvGin6VOQjMw4ZDoWyWMZDOJ5EAPKH0l&#xA;opWjdaMhKn5jbOqhMSAI6vBZQYSMTzBpMtVg9D8pfM3astof+niLMOf+NY/cfuLt9Cb0mT3x+8MW&#xA;/wCcd2r+Z95/2xZv+ou3yrtn6R+O92nY3I/juZDLq1fOYh5f9LLhT/nvTNDHmHdnk9KJzLalhOKr&#xA;CcVS280LQryUzXenWtzKesk0Mbt97KTgVjGp/lB+XeoK/r6RHzf/AHYGckb12Vyyf8LgMQm2L3f/&#xA;ADjr5SWMjSr2806Rq1ZJCF/4GEwD78nCcofSSPcaa54oT+qIl7xaT3X5E+arVl/Q/mclRU8rpVqC&#xA;fD93K/8Aw+ZMe0NRHbjPxo/e4k+zNPI3wV7rH3IO48qfnhZMwjljvbdKklJ5IS3ypNIf+SeXR7Sl&#xA;/FDHL/NaJdkivTkyR/zkhvrnz1ArSa1oF+IgaeqJDID/AMjxBmdh7axx54+H+rX7HX5+wssuWTi/&#xA;rX+1L080aYF5XMN1aV/37byEf8FEJE/HM/H21p5cyY+8fqt12TsPUx5AS9x/XSKt9f0C4YLDqFuz&#xA;t0j9RQ9f9UkN+GZuPW4J8px+bg5NDnhzhL5JiFUio3GZQpxDbdBhRbqDFUJ5K/8AJ3WX/bKl/wCJ&#xA;PnGduf4z/mh7f2f/AMW/zj+h7wTmrd0lnmE/7gdS/wCYWb/k22Ksj/5x/wD+UFk/5jpv+IR5Rl5s&#xA;48nh/nqannPXx4ajd/8AJ98rZPRf+cbZOV/r3tFb/wDEpMVe64q7FXYq7FXgnq/8hh4/9ren/JXO&#xA;r/5B/wCZ+h5Gv8N/z/0oPyxH5hl/MnzPqmpXcv6Bs9UvorOJqNG0guZFUFqEoIwNgaVNPDNbqdRW&#xA;GMBzMRfup2uDRwOc5COUj87ewadqEUqgxurjxUg/qzTO5Rdm81xe6gjxlYkEPpSUNH5KeW/scskf&#xA;SPi1QjU5Hvp5b+Z/mC18q6pbyXdpPJbXysVmgCmkkdAykMydip6+Phm97KyccDHrF5jtrQnxeMfx&#xA;feEDN5o0zXfyg81S2PqAQS2YkWVeJBa5jp0J8MuyxI1OP3S+5jooGOmyA98fvSP/AJxxav5m3v8A&#xA;2xZv+oq3zH7Z+kfjvdn2PyP47kJp+sCb80rMdBJrkQ4/612Ns0Du3089rbP9uJT70FcIkUUh5NHs&#xA;X6IUP+ST/GuTGQo4QhZPL0Z/u5mX/WAP6qZIZkcCFl8vXg+w6OPmQf1ZIZQjhQcukaknWBiP8mjf&#xA;qrkhMI4SgpYpozSRGQ/5QI/XkrVRJxQsJxSsJxVA3ul6XekG9s4LkqKKZo0kIHWg5A4FSDUvy28j&#xA;6gzPdaTCzMCNuSqK+CA8PwxpWMXP5C+TBzksHubC4avGSF/TC19oRCT/AMFhgTHeJI92zGeOMxUg&#xA;D790qufyV162SmleZZmY9RcgMo/5GLcN+OZcO0dRHlM/Hf77cLJ2Xpp84D4bfdSWXHkD80rSQRwt&#xA;Zakg6ykelX6fUX/k3mXDtzOOfDL4fqLhZPZ/TnkZR+P7FDyP5d85w/mnZ6vqmkta2i2ktrJKnqNG&#xA;p4u4YsyJ1bbNfrNSc+XjIranY6DRjT4+AG97e2E5Q5aW+YD/ALgtR/5hZv8Ak22Ksl/5x/8A+UFk&#xA;/wCY6b/iEeUZebOPJ4D5+mp538wjw1O8/wCoh8rZPS/+cY35ah5g9orb/iUmKvfcVdirsVdir59u&#xA;CI/zuEY2rqsZof8AKYN/HOoib0f+Y8rKNa3/AD1HSvP2n+X/ADn5m03V4Xawl1e+dZokEnH1Lh+S&#xA;uhK1X5fdlOXsqWXHCcDvwR2+DlY+1Y4sk4TG3Gd/iy6PR/y415/rPl7zRJp9y4qkMcyoeR7+jOBL&#xA;9AOajLoc2P6ol2uLXYcn0yCPutD8/adp9vBpfmqNZVLm6u7izWZ5V29IfE7U4/F88xHLYf5huvM8&#xA;UBPmDzGt1CjchFDaRW5Ygf78BJ79OJy3DinOVQBJ8mrNlhCNzIA80mtLwXX5V+e7kRrEjTacERQB&#xA;8IuV3PiT3OdCdNLDkwxkblUr+Tz0dTHNDNKIqPpr5of/AJxq5H8yb1/2To84B9xdW1f15R2x9I9/&#xA;63M7I6sM8oXM97+a2jtspfWoJGG9KC6Dkfhmgd0+z8VdirsVUbq9tLROdzMkSnpyIBPyHfCBapTN&#xA;5w0lDSISTHsVWg/4ah/DJjGWPEl9z+YFrBMI5bNzGy15KwJ60+yQP14fDXibTzd5Puv7+Mwk95It&#xA;/vj5YOGQWwrpH5PvP7i7jRj0Al4tv/kv/TDxSC0F0nlKCReVvdHiehKhgfpBGPio4UDN5R1JamN4&#xA;5B4VIP4in45IZQvCgJ9B1iL7Vq7f6lH/AOIk5LjCKKXzQzRGksbRnwYEfryVoUCcVWE4qsJxVYTg&#xA;VLfMB/3B6j/zCzf8mzirJ/8AnH//AJQWT/mOm/4hHlOXmzjyfOv5gy089+Yx4ape/wDUQ+VsnqH/&#xA;ADi0/LUPMX/GK2/4lJir6ExV2KuxV2KvnbzhfWmkfnkbu9kMVnBd2k8spVjRPRjZjRQSab9BnTaa&#xA;JnpKHOj95eZ1JENXZ5WPuD1xfMf5XeYGHqXelX0jUAS6EPM7U+zMA34ZpvD1OLlxx91/odwZ6bLz&#xA;4Je+v0qdz+VP5c6gnqDSYVDj4ZLZ3jHzURsF/DLYdq6mH8Xzpqn2Rpp/w/IlKpvyQ0FEppuqahYk&#xA;bqqyhkB/1eKn/hsyR23M/XCEvg4suwogeic4/H+xjmpf84/6m7c7XWo7hu31mN0I/wBkrS/qzPw+&#xA;0OMc8fD7q/Y6/N7O5TyycXvv9qXeYfJOseU/yj83xai0L/WXsGheBiwIS6jBryVSPtZDLr8eo1GM&#xA;wvbi5+5t03Z+TTYMgnW/Dy97H/8AnGILJ551B6/FFpkq07UkuLc9f+eeY3bB2Dn9kjmwD8rQz/mP&#xA;5c6s36QgJ7nZwSc0LuX2zirsVSfzRrb6VYBoqG5mbhFXcDapantkoRsoJefPcT3EplnkaWRursan&#xA;MgBrVosKoPVErKn+r/E4qEF6eBLvTxVUhluYDWCV4j4oxU/hjSoXRPOvmtfzJttJbUppNPlRjJby&#xA;UkB427uN3BYfEoOxwcAK8Reo/wCILyP7So49wQfwOA4gvGV6+aYD8NxbkKepUhvwNMicSeNHfo7R&#xA;L6JZhbxSI42dVAP3ihyuyGVBBz+TdEl+ykkP+o5/425YfEK8IS+fyDGd4Lxl8A6A/iCP1ZLxUcKW&#xA;XHkXWUqYmimHYBip/wCGAH45LxAjhSjVPJPme7sbmyitAJLiJ4g7yIEXmOPJmBOwrXYE4eMLRZh+&#xA;Xfk9vKflqPS5JxcXBkae4kUEJzegISu9AFA3ymUrLICnyh5zsNQ1L8yfMNlp9tLd3curXwjghQu7&#xA;f6Q/RVqcil9BfkR+WereT9MvrzWeMep6oYv9FVg3oxRciAzL8PNi5rStKDfrir1PFXYq7FXYq+f/&#xA;AM4vKrX/AJ8u5vW9D1LS3eM8eQZvjjqdxsPT7ZvtDqeDCAO8um1ejGTKST0DyLU7K+025NveJwfq&#xA;jjdHA7oe/wCsZtsWYTGzqc+mljO/JTs9Z1Oyk52F3PaydQ0EjxtX5oRk5xifqALVAyB9JLIbD85f&#xA;zH048YdcnlC7FbkJcdPEzK7fjmJLQ4J/wj4fscuOszw6n4/tZLp3/OTnnK2ot9Y2V6g6sFkhkP0q&#xA;zL/wmY0+yMZ5Ehyodq5BzALvPf8AzkFY+bPI+o6DJo8ljeXgh9OVZlmiBinjlNarGwqqHscjp+zT&#xA;iyCXFYH6mWftAZcZjVEoX/nGaRh5o191JDLpEhVhsQRKm4yvtc7Bu7LGxYl+T/8A5Mzy7/zFr/xE&#xA;5onbvtLFXYqwD84dRudM0nTtQWIy2cV16d6VFWVJEIVh4fEB+rLMXNjJjOm31pfW6XFrKssL9GX9&#xA;RHY+2XMEyiwqqtawzULipGwIOKtfoaFvsuy/MA/0xpVraBcfsOrexqDjSqL6LqCf7pLDxWjfqxpW&#xA;OaP5d1o/mdHqZtJEsLVD6tw44LVrdkAXlTkeTDphCHo02FUFNgVNPKF6V1GWxLbSRNOqf8Y2RSR/&#xA;yMGVZRsziy3KGbsVdirsVWTLI0ZWN/TY7c6ciPkDtXwriqV+X/KXl7QFl/RdmkM9wxe6uj8c8zse&#xA;TNLK1Xarb9aeGKpvirsVdirsVdiryP8AOS9stP8AMGmy3kywLe2zRwO+yloJCzgsdh/frmz0UTKB&#xA;roXC1GSMZC9rYDrmmWur6VJE3FjxMltNXZZADxYHw8fbMqEjE21TgJxo8kD5K0u2ttFt7oIDc3SC&#xA;WSWm9G3VQfADLdRlMpeTTpcIhHzKJ8xeXLPWbN0dVS8Vf9HuQPiVh0BPdT3H8crx5DE2G7JjExRe&#xA;aeW/Ld5reoPbkmCG3/3rkIqVNacAP5jQ5scmoEY33uqx6UykR3PStP8AKHl2yTjHZJK1N5JgJWP/&#xA;AAVQPozAlnnLq7OGnhHkEx/JzT7bS/OHnkWi8Rb6VyhHUL6iiQrTw5Zh66RMI25GmgIk0wX8j0Zv&#xA;zU0AKCT6spoPAW8hP4DNW5j7JxV2KqF/YWeoWc1lewrcWlwpSaFxVWU4gq8O8yfk95q8u3Umo+T7&#xA;iS6tD8RtQR66gfslT8EwHbv7ZfHIDzYGKR2X5l39jObTXNOZJozxl4AxyKR/NFJ3+kZYxZTp35ge&#xA;VLoAfXRA56pOrR0/2RHD8cKsksdR0+6ANrdRTg9PSdX/AOIk4qmcWFCKjxVfL0xVJ9S1fSrIE3l5&#xA;Bb07SyKh+4kYqwrXPzT8vWqsljyv5xsOAKR193YfqBwKyD8n9N8yX2oXfm3WkMEVzB9W023IKj0m&#xA;dZGdVO4UlFoT9r5ZRll0ZxD1TKmbsVdirsVdirsVdirsVdirsVdirxr/AJyh0V7nyZY6tGvJtMuw&#xA;sp/liuV4E/8AIxYx9ObXsnJw5CO8Ot7Tx3AHuL5jh1O9gRkguJYkcEOqOygg9QQDvm+NHmHSxJHI&#xA;vUvy/wBct7/RIrTkBdWQ9N467lAfgYDwpt8812ohUr73a6XJca6hks0sUMTzSsEijUs7saAKBUkn&#xA;KHJeY+WfP2kaU2oi5gmYXd09xE8QVjxf9lgzJ0zKniJAcKGeIJTW4/N7RFQ+hZ3LvTYP6aCvzDPl&#xA;fgFs/MjuTr8n9VmvNN/MbXbgqJH0WUsm9OTLMEUewEYXMLtAUAHK0kuKyo/8426W13+ZCXfGqada&#xA;TzluwLgQD7/VOatzX1firsVdirsVS/V/L+h6zF6WqWEF4gFF9ZFZl/1WPxL9BwgkLTBtV/IPyRdl&#xA;mszc6c56LFJ6iV91lDt/w2TGQseEMWvv+ccLxamw1uOTwSeBo/8AhkZ/1ZLxUcCBP5HfmRbMPquq&#xA;WxUElTHczoR4Egxr+GS8UI4Vh/Kn84ASBfsQO4vn3/HHxQvCVT/lSX5l3TEXWq2/E05NLczvXt09&#xA;Nq4+KF4Ux07/AJxwlJDalrSqNuUdtCWJ8aO7LT/gcicqeFnXlz8oPI+husyWZvrpN1uL0iUg9ahK&#xA;LGPnxrkDMlkIhmmQS7FXYq7FXYq7FXYq7FXYq7FXYq7FUPqGn2Oo2U1jfwJc2dwpjnglUMjqeoIO&#xA;GMjE2OaJRBFF4r5m/wCcVvLl5M8/l/VJtK5GotZl+swj2QlkkUf6zNmzx9qSH1C3X5Ozon6TTAr/&#xA;AP5xq/NLSJvrOj3Npeun901tO0E30iVY1H/B5kjtLHLY2HHOgyR3DE/NPlb85YYWg1vStTe2TdzH&#xA;EZYdt/ie3DIfpOXQzYjyIYTx5eUgWAziWGRopkaORdmRwVYfMHLuJp4W7Gy1DUbpLTT7aW8upDSO&#xA;CBGkkY+yqCTkJTA5tkYE8numneS9Y8h/k9q6apbsnmPzhPbWVnpyjnMsMbGQgotTyYF6qP8AJrvt&#xA;ml1mcTIA5B22mxGEd3p/5BflvqPlPRbu/wBYiEGq6oyf6OaFooIwSqtTozMxLD5d8w3Ieq4q7FXY&#xA;q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FVG6srO7ThdQR3&#xA;CbjjKiuN+uzA+GEEhBFrbPTtPslZbO1htlY1YQxrGCffiBiSTzUABT/RNidS/SUkYlvVX04ZpPiM&#xA;SH7SxV2Tl+1Tdu/QUCUZirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdi&#xA;rsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir&#xA;sVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirs&#xA;VdirsVdir//Z</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<rect i:knockout="Off" fill="none" width="352" height="286"/> 
+				<g>
+					<g>
+						<path i:knockout="Off" fill="#565D6F" d="M138.754,207.178l109.78,8.616c0,0,0,4.846,0,6.407
+							c0,10.771-24.629,17.813-55.008,15.736c-30.383-2.089-55.012-12.511-55.012-23.281
+							C138.515,212.16,138.754,207.178,138.754,207.178z"/>
+						
+							<linearGradient id="XMLID_25_" gradientUnits="userSpaceOnUse" x1="-607.6221" y1="265.626" x2="-497.6025" y2="265.626" gradientTransform="matrix(1 0.0685 0 1 746.1367 -15.7498)">
+							<stop  offset="0.0056" style="stop-color:#ADB2C2"/>
+							<stop  offset="0.6517" style="stop-color:#DDE5FA"/>
+							<stop  offset="1" style="stop-color:#BBC2D4"/>
+							<a:midPointStop  offset="0.0056" style="stop-color:#ADB2C2"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#ADB2C2"/>
+							<a:midPointStop  offset="0.6517" style="stop-color:#DDE5FA"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#DDE5FA"/>
+							<a:midPointStop  offset="1" style="stop-color:#BBC2D4"/>
+						</linearGradient>
+						<path i:knockout="Off" fill="url(#XMLID_25_)" d="M248.534,215.794c0,10.78-24.629,17.824-55.008,15.735
+							c-30.383-2.078-55.012-12.493-55.012-23.274c0-10.77,24.629-17.819,55.012-15.741
+							C223.905,194.603,248.534,205.024,248.534,215.794z"/>
+						<g>
+							
+								<linearGradient id="XMLID_26_" gradientUnits="userSpaceOnUse" x1="-555.166" y1="183.543" x2="-555.166" y2="233.7756" gradientTransform="matrix(1 0 0 1 746.1367 0)">
+								<stop  offset="0.0056" style="stop-color:#9DA1B0"/>
+								<stop  offset="1" style="stop-color:#BBC2D4"/>
+								<a:midPointStop  offset="0.0056" style="stop-color:#9DA1B0"/>
+								<a:midPointStop  offset="0.5" style="stop-color:#9DA1B0"/>
+								<a:midPointStop  offset="1" style="stop-color:#BBC2D4"/>
+							</linearGradient>
+							<polygon i:knockout="Off" fill="url(#XMLID_26_)" points="169.708,187.189 169.708,211.355 212.232,218.954 212.124,194.618 
+								"/>
+							<polygon i:knockout="Off" fill="#565D6F" points="216.834,192.529 212.124,194.618 212.232,218.954 217.046,216.469 "/>
+						</g>
+					</g>
+					<g>
+						
+							<linearGradient id="XMLID_27_" gradientUnits="userSpaceOnUse" x1="710.7461" y1="-33.4839" x2="572.9243" y2="204.4626" gradientTransform="matrix(-1 0.0211 0 1 872.0371 0.2321)">
+							<stop  offset="0" style="stop-color:#6E6E6A"/>
+							<stop  offset="0.0364" style="stop-color:#848480"/>
+							<stop  offset="0.1092" style="stop-color:#A9A9A7"/>
+							<stop  offset="0.1848" style="stop-color:#C8C8C7"/>
+							<stop  offset="0.2628" style="stop-color:#E0E0E0"/>
+							<stop  offset="0.3442" style="stop-color:#F2F2F1"/>
+							<stop  offset="0.4312" style="stop-color:#FCFCFC"/>
+							<stop  offset="0.5337" style="stop-color:#FFFFFF"/>
+							<stop  offset="0.623" style="stop-color:#D0D0D0"/>
+							<stop  offset="0.7542" style="stop-color:#929292"/>
+							<stop  offset="0.8653" style="stop-color:#646464"/>
+							<stop  offset="0.9507" style="stop-color:#484848"/>
+							<stop  offset="1" style="stop-color:#3D3D3D"/>
+							<a:midPointStop  offset="0" style="stop-color:#6E6E6A"/>
+							<a:midPointStop  offset="0.2605" style="stop-color:#6E6E6A"/>
+							<a:midPointStop  offset="0.5337" style="stop-color:#FFFFFF"/>
+							<a:midPointStop  offset="0.4138" style="stop-color:#FFFFFF"/>
+							<a:midPointStop  offset="1" style="stop-color:#3D3D3D"/>
+						</linearGradient>
+						<path fill="url(#XMLID_27_)" d="M65.23,26.235c0,0,15.17-3.443,17.178-3.895c2.604-0.588,7.517-1.828,10.317-1.513
+							l222.55,23.509c5.266,0.582,9.563,5.467,9.557,10.873l-0.021,143.079c0,2.697-1.078,4.972-2.808,6.462
+							c-1.73,1.496-16.983,9.193-16.983,9.193L65.23,26.235z"/>
+						<g i:knockout="Off">
+							<path i:knockout="Off" fill="#FFFFFF" d="M68.424,175.353c-4.585-0.778-8.35-5.341-8.35-10.144V33.714
+								c0-4.809,3.785-8.321,8.42-7.815l232.41,25.7c4.753,0.528,8.643,4.95,8.637,9.823l-0.311,145.636
+								c-0.01,4.88-3.889,8.226-8.609,7.431L68.424,175.353z"/>
+						</g>
+					</g>
+					<path i:knockout="Off" fill="#565D6F" d="M293.396,59.284c-1.821-0.275-198.563-23.932-216.419-26.343
+						c-1.216-0.077-2.169,0.313-2.661,0.556s-4.966,2.646-4.966,2.646l223.224,170.189l5.049-1.918c0,0,2.861-1.343,2.861-3.775
+						c0-2.176,0-109.841,0-133.349C300.484,64.512,299.141,60.155,293.396,59.284z"/>
+					<g i:knockout="Off">
+						
+							<linearGradient id="XMLID_28_" gradientUnits="userSpaceOnUse" x1="576.2344" y1="192.5801" x2="799.922" y2="17.1336" gradientTransform="matrix(-1 0.0183 0 1 872.0371 0.0048)">
+							<stop  offset="0.0056" style="stop-color:#ADB2C2"/>
+							<stop  offset="0.6517" style="stop-color:#DDE5FA"/>
+							<stop  offset="1" style="stop-color:#BBC2D4"/>
+							<a:midPointStop  offset="0.0056" style="stop-color:#ADB2C2"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#ADB2C2"/>
+							<a:midPointStop  offset="0.6517" style="stop-color:#DDE5FA"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#DDE5FA"/>
+							<a:midPointStop  offset="1" style="stop-color:#BBC2D4"/>
+						</linearGradient>
+						<path i:knockout="Off" fill="url(#XMLID_28_)" d="M72.878,169.859c-3.023-0.507-5.493-3.433-5.493-6.495V40.171
+							c0-3.063,2.491-5.271,5.531-4.9l217.332,26.255c3.041,0.37,5.525,3.176,5.521,6.238l-0.299,134.072
+							c-0.006,3.063-2.48,5.151-5.505,4.646L72.878,169.859z"/>
+					</g>
+					<polygon i:knockout="Off" points="271.586,185.481 270.954,74.879 87.755,52.376 87.955,111.934 88.06,155.631 "/>
+					<polygon i:knockout="Off" fill="#565D6F" points="89.578,52.6 89.879,154.588 271.578,184.142 271.586,185.481 88.06,155.631 
+						87.755,52.376 "/>
+				</g>
+				<g>
+					
+						<linearGradient id="XMLID_29_" gradientUnits="userSpaceOnUse" x1="285.8027" y1="899.4316" x2="285.8027" y2="984.8441" gradientTransform="matrix(0.9196 -0.0931 -0.4005 -1.0133 282.4847 1064.7212)">
+						<stop  offset="0.0056" style="stop-color:#4FD2FF"/>
+						<stop  offset="0.6753" style="stop-color:#1871B1"/>
+						<stop  offset="0.9944" style="stop-color:#004890"/>
+						<a:midPointStop  offset="0.0056" style="stop-color:#4FD2FF"/>
+						<a:midPointStop  offset="0.4773" style="stop-color:#4FD2FF"/>
+						<a:midPointStop  offset="0.9944" style="stop-color:#004890"/>
+					</linearGradient>
+					<polygon i:knockout="Off" fill="url(#XMLID_29_)" points="267.428,180.688 94.016,152.686 93.729,56.053 266.832,77.162 "/>
+					
+						<linearGradient id="XMLID_30_" gradientUnits="userSpaceOnUse" x1="272.3018" y1="854.1563" x2="272.3018" y2="906.8079" gradientTransform="matrix(0.9196 -0.0931 -0.4005 -1.0133 282.4847 1064.7212)">
+						<stop  offset="0.0056" style="stop-color:#0087E9"/>
+						<stop  offset="0.5225" style="stop-color:#0062B7"/>
+						<stop  offset="1" style="stop-color:#003B7D"/>
+						<a:midPointStop  offset="0.0056" style="stop-color:#0087E9"/>
+						<a:midPointStop  offset="0.5" style="stop-color:#0087E9"/>
+						<a:midPointStop  offset="0.5225" style="stop-color:#0062B7"/>
+						<a:midPointStop  offset="0.5" style="stop-color:#0062B7"/>
+						<a:midPointStop  offset="1" style="stop-color:#003B7D"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_30_)" d="M93.807,114.47c17.327,6.64,173.543,29.086,173.543,29.086l0.078,37.586
+						L94.016,152.936L93.807,114.47z"/>
+					<path i:knockout="Off" fill="#BAEEFF" d="M101.075,86.85c11.253,6.611,43.453,11.195,50.376,8.831
+						c16.143,4.475,16.369-13.184,2.533-14.978c-4.524-14.263-20.596-11.545-23.726-5.782c-9.196-8.298-18.384-0.951-16.856,2.677
+						c-2.835-1.417-9.355-2.502-12.212-1.918C98.334,76.266,89.822,80.237,101.075,86.85z"/>
+					
+						<linearGradient id="XMLID_31_" gradientUnits="userSpaceOnUse" x1="783.6943" y1="-279.6216" x2="832.1451" y2="-223.586" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2048" style="stop-color:#FCFCFC"/>
+						<stop  offset="0.3396" style="stop-color:#F3F3F3"/>
+						<stop  offset="0.4542" style="stop-color:#E4E4E4"/>
+						<stop  offset="0.5575" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.6533" style="stop-color:#B4B4B4"/>
+						<stop  offset="0.7435" style="stop-color:#929292"/>
+						<stop  offset="0.8293" style="stop-color:#6A6A6A"/>
+						<stop  offset="0.9117" style="stop-color:#3B3B3B"/>
+						<stop  offset="0.9887" style="stop-color:#080808"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7853" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_31_)" d="M158.363,150.534c12.016,3.447,28.979,5.724,38.356,5.683
+						c9.351-0.064,22.594-0.172,29.649-10.086c-3.473,9.954-10.307,22.953-40.579,19.046c-14.783-2.258-34.682-7.592-38.791-11.043
+						C149.114,154.618,158.039,152.188,158.363,150.534z"/>
+					
+						<linearGradient id="XMLID_32_" gradientUnits="userSpaceOnUse" x1="762.9004" y1="-261.8945" x2="845.3633" y2="-261.8945" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2543" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4827" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.701" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9119" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#B8B8B8"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#B8B8B8"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_32_)" d="M141.887,140.042l16.44,10.755c9.799,2.95,26.442,5.887,38.748,6.004
+						c13.142,0.054,23.14-2.68,29.292-10.67C211.024,143.215,153.64,138.038,141.887,140.042z"/>
+					
+						<linearGradient id="XMLID_33_" gradientUnits="userSpaceOnUse" x1="807.2725" y1="-269.1001" x2="803.3225" y2="-253.925" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#B0B0B0"/>
+						<stop  offset="0.1732" style="stop-color:#ACACAC"/>
+						<stop  offset="0.3287" style="stop-color:#A1A1A1"/>
+						<stop  offset="0.4775" style="stop-color:#8F8F8F"/>
+						<stop  offset="0.6221" style="stop-color:#757575"/>
+						<stop  offset="0.7637" style="stop-color:#545454"/>
+						<stop  offset="0.9012" style="stop-color:#2C2C2C"/>
+						<stop  offset="1" style="stop-color:#0A0A0A"/>
+						<a:midPointStop  offset="0" style="stop-color:#B0B0B0"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#B0B0B0"/>
+						<a:midPointStop  offset="1" style="stop-color:#0A0A0A"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_33_)" d="M195.917,154.512c-12.007-0.217-28.166-3.62-35.323-5.432l-12.345-7.926
+						c9.771-1.008,62.688,3.114,75.747,5.609C217.931,152.91,207.769,154.683,195.917,154.512z"/>
+					<linearGradient id="XMLID_34_" gradientUnits="userSpaceOnUse" x1="184.9014" y1="108.4639" x2="93.298" y2="182.5674">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.0971" style="stop-color:#F9F9F9"/>
+						<stop  offset="0.2212" style="stop-color:#EAEAEA"/>
+						<stop  offset="0.36" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.5095" style="stop-color:#ABABAB"/>
+						<stop  offset="0.6676" style="stop-color:#7C7C7C"/>
+						<stop  offset="0.8331" style="stop-color:#424242"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.6554" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_34_)" d="M182.612,147.056l0.895-74.204c0,0-36.696,61.917-38.206,65.099
+						C161.604,139.461,182.612,147.056,182.612,147.056z"/>
+					
+						<linearGradient id="XMLID_35_" gradientUnits="userSpaceOnUse" x1="804.1924" y1="-284.895" x2="838.417" y2="-284.895" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2631" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4992" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.7251" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9432" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#BDBDBD"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#BDBDBD"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_35_)" d="M187.315,149.058c0.058-2.359-0.489-65.339-0.489-65.339l24.758,64.832
+						C211.584,148.551,193.701,147.998,187.315,149.058z"/>
+					<linearGradient id="XMLID_36_" gradientUnits="userSpaceOnUse" x1="165.7031" y1="143.6299" x2="112.9957" y2="154.4415">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.0971" style="stop-color:#F9F9F9"/>
+						<stop  offset="0.2212" style="stop-color:#EAEAEA"/>
+						<stop  offset="0.36" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.5095" style="stop-color:#ABABAB"/>
+						<stop  offset="0.6676" style="stop-color:#7C7C7C"/>
+						<stop  offset="0.8331" style="stop-color:#424242"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.6554" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_36_)" d="M141.887,140.042l16.44,10.755c0,0-3.17,6.167-10.992,3.373
+						C139.513,151.377,141.887,140.042,141.887,140.042z"/>
+					<linearGradient id="XMLID_37_" gradientUnits="userSpaceOnUse" x1="184.0098" y1="111.1172" x2="186.3672" y2="111.1172">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2631" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4992" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.7251" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9432" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#BDBDBD"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#BDBDBD"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_37_)" d="M184.01,153.379l0.261-84.94h1.113l0.983,85.357
+						C186.367,153.796,184.89,153.558,184.01,153.379z"/>
+				</g>
+				<g>
+					<g>
+						<path fill="#FFFFFF" d="M37.232,119.525c0,0,15.6,0.926,25.43,2.267c9.676,1.333,30.383,2.461,34.002,10.903
+							c4.293,10.015,3.928,40.496,2.804,62.674c-1.115,22.226,0,49.581-5.435,57.653c-5.489,8.162-16.234,5.828-35.164,2.395
+							c-19.572-3.563-27.699-4.11-31.076-11.213c-3.388-7.145-7.02-40.475-7.23-60.083c-0.207-19.626-0.425-56.304,5.325-60.732
+							C31.58,118.988,34.308,119.351,37.232,119.525z"/>
+					</g>
+					<g>
+						<g>
+							<linearGradient id="XMLID_38_" gradientUnits="userSpaceOnUse" x1="67.0791" y1="118.499" x2="88.3885" y2="196.3888">
+								<stop  offset="0" style="stop-color:#222221"/>
+								<stop  offset="0.1461" style="stop-color:#BFBFC0"/>
+								<stop  offset="0.1685" style="stop-color:#FFFFFF"/>
+								<stop  offset="0.3202" style="stop-color:#FFFFFF"/>
+								<stop  offset="0.5169" style="stop-color:#E9E9E9"/>
+								<stop  offset="0.5615" style="stop-color:#D7D7D7"/>
+								<stop  offset="0.775" style="stop-color:#858585"/>
+								<stop  offset="0.9262" style="stop-color:#515151"/>
+								<stop  offset="1" style="stop-color:#3D3D3D"/>
+								<a:midPointStop  offset="0" style="stop-color:#222221"/>
+								<a:midPointStop  offset="0.5" style="stop-color:#222221"/>
+								<a:midPointStop  offset="0.1461" style="stop-color:#BFBFC0"/>
+								<a:midPointStop  offset="0.5" style="stop-color:#BFBFC0"/>
+								<a:midPointStop  offset="0.1685" style="stop-color:#FFFFFF"/>
+								<a:midPointStop  offset="0.5185" style="stop-color:#FFFFFF"/>
+								<a:midPointStop  offset="0.3202" style="stop-color:#FFFFFF"/>
+								<a:midPointStop  offset="0.5" style="stop-color:#FFFFFF"/>
+								<a:midPointStop  offset="0.5169" style="stop-color:#E9E9E9"/>
+								<a:midPointStop  offset="0.4535" style="stop-color:#E9E9E9"/>
+								<a:midPointStop  offset="1" style="stop-color:#3D3D3D"/>
+							</linearGradient>
+							<path i:knockout="Off" fill="url(#XMLID_38_)" d="M34.357,119.479c-0.197,0.022-0.414,0.048-0.612,0.079 M108.381,155.497
+								c-0.367-7.347-1.287-17.677-5.35-25.608c-4.091-7.998-25.598-8.543-33.609-9.406c-8.123-0.871-23.082-2.353-27.806-2.448
+								c-1.335-0.027-4.048,0.577-7.259,1.444c1.024-0.074,1.955-0.009,2.898,0.048c0,0,15.605,0.927,25.441,2.268
+								c9.672,1.332,30.377,2.462,33.995,10.903c4.298,10.014,3.929,40.495,2.813,62.672c-1.119,22.225,0,49.579-5.435,57.651
+								c-0.959,1.428-2.079,2.501-3.364,3.338c6.218-3.732,10.674-6.608,11.398-7.484c2.593-3.085,5.171-14.153,5.353-23.607
+								C107.649,216.071,109.196,171.814,108.381,155.497z"/>
+						</g>
+					</g>
+					<g>
+						<path fill="#183268" d="M91.463,134.754c-3.51-5.958-22.819-7.03-31.137-8.039c-8.393-1.003-22.503-2.427-24.33-2.528
+							c-1.547-0.085-4.04,0.614-4.756,0.831c-0.008,0-0.014,0-0.014,0c1.612-0.234,3.283-0.031,5.701,0.249
+							c0,0,18.096,1.745,29.084,3.367c10.12,1.492,20.754,2.201,23.626,7.086c3.074,5.243,2.649,7.954,2.649,13.584
+							c0,5.617,0,36.538,0.205,47.786c0.205,11.247-1.024,47.488-2.033,49.958c-0.742,1.772-3.095,3.888-5.959,5.199
+							c0,0,0,0,0.007-0.001l0.039,0.087c0,0,3.742-0.908,5.467-2.177c1.721-1.265,2.692-2.731,3.572-7.08
+							c0.266-1.337,0.843-29.903,1.024-46.283c0.168-16.351-0.041-44.412-0.041-49.62C94.568,142.045,94.342,139.605,91.463,134.754
+							z"/>
+					</g>
+					<g>
+						
+							<radialGradient id="XMLID_39_" cx="27.498" cy="134.0684" r="127.8748" fx="27.498" fy="134.0684" gradientUnits="userSpaceOnUse">
+							<stop  offset="0.1461" style="stop-color:#3CB5FF"/>
+							<stop  offset="0.7697" style="stop-color:#004A92"/>
+							<stop  offset="1" style="stop-color:#002B5D"/>
+							<a:midPointStop  offset="0.1461" style="stop-color:#3CB5FF"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#3CB5FF"/>
+							<a:midPointStop  offset="0.7697" style="stop-color:#004A92"/>
+							<a:midPointStop  offset="0.5" style="stop-color:#004A92"/>
+							<a:midPointStop  offset="1" style="stop-color:#002B5D"/>
+						</radialGradient>
+						<path fill="url(#XMLID_39_)" d="M36.928,125.267c0,0,18.147,1.775,29.157,3.178c10.34,1.322,20.265,1.266,23.553,7.275
+							c3.266,5.976,2.649,7.954,2.649,13.584c0,5.617,0,36.538,0.205,47.786c0.205,11.247-1.024,47.488-2.033,49.958
+							c-1.031,2.472-5.186,5.648-9.529,6.299c-4.39,0.66-14.832-0.885-25.606-3.192c-10.968-2.361-20.378-3.252-24.292-7.732
+							c-4.238-4.85-7.093-45.628-7.093-57.991c0-12.354-1.146-47.012,0-51.229c1.147-4.208,1.764-5.964,4.911-7.489
+							C31.34,124.515,33.327,124.853,36.928,125.267z"/>
+					</g>
+					<g>
+						<polygon fill="#FFFFFF" points="31.377,135.368 85.042,142.343 85.042,215.361 31.51,205.995 "/>
+					</g>
+					<g>
+						<path fill="#889AC2" d="M71.314,237.038c-1.397-1.887-0.857-4.226-0.166-5.899c0.693-1.668,3.246-5.705,7.834-7.633
+							c3.816-1.612,8.107-2.976,9.679-1.918c2.54,1.711,2.663,5.674,2.474,8.087c-0.229,2.799-1.05,6.138-3.672,6.975
+							c-2.636,0.86-5.893,0.918-8.703,0.964C75.927,237.668,72.18,238.217,71.314,237.038z"/>
+					</g>
+					<path fill="#183268" d="M44.407,226.776c-0.443-1.991-1.72-4.049-3.803-6.224c-1.664-1.737-6.982-6.62-8.679-6.911
+						c-0.803-0.134-2.57,0.241-2.57,0.241s0.027,0.047,0.035,0.054c0.185-0.024,0.38-0.059,0.596-0.047
+						c2.301,0.208,7.933,5.229,9.397,6.946c1.462,1.718,2.781,2.615,3.454,4.637c0.695,2.143,1.126,2.946,0.635,5.015
+						c-0.184,0.733-0.427,1.12-0.75,1.358c1.056-0.216,1.365-0.642,1.633-1.159C44.652,230.108,44.693,228.039,44.407,226.776z
+						 M29.391,213.937L29.391,213.937L29.391,213.937L29.391,213.937z"/>
+					<g>
+						<path fill="#889AC2" d="M41.11,232.177c0,0-4.397-0.963-7.751-2.233c-3.373-1.269-4.452-1.489-5.543-3.222
+							c-1.079-1.74-1.226-4.523-0.948-7.313c0.269-2.793,0.808-5.725,3.118-5.519c2.301,0.208,7.933,5.229,9.397,6.946
+							c1.462,1.718,2.781,2.615,3.454,4.637c0.695,2.143,1.126,2.946,0.635,5.015C43.077,232.121,42.381,232.196,41.11,232.177z"/>
+					</g>
+					<path fill="#183268" d="M59.979,243.876v0.019c0,0,0.066-0.033,0.087-0.036c0.341-0.098,0.685-0.151,1.012-0.277
+						c-0.358,0.143-0.73,0.198-1.106,0.295C59.971,243.876,59.971,243.876,59.979,243.876z M67.807,229.232
+						c-2.202-7.979-9.314-9.963-10.485-10.042c-1.161-0.077-3.988,0.565-3.988,0.565l0.048,0.173
+						c4.938-0.893,10.316,2.533,12.596,8.321c2.028,5.153,0.951,10.563-2.279,13.587c1.088-0.656,2.115-1.324,2.646-1.824
+						C67.756,238.692,69.314,234.702,67.807,229.232z"/>
+					<g>
+						<path fill="#889AC2" d="M65.977,228.25c2.504,6.372,0.328,13.216-4.899,15.331c-5.268,2.135-11.663-1.331-14.256-7.784
+							c-2.6-6.487-0.332-13.435,5.025-15.483C57.154,218.291,63.461,221.855,65.977,228.25z"/>
+					</g>
+					<path i:knockout="Off" fill="#183268" d="M89.818,221.827c-1.274-0.583-2.793-0.662-2.793-0.662l-0.012,0.052
+						c-0.006,0-0.021,0-0.037,0c0.705-0.008,1.289,0.101,1.685,0.371c2.54,1.711,2.663,5.674,2.474,8.087
+						c-0.229,2.799-1.05,6.138-3.672,6.975c-0.407,0.139-0.834,0.214-1.262,0.317c0,0,0.014-0.001,0.017-0.001
+						c0.646-0.132,1.448-0.291,2.27-0.462c1.848-0.396,2.382-1.587,2.962-3.074C93.254,228.811,91.449,222.587,89.818,221.827z"/>
+				</g>
+				<g>
+					
+						<linearGradient id="XMLID_40_" gradientUnits="userSpaceOnUse" x1="134.2231" y1="863.5508" x2="134.2231" y2="905.4798" gradientTransform="matrix(0.9196 -0.0931 -0.4005 -1.0133 282.4847 1064.7212)">
+						<stop  offset="0.0056" style="stop-color:#4FD2FF"/>
+						<stop  offset="0.6753" style="stop-color:#1871B1"/>
+						<stop  offset="0.9944" style="stop-color:#004890"/>
+						<a:midPointStop  offset="0.0056" style="stop-color:#4FD2FF"/>
+						<a:midPointStop  offset="0.4773" style="stop-color:#4FD2FF"/>
+						<a:midPointStop  offset="0.9944" style="stop-color:#004890"/>
+					</linearGradient>
+					<polygon i:knockout="Off" fill="url(#XMLID_40_)" points="81.925,205.563 34.608,197.79 34.447,140.553 81.589,146.641 "/>
+					
+						<linearGradient id="XMLID_41_" gradientUnits="userSpaceOnUse" x1="126.606" y1="840.4346" x2="126.606" y2="860.4087" gradientTransform="matrix(0.9196 -0.0931 -0.4005 -1.0133 282.4847 1064.7212)">
+						<stop  offset="0.0056" style="stop-color:#0087E9"/>
+						<stop  offset="0.5225" style="stop-color:#0062B7"/>
+						<stop  offset="1" style="stop-color:#003B7D"/>
+						<a:midPointStop  offset="0.0056" style="stop-color:#0087E9"/>
+						<a:midPointStop  offset="0.5" style="stop-color:#0087E9"/>
+						<a:midPointStop  offset="0.5225" style="stop-color:#0062B7"/>
+						<a:midPointStop  offset="0.5" style="stop-color:#0062B7"/>
+						<a:midPointStop  offset="1" style="stop-color:#003B7D"/>
+					</linearGradient>
+					<polygon i:knockout="Off" fill="url(#XMLID_41_)" points="34.489,177.886 81.715,183.823 81.758,205.062 34.607,197.79 "/>
+					<path i:knockout="Off" fill="#BAEEFF" d="M42.022,152.599c-1.356-4.276-4.547-5.835-7.51-5.886v14.607
+						c2.764,0.181,4.981,0.115,6.078-0.259C49.712,163.59,49.841,153.611,42.022,152.599z"/>
+					
+						<linearGradient id="XMLID_42_" gradientUnits="userSpaceOnUse" x1="642.9775" y1="-262.3721" x2="668.2901" y2="-233.0969" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2048" style="stop-color:#FCFCFC"/>
+						<stop  offset="0.3396" style="stop-color:#F3F3F3"/>
+						<stop  offset="0.4542" style="stop-color:#E4E4E4"/>
+						<stop  offset="0.5575" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.6533" style="stop-color:#B4B4B4"/>
+						<stop  offset="0.7435" style="stop-color:#929292"/>
+						<stop  offset="0.8293" style="stop-color:#6A6A6A"/>
+						<stop  offset="0.9117" style="stop-color:#3B3B3B"/>
+						<stop  offset="0.9887" style="stop-color:#080808"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7853" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_42_)" d="M45.224,190.679c6.277,1.8,15.14,2.99,20.039,2.969
+						c4.885-0.035,11.803-0.089,15.488-5.269c-1.813,5.199-5.383,11.99-21.199,9.948c-7.722-1.179-18.117-3.965-20.266-5.769
+						C40.393,192.812,45.055,191.542,45.224,190.679z"/>
+					
+						<linearGradient id="XMLID_43_" gradientUnits="userSpaceOnUse" x1="632.1162" y1="-253.1104" x2="675.1953" y2="-253.1104" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2543" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4827" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.701" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9119" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#B8B8B8"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#B8B8B8"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_43_)" d="M36.617,185.197l8.588,5.619c5.12,1.539,13.814,3.074,20.242,3.137
+						c6.865,0.028,12.09-1.399,15.304-5.574C72.736,186.854,42.758,184.15,36.617,185.197z"/>
+					
+						<linearGradient id="XMLID_44_" gradientUnits="userSpaceOnUse" x1="655.2979" y1="-256.8745" x2="653.2343" y2="-248.9467" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#B0B0B0"/>
+						<stop  offset="0.1732" style="stop-color:#ACACAC"/>
+						<stop  offset="0.3287" style="stop-color:#A1A1A1"/>
+						<stop  offset="0.4775" style="stop-color:#8F8F8F"/>
+						<stop  offset="0.6221" style="stop-color:#757575"/>
+						<stop  offset="0.7637" style="stop-color:#545454"/>
+						<stop  offset="0.9012" style="stop-color:#2C2C2C"/>
+						<stop  offset="1" style="stop-color:#0A0A0A"/>
+						<a:midPointStop  offset="0" style="stop-color:#B0B0B0"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#B0B0B0"/>
+						<a:midPointStop  offset="1" style="stop-color:#0A0A0A"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_44_)" d="M64.844,192.757c-6.273-0.113-14.715-1.891-18.454-2.838l-6.448-4.141
+						c5.104-0.525,32.749,1.627,39.57,2.931C76.343,191.921,71.034,192.846,64.844,192.757z"/>
+					<linearGradient id="XMLID_45_" gradientUnits="userSpaceOnUse" x1="59.0879" y1="168.7012" x2="11.2345" y2="207.4127">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.0971" style="stop-color:#F9F9F9"/>
+						<stop  offset="0.2212" style="stop-color:#EAEAEA"/>
+						<stop  offset="0.36" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.5095" style="stop-color:#ABABAB"/>
+						<stop  offset="0.6676" style="stop-color:#7C7C7C"/>
+						<stop  offset="0.8331" style="stop-color:#424242"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.6554" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_45_)" d="M57.893,188.861l0.468-38.764L38.4,184.104
+						C43.614,184.718,57.893,188.861,57.893,188.861z"/>
+					
+						<linearGradient id="XMLID_46_" gradientUnits="userSpaceOnUse" x1="653.6865" y1="-264.9023" x2="671.3027" y2="-264.9023" gradientTransform="matrix(0.8676 -0.2256 0.515 0.9831 -377.4358 584.3093)">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2631" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4992" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.7251" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9432" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#BDBDBD"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#BDBDBD"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_46_)" d="M60.349,189.907c0.015-1.313-0.254-33.635-0.254-33.635l12.934,33.371
+						C73.028,189.644,62.417,189.346,60.349,189.907z"/>
+					<linearGradient id="XMLID_47_" gradientUnits="userSpaceOnUse" x1="49.0576" y1="187.0713" x2="21.5249" y2="192.7189">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.0971" style="stop-color:#F9F9F9"/>
+						<stop  offset="0.2212" style="stop-color:#EAEAEA"/>
+						<stop  offset="0.36" style="stop-color:#CFCFCF"/>
+						<stop  offset="0.5095" style="stop-color:#ABABAB"/>
+						<stop  offset="0.6676" style="stop-color:#7C7C7C"/>
+						<stop  offset="0.8331" style="stop-color:#424242"/>
+						<stop  offset="1" style="stop-color:#000000"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.6554" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#000000"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_47_)" d="M36.617,185.197l8.588,5.619c0,0-1.655,3.221-5.742,1.762
+						C35.377,191.119,36.617,185.197,36.617,185.197z"/>
+					<linearGradient id="XMLID_48_" gradientUnits="userSpaceOnUse" x1="58.623" y1="170.0869" x2="59.8535" y2="170.0869">
+						<stop  offset="0" style="stop-color:#FFFFFF"/>
+						<stop  offset="0.2631" style="stop-color:#FBFBFB"/>
+						<stop  offset="0.4992" style="stop-color:#F1F1F1"/>
+						<stop  offset="0.7251" style="stop-color:#DEDEDE"/>
+						<stop  offset="0.9432" style="stop-color:#C5C5C5"/>
+						<stop  offset="1" style="stop-color:#BDBDBD"/>
+						<a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="0.7288" style="stop-color:#FFFFFF"/>
+						<a:midPointStop  offset="1" style="stop-color:#BDBDBD"/>
+					</linearGradient>
+					<path i:knockout="Off" fill="url(#XMLID_48_)" d="M58.623,192.165l0.135-44.373h0.582l0.514,44.59
+						C59.854,192.382,59.082,192.259,58.623,192.165z"/>
+				</g>
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_graf_upnp_ext_renderer_list_icon.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.0" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="16" height="16" viewBox="0 0 16 16"
+	 overflow="visible" enable-background="new 0 0 16 16" xml:space="preserve">
+<g>
+	<rect fill="none" width="16" height="16"/>
+	<path d="M0.822,3.006V13.09h13.807V3.006H0.822z M2.138,4.266h11.234v7.563h-3.275l-7.937,0.035L2.138,4.266z"/>
+	<polygon points="5.856,4.366 5.856,11.776 13.266,8.012 	"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_1.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="2.996" y="3.001" width="10.01" height="9.995"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_2.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="2.881" y="3.016" width="0.984" height="1"/>
+<rect x="4.881" y="3.016" width="0.984" height="1"/>
+<rect x="6.881" y="3.016" width="0.984" height="1"/>
+<rect x="8.881" y="3.016" width="0.984" height="1"/>
+<rect x="10.881" y="3.016" width="0.984" height="1"/>
+<rect x="3.881" y="4.016" width="0.984" height="1"/>
+<rect x="5.881" y="4.016" width="0.984" height="1"/>
+<rect x="7.881" y="4.016" width="0.984" height="1"/>
+<rect x="9.881" y="4.016" width="0.984" height="1"/>
+<rect x="11.881" y="4.016" width="0.984" height="1"/>
+<rect x="2.881" y="5.016" width="0.984" height="1"/>
+<rect x="4.881" y="5.016" width="0.984" height="1"/>
+<rect x="6.881" y="5.016" width="0.984" height="1"/>
+<rect x="8.881" y="5.016" width="0.984" height="1"/>
+<rect x="10.881" y="5.016" width="0.984" height="1"/>
+<rect x="3.881" y="6.016" width="0.984" height="1"/>
+<rect x="5.881" y="6.016" width="0.984" height="1"/>
+<rect x="7.881" y="6.016" width="0.984" height="1"/>
+<rect x="9.881" y="6.016" width="0.984" height="1"/>
+<rect x="11.881" y="6.016" width="0.984" height="1"/>
+<rect x="2.881" y="7.016" width="0.984" height="1"/>
+<rect x="4.881" y="7.016" width="0.984" height="1"/>
+<rect x="6.881" y="7.016" width="0.984" height="1"/>
+<rect x="8.881" y="7.016" width="0.984" height="1"/>
+<rect x="10.881" y="7.016" width="0.984" height="1"/>
+<rect x="3.881" y="8.016" width="0.984" height="1"/>
+<rect x="5.881" y="8.016" width="0.984" height="1"/>
+<rect x="7.881" y="8.016" width="0.984" height="1"/>
+<rect x="9.881" y="8.016" width="0.984" height="1"/>
+<rect x="11.881" y="8.016" width="0.984" height="1"/>
+<rect x="2.881" y="9.016" width="0.984" height="1"/>
+<rect x="4.881" y="9.016" width="0.984" height="1"/>
+<rect x="6.881" y="9.016" width="0.984" height="1"/>
+<rect x="8.881" y="9.016" width="0.984" height="1"/>
+<rect x="10.881" y="9.016" width="0.984" height="1"/>
+<rect x="3.881" y="10.016" width="0.984" height="1"/>
+<rect x="5.881" y="10.016" width="0.984" height="1"/>
+<rect x="7.881" y="10.016" width="0.984" height="1"/>
+<rect x="9.881" y="10.016" width="0.984" height="1"/>
+<rect x="11.881" y="10.016" width="0.984" height="1"/>
+<rect x="2.881" y="11.016" width="0.984" height="1"/>
+<rect x="4.881" y="11.016" width="0.984" height="1"/>
+<rect x="6.881" y="11.016" width="0.984" height="1"/>
+<rect x="8.881" y="11.016" width="0.984" height="1"/>
+<rect x="10.881" y="11.016" width="0.984" height="1"/>
+<rect x="3.881" y="12.016" width="0.984" height="1"/>
+<rect x="5.881" y="12.016" width="0.984" height="1"/>
+<rect x="7.881" y="12.016" width="0.984" height="1"/>
+<rect x="9.881" y="12.016" width="0.984" height="1"/>
+<rect x="11.881" y="12.016" width="0.984" height="1"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_3.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="3.009" y="3.023" width="0.984" height="1"/>
+	<rect x="5.009" y="3.023" width="0.984" height="1"/>
+	<rect x="7.009" y="3.023" width="0.984" height="1"/>
+	<rect x="9.009" y="3.023" width="0.984" height="1"/>
+	<rect x="11.009" y="3.023" width="0.984" height="1"/>
+	<rect x="4.009" y="4.023" width="0.984" height="1"/>
+	<rect x="6.009" y="4.023" width="0.984" height="1"/>
+	<rect x="8.009" y="4.023" width="0.984" height="1"/>
+	<rect x="10.009" y="4.023" width="0.984" height="1"/>
+	<rect x="12.009" y="4.023" width="0.984" height="1"/>
+	<rect x="3.009" y="5.023" width="0.984" height="1"/>
+	<rect x="5.009" y="5.023" width="0.984" height="1"/>
+	<rect x="7.009" y="5.023" width="0.984" height="1"/>
+	<rect x="9.009" y="5.023" width="0.984" height="1"/>
+	<rect x="11.009" y="5.023" width="0.984" height="1"/>
+	<rect x="4.009" y="6.023" width="0.984" height="1"/>
+	<rect x="10.009" y="6.023" width="0.984" height="1"/>
+	<rect x="12.009" y="6.023" width="0.984" height="1"/>
+	<rect x="3.009" y="7.023" width="0.984" height="1"/>
+	<rect x="5.009" y="7.023" width="0.984" height="1"/>
+	<rect x="11.009" y="7.023" width="0.984" height="1"/>
+	<rect x="4.009" y="8.023" width="0.984" height="1"/>
+	<rect x="10.009" y="8.023" width="0.984" height="1"/>
+	<rect x="12.009" y="8.023" width="0.984" height="1"/>
+	<rect x="3.009" y="9.023" width="0.984" height="1"/>
+	<rect x="5.009" y="9.023" width="0.984" height="1"/>
+	<rect x="11.009" y="9.023" width="0.984" height="1"/>
+	<rect x="4.009" y="10.023" width="0.984" height="1"/>
+	<rect x="6.009" y="10.023" width="0.984" height="1"/>
+	<rect x="8.009" y="10.023" width="0.984" height="1"/>
+	<rect x="10.009" y="10.023" width="0.984" height="1"/>
+	<rect x="12.009" y="10.023" width="0.984" height="1"/>
+	<rect x="3.009" y="11.023" width="0.984" height="1"/>
+	<rect x="5.009" y="11.023" width="0.984" height="1"/>
+	<rect x="7.009" y="11.023" width="0.984" height="1"/>
+	<rect x="9.009" y="11.023" width="0.984" height="1"/>
+	<rect x="11.009" y="11.023" width="0.984" height="1"/>
+	<rect x="4.009" y="12.023" width="0.984" height="1"/>
+	<rect x="6.009" y="12.023" width="0.984" height="1"/>
+	<rect x="8.009" y="12.023" width="0.984" height="1"/>
+	<rect x="10.009" y="12.023" width="0.984" height="1"/>
+	<rect x="12.009" y="12.023" width="0.984" height="1"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_4.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="3.006" y="2.989" width="0.984" height="1"/>
+	<rect x="5.005" y="2.989" width="0.984" height="1"/>
+	<rect x="7.005" y="2.989" width="0.984" height="1"/>
+	<rect x="9.005" y="2.989" width="0.984" height="1"/>
+	<rect x="11.005" y="2.989" width="0.984" height="1"/>
+	<rect x="12.005" y="3.989" width="0.984" height="1"/>
+	<rect x="3.006" y="4.989" width="0.984" height="1"/>
+	<rect x="12.005" y="5.989" width="0.984" height="1"/>
+	<rect x="3.006" y="6.989" width="0.984" height="1"/>
+	<rect x="12.005" y="7.989" width="0.984" height="1"/>
+	<rect x="3.006" y="8.989" width="0.984" height="1"/>
+	<rect x="12.005" y="9.989" width="0.984" height="1"/>
+	<rect x="3.006" y="10.989" width="0.984" height="1"/>
+	<rect x="4.005" y="11.989" width="0.984" height="1"/>
+	<rect x="6.005" y="11.989" width="0.984" height="1"/>
+	<rect x="8.005" y="11.989" width="0.984" height="1"/>
+	<rect x="10.005" y="11.989" width="0.984" height="1"/>
+	<rect x="12.005" y="11.989" width="0.984" height="1"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_5.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="12.993" y="22.001" width="1" height="0.984"/>
+<rect x="12.993" y="20.001" width="1" height="0.984"/>
+<rect x="12.993" y="18.001" width="1" height="0.984"/>
+<rect x="12.993" y="16.001" width="1" height="0.984"/>
+<rect x="12.993" y="14.001" width="1" height="0.984"/>
+<rect x="13.993" y="21.001" width="1" height="0.984"/>
+<rect x="13.993" y="19.001" width="1" height="0.984"/>
+<rect x="13.993" y="17.001" width="1" height="0.984"/>
+<rect x="13.993" y="15.001" width="1" height="0.984"/>
+<rect x="13.993" y="13.002" width="1" height="0.983"/>
+<rect x="14.993" y="22.001" width="1" height="0.984"/>
+<rect x="14.993" y="20.001" width="1" height="0.984"/>
+<rect x="14.993" y="18.001" width="1" height="0.984"/>
+<rect x="14.993" y="16.001" width="1" height="0.984"/>
+<rect x="14.993" y="14.001" width="1" height="0.984"/>
+<rect x="15.993" y="21.001" width="1" height="0.984"/>
+<rect x="15.993" y="19.001" width="1" height="0.984"/>
+<rect x="15.993" y="17.001" width="1" height="0.984"/>
+<rect x="15.993" y="15.001" width="1" height="0.984"/>
+<rect x="15.993" y="13.002" width="1" height="0.983"/>
+<rect x="16.993" y="22.001" width="1" height="0.984"/>
+<rect x="16.993" y="20.001" width="1" height="0.984"/>
+<rect x="16.993" y="18.001" width="1" height="0.984"/>
+<rect x="16.993" y="16.001" width="1" height="0.984"/>
+<rect x="16.993" y="14.001" width="1" height="0.984"/>
+<rect x="17.993" y="21.001" width="1" height="0.984"/>
+<rect x="17.993" y="19.001" width="1" height="0.984"/>
+<rect x="17.993" y="17.001" width="1" height="0.984"/>
+<rect x="17.993" y="15.001" width="1" height="0.984"/>
+<rect x="17.993" y="13.002" width="1" height="0.983"/>
+<rect x="18.993" y="22.001" width="1" height="0.984"/>
+<rect x="18.993" y="20.001" width="1" height="0.984"/>
+<rect x="18.993" y="18.001" width="1" height="0.984"/>
+<rect x="18.993" y="16.001" width="1" height="0.984"/>
+<rect x="18.993" y="14.001" width="1" height="0.984"/>
+<rect x="19.993" y="21.001" width="1" height="0.984"/>
+<rect x="19.993" y="19.001" width="1" height="0.984"/>
+<rect x="19.993" y="17.001" width="1" height="0.984"/>
+<rect x="19.993" y="15.001" width="1" height="0.984"/>
+<rect x="19.993" y="13.002" width="1" height="0.983"/>
+<rect x="20.993" y="22.001" width="1" height="0.984"/>
+<rect x="20.993" y="20.001" width="1" height="0.984"/>
+<rect x="20.993" y="18.001" width="1" height="0.984"/>
+<rect x="20.993" y="16.001" width="1" height="0.984"/>
+<rect x="20.993" y="14.001" width="1" height="0.984"/>
+<rect x="21.993" y="21.001" width="1" height="0.984"/>
+<rect x="21.993" y="19.001" width="1" height="0.984"/>
+<rect x="21.993" y="17.001" width="1" height="0.984"/>
+<rect x="21.993" y="15.001" width="1" height="0.984"/>
+<rect x="21.993" y="13.002" width="1" height="0.983"/>
+<g>
+	<rect x="2.997" y="2.975" width="0.984" height="1"/>
+	<rect x="4.997" y="2.975" width="0.984" height="1"/>
+	<rect x="6.997" y="2.975" width="0.984" height="1"/>
+	<rect x="8.996" y="2.975" width="0.984" height="1"/>
+	<rect x="10.996" y="2.975" width="0.984" height="1"/>
+	<rect x="11.996" y="3.975" width="0.984" height="1"/>
+	<rect x="2.997" y="4.975" width="0.984" height="1"/>
+	<rect x="11.996" y="5.975" width="0.984" height="1"/>
+	<rect x="2.997" y="6.975" width="0.984" height="1"/>
+	<rect x="11.996" y="7.975" width="0.984" height="1"/>
+	<rect x="2.997" y="8.975" width="0.984" height="1"/>
+	<rect x="11.996" y="9.975" width="0.984" height="1"/>
+	<rect x="2.997" y="10.975" width="0.984" height="1"/>
+	<rect x="3.997" y="11.974" width="0.984" height="1"/>
+	<rect x="5.997" y="11.974" width="0.984" height="1"/>
+	<rect x="7.997" y="11.974" width="0.984" height="1"/>
+	<rect x="9.996" y="11.974" width="0.984" height="1"/>
+	<rect x="11.996" y="11.974" width="0.984" height="1"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_6.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="13.001" y="22.007" width="1" height="0.984"/>
+	<rect x="13.001" y="20.007" width="1" height="0.984"/>
+	<rect x="13.001" y="18.007" width="1" height="0.984"/>
+	<rect x="13.001" y="16.007" width="1" height="0.984"/>
+	<rect x="13.001" y="14.007" width="1" height="0.984"/>
+	<rect x="14.001" y="21.007" width="1" height="0.984"/>
+	<rect x="14.001" y="19.007" width="1" height="0.984"/>
+	<rect x="14.001" y="17.007" width="1" height="0.984"/>
+	<rect x="14.001" y="15.007" width="1" height="0.984"/>
+	<rect x="14.001" y="13.008" width="1" height="0.983"/>
+	<rect x="15.001" y="22.007" width="1" height="0.984"/>
+	<rect x="15.001" y="20.007" width="1" height="0.984"/>
+	<rect x="15.001" y="18.007" width="1" height="0.984"/>
+	<rect x="15.001" y="16.007" width="1" height="0.984"/>
+	<rect x="15.001" y="14.007" width="1" height="0.984"/>
+	<rect x="16.001" y="21.007" width="1" height="0.984"/>
+	<rect x="16.001" y="19.007" width="1" height="0.984"/>
+	<rect x="16.001" y="17.007" width="1" height="0.984"/>
+	<rect x="16.001" y="15.007" width="1" height="0.984"/>
+	<rect x="16.001" y="13.008" width="1" height="0.983"/>
+	<rect x="17.001" y="22.007" width="1" height="0.984"/>
+	<rect x="17.001" y="20.007" width="1" height="0.984"/>
+	<rect x="17.001" y="18.007" width="1" height="0.984"/>
+	<rect x="17.001" y="16.007" width="1" height="0.984"/>
+	<rect x="17.001" y="14.007" width="1" height="0.984"/>
+	<rect x="18.001" y="21.007" width="1" height="0.984"/>
+	<rect x="18.001" y="19.007" width="1" height="0.984"/>
+	<rect x="18.001" y="17.007" width="1" height="0.984"/>
+	<rect x="18.001" y="15.007" width="1" height="0.984"/>
+	<rect x="18.001" y="13.008" width="1" height="0.983"/>
+	<rect x="19.001" y="22.007" width="1" height="0.984"/>
+	<rect x="19.001" y="20.007" width="1" height="0.984"/>
+	<rect x="19.001" y="18.007" width="1" height="0.984"/>
+	<rect x="19.001" y="16.007" width="1" height="0.984"/>
+	<rect x="19.001" y="14.007" width="1" height="0.984"/>
+	<rect x="20.001" y="21.007" width="1" height="0.984"/>
+	<rect x="20.001" y="19.007" width="1" height="0.984"/>
+	<rect x="20.001" y="17.007" width="1" height="0.984"/>
+	<rect x="20.001" y="15.007" width="1" height="0.984"/>
+	<rect x="20.001" y="13.008" width="1" height="0.983"/>
+	<rect x="21.001" y="22.007" width="1" height="0.984"/>
+	<rect x="21.001" y="20.007" width="1" height="0.984"/>
+	<rect x="21.001" y="18.007" width="1" height="0.984"/>
+	<rect x="21.001" y="16.007" width="1" height="0.984"/>
+	<rect x="21.001" y="14.007" width="1" height="0.984"/>
+	<rect x="22.001" y="21.007" width="1" height="0.984"/>
+	<rect x="22.001" y="19.007" width="1" height="0.984"/>
+	<rect x="22.001" y="17.007" width="1" height="0.984"/>
+	<rect x="22.001" y="15.007" width="1" height="0.984"/>
+	<rect x="22.001" y="13.008" width="1" height="0.983"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_7.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="13.009" y="22.001" width="1" height="0.984"/>
+	<rect x="13.009" y="20.001" width="1" height="0.984"/>
+	<rect x="13.009" y="18.001" width="1" height="0.984"/>
+	<rect x="13.009" y="16.001" width="1" height="0.984"/>
+	<rect x="13.009" y="14.001" width="1" height="0.984"/>
+	<rect x="14.009" y="21.001" width="1" height="0.984"/>
+	<rect x="14.009" y="19.001" width="1" height="0.984"/>
+	<rect x="14.009" y="17.001" width="1" height="0.984"/>
+	<rect x="14.009" y="15.001" width="1" height="0.984"/>
+	<rect x="14.009" y="13.002" width="1" height="0.983"/>
+	<rect x="15.009" y="22.001" width="1" height="0.984"/>
+	<rect x="15.009" y="20.001" width="1" height="0.984"/>
+	<rect x="15.009" y="18.001" width="1" height="0.984"/>
+	<rect x="15.009" y="16.001" width="1" height="0.984"/>
+	<rect x="15.009" y="14.001" width="1" height="0.984"/>
+	<rect x="16.009" y="21.001" width="1" height="0.984"/>
+	<rect x="16.009" y="15.001" width="1" height="0.984"/>
+	<rect x="16.009" y="13.002" width="1" height="0.983"/>
+	<rect x="17.009" y="22.001" width="1" height="0.984"/>
+	<rect x="17.009" y="20.001" width="1" height="0.984"/>
+	<rect x="17.009" y="14.001" width="1" height="0.984"/>
+	<rect x="18.009" y="21.001" width="1" height="0.984"/>
+	<rect x="18.009" y="15.001" width="1" height="0.984"/>
+	<rect x="18.009" y="13.002" width="1" height="0.983"/>
+	<rect x="19.009" y="22.001" width="1" height="0.984"/>
+	<rect x="19.009" y="20.001" width="1" height="0.984"/>
+	<rect x="19.009" y="14.001" width="1" height="0.984"/>
+	<rect x="20.009" y="21.001" width="1" height="0.984"/>
+	<rect x="20.009" y="19.001" width="1" height="0.984"/>
+	<rect x="20.009" y="17.001" width="1" height="0.984"/>
+	<rect x="20.009" y="15.001" width="1" height="0.984"/>
+	<rect x="20.009" y="13.002" width="1" height="0.983"/>
+	<rect x="21.009" y="22.001" width="1" height="0.984"/>
+	<rect x="21.009" y="20.001" width="1" height="0.984"/>
+	<rect x="21.009" y="18.001" width="1" height="0.984"/>
+	<rect x="21.009" y="16.001" width="1" height="0.984"/>
+	<rect x="21.009" y="14.001" width="1" height="0.984"/>
+	<rect x="22.009" y="21.001" width="1" height="0.984"/>
+	<rect x="22.009" y="19.001" width="1" height="0.984"/>
+	<rect x="22.009" y="17.001" width="1" height="0.984"/>
+	<rect x="22.009" y="15.001" width="1" height="0.984"/>
+	<rect x="22.009" y="13.002" width="1" height="0.983"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_8.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<g>
+	<rect x="12.995" y="22.003" width="1" height="0.984"/>
+	<rect x="12.995" y="20.003" width="1" height="0.984"/>
+	<rect x="12.995" y="18.003" width="1" height="0.984"/>
+	<rect x="12.995" y="16.003" width="1" height="0.984"/>
+	<rect x="12.995" y="14.003" width="1" height="0.984"/>
+	<rect x="13.995" y="13.004" width="1" height="0.983"/>
+	<rect x="14.995" y="22.003" width="1" height="0.984"/>
+	<rect x="15.995" y="13.004" width="1" height="0.983"/>
+	<rect x="16.995" y="22.003" width="1" height="0.984"/>
+	<rect x="17.995" y="13.004" width="1" height="0.983"/>
+	<rect x="18.995" y="22.003" width="1" height="0.984"/>
+	<rect x="19.995" y="13.004" width="1" height="0.983"/>
+	<rect x="20.995" y="22.003" width="1" height="0.984"/>
+	<rect x="21.995" y="21.003" width="1" height="0.984"/>
+	<rect x="21.995" y="19.003" width="1" height="0.984"/>
+	<rect x="21.995" y="17.003" width="1" height="0.984"/>
+	<rect x="21.995" y="15.003" width="1" height="0.984"/>
+	<rect x="21.995" y="13.004" width="1" height="0.983"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_9.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="26" height="26" viewBox="0 0 26 26"
+	 overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+<rect x="13.005" y="13.013" width="10.01" height="9.994"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_prop_folder_current.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,16 @@
+<?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="16" height="16" viewBox="0 0 16 16">
+<g>
+<g>
+<rect fill="none" width="16" height="16"/>
+<g>
+<polygon fill="#B3DDFF" points="10.402,4.131 6.354,3.284 5.024,3.942 9.648,4.907 "/>
+<polygon fill="#0046B7" points="13.457,4.148 11.439,12.235 9.931,7.926 8.687,8.514 8.689,8.519 10.929,13.004 12.401,12.131        14.363,3.54 13.476,4.152 "/>
+<polygon fill="#B3DDFF" points="11.788,2.996 10.878,3.63 10.888,3.632 13.457,4.148 13.476,4.152 14.382,3.527 "/>
+<polygon fill="#B3DDFF" points="8.701,8.506 9.907,7.926 4.704,6.779 2.961,6.395 1.652,6.792 5.243,7.673 "/>
+<polygon fill="#5AA7E0" points="8.687,8.514 9.931,7.926 11.439,12.235 13.457,4.148 10.888,3.632 9.648,4.907 5.024,3.942        4.704,6.779 9.907,7.926 8.701,8.506 1.617,6.783 1.628,6.799 1.63,6.802 4.314,10.893 10.908,12.965 "/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_folder_locked_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="408 310" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="26" height="26"
+	 viewBox="0 0 26 26" overflow="visible" enable-background="new 0 0 26 26" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="&ns_vars;">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="&ns_custom;" xmlns:v="&ns_vars;"></v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="284" x="408" width="26" height="26" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+  <pdf:Producer>Adobe PDF library 6.66</pdf:Producer>
+ </rdf:Description>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-08-31T13:44:30+03:00</xap:CreateDate>
+  <xap:ModifyDate>2005-08-31T12:00:58Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:MetadataDate>2005-08-31T13:44:30+03:00</xap:MetadataDate>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>256</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAEAAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7&#xA;FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F&#xA;XYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX&#xA;Yq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXY&#xA;q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq&#xA;7FXYq7FULeapptlT65dRW5P2RI6qT8gTU5Tl1OPH9chH3ltx4Zz+kEoX/FPlv/q5W/8AyMXKP5R0&#xA;/wDPj8238lm/my+Tv8U+W/8Aq5W//Ixcf5R0/wDPj81/JZv5svk7/FPlv/q5W/8AyMXH+UdP/Pj8&#xA;1/JZv5svk7/FPlv/AKuVv/yMXH+UdP8Az4/NfyWb+bL5O/xT5b/6uVv/AMjFx/lHT/z4/NfyWb+b&#xA;L5O/xT5b/wCrlb/8jFx/lHT/AM+PzX8lm/my+SJs9X0q9bjaXkM7fyRurN9wNcuxarFk+iUZe4tW&#xA;TBOH1RI+CLy9qdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVSvzPrB0j&#xA;Rbi9QAyqAsIPTm5oK/LrmF2hqvAwymOfT3uVo8Hi5BHo8Vurq4urh7i4kaWaQ8nkY1JOeeZMkpyM&#xA;pGyXsYQERQFAKWQZuxV2KuxV2KuxVtWZGDKSrKaqw2II8MIJG4QRb0TyN53nnnTStUcySPta3Lfa&#xA;J/kc969jnVdj9rykRiymyeR/QXn+0uzhEeJD4hn2dQ6J2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K&#xA;uxV2KuxV2KuxV2KuxV2KsW/Mn/lGH/4yx/rzS9v/AOLH3h2fZH9/8C8lzhnq3Yq7FXYq7FXYq7FX&#xA;YquikkikSWNisiEMjDqCDUHDGRBscwggEUXuOgarHquk218tA0q/vVH7Mg2cffnpGi1Iz4ozHXn7&#xA;+rxOqwHFkMe5MMymh2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxVi35k/8ow/&#xA;/GWP9eaXt/8AxY+8Oz7I/v8A4F5LnDPVuxV2KuxV2KuxV2KuxV2Ksr8jebU0eZ7S8J+oTty5Dcxv&#xA;05U8COubvsftMac8M/ol9hdV2lofFHFH6h9r1WCeGeJZoJFlicVR0IKkexGdtCcZC4mwXmJRMTR2&#xA;K/JMXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYqxb8yf+UYf/jNH+s5pe3/APFj&#xA;7w7Psj+/+BeS5wz1bsVdirsVdirsVdirsVdirh1xQmGn6tqVgSbO5kg5faCMQD8x0OWYtVlxfRIx&#xA;aMuCE/qAKbL5z8zHrfN/wKf805kHtrV/zz9n6nFPZ+H+b96qvnHzIet83/Ap/wA05We29X/PPyH6&#xA;mJ0GH+aqr5u8xH/j9b/gU/5pyB7c1n+qH5D9TE6DD/NVV816+f8Aj8b/AIFP6ZWe3dZ/qh+Q/UxO&#xA;hw/zVVfNOu97tv8AgU/pkD2/rf8AVD8h+pidFi/mqq+Ztb/5am+5f6ZWfaDW/wCqH5D9TE6LF/NV&#xA;F8yaz/y1N9y/0yB9odd/qh+Q/Ux/J4u5UHmLWP8AlpP3L/TIn2i13+qH5R/Uj8nj7l48w6t/y0n7&#xA;l/pkf9EWu/1Q/KP6kflMfc3/AIg1b/loP3L/AEwf6I9f/qh+Uf1I/KY+53+INW/5aD9y/wBMf9Ee&#xA;v/1Q/KP6l/KY+5afMOr/APLSfuX+mH/RFrv9UPyj+pP5TH3Ktp5q1GGUGdhPF+0pABp7EAZn6L2q&#xA;1WOf7w+JDqCAD8CGGTQwkNtizG2uIrmBJ4jyjkHJTnpem1EM2MZIG4yDppwMSQeYVMuYuxV2KuxV&#xA;2KuxVjnn7/lHn/4yx/rznfan/Ez/AFg5/Zv978HmgzzJ6BeuRQqDAhcMiheMCFQZFC8YELxkVXjA&#xA;xXjIqvGBivGRVUGBivGRVeMCF65FC8YELxkUKgwIXjIoXAYEOIxVacKVhySsk0An9HL7M1Pvz2D2&#xA;NJOgHlKX3ur1f1pjnVOM7FXYq7FXYq7FWOefv+Uef/jLH+vOd9qf8TP9YOf2b/e/B5oM8yegXrkU&#xA;KgwIXDIoXjAhUGRQvGBC8ZFV4wMV4yKrxgYrxkVVBgYrxkVXjAheuRQvXAheMihUGBC8ZFC8HAhx&#xA;OKrDhSsOFWSaB/xzx/rNnsHsZ/iA/rSdXq/rTHOrcZ2KuxV2KuxV2Ksc8/f8o8//ABlj/XnO+1P+&#xA;Jn+sHP7N/vfg80GeZPQLxkULxgQvGRQvGBC8ZFC8YELxgVUGRYrxgVeMiheMCF4yKF4yKF4wIXjI&#xA;oXjAhUByKFwOBC8HAhdXArq4qtJwqtJwpZLoH/HOH+s2ev8AsZ/iA/rSdXq/rTHOrcV2KuxV2Kux&#xA;V2Ksc8/f8o8//GWP9ec77U/4mf6wc/s3+9+DzQZ5k9AvGBC8ZFC8YELxkVXrgQvGRQvGBC8ZFC8Y&#xA;EJZ5l816B5Y0xtS1u7S0thsnLd5G/kjQfEzewzJ0ehy6mfBijxH7vf3NeTJGAsvDvMn/ADlTemV4&#xA;vLWkRxxA0S61BmdmHj6MTIFP+zOdvo/YmNXmmb7o/rP6g67J2gf4R82Jy/8AOSH5ovIGS7tolBqU&#xA;S2jIO/T4uR/HNrH2R0IH0yP+cWg63Im2jf8AOUvne1lX9J2NlqMH7QVXt5T8nVnQf8BmJqPYrSyH&#xA;olOB+Y/HxZR10xzAL278uvzl8o+d6W1o7WWrheT6bc0DkDqYnHwyAe2/iBnFdrez2o0Xql6sf84f&#xA;p7vu83NxaiM+XNnwOaFvXg4ELwcihcDgVcDgQurgQ6uKtE4UrScKWTeX/wDjnD/WbPXvY3/ER/Wk&#xA;6rV/WmWdW4rsVdirsVdirsVY55//AOUef/jLH+vOd9qf8TP9YOf2b/e/B5mM8yegXjAqoMiheMCF&#xA;wyKF64CheMiheMCF4wIUNU1Sz0rTLrU71/TtLOJ5538EQcjTxO2wyeDDLLMQjvKRoMJSERZfF3n7&#xA;z1q/nLX5dTvnZYAWWxtK1SCGuyD3/mbuc9l7L7Mx6PEIQ5/xHvP45PP5sxySspp+X35P+bPOoNzZ&#xA;IlnpStxfUbmoQkdVjUAtIR7beJzG7V7f0+i9MvVP+aP09zPDppZOXJ6jD/zida+mvreZXMn7RS0A&#xA;X6KzHOYl7cyvbFt/W/465f8AJ/mxrzh/zjL5q0i0lvdEvI9bhiBZ7dYzBc0G54R8pFens1T2GbHs&#xA;/wBssGWQjlicZPW7j89q+XxacmhlHcbvIbW6vLG8jubaR7a7tnDxSoSjo6GoII3BBzrpwjOJjIXE&#xA;/a4YJBfan5PfmAPOvk6DUJ+I1S1b6tqSLsPVQAiQDwkUhvnUds8Y7f7K/JakwH0S3j7u74cndafL&#xA;xxvqzkHNG3LwcCFwOBC4HArdcVdXFWicVWk4VZR5d/45o/12z172N/xEf1pOq1n1pnnVOK7FXYq7&#xA;FXYq7FWOef8A/lHn/wCMsf68532p/wATP9YOf2b/AHvweZjPMnoV4wIXjAheMiheMCF4yKF4wIXD&#xA;IoXrgQ8p/wCclNbksfIMVhExDapdxxSU2rFEDK3/AA6pnVex+mE9WZn+CJPxO33W4OvnUK7y+bfL&#xA;GiSa75j03R4yVa/uYoC46qrsAz/7FanPR9bqRgwzyH+GJLqMcOKQHe+6NM06y0zT7fT7GJYLO1jW&#xA;KCJeiogoBnh2bLLJMzkblI2XoYxAFBGA5SleDgQ+RP8AnIryxbaJ+Yks9qgS31eBb4ouyiVmZJaf&#xA;6zJzP+tnrXslrJZtGBLnjPD8OY++vg6bWQ4Z+9kH/OKWsSQebtV0ktSC+shPT/iy2kUL/wALM2YH&#xA;txpxLTwydYzr4SH7Az0MvUQ+ogc8wdmuBwKuBxQurgV3LFDuWKurilaThVlflz/jmL/rtnrnsb/i&#xA;I/rSdTrPrTPOqcV2KuxV2KuxV2Ksc8//APKOv/xlj/XnO+1H+Jn+sHP7N/vfg8yGeZvQrxkULxgQ&#xA;vGRQvGBC8YELwciheMCFwOBXhn/OVDN+jfLq1PEzXJK9iQsdP152/sSPXl90f0ur7S5ReX/kmqt+&#xA;aXl8MAR60hod9xC5B+g50/tGf8Bye4feHC0n94H2YDnjjvlwOBC8HAh81/8AOV3/ACkOhf8AMJL/&#xA;AMnc9I9h/wC5yf1h9zq+0PqDH/8AnGn/AMmhB/zCXP8AxEZn+2H+In+tFq0X94+uwc8lduuBwK2D&#xA;gQu5YFdyxQ7lirq4pWk4VZb5a/45i/67Z657Hf4iP60nUaz+8TTOpcV2KuxV2KuxV2Ksb/MD/lHX&#xA;/wCMsf68532o/wATP9YOf2b/AHvweZDPM3oV4wIXjAheMiheMCF4yKrgcCF4OBC8HIoeF/8AOVH/&#xA;ABz/AC7/AMZbr/iMedx7E/Xl90f0ur7S5ReY/kl/5NLQP+Msn/JiTOm9o/8AEcnuH+6Dh6T+8D7K&#xA;Bzx13y8HAhcDgQ+bP+crf+Ug0L/mEl/5OZ6P7D/3OT+sPudV2h9QY/8A841/+TPg/wCYS4/4iM2H&#xA;th/iJ/rRatF/ePrkHPJXcLgcCF1cCurirdcVdXFXVxVonFWXeWf+OWv+u2et+x3+Ij+tJ1Gt/vE1&#xA;zqXEdirsVdirsVdirG/zA/5R1/8AjLH+vOd9qP8AEz/WDn9m/wB78HmIzzR6FeMiq8YELwcCF4OR&#xA;QuBwIXg4ELwcih5z5z/PPy95T8wT6Je2F3PcQLGzSw+lwIkQOKcnU9D4Z0XZ3s1m1WEZYyiAb530&#xA;+DhZtbHHLhILx784/wA1dH8822lxafaXFq1i8zSG44UYShAOPBm/kzr/AGf7EyaKUzOUZcVcr6W6&#xA;/V6kZQKHJiP5f+ZLXy15x03XLuJ5reyd3kiipzIaNk25EDq3jm27V0ctTp54okAy7/e4+DIITEj0&#xA;e7j/AJyk8of9WnUPuh/6qZwv+grUfz4fb+p2X8ow7iuH/OU3lD/q06h90H/VTH/QTqP58Pt/Uv8A&#xA;KEO4t/8AQ1Hk/wD6tOofdB/1Uwf6CdR/Ph9v6kfyhDuLyj85vzK0rz3qenXenWs9qlnA8Ui3HCpL&#xA;PyqODNnVez3Y+TQwlGZEuI3s4eqzjIQQlv5UedbDyb5vj1u+gluLdIJYjHBx51kAAPxFRmT252dP&#xA;Wac4oEA2Dv5MNPlEJWXulj/zlD5RvL23tE0rUFe4kSJWYQ0BdgoJpJ75w+X2L1EImRnDYX1/U541&#xA;0SaovZgc41zW64q3XArdcVdXFWq4q1XCrMfK/wDxyl/12z1n2P8A8RH9aTp9b/eJtnUuI7FXYq7F&#xA;XYq7FWN/mD/yjr/8ZY/15zvtR/ih/rBz+zf734PMBnmj0S8YELwcCFwORQvBwIXg4ELwciq4HAh8&#xA;ofn/AP8Akz9R/wCMVt/yYTPVfZb/ABGPvl95dBr/AO9LzrOhcN2KuxV2KuxV2KuxVMfLv/KQaZ/z&#xA;Fwf8nFzH1f8Acz/qn7mUPqD74Bzwd6JdXArq4q3XFDq4q1XFLq4qzLyt/wAclf8AXbPWfZD/ABEf&#xA;1pOm1v8AeJvnUOI7FXYq7FXYq7FWNfmD/wAo4/8Axlj/AF5zvtR/ih/rB2HZv978HmAOeavQrwci&#xA;hcDgQvBwKvBwIXg5FC4HAhcDgQ+Uvz+/8mdqP/GK2/5MJnqnst/iMffL7y6DX/3pedZ0LhuxV2Ku&#xA;xV2KuxV2Kpj5d/5SDTP+YuD/AJOLmPq/7mf9U/cyh9Qfe1c8IejdXFW64FdXFXVxV1cVarhVmvlT&#xA;/jkL/rt+vPV/ZD/Eh/Wk6bXf3icZ1DhuxV2KuxV2KuxVjX5hf8o4/wDxlj/XnPe0/wDih/rB2HZv&#xA;978Hl4OeaPQrwcCrgcCF4OBC4HIoXg4ELgcCrwcCHyl+fv8A5M7Uf+MVt/yYXPU/Zf8AxKPvl95e&#xA;f1/96XnedC4bsVdirsVdirsVdiqYeXf+Ug0z/mLg/wCTi5j6v+6n/VP3MofUH3pXPCnpG64FdXFD&#xA;q4q6uKurirq4pZt5S/446/67/rz1f2R/xIf1pOl1394nOdO4bsVdirsVdirsVY1+Yf8Ayjj/APGW&#xA;P9ec97T/AOKH+sHYdmf3vweXA55q9EuBwIXg4ELgciq4HAheDgQvBwIXA4EPlT8/P/Jm6j/xitv+&#xA;TC56l7L/AOJR98vvLz+v/vS87zoXDdirsVdirsVdirsVTDy9/wAd/TP+YuD/AJOLmPq/7qf9U/cy&#xA;h9QfeNc8LeldXFW64FdyxV3LFXVxVquFWc+Uf+OMv/GR/wBeeq+yP+JD+tJ0mu/vE6zp3DdirsVd&#xA;irsVdirGfzE/5Rt/+Msf68572n/xQ/1g7Dsz+9+BeWg55s9EvBwKuByKFwOBC8HAhcDgVeDgQuBw&#xA;IfKv59/+TM1D/jFbf8mFz1L2X/xKPvl95ef1/wDen4PPM6BwnYq7FXYq7FXYq7FUw8vf8d/TP+Yu&#xA;D/k4uY+r/up/1T9zKH1B93Vzwx6Z1cVbrih1cVdXFXVxVquKWd+T/wDjjL/xkf8AXnqvsl/iQ/rS&#xA;dHr/AO8+Cd50zhuxV2KuxV2KuxVjP5if8o2//GWP9ec97T/4of6wdh2Z/e/AvLAc82ejXA4ELgcC&#xA;F4OBVwOBC4HAhcDgVeDgQ8c/Mj8ktf8ANXm261qzv7SCCdIlWOb1OYMcYQ14ow7Z2HZHtHi0unGK&#xA;UZEi+VdT73V6nQyyTMgQxj/oWfzZ/wBXSw++b/qnmy/0Y6f+ZP7P1uP/ACZPvDf/AELL5s/6uth9&#xA;83/VPH/Rlp/5k/s/Wv8AJk+8O/6Fk82f9XWw++b/AKp4/wCjLT/zJ/Z+tf5Mn3hv/oWPzb/1dbD7&#xA;5v8Aqng/0Zaf+ZP7P1o/k2feG/8AoWLzb/1dbD75v+qeP+jPT/zJ/Z+tf5Nn3h3/AELD5t/6uun/&#xA;AHzf9U8f9Gen/mT+z9a/ybPvDf8A0LB5t/6uun/fN/1Twf6M9P8AzJ/Z+tf5Nn3hE6Z/zjV5rtNS&#xA;tLp9UsGS3mjlZVM1SEcMQKx+2V5vbDBOEoiE9wR0/WmPZ0wQbD6Mrnnbt264q3XArq4odXFXVxS1&#xA;XCrPfJv/ABxV/wCMj/rz1P2S/wASH9aTo9f/AHnwTzOmcJ2KuxV2KuxV2KsY/MX/AJRp/wDjLH+v&#xA;Oe9pv8UP9YOw7M/vfgXlYOebvRrgcCrwcCFwOBC4HAq4HAhcDgQuBwKvBwIXA4ENg4FXA4ELgcCt&#xA;g4oXA4FbrgQ3XFW64FdXFW64odXFXVxV1cVariln/kz/AI4i/wDGR/156n7J/wCJD+tJ0Wv/ALz4&#xA;J7nSuE7FXYq7FXYq7FWMfmN/yjT/APGWP9ec/wC03+KH+sHYdmf33wLykHPN3pF4OBC4HAhcDgVc&#xA;DgQuBwIXA4FXA4ELgcCrgcCFwOBC4HArYOKGwcCrq4FbrihuuBW+WNK6uKt1wIdXFXVxV1cVarhS&#xA;9B8lf8cNf+Mj/rz1H2T/AMSH9aToe0P734J9nSuE7FXYq7FXYq7FUu8xaQNW0i4sqhXcViY9A6mq&#xA;/wBDmD2lo/zOCWPqeXv6N+mzeHMSeM3tjeWNy1tdxNDMnVGH4jxHuM8sz6eeKRhMcMg9VjyRmLib&#xA;CkDlDNcDgQuBwIXA4FXA4ELgcCFwOBVwOBC4HArYOBC4HFVwOBDdcCt1xQ3XArdcVdXArdcUOrir&#xA;q4q6uKuriqta2tzdzrBbRtLK3RV/WfAZfp9NkzTEMYMpFjOYiLOwen6Lpw07TYbWoLoKyMO7sanP&#xA;XuytCNLp44uo5+883nNRl8SZkjc2DS7FXYq7FXYq7FXYqpT2trcALcQpMo6CRQw/EHK8mGE9pAS9&#xA;4tlGZjyNKH6G0j/lht/+RSf0yn8jg/mQ/wBKGfjz/nH5t/ofSP8Alht/+RSf0x/I4P5kP9KF8ef8&#xA;4/N36H0n/lit/wDkUn9MfyOD+ZD/AEoXx5/zj83fojSf+WKD/kUn9MfyOD+ZD/ShfHn/ADj83foj&#xA;Sf8Alig/5FJ/TH8jg/mQ/wBKF8ef84/N36I0r/lig/5FJ/TH8jg/1OH+lC+NP+cfm3+idK/5YoP+&#xA;RSf0x/I4P9Th/pQvjT/nH5u/ROlf8scH/IpP6Y/kcH+pw/0oR40/5x+bv0Tpf/LHB/yLT+mP5DB/&#xA;qcP9KF8af84/N36K0v8A5Y4P+Raf0wfkMH+pw/0oXxp/zj83forS/wDljg/5Fp/TH8hg/wBTh/pQ&#xA;vjT7z83forTP+WOD/kWn9MfyGn/1OH+lH6l8afefm3+i9M/5ZIP+Raf0x/Iaf/U4f6UfqXxp95+b&#xA;v0Xpn/LJD/yLT+mP5DT/AOpw/wBKP1L40+8/N36L0z/lkh/5Fp/TH8hp/wDU4f6UfqXxp95+bv0X&#xA;pn/LJD/yLT+mP5DT/wCpw/0o/UvjT7z83fovTf8Alkh/5Fp/TH8hp/8AU4f6UfqXxp95+bv0Xpv/&#xA;ACyQ/wDItP6Y/kNP/qcP9KP1L40+8/N36M03/lkh/wCRaf0x/Iaf/U4f6UfqXxp95+bv0Zpv/LJD&#xA;/wAi0/pj+Q0/+pw/0o/UvjT7z83fozTf+WSH/kWn9MfyGn/1OH+lH6l8afefm79Gab/yyQ/8i0/p&#xA;j+Q0/wDqcP8ASj9S+NPvPzVYbe3hBEMSRg9Qihf1ZdjwwxioREfcKYykTzKplrF2KuxV2KuxV2Ku&#xA;xV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kux&#xA;V2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV&#xA;2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2&#xA;KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K&#xA;uxV2KuxV2Kv/2Q==</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/'>
+  <xapMM:DocumentID>uuid:613db75f-bcf9-4a78-b76d-0d89ef07a31b</xapMM:DocumentID>
+ </rdf:Description>
+
+ <rdf:Description rdf:about='uuid:131a7bf5-cd0e-4706-abfb-a53ed59e497e'
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<rect i:knockout="Off" fill="none" width="26" height="26"/> 
+				<g i:knockout="Off">
+					<path i:knockout="Off" fill="#FFFFFF" d="M4,2.954c-1.103,0-2,0.897-2,2V21c0,1.103,0.897,2,2,2h18c1.103,0,2-0.897,2-2V7.682
+						l-0.159-0.78c-0.318-0.743-1.04-1.22-1.841-1.22h-9.728c-0.158,0-0.443-0.183-0.51-0.326l-0.417-0.91
+						c-0.392-0.851-1.392-1.491-2.327-1.491H4z"/>
+				</g>
+				<g i:knockout="Off">
+					<radialGradient id="XMLID_3_" cx="20.2725" cy="8.1089" r="32.5557" fx="20.2725" fy="8.1089" gradientUnits="userSpaceOnUse">
+						<stop  offset="0" style="stop-color:#FEF700"/>
+						<stop  offset="0.3006" style="stop-color:#F0CD00"/>
+						<stop  offset="0.7745" style="stop-color:#DB8F00"/>
+						<stop  offset="1" style="stop-color:#D37700"/>
+						<a:midPointStop  offset="0" style="stop-color:#FEF700"/>
+						<a:midPointStop  offset="0.4615" style="stop-color:#FEF700"/>
+						<a:midPointStop  offset="1" style="stop-color:#D37700"/>
+					</radialGradient>
+					<path i:knockout="Off" fill="url(#XMLID_3_)" d="M3,7.291V21c0,0.55,0.45,1,1,1h18c0.55,0,1-0.45,1-1V7.682
+						c0-0.139-0.029-0.271-0.08-0.391H3z"/>
+					<radialGradient id="XMLID_4_" cx="20.2031" cy="4.1396" r="9.5686" fx="20.2031" fy="4.1396" gradientUnits="userSpaceOnUse">
+						<stop  offset="0" style="stop-color:#FEF700"/>
+						<stop  offset="0.3534" style="stop-color:#F6D10A"/>
+						<stop  offset="1" style="stop-color:#E88F1C"/>
+						<a:midPointStop  offset="0" style="stop-color:#FEF700"/>
+						<a:midPointStop  offset="0.4859" style="stop-color:#FEF700"/>
+						<a:midPointStop  offset="1" style="stop-color:#E88F1C"/>
+					</radialGradient>
+					<path i:knockout="Off" fill="url(#XMLID_4_)" d="M22,6.682h-9.728c-0.55,0-1.188-0.409-1.418-0.908l-0.418-0.911
+						c-0.229-0.499-0.868-0.908-1.418-0.908H4c-0.55,0-1,0.45-1,1v2.337h19.92C22.767,6.934,22.411,6.682,22,6.682z"/>
+				</g>
+				<path i:knockout="Off" d="M15.986,14.316V12.52c0-1.507-0.818-2.52-2.432-2.52c-1.614,0-2.541,1.013-2.541,2.52v1.797H10v4.852
+					h7v-4.852H15.986z M12,12.52c0-0.998,0.485-1.599,1.555-1.599S15,11.521,15,12.52v1.797h-3V12.52z"/>
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_folder_small.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,22 @@
+<?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.201,1.944c-0.891,0-1.616,0.726-1.616,1.615v12.961c0,0.892,0.725,1.615,1.616,1.615H17.74     c0.891,0,1.615-0.726,1.615-1.615V5.764l-0.129-0.631c-0.256-0.6-0.84-0.984-1.486-0.984H9.882C9.755,4.148,9.524,4,9.47,3.885     L9.134,3.149c-0.317-0.688-1.125-1.204-1.88-1.204L3.201,1.944L3.201,1.944z"/>
+</g>
+<g>
+<radialGradient id="XMLID_2_" cx="3.3203" cy="15.3789" r="19.6591" gradientTransform="matrix(1 0 0 1.0104 0 -0.3156)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FEE300"/>
+<stop offset="0.3639" style="stop-color:#F0CD00"/>
+<stop offset="0.7745" style="stop-color:#DB8F00"/>
+<stop offset="1" style="stop-color:#D37700"/>
+</radialGradient>
+<path fill="url(#XMLID_2_)" d="M2.126,5.22v11.576c0,0.463,0.377,0.845,0.836,0.845h15.043c0.459,0,0.836-0.38,0.836-0.845V5.55     c0-0.116-0.025-0.229-0.066-0.33H2.126L2.126,5.22z"/>
+<path fill="#E88F1C" d="M18.005,4.705h-8.13c-0.458,0-0.993-0.347-1.186-0.766L8.341,3.17C8.149,2.748,7.616,2.401,7.156,2.401     H2.962c-0.459,0-0.836,0.38-0.836,0.846v1.974h16.649C18.646,4.92,18.349,4.705,18.005,4.705z"/>
+</g>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_music.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -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/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_other_images.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+<?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="M2.775,3.639c-0.6,0-1.121,0.523-1.121,1.267L1.638,15.919c0,1.431,0.102,1.59,1.71,1.59h14.679     c1.029,0,1.312-0.448,1.312-1.501l0.015-10.731c0-1.049-0.213-1.635-1.242-1.635L3.506,3.639H2.775z"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="2.147" y1="9.918" x2="18.8398" y2="9.918">
+<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_3_)" d="M18.205,4.117H2.783l0,0c-0.352,0-0.636,0.289-0.636,0.64v10.94     c-0.031,0.029,16.669,0.029,16.693,0V4.757C18.84,4.406,18.557,4.117,18.205,4.117z"/>
+</g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="2.147" y1="15.5117" x2="18.8398" y2="15.5117">
+<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_4_)" d="M2.147,14.075v2.236c0,0.352,0.284,0.638,0.636,0.638h15.422c0.352,0,0.635-0.28,0.635-0.638    v-2.236H2.147z"/>
+<polygon fill="#F4A816" points="6.518,14.384 4.531,12.246 16.455,12.246 14.467,14.384   "/>
+<polygon fill="#FFFFFF" points="11.157,11.532 11.157,5.829 5.855,11.532   "/>
+<polygon fill="#FFFFFF" points="11.818,5.829 15.13,11.532 11.818,11.532   "/>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_other_videos.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,30 @@
+<?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>
+<g>
+<path fill="#FFFFFF" d="M4.214,2.083c-1.498-0.035-2.55,0.415-2.539,2.524v11.987c-0.011,2.071,0.867,2.483,2.539,2.523h12.693     c1.941,0.065,2.538-0.799,2.539-2.523V4.607c-0.001-1.866-0.877-2.56-2.539-2.524H4.214z"/>
+<path fill="url(#XMLID_2_)" d="M18.895,17.235c0,0.763-0.62,1.388-1.386,1.388H3.647c-0.767,0-1.387-0.625-1.387-1.388V4.064     c0-0.764,0.621-1.385,1.387-1.385h13.861c0.766,0,1.386,0.621,1.386,1.385V17.235z"/>
+<rect x="3.647" y="11.69" fill="#FFFFFF" width="2.079" height="2.08"/>
+<rect x="3.647" y="15.85" fill="#FFFFFF" width="2.079" height="2.079"/>
+<rect x="15.43" y="7.531" fill="#FFFFFF" width="2.079" height="2.081"/>
+<rect x="15.43" y="3.373" fill="#FFFFFF" width="2.079" height="2.079"/>
+<rect x="15.43" y="11.69" fill="#FFFFFF" width="2.079" height="2.08"/>
+<rect x="15.43" y="15.85" fill="#FFFFFF" width="2.079" height="2.079"/>
+<rect x="7.112" y="2.68" fill="#CBCBCB" width="6.932" height="4.157"/>
+<rect x="7.112" y="8.223" fill="#CBCBCB" width="6.932" height="4.854"/>
+<rect x="7.112" y="14.464" fill="#CBCBCB" width="6.932" height="4.159"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="2.2061" y1="3.626" x2="18.9491" y2="17.675">
+<stop offset="0" style="stop-color:#AFAFAE"/>
+<stop offset="1" style="stop-color:#121212"/>
+</linearGradient>
+</defs>
+</g>
+<rect x="3.628" y="7.524" fill="#FFFFFF" width="2.078" height="2.081"/>
+<rect x="3.628" y="3.365" fill="#FFFFFF" width="2.078" height="2.08"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/bitmaps/qgn_server_icon.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,66 @@
+<?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>
+<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="-376.5962" y1="280.3848" x2="-369.1521" y2="260.9922" gradientTransform="matrix(1 0 0 -1 379.2793 280.7715)">
+<stop offset="0" style="stop-color:#E9E9E9"/>
+<stop offset="0.0056" style="stop-color:#E9E9E9"/>
+<stop offset="0.1191" style="stop-color:#E2E2E2"/>
+<stop offset="0.2885" style="stop-color:#CDCDCD"/>
+<stop offset="0.4927" style="stop-color:#ACACAC"/>
+<stop offset="0.724" style="stop-color:#7E7E7E"/>
+<stop offset="0.9752" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_5_)" d="M10.359,3.445L3.066,2.639c0,0-0.319-0.035-0.322,0.375c-0.003,0.632,0.002,14.478,0,14.829    c-0.002,0.332,0.232,0.378,0.232,0.378l7.351,1.445c0,0,0.249,0.059,0.251-0.315c0.003-0.511,0.084-14.59,0.087-15.416    C10.669,3.447,10.359,3.445,10.359,3.445z"/>
+<polygon fill="#3D3D3D" points="3.247,4.25 10.025,4.995 10.025,6.088 3.243,5.356   "/>
+<polygon fill="#3D3D3D" points="3.247,6.999 10.025,7.743 10.025,8.837 3.243,8.105   "/>
+<polygon fill="#3D3D3D" points="3.247,9.748 10.025,10.492 10.025,11.585 3.243,10.854   "/>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="-369.7485" y1="283.4189" x2="-364.5975" y2="261.1074" gradientTransform="matrix(1 0 0 -1 379.2793 280.7715)">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.0056" style="stop-color:#000000"/>
+<stop offset="0.1404" style="stop-color:#3D3D3D"/>
+<stop offset="0.2303" style="stop-color:#FFFFFF"/>
+<stop offset="0.2865" style="stop-color:#FFFFFF"/>
+<stop offset="0.5112" style="stop-color:#E9E9E9"/>
+<stop offset="0.567" style="stop-color:#E2E2E2"/>
+<stop offset="0.6503" style="stop-color:#CDCDCD"/>
+<stop offset="0.7506" style="stop-color:#ACACAC"/>
+<stop offset="0.8643" style="stop-color:#7E7E7E"/>
+<stop offset="0.9878" style="stop-color:#434343"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_6_)" d="M17.676,1.145c-0.596-0.057-6.274-0.407-7.372-0.516c0,0-0.314-0.038-0.711-0.017    c-0.396,0.022-5.491,0.574-5.939,0.62C3.09,1.288,2.75,1.51,2.659,1.615C2.81,1.48,3.004,1.496,3.004,1.496    c1.53,0.081,7.851,0.746,7.851,0.746s0.958-0.072,1,0.914v0.008c0,0,0,15.454,0,16.459c0,0.358-0.125,0.594-0.282,0.753    c1.511-0.617,6.123-2.542,6.123-2.542c0.59-0.218,0.662-1.016,0.662-1.016l0.078-14.871C18.437,1.947,18.406,1.216,17.676,1.145z"/>
+<path fill="#FFFFFF" d="M10.855,2.242c0,0-6.321-0.665-7.851-0.746c0,0-0.52-0.048-0.52,0.606C2.478,2.9,2.491,17.01,2.484,18.34    c-0.005,0.757,0.556,0.729,0.556,0.729l7.85,1.625c0,0,0.966-0.067,0.966-1.072s0-16.459,0-16.459V3.155    C11.813,2.169,10.855,2.242,10.855,2.242z M10.578,19.351c-0.002,0.374-0.251,0.313-0.251,0.313l-7.351-1.443    c0,0-0.234-0.046-0.232-0.378c0.002-0.351-0.003-14.197,0-14.829c0.002-0.411,0.322-0.375,0.322-0.375l7.293,0.806    c0,0,0.31,0.002,0.306,0.49C10.662,4.76,10.581,18.84,10.578,19.351z"/>
+<path fill="#3D3D3D" d="M11.072,3.916c0-0.654-0.525-0.743-0.525-0.743L3.566,2.436c0,0-0.263,0.025-0.329,0.05    c-0.162,0.063-0.442,0.183-0.442,0.27c0,0.005,0.005,0.013,0.006,0.018c0.093-0.153,0.264-0.135,0.264-0.135l7.293,0.806    c0,0,0.31,0.002,0.307,0.49c-0.005,0.825-0.085,14.905-0.089,15.414c0,0.046-0.004,0.086-0.01,0.119    c-0.003,0.019-0.009,0.033-0.017,0.051c-0.003,0.009-0.007,0.023-0.012,0.033c-0.008,0.019-0.019,0.033-0.031,0.047    c-0.001,0.001-0.002,0.006-0.006,0.008c-0.014,0.015-0.028,0.026-0.043,0.034l0,0c0.093-0.024,0.63-0.184,0.63-0.343    C11.089,19.125,11.072,4.493,11.072,3.916z"/>
+<g>
+<polygon fill="#102F02" points="6.014,12.937 6.193,12.856 7.199,12.939 7.199,14.054 7.085,14.117 6.227,13.422    "/>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="-373.104" y1="267.7617" x2="-372.1293" y2="266.4128" gradientTransform="matrix(1 0 0 -1 379.2793 280.7715)">
+<stop offset="0" style="stop-color:#68D80B"/>
+<stop offset="0.0056" style="stop-color:#68D80B"/>
+<stop offset="0.1573" style="stop-color:#68D80B"/>
+<stop offset="0.2796" style="stop-color:#60D10A"/>
+<stop offset="0.4658" style="stop-color:#4BBD06"/>
+<stop offset="0.6798" style="stop-color:#2B9F00"/>
+<stop offset="1" style="stop-color:#2B9F00"/>
+</linearGradient>
+<rect x="6.011" y="12.986" fill="url(#XMLID_7_)" width="1.077" height="1.083"/>
+</g>
+<polygon fill="#102F02" points="6.014,15.431 6.193,15.35 7.199,15.434 7.199,16.546 7.085,16.611 6.227,15.915   "/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="-373.104" y1="265.2686" x2="-372.1298" y2="263.9204" gradientTransform="matrix(1 0 0 -1 379.2793 280.7715)">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1573" style="stop-color:#F51D18"/>
+<stop offset="0.2283" style="stop-color:#ED1C17"/>
+<stop offset="0.3363" style="stop-color:#D81A13"/>
+<stop offset="0.4681" style="stop-color:#B6170E"/>
+<stop offset="0.6171" style="stop-color:#861306"/>
+<stop offset="0.6798" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<rect x="6.011" y="15.479" fill="url(#XMLID_8_)" width="1.077" height="1.082"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/data/upnpcommonui.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1338 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for the Common UI
+*
+*/
+
+
+// RESOURCE IDENTIFIER
+NAME    UPCU
+
+// INCLUDES
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.loc>
+#include <avkon.hrh>
+#include <eikon.rh>
+#include <eikon.rsg>
+#include <data_caging_paths_strings.hrh>
+#include <appinfo.rh>
+#include <avkon.mbg>
+#include <upnpcommonui.mbg>         // animation frames
+#include <upnpframework.loc>        // Loc strings for upnpframework subsystem
+
+#include "upnpcommonui.hrh"
+
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// RESOURCE DEFINITIONS
+
+// --------------------------------------------------------------------------
+//
+// RSS_SIGNATURE
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE 
+    {
+    }
+
+// --------------------------------------------------------------------------
+//
+// TBUF
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF 
+    { 
+    buf = "";
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_EXTERNAL_MEDIA_TITLE
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_external_media_title
+    {
+    buf = qtn_iupnp_title_ext_media_2;
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_external_waiting_note
+    {
+    buf = qtn_iupnp_main_empty; 
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_EXTERNAL_EMPTY_FOLDER
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_external_empty_folder
+    {
+    buf = qtn_iupnp_no_files_found; 
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_BROWSE_DIALOG_MENUBAR
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_upnpcommonui_browse_dialog_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            { 
+            menu_pane = r_upnpcommonui_browse_option_menu;
+            }
+        };
+    }
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_MENUPANE_MARKABLE_LIST_IMPLEMENTATION
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_upnpcommonui_menupane_markable_list_implementation
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command=EAknCmdMark;
+            txt=qtn_options_list_mark_one;
+            },
+        MENU_ITEM
+            {
+            command=EAknMarkAll;
+            txt=qtn_options_list_mark_all;
+            },
+        MENU_ITEM
+            {
+            command=EAknCmdUnmark;
+            txt=qtn_options_list_unmark_one;
+            },
+        MENU_ITEM
+            {
+            command=EAknUnmarkAll;
+            txt=qtn_options_list_unmark_all;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_MENUPANE_SHOW_SUB_MENU
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_upnpcommonui_menupane_show_sub_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            { 
+            command = EUPnPShowLocal; 
+            txt = qtn_iupnp_on_device;
+            },
+        MENU_ITEM
+            { 
+            command = EUPnPShowExt; 
+            txt = qtn_iupnp_via_homenet;
+            }
+        
+        };
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_MENUPANE_PLAY_SUB_MENU
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_upnpcommonui_menupane_play_sub_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            { 
+            command = EUPnPPlayLocal;
+            txt = qtn_iupnp_on_device;
+            },
+        MENU_ITEM
+            { 
+            command = EUPnPPlayExt; 
+            txt = qtn_iupnp_via_homenet; 
+            }
+
+        };
+    }
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_BROWSE_OPTION_MENU
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_upnpcommonui_browse_option_menu
+    {
+    items =
+        {
+        MENU_ITEM 
+            { 
+            command = EUPnPOpen;
+            txt = qtn_options_open;
+            },
+        MENU_ITEM 
+            { 
+            command = EUPnPShow;
+            txt = qtn_iupnp_show_ext_main;
+            cascade = r_upnpcommonui_menupane_show_sub_menu;      
+            },
+        MENU_ITEM 
+            { 
+            command = EUPnPPlay;
+            txt = qtn_iupnp_play_ext_main;
+            cascade = r_upnpcommonui_menupane_play_sub_menu;        
+            },
+        MENU_ITEM 
+            { 
+            command = EUPnPFind;
+            txt = qtn_options_find; 
+            },
+        MENU_ITEM 
+            { 
+            command = EUPnPCopy;
+            txt = qtn_iupnp_copy_main; 
+            },
+        MENU_ITEM
+            {            
+            cascade= r_upnpcommonui_menupane_markable_list_implementation; 
+            command=EAknCmdEditListMenu; 
+            txt=qtn_options_list; 
+            },
+        MENU_ITEM 
+            { 
+            command = EUPnPHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM 
+            { 
+            command = EAknCmdExit; 
+            txt = qtn_options_exit; 
+            }
+        };
+    }
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_EXTERNAL_DEVICE_DIALOG_MENUBAR
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_upnpcommonui_external_device_dialog_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            { 
+            menu_pane = r_upnpcommonui_external_device_option_menu;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_COMMONUI_EXTERNAL_DEVICE_OPTION_MENU
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_upnpcommonui_external_device_option_menu
+    {
+    items =
+        {
+        MENU_ITEM 
+            { 
+            command = EUPnPOpen;
+            txt = qtn_options_open; 
+            },
+        MENU_ITEM 
+            { 
+            command = EUPnPFind;
+            txt = qtn_options_find; 
+            },
+        MENU_ITEM 
+            { 
+            command = EUPnPHelp;
+            txt = qtn_options_help; 
+            },
+        MENU_ITEM 
+            { 
+            command = EAknCmdExit; 
+            txt = qtn_options_exit; 
+            }
+        };
+    }
+
+
+// --------------------------------------------------------------------------
+//
+// R_COMMONUI_SOFTKEYS_OPTION_BACK__OPEN
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_options_back__open
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; },
+        CBA_BUTTON {id=EAknSoftkeyOpen; txt= qtn_msk_open; }
+        };
+    }
+    
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SOFTKEYS_OPTION_BACK__SHOW
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_options_back__show
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; },
+        CBA_BUTTON {id=EAknSoftkeyOk; txt= text_softkey_show; }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_sOFTKEYS_OPTIONS_BACK__PLAY
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_options_back__play
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; },
+        CBA_BUTTON {id=EAknSoftkeyOk; txt= qtn_msk_play; }
+        };
+    }        
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_BROWSE_DIALOG
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_upnpcommonui_browse_dialog
+    { 
+    flags = EAknDialogMarkableList;
+    buttons = r_upnpcommonui_softkeys_options_back__open; 
+    items = 
+        { 
+        DLG_LINE
+            { 
+            id = EUPnPBrowseListBoxId;
+            type = EAknCtSingleGraphicListBox;
+            control = LISTBOX 
+                {
+                flags = EAknListBoxMarkableList; //EAknListBoxSelectionList; 
+                };
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_EXTERNAL_MEDIA_SELECT_DIALOG
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_upnpcommonui_external_media_select_dialog
+    { 
+    flags = EEikDialogFlagNoDrag |
+            EEikDialogFlagNoTitleBar |
+            EEikDialogFlagFillAppClientRect |
+            EEikDialogFlagCbaButtons |
+            EEikDialogFlagWait;
+    buttons = r_upnpcommonui_softkeys_empty_back; 
+    items = 
+        { 
+        DLG_LINE
+            { 
+            id = EUPnPExternDevicesListBoxId;
+            type = EAknCtSingleGraphicListBox;
+            control = LISTBOX 
+                {
+                flags = EAknListBoxSelectionList; 
+                };
+            }
+        };
+    }
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_VIDEO_PLAYER_DIALOG
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_upnpcommonui_video_player_dialog
+    { 
+    flags = EEikDialogFlagNoDrag |
+            EEikDialogFlagNoTitleBar |
+            EEikDialogFlagFillAppClientRect |
+            EEikDialogFlagCbaButtons |
+            EEikDialogFlagWait;
+    buttons = r_upnpcommonui_softkeys_empty_back; 
+    items = 
+        { 
+        DLG_LINE
+            { 
+            id = EUPnPVideoPlayerListBoxId;
+            type = ECustomCtrlDlgCtCustomControl;
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_VIDEO_PLAYBACK_WAIT_NOTE_DIALOG
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_upnpcommonui_video_playback_wait_note_dialog
+    {
+    flags = EAknProgressNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EUPnPVideoDialogWaitNote;
+            control = AVKON_NOTE
+                {
+                layout         = EProgressLayout;
+                singular_label = qtn_iupnp_prog_prep_playback;
+                imageid        = EMbmAvkonQgn_note_progress;
+                imagemask      = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+    
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SOFTKEYS_PLAY_STOP
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_play_stop
+    { 
+    buttons = 
+        { 
+        CBA_BUTTON 
+            { 
+            id = EUPnPPlayCmd; 
+            txt = qtn_iupnp_play_ext_main;  
+            }, 
+        CBA_BUTTON 
+            { 
+            id = EUPnPStopCmd; 
+            txt = text_softkey_stop;    
+            } 
+        }; 
+    }
+    
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SOFTKEYS_PAUSE_STOP
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_pause_stop 
+    { 
+    buttons = 
+        { 
+        CBA_BUTTON 
+            { 
+            id = EUPnPPauseCmd; 
+            txt = text_softkey_pause;  
+            }, 
+        CBA_BUTTON 
+            { 
+            id = EUPnPStopCmd; 
+            txt = text_softkey_stop;  
+            } 
+        }; 
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_sOFTKEYS_CONTINUE_STOP
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_continue_stop 
+    { 
+    buttons = 
+        { 
+        CBA_BUTTON 
+            { 
+            id = EUPnPContinueCmd; 
+            txt = qtn_iupnp_sk_continue; 
+            }, 
+        CBA_BUTTON 
+            { 
+            id = EUPnPStopCmd; 
+            txt = text_softkey_stop; 
+            } 
+        }; 
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SOFTKEYS_REPLAY_BACK
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_replay_back 
+    { 
+    buttons = 
+        { 
+        CBA_BUTTON 
+            { 
+            id = EUPnPReplayCmd; 
+            txt = qtn_iupnp_sk_replay; 
+            }, 
+        CBA_BUTTON 
+            { 
+            id = EUPnPBackCmd; 
+            txt = text_softkey_back; 
+            } 
+        }; 
+    }
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SOFTKEYS_EMPTY_CANCEL
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_empty_cancel 
+    { 
+    buttons = 
+        { 
+        CBA_BUTTON 
+            { 
+            id = EAknSoftkeyEmpty;             
+            },        
+        CBA_BUTTON 
+            { 
+            id = EAknSoftkeyCancel; 
+            txt = text_softkey_cancel;  
+            } 
+        }; 
+    }
+            
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_VIDEO_NAVI_TIME
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_video_navi_time 
+    { 
+    buf = qtn_iupnp_sep_slash; 
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SELECT_DEVICE_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_select_device_text
+    {
+    buf = qtn_iupnp_select_device;
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SELECT_PLAYER_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_select_player_text
+    {
+    buf = qtn_iupnp_select_player;
+    }
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_COPY_TO_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_copy_to_text
+    { 
+    buf = qtn_fldr_copy_to_prompt;
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_MOVE_TO_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_move_to_text
+    { 
+    buf = qtn_fldr_move_to_prmpt;
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_TITLE_SHOWING
+//
+// --------------------------------------------------------------------------     
+//
+RESOURCE TBUF r_upnpcommonui_title_showing   
+    { 
+    buf = qtn_iupnp_title_showing;
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_NOMEMORY_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_nomemory_text    
+    { 
+    buf = qtn_memlo_ram_out_of_mem;
+    }
+
+// --------------------------------------------------------------------------
+// R_UPNPCOMMONUI_DEVICE_MEMORY_LOW
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_upnpcommonui_device_memory_low    
+    {
+    buf = qtn_memlo_device_memory_full;
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_INFO_COPY_ONE_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_info_copy_one_text
+    {
+    buf = qtn_iupnp_info_copy_one;
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_INFO_COPY_MANY_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_info_copy_many_text
+    {
+    buf = qtn_iupnp_info_copy_many;
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_RENDERING_FAILED_UNKNOWN_ERROR_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_rendering_failed_unknown_error_text
+    {
+    buf = qtn_iupnp_err_rendering_failed_unknown;
+    }
+    
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_NOT_SUPPORTED_ERROR_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_not_supported_error_text
+    {
+    buf = qtn_iupnp_err_not_supported;
+    }    
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_general_failure_error_text
+    {
+    buf = qtn_iupnp_err_general_failure;
+    }    
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_CONN_LOST_COPY_ERROR_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_conn_lost_copy_error_text
+    {
+    buf = qtn_iupnp_err_conn_lost_copy;
+    }    
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SOFTKEYS_EMPTY_BACK
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_empty_back 
+    { 
+    buttons = 
+        { 
+        CBA_BUTTON 
+            { 
+            id = EAknSoftkeyEmpty;             
+            },        
+        CBA_BUTTON 
+            { 
+            id = EUPnPBackCmd; 
+            txt = text_softkey_back;  
+            } 
+        }; 
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SOFTKEYS_EMTPY_STOP
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_empty_stop 
+    { 
+    buttons = 
+        { 
+        CBA_BUTTON 
+            { 
+            id = EAknSoftkeyEmpty;             
+            },        
+        CBA_BUTTON 
+            { 
+            id = EUPnPStopCmd; 
+            txt = text_softkey_stop;  
+            } 
+        }; 
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_ERROR_CON_TEXT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_error_con_text
+    { 
+    buf=qtn_iupnp_err_con_failed;
+    }
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_BROWSE_UPDATE_WAIT_NOTE_DIALOG
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_upnpcommonui_browse_update_wait_note_dialog
+    {
+    flags = EAknProgressNoteFlags | EEikDialogFlagWait;
+    buttons = r_upnpcommonui_softkeys_empty_cancel;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EUPnPBrowseDialogProgressNote;
+            control = AVKON_NOTE
+                {
+                layout         = EProgressLayout;
+                singular_label = qtn_iupnp_wait_list_update;
+                imageid        = EMbmAvkonQgn_note_progress;
+                imagemask      = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+    
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ANIMATION_FOR_SELECTION_DIALOG
+//
+//----------------------------------------------------
+//
+RESOURCE BMPANIM_DATA r_upnpcommonui_animation_for_selection_dialog
+    {
+    frameinterval   = 250;
+    playmode        = EAknBitmapAnimationPlayModeCycle;
+    frames          = r_upnpcommonui_animation_for_selection_dialog_images;
+    bmpfile = "Z:"APP_RESOURCE_DIR"\\UPnPCommonUI.mif";
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ANIMATION_FOR_SELECTION_DIALOG_IMAGES
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_upnpcommonui_animation_for_selection_dialog_images
+    {
+    items=
+        {
+        BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_1 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_1_mask;},
+        BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_2 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_2_mask;},
+        BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_3 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_3_mask;},
+        BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_4 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_4_mask;},    
+        BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_5 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_5_mask;},   
+        BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_6 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_6_mask;},    
+        BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_7 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_7_mask;},    
+        BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_8 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_8_mask;},
+        BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_9 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_9_mask;}
+        };
+    }    
+
+    
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SERVER_SERVER_SEARCH_MAIN
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_server_search_main
+    {
+    buf = qtn_iupnp_server_search_main;
+    } 
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNPCOMMONUI_SOFTKEYS_SHOW_STOP
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_softkeys_show_stop
+    { 
+    buttons = 
+        { 
+        CBA_BUTTON 
+            { 
+            id = EAknSoftkeyShow;
+            txt = text_softkey_show;
+            },        
+        CBA_BUTTON 
+            { 
+            id = EUPnPStopCmd; 
+            txt = text_softkey_stop;          
+            } 
+        }; 
+    }
+
+// CONSTANTS
+#define KStartingYearForDateEditor 1
+#define KEndingYearForDateEditor 9999
+#define KFileNameEditorMaxWidth 255
+#define KFileNameEditorNumOfLines 0
+#define KFileNameEditorMaxLength 255
+
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ADVANCEDFIND_WAIT_NOTE_DIALOG
+//
+//----------------------------------------------------
+//
+
+RESOURCE DIALOG r_upnpcommonui_advancedfind_wait_note_dialog
+    {
+    flags = EAknProgressNoteFlags | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EProgressLayout;
+                singular_label = qtn_iupnp_finding_results_note;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                  animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_MEDIA_TYPE_SETTING_PAGE
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_media_type_setting_page
+    {
+    label = qtn_iupnp_media_type_title;
+    type = EAknCtPopupSettingList;
+    editor_resource_id = r_upnpcommonui_media_type_editor;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_FILE_NAME_SETTING_PAGE
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_file_name_setting_page
+    {
+    type = EEikCtEdwin;//text editor 
+    editor_resource_id = r_upnpcommonui_file_name_editor;
+    }
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ARTIST_SETTING_PAGE
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_artist_setting_page
+    {
+    type = EEikCtEdwin;//text editor 
+    editor_resource_id = r_upnpcommonui_file_name_editor;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ALBUM_NAME_SETTING_PAGE
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_album_name_setting_page
+    {
+    type = EEikCtEdwin;//text editor 
+    editor_resource_id = r_upnpcommonui_file_name_editor;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_GENRE_SETTING_PAGE
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_genre_setting_page
+    {
+    type = EEikCtEdwin;//text editor 
+    editor_resource_id = r_upnpcommonui_file_name_editor;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_DATE_FROM_SETTING_PAGE
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_date_from_setting_page
+    {
+    type = EEikCtDateEditor; //date editor
+    editor_resource_id = r_upnpcommonui_date_editor;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_DATE_UNTIL_SETTING_PAGE
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_date_until_setting_page
+    {
+    type = EEikCtDateEditor; //date editor
+    editor_resource_id = r_upnpcommonui_date_editor;
+    }
+
+
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_UPNPADFIND_SOFTKEYS_OK_BACK__oK
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_upnpcommonui_upnpadvfind_softkeys_ok_back__ok
+    {
+    //flags = 0;
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOk; txt = text_softkey_ok;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; },
+        CBA_BUTTON {id=EAknSoftkeyOpen; txt = qtn_msk_change; }
+        };
+    }
+    
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ADVANCED_FIND_MAIN_DIALOG
+//
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_upnpcommonui_advanced_find_main_dialog
+    {
+    flags  = EAknDialogMultiselectionList;
+    
+    buttons = r_upnpcommonui_upnpadvfind_softkeys_ok_back__ok;
+    items = 
+        {
+        DLG_LINE        
+            {
+            type = KAknCtLastControlId;
+            id = EMultiSelectionListBoxId;
+            control = AVKON_SETTING_ITEM_LIST
+                {
+                flags = EAknSettingItemIncludeHiddenInOrdinal;
+                  initial_number = 1;
+                items =
+                    {
+                    AVKON_SETTING_ITEM
+                          {
+                        identifier = EAdvancedFindMediaType;
+                        setting_page_resource = r_upnpcommonui_media_type_setting_page;
+                        associated_resource = r_upnpcommonui_media_type_popup_texts;
+                        name = qtn_iupnp_media_type;
+                        },
+                    AVKON_SETTING_ITEM
+                          {
+                        identifier = EAdvancedFindFileName;
+                        setting_page_resource = r_upnpcommonui_file_name_setting_page;
+                        name = qtn_iupnp_find_file;
+                        },
+                    AVKON_SETTING_ITEM
+                          {
+                        identifier = EAdvancedFindArtist;
+                        setting_page_resource = r_upnpcommonui_artist_setting_page;
+                        name = qtn_iupnp_find_artist;
+                        },
+                    AVKON_SETTING_ITEM
+                          {
+                        identifier = EAdvancedFindAlbum;
+                        setting_page_resource = r_upnpcommonui_album_name_setting_page;
+                        name = qtn_iupnp_find_album;
+                        },
+                    AVKON_SETTING_ITEM
+                          {
+                        identifier = EAdvancedFindGenre;
+                        setting_page_resource = r_upnpcommonui_genre_setting_page;
+                        name = qtn_iupnp_find_genre;
+                        },
+                    AVKON_SETTING_ITEM
+                          {
+                        identifier = EAdvancedFindDateFrom;
+                        setting_page_resource = r_upnpcommonui_date_from_setting_page;
+                        name = qtn_iupnp_find_date_from;
+                        },
+                    AVKON_SETTING_ITEM
+                          {
+                        identifier = EAdvancedFindDateUntil;
+                        setting_page_resource = r_upnpcommonui_date_until_setting_page;
+                        name = qtn_iupnp_find_date_until;
+                        }
+                    };
+                };
+            }
+          };
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_MEDIA_TYPE_EDITOR
+//
+//----------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_upnpcommonui_media_type_editor
+    {
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_MEDIA_TYPE_POPUP_TEXTS
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_upnpcommonui_media_type_popup_texts
+    {
+    setting_texts_resource = r_upnpcommonui_advanced_find_media_types_texts;
+    popped_up_texts_resource = r_upnpcommonui_media_type_texts_popped_up;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ADVANCED_FIND_MEDIA_TYPES_TEXTS
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_upnpcommonui_advanced_find_media_types_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT { value = EAdvancedFindAll; text = qtn_iupnp_mt_all; },
+        AVKON_ENUMERATED_TEXT { value = EAdvancedFindImages; text = qtn_iupnp_mt_image; },
+        AVKON_ENUMERATED_TEXT { value = EAdvancedFindVideo; text = qtn_iupnp_mt_video; },
+        AVKON_ENUMERATED_TEXT { value = EAdvancedFindMusic; text = qtn_iupnp_mt_music; }
+        };
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_MEDIA_TYPE_TEXTS_POPPED_UP
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_upnpcommonui_media_type_texts_popped_up
+    {
+    items =
+        {
+        LBUF { txt = qtn_iupnp_mt_all; },
+        LBUF { txt = qtn_iupnp_mt_image; },
+        LBUF { txt = qtn_iupnp_mt_video; },
+        LBUF { txt = qtn_iupnp_mt_music; }
+        };
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_DATE_EDITOR
+//
+//----------------------------------------------------
+//
+RESOURCE DATE_EDITOR r_upnpcommonui_date_editor
+    {
+    minDate = DATE
+        {
+        year=KStartingYearForDateEditor;
+        };
+
+    maxDate = DATE
+        {
+        year=KEndingYearForDateEditor;
+        };
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_FILE_NAME_EDITOR
+//
+//----------------------------------------------------
+//
+RESOURCE EDWIN r_upnpcommonui_file_name_editor
+    {
+    width = KFileNameEditorMaxWidth;
+    lines = KFileNameEditorNumOfLines;
+    maxlength = KFileNameEditorMaxLength;
+    default_case = EAknEditorTextCase;
+    }
+
+
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_TITLE
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_advanced_find_search_result_title
+    {
+    buf = qtn_iupnp_search_results;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILE
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_advanced_find_search_result_file
+    {
+    buf = qtn_iupnp_nof_file;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILES
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_advanced_find_search_result_files
+    {
+    buf = qtn_iupnp_nof_files;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_NO_RESULTS
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_advanced_find_search_result_no_results
+    {
+    buf = qtn_iupnp_no_files_found;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_RESULT_WINDOW_MENUBAR
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_upnpcommonui_result_window_menubar
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_upnpcommonui_result_window_menu;}
+        };
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_RESULT_WINDOW_MENU
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_upnpcommonui_result_window_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EUPnPShow;
+            txt = qtn_iupnp_show_ext_main;
+            cascade = r_upnpcommonui_menupane_show_sub_menu;
+            },
+        MENU_ITEM
+            { 
+            command = EUPnPPlay; 
+            txt = qtn_iupnp_play_ext_main;
+            cascade = r_upnpcommonui_menupane_play_sub_menu;
+            },
+        MENU_ITEM 
+            { 
+            command = EUPnPCopy;
+            txt = qtn_iupnp_copy_main; 
+            },
+        MENU_ITEM
+            {
+            cascade = R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION;
+            command = EAknCmdEditListMenu;
+            txt = qtn_options_list;
+            },
+        MENU_ITEM 
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            { 
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_ADVANCED_FIND_RESULT_DIALOG
+//
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_upnpcommonui_advanced_find_result_dialog
+    {
+    flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | EEikDialogFlagFillAppClientRect |
+               EEikDialogFlagCbaButtons | EEikDialogFlagWait;
+
+    buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    items =
+        {
+        DLG_LINE
+            {
+            id = EAdvFindResultBoxId;
+            type = EAknCtDoubleGraphicListBox;
+            control = LISTBOX
+                {
+                    flags = EAknListBoxMarkableList;            
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+// R_COMMONUI_ADVANCED_FIND_TOO_MANY_RESULTS_ERROR
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_advanced_find_too_many_results_error 
+    { 
+	buf=qtn_iupnp_too_big_cache_note_text;
+    }
+
+//----------------------------------------------------
+//
+// R_UPNPCOMMONUI_NO_ITEMS_TO_PLAY_TEXT
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_upnpcommonui_no_items_to_play_text 
+    { 
+	buf=qtn_iupnp_no_items_to_play_text;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for CommonUI
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/upnpcommonui.h              |../../../inc/upnpcommonui.h
+../inc/upnplocalplayer.h           |../../../inc/upnplocalplayer.h
+../inc/upnpnavipanecontainer.h     |../../../inc/upnpnavipanecontainer.h
+
+PRJ_MMPFILES
+upnpcommonui.mmp
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE upnpcommonui.mif
+OPTION HEADERFILE upnpcommonui.mbg
+OPTION SOURCEDIR ../bitmaps
+OPTION SOURCES \
+    -c8,8 qgn_graf_upnp_ext_renderer \
+    -c8,8 qgn_graf_upnp_ext_renderer_list_icon \
+    -c8,8 qgn_server_icon \
+    -c8,8 qgn_prop_mserv_music \
+    -c8,8 qgn_prop_mserv_other_images \
+    -c8,8 qgn_prop_mserv_other_videos \
+    -c8,8 qgn_prop_mserv_folder_small \
+    -c8,8 qgn_prop_mserv_folder_locked_small \
+    -c8,8 qgn_prop_folder_current \
+    -c8,8 qgn_indi_upnp_search_1 \
+    -c8,8 qgn_indi_upnp_search_2 \
+    -c8,8 qgn_indi_upnp_search_3 \
+    -c8,8 qgn_indi_upnp_search_4 \
+    -c8,8 qgn_indi_upnp_search_5 \
+    -c8,8 qgn_indi_upnp_search_6 \
+    -c8,8 qgn_indi_upnp_search_7 \
+    -c8,8 qgn_indi_upnp_search_8 \
+    -c8,8 qgn_indi_upnp_search_9
+END
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/group/upnpcommonui.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common UI Project specification file
+*
+*/
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+
+TARGET          upnpcommonui.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10208A1A
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+// Include paths
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+START RESOURCE  ../data/upnpcommonui.rss
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+SOURCEPATH      ../src
+SOURCE          upnpexternaldevicedialog.cpp
+SOURCE          upnpbrowsecacheitem.cpp
+SOURCE          upnpbrowsedialog.cpp
+SOURCE          upnpselectiondialog.cpp
+SOURCE          upnpcommonui.cpp
+SOURCE          upnpvideoplayerdialog.cpp
+SOURCE          upnpnavipanecontainer.cpp
+SOURCE          upnpadvfinddialog.cpp
+SOURCE          upnpadvfindlist.cpp
+SOURCE          upnpimageplayer.cpp
+SOURCE          upnpadvfindresultwindow.cpp
+SOURCE          upnplocalplayer.cpp
+
+// Core platform and UI
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         bafl.lib
+LIBRARY         eikcore.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         avkon.lib
+LIBRARY         aknlayout.lib
+LIBRARY         AKNSKINS.lib
+LIBRARY         AknIcon.lib
+LIBRARY         AknLayout2Scalable.lib
+LIBRARY         eikctl.lib
+LIBRARY         eikdlg.lib
+LIBRARY         featmgr.lib
+LIBRARY         egul.lib
+LIBRARY         CommonEngine.lib
+LIBRARY         fbscli.lib 
+LIBRARY         efsrv.lib
+LIBRARY         hlplch.lib
+LIBRARY         gdi.lib
+LIBRARY         apsettingshandlerui.lib
+LIBRARY         apengine.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         CommonDialogs.lib
+LIBRARY         PlatformEnv.lib
+LIBRARY         commdb.lib
+LIBRARY         ServiceHandler.lib
+LIBRARY         commonui.lib
+LIBRARY         apmime.lib //TDataType
+LIBRARY         charconv.lib
+LIBRARY         remconcoreapi.lib
+LIBRARY         remconinterfacebase.lib
+
+// ECom
+library         ecom.lib
+
+// S60 Upnp Stack
+LIBRARY         upnpipserversutils.lib
+LIBRARY         upnpavobjects.lib
+LIBRARY         avmediaserverclient.lib
+
+// Upnp Framework
+LIBRARY         upnputilities.lib
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         upnpavcontrollerhelper.lib
+LIBRARY         upnpfiletransferengine.lib
+LIBRARY         upnpmusicadapter.lib
+LIBRARY         upnpxmlparser.lib
+LIBRARY         upnpsettingsengine.lib
+
+// Logging
+DEBUGLIBRARY         flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/group/upnpcommonui_uid_.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+// Makmake-generated uid source file
+#include <e32cmn.h>
+#pragma data_seg(".SYMBIAN")
+__EMULATOR_IMAGE_HEADER2(0x10000079,0x1000008d,0x053898ad,EPriorityForeground,0x000ffffeu,0x00000000u,0x053898ad,0x101fb657,0x00010000,0)
+#pragma data_seg()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpadvfinddialog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  advanced find dialog class header
+*
+*/
+
+
+
+#ifndef UPNPADVANCEDFINDDIALOG_H
+#define UPNPADVANCEDFINDDIALOG_H
+
+//  INCLUDES
+#include <aknselectionlist.h>
+#include <aknlists.h> 
+#include <aknsettingitemlist.h> 
+#include <akntitle.h> //for status pane
+
+// FORWARD DECLARATIONS
+class CUPnPAdvancedFindList;
+class MUPnPAVController;
+class MUPnPAVBrowsingSession;
+class CUPnPCommonUI;
+
+// CLASS DECLARATION
+
+/**
+*  Class declaration for UPnP Advanced find dialog
+*  @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( CUPnPAdvancedFindDialog ) : public CAknDialog
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CUPnPAdvancedFindDialog* NewL(
+                                TInt aMenuResource, 
+                                MUPnPAVController& aAVControl,
+                                MUPnPAVBrowsingSession& aBrowsingSession,
+                                CUPnPCommonUI& aCommonUI );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUPnPAdvancedFindDialog();
+
+    public: // New functions
+    
+        /**
+         * Called from CommonUI to destroy the advFind dialog itself
+         * when the selected media server disappears
+         * @since Series 60 3.1
+         * @param aError exit error
+         * @return None
+         */   
+        void DismissItselfL( TInt aError );
+
+    public: // Functions from base classes
+
+       /**
+        * From CAknDialog, handles menu commands
+        * @since Series 60 Series3.1
+        * @param aCommandId, command to be handled
+        */
+        void ProcessCommandL( TInt aCommandId );
+      
+       /**
+        * From CAknDialog, handles key events.
+        * @since Series 60 Series3.1
+        * @param aKeyEvent Event to handled.
+        * @param aType Type of the key event. 
+        * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). 
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, 
+                                     TEventCode aType );
+        
+    protected:  // Functions from base classes
+       /**
+        * From CAknDialog, handles layout initialization
+        * @since Series 60 Series3.1
+        * @param none
+        * @return none
+        */
+        void PreLayoutDynInitL();
+
+       /**
+        * From CAknDialog, handles focus changes of the dialog
+        * @since Series 60 Series3.1
+        * @param aButtonId, pressed button id
+        * @return True if ready to close dialog, False otherwise
+        */
+        TBool OkToExitL( TInt aButtonId );
+       
+       /**
+        * Creates custom control
+        * @since Series 60 Series3.1
+        * @param aControlType, control type
+        * @return SEikControlInfo control info
+        */
+        virtual SEikControlInfo CreateCustomControlL( TInt aControlType );
+        
+    private:
+
+       /**
+        * C++ default constructor.
+        */
+        CUPnPAdvancedFindDialog::CUPnPAdvancedFindDialog(
+                                MUPnPAVController& aAVControl,
+                                MUPnPAVBrowsingSession& aBrowsingSession,
+                                CUPnPCommonUI& aCommonUI );
+       /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( TInt aMenuResource );
+    
+    private:
+        
+        /**
+         * Set dialog title
+         */
+        void SetTitleL();
+        
+    private:    // Data
+        
+        // list member variable for dialog data
+        CUPnPAdvancedFindList*        iSettingsList; // not owned
+        // title pane
+        CAknTitlePane*                iTitlePane; // not owned
+        // status pane
+        CEikStatusPane*               iStatusPane; // not owned
+        
+        MUPnPAVController&            iAVControl; // not owned
+        MUPnPAVBrowsingSession&       iBrowseSession; // not owned
+        
+        // title text before find
+        HBufC*                        iOriginalTitleText; // owned
+        CUPnPCommonUI&                iCommonUI; //not owned
+        
+        TBool                         iClose;
+    };
+
+#endif      // UPNPADVANCEDFINDDIALOG_H   
+            
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpadvfindlist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,323 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  List for data of settings dialog
+*
+*/
+
+
+#ifndef UPNPADVANCEDFINDLIST_H
+#define UPNPADVANCEDFINDLIST_H
+
+// INCLUDES
+// System
+#include <aknsettingitemlist.h> 
+#include <AknProgressDialog.h>
+
+// upnpframework / avcontroller api
+#include "upnpavbrowsingsessionobserver.h"
+
+// commonui internal
+#include "upnpcommonui.h"
+
+
+const TInt KMaxNameLength = 256;
+const TInt KGranularityOfArrays = 8;
+const TInt KSizeOfTBufC16 = 32;
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class MUPnPAVBrowsingSession;
+class CAdvancedFindResultWindow;
+class CUPnPAdvancedFindDialog;
+class CUPnPCommonUI;
+
+/**
+*  Settings list class declaration
+*  @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( CUPnPAdvancedFindList ) : public CAknSettingItemList,
+                              public MUPnPAVBrowsingSessionObserver,
+                              public MProgressDialogCallback
+    {
+    public:  // Constructors and destructor
+        
+       /**
+        * Two-phased constructor.
+        */
+        static CUPnPAdvancedFindList* NewL( 
+                                MUPnPAVController& aAVControl,
+                                MUPnPAVBrowsingSession& aBrowsingSession,
+                                CUPnPAdvancedFindDialog& aParent,
+                                CUPnPCommonUI& aCommonUI );
+        
+       /**
+        * Destructor.
+        */
+        virtual ~CUPnPAdvancedFindList();
+
+    public: // Functions from base classes
+
+       /**
+        * From CAknSettingItemList, this launches the setting page.
+        * @since Series 60 Series3.1
+        * @param aIndex, index of selected list item
+        * @param aCalledFromMenu, indicates if editing is called trough menu 
+        *                         or from keyboard
+        * @return none
+        */
+        void EditItemL ( TInt aIndex, TBool aCalledFromMenu );
+        
+        /** 
+         * Launch up CAknSettingItemList
+         * @since Series 60 3.1
+         * @param none
+         * @return error code
+         */
+        TInt MakeQueryL( );
+        
+    public: //From MProgressDialogCallback
+        
+        /**
+         * Callback method Get's called when a dialog is dismissed
+         * @since Series 60 3.1
+         * @param aButtonId the reason when the dialog is dismissed
+         * @return none
+         */
+        void DialogDismissedL( TInt aButtonId );
+
+    public: //From MUPnPAVBrowsingSessionObserver
+
+        /**
+         * Returns a browse result received from a Media Server.
+         *         
+         * @since Series 60 3.1
+         * @param aBrowseResponse browse response xml document
+         * @param aError system wide error code
+         * @param aMatches number of returned items
+         * @param aTotalCount total number of objects on container
+         * @param aUpdateId update id number
+         * @return None
+         */
+        void BrowseResponse(
+                            const TDesC8& /*aBrowseResponse*/,
+                            TInt /*aError*/,
+                            TInt /*aMatches*/,
+                            TInt /*aTotalCount*/,
+                            const TDesC8& /*aUpdateId*/
+                            ){};
+
+        /**
+         * Returns a search result received from a Media Server.
+         *
+         * @param aSearchResponse search response xml document
+         * @param aError system wide error code
+         * @param aMatches number of returned items
+         * @param aTotalCount total number of resulted items
+         * @param aUpdateId update id number
+         * @return None
+         */
+        void SearchResponse( 
+                            const TDesC8& aSearchResponse,
+                            TInt aError,
+                            TInt aMatches,
+                            TInt aTotalCount,
+                            const TDesC8& aUpdateId
+                            );
+
+         /**
+         * Returns processed search results received from a Media Server.
+         *
+         * @since Series 60 3.1
+         * @param TInt aError status information
+         * @param aTotalCount TInt total number of objects
+         * @param RPointerArray of CUpnpObject objects
+         * @return None
+         */
+         void SearchResponseL( 
+                         TInt aStatus,
+                         const RPointerArray<CUpnpObject>& aResultArray );
+
+        /**
+         * Returns search capabilities of the requested Media Server.
+         *
+         * @since Series 60 3.1
+         * @param TInt aError status information
+         * @param HBufC8& the search capabilities string
+         * @return None
+         */
+        void SearchCapabilitiesResponse( TInt /*aError*/,
+                         const TDesC8& /*aSearchCapabilities*/ ){};
+
+        /**
+         * Notifies that the create container operation is complete.
+         *
+         * @since Series 60 3.1
+         * @param aError status information
+         * @param aObjectId (const TDesC8&) object ID of the new container
+         */
+        void CreateContainerResponse( TInt /*aError*/,
+                                      const TDesC8& /*aObjectId = KNullDesC8*/ )
+                                      {};
+
+        /**
+         * Notifies that the requested UPnP Object deletion is complete.
+         *
+         * @since Series 60 3.1
+         * @param aError status information
+         * @return None
+         */
+        void DeleteObjectResponse( TInt /*aError*/ ){};
+
+        /**
+         * Notifies that the Media Server we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since Series 60 3.1
+         * @param aReason reason code
+         * @return None
+         */
+        void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );
+        
+        /**
+         * Notifies that the Media Server we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since Series 60 3.1
+         * @param aReason reason code
+         * @return None
+         */
+        void MediaServerDisappearedL( TUPnPDeviceDisconnectedReason aReason );
+        
+        /**
+         * Notifies that a local media server has been on sharing
+         *
+         * @since Series 60 3.1
+         * @param aReason reason code
+         * @return None
+         */      
+        void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){};
+
+    public: //business logic
+        
+        /**
+         * Check if the setting page is open 
+         *
+         * @since Series 60 3.1
+         * @param none
+         * @return TBool ETrue if the setting is open
+         */ 
+        TBool IsSettingPageOpen() const;
+        
+    protected:  // Functions from base classes
+        
+        /**
+         * Handles a change to the control's resources
+         *
+         * @since Series 60 3.1
+         * @param aType a message UID value.
+         * @return None
+         */  
+        void HandleResourceChange( TInt aType ); 
+
+    private:
+        
+        /**
+        * C++ default constructor.
+        */
+        CUPnPAdvancedFindList( MUPnPAVController& aAVControl, 
+                               MUPnPAVBrowsingSession& aBrowsingSession,
+                               CUPnPAdvancedFindDialog& aParent,
+                               CUPnPCommonUI& aCommonUI );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * From CAknSettingItemList, Framework method to create a setting item.
+        * @since Series 60 Series3.1
+        * @param aIdentifier,  list item id to be created
+        * @return CAknSettingItem, pointer to list item
+        */        
+        CAknSettingItem* CreateSettingItemL( TInt aIdentifier );
+        
+        /**
+        * Get search criteria
+        * @since Series 60 Series3.1
+        * @param none
+        * @return search criteria
+        */
+        HBufC8* BuildSearchCriteriaL() const;
+        
+    private:    // Data
+
+        //time variable for date from item
+        TTime iDateFrom;
+        //time variable for date Until item
+        TTime iDateUntil;
+        //time variable for initial date from item
+        TTime iDateInitial;
+
+        // Boolean flag telling if Search response received
+        TBool iSearchResponseReceived;
+                        
+        // text for artist selection item
+        TBuf<KMaxNameLength> iArtistText;
+        // text for album selection item
+        TBuf<KMaxNameLength> iAlbumText;
+        // text for Genre selection item
+        TBuf<KMaxNameLength> iGenreText;
+        
+        TBuf<KMaxNameLength> iFileName;
+        
+        //chosen media type
+        TInt iMediatype;
+
+          // wait note dialog
+        CAknWaitDialog*                         iWaitNoteDialog;
+        
+        
+        MUPnPAVController&                      iAVControl;
+                
+        //observer for browse results
+        MUPnPAVBrowsingSessionObserver*         iBrowseObserver;       
+
+        //Array for search result
+        RPointerArray<CUpnpObject>              iResultArray;
+        
+        CAdvancedFindResultWindow*              iFindResultWindow; //not owned
+        CUPnPCommonUI&                          iCommonUI;
+        CUPnPAdvancedFindDialog&                iAdvancedFindDialog;
+        
+        MUPnPAVBrowsingSession&                 iBrowseSession;
+        
+        CUPnPCommonUI::TUPnPAction              iAction;
+        
+        TInt iExitCode;
+        
+        // iShowingErrorNote tells if we are showing the error note. 
+        // During the error note is shown, we cannot destroy our parent dialog
+        // because then the continuation after error note fails (crashes)
+        TBool iShowingErrorNote;
+        
+        TBool                                   iClose;
+        TBool                                   iSettingPageOpen;
+        
+        TUPnPDeviceDisconnectedReason           iCloseReason;
+        
+    };
+#endif      // UPNPADVANCEDFINDLIST_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpadvfindresultwindow.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,381 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements CAdvancedFindResultWindow class
+*
+*/
+
+
+#ifndef ADVANCEDFINDRESULTWINDOW_H
+#define ADVANCEDFINDRESULTWINDOW_H
+
+// INCLUDES
+#include <aknnavide.h> 
+#include <akntitle.h> //for status pane
+#include <AknIconArray.h>
+#include <AknDialog.h>
+#include "upnpdeviceobserver.h"
+#include "upnpcommonui.h"
+
+// FORWARD DECLARATIONS
+class CUPnPCommonUI;
+class MUPnPAVController;
+class CUpnpImagePlayer;
+class CUPnPMusicAdapter;
+class CUPnPLocalPlayer;
+class CUPnPPeriodic;
+
+// DATA TYPES
+
+// CLASS DECLARATION
+
+/**
+* CAdvancedFindResultWindow dialog class
+* @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( CAdvancedFindResultWindow ) : 
+                                              public CAknDialog,
+                                              public MUPnPDeviceObserver
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CAdvancedFindResultWindow* NewL(
+                                    TInt aMenuResource, 
+                                    RPointerArray<CUpnpObject>& aResultArray,
+                                    MUPnPAVController& aAVControl,
+                                    MUPnPAVBrowsingSession& aBrowseSession,
+                                    CUPnPCommonUI& aCommonUI );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CAdvancedFindResultWindow();
+    
+    public: //from MUPnPDeviceObserver
+         
+         /**
+          * This is called when the WLAN or a media server to be browsing 
+          * has disappeard
+          * To close itself
+          * @since Series 60 3.1
+          * @param aError exit reason
+          * @return none
+          */
+         void DeviceDisappeared( TInt aError );
+    
+    public:  //new functions
+    
+        /**
+        * Close the browse dialog itself
+        * @since Series 60 3.1
+        * @param aError exit reason
+        * @return None
+        */
+        void DismissItselfL( TInt aError );
+        
+        /**
+         * Callback method for the iImageControlTimer.
+         *
+         * @since Series 60 3.2.3
+         * @param aDlg current dialog which to be called
+         * @return Tint
+         */
+        static TInt ImageControlTimerCallbackL(TAny* aDlg);
+        
+    protected:  // New functions
+        
+        /**
+          * To load list items when the dialog is initialized
+          * @since Series 60 3.1
+          * @param none
+          * @return none
+          */
+        void LoadListItemsL();
+
+        /**
+        * 2nd constructor
+        */
+        void ConstructL( TInt aMenuResource, 
+                         RPointerArray<CUpnpObject>& aResultArray );
+                         
+        /**
+        * Modifies navigation pane text
+        * @since Series 60 3.1       
+        */
+        void SetNaviPaneTextL();
+
+        /**
+        * Loads a possibly skinned icon and adds it to icon array
+        * @since Series 60 3.1
+        * @param CAknIconArray, array of icons        
+        * @param MAknsSkinInstance, skin instance
+        * @param TDesC, reference to icon file        
+        * @param TAknsItemID, skinned icon id       
+        * @param TInt, bitmap id      
+        * @param TInt, bitmap mask id        
+        */
+        
+        void AppendIconToArrayL( CAknIconArray* aArray,
+                                 MAknsSkinInstance* aSkin,
+                                 const TDesC& aMbmFile,
+                                 const TAknsItemID& aID,
+                                 TInt aBitmapId,
+                                 TInt aMaskId );
+ 
+        /**
+         * Mark or unmark a menu item
+         * @since Series 60 3.1
+         * @param aItem a menu item to be marked
+         * @param aMark a menu item should be marked or not
+         * @return none
+         */                                     
+        void MarkUnmarkL(TInt aItem, TBool aMark);
+        
+        /**
+         * Play a seleted item
+         * @since Series 60 3.1
+         * @param aLocal if the selected item is a local or remote
+         * @return none
+         */
+        void PlayL( TBool aLocal );
+        
+        /**
+         * Show or play an item on remote renderer
+         * @since Series 60 3.1
+         * @param none
+         * @return none
+         */
+        void ShowPlayExtL();
+        
+        /**
+         * Show or play an item on local renderer
+         * @since Series 60 3.1
+         * @param none
+         * @return none
+         */
+        
+        void ShowPlayLocalL();
+        
+        /**
+        * updates command button area
+        * @since Series 60 3.23
+        * @param aMark use for two states, item marked or no marked
+        * @param aTempCounter is the number of the current item in the list.
+        * @return None
+        */
+        void UpdateCommandButtonAreaL( TBool aMark, TInt aTempCounter );
+
+        /**
+        * updates command button area
+        * @since Series 60 3.23
+        * @param aMark use for two states, item marked or no marked
+        * @param aTempCounter is the number of the current item in the list.
+        * @return None
+        */
+        void UpdateCommandButtonArea( TBool aMark, TInt aTempCounter );
+        
+    protected:  // Functions from base classes
+        
+        /**
+        * From CAknSelectionListDialog, handles layout initialization
+        * @since Series 60 3.1
+        */
+        void PreLayoutDynInitL();
+        
+        /**
+        * From CAknDialog, handles menu commands
+        * @since Series 60 3.1
+        * @param aCommandId, command to be handled
+        * @return none
+        */
+        void ProcessCommandL( TInt aCommandId );
+        
+        /**
+        * From CAknSelectionListDialog, handles key events.
+        * @since Series 60 3.1
+        * @param TKeyEvent, Event to handled.
+        * @param TEventCode, Type of the key event. 
+        * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). 
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, 
+                                     TEventCode aType );
+        
+        /**
+        * From CAknSelectionListDialog, handles focus changes of the dialog
+        * @since Series 60 3.1
+        * @param TInt, pressed button id
+        * @return TBool, ETrue if ready to close dialog, EFalse otherwise
+        */
+        TBool OkToExitL( TInt aButtonId );
+        
+        /**
+        * Menu observer interface. From MEikMenuObserver
+        * @since Series 60 3.1
+        * @param aResourceId resource ID identifying the menu pane 
+        * to initialise.
+        * @param aMenuPane The in-memory representation of the menu pane
+        * @return none
+        */
+        void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane); 
+    
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CAdvancedFindResultWindow( MUPnPAVController& aAVControl,
+                                   MUPnPAVBrowsingSession& aBrowseSession,
+                                   CUPnPCommonUI& aCommonUI );
+       
+        /**
+        * From CoeControl
+        * @param TCoeHelpContext, context of desired help
+        * @return none
+        */
+        void GetHelpContext(TCoeHelpContext& aContext) const;
+              
+        /**
+         * Show a video on a remote renderer
+         * @since Series 60 3.1
+         * @param none 
+         * @return none
+         */
+        void ShowVideoExtL();
+        
+        /**
+         * Show an image on a remote renderer
+         * @since Series 60 3.1
+         * @param none 
+         * @return void
+         */
+        void ShowImageExtL();
+        
+        /**
+         * Shows current image
+         * @since Series 60 3.2.3
+         * @param aShowImage (TBool) shows current image and draws showing 
+         *  icon
+         * @return None
+         */
+         void ShowCurrentImageL( TBool aShowImage );
+         
+         /**
+          * Starts imageControl timer
+          * @since Series 60 3.2.3
+          * @param None
+          * @return None
+          */
+          void StartImageControlTimer();
+           
+           /**
+           * Stops ImageControl
+           * @since Series 60 3.2.3
+           * @param None
+           * @return None
+           */
+           void StopImageControlL();
+        
+        /**
+         * Handle different errors returned from other dialogs
+         * @since Series 60 3.1
+         * @param exiting reason
+         * @return none
+         */
+        void HandleErrorL( TInt aError );
+        
+        /**
+        * Handel copy
+        * @since Series 60 3.1
+        * @param none
+        *                     
+        * @return none
+        */
+        void HandleCopyL();
+        
+        /**
+        * Updates softkeys 
+        * @since Series 60 3.2
+        * @param aResourceId (TInt) softkey resource
+        * @return None
+        */
+        void UpdateSoftkeysL( TInt aResourceId );      
+        
+        /**
+        * Check if any audio item is marked
+        * @since Series 60 3.1
+        * @param None
+        * @return ETrue if at least one audio item is marked
+        */
+        TBool IsAudioItemMarked( void );  
+        
+    private: //data
+        
+        //used for CUpnpFileTransferEngine only
+        MUPnPAVBrowsingSession&                      iBrowseSession; 
+        // find results (NOT OWNED)
+        RPointerArray<CUpnpObject>                   iResultArray;
+        // dialog control item (NOT OWNED)
+        CAknDoubleGraphicStyleListBox*               iListBox;
+        // navi pane decorator
+        CAknNavigationDecorator*                     iNaviDecorator;
+        // navipane member (NOT OWNED)
+        CAknNavigationControlContainer*              iNaviPane;
+        // title pane (NOT OWNED)
+        CAknTitlePane*                               iTitlePane;
+        
+        MUPnPAVController&                           iAVControl;
+        
+        // pointer to device selection
+        CUPnPCommonUI&                               iCommonUI;
+        
+        //ImageControl periodic timer (own)
+        CUPnPPeriodic*                               iImageControlTimer;
+        
+        CUpnpImagePlayer*                            iImagePlayer;
+        
+        CUPnPLocalPlayer*                            iLocalPlayer;
+        
+        CUpnpAVDevice*                               iTargetDevice;
+
+        // the media server device (NOT OWNED)        
+        const CUpnpAVDevice*                         iSourceDevice;
+        
+        TInt                                         iChildDialogOpen;
+        
+        //flag to either media server disappears or media renderer disappear
+        TBool                                        iMSDisappear;
+        
+        CUPnPCommonUI::TUPnPAction                   iAction;
+        
+        TInt                                         iCopyIndex;
+        
+        TBool                                        iIsMusicItem;
+        
+        /**
+         * for music playing, this is to prevent user to pop up renderer
+         * selection and select renderer multiple times
+         */
+        TBool                                       iMusicPlay;
+        
+        // Flag to tell if the image control view is active
+        TBool                                       iImageControlActive;
+        
+        // The Index of last show image
+        TInt                                        iLastImageItemIndex;
+        // Flag to tell if the the Hash (#) key is Holding down
+        TBool                                       iHashKeyFlag;
+    };
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpbrowsecacheitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UPnPSelectionDialog class implementation
+*
+*/
+
+
+#ifndef __UPNP_BROWSE_CACHE_ITEM_H__
+#define __UPNP_BROWSE_CACHE_ITEM_H__
+
+// FORWARD DECLARATIONS
+class CUpnpObject;
+
+class CUPnPBrowseCacheItem : public CBase
+    {
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        //IMPORT_C static CUPnPBrowseCacheItem* NewL();
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUPnPBrowseCacheItem* NewL(
+                            const TDesC8& aContainer,
+                            TInt aHighLightedItem,
+                            TInt aFirstItem);
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CUPnPBrowseCacheItem();
+
+        /**
+        * Returns the container Id
+        * @since Series 60 3.1
+        * @param None
+        * @return HBufC8& the container Id 
+        */
+        IMPORT_C const HBufC8& ContainerId() const;
+
+        /**
+        * Sets the item array
+        * @since Series 60 3.1
+        * @param aBrowseArray CUpnpObjectList Pointer
+        * @return None
+        */
+        IMPORT_C void SetItemArrayL(
+                        const RPointerArray<CUpnpObject>& aBrowseArray );
+
+        /**
+        * Sets the index of the first item
+        * @since Series 60 3.1
+        * @param aFirstItem (TInt) index of the first item
+        * @return None
+        */
+        IMPORT_C void SetFirstItem( const TInt aFirstItem );
+
+        /**
+        * Sets the total count of items in this container
+        * @since Series 60 3.2
+        * @param aTotalCount (TInt) number of items in this container
+        * @return None
+        */
+        void SetTotalCount( const TInt aTotalCount );
+
+        /**
+        * Sets the index of the highlighted item
+        * @since Series 60 3.1
+        * @param aHighLightedItem (TInt) index of the first item
+        * @return None
+        */
+        IMPORT_C void SetHighLightedItem(const TInt aHighLightedItem);
+
+        /**
+        * Returns an object
+        * @since Series 60 3.1
+        * @param aItemToGet (TInt) index of the item
+        * @return CUpnpObject& the object
+        */
+        IMPORT_C const CUpnpObject* GetItem(const TInt aItemToGet);
+
+        /**
+        * Returns the number of items
+        * @since Series 60 3.1
+        * @param None
+        * @return TInt& the number of items
+        */
+        IMPORT_C TInt GetNumberOfItems() const;
+
+        /**
+        * Returns the index of the top most item
+        * @since Series 60 3.1
+        * @param None
+        * @return TInt& the index of the top most item
+        */
+        IMPORT_C TInt GetUpperMostItem() const;
+
+        /**
+        * Returns the total count of items in this container
+        * @since Series 60 3.2
+        * @param None
+        * @return TInt total number of items
+        */
+        TInt GetTotalCount() const;
+
+        /**
+        * Returns the index of the highlighted item
+        * @since Series 60 3.1
+        * @param None
+        * @return TInt& the index the highlighted item
+        */
+        IMPORT_C TInt GetHighlightedItem() const;
+
+    protected:
+
+        /**
+        * C++ default constructor.
+        */
+        CUPnPBrowseCacheItem();
+
+    private:
+
+        /**
+        * 2nd constructor
+        */
+        void ConstructL( const TDesC8& aContainer,
+                         TInt aHighLightedItem,
+                         TInt aFirstItem );
+
+    protected: // Data
+
+        // Object ID
+        HBufC8*                     iContainerData; //owned
+
+        //array of items
+        RPointerArray<CUpnpObject>  iItemArray; // owned
+
+        //first Item in Array
+        TInt                        iFirstItem;
+
+        //first Item in Array
+        TInt                        iTotalCount;
+
+        //highlighted item
+        TInt                        iHighLightedItem;
+      
+      };
+
+#endif // __UPNP_BROWSE_CACHE_ITEM_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpbrowsedialog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,674 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UPnPSelectionDialog class implementation
+*
+*/
+
+
+#ifndef __UPNP_BROWSE_DIALOG_H__
+#define __UPNP_BROWSE_DIALOG_H__
+
+// INCLUDES
+// System
+#include <AknProgressDialog.h>
+
+// upnpframework / avcontroller api
+#include "upnpavbrowsingsessionobserver.h"
+#include "upnpavrenderingsessionobserver.h"
+
+// commonui internal
+#include "upnpdeviceobserver.h"
+
+// FORWARD DECLARATIONS
+class CUPnPMusicAdapter;
+class CUPnPLocalPlayer;
+class CUPnPBrowseCacheItem;
+class CAknIconArray;
+class CUPnPCommonUI;
+class CUpnpImagePlayer;
+class CUPnPBrowsePlaylistFiller;
+class CUPnPPeriodic;
+
+/**
+* Browse dialog class of Common UI library
+*/
+class CUPnPBrowseDialog : public CAknDialog,
+                          public MUPnPAVBrowsingSessionObserver,
+                          public MProgressDialogCallback,
+                          public MUPnPDeviceObserver
+                          
+    {
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUPnPBrowseDialog* NewL(
+                                            TInt aMenuResource,
+                                            MUPnPAVController& aAVControl,
+                                            const CUpnpAVDevice& aDevice,
+                                            CUPnPCommonUI& aCommonUI );
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CUPnPBrowseDialog();
+
+    public: // Methods from MUPnPAVBrowsingSessionObserver
+
+        /**
+         * Returns a browse result received from a Media Server.
+         *         
+         * @since Series 60 3.1
+         * @param aBrowseResponse browse response xml document
+         * @param aError system wide error code
+         * @param aMatches number of returned items
+         * @param aTotalCount total number of objects on container
+         * @param aUpdateId update id number
+         * @return None
+         */
+        void BrowseResponse(
+                        const TDesC8& aBrowseResponse,
+                        TInt aError,
+                        TInt aMatches,
+                        TInt aTotalCount,
+                        const TDesC8& aUpdateId
+                        );
+
+        /**
+         * Returns a search result received from a Media Server.
+         *
+         * @param aSearchResponse search response xml document
+         * @param aError system wide error code
+         * @param aMatches number of returned items
+         * @param aTotalCount total number of resulted items
+         * @param aUpdateId update id number
+         * @return None
+         */
+        void SearchResponse( 
+                        const TDesC8& /*aSearchResponse*/,
+                         TInt /*aError*/,
+                         TInt /*aMatches*/,
+                         TInt /*aTotalCount*/,
+                         const TDesC8& /*aUpdateId*/
+                         ){};
+
+        /**
+         * Notifies that the create container operation is complete.
+         *
+         * @since Series 60 3.1
+         * @param TInt, status information
+         * @param aObjectId (const TDesC8&) object ID of the new container
+         */
+        void CreateContainerResponse( TInt /*aError*/,
+                        const TDesC8& /*aObjectId = KNullDesC8*/ ){};
+
+        /**
+         * Notifies that the requested UPnP Object deletion is complete.
+         *
+         * @since Series 60 3.1
+         * @param TInt, status information
+         * @return None
+         */
+        void DeleteObjectResponse( TInt /*aError*/ ){};
+
+         /**
+         * Returns search capabilities of the requested Media Server.
+         *
+         * @since Series 60 3.1
+         * @param TInt, status information
+         * @param HBufC8&, the search capabilities string
+         * @return None
+         */
+        void SearchCapabilitiesResponse( TInt /*aError*/,
+            const TDesC8& /*aSearchCapabilities*/  ){};
+        
+        
+        /**
+         * Notifies that the Media Server we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since Series 60 3.1
+         * @param aReason reason code
+         * @return None
+         */ 
+        void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );
+        
+        /**
+         * Notifies that the Local Media Server has been put on sharing state
+         *
+         * @since Series 60 3.1
+         * @param aReason reason code
+         * @return None
+         */
+        void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){};
+        
+   protected: // from CoeControl
+   
+        /**
+        * Gets the control's help context. 
+        * @param TCoeHelpContext, context of desired help
+        * @return none
+        */
+        void GetHelpContext(TCoeHelpContext& aContext) const;
+   
+    public: // From MProgressDialogCallback
+
+        /**
+         * Callback function for progress bar.
+         *
+         * @since Series 60 3.1
+         * @param aButtonId, id of the button pressed
+         * @return None
+         */
+        void DialogDismissedL( TInt aButtonId );
+
+    public: // New functions
+
+        /**
+        * Sends the browse request to UPnP AV Controller. When result set
+        * arrives, UPnP AV Controller will call the "BrowseResponse" call
+        * back method.
+        *
+        * @param TInt index of the iBrowseArray object, if -1 is given,
+        *             the root container will be browsed.
+        * @return None
+        */
+        void SendBrowseRequestL( TInt aIndex );
+
+        /**
+         * Callback method for the iImageControlTimer.
+         *
+         * @since Series 60 3.1
+         * @param aDlg current dialog which to be called
+         * @return Tint
+         */
+        static TInt ImageControlTimerCallbackL(TAny* aDlg);
+
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CAknDialog, handles menu commands
+        * @param aCommandId, command to be handled
+        * @return none
+        */
+        void ProcessCommandL( TInt aCommandId );
+
+        /**
+        * From CAknDialog, handles key events.
+        * @param TKeyEvent, Event to handled.
+        * @param TEventCode, Type of the key event.
+        * @return TKeyResponse, response code (EKeyWasConsumed, 
+        *         EKeyWasNotConsumed).
+        */
+        TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent,
+                                      TEventCode aType);
+
+        /**
+        * From CAknDialog, handles layout initialization
+        */
+        void PreLayoutDynInitL();
+
+       /**
+        * Menu observer interface. From MEikMenuObserver
+        * @since Series 60 3.1
+        * @param aResourceId resource ID identifying the menu pane to 
+        * initialise.
+        * @param aMenuPane The in-memory representation of the menu pane
+        * @return none
+        */
+        void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane);
+
+        /**
+        * From CAknDialog, handles focus changes of the dialog
+        * @param aButtonId, pressed button id
+        * @return True if ready to close dialog, False otherwise
+        */
+        TBool OkToExitL( TInt aButtonId );
+        
+        /**
+        * From CoeControl
+        */
+        void HandleResourceChange(TInt aType);
+
+        
+    public: // Methods from MUPnPDeviceObserver
+    
+        /**
+         * Notifies that the target renderer disappeared
+         *
+         * @since Series 60 3.1
+         * @param aError exit reason
+         * @return None
+         */
+        void DeviceDisappeared( TInt aError );
+        
+    private:    // New Functions
+
+        /**
+        * Loads a possibly skinned icon and adds it to icon array
+        * @since Series 60 3.1
+        * @param CAknIconArray, array of icons
+        * @param MAknsSkinInstance, skin instance
+        * @param TDesC, reference to icon file
+        * @param TAknsItemID, skinned icon id
+        * @param TInt, bitmap id
+        * @param TInt, bitmap mask id
+        */
+        void AppendIconToArrayL( CAknIconArray* aArray,
+                                 MAknsSkinInstance* aSkin,
+                                 const TDesC& aMbmFile,
+                                 const TAknsItemID& aID,
+                                 TInt aBitmapId,
+                                 TInt aMaskId);
+
+        /**
+        * Marks one item
+        * @since Series 60 3.1
+        * @param aItemIndex (TInt) index of item that should be marked
+        * @return None
+        */
+        void MarkItemL( TInt aItemIndex );
+
+        /**
+        * Unmarks one item
+        * @since Series 60 3.1
+        * @param aItemIndex (TInt) index of item that should be unmarked
+        * @return None
+        */
+        void UnmarkItem( TInt aItemIndex );
+
+        /**
+        * Marks all items. Does not mark any containers.
+        * @since Series 60 3.1
+        * @return None
+        */
+        void MarkAllItemsL();
+
+        /**
+        * Unmarks all items
+        * @since Series 60 3.1
+        * @return None
+        */
+        void UnmarkAllItems();
+
+        /**
+        * Unmarks one item
+        * @since Series 60 3.1
+        * @param aItemIndex (TInt) index of item that should be unmarked
+        * @return None
+        */
+        void UnMarkItemL( TInt aItemIndex );
+
+        /**
+        * Plays music file
+        * @since Series 60 3.1
+        * @param none
+        * @return none
+        */
+        void PlayL(TBool aLocal);
+
+        /**
+        * Show image, video and music on external media renderer
+        * @since Series 60 3.1
+        * @param none
+        * @return none
+        */
+        void ShowPlayExtL();
+
+        /**
+        * Displays wait note
+        * @since Series 60 3.1
+        * @param TInt, note resource
+        */
+        void DisplayWaitNoteL( TInt aResource );
+
+
+        /**
+        * Dismisses wait note
+        * @since Series 60 3.2.3
+        */
+        void DismissWaitNoteL();
+        
+        /**
+        * Called when target device responds to browse query
+        * @since Series 60 3.1
+        * @param TInt, query status
+        * @param aTotalCount TInt total number of objects
+        * @param RPointerArray&, returned item array
+        * @return None
+        */
+        void BrowseResponseL( 
+                    TInt aError,
+                    TInt aTotalCount,
+                    const RPointerArray<CUpnpObject>& aResultArray );
+
+        
+        
+        
+        /**
+        * updates selected items array
+        * @since Series 60 3.1
+        * @param None
+        * @return None
+        */
+        void SelectedArrayCheckL(void);
+        
+         /**
+         * updates command button area
+         * @since Series 60 3.23
+         * @param aMark use for two states, item marked or no marked
+         * @param aTempCounter is the number of the current item in the list.
+         * @return None
+         */
+         void UpdateCommandButtonAreaL( TBool aMark, TInt aTempCounter );
+
+         /**
+         * updates command button area
+         * @since Series 60 3.23
+         * @param aMark use for two states, item marked or no marked
+         * @param aTempCounter is the number of the current item in the list.
+         * @return None
+         */
+         void UpdateCommandButtonArea( TBool aMark, TInt aTempCounter );
+         
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CUPnPBrowseDialog( MUPnPAVController& aAVControl,
+                           CUPnPCommonUI& aCommonUI,
+                           const CUpnpAVDevice& aDevice );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( TInt aMenuResource );
+
+        /**
+        * Loads listbox items
+        * @since Series 60 3.1
+        * @return none
+        */
+        void LoadListItemsL( void );
+
+        /**
+        * Delete old list items
+        * @since Series 60 3.1
+        * @return none
+        */
+        void DeleteListItemsL( void );
+
+        /**
+        * Clears dialog title
+        * @since Series 60 3.1
+        * @return none
+        */
+        void ClearTitleL();
+
+        /**
+        * Updates navi pane text
+        * @since Series 60 3.1
+        * @return none
+        */
+        void UpdateNaviPaneTextL();
+
+        /**
+         * Check if the container with the specified container Id exists
+         * @since Series 60 3.1
+         * @param aCheckContainerId the container Id to be checked
+         * @return the found result
+         */
+        TInt CacheCheck( const TDesC8& aCheckContainerId );
+        
+        /**
+         * Update the cache if any new container is found
+         * @since Series 60 3.1
+         * @param aContainerId the container Id to be checked
+         * @param aNewItem check if the container is new or not
+         * @return the found result
+         */
+        void CacheItemUpdateL( const TDesC8& aContainerId, TBool aNewItem );
+        
+        /**
+         * Send dummy browse response
+         * @since Series 60 3.1
+         * @param aCacheIndex the index in the cache array
+         *
+         * @return none
+         */
+        void SendDummyBrowseResponseL( TInt aCacheIndex );
+        
+        /**
+        * Starts ImageControl
+        * @since Series 60 3.1
+        * @param None
+        * @return none
+        */
+        void StartImageControlL();
+        
+        /**
+        * Stops ImageControl
+        * @since Series 60 3.1
+        * @param None
+        * @return None
+        */
+        void StopImageControlL();
+        
+        /**
+        * Updates softkeys 
+        * @since Series 60 3.1
+        * @param aResourceId (TInt) softkey resource
+        * @return None
+        */
+        void UpdateSoftkeysL( TInt aResourceId );
+        
+        /**
+        * Starts imageControl timer
+        * @since Series 60 3.1
+        * @param None
+        * @return None
+        */
+        void StartImageControlTimer( void );
+        
+        /**
+        * Shows current image
+        * @since Series 60 3.1
+        * @param aShowImage (TBool) shows current image and draws showing 
+        *  icon
+        * @return None
+        */
+        void ShowCurrentImageL( TBool aShowImage );
+        
+        /**
+        * Shows current video
+        * @since Series 60 3.1
+        * @param none
+        * @return none
+        */
+        void ShowVideoDialogExtL( );
+        
+        /**
+        * Handel copy
+        * @since Series 60 3.1
+        * @param None
+        *                     
+        * @return none
+        */
+        void HandleCopyL();
+        
+        /**
+        * Create a playlist filler representing current music selection
+        * for starting music playback
+        * @since Series 60 3.1
+        * @param none
+        *                     
+        * @return CUPnPPlayListFiller filler instance
+        */
+        CUPnPPlayListFiller* CreateFillerLC();
+         
+        /**
+         * Handle different errors returned from other dialogs
+         * @since Series 60 3.1
+         * @param exiting reason
+         * @return none
+         */
+        void HandleErrorL( TInt aError ); 
+        
+        /**
+        * Check if any audio item is marked
+        * @since Series 60 3.1
+        * @param None
+        * @return ETrue if at least one audio item is marked
+        */
+        TBool IsAudioItemMarked( void );  
+ 
+    private:    // Data
+
+        //listbox
+        CEikColumnListBox*          iListBox; //not owned
+        //browse result array
+        RPointerArray<CUpnpObject>  iResultArray; //item inside not owned
+        //navi pane
+        CAknNavigationDecorator*    iNaviDecorator; //owned
+        // navi pane
+        CAknNavigationControlContainer* iNaviPane; //not owned
+        //AV controller
+        MUPnPAVBrowsingSession*     iBrowseSession; //owned
+        
+        CUPnPCommonUI&              iCommonUI; //not owned
+        
+        MUPnPAVController&          iAVControl; //not owned
+        //parent container
+        RPointerArray<HBufC8>       iParentId;  //owned
+        // parent name
+        RPointerArray<HBufC8>       iParentName; //owned
+        //common UI
+           
+        //wait dialog
+        CAknWaitDialog*             iWaitNoteDialog; //owned    
+        //temporary browse result array
+        RPointerArray<CUpnpObject>  iTempArray; // items inside not owned
+        //browse direction
+        TInt                        iBrowseFlag;
+        
+        // stores selected item index
+        TInt                        iSelectedItem;
+        
+        //exit timer
+        TBool                       iFirstResultArray;
+        TInt                        iCurrentItem;
+        TBool                       iAllObjectsReceived;
+
+        TInt                        iPrevHighlighteditem;
+        TInt                        iUppermostItem;
+        TInt                        iBrowseDirection;
+        
+        TBool                       iDummyBrowseResponse;
+        HBufC8*                     iCurrentFolderId; //owned
+        TBool                       iBrowseRequestSent;
+
+        RPointerArray<CUPnPBrowseCacheItem>        iBrowseCacheItems; //owned
+
+        CPeriodic*                  iPeriodic; //owned       
+
+        //Array for selected items
+        RPointerArray<CUpnpObject>  iSelectedItemsArray; //owned
+        //Flag to tell if the image control view is active
+        TBool                       iImageControlActive;        
+        //ImageControl periodic timer
+        CUPnPPeriodic*              iImageControlTimer; //owned
+        
+        CUpnpImagePlayer*           iImagePlayer; //owned
+        
+        CUPnPLocalPlayer*           iLocalPlayer; //owned
+        
+        CUpnpAVDevice*              iTargetDevice; //owned
+        
+        const CUpnpAVDevice&        iSourceDevice; //not owned
+        
+        // title pane
+        CAknTitlePane*              iTitlePane; //not owned
+        
+        //Flag to tell if shift and Ok was pressed the same time
+        TBool                       iShiftAndOkPressed;
+        
+        TInt                        iLastImageItemIndex;
+        
+        TInt                        iChildDialogOpen;
+        
+        //flag to either media server disappears or media renderer disappear
+        TBool                       iMSDisappear;
+        
+        TInt                        iTotalCount;
+        
+        CUPnPCommonUI::TUPnPAction               iAction;
+        
+        TInt                        iCopyIndex;
+        
+        TBool                       iRoot;
+        
+        TBool                       iIsMusicItem;
+        
+        TBool                       iAllObjectsReceviedInOneBrowse;
+        
+        TInt                        iNumObjectReceviedInOnBrowse;
+        
+        /**
+         * for music playing, this is to prevent user to pop up renderer
+         * selection and select renderer multiple times
+         */
+        TBool                       iMusicPlay;
+        
+        TInt                        iError;
+        
+        // is PreLayoutDynInitL done. Used when exiting dialog
+        TBool                       iDlgPreLayoutDone;
+        
+        // Flag to tell if the the Hash (#) key is Holding down
+        TBool                       iHashKeyFlag;
+        
+        // Flag to tell if need repeat browse request to get all objects 
+        // which an original browse request desired
+        TBool iNeedRepeatRequest;
+        
+        // Flag to tell if the browse request is original browse request.
+        TBool iOriginalBrowseRequest;
+        
+        // Current number of objects receved from original browse request
+        TInt iCurrentRecevedObjectIndex;
+        
+        // Count of objects which an original browse request desired
+        TInt iNeedRecevedObjectCount;
+        
+        // Server return count of objects in first browse request
+        TInt iServerReturnObjectCount;
+        
+        // If wait note is cancel before the browse dialog is displayed,
+        // set a value for leave.
+        TInt iErrorForCancel;	
+        
+        // Flag to tell if the copying is onging, ETrue: Ongoing
+        TBool                       iCopying;
+        
+        // Flag to tell if the application should be closed, ETrue: should be closed
+        TBool                       iApplicationClose;
+    };
+
+#endif // __UPNP_BROWSE_DIALOG_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpcommonui.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,349 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the Common UI class
+*
+*/
+
+
+#ifndef CUPNPCOMMONUI_H
+#define CUPNPCOMMONUI_H
+
+// INCLUDES
+#include <eikspmod.h>
+#include <eikclb.h>
+#include <aknview.h>
+
+// CONSTANTS
+
+// Application UID's needed in code
+const TInt KMediaGalleryUID3 = { 0x101F8599 };
+
+enum TUPnPBrowseActionIds
+    {
+    EUPnPBrowseOpen = 1,
+    EUPnPBrowseFind,
+    EUPnPBrowseShowExt,
+    EUPnPBrowsePlayExt,
+    EUPnPBrowseCopy
+    };
+
+enum TUPnPBrowseIncomingActionId
+    {
+    EUPnPSelectContainer = 1,
+    EUPnPBrowseFolders
+    };
+
+enum TUPnPDialogTitle
+    {
+    EUPnPSelectDeviceTitle = 1, /* "Select device:" */
+    EUPnPSelectFolderTitle,     /* "Select folder:" */
+    EUPnPCopyToTitle,           /* "Copy to:" */
+    EUPnPMoveToTitle            /* "Move to: */ 
+    };
+
+enum TUPnPDeviceTypesToSearch
+    {
+    EUPnPSearchAllDevices = 1,
+    EUPnPSearchAllServerDevices,
+    EUPnPSearchServerDevicesWithCopyCapability,
+    EUPnPSearchServerDevicesWithSearchCapability,
+    EUPnPSearchAllRenderingDevices,
+    EUPnPSearchRenderingDevicesWithImageCapability,
+    EUPnPSearchRenderingDevicesWithVideoCapability,
+    EUPnPSearchRenderingDevicesWithImageAndVideoCapability,
+    EUPnPSearchRenderingDevicesWithAudioCapability
+    };
+
+enum TUPnPPopUpSoftkey
+    {
+    EUPnPSoftkeyCopy = 1,
+    EUPnPSoftkeyMove,
+    EUPnPSoftkeySelect
+    };
+    
+// FORWARD DECLARATIONS
+class CAknViewAppUi;
+class CUPnPExternalDeviceDialog;
+class CUPnPBrowseDialog;
+class CUPnPAdvancedFindDialog;
+class CUPnPVideoPlayerDlg;
+class CUPnPSelectionDialog;
+class MUPnPAVController;
+class MUPnPAVRenderingSession;
+class MUPnPAVBrowsingSession;
+class CUPnPPlayListFiller;
+class CUPnPMusicAdapter;
+
+class CUpnpObject;
+class CUpnpAVDevice;
+class CUpnpContainer;
+
+
+
+
+// CLASS DECLARATION
+
+/**
+*  CUPnPCommonUI class
+*
+*  Collection UI class.
+*/
+class CUPnPCommonUI : public CBase
+    {
+    public:
+    
+        enum TUPnPAction
+        {
+        EUPnPNone = 0,
+        EUPnPBrowse,
+        EUPnPSearch,
+        EUPnPCopy,
+        EUPnPShow
+        };
+    
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUPnPCommonUI* NewL();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CUPnPCommonUI();
+
+    public: // Business logic methods
+
+        /**
+        * Executes device selection dialog
+        * 
+        * @since Series 60 3.1
+        * @param aAVControl (MUPnPAVController&) controller for remote devices
+        * @return TInt, Error code
+        */
+        IMPORT_C TInt ExecuteDeviceDialogL( MUPnPAVController& aAVControl );
+
+        /**
+        * Executes browse dialog
+        * 
+        * @since Series 60 3.1
+        * @param aAVControl (MUPnPAVController&) controller for remote devices
+        * @return TInt, Error code
+        */
+        IMPORT_C TInt ExecuteBrowseDialogL( MUPnPAVController& aAVControl,
+                                            const CUpnpAVDevice& aDevice );
+
+        /**
+        * Executes video player
+        * 
+        * @since Series 60 3.1
+        * @param aRenderingSession (MUPnPAVRenderingSession& )
+        *        the rendering session to used for the playback
+        * @param aObject (CUpnpObject&) the video item to be played
+        * @return TInt, Error code
+        */
+        IMPORT_C TInt ExecuteVideoPlayerL(
+                                MUPnPAVRenderingSession& aRenderingSession,
+                                const CUpnpObject& aObject );
+        
+        /**
+        * Executes music player
+        * 
+        * @since Series 60 3.1
+        * @param aAVControl UPnPAVControl reference
+        * @param aFiller Object that contains playlist information
+        * @param aRenderer the selected renderer device
+        * @return TInt error code
+        */
+        IMPORT_C TInt ExecuteMusicPlayerL( MUPnPAVController& aAVControl,
+                                  CUPnPPlayListFiller* aFiller,
+                                  const CUpnpAVDevice* aTargetDevice );
+                        
+        /**
+        * Displays a UPnP device selection pop-up dialog.
+        *
+        * @since Series 60 3.1
+        * @param aAVControl (MUPnPAVController&) reference to a 
+        *                   CUPnPAVControl
+        * @param aDevice (CUpnpAVDevice&) reference to the device
+        * @param aType (TUPnPDeviceTypesToSearch), type of device that is
+        *        requested
+        * @param aTitle (TUPnPDialogTitle) the title for the dialog
+        * @return TInt exiting reason
+        */
+        IMPORT_C TInt SelectDeviceL( MUPnPAVController& aAVControl,
+                                     CUpnpAVDevice& aDevice,
+                                     TUPnPDeviceTypesToSearch aType,
+                                     TUPnPDialogTitle aTitle );
+
+        /**
+        * Dismiss dialog
+        * when media server disappears
+        *
+        * @since Series 60 3.1
+        * @param aError exit error
+        * 
+        * @return None
+        */                          
+        IMPORT_C void DismissDialogL( TInt aError );
+
+        /**
+        * Displays an Connection failed error note needed in aiw engine.
+        *
+        * @since Series 60 3.1
+        */
+        IMPORT_C void DisplayConnectionErrorNoteL();
+
+        /**
+        * Displays an Connection lost error note if copying files fails.
+        *
+        * @since Series 60 3.2.3
+        */
+        IMPORT_C void DisplayConnectionLostCopyErrorNoteL();
+
+    public: // Common API internal interface
+
+        /**
+        * Executes the Advanced Find Dialog.
+        *
+        * @since Series 60 3.1
+        * @param aAVControl (MUPnPAVController&) reference to AVController
+        * @param aBrowsingSession (MUPnPAVBrowsingSession&) reference to the
+        *        rendering session
+        * @return TInt the status
+        */
+        TInt ExecuteAdvFindDialogL( MUPnPAVController& aAVControl,
+            MUPnPAVBrowsingSession& aBrowsingSession );
+        
+        /**
+        * Display a error message
+        *
+        * @since Series 60 3.1
+        * @param aResource The string from the resource file
+        * @param aMaxNumberOfResultsShown The integer filled up in the string
+        * @return None
+        */
+        void DisplayErrorTextL( TInt aResource, 
+                                TInt aMaxNumberOfResultsShown );
+
+        /**
+        * Displays error note
+        *
+        * @since Series 60 3.1
+        * @param TInt, note resource
+        * @return None
+        */
+        void DisplayErrorTextL( TInt aResource );
+        
+        /**
+         * Displays error note
+         *
+         * @since Series 60 3.1
+         * @param TInt, note resource
+         * @param aInfo, note resource
+         * @return None
+         */
+        void DisplayErrorTextL( TInt aResource, const TDesC& aInfo );
+        
+        
+        /**
+        * Displays Information text
+        *
+        * @since Series 60 3.1
+        * @param TInt, note resource
+        * @param TInt, number of files copied
+        * @return None
+        */
+        void DisplayInfoTextL( TInt aResource,
+                               TInt aNumberOfCopy );
+        
+        /**
+        * Displays Information text
+        *
+        * @since Series 60 3.1
+        * @param TInt, note resource
+        * @return None
+        */                       
+        void DisplayInfoTextL( TInt aResource );
+                                
+        /**
+        * Return number of dialogs created in CommonUI
+        *
+        * @since Series 60 3.1
+        * @param none
+        * @return any of dialog created
+        */                          
+        TBool PresenceOfDialog();
+        
+        /**
+        * Handle common error code from other dialogs
+        *
+        * @since Series 60 3.1
+        * @param aError error code
+        * @return none
+        */                          
+        void HandleCommonErrorL( TInt aError,
+                                 TInt aNumCopyItem );
+        
+        /**
+        * Get current upnp action
+        *
+        * @since Series 60 3.1
+        * @param aAction current upnp action
+        * @return none
+        */                         
+        void GetUpnpAction( TUPnPAction aAction );
+        
+    private:
+
+        /**
+        * C++ default constructor
+        */
+        CUPnPCommonUI();
+
+        /**
+        * EPOC default constructor.
+        */
+        void ConstructL();
+        
+        /**
+         * Get Copy location
+         * @since Series 60 3.1
+         * @param aLocation current copy loaction
+         */
+        void GetCopyLocationL( TDes& aLocation ) const;
+
+    private: // Data
+
+        CAknViewAppUi*              iAppUi;                     // Not owned
+        CUPnPExternalDeviceDialog*  iExternalDeviceSelection;   // Not owned
+        CUPnPBrowseDialog*          iBrowseSelection; //not owned
+        CUPnPAdvancedFindDialog*    iAdvFindDialog; //not owned
+        CUPnPVideoPlayerDlg*        iVideoPlayerDialog; //not owned
+        CUPnPSelectionDialog*         iDeviceSelection; //not owned
+        TInt                        iResFileOffset;
+        CEikonEnv*                  iCoeEnv; //not owned
+        CUPnPMusicAdapter*          iMusicAdapter; //owned
+        CUPnPCommonUI::TUPnPAction  iAction;
+        
+        /**
+         * Flag the FeatureManager is initialized or not
+         */
+        TBool                       iFeatureManagerInitialized;
+    };
+
+#endif  // CUPNPCOMMONUI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpcommonui.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the Common UI
+*
+*/
+
+
+#ifndef UPNPCOMMONUI_HRH
+#define UPNPCOMMONUI_HRH
+
+// DATA TYPES
+enum TUPnPCommonUICommandIds
+    {
+    EUPnPOpen = 0x7000,
+    EUPnPFind,
+    EUPnPHelp,
+    EUPnPShow,
+    EUPnPShowExt,
+    EUPnPPlay,
+    EUPnPPlayExt,
+    EUPnPPlayLocal,
+    EUPnPShowLocal,
+    EUPnPCopy,
+    EUPnPUnmark,
+    EUPnPMark,
+    EUPnPSubMark,
+    EUPnPMarkAll,
+    EUPnPunMark,
+    EUPnPSubunMark,
+    EUPnPunMarkAll,
+    EUPnPMute,
+    EUPnPUnmute,
+    EUPnPRepeatPlay,
+    EUPnPRandom,
+    EUPnPRepeatOn,
+    EUPnPRepeatOff,
+    EUPnPRandomOn,
+    EUPnPRandomOff
+    };
+    
+enum TUPnPExternDeviceDlgLineId
+    {
+    EUPnPExternDevicesListBoxId = 1
+    };
+    
+enum TUPnPBrowseDlgLineId
+    {
+    EUPnPBrowseListBoxId = 1
+    };
+    
+enum TUPnPVideoPlayerDlgLineId
+    {
+    EUPnPVideoPlayerListBoxId = 1,
+    EUPnPVideoDialogWaitNote
+    };
+   
+enum TUPnPCustomControlDialog
+    {
+    ECustomCtrlDlgCtCustomControl = 1000
+    };
+// MultiViews enumerate command codes
+enum TUPnPMediaPlayerCommandIds
+    {
+    EUPnPPauseCmd = 1,  // start value must not be 0
+    EUPnPContinueCmd,
+    EUPnPReplayCmd,
+    EUPnPStopCmd,
+    EUPnPBackCmd,
+    EUPnPPlayCmd
+    };
+
+
+// MultiViews application view ids.
+enum TUPnPMediaPlayerViewNumber
+    {
+    EUPnPVideoPlayerViewId = 1,
+    EUPnPMusicPlayerViewId
+    };
+
+enum TUPnPWaitingNote
+    {
+    EUPnPWaitingNote=1,
+    EUPnPBrowseDialogProgressNote
+    };
+
+enum TImageControlDlgLineId // dialog line ids
+    {
+    EImageResultBoxId = 1
+    };    
+
+enum THomeConnectMultiSelectionDlgLineId
+    {
+    EMultiSelectionListBoxId = 1
+    };
+
+enum TCbaButtons
+    {
+    EAknSoftkeyContinue = 1        
+    };
+        
+enum THomeConnectAdvancedFindList
+    {
+    EAdvancedFindMediaType = 0, //menee .rss fileen indikaattoriksi
+    EAdvancedFindFileName,
+    EAdvancedFindArtist,
+    EAdvancedFindAlbum,
+    EAdvancedFindGenre,
+    EAdvancedFindDateFrom,
+    EAdvancedFindDateUntil
+    };
+
+enum THomeConnectAdvancedFindMediaTypes
+    {
+    EAdvancedFindAll = 0,
+    EAdvancedFindImages,
+    EAdvancedFindVideo,
+    EAdvancedFindMusic 
+    };
+
+enum TAdvancedFindType
+    {
+    EArtists = 0,
+    EAlbums,
+    EGenres
+    };
+
+enum THomeConnectCommandIds
+    {
+    EHomeConnectCmdAppOpen = 1,
+    EAdvancedFindCmdAppHelp,
+    EAdvancedFindCmdAppChange,
+    EHomeConnectCmdTrust,
+    EHomeConnectCmdUnTrust,
+    EHomeConnectCmdBlock,
+    EHomeConnectCmdUnBlock
+    };
+    
+enum TAdvancedFindResultDlgLineId // dialog line ids
+    {
+    EAdvFindResultBoxId = 1
+    };    
+
+#endif      // UPNPCOMMONUI_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpdeviceobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CommonUI internal renderer device observer interface
+*
+*/
+
+
+#ifndef M_UPNPDEVICEOBSERVER_H
+#define M_UPNPDEVICEOBSERVER_H
+
+// INCLUDES
+
+// FORWARD DECLARATIONS
+
+/**
+* Defines the response interface for the image play in the
+* UPnP CommonUI.
+*
+* @since Series 60 3.1
+*/
+class MUPnPDeviceObserver
+    {
+
+    public:
+
+        /**
+         * Notifies the dialog which should exit
+         *
+         * @since Series 60 3.1
+         * @param aError reason of exit
+         * @return None
+         */
+        virtual void DeviceDisappeared( TInt aError ) = 0;
+
+    };
+
+#endif // MUPnPDeviceObserver
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpexternaldevicedialog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UPnPSelectionDialog class implementation
+*
+*/
+
+
+#ifndef __UPNP_EXTERNAL_DEVICE_DIALOG_H__
+#define __UPNP_EXTERNAL_DEVICE_DIALOG_H__
+
+// INCLUDES
+#include <aknselectionlist.h>
+#include <aknnavide.h> // CAknNavigationDecorator
+#include "upnpavdeviceobserver.h"
+#include "upnpnavipanecontainer.h"
+
+// FORWARD DECLARATIONS
+class CAknIconArray;
+class MAknsSkinInstance;
+class CAknTitlePane;
+class CUPnPCommonUI;
+class CAknNavigationDecorator;    
+class MUPnPAVController;
+
+class CUpnpItem;
+class CUpnpAVDeviceList;
+/**
+* External device dialog class of Common UI library
+*/
+NONSHARABLE_CLASS( CUPnPExternalDeviceDialog ) : public CAknDialog,
+                                                 public MUPnPAVDeviceObserver
+    {
+    private:
+        /**
+        * C++ default constructor
+        */
+        CUPnPExternalDeviceDialog( MUPnPAVController& aAVControl,
+                                   CUPnPCommonUI& aCommonUI );
+
+        /**
+        * EPOC default constructor.
+        */
+        void ConstructL(TInt aMenuResource );
+
+
+    public: // Methods from MUPnPAVDeviceObserver
+        /**
+         * Notifies that a new UPnP device was discovered.
+         *
+         * @since Series 60 3.1
+         * @param CUpnpDevice
+         * @return None
+         */
+        void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
+
+        /**
+         * Notifies that a UPnP device was dissapeared.
+         *
+         * @since Series 60 3.1
+         * @param CUpnpDevice
+         * @return None
+         */
+        void UPnPDeviceDisappeared (const CUpnpAVDevice& aDevice );
+        
+        /**
+         * Notifies that the WLAN connection has been lost. All sessions
+         * are now usable and must be closed.
+         *
+         * @since Series 60 3.1
+         * @return None
+         */ 
+        void WLANConnectionLost();
+        
+    protected:  // Functions from base classes
+
+        /**
+        * From CAknDialog, handles layout initialization
+        * @since Series 60 3.1
+        * @return none
+        */
+        void PreLayoutDynInitL();
+        
+        /**
+        * From CEikdialog This function is called by the EIKON dialog 
+        * framework just before the dialog is activated, after it 
+        *has called PreLayoutDynInitL() and the dialog has been sized. 
+        * 
+        * @param none
+        * @since Series 60 3.1
+        * @return none
+        */
+        void PostLayoutDynInitL();
+
+        /**
+        * From CAknDialog, handles focus changes of the dialog
+        * @since Series 60 3.1
+        * @param TInt, pressed button id
+        * @return True if ready to close dialog, False otherwise
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+        /**
+        * From CAknDialog, dynamically modifies menu
+        * @since Series 60 3.1
+        * @param TInt, menu resource
+        * @param CEikMenuPane, menu pane resource
+        */
+        void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane);
+
+        /**
+        * From CAknDialog, handles menu commands
+        * @since Series 60 3.1
+        * @param TInt, command to be handled
+        */
+        void ProcessCommandL (TInt aCommand);
+
+        /**
+        * From CoeControl
+        */
+        void HandleResourceChange(TInt aType);
+
+
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param TInt, menu resource used with the dialog
+        * @param CUPnPAVControl&, AV controller
+        * @param CUPnPCommonUI&, pointer to common ui
+        */
+        static CUPnPExternalDeviceDialog* NewL(
+            TInt aMenuResource,
+            MUPnPAVController& aAVControl,
+            CUPnPCommonUI& aCommonUI);
+
+        // Destructor
+        virtual ~CUPnPExternalDeviceDialog(); // destruct and give statistics
+
+
+    private:    // New Functions
+
+        /**
+        * Loads a possibly skinned icon and adds it to icon array
+        * @since Series 60 3.1
+        * @param CAknIconArray, array of icons
+        * @param MAknsSkinInstance, skin instance
+        * @param TDesC, reference to icon file
+        * @param TAknsItemID, skinned icon id
+        * @param TInt, bitmap id
+        * @param TInt, bitmap mask id
+        */
+        void AppendIconToArrayL(CAknIconArray* aArray,
+                                MAknsSkinInstance* aSkin,
+                                const TDesC& aMbmFile,
+                                const TAknsItemID& aID,
+                                TInt aBitmapId,
+                                TInt aMaskId);
+
+
+        /**
+        * Display Media Server Names.
+        * @since Series 60 3.1
+        */
+        void DisplayMediaServersL();
+
+        /**
+        * Execute Browse dialog
+        * @since Series 60 3.1
+        * @return dialog return code
+        */
+        TInt ExecuteBrowseL();
+        
+        /**
+        * Execute AdvFind dialog
+        * @since Series 60 3.1
+        * @return dialog return code
+        */
+        TInt ExecuteFindL();
+        /**
+         * Notifies that a new UPnP device was discovered.
+         *
+         * @since Series 60 3.1
+         * @param CUpnpDevice, new device
+         * @return None
+         */
+        void UPnPDeviceDiscoveredL(const CUpnpAVDevice& aDevice);
+
+        /**
+         * Notifies that a UPnP device was dissapeared.
+         *
+         * @since Series 60 3.1
+         * @param CUpnpDevice, disappeared device
+         * @return None
+         */
+        void UPnPDeviceDisappearedL(const CUpnpAVDevice& aDevice);
+
+        /**
+        * From CoeControl
+        * @param TCoeHelpContext, context of desired help
+        */
+        void GetHelpContext(TCoeHelpContext& aContext) const;        
+        
+        /**
+         * Updates navi pane animation
+         *
+         * @since Series 60 3.1
+         * @param TBool, animation on/off         
+         */
+        void UpDateAnimationWindowL(TBool aAnimationState);
+        
+    
+
+    private:
+        CEikColumnListBox*                          iListBox; //not owned
+        MUPnPAVController&                          iAVControl;
+        
+        CUpnpAVDeviceList*                          iDeviceArray; //owned
+        CUPnPCommonUI&                              iCommonUI; //not owned
+        // title pane
+        CAknTitlePane*                              iTitlePane; //not owned
+        CAknNavigationDecorator*                    iNaviDecorator; //owned
+        // animation timer
+        //not owned
+        CUPnPNaviPaneContainer*                     iNaviContainer;
+        CEikStatusPane*                             iStatusPane; //not owned
+        //not owned
+        CAknNavigationControlContainer*             iNaviPaneContainer;
+        
+        MUPnPAVDeviceObserver*                      iPreDeviceObserver;
+        TBool                                       iNaviPaneActive;
+    };
+
+#endif // __UPNP_EXTERNAL_DEVICE_DIALOG_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpimageplayer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plays remote images on a renderer
+*
+*/
+
+
+#ifndef C_CUPNPIMAGEPLAYER_H
+#define C_CUPNPIMAGEPLAYER_H
+
+
+#include <e32base.h>
+
+#include <s32mem.h>
+#include "upnpavrenderingsessionobserver.h"
+#include "upnpcommonui.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class MUPnPAVRenderingSession;
+class CUpnpAVDevice;
+class CUpnpObject;
+class MUPnPDeviceObserver;
+class CUPnPCommonUI;
+
+
+// CLASS DECLARATION
+
+/**
+*  UPnP AV Controller callback dispatcher
+*  
+*
+*  @lib - 
+*  @since Series 60 3.1
+*/
+
+NONSHARABLE_CLASS( CUpnpImagePlayer ) : public CBase, 
+                                        public MUPnPAVRenderingSessionObserver
+    {
+    
+    private:
+        /**
+         * Defines the image playing state
+         */
+         enum TPendingOperation
+            {
+            EImageIdle = 0,     //when no action on image has been set
+            EImageInitialising, //image uri has been set, callback not called
+            EImageShowing,     //image play has been set, callback not called
+            EImageNext          //another image is acting when the previous
+                                //one's action has not been completed
+            };
+
+    public:  // Constructors and destructor
+            
+        static CUpnpImagePlayer* NewL( MUPnPAVController& aAVControl,
+                                       MUPnPDeviceObserver& aDialog,
+                                       CUPnPCommonUI& aCommonUI );
+       
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpImagePlayer();
+        
+    public:
+        
+        /**
+         * Set the renderer to show the image
+         * @since Series 60 3.1
+         * @param aTargetDevice the selected renderer to show the image
+         * @return none
+         */
+        void SetTargetDeviceL(const CUpnpAVDevice& aTargetDevice); 
+        
+        /**
+         * Show the image
+         * @since Series 60 3.1
+         * @param the image to be shown
+         * @return none
+         */
+        void PlayL(const CUpnpObject& aItem);
+        
+        /**
+         * Stop showing the image
+         * @since Series 60 3.1
+         * @param none;
+         * @return none
+         */
+        void Stop();
+    
+    
+    protected: //Functions from MUPnPAVRenderingSessionObserver
+        
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'get volume' request. Parameter contains the volume level of the
+         * media renderer device to which the 'get volume' request was sent.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @param aVolumeLevel TInt volume level (between 0 - 100)
+         * @param aActionResponse EFalse if caused by pressing hardware key
+         *                        ETrue if caused by rendering session
+         * @return None
+         */
+        void VolumeResult( TInt /*aError*/, TInt /*aVolumeLevel*/, 
+                           TBool /*aActionResponse*/  ){};
+        
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'get mute' request. Parameter contains the state of the mute of the
+         * media renderer device to which the 'get mute' request was sent.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @param aMute TBool the state of the mute (ETrue or EFalse)
+         * @param aActionResponse EFalse if caused by pressing hardware key
+         *                        ETrue if caused by rendering session
+         * @return None
+         */
+        void MuteResult( TInt /*aError*/, TBool /*aMute*/,
+                         TBool /*aActionResponse*/ ){};
+        
+        /**
+         * UPnP AV Controller calls this method to indicate that the
+         * requested interaction operation (play, stop, etc.) is complete.
+         * In other words, the target rendering device has changed it's
+         * state accordingly.
+         *
+         * @since Series 60 3.1
+         * @param aErrorCode TInt error code
+         * @param aOperation TInt operation (TAVInteractOperation)
+         * @return None
+         */ 
+        void InteractOperationComplete( 
+                      TInt aError,
+                      TUPnPAVInteractOperation aOperation 
+                      );
+        
+        /**
+         * UPnP AV Controller calls this method as a response to Position 
+         * Info action. The current position and the total length of the 
+         * track that is currently playing is returned. The results are in
+         * (hh:mm:ss) format.
+         *
+         * UPnPAVController releases the memory allocated for aTrackPosition
+         * and aTrackLength.
+         *
+         * @since Series 60 3.0
+         * @param aStatus TInt error code
+         * @param aTrackPosition TDesC8& track position
+         * @param aTrackLength TDesC8& track length
+         * @return None
+         */
+        void PositionInfoResult( 
+                      TInt /*aError*/, 
+                      const TDesC8& /*aTrackPosition*/, 
+                      const TDesC8& /*aTrackLength*/ 
+                      ){};
+                      
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'set uri' request.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @return None
+         */
+        void SetURIResult( TInt aError );
+        
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'set next uri' request.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @return None
+         */
+        void SetNextURIResult( TInt /*aError*/){};
+        
+        /**
+         * Notifies that the Media Renderer we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since Series 60 3.1
+         * @return None
+         */
+        void MediaRendererDisappeared(
+            TUPnPDeviceDisconnectedReason aReason );
+        
+        /**
+         * Notifies that the Local Media Server has been put on sharing state
+         *
+         * @since Series 60 3.1
+         * @param aReason reason code
+         * @return None
+         */
+        void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){};
+    
+    private:
+
+        /**
+         * C++ default constructor.
+         */
+         CUpnpImagePlayer( MUPnPAVController& aAVControl,
+                           MUPnPDeviceObserver& aDialog,
+                           CUPnPCommonUI& aCommonUI );         
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         */
+         void ConstructL(); 
+
+    private:
+        
+        /**
+         * UPnP AV Controller calls this method to indicate that the
+         * requested interaction operation (play, stop, etc.) is complete.
+         * In other words, the target rendering device has changed it's
+         * state accordingly.
+         *
+         * @since Series 60 3.1
+         * @param aErrorCode TInt error code
+         * @param aOperation TInt operation (TAVInteractOperation)
+         * @return None
+         */ 
+         void InteractOperationCompleteL( 
+                      TInt aError,
+                      TUPnPAVInteractOperation aOperation 
+                      );
+        
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'set uri' request.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @return None
+         */
+         void SetURIResultL( TInt aError );
+        
+    private:
+
+        MUPnPAVRenderingSession*            iRendSession; //owned
+        MUPnPAVController&                  iAVControl;   //not owned
+        const CUpnpAVDevice*                iTargetDevice;    //not owned
+        
+        TPendingOperation                   iImageState;
+        
+        HBufC8*                             iUri;  //OWNED
+        
+        const CUpnpItem*                    iItem;  //not owned
+        
+        MUPnPDeviceObserver&                iDialog; //not owned
+        
+        CUPnPCommonUI&                      iCommonUI; //Not owned
+        
+        TBool                               iFirstStart; 
+        
+        CUPnPCommonUI::TUPnPAction          iAction;
+    };
+
+
+#endif // C_CUPNPIMAGEPLAYER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnplocalplayer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plays remote images,videos and music locally on device
+*
+*/
+
+
+#ifndef C_CUPNPLOCALPLAYER_H
+#define C_CUPNPLOCALPLAYER_H
+
+#include <e32base.h>
+#include <s32mem.h>
+#include <f32file.h>
+#include <AknServerApp.h>
+#include <AknProgressDialog.h>
+#include "upnpfiletransfersessionobserver.h"
+
+// FORWARD DECLARATIONS
+
+class MUPnPAVBrowsingSession;
+class CUpnpObject;
+class CDocumentHandler;
+class CAknWaitDialog;
+class CUPnPCommonUI;
+class MUPnPAVController;
+class MUPnPFileDownloadSession;
+class MUPnPAVBrowsingSessionObserver;
+
+
+// CLASS DECLARATION
+
+/**
+* CUPnPLocalPlayer
+* The class works is used to play or show the remote item in
+* local devices .
+*
+* @since S60 3.1
+*/
+
+class CUPnPLocalPlayer: public CBase,
+                        public MAknServerAppExitObserver,
+                        public MProgressDialogCallback,
+                        public MUPnPFileTransferSessionObserver
+    {
+    public:  // Constructors and destructor
+
+        IMPORT_C static CUPnPLocalPlayer* NewL(
+                                    MUPnPAVController& aAVController,
+                                    MUPnPAVBrowsingSession& aBrowseSession,
+                                    CUPnPCommonUI& aCommonUI  );
+        /**
+        * Destructor.
+        */
+        virtual ~CUPnPLocalPlayer();
+
+    public:  // new function
+
+        /**
+         * Play a given item
+         *
+         * @since Series 60 3.1
+         * @param CUpnpObject given item to be played
+         * @return none
+         */
+        IMPORT_C void PlayL( const CUpnpObject& aItem );
+
+    public: // Call back methods of MUPnPFileTransferSessionObserver
+
+        /**
+         * Notifies that the transfer has been started
+         *
+         * @since Series 60 3.2
+         * @param aKey identifies the transfer
+         * @param aStatus status (error) code
+         * @return none
+         */
+        void TransferStarted( TInt aKey,
+                              TInt aStatus );
+    
+        /**
+         * Notifies that the transfer has been completed
+         *
+         * @since Series 60 3.2
+         * @param aKey identifies the transfer
+         * @param aStatus status (error) code
+         * @param aFilePath 
+         */ 
+        void TransferCompleted( TInt aKey,
+                                TInt aStatus,
+                                const TDesC& aFilePath );
+        
+         /**
+         * Notifies transfer progress, not implemented since the transfer
+         * progress is not cared in the download and play/show case
+         *
+         * @since Series 60 3.2
+         * @param aKey identifies the transfer
+         * @param aBytes amount of bytes downloaded
+         * @param aTotalBytes total amount of bytes
+         */
+        void TransferProgress( TInt /*aKey*/,
+                               TInt /*aBytes*/,
+                               TInt /*aTotalBytes*/ ){};
+
+        /**
+         * Notifies that the Media Server we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since Series 60 3.2
+         * @return None
+         */    
+        void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );
+
+    protected: // From MProgressDialogCallback
+
+        /**
+         * Callback function for progress bar.
+         *
+         * @since Series 60 3.1
+         * @param aButtonId, id of the button pressed
+         * @return None
+         */
+        void DialogDismissedL( TInt aButtonId );
+
+    protected:  //from MAknServerAppExitObserver
+
+         /**
+         * Notifies that the image or video player has quit. 
+         *
+         * @since Series 60 3.1
+         * @return aReason (TInt), the reason for quitting
+         */    
+        void HandleServerAppExit( TInt aReason );
+
+    private:
+
+        /**
+        * Constructs the local player
+        */
+        CUPnPLocalPlayer( MUPnPAVController& aAVController,
+                          MUPnPAVBrowsingSession& aBrowseSession,
+                          CUPnPCommonUI& aCommonUI  );
+       /**
+        * Perform the second phase construction
+        */
+        void ConstructL(); 
+
+    private:
+        
+        /**
+         * Notifies that the copy operation is complete.
+         *
+         * @since Series 60 3.2
+         * @param aStatus TInt status information
+         * @param aFilepath filepath for a downloaded file (CopyToPhoneL)
+         * @return None
+         */
+        void CopyCompleteL( TInt aError, 
+                           const TDesC& aFilepath );
+        /**
+        * Start the current waiting note
+        * @since Series 60 3.1
+        * @param none
+        * @return none
+        */
+        void StartWaitingNoteL();
+
+        /**
+        * Finish the current waiting note
+        * @since Series 60 3.1
+        * @param none
+        * @return none
+        */
+        void FinishNote();
+
+         /**
+         * Removes those res-elements from the item that can't be used for 
+         * local playback.
+         * @since Series 60 3.1
+         * @param CUpnpObject item to be checked
+         * @return TBool is there any usable res element left.
+         */
+        TBool IsLocallySupportedL( CUpnpObject& aItem );
+
+         
+    private:
+        
+        MUPnPAVBrowsingSession*                     iBrowseSession; //not owned
+        MUPnPAVBrowsingSessionObserver*             iBrowseSessionObserver;    
+        CUpnpObject*                                iItem; //owned
+        RFs                                         iFs; //owned         
+        CDocumentHandler*                           iDocumentHandler;//owned
+        CAknWaitDialog*                             iWaitNoteDialog; //owned
+        HBufC*                                      iFilePath; //owned
+        TInt                                        iExitReason;
+        TBool                                       iWaitingNote;
+        MUPnPFileDownloadSession*                   iDownloadSession;
+        MUPnPAVController*                          iAVController; //not owned
+
+        CUPnPCommonUI&                              iCommonUI; //Not owned
+        };
+
+    #endif // C_CUPNPLOCALPLAYER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpnavipanecontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for UPnP navi pane container
+*
+*/
+
+
+
+#ifndef UPNPNAVIPANECONTAINER_H
+#define UPNPNAVIPANECONTAINER_H
+
+
+// INCLUDES
+#include <coecntrl.h>
+#include <AknsBasicBackgroundControlContext.h>
+
+// FORWARD DECLARATIONS
+class CUPnPPeriodic;
+
+// CLASS DECLARATION
+
+/**
+*  CUPnPNaviPaneContainer
+*  Container class for navi pane
+*
+*  @lib
+*  @since 3.0
+*/
+
+enum TAnimationFrames
+    {
+    EFrame1,
+    EFrame2,
+    EFrame3,
+    EFrame4,
+    EFrame5,
+    EFrame6,
+    EFrame7,
+    EFrame8,
+    EFrame9
+    };
+
+
+
+class CUPnPNaviPaneContainer : public CCoeControl
+    {    
+    public:  // Constructors and destructor
+
+        /**
+        * Symbian constructor can leave
+        */    
+        IMPORT_C static CUPnPNaviPaneContainer* NewL(
+                                    const TRect& aRect, 
+                                    TPoint aPosition, 
+                                    CAknNavigationControlContainer* aParent );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUPnPNaviPaneContainer();
+     
+
+    private: // Functions from base classes
+
+
+        /**
+        * From CoeControl
+        * @return Number of contained component controls.
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl
+        * @param aIndex index of a contained component control.
+        */
+        
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /*
+        * From CCoeControl
+        * @param aRect drawable area.
+        */
+        void Draw(const TRect& aRect) const;
+        
+    private: // Constructors
+    
+        /**
+        * C++ default constructor
+        */
+        CUPnPNaviPaneContainer();
+    
+        /**
+        * Symbian second phase constructor
+        */
+        void ConstructL( const TRect& aRect,
+                         TPoint aPosition,
+                         CAknNavigationControlContainer* aParent = NULL );
+        
+        /**
+        * sets postion and activates and deactivates window
+        */       
+        void DrawAnimation();
+        
+        /**
+        * loads animation frame
+        */
+        static CGulIcon* LoadIconL( TAnimationFrames aAnimationState, 
+                                    TAny* aDlg );
+        
+        /**
+        * deletes the animation frame which enum is given as parameter
+        */
+        void DeleteIcon(TAnimationFrames aAnimationState);
+          
+        /**
+        * updates animation, changes the animation frame to next 
+        */                       
+        static TBool UpdateAnimationL(TAny* aDlg);
+        
+     private: // data
+                   
+        CGulIcon*                            iIcon1;   // owned
+        CGulIcon*                            iIcon2;   // owned
+        CGulIcon*                            iIcon3;   // owned
+        CGulIcon*                            iIcon4;   // owned
+        CGulIcon*                            iIcon5;   // owned
+        CGulIcon*                            iIcon6;   // owned
+        CGulIcon*                            iIcon7;   // owned
+        CGulIcon*                            iIcon8;   // owned
+        CGulIcon*                            iIcon9;   // owned
+        CGulIcon*                            iNavipaneIcon;    // owned
+        CEikLabel*                           iLabel; //owned       
+        CUPnPPeriodic*                       iPeriodic; //owned
+        TInt                                 iAnimationIndex;
+        TPoint                               iPosition;
+        CAknsBasicBackgroundControlContext*  iSkinContext; // owned
+        TBool                                iFirstDrawDelayWaited;
+        
+        TInt                        iResFileOffset;
+        CEikonEnv*                  iCoeEnv; //not owned        
+    };
+#endif      // UPNPNAVIPANECONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpselectiondialog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the UPnPSelectionDialog class implementation
+*
+*/
+
+
+#ifndef __UPNP_SELECTION_DIALOG_H__
+#define __UPNP_SELECTION_DIALOG_H__
+
+// INCLUDES
+#include "upnpavdeviceobserver.h"
+#include "upnpcommonui.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class CUpnpAVDeviceList;
+/**
+* Device selection dialog class of Common UI library
+*/
+NONSHARABLE_CLASS( CUPnPSelectionDialog ): public CBase, 
+                                           public MUPnPAVDeviceObserver
+    {
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CUPnPSelectionDialog* NewL(MUPnPAVController& aAVControl);
+        /**
+        * Destructor.
+        */
+        virtual ~CUPnPSelectionDialog();
+
+    public: // Methods from MUPnPAVDeviceObserver
+        /**
+         * Notifies that a new UPnP device was discovered.
+         *
+         * @since Series 60 3.1
+         * @param CUpnpAVDevice
+         * @return None
+         */
+        void UPnPDeviceDiscovered(const CUpnpAVDevice& aDevice);
+
+        /**
+         * Notifies that a UPnP device was dissapeared.
+         *
+         * @since Series 60 3.1
+         * @param CUpnpAVDevice
+         * @return None
+         */
+        void UPnPDeviceDisappeared(const CUpnpAVDevice& aDevice);
+
+        /**
+         * Notifies that the WLAN connection has been lost. All sessions
+         * are now usable and must be closed.
+         *
+         * @since Series 60 3.1
+         * @return None
+         */ 
+        void WLANConnectionLost();
+        
+    public:
+
+        /**
+         * Starts selection popup
+         *
+         * @since Series 60 3.1
+         * @param CUpnpAVDevice, selected device
+         */
+        TInt StartPopupL(CUpnpAVDevice& aDevice);
+
+        /**
+         * Creates a selection popup.
+         *
+         * @since Series 60 3.1
+         * @param const TDesC&, popup title
+         * @param aDeviceType TUPnPDeviceTypesToSearch type of devices to
+         *        search
+         * @return None
+         */
+        void CreatePopupL( const TDesC& aTitle,
+                           TUPnPDeviceTypesToSearch aDeviceType );
+        
+        /**
+         * Destroy the selection dialog rather than pressing "Cancel" button
+         *
+         * @since Series 60 3.1
+         * @param TInt exiting error 
+         * @return None
+         */
+        void DismissItself( TInt aError );
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CUPnPSelectionDialog(MUPnPAVController& aAVControl);
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+    private:    // New Functions
+
+        /**
+        * Loads a possibly skinned icon and adds it to icon array
+        * @since Series 60 3.1
+        * @param CAknIconArray, array of icons
+        * @param MAknsSkinInstance, skin instance
+        * @param TDesC, reference to icon file
+        * @param TAknsItemID, skinned icon id
+        * @param TInt, bitmap id
+        * @param TInt, bitmap mask id
+        */
+        void AppendIconToArrayL(CAknIconArray* aArray,
+                                MAknsSkinInstance* aSkin,
+                                const TDesC& aMbmFile,
+                                const TAknsItemID& aID,
+                                TInt aBitmapId,
+                                TInt aMaskId);
+
+        /**
+        * Loads listbox items
+        * @since Series 60 3.1
+        */
+        void LoadListItemsL(void);
+
+        /**
+        * From CAknDialog, handles layout initialization
+        * @param const TDesC&, dialog title
+        */
+        void PreLayoutDynInitL(const TDesC& aTitle);
+
+        /**
+         * Notifies that a new UPnP device was discovered.
+         *
+         * @since Series 60 3.1
+         * @param CUpnpAVDevice, new device
+         * @return None
+         */
+        void UPnPDeviceDiscoveredL(const CUpnpAVDevice& aDevice);
+
+        /**
+         * Notifies that a UPnP device was dissapeared.
+         *
+         * @since Series 60 3.1
+         * @param CUpnpAVDevice, disappeared device
+         * @return None
+         */
+        void UPnPDeviceDisappearedL(const CUpnpAVDevice& aDevice);
+
+        /**
+         * Checks if a given device matches with the search criteria.
+         *
+         * @since Series 60 3.1
+         * @param aDevice (CUpnpAVDevice*) the device
+         * @return TBool
+         */
+        TBool MatchWithSearchCriteria( CUpnpAVDevice *aDevice );
+        
+        /**
+         * Updates command set of the dialog by the search type of the devices.
+         * 
+         * @since Series S60 5.1
+         * @param none
+         * @return none
+         */
+        void UpdateCommandSetL();
+
+    private:
+
+        CAknPopupList*                              iPopup; //not owned
+        CAknSingleGraphicPopupMenuStyleListBox*     iListBox; //owned
+        CUpnpAVDeviceList*                          iDeviceArray; //owned
+        
+
+        MUPnPAVController&                          iAVControl;
+        TUPnPDeviceTypesToSearch                    iTypeOfDevicesToSearch;
+        //observer for device appearance
+        MUPnPAVDeviceObserver*                      iDeviceObserver;
+        
+        TInt                                         iExitReason;
+    };
+
+#endif // __UPNP_SELECTION_DIALOG_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/inc/upnpvideoplayerdialog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,630 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for UPnP Video player class implementation
+*
+*/
+
+
+#ifndef __UPNP_VIDEOPLAYER_DIALOG_H__
+#define __UPNP_VIDEOPLAYER_DIALOG_H__
+
+// INCLUDES
+#include <aknViewAppUi.h>
+#include "upnpavrenderingsessionobserver.h"
+#include<remconcoreapitargetobserver.h>    //for MRemConCoreApiTargetObserver
+
+// FORWARD DECLARATIONS
+class CCustomCtrlDlgCustomControl;
+class MUPnPAVRenderingSession;
+class MUPnPAVController;
+class CUpnpObject;
+class CUpnpAVDevice;
+class CUPnPCommonUI;
+class MProgressDialogCallback;
+class CEikLabel;
+
+class CAknVolumePopup;
+class CRemConCoreApiTarget;
+class CRemConInterfaceSelector;
+class CUPnPPeriodic;
+
+/**
+* Video player class of Common UI library
+*/
+NONSHARABLE_CLASS( CUPnPVideoPlayerDlg ) : public CAknDialog,
+                                    public MUPnPAVRenderingSessionObserver,
+                                    public MProgressDialogCallback
+                                  , public MRemConCoreApiTargetObserver
+    {
+
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructors.
+        */
+        CUPnPVideoPlayerDlg( MUPnPAVRenderingSession& aRenderingSession,
+                             const CUpnpObject& aObject,
+                             CUPnPCommonUI& aCommonUI );
+
+        
+        /**
+        * Two-phased constructors.
+        */
+        static CUPnPVideoPlayerDlg* NewL(
+                            MUPnPAVRenderingSession& aRenderingSession,
+                            const CUpnpObject& aObject,
+                            CUPnPCommonUI& aCommonUI );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUPnPVideoPlayerDlg();
+
+    public: // Methods from MUPnPAVRenderingSessionObserver
+
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'get volume' request. Parameter contains the volume level of the
+         * media renderer device to which the 'get volume' request was sent.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @param aVolumeLevel TInt volume level (between 0 - 100)
+         * @param aActionResponse EFalse if caused by pressing hardware key
+         *                        ETrue if caused by rendering session
+         */
+        void VolumeResult( TInt aError, TInt aVolumeLevel, 
+                           TBool aActionResponse );
+
+        /**
+         * UPnP AV Controller calls this method to indicate that the requested
+         * interaction operation (play, stop, etc.) is complete. In other
+         * words, the target rendering device has changed it's state
+         * accordingly.
+         *
+         * @since Series 60 3.1
+         * @param aErrorCode TInt error code
+         * @param aOperation TInt operation (TAVInteractOperation)
+         * @return None
+         */
+        void InteractOperationComplete(
+                            TInt aErrorCode,
+                            TUPnPAVInteractOperation aOperation );
+
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'get mute' request. Parameter contains the state of the mute of the
+         * media renderer device to which the 'get mute' request was sent.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @param aMute TBool the state of the mute (ETrue or EFalse)
+         * @param aActionResponse EFalse if caused by pressing hardware key
+         *                        ETrue if caused by rendering session
+         */
+        void MuteResult( TInt aError, TBool aMute, TBool aActionResponse );
+
+        /**
+         * UPnP AV Controller calls this method as a response to Position
+         * Info action. The current position and the total length of the
+         * track that is currently playing is returned. The results are in
+         * (hh:mm:ss) format.
+         *
+         * UPnPAVController releases the memory allocated for aTrackPosition
+         * and aTrackLength.
+         *
+         * @since Series 60 3.1
+         * @param aStatus TInt error code
+         * @param aTrackPosition TDesC8& track position
+         * @param aTrackLength TDesC8& track length
+         */
+        void PositionInfoResult( TInt aError,
+                                 const TDesC8& aTrackPosition,
+                                 const TDesC8& aTrackLength );
+
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'set uri' request.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @return None
+         */
+        void SetURIResult( TInt aError );
+
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'set next uri' request.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @return None
+         */
+        void SetNextURIResult( TInt /*aError*/ ){};
+       
+       /**
+         * Notifies that the Media Renderer we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since Series 60 3.1
+         * @return None
+         */  
+        void MediaRendererDisappeared(
+            TUPnPDeviceDisconnectedReason aReason );
+        
+        /**
+         * Notifies that the Local Media Server has been put on sharing state
+         *
+         * @since Series 60 3.1
+         * @param aReason reason code
+         * @return None
+         */
+        void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){};
+       
+    public: // Functions from base classes
+
+        /**
+        * CreateCustomControlL
+        *
+        * Draw this CUPnPVideoPlayerDlg to the screen.
+        * @param aRect the rectangle of this view that needs updating
+        */
+        SEikControlInfo CreateCustomControlL( TInt aControlType );
+
+        /**
+        * From CAknDialog, handles key events.
+        * @param TKeyEvent, Event to handled.
+        * @param TEventCode, Type of the key event.
+        * @return TKeyResponse, response code (EKeyWasConsumed,
+        *         EKeyWasNotConsumed).
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                     TEventCode aType );
+        
+    public:  //new function
+        
+        /**
+         * Called from CommonUI to destroy the video dialog itself
+         * both in single Media server disappears or WLAN lost case
+         * @since Series 60 3.1
+         * @param aError exit reason (KErrSessionClosed and
+         *                            KErrDisconnected)
+         * @return None
+         */   
+        void DismissItselfL( TInt aError );
+        
+        /**
+         * Handle different errors
+         * @since Series 60 3.1
+         * @param exiting reason
+         * @return none
+         */
+        void HandleErrorL( TInt aError );
+      
+    protected: // Functions from base classes
+
+        /**
+        * From CoeControl
+        * @param None
+        * @return None
+        */
+        void HandleResourceChange(TInt aType);
+
+        /**
+        * From CAknDialog
+        * @param None
+        * @return None
+        */
+        void SizeChanged();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CEikDialog, handles layout initialization
+        * @param None
+        * @return None
+        */
+        void PreLayoutDynInitL();
+
+        /**
+        * From CAknDialog, handles focus changes of the dialog
+        * @param aButtonId, pressed button id
+        * @return True if ready to close dialog, False otherwise
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+    private:    // New Functions
+
+        /**
+        * Updates navi pane
+        *
+        * @since Series 60 3.1
+        * @param None
+        * @return None
+        */
+        void UpdateNaviPaneL( );
+
+        /**
+        * Check the status pane capabilities.
+        *
+        * @since Series 60 3.1
+        * @param aPaneId Status pane Id.
+        * @return indication of success
+        */
+        TBool CheckStatusPaneCapabilities( const TPaneId& aPaneId );
+
+        /**
+        * Set navigation label from descriptor.
+        *
+        * @since Series 60 3.1
+        * @param aText Text to be displayed on the navi label.
+        * @return none
+        */
+        void SetNaviLabelL( const TDesC& aText );
+
+        
+        /**
+         * UPnP AV Controller calls this method to indicate that the requested
+         * interaction operation (play, stop, etc.) is complete. In other
+         * words, the target rendering device has changed it's state
+         * accordingly.
+         *
+         * @since Series 60 3.1
+         * @param aErrorCode TInt error code
+         * @param aOperation TInt operation (TAVInteractOperation)
+         * @return None
+         */
+        void InteractOperationCompleteL(
+                            TInt aErrorCode,
+                            TUPnPAVInteractOperation aOperation );
+                            
+        /**
+         * UPnP AV Controller calls this method to return the result for the
+         * 'set uri' request.
+         *
+         * @since Series 60 3.1
+         * @param aError error code
+         * @return None
+         */
+        void SetURIResultL( TInt aError );
+        
+        /**
+         * For set cba string, encapsulation it in this function.
+         *
+         * @since Series 60 3.2
+         * @param None
+         * @return None
+         */
+        void ContinueAfterPauseL();
+                        
+    private:
+
+        /**
+        * 2nd phase constructors.
+        */
+        void ConstructL();
+
+        /**
+        * Clears dialog title
+        *
+        * @since Series 60 3.1
+        * @param none
+        * @return none
+        */
+        void ClearTitleL();
+
+        /**
+        * Updates softkey texts
+        *
+        * @since Series 60 3.1
+        * @param TInt, state
+        * @return none
+        */
+        void UpdateSoftkeysL(TInt aState);
+
+        /**
+        * Timer callback for volume indicator hiding.
+        *
+        * @since Series 60 3.1
+        * @return TInt, error code
+        */
+        static TInt HideVolumeIdicator(TAny* aPtr);
+
+        /**
+        * Shows volume indicator
+        *
+        * @since Series 60 3.1
+        * @param none
+        * @return none
+        */
+        void ShowVolumeIndicatorL();
+
+        /**
+        * Timer callback
+        *
+        * @since Series 60 3.1
+        * @param TAny*, caller
+        * @return TInt
+        */
+        static TInt TimerIndicatorL(TAny* aPtr);
+
+        /**
+        * Resolves the target UPnP device capabilites
+        * @since Series 60 3.1
+        * @param None
+        * @return none
+        */
+        void ResolveTargetDeviceCapabilitiesL();
+        
+        /**
+        * Stop the video playback wait note
+        * @since Series 60 3.1
+        * @param None
+        * @return none
+        */
+        void FinishWaitNoteL();
+        
+        /**
+         * Prepare the video playback
+         *
+         * @since Series 60 3.1
+         * @param None
+         * @return None
+         */
+        void PreparePlayBackL();
+        
+        /**
+         * Start wait note
+         *
+         * @since Series 60 3.1
+         * @param None
+         * @return An error code
+         */
+        TInt StartWaitNoteL();
+        
+        /**
+         * Start displaying timer on the navi pane
+         *
+         * @since Series 60 3.1
+         * @param None
+         * @return None
+         */
+        void StartDisplayTimer();
+        
+        /**
+        * Calls respective observer function
+        *
+        * @since Series 60 3.1
+        * @param none
+        * @return none
+        */
+        void DoChangeVolumeL();
+        
+        /**
+        * Timer callback
+        *
+        * @since Series 60 3.1
+        * @param TAny*, caller
+        * @return TInt
+        */
+        static TInt ChangeVolume( TAny* aPtr );
+        
+    public: // Call back methods of MAknProgressDialogCallback
+
+        /**
+         * ProgressDialog call back method.
+         * Get's called when a dialog is dismissed.
+         *
+         * @since S60 3.1
+         * @param aButtonId (TInt) ID of the button pressed
+         */
+        void DialogDismissedL( TInt aButtonId );
+    
+    private:// From MRemConCoreApiTargetObserver
+        
+        
+        /**
+        * Side volume key API from MRemConCoreApiTargetObserver
+        * @since 3.2
+        * @see MRemConCoreApiTargetObserver
+        */
+        virtual void MrccatoCommand(TRemConCoreApiOperationId aOperationId, 
+                             TRemConCoreApiButtonAction aButtonAct );         
+    private:    // Data
+
+        enum TUPnPVideoStates
+            {
+            EUPnPVideoPause = 0x600,
+            EUPnPVideoPlay,
+            EUPnPVideoStop
+            };
+
+        CUPnPPeriodic*                  iTimer; //owned
+        CAknNavigationDecorator*        iNaviDecorator; //owned
+        CAknNavigationControlContainer* iNaviPane;             // Not owned
+        
+        MUPnPAVRenderingSession&        iRendSession; //not owned
+
+        const CUpnpObject*              iItem; //not owned
+        const CUpnpAVDevice*            iTargetDevice;         // Not owned
+        const CUpnpAVDevice*            iSourceDevice;         // Not owned
+
+        HBufC*                          iMinSecFormatString; //owned
+        HBufC*                          iHourMinSecFormatString; //owned
+        HBufC*                          iTimerNavi;
+        TInt64                          iPlaybackPosInSeconds;
+        TInt64                          iTotalLengthInSeconds;
+        TInt                            iCurrentVolume;
+        TInt                            iNewVolume;
+        TInt                            iTimerRefresh;
+        
+        CCustomCtrlDlgCustomControl*    iContainer; //not owned
+        
+        //Volume adjust indicator
+        TBool                           iAdjustingVolume;
+        // Target device capabilites
+        TBool                           iPauseCapability;
+        TBool                           iVolumeCapability;
+        // title text before video player
+        HBufC*                          iOriginalTitleText; //owned
+        
+        CUPnPCommonUI&                  iCommonUI;
+        
+        TBool                           iPause; 
+        
+        // Flag if the remote renderer is playing and the elapsed time needs
+        // be updated. This means that the renderer has started the playback 
+        // already and it is not in paused state.
+        TBool                           iRendererPlaying;
+        
+        // The time interval of getting GetPositionInfoL
+        TInt                            iGetPositionInfoInterval;
+        
+        CUPnPCommonUI::TUPnPAction      iAction;
+        
+        CAknWaitDialog*                 iVideoPlaybackWaitNote; // owned;
+        
+        TInt                            iExitCode;
+        
+        //ETrue if volume is up, EFalse if volume is down
+        TBool                           iVolumeUp;
+           
+        TBool                            iVolumeKeyPressHold;
+        CUPnPPeriodic*                   iVolumeTimer; // owned
+        CAknVolumePopup*                 iVolumePopup; // owned
+        
+        // owned by iInterfaceSelector
+        CRemConCoreApiTarget*            iCoreTarget; 
+        CRemConInterfaceSelector*        iInterfaceSelector; // owned
+        
+    };
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// -----> CImage (definition)
+//
+//////////////////////////////////////////////////////////////////////////////
+class CImage : public CCoeControl
+    {
+    public:
+
+        /**
+        * C++ default constructor.
+        */
+        CImage(MUPnPAVRenderingSession& aRendSession);
+
+        //destructor
+        virtual ~CImage();
+
+    private: // Methods
+
+        /**
+        * Draws the display
+        *
+        * @param TRect&, Rectangle to be drawn
+        * @return none
+        */
+        void Draw(const TRect& aRect) const;
+
+        /**
+        * Draws the display
+        *
+        * @param TRect&, Rectangle to be drawn
+        * @return none
+        */
+        void DrawL(const TRect& aRect) const;
+
+        /**
+        * Draws the label
+        *
+        * @param TRect&, Rectangle to be drawn
+        * @return none
+        */
+        void DrawLabelL(const TRect& aRect) const;
+
+     private: // Data
+
+        // Data members defined and used by this class.
+        MUPnPAVRenderingSession&    iRendSession;
+        CFbsBitmap*                 iBitmap; //owned
+        CFbsBitmap*                 iMask; //owned
+    };
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// -----> CCustomCtrlDlgCustomControl (definition)
+//
+//////////////////////////////////////////////////////////////////////////////
+class CCustomCtrlDlgCustomControl : public CCoeControl
+    {
+
+    public:
+
+        /**
+        * Construct From Resource.
+        */
+        void ConstructFromResourceL( TResourceReader& aReader );
+
+        /**
+        * Sets AV controller
+        *
+        * @since Series 60 3.1
+        * @param MUPnPAVRenderingSession&, AV controller
+        * @return none
+        */
+        void SetRenderingSession( MUPnPAVRenderingSession& aAVRendSession );
+
+        //destructor
+        virtual ~CCustomCtrlDlgCustomControl();
+
+    private:
+
+        /**
+        * Draws the display
+        *
+        * @param TRect&, Rectangle to be drawn
+        * @return none
+        */
+        void Draw( const TRect& aRect ) const;
+
+        /**
+        * From CAknDialog
+        * @param none
+        * @return none
+        */
+        void SizeChanged();
+
+        /**
+        * From CAknDialog
+        * @param none
+        * @return the number of component controls contained by this control
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CAknDialog
+        * @param the index of the control to get
+        * @return the component control with an index of aIndex
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+    private:
+
+        // Data members defined and used by this class.
+        CImage*                     iImage; //owned
+        MUPnPAVRenderingSession*    iRendSession; //not owned
+        
+    };
+
+#endif // __UPNP_VIDEOPLAYER_DIALOG_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpadvfinddialog.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,303 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Advanced find dialog component source code
+*
+*/
+
+
+
+// INCLUDE FILES
+// System
+#include <StringLoader.h>
+#include <upnpstring.h>
+
+// upnpframework / avcontroller api
+#include "upnpavbrowsingsession.h"
+#include "upnpavdevice.h"
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"
+
+// common ui internal
+#include "upnpcommonui.h"
+#include <upnpcommonui.rsg>
+#include "upnpadvfinddialog.h"
+#include "upnpadvfindlist.h"
+
+// debug stuff
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KLength = 100;
+
+// ============================ MEMBER FUNCTIONS ============================
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindDialog::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPAdvancedFindDialog::ConstructL(TInt aMenuResource)
+    {
+    __LOG( "CUPnPAdvancedFindDialog::ConstructL" );
+    CAknDialog::ConstructL(aMenuResource);
+    
+    iOriginalTitleText = HBufC16::NewL( KMaxFileName );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindDialog::CUPnPAdvancedFindDialog
+// default constructor
+// --------------------------------------------------------------------------
+CUPnPAdvancedFindDialog::CUPnPAdvancedFindDialog(
+                                MUPnPAVController& aAVControl,
+                                MUPnPAVBrowsingSession& aBrowsingSession,
+                                CUPnPCommonUI& aCommonUI ):
+                                iAVControl(aAVControl),
+                                iBrowseSession(aBrowsingSession),
+                                iCommonUI(aCommonUI)
+
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindDialog::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAdvancedFindDialog* CUPnPAdvancedFindDialog::NewL(
+                                TInt aMenuResource,
+                                MUPnPAVController& aAVControl,
+                                MUPnPAVBrowsingSession& aBrowsingSession,
+                                CUPnPCommonUI& aCommonUI )
+    {    
+    __LOG( "CUPnPAdvancedFindDialog::NewL" );
+
+    CUPnPAdvancedFindDialog* self = new ( ELeave ) CUPnPAdvancedFindDialog(
+        aAVControl, aBrowsingSession, aCommonUI );
+    CleanupStack::PushL( self );
+    self->ConstructL( aMenuResource );
+    CleanupStack::Pop();
+    return self;
+    }
+    
+// Destructor
+CUPnPAdvancedFindDialog::~CUPnPAdvancedFindDialog()
+    {
+    __LOG( "CUPnPAdvancedFindDialog destructor" );
+    // Set original title pane text
+    if( iOriginalTitleText && iTitlePane )
+        {
+        TRAP_IGNORE( iTitlePane->SetTextL( *iOriginalTitleText ) );
+        delete iOriginalTitleText;    
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindDialog::OkToExitL( TInt aButtonId )
+// called by framework when trying to close the dialog
+// --------------------------------------------------------------------------
+//
+TBool CUPnPAdvancedFindDialog::OkToExitL( TInt aButtonId )
+    {
+    __LOG( "CUPnPAdvancedFindDialog::OkToExitL" );
+    TInt error = KErrNone;
+    TBool retval = EFalse;
+    
+    if ( aButtonId == EAknSoftkeyOk )
+        {
+        iSettingsList->SetMopParent( this );
+        error = iSettingsList->MakeQueryL();
+        
+        iTitlePane = (CAknTitlePane*)iStatusPane->ControlL(
+                                    TUid::Uid( EEikStatusPaneUidTitle ) );
+        SetTitleL();
+        TryExitL( error );
+        }
+    else if ( aButtonId == EAknSoftkeyOptions )
+        {
+        DisplayMenuL();
+        }
+    else if ( aButtonId == EAknSoftkeyBack || 
+              aButtonId == KErrSessionClosed ||
+              aButtonId == KErrDisconnected ||
+              aButtonId == EAknCmdExit ||
+              aButtonId == EEikCmdExit )
+        {
+        retval = ETrue; //back to previous dialog
+        }
+    else if( aButtonId == EAknSoftkeyOpen )
+        {
+        TKeyEvent tmpEvent;
+        tmpEvent.iCode = EKeyOK;
+        tmpEvent.iModifiers = 0;
+        tmpEvent.iRepeats = 0;
+        tmpEvent.iScanCode = 0;
+        TEventCode eventType = EEventKey;
+        OfferKeyEventL( tmpEvent, eventType );
+        }
+    return retval;
+    }
+
+// ---------------------------------------------------------
+// CUPnPAdvancedFindDialog::PreLayoutDynInitL()
+// called by framework before dialog is shown 
+// ---------------------------------------------------------
+//
+void CUPnPAdvancedFindDialog::PreLayoutDynInitL()
+    {
+    __LOG( "CUPnPAdvancedFindDialog::PreLayoutDynInitL" );
+    iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    iTitlePane = ( CAknTitlePane* )iStatusPane->ControlL( 
+                                    TUid::Uid( EEikStatusPaneUidTitle ) );
+    
+    // Take backup of title text
+    iOriginalTitleText->Des().Copy( *iTitlePane->Text() );
+    // set dialog title
+    SetTitleL();
+    }
+    
+
+// ---------------------------------------------------------
+// CUPnPAdvancedFindDialog::ProcessCommandL()
+// ---------------------------------------------------------
+//    
+void CUPnPAdvancedFindDialog::ProcessCommandL ( TInt aCommand )
+    {
+    __LOG( "CUPnPAdvancedFindDialog::ProcessCommandL" );
+    HideMenu();    
+    CAknDialog::ProcessCommandL( aCommand );
+    }
+  
+// ---------------------------------------------------------
+// CUPnPAdvancedFindDialog::OfferKeyEventL()
+// called by framework when key is pressed 
+// ---------------------------------------------------------
+//
+TKeyResponse CUPnPAdvancedFindDialog::OfferKeyEventL(
+                                                const TKeyEvent &aKeyEvent,
+                                                TEventCode aType )
+    {
+    __LOG( "CUPnPAdvancedFindDialog::OfferKeyEventL" );
+    if ( aType != EEventKey )
+        {
+        return EKeyWasNotConsumed;
+        }
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyDownArrow: // flow through
+        case EKeyUpArrow:
+            {
+            iSettingsList->OfferKeyEventL( aKeyEvent, aType );
+            break;
+            }
+        case EKeyOK:
+            {
+            TInt selected_item = iSettingsList->ListBox()->CurrentItemIndex();
+            iSettingsList->EditItemL( selected_item, ETrue );
+            if( !iClose )
+                {
+                iSettingsList->HandleChangeInItemArrayOrVisibilityL();    
+                }
+            
+            break;
+            }       
+        default:
+            {
+            CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+            break;    
+            }
+        }
+
+    return EKeyWasConsumed;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindDialog::CreateCustomControlL
+// --------------------------------------------------------------------------
+//
+SEikControlInfo CUPnPAdvancedFindDialog::CreateCustomControlL(
+                                                        TInt aControlType )
+    {
+    __LOG( "CUPnPAdvancedFindDialog::CreateCustomControlL" );
+    SEikControlInfo controlInfo;
+    controlInfo.iControl = NULL;
+    controlInfo.iTrailerTextId = 0;
+    controlInfo.iFlags = 0;
+    switch ( aControlType )
+        {
+        case KAknCtLastControlId:
+            {            
+            iSettingsList = CUPnPAdvancedFindList::NewL( iAVControl, 
+                                                         iBrowseSession,
+                                                         *this,
+                                                         iCommonUI );
+            controlInfo.iControl = iSettingsList;          
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }    
+    return controlInfo;
+    }        
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindDialog::DismissItselfL
+// --------------------------------------------------------------------------
+//
+void CUPnPAdvancedFindDialog::DismissItselfL( TInt aError )
+    {
+    iClose = ETrue;
+    if( iSettingsList )
+        {
+        //if setting page is not open, close it, otherwise, do nothing
+        if( !iSettingsList->IsSettingPageOpen() )
+            {
+            TryExitL( aError );
+            }
+        }
+    else
+        {
+        TryExitL( aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindDialog::SetTitleL
+// --------------------------------------------------------------------------
+//
+void CUPnPAdvancedFindDialog::SetTitleL()
+    {
+    const CUpnpAVDevice* device = &( iBrowseSession.Device() );
+    
+    // Get device friendly name and replace illegal characters.
+    HBufC8* tmpfriendlyname = 
+        UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+        ( ( CUpnpAVDevice* )device )->FriendlyName() );    
+    
+    CleanupStack::PushL( tmpfriendlyname );
+    TPtrC8 friendlyname = *tmpfriendlyname;
+        
+    HBufC* titleString = UpnpString::ToUnicodeL( 
+        friendlyname.Left( KLength ) );
+    CleanupStack::PushL( titleString );
+    
+    iTitlePane->SetTextL( *titleString );
+    CleanupStack::PopAndDestroy( titleString );
+    CleanupStack::PopAndDestroy( tmpfriendlyname );
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpadvfindlist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1039 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  List in advanced find results dialog
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <aknnotewrappers.h>
+#include <aknlists.h>
+#include <StringLoader.h>
+#include <AknWaitDialog.h>
+#include <akntextsettingpage.h> //for text editor flags
+#include <upnpstring.h>
+
+// upnp stack api's
+#include <upnpitem.h>
+
+// upnpframework / avcontroller api
+#include "upnpavbrowsingsession.h"
+
+// upnpramework / avcontroller helper api
+#include "upnpconstantdefs.h" // upnp definitions
+
+// upnpframework / xml parser api
+#include "upnpxmlparser.h"
+
+// common ui internal
+#include "upnpcommonui.hrh"
+#include <upnpcommonui.rsg>
+#include "upnpadvfindresultwindow.h"
+#include "upnpadvfindlist.h"
+#include "upnpadvfinddialog.h"
+
+
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+//CONSTANTS
+_LIT( KDate, "%d0000:" ); //Initial value for date elements
+_LIT8( KAttributeRefID, "@refID" );
+_LIT8( KTimeFormat8, "%d-%02d-%02d" );
+const TInt KMaxRequestCount = 50;
+const TInt KTmpDateFormatLength = 12;
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::CUPnPAdvancedFindList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPAdvancedFindList::CUPnPAdvancedFindList(
+                                    MUPnPAVController& aAVControl,
+                                    MUPnPAVBrowsingSession& aBrowsingSession,
+                                    CUPnPAdvancedFindDialog& aParent,
+                                    CUPnPCommonUI& aCommonUI ):
+                                    iAVControl(aAVControl),
+                                    iCommonUI(aCommonUI),
+                                    iAdvancedFindDialog(aParent),
+                                    iBrowseSession(aBrowsingSession),
+                                    iShowingErrorNote(EFalse)
+    {
+    
+    // Set date to January first of current year
+    iDateFrom.HomeTime();
+    TInt year = iDateFrom.DateTime().Year();
+    TBuf<10> tempBuf;
+    tempBuf.Format( KDate(), year );
+    iDateFrom.Set( tempBuf ); 
+    
+    iDateUntil.HomeTime();
+    
+    iDateInitial.Set( tempBuf );    
+        
+        
+    
+    // backup existing browsesession observer and set this as current observer
+    iBrowseObserver = iBrowseSession.Observer();
+    iBrowseSession.RemoveObserver();
+    iBrowseSession.SetObserver( *this );
+ 
+    iSearchResponseReceived = EFalse;
+    
+    iAction = CUPnPCommonUI::EUPnPNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPAdvancedFindList::ConstructL()
+    {
+    }
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAdvancedFindList* CUPnPAdvancedFindList::NewL(
+                                    MUPnPAVController& aAVControl,
+                                    MUPnPAVBrowsingSession& aBrowsingSession, 
+                                    CUPnPAdvancedFindDialog& aParent,
+                                    CUPnPCommonUI& aCommonUI )
+    {
+    __LOG( "CUPnPAdvancedFindList newL" ) ;
+    CUPnPAdvancedFindList* self = new (ELeave) CUPnPAdvancedFindList(
+                                                            aAVControl, 
+                                                            aBrowsingSession,
+                                                            aParent,
+                                                            aCommonUI );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::NewL
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPAdvancedFindList::~CUPnPAdvancedFindList()
+    {
+    __LOG( "CUPnPAdvancedFindList::~CUPnPAdvancedFindList" );
+    if ( iWaitNoteDialog ) 
+        {
+         // Stop showing wait note
+        TRAP_IGNORE( iWaitNoteDialog->ProcessFinishedL() );
+        delete iWaitNoteDialog;
+        iWaitNoteDialog = NULL;
+        }
+        
+    iBrowseSession.RemoveObserver();
+    if( iBrowseObserver )
+        {
+        iBrowseSession.SetObserver( *iBrowseObserver );
+        }
+    
+    iResultArray.ResetAndDestroy();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::MediaServerDisappeared
+// --------------------------------------------------------------------------
+//
+void CUPnPAdvancedFindList::MediaServerDisappeared( 
+                                TUPnPDeviceDisconnectedReason aReason )
+    {
+    iClose = ETrue;
+    iCloseReason = aReason;
+    TRAP_IGNORE( MediaServerDisappearedL( aReason ) );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::MediaServerDisappearedL
+// --------------------------------------------------------------------------
+//
+void CUPnPAdvancedFindList::MediaServerDisappearedL( 
+                                TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG( "CUPnPAdvancedFindList::MediaServerDisappearedL" );
+    
+    if( aReason == EDisconnected )
+        {
+        iExitCode = KErrSessionClosed;
+        }
+    else if( aReason == EWLANLost)
+        {
+        iExitCode = KErrDisconnected;
+        }
+    else
+        {
+        __PANICD( __FILE__, __LINE__);
+        }
+    
+    if( iWaitNoteDialog ) //if it is on searching
+        {
+        __LOG( "CUPnPAdvancedFindList::iWaitNoteDialog ETrue" );
+        DialogDismissedL( EEikBidCancel );
+        iWaitNoteDialog->ProcessFinishedL();
+        //no need to call DialogDismissedL;
+        delete iWaitNoteDialog;
+        iWaitNoteDialog = NULL;
+        }
+    else
+        {
+        if( iFindResultWindow )
+            {
+            __LOG( "CUPnPAdvancedFindList::iFindResultWindow->DismissItselfL" );
+            iFindResultWindow->DismissItselfL( iExitCode );
+            iFindResultWindow = NULL;
+            }
+        else //notify AdvancedFindDialog to close itself
+            {
+            if ( !iShowingErrorNote )
+                {
+                iAdvancedFindDialog.DismissItselfL( iExitCode ); 
+                }
+            else
+                {
+                __LOG( "CUPnPAdvancedFindList::iShowingErrorNote ETrue" );
+                }                      
+            }      
+        }
+    __LOG( "CUPnPAdvancedFindList::MediaServerDisappearedL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::DialogDismissedL
+// --------------------------------------------------------------------------
+//
+void CUPnPAdvancedFindList::DialogDismissedL( TInt aButtonId )
+    {
+    __LOG( "CUPnPBrowseDialog::DialogDismissedL" );
+
+    // If button is cancel, inform observer parent class 
+    // that cancel has been made
+    if( aButtonId == EEikBidCancel )
+        {
+        __LOG( "CUPnPBrowseDialog::DialogDismissedL: \
+                                             Cancel was pressed." );
+        
+        iAction = CUPnPCommonUI::EUPnPNone; 
+        iBrowseSession.CancelSearch();
+        }
+
+    __LOG( "CUPnPBrowseDialog::DialogDismissedL end" );
+    //Do nothing
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::SearchResponse
+// --------------------------------------------------------------------------
+//
+void CUPnPAdvancedFindList::SearchResponse( const TDesC8& aSearchResponse,
+    TInt aError, TInt /*aMatches*/, TInt /*aTotalCount*/, const TDesC8&
+    /*aUpdateId*/ )
+    {
+    __LOG( "CUPnPBrowseDialog::SearchResponse" );
+    RPointerArray<CUpnpObject> array;   
+    
+    if( aError == KErrNone )
+        {
+        CUPnPXMLParser* parser = NULL;
+        TRAP( aError, parser = CUPnPXMLParser::NewL();
+              parser->ParseResultDataL( array,
+              aSearchResponse ) );
+        
+        delete parser;
+        }
+        
+    TRAP_IGNORE( SearchResponseL( aError, array ) );
+    
+    array.ResetAndDestroy();
+    
+    __LOG( "CUPnPBrowseDialog::SearchResponse -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::SearchResponseL
+// Response to FindMetadataL function.
+// --------------------------------------------------------------------------
+void CUPnPAdvancedFindList::SearchResponseL( 
+                            TInt aError,
+                            const RPointerArray<CUpnpObject>& aResultArray )
+    {
+    
+    __LOG( "CUPnPBrowseDialog::SearchResponseL" );
+    iExitCode = aError;    
+    if( KErrNone == aError )
+        {
+        iSearchResponseReceived = ETrue;
+        TBuf<KMaxNameLength> previousTitleName;
+        previousTitleName.Zero();
+        //Go through the search result and add data to database
+        
+        
+        for( TInt count = 0; count < aResultArray.Count(); count++ )
+            {    
+            //If an Item is found
+            CUpnpObject* tmpObject = aResultArray[count];
+
+            //If it is right type and name is longer than zero
+            if ( tmpObject->ObjectType() == EUPnPItem )
+                {
+                CUpnpItem* item = static_cast<CUpnpItem*>( tmpObject );
+
+                if ( item->Title().Length() > 0 )
+                    {
+                    
+                    //Copy the item
+                    item = CUpnpItem::NewL();
+                    CleanupStack::PushL( item );
+                    item->CopyL( *aResultArray[count] );
+                    //And if item is correct type
+                    iResultArray.Append( item ); // item ownership transferred
+                    CleanupStack::Pop( item );
+                    }
+                }
+            }
+        }
+    else
+        {
+        iCommonUI.GetUpnpAction( iAction );
+        iCommonUI.HandleCommonErrorL( aError, NULL );
+        __LOG( "CUPnPAdvancedFindList: \
+                SearchResponse operation failed!" );
+        }
+    if ( iWaitNoteDialog )
+        {
+        TRAP_IGNORE( iWaitNoteDialog->ProcessFinishedL() );
+        }
+   __LOG( "CUPnPBrowseDialog::SearchResponseL -end" );
+   }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::CreateSettingItemL
+// Creates list items
+// --------------------------------------------------------------------------
+//
+CAknSettingItem* CUPnPAdvancedFindList::CreateSettingItemL( 
+                                                           TInt aIdentifier )
+    {    
+    CAknSettingItem* settingItem = NULL;
+    switch (aIdentifier)
+        {
+        case EAdvancedFindMediaType:
+            {
+            iMediatype = 0;
+            settingItem = new (ELeave) CAknEnumeratedTextPopupSettingItem(
+                                       aIdentifier, iMediatype ); 
+            break;
+            }
+        case EAdvancedFindFileName:
+            {            
+            settingItem = new (ELeave) CAknTextSettingItem( aIdentifier, 
+                                                            iFileName );
+            settingItem->SetSettingPageFlags(
+                                   CAknTextSettingPage::EZeroLengthAllowed );
+            break;
+            }
+        case EAdvancedFindArtist:
+            {                        
+            settingItem = new (ELeave) CAknTextSettingItem( aIdentifier,
+                                                            iArtistText );
+            settingItem->SetSettingPageFlags(
+                                   CAknTextSettingPage::EZeroLengthAllowed );
+            settingItem->SetHidden( ETrue );                        
+            break;
+            }
+        case EAdvancedFindAlbum:
+            {            
+            settingItem = new (ELeave) CAknTextSettingItem( aIdentifier,
+                                                            iAlbumText );
+            settingItem->SetSettingPageFlags(
+                                   CAknTextSettingPage::EZeroLengthAllowed );
+            settingItem->SetHidden( ETrue );
+            break;
+            }
+        case EAdvancedFindGenre:
+            {            
+            settingItem = new (ELeave) CAknTextSettingItem( aIdentifier,
+                                                            iGenreText );
+            settingItem->SetSettingPageFlags(
+                                   CAknTextSettingPage::EZeroLengthAllowed );
+            settingItem->SetHidden( ETrue );
+            break;
+            }
+        case EAdvancedFindDateFrom:
+            {            
+            settingItem = new (ELeave) CAknTimeOrDateSettingItem(
+                                           aIdentifier, 
+                                           CAknTimeOrDateSettingItem::EDate,
+                                           iDateFrom );
+            break;            
+            }
+        case EAdvancedFindDateUntil:
+            {            
+            settingItem = new (ELeave) CAknTimeOrDateSettingItem(
+                                           aIdentifier, 
+                                           CAknTimeOrDateSettingItem::EDate,
+                                           iDateUntil );
+            break;
+            }                
+        default:
+            break;
+        }            
+    return settingItem;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::EditItemL
+// --------------------------------------------------------------------------
+//
+void  CUPnPAdvancedFindList::EditItemL ( TInt aIndex, TBool aCalledFromMenu )
+    {
+    CAknSettingItemArray* arrayForTrueIndex = 
+                                CAknSettingItemList::SettingItemArray();
+    TInt indexForEditing = arrayForTrueIndex->
+                                        ItemIndexFromVisibleIndex( aIndex );
+    arrayForTrueIndex = NULL;           
+    switch ( indexForEditing )
+        {
+        case EAdvancedFindMediaType:
+            {
+            iSettingPageOpen = ETrue;        
+            CAknSettingItemList::EditItemL( indexForEditing, 
+                                            aCalledFromMenu );
+            CAknSettingItemArray* arrayForHideCommands = 
+                                    CAknSettingItemList::SettingItemArray();
+            StoreSettingsL();        
+            if ( iMediatype == EAdvancedFindMusic )
+                {
+                CAknSettingItem* settingItem = 
+                            arrayForHideCommands->At( EAdvancedFindArtist );
+                settingItem->SetHidden( EFalse );
+                settingItem = NULL;                
+                CAknSettingItem* settingItem2 = 
+                            arrayForHideCommands->At( EAdvancedFindAlbum );
+                settingItem2->SetHidden( EFalse );
+                settingItem2 = NULL;            
+                CAknSettingItem* settingItem3 = 
+                            arrayForHideCommands->At( EAdvancedFindGenre );
+                settingItem3->SetHidden( EFalse );    
+                settingItem3 = NULL;
+                }
+            else 
+                {                
+                CAknSettingItem* settingItem = 
+                            arrayForHideCommands->At( EAdvancedFindArtist );
+                settingItem->SetHidden( ETrue );
+                settingItem = NULL;                
+                CAknSettingItem* settingItem2 = 
+                            arrayForHideCommands->At( EAdvancedFindAlbum );
+                settingItem2->SetHidden(ETrue);
+                settingItem2 = NULL;                
+                CAknSettingItem* settingItem3 = 
+                            arrayForHideCommands->At( EAdvancedFindGenre );
+                settingItem3->SetHidden( ETrue );
+                settingItem3 = NULL;
+                }            
+            arrayForHideCommands = NULL;            
+            }
+            break;
+        case EAdvancedFindFileName:
+            {
+            iSettingPageOpen = ETrue;            
+            CAknSettingItemList::EditItemL( indexForEditing, 
+                                            aCalledFromMenu );
+            StoreSettingsL();            
+            }
+            break;            
+        case EAdvancedFindArtist:
+            {
+            iSettingPageOpen = ETrue;
+            CAknSettingItemList::EditItemL( indexForEditing, 
+                                            aCalledFromMenu );
+            StoreSettingsL();             
+            }
+            break;
+        case EAdvancedFindAlbum:
+            {
+            iSettingPageOpen = ETrue;
+            CAknSettingItemList::EditItemL( indexForEditing, 
+                                            aCalledFromMenu );
+            StoreSettingsL();            
+            }
+            break;
+        case EAdvancedFindGenre:
+            {
+            iSettingPageOpen = ETrue;
+            CAknSettingItemList::EditItemL( indexForEditing,
+                                            aCalledFromMenu );
+            StoreSettingsL();            
+            }            
+            break;
+        case EAdvancedFindDateFrom:
+            {           
+            iSettingPageOpen = ETrue; 
+            CAknSettingItemList::EditItemL( indexForEditing, 
+                                            aCalledFromMenu );            
+            StoreSettingsL();
+            }
+            break;
+        case EAdvancedFindDateUntil:
+            {            
+            iSettingPageOpen = ETrue;
+            CAknSettingItemList::EditItemL( indexForEditing, 
+                                            aCalledFromMenu );
+            StoreSettingsL();
+            
+            }
+            break;            
+        default:
+            break;
+        }
+    
+    iSettingPageOpen = EFalse;    
+    //load settings to screen
+    CAknSettingItemList::LoadSettingsL();
+    CAknSettingItemList::DrawDeferred();
+    
+    
+    if( iClose )
+        {
+        MediaServerDisappearedL(iCloseReason);
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::MakeQueryL
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAdvancedFindList::MakeQueryL()
+    {
+    //Search criteria string
+    HBufC8* searchCriteria = BuildSearchCriteriaL();
+    CleanupStack::PushL( searchCriteria );
+
+    HBufC8* sortCriteria = KSortCriteria().AllocL();
+    CleanupStack::PushL( sortCriteria );
+
+    iAction = CUPnPCommonUI::EUPnPSearch;
+    // Make the search request
+    iBrowseSession.SearchL( 
+                        KContainerIdRoot,     /* object id of the container */
+                        *searchCriteria,      /* criteria */
+                        KFilterCommon,        /* filter */
+                        0,                    /* start index */
+                        KMaxRequestCount + 1, /* request count + 1 */
+                        *sortCriteria );      /* sort criteria */
+    CleanupStack::PopAndDestroy( sortCriteria );
+    CleanupStack::PopAndDestroy( searchCriteria );            
+
+    TInt ret = KErrNone;
+    iWaitNoteDialog = new(ELeave) CAknWaitDialog( (
+                                  REINTERPRET_CAST( CEikDialog**,
+                                                    &iWaitNoteDialog ) ),
+                                                    ETrue );
+    iWaitNoteDialog->SetCallback( this );
+ 
+    ret = iWaitNoteDialog->ExecuteLD( 
+                R_UPNPCOMMONUI_ADVANCEDFIND_WAIT_NOTE_DIALOG );
+
+    //Make result window
+    //ret is KErrNone only when the DialogDismissedL by the FW.
+    // ( not canceling)
+    if( ret != KErrNone && iExitCode == KErrNone )
+        {
+        //If there was more than request count received
+        if( iResultArray.Count() > KMaxRequestCount )
+            {
+            //Delete Item from array
+            delete iResultArray[KMaxRequestCount];
+            //Remove from array
+            iResultArray.Remove( KMaxRequestCount );
+
+            iShowingErrorNote = ETrue;
+            //Display error note
+            iCommonUI.DisplayErrorTextL(
+                        R_UPNPCOMMONUI_ADVANCED_FIND_TOO_MANY_RESULTS_ERROR,
+                        KMaxRequestCount );
+            iShowingErrorNote = EFalse;            
+            }        
+        
+        // During running DisplayErrorTextL() 
+        // We also need to care about whether iExitCode been changed or not.
+        if ( iExitCode != KErrNone )
+            {
+            iResultArray.ResetAndDestroy();
+            return iExitCode;
+            }
+        else
+            {
+            iFindResultWindow = CAdvancedFindResultWindow::NewL(
+                    R_UPNPCOMMONUI_RESULT_WINDOW_MENUBAR,
+                    iResultArray,
+                    iAVControl,
+                    iBrowseSession,
+                    iCommonUI );
+
+            iFindResultWindow->SetMopParent( this );
+            
+            iShowingErrorNote = ETrue;
+            
+            iExitCode = iFindResultWindow->ExecuteLD( 
+                            R_UPNPCOMMONUI_ADVANCED_FIND_RESULT_DIALOG );
+            iShowingErrorNote = EFalse;
+            
+            iFindResultWindow = NULL;
+            }          
+        }
+    CAknSettingItemList::LoadSettingsL();
+    CAknSettingItemList::DrawDeferred();
+
+    //Delete result array
+    iResultArray.ResetAndDestroy();
+    iSearchResponseReceived = EFalse;
+    
+    if( iExitCode != KErrSessionClosed && 
+        iExitCode != KErrDisconnected &&
+        iExitCode != EAknCmdExit &&
+        iExitCode != EEikCmdExit )
+        {
+        iExitCode = KErrNone;
+        }
+    __LOG( "CUPnPAdvancedFindList::MakeQueryL End" );
+    return iExitCode;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::HandleResourceChange
+// --------------------------------------------------------------------------
+//
+void CUPnPAdvancedFindList::HandleResourceChange( TInt aType ) 
+    {
+    __LOG( "CUPnPAdvancedFindList::HandleResourceChange" );
+    
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect mainPaneRect;
+        AknLayoutUtils::LayoutMetricsRect(
+            AknLayoutUtils::EMainPane, mainPaneRect );        
+        
+        TAknLayoutRect layoutRect;
+        layoutRect.LayoutRect(
+            TRect( TPoint( 0, 0 ), mainPaneRect.Size() ),
+            AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
+                
+        ListBox()->SetRect( layoutRect.Rect() );
+        }
+        
+    // Base call
+    CAknSettingItemList::HandleResourceChange( aType );
+    }    
+    
+    
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::BuildSearchCriteriaL
+// --------------------------------------------------------------------------
+//
+HBufC8* CUPnPAdvancedFindList::BuildSearchCriteriaL() const
+    {
+    __LOG( "CUPnPAdvancedFindList::BuildSearchCriteriaL" );   
+    //Search criteria string
+    HBufC8* searchCriteria = NULL;
+    HBufC8* tmpStr = NULL;
+
+    //Date variables for handling date search
+    TBuf8<KTmpDateFormatLength> tmpDateFormat;
+    TDateTime tmpDate;
+
+    searchCriteria = HBufC8::NewL(
+        KElementClass().Length() +
+        KCriteriaSpace().Length() +
+        KCriteriaDerivedFrom().Length() +
+        KCriteriaSpace().Length() +
+        KCriteriaQuot().Length() +
+        KClassVideo().Length() +
+        KCriteriaQuot().Length() +
+        KCriteriaSpace().Length() +
+        KCriteriaAnd().Length() +
+        KCriteriaSpace().Length() +
+        KAttributeRefID().Length() +
+        KCriteriaSpace().Length() +
+        KCriteriaExists().Length() +
+        KCriteriaSpace().Length() +
+        KCriteriaFalse().Length() );
+    TPtr8 strPtr = searchCriteria->Des();
+
+    strPtr.Copy( KElementClass() );
+    strPtr.Append( KCriteriaSpace );
+    strPtr.Append( KCriteriaDerivedFrom );
+    strPtr.Append( KCriteriaSpace );
+    strPtr.Append( KCriteriaQuot );
+
+    //Set search for the mediatype
+    __LOG1( "iMediatype: %d", iMediatype );
+    switch( iMediatype )
+        {
+        case EAdvancedFindAll:
+            {
+            strPtr.Append( KClassItem() );
+            break;
+            }
+        case EAdvancedFindImages:
+            {
+            strPtr.Append( KClassImage() );
+            break;
+            }
+        case EAdvancedFindVideo:
+            {
+            strPtr.Append( KClassVideo() );
+            break;
+            }
+        case EAdvancedFindMusic:
+            {
+            strPtr.Append( KClassAudio() );
+            break;
+            }
+        default:
+            {
+            __PANICD( __FILE__, __LINE__ );
+            break;
+            }
+        }
+
+    strPtr.Append( KCriteriaQuot );
+    strPtr.Append( KCriteriaSpace );
+    strPtr.Append( KCriteriaAnd );
+    strPtr.Append( KCriteriaSpace );
+    strPtr.Append( KAttributeRefID );
+    strPtr.Append( KCriteriaSpace );
+    strPtr.Append( KCriteriaExists );
+    strPtr.Append( KCriteriaSpace );
+    strPtr.Append( KCriteriaFalse );
+    CleanupStack::PushL( searchCriteria );
+
+    //Check if filename has been entered to search criteria
+    __LOG1( "iFileName.Length: %d", iFileName.Length() );
+    if( iFileName.Length() > 0 )
+        {  
+        __LOG( "add name condition" );
+        tmpStr = UpnpString::FromUnicodeL( iFileName );
+        
+        //If inserted, add to search string
+        searchCriteria = searchCriteria->ReAllocL(
+            searchCriteria->Length() +
+            KCriteriaSpace().Length() +
+            KCriteriaAnd().Length() +
+            KCriteriaSpace().Length() +
+            KElementTitle().Length() +
+            KCriteriaSpace().Length() +
+            KCriteriaContains().Length() +
+            KCriteriaSpace().Length() +
+            KCriteriaQuot().Length() +
+            tmpStr->Length() +
+            KCriteriaQuot().Length() 
+            );
+        
+        //pop out the old searchCriteria
+        CleanupStack::Pop();
+        //push the new searchCriteria which is created by ReAllocL
+        CleanupStack::PushL( searchCriteria );
+        
+        strPtr.Set( searchCriteria->Des() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaAnd() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KElementTitle() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaContains() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaQuot() );
+        strPtr.Append( *tmpStr );
+        strPtr.Append( KCriteriaQuot() );
+        delete tmpStr;
+        tmpStr = NULL;
+        
+        }
+
+    //Add possibly artists to search criteria
+    if( iArtistText.Length() > 0 && iMediatype == EAdvancedFindMusic )
+        {
+        __LOG( "add artists condition" );
+        tmpStr = UpnpString::FromUnicodeL( iArtistText );
+        searchCriteria = searchCriteria->ReAllocL(
+             searchCriteria->Length() +
+             KCriteriaSpace().Length() +
+             KCriteriaAnd().Length() +
+             KCriteriaSpace().Length() +
+             KCriteriaOB().Length() +
+             KElementArtist().Length() +
+             KCriteriaSpace().Length() +
+             KCriteriaContains().Length() +
+             KCriteriaSpace().Length() +
+             KCriteriaQuot().Length() +
+             tmpStr->Length() + 
+             KCriteriaQuot().Length() +
+             KCriteriaSpace().Length() +
+             KCriteriaCB().Length()
+             ); 
+
+       //pop out the old searchCriteria
+        CleanupStack::Pop();
+        //push the new searchCriteria which is created by ReAllocL
+        CleanupStack::PushL( searchCriteria ); 
+
+        strPtr.Set( searchCriteria->Des() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaAnd() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaOB() );
+        strPtr.Append( KElementArtist() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaContains() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaQuot() );
+        strPtr.Append( *tmpStr ); //Artist name
+        strPtr.Append( KCriteriaQuot() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaCB() );
+        delete tmpStr;
+        tmpStr = NULL;
+        }
+
+    //Add possibly albums to search criteria
+    if( iAlbumText.Length() > 0 && iMediatype == EAdvancedFindMusic )
+        {
+        __LOG( "add albums condition" );
+        tmpStr = UpnpString::FromUnicodeL( iAlbumText );
+        searchCriteria = searchCriteria->ReAllocL(
+            searchCriteria->Length() +
+            KCriteriaSpace().Length() + 
+            KCriteriaAnd().Length() + 
+            KCriteriaSpace().Length() + 
+            KCriteriaOB().Length() + 
+            KElementAlbum().Length() + 
+            KCriteriaSpace().Length() + 
+            KCriteriaContains().Length() + 
+            KCriteriaSpace().Length() + 
+            KCriteriaQuot().Length() + 
+            tmpStr->Length() + 
+            KCriteriaQuot().Length() + 
+            KCriteriaSpace().Length() + 
+            KCriteriaCB().Length() 
+            );
+
+        //pop out the old searchCriteria
+        CleanupStack::Pop();
+        //push the new searchCriteria which is created by ReAllocL
+        CleanupStack::PushL( searchCriteria );
+
+        strPtr.Set( searchCriteria->Des() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaAnd() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaOB() );
+        strPtr.Append( KElementAlbum() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaContains() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaQuot() );
+        strPtr.Append( *tmpStr ); //Artist name
+        strPtr.Append( KCriteriaQuot() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaCB() );
+        delete tmpStr;
+        tmpStr = NULL;
+        }
+
+    //Add possibly genres to search criteria
+    if( iGenreText.Length() > 0 && iMediatype == EAdvancedFindMusic )
+        {
+        __LOG( "add genres condition" );
+        tmpStr = UpnpString::FromUnicodeL( iGenreText );
+
+        searchCriteria = searchCriteria->ReAllocL(
+            searchCriteria->Length() +
+            KCriteriaSpace().Length() + 
+            KCriteriaAnd().Length() + 
+            KCriteriaSpace().Length() + 
+            KCriteriaOB().Length() + 
+            KElementGenre().Length() + 
+            KCriteriaSpace().Length() + 
+            KCriteriaContains().Length() + 
+            KCriteriaSpace().Length() + 
+            KCriteriaQuot().Length() + 
+            tmpStr->Length() + 
+            KCriteriaQuot().Length() + 
+            KCriteriaSpace().Length() + 
+            KCriteriaCB().Length() 
+            );
+
+        //pop out the old searchCriteria
+        CleanupStack::Pop();
+        //push the new searchCriteria which is created by ReAllocL
+        CleanupStack::PushL( searchCriteria );
+                                                
+        strPtr.Set( searchCriteria->Des() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaAnd() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaOB() );
+        strPtr.Append( KElementGenre() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaContains() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaQuot() );
+        strPtr.Append( *tmpStr ); //Genre name
+        strPtr.Append( KCriteriaQuot() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaCB() );
+        delete tmpStr;
+        tmpStr = NULL;
+        }
+
+    // To check whether need to add time condition
+    TBool addTimeCondition = ETrue;
+    
+    if( iFileName.Length() > 0 )
+        {
+        __LOG( "iFileName > 0" );
+        
+        // Make temp TDateTime item with current home time to compare with date
+        // until.
+        TTime tempTTimeforCurrent;
+        tempTTimeforCurrent.HomeTime();
+        TDateTime tempTDateTimeforCurrent = tempTTimeforCurrent.DateTime();
+        TDateTime tempTDateTimeforUntil = iDateUntil.DateTime();
+        TBuf8<KTmpDateFormatLength> tempDateFormatCurrent;
+        TBuf8<KTmpDateFormatLength> tempDateFormatUntil;
+        tempDateFormatCurrent.Format( KTimeFormat8(),
+            tempTDateTimeforCurrent.Year(), 
+            tempTDateTimeforCurrent.Month() + 1,
+            tempTDateTimeforCurrent.Day() + 1 );
+        tempDateFormatUntil.Format( KTimeFormat8(),
+            tempTDateTimeforUntil.Year(),
+            tempTDateTimeforUntil.Month() + 1,
+            tempTDateTimeforUntil.Day() +1 );
+                
+        if( ( iDateFrom == iDateInitial ) && 
+                ( tempDateFormatCurrent == tempDateFormatUntil ) )
+            {
+            // Time criterias are not included into the find query
+            // if they are not altered when Title search
+            __LOG( "time criterias are not altered" );
+            addTimeCondition = EFalse;
+            }
+        }
+    
+    if ( addTimeCondition )    
+        {
+        __LOG( "add time conditions" );
+        
+        // Add time from
+        tmpDate = iDateFrom.DateTime();
+        //Format the date according to UPnP
+        tmpDateFormat.Format( KTimeFormat8, 
+            tmpDate.Year(), 
+            tmpDate.Month() + 1,
+            tmpDate.Day() + 1 );
+
+        searchCriteria = searchCriteria->ReAllocL(
+            searchCriteria->Length() +
+            KCriteriaSpace().Length() +
+            KCriteriaAnd().Length() +
+            KCriteriaSpace().Length() +
+            KElementDate().Length() +
+            KCriteriaSpace().Length() +
+            KCriteriaGTE().Length() +
+            KCriteriaSpace().Length() +
+            KCriteriaQuot().Length() +
+            tmpDateFormat.Length() +
+            KCriteriaQuot().Length()  
+            );
+        CleanupStack::Pop();
+        CleanupStack::PushL( searchCriteria );
+    
+        strPtr.Set( searchCriteria->Des() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaAnd() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KElementDate() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaGTE() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaQuot() );
+        strPtr.Append( tmpDateFormat );
+        strPtr.Append( KCriteriaQuot() );
+    
+        // Add time until
+        tmpDate = iDateUntil.DateTime();
+        tmpDateFormat.Format( KTimeFormat8,
+            tmpDate.Year(), 
+            tmpDate.Month() + 1, 
+            tmpDate.Day() + 1 );
+    
+        searchCriteria = searchCriteria->ReAllocL(
+            searchCriteria->Length() +
+            KCriteriaSpace().Length() +
+            KCriteriaAnd().Length() +
+            KCriteriaSpace().Length() +
+            KElementDate().Length() +
+            KCriteriaSpace().Length() +
+            KCriteriaLTE().Length() +
+            KCriteriaSpace().Length() +
+            KCriteriaQuot().Length() +
+            tmpDateFormat.Length() +
+            KCriteriaQuot().Length()  
+            );
+        CleanupStack::Pop();
+        CleanupStack::PushL( searchCriteria );                            
+    
+        strPtr.Set( searchCriteria->Des() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaAnd() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KElementDate() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaLTE() );
+        strPtr.Append( KCriteriaSpace() );
+        strPtr.Append( KCriteriaQuot() );
+        strPtr.Append( tmpDateFormat );
+        strPtr.Append( KCriteriaQuot() );
+        }
+
+    //Encode the searchcriteria for xml compatibility
+    HBufC8* xmlEncodedSearchCriteria = 
+                            UpnpString::EncodeXmlStringL( searchCriteria );
+    
+    CleanupStack::PopAndDestroy( searchCriteria ); //searchCriteria
+    
+    __LOG( "CUPnPAdvancedFindList::BuildSearchCriteriaL - end" );
+    return xmlEncodedSearchCriteria;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAdvancedFindList::IsSettingPageOpen
+// --------------------------------------------------------------------------
+//
+TBool CUPnPAdvancedFindList::IsSettingPageOpen() const
+    {
+    return iSettingPageOpen;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpadvfindresultwindow.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1640 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Find results dialog class source code
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <featmgr.h>
+#include <akntabgrp.h>
+#include <StringLoader.h>
+#include <aknlists.h>
+#include <commondialogs.mbg>
+#include <aknnotewrappers.h>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+// upnp stack api's
+#include <upnpitem.h>
+#include <upnpobject.h>
+#include <upnpstring.h>
+#include <collate.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h"   //start browse session and rendering session
+#include "upnpavbrowsingsession.h"
+#include "upnpavrenderingsession.h"
+#include "upnpavdevice.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // upnp definitions
+#include "upnpitemutility.h"
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"
+#include "upnpfiletransferengine.h"
+#include "upnpmusicadapter.h"
+#include "upnpplaylistfiller.h"
+
+// common ui internal
+#include <hlplch.h>
+#include <upnpcommonui.mbg>
+#include <upnpcommonui.rsg>
+#include "upnpadvfindresultwindow.h"
+#include "upnpcommonui.hrh"
+#include "upnpimageplayer.h"
+#include "upnplocalplayer.h"
+#include "upnpcommonui.h"
+#include "upnpperiodic.h"
+
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+//CONSTANTS
+_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" );
+const TInt KMbmFileBufferSize = 256;
+_LIT8( KUnknown,    "Unknown" );
+_LIT( KUPNP_HLP_SEARCH, "UPNP_HLP_SEARCH" );
+
+// Format string for image not showing
+_LIT( KImageFormatString,  "%d\t%S\t\t" );
+
+// Format string for image showing
+_LIT( KImageShowingFormatString, "%d\t%S\t\t%d" );
+
+const TInt KLength = 100;
+
+// The delay from the Start() function of CPeriodic class 
+// to the generation of the first event, in microseconds.
+const TInt KImageTimerDelay = 800000;
+
+// A callback specifying a function to be called 
+// when the CPeriodic is scheduled after a timer event, in microseconds.
+const TInt KImageTimerInterval = 800000;
+
+enum TUPnPIconTypes
+    {
+    EUPnPIconMusic = 1,
+    EUPnPIconVideo,
+    EUPnPIconImage,
+    EUPnPIconImageShowing,
+    EUPnPIconOther,
+    EUPnPIconLast
+    };
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CAdvancedFindResultWindow* CAdvancedFindResultWindow::NewL(
+                                    TInt aMenuResource,
+                                    RPointerArray<CUpnpObject>& aResultArray,
+                                    MUPnPAVController& aAVControl,
+                                    MUPnPAVBrowsingSession& aBrowseSession,
+                                    CUPnPCommonUI& aCommonUI )
+    {    
+    CAdvancedFindResultWindow* self = new(ELeave) CAdvancedFindResultWindow(
+                                                            aAVControl,
+                                                            aBrowseSession,
+                                                            aCommonUI );
+    CleanupStack::PushL( self );
+    self->ConstructL( aMenuResource, aResultArray );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+
+void CAdvancedFindResultWindow::ConstructL( 
+                                TInt aMenuResource,
+                                RPointerArray<CUpnpObject>& aResultArray )
+    {
+
+
+
+    iTargetDevice = CUpnpAVDevice::NewL();
+    
+    iImageControlTimer = CUPnPPeriodic::NewL( CActive::EPriorityUserInput );
+        
+    //iCommonUI = CUPnPCommonUI::NewL();
+
+    for( TInt index = 0; index < aResultArray.Count(); index++ )
+        {
+        iResultArray.AppendL( aResultArray[index] );
+        }
+            
+    CAknDialog::ConstructL( aMenuResource );
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::CAdvancedFindResultWindow
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+
+CAdvancedFindResultWindow::CAdvancedFindResultWindow(
+                                    MUPnPAVController& aAVControl,
+                                    MUPnPAVBrowsingSession& aBrowseSession,
+                                    CUPnPCommonUI& aCommonUI ):
+                                    iBrowseSession(aBrowseSession),
+                                    iAVControl(aAVControl),
+                                    iCommonUI(aCommonUI)
+    {
+    iSourceDevice = &( iBrowseSession.Device() );
+    iChildDialogOpen = 0;
+    iMSDisappear = EFalse;
+    iAction = CUPnPCommonUI::EUPnPNone;
+    iIsMusicItem = EFalse;
+    iLastImageItemIndex = KErrNotFound;
+    iHashKeyFlag = EFalse;   
+    }
+
+// Destructor
+CAdvancedFindResultWindow::~CAdvancedFindResultWindow()
+    {
+    if ( iNaviDecorator && iNaviPane )
+        {
+        iNaviPane->Pop( iNaviDecorator );
+        }
+    delete iNaviDecorator;
+    
+    iResultArray.Close();
+    
+    if ( iImagePlayer )
+        {
+        iImagePlayer->Stop();
+        delete iImagePlayer;
+        }
+    delete iLocalPlayer;
+    
+    if ( iImageControlTimer )  
+        {
+        iImageControlTimer->Cancel();
+        delete iImageControlTimer;
+        }
+        
+    delete iTargetDevice;
+    }
+
+// ---------------------------------------------------------
+// CAdvancedFindResultWindow::OkToExitL( TInt aButtonId )
+// called by framework when the softkey is pressed
+// ---------------------------------------------------------
+//
+
+TBool CAdvancedFindResultWindow::OkToExitL( TInt aButtonId )
+    {
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    
+    switch ( aButtonId )        
+        {                
+        case EAknSoftkeyOk:
+            {
+            if ( iResultArray.Count() > 0 )
+                {
+                TRAPD( error, ShowPlayExtL() );
+                HandleErrorL( error );
+                }            
+            break;
+            }
+        case EUPnPStopCmd:
+            {
+            StopImageControlL();
+            break;
+            }
+        case EUPnPPlayCmd:
+            {
+            if( !iMusicPlay )
+                {
+                StopImageControlL();
+                TRAPD( error, PlayL( EFalse ) );
+                if( KErrNone != error )
+                    {
+                    iMusicPlay = EFalse;
+                    }
+                HandleErrorL( error );
+                }           
+            break;            
+            }
+        case EAknSoftkeyShow:
+            {
+            StopImageControlL();
+            TRAPD( error, ShowVideoExtL() );
+            HandleErrorL( error );
+            break;
+            }            
+        case KErrSessionClosed: 
+        case KErrDisconnected:
+        case EAknCmdExit: // fall through
+        case EAknSoftkeyBack:
+            {
+            iNaviPane->PushDefaultL();
+            return ETrue;
+            }
+        case EAknSoftkeyOptions:
+            {
+            CAknDialog::DisplayMenuL();
+            SetNaviPaneTextL();   
+            break;
+            }
+        default:
+            {
+            break;
+            }//switch (aButtonId) 
+        }
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------
+// CAdvancedFindResultWindow::PreLayoutDynInitL()
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CAdvancedFindResultWindow::PreLayoutDynInitL()
+    {
+    iListBox = static_cast<CAknDoubleGraphicStyleListBox*>( 
+                                            Control(EAdvFindResultBoxId) );
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+            CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+    CAknIconArray* icons = new (ELeave) CAknIconArray( EUPnPIconLast );
+    CleanupStack::PushL( icons );
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) );
+    
+    
+    TFileName mbmFileName( KAknCommonUIMbmFileName );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    mbmFileName.Insert( 0, drive );
+    
+    
+    //marked icon
+    AppendIconToArrayL( icons,
+        skin,
+        KAvkonBitmapFile,
+        KAknsIIDQgnIndiMarkedAdd,
+        EMbmAvkonQgn_indi_marked_add,
+        EMbmAvkonQgn_indi_marked_add_mask );
+    // Music icon
+    AppendIconToArrayL( icons,
+        skin,
+        mbmFileName,
+        KAknsIIDDefault,
+        EMbmUpnpcommonuiQgn_prop_mserv_music,
+        EMbmUpnpcommonuiQgn_prop_mserv_music_mask );
+     // Video icon
+    AppendIconToArrayL( icons,
+        skin,
+        mbmFileName,
+        KAknsIIDDefault,
+        EMbmUpnpcommonuiQgn_prop_mserv_other_videos,
+        EMbmUpnpcommonuiQgn_prop_mserv_other_videos_mask );
+    // Image icon
+    AppendIconToArrayL( icons,
+        skin,
+        mbmFileName,
+        KAknsIIDDefault,
+        EMbmUpnpcommonuiQgn_prop_mserv_other_images,
+        EMbmUpnpcommonuiQgn_prop_mserv_other_images_mask );
+    // Image showing icon
+    AppendIconToArrayL( icons,
+        skin, 
+        mbmFileName, 
+        KAknsIIDDefault, 
+        EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon, 
+        EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon_mask );
+    //Other icon
+    AppendIconToArrayL( icons,
+        skin,
+        KCommonDialogsBitmapFile,
+        KAknsIIDQgnPropFmgrFileSound,
+        EMbmCommondialogsQgn_prop_fmgr_file_other,
+        EMbmCommondialogsQgn_prop_fmgr_file_other_mask );
+    iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons );
+    CleanupStack::Pop(icons); 
+    // set dialog title
+    CEikStatusPane* statusPane = 
+                    ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane();
+    iTitlePane = (CAknTitlePane*)statusPane->ControlL( 
+                                       TUid::Uid( EEikStatusPaneUidTitle ) );
+    // Set the text string.
+    HBufC* tempStr = StringLoader::LoadLC( 
+                    R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_TITLE ); 
+    iTitlePane->SetTextL( *tempStr );
+    CleanupStack::PopAndDestroy( tempStr );
+    LoadListItemsL();
+    SetNaviPaneTextL();
+    iListBox->ActivateL();
+    }
+
+// ---------------------------------------------------------
+// CAdvancedFindResultWindow::PostLayoutDynInitL()
+// Called by framework before dialog is shown.
+// Needed because filter is not active until PreLayoutDynInitL().
+// ---------------------------------------------------------
+//
+/*void  CAdvancedFindResultWindow::PostLayoutDynInitL()
+    {
+    }*/
+    
+// ---------------------------------------------------------
+// CAdvancedFindResultWindow::OfferKeyEventL()
+// called by framework when key is pressed
+// ---------------------------------------------------------
+//
+TKeyResponse CAdvancedFindResultWindow::OfferKeyEventL ( 
+                                                const TKeyEvent &aKeyEvent,
+                                                TEventCode aType )
+    {
+    TInt tempCounter = iListBox->CurrentItemIndex();
+    if (aType != EEventKey)
+        {
+        if ( aKeyEvent.iScanCode == EStdKeyHash )
+            {
+            if ( aType == EEventKeyDown )
+                {
+                iHashKeyFlag = ETrue;
+                }
+            else
+                {
+                iHashKeyFlag = EFalse;
+                }
+            }
+        iListBox->OfferKeyEventL( aKeyEvent, aType ); 
+
+        if ( aType == EEventKeyUp && !iHashKeyFlag )
+            {      
+            if ( !iImageControlActive )
+                {
+                const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+                if ( indexes->Count() )
+                    {
+                    UpdateCommandButtonAreaL( ETrue, tempCounter );
+                    }
+                else
+                    {
+                    UpdateCommandButtonAreaL( EFalse, tempCounter );
+                    }               
+                }                        
+            }
+        return EKeyWasConsumed;
+        }
+    else
+        {
+        if ( aKeyEvent.iCode == EKeyDownArrow ||
+         aKeyEvent.iCode == EKeyUpArrow )
+            {               
+            if ( iImageControlActive )
+                {
+                iImageControlTimer->Cancel();
+                StartImageControlTimer();
+                }
+            
+            if ( aKeyEvent.iCode == EKeyDownArrow )
+                {
+                tempCounter++;
+                }
+            else
+                {
+                tempCounter--;
+                }
+            if ( tempCounter >= iResultArray.Count() )
+                {
+                tempCounter = 0;
+                }
+            if ( tempCounter < 0 )
+                {
+                tempCounter = iResultArray.Count()-1;
+                }
+            if( iImageControlActive )
+                {
+                if( UPnPItemUtility::BelongsToClass( 
+                        *iResultArray[tempCounter], KClassImage ) ) // image  
+                    {
+                    UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
+                    }
+                else if ( UPnPItemUtility::BelongsToClass( 
+                        *iResultArray[tempCounter], KClassVideo ) ) // video
+                    {
+                    UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_SHOW_STOP );
+                    }
+                else if ( UPnPItemUtility::BelongsToClass( 
+                        *iResultArray[tempCounter], KClassAudio ) ) // music
+                    {
+                    UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_PLAY_STOP );
+                    }    
+                else
+                    {
+                    UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
+                    }    
+                }
+             }
+            
+        CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+        if ( ( tempCounter < iResultArray.Count() ) && tempCounter > -1 )
+            {
+            if ( !iImageControlActive )
+                {
+                const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+                if ( indexes->Count() )
+                    {
+                    UpdateCommandButtonAreaL( ETrue, tempCounter );
+                    }
+                else
+                    {
+                    UpdateCommandButtonAreaL( EFalse, tempCounter );
+                    }               
+                }
+            } 
+        }
+    return EKeyWasConsumed;
+    }
+
+// ---------------------------------------------------------
+// CAdvancedFindResultWindow::SetNaviPaneText()
+// Sets navi pane text referring to the count of selected files
+// ---------------------------------------------------------
+//
+void CAdvancedFindResultWindow::SetNaviPaneTextL()
+    {
+    TInt itemCount = iResultArray.Count();    
+    HBufC* naviText;
+    if (itemCount == 1)
+        {        
+        naviText = StringLoader::LoadLC( 
+                    R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILE, 
+                    itemCount );
+        
+        }
+    else
+        {
+        naviText = StringLoader::LoadLC( 
+                    R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILES,
+                    itemCount );
+        }
+    // push text to navi pane
+    CEikStatusPane* statusPane = 
+                    ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane();
+    iNaviPane = ( CAknNavigationControlContainer * )statusPane->ControlL(
+                                         TUid::Uid(EEikStatusPaneUidNavi ) );
+    // delete previous navidecorator
+    delete iNaviDecorator; iNaviDecorator = NULL;
+
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( *naviText );
+    iNaviPane->PushL( *iNaviDecorator );
+    CleanupStack::PopAndDestroy( naviText );    
+    DrawDeferred();
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::AppendIconToArrayL
+// Load a possibly skinned icon (with mask) and append it to an
+// icon array.
+// --------------------------------------------------------------------------
+//
+
+void CAdvancedFindResultWindow::AppendIconToArrayL( CAknIconArray* aArray,
+                                                    MAknsSkinInstance* aSkin,
+                                                    const TDesC& aMbmFile,
+                                                    const TAknsItemID& aID,
+                                                    TInt aBitmapId,
+                                                    TInt aMaskId )
+    {    
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+    TBuf<KMbmFileBufferSize> buffer( aMbmFile );
+    AknsUtils::CreateIconLC( aSkin, aID, bitmap, mask,
+                             aMbmFile, aBitmapId, aMaskId );
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally( EFalse );
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop( mask );
+    CleanupStack::Pop( bitmap );     
+    bitmap = NULL;
+    mask = NULL;
+    CleanupStack::PushL( icon );
+    aArray->AppendL( icon );
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop( icon );
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::ProcessCommandL
+// --------------------------------------------------------------------------
+//
+void CAdvancedFindResultWindow::ProcessCommandL( TInt aCommand )
+    {
+    TInt error = KErrNone;
+    
+    HideMenu();
+    TInt selected_item = iListBox->CurrentItemIndex();
+    switch (aCommand)
+        {
+        case EUPnPPlayExt:
+        case EUPnPShowExt: //fall through
+            {
+            TRAP( error, ShowPlayExtL() );
+            break;
+            }
+        case EUPnPPlayLocal: //    
+        case EUPnPShowLocal: //fall through
+            {
+            TRAP( error, ShowPlayLocalL() );
+            if( KErrSessionClosed == error )
+                {
+                iMSDisappear = ETrue;
+                }
+            break;
+            }
+        case EUPnPCopy:
+            {
+            TRAP( error, HandleCopyL() );
+            if( KErrNotFound == error )
+                {
+                iCopyIndex = 0; 
+                }
+            if( error == KErrSessionClosed ) //if server lost
+                {
+                iMSDisappear = ETrue;
+                }
+            break;
+            }           
+        case EAknCmdHelp:
+            {
+            TRAPD( error, HlpLauncher::LaunchHelpApplicationL(
+                iEikonEnv->WsSession(),
+                iEikonEnv->EikAppUi()->AppHelpContextL() ) );
+            if ( error != KErrNone )
+                {
+                __LOG1( "CAdvancedFindResultWindow: \
+    LaunchHelpApplicationL returned err=%d", error );
+                }     
+            break;
+            }
+        case EAknCmdMark:
+            {
+            MarkUnmarkL( iListBox->CurrentItemIndex(), ETrue );
+            break;
+            }
+        case EAknMarkAll:
+            {
+            MarkUnmarkL( -1, ETrue );
+            break;
+            }
+        case EAknCmdUnmark:
+            {
+            MarkUnmarkL( iListBox->CurrentItemIndex(), EFalse );
+            break;
+            }
+        case EAknUnmarkAll:
+            {
+            MarkUnmarkL( -1, EFalse );
+            break;
+            }
+        case EAknCmdExit:
+            {
+            //User::Exit(0);
+            TryExitL( aCommand ); //no need to go to next
+            return;
+            }    
+        default:
+            CAknDialog::ProcessCommandL( aCommand );
+            break;
+        }   
+    HandleErrorL( error );  
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::MarkUnmarkL
+// --------------------------------------------------------------------------
+//
+void CAdvancedFindResultWindow::MarkUnmarkL( TInt aItem, TBool aMark )
+    {    
+    CTextListBoxModel* model = iListBox->Model();
+    TInt itemCount = model->NumberOfItems();
+    CListBoxView* listBoxView = iListBox->View();
+    if ( aMark )
+        {
+        for ( TUint i = 0; i < itemCount; i++ )
+            {
+            if ( aItem == -1 || aItem == i )
+                {
+                listBoxView->SelectItemL( i );                
+                }
+            }
+        UpdateCommandButtonAreaL( ETrue, iListBox->CurrentItemIndex() );
+        }
+    else
+        {
+        for ( TUint i = 0; i < itemCount; i++ )
+            {
+            if ( aItem == -1 || aItem == i )
+                {
+                listBoxView->DeselectItem( i );
+                }
+            }
+        const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+        if ( indexes->Count() )
+            {
+            UpdateCommandButtonArea( ETrue, iListBox->CurrentItemIndex() );
+            }
+        else
+            {
+            UpdateCommandButtonArea( EFalse, iListBox->CurrentItemIndex() );
+            }        
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::PlayL
+// --------------------------------------------------------------------------
+void CAdvancedFindResultWindow::PlayL( TBool aLocal )
+    {
+    TInt error = KErrNone;
+    
+    // create a playlist representation
+    CUPnPPlayListFiller* filler = 
+                    CUPnPPlayListFiller::NewL();
+    CleanupStack::PushL( filler );
+    TInt firstAudioItem = KErrNotFound;
+    TBool focusedItemFound = EFalse;
+    const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+    if ( indexes->Count() > 0 )
+        {
+        // play the marked files
+        for (TInt i = 0; i < indexes->Count(); i++)
+            {
+            filler->InsertObjectL(
+                         *iSourceDevice, *iResultArray[ indexes->At( i ) ] );
+            
+            if( UPnPItemUtility::BelongsToClass( 
+                *iResultArray[ indexes->At(i) ], KClassAudio )
+                && firstAudioItem == KErrNotFound )
+                {
+                firstAudioItem = i;
+                }
+            if( iResultArray[ indexes->At( i ) ]->Id()
+                == iResultArray[ iListBox->CurrentItemIndex() ]->Id() )
+                {
+                filler->SetSelectedIndex( i );
+                focusedItemFound = ETrue;
+                }
+            }
+
+        if( !focusedItemFound )
+            {
+            filler->SetSelectedIndex( firstAudioItem );
+            }
+        }
+    else
+        {
+        // play all found files
+        for( TInt i = 0; i < iResultArray.Count(); i++ )
+            {
+            filler->InsertObjectL(
+                *iSourceDevice, *iResultArray[ i ] );
+            }
+        filler->SetSelectedIndex( iListBox->CurrentItemIndex() );
+        }
+
+    if( !aLocal )
+        {
+        
+        iChildDialogOpen++;
+        error = iCommonUI.SelectDeviceL(
+                              iAVControl,
+                              *iTargetDevice,
+                              EUPnPSearchRenderingDevicesWithAudioCapability,
+                              EUPnPSelectDeviceTitle );       
+        if ( KErrNone == error )
+            {
+            CleanupStack::Pop( filler ); // musicadapter handles delete
+            
+            iMusicPlay = ETrue;
+            //filler ownership transferred
+            error = iCommonUI.ExecuteMusicPlayerL( iAVControl, 
+                                                   filler, 
+                                                   iTargetDevice );
+            iMusicPlay = EFalse;                                       
+            iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL(
+                                    R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+            iAvkonEnv->LoadAknLayoutL();
+            iAvkonAppUi->ReportResourceChangedToAppL(
+                                KEikDynamicLayoutVariantSwitch );
+          
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy( filler );
+            }
+        iChildDialogOpen--;
+        }
+    else
+        {
+        CleanupStack::Pop( filler );
+        iChildDialogOpen++;
+        iMusicPlay = ETrue;
+        //filler ownership transferred
+        error = iCommonUI.ExecuteMusicPlayerL( iAVControl, filler, NULL );
+        iMusicPlay = EFalse;
+        iChildDialogOpen--;
+        iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL(
+                                    R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+        iAvkonEnv->LoadAknLayoutL();
+        iAvkonAppUi->ReportResourceChangedToAppL(
+                            KEikDynamicLayoutVariantSwitch );
+        }
+    if( KErrNone != error )
+        {
+        User::Leave( error );    
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::ShowPlayExtL
+// --------------------------------------------------------------------------
+void CAdvancedFindResultWindow::ShowPlayExtL()
+    {
+    //if audio file is either in marked items or highlighted, play it
+    const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+    if ( indexes->Count() )
+        {
+        if( IsAudioItemMarked() && !iMusicPlay )
+            {
+            TRAPD( err, PlayL( EFalse ) );
+            if( KErrNone != err )
+                {
+                iMusicPlay = EFalse;
+                }
+            }    
+        }
+    else // if no marked items
+        {
+        if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
+                          ObjectClass().Find( KClassVideo ) == 0 )
+            {
+            ShowVideoExtL();
+            }
+        else if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
+                              ObjectClass().Find( KClassImage ) == 0 )
+            {
+            ShowImageExtL();
+            }    
+        else if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
+                          ObjectClass().Find( KClassAudio ) == 0 && 
+                          !iMusicPlay )    
+            {
+            PlayL( EFalse );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::ShowPlayLocalL
+// --------------------------------------------------------------------------
+void CAdvancedFindResultWindow::ShowPlayLocalL()
+    {
+    //if audio file is either in marked items or highlighted, play it
+    const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+    if ( !iMusicPlay && UPnPItemUtility::BelongsToClass(
+        *iResultArray[iListBox->CurrentItemIndex()], KClassAudio) )
+        {
+        TRAPD( err, PlayL( ETrue ) );
+        if( KErrNone != err )
+            {
+            iMusicPlay = EFalse;
+            }
+        }
+    else // if no marked items
+        {
+        if ( !indexes->Count() )
+            {
+            if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
+                ObjectClass().Find( KClassVideo ) == 0 ||
+                 ( iResultArray[iListBox->CurrentItemIndex()] )->
+                        ObjectClass().Find( KClassImage ) == 0 )
+                {
+                 if( !iLocalPlayer )
+                    {
+                    iLocalPlayer = CUPnPLocalPlayer::NewL( iAVControl,
+                                                           iBrowseSession,
+                                                           iCommonUI );
+                    }
+                const CUpnpObject* item = 
+                                iResultArray[iListBox->CurrentItemIndex()];
+                
+                iLocalPlayer->PlayL( *item );
+                }
+            }
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::LoadListItemsL
+// loads items in result array to dialog. 
+// --------------------------------------------------------------------------
+//    
+void CAdvancedFindResultWindow::LoadListItemsL()
+    {
+    MarkUnmarkL( -1, EFalse ); //deselect all items
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+    HBufC16* item = HBufC16::NewL(256);
+    CleanupStack::PushL( item );
+    listBoxItems->Reset();
+    if( !iResultArray.Count() )
+        {
+        // show "no results" text
+        HBufC* noResultsText =  StringLoader::LoadLC( 
+                    R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_NO_RESULTS );
+        iListBox->View()->SetListEmptyTextL( *noResultsText );
+        CleanupStack::PopAndDestroy( noResultsText );
+        }
+    else
+        {
+        for (TInt i=0; i < iResultArray.Count(); i++)
+            {           
+            if( ( iResultArray[i])->
+                    ObjectClass().Find( KClassAudio ) == 0 ) 
+                {
+                if( ( iResultArray[i]->Title().Length() ) != 0 )
+                    {
+                    // Get title and replace illegal characters.
+                    HBufC8* tmptitle = 
+                    UPnPCommonUtils::FixListboxItemTextL( 
+                        iResultArray[ i ]->Title().Left( KLength ) );
+                    
+                    CleanupStack::PushL( tmptitle );
+                    TPtrC8 tmpnameptr = *tmptitle;
+                    iResultArray[i]->SetTitleL( tmpnameptr );
+
+                    HBufC* tmpStr = 
+                        UpnpString::ToUnicodeL( tmpnameptr.Left( KLength ) );
+                    CleanupStack::PushL( tmpStr );
+                    HBufC8* artist = NULL;
+                    
+                    const RUPnPElementsArray& elms = 
+                                        iResultArray[i]->GetElements();
+                    TInt count = elms.Count();
+                    for( TInt i = 0; i < count; i++)
+                        {
+                        if( elms[ i ]->Name() == KElementArtist() )
+                            {
+                            artist = elms[ i ]->Value().AllocL();
+                            i = count;
+                            }
+                        }
+                    if( !artist )
+                        {
+                        TBufC8<7> buf( KUnknown() );
+                        artist = buf.AllocL();
+                        }
+                    CleanupStack::PushL( artist );
+                    HBufC* tmpStr2 = 
+                           UpnpString::ToUnicodeL( artist->Left( KLength ) );
+                    CleanupStack::PushL( tmpStr2 );
+                    item->Des().Format( _L("%d\t%S\t%S\t"), 
+                                        EUPnPIconMusic, 
+                                        tmpStr, 
+                                        tmpStr2 );
+                    CleanupStack::PopAndDestroy( tmpStr2 );
+                    CleanupStack::PopAndDestroy( artist );
+                    CleanupStack::PopAndDestroy( tmpStr );
+                    CleanupStack::PopAndDestroy( tmptitle );
+                    }
+                }
+            else if( (iResultArray[i])->ObjectClass().Find( KClassVideo )
+                                                == 0 ) //if video
+                {
+                if( ( iResultArray[i]->Title().Length() ) != 0 )
+                    {
+                    // Get title and replace illegal characters.
+                    HBufC8* tmptitle = 
+                    UPnPCommonUtils::FixListboxItemTextL( 
+                        iResultArray[ i ]->Title().Left( KLength ) );
+                    
+                    CleanupStack::PushL( tmptitle );
+                    TPtrC8 tmpnameptr = *tmptitle;
+                    iResultArray[i]->SetTitleL( tmpnameptr );
+                    
+                    HBufC* tmpStr = 
+                        UpnpString::ToUnicodeL( tmpnameptr.Left( KLength ) );
+                    CleanupStack::PushL( tmpStr );
+                    item->Des().Format( _L("%d\t%S\t\t"), 
+                                        EUPnPIconVideo, 
+                                        tmpStr );
+                    CleanupStack::PopAndDestroy( tmpStr );
+                    CleanupStack::PopAndDestroy( tmptitle );
+                    }
+                  
+                }
+            else if( ( iResultArray[i] )->ObjectClass().Find( KClassImage )
+                                                == 0 ) //if image
+                {
+                if( ( iResultArray[i]->Title().Length() ) != 0 )
+                    {
+                    // Get title and replace illegal characters.
+                    HBufC8* tmptitle = 
+                    UPnPCommonUtils::FixListboxItemTextL( 
+                        iResultArray[ i ]->Title().Left( KLength ) );
+                    
+                    CleanupStack::PushL( tmptitle );
+                    TPtrC8 tmpnameptr = *tmptitle;
+                    iResultArray[i]->SetTitleL( tmpnameptr );
+                    
+                    HBufC* tmpStr = UpnpString::ToUnicodeL( 
+                        tmpnameptr.Left( KLength ) );
+                    CleanupStack::PushL( tmpStr );
+                    item->Des().Format( _L("%d\t%S\t\t"), 
+                                        EUPnPIconImage, 
+                                        tmpStr );
+                    CleanupStack::PopAndDestroy( tmpStr );
+                    CleanupStack::PopAndDestroy( tmptitle );
+                    }
+                 }
+            else //if not recoganized media file type
+                {
+                if( ( iResultArray[i]->Title().Length() ) != 0 )
+                    {
+                    // Get title and replace illegal characters.
+                    HBufC8* tmptitle = 
+                    UPnPCommonUtils::FixListboxItemTextL( 
+                        iResultArray[ i ]->Title().Left( KLength ) );
+                    
+                    CleanupStack::PushL( tmptitle );
+                    TPtrC8 tmpnameptr = *tmptitle;
+                    iResultArray[i]->SetTitleL( tmpnameptr );
+
+                    HBufC* tmpStr = UpnpString::ToUnicodeL( 
+                        tmpnameptr.Left( KLength ) );
+                    CleanupStack::PushL( tmpStr );
+                    item->Des().Format( _L("%d\t%S\t\t"), 
+                                        EUPnPIconOther, 
+                                        tmpStr );
+                    CleanupStack::PopAndDestroy( tmpStr );
+                    CleanupStack::PopAndDestroy( tmptitle );
+                    }
+                }
+            listBoxItems->AppendL( item->Des() );                
+            } //for
+        iListBox->HandleItemAdditionL(); // Update listbox
+        iListBox->SetCurrentItemIndexAndDraw( 0 ); // select new item
+        if( (iResultArray[0])->
+                          ObjectClass().Find( KClassImage ) == 0 ||
+        (iResultArray[0])->
+                          ObjectClass().Find( KClassVideo ) == 0)
+            {
+            UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW );
+            }
+        else if( ( iResultArray[0] )->ObjectClass()
+                                  .Find( KClassAudio ) == 0 )
+            {
+            UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
+            }        
+        else
+            {
+            UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+            } 
+        }
+
+
+    CleanupStack::PopAndDestroy( item );
+    }
+    
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::DynInitMenuPaneL(TInt aResourceId, 
+//                                             CEikMenuPane *aMenuPane)
+// creates dynamical menu according to result array users 
+// selections/highlighted item
+// --------------------------------------------------------------------------
+//    
+void  CAdvancedFindResultWindow::DynInitMenuPaneL( TInt aResourceId, 
+                                                   CEikMenuPane *aMenuPane )
+    {
+    TInt selected_item = iListBox->CurrentItemIndex();
+    if ( aResourceId ==  R_UPNPCOMMONUI_RESULT_WINDOW_MENU )
+        {
+        aMenuPane->SetItemDimmed( EUPnPShow, ETrue );
+        aMenuPane->SetItemDimmed( EUPnPPlay, ETrue );
+        if (iResultArray.Count() == 0)
+            {
+            aMenuPane->SetItemDimmed( EUPnPCopy, ETrue );
+            aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue );
+            }
+        else
+            {
+            const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+            if ( indexes->Count() ) //if items are marked
+                {
+                if( UPnPItemUtility::BelongsToClass( 
+                                            *iResultArray[selected_item], 
+                                            KClassAudio ) 
+                    && IsAudioItemMarked() )
+                    {
+                    //if an audio is focused
+                    aMenuPane->SetItemDimmed(EUPnPPlay, EFalse);
+                    }
+                else
+                    { 
+                    aMenuPane->SetItemDimmed(EUPnPPlay, ETrue);
+                    } 
+                }
+            //check highlited items        
+            else if ( ( ( iResultArray[iListBox->CurrentItemIndex()])->
+                   ObjectClass().Find( KClassVideo ) == 0 ||
+                 ( iResultArray[iListBox->CurrentItemIndex()])->
+                   ObjectClass().Find( KClassImage ) == 0 ) )
+                {
+                aMenuPane->SetItemDimmed( EUPnPShow, EFalse );
+                }
+            else if ( ( iResultArray[iListBox->CurrentItemIndex()])->
+                        ObjectClass().Find( KClassAudio ) 
+                        == 0 )  //if music
+                {
+                aMenuPane->SetItemDimmed( EUPnPPlay, EFalse );
+                }
+            }                    
+
+        // hide help option if not supported
+        if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+            {
+            aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
+            }
+        }
+    else if( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION )
+        {        
+        TBool markHidden = iListBox->View()->ItemIsSelected( selected_item );
+        TBool unmarkHidden = !iListBox->View()->
+                                            ItemIsSelected( selected_item );
+        TBool markAllHidden = iListBox->Model()->NumberOfItems() == 0 ||
+        iListBox->SelectionIndexes()->Count()==iListBox->Model()->
+                                                            NumberOfItems();
+        TBool unmarkAllHidden = iListBox->Model()->NumberOfItems() == 0 ||
+                                iListBox->SelectionIndexes()->Count() == 0;
+        aMenuPane->SetItemDimmed( EAknCmdMark, markHidden );
+        aMenuPane->SetItemDimmed( EAknCmdUnmark, unmarkHidden );
+        aMenuPane->SetItemDimmed( EAknMarkAll, markAllHidden );
+        aMenuPane->SetItemDimmed( EAknUnmarkAll, unmarkAllHidden );
+        }
+    
+    CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
+    }
+  
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::GetHelpContext
+// --------------------------------------------------------------------------
+//
+void CAdvancedFindResultWindow::GetHelpContext( 
+                                            TCoeHelpContext& aContext ) const
+    {
+    __LOG( "CAdvancedFindResultWindow::GetHelpContext");
+    
+//  aContext.iMajor = TUid::Uid( KMediaGalleryUID3 );    
+    aContext.iContext = KUPNP_HLP_SEARCH;
+    }
+    
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::ShowVideoExtL
+// --------------------------------------------------------------------------
+//
+void CAdvancedFindResultWindow::ShowVideoExtL()
+    {
+    
+    TInt error = KErrGeneral;
+    iAction = CUPnPCommonUI::EUPnPShow;
+    iChildDialogOpen++;
+    error = iCommonUI.SelectDeviceL(
+                              iAVControl,
+                              *iTargetDevice,
+                              EUPnPSearchRenderingDevicesWithVideoCapability,
+                              EUPnPSelectDeviceTitle );
+    iChildDialogOpen--;
+    if ( KErrNone == error )
+        {
+        const CUpnpObject* selectedObject = iResultArray[iListBox->
+                                   CurrentItemIndex()];
+                    
+        if( iSourceDevice )
+            {
+            
+            MUPnPAVRenderingSession* renderingSession = 
+                     &(iAVControl.StartRenderingSessionL( *iTargetDevice ) );
+            iChildDialogOpen++;
+            
+            TInt ret = KErrNone;
+            //trap here to release rendering session properly
+            TRAP( error, ret = iCommonUI.ExecuteVideoPlayerL(
+                                                   *renderingSession, 
+                                                   *selectedObject ) );
+            
+            if( ret < KErrNone )
+                {
+                error = ret;
+                }
+            
+            //set back panel and navi text
+            
+            // Get device friendly name and replace illegal characters.
+            HBufC8* tmpfriendlyname = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+                iSourceDevice->FriendlyName() );
+            
+            CleanupStack::PushL( tmpfriendlyname );
+            TPtrC8 friendlyname = *tmpfriendlyname;
+            
+            HBufC* titleString = 
+                UpnpString::ToUnicodeL( friendlyname.Left( KLength ) );
+            CleanupStack::PushL( titleString );
+            
+            iTitlePane->SetTextL( *titleString );
+            CleanupStack::PopAndDestroy( titleString );
+            CleanupStack::PopAndDestroy( tmpfriendlyname );
+            
+            SetNaviPaneTextL();
+            
+            renderingSession->RemoveObserver();
+            iAVControl.StopRenderingSession( *renderingSession );
+            
+            iChildDialogOpen--;
+            }
+        }
+    if( KErrNone != error )
+        {
+        User::Leave( error );    
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::ShowImageExtL
+// --------------------------------------------------------------------------
+//
+void CAdvancedFindResultWindow::ShowImageExtL()
+    {
+    TInt error = KErrNone;
+    iAction = CUPnPCommonUI::EUPnPShow;
+    iChildDialogOpen++;
+    error= iCommonUI.SelectDeviceL(
+                              iAVControl,
+                              *iTargetDevice,
+                              EUPnPSearchRenderingDevicesWithImageCapability,
+                              EUPnPSelectDeviceTitle );
+    iChildDialogOpen--;
+    
+    if ( KErrNone == error )
+        {
+        if( !iImagePlayer )
+            {
+            iImagePlayer = CUpnpImagePlayer::NewL( iAVControl, 
+                                                   *this,
+                                                   iCommonUI );
+            }
+        iImagePlayer->SetTargetDeviceL( *iTargetDevice );
+        
+        StartImageControlTimer();
+        iImageControlActive = ETrue;
+        UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
+        }
+    else
+        {
+        User::Leave( error );
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::ShowCurrentImageL
+// --------------------------------------------------------------------------
+void CAdvancedFindResultWindow::ShowCurrentImageL( TBool aShowImage )
+    {    
+    TInt currentItemIndex = iListBox->CurrentItemIndex();
+    if ( currentItemIndex < 0 )
+        {
+        currentItemIndex = 0;
+        }
+    
+    CDesCArray* listBoxItems = 
+        static_cast<CDesCArray*>( iListBox->Model()->ItemTextArray() );
+    
+    if( iLastImageItemIndex >= 0 ) // if last item was image
+        {
+        TBuf<KMaxFileName> lastItem;
+        HBufC *lastTmpItem = UpnpString::ToUnicodeL( 
+            iResultArray[iLastImageItemIndex]->Title().Left( KLength ) );
+        CleanupStack::PushL( lastTmpItem );
+        lastItem.Format( KImageFormatString(), 
+                         EUPnPIconImage, 
+                         lastTmpItem);
+        CleanupStack::PopAndDestroy ( lastTmpItem );
+                 
+        listBoxItems->Delete( iLastImageItemIndex );
+        listBoxItems->InsertL( iLastImageItemIndex, lastItem );
+        iListBox->HandleItemAdditionL();
+        if( !( UPnPItemUtility::BelongsToClass( 
+                *iResultArray[iListBox->CurrentItemIndex()], KClassImage ) ) )
+            {
+            iLastImageItemIndex = KErrNotFound;    
+            }
+        }    
+
+    if( UPnPItemUtility::BelongsToClass( 
+            *iResultArray[iListBox->CurrentItemIndex()], KClassImage ) )
+        {
+        if( ( CUpnpItem* )iResultArray[currentItemIndex]
+                                                ->Title().Length() != 0 )
+            {
+            HBufC *tmpItem = UpnpString::ToUnicodeL( 
+                iResultArray[ currentItemIndex ]->Title().Left( KLength ) );
+            CleanupStack::PushL( tmpItem );
+            
+            TBuf<KMaxFileName> item;
+            // if not showing an image
+            if ( !aShowImage )
+                {   
+                item.Format( KImageFormatString(), EUPnPIconImage, tmpItem);
+                iLastImageItemIndex = KErrNotFound;
+                listBoxItems->Delete( currentItemIndex );
+                listBoxItems->InsertL( currentItemIndex, item );
+                }
+            else // if showing an image
+                {
+                
+                item.Format( KImageShowingFormatString() ,EUPnPIconImage,
+                                               tmpItem,
+                                               EUPnPIconImageShowing );
+                if(iImagePlayer)
+                    {
+                    iAction = CUPnPCommonUI::EUPnPShow;
+                    TRAPD( error, iImagePlayer->PlayL( 
+                                  *iResultArray[currentItemIndex] ) );
+                    
+                    HandleErrorL( error );
+                    
+                   }     
+
+                // listBoxItem.Set( item );
+                listBoxItems->Delete( currentItemIndex );
+                listBoxItems->InsertL( currentItemIndex, item );
+                iLastImageItemIndex = currentItemIndex;
+                }
+            CleanupStack::PopAndDestroy ( tmpItem );
+            iListBox->HandleItemAdditionL();
+            iListBox->SetCurrentItemIndexAndDraw( currentItemIndex );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::StartImageControlTimer
+// Starts periodic timer
+// --------------------------------------------------------------------------
+void CAdvancedFindResultWindow::StartImageControlTimer()
+    {
+    __LOG( "CAdvancedFindResultWindow::StartImageControlTimer" );
+    iImageControlTimer->Start( 
+                        KImageTimerDelay,
+                        KImageTimerInterval,
+                        TCallBack( ImageControlTimerCallbackL, this ) );
+    __LOG( "CAdvancedFindResultWindow::StartImageControlTimer-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::ImageControlTimerCallbackL
+// Callback method for the Timer.
+// --------------------------------------------------------------------------
+TInt CAdvancedFindResultWindow::ImageControlTimerCallbackL( TAny* aDlg )
+    {
+    __LOG( "CAdvancedFindResultWindow::ImageControlTimerCallbackL" );
+    
+    static_cast< CAdvancedFindResultWindow* >( aDlg )->
+                                        iImageControlTimer->Cancel();
+    static_cast< CAdvancedFindResultWindow* >( aDlg )->
+                                        ShowCurrentImageL( ETrue );
+    
+    __LOG( "CAdvancedFindResultWindow::ImageControlTimerCallbackL-END" );
+    return KErrNone;
+}
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::StopImageControlL
+// --------------------------------------------------------------------------
+void CAdvancedFindResultWindow::StopImageControlL()
+    {
+    __LOG( "CAdvancedFindResultWindow::StopImageControlL" );
+        
+    if ( iImageControlActive )
+        {
+        iImageControlActive = EFalse;
+        iImageControlTimer->Cancel();
+        ShowCurrentImageL( EFalse );
+        
+        const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+        if ( indexes->Count() )
+            {
+            if( UPnPItemUtility::BelongsToClass( 
+                            *iResultArray[iListBox->CurrentItemIndex()], 
+                            KClassAudio )
+                && IsAudioItemMarked() ) 
+                {
+                UpdateSoftkeysL( 
+                            R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
+                }
+            else
+                {
+                UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                }
+            }
+        else // check the hightlighted item
+            {
+            TInt tempCounter = iListBox->CurrentItemIndex();
+            if( UPnPItemUtility::BelongsToClass( 
+                    *iResultArray[tempCounter], KClassImage ) ||
+                UPnPItemUtility::BelongsToClass( 
+                    *iResultArray[tempCounter], KClassVideo ) )
+                {
+                UpdateSoftkeysL(
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW );
+                }
+            else if( UPnPItemUtility::BelongsToClass( 
+                    *iResultArray[tempCounter], KClassAudio ) )
+                {
+                UpdateSoftkeysL( 
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
+                }        
+            else
+                {
+                UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                }
+            }
+
+        iAction = CUPnPCommonUI::EUPnPNone;
+        iImagePlayer->Stop();
+        }
+    
+    __LOG( "CAdvancedFindResultWindow::StopImageControlL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::DismissItselfL
+// --------------------------------------------------------------------------
+//
+void CAdvancedFindResultWindow::DismissItselfL( TInt aError )
+    {
+    __LOG( "CAdvancedFindResultWindow::DismissItselfL" );
+    iMSDisappear = ETrue;
+    if( iChildDialogOpen > 0 ) //if video or music dialog open
+        {
+        __LOG( "CAdvancedFindResultWindow::iCommonUI.DismissDialogL" );
+        iCommonUI.DismissDialogL( aError );
+        }
+    else
+        {
+        __LOG( "CAdvancedFindResultWindow::TryExitL" );
+        TryExitL( aError ); //media server disappeared or WLAN lost
+        }
+    __LOG( "CAdvancedFindResultWindow::DismissItselfL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::DeviceDisappeared
+// called by image play only, no implementation
+// --------------------------------------------------------------------------
+//   
+void CAdvancedFindResultWindow::DeviceDisappeared( TInt aError )
+    {
+    TRAP_IGNORE( HandleErrorL( aError ) );
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::HandleCopyL
+// --------------------------------------------------------------------------
+//   
+void CAdvancedFindResultWindow::HandleCopyL()
+    {
+    iAction = CUPnPCommonUI::EUPnPCopy;
+    iCopyIndex = NULL;
+    RPointerArray<CUpnpItem> tempArrayForCopy;
+    CleanupResetAndDestroyPushL( tempArrayForCopy );            
+    const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+    if ( indexes->Count() )
+        {            
+        for (TInt count=0; count < indexes->Count(); count++)
+            {
+            CUpnpItem* tempItem = CUpnpItem::NewL();
+            CleanupStack::PushL( tempItem );
+            tempItem->CopyL( *iResultArray[indexes->At(count)] );
+            tempArrayForCopy.AppendL( tempItem );
+            CleanupStack::Pop( tempItem );
+            }
+        iCopyIndex = indexes->Count();    
+        }                
+    else
+        {             
+        CUpnpItem* tempItem = CUpnpItem::NewL();
+        CleanupStack::PushL( tempItem );
+        tempItem->
+                CopyL( *iResultArray[iListBox->CurrentItemIndex()] );
+        tempArrayForCopy.AppendL( tempItem );
+        CleanupStack::Pop( tempItem );
+        iCopyIndex = 1;
+        }            
+    
+    CUpnpFileTransferEngine* ftEngine = NULL;
+    // Instantiate the UPnP File Transfer Engine
+    ftEngine = CUpnpFileTransferEngine::NewL( &iBrowseSession );
+    CleanupStack::PushL( ftEngine );
+        
+    ftEngine->CopyRemoteItemsToHandsetL( tempArrayForCopy );
+        // Clean up ftEngine
+    CleanupStack::PopAndDestroy( ftEngine );
+    ftEngine = NULL;
+        
+    // Clean up tempArrayForCopy
+    CleanupStack::PopAndDestroy( &tempArrayForCopy );
+    }
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::HandleErrorL
+// --------------------------------------------------------------------------
+//     
+void CAdvancedFindResultWindow::HandleErrorL( TInt aError )
+    {
+    iCommonUI.GetUpnpAction( iAction );
+    //if media server or WLAN lost, close the browse dialog    
+    if( ( KErrSessionClosed == aError && iMSDisappear )||
+          KErrDisconnected == aError ||
+          EAknCmdExit == aError ||
+          EEikCmdExit == aError )
+        {
+        if( iChildDialogOpen > 0 ) 
+            {
+            //if some dialos are open on the top of browse dialog, 
+            //close those dialogs and do the corresponding action via
+            //errors returned from them 
+            iCommonUI.DismissDialogL( aError );
+            }
+        else //if no, do the corresponding action via the error
+            {
+            TryExitL( aError );    
+            }
+        }
+     else
+        {
+        // if media renderer disappears
+        if( KErrSessionClosed == aError && !iMSDisappear )
+            {
+            StopImageControlL();   
+            }
+        
+        iCommonUI.HandleCommonErrorL( aError, iCopyIndex );
+        iAction = CUPnPCommonUI::EUPnPNone;
+        iCopyIndex = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::UpdateSoftkeysL
+// Update CBA-keys
+// --------------------------------------------------------------------------
+
+void CAdvancedFindResultWindow::UpdateSoftkeysL( TInt aResourceId )
+    {   
+    __LOG( "CAdvancedFindResultWindow::UpdateSoftkeysL" );
+    CEikButtonGroupContainer* cba = &ButtonGroupContainer();
+    cba->SetCommandSetL( aResourceId );
+    cba->DrawDeferred();
+    __LOG( "CAdvancedFindResultWindow::UpdateSoftkeysL-END" );
+    }
+    
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::IsAudioItemMarked
+// --------------------------------------------------------------------------
+TBool CAdvancedFindResultWindow::IsAudioItemMarked( void )
+    {
+    TBool mark = EFalse;
+    const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+    if ( indexes->Count() ) //if items are marked
+        {
+        for (TInt count=0; count < indexes->Count(); count++)
+            {
+            if ( ( iResultArray[indexes->At(count)])->
+                                ObjectClass().Find( KClassAudio )
+                   == 0 ) //audio
+                {
+                mark = ETrue;
+                count = indexes->Count();
+                }                
+            }
+        }
+    __LOG( "CAdvancedFindResultWindow::IsAudioItemMarked-END" );      
+    return mark;
+
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::UpdateCommandButtonAreaL( 
+//      TBool aMark, TInt tempCounter )
+// Updates command button area
+// --------------------------------------------------------------------------
+void CAdvancedFindResultWindow::UpdateCommandButtonAreaL( TBool aMark,
+        TInt aTempCounter )
+    {
+    if( aTempCounter>=0 && iResultArray.Count() )
+        {
+        if( !aMark ) // no marked items in the list box
+            {
+            if( ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassImage ) ) ||
+            ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassVideo ) ) )
+                {
+                UpdateSoftkeysL( 
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW );
+                }
+            else if( ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassAudio ) ) )
+                {
+                UpdateSoftkeysL( 
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
+                }        
+            else if( ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassContainer ) ) )
+                {
+                UpdateSoftkeysL( 
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN );
+                }
+            else
+                {
+                UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                }        
+            }
+        else // at least one marked item in the list box
+            {
+            if( ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassContainer ) ) )
+                {
+                UpdateSoftkeysL( 
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN );
+                }        
+            else if( !IsAudioItemMarked() )
+                {
+                //if no audio item have been marked.
+                UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                }
+            else
+                {
+                if( !( UPnPItemUtility::BelongsToClass(
+                        *iResultArray[aTempCounter], KClassAudio ) ) )
+                    {
+                    UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                    }
+                else
+                    {
+                    UpdateSoftkeysL( 
+                            R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
+                    }
+                }       
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAdvancedFindResultWindow::UpdateCommandButtonArea( 
+//      TBool aMark, TInt tempCounter )
+// Updates command button area
+// --------------------------------------------------------------------------
+void CAdvancedFindResultWindow::UpdateCommandButtonArea( TBool aMark,
+        TInt aTempCounter )
+    {
+    TInt error = KErrNone;
+    TRAP( error, UpdateCommandButtonAreaL( aMark, aTempCounter ) );
+    if( error )
+        {
+        __LOG1( "UpdateCommandButtonAreaL error,error=%d", error );
+        }
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpbrowsecacheitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for UPnP Browse cache item implementation
+*
+*/
+
+
+// INCLUDES
+#include <upnpobjectlist.h>
+#include "upnpbrowsecacheitem.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::CUPnPBrowseCacheItem
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPBrowseCacheItem::CUPnPBrowseCacheItem()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+void CUPnPBrowseCacheItem::ConstructL( const TDesC8& aContainer,
+                                       TInt aHighLightedItem,
+                                       TInt aFirstItem )
+    {
+    iContainerData = aContainer.AllocL();
+    iFirstItem = aFirstItem;
+    iHighLightedItem = aHighLightedItem;
+    iItemArray.ResetAndDestroy();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+EXPORT_C CUPnPBrowseCacheItem* CUPnPBrowseCacheItem::NewL(
+                               const TDesC8& aContainer,
+                               TInt aHighLightedItem,
+                               TInt aFirstItem )
+    {
+    CUPnPBrowseCacheItem* self = new( ELeave ) CUPnPBrowseCacheItem;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aContainer, aHighLightedItem, aFirstItem );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CUPnPBrowseCacheItem::~CUPnPBrowseCacheItem()
+    {
+    if ( iItemArray.Count() > 0 )
+        {
+        iItemArray.ResetAndDestroy();
+        }
+    iItemArray.Close();    
+    delete iContainerData;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::ContainerId
+// --------------------------------------------------------------------------
+EXPORT_C const HBufC8& CUPnPBrowseCacheItem::ContainerId() const
+    {
+    return *iContainerData;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::SetItemArrayL
+// --------------------------------------------------------------------------
+EXPORT_C void CUPnPBrowseCacheItem::SetItemArrayL(
+                            const RPointerArray<CUpnpObject>& aBrowseArray )
+    {
+    iItemArray.ResetAndDestroy();
+    for ( TInt index=0; index < aBrowseArray.Count(); index++ )
+        {        
+        iItemArray.AppendL( aBrowseArray[ index ] );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::SetFirstItem
+// --------------------------------------------------------------------------
+EXPORT_C void CUPnPBrowseCacheItem::SetFirstItem( const TInt aFirstItem ) 
+    {
+    iFirstItem = aFirstItem;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::SetTotalCount
+// --------------------------------------------------------------------------
+void CUPnPBrowseCacheItem::SetTotalCount( const TInt aTotalCount ) 
+    {
+    iTotalCount = aTotalCount;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::SetHighLightedItem
+// --------------------------------------------------------------------------
+EXPORT_C void CUPnPBrowseCacheItem::SetHighLightedItem(
+                                            const TInt aHighLightedItem )
+    {
+    iHighLightedItem = aHighLightedItem;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::GetItem
+// --------------------------------------------------------------------------
+EXPORT_C const CUpnpObject* CUPnPBrowseCacheItem::GetItem(
+                                                    const TInt aItemToGet )
+    {
+    return iItemArray[ aItemToGet ];
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::GetNumberOfItems
+// --------------------------------------------------------------------------
+EXPORT_C TInt CUPnPBrowseCacheItem::GetNumberOfItems() const
+    {
+    return iItemArray.Count();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::GetTotalCount
+// --------------------------------------------------------------------------
+TInt CUPnPBrowseCacheItem::GetTotalCount() const
+    {
+    return iTotalCount;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::GetUpperMostItem
+// --------------------------------------------------------------------------
+EXPORT_C TInt CUPnPBrowseCacheItem::GetUpperMostItem() const
+    {
+    return iFirstItem;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseCacheItem::GetHighlightedItem
+// --------------------------------------------------------------------------
+EXPORT_C TInt CUPnPBrowseCacheItem::GetHighlightedItem() const
+    {
+    return iHighLightedItem;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpbrowsedialog.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,3069 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for UPnP Browse UI Implementation
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <featmgr.h>
+#include <AknIconArray.h>
+#include <aknnavide.h>
+#include <eikclbd.h>
+#include <akntabgrp.h>
+#include <StringLoader.h>
+#include <hlplch.h>
+#include <commondialogs.mbg>
+#include <AknWaitDialog.h>
+#include <upnpstring.h>
+#include <AknDialog.h>
+#include <akntitle.h>
+#include <aknlists.h>
+#include <aknnotewrappers.h> 
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include <httperr.h>
+
+// upnp stack api's
+#include <upnpitem.h>
+#include <upnpcontainer.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h"   //start browse session and rendering session
+#include "upnpavdevice.h"
+#include "upnpavbrowsingsession.h"
+#include "upnpavrenderingsession.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // upnp definitions
+
+// upnpframework / xml parser api
+#include "upnpxmlparser.h"
+
+// upnpframework / utility class UPnPItemUtility
+#include "upnpitemutility.h"
+
+// upnpframework / internal api's
+#include "upnpfiletransferengine.h"
+#include "upnpmusicadapter.h"
+#include "upnpbrowseplaylistfiller.h"
+
+// common ui internal
+#include "upnpcommonui.h"
+#include <upnpcommonui.rsg>
+#include <upnpcommonui.mbg>
+#include "upnpcommonutils.h"
+
+#include "upnplocalplayer.h"
+#include "upnpbrowsedialog.h"
+#include "upnpcommonui.hrh"
+#include "upnpbrowsecacheitem.h"
+#include "upnpimageplayer.h"
+#include "upnpperiodic.h"
+
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+
+//CONSTANTS
+_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" );
+_LIT( KFormatString,  "%d\t%S\t\t" );
+_LIT( KFormatString2, "%d\t%S\t\t%d" );
+_LIT( KUPNP_HLP_REMOTE_DEVICES, "UPNP_HLP_REMOTE_DEVICES" ); 
+_LIT( KUPNP_HLP_CONTENT_VIEW, "UPNP_HLP_CONTENT_VIEW" ); 
+
+const TInt KBrowseBack = -1;
+const TInt KBrowseRoot = -2;
+const TInt KBrowseForward = -3;
+const TInt KBrowseRequestCount = 20;
+const TInt KWindowBrowseTricker = 3;
+
+const TInt KImageTimerDelay = 800000;
+const TInt KImageTimerInterval = 800000;
+
+const TInt KLength = 100;
+
+// CONSTANTS
+enum TUPnPIconTypes
+    {
+    EUPnPIconFolder = 1,
+    //EUPnPIconFolderLocked,
+    EUPnPIconMusic,
+    EUPnPIconVideo,
+    EUPnPIconImage,
+    EUPnPIconImageShowing,
+    EUPnPIconOther,
+    EUPnPIconLast
+    };
+enum TUPnPBrowseDirection
+    {
+    EBackward= 1,
+    EForward
+    };
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUPnPBrowseDialog* CUPnPBrowseDialog::NewL( TInt aMenuResource,
+                                            MUPnPAVController& aAVControl,
+                                            const CUpnpAVDevice& aDevice, 
+                                            CUPnPCommonUI& aCommonUI)
+    {
+    __LOG( "CUPnPBrowseDialog::NewL" );
+
+    CUPnPBrowseDialog* self = new (ELeave) CUPnPBrowseDialog(
+        aAVControl, aCommonUI, aDevice );
+    CleanupStack::PushL( self );
+    self->ConstructL( aMenuResource );
+    
+    CleanupStack::Pop( self );
+    
+    __LOG( "CUPnPBrowseDialog::NewL-END" );
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::ConstructL( TInt aMenuResource )
+                                    
+    {
+    // Register as an observer to file operations (browse results)
+    
+    __LOG( "CUPnPBrowseDialog::ConstructL" );
+    
+    iBrowseSession = &iAVControl.StartBrowsingSessionL( iSourceDevice );
+    iBrowseSession->SetObserver( *this );
+
+    iFirstResultArray = ETrue;
+    CAknDialog::ConstructL( aMenuResource );
+
+    iTargetDevice = CUpnpAVDevice::NewL();
+    iImageControlTimer = CUPnPPeriodic::NewL( CActive::EPriorityUserInput );
+    
+    iError = KErrNone;
+    iDlgPreLayoutDone = EFalse;
+    iErrorForCancel = KErrNone;
+    __LOG( "CUPnPBrowseDialog::ConstructL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::CUPnPBrowseDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+CUPnPBrowseDialog::CUPnPBrowseDialog( MUPnPAVController& aAVControl,
+                                      CUPnPCommonUI& aCommonUI,
+                                      const CUpnpAVDevice& aDevice ):
+                                      iCommonUI( aCommonUI ), 
+                                      iAVControl( aAVControl ),
+                                      iSourceDevice(aDevice)
+    {
+    __LOG( "CUPnPBrowseDialog::CUPnPBrowseDialog" );
+    
+    iBrowseRequestSent = EFalse;
+    iChildDialogOpen = 0;
+    iLastImageItemIndex = KErrNotFound;
+    iMSDisappear = EFalse;
+    iAction = CUPnPCommonUI::EUPnPNone;
+    iCopyIndex = NULL;
+    iRoot = ETrue;
+    
+    iIsMusicItem = EFalse;
+    iHashKeyFlag = EFalse;
+    __LOG( "CUPnPBrowseDialog::CUPnPBrowseDialog-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::~CUPnPBrowseDialog
+// C++ default destructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+CUPnPBrowseDialog::~CUPnPBrowseDialog()
+    {
+    __LOG( "CUPnPBrowseDialog::~CUPnPBrowseDialog" );
+    // Unregister as an observer to file operations (browse results)       
+    TRAPD( err, DismissWaitNoteL() );
+    if ( err != KErrNone )
+        {
+        __LOG( "CUPnPBrowseDialog::~CUPnPBrowseDialog \
+                                                    delete WaitNote error" );
+        } 
+        
+    if ( iCurrentFolderId && !iBrowseRequestSent )
+        {
+        TRAP_IGNORE( CacheItemUpdateL( *iCurrentFolderId, EFalse ) );
+        }     
+    
+    delete iCurrentFolderId;
+    
+    delete iTargetDevice;
+    delete iImagePlayer;
+    iParentId.ResetAndDestroy();
+    iParentName.ResetAndDestroy();
+    iResultArray.Close();
+    iBrowseCacheItems.ResetAndDestroy();
+    iTempArray.Close();
+    if ( iNaviPane && iNaviDecorator )
+        {
+        iNaviPane->Pop( iNaviDecorator );
+        }
+    
+    delete iNaviDecorator;
+    
+    iSelectedItemsArray.ResetAndDestroy();
+        
+    if ( iImageControlTimer )  
+        {
+        iImageControlTimer->Cancel();
+        delete iImageControlTimer;
+        }    
+     
+    delete iLocalPlayer; 
+    
+    if( iBrowseSession )
+        {
+        iBrowseSession->CancelBrowse(); 
+        iBrowseSession->RemoveObserver();
+        iAVControl.StopBrowsingSession( *iBrowseSession );
+        }
+    
+    __LOG( "CUPnPBrowseDialog::~CUPnPBrowseDialog-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DialogDismissedL();
+// MProgressDialogCallback, progressbar callback function
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::DialogDismissedL( TInt aButtonId )
+    {
+    __LOG( "CUPnPBrowseDialog::DialogDismissedL" );
+    // If button is cancel, inform observer parent class
+    // that cancel has been made
+    if( aButtonId == EEikBidCancel )
+        {
+        __LOG( "CUPnPBrowseDialog::DialogDismissedL: \
+                Cancel was pressed.");
+        iAction = CUPnPCommonUI::EUPnPNone;        
+        iBrowseSession->CancelBrowse();
+        iBrowseRequestSent = EFalse;
+         
+        TInt cachedItemIndex = CacheCheck( *iCurrentFolderId );
+       
+        if ( cachedItemIndex > -1 )
+            {               
+            delete iBrowseCacheItems[ cachedItemIndex ];
+            iBrowseCacheItems[ cachedItemIndex ] = NULL;
+            iBrowseCacheItems.Remove( cachedItemIndex );
+            iBrowseCacheItems.Compress();
+            }            
+        // If button is cancel,
+        // the browse dialog should not been displayed,leave it in the
+        // function of PreLayoutDynInitL.
+        iErrorForCancel = EEikBidCancel;     
+        }
+    __LOG( "CUPnPBrowseDialog::DialogDismissedL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::PreLayoutDynInitL()
+    {
+    __LOG( "CUPnPBrowseDialog::PreLayoutDynInitL" );
+
+    // Browse dialog title text
+    TUid titlePaneUid;
+    titlePaneUid.iUid = EEikStatusPaneUidTitle;
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    CEikStatusPaneBase::TPaneCapabilities titlesubPane =
+        statusPane->PaneCapabilities( titlePaneUid );
+
+    if ( titlesubPane.IsPresent() && titlesubPane.IsAppOwned() )
+        {
+        iTitlePane = (CAknTitlePane*) statusPane->ControlL( titlePaneUid );
+
+        // Get device friendly name and replace illegal characters.
+        HBufC8* tmpfriendlyname = 
+        UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+            iSourceDevice.FriendlyName() );
+            
+        CleanupStack::PushL( tmpfriendlyname );
+        TPtrC8 friendlyname = *tmpfriendlyname;
+        
+        HBufC *tmpbuf = UpnpString::ToUnicodeL( 
+            friendlyname.Left( KLength ) );
+        CleanupStack::PushL( tmpbuf ); 
+        iTitlePane->SetTextL( *tmpbuf );
+
+        CleanupStack::PopAndDestroy( tmpbuf );
+        CleanupStack::PopAndDestroy( tmpfriendlyname );
+        }
+
+    iListBox = static_cast<CAknSingleGraphicStyleListBox*>(
+                                        Control( EUPnPBrowseListBoxId ) );
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
+            CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+    
+    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+    CAknIconArray* icons = new ( ELeave ) CAknIconArray( EUPnPIconLast );
+    CleanupStack::PushL( icons );
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    TFileName mbmFileName( KAknCommonUIMbmFileName );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    mbmFileName.Insert( 0, drive );
+    
+    AppendIconToArrayL( icons, 
+        skin, 
+        KAvkonBitmapFile, 
+        KAknsIIDQgnIndiMarkedAdd, 
+        EMbmAvkonQgn_indi_marked_add, 
+        EMbmAvkonQgn_indi_marked_add_mask );
+
+    // Folder icon
+    AppendIconToArrayL( icons,
+        skin, 
+        mbmFileName, 
+        KAknsIIDQgnPropFolderSmall, 
+        EMbmUpnpcommonuiQgn_prop_mserv_folder_small, 
+        EMbmUpnpcommonuiQgn_prop_mserv_folder_small_mask );
+                   
+                        
+    // Music icon
+    AppendIconToArrayL( icons,
+        skin, 
+        mbmFileName, 
+        KAknsIIDDefault, 
+        EMbmUpnpcommonuiQgn_prop_mserv_music, 
+        EMbmUpnpcommonuiQgn_prop_mserv_music_mask );
+
+    // Video icon
+    AppendIconToArrayL( icons,
+        skin,
+        mbmFileName, 
+        KAknsIIDDefault, 
+        EMbmUpnpcommonuiQgn_prop_mserv_other_videos, 
+        EMbmUpnpcommonuiQgn_prop_mserv_other_videos_mask );
+
+    // Image icon
+    AppendIconToArrayL( icons,
+        skin, 
+        mbmFileName, 
+        KAknsIIDDefault, 
+        EMbmUpnpcommonuiQgn_prop_mserv_other_images, 
+        EMbmUpnpcommonuiQgn_prop_mserv_other_images_mask );
+        
+    //Image showing icon
+    AppendIconToArrayL( icons,
+        skin, 
+        mbmFileName, 
+        KAknsIIDDefault, 
+        EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon, 
+        EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon_mask );
+
+
+    // Other icon
+    AppendIconToArrayL( icons,
+        skin, 
+        KCommonDialogsBitmapFile, 
+        KAknsIIDQgnPropFmgrFileSound, 
+        EMbmCommondialogsQgn_prop_fmgr_file_other, 
+        EMbmCommondialogsQgn_prop_fmgr_file_other_mask );
+                                        
+    iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
+
+    CleanupStack::Pop(icons);
+
+    // Hide "No data" text
+    iListBox->View()->SetListEmptyTextL( KNullDesC() );
+
+    // Send browse request
+    SendBrowseRequestL( KBrowseRoot );
+    
+    iDlgPreLayoutDone = ETrue;
+    
+    if( iError < KErrNone )
+        {
+        __LOG1( "CUPnPBrowseDialog::PreLayoutDynInitL leave %d", iError );
+        User::Leave( iError );
+        }  
+        
+    if( iErrorForCancel == EEikBidCancel )
+        {
+        User::Leave( EEikBidCancel );
+        } 
+    __LOG( "CUPnPBrowseDialog::PreLayoutDynInitL-END" );
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::OkToExitL( TInt aButtonId )
+// called by framework when the softkey is pressed
+// --------------------------------------------------------------------------
+TBool CUPnPBrowseDialog::OkToExitL( TInt aButtonId )
+    {
+    __LOG( "CUPnPBrowseDialog::OkToExitL" );
+    
+    TBool returnValue = EFalse;
+    TInt error = KErrNone;
+    switch (aButtonId )
+        {
+        // Connection failed. Dialog must be closed
+        case KErrDisconnected:
+        case KErrSessionClosed: //fall through
+            {
+            // exit only if PreLayoutDynInitL is done
+            if( iDlgPreLayoutDone )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        case EAknSoftkeyOptions:
+            {
+            SelectedArrayCheckL();
+            DisplayMenuL(); 
+            break;
+            }
+        case EUPnPStopCmd: 
+            {
+            StopImageControlL();
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            // Check if we are in the root 
+            if ( !iParentId.Count() )
+                {
+                ClearTitleL();
+                return ETrue;
+                }
+            else
+                {
+                if ( iBrowseRequestSent )
+                    {                    
+                    iBrowseSession->CancelBrowse();
+                    iBrowseRequestSent = EFalse;
+                    }   
+                 
+                iListBox->ClearSelection();
+                iSelectedItemsArray.ResetAndDestroy();
+                SendBrowseRequestL( KBrowseBack );                    
+                }           
+        
+            break;                               
+            }
+        case EUPnPPlayCmd: //for lsk only, play on external renderer
+            {
+            if( !iMusicPlay )
+                {
+                StopImageControlL();
+                TRAP( error, PlayL( EFalse ) );
+                if( KErrNone != error )
+                    {
+                    iMusicPlay = EFalse;
+                    }    
+                }
+            
+            break;
+            }
+        case EAknSoftkeyOpen: //fall thougth
+        case EAknSoftkeyOk:
+            {
+            // Shift and Ok pressed so the external device dialog must not be
+            // opened
+            if ( iShiftAndOkPressed )
+                {
+                iShiftAndOkPressed = EFalse;
+                return EFalse;
+                }
+            if ( !iResultArray.Count() || iImageControlActive )
+                {
+                return EFalse; // Do nothing if empty
+                }
+            else if ( iResultArray[iListBox->CurrentItemIndex()]->
+                        ObjectType() == EUPnPContainer )
+                {
+                if ( !iBrowseRequestSent )
+                    {
+                    iListBox->ClearSelection();
+                    iSelectedItemsArray.ResetAndDestroy();
+                    SendBrowseRequestL( iListBox->CurrentItemIndex() );
+                    }
+                }
+            else
+                {
+                // Play or Show on external device
+                // Select device according to the media type
+                TRAP( error, ShowPlayExtL() );
+                
+                /* if something happens, set iMusicPlay = EFalse,
+                 * no matter what kinda of media file playing 
+                 * before
+                 */
+                
+                if( KErrNone != error )
+                    {
+                    iMusicPlay = EFalse;
+                    }
+                }
+            break;
+            }
+        case EAknSoftkeyShow:
+            {
+            StopImageControlL();
+            TRAP( error, ShowVideoDialogExtL() );
+            break;
+            }
+        case EAknSoftkeyCancel:
+        case EAknSoftkeyExit:
+        case EAknCmdExit:
+        case EEikCmdExit:   //fall through
+            {
+            ClearTitleL();
+            return ETrue; //back to previous dialog
+            }
+        default:
+            {
+            break;
+            }
+        }//switch
+    
+    HandleErrorL( error );
+    __LOG( "CUPnPBrowseDialog::OkToExitL End" );
+    
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::OfferKeyEventL();
+// called by framework when key is pressed 
+// --------------------------------------------------------------------------
+TKeyResponse CUPnPBrowseDialog::OfferKeyEventL(
+            const TKeyEvent &aKeyEvent,
+            TEventCode aType )
+    {
+    __LOG( "CUPnPBrowseDialog::OfferKeyEventL" );
+    TInt currentItemIndex = iListBox->CurrentItemIndex();   
+    TInt tempCounter = currentItemIndex;
+    // Shift and Ok pressed at same time so the event must consumed
+    if ( ( aKeyEvent.iModifiers & EModifierShift ) != 0 && 
+        aType == EEventKeyDown && ( aKeyEvent.iScanCode == EStdKeyDevice3 ) )
+        {
+        iShiftAndOkPressed = ETrue;
+        return EKeyWasConsumed;
+        }
+    if ( aType != EEventKey ) 
+        {
+        if ( aKeyEvent.iScanCode == EStdKeyHash )
+            {
+            if ( aType == EEventKeyDown )
+                {
+                iHashKeyFlag = ETrue;
+                }
+            else
+                {
+                iHashKeyFlag = EFalse;
+                }
+            }
+        CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+        if ( aType == EEventKeyUp && !iHashKeyFlag )
+            {
+            if ( ( tempCounter < iResultArray.Count() ) && tempCounter > -1 )
+                {
+        
+                if ( !iImageControlActive )
+                    {
+                    const CArrayFix<TInt>* indexes = 
+                                                iListBox->SelectionIndexes();
+                    if ( indexes->Count() )
+                        {
+                        UpdateCommandButtonAreaL( ETrue, tempCounter );
+                        }
+                    else
+                        {
+                        UpdateCommandButtonAreaL( EFalse, tempCounter );
+                        }               
+                    }
+                
+                }
+            }
+        return EKeyWasConsumed;
+        }
+
+    // Shift (pen) key cannot be used marking folders
+    if ( currentItemIndex < 0 )
+        {
+        currentItemIndex = 0;
+        }
+
+    
+    if ( ( aKeyEvent.iCode == EKeyUpArrow ) &&
+         ( currentItemIndex == 0 ) )
+        {
+        return EKeyWasConsumed;
+        }
+    
+    CTextListBoxModel* model = iListBox->Model();
+    TInt numberOfItems = model->NumberOfItems();
+    
+    if ( iAllObjectsReceived && ( currentItemIndex == numberOfItems-1 )
+        && aKeyEvent.iCode == EKeyDownArrow )
+        {
+        return EKeyWasConsumed;
+        }
+        
+    // If selection is approaching the end of the list
+    if ( ( aKeyEvent.iCode == EKeyDownArrow ) && ( !iRoot ) &&
+         ( ( currentItemIndex + KWindowBrowseTricker ) >= numberOfItems ) &&
+         ( iUppermostItem + numberOfItems < iTotalCount ) &&
+         ( !iAllObjectsReceived ) &&
+         ( !iBrowseRequestSent ) )
+        {
+        TInt startIndex = iUppermostItem + numberOfItems;   
+        iAction = CUPnPCommonUI::EUPnPBrowse;         
+        iOriginalBrowseRequest = ETrue;
+        iBrowseSession->BrowseL( *iCurrentFolderId, 
+                                 KFilterCommon,       /* filter */
+                                 MUPnPAVBrowsingSession::EDirectChildren,
+                                 startIndex,          /* start index */
+                                 KBrowseRequestCount, /* request count */
+                                 KSortNone );         /* sort criteria */
+        iBrowseRequestSent = ETrue;
+        iCurrentItem = currentItemIndex;
+        iBrowseDirection = EForward;
+        }
+    if ( ( aKeyEvent.iCode == EKeyUpArrow ) && ( !iRoot ) &&
+       ( ( (currentItemIndex - KWindowBrowseTricker ) <= 0 ) ) && 
+       ( !iBrowseRequestSent ) && ( iUppermostItem > 0 ) )
+        {
+        TInt requestCount = KBrowseRequestCount;
+        TInt startIndex = KErrNotFound;
+        
+        // To keep order of items of listbox don't change.
+        if ( iNeedRepeatRequest )
+            {
+            startIndex = iUppermostItem - iServerReturnObjectCount;
+            requestCount = iServerReturnObjectCount;
+            if ( startIndex < 0 )
+                {
+                startIndex = 0;            
+                }            
+            }
+        else
+            {
+            startIndex = iUppermostItem - KBrowseRequestCount;
+            if ( startIndex < 0 )
+                {
+                requestCount = iUppermostItem;
+                startIndex = 0;            
+                }
+            }
+        iAction = CUPnPCommonUI::EUPnPBrowse;
+        iOriginalBrowseRequest = ETrue;
+        iBrowseSession->BrowseL( *iCurrentFolderId,
+                                 KFilterCommon,       /* filter */
+                                 MUPnPAVBrowsingSession::EDirectChildren,
+                                 startIndex,     /* start index */
+                                 requestCount,   /* request count */
+                                 KSortNone );    /* sort criteria */
+                                 
+        iBrowseRequestSent = ETrue;
+        iCurrentItem = currentItemIndex;                           
+        iBrowseDirection = EBackward;
+            
+        if ( iAllObjectsReceived )
+            {
+            iAllObjectsReceived = EFalse;
+            }
+        
+        }
+    
+    // it is checked that currentItemIndex is valid
+    iCurrentItem = currentItemIndex;
+    
+    if ( ( aKeyEvent.iCode == EKeyDownArrow) &&
+         ( currentItemIndex + 1) == numberOfItems )
+        {
+        return EKeyWasConsumed;
+        }
+        
+    else if ( ( aKeyEvent.iCode == EKeyUpArrow) && 
+              ( currentItemIndex == 0 ) && 
+              ( iBrowseRequestSent ) )
+        {
+        return EKeyWasConsumed;
+        }
+    else if ( aKeyEvent.iCode == EKeyDownArrow )
+        {
+        if ( ( numberOfItems - 1 ) > iCurrentItem )
+            {
+            iCurrentItem++;
+            }
+            else 
+            {
+            iCurrentItem = 0;   
+            }       
+        }
+    else if ( aKeyEvent.iCode == EKeyUpArrow )
+        {
+         //if already if first item, should then go to the last one.
+        if ( iCurrentItem > 0 )
+            {
+            iCurrentItem--;
+            }
+        }
+    
+    if ( aKeyEvent.iCode == EKeyDownArrow ||
+         aKeyEvent.iCode == EKeyUpArrow )
+        {
+        if ( iImageControlActive )
+            {
+            iImageControlTimer->Cancel();
+            StartImageControlTimer();
+            }
+        if ( aKeyEvent.iCode == EKeyDownArrow )
+            {
+            tempCounter++;
+            }
+        else
+            {
+            tempCounter--;
+            }
+        if ( ( tempCounter < iResultArray.Count() ) && tempCounter > -1 )
+            {
+            if( iImageControlActive )
+                {
+                // image or container
+                if ( ( iResultArray[tempCounter] )->ObjectClass()
+                          .Find( KClassImage ) == 0 ||
+                     ( iResultArray[tempCounter] )->ObjectClass()
+                                          .Find( KClassContainer ) == 0 ) 
+                    {
+                    UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
+                    }
+                else if ( ( iResultArray[tempCounter] )->ObjectClass()
+                              .Find( KClassVideo ) == 0 ) //video
+                    {
+                    UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_SHOW_STOP );
+                    }
+                else if ( ( iResultArray[tempCounter] )->ObjectClass()
+                              .Find( KClassAudio ) == 0 ) //music
+                    {
+                    UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_PLAY_STOP );
+                    }    
+                else
+                    {
+                    UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
+                    }    
+                }
+            }            
+        }
+    
+    if ( ( currentItemIndex >= 0 ) && 
+         ( currentItemIndex < iListBox->Model()->NumberOfItems() ) )
+        {
+        if ( ( ( iResultArray[currentItemIndex])->ObjectType()
+                           != EUPnPContainer) ||
+            !( aKeyEvent.iModifiers & EModifierShift ) )
+            {
+            if( aKeyEvent.iCode == EKeyEscape )
+                {
+                __LOG( "OfferKeyEventL EKeyEscape" );
+                if( !iCopying )
+                    {
+                    CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+                    }
+                else
+                    {
+                    __LOG( "Copying ongoing, app should be closed" );
+                    iApplicationClose = ETrue;
+                    __LOG( "Copying ongoing, app should be closed-end" );
+                    }
+                __LOG( "OfferKeyEventL EKeyEscape -end" );    
+                }
+            else
+                {
+                CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+                }    
+            }
+        }
+    
+    // no items in list, all events can be handled by system
+    else if ( iListBox->Model()->NumberOfItems() == 0)  
+        {
+        CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+        }    
+          
+    
+    __LOG( "CUPnPBrowseDialog::OfferKeyEventL End" );
+    return EKeyWasConsumed;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::ProcessCommandL( TInt aCommand )
+// called by framework when menu item is selected
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::ProcessCommandL( TInt aCommand )
+    {
+    __LOG( "CUPnPBrowseDialog::ProcessCommandL" );
+
+    TInt error = KErrNone;
+    TInt selected_item = iListBox->CurrentItemIndex();
+    if ( selected_item < 0 )
+        {
+        selected_item = 0;
+        }
+
+    // Menu commands control
+    HideMenu();
+    switch ( aCommand ) 
+        {
+        case EAknCmdExit: 
+        case EEikCmdExit:// fall through
+            {
+            TryExitL( aCommand );
+            return;
+            }
+        case EUPnPOpen:
+            {
+            if ( iResultArray[selected_item]->ObjectType() == EUPnPContainer)
+                {
+                iListBox->ClearSelection();
+                iSelectedItemsArray.ResetAndDestroy();
+                SendBrowseRequestL( selected_item );
+                }
+            break;
+            } 
+        case EUPnPFind:
+            {
+            if ( iNaviDecorator )
+                {
+                iNaviPane->Pop( iNaviDecorator );
+                delete iNaviDecorator;
+                iNaviDecorator = NULL;
+                }
+            // cancel idle timer because player uses own timer
+            error = iCommonUI.ExecuteAdvFindDialogL( iAVControl, 
+                                                     *iBrowseSession );
+                        
+            //only MS or WLAN lost can make advfind dlg exit
+            if( KErrSessionClosed == error )
+                {
+                iMSDisappear = ETrue;
+                }
+                
+            //if not media server or wlan lost, update its navipane
+            if( !iMSDisappear && error != KErrDisconnected )
+                {
+                UpdateNaviPaneTextL();    
+                }
+              
+            break;
+            }
+        case EUPnPHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+                iEikonEnv->EikAppUi()->AppHelpContextL() );
+            break;
+            }
+        case EUPnPPlayExt:
+        case EUPnPShowExt: //fall through
+            {
+            TRAP( error, ShowPlayExtL() );
+            if( KErrNone != error )
+                {
+                iMusicPlay = EFalse;
+                }
+            break;
+            }
+        case EUPnPShowLocal: //show image & video on local
+            {
+            if( !iLocalPlayer )
+                {
+                iLocalPlayer = CUPnPLocalPlayer::NewL( iAVControl,
+                                                       *iBrowseSession,
+                                                       iCommonUI );
+                }
+            const CUpnpObject* item = 
+                            iResultArray[ iListBox->CurrentItemIndex() ];
+            
+            iAction = CUPnPCommonUI::EUPnPShow;                
+            TRAP( error, iLocalPlayer->PlayL( *item ) );
+            if( KErrSessionClosed == error )
+                {
+                iMSDisappear = ETrue;
+                }
+            break;
+            }
+        case EUPnPPlayLocal: //play music on local
+            {
+            if( ( iResultArray[ iListBox->CurrentItemIndex() ]
+                        ->ObjectClass().Find( KClassAudio ) == 0 ||
+                iIsMusicItem ) && !iMusicPlay )
+                {
+                TRAP( error, PlayL( ETrue ) );
+                if( KErrNone != error )
+                    {
+                    iMusicPlay = EFalse;
+                    }
+                }
+            break;
+            }
+        case EUPnPCopy:
+            {
+            TRAP( error, HandleCopyL() );
+            iCopying = EFalse;
+            __LOG1( "HandleCopyL is finished: %d", error );
+            if( iApplicationClose )
+                {
+                __LOG( "copying is onging, exit" );
+                TryExitL( EAknCmdExit );
+                return;
+                }
+            
+            //During copying, sometimes we get the httperr,
+            //but doesn't handle it, at here I transfer the httperr
+            //to symbian error.
+            if ( KErrHttpPartialResponseReceived == error || 
+                 KErrHttpRequestNotSent == error ||
+                 KErrHttpResponseNotReceived == error )
+                {
+                error =  KErrSessionClosed;
+                }
+                
+            __LOG1( "CUPnPBrowseDialog::HandleCopyL: %d", error );
+            
+            if( KErrSessionClosed == error ) //if server lost
+                {
+                iMSDisappear = ETrue;
+                }
+            else if( KErrNotFound == error )
+                {
+                if( iResultArray[iListBox->CurrentItemIndex()]->
+                                            ObjectType() == EUPnPContainer )
+                    {
+                    if( iCopyIndex > 0 ) //if the container is not empty
+                        {
+                        iCommonUI.DisplayErrorTextL( 
+                                R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT );
+                        iAction = CUPnPCommonUI::EUPnPNone;
+                        }
+                    else //if the container is empty
+                        {
+                        iCopyIndex = ETrue;
+                        }
+                    
+                    }
+                else
+                    {
+                    iCopyIndex = EFalse;
+                    }
+                }
+            break;
+            }
+        case EAknCmdMark:
+            {
+            MarkItemL( iListBox->CurrentItemIndex() );
+            break;
+            }
+        case EAknMarkAll:
+            {
+            MarkAllItemsL();
+            break;
+            }
+        case EAknCmdUnmark: 
+            {
+            UnmarkItem( iListBox->CurrentItemIndex() );
+            break;
+            }
+        case EAknUnmarkAll:
+            {
+            UnmarkAllItems();
+            break;
+            }
+        default:
+            {
+            CAknDialog::ProcessCommandL( aCommand );
+            break;
+            }
+        }
+        
+    HandleErrorL( error );    
+    __LOG( "CUPnPBrowseDialog::ProcessCommandL End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane 
+// *aMenuPane)
+// called by framework before menu panel is shown
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::DynInitMenuPaneL( TInt aResourceId, 
+                                          CEikMenuPane *aMenuPane )
+    {
+    __LOG( "CUPnPBrowseDialog::DynInitMenuPaneL" );
+
+    TVolumeInfo info;
+    
+    TInt selected_item = iListBox->CurrentItemIndex();
+
+    if ( aResourceId == R_UPNPCOMMONUI_BROWSE_OPTION_MENU )
+       {
+        iIsMusicItem = EFalse;
+        if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+            {
+            aMenuPane->SetItemDimmed( EUPnPHelp, ETrue );
+            }
+
+        if ( !iSourceDevice.SearchCapability() )
+            {
+            aMenuPane->SetItemDimmed( EUPnPFind, ETrue );
+            }
+        if ( iResultArray.Count() == 0 )
+            {
+            aMenuPane->SetItemDimmed( EUPnPOpen, ETrue );
+            aMenuPane->SetItemDimmed( EUPnPFind, ETrue );
+            aMenuPane->SetItemDimmed( EUPnPCopy, ETrue );
+            aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue );
+            aMenuPane->SetItemDimmed( EUPnPShow, ETrue );
+            aMenuPane->SetItemDimmed( EUPnPPlay, ETrue );
+            }
+        // Something marked
+        else if( iSelectedItemsArray.Count() )
+            {
+            // Only one video or image be able to show on external device
+            for ( TInt count = 0; 
+                  count < iSelectedItemsArray.Count();
+                  count++)
+                {
+                if ( ( iSelectedItemsArray[ count ] )->
+                        ObjectClass().Find( KClassAudio ) == 0 )
+                    {
+                    //if marked items have at least one audio item
+                    iIsMusicItem = ETrue;
+                    count = iSelectedItemsArray.Count();
+                    }
+                else
+                    {
+                    iIsMusicItem = EFalse;
+                    }                    
+                }
+              
+            aMenuPane->SetItemDimmed( EUPnPShow, ETrue );  
+            if ( UPnPItemUtility::BelongsToClass( 
+                                *iResultArray[selected_item], KClassAudio )
+                 && IsAudioItemMarked() )
+                {
+                aMenuPane->SetItemDimmed( EUPnPPlay, EFalse );
+                }
+            else
+                {
+                aMenuPane->SetItemDimmed( EUPnPPlay, ETrue );
+                } 
+            
+            // we must enable unmark all
+            aMenuPane->SetItemDimmed( EAknCmdEditListMenu, EFalse );
+
+            //only items are marked, disable EUPnPOpen
+            aMenuPane->SetItemDimmed( EUPnPOpen, ETrue );
+            
+            }
+        else if( selected_item >= 0 ) //if no marked items
+            {
+             // Focus on a container
+            if ( iResultArray[ selected_item ]->
+                            ObjectType() == EUPnPContainer )
+                {
+                aMenuPane->SetItemDimmed( EUPnPShow, ETrue );
+                aMenuPane->SetItemDimmed( EUPnPPlay, ETrue );
+                if ( iResultArray[ selected_item ]->ObjectClass()
+                    .Find( KClassPlaylist ) == 0 )
+                    {
+                    //aMenuPane->SetItemDimmed(EUPnPPlay, ETrue);
+                    }
+                
+                aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue );
+                }
+            else //if hightlighted item
+                {
+                // show edit list menu
+                aMenuPane->SetItemDimmed( EAknCmdEditListMenu, EFalse );
+                aMenuPane->SetItemDimmed( EUPnPOpen, ETrue );
+                if( ( iResultArray[ selected_item ] )->
+                                     ObjectClass().Find( KClassAudio ) == 0 )
+                    {
+                    aMenuPane->SetItemDimmed( EUPnPShow, ETrue );
+                    aMenuPane->SetItemDimmed( EUPnPPlay, EFalse );
+                    }
+                else if( ( ( iResultArray[ selected_item ] )->ObjectClass()
+                                        .Find( KClassImage ) == 0
+                         || ( iResultArray[ selected_item ])->ObjectClass()
+                                        .Find( KClassVideo ) == 0 ) 
+                         && !iSelectedItemsArray.Count() )
+                    {
+                    if( iIsMusicItem )
+                        {
+                        aMenuPane->SetItemDimmed( EUPnPPlay, EFalse );
+                        }
+                    else
+                        {
+                        aMenuPane->SetItemDimmed( EUPnPPlay, ETrue );
+                        }
+                    aMenuPane->SetItemDimmed( EUPnPShow, EFalse );
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed( EUPnPShow, ETrue );
+                    if( iIsMusicItem )
+                        {
+                        aMenuPane->SetItemDimmed( EUPnPPlay, EFalse );
+                        }
+                    else
+                        {
+                        aMenuPane->SetItemDimmed( EUPnPPlay, ETrue );
+                        }
+                    }
+                }
+            }
+       
+        }
+    else if ( aResourceId == 
+                R_UPNPCOMMONUI_MENUPANE_MARKABLE_LIST_IMPLEMENTATION )
+        {
+        TBool markHidden = iListBox->View()->ItemIsSelected( selected_item );
+        TBool unmarkHidden = !iListBox->View()->
+                                        ItemIsSelected( selected_item );
+        TBool markAllHidden = iListBox->Model()->NumberOfItems() == 0 || 
+            iListBox->SelectionIndexes()->Count() == 
+            iListBox->Model()->NumberOfItems();
+        TBool unmarkAllHidden = iListBox->Model()->NumberOfItems() == 0 ||
+            iSelectedItemsArray.Count() == 0;
+
+        if ( iResultArray[ selected_item ]->ObjectType() == EUPnPContainer )
+            {
+            aMenuPane->SetItemDimmed( EAknCmdMark, ETrue );
+            aMenuPane->SetItemDimmed( EAknCmdUnmark, ETrue );
+            aMenuPane->SetItemDimmed( EAknMarkAll, ETrue );
+            }
+        else 
+            {
+            aMenuPane->SetItemDimmed( EAknCmdMark, markHidden );
+            aMenuPane->SetItemDimmed( EAknCmdUnmark, unmarkHidden );
+            aMenuPane->SetItemDimmed( EAknMarkAll, markAllHidden );
+            aMenuPane->SetItemDimmed( EAknUnmarkAll, unmarkAllHidden );
+            }
+        }
+    CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
+    __LOG( "CUPnPBrowseDialog::DynInitMenuPaneL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DeleteListItemsL
+// Delete old items from browse list.
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::DeleteListItemsL()
+    {
+    __LOG ( "CUPnPBrowseDialog::DeleteListItemsL" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    TInt currentItem = iListBox->CurrentItemIndex();
+    if ( currentItem < 0 )
+        {
+        currentItem = 0;
+        }
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );    
+    listBoxItems->Delete( 0,listBoxItems->Count() );
+    AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( iListBox,
+                                                            currentItem,
+                                                            ETrue );
+    __LOG ( "CUPnPBrowseDialog::DeleteListItemsL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::LoadListItemsL
+// Loads browse result set to the screen
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::LoadListItemsL()
+    {
+    __LOG( "CUPnPBrowseDialog::LoadListItemsL" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+
+    TBuf<KMaxFileName> item;
+
+    if( !iResultArray.Count() )
+        {
+        iListBox->View()->SetListEmptyTextL(
+            *StringLoader::LoadLC( R_UPNPCOMMONUI_EXTERNAL_EMPTY_FOLDER ) );
+        CleanupStack::PopAndDestroy(); 
+        UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+        }
+    else
+        {
+        for (TInt i=0; i < iResultArray.Count(); i++)
+            {
+            // Get title and replace illegal characters.
+            HBufC8* tmptitle = 
+            UPnPCommonUtils::FixListboxItemTextL( 
+                iResultArray[i]->Title().Left( KLength ) );
+            CleanupStack::PushL( tmptitle );
+
+            TPtrC8 tmpnameptr = *tmptitle;            
+            iResultArray[i]->SetTitleL( tmpnameptr );
+
+            HBufC *tmpItem = UpnpString::ToUnicodeL( 
+                tmpnameptr.Left( KLength ) );
+            CleanupStack::PushL( tmpItem );
+                        
+            if ( iResultArray[ i ]->ObjectType() == EUPnPContainer )
+                {
+                item.Format( KFormatString(), EUPnPIconFolder, tmpItem );    
+                }
+            else
+                {
+                if ( (iResultArray[ i ] )->ObjectClass()
+                                        .Find( KClassAudio ) == 0 )
+                    {
+                    item.Format( KFormatString(), EUPnPIconMusic,
+                                                        tmpItem );
+                    }
+                else if ( ( iResultArray[ i ] )->ObjectClass()
+                                        .Find( KClassVideo ) == 0 )
+                    {
+                    item.Format( KFormatString(), EUPnPIconVideo,
+                                                        tmpItem ); 
+                    }
+                else if ( ( iResultArray[ i ] )->ObjectClass()
+                                        .Find( KClassImage ) == 0 )
+                    {
+                    item.Format( KFormatString(), EUPnPIconImage,
+                                                        tmpItem );
+                    }
+                else
+                    {
+                    item.Format( KFormatString(), EUPnPIconOther,
+                                                        tmpItem );
+                    }
+                }
+            CleanupStack::PopAndDestroy ( tmpItem ); 
+            CleanupStack::PopAndDestroy ( tmptitle ); 
+            listBoxItems->AppendL( item );
+            
+            if ( iSelectedItemsArray.Count() )
+                {
+                for ( TInt index = 0; 
+                      index < iSelectedItemsArray.Count(); 
+                      index++ )
+                    {
+                    for ( TInt i = 0; i < iResultArray.Count() ; i++ )
+                        {
+                        if ( !( iResultArray[ i ])->Id().CompareC(
+                                       iSelectedItemsArray[ index ]->Id() ) )
+                            {
+                            MarkItemL( i );
+                            i = iResultArray.Count();
+                            }
+                        }
+                    }
+                }
+            } //for
+        
+        iListBox->HandleItemAdditionL(); // Update listbox    
+        // Ensure iCurrentItem isn't out of bounds
+        if ( iCurrentItem < 0 )
+            {
+            iCurrentItem = 0;
+            }
+        if ( iCurrentItem >=  model->NumberOfItems() )
+            {
+            iCurrentItem  = model->NumberOfItems() - 1;
+            }
+            
+        // select new item
+        iListBox->SetCurrentItemIndexAndDraw( iCurrentItem );    
+        if( !iImageControlActive )
+            {
+            if( (iResultArray[iCurrentItem])->
+                              ObjectClass().Find( KClassImage ) == 0 ||
+            (iResultArray[iCurrentItem])->
+                              ObjectClass().Find( KClassVideo ) == 0)
+                {
+                UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW);
+                }
+            else if( ( iResultArray[iCurrentItem] )->ObjectClass()
+                                      .Find( KClassAudio ) == 0 )
+                {
+                UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY);
+                }        
+            else if( ( iResultArray[iCurrentItem] )->ObjectClass()
+                                      .Find( KClassContainer ) == 0 )
+                {
+                UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN);
+                }    
+            else
+                {
+                UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                }
+            }
+        }
+
+        
+        
+    __LOG( "CUPnPBrowseDialog::LoadListItemsL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::SendBrowseRequestL
+// Sends the browse request to UPnP AV Controller. When result set arrives,
+// UPnP AV Controller will call the "BrowseResponse" call back method,
+// which is implemented below.
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::SendBrowseRequestL( TInt aIndex )
+    {
+    __LOG1( "CUPnPBrowseDialog::SendBrowseRequestL, index: %d", aIndex );
+    iFirstResultArray = ETrue;
+    
+    iNeedRepeatRequest = EFalse;
+    iOriginalBrowseRequest = ETrue;
+    iServerReturnObjectCount = 0;
+    
+    iBrowseDirection = EForward;
+    
+    TInt cache = 0;
+    iDummyBrowseResponse = EFalse;
+    if( iBrowseSession )
+        {
+        // If the given index is negative, get the root ("0") container
+        if( KBrowseRoot == aIndex ) 
+            {
+            iUppermostItem = 0;
+            //Set browse flag for root browse
+            iBrowseFlag = KBrowseRoot;
+
+            // Clear parent id table
+            iParentId.ResetAndDestroy();
+
+            // Clear temporary array for browse view
+            iTempArray.Reset();
+            
+            // Clear previous browse view
+            
+            iCurrentFolderId = KContainerIdRoot().AllocL();
+           
+            // Make the browse request
+            cache = CacheCheck( *iCurrentFolderId );
+            if ( cache > 0 )
+                {
+                //update current cache item
+                CacheItemUpdateL( *iCurrentFolderId, EFalse );
+                }
+            else
+                {
+                //not founded in cache create new cache item
+                CacheItemUpdateL( *iCurrentFolderId, ETrue );
+                }            
+                        
+            iAction = CUPnPCommonUI::EUPnPBrowse;
+            iBrowseSession->BrowseL( *iCurrentFolderId, 
+                                     KFilterCommon,   /* filter */
+                                     MUPnPAVBrowsingSession::EDirectChildren,
+                                     0,               /* start index */
+                                     KBrowseRequestCount,/* request count */
+                                     KSortNone );     /* sort criteria */
+            }
+        else if( KBrowseBack == aIndex ) // Back operation
+            {
+            if ( iParentId.Count() > 0 )
+                {
+                // Set browse flag so that cleanup can be done in response
+                iBrowseFlag = KBrowseBack;
+
+                TInt startIndex =
+                iPrevHighlighteditem - KBrowseRequestCount;
+
+                if ( startIndex < 0 )
+                    {
+                    startIndex = 0;
+                    }
+                    
+                TInt requestCount = KBrowseRequestCount * 2;
+                CacheItemUpdateL( *iCurrentFolderId, EFalse );
+
+                delete iCurrentFolderId; iCurrentFolderId = NULL;
+                iCurrentFolderId = 
+                                iParentId[ iParentId.Count() - 1 ]->AllocL();
+                cache = CacheCheck( *iCurrentFolderId );
+                
+                if ( cache < 0 )
+                    {
+                    iUppermostItem = 0;
+                    iBrowseRequestSent = ETrue;
+                    iAction = CUPnPCommonUI::EUPnPBrowse;
+                    iBrowseSession->BrowseL( 
+                                     *iCurrentFolderId,
+                                     KFilterCommon,  /* filter */
+                                     MUPnPAVBrowsingSession::EDirectChildren,
+                                     startIndex,     /* start index */
+                                     requestCount,   /* request count */
+                                     KSortNone );    /* sort criteria */
+                    }
+                else
+                    {
+                    iDummyBrowseResponse = ETrue;
+                    }
+                }
+            }
+        else
+            {
+            // If there is an object in the browse array with the given
+            // index, get the container id of that object
+            iPrevHighlighteditem = iListBox->CurrentItemIndex();
+            if( iResultArray.Count() >= aIndex )
+                {
+                iBrowseFlag = KBrowseForward;
+
+                // store selected item index
+                iSelectedItem = aIndex;
+
+                //update current cache item
+                CacheItemUpdateL( *iCurrentFolderId, EFalse );
+                delete iCurrentFolderId; iCurrentFolderId = NULL;
+                iCurrentFolderId =
+                               iResultArray[ aIndex ]->Id().AllocL();
+               
+                // compare if the array what is about to be requested
+                // Make the browse request
+                cache = CacheCheck( *iCurrentFolderId );
+                if ( cache < 0 )
+                    {
+                    //not founded in cache create new cache item
+                    CacheItemUpdateL( *iCurrentFolderId, ETrue );
+                    iUppermostItem = 0;
+                    iBrowseRequestSent = ETrue;
+                    iAction = CUPnPCommonUI::EUPnPBrowse;
+                    iBrowseSession->BrowseL(
+                       ( ( CUpnpContainer*)iResultArray[aIndex])->Id(),
+                    /* CUpnpContainer (containing the object id of
+                            the container */
+                           KFilterCommon,       /* filter */
+                           MUPnPAVBrowsingSession::EDirectChildren,
+                           0,       /* start index */
+                           KBrowseRequestCount, /* request count */
+                           KSortNone );         /* sort criteria */
+                    }
+                else
+                    {
+                    iDummyBrowseResponse = ETrue;
+                    }                   
+
+
+                }
+            }
+        if ( iDummyBrowseResponse )
+            {
+            SendDummyBrowseResponseL( cache );
+            }
+        else
+            {
+            // Display waiting note if browse request is sent
+            DisplayWaitNoteL( R_UPNPCOMMONUI_BROWSE_UPDATE_WAIT_NOTE_DIALOG );
+            }    
+        }
+    else
+        {
+        __LOG(  " CUPnPBrowseDialog::SendBrowseRequestL: \
+                FAILED AV control point is NULL" );        
+
+        }
+        
+    __LOG( "CUPnPBrowseDialog::SendBrowseRequestL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::BrowseResponse
+// Returns browse results from UPnP AV control point.
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::BrowseResponse( const TDesC8& aBrowseResponse,
+    TInt aError, TInt /*aMatches*/, TInt aTotalCount, const TDesC8&
+    /*aUpdateId*/ )
+    {
+    __LOG1( "CUPnPBrowseDialog::BrowseResponse: %d", aError );
+       
+    RPointerArray<CUpnpObject> array;
+    
+    if( aError == KErrNone )
+        {
+        iRoot = EFalse;
+        CUPnPXMLParser* parser = NULL;
+        TRAP( aError, parser = CUPnPXMLParser::NewL();
+              parser->ParseResultDataL( array,
+              aBrowseResponse ) );
+        
+        delete parser;
+        }
+        
+    TRAP_IGNORE( BrowseResponseL( aError, aTotalCount, array ) );
+    
+    array.ResetAndDestroy();
+    
+    __LOG( "CUPnPBrowseDialog::BrowseResponse -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::BrowseResponseL
+// Returns browse results from UPnP AV control point.
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::BrowseResponseL(
+                            TInt aStatus,
+                            TInt aTotalCount,
+                            const RPointerArray<CUpnpObject>& aResultArray )
+    {    
+    __LOG( "CUPnPBrowseDialog::BrowseResponseL" );
+        
+    CUPnPCommonUI::TUPnPAction currentAction = iAction;
+    TInt currentCopyIndex = iCopyIndex;
+    iAction = CUPnPCommonUI::EUPnPBrowse;
+    TRAPD( error, HandleErrorL( aStatus ) );
+    iAction = currentAction;
+    iCopyIndex = currentCopyIndex;
+    User::LeaveIfError( error );
+
+    if( KErrNone == aStatus )
+        {
+        iTotalCount = aTotalCount;
+        SelectedArrayCheckL();
+        iAllObjectsReceived = EFalse;    
+        iBrowseRequestSent = EFalse;
+        if( iBrowseFlag != KBrowseRoot )
+            {
+            if ( iFirstResultArray )
+                {
+                if( iBrowseFlag == KBrowseBack ) //Back browse was made
+                    {
+                    delete iParentId[ iParentId.Count() - 1 ];
+                    iParentId.Remove( iParentId.Count() - 1 );
+
+                    // delete non-relevant parent name
+                    delete iParentName[iParentName.Count() - 1];
+                    iParentName.Remove( iParentName.Count() - 1 );
+                    }
+                else //Forward browse has been made
+                    {
+                    // Save Parent Id
+                    if ( iResultArray.Count() > 0 )
+                        {
+                        HBufC8* containerId = 
+                            ( iResultArray[ 0 ]->ParentId() ).AllocL();
+                        iParentId.Append( containerId );
+
+                        // store parent name
+                        HBufC8* name = 
+                         ( iResultArray[ iSelectedItem ]->Title() ).AllocL();
+                        iParentName.Append( name );
+                        }
+                    }
+                }
+            }
+        // If the result array in response to first browse request
+        if ( iFirstResultArray )
+           {
+           DeleteListItemsL();
+           iResultArray.Reset();
+          
+           // If Server don't return all of the objects requested in 
+           // an first browse request So need repeat browse request
+           // to get all objects which the first browse request desired
+           TInt tempCount = iTotalCount;
+           if ( tempCount > KBrowseRequestCount )
+               {
+               tempCount = KBrowseRequestCount;
+               }           
+           iServerReturnObjectCount = aResultArray.Count();
+           if ( iServerReturnObjectCount < tempCount )
+               {
+               iNeedRepeatRequest = ETrue;
+               }
+           }
+        
+        CTextListBoxModel* model = iListBox->Model();
+        
+        // If response to an original browse request, so could get count of 
+        // all objects which the original browse request desired 
+        // PS: the first browse request is actually an original browse request
+        if ( iOriginalBrowseRequest )
+            {
+            TInt tempCount = 0;
+            if ( iBrowseDirection == EForward )
+                {
+                tempCount = iTotalCount - iUppermostItem  -
+                            model->NumberOfItems();
+                }
+            else if ( iBrowseDirection == EBackward )
+                {
+                tempCount = iUppermostItem;
+                }
+            
+            if ( tempCount > KBrowseRequestCount )
+                {
+                tempCount = KBrowseRequestCount;
+                }
+            iNeedRecevedObjectCount = tempCount;
+            iCurrentRecevedObjectIndex = 0;
+            iOriginalBrowseRequest = EFalse;
+            }
+        
+        if( ( aResultArray.Count() + 
+              iUppermostItem + 
+              model->NumberOfItems() ) >= aTotalCount && 
+              aResultArray.Count() == 0 )
+            {
+            iAllObjectsReceived = ETrue; 
+            }
+        else //if not all the objects are recevied
+            {
+            if ( aResultArray.Count() < KBrowseRequestCount )
+                {
+                iAllObjectsReceviedInOneBrowse = EFalse;
+                iNumObjectReceviedInOnBrowse+=aResultArray.Count();
+                if( iNumObjectReceviedInOnBrowse >= KBrowseRequestCount )
+                    {
+                    iAllObjectsReceviedInOneBrowse = ETrue;
+                    }
+                }
+            }
+        
+        // Copy the items from the array received as a parameter
+        for( TInt index=0; index < aResultArray.Count(); index++ )
+            {
+            
+            if ( iBrowseDirection == EForward )
+                {
+                if ( ( aResultArray[index]->ObjectType() ==
+                                         EUPnPContainer ) )
+                    {
+                    CUpnpContainer* container = CUpnpContainer::NewL();
+                
+                    CleanupStack::PushL( container );
+                    container->CopyL( *aResultArray[ index ] );
+                    CleanupStack::Pop( container );
+                    iResultArray.Append( container );
+                    }
+                else 
+                    {
+                    CUpnpItem* item = CUpnpItem::NewL();
+                
+                    CleanupStack::PushL( item );
+                    item->CopyL( *aResultArray[ index ] );
+                    CleanupStack::Pop( item );
+                    iResultArray.Append( item );
+                    }                    
+                }
+            else if ( iBrowseDirection == EBackward )
+                {
+                if ( aResultArray[ index ]->ObjectType() == EUPnPContainer )
+                    {
+                    CUpnpContainer* container = CUpnpContainer::NewL();
+                    CleanupStack::PushL( container );
+                    container->CopyL( *aResultArray[ index ] );
+                    CleanupStack::Pop( container );
+                    iResultArray.Insert( container, index );
+                    iUppermostItem--;
+                    }
+                else
+                    {
+                    CUpnpItem* item = CUpnpItem::NewL();
+                
+                    CleanupStack::PushL( item );
+                    item->CopyL( *aResultArray[ index ] );
+                    CleanupStack::Pop( item );
+                    iResultArray.Insert( item, index );
+                    iUppermostItem--;
+                    }                    
+                }
+            }
+        
+            if ( iResultArray.Count() > ( KBrowseRequestCount * 2 ) )
+                {                
+                if ( iBrowseDirection == EForward )
+                    {
+                    for ( ;
+                        ( KBrowseRequestCount * 2 ) < iResultArray.Count(); )
+                        {
+                        delete iResultArray[ 0 ];
+                        iResultArray[ 0 ] = NULL;
+                        iResultArray.Remove( 0 );
+                        if ( iCurrentItem > 0 )
+                            {
+                            iCurrentItem--;    
+                            }                        
+                        iUppermostItem++;
+                        }                
+                    }
+                else if ( iBrowseDirection == EBackward )
+                    {
+                    for ( ; 
+                        ( KBrowseRequestCount * 2 ) < iResultArray.Count(); )
+                        {                    
+                        delete iResultArray[ ( iResultArray.Count() - 1 ) ];
+                        iResultArray[ ( iResultArray.Count() - 1 ) ] = NULL;
+                        iResultArray.Remove( iResultArray.Count() - 1 );
+                        iCurrentItem++;
+                        }
+                    }
+                }
+            
+        // Reload the list items
+        if ( iFirstResultArray )
+           {
+           if ( !iDummyBrowseResponse )
+               {
+               iCurrentItem = 0;
+               }               
+           iFirstResultArray = EFalse;
+           // update navi pane text
+           UpdateNaviPaneTextL();
+           // Redraw the list
+           iListBox->ActivateL();
+           iListBox->DrawDeferred();
+           }
+        DeleteListItemsL();
+        LoadListItemsL();
+        
+        // If count of CDS objects requesed in an original browse request
+        // isn't complete, countinue send browse request
+        iCurrentRecevedObjectIndex += aResultArray.Count();
+        if ( iNeedRepeatRequest && 
+             iCurrentRecevedObjectIndex < iNeedRecevedObjectCount )
+            {
+            TInt startIndex = KErrNotFound;
+            if ( iBrowseDirection == EForward )
+                {
+                TInt numberOfItems = iListBox->Model()->NumberOfItems();
+                startIndex = iUppermostItem + numberOfItems;
+                }
+            else if ( iBrowseDirection == EBackward )
+                {
+                startIndex = iUppermostItem - iServerReturnObjectCount;
+                }
+            iAction = CUPnPCommonUI::EUPnPBrowse;         
+            iBrowseSession->BrowseL( *iCurrentFolderId, 
+                                 KFilterCommon,       /* filter */
+                                 MUPnPAVBrowsingSession::EDirectChildren,
+                                 startIndex,          /* start index */
+                                 iServerReturnObjectCount,/* request count */
+                                 KSortNone );         /* sort criteria */
+            iBrowseRequestSent = ETrue;
+            }
+        else
+            {
+            DismissWaitNoteL();               
+            }
+        }
+    else
+        {
+        __LOG( "CUPnPBrowseDialog: \
+            Browse operation failed!" );
+        DismissWaitNoteL();
+        //Delete the current browsed container id in the cache and
+        // handle the error
+        DialogDismissedL( KErrNotFound );
+        }
+    
+    
+    __LOG( "CUPnPBrowseDialog::BrowseResponseL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::ClearTitleL
+// Sets title back to default.
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::ClearTitleL()
+    {
+    __LOG( "tCUPnPBrowseDialog::ClearTitleL" );
+    
+    TUid titlePaneUid;
+    titlePaneUid.iUid = EEikStatusPaneUidTitle;
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    CEikStatusPaneBase::TPaneCapabilities titlesubPane =
+        statusPane->PaneCapabilities( titlePaneUid );
+
+    CAknTitlePane* titlePane =
+        ( CAknTitlePane* ) statusPane->ControlL( titlePaneUid );
+    __LOG( "CUPnPBrowseDialog::ClearTitleL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::AppendIconToArrayL
+// Load a possibly skinned icon (with mask) and append it to an 
+// icon array.
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::AppendIconToArrayL( CAknIconArray* aArray,
+                                            MAknsSkinInstance* aSkin,
+                                            const TDesC& aMbmFile,
+                                            const TAknsItemID& aID,
+                                            TInt aBitmapId,
+                                            TInt aMaskId)
+    {
+    __LOG(  "CUPnPBrowseDialog::AppendIconToArrayL" );
+
+    __ASSERTD( aArray != NULL, __FILE__, __LINE__ );
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+
+    AknsUtils::CreateIconL(
+                aSkin, aID, bitmap, mask, aMbmFile, aBitmapId, aMaskId );
+    
+    CleanupStack::PushL( bitmap );
+    CleanupStack::PushL( mask );
+    
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    
+    icon->SetBitmapsOwnedExternally( EFalse );
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop( mask );
+    CleanupStack::Pop( bitmap );
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL( icon );
+    aArray->AppendL( icon );
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop( icon );
+    __LOG( "CUPnPBrowseDialog::AppendIconToArrayL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::MarkItemL
+// Marks one item
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::MarkItemL( TInt aItemIndex )
+    {
+    __LOG( "CUPnPBrowseDialog::MarkItemL" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    CListBoxView* listBoxView = iListBox->View();
+
+    if( iResultArray[ aItemIndex ] )
+        {
+        if( iResultArray[ aItemIndex ]->ObjectType() == EUPnPItem )
+            {
+            listBoxView->SelectItemL( aItemIndex );       
+            }           
+        }
+    UpdateCommandButtonAreaL( ETrue, iListBox->CurrentItemIndex() );
+    __LOG( "CUPnPBrowseDialog::MarkItemL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::UnmarkItemL
+// Unmarks one item
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::UnmarkItem( TInt aItemIndex )
+    {
+    __LOG( "CUPnPBrowseDialog::UnmarkItemL" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    CListBoxView* listBoxView = iListBox->View();
+    listBoxView->DeselectItem( aItemIndex );    
+    const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+    if ( indexes->Count() )
+        {
+        UpdateCommandButtonArea( ETrue, iListBox->CurrentItemIndex() );
+        }
+    else
+        {
+        UpdateCommandButtonArea( EFalse, iListBox->CurrentItemIndex() );
+        }
+    __LOG( "CUPnPBrowseDialog::UnmarkItemL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::MarkAllItemsL
+// Marks all items. Does not mark any containers.
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::MarkAllItemsL()
+    {
+    __LOG( "CUPnPBrowseDialog::MarkAllItemsL" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    TInt itemCount = model->NumberOfItems();
+    CListBoxView* listBoxView = iListBox->View();
+
+    // Go through the items and select all items
+    for( TInt index = 0; index < itemCount; index++ )
+        {
+        if( iResultArray[ index ]->ObjectType() == EUPnPItem )
+            {
+            listBoxView->SelectItemL( index );
+            }
+        }
+    UpdateCommandButtonAreaL( ETrue, iListBox->CurrentItemIndex() );
+    __LOG( "CUPnPBrowseDialog::MarkAllItemsL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::UnmarkAllItems
+// Unmarks all items
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::UnmarkAllItems()
+    {
+    __LOG( "CUPnPBrowseDialog::UnmarkAllItems" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    TInt itemCount = model->NumberOfItems();
+    CListBoxView* listBoxView = iListBox->View();
+    iSelectedItemsArray.ResetAndDestroy();
+    for( TInt index = 0; index < itemCount; index++ )
+        {
+        listBoxView->DeselectItem( index );
+        }
+    UpdateCommandButtonArea( EFalse, iListBox->CurrentItemIndex() );
+    __LOG( "CUPnPBrowseDialog::UnmarkAllItems-END" );
+    }
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::ShowPlayExtL
+// show image or video on external device
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::ShowPlayExtL()
+    {
+    __LOG( "CUPnPBrowseDialog::ShowPlayExtL" );
+    
+    SelectedArrayCheckL();
+    //if there is(are) audio item(s) marked, start playing it(them) on remote
+    //renderer    
+    if ( iSelectedItemsArray.Count() > 0 )
+        {
+        if( IsAudioItemMarked() )
+            {
+            //if marked items have at least one audio item
+            iIsMusicItem = ETrue;
+            }
+        else
+            {
+            iIsMusicItem = EFalse;
+            }                    
+        //if at least one audio file is either in marked items
+        //play it
+        if( iIsMusicItem && !iMusicPlay )
+            {
+            PlayL( EFalse );
+            }
+        }
+    else // if no marked items
+        {
+        if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
+                          ObjectClass().Find( KClassVideo ) == 0 )
+            {
+            ShowVideoDialogExtL();
+            }
+        else if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
+                              ObjectClass().Find( KClassImage ) == 0 )
+            {
+            StartImageControlL();
+            }
+        else if ( ( iResultArray[iListBox->CurrentItemIndex()] )->
+                          ObjectClass().Find( KClassAudio ) == 0 &&
+                          !iMusicPlay )    
+            {
+            PlayL( EFalse );
+            }
+        }
+    
+    __LOG( "CUPnPBrowseDialog::ShowPlayExtL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::CreateFillerLC
+// Creates a playlist representing current selection for music playback
+// --------------------------------------------------------------------------
+
+CUPnPPlayListFiller* CUPnPBrowseDialog::CreateFillerLC()
+    {
+    CUPnPPlayListFiller* filler = NULL;
+
+    if ( iSelectedItemsArray.Count() > 0 )
+        {
+        // Play marked items only
+        filler = CUPnPPlayListFiller::NewL();
+        CleanupStack::PushL( filler );
+        TInt firstAudioItem = KErrNotFound;
+        TBool focusedItemFound = EFalse;
+        for( TInt i = 0; i < iSelectedItemsArray.Count(); i++ )
+            {
+            filler->InsertObjectL(
+                iSourceDevice, *iSelectedItemsArray[ i ] );
+
+            if( UPnPItemUtility::BelongsToClass( *iSelectedItemsArray[ i ]
+                                                              , KClassAudio )
+                && firstAudioItem == KErrNotFound )
+                {
+                firstAudioItem = i;
+                }
+            if( iSelectedItemsArray[i]->Id() == iResultArray[ iListBox->
+                                                 CurrentItemIndex() ]->Id() )
+                {
+                filler->SetSelectedIndex( i );
+                focusedItemFound = ETrue;
+                }
+            }
+        // if focused item was not found set index to first audio item
+        if( !focusedItemFound )
+            {   
+            filler->SetSelectedIndex( firstAudioItem );
+            }
+        }
+    else
+        {
+        // play entire container starting from current pointer
+        TInt currentIndex = iListBox->CurrentItemIndex();
+        if( currentIndex < 0 )
+            {
+            currentIndex = 0;
+            }
+
+        if( iParentId.Count() == 0 )
+            {
+            //root level
+            filler = CUPnPBrowsePlaylistFiller::NewL(
+                KContainerIdRoot,
+                iUppermostItem,
+                iTotalCount );
+            }
+        else if( iParentId.Count() > 0)
+            {
+            //any other level
+            filler = CUPnPBrowsePlaylistFiller::NewL(
+                iResultArray[ 0 ]->ParentId(),
+                iUppermostItem,
+                iTotalCount );
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }
+        CleanupStack::PushL( filler );
+        for( TInt i = 0; i < iResultArray.Count(); i++ )
+            {
+            filler->InsertObjectL( iSourceDevice, *iResultArray[ i ] );
+            }
+        filler->SetSelectedIndex( currentIndex );
+        }
+
+    return filler;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::PlayL
+// Plays selected music file
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::PlayL( TBool aLocal )
+    {
+    __LOG( "CUPnPBrowseDialog::PlayL" );
+    TInt error = KErrNone;    
+    if( !aLocal )
+        {
+        if( !iImageControlActive )  //if not played via image control
+            {                        //start device dialog
+            iChildDialogOpen++;
+            error = iCommonUI.SelectDeviceL(
+                             iAVControl,
+                             *iTargetDevice,
+                             EUPnPSearchRenderingDevicesWithAudioCapability,
+                             EUPnPSelectDeviceTitle );
+            iChildDialogOpen--;                 
+            }
+        if ( KErrNone == error )
+            {
+            CUPnPPlayListFiller* filler = CreateFillerLC();
+            CleanupStack::Pop( filler ); 
+            iChildDialogOpen++;
+            iMusicPlay = ETrue;
+           //filler ownership transferred
+            error = iCommonUI.ExecuteMusicPlayerL(
+                iAVControl, filler, iTargetDevice );
+            
+            iMusicPlay = EFalse;
+            iChildDialogOpen--;
+            iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL(
+                                    R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+            iAvkonEnv->LoadAknLayoutL();
+            iAvkonAppUi->ReportResourceChangedToAppL(
+                                    KEikDynamicLayoutVariantSwitch );
+            }
+        else
+            {
+            __LOG( "CUPnPBrowseDialog::PlayL SelectDeviceL failed" );        
+            }    
+        }
+    else
+        {
+        CUPnPPlayListFiller* filler = CreateFillerLC();
+        CleanupStack::Pop( filler );
+        iChildDialogOpen++;
+        iMusicPlay = ETrue;
+        //filler ownership transferred
+        error = iCommonUI.ExecuteMusicPlayerL( iAVControl, filler, NULL );
+        
+        iMusicPlay = EFalse;
+        iChildDialogOpen--;
+        iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL(
+                                    R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+        iAvkonEnv->LoadAknLayoutL();
+        iAvkonAppUi->ReportResourceChangedToAppL(
+                                    KEikDynamicLayoutVariantSwitch );
+        }
+
+    if( KErrNone != error )
+        {
+        User::Leave( error );    
+        }
+    __LOG( "CUPnPBrowseDialog::PlayL-END" );
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DisplayWaitNoteL
+// 
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::DisplayWaitNoteL( TInt aResource )
+    {
+    __LOG( "CUPnPBrowseDialog::DisplayWaitNoteL" );
+    
+    // Wait dialog is terminated from Ready function
+    iWaitNoteDialog = new( ELeave )CAknWaitDialog(
+        ( REINTERPRET_CAST ( CEikDialog**,&iWaitNoteDialog ) ), ETrue );
+    iWaitNoteDialog->SetCallback( this );
+    iWaitNoteDialog->ExecuteLD( aResource );
+    
+    __LOG( "CUPnPBrowseDialog::DisplayWaitNoteL-END" );
+    }    
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DismissWaitNoteL
+// 
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::DismissWaitNoteL()
+    {
+    __LOG( "CUPnPBrowseDialog::DismissWaitNoteL" );
+    
+    if ( iWaitNoteDialog )
+        {
+        iWaitNoteDialog->ProcessFinishedL();
+        delete iWaitNoteDialog;
+        iWaitNoteDialog = NULL;
+        }
+
+    __LOG( "CUPnPBrowseDialog::DismissWaitNoteL-END" );
+    }  
+
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::GetHelpContext
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    __LOG( "CUPnPBrowseDialog::GetHelpContext" );
+    
+//    aContext.iMajor = TUid::Uid( KMediaGalleryUID3 );
+
+    aContext.iContext = KUPNP_HLP_REMOTE_DEVICES;
+
+    TInt count = iResultArray.Count();
+    for ( TInt index = 0; index < count; index++ )
+        {
+        if ( iResultArray[ index ]->ObjectType() != EUPnPContainer )
+            {
+            // show content help if folder contains items
+            aContext.iContext = KUPNP_HLP_CONTENT_VIEW;
+            // end loop
+            index = count;
+            }
+        }
+    __LOG( "CUPnPBrowseDialog::GetHelpContext-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::MediaServerDisappeared
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::MediaServerDisappeared( 
+                                TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG( "CUPnPBrowseDlg::MediaServerDisappeared" );
+
+    TInt error = KErrNone;
+    if( aReason == EDisconnected )
+        {
+        error = KErrSessionClosed;
+        iMSDisappear = ETrue;
+        }
+    else if( aReason == EWLANLost )
+        {
+        error = KErrDisconnected;
+        }
+    else
+        {
+        __PANICD( __FILE__, __LINE__ );
+        }
+    
+    TRAPD( err, DismissWaitNoteL() );
+    if ( err != KErrNone )
+        {
+        __LOG( "CUPnPBrowseDlg::MediaServerDisappeared \
+                                                     delete WaitNote error" );
+        }
+    
+    //Only HandleCopyL will set iAction to CUPnPCommonUI::EUPnPCopy, after
+    //HandleCopyL be called, HandleErrorL also will be called. So at here 
+    //HandleErrorL shouldn't be called. Otherwise will result ESLX-7M88UF
+    if ( iAction != CUPnPCommonUI::EUPnPCopy )
+        {
+        TRAP_IGNORE( HandleErrorL( error ) );
+        }
+    
+    __LOG( "CUPnPBrowseDlg::MediaServerDisappeared - END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::UpdateNaviPaneTextL
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::UpdateNaviPaneTextL()
+    {
+    __LOG( "CUPnPBrowseDialog::UpdateNaviPaneTextL" );
+
+    // Set text to navi pane
+    CEikStatusPane* sp = 
+        ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane();
+    iNaviPane = ( CAknNavigationControlContainer * )sp->ControlL(
+        TUid::Uid( EEikStatusPaneUidNavi ) );
+
+    // old decorator is popped and deleted
+    if ( iNaviDecorator )
+        {
+        iNaviPane->Pop( iNaviDecorator );
+        delete iNaviDecorator;
+        iNaviDecorator = NULL;
+        }
+    
+    if ( iImageControlActive )    
+        {
+        if( iTitlePane )
+            {
+            iTitlePane->SetTextL( *StringLoader::LoadLC(
+                                R_UPNPCOMMONUI_TITLE_SHOWING ) );
+            CleanupStack::PopAndDestroy();   
+            }
+        
+        // Get device friendly name and replace illegal characters.
+        HBufC8* tmpfriendlyname = 
+        UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+            iTargetDevice->FriendlyName() );
+            
+        CleanupStack::PushL( tmpfriendlyname );
+        TPtrC8 friendlyname = *tmpfriendlyname;
+        
+        HBufC *tmpbuf = UpnpString::ToUnicodeL( 
+            friendlyname.Left( KLength ) );
+        CleanupStack::PushL( tmpbuf );   
+
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( *tmpbuf );
+        CleanupStack::PopAndDestroy( tmpbuf );
+        CleanupStack::PopAndDestroy( tmpfriendlyname );
+        iNaviPane->PushL( *iNaviDecorator );         
+        }
+    // parent name is given    
+    else if ( iParentName.Count() > 0 )
+        {
+        //set back the title
+        if( iTitlePane )
+            {
+            // Get device friendly name and replace illegal characters.
+            HBufC8* tmpfriendlyname = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+                iSourceDevice.FriendlyName() );
+            CleanupStack::PushL( tmpfriendlyname );
+            
+            TPtrC8 friendlyname = *tmpfriendlyname;
+            HBufC *tmpbuf = UpnpString::ToUnicodeL( 
+                friendlyname.Left( KLength ) );
+            CleanupStack::PushL( tmpbuf ); 
+            
+            iTitlePane->SetTextL( *tmpbuf );
+            CleanupStack::PopAndDestroy( tmpbuf );
+            CleanupStack::PopAndDestroy( tmpfriendlyname );
+            }
+        
+        // Get name and replace illegal characters.
+        HBufC8* tmpname = 
+        UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+            *iParentName[ iParentName.Count() - 1 ] );
+            
+        CleanupStack::PushL( tmpname );
+        TPtrC8 tmpnameptr = *tmpname;
+        
+        HBufC* buf = UpnpString::ToUnicodeL( tmpnameptr.Left( KLength )  );
+        CleanupStack::PushL(buf);
+        // ownership of decorator is transfered to application
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( *buf );
+        CleanupStack::PopAndDestroy( buf );
+        CleanupStack::PopAndDestroy( tmpname );
+        iNaviPane->PushL( *iNaviDecorator );
+        }
+    __LOG( "CUPnPBrowseDialog::UpdateNaviPaneTextL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::CacheCheck
+// Checks if the wanted container is in Cache
+// --------------------------------------------------------------------------
+
+TInt CUPnPBrowseDialog::CacheCheck( const TDesC8& aCheckContainerId )
+    {    
+    __LOG( "CUPnPBrowseDialog::CacheCheck" );
+    
+    TInt retContainerCacheArrayId = -1;
+    for ( TInt index = 0; index < iBrowseCacheItems.Count(); index++ )
+        {
+        if ( aCheckContainerId.Compare( 
+                        iBrowseCacheItems[ index ]->ContainerId() ) == 0 )
+            {
+            // item is in cache
+            retContainerCacheArrayId = index;
+            break;
+            }
+        }
+    
+    __LOG( "CUPnPBrowseDialog::CacheCheck-END" );    
+    return retContainerCacheArrayId;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::SendDummyBrowseResponseL
+// sends dummy response as browseresponse from cache
+// --------------------------------------------------------------------------
+
+void CUPnPBrowseDialog::SendDummyBrowseResponseL( TInt aCacheIndex )
+    {
+    __LOG( "CUPnPBrowseDialog::SendDummyBrowseResponseL" );
+    iTempArray.Reset();
+    
+    TInt numberOfItems = iBrowseCacheItems[ aCacheIndex ]->GetNumberOfItems();
+    for ( TInt index = 0; index < numberOfItems; index++ )
+        {
+        iTempArray.Append( iBrowseCacheItems[ aCacheIndex ]->
+                                                          GetItem( index ) );
+        }
+    iUppermostItem = iBrowseCacheItems[ aCacheIndex ]->GetUpperMostItem();
+    iTotalCount = iBrowseCacheItems[ aCacheIndex ]->GetTotalCount();
+    iCurrentItem = iBrowseCacheItems[ aCacheIndex ]->GetHighlightedItem();
+    BrowseResponseL( KErrNone, iTotalCount, iTempArray );
+    __LOG( "CUPnPBrowseDialog::SendDummyBrowseResponseL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::CacheItemUpdateL
+// updates containers cache
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::CacheItemUpdateL( const TDesC8& aContainerId, 
+                                          TBool aNewItem )
+    {
+    __LOG( "CUPnPBrowseDialog::CacheItemUpdateL" );
+    if ( aNewItem )
+        {
+        __LOG( "CUPnPBrowseDialog::CacheItemUpdateL, NewItem" );
+        CUPnPBrowseCacheItem* test = CUPnPBrowseCacheItem::NewL( 
+                                                        aContainerId,
+                                                        iPrevHighlighteditem,
+                                                        iUppermostItem );
+        CleanupStack::PushL( test );
+        iBrowseCacheItems.Append( test );
+        CleanupStack::Pop( test );
+        }
+    else //update current item
+        {
+        TInt cacheItemIndex = CacheCheck( aContainerId );
+        if ( cacheItemIndex > -1 )
+            {
+            iBrowseCacheItems[ cacheItemIndex ]->SetFirstItem( 
+                                                iUppermostItem );
+            iBrowseCacheItems[ cacheItemIndex ]->SetHighLightedItem(
+                                                iCurrentItem );
+            iBrowseCacheItems[ cacheItemIndex ]->SetTotalCount(
+                                                iTotalCount );
+            //iResultArray ownership transferred here
+            iBrowseCacheItems[cacheItemIndex]->SetItemArrayL( iResultArray );
+            }
+        }
+    __LOG( "CUPnPBrowseDialog::CacheItemUpdateL-END" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::SelectedArrayCheckL
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::SelectedArrayCheckL( void )
+    {
+    __LOG( "CUPnPBrowseDialog::SelectedArrayCheckL" );
+    const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+    //add possible new selections
+    if ( indexes->Count() )
+        {
+        for ( TInt selectionCount = 0; selectionCount < indexes->Count();
+                                                       selectionCount++ )
+            {
+            TBool alreadyInArray = EFalse;            
+            for ( TInt i = 0; i < iSelectedItemsArray.Count(); i++ )
+                {
+                //checks if the selected BrowseArray item is
+                //in the selected items array
+                if ( !( iSelectedItemsArray[ i ]->Id().CompareC( ( 
+                            iResultArray[ indexes->At( selectionCount ) ]
+                            )->Id() ) ) )
+                                    
+                    {                    
+                    alreadyInArray = ETrue;
+                    i = iSelectedItemsArray.Count();
+                    }
+                }
+            //if not in array add it there
+            if ( !alreadyInArray )
+                {
+                CUpnpItem* itemForSelectionArray = CUpnpItem::NewL();
+                
+                itemForSelectionArray->CopyL( *iResultArray[ indexes->At(
+                                                     selectionCount ) ] );
+
+                iSelectedItemsArray.AppendL( itemForSelectionArray );
+                }
+            }
+        }
+    CTextListBoxModel* model = iListBox->Model();
+    TInt numberOfItems = model->NumberOfItems();
+    
+    //delete unselectedItems from selected items array    
+    if ( numberOfItems )
+        {
+        const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+        
+        //check all items in the current dialog
+        for ( TInt listItemIndex = 0; listItemIndex < numberOfItems;
+                                                  listItemIndex++ )
+            {
+            TBool notSelected = ETrue;
+            
+            //check all selected items
+            for ( TInt index = 0; index < indexes->Count() ; index++ )
+                {
+                if ( listItemIndex == indexes->At( index ) )
+                    {
+                    notSelected = EFalse;
+                    index = indexes->Count();
+                    }
+                }
+            //if not selected, check if the item is in selected items array
+            if ( notSelected )
+                {
+                //check selected items array   
+                for ( TInt selectionArray = 0;
+                      selectionArray < iSelectedItemsArray.Count() ;
+                      selectionArray++ )
+                     
+                    {                    
+                    if ( !( iSelectedItemsArray[ selectionArray ]->
+                                                               Id().CompareC(
+                       ( ( CUpnpItem* )iResultArray[ listItemIndex ] )
+                                                                ->Id() ) ) )
+                        {
+                        delete iSelectedItemsArray[ selectionArray ];
+                        iSelectedItemsArray.Remove( selectionArray );
+                        iSelectedItemsArray.Compress();
+                        selectionArray = iSelectedItemsArray.Count();
+                        }
+                    }
+                }
+            }
+        }
+    __LOG( "CUPnPBrowseDialog::SelectedArrayCheckL-END" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::StartImageControlL
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::StartImageControlL()
+    {
+    __LOG( "CUPnPBrowseDialog::StartImageControlL" );
+    TInt error = KErrNone;
+    
+    iChildDialogOpen++;
+    error = iCommonUI.SelectDeviceL(
+                           iAVControl,
+                           *iTargetDevice,
+                           EUPnPSearchRenderingDevicesWithImageCapability,
+                           EUPnPSelectDeviceTitle );
+    iChildDialogOpen--;
+    if ( KErrNone == error )
+        {
+        if( !iImagePlayer )
+            {
+            iImagePlayer = CUpnpImagePlayer::NewL( iAVControl, 
+                                                   *this, 
+                                                   iCommonUI );
+            }
+        
+        TRAP( error, iImagePlayer->SetTargetDeviceL( *iTargetDevice ) );
+        
+        if( KErrNone == error )
+            {
+            StartImageControlTimer();
+            iImageControlActive = ETrue;
+            UpdateNaviPaneTextL();
+            UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
+            }
+        else
+            {
+            __LOG( "CUPnPBrowseDialog::StartImageControlL SetTargetDeviceL \
+didn't selected" );
+            }
+        }
+    else
+        {
+        __LOG( "CUPnPBrowseDialog::StartImageControlL SelectDevice \
+didn't selected" );
+        }
+    if( KErrNone != error )
+        {
+        User::Leave( error );    
+        }
+    
+    __LOG( "CUPnPBrowseDialog::StartImageControlL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::StopImageControlL
+// --------------------------------------------------------------------------
+        
+void CUPnPBrowseDialog::StopImageControlL()
+    {
+    __LOG( "CUPnPBrowseDialog::StopImageControlL" );
+    if ( iImageControlActive )
+        {
+        iImageControlActive = EFalse;
+        iImageControlTimer->Cancel();
+        ShowCurrentImageL( EFalse );
+        UpdateNaviPaneTextL();
+        TInt currentItemIndex = iListBox->CurrentItemIndex();
+        if ( currentItemIndex < 0 )
+            {
+            currentItemIndex = 0;
+            }
+        UpdateCommandButtonAreaL( EFalse, currentItemIndex );    
+        iAction = CUPnPCommonUI::EUPnPNone;
+        iImagePlayer->Stop();
+        }
+    
+    __LOG( "CUPnPBrowseDialog::StopImageControlL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::UpdateSoftkeysL
+// Update CBA-keys
+// --------------------------------------------------------------------------
+
+void CUPnPBrowseDialog::UpdateSoftkeysL( TInt aResourceId )
+    {   
+    __LOG( "CUPnPBrowseDialog::UpdateSoftkeysL" );
+    CEikButtonGroupContainer* cba = &ButtonGroupContainer();
+    cba->SetCommandSetL( aResourceId );
+    cba->DrawDeferred();
+    __LOG( "CUPnPBrowseDialog::UpdateSoftkeysL-END" );
+    }
+    
+// --------------------------------------------------------------------------
+// UPnPImagePlayerDialog::ImageControlTimerCallbackL
+// Callback method for the Timer.
+// --------------------------------------------------------------------------
+TInt CUPnPBrowseDialog::ImageControlTimerCallbackL( TAny* aDlg )
+    {
+    __LOG( "CUPnPBrowseDialog::ImageControlTimerCallbackL" );
+    static_cast< CUPnPBrowseDialog* >( aDlg )->iImageControlTimer->Cancel();
+    if ( !( static_cast< CUPnPBrowseDialog* >( aDlg )->iBrowseRequestSent ) )
+        {
+        static_cast< CUPnPBrowseDialog* >( aDlg )->ShowCurrentImageL( ETrue );
+        }
+    else
+        {
+        static_cast<CUPnPBrowseDialog*>(aDlg)->StartImageControlTimer();
+        }    
+    __LOG( "CUPnPBrowseDialog::ImageControlTimerCallbackL-END" );
+    return KErrNone;
+}
+    
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::StartImageControlTimer
+// Starts periodic timer
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::StartImageControlTimer( void )
+    {
+    __LOG( "CUPnPBrowseDialog::StartImageControlTimer" );
+    iImageControlTimer->Start( 
+                        KImageTimerDelay,
+                        KImageTimerInterval,
+                        TCallBack( ImageControlTimerCallbackL, this ) );
+    __LOG( "CUPnPBrowseDialog::StartImageControlTimer-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::ShowCurrentImageL
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::ShowCurrentImageL( TBool aShowImage )
+    {
+    __LOG( "CUPnPBrowseDialog::ShowCurrentImageL" );
+    
+    TInt currentItemIndex = iListBox->CurrentItemIndex();
+    if ( currentItemIndex < 0 )
+        {
+        currentItemIndex = 0;
+        }
+    
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast< CDesCArray* >( textArray );
+    
+    if( iLastImageItemIndex >= 0 ) //if last item was image
+        {
+        TBuf<KMaxFileName> lastItem;
+        HBufC *lastTmpItem = UpnpString::ToUnicodeL( 
+            iResultArray[ iLastImageItemIndex ]->Title().Left( KLength ) );
+        CleanupStack::PushL( lastTmpItem );
+        lastItem.Format( KFormatString(), 
+                         EUPnPIconImage, 
+                         lastTmpItem);
+        CleanupStack::PopAndDestroy ( lastTmpItem );
+                 
+        listBoxItems->Delete( iLastImageItemIndex );
+        listBoxItems->InsertL( iLastImageItemIndex, lastItem );
+        iListBox->HandleItemAdditionL();
+        if( ( iResultArray[ iListBox->CurrentItemIndex() ] )->
+                          ObjectClass().Find( KClassImage ) != 0 )
+            {
+            iLastImageItemIndex = KErrNotFound;    
+            }
+        }    
+
+    if ( ( iResultArray[ iListBox->CurrentItemIndex() ] )->
+                          ObjectClass().Find( KClassImage ) == 0 )
+        {
+        if( ( CUpnpItem* )iResultArray[ currentItemIndex ]
+                                                ->Title().Length() != 0 )
+            {
+            HBufC *tmpItem = UpnpString::ToUnicodeL( 
+                    iResultArray[ currentItemIndex ]->
+                                    Title().Left( KLength ) );
+            CleanupStack::PushL( tmpItem );
+            
+            TBuf<KMaxFileName> item;
+            //if not showing an image
+            if ( !aShowImage )
+                {   
+                item.Format( KFormatString(), EUPnPIconImage, tmpItem);
+                iLastImageItemIndex = KErrNotFound;
+                listBoxItems->Delete( currentItemIndex );
+                listBoxItems->InsertL( currentItemIndex, item );
+                }
+            else //if showing an image
+                {
+                
+                item.Format( KFormatString2() ,EUPnPIconImage,
+                                               tmpItem,
+                                               EUPnPIconImageShowing );
+                if(iImagePlayer)
+                    {
+                    __LOG( "CUPnPBrowseDialog::iImagePlayer->PlayL" );
+                    iAction = CUPnPCommonUI::EUPnPShow;
+                    TRAPD( error, iImagePlayer->PlayL( 
+                                  *iResultArray[currentItemIndex] ) );
+                    
+                    HandleErrorL( error );
+                    
+                    }     
+
+                //listBoxItem.Set( item );
+                listBoxItems->Delete( currentItemIndex );
+                listBoxItems->InsertL( currentItemIndex, item );
+                iLastImageItemIndex = currentItemIndex;
+                }
+            CleanupStack::PopAndDestroy ( tmpItem );
+            iListBox->HandleItemAdditionL();
+            iListBox->SetCurrentItemIndexAndDraw( currentItemIndex );
+            }
+        }
+    
+    __LOG( "CUPnPBrowseDialog::ShowCurrentImageL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::ShowVideoDialogExt
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::ShowVideoDialogExtL()
+    {
+    __LOG( "CUPnPBrowseDialog::ShowVideoDialogExtL" );
+    
+    TInt error = KErrNone;
+    
+    const CUpnpObject* selectedObject = 
+                                iResultArray[ iListBox->CurrentItemIndex() ];
+    
+    if( !iImageControlActive ) //if showing video is not from image timer
+        {                        //then start select device dialog
+        iChildDialogOpen++;
+        error = iCommonUI.SelectDeviceL(
+                     iAVControl,
+                     *iTargetDevice,
+                     EUPnPSearchRenderingDevicesWithVideoCapability,
+                     EUPnPSelectDeviceTitle );
+        iChildDialogOpen--;
+        }
+    else //if target renderer exists, check video capability
+        {
+        if( !iTargetDevice->VideoCapability() )
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+    if( KErrNone == error )
+        {
+        iAction = CUPnPCommonUI::EUPnPShow;    
+        MUPnPAVRenderingSession* renderingSession = NULL;    
+        renderingSession = &( iAVControl.StartRenderingSessionL( 
+                                                  *iTargetDevice ) );
+        
+        iChildDialogOpen++;
+        //trap here to release rendering session properly, better to 
+        //create and destroy the rendering ession inside the video player
+        TInt ret = KErrNone;
+        TRAP( error, ret = iCommonUI.ExecuteVideoPlayerL( 
+                                               *renderingSession, 
+                                               *selectedObject ) );
+        
+        if( ret < KErrNone && error == KErrNone )
+            {
+            error = ret;
+            }
+        renderingSession->RemoveObserver();
+        iAVControl.StopRenderingSession( *renderingSession );
+            
+        iChildDialogOpen--;
+        
+        //if not media server or wlan lost, update its navipane
+        if( !iMSDisappear && error != KErrDisconnected )
+            {
+            UpdateNaviPaneTextL();    
+            }
+        }
+     else
+        {
+        __LOG( "ShowVideoDialogExtL: SetTargetDeviceL FAILED" );
+        }
+     
+     if( KErrNone != error )
+        {
+        User::Leave( error );
+        }
+     
+    __LOG( "CUPnPBrowseDialog::ShowVideoDialogExtL-END" );   
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::HandleCopyL()
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::HandleCopyL() 
+    {
+    __LOG( "CUPnPBrowseDialog::HandleCopyL" );   
+   
+    iAction = CUPnPCommonUI::EUPnPCopy;
+    iCopyIndex = NULL;
+    TInt selected_item = iListBox->CurrentItemIndex();
+    iCopying = ETrue;
+    if( iResultArray[ selected_item ]->ObjectType() == EUPnPContainer )
+        {
+        // Instantiate the UPnP File Transfer Engine
+        CUpnpFileTransferEngine* ftEngine = 
+                    CUpnpFileTransferEngine::NewL( iBrowseSession );
+        CleanupStack::PushL( ftEngine );
+        
+        TBool playlistContainer = EFalse;
+        playlistContainer = UPnPCommonUtils::IsPlaylistContainerL( 
+                            *iResultArray[ iListBox->CurrentItemIndex() ] );
+        
+        // Copy container to phone memory
+        TInt copyErr = KErrNone;
+        if( playlistContainer )
+            {
+            TRAP( copyErr, ftEngine->CopyRemotePlaylistToHandsetL(
+                             ( CUpnpContainer* )iResultArray[
+                             iListBox->CurrentItemIndex() ] ) );
+            }
+        else
+            {
+            TRAP( copyErr, ftEngine->CopyRemoteContainerToHandsetL(
+                                         ( CUpnpContainer* )iResultArray[
+                                         iListBox->CurrentItemIndex() ] ) );
+            }
+            
+        iCopyIndex = ftEngine->ItemCopiedFromContainer();
+        
+        User::LeaveIfError( copyErr );
+        
+        // Clean up ftEngine
+        CleanupStack::PopAndDestroy( ftEngine );
+        ftEngine = NULL;    
+        }
+    else
+        {
+        RPointerArray<CUpnpItem> tempArrayForCopy;
+        CleanupResetAndDestroyPushL( tempArrayForCopy );
+        if ( iSelectedItemsArray.Count() )
+            {
+            for ( TInt count=0; 
+                  count < iSelectedItemsArray.Count(); 
+                  count++ )
+                {
+                CUpnpItem* tempItem = CUpnpItem::NewL();
+                CleanupStack::PushL( tempItem );
+                
+                
+                tempItem->CopyL( *iSelectedItemsArray[ count ] );
+                
+                //ownership transferred
+                tempArrayForCopy.AppendL( tempItem );
+                CleanupStack::Pop( tempItem );
+                }
+            iCopyIndex = iSelectedItemsArray.Count();    
+            }
+        else
+            {
+            CUpnpItem* tempItem = CUpnpItem::NewL();
+            CleanupStack::PushL( tempItem );
+            tempItem->CopyL( *iResultArray[selected_item] );
+            //ownership transferred
+            tempArrayForCopy.AppendL( tempItem );
+            CleanupStack::Pop( tempItem );
+            iCopyIndex = 1;
+            }
+        // Instantiate the UPnP File Transfer Engine
+        CUpnpFileTransferEngine* ftEngine = NULL;
+        ftEngine = CUpnpFileTransferEngine::NewL( iBrowseSession );
+        CleanupStack::PushL( ftEngine );
+         // Copy to phone
+        ftEngine->CopyRemoteItemsToHandsetL( tempArrayForCopy );
+        // Clean up ftEngine
+        CleanupStack::PopAndDestroy( ftEngine );
+        ftEngine = NULL;
+        CleanupStack::PopAndDestroy( &tempArrayForCopy );
+        }
+     iCopying = EFalse;
+     UnmarkAllItems(); 
+
+     __LOG( "CUPnPBrowseDialog::HandleCopyL-END" );  
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DeviceDisappeared( TInt aError )
+// called in image play
+//---------------------------------------------------------------------------
+void CUPnPBrowseDialog::DeviceDisappeared( TInt aError )
+    {
+    TRAP_IGNORE( HandleErrorL( aError ) );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::HandleErrorL( TInt aError )
+// Handle errors in all the case EGKL-6ZPH89
+//---------------------------------------------------------------------------
+void CUPnPBrowseDialog::HandleErrorL( TInt aError )
+    {
+    iCommonUI.GetUpnpAction( iAction );
+    //if media server or WLAN lost, close the browse dialog    
+    if( ( KErrSessionClosed == aError && iMSDisappear ) ||
+          KErrDisconnected == aError ||
+          EAknCmdExit == aError ||
+          EEikCmdExit == aError )
+        {
+        if( iError == KErrNone )
+            {
+            iError = aError;
+            }
+        
+        if( iChildDialogOpen > 0 ) 
+            {
+            //if some dialos are open on the top of browse dialog, 
+            //close those dialogs and do the corresponding action via
+            //errors returned from them 
+            iCommonUI.DismissDialogL( aError );
+            }
+        else //if no, do the corresponding action via the error
+            {
+            TryExitL( aError );
+            }
+        }
+     else
+        {
+        // if media renderer disappears
+        if( KErrSessionClosed == aError && !iMSDisappear )
+            {
+            StopImageControlL();
+            UpdateNaviPaneTextL();    
+            }
+        
+        iCommonUI.HandleCommonErrorL( aError, iCopyIndex );
+        iAction = CUPnPCommonUI::EUPnPNone;
+        iCopyIndex = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::HandleResourceChange
+// --------------------------------------------------------------------------
+//    
+void CUPnPBrowseDialog::HandleResourceChange(TInt aType)
+    {
+    __LOG("[UPnPCommonUI]\t CUPnPBrowseDialog::HandleResourceChange");
+    CAknDialog::HandleResourceChange(aType);
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::IsAudioItemMarked
+// --------------------------------------------------------------------------
+TBool CUPnPBrowseDialog::IsAudioItemMarked( void )
+    {
+    TBool mark = EFalse;
+    const CArrayFix<TInt>* indexes = iListBox->SelectionIndexes();
+    if ( indexes->Count() ) //if items are marked
+        {
+        for (TInt count=0; count < indexes->Count(); count++)
+            {
+            if ( ( iResultArray[indexes->At(count)])->
+                                ObjectClass().Find( KClassAudio )
+                   == 0 ) //audio
+                {
+                mark = ETrue;
+                count = indexes->Count();
+                }                
+            }
+        }
+    __LOG( "CUPnPBrowseDialog::IsAudioItemMarked-END" );      
+    return mark;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::UpdateCommandButtonAreaL( 
+//      TBool aMark, TInt tempCounter )
+// Updates command button area
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::UpdateCommandButtonAreaL( TBool aMark,
+        TInt aTempCounter )
+    {
+    if( aTempCounter>=0 && iResultArray.Count() )
+        {
+        if( !aMark ) // no marked items in the list box
+            {
+            if( ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassImage ) ) ||
+            ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassVideo ) ) )
+                {
+                UpdateSoftkeysL( 
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW );
+                }
+            else if( ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassAudio ) ) )
+                {
+                UpdateSoftkeysL( 
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
+                }        
+            else if( ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassContainer ) ) )
+                {
+                UpdateSoftkeysL( 
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN );
+                }
+            else
+                {
+                UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                }        
+            }
+        else // at least one marked item in the list box
+            {
+            if( ( UPnPItemUtility::BelongsToClass(
+                    *iResultArray[aTempCounter], KClassContainer ) ) )
+                {
+                UpdateSoftkeysL( 
+                        R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN );
+                }        
+            else if( !IsAudioItemMarked() )
+                {
+                //if no audio item have been marked.
+                UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                }
+            else
+                {
+                if( !( UPnPItemUtility::BelongsToClass(
+                        *iResultArray[aTempCounter], KClassAudio ) ) )
+                    {
+                    UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                    }
+                else
+                    {
+                    UpdateSoftkeysL( 
+                            R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY );
+                    }
+                }       
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::UpdateCommandButtonArea( TBool aMark, TInt tempCounter )
+// Updates command button area
+// --------------------------------------------------------------------------
+void CUPnPBrowseDialog::UpdateCommandButtonArea( TBool aMark,
+        TInt aTempCounter )
+    {
+    TInt error = KErrNone;
+    TRAP( error, UpdateCommandButtonAreaL( aMark, aTempCounter ) );
+    if( error )
+        {
+        __LOG1( "UpdateCommandButtonAreaL error,error=%d", error );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpcommonui.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,669 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Common UI.
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <AknUtils.h>
+#include <featmgr.h>
+#include <bautils.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+#include <pathinfo.h> //PathInfo
+
+// upnp stack api
+#include <upnpobject.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h"
+#include "upnpavrenderingsession.h"
+#include "upnpavdevice.h"
+#include "upnpmediaserversettings.h"
+
+// upnpframework / internal api's
+#include "upnpmusicadapter.h"
+
+// commonui internal
+#include "upnpcommonui.h"
+#include <upnpcommonui.rsg>
+#include "upnpexternaldevicedialog.h"
+#include "upnpbrowsedialog.h"
+#include "upnpvideoplayerdialog.h"
+#include "upnpadvfinddialog.h"
+#include "upnpselectiondialog.h"
+
+// debug stuff
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+// Filename of rsc file
+_LIT( KUPnPCommonUiRscFile, "\\resource\\upnpcommonui.rsc" );
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::CUPnPCommonUI
+// --------------------------------------------------------------------------
+//
+CUPnPCommonUI::CUPnPCommonUI()
+    {
+    __LOG( "CUPnPCommonUI::CUPnPCommonUI" );
+    iFeatureManagerInitialized = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPCommonUI::ConstructL()
+    {
+    __LOG( "CUPnPCommonUI::ConstructL" );
+
+    iCoeEnv = CEikonEnv::Static();
+    RFs& fileSession = iCoeEnv->FsSession();
+
+    // Load common ui resource file
+    TFileName rscFileName( KUPnPCommonUiRscFile );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive );
+    
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( fileSession, rscFileName ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+    iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName );
+
+    FeatureManager::InitializeLibL();
+    iFeatureManagerInitialized = ETrue;
+
+    // Get AppUI pointer
+    iAppUi = static_cast<CAknViewAppUi*>( iCoeEnv->EikAppUi() );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::NewL()
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPCommonUI* CUPnPCommonUI::NewL()
+    {
+    __LOG( "CUPnPCommonUI::NewL" );
+    
+    CUPnPCommonUI* self = new ( ELeave) CUPnPCommonUI();
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPCommonUI::~CUPnPCommonUI()
+    {
+    __LOG( "CUPnPCommonUI::~CUPnPCommonUI" );
+
+    if ( iFeatureManagerInitialized )
+        {
+        FeatureManager::UnInitializeLib();
+        }
+   
+    // Un-Load resource file
+    if ( iResFileOffset )
+        {
+        iCoeEnv->DeleteResourceFile( iResFileOffset );
+        iResFileOffset = 0;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::ExecuteDeviceDialogL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPCommonUI::ExecuteDeviceDialogL(
+    MUPnPAVController& aAVControl )
+    {
+    __LOG( "CUPnPCommonUI::ExecuteDeviceDialogL" );
+    
+    TInt returnValue = KErrArgument;
+
+    iExternalDeviceSelection = CUPnPExternalDeviceDialog::NewL(
+        R_UPNPCOMMONUI_EXTERNAL_DEVICE_DIALOG_MENUBAR,
+        aAVControl,
+        *this );
+
+    
+    iExternalDeviceSelection->SetMopParent( iAppUi );
+    returnValue = iExternalDeviceSelection->ExecuteLD(
+        R_UPNPCOMMONUI_EXTERNAL_MEDIA_SELECT_DIALOG );
+    iExternalDeviceSelection = NULL;
+
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::ExecuteBrowseDialogL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPCommonUI::ExecuteBrowseDialogL(
+    MUPnPAVController& aAVControl,
+    const CUpnpAVDevice& aDevice)
+    {
+    __LOG( "CUPnPCommonUI::ExecuteBrowseDialogL" );
+
+
+    TInt returnValue = KErrArgument;
+    
+    TInt error = KErrNone; 
+
+
+    iBrowseSelection = CUPnPBrowseDialog::NewL(
+            R_UPNPCOMMONUI_BROWSE_DIALOG_MENUBAR, aAVControl, aDevice, *this );
+
+    iBrowseSelection->SetMopParent( iAppUi );
+    TRAP( error, returnValue =  iBrowseSelection->ExecuteLD( 
+                                        R_UPNPCOMMONUI_BROWSE_DIALOG ) );
+    iBrowseSelection = NULL;
+
+    if( error != KErrNone )
+        {
+        returnValue = error;
+        }
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::ExecuteVideoPlayerL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPCommonUI::ExecuteVideoPlayerL( 
+    MUPnPAVRenderingSession& aRenderingSession,
+    const CUpnpObject& aObject )
+    {
+    __LOG( "CUPnPCommonUI::ExecuteVideoPlayerL" );
+
+    TInt returnValue = KErrArgument;
+
+    iVideoPlayerDialog = CUPnPVideoPlayerDlg::NewL( 
+              aRenderingSession, aObject, *this );
+    iVideoPlayerDialog->SetMopParent( iAppUi );
+    TRAPD( error, returnValue = iVideoPlayerDialog->ExecuteLD(
+        R_UPNPCOMMONUI_VIDEO_PLAYER_DIALOG ) );
+    iVideoPlayerDialog = NULL;
+    
+    if( error != KErrNone )
+        {
+        returnValue = error;
+        }
+        
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::ExecuteMusicPlayerL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPCommonUI::ExecuteMusicPlayerL( 
+                                   MUPnPAVController& aAVControl,
+                                   CUPnPPlayListFiller* aFiller,
+                                   const CUpnpAVDevice* aTargetDevice )
+    {
+    TInt returnValue = KErrArgument;
+
+    iMusicAdapter = CUPnPMusicAdapter::NewL( aAVControl ); 
+    TInt error = KErrNone;   
+    if( aTargetDevice )
+        {
+        //play in remote
+        TRAP( error, returnValue = iMusicAdapter->ExecuteMusicInRemoteL( 
+            iCoeEnv->EikAppUi(),
+            aFiller,
+            *aTargetDevice ) );
+        }
+    else 
+        {
+        //play in local
+        TRAP( error, returnValue = iMusicAdapter->ExecuteMusicInLocalL(
+             iCoeEnv->EikAppUi(),
+             aFiller ) );
+        }
+    delete iMusicAdapter;
+    iMusicAdapter = 0;
+
+    if( error != KErrNone )
+        {
+        returnValue = error;
+        }
+    return returnValue;
+    }
+
+                  
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::SelectDeviceL
+// Displays a UPnP device selection pop-up dialog.
+// --------------------------------------------------------------------------
+EXPORT_C TInt CUPnPCommonUI::SelectDeviceL( MUPnPAVController& aAVControl,
+                                            CUpnpAVDevice& aDevice,
+                                            TUPnPDeviceTypesToSearch aType,
+                                            TUPnPDialogTitle aTitle )
+    {
+    __LOG( "CUPnPCommonUI::SelectDeviceL" );
+
+
+    TInt returnValue = KErrGeneral;
+
+    // Create the selection popup
+    delete iDeviceSelection; iDeviceSelection = NULL;
+    iDeviceSelection = CUPnPSelectionDialog::NewL( aAVControl );
+    
+    // Read the title string
+    HBufC* title = NULL;
+    if( aTitle == EUPnPCopyToTitle )
+        {
+        title = StringLoader::LoadLC( R_UPNPCOMMONUI_COPY_TO_TEXT );
+        } 
+    else if( aTitle == EUPnPMoveToTitle )
+        {        
+        title = StringLoader::LoadLC( R_UPNPCOMMONUI_MOVE_TO_TEXT );
+        }
+    else
+        {
+        if( aType == EUPnPSearchRenderingDevicesWithAudioCapability )
+            {
+            title = StringLoader::LoadLC( R_UPNPCOMMONUI_SELECT_PLAYER_TEXT );
+            }
+        else
+            {
+            title = StringLoader::LoadLC( R_UPNPCOMMONUI_SELECT_DEVICE_TEXT );
+            }
+        }
+
+    if( aType == EUPnPSearchAllDevices ||
+        aType == EUPnPSearchAllServerDevices ||
+        aType == EUPnPSearchServerDevicesWithCopyCapability ||
+        aType == EUPnPSearchServerDevicesWithSearchCapability ||
+        aType == EUPnPSearchAllRenderingDevices ||
+        aType == EUPnPSearchRenderingDevicesWithImageCapability ||
+        aType == EUPnPSearchRenderingDevicesWithVideoCapability ||
+        aType == EUPnPSearchRenderingDevicesWithImageAndVideoCapability ||
+        aType == EUPnPSearchRenderingDevicesWithAudioCapability )
+        {
+        iDeviceSelection->CreatePopupL( *title, aType );
+        returnValue = iDeviceSelection->StartPopupL( aDevice );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( title ); 
+        title = NULL;
+        return KErrNotSupported;
+        }
+    
+     // Clean up
+    CleanupStack::PopAndDestroy( title ); 
+    title = NULL;
+    delete iDeviceSelection; iDeviceSelection = NULL;
+
+    __LOG1( "CUPnPCommonUI::SelectDeviceL: %d", returnValue );
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::DisplayConnectionErrorNote()
+// Displays error note R_UPNP_ERROR_CON_TEXT
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPCommonUI::DisplayConnectionErrorNoteL()
+    {
+    HBufC* errorText = StringLoader::LoadLC( R_UPNPCOMMONUI_ERROR_CON_TEXT );
+    CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( ETrue );
+    errorNote->ExecuteLD( *errorText );
+    CleanupStack::PopAndDestroy( errorText );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::DisplayConnectionLostCopyErrorNoteL()
+// Displays error note R_UPNPCOMMONUI_CONN_LOST_COPY_ERROR_TEXT
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPCommonUI::DisplayConnectionLostCopyErrorNoteL()
+    {
+    __LOG( "CUPnPCommonUI::DisplayConnectionLostCopyErrorNoteL" );
+    HBufC* errorText = StringLoader::LoadLC( 
+                           R_UPNPCOMMONUI_CONN_LOST_COPY_ERROR_TEXT );
+    CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( ETrue );
+    errorNote->ExecuteLD( *errorText );
+    CleanupStack::PopAndDestroy( errorText );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::ExecuteAdvFindDialogL()
+// --------------------------------------------------------------------------
+//
+TInt CUPnPCommonUI::ExecuteAdvFindDialogL(
+                                MUPnPAVController& aAVControl,
+                                MUPnPAVBrowsingSession& aBrowsingSession)
+
+    {
+    __LOG( "CUPnPCommonUI::ExecuteAdvFindDialogL" );
+    
+    
+    TInt returnValue = KErrArgument;
+    TInt error = KErrNone;
+
+    iAdvFindDialog = CUPnPAdvancedFindDialog::NewL(
+                            R_UPNPCOMMONUI_ADVANCED_FIND_MAIN_DIALOG,
+                            aAVControl,
+                            aBrowsingSession,
+                            *this );
+
+    iAdvFindDialog->SetMopParent( iAppUi );
+
+    TRAP( error, returnValue = iAdvFindDialog->ExecuteLD(
+                            R_UPNPCOMMONUI_ADVANCED_FIND_MAIN_DIALOG ) );
+    
+    iAdvFindDialog = NULL;
+    
+    if( KErrNone != error )
+        {
+        returnValue = error;
+        }
+    
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::DismissDialogL()
+// called only when the media server disconnected or WLAN connection is lost
+// to close the dialogs which are running on the top of the mother class
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPCommonUI::DismissDialogL( TInt aError )
+    {
+    if( iDeviceSelection && KErrSessionClosed == aError )
+        {
+        iDeviceSelection->DismissItself( aError );
+        }
+    
+    if( iVideoPlayerDialog )
+        {
+        iVideoPlayerDialog->DismissItselfL( aError ); 
+        iVideoPlayerDialog = NULL;
+        }
+        
+    if( iMusicAdapter )
+        {
+        iMusicAdapter->Dismiss( aError );
+        //iMusicAdapter = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::DisplayErrorTextL
+// 
+// --------------------------------------------------------------------------
+void CUPnPCommonUI::DisplayErrorTextL( TInt aResource )
+    {
+    CAknErrorNote* errorNote = new( ELeave )CAknErrorNote();
+    errorNote->ExecuteLD( *StringLoader::LoadLC( aResource ) );
+    CleanupStack::PopAndDestroy();  
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::DisplayErrorTextL
+// --------------------------------------------------------------------------
+// 
+void CUPnPCommonUI::DisplayErrorTextL( TInt aResource, const TDesC& aInfo )
+    {
+    HBufC* errorText = StringLoader::LoadLC( aResource, aInfo );
+    CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( ETrue );
+    errorNote->ExecuteLD( *errorText );
+    CleanupStack::PopAndDestroy( errorText );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DisplayErrorNote
+// --------------------------------------------------------------------------
+//    
+void CUPnPCommonUI::DisplayErrorTextL( TInt aResource,
+                                       TInt aMaxNumberOfResultsShown )
+    {    
+    HBufC* errorText = StringLoader::LoadLC( aResource, 
+                                             aMaxNumberOfResultsShown );
+    CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( ETrue );
+    errorNote->ExecuteLD( *errorText );
+    CleanupStack::PopAndDestroy( errorText );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DisplayInfoTextL
+// --------------------------------------------------------------------------
+//      
+void CUPnPCommonUI::DisplayInfoTextL( TInt aResource,
+                                      TInt aNumberOfCopy )
+    {
+    CAknInformationNote* errorNote = 
+                                new( ELeave )CAknInformationNote( ETrue );
+    errorNote->ExecuteLD( *StringLoader::LoadLC( aResource, 
+                                                 aNumberOfCopy ) );
+    CleanupStack::PopAndDestroy(); 
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DisplayInfoTextL
+// --------------------------------------------------------------------------
+//      
+void CUPnPCommonUI::DisplayInfoTextL( TInt aResource )
+    {
+    CAknInformationNote* errorNote = 
+                                new( ELeave )CAknInformationNote( );
+    errorNote->ExecuteLD( *StringLoader::LoadLC( aResource ) );
+    CleanupStack::PopAndDestroy(); 
+    }    
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::PresenceOfDialog
+// --------------------------------------------------------------------------
+//  
+TBool CUPnPCommonUI::PresenceOfDialog()
+    {
+    if( iBrowseSelection || iAdvFindDialog || iDeviceSelection )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::GetUpnpAction()
+// --------------------------------------------------------------------------
+//
+void CUPnPCommonUI::GetUpnpAction( TUPnPAction aAction )
+    {
+    iAction = aAction;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::HandleCommonErrorL
+// --------------------------------------------------------------------------
+//      
+void CUPnPCommonUI::HandleCommonErrorL( TInt aError,
+                                        TInt aCopyIndex  )
+    {
+    
+    //specified errors for every action should be handled first
+    // common erros last
+    __LOG1( "CUPnPCommonUI::HandleCommonErrorL: %d", aError );
+    
+    if( KErrNone <= aError && ( iAction == CUPnPCommonUI::EUPnPNone ||
+        iAction != CUPnPCommonUI::EUPnPCopy ) )
+        {
+        iAction = EUPnPNone;
+        return;
+        }
+    switch( aError )
+        {
+        case KErrCancel:
+            {
+            break;
+            }
+        case KErrServerBusy:
+            {
+            DisplayErrorTextL( R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT );
+            break; 
+            }
+        case KErrNoMemory:
+            {
+            DisplayErrorTextL( R_UPNPCOMMONUI_NOMEMORY_TEXT );
+            break;
+            }
+        case KErrDiskFull:
+            {
+            HBufC* copyLocation = HBufC::NewLC( KMaxFileName );
+            TPtr copyLocationPtr( copyLocation->Des() );
+            GetCopyLocationL( copyLocationPtr );
+            TPtr driveName = copyLocationPtr.LeftTPtr( 2 );
+            DisplayErrorTextL( R_UPNPCOMMONUI_DEVICE_MEMORY_LOW, driveName );
+            CleanupStack::PopAndDestroy( copyLocation );
+            break;
+            }
+        case KErrSessionClosed:
+        case KErrDisconnected:
+            {
+            if( iAction == CUPnPCommonUI::EUPnPCopy )
+                {
+                //Connection lost, some files may not be copied
+                DisplayErrorTextL( R_UPNPCOMMONUI_CONN_LOST_COPY_ERROR_TEXT );
+                }
+            else if( KErrSessionClosed == aError &&
+                     iAction != CUPnPCommonUI::EUPnPCopy )
+                {
+                //connection failed
+                DisplayErrorTextL( R_UPNPCOMMONUI_ERROR_CON_TEXT );
+                }
+            delete iBrowseSelection;
+            iBrowseSelection = NULL;
+            break;
+            }
+        case KErrNotSupported:
+            {
+            //Selected device does not support this operation
+            DisplayErrorTextL( R_UPNPCOMMONUI_NOT_SUPPORTED_ERROR_TEXT );
+            break;
+            }
+        default:
+            {
+            if( iAction != EUPnPNone )
+                {
+                if( iAction == EUPnPCopy )  
+                    {
+                    if( KErrNone == aError )
+                        {
+                        if( aCopyIndex == 1) //copying single item OK
+                            {
+                            DisplayInfoTextL( 
+                                    R_UPNPCOMMONUI_INFO_COPY_ONE_TEXT );
+                            }
+                        else if( aCopyIndex > 1 ) //copying multi items OK
+                            {
+                            DisplayInfoTextL( 
+                                    R_UPNPCOMMONUI_INFO_COPY_MANY_TEXT, 
+                                    aCopyIndex );
+                            }
+                        else
+                            {
+                            //
+                            }    
+                        }
+                    else
+                        {
+                        if( KErrNotFound == aError )
+                            {
+                            if( aCopyIndex ) //copying a container
+                                {
+                                //"Container does not contain any items."
+                                DisplayErrorTextL( 
+                                R_UPNPCOMMONUI_NO_ITEMS_TO_PLAY_TEXT );
+                                }
+                            else
+                                {
+                                //copy failed
+                                DisplayErrorTextL( 
+                                R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT );
+                                }
+                            }
+                         else //if copying, unkown error
+                            {
+                            //copy failed
+                            DisplayErrorTextL( 
+                                R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT );
+                            }   
+                        }
+                    }
+                else if( iAction == EUPnPShow )
+                    {
+                    if( KErrNone != aError )
+                        {
+                        //Playback failed on the remote device for 
+                        //unknown error. Try again
+                        DisplayErrorTextL( 
+                        R_UPNPCOMMONUI_RENDERING_FAILED_UNKNOWN_ERROR_TEXT );
+                        }
+                    }
+                else
+                    {
+                    if( KErrNone != aError )
+                        {
+                        //Selected device refused the operation
+                        DisplayErrorTextL( 
+                            R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT );
+                        }
+                    }
+                }//if( iAction != EUPnPNone )
+           
+            break;        
+            }//default:
+            
+        } // switch( aError )
+        
+        iAction = EUPnPNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPCommonUI::GetCopyLocationL
+// --------------------------------------------------------------------------
+//
+void CUPnPCommonUI::GetCopyLocationL( TDes& aLocation ) const
+    {
+    // Get instance of Server Settings object
+    CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( settings );
+
+    // Get the location setting from ServerSettings
+    settings->Get( UpnpMediaServerSettings::EUploadDirectory, aLocation );
+        
+    CleanupStack::PopAndDestroy( settings );    
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpexternaldevicedialog.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,813 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for UPnP External device dialog
+*                UI Implementation
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <aknnavide.h> // CAknNavigationDecorator
+#include <barsread.h> // TResourceReader
+#include <AknIconArray.h>
+#include <eikclbd.h>
+#include <StringLoader.h>
+#include <featmgr.h>
+#include <hlplch.h>
+#include <upnpstring.h>
+#include <layoutmetadata.cdl.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdevice.h"
+#include "upnpavcontroller.h"
+#include "upnpavbrowsingsession.h"
+#include "upnpavdevicelist.h"
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"
+
+// common ui internal
+#include "upnpadvfinddialog.h"
+#include "upnpcommonui.hrh"
+#include "upnpexternaldevicedialog.h"
+#include <upnpcommonui.rsg>
+#include <upnpcommonui.mbg> //for icons
+#include "upnpcommonui.h"
+#include "upnpnavipanecontainer.h"
+
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" );
+const TInt KLength = 100;
+_LIT(KUPNP_HLP_MAIN_EXTERNAL,"UPNP_HLP_MAIN_EXTERNAL"); 
+
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::CUPnPExternalDeviceDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPExternalDeviceDialog::CUPnPExternalDeviceDialog(
+                                        MUPnPAVController& aAVControl,
+                                        CUPnPCommonUI& aCommonUI):
+                                        iAVControl(aAVControl),
+                                        iCommonUI(aCommonUI)
+    {
+    iPreDeviceObserver = iAVControl.DeviceObserver();
+    iAVControl.RemoveDeviceObserver();
+    iAVControl.SetDeviceObserver( *this );
+    }
+    
+// Destructor
+CUPnPExternalDeviceDialog::~CUPnPExternalDeviceDialog()
+    {
+    __LOG( "CUPnPExternalDeviceDialog::~CUPnPExternalDeviceDialog" );
+    
+    delete iDeviceArray;
+    iAVControl.RemoveDeviceObserver();
+    
+    if( iPreDeviceObserver )
+        {
+        iAVControl.SetDeviceObserver( *iPreDeviceObserver );
+        }
+    
+    if ( iNaviDecorator && iNaviPaneContainer )
+        {
+        iNaviPaneContainer->Pop( iNaviDecorator );
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    
+    __LOG( "CUPnPExternalDeviceDialog::~CUPnPExternalDeviceDialog End." );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::ConstructL( TInt aMenuResource )
+    {
+    __LOG( "CUPnPExternalDeviceDialog::ConstructL" );
+    
+    iDeviceArray = CUpnpAVDeviceList::NewL();
+    
+    CAknDialog::ConstructL( aMenuResource );
+    __LOG( "CUPnPExternalDeviceDialog::ConstructL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPExternalDeviceDialog* CUPnPExternalDeviceDialog::NewL(
+    TInt aMenuResource, 
+    MUPnPAVController& aAVControl,
+    CUPnPCommonUI& aCommonUI)
+    {
+    __LOG( "CUPnPExternalDeviceDialog::NewL" );
+
+    CUPnPExternalDeviceDialog* self = 
+                        new ( ELeave ) CUPnPExternalDeviceDialog( aAVControl,
+                                                                aCommonUI );
+    CleanupStack::PushL( self );
+    self->ConstructL( aMenuResource );
+    CleanupStack::Pop();
+    __LOG( "CUPnPExternalDeviceDialog::NewL End" );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::PreLayoutDynInitL()
+    {
+    __LOG( "CUPnPExternalDeviceDialog::PreLayoutDynInitL" );
+
+    // Create dialog title text
+    CEikStatusPane* statusPane = 
+                    ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane();    
+    iTitlePane = ( CAknTitlePane* )statusPane->ControlL(
+                    TUid::Uid( EEikStatusPaneUidTitle ) );
+    iTitlePane->SetTextL( *StringLoader::LoadLC(
+                                R_UPNPCOMMONUI_EXTERNAL_MEDIA_TITLE ) );
+    CleanupStack::PopAndDestroy();
+    
+    iListBox = static_cast<CAknSingleGraphicStyleListBox*>
+              ( Control( EUPnPExternDevicesListBoxId ) );
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
+            CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+    
+    
+    CAknIconArray* icons = new ( ELeave ) CAknIconArray( 3 );
+    CleanupStack::PushL(icons);
+
+    // Mif icons
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) );
+    
+    // Folder icon
+    
+    TFileName mbmFileName( KAknCommonUIMbmFileName );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    mbmFileName.Insert( 0, drive );
+    
+    AppendIconToArrayL( icons, skin, 
+                        mbmFileName, 
+                        KAknsIIDDefault, 
+                        EMbmUpnpcommonuiQgn_server_icon, 
+                        EMbmUpnpcommonuiQgn_server_icon_mask );
+   
+                                        
+    iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
+        
+    CleanupStack::Pop( icons );
+
+    // Enable horizontal scrolling
+    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+    DisplayMediaServersL();
+
+    if ( !iDeviceArray->Count() )  
+        {
+        // show "Waiting devices" text
+        iListBox->View()->SetListEmptyTextL(
+            *StringLoader::LoadLC( R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE ) );
+        CleanupStack::PopAndDestroy(); 
+        }
+    else
+        {
+        CEikButtonGroupContainer* cba = &ButtonGroupContainer();
+        cba->SetCommandSetL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN );
+        cba->DrawDeferred();
+        }
+    __LOG( "CUPnPExternalDeviceDialog::PreLayoutDynInitL End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::PostLayoutDynInitL();
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::PostLayoutDynInitL()
+    {
+    iNaviPaneActive = ETrue;
+    UpDateAnimationWindowL(iNaviPaneActive);//DateAnimationWindow();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::OkToExitL(TInt aButtonId)
+// see upnpexternaldevicedialog.h
+// --------------------------------------------------------------------------
+//
+TBool CUPnPExternalDeviceDialog::OkToExitL( TInt aButtonId )
+    {
+    __LOG( "CUPnPExternalDeviceDialog::OkToExitL" );
+    
+    TBool returnValue = EFalse;
+    iCommonUI.HandleCommonErrorL( aButtonId, NULL );
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL(); 
+            break;
+            }
+        case EAknSoftkeyOpen: //fall through
+        case EAknSoftkeyOk:
+            {
+            CTextListBoxModel *model = iListBox->Model();
+
+            if (model->NumberOfItems()) //browse only if list have items
+                {
+                iNaviPaneActive = EFalse;                
+                UpDateAnimationWindowL(iNaviPaneActive);
+
+                TInt ret = ExecuteBrowseL();
+                if (ret == EAknCmdExit || 
+                    ret == EEikCmdExit ||
+                    ret == KErrDisconnected ||
+                    ret == KErrSessionClosed
+                    )
+                    {
+                    TryExitL( ret );
+                    }
+                else
+                    {
+                    DisplayMediaServersL();
+                    iNaviPaneActive = ETrue;
+                    UpDateAnimationWindowL(iNaviPaneActive);
+                    }
+                }
+            break;
+            }
+        case EAknSoftkeyBack: // fall through
+        case EUPnPBackCmd: // fall through
+        case EAknSoftkeyCancel: // fall through
+        case EAknSoftkeyExit: // fall through
+        case EAknCmdExit: // fall through
+        case EEikCmdExit: // fall through
+        case KErrNotReady: // fall through
+        case KErrDisconnected:
+            {
+            if( iTitlePane )
+                {
+                iTitlePane->SetTextToDefaultL();
+                }
+            returnValue = ETrue; //back to previous dialog
+            break;
+            }
+        case KErrSessionClosed:
+            {
+            DisplayMediaServersL();
+            iNaviPaneActive = ETrue;
+            UpDateAnimationWindowL(iNaviPaneActive);
+
+            break;
+            }
+        default:
+            {
+            // ignore
+            }
+        }
+  
+    __LOG( "CUPnPExternalDeviceDialog::OkToExitL End." );
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDevice::DynInitMenuPaneL(TInt aResourceId, 
+// CEikMenuPane *aMenuPane)
+// called by framework before menu panel is shown
+// --------------------------------------------------------------------------
+void  CUPnPExternalDeviceDialog::DynInitMenuPaneL( TInt aResourceId,
+                                                   CEikMenuPane *aMenuPane )
+    {
+    __LOG( "CUPnPExternalDeviceDialog::DynInitMenuPaneL" );
+
+    if( aResourceId ==  R_UPNPCOMMONUI_EXTERNAL_DEVICE_OPTION_MENU )
+        {
+        // Hide menu items if empty list
+        CTextListBoxModel *model = iListBox->Model();
+        if ( !model->NumberOfItems() ) 
+            {
+            aMenuPane->SetItemDimmed( EUPnPOpen, ETrue );
+            aMenuPane->SetItemDimmed( EUPnPFind, ETrue );
+            }
+
+        // Hide "Find" if the currently focused device does not support it
+        TInt selected_item = iListBox->CurrentItemIndex();
+        if( selected_item >= 0 &&
+            !( *iDeviceArray )[ selected_item ]->SearchCapability() )
+            {
+            aMenuPane->SetItemDimmed( EUPnPFind, ETrue );
+            }
+
+        // Hide "Help" if the help file is not available
+        if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+            {
+            aMenuPane->SetItemDimmed( EUPnPHelp, ETrue );
+            }
+        }
+    __LOG( "CUPnPExternalDeviceDialog::DynInitMenuPaneL End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::ProcessCommandL(TInt aCommand)
+// called by framework when menu item is selected
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::ProcessCommandL( TInt aCommand )
+    {
+    __LOG( "CUPnPExternalDeviceDialog::ProcessCommandL" );
+    
+    TInt error = KErrNone;
+    HideMenu();
+    switch ( aCommand ) 
+        {
+        case EAknCmdExit:
+        case EEikCmdExit:
+            {
+            TryExitL( aCommand );
+            break;
+            }
+        case EUPnPOpen:
+            {
+            iNaviPaneActive = EFalse;
+            UpDateAnimationWindowL(iNaviPaneActive);
+
+            error = ExecuteBrowseL();
+            if ( error == EAknCmdExit ||
+                 error == EEikCmdExit ||
+                 error == KErrDisconnected ||
+                 error == KErrSessionClosed )
+                {
+                TryExitL( error );
+                }
+            else 
+                {
+                DisplayMediaServersL(); 
+                iNaviPaneActive = ETrue;
+                UpDateAnimationWindowL(iNaviPaneActive); 
+                }
+            break;
+            }
+        case EUPnPFind:
+            {
+            iNaviPaneActive = EFalse;
+            UpDateAnimationWindowL(iNaviPaneActive);  
+            
+            error = ExecuteFindL();
+            if ( error == EAknCmdExit ||
+                 error == EEikCmdExit ||
+                 error == KErrDisconnected || 
+                 error == KErrNotReady || 
+                 error == KErrSessionClosed )
+                {
+                TryExitL( error );
+                }
+            else
+                {
+                iNaviPaneActive = ETrue;
+                UpDateAnimationWindowL(iNaviPaneActive);
+                }
+            break;
+            }
+        case EUPnPHelp:
+            {
+            iNaviPaneActive = EFalse;
+            UpDateAnimationWindowL(iNaviPaneActive);
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+            iEikonEnv->EikAppUi()->AppHelpContextL() );
+            iNaviPaneActive = ETrue;
+            UpDateAnimationWindowL(iNaviPaneActive);
+            break;
+            }
+        default:
+            break;
+        }
+    __LOG( "CUPnPExternalDeviceDialog::ProcessCommandL End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::UPnPDeviceDiscovered
+// Returns discovered device from UPnP AV control point.
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::UPnPDeviceDiscovered(
+                                        const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDiscovered" );
+    TInt error = KErrNone;
+    TRAP( error, UPnPDeviceDiscoveredL( aDevice ) );
+    
+    __LOG1( "CUPnPExternalDeviceDialog::UPnPDeviceDiscovered %d", error);
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::UPnPDeviceDiscoveredL
+// Returns discovered device from UPnP AV control point.
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::UPnPDeviceDiscoveredL(
+                                        const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDiscovered" );
+              
+    // Display only Media servers
+    if( aDevice.DeviceType() == CUpnpAVDevice::EMediaServer )
+        {
+        CUpnpAVDevice* tempDevice = CUpnpAVDevice::NewL( aDevice ) ;
+                                      
+        CleanupStack::PushL( tempDevice );
+        iDeviceArray->AppendDeviceL( *tempDevice );
+        CleanupStack::Pop( tempDevice ); 
+        
+        // Get device friendly name and replace illegal characters.
+        HBufC8* tmpfriendlyname = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+            ( ( CUpnpAVDevice* )tempDevice )->FriendlyName() );
+            
+        CleanupStack::PushL( tmpfriendlyname );
+        TPtrC8 friendlyname = *tmpfriendlyname;
+                
+        CTextListBoxModel* model = iListBox->Model();
+        MDesCArray* textArray = model->ItemTextArray();
+        CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+        TBuf<256> item;
+        
+        HBufC *tmpbuf = UpnpString::ToUnicodeL( friendlyname.Left( KLength ) );
+        CleanupStack::PushL( tmpbuf ); 
+        
+        item.Format( _L( "%d\t%S\t\t" ),0, tmpbuf ); 
+        CleanupStack::PopAndDestroy( tmpbuf ); 
+        CleanupStack::PopAndDestroy( tmpfriendlyname );
+
+        listBoxItems->AppendL( item );
+        iListBox->HandleItemAdditionL(); // Update listbox
+
+        iListBox->ActivateL();
+        iListBox->DrawDeferred();
+        
+        //update menu pane
+        CEikButtonGroupContainer* cba = &ButtonGroupContainer();
+        
+        cba->SetCommandSetL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN );
+        cba->DrawDeferred();
+        }
+    __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDiscovered End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::UPnPDeviceDisappeared
+// Returns disappeared device from UPnP AV control point.
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::UPnPDeviceDisappeared(
+                                        const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDisappeared" );
+    
+    TRAP_IGNORE( UPnPDeviceDisappearedL( aDevice ) );
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::UPnPDeviceDisappearedL
+// Returns disappeared device from UPnP AV control point.
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::UPnPDeviceDisappearedL(
+                                               const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDissapearedL" );
+    
+    CTextListBoxModel* model = iListBox->Model();
+    TInt currentItem = iListBox->CurrentItemIndex();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+    TInt i = 0;
+    TPtrC8 ptr(aDevice.Uuid());
+    while( i < iDeviceArray->Count() &&
+        ptr.Compare( ( *iDeviceArray)[ i ]->Uuid() ) )
+        {
+        i++;
+        }
+    if ( i < iDeviceArray->Count() )
+        {
+        iDeviceArray->RemoveAndDestroy( i );
+        listBoxItems->Delete( i,1 );
+        AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(
+            iListBox, currentItem, ETrue );
+        iListBox->DrawDeferred();
+        }
+            
+    if ( !iDeviceArray->Count() )
+        {
+        // show "Waiting devices" text
+        iListBox->View()->SetListEmptyTextL(
+            *StringLoader::LoadLC( R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE ) );
+        CleanupStack::PopAndDestroy(); // R_EXTERNAL_WAITING_NOTE
+        
+        CEikButtonGroupContainer* cba = &ButtonGroupContainer();
+        cba->SetCommandSetL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_BACK );
+        cba->DrawDeferred();
+        }
+   
+    __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDissapearedL-END" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::AppendIconToArrayL
+// Load a possibly skinned icon (with mask) and append it to an 
+// icon array.
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::AppendIconToArrayL( CAknIconArray* aArray,
+                                           MAknsSkinInstance* aSkin,
+                                           const TDesC& aMbmFile,
+                                           const TAknsItemID& aID,
+                                           TInt aBitmapId,
+                                           TInt aMaskId )
+    {
+    __LOG( "CUPnPExternalDeviceDialog::AppendIconToArrayL" );
+    
+    __ASSERTD( aArray != NULL, __FILE__, __LINE__ );
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC( aSkin, aID,
+        bitmap, mask, aMbmFile, aBitmapId, aMaskId );
+
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally( EFalse );
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop( 2 ); // mask, bitmap
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL( icon );
+    aArray->AppendL( icon );
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop();
+    __LOG( "CUPnPExternalDeviceDialog::AppendIconToArrayL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseDialog::DisplayMediaServersL
+// Add visible Media Servers to Listbox of dialog
+// --------------------------------------------------------------------------
+void CUPnPExternalDeviceDialog::DisplayMediaServersL()
+    {
+    __LOG( "CUPnPExternalDeviceDialog::DisplayMediaServersL" );
+    
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+    
+    //clear list        
+    delete iDeviceArray; iDeviceArray = NULL;
+    listBoxItems->Reset();
+    
+    TBuf<256> item;
+    
+    iDeviceArray=iAVControl.GetMediaServersL();
+    
+
+    if ( iDeviceArray->Count() )
+        {
+        for ( TInt i=0; i < iDeviceArray->Count(); i++ )
+            {
+            // Get device frienly name and replace illegal characters.
+            HBufC8* tmpfriendlyname = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+                ( *iDeviceArray )[ i ]->FriendlyName() );
+
+            CleanupStack::PushL( tmpfriendlyname );
+            TPtrC8 friendlyname = *tmpfriendlyname;
+
+            HBufC* tmpbuf = UpnpString::ToUnicodeL( 
+                friendlyname.Left( KLength ) );
+            CleanupStack::PushL( tmpbuf ); 
+            item.Format( _L( "%d\t%S\t\t" ),0, tmpbuf ); 
+            CleanupStack::PopAndDestroy( tmpbuf );
+            CleanupStack::PopAndDestroy( tmpfriendlyname ); 
+            listBoxItems->AppendL( item );
+            }
+        
+        iListBox->HandleItemAdditionL(); // Update listbox
+        iListBox->SetCurrentItemIndexAndDraw( 0 ); // select new item        
+        }
+    __LOG( "CUPnPExternalDeviceDialog::DisplayMediaServersL End" );        
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::ExecuteBrowseL
+// see upnpexternaldevicedialog.h
+// --------------------------------------------------------------------------
+TInt CUPnPExternalDeviceDialog::ExecuteBrowseL()
+    {
+    __LOG( "CUPnPExternalDeviceDialog::ExecuteBrowseL" );
+    
+    TInt selected_item = iListBox->CurrentItemIndex();
+
+    const CUpnpAVDevice* selectedDevice = ( *iDeviceArray )[ selected_item ];
+    
+    TInt ret = iCommonUI.ExecuteBrowseDialogL(
+        iAVControl, *selectedDevice );
+    
+    iTitlePane->SetTextL( *StringLoader::LoadLC(
+        R_UPNPCOMMONUI_EXTERNAL_MEDIA_TITLE ) );
+    CleanupStack::PopAndDestroy();
+
+    
+    __LOG( "CUPnPExternalDeviceDialog::ExecuteBrowseL End" );
+    return ret;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::ExecuteFindL
+// see upnpexternaldevicedialog.h
+// --------------------------------------------------------------------------
+TInt CUPnPExternalDeviceDialog::ExecuteFindL()
+    {
+    __LOG( "CUPnPExternalDeviceDialog::ExecuteFindL" );
+    
+    TInt ret = KErrNone;
+    TInt selected_item = iListBox->CurrentItemIndex();
+    CUpnpAVDevice* selectedDevice = 
+                            ( *iDeviceArray )[ selected_item ];
+    
+    if( selectedDevice )
+        {
+        //create a browsessesion only for advFind dialog
+        
+        MUPnPAVBrowsingSession* browsingSession = NULL;    
+        browsingSession = &( iAVControl.StartBrowsingSessionL(
+                                                *selectedDevice ) );
+        
+        ret = iCommonUI.ExecuteAdvFindDialogL( iAVControl,
+                                               *browsingSession );
+        browsingSession->RemoveObserver();
+        iAVControl.StopBrowsingSession( *browsingSession );    
+        }
+    
+    if( KErrDisconnected != ret ) //if not WLAN lost
+        {
+        DisplayMediaServersL();    
+        }
+
+    __LOG( "CUPnPExternalDeviceDialog::ExecuteFindL End" );
+    return ret;
+    }
+    
+
+            
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::WLANConnectionLost
+// see upnpexternaldevicedialog.h
+// --------------------------------------------------------------------------
+void CUPnPExternalDeviceDialog::WLANConnectionLost() 
+    {
+    __LOG( "CUPnPExternalDeviceDialog::WLANConnectionLost" );
+    //if no dialog created in CUPnPExternalDeviceDialog, destory itself 
+    //Otherwise destory other dialogs like in normal by KErrAbort
+    if( !iCommonUI.PresenceOfDialog() )
+        {
+        TRAP_IGNORE( TryExitL( KErrDisconnected ) );
+        }
+    
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::GetHelpContext
+// see upnpexternaldevicedialog.h
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::GetHelpContext(
+                                        TCoeHelpContext& aContext ) const
+    {
+    __LOG( "CUPnPExternalDeviceDialog::GetHelpContext" );
+    
+//  aContext.iMajor = TUid::Uid( KMediaGalleryUID3 );    
+    aContext.iContext = KUPNP_HLP_MAIN_EXTERNAL;
+    
+    __LOG( "CUPnPExternalDeviceDialog::GetHelpContext End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::UpDateAnimationWindowL
+// see upnpexternaldevicedialog.h
+// --------------------------------------------------------------------------
+//
+void CUPnPExternalDeviceDialog::UpDateAnimationWindowL(TBool aAnimationState)
+    {    
+    __LOG( "CUPnPExternalDeviceDialog::UpDateAnimationWindowL" );
+    if ( iNaviDecorator )
+        {
+        iNaviPaneContainer->Pop( iNaviDecorator );
+        }
+    
+    // destroy iNaviDecorator
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+        
+    if ( ( !Layout_Meta_Data::IsLandscapeOrientation() )
+         && ( aAnimationState ) )
+        {
+        iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+
+        TBool naviFaded = iStatusPane->IsFaded();
+
+        if (!naviFaded)
+            {
+            iNaviPaneContainer = ( CAknNavigationControlContainer* )
+                iStatusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
+        
+            TPoint screenPosition = iNaviPaneContainer->
+                PositionRelativeToScreen();
+            /**
+             * adjust the screen position so that the "Searching..." could be 
+             * exactly in that "blue" NaviPane
+             */                        
+            screenPosition.iY = screenPosition.iY+1;
+            iNaviContainer = CUPnPNaviPaneContainer::NewL(
+                                                 iNaviPaneContainer->Rect(),
+                                                 screenPosition,
+                                                 iNaviPaneContainer );
+        
+            iNaviDecorator = CAknNavigationDecorator::NewL(
+                iNaviPaneContainer, iNaviContainer );
+        iNaviDecorator->SetContainerWindowL( *iNaviPaneContainer );
+        iNaviDecorator->MakeScrollButtonVisible(EFalse);
+        iNaviDecorator->SetComponentsToInheritVisibility( ETrue );
+            iNaviPaneContainer->PushL( *iNaviDecorator );        
+            }
+        }
+    iListBox->ActivateL();
+    
+    __LOG( "CUPnPExternalDeviceDialog::UpDateAnimationWindowL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPExternalDeviceDialog::HandleResourceChange
+// --------------------------------------------------------------------------
+//    
+void CUPnPExternalDeviceDialog::HandleResourceChange(TInt aType)
+    {
+    __LOG("[UPnPCommonUI]\t CUPnPExternalDeviceDialog::HandleResourceChange");
+    CAknDialog::HandleResourceChange(aType);
+    
+    // Update Titlepane only if there is no other dialogs open
+    if( !iCommonUI.PresenceOfDialog() )
+        {
+        __LOG("[UPnPCommonUI]\t CUPnPExternalDeviceDialog::HandleResourceChange\
+updating iTitlePane");
+
+    TRAPD( err,
+            iTitlePane->SetTextL( *StringLoader::LoadLC(
+                R_UPNPCOMMONUI_EXTERNAL_MEDIA_TITLE ) );
+            CleanupStack::PopAndDestroy();
+            );
+            
+    if( err != KErrNone )
+        {
+        __LOG("[UPnPCommonUI]\t CUPnPExternalDeviceDialog::HandleResourceChange\
+iTitlePane->SetTextL failed");
+            }
+        }
+    
+    if (iNaviPaneActive)
+        {
+        TRAP_IGNORE( UpDateAnimationWindowL(iNaviPaneActive) );
+        }    
+    }         
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpimageplayer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,305 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plays remote images on a renderer
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <aknnotewrappers.h>
+
+// upnp stack api
+#include <upnpobject.h>
+#include <upnpitem.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h"
+#include "upnpavrenderingsession.h"
+#include "upnpavdevice.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpitemutility.h"            // ResourceFromItemL
+
+// upnpframework / internal api's
+#include "upnpcdsreselementutility.h"
+
+// commonui internal
+#include "upnpimageplayer.h"
+#include "upnpdeviceobserver.h"
+#include <upnpcommonui.rsg>
+
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::CUpnpAVDevice
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpImagePlayer::CUpnpImagePlayer( MUPnPAVController& aAVControl,
+                                    MUPnPDeviceObserver& aDialog,
+                                    CUPnPCommonUI& aCommonUI ):
+                                    iAVControl(aAVControl),
+                                    iDialog(aDialog),
+                                    iCommonUI(aCommonUI)
+    {    
+    __LOG( "CUpnpImagePlayer::CUpnpImagePlayer" );
+    iImageState = EImageIdle;
+    iFirstStart = ETrue;
+    iAction = CUPnPCommonUI::EUPnPNone;
+    __LOG( "CUpnpImagePlayer::CUpnpImagePlayer end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUpnpImagePlayer::ConstructL()
+    {                        
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpImagePlayer* CUpnpImagePlayer::NewL( 
+                                    MUPnPAVController& aAVControl,
+                                    MUPnPDeviceObserver& aDialog,
+                                    CUPnPCommonUI& aCommonUI )
+    {
+    __LOG( "CUpnpImagePlayer::NewL" );
+    CUpnpImagePlayer* self = new( ELeave )CUpnpImagePlayer( aAVControl,
+                                                          aDialog,
+                                                          aCommonUI );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __LOG( "CUpnpImagePlayer::NewL end" );
+    return self;
+    }
+
+// Destructor
+CUpnpImagePlayer::~CUpnpImagePlayer()
+    {   
+    __LOG( "CUpnpImagePlayer::~CUpnpImagePlayer" );
+    
+    Stop();
+    delete iUri;
+    __LOG( "CUpnpImagePlayer::~CUpnpImagePlayer end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetTargetDeviceL
+// --------------------------------------------------------------------------
+//
+void CUpnpImagePlayer::SetTargetDeviceL( const CUpnpAVDevice& aTargetDevice )
+    {
+    __LOG( "CUpnpImagePlayer::SetTargetDeviceL" );
+    iTargetDevice = &aTargetDevice;  
+    iImageState = EImageIdle;
+    
+    if( iRendSession )
+        {
+        iRendSession->RemoveObserver();
+        iAVControl.StopRenderingSession( *iRendSession );
+        iRendSession = NULL;
+        }
+    iRendSession = &iAVControl.StartRenderingSessionL( *iTargetDevice );
+    iRendSession->SetObserver( *this );
+    
+    __LOG( "CUpnpImagePlayer::SetTargetDeviceL end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::PlayL
+// --------------------------------------------------------------------------
+//  
+void CUpnpImagePlayer::PlayL( const CUpnpObject& aItem )
+    {
+    __LOG( "CUpnpImagePlayer::PlayL" );
+    
+    iAction = CUPnPCommonUI::EUPnPShow;
+    iItem = static_cast<const CUpnpItem*>( &aItem );
+    delete iUri; iUri = NULL;
+
+    iUri = UPnPItemUtility::ResourceFromItemL( *iItem ).Value().AllocL();
+    
+    if( iImageState == EImageIdle )
+        {
+        if( iFirstStart )
+            {
+            iRendSession->SetURIL( *iUri, *iItem ); //not possible to leave 
+            iImageState = EImageInitialising;
+            delete iUri; iUri = NULL;    
+            }
+        else //stopping previously played item
+            {
+            iRendSession->StopL();
+            iImageState = EImageNext;
+            }
+        }
+    else
+        {
+        iImageState = EImageNext;                
+        }
+
+    __LOG( "CUpnpImagePlayer::PlayL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::Stop
+// --------------------------------------------------------------------------
+//  
+void CUpnpImagePlayer::Stop()
+    {
+    if( iRendSession )
+        {
+        iImageState = EImageIdle;
+        iFirstStart = ETrue;
+        TRAP_IGNORE( iRendSession->StopL() );
+        iRendSession->RemoveObserver();
+        iAVControl.StopRenderingSession( *iRendSession );
+        iRendSession = NULL;      
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::InteractOperationComplete
+// --------------------------------------------------------------------------
+//
+void CUpnpImagePlayer::InteractOperationComplete( 
+              TInt aError,
+              TUPnPAVInteractOperation aOperation 
+              )
+    {
+    __LOG2( "CUpnpImagePlayer::InteractOperationComplete: %d, %d",
+        aError, aOperation );
+    TRAP_IGNORE( InteractOperationCompleteL( aError, aOperation ) );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::InteractOperationCompleteL
+// --------------------------------------------------------------------------
+//
+void CUpnpImagePlayer::InteractOperationCompleteL( 
+              TInt aError,
+              TUPnPAVInteractOperation aOperation 
+              )
+    {
+    iCommonUI.HandleCommonErrorL( aError, NULL );
+    
+    switch( aOperation )
+        {
+        case EUPnPAVPlay:
+            {
+            if( iFirstStart )
+                {
+                iFirstStart = EFalse;    
+                }
+            
+            if( iImageState == EImageNext ) //if still there is a pending item
+                {                           //stop current showing item
+                iRendSession->StopL();
+                }
+            else
+                {
+                iImageState = EImageIdle;
+                }
+            }
+            break;
+        case EUPnPAVStop:
+            {
+            if( iUri && iImageState == EImageNext )
+                {
+                iAction = CUPnPCommonUI::EUPnPShow;
+                iRendSession->SetURIL( *iUri, *iItem );
+                iImageState = EImageInitialising;
+                delete iUri; iUri = NULL;    
+                }
+            }
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetURIResult
+// --------------------------------------------------------------------------
+//
+void CUpnpImagePlayer::SetURIResult( TInt aError )
+    {
+    __LOG1( "CUpnpImagePlayer::SetURIResult: %d", aError );
+    
+    TRAP_IGNORE( SetURIResultL( aError ) );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::SetURIResultL
+// --------------------------------------------------------------------------
+//   
+void CUpnpImagePlayer::SetURIResultL( TInt aError )
+    {
+    iCommonUI.GetUpnpAction( iAction );
+    iCommonUI.HandleCommonErrorL( aError, NULL );
+    if( iImageState == EImageNext ) //if there is another pending item
+        {
+        if( iUri )
+            {
+            iRendSession->SetURIL( *iUri, *iItem ); //not possible to leave
+            iImageState = EImageInitialising;
+            delete iUri; iUri = NULL;    
+            }
+        else
+            {
+            iImageState = EImageIdle;
+            iCommonUI.GetUpnpAction( iAction );
+            iCommonUI.HandleCommonErrorL( KErrNotFound, NULL );            
+            }
+        }
+    else //if no pending item
+        {
+        if( KErrNone == aError )
+            {
+            iRendSession->PlayL(); //not possible to leave
+            iImageState = EImageShowing;
+            }
+        else
+            {
+            iImageState = EImageIdle;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAVDevice::PlayL
+// --------------------------------------------------------------------------
+//
+void CUpnpImagePlayer::MediaRendererDisappeared( 
+                                 TUPnPDeviceDisconnectedReason aReason )
+    {
+    if( aReason == EDisconnected )
+        {
+        iDialog.DeviceDisappeared( KErrSessionClosed );
+        }
+    
+    }
+    
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnplocalplayer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,679 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plays remote images and videos locally on the device
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <AiwGenericParam.h>
+#include <AiwGenericParam.hrh>
+#include <AiwCommon.hrh>
+
+#include <aknnotewrappers.h>
+#include <DocumentHandler.h>
+#include <apmstd.h>
+#include <AknWaitDialog.h>
+#include <aknnotewrappers.h>
+#include <upnpdlnaprotocolinfo.h>
+#include <upnpcommonui.rsg>
+#include <utf.h>
+#include <bautils.h>
+
+// upnp specific MACRO definition
+#include "upnpconstantdefs.h"
+// upnp stack api
+#include <upnpitem.h>
+#include <upnpobject.h>
+#include <upnpstring.h>
+
+// upnp framework / avcontroller api
+#include "upnpavcontroller.h"                   // MUPnPAVController
+#include "upnpfiledownloadsession.h"            // MUPnPFileDownloadSession
+#include "upnpavbrowsingsession.h"
+
+// upnp framework / avcontroller helper api
+#include "upnpdlnautility.h"
+#include "upnpitemutility.h"
+#include "upnpfileutility.h"
+
+// upnp framework / internal api's
+#include "upnpcommonutils.h"
+#include "upnpsettingsengine.h" // get selected download location
+
+// USER INCLUDE FILES
+#include "upnpcommonui.h"
+#include "upnplocalplayer.h"
+#include "upnpdeviceobserver.h"
+
+// DEBUG
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+// CONSTANT DEFINITIONS
+_LIT8( KProtocolInfo,   "protocolInfo" );
+_LIT8( KHttpDes,        "http://" );
+_LIT8( KHttpGetDes, "http-get" );
+_LIT8( KHttpEqual, "=" );
+
+const TInt KDownloadPosition = 0;
+
+// Video mimetypes that can be played on device
+
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::CUPnPLocalPlayer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPLocalPlayer::CUPnPLocalPlayer( MUPnPAVController& aAVController,
+                                    MUPnPAVBrowsingSession& aBrowseSession,
+                                    CUPnPCommonUI& aCommonUI  ):
+                                    iCommonUI(aCommonUI)
+    {
+    __LOG( "CUPnPLocalPlayer::CUPnPLocalPlayer" );
+    iAVController = &aAVController;
+    iExitReason = KErrNone;
+    iBrowseSession = &aBrowseSession;
+    __LOG( "CUPnPLocalPlayer::CUPnPLocalPlayer-END" );
+    }
+
+    
+    
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPLocalPlayer::ConstructL()
+    {
+    __LOG( "CUPnPLocalPlayer::ConstructL" ); 
+    iDocumentHandler = CDocumentHandler::NewL();
+    iDocumentHandler->SetExitObserver( this );
+    User::LeaveIfError( iFs.Connect() );
+    iDownloadSession = &iAVController->StartDownloadSessionL(
+                                            iBrowseSession->Device() );
+    __LOG( "CUPnPLocalPlayer::ConstructL-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPLocalPlayer* CUPnPLocalPlayer::NewL(
+                                    MUPnPAVController& aAVController,
+                                    MUPnPAVBrowsingSession& aBrowseSession,
+                                    CUPnPCommonUI& aCommonUI  )
+    {
+    CUPnPLocalPlayer* self = new( ELeave )CUPnPLocalPlayer( aAVController,
+                                                            aBrowseSession,
+                                                            aCommonUI );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __LOG( "CUPnPLocalPlayer::NewL-END" );
+    return self;
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::~CUPnPLocalPlayer
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPLocalPlayer::~CUPnPLocalPlayer()
+    {   
+    __LOG( "CUPnPLocalPlayer::~CUPnPLocalPlayer" );
+    
+    // If download session is running, stop it
+    if( iAVController &&
+        iDownloadSession )
+        {
+        iAVController->StopDownloadSession( *iDownloadSession );
+        }
+
+    delete iDocumentHandler;
+    
+    delete iWaitNoteDialog;
+    
+    delete iItem;
+    
+    if( iFilePath )
+        {
+        iFs.Delete( *iFilePath );
+        delete iFilePath;
+        }
+    iFs.Close();
+
+    __LOG( "CUPnPLocalPlayer::~CUPnPLocalPlayer-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::PlayL
+// Play a selected item.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPLocalPlayer::PlayL( const CUpnpObject& aItem )
+    {
+    __LOG( "CUPnPLocalPlayer::PlayL" );
+    
+    // recreate iItem
+    delete iItem; iItem = NULL;
+    iItem = CUpnpItem::NewL();
+    iItem->CopyL( aItem );
+
+    if ( !IsLocallySupportedL( *iItem ) ) 
+        {
+        User::Leave( KErrNotSupported );
+        }
+    
+    //in order not to get two callbacks when MS is lost, 
+    // in CUPnPLocalPlayer and CUPnPBrowseDialog
+    iBrowseSessionObserver = iBrowseSession->Observer();
+    iBrowseSession->RemoveObserver(); 
+    iFs.Close();
+    
+    User::LeaveIfError( iFs.Connect() );
+    User::LeaveIfError( iFs.ShareProtected() );
+    delete iFilePath; iFilePath = NULL;
+    iExitReason = KErrNone;
+    iDownloadSession->SetObserver( *this );
+    
+    /**
+     * All the temporiarily downloaded files should go to the
+     * hidden folder \data\download\media\temp
+     * fix for ETLU-7LKCJB
+     */
+    //create a file path which should contain the absolute file path
+    //e.g c:\data\download\media\temp\image.jpg
+    
+    iFilePath = HBufC::NewL( KMaxFileName );
+    HBufC* copyLocation = HBufC::NewLC( KMaxFileName );
+    CUPnPSettingsEngine* settingsEngine = CUPnPSettingsEngine::NewL();
+    CleanupStack::PushL( settingsEngine );
+    TBool copyLocationIsPhoneMemory = 0; // not used in this case
+    TPtr copyLocationPtr( copyLocation->Des() );
+    settingsEngine->GetCopyLocationL( copyLocationPtr,
+        copyLocationIsPhoneMemory );
+        
+    CleanupStack::PopAndDestroy( settingsEngine );    
+        
+    iFilePath->Des().Append( *copyLocation );
+    CleanupStack::PopAndDestroy( copyLocation );
+    
+    _LIT( KTempFolder, "temp\\");
+    iFilePath->Des().Append( KTempFolder() );
+    
+    //check the existence of the target folder
+    if( !BaflUtils::FolderExists( iFs, *iFilePath ) )
+        {
+        User::LeaveIfError( iFs.MkDirAll( *iFilePath ) );
+        }
+        
+    User::LeaveIfError( iFs.SetAtt( *iFilePath, 
+                                    KEntryAttHidden, 
+                                    KEntryAttNormal ) );     
+    
+    //Get the title of the given item
+    HBufC* title16 = UpnpString::ToUnicodeL( aItem.Title() );
+    CleanupStack::PushL( title16 );
+    HBufC* title16checked =
+        UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( *title16 );
+    CleanupStack::PopAndDestroy( title16 );
+    
+    iFilePath->Des().Append( *title16checked );
+    delete title16checked; title16checked = NULL;
+    //Get the extension of the given item
+    
+    const CUpnpItem* item = (CUpnpItem*)(&aItem);
+    const CUpnpElement* tmpEl = &( UPnPItemUtility::ResourceFromItemL( 
+        *item ) );
+    
+    if( !UPnPFileUtility::FitsInMemory( *tmpEl) )
+        {
+        User::Leave( KErrDiskFull );
+        }  
+            
+    const CUpnpAttribute* tmpAttInfo = UPnPItemUtility::FindAttributeByName(
+        *tmpEl, KAttributeProtocolInfo );
+    
+    User::LeaveIfNull( const_cast<CUpnpAttribute*>(tmpAttInfo ) );
+    
+    CUpnpDlnaProtocolInfo* tmpProtocolInfo = CUpnpDlnaProtocolInfo::NewL(
+        tmpAttInfo->Value() );
+   
+    CleanupStack::PushL( tmpProtocolInfo );
+        
+    HBufC* fileExt = NULL;
+    
+    fileExt = UPnPCommonUtils::FileExtensionByMimeTypeL(
+        tmpProtocolInfo->ThirdField() );
+    
+    User::LeaveIfNull( fileExt );
+    
+    iFilePath->Des().Append( *fileExt );
+    
+    delete fileExt; fileExt = NULL;
+    
+    CleanupStack::PopAndDestroy( tmpProtocolInfo );
+        
+    TInt err = KErrNone;
+    
+    RFile rfile;
+    err = rfile.Create(iFs, *iFilePath, EFileWrite );
+    
+    CleanupClosePushL( rfile );
+    if( KErrAlreadyExists == err )
+        {
+        __LOG( "Already exists -> Delete old and create new" );
+        User::LeaveIfError( iFs.Delete( *iFilePath ) );
+        User::LeaveIfError( rfile.Create(iFs, *iFilePath, EFileWrite ) );
+        }
+    
+    iDownloadSession->StartDownloadL( *tmpEl, 
+                                      ( CUpnpItem& )aItem, 
+                                      rfile,
+                                      KDownloadPosition );
+    CleanupStack::PopAndDestroy(&rfile);
+    
+    iWaitingNote = EFalse;    
+    if( !iWaitingNote ) //if ReserveLocalMSServicesCompleted is not called
+        {               //immediately
+        iWaitingNote = ETrue;
+        StartWaitingNoteL();
+        }
+    
+    __LOG1( "CUPnPLocalPlayer::PlayL-END %d", iExitReason );
+    if( iExitReason != KErrNone )
+        {    
+        User::Leave( iExitReason );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::TransferStarted.
+// --------------------------------------------------------------------------
+//
+void CUPnPLocalPlayer::TransferStarted( TInt aKey, TInt aStatus )
+    {
+    __LOG( "CUPnPLocalPlayer::TransferStarted" );
+    if( aStatus != KErrNone)
+        {
+        iExitReason = aStatus;    
+        }
+    else if( aKey != KDownloadPosition )
+        {
+        iExitReason = KErrGeneral;
+        }
+    
+    if( iExitReason != KErrNone )
+        {
+        FinishNote();
+        }
+    __LOG( "CUPnPLocalPlayer::TransferStarted-END" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::TransferCompleted.
+// --------------------------------------------------------------------------
+//        
+void CUPnPLocalPlayer::TransferCompleted( TInt aKey,
+                                          TInt aStatus,
+                                          const TDesC& aFilePath )
+    {
+    __LOG( "CUPnPLocalPlayer::TransferCompleted" );
+    
+    if( aKey != KDownloadPosition )
+        {
+        iExitReason = KErrGeneral;
+        FinishNote();
+        }
+    else
+        {
+        TRAP_IGNORE( CopyCompleteL( aStatus, aFilePath ) );    
+        }    
+    
+    __LOG( "CUPnPLocalPlayer::TransferCompleted-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::CopyCompleteL
+// Returns from UPnP AV control point when a copy operation has been finished
+// --------------------------------------------------------------------------
+void CUPnPLocalPlayer::CopyCompleteL( TInt aError,
+                                     const TDesC& /*aFilePath*/ )
+    {
+    __LOG1( "CopyCompleteL %d", aError );
+
+    FinishNote();
+    // If copying was successful, play the copied item
+    if( KErrNone == aError )
+        {
+        // iFilePath Contains UTF8 content,we need change
+        // to TDesC8 first ,Using Copy don't lost any data,because the 
+        //low byte is NULL       
+        TBuf8<KMaxFileName> filename;
+        filename.Copy( *iFilePath );
+        
+        HBufC* temp = iFilePath;
+        iFilePath = NULL;      
+        
+        // try transform UTF8 to UniCode
+        HBufC* unicodename = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+            filename );       
+        CleanupStack::PushL( unicodename );
+
+        // Rename the file
+        iFilePath = UPnPCommonUtils::RenameFileL( *unicodename ) ;
+        if( iFilePath )
+            {
+            delete temp; temp = NULL;
+            }
+        else
+            {
+            iFilePath = temp;
+            }    
+        CleanupStack::PopAndDestroy( unicodename );
+        unicodename = NULL;
+        
+        if( iFilePath )
+            {
+            
+            // fix for TSW: ESLX-7L3DMX
+            // OpenFileEmbeddedL( aSharableFile,aDataType, aParamList)
+            // leaves with KErrInUse which results into immediate close
+            // of image viewer.
+            
+            RFile sharableFile;
+            TRAPD( err, iDocumentHandler->OpenTempFileL( 
+                    *iFilePath, sharableFile ) );
+                    
+            if ( err == KErrNone )
+                {
+                CleanupClosePushL( sharableFile );
+
+                // Create a param list to remove 
+                // the "Use image as" sub menu item
+                CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
+                paramList->Reset();
+                
+//       Append a param into the list to restrict the viewer application from
+//       showing the "use image as" sub menu item. Currently there is no
+//       AiwGenericParam for this. A CR has been created for AIW to add this
+//       constant to "AiwGenericParam.hrh".
+//          Example: This is how the "Save" menu item is allowed.
+//          paramList->AppendL( EGenericParamAllowSave );
+                
+                TDataType dataType = TDataType();
+                
+                __LOG( "Open document now... " );
+                            
+                TRAP( err, err = iDocumentHandler->OpenFileEmbeddedL(
+                            sharableFile, dataType, *paramList ) );
+
+                __LOG1( "err, err = iDocumentHandler->OpenFileEmbeddedL %d",
+                        err );
+                
+                // Cleanup
+                CleanupStack::PopAndDestroy( paramList );
+                CleanupStack::PopAndDestroy( &sharableFile );
+                }
+                                                    
+            if( KErrNone != err)
+                {
+                iFs.Delete( *iFilePath );
+                iExitReason = err;
+                }
+            }
+        else
+            {
+            iExitReason = KErrNoMemory;
+            }
+        }
+    else
+        {
+        iExitReason = aError;
+        }
+
+  
+    iCommonUI.HandleCommonErrorL( iExitReason, 0 );
+
+    __LOG( "CUPnPLocalPlayer::CopyCompleteL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::MediaServerDisappeared
+// Returns from UPnP AV control point when a media server disppears
+// --------------------------------------------------------------------------
+void CUPnPLocalPlayer::MediaServerDisappeared( 
+                                  TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG( "CUPnPLocalPlayer::MediaServerDisappeared" );
+    TInt error = KErrNone;
+    if( aReason == EDisconnected )
+        {
+        error = KErrSessionClosed;
+        }
+    else if( aReason == EWLANLost)
+        {
+        error = KErrDisconnected;
+        }
+    else
+        {
+        __PANICD( __FILE__, __LINE__);
+        }
+    iExitReason = error;
+    FinishNote(); 
+    __LOG1("CUPnPLocalPlayer::MediaServerDisappeared %d END",error );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::HandleServerAppExit
+// Returns from application server after quitting a application
+// here is either image player or video player or music player
+// --------------------------------------------------------------------------
+void CUPnPLocalPlayer::HandleServerAppExit( TInt aReason )
+    {
+    __LOG1( "CUPnPLocalPlayer::HandleServerAppExit %d" , aReason );
+
+    if( iFilePath )
+        {
+        iFs.Delete( *iFilePath );
+        }
+
+    __LOG( "CUPnPLocalPlayer::HandleServerAppExit" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::DialogDismissedL
+// Returns from dialog server after cancelling a dialog
+// here is the wait note
+// --------------------------------------------------------------------------
+void CUPnPLocalPlayer::DialogDismissedL( TInt aButtonId )
+    {
+    __LOG1( "CUPnPLocalPlayer::DialogDismissedL %d", aButtonId );
+    if( aButtonId == EEikBidCancel )
+        {
+        iDownloadSession->CancelAllTransfers();
+        iDownloadSession->RemoveObserver();
+        if( iBrowseSessionObserver )
+            {
+            iBrowseSession->SetObserver( *iBrowseSessionObserver );
+            }
+        iBrowseSessionObserver = NULL;
+        iExitReason = KErrCancel;
+        __LOG( "CUPnPLocalPlayer::DialogDismissedL Cancel " );   
+
+        }
+   __LOG( "CUPnPLocalPlayer::DialogDismissedL" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::FinishNote
+// Finish the current waiting note and ready to quit the local playback
+// --------------------------------------------------------------------------
+void CUPnPLocalPlayer::FinishNote()
+    {
+    __LOG( "CUPnPLocalPlayer::FinishNote" );
+    iDownloadSession->CancelAllTransfers();
+    iDownloadSession->RemoveObserver();
+    if( iBrowseSessionObserver )
+        {
+        iBrowseSession->SetObserver( *iBrowseSessionObserver );
+        }
+    iBrowseSessionObserver = NULL;
+    if( iWaitNoteDialog )
+        {
+        TRAP_IGNORE( iWaitNoteDialog->ProcessFinishedL() );
+        delete iWaitNoteDialog;
+        iWaitNoteDialog = NULL;
+        }
+    __LOG( "CUPnPLocalPlayer::FinishNote-END" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::StartWaitingNoteL
+// Start the current waiting note
+// -------------------------------------------------------------------------- 
+void CUPnPLocalPlayer::StartWaitingNoteL()
+    {
+    iWaitNoteDialog = new ( ELeave )CAknWaitDialog(
+                    ( REINTERPRET_CAST ( CEikDialog**, &iWaitNoteDialog ) ),
+                                                            ETrue);
+    iWaitNoteDialog->SetCallback( this );
+    iWaitNoteDialog->ExecuteLD( 
+                R_UPNPCOMMONUI_VIDEO_PLAYBACK_WAIT_NOTE_DIALOG );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLocalPlayer::IsLocallySupportedL
+// Checks if the item can be played locally.
+// -------------------------------------------------------------------------- 
+TBool CUPnPLocalPlayer::IsLocallySupportedL( CUpnpObject& aItem )
+    {
+    TBool retval = EFalse; // return value
+
+    // Get all res elements into array
+    RUPnPElementsArray elms;
+    CleanupClosePushL( elms );
+    UPnPItemUtility::GetResElements( aItem, elms );
+    TInt count = elms.Count();
+    
+    CUpnpDlnaProtocolInfo* pInfo = NULL;
+
+    // Determine which resources are usable:
+    //  1. Filter out other than HTTP GET resources (internal uri's, RTP)
+    //  2. Filter out such resources for which DLNA profile is not supported.
+    //  3. Filter out such resources for which mime type is not supported.
+    for( TInt i = count-1 ; i >= 0; i-- )
+        {
+        // Make sure that it is a HTTP GET resource. Otherwise remove it and
+        // continue with the next one.
+        if( elms[ i ]->Value().Left( 
+                KHttpDes.iTypeLength ).Compare( KHttpDes() ) != 0 )
+            {
+            CUpnpElement* destroyable = elms[i];
+            aItem.RemoveElementL( destroyable ); 
+            delete destroyable;
+
+            continue;
+            }
+
+        // Obtain protocolInfo of the res element.
+        const CUpnpAttribute* attr = NULL;
+        TRAPD( nosuchattribute, 
+               attr = &UPnPItemUtility::FindAttributeByNameL(
+                                                        *elms[ i ],
+                                                        KProtocolInfo() ) );
+
+        if ( nosuchattribute ) 
+            {
+            // No mandatory protocolinfo attribute. Remove this and continue.
+            CUpnpElement* destroyable = elms[i];
+            aItem.RemoveElementL( destroyable ); 
+            delete destroyable;
+
+            continue;
+            }
+
+        // parse protocol info
+        pInfo = CUpnpDlnaProtocolInfo::NewL( attr->Value() );
+        CleanupStack::PushL( pInfo );
+
+        // Check that DLNA profile is among the supported ones.            
+        if ( pInfo->PnParameter() != KNullDesC8() 
+             && !UPnPDlnaUtility::IsSupportedDlnaProfile( 
+                                                pInfo->PnParameter() ) )
+            {
+            // DLNA profile not supported. Remove this and continue.
+            CUpnpElement* destroyable = elms[i];
+            aItem.RemoveElementL( destroyable ); 
+            delete destroyable;
+            CleanupStack::PopAndDestroy( pInfo );
+            pInfo = NULL;
+
+            continue;
+            }
+
+        // check that mime type is among the supported ones
+        TPtrC8 mime = pInfo->ThirdField();
+        if ( !UPnPDlnaUtility::IsSupportedMimeType( mime ) ) 
+            {
+            // mime type not supported.
+            TPtrC8 httpget = pInfo->FirstField();
+            TPtrC8 httpdlnatem = pInfo->FourthField();
+            HBufC8* tem = NULL;
+            tem = httpdlnatem.Right( httpdlnatem.Length() - httpdlnatem.Find( 
+                                            KHttpEqual ) - 1 ).AllocLC();
+            tem->Des().Trim();
+            TPtrC8 httpdlna = *tem;
+            CleanupStack::PopAndDestroy( tem );
+            if ( httpget.Compare( KHttpGetDes ) != 0 ||
+                    !UPnPDlnaUtility::IsSupportedDlnaProfile
+                    ( httpdlna ) )
+                {
+                // mime type not supported and DLNA profile not supported. 
+                // Remove this and continue
+                CUpnpElement* destroyable = elms[i];
+                aItem.RemoveElementL( destroyable ); 
+                delete destroyable;
+                CleanupStack::PopAndDestroy( pInfo );
+                pInfo = NULL;
+                
+                continue;
+                }
+            }
+
+        CleanupStack::PopAndDestroy( pInfo );
+        pInfo = NULL;
+        }
+
+    // All res elements have been processed and removed if they are not 
+    // supported. Clean up and return ETrue if there are res elements 
+    // left in the item and EFalse if there are no res elements left.        
+    CleanupStack::PopAndDestroy( &elms ); 
+
+    UPnPItemUtility::GetResElements( aItem, elms );
+    retval = elms.Count();
+    elms.Close();    
+
+    return retval;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpnavipanecontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,640 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for UPnP navi pane container
+*
+*/
+
+
+
+// INCLUDE FILES
+// system
+#include <AknUtils.h>
+#include <upnpstring.h>
+#include <aknlists.h>
+#include <AknIconArray.h>
+#include <aknnavilabel.h>
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h> 
+#include <layoutmetadata.cdl.h> 
+#include <eiklabel.h>
+#include <AknIconUtils.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <data_caging_path_literals.hrh>
+#include <layoutmetadata.cdl.h>
+#include <AknBidiTextUtils.h>
+#include <bautils.h>
+
+// internal
+#include "upnpnavipanecontainer.h"
+#include <upnpcommonui.rsg>
+#include <upnpcommonui.mbg>
+#include "upnpperiodic.h"
+
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" );
+
+// CONSTANTS
+const TInt KPeriodicTimerDelay = 1000000; // microseconds
+const TInt KPeriodicTimerInterval = 200000; // microseconds
+_LIT( KUPnPCommonUiRscFile, "\\resource\\upnpcommonui.rsc" );
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::CUPnPNaviPaneContainer
+// --------------------------------------------------------------------------
+//
+CUPnPNaviPaneContainer::CUPnPNaviPaneContainer()
+    {
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::NewL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPNaviPaneContainer* CUPnPNaviPaneContainer::NewL( 
+                                     const TRect& aRect,
+                                     TPoint aPosition,
+                                     CAknNavigationControlContainer* aParent )
+    {
+    CUPnPNaviPaneContainer* self = new ( ELeave ) CUPnPNaviPaneContainer();
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect, aPosition, aParent );
+    CleanupStack::Pop();
+    return self;
+    }    
+
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUPnPNaviPaneContainer::ConstructL( 
+                                 const TRect& aRect, 
+                                 TPoint aPosition,
+                                 CAknNavigationControlContainer* aParent )
+    {
+    iCoeEnv = CEikonEnv::Static();
+    RFs& fileSession = iCoeEnv->FsSession();
+
+    // Load common ui resource file
+    TFileName rscFileName( KUPnPCommonUiRscFile );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive );
+    
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( fileSession, rscFileName ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+    iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName );
+    
+    
+    // Create label    
+    iFirstDrawDelayWaited = EFalse;
+
+    iPosition.iX = aPosition.iX;
+    iPosition.iY = aPosition.iY;
+    
+    TRect backgroundRect = aRect;
+    backgroundRect.iTl.iX = -iPosition.iX;
+       
+    iSkinContext = CAknsBasicBackgroundControlContext::NewL(
+       KAknsIIDQsnBgNavipaneSolid , backgroundRect, EFalse );
+       
+    SetPosition(iPosition);
+    
+    SetRect(aRect);
+    CreateWindowL( aParent );
+        
+    iIcon1 = LoadIconL( EFrame1, this );
+    iIcon2 = LoadIconL( EFrame2, this );
+    iIcon3 = LoadIconL( EFrame3, this );
+    iIcon4 = LoadIconL( EFrame4, this );
+    iIcon5 = LoadIconL( EFrame5, this );
+    iIcon6 = LoadIconL( EFrame6, this );
+    iIcon7 = LoadIconL( EFrame7, this );
+    iIcon8 = LoadIconL( EFrame8, this );
+    iIcon9 = LoadIconL( EFrame9, this );
+    
+    AknIconUtils::SetSize( iIcon1->Bitmap(), 
+                          TSize(aRect.Height(),
+                          aRect.Height() ) ); //width = height, on purpose
+                          
+    AknIconUtils::SetSize( iIcon2->Bitmap(),
+                          TSize(aRect.Height(),
+                          aRect.Height() ) ); //width = height, on purpose
+                          
+    AknIconUtils::SetSize( iIcon3->Bitmap(),
+                          TSize(aRect.Height(),
+                          aRect.Height() ) ); //width = height, on purpose
+                          
+    AknIconUtils::SetSize( iIcon4->Bitmap(),
+                          TSize(aRect.Height(),
+                          aRect.Height() ) ); //width = height, on purpose
+
+    AknIconUtils::SetSize( iIcon5->Bitmap(),
+                          TSize(aRect.Height(),
+                          aRect.Height() ) ); //width = height, on purpose
+
+    AknIconUtils::SetSize( iIcon6->Bitmap(),
+                          TSize(aRect.Height(),
+                          aRect.Height() ) ); //width = height, on purpose
+
+    AknIconUtils::SetSize( iIcon7->Bitmap(),
+                          TSize(aRect.Height(),
+                          aRect.Height() ) ); //width = height, on purpose
+
+    AknIconUtils::SetSize( iIcon8->Bitmap(),
+                          TSize(aRect.Height(),
+                          aRect.Height() ) ); //width = height, on purpose
+
+    AknIconUtils::SetSize( iIcon9->Bitmap(),
+                          TSize(aRect.Height(),
+                          aRect.Height() ) ); //width = height, on purpose
+                          
+    iNavipaneIcon = iIcon1; //set first image in animation
+    
+    iPeriodic = CUPnPPeriodic::NewL( CActive::EPriorityUserInput );
+    iPeriodic->Start( KPeriodicTimerDelay,
+                      KPeriodicTimerInterval,
+                      TCallBack(UpdateAnimationL, this ) );
+    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::~CUPnPNaviPaneContainer
+// --------------------------------------------------------------------------
+//
+CUPnPNaviPaneContainer::~CUPnPNaviPaneContainer()
+    {
+    if ( iResFileOffset )
+        {
+        iCoeEnv->DeleteResourceFile( iResFileOffset );
+        iResFileOffset = 0;
+        }
+    
+    if ( iPeriodic )
+        {
+        iPeriodic->Cancel();
+        delete iPeriodic;
+        }
+    DeleteIcon( EFrame1 );
+    DeleteIcon( EFrame2 );
+    DeleteIcon( EFrame3 );
+    DeleteIcon( EFrame4 );
+    DeleteIcon( EFrame5 );
+    DeleteIcon( EFrame6 );
+    DeleteIcon( EFrame7 );
+    DeleteIcon( EFrame8 );
+    DeleteIcon( EFrame9 );
+    delete iSkinContext;
+    /*
+    delete iLabel;
+    */
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::CountComponentControls
+// --------------------------------------------------------------------------
+//
+TInt CUPnPNaviPaneContainer::CountComponentControls() const
+    {
+    return 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::ComponentControl
+// --------------------------------------------------------------------------
+//
+CCoeControl* CUPnPNaviPaneContainer::ComponentControl( TInt /*aIndex*/ ) const
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::Draw
+// --------------------------------------------------------------------------
+//
+void CUPnPNaviPaneContainer::Draw( const TRect& aRect ) const
+    {
+    // Do not draw custom navi pane in landscape orientation
+    if (Layout_Meta_Data::IsLandscapeOrientation() == EFalse)
+        {
+        if (iFirstDrawDelayWaited)
+            {        
+            CWindowGc& gc = SystemGc();
+            gc.Clear();
+        
+            MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        
+            if (iSkinContext)
+                {//Draw the skin background
+                AknsDrawUtils::Background(
+                    skin, iSkinContext, this, gc, aRect);
+                }
+            else
+                {//  clear the area
+                gc.SetBrushColor( iEikonEnv->ControlColor(
+                                  EColorWindowBackground, *this ) );
+                gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+                gc.Clear( aRect );
+                }
+    
+    
+            const CFont* normalFont = iCoeEnv->AnnotationFont();
+            TInt baseline = ((aRect.Height() / 2) +
+                         (normalFont->AscentInPixels() / 2));
+       
+            TRgb color(0,0,0);
+
+            TInt err = AknsUtils::GetCachedColor( skin, color, 
+                                                  KAknsIIDQsnTextColors, 
+                                                  EAknsCIQsnTextColorsCG2 );
+
+   
+            gc.UseFont(normalFont);
+            if( KErrNone == err )
+                {
+                gc.SetPenColor( color );    
+                }
+            else
+                {
+                gc.SetPenColor( KRgbBlack );
+                }
+            gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+    
+            HBufC* naviPaneText = NULL;
+            TRAP( err,  naviPaneText = StringLoader::LoadL(
+                                  R_UPNPCOMMONUI_SERVER_SEARCH_MAIN ) );
+            
+            TSize animationFrameSize =
+                  iNavipaneIcon->Bitmap()->SizeInPixels();
+          
+            const TInt textWidth = (aRect.Width() - 
+                                    animationFrameSize.iWidth);
+    
+            TBuf< 128 > textBuffer;
+            
+            if( KErrNone == err )
+                {
+                if (AknBidiTextUtils::ConvertToVisualAndClip( *naviPaneText,
+                                                           textBuffer,
+                                                          *normalFont,
+                                                           textWidth,
+                                                           textWidth))
+                    {
+                    gc.DrawText(textBuffer, aRect, baseline,
+                                CGraphicsContext::ELeft);    
+                    }
+                else //text not clipped, default case
+                    {
+                    gc.DrawText(textBuffer, aRect, baseline,
+                                CGraphicsContext::ELeft);
+                    }
+                delete naviPaneText;
+                }
+            TPoint upperLeftCorner((aRect.Width() - 
+                                   animationFrameSize.iWidth), 0);
+                                   
+            gc.BitBltMasked(upperLeftCorner, iNavipaneIcon->Bitmap(), Rect(),
+                                         iNavipaneIcon->Mask(), EFalse);
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::LoadIconL
+// --------------------------------------------------------------------------
+//
+
+
+CGulIcon* CUPnPNaviPaneContainer::LoadIconL( TAnimationFrames aAnimationState,
+                                             TAny* aDlg)
+    {
+    static_cast<CUPnPNaviPaneContainer*>( aDlg )->
+                                            DeleteIcon( aAnimationState );
+    
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+    TInt id = 0;
+    TInt maskId = 0;
+    TAknsItemID skinId = KAknsIIDNone;
+    
+    switch ( aAnimationState )
+        {
+        
+        case EFrame1:
+            {
+            id = EMbmUpnpcommonuiQgn_indi_upnp_search_1;
+            maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_1_mask;
+            skinId = KAknsIIDQsnBgNavipaneSolid;
+            break;
+            }
+        case EFrame2:
+            {
+            id = EMbmUpnpcommonuiQgn_indi_upnp_search_2;
+            maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_2_mask;
+            skinId = KAknsIIDQsnBgNavipaneSolid;
+            break;
+            }
+        case EFrame3:
+            {
+            id = EMbmUpnpcommonuiQgn_indi_upnp_search_3;
+            maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_3_mask;
+            skinId = KAknsIIDQsnBgNavipaneSolid;
+            break;
+            }
+        case EFrame4:
+            {
+            id = EMbmUpnpcommonuiQgn_indi_upnp_search_4;
+            maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_4_mask;
+            skinId = KAknsIIDQsnBgNavipaneSolid;
+            break;
+            }
+        case EFrame5:
+            {
+            id = EMbmUpnpcommonuiQgn_indi_upnp_search_5;
+            maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_5_mask;
+            skinId = KAknsIIDQsnBgNavipaneSolid;
+            break;
+            }
+        case EFrame6:
+            {
+            id = EMbmUpnpcommonuiQgn_indi_upnp_search_6;
+            maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_6_mask;
+            skinId = KAknsIIDQsnBgNavipaneSolid;
+            break;
+            }
+        case EFrame7:
+            {
+            id = EMbmUpnpcommonuiQgn_indi_upnp_search_7;
+            maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_7_mask;
+            skinId = KAknsIIDQsnBgNavipaneSolid;
+            break;
+            }
+        case EFrame8:
+            {
+            id = EMbmUpnpcommonuiQgn_indi_upnp_search_8;
+            maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_8_mask;
+            skinId = KAknsIIDQsnBgNavipaneSolid;
+            break;
+            }
+        case EFrame9:
+            {
+            id = EMbmUpnpcommonuiQgn_indi_upnp_search_9;
+            maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_9_mask;
+            skinId = KAknsIIDQsnBgNavipaneSolid;
+            break;
+            }    
+        default:
+            {
+            break;
+            }
+        }
+    
+    TFileName mbmFileName( KAknCommonUIMbmFileName );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    mbmFileName.Insert( 0, drive );
+    
+    AknsUtils::CreateIconL( skin,
+                             skinId,                             
+                             bitmap,
+                             mask,
+                             mbmFileName,
+                             id,
+                             maskId );
+                             
+     CleanupStack::PushL(mask);
+     CleanupStack::PushL(bitmap);                         
+    
+    
+   // Get the color of the search text 
+    TRgb color(0,0,0);
+    TBool useWhite = EFalse;
+    TInt err = AknsUtils::GetCachedColor( skin, color, 
+                                    KAknsIIDQsnTextColors, 
+                                    EAknsCIQsnTextColorsCG2 );
+
+
+    
+     // If text color is closer to white, use white animation
+    if( KErrNone == err && 
+        color.Difference(KRgbBlack) > color.Difference(KRgbWhite))
+        {
+        useWhite = ETrue;
+        } 
+    
+    
+    
+    err = KErrNone;
+    if( useWhite )
+        {
+        TInt imgSize = static_cast<CUPnPNaviPaneContainer*>( 
+                                        aDlg )->Rect().Height();
+        AknIconUtils::SetSize( bitmap,TSize(imgSize,imgSize) );
+        TSize size = bitmap->SizeInPixels();
+        
+        CleanupStack::PopAndDestroy(bitmap);
+        bitmap = new(ELeave) CFbsBitmap();
+        CleanupStack::PushL(bitmap);
+        err = bitmap->Create(size, EColor16M);
+        }    
+                            
+        
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally( EFalse );
+
+    CleanupStack::Pop( bitmap ); // bitmap, mask
+    CleanupStack::Pop( mask ); // bitmap, mask
+    bitmap = NULL;
+    mask = NULL;
+    
+    return icon;
+    }
+
+void CUPnPNaviPaneContainer::DeleteIcon( TAnimationFrames aAnimationState )
+    {
+    switch ( aAnimationState )
+        {
+        case EFrame1:
+            {
+            delete iIcon1;
+            iIcon1 = NULL;
+            break;
+            }
+        case EFrame2:
+            {
+            delete iIcon2;
+            iIcon2 = NULL;
+            break;
+            }
+        case EFrame3:
+            {
+            delete iIcon3;
+            iIcon3 = NULL;
+            break;
+            }
+        case EFrame4:
+            {
+            delete iIcon4;
+            iIcon4 = NULL;
+            break;
+            }
+        case EFrame5:
+            {
+            delete iIcon5;
+            iIcon5 = NULL;
+            break;
+            }
+        case EFrame6:
+            {
+            delete iIcon6;
+            iIcon6 = NULL;
+            break;
+            }
+        case EFrame7:
+            {
+            delete iIcon7;
+            iIcon7 = NULL;
+            break;
+            }
+        case EFrame8:
+            {
+            delete iIcon8;
+            iIcon8 = NULL;
+            break;
+            }
+        case EFrame9:
+            {
+            if (iIcon9)
+                {
+                delete iIcon9;
+                iIcon9 = NULL;
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::UpdateAnimation
+// --------------------------------------------------------------------------
+//
+
+TBool CUPnPNaviPaneContainer::UpdateAnimationL( TAny* aDlg )
+    {       
+    CUPnPNaviPaneContainer* dlg = 
+                    static_cast<CUPnPNaviPaneContainer*>( aDlg );
+    
+    if ( !dlg->iFirstDrawDelayWaited )
+        {
+        dlg->iFirstDrawDelayWaited = ETrue;
+        }
+        
+    switch ( dlg->iAnimationIndex++ % 9 )
+        {
+        case 0:
+            {
+            dlg->iNavipaneIcon = dlg->iIcon1;
+            break;
+            }
+        case 1:
+            {
+            dlg->iNavipaneIcon = dlg->iIcon2;
+            break;
+            }
+        case 2:
+            {
+            dlg->iNavipaneIcon = dlg->iIcon3;
+            break;
+            }
+        case 3:
+            {
+            dlg->iNavipaneIcon = dlg->iIcon4;
+            break;
+            }
+        case 4:
+            {
+            dlg->iNavipaneIcon = dlg->iIcon5;
+            break;
+            }
+        case 5:
+            {
+            dlg->iNavipaneIcon = dlg->iIcon6;
+            break;
+            }
+        case 6:
+            {
+            dlg->iNavipaneIcon = dlg->iIcon7;
+            break;
+            }
+        case 7:
+            {
+            dlg->iNavipaneIcon = dlg->iIcon8;
+            break;
+            }
+        case 8:
+            {
+            dlg->iNavipaneIcon = dlg->iIcon9;
+            break;
+            }
+        default:
+            {
+            // error
+            break;
+            }
+        }
+
+    if (dlg->iAnimationIndex >= 9)
+        {
+        dlg->iAnimationIndex = 0;
+        }   
+        
+    dlg->DrawAnimation();
+
+    return ETrue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPNaviPaneContainer::DrawAnimation
+// --------------------------------------------------------------------------
+//
+
+void CUPnPNaviPaneContainer::DrawAnimation()
+    {
+    TPoint imagePosition;
+    imagePosition.iX = iPosition.iX;
+    imagePosition.iY = iPosition.iY;
+    CWindowGc& gc = SystemGc();
+    RDrawableWindow* drawWindow = DrawableWindow();    
+    gc.Activate( *drawWindow );    
+    Draw( Rect() );
+    gc.Deactivate();
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpselectiondialog.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,641 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for UPnP Browse UI Implementation
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <aknPopupHeadingPane.h>
+#include <aknPopup.h>
+#include <aknlists.h>
+#include <AknIconArray.h>
+#include <gulicon.h>
+#include <StringLoader.h>
+
+// upnp stack api
+#include <upnpstring.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdevice.h"
+#include "upnpavcontroller.h"
+#include "upnpavcontrollerfactory.h"
+#include "upnpavdevicelist.h"
+#include "upnpavdevice.h"
+#include "upnpavcontroller.h"
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"
+
+// common ui internal
+#include <upnpcommonui.rsg>
+#include <upnpcommonui.mbg> //for icons
+#include "upnpselectiondialog.h"
+#include "upnpcommonui.h"
+
+// debug stuff
+_LIT( KComponentLogfile, "commonui.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" );
+const TInt KLength = 100;
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUPnPSelectionDialog* CUPnPSelectionDialog::NewL(
+    MUPnPAVController& aAVControl )
+    {
+    __LOG( "CUPnPSelectionDialog::NewL" );
+    
+    CUPnPSelectionDialog* self = 
+                           new ( ELeave ) CUPnPSelectionDialog( aAVControl );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::ConstructL()
+    {
+    __LOG( "CUPnPSelectionDialog::ConstructL" );
+    
+    iDeviceArray = CUpnpAVDeviceList::NewL();
+    // Register as an observer to device operations
+
+    iTypeOfDevicesToSearch = EUPnPSearchAllDevices;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::CUPnPSelectionDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+CUPnPSelectionDialog::CUPnPSelectionDialog( MUPnPAVController& aAVControl ):
+                                           iAVControl( aAVControl )
+    {
+    __LOG( "CUPnPSelectionDialog::CUPnPSelectionDialog" );
+    
+    iDeviceObserver = iAVControl.DeviceObserver();
+    iAVControl.RemoveDeviceObserver();
+    iAVControl.SetDeviceObserver( *this );
+    iPopup = NULL;
+    iExitReason = KErrNone;
+    }
+
+// Destructor
+CUPnPSelectionDialog::~CUPnPSelectionDialog()
+    {
+    __LOG( "CUPnPSelectionDialog::~CUPnPSelectionDialog" );
+
+    delete iListBox;
+
+    // Unregister as an observer to device operations
+    iAVControl.RemoveDeviceObserver();
+    if( iDeviceObserver )
+        {
+        iAVControl.SetDeviceObserver( *iDeviceObserver );    
+        }
+
+    delete iDeviceArray;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::PreLayoutDynInitL( const TDesC& aTitle )
+    {
+    __LOG( "CUPnPSelectionDialog::PreLayoutDynInitL" );
+
+    // Browse dialog title text
+    iPopup->SetTitleL( aTitle ); 
+
+    CAknIconArray* icons = new ( ELeave ) CAknIconArray(2);
+    CleanupStack::PushL( icons );
+
+    // Mif icons
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) );
+
+    TFileName mbmFileName( KAknCommonUIMbmFileName );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    mbmFileName.Insert( 0, drive );
+    
+    // Media server icon
+    AppendIconToArrayL( icons, skin, 
+                        mbmFileName, 
+                        KAknsIIDDefault, 
+                        EMbmUpnpcommonuiQgn_server_icon, 
+                        EMbmUpnpcommonuiQgn_server_icon_mask );
+    iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
+    CleanupStack::Pop( icons );
+    
+    // Enable horizontal scrolling
+    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+    LoadListItemsL();
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::LoadListItemsL
+// Sends the browse request to UPnP AV Controller. When result set arrives,
+// UPnP AV Controller will call the "BrowseResultsL" call back method,
+// which is implemented below.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::LoadListItemsL()
+    {
+    __LOG( "CUPnPSelectionDialog::LoadListItemsL" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+    
+    //contents inside the array will be owned by iDeviceArray
+    CUpnpAVDeviceList* tempDeviceArray = NULL;
+    // Get the devices from the UPnP Stack according to the search criteria
+    if( iTypeOfDevicesToSearch == EUPnPSearchAllDevices )
+        {
+            CUpnpAVDeviceList* tempDeviceArray2 = NULL;
+            tempDeviceArray2 = iAVControl.GetMediaServersL();
+            if( tempDeviceArray2->Count() > 0 )
+                {
+                CleanupStack::PushL( tempDeviceArray2 );
+                CleanupStack::PushL( tempDeviceArray );
+                for( TInt i = 0; i < tempDeviceArray2->Count(); i++ )
+                    {
+                    tempDeviceArray->AppendDeviceL( 
+                                                *( *tempDeviceArray2 )[i] );
+                    }
+                
+                CleanupStack::Pop( tempDeviceArray );
+                CleanupStack::Pop( tempDeviceArray2 );
+                tempDeviceArray2->Reset();
+                
+                }
+            
+            tempDeviceArray2 = iAVControl.GetMediaRenderersL();
+            
+            if(tempDeviceArray2->Count() > 0 )
+                {
+                CleanupStack::PushL( tempDeviceArray2 );
+                CleanupStack::PushL( tempDeviceArray );
+                for( TInt i = 0; i < tempDeviceArray2->Count(); i++ )
+                    {
+                    tempDeviceArray->AppendDeviceL( 
+                                                *( *tempDeviceArray2 )[i] );
+                    }
+                
+                CleanupStack::Pop( tempDeviceArray );    
+                CleanupStack::Pop( tempDeviceArray2);
+                tempDeviceArray2->Reset();
+                }
+            
+            delete tempDeviceArray2;
+            
+        }
+    else if( iTypeOfDevicesToSearch == EUPnPSearchAllServerDevices ||
+      iTypeOfDevicesToSearch == EUPnPSearchServerDevicesWithCopyCapability ||
+      iTypeOfDevicesToSearch == EUPnPSearchServerDevicesWithSearchCapability )
+        {
+        tempDeviceArray = iAVControl.GetMediaServersL();
+        }
+    else
+        {
+        tempDeviceArray = iAVControl.GetMediaRenderersL();
+        }
+    
+    CleanupStack::PushL( tempDeviceArray );
+    if ( tempDeviceArray->Count() )
+        {
+        for ( TInt i=0; i < tempDeviceArray->Count(); i++ )
+            {
+            // Check if the device match with the search criteria
+            if( MatchWithSearchCriteria( 
+                     const_cast<CUpnpAVDevice*>( ( *tempDeviceArray)[i] ) ) )
+                {
+                iDeviceArray->AppendDeviceL( *( *tempDeviceArray )[i] );
+                }
+            else
+                {
+                CUpnpAVDevice* tempDevice = ( *tempDeviceArray )[i];
+                delete tempDevice;
+                tempDevice = NULL;
+                }
+            }        
+        
+        
+        for ( TInt i=0; i < iDeviceArray->Count(); i++ )
+            {
+            // Get device friendly name and replace illegal characters.
+            HBufC8* tmpfriendlyname = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL(               
+                ( *iDeviceArray )[i]->FriendlyName().Left( KLength ) );
+            CleanupStack::PushL( tmpfriendlyname);
+            
+            HBufC* device = UpnpString::ToUnicodeL( *tmpfriendlyname );
+            CleanupStack::PushL( device);
+
+            TBuf<KMaxFileName> item;
+            item.Format( _L( "%d\t%S\t\t" ),0, device ); 
+
+            CleanupStack::PopAndDestroy( device );
+            CleanupStack::PopAndDestroy( tmpfriendlyname );
+            listBoxItems->AppendL( item );            
+            }
+
+        // Updates CBA.
+        UpdateCommandSetL();
+
+        iListBox->HandleItemAdditionL(); // Update listbox
+        iListBox->SetCurrentItemIndexAndDraw( 0 ); // select new item
+ 
+        }     
+    else
+        {
+        HBufC* waitText = StringLoader::LoadLC( 
+                            R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE );
+        iListBox->View()->SetListEmptyTextL( *waitText );
+        CleanupStack::PopAndDestroy( waitText ); 
+        }
+        
+    CleanupStack::Pop( tempDeviceArray );
+    tempDeviceArray->Reset();
+    delete tempDeviceArray;    
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::UPnPDeviceDiscovered
+// Returns discovered device from UPnP AV control point.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::UPnPDeviceDiscovered( 
+                                               const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPSelectionDialog::UPnPDeviceDiscovered" );
+
+    TRAPD( error, UPnPDeviceDiscoveredL( aDevice ) );
+    if( error )
+        {
+        __LOG1( "UPnPDeviceDiscoveredL, leave %d .", error );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::UPnPDeviceDiscoveredL
+// Returns discovered device from UPnP AV control point.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::UPnPDeviceDiscoveredL( 
+                                               const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPSelectionDialog::UPnPDeviceDiscovered" );
+
+    
+    if ( MatchWithSearchCriteria( const_cast<CUpnpAVDevice*>( &aDevice ) ) )
+        {
+        CUpnpAVDevice* tempDevice = CUpnpAVDevice::NewL( aDevice );
+        CleanupStack::PushL( tempDevice );
+        //ownership transferred                                      
+        iDeviceArray->AppendDeviceL( *tempDevice );
+        CleanupStack::Pop( tempDevice );
+
+        HBufC8* tmpfriendlyname = 
+            UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+            ( ( CUpnpAVDevice* )tempDevice )->FriendlyName() );
+
+        CleanupStack::PushL( tmpfriendlyname );
+        TPtrC8 friendlyname = *tmpfriendlyname;
+
+        CTextListBoxModel* model = iListBox->Model();
+        MDesCArray* textArray = model->ItemTextArray();
+        CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+        TBuf<KMaxFileName> item;
+        HBufC* tmpStr = 
+                    UpnpString::ToUnicodeL( friendlyname.Left( KLength ) );
+        CleanupStack::PushL( tmpStr );
+        item.Format( _L( "%d\t%S\t\t" ),0, tmpStr ); 
+        CleanupStack::PopAndDestroy( tmpStr );
+        CleanupStack::PopAndDestroy( tmpfriendlyname );
+        listBoxItems->AppendL( item  );
+        iListBox->HandleItemAdditionL(); // Update listbox
+
+        // Updates CBA.
+        UpdateCommandSetL();
+
+        iListBox->ActivateL();
+        iListBox->DrawDeferred();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::UPnPDeviceDisappeared
+// Returns disappeared device from UPnP AV control point.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::UPnPDeviceDisappeared(
+                                            const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPSelectionDialog::UPnPDeviceDisappeared" );
+
+    TRAPD( error, UPnPDeviceDisappearedL( aDevice ) );
+    if ( error )
+        {
+        __LOG1( "UPnPDeviceDisappearedL, leave %d", error );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::UPnPDeviceDisappearedL
+// Returns disappeared device from UPnP AV control point.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::UPnPDeviceDisappearedL(
+    const CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPSelectionDialog::UPnPDeviceDisappearedL" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    TInt currentItem = iListBox->CurrentItemIndex();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+    TInt i( 0 );
+    TPtrC8 ptr( aDevice.Uuid() );
+    
+    while( i < iDeviceArray->Count() && 
+           ptr.Compare( ( *iDeviceArray )[i]->Uuid() ) )
+        {
+        i++;
+        }
+    if ( i < iDeviceArray->Count() )
+        {
+        iDeviceArray->RemoveAndDestroy( i );
+        listBoxItems->Delete( i, 1 );
+        AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(
+            iListBox, currentItem, ETrue );
+        iListBox->DrawDeferred();
+        }
+
+    if ( !iDeviceArray->Count() )
+        {
+        // show "Waiting devices" text
+        HBufC* waitText = StringLoader::LoadLC( 
+                                R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE );
+        iListBox->View()->SetListEmptyTextL( *waitText );
+        CleanupStack::PopAndDestroy( waitText ); 
+
+        // Updates CBA.
+        UpdateCommandSetL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::WLANConnectionLost
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::WLANConnectionLost() 
+    {
+    __LOG( "CUPnPSelectionDialog::WLANConnectionLost" );
+    DismissItself( KErrDisconnected );
+    };
+    
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::AppendIconToArrayL
+// Load a possibly skinned icon (with mask) and append it to an
+// icon array.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::AppendIconToArrayL( CAknIconArray* aArray,
+                                               MAknsSkinInstance* aSkin,
+                                               const TDesC& aMbmFile,
+                                               const TAknsItemID& aID,
+                                               TInt aBitmapId,
+                                               TInt aMaskId )
+    {
+    __LOG( "CUPnPSelectionDialog::AppendIconToArrayL" );
+    __ASSERTD( aArray != NULL, __FILE__, __LINE__ );
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC( aSkin, aID,
+        bitmap, mask, aMbmFile, aBitmapId, aMaskId );
+
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally( EFalse );
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop( 2 ); // mask, bitmap
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL( icon );
+    aArray->AppendL( icon );
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::CreatePopupL
+// Creates a selection popup.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::CreatePopupL( 
+                                const TDesC& aTitle,
+                                TUPnPDeviceTypesToSearch aDeviceType )
+    {
+    __LOG( "CUPnPSelectionDialog::CreatePopupL" );
+
+    // Store the type of devices that are searched
+    iTypeOfDevicesToSearch = aDeviceType;
+
+    // Create and configure the list box 
+    iListBox = new (ELeave) CAknSingleGraphicPopupMenuStyleListBox;
+    iPopup = CAknPopupList::NewL( iListBox, 
+                                  R_UPNPCOMMONUI_SOFTKEYS_EMPTY_CANCEL,
+                                  AknPopupLayouts::EDynMenuWindow );
+    iListBox->ConstructL( iPopup, EAknListBoxSelectionList );
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff, 
+        CEikScrollBarFrame::EAuto );
+    PreLayoutDynInitL( aTitle );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::StartPopupL
+// Parses the friendly names from the list of UPnPAVDevices and
+// executes the selection dialog. Returns ID of the selected item.
+// --------------------------------------------------------------------------
+TInt CUPnPSelectionDialog::StartPopupL( CUpnpAVDevice& aDevice )
+    {
+    __LOG( "CUPnPSelectionDialog::StartPopupL" );
+
+    TInt ret = KErrNone;
+    
+    // Start animation
+    RDebug::Print( _L( "CUPnPSelectionDialog::\
+StartPopupL header animation" ) );
+    iPopup->Heading()-> SetHeaderAnimationL( 
+                        R_UPNPCOMMONUI_ANIMATION_FOR_SELECTION_DIALOG );
+
+    TInt popupOk = iPopup->ExecuteLD();
+    iPopup = NULL;
+    if ( popupOk )
+        {
+        if ( iListBox->CurrentItemIndex() >= 0 )
+            {
+            CUpnpAVDevice* device =
+                        ( *iDeviceArray )[iListBox->CurrentItemIndex()];
+            aDevice.CopyFromL( *device );
+            ret = KErrNone;
+            }
+        }
+    else
+        {
+        if( KErrNone == iExitReason )
+            {
+            ret = KErrCancel;    
+            }
+        else
+            {
+            ret = iExitReason;
+            }
+        
+        }
+    return ret;    
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::DismissItself
+// Dismiss the selection dialog via an error code.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::DismissItself( TInt aError )
+    {
+    iExitReason = aError;
+    if( iPopup )
+        {
+        iPopup->CancelPopup();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::MatchWithSearchCriteria
+// Checks if a given device matches with the search criteria.
+// --------------------------------------------------------------------------
+TBool CUPnPSelectionDialog::MatchWithSearchCriteria( CUpnpAVDevice *aDevice )
+    {
+    TBool returnValue = EFalse;
+    if( aDevice )
+        {
+        // If all device types are accepted
+        if( iTypeOfDevicesToSearch == EUPnPSearchAllDevices )
+            {
+            returnValue = ETrue;
+            }
+        // If all media server devices are accepted
+        else if( iTypeOfDevicesToSearch == EUPnPSearchAllServerDevices &&
+                 aDevice->DeviceType() == CUpnpAVDevice::EMediaServer )
+            {
+            returnValue = ETrue;
+            }
+        // If all rendering devices are accepted
+        else if( iTypeOfDevicesToSearch == EUPnPSearchAllRenderingDevices &&
+                 aDevice->DeviceType() == CUpnpAVDevice::EMediaRenderer )
+            {
+            returnValue = ETrue;
+            }
+        // If media server devices with copy capability are accepted
+        else if( iTypeOfDevicesToSearch ==
+                 EUPnPSearchServerDevicesWithCopyCapability &&
+                 aDevice->DeviceType() == CUpnpAVDevice::EMediaServer &&
+                 aDevice->CopyCapability() )
+            {
+            returnValue = ETrue;
+            }
+        // If media server devices with search capability are accepted
+        else if( iTypeOfDevicesToSearch ==
+                 EUPnPSearchServerDevicesWithSearchCapability &&
+                 aDevice->DeviceType() == CUpnpAVDevice::EMediaServer &&
+                 aDevice->SearchCapability() )
+            {
+            returnValue = ETrue;
+            }
+        // If rendering devices with image capability are accepted
+        else if( iTypeOfDevicesToSearch ==
+                 EUPnPSearchRenderingDevicesWithImageCapability &&
+                 aDevice->DeviceType() == CUpnpAVDevice::EMediaRenderer &&
+                 aDevice->ImageCapability() )
+            {
+            returnValue = ETrue;
+            }
+        // If rendering devices with video capability are accepted
+        else if( iTypeOfDevicesToSearch ==
+                 EUPnPSearchRenderingDevicesWithVideoCapability &&
+                 aDevice->DeviceType() == CUpnpAVDevice::EMediaRenderer &&
+                 aDevice->VideoCapability() )
+            {
+            returnValue = ETrue;
+            }
+        // If rendering devices with audio capability are accepted
+        else if( iTypeOfDevicesToSearch ==
+                 EUPnPSearchRenderingDevicesWithAudioCapability &&
+                 aDevice->DeviceType() == CUpnpAVDevice::EMediaRenderer &&
+                 aDevice->AudioCapability() )
+            {
+            returnValue = ETrue;
+            }
+        else
+            {
+            returnValue = EFalse;
+            }
+        }
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSelectionDialog::UpdateCommandSetL
+// Updates command set of the dialog by the search type of the devices.
+// --------------------------------------------------------------------------
+void CUPnPSelectionDialog::UpdateCommandSetL()
+    {
+    // Default values, used when no items in the list.
+    TInt resId = R_UPNPCOMMONUI_SOFTKEYS_EMPTY_CANCEL;
+    if ( iDeviceArray->Count() )
+        {
+        // Updates the commands set by iTypeOfDevicesToSearch variable.
+        switch( iTypeOfDevicesToSearch )
+            {
+            case EUPnPSearchServerDevicesWithCopyCapability:
+                // When copying or moving we should use "Ok" lsk 
+                // instead of "Select".
+                resId = R_AVKON_SOFTKEYS_OK_CANCEL;
+                break;
+            default:
+                resId = R_AVKON_SOFTKEYS_SELECT_CANCEL;
+                break;
+            }
+        }
+    
+    CEikButtonGroupContainer* bgc = iPopup->ButtonGroupContainer();    
+    bgc->SetCommandSetL( resId );
+    bgc->DrawDeferred();
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpcommonui/src/upnpvideoplayerdialog.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1663 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Source file for UPnP Video player
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <aknlists.h>
+#include <AknIconArray.h>
+#include <aknnavilabel.h>
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h> 
+#include <layoutmetadata.cdl.h> 
+#include <AknWaitDialog.h>                      // CAknWaitDialog
+#include <aknnotewrappers.h>
+#include <AknVolumePopup.h>
+#include<remconinterfaceselector.h>             //for CRemConInterfaceSelector
+#include<remconcoreapitarget.h>                 //for CRemConCoreApiTarget
+
+// upnp stack api
+#include <upnpitem.h>
+#include <upnpstring.h>
+#include <upnpdevice.h>
+
+// upnpframework / avcontroller api
+#include "upnpavrenderingsession.h"
+#include "upnpavdevice.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpitemutility.h"                    // ResourceFromItemL
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"
+#include "upnpcdsreselementutility.h"
+
+// commonui internal
+#include <upnpcommonui.rsg>
+#include <upnpcommonui.mbg>
+#include "upnpcommonui.h"
+#include "upnpcommonui.hrh"
+#include "upnpvideoplayerdialog.h"
+#include "upnpperiodic.h"
+
+_LIT( KComponentLogfile, "commonui.txt" );
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KMPOneSecond(1000000);
+const TInt KOneHourInSeconds(3600);
+const TInt KMaxVolume(100);
+const TInt KMiniumVolume(0);
+const TInt KGetPosInfoPlaybackInterval( 10 );
+const TInt KGetPosInfoBeforePlaybackInterval( 1 );
+const TInt KLength = 100;
+const TInt KDotLength = 3;
+const TInt KVolumeStep = 1;
+const TInt KVolumeInterval = 10;
+
+_LIT( KAknMultiViewsMbmFileName,    "\\resource\\apps\\upnpcommonui.mbm" );
+_LIT( KDot,                         "..." );
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::NewL
+// Alternate two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPVideoPlayerDlg* CUPnPVideoPlayerDlg::NewL(
+                                MUPnPAVRenderingSession& aRenderingSession,
+                                const CUpnpObject& aObject,
+                                CUPnPCommonUI& aCommonUI )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::NewL" );
+
+    CUPnPVideoPlayerDlg* self = NULL;
+    self = new ( ELeave ) CUPnPVideoPlayerDlg( aRenderingSession,
+                                             aObject,
+                                             aCommonUI );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __LOG( "CUPnPVideoPlayerDlg::NewL End" );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::ConstructL( )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::ConstructL" );
+    
+    iAdjustingVolume = EFalse;
+    
+    // Resolve the target device capabilities
+    ResolveTargetDeviceCapabilitiesL();
+
+    iMinSecFormatString =
+        iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_MIN_SEC );
+
+    iHourMinSecFormatString = 
+        iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_LONG );
+
+    iNaviPane = static_cast<CAknNavigationControlContainer*>(
+                CEikStatusPaneBase::Current()->
+                ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+    
+    iNaviPane->Pop();            
+
+    iOriginalTitleText = HBufC16::NewL( KMaxFileName );
+        
+    iTimer = CUPnPPeriodic::NewL( CActive::EPriorityStandard );
+    
+    iCurrentVolume = KMiniumVolume; //0
+    
+    //create a vertical volume controller
+    iVolumePopup = CAknVolumePopup::NewL( NULL, ETrue );
+    
+    //iVolumePopup->SetObserver( this );
+    
+    //set value to the volume popup    
+    iVolumePopup->SetRange( KMiniumVolume , KMaxVolume );
+    iVolumePopup->SetStepSize( KVolumeStep );     
+    iVolumePopup->SetDefaultValue( KMiniumVolume );
+    
+     // Remote control server command repeat timer.
+    iVolumeTimer = CUPnPPeriodic::NewL( EPriorityNormal );
+            
+    // Open a connection to receive Volume Key events.
+    iInterfaceSelector = CRemConInterfaceSelector::NewL();
+    
+    // owned by CRemConInterfaceSelector instance
+    iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector,*this );
+    TRAPD( err, iInterfaceSelector->OpenTargetL() );
+    if( err != KErrNone )
+        {
+        __LOG1("Leave occured in OpenTargetL %d", err);
+        }
+    
+    __LOG( "CUPnPVideoPlayerDlg::ConstructL End" );                  
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::CUPnPVideoPlayerDlg
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPVideoPlayerDlg::CUPnPVideoPlayerDlg(
+                                MUPnPAVRenderingSession& aRenderingSession,
+                                const CUpnpObject& aObject,
+                                CUPnPCommonUI& aCommonUI ):
+                                iRendSession(aRenderingSession),
+                                iCommonUI(aCommonUI)
+                                
+                                
+    {
+    __LOG( "CUPnPVideoPlayerDlg::CUPnPVideoPlayerDlg" );
+    iTargetDevice = &( iRendSession.Device() );
+    iItem = &aObject;
+    iAction = CUPnPCommonUI::EUPnPNone;
+    
+    __LOG( "CUPnPVideoPlayerDlg::CUPnPVideoPlayerDlg End" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPVideoPlayerDlg::~CUPnPVideoPlayerDlg()
+    {
+    __LOG( "CUPnPVideoPlayerDlg::~CUPnPVideoPlayerDlg" );
+    
+    if( iVolumeTimer )
+        {
+        iVolumeTimer->Cancel();
+        delete iVolumeTimer;
+        }
+    
+    if( iVolumePopup )
+        {
+        iVolumePopup->CloseVolumePopup();
+        }
+    
+    delete iVolumePopup;        
+    delete iInterfaceSelector;
+    if( iVideoPlaybackWaitNote )
+        {
+        TRAP_IGNORE( iVideoPlaybackWaitNote->ProcessFinishedL() );
+        delete iVideoPlaybackWaitNote;
+        iVideoPlaybackWaitNote = NULL;
+        }
+    
+    if( iTimer )
+        {
+        iTimer->Cancel();
+        }
+    
+    delete iTimer;
+    
+    
+    delete iMinSecFormatString;
+    delete iHourMinSecFormatString;
+    delete iTimerNavi;
+
+    delete iNaviDecorator;
+
+    delete iOriginalTitleText;
+    TRAP_IGNORE( iRendSession.StopL() );
+    iRendSession.RemoveObserver();
+
+    __LOG( "CUPnPVideoPlayerDlg::~CUPnPVideoPlayerDlg End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::PreLayoutDynInitL()
+    {
+    __LOG( "CUPnPVideoPlayerDlg::PreLayoutDynInitL" );
+
+
+    // Browse dialog title text
+    TUid titlePaneUid;
+    titlePaneUid.iUid = EEikStatusPaneUidTitle;
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    CEikStatusPaneBase::TPaneCapabilities titlesubPane =
+                        statusPane->PaneCapabilities( titlePaneUid );
+
+    
+    if( titlesubPane.IsPresent() &&
+        titlesubPane.IsAppOwned() )
+        {
+        CAknTitlePane* titlePane =
+                (CAknTitlePane*) statusPane->ControlL( titlePaneUid );
+        // Take backup of title text
+        iOriginalTitleText->Des().Copy( *titlePane->Text() );
+
+        HBufC *tmpbuf = UpnpString::ToUnicodeL( iItem->Title() );
+        CleanupStack::PushL( tmpbuf );
+        titlePane->SetTextL( *tmpbuf );
+        CleanupStack::PopAndDestroy();
+        }
+    
+    
+    // Start to observe the rendering session
+    iRendSession.RemoveObserver();
+    iRendSession.SetObserver( *this );
+    
+    PreparePlayBackL();
+    
+    StartWaitNoteL();
+
+/*
+// Temporally commented out. Will be uncommented when UpnpAvController 
+// provides cancel functionaly fot SetUri action (Upnp Fw 2.5)
+    if( iExitCode == EEikBidCancel )
+        {
+        // Cancel the SetUri
+        //iRendSession.Cancel();
+        // Send Stop
+        TRAP_IGNORE( iRendSession.StopL() );
+        ClearTitleL();
+        iExitCode = KErrCancel;
+        }
+*/
+    User::LeaveIfError( iExitCode );
+
+    if ( !Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL(
+                                 R_AVKON_STATUS_PANE_LAYOUT_USUAL );
+        }
+    // Volume level to 0
+    iCurrentVolume = KMiniumVolume;
+    
+    // try to get volume level from renderer
+    TRAPD( err, iRendSession.GetVolumeL() );
+    if( !err )
+        {
+        iAdjustingVolume = ETrue;
+        }
+    
+    __LOG( "CUPnPVideoPlayerDlg::PreLayoutDynInitL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::OkToExitL(TInt aButtonId)
+// called by framework when the softkey is pressed
+// may leave without trap(System error)
+// --------------------------------------------------------------------------
+//
+TBool CUPnPVideoPlayerDlg::OkToExitL( TInt aButtonId )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::OkToExitL" );
+
+    TBool retval = EFalse;
+    TInt error = KErrNone;
+
+    switch ( aButtonId )
+        {
+        case KErrSessionClosed: //either MS or MR disappears
+        case KErrDisconnected: //fall through
+            {
+            // Connection failed so we have to close player
+            TRAP_IGNORE( ClearTitleL() );
+            return ETrue;
+            }
+        case EUPnPPauseCmd:
+            {
+            iAction = CUPnPCommonUI::EUPnPShow;
+            TRAP( error, iRendSession.PauseL() );
+            if ( KErrNone != error )
+                {
+
+                __LOG1( "CUPnPVideoPlayerDialog::OkToExitL:Pause %d",
+                         error );
+                }
+            break;
+            }
+        case EUPnPReplayCmd:
+            {
+            iAction = CUPnPCommonUI::EUPnPShow;
+
+            PreparePlayBackL();
+            iExitCode = KErrNone;
+            StartWaitNoteL();
+/*
+// Temporally commented out. Will be uncommented when UpnpAvController 
+// provides cancel functionaly fot SetUri action (Upnp Fw 2.5)
+
+            if( iExitCode == EEikBidCancel ||
+                iExitCode == KErrCancel )
+                {
+                // Cancel the SetUri
+                //iRendSession.Cancel();
+                // Send Stop
+                TRAP_IGNORE( iRendSession.StopL() );
+                }
+*/
+            if( iExitCode == KErrSessionClosed ||
+                iExitCode == KErrDisconnected )
+                {
+                TryExitL( iExitCode );
+                }
+            break;
+            }
+        case EUPnPContinueCmd:
+            {
+            iAction = CUPnPCommonUI::EUPnPShow;
+            TRAP( error, iRendSession.PlayL() );
+            if ( KErrNone != error )
+                {
+                __LOG1( "CUPnPVideoPlayerDialog::\
+                                            OkToExitL: Continue %d", error );
+                }
+            break;
+            }
+        case EUPnPBackCmd: //quit the video player dialog
+            {
+            TRAP_IGNORE( ClearTitleL() ); //avoid system error
+            return ETrue;            
+            }
+        case EUPnPStopCmd:
+            {
+            iAction = CUPnPCommonUI::EUPnPShow;
+            TRAP( error, iRendSession.StopL() );
+            if ( KErrNone != error )
+                {
+
+                __LOG1( "CUPnPVideoPlayerDialog::\
+                                    OkToExitL: Stop %d", error );
+                }
+            break;
+            }
+        case EAknSoftkeyOk:
+            {
+            break;
+            }
+        case EAknSoftkeyCancel: 
+        case EAknSoftkeyExit: 
+        case EAknCmdExit: // fall through
+        case EEikCmdExit:
+            {
+            TRAP_IGNORE( ClearTitleL() );
+            return ETrue; //back to previous dialog
+            }
+        default:
+            {
+            // ignore
+            break;
+            }
+        }
+    
+    __LOG( "CUPnPVideoPlayerDlg::OkToExitL End" );    
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::UpdateSoftkeysL
+// --------------------------------------------------------------------------
+void CUPnPVideoPlayerDlg::UpdateSoftkeysL( TInt aState )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::UpdateSoftkeysL" );
+
+    
+    if ( aState == EUPnPVideoPlay &&
+         iPauseCapability )
+        {
+        ButtonGroupContainer().SetCommandSetL( 
+                                    R_UPNPCOMMONUI_SOFTKEYS_PAUSE_STOP );
+        ButtonGroupContainer().DrawDeferred();
+        }
+    else if ( aState == EUPnPVideoPlay &&
+              !iPauseCapability )
+        {
+        ButtonGroupContainer().SetCommandSetL( 
+                                    R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP );
+        ButtonGroupContainer().DrawDeferred();
+        }
+    else if ( aState == EUPnPVideoPause )
+        {
+        ButtonGroupContainer().SetCommandSetL(
+                                    R_UPNPCOMMONUI_SOFTKEYS_CONTINUE_STOP );
+        ButtonGroupContainer().DrawDeferred();
+        }
+    else if ( aState == EUPnPVideoStop )
+        {
+        ButtonGroupContainer().SetCommandSetL( 
+                                    R_UPNPCOMMONUI_SOFTKEYS_REPLAY_BACK );
+        ButtonGroupContainer().DrawDeferred();
+        }
+    __LOG( "CUPnPVideoPlayerDlg::UpdateSoftkeysL End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::OfferKeyEventL
+// --------------------------------------------------------------------------
+//
+TKeyResponse CUPnPVideoPlayerDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                                  TEventCode aType )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::OfferKeyEventL" );
+    
+    TKeyResponse response = EKeyWasConsumed;
+    TInt error = KErrNone;
+    if ( aType == EEventKeyUp )
+        {
+        if ( aKeyEvent.iScanCode == EStdKeyLeftArrow )
+            {
+            // Adjust volume if the target rendering device supports the
+            // feature, and we are not waiting for a response for a previous
+            // set volume action.
+            
+            iVolumeUp = EFalse;
+            ChangeVolume( this );
+            }
+        else if ( aKeyEvent.iScanCode == EStdKeyRightArrow )
+            {
+            // Adjust volume if the target rendering device supports the
+            // feature, and we are not waiting for a response for a previous
+            // set volume action.
+            iVolumeUp = ETrue;    
+            ChangeVolume( this );
+            }
+
+        if( KErrNotReady == error ||
+            KErrDisconnected == error )
+            {
+            TryExitL( error );
+            }
+        }
+    else if( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
+        {
+        CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+        }
+    __LOG( "CUPnPVideoPlayerDlg::OfferKeyEventL End" ); 
+    return response;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::ShowVolumeIndicatorL
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::ShowVolumeIndicatorL()
+    {
+    __LOG( "CUPnPVideoPlayerDlg::ShowVolumeIndicatorL" );
+
+    if ( iCurrentVolume >= KMiniumVolume && iCurrentVolume <= KMaxVolume )
+        {
+        __LOG( " - display volume popup indicator" );
+        if ( iVolumePopup )
+            {
+            iVolumePopup->SetValue( iCurrentVolume );
+            iVolumePopup->ShowVolumePopupL(); // will close after 1s
+            }                
+        }
+    else
+        {
+        HideVolumeIdicator( this );
+        }
+    __LOG( "CUPnPVideoPlayerDlg::ShowVolumeIndicatorL End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::HideVolumeIdicator
+// --------------------------------------------------------------------------
+//
+TInt CUPnPVideoPlayerDlg::HideVolumeIdicator( TAny* aPtr )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::HideVolumeIdicator" );
+
+    CUPnPVideoPlayerDlg* self = 
+        static_cast<CUPnPVideoPlayerDlg*>( aPtr );
+
+    if ( self->iVolumePopup )
+        {
+        self->iVolumePopup->CloseVolumePopup();
+        }
+        
+    __LOG( "CUPnPVideoPlayerDlg::HideVolumeIdicator End" );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::TimerIndicatorL
+// --------------------------------------------------------------------------
+//
+TInt CUPnPVideoPlayerDlg::TimerIndicatorL( TAny* aPtr )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::TimerIndicatorL" );
+    CUPnPVideoPlayerDlg* self = 
+        static_cast<CUPnPVideoPlayerDlg*>(aPtr);
+    
+    if( self->iTotalLengthInSeconds > 0)
+        {
+        if( self->iPlaybackPosInSeconds >= self->iTotalLengthInSeconds )
+            {
+            self->iTimer->Cancel();
+            self->iRendererPlaying = EFalse;            
+            self->iPlaybackPosInSeconds = 0;
+            self->iTotalLengthInSeconds = 0;
+            return KErrNone;
+            }
+        }
+        
+    // Increase the count of timer expirations
+    self->iTimerRefresh++;
+    
+    // Increase the elapsed time by one (this timer elapses once a second).
+    if ( self->iRendererPlaying && !self->iPause )
+        {
+        self->iPlaybackPosInSeconds++;
+        }
+    
+    self->UpdateNaviPaneL();
+        
+    // Refresh the position after every KGetPosInfoPlaybackInterval
+    // secs from the beginning of play if necessary 
+    // (total length not set set at that moment) 
+    if( self->iTimerRefresh >= self->iGetPositionInfoInterval )
+        {
+        self->iTimerRefresh = 0;
+        TRAPD( err, self->iRendSession.GetPositionInfoL() );
+        if ( err )
+            {
+            __LOG1( "TimerIndicatorL GetPositionInfoL err: %d", err );
+            }
+        }   
+        
+    __LOG( "CUPnPVideoPlayerDlg::TimerIndicatorL End" );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::ClearTitleL
+// Sets title back to default.
+// --------------------------------------------------------------------------
+void CUPnPVideoPlayerDlg::ClearTitleL()
+    {
+    __LOG( "CUPnPVideoPlayerDlg::ClearTitleL" );
+
+    TUid titlePaneUid;
+    titlePaneUid.iUid = EEikStatusPaneUidTitle;
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    CEikStatusPaneBase::TPaneCapabilities titlesubPane =
+                        statusPane->PaneCapabilities( titlePaneUid );
+
+    CAknTitlePane* titlePane =
+        ( CAknTitlePane* ) statusPane->ControlL( titlePaneUid );
+    // Set original text
+    titlePane->SetTextL( *iOriginalTitleText );
+    iNaviPane->Pop();
+    __LOG( "CUPnPVideoPlayerDlg::ClearTitleL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerView::UpdateNaviPaneL()
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::UpdateNaviPaneL()
+    {
+    __LOG( "CUPnPVideoPlayerDlg::UpdateNaviPaneL" );
+    
+    TTime posTime = TTime( ( iPlaybackPosInSeconds )*KMPOneSecond );
+    TTime durTime = TTime( iTotalLengthInSeconds*KMPOneSecond );
+
+    TBuf<16> pos;
+    TBuf<16> dur;
+
+    if ( iTotalLengthInSeconds > 0 &&
+         iTotalLengthInSeconds < KOneHourInSeconds )
+       {
+       // Format time to user readable format. (min:sec)
+       posTime.FormatL( pos, *iMinSecFormatString );
+       durTime.FormatL( dur, *iMinSecFormatString );
+       }
+    else
+       {
+       // Format time to user readable format. (hour:min:sec)
+       posTime.FormatL( pos, *iHourMinSecFormatString );
+       durTime.FormatL( dur, *iHourMinSecFormatString );
+       }
+    if ( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) )
+        {
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( pos );
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( dur );
+        }
+    // if duration greated than 0, show postion in 00:00/00:00 format
+    if ( iTotalLengthInSeconds > 0 )
+        {
+        CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat(2);
+        CleanupStack::PushL( strings );
+        strings->AppendL( pos ); //First string (position)
+        strings->AppendL( dur ); //Second string (duration)
+        delete iTimerNavi; iTimerNavi = NULL;
+        iTimerNavi = StringLoader::LoadL( R_UPNPCOMMONUI_VIDEO_NAVI_TIME,
+                                          *strings,
+                                          iEikonEnv );
+
+        SetNaviLabelL( *iTimerNavi );
+
+        CleanupStack::PopAndDestroy( strings ); // strings & stringholder
+        }
+    else // show position in 00:00:00 format
+        {
+        SetNaviLabelL( pos );
+        }
+
+    __LOG( "CUPnPVideoPlayerDlg::UpdateNaviPaneL End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerView::SetNaviLabelL
+// Set navigation label from descriptor.
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+void CUPnPVideoPlayerDlg::SetNaviLabelL( const TDesC& aText )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::SetNaviLabelL" );
+    
+    TUid naviPaneUid;
+    naviPaneUid.iUid = EEikStatusPaneUidNavi;
+
+    // check if we can access the navi pane
+    if ( CheckStatusPaneCapabilities( naviPaneUid ) )
+        {
+        CAknNavigationControlContainer* naviPane = 
+            static_cast<CAknNavigationControlContainer*>
+                ( iEikonEnv->AppUiFactory()->StatusPane()->ControlL( 
+                                                            naviPaneUid ) );
+
+        if ( iNaviDecorator &&
+             ( iNaviDecorator->ControlType() ==
+                CAknNavigationDecorator::ENaviLabel ) )
+            {
+            // Set the navi text
+            CAknNaviLabel* naviLabel = static_cast<CAknNaviLabel*>
+                                ( iNaviDecorator->DecoratedControl() );
+            naviLabel->SetTextL( aText );
+            }
+        else
+            {
+            // create the navigation pane label
+            iNaviDecorator = naviPane->CreateNavigationLabelL( aText );
+            }
+        naviPane->PushL( *iNaviDecorator );
+        }
+        
+    __LOG( "CUPnPVideoPlayerDlg::SetNaviLabelL End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::CheckStatusPaneCapabilities
+// Check the status pane capabilities.
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+TBool CUPnPVideoPlayerDlg::CheckStatusPaneCapabilities(
+                                            const TPaneId& aPaneId )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::CheckStatusPaneCapabilities" );
+
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+
+    CEikStatusPaneBase::TPaneCapabilities subPane =
+                                statusPane->PaneCapabilities( aPaneId );
+    __LOG( "CUPnPVideoPlayerDlg::CheckStatusPaneCapabilities End" );
+    // check if we can access the status pane
+    return ( subPane.IsPresent() && 
+             subPane.IsAppOwned() );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::CreateCustomControlL() const
+// Draws the display
+// --------------------------------------------------------------------------
+//
+SEikControlInfo CUPnPVideoPlayerDlg::CreateCustomControlL( TInt aControlType )
+    {   
+    __LOG( "CUPnPVideoPlayerDlg::CreateCustomControlL" );
+
+    SEikControlInfo controlInfo;
+    controlInfo.iControl = NULL;
+    controlInfo.iTrailerTextId = 0;
+    controlInfo.iFlags = 0;
+    switch ( aControlType )
+        {
+        case ECustomCtrlDlgCtCustomControl:
+            {
+            iContainer = new (ELeave) CCustomCtrlDlgCustomControl();
+            controlInfo.iControl = iContainer;
+            ( (CCustomCtrlDlgCustomControl*)controlInfo.iControl )->
+                        SetRenderingSession( iRendSession );
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    __LOG( "CUPnPVideoPlayerDlg::CreateCustomControlL End" );    
+    return controlInfo;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::VolumeResult()
+// Video volume callback
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::VolumeResult( TInt aError, TInt aVolumeLevel,
+                                        TBool /*aActionResponse*/ )
+    {
+    __LOG2( "CUPnPVideoPlayerDlg::VolumeResult err=%d vol=%d",
+        aError, aVolumeLevel );
+
+    iAdjustingVolume = EFalse;
+    
+    if( aError == KErrNone )
+        {
+        iCurrentVolume = aVolumeLevel;
+        }
+    else 
+        {
+        // ignore error
+        }
+    TRAP_IGNORE( ShowVolumeIndicatorL() );
+    __LOG( "CUPnPVideoPlayerDlg::VolumeResult End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::InteractOperationComplete() const
+// Video operation callback
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::InteractOperationComplete(
+                                        TInt aError,
+                                        TUPnPAVInteractOperation aOperation )
+    {
+    
+    __LOG1( "CUPnPVideoPlayerDlg::InteractOperationComplete %d", aError );
+    TInt error = KErrNone;
+    TRAP( error, InteractOperationCompleteL( aError, aOperation ) )
+    __LOG( "CUPnPVideoPlayerDlg::InteractOperationComplete" );    
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::InteractOperationCompleteL() const
+// leave function to handle callback
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::InteractOperationCompleteL(
+                                        TInt aError,
+                                        TUPnPAVInteractOperation aOperation )
+    {
+    
+    __LOG1( "CUPnPVideoPlayerDlg::InteractOperationCompleteL %d", aError );
+    // Show error note if there was an error
+
+    if ( aError != KErrNone )
+        {
+        FinishWaitNoteL();
+        //stop timer
+        HideVolumeIdicator( this );
+        iTimer->Cancel();
+        iRendererPlaying = EFalse;        
+        UpdateSoftkeysL( EUPnPVideoStop );
+        iAction = CUPnPCommonUI::EUPnPShow;
+        HandleErrorL( aError );
+        return;
+        }
+    
+    if( iExitCode == EEikBidCancel ) //if video playing is cancelled
+        {
+        iRendSession.StopL();
+        iExitCode = KErrNone;
+        }
+    switch(aOperation)
+        {
+        case EUPnPAVPlay:
+            {
+            FinishWaitNoteL();
+            ContinueAfterPauseL();     
+            break;
+            }
+        case EUPnPAVPlayUser: // fall through
+            {
+            //display timer
+            StartDisplayTimer();
+            // Query the position info (track duration, position, etc.)
+            TRAP_IGNORE( iRendSession.GetPositionInfoL() );
+            ContinueAfterPauseL();
+            break;
+            }
+        case EUPnPAVPause: // fall through
+        case EUPnPAVPauseUser:
+            {
+            iPause = ETrue;
+            iRendererPlaying = EFalse;
+            iTimer->Cancel();
+            UpdateSoftkeysL( EUPnPVideoPause );
+            break;
+            }
+        case EUPnPAVStop: // fall through
+        case EUPnPAVStopUser:
+            {        
+            HideVolumeIdicator( this );
+            iTimer->Cancel();
+            iRendererPlaying = EFalse;            
+            iPlaybackPosInSeconds = 0;
+            iTotalLengthInSeconds = 0;
+            UpdateSoftkeysL( EUPnPVideoStop );    
+            }
+            break;
+        default:
+            {
+            // unknown operation
+            __PANICD( __FILE__, __LINE__ );
+            break;
+            }
+        }
+    __LOG( "CUPnPVideoPlayerDlg::InteractOperationCompleteL" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::InteractOperationComplete() const
+// Video operation callback
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::MuteResult( TInt aError, TBool aMute,
+                                      TBool /*aActionResponse*/ )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::MuteResult" );
+    __LOG3( "MuteResult - aError %d aMute %d iVolume %d ",
+        aError, aMute, iCurrentVolume );
+    
+    if( KErrNone == aError )
+        {
+        if( aMute )
+            {
+            iCurrentVolume = KMiniumVolume;
+            }
+        if ( iVolumePopup)
+            {               
+            iVolumePopup->SetValue( iCurrentVolume );
+            // will close after 1s
+            TRAP_IGNORE( iVolumePopup->ShowVolumePopupL() );
+            }
+        }
+    else
+        {
+        HideVolumeIdicator( this );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::PositionInfoResult
+// UPnP AV Controller calls this method as a response to Position 
+// Info action. The current position and the total length of the
+// track that is currently playing is returned. The results are in
+// (hh:mm:ss) format.
+// --------------------------------------------------------------------------
+void CUPnPVideoPlayerDlg::PositionInfoResult(  TInt aError,
+                                               const TDesC8& aTrackPosition,
+                                               const TDesC8& aTrackLength )
+    {
+    
+    __LOG1( "CUPnPVideoPlayerDlg::PositionInfoResult %d", aError );
+    if( KErrNone == aError )
+        {
+        if( aTrackPosition.Length() )
+            {
+            TLex8 lex( aTrackPosition );
+            TInt tmpint;
+            TChar ch;
+            if ( lex.Val( tmpint ) == KErrNone )
+                {
+                iPlaybackPosInSeconds = tmpint * 3600;
+                }
+               ch = lex.Get();
+            if ( lex.Val( tmpint ) == KErrNone )
+                {
+                iPlaybackPosInSeconds = iPlaybackPosInSeconds + tmpint * 60;
+                }
+            ch = lex.Get();
+            if ( lex.Val( tmpint ) == KErrNone )
+                {
+                iPlaybackPosInSeconds = iPlaybackPosInSeconds + tmpint;
+                }
+            }
+        if( aTrackLength.Length() )
+            {
+            iTotalLengthInSeconds = 0;
+            TLex8 lex1( aTrackLength );
+            TInt tmpint;
+            TChar ch;
+            if ( lex1.Val( tmpint ) == KErrNone )
+                {
+                iTotalLengthInSeconds = tmpint * 3600;
+                }
+            ch = lex1.Get();
+            if ( lex1.Val( tmpint ) == KErrNone )
+                {
+                iTotalLengthInSeconds = iTotalLengthInSeconds + tmpint * 60;
+                }
+            ch = lex1.Get();
+            if ( lex1.Val( tmpint ) == KErrNone )
+                {
+                iTotalLengthInSeconds = iTotalLengthInSeconds + tmpint;
+                
+                }
+            }
+        }// if( KErrNone == aError )
+    
+    if ( iPlaybackPosInSeconds > 0 )
+        {
+        // after knowing remote renderer has started to play at the first
+        // time, set GetPositonInfo frequency and update the elapsed time.
+        if ( iGetPositionInfoInterval != KGetPosInfoBeforePlaybackInterval )
+            {
+            iGetPositionInfoInterval = KGetPosInfoPlaybackInterval;
+            UpdateNaviPaneL();
+            }
+        if ( iPause )
+            {
+            iRendererPlaying = EFalse;
+            }
+        else
+            {
+            iRendererPlaying = ETrue;
+            }
+        }    
+    __LOG( "CUPnPVideoPlayerDlg::PositionInfoResult End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::SetURIResult
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::SetURIResult( TInt aError )
+    {
+    
+    TRAP_IGNORE( SetURIResultL( aError ) );
+    __LOG( "CUPnPVideoPlayerDlg::SetURIResult End" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::ContinueAfterPauseL
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::ContinueAfterPauseL()
+    {  
+    iPause = EFalse;
+    UpdateSoftkeysL( EUPnPVideoPlay );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::SetURIResultL
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::SetURIResultL( TInt aError )
+    {
+    __LOG1( "CUPnPVideoPlayerDlg::SetURIResult %d", aError );
+    
+    
+    if( iExitCode == EEikBidCancel )
+        {
+        __LOG( "CUPnPVideoPlayerDlg::SetURIResult Cancelled" );
+        return;
+        }    
+    
+    if( KErrNone != aError )
+        {
+        FinishWaitNoteL();
+        UpdateSoftkeysL( EUPnPVideoStop );
+        iAction = CUPnPCommonUI::EUPnPShow;
+        HandleErrorL( aError );
+        }
+    else
+        {
+        iGetPositionInfoInterval = KGetPosInfoBeforePlaybackInterval;
+        iRendSession.PlayL();
+        }
+    __LOG( "CUPnPVideoPlayerDlg::SetURIResult End" );
+    }
+
+//for media server or WLAN disappeared case
+void CUPnPVideoPlayerDlg::DismissItselfL( TInt aError )
+    {
+    HandleErrorL( aError );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::MediaRendererDisappeared
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::MediaRendererDisappeared( 
+                                TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG( "[UPnPCommonUI]\t CUPnPVideoPlayerDlg: \
+Source Device Dissapeared" );
+    // only for renderer disappearing
+    if( aReason == EDisconnected )
+        {
+        TRAP_IGNORE( HandleErrorL( KErrSessionClosed ) );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayerDlg::HandleResourceChange
+// Called by framework when resource change event detected
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::HandleResourceChange(TInt aType)
+    {
+    __LOG( "CUPnPVideoPlayerDlg::HandleResourceChange" );
+
+    CAknDialog::HandleResourceChange( aType );
+
+    if ( aType == KAknsMessageSkinChange )
+        {
+        iContainer->DrawDeferred();
+        }
+    else if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        if (!Layout_Meta_Data::IsLandscapeOrientation())
+            {
+            TRAP_IGNORE( iEikonEnv->AppUiFactory()->StatusPane()->
+                       SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ) );
+            }
+        SizeChanged();
+        iContainer->DrawDeferred();
+        }
+    else
+        {
+        // pass
+        }
+    __LOG( "CUPnPVideoPlayerDlg::HandleResourceChange End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayerDlg::SizeChanged
+// Called by framework after the dialog size has been changed
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::SizeChanged()
+    {
+    __LOG( "CUPnPVideoPlayerDlg::SizeChanged" );
+
+    if ( iContainer )
+        {
+        TRect clientRect = Rect();
+
+        iContainer->SetRect( clientRect );
+        iContainer->DrawDeferred();
+        }
+    CAknDialog::SizeChanged();
+    __LOG( "CUPnPVideoPlayerDlg::SizeChanged End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::ResolveTargetDeviceCapabilitiesL
+// Resolves the target UPnP device capabilites.
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::ResolveTargetDeviceCapabilitiesL()
+    {
+    __LOG( "CUPnPVideoPlayerDlg::ResolveTargetDeviceCapabilitiesL" );
+    if( iTargetDevice )
+        {
+        iPauseCapability = iTargetDevice->PauseCapability();
+        iVolumeCapability = iTargetDevice->VolumeCapability();
+        __LOG1( "iPauseCapability:: %d", iPauseCapability );
+        __LOG1( "iVolumeCapability:: %d", iVolumeCapability );
+        
+        }
+
+    __LOG( "CUPnPVideoPlayerDlg::ResolveTargetDeviceCapabilitiesL End" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::HandleErrorL
+// Resolves the target UPnP device capabilites.
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::HandleErrorL( TInt aError )
+    {
+    iCommonUI.GetUpnpAction( iAction );
+    if( KErrSessionClosed == aError ||
+        KErrDisconnected == aError )
+        {
+        iExitCode = aError;
+        TRAP_IGNORE( iRendSession.StopL() );
+        if( iVideoPlaybackWaitNote )
+            {
+            TRAP_IGNORE( iVideoPlaybackWaitNote->ProcessFinishedL() );
+            delete iVideoPlaybackWaitNote;
+            iVideoPlaybackWaitNote = NULL;
+            }
+            
+        // When wait note is display or playback is ongoing, if received 
+        // KErrDisconnected or KErrSessionClosed, then to exit the 
+        // VideoPlayerDlg.
+        TryExitL( iExitCode );    
+        }
+     else //common error codes
+        {
+        iCommonUI.HandleCommonErrorL( aError, NULL );
+        iAction = CUPnPCommonUI::EUPnPNone;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::StartWaitNoteL
+// --------------------------------------------------------------------------
+//
+TInt CUPnPVideoPlayerDlg::StartWaitNoteL()
+    {
+    
+    __LOG( "CUPnPVideoPlayerDlg::StartWaitNoteL" );
+    
+    TInt ret = KErrNone;
+    //start preparing playback
+    if( !iVideoPlaybackWaitNote )
+        {
+        iVideoPlaybackWaitNote = new(ELeave)CAknWaitDialog(
+                                ( REINTERPRET_CAST( CEikDialog**, 
+                                &iVideoPlaybackWaitNote ) ), ETrue );
+    
+        // Register to get the responses from the dialog 
+        iVideoPlaybackWaitNote->SetCallback( this );  
+        
+        ret = iVideoPlaybackWaitNote->ExecuteLD( 
+                    R_UPNPCOMMONUI_VIDEO_PLAYBACK_WAIT_NOTE_DIALOG );
+        }   
+    
+    __LOG1( "CUPnPVideoPlayerDlg::StartWaitNoteL %d", ret );
+    return ret;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::FinishWaitNoteL
+// Finish the video playback wait note
+// --------------------------------------------------------------------------
+// 
+void CUPnPVideoPlayerDlg::FinishWaitNoteL() 
+    {
+    if( iVideoPlaybackWaitNote )
+        {
+        iVideoPlaybackWaitNote->ProcessFinishedL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::DialogDismissedL
+// --------------------------------------------------------------------------
+// 
+void CUPnPVideoPlayerDlg::DialogDismissedL( TInt aButtonId ) 
+    {
+    if( aButtonId == EEikBidCancel )
+        {
+        iExitCode = EEikBidCancel;
+
+        __LOG( "CUPnPVideoPlayerDlg::DialogDismissedL -Cancelled" );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::PreparePlayBackL
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::PreparePlayBackL()
+    {
+    __LOG( "CUPnPVideoPlayerDlg::PreparePlayBackL" );
+    if( !iTargetDevice )
+        {
+        __LOG( "CUPnPVideoPlayerDlg::PreLayoutDynInitL: \
+                                                TargetDeviceL FAILED!" );
+        User::Leave( KErrNotReady );
+        }   
+    const CUpnpItem* item = static_cast<const CUpnpItem*>( iItem );
+    HBufC8* uri 
+            = UPnPItemUtility::ResourceFromItemL( *item ).Value().AllocLC();
+     // Set the URI
+    iRendSession.SetURIL( *uri, *item );
+    CleanupStack::PopAndDestroy ( uri ); 
+        
+    __LOG( "CUPnPVideoPlayerDlg::PreparePlayBackL - End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::StartDisplayTimer
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::StartDisplayTimer()
+    {
+    //display time on the navipane: 00:00/00:00(total length)
+    if ( !iTimer->IsActive() )
+        {
+        iTimer->Start(
+        0,
+        KMPOneSecond,
+        TCallBack( CUPnPVideoPlayerDlg::TimerIndicatorL,
+        this ) );
+        }  
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::DoChangeVolumeL
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::DoChangeVolumeL()
+    {
+    __LOG( "CUPnPVideoPlayerDlg::DoChangeVolumeL" );
+    
+    __LOG1( " iCurrentVolume = %d ", iCurrentVolume );
+    
+    if( iAdjustingVolume || !iVolumeCapability )
+        {
+        return;
+        }
+        
+    if( iVolumeUp )
+        {
+        iNewVolume = iCurrentVolume + KVolumeInterval;
+        if( iNewVolume > KMaxVolume )
+            {
+            iNewVolume = KMaxVolume;
+            }    
+        }
+    else
+        {
+        iNewVolume = iCurrentVolume - KVolumeInterval;
+        if( iNewVolume < KMiniumVolume )
+            {
+            iNewVolume = KMiniumVolume;
+            }
+        }
+    
+    iRendSession.SetVolumeL( iNewVolume );
+    
+    iAdjustingVolume = ETrue;
+    
+    __LOG( "CUPnPVideoPlayerDlg::DoChangeVolumeL - End" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::ChangeVolume
+// --------------------------------------------------------------------------
+//
+TInt CUPnPVideoPlayerDlg::ChangeVolume( TAny* aPtr )
+    {    
+    CUPnPVideoPlayerDlg* self = 
+    static_cast<CUPnPVideoPlayerDlg*>( aPtr );
+    
+    TRAPD( err, self->DoChangeVolumeL() );
+    
+    __LOG1( "CUPnPVideoPlayerDlg::DoChangeVolumeL %d", err );
+    
+    if( KErrNone == err )    
+        {
+        self->iCurrentVolume = self->iNewVolume;
+        }
+    else if( err == KErrSessionClosed || err == KErrDisconnected )
+        {
+        //either MS or MR disappears
+        TRAP_IGNORE( self->TryExitL( err ) );
+        }    
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPVideoPlayerDlg::MrccatoCommand
+// --------------------------------------------------------------------------
+//
+void CUPnPVideoPlayerDlg::MrccatoCommand(
+                        TRemConCoreApiOperationId aOperationId,
+                        TRemConCoreApiButtonAction aButtonAct )
+    {
+    __LOG( "CUPnPVideoPlayerDlg::MrccatoCommand" );    
+    __LOG2( "CUPnPVideoPlayerDlg::MrccatoCommand (0x%X,%d)", 
+        aOperationId, aButtonAct );
+   
+    switch ( aOperationId )
+        {
+        case ERemConCoreApiVolumeUp:
+            {
+            switch ( aButtonAct )
+                {
+                case ERemConCoreApiButtonPress:
+                    {
+                    iVolumeUp = ETrue;
+                    iVolumeKeyPressHold = ETrue;
+                    iVolumeTimer->Cancel();
+                    iVolumeTimer->Start( KMPOneSecond,
+                                 KMPOneSecond, 
+                                 TCallBack( ChangeVolume, this ) );
+                    break;
+                    }    
+                case ERemConCoreApiButtonRelease:
+                    {
+                    iVolumeKeyPressHold = EFalse;
+                    iVolumeTimer->Cancel();
+                    break;
+                    }
+                case ERemConCoreApiButtonClick:
+                    {
+                    iVolumeKeyPressHold = EFalse;
+                    iVolumeUp = ETrue;
+                    TRAP_IGNORE( DoChangeVolumeL() );
+                    break;
+                    }
+                default:
+                    break;
+                }
+            break;
+            }
+        case ERemConCoreApiVolumeDown:
+            {
+            switch ( aButtonAct )
+                {
+                case ERemConCoreApiButtonPress:
+                    {
+                    iVolumeKeyPressHold = ETrue;
+                    iVolumeUp = EFalse;
+                    iVolumeTimer->Cancel();
+                    iVolumeTimer->Start( KMPOneSecond,
+                                 KMPOneSecond, 
+                                 TCallBack( ChangeVolume, this ) );
+                    break;
+                    }    
+                case ERemConCoreApiButtonRelease:
+                    {                        
+                    iVolumeKeyPressHold = EFalse;
+                    iVolumeTimer->Cancel();
+                    break;
+                    }
+                case ERemConCoreApiButtonClick:
+                    {
+                    iVolumeKeyPressHold = EFalse;
+                    iVolumeUp = EFalse;
+                    TRAP_IGNORE( DoChangeVolumeL() );
+                    break;
+                    }
+                default:
+                    break;
+                }
+            break;
+            }
+        
+        // Only volume keys handled    
+        case ERemConCoreApiStop:
+        case ERemConCoreApiRewind:
+        case ERemConCoreApiFastForward:
+        case ERemConCoreApiPausePlayFunction:
+        case ERemConCoreApiPause:
+        default:
+            break;
+        }
+    __LOG( "CUPnPVideoPlayerDlg::MrccatoCommand - End" );
+    }
+
+// ===========================================================================
+// CCustomCtrlDlgCustomControl Implementation
+// ===========================================================================
+
+// --------------------------------------------------------------------------
+// CCustomCtrlDlgCustomControl::CCustomCtrlDlgCustomControl
+// --------------------------------------------------------------------------
+//
+CCustomCtrlDlgCustomControl::~CCustomCtrlDlgCustomControl()
+    {
+    __LOG( "CCustomCtrlDlgCustomControl::~CCustomCtrlDlgCustomControl" );
+    delete iImage;
+    iImage = NULL;
+    __LOG( "CCustomCtrlDlgCustomControl::~CCustomCtrlDlgCustomControl End" );
+    }
+
+// --------------------------------------------------------------------------
+// CCustomCtrlDlgCustomControl::Draw() const
+// Draws the display
+// --------------------------------------------------------------------------
+//
+void CCustomCtrlDlgCustomControl::Draw( const TRect& /*aRect*/ ) const
+    {
+    __LOG( "CCustomCtrlDlgCustomControl::Draw" );
+
+    TRect rect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
+    CWindowGc& gc=SystemGc();
+    gc.Clear( rect );
+    gc.SetClippingRect( rect );
+    gc.DrawRect( rect );
+    __LOG( "CCustomCtrlDlgCustomControl::Draw End" );
+    }
+
+// --------------------------------------------------------------------------
+// CCustomCtrlDlgCustomControl::SizeChanged() const
+// Set window size
+// --------------------------------------------------------------------------
+//
+void CCustomCtrlDlgCustomControl::SizeChanged()
+    {
+    __LOG( "CCustomCtrlDlgCustomControl::SizeChanged" );
+
+    TRect rect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
+    rect.iTl = TPoint( 0,0 );
+    iPosition = TPoint( rect.iTl );
+
+    iImage->SetPosition( iPosition );
+    iImage->SetSize( rect.Size() );
+
+    __LOG( "CCustomCtrlDlgCustomControl::SizeChanged End" );
+    }
+
+// --------------------------------------------------------------------------
+// CCustomCtrlDlgCustomControl::ConstructFromResourceL() 
+// Set window size
+// --------------------------------------------------------------------------
+//
+void CCustomCtrlDlgCustomControl::ConstructFromResourceL(
+                                           TResourceReader& /*aReader*/)
+    {
+    __LOG( "CCustomCtrlDlgCustomControl::ConstructFromResourceL" );
+
+    iImage = new(ELeave) CImage( *iRendSession );
+    iImage->SetContainerWindowL( *this );
+
+    TRect rect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
+    rect.iTl = TPoint( 0,0 );
+
+    SetRect( rect );
+    ActivateL();
+    __LOG( "CCustomCtrlDlgCustomControl::ConstructFromResourceL End" );
+    }
+
+// --------------------------------------------------------------------------
+// CCustomCtrlDlgCustomControl::CountComponentControls() const
+// Return number of components
+// --------------------------------------------------------------------------
+//
+TInt CCustomCtrlDlgCustomControl::CountComponentControls() const
+    {
+    return 1;
+    }
+
+// --------------------------------------------------------------------------
+// CCustomCtrlDlgCustomControl::ComponentControl() const
+// return control pointer
+// --------------------------------------------------------------------------
+//
+CCoeControl* CCustomCtrlDlgCustomControl::ComponentControl(
+    TInt aIndex ) const
+    {
+    if ( aIndex==0 )
+        {
+        return iImage;
+        }
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CCustomCtrlDlgCustomControl::SetRenderingSession()
+// --------------------------------------------------------------------------
+//
+void CCustomCtrlDlgCustomControl::SetRenderingSession(
+                                    MUPnPAVRenderingSession& aRendSession )
+    {
+    __LOG( "CCustomCtrlDlgCustomControl::SetRenderingSession" );
+    iRendSession = &aRendSession;
+    __LOG( "CCustomCtrlDlgCustomControl::SetRenderingSession End" );
+    }
+
+// ===========================================================================
+// CImage Implementation
+// ===========================================================================
+
+// --------------------------------------------------------------------------
+// CImage::CImage()
+// --------------------------------------------------------------------------
+//
+CImage::CImage( MUPnPAVRenderingSession& aRendSession):
+                                        iRendSession(aRendSession)
+    {
+    __LOG( "CImage::CImage" );
+
+    iBitmap = NULL;
+    iMask = NULL;
+
+    TFileName mbmFileName( KAknMultiViewsMbmFileName );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    mbmFileName.Insert( 0, drive );
+    
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TRAP_IGNORE( AknsUtils::CreateIconL(
+        skin,
+        KAknsIIDDefault,
+        iBitmap,
+        iMask,
+        mbmFileName,
+        EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer,
+        EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_mask ) );
+    __LOG( "CImage::CImage End" );
+    }
+
+// --------------------------------------------------------------------------
+// CImage::~CImage()
+// --------------------------------------------------------------------------
+//
+CImage::~CImage()
+    {
+    __LOG( "CImage::~CImage");
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iMask;
+    iMask = NULL;
+    __LOG( "CImage::~CImage End");
+    }
+
+// --------------------------------------------------------------------------
+// CImage::Draw()
+// Draw display
+// --------------------------------------------------------------------------
+//
+void CImage::Draw(const TRect& /*aRect*/) const
+    {
+    __LOG( "CImage::Draw" );
+
+    //change image size
+    TSize imageSize;
+    AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EMainPane, imageSize );
+    AknIconUtils::SetSize( iBitmap,imageSize );
+
+    TRAPD( error,DrawL( imageSize ) );
+    if ( error )
+        {
+        __LOG1( "CImage::DrawL %d", error );
+        }
+        
+    __LOG( "CImage::Draw End" );
+    }
+
+// --------------------------------------------------------------------------
+// CImage::DrawL()
+// Draw display
+// --------------------------------------------------------------------------
+//
+void CImage::DrawL( const TRect& aRect ) const
+    {
+    __LOG( "CImage::DrawL" );
+
+    CWindowGc& gc = SystemGc();
+    gc.Clear();
+    gc.DrawBitmap( aRect, iBitmap );
+
+    const CUpnpAVDevice* device = &( iRendSession.Device() );
+    
+    const CFont* normalFont = iEikonEnv->NormalFont();
+    TInt baseline = ( aRect.Height() / 12 + 
+                    ( normalFont->AscentInPixels() / 5 ) ); 
+    gc.UseFont( normalFont );
+    gc.SetPenColor( KRgbBlack );
+    gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+
+    // Get device friendly name and replace illegal characters.
+    HBufC8* tmpfriendlyname = 
+        UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+        ( ( CUpnpAVDevice* )device )->FriendlyName() );
+            
+    CleanupStack::PushL( tmpfriendlyname );
+    TPtrC8 friendlyname = *tmpfriendlyname;
+    
+    HBufC* tmpbuf = UpnpString::ToUnicodeL( friendlyname.Left( KLength ) );
+      
+    //Get max number of characters fits in the screen
+    TInt num = normalFont->TextCount( *tmpbuf, aRect.Width() );
+    //if the name has the length more than the screen can have
+    if( tmpbuf->Length() > num )
+        {
+        HBufC* tmpbuf2 = HBufC::NewL( num );
+        
+        tmpbuf2->Des().Copy( tmpbuf->Des().Left( num - KDotLength ) );
+        tmpbuf2->Des().Append( KDot );
+        gc.DrawText( *tmpbuf2, aRect, baseline, CGraphicsContext::ELeft );    
+        delete tmpbuf2;
+        }
+    else
+        {
+        gc.DrawText( *tmpbuf, aRect, baseline, CGraphicsContext::ECenter );    
+        }
+    
+    delete tmpbuf;
+    CleanupStack::PopAndDestroy( tmpfriendlyname );
+    
+    __LOG( "CImage::DrawL End" );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpextensionpluginif/bwins/upnpextensionpluginifu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	??1CUPnPPluginLoader@@UAE@XZ @ 1 NONAME ; CUPnPPluginLoader::~CUPnPPluginLoader(void)
+	?CreatePluginsL@CUPnPPluginLoader@@QAEABV?$RPointerArray@VCUPnPPluginInterface@@@@XZ @ 2 NONAME ; class RPointerArray<class CUPnPPluginInterface> const & CUPnPPluginLoader::CreatePluginsL(void)
+	?DeletePlugin@CUPnPPluginLoader@@QAEXH@Z @ 3 NONAME ; void CUPnPPluginLoader::DeletePlugin(int)
+	?NewL@CUPnPPluginLoader@@SAPAV1@AAVMUPnPPluginLoaderObserver@@@Z @ 4 NONAME ; class CUPnPPluginLoader * CUPnPPluginLoader::NewL(class MUPnPPluginLoaderObserver &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpextensionpluginif/eabi/upnpextensionpluginifu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,10 @@
+EXPORTS
+	_ZN17CUPnPPluginLoader12DeletePluginEi @ 1 NONAME
+	_ZN17CUPnPPluginLoader14CreatePluginsLEv @ 2 NONAME
+	_ZN17CUPnPPluginLoader4NewLER25MUPnPPluginLoaderObserver @ 3 NONAME
+	_ZN17CUPnPPluginLoaderD0Ev @ 4 NONAME
+	_ZN17CUPnPPluginLoaderD1Ev @ 5 NONAME
+	_ZN17CUPnPPluginLoaderD2Ev @ 6 NONAME
+	_ZThn4_N17CUPnPPluginLoaderD0Ev @ 7 NONAME ; #<thunk>#
+	_ZThn4_N17CUPnPPluginLoaderD1Ev @ 8 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpextensionpluginif/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project UPnP Extension plugin if
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/upnppluginloader.h           |../../../inc/upnppluginloader.h
+../inc/upnppluginloaderobserver.h   |../../../inc/upnppluginloaderobserver.h
+
+PRJ_MMPFILES
+upnpextensionpluginif.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpextensionpluginif/group/upnpextensionpluginif.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project UPnP Extension plugin if
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+#include "../../inc/upnpframeworkfeatures_mmp.hrh"
+
+TARGET          upnpextensionpluginif.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x20009C9E
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+SOURCEPATH      ../src
+SOURCE          upnppluginloader.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpextensionpluginif/inc/upnppluginloader.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  pluginloader which loads home network ECom plugins
+*
+*/
+
+
+#ifndef C_UPNPPLUGINLOADER_H
+#define C_UPNPPLUGINLOADER_H
+
+// INCLUDE FILES
+// System
+#include <e32cmn.h>
+#include <e32base.h>
+#include <gulicon.h>
+
+// upnpframework / home media extension api
+#include <upnpplugininterface.h>
+
+class MUPnPPluginLoaderObserver;
+
+/**
+ * Loads all the ECom plugins which implement the CUPnPPluginInterface
+ * interface
+ *
+ * @since S60 3.2
+ */
+NONSHARABLE_CLASS( CUPnPPluginLoader ) : public MUPnPPluginObserver,
+                                         public CBase
+    {
+    
+public: // 1st phase constructor
+
+    /**
+     * Returns a pointer to an instance of the CUPnPPluginLoader class
+     *
+     * @since S60 3.2
+     * @param aLoaderObserver reference to the MUPnPPluginLoaderObserver
+     * @return Pointer to an instance of the CUPnPPluginLoader class
+     */
+    IMPORT_C static CUPnPPluginLoader* NewL( MUPnPPluginLoaderObserver& 
+        aLoaderObserver );
+
+protected: // 2nd phase constructor
+
+    /**
+     * Default constructor
+     *
+     * @since S60 3.2
+     * @param aLoaderObserver reference to the MUPnPPluginLoaderObserver
+     */
+    CUPnPPluginLoader( MUPnPPluginLoaderObserver& aLoaderObserver );
+
+public: // Destructor
+
+    /**
+     * Destructor
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C virtual ~CUPnPPluginLoader();
+
+public:
+
+    /**
+     * This method creates all ECOM plugins which implement 0x200075DB
+     * interface (CUPnPPluginInterface).
+     *
+     * @since S60 3.2
+     * @return Reference to the plugin array. CUPnPMainDialog uses this
+     *         reference to draw the UI.
+     */
+    IMPORT_C const RPointerArray<CUPnPPluginInterface>& CreatePluginsL();
+
+    /**
+     * Deletes plugin from iPluginArray which index corresponds the
+     * parameter.
+     *
+     * @since S60 3.2
+     * @param aPluginIndex index of plugin to be deleted
+     */
+    IMPORT_C void DeletePlugin( TInt aPluginIndex );
+
+protected: // From MUPnPPluginObserver
+
+    /**
+     * Plugins call this method when they update.
+     *
+     * @since S60 3.2
+     * @param aEvent event from plugin
+     */
+    void ExtensionEvent( const TExtensionEvent& aEvent );
+
+private:
+
+    /**
+     * Pointer array which contains all the plugins
+     */
+    RPointerArray<CUPnPPluginInterface> iPluginArray;
+
+    /**
+     * Pointer to CUPnPPluginLoaderObserver
+     * Not own.
+     */
+    MUPnPPluginLoaderObserver* iLoaderObserver;
+    
+    };
+
+
+#endif // C_UPNPPLUGINLOADER_H
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpextensionpluginif/inc/upnppluginloaderobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  pluginloader observer
+*
+*/
+
+
+#ifndef C_UPNPPLUGINLOADEROBSERVER_H
+#define C_UPNPPLUGINLOADEROBSERVER_H
+
+
+/**
+ * Implemented by CUPnPMainDialog
+ *
+ * @since S60 3.2
+ */
+class MUPnPPluginLoaderObserver
+    {
+public:
+
+    /**
+     * Called by UPnPPluginLoader when plugin(s) has been updated
+     *
+     * @since S60 3.2
+     */
+    virtual void PluginsUpdated()=0;
+    
+    };
+
+#endif // C_UPNPPLUGINLOADEROBSERVER_H
+
+// end of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpextensionpluginif/src/upnppluginloader.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements CUPnPPluginLoader class
+*
+*/
+
+
+#include <ecom/ecom.h>
+#include <ecom/implementationinformation.h>
+
+// upnpframework / home media extension api
+#include <upnpplugininterface.h>
+
+// component internal
+#include "upnppluginloaderobserver.h"
+#include "upnppluginloader.h"
+
+// log facility
+_LIT( KComponentLogfile, "upnpextensionpluginif.txt");
+#include "upnplog.h"
+
+#ifdef __UPNP_CONSOLE_MT__
+static const TUid KTestPluginId = { 0x20009C9D };
+#endif // __UPNP_CONSOLE_MT__
+
+//---------------------------------------------------------------------------
+// CUPnPPluginLoader::NewL
+// Construction method.
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPPluginLoader* CUPnPPluginLoader::NewL(
+    MUPnPPluginLoaderObserver& aLoaderObserver)
+    {
+    __LOG("CUPnPPluginLoader::NewL");
+
+    CUPnPPluginLoader* self = 
+        new( ELeave ) CUPnPPluginLoader(aLoaderObserver);
+    return self;
+    }
+
+//---------------------------------------------------------------------------
+// CUPnPPluginLoader::CUPnPPluginLoader
+// Default constructor. Sets the iLoaderObserver
+//---------------------------------------------------------------------------
+CUPnPPluginLoader::CUPnPPluginLoader(MUPnPPluginLoaderObserver&
+                                                        aLoaderObserver)
+    {
+    __LOG( "CUPnPPluginLoader::CUPnPPluginLoader" );
+
+    iLoaderObserver = &aLoaderObserver;
+    }
+
+//---------------------------------------------------------------------------
+// CUPnPPluginLoader::~CUPnPPluginLoader
+// Destroys all the plugins
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPPluginLoader::~CUPnPPluginLoader()
+    {
+    __LOG( "CUPnPPluginLoader::~CUPnPPluginLoader" );
+
+    for (TInt i=0;i<iPluginArray.Count();i++) 
+        {
+        delete iPluginArray[i];
+        }
+
+    iPluginArray.Close();
+    REComSession::FinalClose();
+    }
+
+//---------------------------------------------------------------------------
+// CUPnPPluginLoader::CreatePluginsL
+// Creates all plugins which implement CUPnPPluginInterface
+//---------------------------------------------------------------------------
+EXPORT_C const RPointerArray<CUPnPPluginInterface>& 
+    CUPnPPluginLoader::CreatePluginsL()
+    {
+    __LOG( "CUPnPPluginLoader::CreatePluginsL" );
+
+    CImplementationInformation* implInfo = NULL;
+    RImplInfoPtrArray implArray;
+
+    REComSession::ListImplementationsL(interfaceUid,implArray);
+    for(TInt i=0;i<implArray.Count();i++)
+        {
+        implInfo = implArray[i];
+       
+        if( implInfo->VendorId() == VID_DEFAULT
+#ifdef __UPNP_CONSOLE_MT__
+            // In case of module testing load only our test plugin
+            && implInfo-> ImplementationUid().iUid == KTestPluginId.iUid
+#endif // __UPNP_CONSOLE_MT__
+        )
+            {
+           CUPnPPluginInterface* interface = NULL;           
+           interface = CUPnPPluginInterface::NewL
+                      ( implInfo->ImplementationUid(), *this );
+           
+           CleanupStack::PushL( interface );  
+           // interface ownership is transfered and 
+           // iPluginArray will handle the destroying of interface.
+           iPluginArray.AppendL( interface );           
+           CleanupStack::Pop( interface );
+            }
+        else
+            {
+            __LOG( "CUPnPPluginLoader::CreatePluginsL - \
+Invalid plugin vendor id" );
+            }
+        }
+    implArray.ResetAndDestroy();
+    implArray.Close();
+    return iPluginArray;
+    }
+
+//---------------------------------------------------------------------------
+// CUPnPPluginLoader::DeletePlugin
+// Deletes plugin from iPluginArray
+//---------------------------------------------------------------------------
+EXPORT_C void CUPnPPluginLoader::DeletePlugin( TInt aPluginIndex )
+    {
+    __LOG( "CUPnPPluginLoader::DeletePlugin" );
+    __ASSERTD( aPluginIndex >= 0, __FILE__, __LINE__ );
+    __ASSERTD( aPluginIndex < iPluginArray.Count(), __FILE__, __LINE__ );
+
+    if ( aPluginIndex < iPluginArray.Count() )
+        {
+        delete iPluginArray[aPluginIndex];
+        iPluginArray.Remove(aPluginIndex);
+        }
+    }
+
+//---------------------------------------------------------------------------
+// CUPnPPluginLoader::ExtensionEvent
+// From base class MUPnPPluginObserver
+// Handles the events which come from plugins
+//---------------------------------------------------------------------------
+void CUPnPPluginLoader::ExtensionEvent(const TExtensionEvent& aEvent) 
+    {
+    __LOG( "CUPnPPluginLoader::ExtensionEvent" );
+
+    switch ( aEvent )
+        {
+        case EExtensionEnabled:
+            {
+            // the extension is enabled by default - no need to call 
+            // explicitly
+            // NOT IMPLEMENTED
+            break;
+            }
+        case EExtensionDisabled:
+            {
+            // when called, disables the item in the list, cannot execute
+            // NOT IMPLEMENTED
+            break;
+            }
+        case EExtensionIconChanged:
+            {
+            // will call GetI1con again, and redraw
+            iLoaderObserver->PluginsUpdated();
+            break;
+            }
+        case EExtensionTitleChanged:
+            {
+            // will call GetTitle again, and redraw
+            iLoaderObserver->PluginsUpdated();
+            break;
+            }
+        case EExtensionSecondaryTextChanged:
+            {
+            // will call GetSubTitle again, and redraw
+            iLoaderObserver->PluginsUpdated();
+            break;
+            }
+        case EExtensionClosed:
+            {
+            // extension which was ExecuteL'd, has been closed.
+            // NOT IMPLEMENTED
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/bwins/upnpfiletransferengineu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,11 @@
+EXPORTS
+	?CopyLocalFilesToRemoteServerL@CUpnpFileTransferEngine@@QAEXPAV?$RPointerArray@VTDesC16@@@@@Z @ 1 NONAME ; void CUpnpFileTransferEngine::CopyLocalFilesToRemoteServerL(class RPointerArray<class TDesC16> *)
+	?CopyLocalPlaylistToRemoteServerL@CUpnpFileTransferEngine@@QAEXABVTDesC16@@PAV?$RPointerArray@VTDesC16@@@@@Z @ 2 NONAME ; void CUpnpFileTransferEngine::CopyLocalPlaylistToRemoteServerL(class TDesC16 const &, class RPointerArray<class TDesC16> *)
+	?CopyRemoteContainerToHandsetL@CUpnpFileTransferEngine@@QAEXPAVCUpnpContainer@@@Z @ 3 NONAME ; void CUpnpFileTransferEngine::CopyRemoteContainerToHandsetL(class CUpnpContainer *)
+	?CopyRemoteItemsToHandsetL@CUpnpFileTransferEngine@@QAEXAAV?$RPointerArray@VCUpnpItem@@@@@Z @ 4 NONAME ; void CUpnpFileTransferEngine::CopyRemoteItemsToHandsetL(class RPointerArray<class CUpnpItem> &)
+	?CopyRemotePlaylistToHandsetL@CUpnpFileTransferEngine@@QAEXPAVCUpnpContainer@@@Z @ 5 NONAME ; void CUpnpFileTransferEngine::CopyRemotePlaylistToHandsetL(class CUpnpContainer *)
+	?CopyToHandsetL@CUpnpFileTransferEngine@@QAEHPAVCDesC8ArrayFlat@@@Z @ 6 NONAME ; int CUpnpFileTransferEngine::CopyToHandsetL(class CDesC8ArrayFlat *)
+	?ItemCopiedFromContainer@CUpnpFileTransferEngine@@QAEHXZ @ 7 NONAME ; int CUpnpFileTransferEngine::ItemCopiedFromContainer(void)
+	?MoveLocalFilesToRemoteServerL@CUpnpFileTransferEngine@@QAEXPAV?$RPointerArray@VTDesC16@@@@@Z @ 8 NONAME ; void CUpnpFileTransferEngine::MoveLocalFilesToRemoteServerL(class RPointerArray<class TDesC16> *)
+	?NewL@CUpnpFileTransferEngine@@SAPAV1@PAVMUPnPAVBrowsingSession@@@Z @ 9 NONAME ; class CUpnpFileTransferEngine * CUpnpFileTransferEngine::NewL(class MUPnPAVBrowsingSession *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/data/upnpfiletransferengineresources.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project UpnpFileTransferEngine
+*
+*/
+
+
+// RESOURCE IDENTIFIER
+NAME UPTE
+
+// INCLUDES
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.loc>
+#include <avkon.mbg>
+#include <eikon.rh>
+#include <upnpframework.loc>
+
+#include "upnpfiletransferengine.rh"
+
+// RESOURCE DEFINITIONS
+
+RESOURCE RSS_SIGNATURE { }
+RESOURCE TBUF { buf=""; }
+
+// --------------------------------------------------------------------------
+// R_FT_COPY_PROGRESS_NOTE_DIALOG
+// A progress dialog, showed during copying and moving files.
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_ft_copy_progress_note_dialog
+    {
+    flags = EAknProgressNoteFlags | EEikDialogFlagWait;
+    buttons=R_AVKON_SOFTKEYS_CANCEL;
+    items=
+        {
+        DLG_LINE
+            {
+            type=EAknCtNote;
+            id=EUpnpFileTransferProgressNote;
+            control=AVKON_NOTE
+                {
+                layout         = EProgressLayout;
+                singular_label = qtn_gen_note_copying;
+                imageid        = EMbmAvkonQgn_note_progress;
+                imagemask      = EMbmAvkonQgn_note_progress_mask;
+                };
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+// R_FT_MOVE_PROGRESS_NOTE_DIALOG
+// A progress dialog, showed during copying and moving files.
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_ft_move_progress_note_dialog
+    {
+    flags = EAknProgressNoteFlags | EEikDialogFlagWait;
+    buttons=R_AVKON_SOFTKEYS_CANCEL;
+    items=
+        {
+        DLG_LINE
+            {
+            type=EAknCtNote;
+            id=EUpnpFileTransferProgressNote;
+            control=AVKON_NOTE
+                {
+                layout         = EProgressLayout;
+                singular_label = qtn_fldr_moving_wait_note;
+                imageid        = EMbmAvkonQgn_note_progress;
+                imagemask      = EMbmAvkonQgn_note_progress_mask;
+                };
+            }
+        };
+    }
+
+// --------------------------------------------------------------------------
+// R_FT_DRM_FILE_TEXT
+// "Skipping DRM protected files." - note
+// Used to indicate that DRM protected files will be skipped.
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_ft_drm_file_text
+    { 
+    buf = qtn_iupnp_drm_file_text;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/eabi/upnpfiletransferengineU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	_ZN23CUpnpFileTransferEngine14CopyToHandsetLEP15CDesC8ArrayFlat @ 1 NONAME
+	_ZN23CUpnpFileTransferEngine23ItemCopiedFromContainerEv @ 2 NONAME
+	_ZN23CUpnpFileTransferEngine25CopyRemoteItemsToHandsetLER13RPointerArrayI9CUpnpItemE @ 3 NONAME
+	_ZN23CUpnpFileTransferEngine28CopyRemotePlaylistToHandsetLEP14CUpnpContainer @ 4 NONAME
+	_ZN23CUpnpFileTransferEngine29CopyLocalFilesToRemoteServerLEP13RPointerArrayI7TDesC16E @ 5 NONAME
+	_ZN23CUpnpFileTransferEngine29CopyRemoteContainerToHandsetLEP14CUpnpContainer @ 6 NONAME
+	_ZN23CUpnpFileTransferEngine29MoveLocalFilesToRemoteServerLEP13RPointerArrayI7TDesC16E @ 7 NONAME
+	_ZN23CUpnpFileTransferEngine32CopyLocalPlaylistToRemoteServerLERK7TDesC16P13RPointerArrayIS0_E @ 8 NONAME
+	_ZN23CUpnpFileTransferEngine4NewLEP22MUPnPAVBrowsingSession @ 9 NONAME
+	_ZTI23CUpnpFileTransferEngine @ 10 NONAME ; #<TI>#
+	_ZTV23CUpnpFileTransferEngine @ 11 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project UpnpFileTransferEngine
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/upnpfiletransferengine.h           |../../../inc/upnpfiletransferengine.h
+
+PRJ_MMPFILES
+upnpfiletransferengine.mmp
+
+PRJ_TESTMMPFILES
+// None
+
+PRJ_TESTEXPORTS
+// None
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/group/upnpfiletransferengine.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project UpnpFileTransferEngine
+*
+*/
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh"
+#include "../inc/upnpfiletransferengineuids.hrh"
+
+#include <data_caging_paths.hrh>
+
+// Build target
+TARGET          upnpfiletransferengine.dll
+CAPABILITY      CAP_GENERAL_DLL
+TARGETTYPE      DLL
+UID             0x10009D8D KUpnpFileTransferEngineDllUid
+VENDORID        VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+SOURCEPATH      ../data
+START RESOURCE  upnpfiletransferengineresources.rss
+HEADER
+TARGET          upnpfiletransferengineresources.rsc
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../data
+USERINCLUDE     ../../upnputilities/inc
+USERINCLUDE     ../../upnpcommand/inc
+USERINCLUDE     ../../upnpaiwengine/inc
+
+MW_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+SOURCEPATH      ../src
+SOURCE          upnpplaylisthandler.cpp
+SOURCE          upnpfiletransferhandler.cpp
+SOURCE          upnpfiletransferengine.cpp
+SOURCE          upnpnotehandler.cpp
+SOURCE          upnpdownloadhandler.cpp
+SOURCE          upnpuploadhandler.cpp
+
+// Core platform + Ui
+LIBRARY         euser.lib
+LIBRARY         bafl.lib
+LIBRARY         cone.lib
+LIBRARY         efsrv.lib 
+LIBRARY         PlatformEnv.lib
+LIBRARY         avkon.lib
+LIBRARY         eikctl.lib
+LIBRARY         CommonEngine.lib 
+
+// S60 Upnp Stack
+LIBRARY         upnpipserversutils.lib
+LIBRARY         upnpavobjects.lib
+
+// Upnp Framework
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         upnpavcontrollerhelper.lib
+LIBRARY         upnputilities.lib
+LIBRARY         upnpmusicadapter.lib
+LIBRARY         upnpsettingsengine.lib 
+LIBRARY         upnpxmlparser.lib
+
+// Debugging
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/inc/upnpdownloadhandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,356 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpDownloadHandler class
+*
+*/
+
+
+#ifndef UPNP_DOWNLOAD_HANDLER_H
+#define UPNP_DOWNLOAD_HANDLER_H
+
+// INCLUDES
+// upnpframework / avcotnroller api
+#include "upnpavbrowsingsessionobserver.h"
+#include "upnpavsessionobserverbase.h"
+#include "upnpfiletransfersessionobserver.h"
+
+// filetransferengine internal
+#include "upnpprogressdialogobserver.h"
+
+
+// FORWARD DECLARATIONS
+class CUpnpObject;
+class MUPnPAVBrowsingSession;
+class MUPnPFileDownloadSession;
+class MUPnPAVController;
+class CUpnpNoteHandler;
+class CUpnpPlaylistHandler;
+// CLASS DECLARATION
+
+/**
+* CUpnpDownloadHandler
+* The class encapsulates all the file download functionality of
+* UpnpFileTransferEngine.
+*
+* @since S60 3.2
+*/
+NONSHARABLE_CLASS( CUpnpDownloadHandler ) :
+                             public CBase,
+                             public MUPnPFileTransferSessionObserver,
+                             public MUPnPAVBrowsingSessionObserver,
+                             public MUPnPProgressDialogobserver
+    {
+    
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aBrowsingSession (MUPnPAVBrowsingSession*) pointer to the
+         *        browsing session
+         */
+         static CUpnpDownloadHandler* NewL(
+                            MUPnPAVBrowsingSession* aBrowsingSession );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpDownloadHandler();
+
+    public: // Business logic methods
+
+        /**
+         * Downloads the given objects to the handset, into the default 
+         * target folder (setting in the Home Media application).
+         *
+         * Leaves using e32err.h error codes if the operation fails.
+         *
+         * @since S60 3.2
+         * @param aObjectIds (CDesC8ArrayFlat*) list of object IDs to copy
+         */
+        void DownloadItemsL( CDesC8ArrayFlat* aObjectIds );
+        
+        /**
+         * Return the number of copied files
+         *
+         *
+         * @since S60 3.2
+         * 
+         */
+        TInt GetNumCopiedFiles() const;
+    public: // Call back methods of MUPnPFileTransferSessionObserver
+
+        /**
+         * Notifies that the transfer has been started
+         *
+         * @since Series 60 3.2
+         * @param aKey identifies the transfer
+         * @param aStatus status (error) code
+         * @return none
+         */
+        void TransferStarted( TInt aKey,
+                              TInt aStatus );
+    
+        /**
+         * Notifies that the transfer has been completed
+         *
+         * @since Series 60 3.2
+         * @param aKey identifies the transfer
+         * @param aStatus status (error) code
+         * @param aFilePath 
+         */ 
+        void TransferCompleted( TInt aKey,
+                                TInt aStatus,
+                                const TDesC& aFilePath );
+        
+         /**
+         * Notifies transfer progress
+         *
+         * @since Series 60 3.2
+         * @param aKey identifies the transfer
+         * @param aBytes amount of bytes downloaded
+         * @param aTotalBytes total amount of bytes
+         */
+        void TransferProgress( TInt aKey,
+                               TInt aBytes,
+                               TInt aTotalBytes );
+                               
+        /**
+         * Notifies that the Media Server we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since S60 3.2
+         * @param aReason reason code
+         */
+        void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );                       
+
+    public: // Call back methods of MUPnPAVBrowsingSessionObserver
+
+        /**
+         * Returns a browse result received from a Media Server.
+         *         
+         * @since Series 60 3.2
+         * @param aBrowseResponse browse response xml document
+         * @param aError system wide error code
+         * @param aMatches number of returned items
+         * @param aTotalCount total number of objects on container
+         * @param aUpdateId update id number
+         * @return None
+         */
+        void BrowseResponse(
+                        const TDesC8& aBrowseResponse,
+                        TInt aError,
+                        TInt aMatches,
+                        TInt aTotalCount,
+                        const TDesC8& aUpdateId
+                        );
+
+        // Unused methods
+        void SearchResponse( const TDesC8& /*aSearchResponse*/,
+                             TInt /*aError*/,
+                             TInt /*aMatches*/,
+                             TInt /*aTotalCount*/,
+                             const TDesC8& /*aUpdateId*/ ) {}
+
+        // Unused methods                             
+        void SearchCapabilitiesResponse(
+                             TInt /*aError*/,
+                             const TDesC8& /*aSearchCapabilities*/ ) {}
+        
+        // Unused methods
+        void CreateContainerResponse(
+                            TInt /*aError*/,
+                            const TDesC8& /*aObjectId*/ ) {}
+        
+        // Unused methods
+        void DeleteObjectResponse( TInt /*aError*/ ) {}
+
+        
+
+    public: // From MUPnPAVSessionObserverBase
+
+        void ReserveLocalMSServicesCompleted( TInt /*aError*/ ) {}
+        
+    public: // Call back methods of MUPnPProgressDialogobserver
+
+        /**
+         * ProgressDialog call back method.
+         * Get's called when a dialog is dismissed.
+         *
+         * @since S60 3.2
+         * @param aButtonId (TInt) ID of the button pressed
+         */
+        void DialogDismissedL();
+
+    private: // Construction methods
+
+        /**
+         * Constructor
+         *
+         * @since 3.2
+         */
+        CUpnpDownloadHandler();
+
+        /**
+         * ConstructL.
+         *
+         * @since 3.2
+         * @param aController (MUPnPAVBrowsingSession*) pointer to a valid
+         *        UpnpAvController BrowsingsSession
+         */
+        void ConstructL( MUPnPAVBrowsingSession* aBrowsingSession );
+
+    private:
+
+        /**
+         * Starts the next download. Leaves (KErrCompletion) if there are
+         * no more objects to download.
+         *
+         * @since 3.2
+         */
+        void StartDownloadL();
+        
+        /**
+         * Starts the next download. 
+         *
+         * @since 3.2
+         */
+        void StartDownload();
+        
+        /**
+         * Returns a browse result received from a Media Server.
+         *         
+         * @since Series 60 3.2
+         * @param aBrowseResponse browse response xml document
+         * @param aTotalCount total number of objects on container
+         * @return None
+         */
+        void BrowseResponseL( const TDesC8& aBrowseResponse,
+                              TInt  aTotalCount );
+        
+        /**
+         * Notify MPX when the download is complete
+         * @since Series 60 3.2
+         * @param (CUpnpItem&) aObject downloaded item
+         * @param (TDesC&) aFilePath downloaded item file path
+         */
+        void NotifyMPXL( const CUpnpItem& aObject, 
+                         const TDesC& aFilePath );
+    private: // Data members
+
+        /*
+         * Browsing session handle. Not owned.
+         */
+        MUPnPAVBrowsingSession*         iBrowsingSession;
+
+        /*
+         * Backup of the client's browsing session handle. Not owned.
+         */
+        MUPnPAVBrowsingSessionObserver* iBrowsingSessionObserverBackup;
+
+        /*
+         * File download session handle.
+         */
+        MUPnPFileDownloadSession*       iDownloadSession;
+
+        /*
+         * UpnpAvControllerClient. Owned.
+         */
+        MUPnPAVController*              iAvController;
+
+        /*
+         * Pointer to the UpnpNoteHandler. Owned.
+         */
+        CUpnpNoteHandler*               iNoteHandler;
+
+        /*
+         * Holds the status code of the transfer operation.
+         */
+        TInt iStatusCode;
+
+        /*
+         * Holds the position information.
+         */
+        TInt iCopyPosition;
+
+        /*
+         * Holds the copy completeness per cent value.
+         */
+        TInt iCopyCompleteness;
+
+        /*
+         * Pointer to the list of objects to download. Not owned.
+         */
+        CDesC8ArrayFlat*                iObjectsToCopy;
+        
+        /*
+         * Position of items to be browsed.
+         */
+        TInt                            iBrowsePosition;
+        
+        /*
+         * Is it container or items download.
+         */
+        TBool                           iContainerCopy;
+        
+        /*
+         * Is it normal container or playlist download
+         */
+        TBool                           iPlayList;
+        
+        /*
+         * Is it the first browse when start downloading
+         */
+        TBool                           iFirstBrowse;
+        
+        /*
+         * Pointer to the container id. owned.
+         */
+        HBufC8*                         iContainerId; //owned
+        
+        /*
+         * Total number of items to be downloaded
+         */
+        TInt                            iTotalCount;
+        
+        /*
+         * Number of items has be downloaded
+         */
+        TInt                            iDownloadedCount;
+        
+        /**
+         * We need to store the items after the browse response
+         * to perform mutiple downloads simultaneously.
+         */
+        RPointerArray<CUpnpObject>      iCopyItems; //owned
+        
+        /*
+         * Playlist handler. owned
+         */
+        CUpnpPlaylistHandler*           iPlaylistHandler; 
+        
+        /*
+         * Is there any item in copying container case
+         */
+        TBool                           IsAnyItem;
+        
+        /*
+         * Flag to set the progress bar maximum value
+         */
+        TBool                           iProgressBarMaxValueSet;
+        
+    };
+
+#endif // UPNP_DOWNLOAD_HANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/inc/upnpfiletransferengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpFileTransferEngine class
+*
+*/
+
+
+#ifndef UPNP_FILE_TRANSFER_ENGINE_H
+#define UPNP_FILE_TRANSFER_ENGINE_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpContainer;
+class CUpnpItem;
+class MUPnPAVBrowsingSession;
+class MUPnPAVController;
+class CUpnpFileTransferHandler;
+class CDesC8ArrayFlat;
+class CUpnpUploadHandler;
+
+// CLASS DECLARATION
+
+/**
+* CUpnpFileTransferEngine
+* The class works as an interface component, providing file transfer features
+* for the clients.
+*
+* @since S60 3.0
+*/
+class CUpnpFileTransferEngine : public CBase
+    {
+
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         *
+         * Leaves (KErrArgument) if the provided UpnpAvBrowsingSession
+         * pointer is not valid.
+         *
+         * @since S60 3.0
+         * @param aBrowsingSession (MUPnPAVBrowsingSession*) pointer to the
+         *        browsing session
+         */
+         IMPORT_C static CUpnpFileTransferEngine* NewL(
+                            MUPnPAVBrowsingSession* aBrowsingSession );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpFileTransferEngine();
+
+    public: // New methods for transfering content to handset
+
+        /**
+         * Copies items (whose object ids are provided) from a remote Upnp
+         * Media Server to the handset. The files are stored in the location
+         * defined in the settings of the Home Media application.
+         *
+         * Leaves using e32err.h error codes if operation fails.
+         *
+         * @since S60 3.2
+         * @param aObjectIds (CDesC8ArrayFlat*) list of object IDs to copy
+         * @return TInt a number of copied files
+         */
+        IMPORT_C TInt CopyToHandsetL( CDesC8ArrayFlat* aObjectIds );
+
+    public: // Transfer content from handset to remote UPnP Media Server
+
+       /**
+         * Copies local files to a remote media server. DLNA Any Container
+         * feature will be used. Removes files from the array which are 
+         * succesfully moved.
+         *
+         * Leaves (KErrArgument) if the provided array of items is empty.
+         *
+         * @since S60 3.2
+         * @param aFileNames (RPointerArray*) pointer to the array of 
+         *        file names (including path) of the files to copy
+         */
+        IMPORT_C void CopyLocalFilesToRemoteServerL(
+                                RPointerArray<TDesC16>* aFilePaths );
+
+        /**
+         * Moves local files to a remote media server. DLNA Any Container
+         * feature will be used. Removes files from the array which are 
+         * succesfully moved.
+         *
+         * Leaves (KErrArgument) if the provided array of files is empty.
+         *
+         * @since S60 3.0
+         * @param aFileNames (RPointerArray*) pointer to the array of 
+         *        file names (including path) of the files to move
+         */
+        IMPORT_C void MoveLocalFilesToRemoteServerL(
+                                RPointerArray<TDesC16>* aFilePaths );
+
+        /**
+         * Copies a playlist from the local handset to a remote Upnp Media
+         * Server.
+         *
+         * Leaves (KErrArgument) if the provided playlist name is not valid
+         * or the provided array of items is empty.
+         *
+         * @since S60 3.1
+         * @param aPlaylistName (const TDesC&) the name of the playlist
+         * @param aFileNames (RPointerArray&) reference to the array of 
+         *        file names (including path) of the files to copy
+         */
+        IMPORT_C void CopyLocalPlaylistToRemoteServerL(
+                                const TDesC& aPlaylistName,
+                                RPointerArray<TDesC16>* aFilePaths );
+
+    public: // Transfer content from remote UPnP Media Server to handset
+
+        /**
+         * Copies items from a remote Upnp Media Server to the handset to
+         * the location defined in the Home Media application).
+         *
+         * Leaves (KErrArgument) if the provided array of items is empty.
+         *
+         * @since S60 3.0
+         * @param aItems (RPointerArray&) reference to the array of 
+         *        CUpnpItems, the items to copy
+         */
+        IMPORT_C void CopyRemoteItemsToHandsetL(
+                                RPointerArray<CUpnpItem>& aItems );
+
+        /**
+         * Copies a container from a remote Upnp Media Server to the location
+         * defined in the Home Media application).
+         * 
+         * Leaves (KErrArgument) if the provided UpnpContainer is not valid.
+         *
+         * @since S60 3.0
+         * @param aSourceContainer (CUpnpContainer*) pointer to the source 
+         *        UpnpContainer object
+         */
+        IMPORT_C void CopyRemoteContainerToHandsetL(
+                                CUpnpContainer* aSourceContainer );
+
+        /**
+         * Copies a playlist from a remote Upnp Media Server to the location
+         * defined in the Home Media application).
+         *
+         * Leaves (KErrArgument) if the provided UpnpContainer is not valid.
+         *
+         * @since S60 3.0
+         * @param aSourceContainer (CUpnpContainer*) pointer to the source 
+         *        UpnpContainer object
+         */
+        IMPORT_C void CopyRemotePlaylistToHandsetL(
+                                CUpnpContainer* aSourceContainer );
+    public:
+
+        /**
+         * Return the number of items copied from a container
+         *
+         * @since S60 3.1
+         * @param none
+         * @return TInt number of items copied
+         */
+        IMPORT_C TInt ItemCopiedFromContainer();
+    
+    private: // Construction methods
+
+        // Constructor
+        CUpnpFileTransferEngine();
+
+        /**
+         * ConstructL.
+         * @param aController (MUPnPAVBrowsingSession*) pointer to a valid
+         *        UpnpAvController BrowsingsSession
+         */
+        void ConstructL( MUPnPAVBrowsingSession* aBrowsingSession );
+
+    private: // Data members
+
+        /*
+         * Pointer to the file transfer handler. Owned.
+         */
+        CUpnpFileTransferHandler* iFileTransferHandler;
+
+        /*
+         * Pointer to the browsing session which the client provides. Not
+         * owned.
+         */
+        MUPnPAVBrowsingSession* iBrowsingSession;
+        CUpnpUploadHandler* iUploadHandler; //owned
+    };
+
+#endif // UPNP_FILE_TRANSFER_ENGINE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/inc/upnpfiletransferengine.rh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project UpnpFileTransferEngine
+*
+*/
+
+
+#ifndef UPNP_FILE_TRANSFER_ENGINE_RH
+#define UPNP_FILE_TRANSFER_ENGINE_RH
+
+enum TUpnpFileTransferEngineResources
+    {
+    EUpnpFileTransferProgressNote = 1,
+    EUpnpFileTransferWaitingNote
+    };
+
+#endif // UPNP_FILE_TRANSFER_ENGINE_RH
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/inc/upnpfiletransferengineuids.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project UpnpFileTransferEngine
+*
+*/
+
+
+#ifndef UPNP_FILE_TRANSFER_ENGINE_UIDS_HRH
+#define UPNP_FILE_TRANSFER_ENGINE_UIDS_HRH
+
+#define KUpnpFileTransferEngineDllUid              0x10208A50
+
+#endif // UPNP_FILE_TRANSFER_ENGINE_UIDS_HRH
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/inc/upnpfiletransferhandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,371 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpFileTransferHandler class
+*
+*/
+
+
+#ifndef UPNP_FILE_TRANSFER_HANDLER_H
+#define UPNP_FILE_TRANSFER_HANDLER_H
+
+// INCLUDES
+// System
+#include <AknProgressDialog.h>
+
+// upnpavcotnroller api
+#include "upnpavbrowsingsessionobserver.h"
+#include "upnpfiletransfersessionobserver.h"
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"                    // TUPnPItemType
+
+// filetransferengine internal
+#include "upnpplaylisthandler.h"
+
+// CONSTANTS
+enum TUpnpFileTransferMode
+    {
+    EUpnpIdleTransferMode = 0,
+    EUpnpCopyRemoteItemsToDefaultLocation,
+    EUpnpCopyRemoteContainerToDefaultLocation,
+    EUpnpCopyRemotePlaylistToDefaultLocation
+    };
+
+enum TUpnpAlbumType
+    {
+    EUpnpFileCopyImageAlbum = 0,
+    EUpnpFileCopyVideoAlbum
+    };
+
+// FORWARD DECLARATIONS
+class CEikonEnv;
+class MUPnPFileDownloadSession;
+
+// CLASS DECLARATION
+
+/**
+* CUpnpFileTransferHandler
+* The class works as an engine component, providing file transfer features
+* of the UpnpFileTransferEngine component.
+*
+* @since S60 3.1
+*/
+NONSHARABLE_CLASS( CUpnpFileTransferHandler ) :
+                                 public CBase,
+                                 public MUPnPAVBrowsingSessionObserver,
+                                 public MUPnPFileTransferSessionObserver,
+                                 public MProgressDialogCallback
+    {
+
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aBrowsingSession (MUPnPAVBrowsingSession*) pointer to the
+         *        browsing session
+         */
+         static CUpnpFileTransferHandler* NewL(
+                            MUPnPAVBrowsingSession* aBrowsingSession );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpFileTransferHandler();
+
+    public: // Business logic methods
+
+        /**
+         * Transfers items from a remote Upnp Media Server to the handset.
+         * Removes files from the array which are succesfully transferred.
+         *
+         * @since S60 3.1
+         * @param aTransferMode (TUpnpFileTransferMode) the transfer mode
+         * @param aItems (RPointerArray<CUpnpItem>&) reference to the array
+         *       of CUpnpItems, the items to copy
+         */
+        void TransferRemoteItemsToHandsetL(
+                            TUpnpFileTransferMode aTransferMode,
+                            RPointerArray<CUpnpItem>& aItems );
+
+        /**
+         * Transfers a container/playlist from a remote Upnp Media Server to
+         * the handset.
+         *
+         * @since S60 3.1
+         * @param aTransferMode (TUpnpFileTransferMode) the transfer mode
+         * @param aContainer (CUpnpContainer*) pointer to the source Upnp
+         *        Container object
+         */
+        void TransferRemoteContainerToHandsetL(
+                            TUpnpFileTransferMode aTransferMode,
+                            CUpnpContainer* aSourceContainer );
+
+        /**
+         * Return the number of items copied from a container
+         *
+         * @since S60 3.1
+         * @param none
+         * @return TInt number of items copied
+         */
+        TInt ItemCopiedFromContainer();
+
+    public: // Call back methods of MAknProgressDialogCallback
+
+        /**
+         * ProgressDialog call back method.
+         * Get's called when a dialog is dismissed.
+         *
+         * @since S60 3.1
+         * @param aButtonId (TInt) ID of the button pressed
+         */
+        void DialogDismissedL( TInt aButtonId );
+
+    public: // Call back methods of MUPnPAVBrowsingSessionObserver
+
+        /**
+         * Returns a browse result received from a Media Server.
+         *         
+         * @since Series 60 3.1
+         * @param aBrowseResponse browse response xml document
+         * @param aError system wide error code
+         * @param aMatches number of returned items
+         * @param aTotalCount total number of objects on container
+         * @param aUpdateId update id number
+         * @return None
+         */
+        void BrowseResponse(
+                        const TDesC8& aBrowseResponse,
+                        TInt aError,
+                        TInt aMatches,
+                        TInt aTotalCount,
+                        const TDesC8& aUpdateId
+                        );
+
+        /**
+         * Returns a search result received from a Media Server.
+         *
+         * @param aSearchResponse search response xml document
+         * @param aError system wide error code
+         * @param aMatches number of returned items
+         * @param aTotalCount total number of resulted items
+         * @param aUpdateId update id number
+         * @return None
+         */
+        void SearchResponse( 
+                        const TDesC8& /*aSearchResponse*/,
+                        TInt /*aError*/,
+                        TInt /*aMatches*/,
+                        TInt /*aTotalCount*/,
+                        const TDesC8& /*aUpdateId*/
+                        ){}
+
+        /**
+         * Returns search capabilities of the requested Media Server.
+         *
+         * @since S60 3.1
+         * @param aError Status information
+         * @param aSearchCapabilities Reference to the search capabilities
+         *        string in HBufC8 format.
+         */
+        void SearchCapabilitiesResponse( TInt /*aError*/,
+                                         const TDesC8& /*aSearchCapabilities*/ )
+                                         {}
+        
+
+        
+        /**
+         * Notifies that the create container operation is complete.
+         *
+         * @since S60 3.1
+         * @param aError Status information
+         * @param aObjectId (const TDesC8&) object ID of the new container
+         */
+        void CreateContainerResponse( TInt /*aError*/,
+                                      const TDesC8& /*aObjectId = KNullDesC8*/ )
+                                      {}
+
+        /**
+         * Notifies that the requested Upnp Object deletion is complete.
+         *
+         * @since S60 3.1
+         * @param aError Status information
+         */
+        void DeleteObjectResponse( TInt /*aError*/ ){}
+
+        /**
+         * Notifies that the Media Server we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since S60 3.1
+         * @param aReason reason code
+         */
+        void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );
+
+         /**
+         * Notifies that the Media Server startup has completed. 
+         *
+         * @since S60 3.1
+         * @return aError (TInt), error code
+         */
+        void ReserveLocalMSServicesCompleted( TInt aError );
+
+    public: // Call back methods of MUPnPFileTransferSessionObserver
+        
+        /**
+         * Notifies that the transfer has been started
+         *
+         * @since S60 3.1
+         * @param aKey identifies the transfer
+         * @param aStatus status (error) code
+         */ 
+        void TransferStarted( TInt aKey,
+                              TInt aStatus );
+        /**
+         * Notifies that the transfer has been completed
+         *
+         * @since S60 3.1
+         * @param aKey identifies the transfer
+         * @param aStatus status (error) code
+         * @param aFilePath 
+         */  
+        void TransferCompleted( TInt aKey,
+                                TInt aStatus,
+                                const TDesC& aFilePath );
+    
+        /**
+         * Notifies transfer progress
+         * NOTE: Transfer progress is not guaranteed
+         *
+         * @since S60 3.1
+         * @param aKey identifies the transfer
+         * @param aBytes amount of bytes downloaded
+         * @param aTotalBytes total amount of bytes
+         */ 
+        void TransferProgress( TInt aKey,
+                               TInt aBytes,
+                               TInt aTotalBytes );
+
+    private: // private business methods
+
+        /**
+         * Handles the copy complete callback when copying files
+         *
+         * @since S60 3.1
+         * @param aError (TInt) Status information
+         * @param aFilepath (const TDesC&) filepath for a downloaded file
+         */
+        void CopyCompleteFilesL( TInt aError, 
+                                 const TDesC& aFilepath );
+
+        /**
+         * Handles the copy complete callback when copying containers
+         *
+         * @since S60 3.1
+         * @param aError (TInt) Status information
+         * @param aFilepath (const TDesC&) filepath for a downloaded file
+         */
+        void CopyCompleteContainersL( TInt aError, 
+                                      const TDesC& aFilepath );
+
+        /**
+         * Initialises and runs the progress note.
+         *
+         * @since S60 5.1
+         * @param aCount A Count used for initialized increment values of dialog.
+         *        Zero creates dialog as uninitialized.
+         */
+        void RunCopyNoteL( TInt aCount = 0 );
+        
+        /**
+         * Finishes the progress and wait note if they are running.
+         *
+         * @since S60 3.1
+         */
+        void FinishNotes();
+
+        /**
+         * Resolves the media type of the given file.
+         *
+         * @since S60 3.1
+         * @param aFilepath (const TDesC&) filename
+         * @return TUPnpItemType the type of the item
+         */
+        TUPnPItemType ResolveFileType( const TDesC& aFilepath );
+
+    private: // Construction methods (private)
+
+        // Constructor
+        CUpnpFileTransferHandler();
+
+        /**
+         * ConstructL.
+         * @param aController (MUPnPAVBrowsingSession*) pointer to a valid
+         *        UpnpAvController BrowsingsSession
+         */
+        void ConstructL( MUPnPAVBrowsingSession* aBrowsingSession );
+
+    private: // Data members
+
+        // CoeEnv and the resource offset (needed when loading and
+        // unloading resources)
+        CEikonEnv* iCoeEnv;                             // not owned
+        TInt iResFileOffset;
+
+        // Browsing session handles (not owned)
+        MUPnPAVBrowsingSession* iBrowsingSession;
+        MUPnPAVBrowsingSessionObserver *iBrowsingSessionObserverBackup;
+
+        // Progess note dialog and progress info
+        CAknProgressDialog* iProgressNoteDialog;        // owned
+        CEikProgressInfo* iProgressInfo;                // not owned
+        TInt iCurrentProgressValue;
+        TInt iProgressIncrement;
+
+        TUpnpFileTransferMode iFileTransferMode;
+        TInt iCopyPosition;
+
+        // Status code to store the operation status information
+        TInt iStatusCode;
+
+        //used to copy from remote to local
+        RPointerArray<CUpnpItem>* iCopyItems;           // owned
+        CUpnpItem* iCopyItem;                           // owned
+
+        // Container copy
+        TBool iContainerCopyFirstBrowse;
+        TInt iContainerCopyBrowseIndex;
+        TInt iContainerCopyBrowseTotalCount;
+        CUpnpContainer* iCopyFromContainer;             // not owned
+
+        // Playlist handler
+        CUpnpPlaylistHandler* iPlaylistHandler;         // owned
+
+        //number of items copied from a container
+        TInt iNumCopiedItemFromContainer;
+
+        /*
+         * UpnpAvControllerClient. Owned.
+         */
+        MUPnPAVController*              iAvController;
+        
+        /*
+         * File download session handle.
+         */
+        MUPnPFileDownloadSession*       iDownloadSession;
+        
+    };
+
+#endif // UPNP_FILE_TRANSFER_HANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/inc/upnpnotehandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpNoteHandler class
+*
+*/
+
+
+#ifndef UPNP_FILE_TRANSFER_NOTE_HANDLER_H
+#define UPNP_FILE_TRANSFER_NOTE_HANDLER_H
+
+// INCLUDES
+#include <AknProgressDialog.h>
+
+// FORWARD DECLARATIONS
+class CAknProgressDialog;
+class CEikProgressInfo;
+class MUPnPProgressDialogobserver;
+class CEikonEnv;
+
+// ENUMS
+enum TUpnpProgressNoteType
+    {
+    EUpnpCopyProgressNote = 0,
+    EUpnpMoveProgressNote
+    };
+
+// CLASS DECLARATION
+
+/**
+* CUpnpNoteHandler
+* The class provides means for the UpnpFileTransferEngine component to show
+* the state of the file transfer process.
+*
+* @since S60 3.2
+*/
+NONSHARABLE_CLASS( CUpnpNoteHandler ) : public CBase,
+                                        public MProgressDialogCallback
+    {
+
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         */
+         static CUpnpNoteHandler* NewL( 
+                                MUPnPProgressDialogobserver* aObserver );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpNoteHandler();
+
+    public: // Call back methods of MAknProgressDialogCallback
+
+        /**
+         * ProgressDialog call back method.
+         * Get's called when a dialog is dismissed.
+         *
+         * @since S60 3.1
+         * @param aButtonId (TInt) ID of the button pressed
+         */
+        void DialogDismissedL( TInt aButtonId );
+
+    public: // private business methods
+
+        /**
+         * Initialises and runs the progress note.
+         *
+         * @since S60 3.2
+         * @param aNoteType (TUpnpProgressNoteType) type of the note
+         */
+        void RunProgressNoteL( TUpnpProgressNoteType aNoteType );
+
+        /**
+         * Sets the value of the progress note.
+         *
+         * @since S60 3.2
+         * @param aProgressValue (TInt) percentage value for the note
+         */
+        void SetValue( TInt aProgressValue );
+
+        /**
+         * Finishes the progress note.
+         *
+         * @since S60 3.2
+         */
+        void FinishProgressNote();
+        
+        void SetMaxValue( TInt aMaxValue );
+        
+        /**
+         * Skipping DRM protected files - note
+         *
+         * @since S60 3.2.3
+         */        
+        void ShowSkippingDRMFilesNoteL();
+        
+
+    private: // Construction methods (private)
+
+        // Constructor
+        CUpnpNoteHandler( MUPnPProgressDialogobserver* aObserver );
+
+        /**
+         * ConstructL.
+         */
+        void ConstructL();
+
+    private: // Data members
+
+        // CoeEnv and the resource offset (needed when loading and
+        // unloading resources)
+        TInt iResFileOffset;
+
+        // Progess note dialog and progress info
+        CAknProgressDialog* iProgressNoteDialog;        // owned
+        CEikProgressInfo* iProgressInfo;                // not owned
+        TInt iCurrentProgressValue;
+        MUPnPProgressDialogobserver*                iProgressDialogObserver;
+        
+        TInt                                        iMaxProgressValue;
+        CEikonEnv* iCoeEnv;                             // not owned
+        
+        /**
+         * Flag progress if is finished. 
+         */
+        TBool                           iProgressNoteFinish;
+
+    };
+
+#endif // UPNP_FILE_TRANSFER_NOTE_HANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/inc/upnpplaylisthandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpPlaylistHandler class
+*
+*/
+
+
+#ifndef UPNP_FILE_TRANSFER_ENGINE_PLAYLIST_HANDLER_H
+#define UPNP_FILE_TRANSFER_ENGINE_PLAYLIST_HANDLER_H
+
+//  INCLUDES
+#include <badesca.h>
+
+// FORWARD DECLARATION
+class CUpnpObject;
+class CUpnpItem;
+class CUPnPPlaylistServices;
+
+// DATA TYPES
+enum TUpnpPlaylistLocation
+    {
+    EPhoneMemory = 0,
+    EMemorycard,
+    EHarddisk,
+    EUnknown
+    };
+
+// CLASS DECLARATION
+
+/**
+* CUpnpPlaylistHandler
+* The class stores the playlist information, and generates MPX playlists and
+* Gallery albums when requested.
+*
+* @since S60 3.1
+*/
+NONSHARABLE_CLASS( CUpnpPlaylistHandler ) : public CBase
+    {
+
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         */
+        static CUpnpPlaylistHandler* NewL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpPlaylistHandler();
+
+    public: // Methods for managing the content
+
+        /**
+         * Resets the playlists content.
+         *
+         * @since S60 3.1
+         */
+        void Reset();
+
+        /**
+         * Sets the name for the playlist
+         *
+         * @since S60 3.1
+         * @param aPlaylistName (const TDesC&) name for the playlist and
+         *        image and video albums (same name will for all tree).
+         */
+        void SetPlaylistNameL( const TDesC& aPlaylistName );
+
+        /**
+         * Adds a audio item to the playlist (playlist will not be generated
+         * yet, it has to be created by calling a separate method).
+         *
+         * @since S60 3.1
+         * @param aFilePath (const TDesC&) filepath of the audio file
+         */
+        void AddAudioItemL( const TDesC& aFilePath );
+
+        /**
+         * Adds an image item to the playlist (playlist will not be generated
+         * yet, it has to be created by calling a separate method).
+         *
+         * @since S60 3.1
+         * @param aFilePath (const TDesC&) filepath of the image file
+         */
+        void AddImageItemL( const TDesC& aFilePath );
+
+        /**
+         * Adds a video item to the playlist (playlist will not be generated
+         * yet, it has to be created by calling a separate method).
+         *
+         * @since S60 3.1
+         * @param aFilePath (const TDesC&) filepath of the video file
+         */
+        void AddVideoItemL( const TDesC& aFilePath );
+
+    public: // Methods for getting the state of the playlist
+    
+        /**
+         * Returns the number of items in the audio item array
+         *
+         * @since S60 3.1
+         * @return (TInt) the item count
+         */
+        TInt AudioItemCount();
+        
+        /**
+         * Returns the number of items in the image item array
+         *
+         * @since S60 3.1
+         * @return (TInt) the item count
+         */
+        TInt ImageItemCount();
+
+        /**
+         * Returns the number of items in the video item array
+         *
+         * @since S60 3.1
+         * @return (TInt) the item count
+         */
+        TInt VideoItemCount();
+
+    public: // Methods for creating the playlists
+
+        /**
+         * Creates a MPX playlist (if there are music items added).
+         *
+         * @since S60 3.1
+         */
+        void CreateMusicPlaylistL();
+
+        /**
+         * Creates an image album (if there are image items added).
+         *
+         * @since S60 3.1
+         */
+        void CreateImageAlbumL();
+
+        /**
+         * Creates a video album (if there are video items added).
+         *
+         * @since S60 3.1
+         */
+        void CreateVideoAlbumL();
+
+    public: // Methods for notifying MPX
+
+        /**
+         * Notifies MPX of a new audio file.
+         *
+         * @since S60 3.1
+         * @param aTrackPath (const TDesC&) filepath of the audio file
+         * @param aMetadata (CUpnpItemt&) metadata as it was in media server
+         */
+        void NotifyNewAudioFileL( const TDesC& aFilePath,
+                                  const CUpnpItem& aMetadata );
+
+    private: // private business logic methods
+
+        /**
+         * Checks that Playlist location is valid
+         *
+         * @since S60 3.1
+         * @return TBool
+         */
+        TBool PlaylistFileLocation();
+
+    private: // 2nd phase constructors
+
+        // Constructor
+        CUpnpPlaylistHandler();
+
+        /**
+         * ConstructL.
+         */
+        void ConstructL();
+
+    private: // Data members
+
+        HBufC* iPlaylistName;                           // owned
+        CDesCArrayFlat* iFilesForAudioPlaylist;         // owned
+        RPointerArray<HBufC> iFilesForVideoAlbum;       // owned
+        RPointerArray<HBufC> iFilesForImageAlbum;       // owned
+
+        // music playlist methods encapsulation
+        CUPnPPlaylistServices* iPlaylistServices;       // owned
+    };
+
+#endif // UPNP_FILE_TRANSFER_ENGINE_PLAYLIST_HANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/inc/upnpprogressdialogobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Callback definitions for copy progress
+*
+*/
+
+
+#ifndef M_UPNPPROGRESSDIALOGOBSERVER
+#define M_UPNPPROGRESSDIALOGOBSERVER
+
+// INCLUDES
+
+// FORWARD DECLARATIONS
+
+/**
+* Defines the response interface for the progress dialog the
+* UPnPFileTransferEngine.
+*
+* @since Series 60 3.2
+*/
+class MUPnPProgressDialogobserver
+    {
+
+    public:
+
+        /**
+         * Notifies the progress dialog is canceled
+         *
+         * @since Series 60 3.2
+         * @param aError reason of exit
+         * @return None
+         */
+        virtual void DialogDismissedL() = 0;
+
+    };
+
+#endif // MUPnPProgressDialogobserver
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/inc/upnpuploadhandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Header file for the CUpnpUploadHandler class
+*
+*/
+
+
+#ifndef UPNP_UPLOAD_HANDLER_H
+#define UPNP_UPLOAD_HANDLER_H
+
+// INCLUDES
+#include "upnpfiletransfersessionobserver.h"
+#include "upnpprogressdialogobserver.h"
+
+// FORWARD DECLARATIONS
+
+class MUPnPAVBrowsingSession;
+class MUPnPFileUploadSession;
+class MUPnPAVController;
+class CUpnpNoteHandler;
+class CEikonEnv;
+
+//class CUpnpPlaylistHandler;
+// CLASS DECLARATION
+
+// CONSTANTS
+enum TUpnpFileUploadMode
+    {
+    EUpnpCopy = 0,
+    EUpnpMove
+    };
+    
+/**
+* CUpnpUploadHandler
+* The class encapsulates all the file download functionality of
+* UpnpFileTransferEngine.
+*
+* @since S60 3.2
+*/
+NONSHARABLE_CLASS( CUpnpUploadHandler ) :
+                             private CAsyncOneShot,
+                             private MUPnPFileTransferSessionObserver,
+                             public MUPnPProgressDialogobserver
+                             
+                             
+                             
+    {
+
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aBrowsingSession (MUPnPAVBrowsingSession*) pointer to the
+         *        browsing session
+         */
+         static CUpnpUploadHandler* NewL(
+                            MUPnPAVBrowsingSession* aBrowsingSession );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUpnpUploadHandler();
+
+    public: // Business logic methods
+
+        /**
+         * Upload the given objects to the remote mediaserver, 
+         *
+         * Leaves using e32err.h error codes if the operation fails.
+         *
+         * @since S60 3.2
+         * @param aObjectIds (RPointerArray<TDesC16>*) list of object 
+         *        paths to copy
+         * @return none
+         */
+        void UploadItemsL( RPointerArray<TDesC16>* aObjectPaths, 
+                           TUpnpFileUploadMode aFileUploadMode );
+        
+        /**
+         * Upload the given playlist to the remote mediaserver, 
+         *
+         * Leaves using e32err.h error codes if the operation fails.
+         *
+         * @since S60 3.2
+         * @param aObjectIds (RPointerArray<TDesC16>&) list of object 
+         *        paths to copy
+         * @return none
+         */
+        void UploadPlayListL( const TDesC& aPlaylistName,
+                              RPointerArray<TDesC16>* aObjectPaths,
+                              TUpnpFileUploadMode aFileUploadMode );
+                              
+    private: // Call back methods of MUPnPFileTransferSessionObserver
+    
+        /**
+         * Notifies that the transfer has been started
+         *
+         * @since Series 60 3.2
+         * @param aKey identifies the transfer
+         * @param aStatus status (error) code
+         * @return none
+         */
+        void TransferStarted( TInt aKey,
+                              TInt aStatus );
+        
+        /**
+         * Notifies that the transfer has been completed
+         *
+         * @since Series 60 3.2
+         * @param aKey identifies the transfer
+         * @param aStatus status (error) code
+         * @param aFilePath 
+         * @return none
+         */ 
+        void TransferCompleted( TInt aKey,
+                                TInt aStatus,
+                                const TDesC& aFilePath );
+        
+        /**
+         * Notifies transfer progress
+         *
+         * @since Series 60 3.2
+         * @param aKey identifies the transfer
+         * @param aBytes amount of bytes downloaded
+         * @param aTotalBytes total amount of bytes
+         * @return none
+         */
+        void TransferProgress( TInt aKey,
+                               TInt aBytes,
+                               TInt aTotalBytes );
+        
+        /**
+         * Notifies that the Media Server we have a session with has
+         * disappeared. Session is now unusable and must be closed. 
+         *
+         * @since S60 3.2
+         * @param aReason reason code
+         * @return none
+         */
+        void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );                       
+
+    public: // Call back methods of MUPnPProgressDialogobserver
+
+        /**
+         * ProgressDialog call back method.
+         * Get's called when a dialog is dismissed.
+         *
+         * @since S60 3.2
+         * @param aButtonId (TInt) ID of the button pressed
+         * @return none
+         */
+        void DialogDismissedL();
+    
+    private: // from CAsyncOneShot
+        
+        /**
+         * Asynchronous execution
+         */
+        void RunL();
+
+        /**
+         * Execution of the error branch
+         */
+        TInt RunError( TInt aError );
+        
+    private: // Construction methods
+
+        /**
+         * Constructor
+         *
+         * @since 3.2
+         */
+        CUpnpUploadHandler();
+
+        /**
+         * ConstructL.
+         *
+         * @since 3.2
+         * @param aController (MUPnPAVBrowsingSession*) pointer to a valid
+         *        UpnpAvController BrowsingsSession
+         * @return none
+         */
+        void ConstructL( MUPnPAVBrowsingSession* aBrowsingSession );
+
+    private:
+
+        /**
+         * Starts the next download. Leaves (KErrCompletion) if there are
+         * no more objects to download.
+         *
+         * @since 3.2
+         * @param none
+         * @return none
+         */
+        void StartUploadL();
+        
+        
+    private: // Data members
+
+        
+        /*
+         * Browsing session handle. Not owned.
+         */
+        MUPnPAVBrowsingSession*         iBrowsingSession;
+
+        /*
+         * File upload session handle.
+         */
+        MUPnPFileUploadSession*         iUploadSession;
+
+        /*
+         * UpnpAvControllerClient. Owned.
+         */
+        MUPnPAVController*              iAvController;
+
+        /*
+         * Pointer to the UpnpNoteHandler. Owned.
+         */
+        CUpnpNoteHandler*               iNoteHandler;
+
+        /*
+         * Holds the status code of the transfer operation.
+         */
+        TInt iStatusCode;
+
+        /*
+         * Holds the position information.
+         */
+        TInt iCopyPosition;
+        
+        /*
+         * Indicate whether copy was cancelled after successfully copied 
+         * the file but TransferComplete not yet called.
+         */
+        TBool iCopiedFileStillInArray;
+        
+        /*
+         * Holds the copy completeness per cent value.
+         */
+        TInt iCopyCompleteness;
+
+        /*
+         * Pointer to the list of objects to download. owned.
+         */
+        RPointerArray<TDesC16>*          iObjectsToCopy;
+        
+        /**
+         * The number of items has been uploaded
+         */
+        TInt                            iUploadItems;
+        
+        /*
+         * Flag to set the progress bar maximum value
+         */
+        TBool                           iProgressBarMaxValueSet;
+        
+        /*
+         * Total number of items to be uploaded
+         */
+        TInt                            iTotalCount;
+        
+        TUpnpFileUploadMode             iUploadMode;
+        
+        CEikonEnv*                      iCoeEnv;   // not owned
+        
+        TBool                           iUploadFirst;
+        
+        //number of items should be uploaded in a group, if the total number
+        // is bigger than 20, iUploadIndex = 20 
+        TInt                            iUploadIndex; 
+        
+        /*
+         * Information if drm note is already shown.
+         */
+        TBool                           iDrmFilesSkipped;
+        
+        //CUpnpPlaylistHandler* iPlaylistHandler;
+        
+        
+    };
+
+#endif // UPNP_DOWNLOAD_HANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/src/upnpdownloadhandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,713 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the CUpnpDownloadHandler class
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <bautils.h>                            // BaflUtils
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+// upnp stack api
+#include <upnpitem.h>                           // CUpnpItem
+#include <upnpcontainer.h>                      // CUpnpContainer
+#include <upnpstring.h>                         // UpnpString
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h"                   // MUPnPAVController
+#include "upnpavcontrollerfactory.h"            // UPnPAVControllerFactory
+#include "upnpavbrowsingsession.h"              // MUPnPAVBrowsingSession
+#include "upnpfiledownloadsession.h"            // MUPnPFileDownloadSession
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h"                   // upnp definitions
+
+// upnpframework / xml parser api
+#include "upnpxmlparser.h"                      // CUPnPXMLParser
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"                    // TUPnPItemType
+
+// filetransferengine internal
+#include "upnpdownloadhandler.h"
+#include "upnpnotehandler.h"
+#include "upnpplaylisthandler.h"                // CUpnpPlaylistHandler
+
+_LIT( KComponentLogfile, "filetransferengine.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KBrowseRequestCount =        1;
+const TInt KZero =                      0;
+const TInt KProgressBaseValue =         100;
+
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::NewL
+// NewL.
+// --------------------------------------------------------------------------
+//
+CUpnpDownloadHandler* CUpnpDownloadHandler::NewL(
+                            MUPnPAVBrowsingSession* aBrowsingSession )
+    {
+    __LOG( "[UpnpDownloadHandler] CUpnpDownloadHandler: NewL" );
+
+    // Check that the browsing session is valid and has target device set.
+    if( !aBrowsingSession )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CUpnpDownloadHandler* self = NULL;
+    self = new (ELeave) CUpnpDownloadHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL( aBrowsingSession );
+    CleanupStack::Pop( self );
+    __LOG( "[UpnpDownloadHandler] CUpnpDownloadHandler: NewL end" );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Constuctor
+// --------------------------------------------------------------------------
+//
+CUpnpDownloadHandler::CUpnpDownloadHandler()
+    {
+    __LOG( "[UpnpDownloadHandler] Constructor" );
+    iContainerCopy = EFalse;
+    iBrowsePosition = -1;
+    iFirstBrowse = ETrue;
+
+    iDownloadedCount = KZero;
+    __LOG( "[UpnpDownloadHandler] Constructor -end" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpDownloadHandler::~CUpnpDownloadHandler()
+    {
+    __LOG( "[UpnpDownloadHandler] Destructor" );
+
+    // If download session is running, stop it
+    if( iAvController &&
+        iDownloadSession )
+        {
+        iAvController->StopDownloadSession( *iDownloadSession );
+        }
+
+    // Delete the note handler.
+    delete iNoteHandler;
+
+    // delete the UpnpAvControllerClient
+    delete iAvController;
+    
+    // delete the container id
+    delete iContainerId;
+    
+    delete iPlaylistHandler;
+    iCopyItems.ResetAndDestroy();
+    iCopyItems.Close();
+    //iCopyItem.ResetAndDestroy();
+    // Restore the browse session observer
+    if( iBrowsingSession &&
+        iBrowsingSessionObserverBackup )
+        {
+        iBrowsingSession->RemoveObserver();
+        iBrowsingSession->SetObserver( *iBrowsingSessionObserverBackup );
+        }
+    __LOG( "[UpnpDownloadHandler] Destructor -end" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::ConstructL(
+                                MUPnPAVBrowsingSession* aBrowsingSession )
+    {
+    __LOG( "[UpnpDownloadHandler] ConstructL" );
+
+    if( !aBrowsingSession )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Store the browsing session
+    iBrowsingSession = aBrowsingSession;
+
+    // Create UpnpAvControllerClient
+    iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL();
+
+    // Create download session
+    iDownloadSession = &iAvController->StartDownloadSessionL(
+                                            iBrowsingSession->Device() );
+
+    // Set this object to be the download session observer
+    iDownloadSession->SetObserver( *this );
+
+    // Backup the browse session observer and set this object as an observer.
+    iBrowsingSessionObserverBackup = iBrowsingSession->Observer();
+    iBrowsingSession->RemoveObserver();
+    iBrowsingSession->SetObserver( *this );
+
+    iNoteHandler = CUpnpNoteHandler::NewL( this );
+    
+    iPlaylistHandler = CUpnpPlaylistHandler::NewL();
+    __LOG( "[UpnpDownloadHandler] ConstructL -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::DownloadItemsL
+// Downloads the given objects to the handset, into the default target folder
+// (setting in the Home Media application).
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::DownloadItemsL( CDesC8ArrayFlat* aObjectIds  )
+    {
+    
+    __LOG( "[UpnpDownloadHandler] DownloadItemsL" );
+    // Check parameter
+    if( !aObjectIds ||
+        aObjectIds->Count() <= KZero )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iTotalCount = aObjectIds->Count();
+    iObjectsToCopy = aObjectIds;
+
+    // Initialise values
+    iCopyPosition = -1;
+    iCopyCompleteness = KZero;
+
+    iStatusCode = KErrNone;
+
+    // Start fetching the object metadata
+    StartDownload();
+
+    if( iStatusCode == KErrNone )
+        {
+        iNoteHandler->RunProgressNoteL( EUpnpCopyProgressNote );
+        }
+        
+    // Leave if there was an error
+    if( iStatusCode != KErrNone )
+        {
+        iDownloadSession->CancelAllTransfers();
+        User::Leave( iStatusCode );
+        }
+    else
+        {
+        if( iContainerCopy )
+            {
+            // If no files were copied, change the copy status code
+            if( iPlaylistHandler->AudioItemCount() <= 0 &&
+                iPlaylistHandler->ImageItemCount() <= 0 &&
+                iPlaylistHandler->VideoItemCount() <= 0 &&
+                iStatusCode == KErrNone )
+                {
+                iStatusCode = KErrNotFound;
+                }
+
+            // If files were copied, create playlists, albums and notify
+            // Media Gallery
+            else
+                {
+                // If audio files were copied, and the operation was to
+                // copy a playlist, then create a MPX playlist
+                if( iPlaylistHandler->AudioItemCount() > 0 && iPlayList )
+                    {
+                    iPlaylistHandler->CreateMusicPlaylistL();
+                    }
+
+                // If image files were copied, create an image album
+                if( iPlaylistHandler->ImageItemCount() > 0 )
+                    {
+                    iPlaylistHandler->CreateImageAlbumL();
+                    }
+
+                // If video files were copied, create a video album
+                if( iPlaylistHandler->VideoItemCount() > 0 )
+                    {
+                    iPlaylistHandler->CreateVideoAlbumL();
+                    }
+                }
+
+            // Reset the playlist handler
+            iPlaylistHandler->Reset();
+            }    
+        }
+    __LOG( "[UpnpDownloadHandler] DownloadItemsL -end" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::DialogDismissedL
+// ProgressDialog call back method. Get's called when a dialog is
+// dismissed.
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::DialogDismissedL( )
+    {
+    __LOG( "[UpnpDownloadHandler] DialogDismissedL" );
+    // Update the status code
+    if( iStatusCode == KErrNone )
+        {
+        iStatusCode = KErrCancel;
+        }
+    iBrowsingSession->CancelBrowse();
+    iDownloadSession->CancelAllTransfers();
+    __LOG( "[UpnpDownloadHandler] DialogDismissedL -end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::MediaServerDisappeared
+// Notifies that the Media Server we have a session with has disappeared. 
+// Session is now unusable and must be closed.
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::MediaServerDisappeared(
+                                TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG( "[UpnpDownloadHandler]\t MediaServerDisappeared()" );
+
+    // Update the status code
+    if( aReason == EDisconnected )
+        {
+        iStatusCode = KErrSessionClosed;
+        }
+    else if( aReason == EWLANLost )
+        {
+        iStatusCode = KErrDisconnected;
+        }
+    else
+        {
+        iStatusCode = KErrUnknown;
+        }
+
+    // Finish the progress note
+    iNoteHandler->FinishProgressNote();
+    
+    __LOG( "[UpnpDownloadHandler]\t MediaServerDisappeared() -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::BrowseResponse
+// Returns unprocessed browse results received from a Media Server.
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::BrowseResponse( const TDesC8& aBrowseResponse,
+                                           TInt aError,
+                                           TInt /*aMatches*/,
+                                           TInt  aTotalCount,
+                                           const TDesC8& /*aUpdateId*/ )
+    {
+    __LOG( "[UpnpDownloadHandler] BrowseResponse()" );
+    
+    if( aBrowseResponse != KNullDesC8 &&
+        aError == KErrNone )
+        {
+        TRAP( aError, BrowseResponseL( aBrowseResponse, 
+                                       aTotalCount ) );
+        }
+    else if( aBrowseResponse == KNullDesC8 && KErrNone!= aError )
+        {
+        aError = KErrArgument;
+        }
+    
+    // If parsing or sending the download action failed, exit
+    if( aError != KErrNone )
+        {
+        
+        if( KErrCompletion == aError )
+            {
+            iStatusCode = KErrNone;
+            }
+        else
+            {
+            iStatusCode = aError;    
+            }
+        iNoteHandler->FinishProgressNote();
+        }
+
+    
+    
+    __LOG( "[UpnpDownloadHandler] BrowseResponse() -end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::BrowseResponseL
+// Returns unprocessed browse results received from a Media Server.
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::BrowseResponseL( const TDesC8& aBrowseResponse,
+                                            TInt aTotalCount )
+                                           
+    {
+    __LOG( "[UpnpDownloadHandler] BrowseResponseL()" );
+
+    //get the number of items in the container copy
+    if( !iFirstBrowse && iContainerCopy )
+        {
+        iTotalCount = aTotalCount;
+        if( !iProgressBarMaxValueSet )
+            {
+            iProgressBarMaxValueSet = ETrue;
+            iNoteHandler->SetMaxValue( iTotalCount * KProgressBaseValue );
+            }
+        
+        }
+        // Parse the result
+        
+    RPointerArray<CUpnpObject> array;
+    CleanupResetAndDestroyPushL( array );
+    
+    CUPnPXMLParser* parser = NULL;
+    parser = CUPnPXMLParser::NewLC();        
+    
+    
+    parser->ParseResultDataL( array, aBrowseResponse );
+    CleanupStack::PopAndDestroy( parser );
+    
+    /**
+     * Seldomly the aError is KErrNone, but no object in array
+     * if this is for the container copying, return KErrArgument
+     * otherwise, continue to browse the next item
+     */
+    if( array.Count() > 0 )
+        {
+        if( array[KZero]->ObjectType() == EUPnPItem )
+            { 
+            iFirstBrowse = EFalse;
+            IsAnyItem = ETrue;
+            
+            if( !iProgressBarMaxValueSet )
+                {
+                iProgressBarMaxValueSet = ETrue;
+                iNoteHandler->SetMaxValue( iTotalCount * KProgressBaseValue );
+                }
+            
+            CUpnpItem* tempItem = NULL;
+            tempItem = CUpnpItem::NewL();
+            tempItem->CopyL( *array[KZero] );
+             
+            CleanupStack::PushL( tempItem );
+             
+            iCopyItems.AppendL( tempItem ); //transfer ownership
+            CleanupStack::Pop( tempItem );
+            
+            // Start downloading the next object
+            StartDownload();
+            }
+        else if( array[KZero]->ObjectType() == EUPnPContainer )
+            {
+            //To get the parent container Id
+            if( iFirstBrowse )
+                {                
+                CUpnpContainer* sourseContainer = NULL;
+                sourseContainer = ( CUpnpContainer* )array[KZero];
+                iPlayList = UPnPCommonUtils::IsPlaylistContainerL( 
+                                            *sourseContainer);
+                        
+                iPlaylistHandler->Reset();
+                
+                // Convert the container title to playlist name
+                HBufC* titleUnicode = NULL;
+                titleUnicode = UpnpString::ToUnicodeL( sourseContainer->Title() );
+                CleanupStack::PushL( titleUnicode );
+                iPlaylistHandler->SetPlaylistNameL( *titleUnicode );
+                CleanupStack::PopAndDestroy( titleUnicode );
+                
+                iContainerCopy = ETrue;
+                iBrowsePosition = -1; //reset the browes position
+                iFirstBrowse = EFalse;
+                delete iContainerId; iContainerId = NULL;
+                iContainerId = array[KZero]->Id().AllocL();
+                }
+            }
+        } //if( array[KZero] > 0 )
+    else //if no items
+        {
+        if( iFirstBrowse )
+            {
+            User::LeaveIfError( KErrArgument );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &array );    
+    
+    //try to start browsing next object
+    if( iTotalCount > ++iBrowsePosition )
+        {
+        if( !iContainerCopy )
+            {
+            iBrowsingSession->BrowseL( iObjectsToCopy->MdcaPoint( 
+                                       iBrowsePosition ),
+                                       KFilterFull(),
+                                       MUPnPAVBrowsingSession::EMetadata,
+                                       iBrowsePosition,
+                                       KBrowseRequestCount,
+                                       KSortCriteria() );
+            }
+         else
+            {
+            // if we are copying a container, 
+            // browse the next item
+            if( iContainerId )
+                {
+                iBrowsingSession->BrowseL( 
+                              *iContainerId,
+                              KFilterFull(),
+                              MUPnPAVBrowsingSession::EDirectChildren,
+                              iBrowsePosition,
+                              KBrowseRequestCount,
+                              KSortCriteria() );
+                }                                    
+            }
+        } //if( iTotalCount > ++iBrowsePosition )
+    else //if there is no item in a container
+        {
+        if( iContainerCopy && !IsAnyItem )
+            {
+            iNoteHandler->FinishProgressNote();
+            }
+        }             
+    __LOG( "[UpnpDownloadHandler] BrowseResponseL() -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::TransferStarted
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::TransferStarted( TInt aKey,
+                                            TInt aStatus )
+    {
+    __LOG( "[UpnpDownloadHandler] TransferStarted()" );
+
+    // If the transfer failed to start, exit
+    
+    if( aStatus != KErrNone)
+        {
+        iStatusCode = aStatus;    
+        }
+    else if( aKey < 0 || aKey > iCopyPosition )
+        {
+        iStatusCode = KErrGeneral;
+        }
+    
+    if( KErrServerBusy == iStatusCode )
+        {
+        iBrowsePosition--;
+        iCopyPosition--;
+        iStatusCode = KErrNone;
+        }
+        
+    if( KErrNone != iStatusCode )
+        {
+        iNoteHandler->FinishProgressNote(); //this is sychro. call    
+        }
+    else
+        {
+        TRAP_IGNORE( iDownloadSession->StartTrackingProgressL( aKey ) );    
+        }    
+    
+    __LOG( "[UpnpDownloadHandler] TransferStarted() -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::TransferProgress
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::TransferProgress( TInt aKey,
+                                             TInt aBytes,
+                                             TInt aTotalBytes )
+    {
+    __LOG( "[UpnpDownloadHandler] TransferProgress()" );
+    if( aKey < 0 || aKey > iCopyPosition )
+        {
+        iStatusCode = KErrGeneral;
+        iNoteHandler->FinishProgressNote();
+        }
+    else
+        {
+        float progress = ((float)aBytes / aTotalBytes) * 100;
+        iNoteHandler->SetValue( iCopyCompleteness + (TInt)progress);    
+        }    
+    
+    __LOG( "[UpnpDownloadHandler] TransferProgress() -end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::TransferCompleted
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::TransferCompleted( TInt aKey,
+                                              TInt aStatus,
+                                              const TDesC& aFilePath )
+    {
+    __LOG( "[UpnpDownloadHandler] TransferCompleted()" );
+    
+    
+    iStatusCode = aStatus;
+    iDownloadedCount++;
+    
+    if( KErrNone != iStatusCode || ( aKey < 0 || aKey > iCopyPosition ) ||
+        iTotalCount <= iDownloadedCount )
+        {
+        iNoteHandler->FinishProgressNote();
+        }
+    else    
+        {
+        // Update the download completeness percentage value
+        iCopyCompleteness = iDownloadedCount * KProgressBaseValue;
+            // Update the progress note
+        iNoteHandler->SetValue( iCopyCompleteness );
+        
+        if( iCopyItems.Count() > aKey )
+            {
+            CUpnpItem* obj = NULL;
+            obj = (CUpnpItem*)iCopyItems[aKey];
+            if( obj )
+                {
+                TRAP_IGNORE( NotifyMPXL( *obj, aFilePath ) );        
+            
+                delete iCopyItems[aKey];
+                iCopyItems[aKey] = NULL;
+                }
+            }
+         
+        }
+    __LOG( "[UpnpDownloadHandler] TransferCompleted() -end" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::NotifyMPXL
+// Notify MPX when download is complete
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::NotifyMPXL( 
+                        const CUpnpItem& aObject, const TDesC& aFilePath )
+    {
+    __LOG( "[UpnpDownloadHandler] NotifyMPXL()" );
+    TUPnPItemType itemType = ETypeOther;
+    itemType = UPnPCommonUtils::ResolveFileTypeL( aFilePath );
+    
+    // Nofity MPX of a new file
+    if( itemType == ETypeAudio )
+        {
+        if( iContainerCopy )
+            {
+            iPlaylistHandler->AddAudioItemL( aFilePath );
+            }
+        iPlaylistHandler->NotifyNewAudioFileL( aFilePath, aObject );
+        }
+    
+    if( iContainerCopy )
+        {
+        if( itemType == ETypeVideo )
+            {
+            iPlaylistHandler->AddVideoItemL( aFilePath);
+            }
+        else if( itemType == ETypeImage )
+            {
+            iPlaylistHandler->AddImageItemL( aFilePath);
+            }
+        }
+    __LOG( "[UpnpDownloadHandler] NotifyMPXL() end" );    
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::StartDownload
+// Start download a file
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::StartDownload()
+    {
+    __LOG( "[UpnpDownloadHandler] StartDownload()" );
+    if( iStatusCode == KErrNone )
+        {
+        TRAP( iStatusCode, StartDownloadL() );    
+        }
+    
+    
+    // If the downloading of the next file failed (browse failed or there
+    // are no more files), exit
+    
+    if( iStatusCode!= KErrNone )
+        {
+        if( iStatusCode == KErrCompletion )
+            {
+            iStatusCode = KErrNone;
+            }
+        iNoteHandler->FinishProgressNote();     
+        }
+    __LOG( "[UpnpDownloadHandler] StartDownload() end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::StartDownloadL
+// Starts the next download. Leaves (KErrCompletion) if there are no more
+// objects to download.
+// --------------------------------------------------------------------------
+//
+void CUpnpDownloadHandler::StartDownloadL()
+    {
+    __LOG( "[UpnpDownloadHandler] StartDownloadL()" );
+
+    if( !iFirstBrowse )
+        {
+        //start downloading
+        // check if there are any CUpnpObject left in the array
+        if( iCopyItems.Count() > ++iCopyPosition )
+            {
+            iDownloadSession->
+                    StartDownloadL( *(CUpnpItem*)iCopyItems[iCopyPosition],
+                                    iCopyPosition );
+            }
+        else
+            {
+            User::Leave( KErrCompletion );
+            }
+        }
+    else //this is called only once at the beginning of copying
+        {
+        //start browsing
+        iBrowsePosition++;
+
+        iBrowsingSession->BrowseL( 
+                        iObjectsToCopy->MdcaPoint( iBrowsePosition ),
+                        KFilterFull(),
+                        MUPnPAVBrowsingSession::EMetadata,
+                        iBrowsePosition,
+                        KBrowseRequestCount,
+                        KSortCriteria() );
+        
+        }
+    __LOG( "[UpnpDownloadHandler] StartDownloadL() -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDownloadHandler::GetNumCopiedFiles
+// --------------------------------------------------------------------------
+//
+TInt CUpnpDownloadHandler::GetNumCopiedFiles() const
+    {
+    return iDownloadedCount;
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/src/upnpfiletransferengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,278 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the CUpnpFileTransferEngine class
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <badesca.h>                            // CDesC8ArrayFlat
+
+// upnp stack api
+#include <upnpcontainer.h>                      // CUpnpContainer
+
+// upnpframework / avcontroller api
+#include "upnpavbrowsingsession.h"              // MUPnPAVSessionBase
+
+// upnpfiletransferengine internal
+#include "upnpfiletransferengine.h"             // CUpnpFileTransferEngine
+#include "upnpfiletransferhandler.h"            // CUpnpFileTransferHandler
+#include "upnpdownloadhandler.h"                // CUpnpDownloadHandler
+#include "upnpuploadhandler.h"                  // CUpnpUploadHandler
+
+
+_LIT( KComponentLogfile, "filetransferengine.txt");
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::NewL
+// NewL.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpFileTransferEngine* CUpnpFileTransferEngine::NewL(
+                            MUPnPAVBrowsingSession* aBrowsingSession )
+    {
+    __LOG( "[UpnpFileTransferEngine] CUpnpFileTransferEngine: NewL" );
+
+    // Check that the browsing session is valid and has target device set.
+    if( !aBrowsingSession )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CUpnpFileTransferEngine* self = NULL;
+    self = new (ELeave) CUpnpFileTransferEngine;
+    CleanupStack::PushL( self );
+    self->ConstructL( aBrowsingSession );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Constuctor
+// --------------------------------------------------------------------------
+//
+CUpnpFileTransferEngine::CUpnpFileTransferEngine()
+    {
+    __LOG( "[UpnpFileTransferEngine] Constructor" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpFileTransferEngine::~CUpnpFileTransferEngine()
+    {
+    __LOG( "[UpnpFileTransferEngine] Destructor" );
+
+    // Delete the file transfer handler.
+    delete iFileTransferHandler;
+    delete iUploadHandler;
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferEngine::ConstructL(
+                                MUPnPAVBrowsingSession* aBrowsingSession )
+    {
+    __LOG( "[UpnpFileTransferEngine] ConstructL" );
+
+    // Check the parameter first
+    if( !aBrowsingSession)
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iBrowsingSession = aBrowsingSession; // not owned
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::CopyToHandsetL
+// Copies items (whose object ids are provided) from a remote Upnp Media
+// Server to the handset.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpFileTransferEngine::CopyToHandsetL(
+                                        CDesC8ArrayFlat* aObjectIds )
+    {
+    __LOG( "[UpnpFileTransferEngine] CopyToHandsetL" );
+
+    // Create the download handler
+    CUpnpDownloadHandler* downloadHandler =
+                            CUpnpDownloadHandler::NewL( iBrowsingSession );
+    CleanupStack::PushL( downloadHandler );
+
+    // Do the download
+    downloadHandler->DownloadItemsL( aObjectIds );
+    
+    TInt fileNumber = downloadHandler->GetNumCopiedFiles();
+    // Clean up
+    CleanupStack::PopAndDestroy( downloadHandler );
+    downloadHandler = NULL;
+    return fileNumber;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::CopyLocalFilesToRemoteServerL
+// Copies local files to a remote media server.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileTransferEngine::CopyLocalFilesToRemoteServerL(
+                                RPointerArray<TDesC16>* aFilePaths )
+    {
+    __LOG( "[UpnpFileTransferEngine] CopyLocalItemsToRemoteServerL" );
+
+    // Create the download handler
+    if( !iUploadHandler )
+        {
+        iUploadHandler = CUpnpUploadHandler::NewL( iBrowsingSession );    
+        }
+    
+    iUploadHandler->UploadItemsL( aFilePaths, EUpnpCopy );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::MoveLocalFilesToRemoteServerL
+// Moves local files to a remote media server.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileTransferEngine::MoveLocalFilesToRemoteServerL(
+                                RPointerArray<TDesC16>* aFilePaths )
+    {
+    __LOG( "[UpnpFileTransferEngine] MoveLocalFilesToRemoteServerL" );
+
+    // Create the download handler
+    if( !iUploadHandler )
+        {
+        iUploadHandler = CUpnpUploadHandler::NewL( iBrowsingSession );    
+        }
+    
+    iUploadHandler->UploadItemsL( aFilePaths, EUpnpMove );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::CopyLocalPlaylistToRemoteServerL
+// Copies a playlist from the local handset to a remote Upnp Media Server.
+// Deprecated!
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileTransferEngine::CopyLocalPlaylistToRemoteServerL(
+                                const TDesC& aPlaylistName,
+                                RPointerArray<TDesC16>* aFilePaths )
+    {
+    __LOG( "[UpnpFileTransferEngine] \
+CopyLocalPlaylistToRemoteServerL" );
+
+    // Create the download handler
+    if( !iUploadHandler )
+        {
+        iUploadHandler = CUpnpUploadHandler::NewL( iBrowsingSession );    
+        }
+    
+    iUploadHandler->UploadPlayListL( aPlaylistName, aFilePaths, EUpnpCopy );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::CopyRemoteItemsToHandsetL
+// Copies items from a remote Upnp Media Server to default location.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileTransferEngine::CopyRemoteItemsToHandsetL(
+                            RPointerArray<CUpnpItem>& aItems )
+    {
+    __LOG( "[UpnpFileTransferEngine] CopyRemoteItemsToHandsetL" );
+
+    // Create the file transfer handler, if not yet created
+    if( !iFileTransferHandler )
+        {
+        iFileTransferHandler = CUpnpFileTransferHandler::NewL(
+                                                    iBrowsingSession );
+        }
+
+    // Forward the method call with the correct transfer mode
+    iFileTransferHandler->TransferRemoteItemsToHandsetL(
+                                EUpnpCopyRemoteItemsToDefaultLocation,
+                                aItems );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::CopyRemoteContainerToHandsetL
+// Copies a container from a remote Upnp Media Server to the default (setting
+// set in the Home Network Application) location.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileTransferEngine::CopyRemoteContainerToHandsetL(
+                            CUpnpContainer* aContainer )
+    {
+    __LOG( "[UpnpFileTransferEngine] CopyRemoteContainerToHandsetL" );
+
+    // Create the file transfer handler, if not yet created
+    if( !iFileTransferHandler )
+        {
+        iFileTransferHandler = CUpnpFileTransferHandler::NewL(
+                                                    iBrowsingSession );
+        }
+
+    // Forward the method call with the correct transfer mode
+    iFileTransferHandler->TransferRemoteContainerToHandsetL(
+                            EUpnpCopyRemoteContainerToDefaultLocation,
+                            aContainer );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::CopyRemotePlaylistToHandsetL
+// Copies a playlist from a remote Upnp Media Server to the default (setting
+// set in the Home Network Application) location.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileTransferEngine::CopyRemotePlaylistToHandsetL(
+                            CUpnpContainer* aContainer )
+    {
+    __LOG( "[UpnpFileTransferEngine] CopyRemotePlaylistToHandsetL" );
+
+    // Create the file transfer handler, if not yet created
+    if( !iFileTransferHandler )
+        {
+        iFileTransferHandler = CUpnpFileTransferHandler::NewL(
+                                                    iBrowsingSession );
+        }
+
+    // Forward the method call with the correct transfer mode
+    iFileTransferHandler->TransferRemoteContainerToHandsetL(
+                            EUpnpCopyRemotePlaylistToDefaultLocation,
+                            aContainer );
+    }
+
+ 
+// --------------------------------------------------------------------------
+// CUpnpFileTransferEngine::ItemCopiedFromContainer
+// returns a number of items copied from a container
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpFileTransferEngine::ItemCopiedFromContainer()
+    {
+    TInt returnValue = KErrNotReady;
+    if( iFileTransferHandler )
+        {
+        returnValue = iFileTransferHandler->ItemCopiedFromContainer();
+        }
+    return returnValue;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/src/upnpfiletransferhandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,996 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the CUpnpFileTransferHandler class
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <eikenv.h>                             // CEikonEnv
+#include <eikprogi.h>                           // CEikProgressInfo
+#include <bautils.h>                            // BaflUtils
+#include <data_caging_path_literals.hrh>        // KDC_RESOURCE_FILES_DIR
+
+#include <upnpitem.h>                           // CUpnpItem
+#include <upnpcontainer.h>                      // CUpnpContainer
+#include <upnpstring.h>                         // UpnpString
+
+// upnpavcontroller api
+#include "upnpavbrowsingsession.h"              // MUPnPAVSessionBase
+#include "upnpavcontrollerfactory.h"            // UPnPAVControllerFactory
+#include "upnpavcontroller.h"                   // MUPnPAVController
+#include "upnpfiledownloadsession.h"            // MUPnPFileDownloadSession
+
+// upnpavcontroller / xml parser api
+#include "upnpxmlparser.h"
+
+// upnpframework / internal api's
+#include "upnpgallerynotifier.h"                // UpnpGalleryNotifer
+
+// filetransferengine internal
+#include <upnpfiletransferengineresources.rsg>  // Dialog resources
+#include "upnpfiletransferhandler.h"            // CUpnpFileTransferHandler
+
+// CONSTANTS
+_LIT( KResFileName,                 "upnpfiletransferengineresources.rsc");
+_LIT8( KBrowseSortCriteria,         "" );
+_LIT8( KBrowseFilter,               "*" );
+const TInt KBrowseRequestCount =        1;
+const TInt KProgressInfoInitialValue =  1;
+const TInt KProgressInfoFinalValue =    50000;
+const TInt KProgressNoteStepper =       2;
+const TInt KCopyPositionInitialValue =  0;
+
+_LIT( KComponentLogfile, "filetransferengine.txt");
+#include "upnplog.h"
+
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::NewL
+// NewL.
+// --------------------------------------------------------------------------
+//
+CUpnpFileTransferHandler* CUpnpFileTransferHandler::NewL(
+        MUPnPAVBrowsingSession* aBrowsingSession )
+    {
+    __LOG( "CUpnpFileTransferHandler::NewL"  );
+
+    // Check that the browsing session is valid and has target device set.
+    if( !aBrowsingSession )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CUpnpFileTransferHandler* self = NULL;
+    self = new (ELeave) CUpnpFileTransferHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL( aBrowsingSession );
+    CleanupStack::Pop( self );
+    __LOG( "CUpnpFileTransferHandler::NewL -end"  );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Constuctor
+// --------------------------------------------------------------------------
+//
+CUpnpFileTransferHandler::CUpnpFileTransferHandler()
+    {
+    __LOG( "CUpnpFileTransferHandler::CUpnpFileTransferHandler" );
+    iNumCopiedItemFromContainer = 0;
+    __LOG( "CUpnpFileTransferHandler::CUpnpFileTransferHandler -end" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpFileTransferHandler::~CUpnpFileTransferHandler()
+    {
+    __LOG( "CUpnpFileTransferHandler::~CUpnpFileTransferHandler" );
+
+    // Restore the browse session observer
+    if( iBrowsingSession &&
+        iBrowsingSessionObserverBackup )
+        {
+        iBrowsingSession->RemoveObserver();
+        iBrowsingSession->SetObserver( *iBrowsingSessionObserverBackup );
+        }
+
+    // Delete the playlist handler.
+    delete iPlaylistHandler;
+
+    // Delete copy item (used in container and playlist copy) is it exists
+    delete iCopyItem;
+    
+    // Deletes download session and avcontroller instances.
+    if( iDownloadSession && iAvController )
+        {
+        iAvController->StopDownloadSession( *iDownloadSession );
+        }
+    delete iAvController;
+
+    // Un-load resource file
+    if ( iResFileOffset )
+        {
+        iCoeEnv->DeleteResourceFile( iResFileOffset );
+        iResFileOffset = 0;
+        }
+    __LOG( "CUpnpFileTransferHandler::~CUpnpFileTransferHandler -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::ConstructL(
+        MUPnPAVBrowsingSession* aBrowsingSession )
+    {
+    __LOG( "CUpnpFileTransferHandler::ConstructL" );
+
+    if( aBrowsingSession )
+        {
+        iBrowsingSession = aBrowsingSession;
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Leave if UI context is not available
+    iCoeEnv = CEikonEnv::Static();
+    if( !iCoeEnv )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    // Get the file server session handle
+    RFs& fs = iCoeEnv->FsSession();
+
+    // Parse the resource file path
+    TParse parse;
+    parse.Set( KResFileName, &KDC_RESOURCE_FILES_DIR, NULL );
+    TFileName rscFileName;
+    rscFileName.Append( parse.FullName() );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive );
+    
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fs, rscFileName );
+
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( fs, rscFileName ) )
+        {
+        __LOG( "Resource file does not exist!" );
+        User::Leave( KErrNotFound );
+        }
+
+    // Read the resource file offset
+    iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName );
+
+    // Backup the browse session observer and set this object as an observer.
+    iBrowsingSessionObserverBackup = iBrowsingSession->Observer();
+    
+
+    iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL();
+
+    // Create download session
+    iDownloadSession = &iAvController->StartDownloadSessionL(
+                                            iBrowsingSession->Device() );
+
+    // Set this object to be the download session observer
+    iDownloadSession->SetObserver( *this );
+    
+    iFileTransferMode = EUpnpIdleTransferMode;
+    
+    // Instantiate the playlist handler
+    iPlaylistHandler = CUpnpPlaylistHandler::NewL();
+    
+    __LOG( "CUpnpFileTransferHandler::ConstructL -end" );
+    }
+   
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::TransferRemoteItemsToHandsetL
+// Copies items from a remote Upnp Media Server to the handset.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::TransferRemoteItemsToHandsetL(
+        TUpnpFileTransferMode aTransferMode,
+        RPointerArray<CUpnpItem>& aItems )
+    {
+    __LOG( "CUpnpFileTransferHandler::TransferRemoteItemsToHandsetL" );
+    if( aItems.Count() <= 0 ||
+        aTransferMode != EUpnpCopyRemoteItemsToDefaultLocation )
+        {
+        User::Leave( KErrArgument ); 
+        }
+
+    // Initialise member variables
+    iFileTransferMode = aTransferMode;
+    iCopyItems = &aItems;
+    iCopyPosition = KCopyPositionInitialValue;
+    iStatusCode = KErrNone;
+
+    // Copy the first file
+    TRAP( iStatusCode, iDownloadSession->StartDownloadL( 
+            (*(*iCopyItems)[iCopyPosition]),
+            iCopyPosition ) );
+    
+    // If first copy action was sent succesfully, draw the progress note,
+    // otherwise leave with the error code
+    if( iStatusCode == KErrNone )
+        {
+        RunCopyNoteL( iCopyItems->Count() );
+        }
+
+    // Notify Media Gallery of the filesystem changes (files added)
+    TRAP_IGNORE( UpnpGalleryNotifier::NotifyMediaGalleryL() );
+
+    // Clean up
+    iFileTransferMode = EUpnpIdleTransferMode;
+
+    // Leave if there was an error
+    if( iStatusCode != KErrNone )
+        {
+        User::Leave( iStatusCode );
+        }
+    
+    __LOG( "CUpnpFileTransferHandler::TransferRemoteItemsToHandsetL -end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::TransferRemoteContainerToHandsetL
+// Copies a container from a remote Upnp Media Server to the handset.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::TransferRemoteContainerToHandsetL(
+        TUpnpFileTransferMode aTransferMode,
+        CUpnpContainer* aSourceContainer )
+    {
+    __LOG( "CUpnpFileTransferHandler::TransferRemoteContainerToHandsetL" );
+
+    iStatusCode = KErrNone;
+
+    if( !aSourceContainer ||
+        aSourceContainer->Title() == KNullDesC8 ||
+        ( aTransferMode != EUpnpCopyRemoteContainerToDefaultLocation &&
+          aTransferMode != EUpnpCopyRemotePlaylistToDefaultLocation ) )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Reset the playlist handler
+    iPlaylistHandler->Reset();
+
+    // Convert the container title to playlist name
+    HBufC* titleUnicode = NULL;
+    titleUnicode = UpnpString::ToUnicodeL( aSourceContainer->Title() );
+    CleanupStack::PushL( titleUnicode );
+    iPlaylistHandler->SetPlaylistNameL( *titleUnicode );
+    CleanupStack::PopAndDestroy( titleUnicode );
+    titleUnicode = NULL;
+
+    // Initialise copy related member variables
+    iCopyFromContainer = aSourceContainer;
+    iFileTransferMode = aTransferMode;
+    iContainerCopyFirstBrowse = ETrue;
+    iContainerCopyBrowseIndex = 0;
+
+    iBrowsingSession->SetObserver( *this );
+    // Start the copy process
+    TRAP( iStatusCode,
+          iBrowsingSession->BrowseL(
+                              iCopyFromContainer->Id(),
+                              KBrowseFilter(),
+                              MUPnPAVBrowsingSession::EDirectChildren,
+                              iContainerCopyBrowseIndex,
+                              KBrowseRequestCount,
+                              KBrowseSortCriteria() ) );
+
+    if( iStatusCode == KErrNone )
+        {
+        // Start the progress Dialog, but do not set current and 
+        // final values for the progress bar. This info will be set
+        // when the first browse result will be reseived.
+        RunCopyNoteL();
+
+        // If no files were copied, change the copy status code
+        if( iPlaylistHandler->AudioItemCount() <= 0 &&
+            iPlaylistHandler->ImageItemCount() <= 0 &&
+            iPlaylistHandler->VideoItemCount() <= 0 &&
+            iStatusCode == KErrNone )
+            {
+            iStatusCode = KErrNotFound;
+            }
+
+        // If files were copied, create playlists, albums and notify
+        // Media Gallery
+        else
+            {
+            // If audio files were copied, and the operation was to
+            // copy a playlist, then create a MPX playlist
+            if( iPlaylistHandler->AudioItemCount() > 0 &&
+                ( aTransferMode ==
+                        EUpnpCopyRemotePlaylistToDefaultLocation ) )
+                {
+                TRAP_IGNORE( iPlaylistHandler->CreateMusicPlaylistL() );
+                }
+
+            // If image files were copied, create an image album
+            if( iPlaylistHandler->ImageItemCount() > 0 &&
+                ( aTransferMode ==
+                        EUpnpCopyRemoteContainerToDefaultLocation ) )
+                {
+                TRAP_IGNORE( iPlaylistHandler->CreateImageAlbumL() );
+                }
+
+            // If video files were copied, create a video album
+            if( iPlaylistHandler->VideoItemCount() > 0 &&
+                ( aTransferMode ==
+                        EUpnpCopyRemoteContainerToDefaultLocation ) )
+                {
+                TRAP_IGNORE( iPlaylistHandler->CreateVideoAlbumL() );
+                }
+            }
+
+        // Notify Media Gallery of filesystem changes, if files were
+        // added.
+        if( iPlaylistHandler->ImageItemCount() > 0 ||
+            iPlaylistHandler->VideoItemCount() > 0 || 
+            iPlaylistHandler->AudioItemCount() > 0 )
+            {
+            __LOG( "Notifying the Media Gallery of new \
+image/video/music files." );
+            TRAP_IGNORE( UpnpGalleryNotifier::NotifyMediaGalleryL() );
+            }
+        
+        __LOG( "TransferRemoteContainerToHandsetL Reset");
+        // Reset the playlist handler
+        iPlaylistHandler->Reset();
+        }
+
+    // Set file transfer mode to idle
+    iFileTransferMode = EUpnpIdleTransferMode;
+
+    // If the copy failed, leave with the error code
+    if( iStatusCode != KErrNone )
+        {
+        User::Leave( iStatusCode );
+        }
+    
+    __LOG( "CUpnpFileTransferHandler::TransferRemoteContainerToHandsetL -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::CopyCompleteContainersL
+// Handles the copy complete callback when copying containers.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::CopyCompleteContainersL(
+        TInt aError,
+        const TDesC& aFilepath )
+    {
+    __LOG( "CUpnpFileTransferHandler::CopyCompleteContainersL" );
+
+    // Update the progress note
+    iCurrentProgressValue++;
+    if( iProgressInfo )
+        {
+        iProgressInfo->SetAndDraw( iCurrentProgressValue );
+        }
+
+    if( aError == KErrNone )
+        {
+        iNumCopiedItemFromContainer++;
+        // Resolve the type of the media file
+        TUPnPItemType itemType = ResolveFileType( aFilepath );
+
+        // Add the file to playlist handler's lists
+        if( itemType == ETypeAudio &&
+            iCopyItem )
+            {
+            TRAP_IGNORE(
+                iPlaylistHandler->NotifyNewAudioFileL(
+                    aFilepath, *iCopyItem );
+                iPlaylistHandler->AddAudioItemL( aFilepath ) );
+            }
+        else if( itemType == ETypeVideo )
+            {
+            TRAP_IGNORE( iPlaylistHandler->AddVideoItemL( aFilepath) );
+            }
+        else if( itemType == ETypeImage )
+            {
+            TRAP_IGNORE( iPlaylistHandler->AddImageItemL( aFilepath) );
+            }
+        else
+            {
+            // Nothing
+            }
+        }
+
+    // Clean up the copy item
+    delete iCopyItem;
+    iCopyItem = NULL;
+
+    // If the copy of the previous file failed with any error code, quit the
+    // whole copy operation
+    if( aError != KErrNone )
+        {
+        iStatusCode = aError;
+        
+        FinishNotes();
+        return;
+        }
+
+    // If there are more objects (possibly items), browse for the next one,
+    // otherwise finish the progress note.
+    if( iContainerCopyBrowseIndex < iContainerCopyBrowseTotalCount )
+        {
+        iBrowsingSession->SetObserver( *this );
+        TRAPD( browseError,
+               iBrowsingSession->BrowseL(
+                                  iCopyFromContainer->Id(),
+                                  KBrowseFilter(),
+                                  MUPnPAVBrowsingSession::EDirectChildren,
+                                  iContainerCopyBrowseIndex,
+                                  KBrowseRequestCount,
+                                  KBrowseSortCriteria() ) );
+
+        // If the browse could not be sent, finish the operation
+        if( browseError != KErrNone && KErrServerBusy != browseError )
+            {
+            // Update the status code
+            if( iStatusCode == KErrNone )
+                {
+                iStatusCode = browseError;
+                }
+            FinishNotes();
+            }
+            
+        }
+    else
+        {
+        FinishNotes();
+        }
+    
+    __LOG( "CUpnpFileTransferHandler::CopyCompleteContainersL -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::CopyCompleteFilesL
+// Handles the copy complete callback when copying files
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::CopyCompleteFilesL( 
+        TInt aError,
+        const TDesC& aFilepath )
+    {
+    __LOG1( "CUpnpFileTransferHandler::CopyCompleteFilesL %d", aError );
+
+    if( aError == KErrNone )
+        {
+        iCurrentProgressValue = iCurrentProgressValue + iProgressIncrement;
+        if( iProgressInfo )
+            {
+            iProgressInfo->SetAndDraw( iCurrentProgressValue );
+            }
+        
+        // If a new file was copied to the handset, inform MPX
+        TInt returnValue = KErrNone;
+        if( iFileTransferMode == EUpnpCopyRemoteItemsToDefaultLocation )
+            {
+            if( (*iCopyItems)[iCopyPosition] )
+                {
+                // Resolve the type of the media file
+                TUPnPItemType itemType = ResolveFileType( aFilepath );
+
+                // Nofity MPX of a new file
+                if( itemType == ETypeAudio )
+                    {
+                    TRAP_IGNORE( iPlaylistHandler->NotifyNewAudioFileL(
+                        aFilepath, *(*iCopyItems)[iCopyPosition] ) );
+                    }
+                }
+
+            // Delete the filename and remove from the array
+            delete (*iCopyItems)[iCopyPosition];
+            (*iCopyItems)[iCopyPosition] = NULL;
+            
+            iCopyItems->Remove( iCopyPosition );
+            iCopyItems->Compress();
+            
+            if( iCopyPosition > iCopyItems->Count() ||
+                iCopyPosition == iCopyItems->Count() )
+                {
+                __LOG( "All files copied. Exiting..." );
+
+                // Finish the progress Dialog
+                iStatusCode = aError;
+                
+                FinishNotes();
+                }
+            // If there are still more files to copy, increment the position
+            // counter, and do the next copy    
+            else
+                {
+                TRAP( returnValue, 
+                      iDownloadSession->StartDownloadL( 
+                                          (*(*iCopyItems)[iCopyPosition]),
+                                          iCopyPosition ) );
+                }
+            }
+            
+        // In case of an error, quit copying
+        if( returnValue != KErrNone )
+            {
+            // Update the status
+            if( iStatusCode == KErrNone )
+                {
+                iStatusCode = returnValue;
+                }
+            // Finish the operation
+            FinishNotes();
+            }     
+        } //if( aError == KErrNone )
+    else
+        {
+        __LOG1("Unable to cont. copy: error %d!", aError );
+        
+        iStatusCode = aError;
+
+        // Finish the progress Dialog
+        FinishNotes();
+        }
+    
+    __LOG( "CUpnpFileTransferHandler::CopyCompleteFilesL -end" );    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::DialogDismissedL
+// ProgressDialog call back method. Get's called when a Dialog is
+// dismissed.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::DialogDismissedL( TInt aButtonId )
+    {
+    
+    // if dialog is being dismissed, cancel every ongoing requrest
+    __LOG( "CUpnpFileTransferHandler::DialogDismissedL" );
+    __LOG( " User cancelled the copy operation." );
+
+    iBrowsingSession->CancelBrowse();
+    iDownloadSession->CancelAllTransfers();
+    iDownloadSession->RemoveObserver();
+        
+    if( aButtonId == EAknSoftkeyCancel )
+        {
+        // Update the status code
+        if( iStatusCode == KErrNone )
+            {
+            iStatusCode = KErrCancel;
+            }
+        }
+    
+    __LOG( "CUpnpFileTransferHandler::DialogDismissedL -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::MediaServerDisappeared
+// Notifies that the Media Server we have a session with has disappeared. 
+// Session is now unusable and must be closed.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::MediaServerDisappeared(
+        TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG( "CUpnpFileTransferHandler::MediaServerDisappeared" );
+
+    // Update the status code
+    if( iStatusCode == KErrNone )
+        {
+        if( aReason == EDisconnected )
+            {
+            iStatusCode = KErrSessionClosed;
+            }
+        else if( aReason == EWLANLost )
+            {
+            iStatusCode = KErrDisconnected;
+            }
+        else
+            {
+            iStatusCode = KErrUnknown;
+            }
+        }
+
+    // Finish wait/progress note
+    FinishNotes();
+    
+    __LOG( "CUpnpFileTransferHandler::MediaServerDisappeared -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::BrowseResponse
+// Returns processed browse results received from a Media Server.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::BrowseResponse( 
+        const TDesC8& aBrowseResponse,
+        TInt aError, 
+        TInt /*aMatches*/, 
+        TInt aTotalCount, 
+        const TDesC8& /*aUpdateId*/ )
+    {
+    __LOG( "CUpnpFileTransferHandler::BrowseResponse" );
+
+    if( iBrowsingSession &&
+        iBrowsingSessionObserverBackup )
+        {
+        iBrowsingSession->SetObserver( *iBrowsingSessionObserverBackup );
+        }
+    CUPnPXMLParser* parser = NULL;
+    TRAP( aError, parser = CUPnPXMLParser::NewL() );
+    if( aError == KErrNone )
+        {
+        RPointerArray<CUpnpObject> array;
+        
+
+        TRAP( aError, parser->ParseResultDataL( array,
+        aBrowseResponse ) );
+        
+        if( aError == KErrNone &&
+            iStatusCode == KErrNone )
+            {
+            if( aTotalCount > 0 )
+                {
+                iContainerCopyBrowseTotalCount = aTotalCount;
+                iContainerCopyBrowseIndex++;
+                iCurrentProgressValue++;
+
+                if( iProgressInfo )
+                    {
+                    // If this was the first browse in container copy
+                    // operation, initialize the progress note, otherwise
+                    // just update it
+                    if( iContainerCopyFirstBrowse )
+                        {
+                        iContainerCopyFirstBrowse = EFalse;
+                        iProgressInfo->SetFinalValue( ( aTotalCount * 
+                            KProgressNoteStepper ) );
+                        iProgressInfo->SetAndDraw( iCurrentProgressValue );
+                        }
+                    else
+                        {
+                        iProgressInfo->SetAndDraw( iCurrentProgressValue );
+                        }
+                    }
+
+                // If the object was an item, create a copy of the item
+                // object
+                iStatusCode = KErrNone;
+                if( array.Count() > 0 &&
+                    array[0] &&
+                    array[0]->ObjectType() == EUPnPItem )
+                    {
+                    // Store the item (the item's metadata is needed when the
+                    // copy is complete)
+                    delete iCopyItem;
+                    iCopyItem = NULL;
+
+                    TRAP( iStatusCode,
+                          iCopyItem = CUpnpItem::NewL() );
+                    if( iStatusCode == KErrNone )
+                        {
+                        TRAP( iStatusCode, iCopyItem->CopyL(
+                            *(CUpnpItem*)array[0] ) );
+                        }
+                    }
+                
+                // Copy the item
+                if( iStatusCode == KErrNone &&
+                    iCopyItem &&
+                    array.Count() > 0 &&
+                    array[0] &&
+                    array[0]->ObjectType() == EUPnPItem )
+                    {
+                    // Copy the next file
+                    if( iFileTransferMode ==
+                                EUpnpCopyRemoteContainerToDefaultLocation ||
+                        iFileTransferMode ==
+                                EUpnpCopyRemotePlaylistToDefaultLocation )
+                        {
+                        TRAP( iStatusCode, iDownloadSession->
+                            StartDownloadL( (*(CUpnpItem*)array[0]), 0 ) );
+                        }
+                    else
+                        {
+                        // If the transfer mode is unknown, finish progress
+                        // note
+                        iStatusCode = KErrUnknown;
+                        FinishNotes();
+                        }
+
+                    // If the copy could not be started, finish progress note
+                    if( iStatusCode != KErrNone )
+                        {
+                        FinishNotes();
+                        }
+                    }
+                // If the object was not an item, but there are still objects
+                // left in the container, do a browse for the next object,
+                // otherwise finish the progress note.
+                else if( iContainerCopyBrowseIndex < 
+                         iContainerCopyBrowseTotalCount )
+                    {
+                    // Update the progress bar ("CopyFile action part" of the 
+                    // progress has to drawn here since the copy is not
+                    // performed for container objects.
+                    iCurrentProgressValue++;
+                    if( iProgressInfo )
+                        {
+                        iProgressInfo->SetAndDraw( iCurrentProgressValue );
+                        }
+
+                    iBrowsingSession->SetObserver( *this );
+                    
+                    TRAP( iStatusCode,
+                          iBrowsingSession->BrowseL(
+                                    iCopyFromContainer->Id(),
+                                    KBrowseFilter(),
+                                    MUPnPAVBrowsingSession::EDirectChildren,
+                                    iContainerCopyBrowseIndex,
+                                    KBrowseRequestCount,
+                                    KBrowseSortCriteria() ) );
+
+                    // If the browse could not be sent, finish progress note
+                    if( iStatusCode != KErrNone )
+                        {
+                        FinishNotes();
+                        }
+
+                    }
+                // If the last object of the container was a container,
+                // finish the progress note
+                else
+                    {
+                    FinishNotes();
+                    }
+                }
+            else
+                {
+                __LOG( "BrowseResponse, \
+empty container, exit (-1)." );
+                iStatusCode = KErrNotFound;
+                FinishNotes();
+                }
+            }
+        else //if( aError == KErrNone && iStatusCode == KErrNone )
+            {
+            if( iStatusCode == KErrNone )
+                {
+                iStatusCode = aError;
+                }
+            FinishNotes();
+            __LOG1( "BrowseResponse, parsing failed, exit (%d).", aError );
+            
+            }
+        
+        array.ResetAndDestroy();
+                
+        delete parser;
+        }
+    else
+        {
+        __LOG1( "BrowseResponse,browse failed, exit (%d)." , aError );
+
+        // Update the status code
+        if( iStatusCode == KErrNone )
+            {
+            iStatusCode = aError;
+            }
+
+        // Finish the operation
+        FinishNotes();
+        }
+    
+    __LOG( "CUpnpFileTransferHandler::BrowseResponse -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::RunCopyNoteL
+// Initialises and runs the progress note.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::RunCopyNoteL( TInt aCount )
+    {
+    __LOG( "CUpnpFileTransferHandler::RunCopyNoteL" );
+    
+    if( iProgressNoteDialog )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    // If aCount is zero, creates "unitialized" dialog.
+    if( aCount < 0 )
+        {
+        User::Leave( KErrArgument );
+        }    
+        
+    // Creates dialog
+    iProgressNoteDialog = new (ELeave) CAknProgressDialog(
+            ( REINTERPRET_CAST( CEikDialog**, &iProgressNoteDialog ) ) );
+    iProgressNoteDialog->PrepareLC( R_FT_COPY_PROGRESS_NOTE_DIALOG );
+    iProgressNoteDialog->SetCallback( this );
+    iProgressInfo = iProgressNoteDialog->GetProgressInfoL();
+    
+    if ( aCount )
+        {
+        // Incrementing dialog values.
+        iProgressInfo->SetFinalValue( KProgressInfoFinalValue );
+        iProgressIncrement = KProgressInfoFinalValue /
+                         ( aCount * KProgressNoteStepper + 
+                                 KProgressNoteStepper );
+        iCurrentProgressValue = KProgressNoteStepper * iProgressIncrement;
+        }
+    else
+        {
+        // Uninitialized dialog values.
+        iProgressInfo->SetFinalValue( KProgressInfoInitialValue );
+        iProgressIncrement = 0;
+        iCurrentProgressValue = 0;
+        }
+    
+    iProgressInfo->SetAndDraw( iCurrentProgressValue );
+    iProgressNoteDialog->RunLD();
+    
+    __LOG( "CUpnpFileTransferHandler::RunCopyNoteL -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::FinishNotes
+// Finishes the progress and wait note if they are running.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::FinishNotes()
+    {
+    __LOG( "CUpnpFileTransferHandler::FinishNotes" );
+
+    // If the progress note is running, finish it
+    if( iProgressNoteDialog )
+        {
+        TRAP_IGNORE( iProgressNoteDialog->ProcessFinishedL() );
+        // since ProcessFinishedL is called iProgressInfo is not 
+        // valid anymore, set it to NULL
+        iProgressInfo = NULL;
+        }
+
+    __LOG( "CUpnpFileTransferHandler::FinishNotes -end" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::StartLocalMediaServerCompleted
+// Notifies that the Media Server startup has completed.
+// --------------------------------------------------------------------------
+//
+void CUpnpFileTransferHandler::ReserveLocalMSServicesCompleted( TInt aError )
+    {
+    __LOG( "CUpnpFileTransferHandler::ReserveLocalMSServicesCompleted" );
+
+    // If the connection is still good (we did not receive media server
+    // disappear/WLAN disconnect while we were waiting), update the status
+    // code.
+    if( iStatusCode == KErrNone )
+        {
+        iStatusCode = aError;
+        }
+
+    __LOG( "CUpnpFileTransferHandler::ReserveLocalMSServicesCompleted -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::ResolveFileType
+// Resolves the media type of the given file.
+// --------------------------------------------------------------------------
+//
+TUPnPItemType CUpnpFileTransferHandler::ResolveFileType(
+        const TDesC& aFilepath )
+    {
+    __LOG( "CUpnpFileTransferHandler::ResolveFileType" );
+
+    TUPnPItemType itemType = ETypeOther;
+    TRAP_IGNORE( itemType = UPnPCommonUtils::ResolveFileTypeL( aFilepath ) );
+    
+    __LOG( "CUpnpFileTransferHandler::ResolveFileType -end" );
+    
+    return itemType;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::ItemCopiedFromContainer
+// Resolves the media type of the given file.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpFileTransferHandler::ItemCopiedFromContainer()
+    {
+    return iNumCopiedItemFromContainer;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::TransferStarted
+// --------------------------------------------------------------------------
+// 
+void CUpnpFileTransferHandler::TransferStarted( 
+        TInt /*aKey*/,
+        TInt aError )
+    {
+    __LOG1( "CUpnpFileTransferHandler::TransferStarted, %d", aError );
+
+    // Just update the progress Dialog. No need for further error checks,
+    // because in error situations UpnpAvController calls also CopyComplete,
+    // and detailed error check is done there.
+    if( aError == KErrNone &&
+        iProgressInfo )
+        {
+        iCurrentProgressValue = iCurrentProgressValue + iProgressIncrement;
+        iProgressInfo->SetAndDraw( iCurrentProgressValue );
+        }
+    __LOG( "CUpnpFileTransferHandler::TransferStarted -end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::TransferCompleted
+// --------------------------------------------------------------------------
+//    
+void CUpnpFileTransferHandler::TransferCompleted( 
+        TInt /*aKey*/,
+        TInt aError,
+        const TDesC& aFilepath )
+    {
+    __LOG1( "CUpnpFileTransferHandler::TransferCompleted, %d", aError );
+
+    TInt copyError = KErrNone;
+    
+    if( iFileTransferMode == EUpnpCopyRemoteContainerToDefaultLocation ||
+        iFileTransferMode == EUpnpCopyRemotePlaylistToDefaultLocation )
+        {
+        TRAP( copyError, CopyCompleteContainersL( aError, aFilepath ) );
+        }
+    else 
+        {
+        TRAP( copyError, CopyCompleteFilesL( aError, aFilepath ) );
+        }
+    if( copyError != KErrNone )
+        {
+        FinishNotes();
+        }
+    __LOG( "CUpnpFileTransferHandler::TransferCompleted -end");    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpFileTransferHandler::TransferProgress
+// --------------------------------------------------------------------------
+//    
+
+void CUpnpFileTransferHandler::TransferProgress( 
+        TInt /*aKey*/,
+        TInt /*aBytes*/,
+        TInt /*aTotalBytes*/ )
+    {
+    
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/src/upnpnotehandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,272 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the CUpnpNoteHandler class
+*
+*/
+
+
+// INCLUDES
+#include <AknUtils.h>                           // CEikonEnv
+#include <bautils.h>                            // BaflUtils
+#include <eikprogi.h>                           // CEikProgressInfo
+#include <AknWaitDialog.h>                      // CAknWaitDialog
+#include <upnpstring.h>                         // UpnpString
+#include <upnpfiletransferengineresources.rsg>  // Dialog resources
+#include <data_caging_path_literals.hrh>        // KDC_RESOURCE_FILES_DIR
+#include <StringLoader.h>                       // StringLoader
+#include <aknnotewrappers.h>                    // CAknErrorNote
+
+#include "upnpnotehandler.h"
+#include "upnpprogressdialogobserver.h"
+
+_LIT( KComponentLogfile, "filetransferengine.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KResFileName,  "upnpfiletransferengineresources.rsc");
+const TInt KProgressInfoInitialValue = 0;
+
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::NewL
+// NewL.
+// --------------------------------------------------------------------------
+//
+CUpnpNoteHandler* CUpnpNoteHandler::NewL( 
+                                    MUPnPProgressDialogobserver* aObserver )
+    {
+    __LOG( "[UpnpNoteHandler] CUpnpNoteHandler: NewL" );
+
+    CUpnpNoteHandler* self = NULL;
+    self = new (ELeave) CUpnpNoteHandler( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __LOG( "[UpnpNoteHandler] CUpnpNoteHandler: NewL end" );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Constuctor
+// --------------------------------------------------------------------------
+//
+CUpnpNoteHandler::CUpnpNoteHandler( MUPnPProgressDialogobserver* aObserver )
+    {
+    __LOG( "[UpnpNoteHandler] Constructor" );
+    iProgressDialogObserver = aObserver;
+    iProgressNoteFinish = EFalse;
+    __LOG( "[UpnpNoteHandler] Constructor - end" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpNoteHandler::~CUpnpNoteHandler()
+    {
+    __LOG( "[UpnpNoteHandler] Destructor" );
+
+    // Un-load resource file
+    if ( iResFileOffset )
+        {
+        iCoeEnv->DeleteResourceFile( iResFileOffset );
+        iResFileOffset = 0;
+        }
+    __LOG( "[UpnpNoteHandler] Destructor end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ConstructL()
+    {
+    __LOG( "[UpnpNoteHandler] ConstructL" );
+
+    // Leave if UI context is not available
+    iCoeEnv = CEikonEnv::Static(); // Not owned
+    if( !iCoeEnv )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Get the file server session handle
+    RFs fileSession = iCoeEnv->FsSession(); // Not owned
+
+    // Parse the resource file path
+    TParse parse;
+    parse.Set( KResFileName, &KDC_RESOURCE_FILES_DIR, NULL );
+    TFileName rscFileName;
+    rscFileName.Append( parse.FullName() );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive );
+    
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( fileSession, rscFileName ) )
+        {
+        __LOG( "[UpnpNoteHandler] Resource file does not exist!" );
+        User::Leave( KErrNotFound );
+        }
+
+    // Read the resource file offset
+    iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName );
+    __LOG( "[UpnpNoteHandler] ConstructL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::SetValueL
+// Sets the value of the progress note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::SetValue( TInt aProgressValue )
+    {
+    __LOG1( "[UpnpNoteHandler] SetValueL: %d", aProgressValue );
+    __LOG1( "[UpnpNoteHandler] iMaxProgressValue: %d", iMaxProgressValue );
+    // Update the progress value
+    iCurrentProgressValue = aProgressValue;
+    
+    if( iCurrentProgressValue >= 0 && 
+        iCurrentProgressValue <= iMaxProgressValue )
+        {
+        // Re-draw the note
+        if( iProgressInfo && !iProgressNoteFinish )
+            {
+            iProgressInfo->SetAndDraw( iCurrentProgressValue );
+            }    
+        }
+    
+    __LOG( "[UpnpNoteHandler] SetValueL" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::SetValueL
+// Sets the max value of the progress note.
+// --------------------------------------------------------------------------
+//    
+void CUpnpNoteHandler::SetMaxValue( TInt aMaxValue )
+    {
+    __LOG( "[UpnpNoteHandler] SetMaxValue" );
+    iMaxProgressValue = aMaxValue;
+    if( iProgressInfo && !iProgressNoteFinish )
+        {
+        iProgressInfo->SetFinalValue( aMaxValue );        
+        }
+    __LOG( "[UpnpNoteHandler] SetMaxValue end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::DialogDismissedL
+// ProgressDialog call back method. Get's called when a dialog is dismissed.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::DialogDismissedL( TInt aButtonId )
+    {
+    __LOG( "[UpnpNoteHandler] DialogDismissedL" );
+    if( aButtonId == EEikBidCancel )
+        {
+        iProgressDialogObserver->DialogDismissedL();
+        }
+    __LOG( "[UpnpNoteHandler] DialogDismissedL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::RunProgressNoteL
+// Initialises and runs the progress note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::RunProgressNoteL( TUpnpProgressNoteType aNoteType )
+    {
+    __LOG( "[UpnpNoteHandler] RunProgressNoteL()" );
+
+    // Check the status of the note
+    if( iProgressNoteDialog )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // reset the iProgressNote flag
+    iProgressNoteFinish = EFalse;
+
+    // Create the note
+    iProgressNoteDialog = new (ELeave) CAknProgressDialog(
+                          ( REINTERPRET_CAST( CEikDialog**,
+                          &iProgressNoteDialog ) ) );
+
+    // Select correct resource
+    if( aNoteType == EUpnpMoveProgressNote )
+        {
+        iProgressNoteDialog->PrepareLC( R_FT_MOVE_PROGRESS_NOTE_DIALOG );
+        }
+    else
+        {
+        iProgressNoteDialog->PrepareLC( R_FT_COPY_PROGRESS_NOTE_DIALOG );
+        }
+
+    // Set values
+    iProgressNoteDialog->SetCallback( this );
+    iProgressInfo = iProgressNoteDialog->GetProgressInfoL();
+    iCurrentProgressValue = KProgressInfoInitialValue;
+
+    // Draw
+    iProgressInfo->SetAndDraw( iCurrentProgressValue );
+
+    // Run the note
+    iProgressNoteDialog->RunLD();
+    
+    __LOG( "[UpnpNoteHandler] RunProgressNoteL() end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::FinishProgressNote
+// Finishes the progress note.
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::FinishProgressNote()
+    {
+    __LOG( "[UpnpNoteHandler] FinishProgressNote()" );
+    
+    iProgressNoteFinish = ETrue;
+    // If the progress note is running, finish it
+    if( iProgressNoteDialog )
+        {
+        TRAP_IGNORE( iProgressNoteDialog->ProcessFinishedL() );
+        }
+    __LOG( "[UpnpNoteHandler] FinishProgressNote() end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpNoteHandler::ShowSkippingDRMFilesNote
+// Shows 'Skipping DRM protected files.' -note
+// --------------------------------------------------------------------------
+//
+void CUpnpNoteHandler::ShowSkippingDRMFilesNoteL()
+    {
+    __LOG( "[CUpnpNoteHandler] ShowSkippingDRMFilesNote" );
+                   
+    // Load the string, and show the note
+    HBufC* errorText = StringLoader::LoadLC( 
+            R_FT_DRM_FILE_TEXT );
+    CAknInformationNote* errorNote = 
+        new ( ELeave ) CAknInformationNote( ETrue );
+    errorNote->ExecuteLD( *errorText );
+    CleanupStack::PopAndDestroy( errorText );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/src/upnpplaylisthandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,419 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for the CUpnpPlaylistHandler class
+*
+*/
+
+
+// INCLUDES
+#include <bautils.h>                            // CDesCArray
+
+#include "upnpplaylistservices.h"               // CUPnPPlaylistServices
+#include <pathinfo.h>                           // PathInfo
+#include "upnpplaylisthandler.h"                // CUpnpPlaylistHandler
+#include <upnpitem.h>                           // CUpnpItem
+#include "upnpsettingsengine.h"                 // CUpnpSettingsEngine
+
+_LIT( KComponentLogfile, "filetransferengine.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KItemArrayGranularity =  16;
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::NewL
+// NewL.
+// --------------------------------------------------------------------------
+//
+CUpnpPlaylistHandler* CUpnpPlaylistHandler::NewL()
+    {
+    __LOG( "[UpnpPlaylistHandler] CUpnpPlaylistHandler: NewL" );
+
+    CUpnpPlaylistHandler* self = NULL;
+    self = new (ELeave) CUpnpPlaylistHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Constuctor
+// --------------------------------------------------------------------------
+//
+CUpnpPlaylistHandler::CUpnpPlaylistHandler()
+    {
+    __LOG( "[UpnpPlaylistHandler] Constructor" );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpPlaylistHandler::~CUpnpPlaylistHandler()
+    {
+    __LOG( "[UpnpPlaylistHandler] Destructor" );
+
+    // If there are items on the playlists, create the playlists now before
+    // deleting the content
+    
+    delete iPlaylistServices;
+    iPlaylistServices = NULL;
+    
+    if( iPlaylistName )
+        {
+        if( iFilesForAudioPlaylist )
+            {
+            if( iFilesForAudioPlaylist->Count() > 0 )
+                {
+                TRAP_IGNORE( CreateMusicPlaylistL() );
+                }
+            }
+        if( iFilesForVideoAlbum.Count() > 0 )
+            {
+            TRAP_IGNORE( CreateVideoAlbumL() );
+            }
+        if( iFilesForImageAlbum.Count() > 0 )
+            {
+            TRAP_IGNORE( CreateImageAlbumL() );
+            }
+        }
+
+    // Empty and destroy the playlist arrays
+    Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::ConstructL()
+    {
+    __LOG( "[UpnpPlaylistHandler] ConstructL" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::Reset
+// Empties the playlists.
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::Reset()
+    {
+    __LOG( "[UpnpPlaylistHandler] Reset" );
+
+    // Delete the playlist name
+    delete iPlaylistName;
+    iPlaylistName = NULL;
+
+    // Delete the audio playlist item arrays
+    delete iFilesForAudioPlaylist;
+    iFilesForAudioPlaylist = NULL;
+
+    // Delete the video album item array
+    iFilesForVideoAlbum.ResetAndDestroy();
+    iFilesForVideoAlbum.Close();
+
+    // Delete the image album item array
+    iFilesForImageAlbum.ResetAndDestroy();
+    iFilesForImageAlbum.Close();    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::SetPlaylistNameL
+// Sets the name for the playlist
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::SetPlaylistNameL( const TDesC& aPlaylistName )
+    {
+    __LOG( "[UpnpPlaylistHandler] SetPlaylistNameL" );
+    
+    // Check parameter
+    if( aPlaylistName == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // If a playlist name is already provided, delete it and replace with
+    // this new one
+    delete iPlaylistName; iPlaylistName = NULL;
+    iPlaylistName = aPlaylistName.AllocL();
+    }    
+    
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::AddAudioItemL
+// Adds an audio item to the playlist (playlist will not be generated yet, it
+// has to be created by calling a separate method).
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::AddAudioItemL( const TDesC& aFilePath )
+    {
+    __LOG( "[UpnpPlaylistHandler] AddAudioItemL" );
+    
+    // Check parameters
+    if( aFilePath == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // If the item arrays for audio item are not yet created, create them now
+    if( !iFilesForAudioPlaylist )
+        {
+        iFilesForAudioPlaylist = 
+                new (ELeave) CDesCArrayFlat( KItemArrayGranularity );
+        }
+
+    // Add the item information in the arrays
+    iFilesForAudioPlaylist->AppendL( aFilePath );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::AddImageItemL
+// Adds an image item to the playlist (playlist will not be generated yet, it
+// has to be created by calling a separate method).
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::AddImageItemL( const TDesC& aFilePath )
+    {
+    __LOG( "[UpnpPlaylistHandler] AddImageItemL" );
+    
+    // Check parameters
+    if( aFilePath == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Add the item information in the array
+    iFilesForImageAlbum.AppendL( aFilePath.AllocL() );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::AddVideoItemL
+// Adds a video item to the playlist (playlist will not be generated yet, it
+// has to be created by calling a separate method).
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::AddVideoItemL( const TDesC& aFilePath )
+    {
+    __LOG( "[UpnpPlaylistHandler] AddVideoItemL" );
+
+    // Check parameters
+    if( aFilePath == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Add the item information in the array
+    iFilesForVideoAlbum.AppendL( aFilePath.AllocL() );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::AudioItemCount
+// Returns the number of items in the audio item array.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpPlaylistHandler::AudioItemCount()
+    {
+    __LOG( "[UpnpPlaylistHandler] AudioItemCount" );
+    
+    TInt returnValue = 0;
+    if( iFilesForAudioPlaylist )
+        {
+        returnValue = iFilesForAudioPlaylist->Count();
+        }
+
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::ImageItemCount
+// Returns the number of items in the image item array.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpPlaylistHandler::ImageItemCount()
+    {
+    __LOG( "[UpnpPlaylistHandler] ImageItemCount" );
+
+    return iFilesForImageAlbum.Count();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::VideoItemCount
+// Returns the number of items in the video item array.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpPlaylistHandler::VideoItemCount()
+    {
+    __LOG( "[UpnpPlaylistHandler] VideoItemCount" );
+
+    return iFilesForVideoAlbum.Count();
+   }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::CreateMusicPlaylistL
+// Creates a MPX playlist (if there are music items added).
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::CreateMusicPlaylistL()
+    {
+    __LOG( "[UpnpPlaylistHandler] CreateMusicPlaylistL" );
+
+    // Create playlist only if required data exists
+    if( iPlaylistName &&
+        iFilesForAudioPlaylist &&
+        iFilesForAudioPlaylist->Count() > 0 )
+        {
+        TBool location = PlaylistFileLocation();
+        if( location )
+            {
+            if ( !iPlaylistServices )
+                {
+                iPlaylistServices = CUPnPPlaylistServices::NewL();
+                }
+
+            TRAPD( createPlaylistError,
+                  iPlaylistServices->CreatePlaylistL(
+                            *iPlaylistName,
+                            *iFilesForAudioPlaylist,
+                            NULL ) );
+            if( createPlaylistError != KErrNone )
+                {
+                __LOG( "[UpnpPlaylistHandler] Failed to create a \
+playlist!" );
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::CreateImageAlbumL
+// Creates an image album (if there are image items added).
+// Not in use in upnp 2.1
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::CreateImageAlbumL()
+    {
+    __LOG( "[UpnpPlaylistHandler] CreateImageAlbumL" );
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::CreateVideoAlbumL
+// Creates a video album (if there are video items added).
+// Not in use in upnp 2.1
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::CreateVideoAlbumL()
+    {
+    __LOG( "[UpnpPlaylistHandler] CreateVideoAlbumL" );
+     
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::PlaylistFileLocation
+// Checks that Playlist location is valid.
+// --------------------------------------------------------------------------
+//
+TBool CUpnpPlaylistHandler::PlaylistFileLocation()
+    {
+    __LOG( "[UpnpPlaylistHandler] PlaylistFileLocation" );
+
+    TBool returnValue = EFalse;
+    TInt error = KErrGeneral; 
+    TParse parse;
+    TDriveNumber defauldrive;
+    
+    // Default download drive
+    TRAP( error,
+        CUPnPSettingsEngine* engine = CUPnPSettingsEngine::NewLC();
+        engine->GetCopyLocationDriveL( defauldrive );
+        CleanupStack::PopAndDestroy( engine );
+        );
+       
+    // Playlist location
+    if( error == KErrNone )
+        {   
+        // There are audio files on the playlist
+        if( iFilesForAudioPlaylist &&
+            iFilesForAudioPlaylist->Count() > 0 )
+            {
+            error = parse.Set( iFilesForAudioPlaylist->MdcaPoint(0), 
+                                NULL, NULL );
+            }
+
+        // There are image files on the playlist
+        else if( iFilesForImageAlbum.Count() > 0 )
+            {    
+            error = parse.Set( *iFilesForImageAlbum[0], NULL, NULL );
+            }
+
+        // There are video files on the playlist
+        else if( iFilesForVideoAlbum.Count() > 0 )
+            {
+            error = parse.Set( *iFilesForVideoAlbum[0], NULL, NULL );
+            }
+        else
+            {
+            // error code is already set
+            }
+        } 
+        
+    // Playlist must be located to default download drive    
+    if( error == KErrNone )
+        {
+        TPtrC drive = parse.Drive();
+        TDriveUnit driveUnit = TDriveUnit( drive );
+        TDriveNumber playlistdrive = (TDriveNumber)((TInt)driveUnit);
+ 
+        if( playlistdrive == defauldrive )
+            {
+            returnValue = ETrue;
+            }
+        }   
+        
+    __LOG1( "[UpnpPlaylistHandler] PlaylistFileLocation %d end", returnValue );  
+    
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPlaylistHandler::NotifyNewAudioFileL
+// Notifies MPX of a new audio file.
+// --------------------------------------------------------------------------
+//
+void CUpnpPlaylistHandler::NotifyNewAudioFileL(
+                                            const TDesC& aFilePath,
+                                            const CUpnpItem& aMetadata )
+    {
+    __LOG( "[UpnpPlaylistHandler] NotifyNewAudioFileL" );
+
+    if( aFilePath == KNullDesC )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    if ( !iPlaylistServices )
+        {
+        iPlaylistServices = CUPnPPlaylistServices::NewL();
+        }
+
+    TRAPD( notifyError,
+        iPlaylistServices->CreateTrackL( aFilePath, aMetadata ) );
+    if ( notifyError != KErrNone )
+        {
+        __LOG( "[UpnpPlaylistHandler] Failed to notify audio track" );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpfiletransferengine/src/upnpuploadhandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,529 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the CUpnpUploadHandler class
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <AknUtils.h>                           // CEikonEnv
+#include <bautils.h>                            // BaflUtils
+
+// upnpframework / avcontroller api
+#include "upnpavcontrollerfactory.h"            // UPnPAVControllerFactory
+#include "upnpavcontroller.h"                   // MUPnPAVController
+#include "upnpavbrowsingsession.h"              // MUPnPAVBrowsingSession
+#include "upnpfileuploadsession.h"              // MUPnPFileDownloadSession
+
+// upnpframework / avcontroller helper api
+#include "upnpfileutility.h"                    // IsFileProtectedL()
+
+// filetransferengine internal
+#include "upnpnotehandler.h"                 
+#include "upnpuploadhandler.h"
+
+
+_LIT( KComponentLogfile, "filetransferengine.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KZero =                      0;   
+const TInt KProgressBaseValue =         100;
+
+const TInt KUploadItemValue =           1;
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::NewL
+// NewL.
+// --------------------------------------------------------------------------
+//
+CUpnpUploadHandler* CUpnpUploadHandler::NewL(
+                            MUPnPAVBrowsingSession* aBrowsingSession )
+    {
+    __LOG( "[CUpnpUploadHandler] CUpnpUploadHandler: NewL" );
+
+    // Check that the browsing session is valid and has target device set.
+    if( !aBrowsingSession )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CUpnpUploadHandler* self = NULL;
+    self = new (ELeave) CUpnpUploadHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL( aBrowsingSession );
+    CleanupStack::Pop( self );
+    __LOG( "[CUpnpUploadHandler] CUpnpUploadHandler: NewL end" );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Constuctor
+// --------------------------------------------------------------------------
+//
+CUpnpUploadHandler::CUpnpUploadHandler()
+    : CAsyncOneShot( EPriorityStandard )
+    {
+    __LOG( "[CUpnpUploadHandler] Constructor" );
+    iUploadFirst = ETrue;
+    iCopiedFileStillInArray = EFalse; 
+    iDrmFilesSkipped = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpUploadHandler::~CUpnpUploadHandler()
+    {
+    __LOG( "[CUpnpUploadHandler] Destructor" );
+
+    // If upload session is running, stop it
+    if( iAvController &&
+         iUploadSession)
+        {
+        iAvController->StopUploadSession( *iUploadSession );
+        }
+
+    // Delete the note handler.
+    delete iNoteHandler;
+
+    // delete the UpnpAvControllerClient
+    delete iAvController;
+    
+    TInt i = 0;
+    while( i < iObjectsToCopy->Count() )
+        {
+        if( (*iObjectsToCopy)[i] == NULL )
+            {
+            iObjectsToCopy->Remove( i );
+            }
+        else
+            {
+            i++;
+            }    
+        }
+    
+    __LOG1( "[CUpnpUploadHandler] copied %d", iTotalCount-iObjectsToCopy->Count() );
+    iObjectsToCopy->Compress();
+    __LOG( "[CUpnpUploadHandler] Destructor end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::ConstructL
+// Second phase constructor
+// --------------------------------------------------------------------------
+//
+void CUpnpUploadHandler::ConstructL(
+                             MUPnPAVBrowsingSession* aBrowsingSession )
+    {
+    __LOG( "[CUpnpUploadHandler] ConstructL" );
+
+    if( !aBrowsingSession )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Leave if UI context is not available
+    iCoeEnv = CEikonEnv::Static(); // Not owned
+    if( !iCoeEnv )
+        {
+        User::Leave( KErrNotSupported );
+        }
+        
+        
+    // Store the browsing session
+    iBrowsingSession = aBrowsingSession;
+
+    // Create UpnpAvControllerClient
+    iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL();
+
+    // Create upload session
+    iUploadSession = &iAvController->StartUploadSessionL(
+                                            iBrowsingSession->Device() );
+
+    // Set this object to be the upload session observer
+    iUploadSession->SetObserver( *this );
+
+    iNoteHandler = CUpnpNoteHandler::NewL( this );
+    __LOG( "[CUpnpUploadHandler] ConstructL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::UploadItemsL
+// Uploads the given objects to the remote server
+// (setting in the Home Media application).
+// --------------------------------------------------------------------------
+//
+void CUpnpUploadHandler::UploadItemsL( RPointerArray<TDesC16>* aObjectIds,
+                                       TUpnpFileUploadMode aFileUploadMode )
+    {
+    __LOG( "[CUpnpUploadHandler] UploadItemsL" );
+    // Check parameter
+    if( aObjectIds->Count() <= 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    iUploadMode = aFileUploadMode;
+    iObjectsToCopy = aObjectIds;
+    
+    iTotalCount = iObjectsToCopy->Count();
+
+    // Initialise values
+    iCopyPosition = -1;
+    iCopyCompleteness = KZero;
+    iCopiedFileStillInArray = EFalse;
+    
+    iStatusCode = KErrNone;
+   
+    // Start uploading the objects
+    TRAP( iStatusCode, StartUploadL() );
+
+    if( iStatusCode == KErrNone )
+        {
+        if( iUploadMode == EUpnpMove )
+            {
+            iNoteHandler->RunProgressNoteL( EUpnpMoveProgressNote );
+            }
+        else
+            {
+            iNoteHandler->RunProgressNoteL( EUpnpCopyProgressNote );
+            }
+        }
+    
+     /**
+     * If the user cancels the copy there might be a situation 
+     * where the file has just been uploaded successful but the 
+     * TransferComplete is not called. 
+     * In this case we need to delete that file from iObjectsToCopy.
+     */
+
+    if ( iStatusCode == KErrCancel )
+        {
+        if( iCopiedFileStillInArray )
+            {                                           
+            delete (*iObjectsToCopy)[iUploadItems];
+            (*iObjectsToCopy)[iUploadItems] = NULL;  
+            
+            }
+        }    
+       
+    
+    // Leave if there was an error
+    if( iStatusCode != KErrNone )
+        {
+        __LOG1( "[CUpnpUploadHandler] UploadItemsL leave %d", iStatusCode );
+        User::Leave( iStatusCode );
+        }
+    
+     
+    __LOG( "[CUpnpUploadHandler] UploadItemsL end" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::UploadPlayListL
+// Uploads the given playlist to the remote server
+// (setting in the Home Media application).
+// --------------------------------------------------------------------------
+//
+void CUpnpUploadHandler::UploadPlayListL(
+                                     const TDesC& /*aPlaylistName*/,
+                                     RPointerArray<TDesC16>* aObjectPaths,
+                                     TUpnpFileUploadMode aFileUploadMode )
+    {
+    __LOG( "[CUpnpUploadHandler] UploadPlayListL" );
+    UploadItemsL( aObjectPaths, aFileUploadMode );
+    __LOG( "[CUpnpUploadHandler] UploadPlayListL end" );    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::DialogDismissedL
+// ProgressDialog call back method. Get's called when a dialog is
+// dismissed.
+// --------------------------------------------------------------------------
+//
+void CUpnpUploadHandler::DialogDismissedL( )
+    {
+    __LOG( "[UpnpDownloadHandler] DialogDismissedL" );
+    // Update the status code
+    if( iStatusCode == KErrNone )
+        {
+        iStatusCode = KErrCancel;
+        }
+    
+    iUploadSession->CancelAllTransfers();
+    __LOG( "[UpnpDownloadHandler] DialogDismissedL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::MediaServerDisappeared
+// --------------------------------------------------------------------------
+//    
+void CUpnpUploadHandler::MediaServerDisappeared( 
+                                    TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG( "[UpnpDownloadHandler]\t MediaServerDisappeared()" );
+
+    // Update the status code
+    if( aReason == EDisconnected )
+        {
+        iStatusCode = KErrSessionClosed;
+        }
+    else if( aReason == EWLANLost )
+        {
+        iStatusCode = KErrDisconnected;
+        }
+    else
+        {
+        iStatusCode = KErrUnknown;
+        }
+
+    // Finish the progress note
+    iNoteHandler->FinishProgressNote();
+    
+    __LOG( "[UpnpDownloadHandler]\t MediaServerDisappeared() end" );
+    }
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::TransferStarted
+// --------------------------------------------------------------------------
+//
+void CUpnpUploadHandler::TransferStarted( TInt aKey, TInt aStatus )
+    {
+    __LOG1( "[CUpnpUploadHandler] TransferStarted() aKey %d", aKey );
+    
+    if( !iProgressBarMaxValueSet )
+        {
+        iNoteHandler->SetMaxValue( iTotalCount * KProgressBaseValue );
+        iProgressBarMaxValueSet = ETrue;
+        }
+    
+    
+    if( aStatus != KErrNone)
+        {
+        iStatusCode = aStatus;    
+        }
+    else if( aKey < 0 || aKey > iCopyPosition )
+        {
+        iStatusCode = KErrGeneral;
+        }
+    
+    if( KErrNone != iStatusCode )
+        {
+        iNoteHandler->FinishProgressNote();    
+        }
+    else
+        {
+        TRAP_IGNORE( iUploadSession->StartTrackingProgressL( aKey ) );    
+        }     
+    __LOG( "[CUpnpUploadHandler] TransferStarted() end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::TransferCompleted
+// --------------------------------------------------------------------------
+//
+void CUpnpUploadHandler::TransferCompleted( TInt aKey,
+                                            TInt aStatus,
+                                            const TDesC& /*aFilePath*/ )
+    {
+    __LOG( "[CUpnpUploadHandler] TransferCompleted()" );
+    __LOG1( "[CUpnpUploadHandler] aKey %d", aKey );
+    __LOG1( "[CUpnpUploadHandler] aStatus %d", aStatus );
+    __LOG1( "[CUpnpUploadHandler] iTotalCount %d", iTotalCount );
+        
+    iStatusCode = aStatus;    
+    iUploadItems++;
+    
+    __LOG1( "[CUpnpUploadHandler] iUploadItems %d", iUploadItems );
+    
+    if( KErrNone == iStatusCode && iObjectsToCopy->Count() > 0 ) 
+        {
+        if( iUploadMode == EUpnpMove )
+            {
+            __LOG( "Deleting file..." );
+            TInt deleteError = BaflUtils::DeleteFile( 
+                                            iCoeEnv->FsSession(),
+                                            *(*iObjectsToCopy)[aKey] );
+            if( deleteError != KErrNone )
+            {
+            __LOG( "Failed to delete file!");
+            }
+            }
+        delete (*iObjectsToCopy)[aKey];
+        (*iObjectsToCopy)[aKey] = NULL;
+        iCopiedFileStillInArray = EFalse;
+        // Update the download completeness percentage value
+        iCopyCompleteness = KProgressBaseValue * iUploadItems;
+
+        // Update the progress note
+        iNoteHandler->SetValue( iCopyCompleteness );
+        }
+    
+    if( KErrNone != iStatusCode || 
+      ( aKey < 0 || aKey > iCopyPosition ) || 
+        iTotalCount <= iUploadItems )
+        {
+        iNoteHandler->FinishProgressNote();    
+        }
+    else if( --iUploadIndex <=0 )
+        {
+        TRAPD( error, StartUploadL() );
+        if( error != KErrNone )
+            {
+            iStatusCode = error;
+            iNoteHandler->FinishProgressNote(); 
+            }
+        }
+    __LOG( "[CUpnpUploadHandler] TransferCompleted() end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::TransferProgress
+// --------------------------------------------------------------------------
+//
+void CUpnpUploadHandler::TransferProgress( TInt aKey,
+                                           TInt aBytes,
+                                           TInt aTotalBytes )
+    {
+    __LOG1( "[CUpnpUploadHandler] TransferProgress() aKey %d", aKey );
+    __LOG1( "[CUpnpUploadHandler] TransferProgress() iCopyPosition %d", iCopyPosition );
+    if( aKey < 0 || aKey > iCopyPosition )
+        {
+        iStatusCode = KErrGeneral;
+        iNoteHandler->FinishProgressNote();
+        }
+    else
+        {
+        float progress = ((float)aBytes / aTotalBytes) * 100;
+     
+        if( aBytes == aTotalBytes )
+            { 
+            iCopiedFileStillInArray = ETrue;
+            }
+        
+        iNoteHandler->SetValue( iCopyCompleteness + (TInt)progress);    
+        }    
+    __LOG( "[CUpnpUploadHandler] TransferProgress() -end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::StartUploadL
+// Starts the next upload. Leaves (KErrCompletion) if there are no more
+// objects to upload.
+// --------------------------------------------------------------------------
+//
+void CUpnpUploadHandler::StartUploadL()
+    {
+    __LOG( "[CUpnpUploadHandler] StartUploadL()" );
+    
+    TInt error = KErrNone;
+     
+    if( iUploadFirst )
+        {
+        iUploadIndex = 1;
+        iUploadFirst = EFalse;
+        }
+    else
+        {
+        iUploadIndex = iTotalCount - iUploadItems;
+    
+        if( iUploadIndex > KUploadItemValue )
+            {
+            iUploadIndex = KUploadItemValue;
+            }
+        else if( iUploadIndex <= 0 )
+            {
+            //copy is fininshed
+            iStatusCode = error;
+            iNoteHandler->FinishProgressNote();
+            return;
+            }    
+        }
+
+    for( TInt i = 0; i< iUploadIndex; i++ )
+        {
+        iCopyPosition++;
+        
+        TBool isDrmProtected = ETrue;
+        TRAP( error, isDrmProtected = UPnPFileUtility::IsFileProtectedL( *(*iObjectsToCopy)[ iCopyPosition ] ) );
+
+        if( error == KErrNone && isDrmProtected == EFalse)
+            {
+            TRAP( error, iUploadSession->StartUploadL( 
+                                    *(*iObjectsToCopy)[ iCopyPosition ],
+                                    iCopyPosition ) );
+            }
+        
+        // If parsing or sending the download action failed, exit
+        if( error != KErrNone )
+            {
+            iUploadSession->CancelAllTransfers();  
+            iStatusCode = error;
+            i = iTotalCount;
+            iNoteHandler->FinishProgressNote();
+            } 
+        else if( isDrmProtected )
+            {
+            __LOG( "[CUpnpUploadHandler] StartUploadL() drm file, start timer" );
+            // show note only once if there is several drm protected files
+            if( !iDrmFilesSkipped )
+                {
+                TRAP_IGNORE( iNoteHandler->ShowSkippingDRMFilesNoteL() );
+                iDrmFilesSkipped = ETrue;
+                }
+             
+            // start timer to process next file   
+            Call();             
+            }
+        }
+    __LOG( "[CUpnpUploadHandler] StartUploadL() end" );
+    }
+
+
+
+
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::RunL
+// --------------------------------------------------------------------------
+void CUpnpUploadHandler::RunL()
+    {
+    __LOG( "CUpnpUploadHandler::RunL" );
+    
+    iUploadItems++;
+    
+    if( --iUploadIndex <=0 )
+        {
+        StartUploadL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUploadHandler::RunError
+// --------------------------------------------------------------------------
+TInt CUpnpUploadHandler::RunError( TInt aError )
+    {
+    __LOG1( "CUpnpUploadHandler::RunError %d", aError );
+    iUploadSession->CancelAllTransfers();  
+    iStatusCode = aError;
+    iNoteHandler->FinishProgressNote();
+    
+    return KErrNone;
+    }   
+    
+  
+        
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/BWINS/upnpmusicadapterU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,35 @@
+EXPORTS
+	??1CUPnPBrowsePlaylistFiller@@UAE@XZ @ 1 NONAME ; CUPnPBrowsePlaylistFiller::~CUPnPBrowsePlaylistFiller(void)
+	??1CUPnPMusicAdapter@@UAE@XZ @ 2 NONAME ; CUPnPMusicAdapter::~CUPnPMusicAdapter(void)
+	??1CUPnPPlayListFiller@@UAE@XZ @ 3 NONAME ; CUPnPPlayListFiller::~CUPnPPlayListFiller(void)
+	??1CUPnPPlaylistServices@@UAE@XZ @ 4 NONAME ; CUPnPPlaylistServices::~CUPnPPlaylistServices(void)
+	?AddMediaToPlaylistL@CUPnPPlaylistServices@@QAEXABVTDesC16@@0@Z @ 5 NONAME ; void CUPnPPlaylistServices::AddMediaToPlaylistL(class TDesC16 const &, class TDesC16 const &)
+	?CreatePlaylistL@CUPnPPlaylistServices@@QAEXABVTDesC16@@ABVMDesC16Array@@PAVTDes16@@@Z @ 6 NONAME ; void CUPnPPlaylistServices::CreatePlaylistL(class TDesC16 const &, class MDesC16Array const &, class TDes16 *)
+	?CreateTrackL@CUPnPPlaylistServices@@QAEXABVTDesC16@@ABVCUpnpItem@@@Z @ 7 NONAME ; void CUPnPPlaylistServices::CreateTrackL(class TDesC16 const &, class CUpnpItem const &)
+	?DeletePlaylistL@CUPnPPlaylistServices@@QAEXABVTDesC16@@@Z @ 8 NONAME ; void CUPnPPlaylistServices::DeletePlaylistL(class TDesC16 const &)
+	?DeleteTrackL@CUPnPPlaylistServices@@QAEXABVTDesC16@@@Z @ 9 NONAME ; void CUPnPPlaylistServices::DeleteTrackL(class TDesC16 const &)
+	?Dismiss@CUPnPMusicAdapter@@QAEXH@Z @ 10 NONAME ; void CUPnPMusicAdapter::Dismiss(int)
+	?ExecuteMusicInLocalL@CUPnPMusicAdapter@@QAEHPAVCEikAppUi@@PAVCUPnPPlayListFiller@@@Z @ 11 NONAME ; int CUPnPMusicAdapter::ExecuteMusicInLocalL(class CEikAppUi *, class CUPnPPlayListFiller *)
+	?ExecuteMusicInRemoteL@CUPnPMusicAdapter@@QAEHPAVCEikAppUi@@PAVCUPnPPlayListFiller@@ABVCUpnpAVDevice@@@Z @ 12 NONAME ; int CUPnPMusicAdapter::ExecuteMusicInRemoteL(class CEikAppUi *, class CUPnPPlayListFiller *, class CUpnpAVDevice const &)
+	?InsertObjectL@CUPnPPlayListFiller@@QAEXABVCUpnpAVDevice@@ABVCUpnpObject@@@Z @ 13 NONAME ; void CUPnPPlayListFiller::InsertObjectL(class CUpnpAVDevice const &, class CUpnpObject const &)
+	?IsValidPlaylistL@CUPnPPlaylistServices@@QAEHABVTDesC16@@@Z @ 14 NONAME ; int CUPnPPlaylistServices::IsValidPlaylistL(class TDesC16 const &)
+	?IsValidTrackL@CUPnPPlaylistServices@@QAEHABVTDesC16@@@Z @ 15 NONAME ; int CUPnPPlaylistServices::IsValidTrackL(class TDesC16 const &)
+	?ListPlaylistsL@CUPnPPlaylistServices@@QAEXAAVCDesC16Array@@0@Z @ 16 NONAME ; void CUPnPPlaylistServices::ListPlaylistsL(class CDesC16Array &, class CDesC16Array &)
+	?NewL@CUPnPBrowsePlaylistFiller@@SAPAV1@ABVTDesC8@@HH@Z @ 17 NONAME ; class CUPnPBrowsePlaylistFiller * CUPnPBrowsePlaylistFiller::NewL(class TDesC8 const &, int, int)
+	?NewL@CUPnPMusicAdapter@@SAPAV1@AAVMUPnPAVController@@@Z @ 18 NONAME ; class CUPnPMusicAdapter * CUPnPMusicAdapter::NewL(class MUPnPAVController &)
+	?NewL@CUPnPPlayListFiller@@SAPAV1@XZ @ 19 NONAME ; class CUPnPPlayListFiller * CUPnPPlayListFiller::NewL(void)
+	?NewL@CUPnPPlaylistServices@@SAPAV1@XZ @ 20 NONAME ; class CUPnPPlaylistServices * CUPnPPlaylistServices::NewL(void)
+	?OpenPlaylistL@CUPnPPlaylistServices@@QAEXABVTDesC16@@AAVCDesC16Array@@@Z @ 21 NONAME ; void CUPnPPlaylistServices::OpenPlaylistL(class TDesC16 const &, class CDesC16Array &)
+	?SetSelectedIndex@CUPnPPlayListFiller@@QAEXH@Z @ 22 NONAME ; void CUPnPPlayListFiller::SetSelectedIndex(int)
+	??1CUPnPAlbumServices@@UAE@XZ @ 23 NONAME ; CUPnPAlbumServices::~CUPnPAlbumServices(void)
+	?IsValidAlbumL@CUPnPAlbumServices@@QAEHABVTDesC16@@@Z @ 24 NONAME ; int CUPnPAlbumServices::IsValidAlbumL(class TDesC16 const &)
+	?ListAlbumsL@CUPnPAlbumServices@@QAEXAAVCDesC16Array@@0@Z @ 25 NONAME ; void CUPnPAlbumServices::ListAlbumsL(class CDesC16Array &, class CDesC16Array &)
+	?NewL@CUPnPAlbumServices@@SAPAV1@XZ @ 26 NONAME ; class CUPnPAlbumServices * CUPnPAlbumServices::NewL(void)
+	?OpenAlbumL@CUPnPAlbumServices@@QAEXABVTDesC16@@AAVCDesC16Array@@@Z @ 27 NONAME ; void CUPnPAlbumServices::OpenAlbumL(class TDesC16 const &, class CDesC16Array &)
+	??1CUPnPLiteFiller@@UAE@XZ @ 28 NONAME ; CUPnPLiteFiller::~CUPnPLiteFiller(void)
+	??1CUPnPLiteSelectionFiller@@UAE@XZ @ 29 NONAME ; CUPnPLiteSelectionFiller::~CUPnPLiteSelectionFiller(void)
+	?ExecuteMusicLiteInLocalL@CUPnPMusicAdapter@@QAEHPAVCEikAppUi@@PAVMUPnPPlaylistFiller@@@Z @ 30 NONAME ; int CUPnPMusicAdapter::ExecuteMusicLiteInLocalL(class CEikAppUi *, class MUPnPPlaylistFiller *)
+	?ExecuteMusicLiteInRemoteL@CUPnPMusicAdapter@@QAEHPAVCEikAppUi@@PAVMUPnPPlaylistFiller@@ABVCUpnpAVDevice@@@Z @ 31 NONAME ; int CUPnPMusicAdapter::ExecuteMusicLiteInRemoteL(class CEikAppUi *, class MUPnPPlaylistFiller *, class CUpnpAVDevice const &)
+	?NewL@CUPnPLiteSelectionFiller@@SAPAV1@ABV?$RPointerArray@VCUpnpObjectLite@@@@ABVCUpnpAVDevice@@@Z @ 32 NONAME ; class CUPnPLiteSelectionFiller * CUPnPLiteSelectionFiller::NewL(class RPointerArray<class CUpnpObjectLite> const &, class CUpnpAVDevice const &)
+	?SetSelectedIndex@CUPnPLiteFiller@@QAEXH@Z @ 33 NONAME ; void CUPnPLiteFiller::SetSelectedIndex(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/EABI/upnpmusicadapterU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,75 @@
+EXPORTS
+	_ZN17CUPnPMusicAdapter20ExecuteMusicInLocalLEP9CEikAppUiP19CUPnPPlayListFiller @ 1 NONAME
+	_ZN17CUPnPMusicAdapter21ExecuteMusicInRemoteLEP9CEikAppUiP19CUPnPPlayListFillerRK13CUpnpAVDevice @ 2 NONAME
+	_ZN17CUPnPMusicAdapter4NewLER17MUPnPAVController @ 3 NONAME
+	_ZN17CUPnPMusicAdapter7DismissEi @ 4 NONAME
+	_ZN17CUPnPMusicAdapterD0Ev @ 5 NONAME
+	_ZN17CUPnPMusicAdapterD1Ev @ 6 NONAME
+	_ZN17CUPnPMusicAdapterD2Ev @ 7 NONAME
+	_ZN19CUPnPPlayListFiller13InsertObjectLERK13CUpnpAVDeviceRK11CUpnpObject @ 8 NONAME
+	_ZN19CUPnPPlayListFiller16SetSelectedIndexEi @ 9 NONAME
+	_ZN19CUPnPPlayListFiller4NewLEv @ 10 NONAME
+	_ZN19CUPnPPlayListFillerD0Ev @ 11 NONAME
+	_ZN19CUPnPPlayListFillerD1Ev @ 12 NONAME
+	_ZN19CUPnPPlayListFillerD2Ev @ 13 NONAME
+	_ZN21CUPnPPlaylistServices12CreateTrackLERK7TDesC16RK9CUpnpItem @ 14 NONAME
+	_ZN21CUPnPPlaylistServices12DeleteTrackLERK7TDesC16 @ 15 NONAME
+	_ZN21CUPnPPlaylistServices13IsValidTrackLERK7TDesC16 @ 16 NONAME
+	_ZN21CUPnPPlaylistServices13OpenPlaylistLERK7TDesC16R12CDesC16Array @ 17 NONAME
+	_ZN21CUPnPPlaylistServices14ListPlaylistsLER12CDesC16ArrayS1_ @ 18 NONAME
+	_ZN21CUPnPPlaylistServices15CreatePlaylistLERK7TDesC16RK12MDesC16ArrayP6TDes16 @ 19 NONAME
+	_ZN21CUPnPPlaylistServices15DeletePlaylistLERK7TDesC16 @ 20 NONAME
+	_ZN21CUPnPPlaylistServices16IsValidPlaylistLERK7TDesC16 @ 21 NONAME
+	_ZN21CUPnPPlaylistServices19AddMediaToPlaylistLERK7TDesC16S2_ @ 22 NONAME
+	_ZN21CUPnPPlaylistServices4NewLEv @ 23 NONAME
+	_ZN21CUPnPPlaylistServicesD0Ev @ 24 NONAME
+	_ZN21CUPnPPlaylistServicesD1Ev @ 25 NONAME
+	_ZN21CUPnPPlaylistServicesD2Ev @ 26 NONAME
+	_ZN25CUPnPBrowsePlaylistFiller4NewLERK6TDesC8ii @ 27 NONAME
+	_ZN25CUPnPBrowsePlaylistFillerD0Ev @ 28 NONAME
+	_ZN25CUPnPBrowsePlaylistFillerD1Ev @ 29 NONAME
+	_ZN25CUPnPBrowsePlaylistFillerD2Ev @ 30 NONAME
+	_ZTI17CUPnPMusicAdapter @ 31 NONAME ; #<TI>#
+	_ZTI19CUPnPPlayListFiller @ 32 NONAME ; #<TI>#
+	_ZTI21CUPnPPlaylistServices @ 33 NONAME ; #<TI>#
+	_ZTI25CUPnPBrowsePlaylistFiller @ 34 NONAME ; #<TI>#
+	_ZTV17CUPnPMusicAdapter @ 35 NONAME ; #<VT>#
+	_ZTV19CUPnPPlayListFiller @ 36 NONAME ; #<VT>#
+	_ZTV21CUPnPPlaylistServices @ 37 NONAME ; #<VT>#
+	_ZTV25CUPnPBrowsePlaylistFiller @ 38 NONAME ; #<VT>#
+	_ZTI14CUPnPMpxHelper @ 39 NONAME ; #<TI>#
+	_ZTV14CUPnPMpxHelper @ 40 NONAME ; #<VT>#
+	_ZThn4_N19CUPnPPlayListFillerD0Ev @ 41 NONAME ; #<thunk>#
+	_ZThn4_N19CUPnPPlayListFillerD1Ev @ 42 NONAME ; #<thunk>#
+	_ZThn4_N25CUPnPBrowsePlaylistFillerD0Ev @ 43 NONAME ; #<thunk>#
+	_ZThn4_N25CUPnPBrowsePlaylistFillerD1Ev @ 44 NONAME ; #<thunk>#
+	_ZN18CUPnPAlbumServices10OpenAlbumLERK7TDesC16R12CDesC16Array @ 45 NONAME
+	_ZN18CUPnPAlbumServices11ListAlbumsLER12CDesC16ArrayS1_ @ 46 NONAME
+	_ZN18CUPnPAlbumServices13IsValidAlbumLERK7TDesC16 @ 47 NONAME
+	_ZN18CUPnPAlbumServices4NewLEv @ 48 NONAME
+	_ZN18CUPnPAlbumServicesD0Ev @ 49 NONAME
+	_ZN18CUPnPAlbumServicesD1Ev @ 50 NONAME
+	_ZN18CUPnPAlbumServicesD2Ev @ 51 NONAME
+	_ZTI18CUPnPAlbumServices @ 52 NONAME ; #<TI>#
+	_ZTV18CUPnPAlbumServices @ 53 NONAME ; #<VT>#
+	_ZN15CUPnPLiteFiller16SetSelectedIndexEi @ 54 NONAME
+	_ZN15CUPnPLiteFillerD0Ev @ 55 NONAME
+	_ZN15CUPnPLiteFillerD1Ev @ 56 NONAME
+	_ZN15CUPnPLiteFillerD2Ev @ 57 NONAME
+	_ZN17CUPnPMusicAdapter24ExecuteMusicLiteInLocalLEP9CEikAppUiP19MUPnPPlaylistFiller @ 58 NONAME
+	_ZN17CUPnPMusicAdapter25ExecuteMusicLiteInRemoteLEP9CEikAppUiP19MUPnPPlaylistFillerRK13CUpnpAVDevice @ 59 NONAME
+	_ZN24CUPnPLiteSelectionFiller4NewLERK13RPointerArrayI15CUpnpObjectLiteERK13CUpnpAVDevice @ 60 NONAME
+	_ZN24CUPnPLiteSelectionFillerD0Ev @ 61 NONAME
+	_ZN24CUPnPLiteSelectionFillerD1Ev @ 62 NONAME
+	_ZN24CUPnPLiteSelectionFillerD2Ev @ 63 NONAME
+	_ZTI15CUPnPLiteFiller @ 64 NONAME ; #<TI>#
+	_ZTI24CUPnPLiteSelectionFiller @ 65 NONAME ; #<TI>#
+	_ZTV15CUPnPLiteFiller @ 66 NONAME ; #<VT>#
+	_ZTV24CUPnPLiteSelectionFiller @ 67 NONAME ; #<VT>#
+	_ZThn4_N15CUPnPLiteFillerD0Ev @ 68 NONAME ; #<thunk>#
+	_ZThn4_N15CUPnPLiteFillerD1Ev @ 69 NONAME ; #<thunk>#
+	_ZThn4_N24CUPnPLiteSelectionFillerD0Ev @ 70 NONAME ; #<thunk>#
+	_ZThn4_N24CUPnPLiteSelectionFillerD1Ev @ 71 NONAME ; #<thunk>#
+	_ZTI16CUPnPBrowseTimer @ 72 NONAME ; #<TI>#
+	_ZTV16CUPnPBrowseTimer @ 73 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for UPnPMusicAdapter
+*
+*/
+
+
+PRJ_PLATFORMS
+WINSCW ARMV5
+
+PRJ_EXPORTS
+../inc/upnpalbumservices.h           |../../../inc/upnpalbumservices.h
+../inc/upnpbrowseplaylistfiller.h    |../../../inc/upnpbrowseplaylistfiller.h
+../inc/upnpbrowsetimer.h             |../../../inc/upnpbrowsetimer.h
+../inc/upnplitefiller.h              |../../../inc/upnplitefiller.h
+../inc/upnpliteselectionfiller.h     |../../../inc/upnpliteselectionfiller.h
+../inc/upnpmusicadapter.h            |../../../inc/upnpmusicadapter.h
+../inc/upnpplaylistfiller.h          |../../../inc/upnpplaylistfiller.h
+../inc/upnpplaylistservices.h        |../../../inc/upnpplaylistservices.h
+
+PRJ_MMPFILES
+upnpmusicadapter.mmp
+
+PRJ_TESTMMPFILES
+// None
+
+PRJ_TESTEXPORTS
+// None
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/group/upnpmusicadapter.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Adapts music playing features to UPnP FW
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET          upnpmusicadapter.dll
+TARGETTYPE      DLL
+UID             0x1000008D 0x200075D4
+
+// Platform security
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+MACRO           __RD_MPX_ERROR_HANDLING_V2
+
+// Sources
+SOURCEPATH      ../src
+SOURCE          upnpmusicadapter.cpp
+SOURCE          upnpplaylistfiller.cpp
+SOURCE          upnpbrowseplaylistfiller.cpp
+SOURCE          upnpplaylistservices.cpp
+SOURCE          upnpmpxhelper.cpp
+SOURCE          upnpalbumservices.cpp
+SOURCE          upnplitefiller.cpp
+SOURCE          upnpliteselectionfiller.cpp
+SOURCE          upnpbrowsetimer.cpp
+
+// Include paths
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../../upnputilities/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// System libraries
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         estor.lib
+LIBRARY         cone.lib
+LIBRARY         inetprotutil.lib // EscapeUtils / string conversion methods
+DEBUGLIBRARY    flogger.lib
+
+// S60 UPnP stack
+LIBRARY         upnpavobjects.lib
+
+// UPnP framework
+LIBRARY         upnpavcontrollerclient.lib
+LIBRARY         upnpavcontrollerhelper.lib
+LIBRARY         upnpxmlparser.lib
+LIBRARY         upnpsettingsengine.lib
+
+// MPX framework
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxharvesterutility.lib
+LIBRARY         mpxcollectionmediator.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnpalbumservices.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  provides album handling services for UPnP framework
+*
+*/
+
+
+#ifndef C_UPNPALBUMSERVICE_H
+#define C_UPNPALBUMSERVICE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxcommonframeworkdefs.h> // for TMPXItemId
+#include <mpxcollectionobserver.h>  // MMPXCollectionObserver
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+
+// CONSTANTS
+const TInt KBufferSize = 255; // from DLNA
+
+/**
+ * A class providing abstract album (image/video) handling services.
+ *
+ * @lib upnpmusicadapter.lib
+ * @since S60 v3.1
+ */
+class CUPnPAlbumServices : public CBase,
+                           public MMPXCollectionObserver
+    {
+
+public: // construction / destruction
+
+    /**
+     * Static constructor
+     */
+    IMPORT_C static CUPnPAlbumServices* NewL();
+
+    /**
+     * desctuctor
+     */
+    virtual ~CUPnPAlbumServices();
+
+public: // component services
+
+    /**
+     * Lists all albums in the library.
+     * Returns a list of albums ID's and a names.
+     * ID can be used to open or modify the album.
+     * @param aAlbumIds array to receive album ID's
+     * @param aAlbumNames array to receive album names
+     */
+    IMPORT_C void ListAlbumsL(
+        CDesCArray& aAlbumIds,
+        CDesCArray& aAlbumNames );
+
+    /**
+     * Retrieves contents (image/video) of given album.
+     * @param aAlbumId ID of the album
+     * @param aContentMedia array to receive the content file paths
+     */
+    IMPORT_C void OpenAlbumL(
+        const TDesC& aAlbumId,
+        CDesCArray& aContentMedia );
+        
+    /**
+     * Checks if the given album exists in the library.
+     * Note: does not check the existence of the actual media
+     * @param aAlbumName name of the album
+     */
+    IMPORT_C TBool IsValidAlbumL(
+        const TDesC& aAlbumName );
+
+private: // private methods
+    
+    /**
+     * Converts an ID from TMPXItemId form to descriptor form.
+     * conversion is guaranteed symmetric to Desc2Id()
+     * @param aId the id in TMPXItemId form
+     * @return the id string representation
+     */
+    const TDesC& Id2Desc( const TMPXItemId& aId );
+    
+    /**
+     * Converts an ID from descriptor form to TMPXItemId form.
+     * conversion is guaranteed symmetric to Id2Desc()
+     * @param aDesc the id as a descriptor
+     * @return the id extracted from the string
+     */
+    TMPXItemId Desc2Id( const TDesC& aDesc );
+
+
+public: // From MMPXCollectionObserver
+
+    /** see MMPXCollectionObserver */
+	 void HandleCollectionMediaL(const CMPXMedia& aMedia, TInt aError);
+
+    /** see MMPXCollectionObserver */
+	void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
+	
+    /** see MMPXCollectionObserver */
+	void HandleOpenL( const CMPXMedia& aEntries,
+	    TInt aIndex,TBool aComplete,TInt aError );
+	
+    /** see MMPXCollectionObserver */                         
+    void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError);
+
+private:
+
+    /**
+     * default constructor
+     */
+    CUPnPAlbumServices();
+
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+    
+    /**
+     * Locally handles the corresponding callback
+     */
+    void DoHandleCollectionMessageL( CMPXMessage* aMsg );
+
+private: // data
+
+    /**
+     * Collection utility of MPX framework (Owned)
+     */
+    MMPXCollectionUtility*      iCollectionUtility;
+
+    /**
+     * temp buffer used in Id2Desc
+     */
+    TBuf<KBufferSize>           iTempBuffer;
+    
+    /**
+     * Scheduler wait loop (Owned)
+     */
+    CActiveSchedulerWait*       iWait;
+    
+    /**
+     * for async operation
+     */
+    TInt                        iStatus;
+    
+    /**
+     * Container media (Owned)
+     */
+    CMPXMedia*                  iMedia;
+    
+    /** 
+     * Array for album names
+     */
+    CDesCArray*                 iAlbumNames;
+    
+    /** 
+     * Array for album ids
+     */
+    CDesCArray*                 iAlbumIds;
+
+    };
+
+#endif // C_UPNPALBUMSERVICE_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnpbrowseplaylistfiller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fills MPX playlist by browsing media server content
+*
+*/
+
+
+#ifndef C_UPNPBROWSEPLAYLISTFILLER_H
+#define C_UPNPBROWSEPLAYLISTFILLER_H
+
+// INCLUDES
+// System
+#include <e32base.h>
+
+// upnpframework / avcontroller api
+#include "upnpavbrowsingsessionobserver.h"
+
+// musicadapter internal
+#include "upnpplaylistfiller.h"
+#include "upnpbrowsetimer.h"
+#include "upnpbrowseplaylistfiller.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVBrowsingSession;
+class CUpnpObject;
+class CMPXCollectionPlaylist;
+class CMPXMediaArray;
+class MMPXCollectionUtility;
+class CUPnPBrowseTimer;
+
+/**
+ * This class continues browse made in browse dialog
+ * and places the items in an MPX playlist.
+ *
+ * @lib upnpmusicadapter.lib
+ * @since S60 v3.1
+ */
+class CUPnPBrowsePlaylistFiller : public CUPnPPlayListFiller,
+                                  public MUPnPAVBrowsingSessionObserver,
+                                  public MUPnPBrowseTimerObserver
+    {
+
+public:
+
+    /**
+     * 1st phase constructor
+     *
+     * @param aContainerId the container where to play
+     * @param aCachedStartIndex container index of first pre-cached item
+     * @param aTotalContainerSize total number of items in this container
+     * @since Series 60 3.1
+     * @return a new CUPnPBrowsePlaylistFiller instance
+     */
+    IMPORT_C static CUPnPBrowsePlaylistFiller* NewL(
+        const TDesC8& aContainerId,
+        TInt aCachedStartIndex,
+        TInt aTotalContainerSize );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */
+    IMPORT_C virtual ~CUPnPBrowsePlaylistFiller();
+
+    /**
+     * Fill track data into the playlist and continue browsing
+     *
+     * @param aHost the host adapter in which context the filler operates
+     * @param aPlaylist playlist to be filled
+     * @since Series 60 3.1
+     */
+    void FillL(
+        CUPnPMusicAdapter& aHost,
+        CMPXMediaArray& aPlaylist );
+
+    /**
+     * Cancels an ongoing Fill operation.
+     */
+    void CancelFill();
+
+    /**
+     * Size for which the playlist is to be created.
+     * Default implementation returns number of items added in the cache.
+     */
+    TInt PlaylistSize();
+
+protected: // From MUPnPAVBrowsingSessionObserver
+
+    /**
+     * See MUPnPAVBrowsingSessionObserver
+     */
+    void BrowseResponse(
+                        const TDesC8& aBrowseResponse,
+                        TInt aError,
+                        TInt aMatches,
+                        TInt aTotalCount,
+                        const TDesC8& aUpdateId
+                        );
+
+    /**
+     * See MUPnPAVBrowsingSessionObserver
+     */
+    void SearchResponse( 
+                        const TDesC8& aSearchResponse,
+                        TInt aError,
+                        TInt aMatches,
+                        TInt aTotalCount,
+                        const TDesC8& aUpdateId
+                        );
+
+    /**
+     * See MUPnPAVBrowsingSessionObserver
+     */
+    void SearchCapabilitiesResponse( TInt aError,
+                                     const TDesC8& aSearchCapabilities 
+                                     );
+
+    /**
+     * See MUPnPAVBrowsingSessionObserver
+     */
+    void CreateContainerResponse( TInt aError,
+                                  const TDesC8& aObjectId );
+
+    /**
+     * See MUPnPAVBrowsingSessionObserver
+     */
+    void DeleteObjectResponse( TInt aError );
+            
+    /**
+     * See MUPnPAVBrowsingSessionObserver
+     */ 
+    void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );
+    
+    /**
+     * See MUPnPAVBrowsingSessionObserver
+     */
+    void ReserveLocalMSServicesCompleted( TInt aError );
+    
+protected: // From MUPnPBrowseTimerObserver
+
+    /**
+     * See MUPnPBrowseTimerObserver
+     */
+    void HandlePeriod();
+
+private:
+
+    /**
+     * Default constructor
+     *
+     * @since Series 60 3.1
+     */
+    CUPnPBrowsePlaylistFiller();
+
+    /**
+     * 2nd phase constructor
+     *
+     * @param aContainerId the container where to browse
+     * @param aCachedStartIndex container index of first pre-cached item
+     * @param aTotalContainerSize total number of items in this container
+     * @since Series 60 3.1
+     */
+    void ConstructL(
+        const TDesC8& aContainerId,
+        TInt aCachedStartIndex,
+        TInt aTotalContainerSize );
+    
+    /**
+     * Adds received media to collection
+     *
+     * @param reveived media
+     * @since Series 60 3.1
+     */
+    void AddMediaToCollectionL( const TDesC8& aBrowseResponse );
+
+private: // data
+
+    /**
+     * Browsing session
+     */
+    MUPnPAVBrowsingSession*             iBrowsingSession;
+
+    /**
+     * Container id where to browse
+     */ 
+    HBufC8*                             iContainerId;
+
+    /**
+     * Index of the first item in PlaylistFiller's pre-cached list
+     */
+    TInt                                iCachedStartIndex;
+
+    /**
+     * Index of next item to fetch from remote mediaserver
+     */
+    TInt                                iCurrentIndex;
+
+    /**
+     * Estimated playlist size in creation phase
+     */
+    TInt                                iPlaylistInitialSize;
+
+    /**
+     * Playlist size as it items are being dynamically fetched
+     */
+    TInt                                iPlaylistActualSize;
+
+    /**
+     * Timer support
+     * Owned.
+     */
+    CUPnPBrowseTimer*                   iBrowseTimer;
+    
+    /**
+     * Item count to be browsed
+     */
+    TInt                                iBlocksize;
+
+    };
+
+
+#endif // C_UPNPBROWSEPLAYLISTFILLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnpbrowsetimer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Prodes timer services
+*
+*/
+
+
+#ifndef __UPNPBROWSETIMER_H__
+#define __UPNPBROWSETIMER_H__
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MUPnPBrowseTimerObserver;
+
+/**
+ * A class that provides periodic notifications.
+ *
+ * Once started, notifies an abstract interface periodically
+ * but only when Continue is called. This avoids situation
+ * where previous operation is still in progress when the next
+ * notification arrives.
+ *
+ * @lib upnpmusicadapter.lib
+ * @since S60 v3.2
+ */
+class CUPnPBrowseTimer : public CTimer
+    {
+
+public:
+
+   /**
+    * Static constructor
+    *
+    * @since Series 60 3.2
+    * @param aObserver the party to be notified on timer trigger
+    * @param aTimerWavelength the timer delay in microseconds
+    */
+    static CUPnPBrowseTimer* NewL(
+        MUPnPBrowseTimerObserver& aObserver,
+        TInt32 aTimerWavelength );
+    
+   /**
+    * Static constructor
+    *
+    * @since Series 60 3.2
+    * @param aObserver the party to be notified on timer trigger
+    * @param aTimerWavelength the timer delay in microseconds
+    */
+    static CUPnPBrowseTimer* NewLC(
+        MUPnPBrowseTimerObserver& aObserver,
+        TInt32 aTimerWavelength );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.2
+     */ 
+    virtual ~CUPnPBrowseTimer();
+
+private:
+
+   /**
+    * Constructor
+    *
+    * @since Series 60 3.2
+    * @param aObserver the party to be notified on timer trigger
+    * @param aTimerWavelength the timer delay in microseconds
+    */
+    CUPnPBrowseTimer(
+        MUPnPBrowseTimerObserver& aObserver,
+        TInt32 aTimerWavelength );
+
+    /**
+     * 2nd phase constructor
+     *
+     * @since Series 60 3.2
+     */   
+    void ConstructL();
+
+public:
+
+    /**
+     * Starts the periodizer
+     *
+     * @since Series 60 3.2
+     */
+    void Start();
+
+    /**
+     * Continues a next step for the periodizer
+     *
+     * @since Series 60 3.2
+     */
+    void Continue();
+
+    /**
+     * Stops periodizer
+     *
+     * @since Series 60 3.2
+     */
+    void Stop();
+
+protected: // personal method
+
+    /**
+     * Receives the timer triggering
+     *
+     * @since Series 60 3.2
+     */
+    void RunL();
+
+
+private: // data
+
+    /**
+     * Observer of the timer
+     */
+    MUPnPBrowseTimerObserver& iObserver;
+
+    /**
+     * Timer wavelength as milliseconds to wait between notifications
+     */
+    TInt32 iTimerWavelength;
+
+    };
+
+/**
+ * The interface to receive timer notifications
+ */
+class MUPnPBrowseTimerObserver
+    {
+
+public:
+
+   /**
+    * Timer has triggered
+    *
+    * @since Series 60 3.2
+    */
+    virtual void HandlePeriod() = 0;
+
+    };
+
+
+#endif // __UPNPBROWSETIMER_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnplitecontainerfiller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides services for filling MPX playlist
+*
+*/
+
+
+#ifndef UPNPLITECONTAINERFILLER_H
+#define UPNPLITECONTAINERFILLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnplitefiller.h"
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CUpnpResultCacheUi;
+
+/**
+ * Provides services for filling MPX playlist
+ *
+ * @lib upnpmusicadapter.lib
+ * @since S60 3.2
+ */
+class CUPnPLiteContainerFiller : public CUPnPLiteFiller
+    {
+
+public: // static factory construction
+
+    /**
+     * 1st phase constructor
+     *
+     * @param aMediaServer External Media Server device
+     * @param aResultCache
+     * @since Series 60 3.2
+     * @return a new CUPnPLiteContainerFiller instance
+     */
+    IMPORT_C static CUPnPLiteContainerFiller* NewL(
+        const CUpnpAVDevice& aMediaServer,
+        const CUpnpResultCacheUi& aResultCache
+        );
+
+    /**
+     * See MUPnPPlaylistFiller
+     */
+    void FillL( CUPnPMusicAdapter& aHost, CMPXMediaArray& aPlaylist );
+
+    /**
+     * See MUPnPPlaylistFiller
+     */
+    void CancelFill();
+
+    /**
+     * See MUPnPPlaylistFiller
+     */
+    TInt PlaylistSize();
+
+public: // construction/destruction
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.2
+     */
+    IMPORT_C virtual ~CUPnPLiteContainerFiller();
+
+private:
+
+    /**
+     * Default constructor
+     *
+     * @since Series 60 3.2
+     */
+    CUPnPLiteContainerFiller( const CUpnpResultCacheUi& aResultCache );
+
+    /**
+     * 2nd phase constructor
+     *
+     * @param aMediaServer External Media Server device
+     * @since Series 60 3.2
+     */
+    void ConstructL( const CUpnpAVDevice& aMediaServer );
+
+private: // data
+
+    /**
+     * Item cache.
+     * (not owned)
+     */
+    const CUpnpResultCacheUi&           iResultCache;
+    
+    /**
+     * Playlist size as it items are being dynamically fetched
+     */
+    TInt                                iPlaylistActualSize;
+
+    };
+
+#endif  // UPNPLITECONTAINERFILLER_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnplitefiller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides services for filling MPX playlist
+*
+*/
+
+
+#ifndef UPNPLITEFILLER_H
+#define UPNPLITEFILLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnpplaylistfiller.h"
+
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+class CUPnPMusicAdapter;
+class CMPXMediaArray;
+class CUpnpObjectLite;
+
+// CLASS DECLARATION
+
+/**
+ * A base class providing services for filling MPX playlist
+ *
+ * @lib upnpmusicadapter.lib
+ * @since S60 3.2
+ */
+class CUPnPLiteFiller : public CBase,
+                        public MUPnPPlaylistFiller
+    {
+
+public: // static factory construction
+
+    /**
+     * 1st phase constructor
+     *
+     * @since Series 60 3.2
+     * @return a new CUPnPLiteFiller instance
+     */
+     static CUPnPLiteFiller* NewL();
+        
+    /**
+     * Sets the index (starting from zero = the first inserted item)
+     * of selected item. Playback will begin from the selected item.
+     * If no item is selected, the first item is selected by default.
+     * Note that this method must be called AFTER inserting the objects.
+     *
+     * @param aSelectedIndex index of the item selected
+     * @since Series 60 3.2
+     */
+    IMPORT_C void SetSelectedIndex( TInt aSelectedIndex );
+    
+    /**
+     * Set Source media server. Device id is needed for creating uri
+     * @param aDevice source media server
+     * @since Series 60 3.2
+     */
+    void SetSourceDeviceL( const CUpnpAVDevice& aDevice );
+    
+    /**
+     * Sets the host for this filler
+     *
+     * @param aHost pointer to the music adapter in which context the
+     * filler is running
+     */
+    void SetHost( CUPnPMusicAdapter& aHost );
+
+    /**
+     * The music adapter that hosts this filler
+     *
+     * @return the host music adapter
+     */
+    CUPnPMusicAdapter& Host() const;
+
+    /**
+     * Completes the filler, resulting it to be deleted
+     */    
+    void DoComplete();
+
+    /**
+     * See MUPnPPlaylistFiller
+     */
+    void FillL( CUPnPMusicAdapter& aHost, CMPXMediaArray& aPlaylist );
+
+    /**
+     * See MUPnPPlaylistFiller
+     */
+    void CancelFill();
+
+    /**
+     * See MUPnPPlaylistFiller
+     */
+    TInt PlaylistSize();
+    
+    /**
+     * Index of selected item (where playback should start)
+     *
+     * @return the selected index
+     */
+    TInt SelectedIndex() const;
+
+public: // construction/destruction
+
+    /**
+     * Destructor
+     * @since Series 60 3.2
+     */
+    IMPORT_C virtual ~CUPnPLiteFiller();
+
+public:
+    /**
+     * Fills a single item with given index into a mpx playlist.
+     * if item is not an audio item, does not fill. Checks current
+     * selected index and adjusts it if necessary.
+     *
+     * @param aPlaylist the MPX playlist
+     * @param aItem the object to fill
+     * @param aIndex playlist index of the item being added
+     * @return void
+     */
+    void FillItemMpxPlaylistL( CMPXMediaArray& aPlaylist,
+        const CUpnpObjectLite& aItem, TInt aIndex );
+
+protected:
+
+    /**
+     * Default constructor
+     *
+     * @since Series 60 3.2
+     */
+    CUPnPLiteFiller();
+
+private:
+    /**
+     * 2nd phase constructor
+     *
+     * @param aMediaServer External Media Server device
+     * @param aObjectList Object to be filled
+     * @since Series 60 3.2
+     */
+    void ConstructL();
+    
+    /**
+     * Convert UPnP item to playlist item URI string
+     * URI string format is upnp:<device_id>*<object_id>
+     * 
+     * @param aDeviceUid the UID of the device, in string form
+     * @param aItem browsed UPnP item to be converted
+     * @param aBuffer the buffer for result URI
+     * @return playlist item descriptor
+     */
+    void ConvertToURI( const TDesC& aDeviceUid,
+        const CUpnpObjectLite& aItem, TDes& aBuffer );
+
+private: // data
+
+    /**
+     * The host music adapter in which context the
+     * filler is running (not owned)
+     */
+    CUPnPMusicAdapter*                    iHost;
+
+    /**
+     * The media server we are playing on (not owned)
+     */
+    const CUpnpAVDevice*                  iSourceDevice;
+
+    /**
+     * Media server device id
+     * (Owned)
+     */
+    HBufC*                                iDeviceUid;
+
+    /**
+     * index of selected item
+     */
+    TInt                                  iSelectedIndex;
+
+    /**
+     * Temporary buffer for 8->16-bit conversion
+     */
+    TBuf<KMaxUriSize>                     iTempBuf;
+
+    };
+
+#endif  // UPNPLITEFILLER_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnpliteselectionfiller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fills MPX playlist
+*
+*/
+
+
+#ifndef UPNPLITESELECTIONFILLER_H
+#define UPNPLITESELECTIONFILLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnplitefiller.h"
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CUpnpAVDevice;
+class CUpnpObjectLite;
+
+/**
+ * Provides services for filling MPX playlist
+ *
+ * @lib upnpmusicadapter.lib
+ * @since S60 3.2
+ */
+class CUPnPLiteSelectionFiller : public CUPnPLiteFiller
+    {
+
+public: // static factory construction
+
+    /**
+     * 1st phase constructor
+     *
+     * @param aObjectList Objects to be filled
+     * @param aMediaServer External Media Server device
+     * @since Series 60 3.2
+     * @return a new CUPnPLiteSelectionFiller instance
+     */
+    IMPORT_C static CUPnPLiteSelectionFiller* NewL(
+        const RPointerArray<CUpnpObjectLite>& aObjectList,
+        const CUpnpAVDevice& aMediaServer
+        );
+
+    /**
+     * See MUPnPPlaylistFiller
+     */
+    void FillL( CUPnPMusicAdapter& aHost, CMPXMediaArray& aPlaylist );
+
+    /**
+     * See MUPnPPlaylistFiller
+     */
+    void CancelFill();
+
+    /**
+     * See MUPnPPlaylistFiller
+     */
+    TInt PlaylistSize();
+
+public: // construction/destruction
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.2
+     */
+    IMPORT_C virtual ~CUPnPLiteSelectionFiller();
+
+private:
+
+    /**
+     * Default constructor
+     *
+     * @since Series 60 3.2
+     */
+    CUPnPLiteSelectionFiller();
+
+    /**
+     * 2nd phase constructor
+     *
+     * @param aObjectList Object to be filled
+     * @param aMediaServer External Media Server device
+     * @since Series 60 3.2
+     */
+    void ConstructL( 
+        const RPointerArray<CUpnpObjectLite>& aObjectList,
+        const CUpnpAVDevice& aMediaServer );
+
+private: // data
+
+    /**
+     * Object list to be resolved
+     * Note: NO OWNERSHIP ON THE CONTENT
+     */        
+    RPointerArray<CUpnpObjectLite>          iObjectList;
+    };
+
+#endif  // UPNPLITESELECTIONFILLER_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnpmpxhelper.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class for some common MPX routines
+*
+*/
+
+
+#ifndef C_UPNPMPXHELPER_H
+#define C_UPNPMPXHELPER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "mpxmediatorobserver.h" // base class
+#include "mpxcollectionobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class MUPnPMpxHelperObserver;
+class MMPXHarvesterUtility;
+class MMPXCollectionUtility;
+class CMPXCollectionMediator;
+
+
+/**
+ * A helper class for some common MPX routines
+ *
+ * @lib upnpmusicadapter.lib
+ * @since S60 v3.1
+ */
+class CUPnPMpxHelper : public CBase
+    , public MMPXMediatorObserver
+    , public MMPXCollectionObserver
+    {
+
+public:
+
+    /**
+     * 1st phase constructor
+     *
+     * @param aModeId mode passed to MPX framework
+     * @return a new CUPnPPlayListFiller instance
+     * @since Series 60 3.1
+     */
+    static CUPnPMpxHelper* NewL( const TUid& aModeId );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */
+    virtual ~CUPnPMpxHelper();
+
+public: // the interface
+
+    /**
+     * Add a song or a playlist synchronously.
+     * Note: does not take ownership of aMedia object. Caller must
+     * delete aMedia after calling this method.
+     * see mpxcollectionhelper in mpxmusicplayer
+     * @param aMedia representation of the media to be added
+     */
+    void AddTrackL( CMPXMedia* aMedia );
+
+    /**
+     * add a song or a playlist asynchronously.
+     * Note: does not take ownership of aMedia object. Caller must
+     * delete aMedia after calling this method.
+     * see mpxcollectionuihelper in mpxmusicplayer
+     * @param aMedia representation of the media to be added
+     * @param aObserver the observer interface
+     */
+    void AddPlaylistL( CMPXMedia* aMedia );
+
+    /**
+     * Open the collection in embedded mode with a Media Object.
+     * see mpxcollectionuihelper in mpxmusicplayer
+     * @param aHostId Host Process UID to identify this embedded instance
+     * @param aMedia Media Object to open
+     */
+    void AddAndOpenL( const TUid& aHostId, CMPXMedia& aMedia );
+
+protected:
+
+    /**
+     * Retrieve collection from URI
+     */
+    TInt FindCollectionIdL( const TDesC& aUri );
+
+    /**
+     * retrieve information for the required attributes
+     */
+    void FillInPlaylistDetailsL( CMPXMedia& aMedia );
+
+    /**
+     * see MMPXMediatorObserver
+     */
+    void HandleMediatorPathUpdatedL(
+        CMPXMedia*& /*aMedia*/, TUid /*aOldPath*/ ) {}
+
+    /**
+     * see MMPXCollectionObserver
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& /*aMedia*/, TInt /*aError*/) {}
+
+    /**
+     * see MMPXCollectionObserver
+     */
+    void HandleCollectionMessageL(
+        const TMPXCollectionMessage& /*aMessage*/ ) {}
+
+    /**
+     * see MMPXCollectionObserver
+     */
+    void HandleCollectionMessageL(
+        const CMPXMessage& /*aMsg*/ ) {}
+
+    /**
+     * see MMPXCollectionObserver
+     */
+    void HandleOpenL(
+        const CMPXMedia& /*aEntries*/,
+        TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ ) {}
+
+    /**
+     * see MMPXCollectionObserver
+     */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& /*aPlaylist*/,
+        TInt /*aError*/ ) {}
+
+    /**
+     * see MMPXCollectionObserver
+     */
+    void HandleCommandComplete(
+        CMPXCommand* /*aCommandResult*/, TInt /*aError*/) {}
+
+private: // private methods
+
+    /**
+     * constructor
+     */
+    CUPnPMpxHelper::CUPnPMpxHelper();
+
+    /**
+     * 2nd phase constructor
+     */
+    void CUPnPMpxHelper::ConstructL( const TUid& aModeId );
+
+private: // members
+
+    /**
+     * MPX harvester utility
+     */
+    MMPXHarvesterUtility*       iHarvester;
+
+    /**
+     * MPX collection utility
+     */
+    MMPXCollectionUtility*      iCollectionUtil;
+
+    /**
+     * MPX collection mediator
+     */
+    CMPXCollectionMediator*     iMediator;
+
+    /**
+     * temporarily stored observer for async operations
+     * NOT OWNED
+     */
+    MUPnPMpxHelperObserver*     iObserver;
+
+    };
+
+/**
+ * Callback ingterface for async methods in CUPnPMpxHelper
+ */
+class MUPnPMpxHelperObserver
+    {
+public:
+
+    /**
+     * async response for AddL
+     */
+    void HandleAddComplete( TInt aError );
+
+    /**
+     * async response for OpenL
+     */
+    void HandleOpenComplete( TInt aError );
+
+    };
+
+#endif // C_UPNPMPXHELPER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnpmusicadapter.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,411 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  handles music playing within UPnP framework
+*
+*/
+
+
+#ifndef C_UPNPMUSICADAPTER_H
+#define C_UPNPMUSICADAPTER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxplaybackobserver.h> // base class
+#include <mpxcollectionobserver.h> // base class
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class CUpnpAVDevice;
+class CUPnPPlayListFiller;
+class MUPnPPlaylistFiller;
+class CMPXCollectionPlaylist;
+class CEikAppUi;
+class CMPXMediaArray;
+class MMPXPlaybackUtility;
+class MMPXPlayerManager;
+class CUpnpAVDevice;
+class MMPXCollectionUtility;
+class MMPXViewUtility;
+class CMPXMedia;
+class CUPnPMpxHelper;
+
+// CONSTANT DEFINITIONS
+// ** a message to music player to complete an immediate exit
+const TInt KMusicPluginMessageExit = 3001;
+
+/**
+ * A class providing play back services for playing within UPnP framework.
+ *
+ * @lib upnpmusicadapter.lib
+ * @since S60 v3.1
+ */
+class CUPnPMusicAdapter : public CBase,
+                          public MMPXPlaybackObserver,
+                          public MMPXPlaybackCallback,
+                          public MMPXCollectionObserver
+    {
+
+public: // interface methods
+
+    /**
+     * 1st phase constructor
+     *
+     * @param aAVController reference to AVController resource. 
+     * @since Series 60 3.1
+     * @return a new CUPnPMusicAdapter instance
+     */
+    IMPORT_C static CUPnPMusicAdapter* NewL(
+        MUPnPAVController& aAVController );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */
+    IMPORT_C virtual ~CUPnPMusicAdapter();
+
+    /**
+     * Initiates music play in a remote renderer.
+     * The method will block until music player exits.
+     * Music adapter will take ownership of the filler in all conditions.
+     *
+     * @param aAppUi the app.ui in case we are displaying a view/dialog
+     * @param aFiller Object that contains playlist information
+     * @param aRenderer the selected renderer device
+     * @return exit status / reason
+     * @since Series 60 3.1
+     */
+    IMPORT_C TInt ExecuteMusicLiteInRemoteL(
+        CEikAppUi* aParentUi,
+        MUPnPPlaylistFiller* aFiller,
+        const CUpnpAVDevice& aRenderer );
+
+    /**
+     * Initiates music play in the local device
+     * The method will block until music player exits.
+     * Music adapter will take ownership of the filler in all conditions.
+     *
+     * @param aAppUi the app.ui in case we are displaying a view/dialog
+     * @param aFiller Object that contains playlist information
+     * @return exit status / reason
+     * @since Series 60 3.1
+     */
+    IMPORT_C TInt ExecuteMusicLiteInLocalL(
+        CEikAppUi* aAppUi,
+        MUPnPPlaylistFiller* aFiller );
+
+    /**
+     * Initiates music play in a remote renderer.
+     * The method will block until music player exits.
+     * Music adapter will take ownership of the filler in all conditions.
+     *
+     * @param aAppUi the app.ui in case we are displaying a view/dialog
+     * @param aFiller Object that contains playlist information
+     * @param aRenderer the selected renderer device
+     * @return exit status / reason
+     * @since Series 60 3.1
+     */
+    IMPORT_C TInt ExecuteMusicInRemoteL(
+        CEikAppUi* aParentUi,
+        CUPnPPlayListFiller* aFiller,
+        const CUpnpAVDevice& aRenderer );
+
+    /**
+     * Initiates music play in the local device
+     * The method will block until music player exits.
+     * Music adapter will take ownership of the filler in all conditions.
+     *
+     * @param aAppUi the app.ui in case we are displaying a view/dialog
+     * @param aFiller Object that contains playlist information
+     * @return exit status / reason
+     * @since Series 60 3.1
+     */
+    IMPORT_C TInt ExecuteMusicInLocalL(
+        CEikAppUi* aAppUi,
+        CUPnPPlayListFiller* aFiller );
+
+    /**
+     * Dismiss the music player UI. The Execute... method will
+     * immediately return with the given return code
+     *
+     * @param aReturnCode Exit code for the execution thread
+     * @since Series 60 3.1
+     */
+    IMPORT_C void Dismiss( TInt aReturnCode = KErrCancel );
+
+public: // component internal methods
+
+    /**
+     * Called when playlist fill has completed.
+     * Does not pass ownership.
+     *
+     * @param aFiller the object that has completed its job.
+     * @since Series 60 3.1
+     */
+    void Complete( MUPnPPlaylistFiller* aFiller );
+
+    /**
+     * The AVController resource
+     * (to be used by the fillers)
+     *
+     * @return reference to the AVController resource
+     * @since Series 60 3.1
+     */
+    MUPnPAVController& AVController();
+
+    /**
+     * The Collection UID used for the playlist.
+     * Accessor for the filler
+     */
+    TUid PlaylistCollectionId();
+
+    
+    /**
+     * The MPX CollectionUtility.
+     * Accessor for the filler
+     */
+    MMPXCollectionUtility& CollectionUtility();
+
+
+protected:
+    
+    /** @see MMPXPlaybackObserver */
+    void HandlePlaybackMessage(CMPXMessage* aMsg, TInt aErr );
+
+    /** @see MMPXPlaybackCallback */
+    void HandlePropertyL( TMPXPlaybackProperty aProperty,
+                          TInt aValue, 
+                          TInt aError );
+
+    /** @see MMPXPlaybackCallback */
+    void HandleSubPlayerNamesL( TUid aPlayer, 
+                                const MDesCArray* aSubPlayers,
+                                TBool aComplete,
+                                TInt aError );
+
+    /** @see MMPXPlaybackCallback */
+    void HandleMediaL(const CMPXMedia& aProperties, TInt aError );
+
+    /** see MMPXCollectionMediaObserver */
+    void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
+    
+    /** see MMPXCollectionObserver */
+    void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
+    
+    /** see MMPXCollectionObserver */
+    void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, 
+        TBool aComplete, TInt aError );
+
+    /** @see MMPXPlaybackObserver */
+    void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
+
+    /** @see MMPXPlaybackObserver */
+    void HandleCommandComplete( CMPXCommand* aCommandResult, TInt aError );
+
+private:
+
+    /**
+     * Default constructor
+     *
+     * @param aAVController reference to AVController resource. 
+     * @since Series 60 3.1
+     */
+    CUPnPMusicAdapter( MUPnPAVController& aAVController );
+
+    /**
+     * 2nd phase constructor
+     *
+     * @since Series 60 3.1
+     */
+    void ConstructL();
+
+    /**
+     * Initialises the state before execution
+     *
+     * @since Series 60 3.1
+     */
+    void InitState();
+
+    /**
+     * Obtains ownership of the filler pointer.
+     *
+     * @param aFiller the filler object to own
+     * @since Series 60 3.1
+     */
+    void TakeOwnershipOfTheFiller( MUPnPPlaylistFiller* aFiller );
+    
+    /**
+     * Creates play list
+     * @since Series 60 3.1
+     */
+    void CreatePlayListL();
+
+    /**
+     * A loop to show the UI
+     * @since Series 60 3.1
+     */
+    void UiShowLoopL();
+
+    /**
+     * Commands the UI to be shown in UiShowLoop
+     * @since Series 60 3.1
+     */
+    void DisplayUI();
+
+    /**
+     * Causes an internal exit
+     * @param aReturnCode the return code for the thread
+     * @since Series 60 3.1
+     */
+    void Exit( TInt aReturnCode );
+
+
+    /**
+     * Locally handles the corresponding callback
+     */
+    void DoHandlePlaybackMessageL( TInt aEvent, TInt aType, TInt aData );
+
+    /**
+     * Locally handles the corresponding callback
+     */
+    void DoHandleCollectionMessageL( TInt aEvent, TInt aType, TInt aData );
+
+    /**
+     * Locally handles the corresponding callback
+     */
+    void DoHandleSubPlayerNamesL( TUid aPlayer, 
+                                const MDesCArray* aSubPlayers,
+                                TBool aComplete,
+                                TInt aError );
+
+public: // type definitions
+
+    /**
+     * the adapter state
+     */
+    enum TAdapterState
+        {
+        EStateIdle = 0, // not running
+        EStatePreparing, // Prepare phase (No UI)
+        EStatePreparingWait, // Preparing, waiting async resp
+        EStateInitialising, // Initialising, UI showing
+        EStateRunning, // normal run state
+        EStateClosing, // UI exiting
+        };
+
+    enum TFillerState
+        {
+        EFillerStateIdle = 0, // created
+        EFillerStateFilling, // filling
+        EFillerStateComplete // fill complete
+        };
+
+private: // data
+
+    /**
+     * AVController resource
+     */
+    MUPnPAVController&          iAVController;
+
+    /**
+     * The renderer device we are rendering on
+     * NULL, if rendering locally
+     * NO OWNERSHIP
+     */
+    const CUpnpAVDevice*        iTargetDevice;
+    
+    /**
+     * Pointer to host application ui.
+     * NO OWNERSHIP
+     */
+    CEikAppUi*                  iAppUi;
+
+    /**
+     * The current playlist filler object
+     */
+    MUPnPPlaylistFiller*        iCurrentFiller;
+
+    /**
+     * Whether the filler is in working state
+     */
+    TFillerState                iCurrentFillerState;
+
+    /**
+     * The current playlist
+     */
+    CMPXCollectionPlaylist*     iPlaylist;
+    
+    /**
+     * The current temp playlist 
+     * Own.
+     */
+    CMPXMediaArray*             iTrackArray;
+    
+    /**
+     * For playlist creation
+     * Own.
+     */
+    CUPnPMpxHelper*             iMpxHelper;
+
+    /**
+     * Collection ID to use when communicating to MPX
+     */
+    TUid                        iPlaylistCollectionId;
+
+    /**
+     * For playback
+     * Own.
+     */
+    MMPXPlaybackUtility*        iPlaybackUtility;
+    
+    /**
+     * For collection
+     * Own.
+     */
+    MMPXCollectionUtility*      iCollectionUtility;
+    
+    /**
+     * View utility.
+     */
+    MMPXViewUtility*            iViewUtility;
+
+    /**
+     * Tells are we using remote playback 
+     */
+    TBool                       iRemotePlayer;
+
+    /**
+     * Exit code
+     */
+    TInt                        iReturnCode;
+
+    /**
+     * Scheduler wait loop
+     */
+    CActiveSchedulerWait*       iWait;
+
+    /**
+     * state of the adapter
+     */
+    TAdapterState               iState;
+    
+    /**
+     * For media object array
+     */
+    CMPXMedia*                  iMedia;
+
+    };
+
+
+#endif // C_UPNPMUSICADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnpplaylistfiller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,284 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base class for filling an MPX playlist
+*
+*/
+
+
+#ifndef C_UPNPPLAYLISTFILLER_H
+#define C_UPNPPLAYLISTFILLER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpAVDevice;
+class CUpnpObject;
+class CUPnPMusicAdapter;
+class CMPXCollectionPlaylist;
+class CMPXMediaArray;
+
+// CONSTANTS
+const TInt KMaxUriSize = 520; // see upnpmusicadapter design
+
+/**
+ *  Defines the playlistfiller interface
+ *
+ *  @lib upnpmusicadapter.lib
+ *  @since S60 v3.2
+ */
+class MUPnPPlaylistFiller
+    {
+
+public:
+
+    /**
+     * Fill track data into the playlist.
+     * Calling method will fulfill the purpose of this object, and
+     * therefore this object will be deleted.
+     *
+     * @param aHost the host adapter in which context the filler operates
+     * @param aPlaylist playlist to be filled
+     * @since Series 60 3.1
+     */
+    virtual void FillL(
+        CUPnPMusicAdapter& aHost,
+        CMPXMediaArray& aPlaylist ) = 0;
+
+    /**
+     * Cancels an ongoing Fill operation.
+     */
+    virtual void CancelFill() = 0;
+
+    /**
+     * Size for which the playlist is to be created.
+     * Default implementation returns number of items added in the cache.
+     */
+    virtual TInt PlaylistSize() = 0;
+    
+    /**
+     * Index of selected item (where playback should start)
+     *
+     * @return the selected index
+     */
+    virtual TInt SelectedIndex() const = 0;
+    
+    public: // Destructor    
+
+    virtual ~MUPnPPlaylistFiller() {};
+    };
+
+/**
+ * A base class providing services for filling MPX playlist
+ *
+ * @lib upnpmusicadapter.lib
+ * @since S60 v3.1
+ */
+class CUPnPPlayListFiller : public CBase,
+                            public MUPnPPlaylistFiller
+                            
+    {
+
+public:
+
+    /**
+     * 1st phase constructor
+     *
+     * @since Series 60 3.1
+     * @return a new CUPnPPlayListFiller instance
+     */
+    IMPORT_C static CUPnPPlayListFiller* NewL();
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */
+    IMPORT_C virtual ~CUPnPPlayListFiller();
+
+    /**
+     * Inserts an initial object to be filled in the playlist
+     * should be called after construction, but before use.
+     * Note that the class refers to the object, so it should be
+     * persistent in memory when Fill() is called.
+     *
+     * @param aMediaServer External Media Server device
+     * @param aObject reference to the object.
+     * @since Series 60 3.1
+     */
+    IMPORT_C void InsertObjectL(
+        const CUpnpAVDevice& aMediaServer,
+        const CUpnpObject& aObject );
+
+    /**
+     * Sets the index (starting from zero = the first inserted item)
+     * of selected item. Playback will begin from the selected item.
+     * If no item is selected, the first item is selected by default.
+     * Note that this method must be called AFTER inserting the objects.
+     *
+     * @param aSelectedIndex index of the item selected
+     * @since Series 60 3.1
+     */
+    IMPORT_C void SetSelectedIndex( TInt aSelectedIndex );
+
+    /**
+     * Fill track data into the playlist.
+     * Calling method will fulfill the purpose of this object, and
+     * therefore this object will be deleted.
+     *
+     * @param aHost the host adapter in which context the filler operates
+     * @param aPlaylist playlist to be filled
+     * @since Series 60 3.1
+     */
+    void FillL( CUPnPMusicAdapter& aHost, CMPXMediaArray& aPlaylist );
+
+    /**
+     * Cancels an ongoing Fill operation.
+     */
+    void CancelFill();
+
+    /**
+     * Size for which the playlist is to be created.
+     * Default implementation returns number of items added in the cache.
+     */
+    TInt PlaylistSize();
+
+    /**
+     * Index of selected item (where playback should start)
+     *
+     * @return the selected index
+     */
+    TInt SelectedIndex() const;
+
+    /**
+     * Returns a non-modifiable reference to the object array
+     *
+     * @since Series 60 3.1
+     * @return an object array
+     */
+    const RPointerArray<CUpnpObject>& ObjectArray();
+
+    /**
+     * The source device for the playlist
+     *
+     * @since Series 60 3.1
+     * @return device for the playlist
+     */
+    const CUpnpAVDevice& SourceDevice();
+
+protected:
+    
+    /**
+     * default constructor
+     */
+    CUPnPPlayListFiller();
+
+    /**
+     * Fills the initial items into the playlist
+     *
+     * @param aPlaylist the MPX playlist
+     * @param aSource the source list of objects
+     * @param aStartIndex playlist index of items being added
+     * @return number of items filled
+     */
+    TInt DoFillL( CMPXMediaArray& aPlaylist,
+        const RPointerArray<CUpnpObject>& aSource,
+        TInt aStartIndex = 0 );
+
+    /**
+     * Fills a single object with given index into a playlist.
+     * if item is not an audio item, does not fill. Checks current
+     * selected index and adjusts it if necessary.
+     *
+     * @param aPlaylist the MPX playlist
+     * @param aObject the object to fill
+     * @param aIndex playlist index of the item being added
+     * @return void
+     */
+    void DoFillObjectL( CMPXMediaArray& aPlaylist,
+        const CUpnpObject& aObject, TInt aIndex );
+    
+    /**
+     * Convert UPnP item to playlist item URI string
+     * URI string format is upnp:<device_id>*<object_id>
+     * 
+     * @param aDeviceUid the UID of the device, in string form
+     * @param aItem browsed UPnP item to be converted
+     * @param aBuffer the buffer for result URI
+     * @return playlist item descriptor
+     */
+    void ConvertToURI( const TDesC& aDeviceUid,
+        const CUpnpObject& aItem, TDes& aBuffer );
+
+    /**
+     * Completes the filler, resulting it to be deleted
+     */    
+    void DoComplete();
+
+    /**
+     * Sets the host for this filler
+     *
+     * @param aHost pointer to the music adapter in which context the
+     * filler is running
+     */
+    void SetHost( CUPnPMusicAdapter& aHost );
+
+    /**
+     * The music adapter that hosts this filler
+     *
+     * @return the host music adapter
+     */
+    CUPnPMusicAdapter& Host() const;
+    	
+private:
+
+    /**
+     * The host music adapter in which context the
+     * filler is running (not owned)
+     */
+    CUPnPMusicAdapter*                    iHost;
+
+    /**
+     * The initial set of items that we are about to
+     * set into the playlist
+     * Note: NO OWNERSHIP ON THE CONTENT
+     */
+    RPointerArray<CUpnpObject>            iItemList;
+
+    /**
+     * index of selected item
+     */
+    TInt                                  iSelectedIndex;
+
+    /**
+     * The media server we are playing on
+     */
+    const CUpnpAVDevice*                  iSourceDevice;
+
+    /**
+     * Media server device id
+     * Own
+     */
+    HBufC*                                iDeviceUid;
+
+    /**
+     * Temporary buffer for 8->16-bit conversion
+     */
+    TBuf<KMaxUriSize>                     iTempBuf;
+    
+
+    };
+
+#endif // C_UPNPPLAYLISTFILLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/inc/upnpplaylistservices.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  provides playlist handling services for UPnP framework
+*
+*/
+
+
+#ifndef C_UPNPPLAYLISTSERVICE_H
+#define C_UPNPPLAYLISTSERVICE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxcommonframeworkdefs.h> // for TMPXItemId
+
+// FORWARD DECLARATIONS
+class MMPXCollectionUtility;
+class TMPXAttributeData;
+class CMPXMedia;
+class CUpnpItem;
+class CUPnPMpxHelper;
+
+// constants
+const TInt KMaxPlaylistId = 32; // Maximum playlist ID length
+const TInt KTempBufferSize = 255; // from DLNA
+
+/**
+ * A class providing abstract playlist handling services.
+ * @lib upnpmusicadapter.lib
+ * @since S60 v3.1
+ */
+class CUPnPPlaylistServices
+    :public CBase
+    {
+
+public: // construction / destruction
+
+    /**
+     * Static constructor
+     */
+    IMPORT_C static CUPnPPlaylistServices* NewL();
+
+    /**
+     * desctuctor
+     */
+    virtual ~CUPnPPlaylistServices();
+
+public: // component services
+
+    /**
+     * Lists all playlists in the music library.
+     * Returns a list of playlist ID's and a names.
+     * ID can be used to open or modify the playlist.
+     * @param aPlaylistIds array to receive playlist ID's
+     * @param aPlaylistNames array to receive playlist names
+     */
+    IMPORT_C void ListPlaylistsL(
+        CDesCArray& aPlaylistIds,
+        CDesCArray& aPlaylistNames );
+
+    /**
+     * Retrieves contents of given playlist.
+     * @param aPlaylistId ID of the playlist
+     * @param aContentMedia array to receive the content file paths
+     */
+    IMPORT_C void OpenPlaylistL(
+        const TDesC& aPlaylistId,
+        CDesCArray& aContentMedia );
+
+    /**
+     * Creates a record of a music track into the music library.
+     * The media is assumed to exist already.
+     * @param aTrackPath path to the track media
+     * @param aTrackMetadata the upnp item for track metadata
+     */
+    IMPORT_C void CreateTrackL(
+        const TDesC& aTrackPath,
+        const CUpnpItem& aTrackMetadata );
+
+    /**
+     * Creates a playlist by given data into the music library.
+     * The tracks should be introduced to MPX using CreateTrackL
+     * prior to calling this method.
+     * @param aPlaylistName the name of the playlist
+     * @param aTrackPaths array of playlist content file paths
+     * @param aPlaylistId receives the playlist ID (KMaxPlaylistId)
+     *                    Can also be NULL, if ID is not needed.
+     */
+    IMPORT_C void CreatePlaylistL(
+        const TDesC& aPlaylistName,
+        const MDesCArray& aTrackPaths,
+        TDes* aPlaylistId );
+
+    /**
+     * Adds a file into an existing playlist.
+     * The track should be introduced to MPX using CreateTrackL
+     * prior to calling this method.
+     * @param aPlaylistId ID of the playlist
+     * @param aTrackPath path to the track media
+     */
+    IMPORT_C void AddMediaToPlaylistL(
+        const TDesC& aPlaylistId,
+        const TDesC& aTrackPath );
+
+    /**
+     * Deletes a record of a music track from the music library.
+     * Note that this does not delete the actual media.
+     * @param aTrackPath the actual file path
+     */
+    IMPORT_C void DeleteTrackL(
+        const TDesC& aTrackPath );
+
+    /**
+     * Deletes a record of a playlist from the music library.
+     * Note that this does not delete the actual media.
+     * @param aPlaylistId ID of the playlist
+     */
+    IMPORT_C void DeletePlaylistL(
+        const TDesC& aPlaylistId );
+
+    /**
+     * Checks if the given track exists in the music library.
+     * Note: does not check the existence of the actual media
+     * @param aTrackPath the actual file path
+     */
+    IMPORT_C TBool IsValidTrackL(
+        const TDesC& aTrackPath );
+
+    /**
+     * Checks if the given playlist exists in the music library.
+     * Note: does not check the existence of the actual media
+     * @param aPlaylistId ID of the playlist
+     */
+    IMPORT_C TBool IsValidPlaylistL(
+        const TDesC& aPlaylistName );
+
+
+protected: // private methods
+
+    /**
+     * category to be used in FindItemL
+     */
+    enum TFindCategory {
+        ESongs,
+        ESongByUri,
+        EPlaylists,
+        EPlaylistById,
+        EPlaylistByTitle
+    };
+
+    /**
+     * Finds a playlist according to given criteria.
+     * @param find category (as in TMPXGeneralCategory)
+     * @param aKey find key, depends on the category
+     * @param aAttribute1 attribute to get (optional)
+     * @param aAttribute2 attribute to get (optional)
+     * @param aAttribute3 attribute to get (optional)
+     * @return the playlist media, or NULL if not found
+     */
+    CMPXMedia* FindItemL(
+        TFindCategory aCategory,
+        const TDesC& aKey,
+        const TMPXAttributeData* aAttribute1 = 0,
+        const TMPXAttributeData* aAttribute2 = 0,
+        const TMPXAttributeData* aAttribute3 = 0 );
+
+    /**
+     * Fetch a playlist content by id
+     * @param aId playlist id
+     * @return the playlist media, or NULL if not found
+     */
+    CMPXMedia* FetchPlaylistContentL( const TDesC& aId );
+
+    /**
+     * Converts an ID from TMPXItemId form to descriptor form.
+     * conversion is guaranteed symmetric to Desc2Id()
+     * @param aId the id in TMPXItemId form
+     * @return the id string representation
+     */
+    const TDesC& Id2Desc( const TMPXItemId& aId );
+
+    /**
+     * Converts an ID from descriptor form to TMPXItemId form.
+     * conversion is guaranteed symmetric to Id2Desc()
+     * @param aDesc the id as a descriptor
+     * @return the id extracted from the string
+     */
+    TMPXItemId Desc2Id( const TDesC& aDesc );
+
+    /**
+     * Finds an element within CUpnpItem
+     * returns the element value converted to unicode,
+     * pushed to cleanup stack.
+     * @param aSource the source CUpnpItem
+     * @param aSourceField the element name within source
+     * @return the vield value, or 0 if element not found.
+     */
+    HBufC16* GetElementLC( const CUpnpItem& aSource,
+        const TDesC8& aSourceField ) const;
+
+private:
+
+    /**
+     * default constructor
+     */
+    CUPnPPlaylistServices();
+
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Collection utility of MPX framework
+     */
+    MMPXCollectionUtility*      iCollectionUtility;
+
+    /**
+     * internal helper for some MPX operations
+     */
+    CUPnPMpxHelper*             iMpxHelper;
+
+
+    /**
+     * temp buffer used in Id2Desc
+     */
+    TBuf<KTempBufferSize>       iTempBuffer;
+
+    /**
+     * ID of item currently processed asynchronously
+     */
+    TMPXItemId                  iCurrentId;
+
+    /**
+     * tells if collection plugin exists
+     */
+    TInt                        iStatus;
+    };
+
+
+#endif // C_UPNPPLAYLISTSERVICE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnpalbumservices.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,628 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  provides album handling services for UPnP framework
+*
+*/
+
+#include "upnpapplicationcrkeys.h" // KCRUidUPnPApplication
+#include <mpxcollectionutility.h>
+#include <mpxcollectionframeworkdefs.h> // main attribute keys
+#include <mpxmessagegeneraldefs.h>
+#include <mpxmediageneraldefs.h> // commonly used attribute keys
+#include <mpxmediacontainerdefs.h> // container-specific attribute keys
+#include <mpxcollectionpath.h>
+#include <mpxcollectionmessage.h>
+#include <mpxmediadrmdefs.h>
+
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+
+#include "upnpalbumservices.h" // ourselves
+
+// debug
+_LIT16( KComponentLogfile, "musicadapter.txt" );
+#include "upnplog.h"
+
+// Constant definitions
+#define KAlbumsCollectionUid 0x20007197 // album plugin uid
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CUPnPAlbumServices::NewL
+// 1st phase constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CUPnPAlbumServices* CUPnPAlbumServices::NewL()
+    {
+    __LOG( "CUPnPAlbumServices::NewL" );
+
+    CUPnPAlbumServices* self = new(ELeave) CUPnPAlbumServices();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::CUPnPAlbumServices
+// Default constructor.
+// --------------------------------------------------------------------------
+//    
+CUPnPAlbumServices::CUPnPAlbumServices() : iStatus( KErrNone )
+    {
+    // None.
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::ConstructL
+// 2nd phase constructor
+// --------------------------------------------------------------------------
+//    
+void CUPnPAlbumServices::ConstructL()
+    {
+    __LOG( "CUPnPAlbumServices::ConstructL" );
+    iAlbumNames = new (ELeave) CDesCArrayFlat(5);
+    iAlbumIds = new (ELeave) CDesCArrayFlat(5);
+
+    iCollectionUtility = MMPXCollectionUtility::NewL(
+        (MMPXCollectionObserver*)this, KMcModePlaylist );
+
+    // Open album collection plugin. Callback to HandleCollectionMessage.
+    CMPXCollectionPath* path = CMPXCollectionPath::NewL();
+    CleanupStack::PushL( path );
+    path->AppendL( KAlbumsCollectionUid );
+    iCollectionUtility->Collection().OpenL( *path );
+ 	CleanupStack::PopAndDestroy( path ); 
+
+    // Wait until signalled to proceed
+    iWait = new (ELeave) CActiveSchedulerWait();    
+    iWait->Start();     
+
+    __LOG1( "CUPnPAlbumServices::ConstructL - End %d", iStatus );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::ListAlbumsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAlbumServices::ListAlbumsL(
+    CDesCArray& aAlbumIds,
+    CDesCArray& aAlbumNames )
+    {
+    __LOG( "CUPnPAlbumServices::ListAlbumsL" );
+    
+    // Check if already listed
+    
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPAlbumServices::ListAlbumsL iStatus %d return", iStatus );
+        return;
+        }
+    
+    if( iAlbumNames->Count() > 0 && iAlbumIds->Count() > 0 )
+        {
+        __LOG( "CUPnPAlbumServices::ListAlbumsL: Already fetched." );
+        // Copy from member
+        TInt count = iAlbumNames->Count();
+        __LOG1( "Album count=%d", count );
+        for( TInt i = 0; i < count; i++ )
+            {
+            aAlbumNames.AppendL( iAlbumNames->MdcaPoint(i) );
+            aAlbumIds.AppendL( iAlbumIds->MdcaPoint(i) );
+            }
+        __LOG( "CUPnPAlbumServices::ListAlbumsL: Return." );
+        return;
+        }
+
+    CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( path );
+    path->SelectAllL();
+
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append( KMPXMediaGeneralId );
+    attrs.Append( KMPXMediaGeneralTitle );
+
+    // Get album list from collection. Callback to HandleCollectionMediaL
+    iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( path );
+
+    // Wait until signalled to proceed
+    iWait->Start();
+
+    if( iStatus != KErrNone )
+        {
+        if( iStatus == KErrNotFound )
+            {
+            // No albums available.
+            __LOG( "ListAlbumsL: No albums available!" );
+            return;
+            }
+        else // Some other problem
+            {
+            User::Leave( iStatus );
+            }
+        }
+
+    if ( iMedia != 0 )
+        {
+        TMPXAttribute mediaArrayAttr( KMPXMediaIdContainer,
+            EMPXMediaArrayContents );
+                
+        if( iMedia->IsSupported( mediaArrayAttr ) )
+            {
+            __LOG("getting album array");
+            CMPXMediaArray* medias = iMedia->ValueCObjectL<CMPXMediaArray>(
+                mediaArrayAttr );
+
+            if( medias )
+                {
+                CleanupStack::PushL( medias );
+                // Album count
+                TInt count = medias->Count();        
+                __LOG1( "Album count=%d", count );
+
+                for( TInt i = 0; i < count; ++i )
+                    {
+                    const CMPXMedia* entry = (*medias)[i];
+                    const TDesC& title = entry->ValueText(
+                        KMPXMediaGeneralTitle );
+                    __LOG3( "Title: %d/%d [%S]",i, count, &title );
+                    TMPXItemId id = *entry->Value<TMPXItemId>(
+                        KMPXMediaGeneralId );
+                    aAlbumNames.AppendL( title );
+                    iAlbumNames->AppendL( title ); // for later usage
+                    aAlbumIds.AppendL( Id2Desc( id ) );
+                    iAlbumIds->AppendL( Id2Desc( id ) ); // for later usage
+                    }
+                CleanupStack::PopAndDestroy( medias );
+                }
+            }
+        else
+            {
+            __LOG( "getting single item" );
+            const TDesC& title = iMedia->ValueText(
+                KMPXMediaGeneralTitle );
+            __LOG1( "Title: %S", &title );
+            TMPXItemId id = *iMedia->Value<TMPXItemId>(
+                KMPXMediaGeneralId );
+            aAlbumNames.AppendL( title );
+            iAlbumNames->AppendL( title ); // for later usage
+            aAlbumIds.AppendL( Id2Desc( id ) );
+            iAlbumIds->AppendL( Id2Desc( id ) ); // for later usage
+            }
+        delete iMedia;
+        iMedia = 0;
+        }
+
+    __LOG( "CUPnPAlbumServices::ListAlbumsL -End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::OpenAlbumL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAlbumServices::OpenAlbumL(
+    const TDesC& aAlbumId,
+    CDesCArray& aContentMedia )
+
+    {
+    
+
+    __LOG1( "CUPnPAlbumServices::OpenAlbumL(%S)", &aAlbumId );
+    
+  
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPAlbumServices::OpenAlbumL iStatus %d return", iStatus );
+        return;
+        }
+        
+    CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( path );   
+    path->AppendL( Desc2Id( aAlbumId ) );
+
+    iCollectionUtility->Collection().OpenL( *path );
+ 	CleanupStack::PopAndDestroy( path );
+
+ 	// Wait until signalled to proceed
+    iWait->Start();
+
+ 	if( iStatus != KErrNone )
+        {
+        // Open album failed.
+        User::Leave( iStatus );
+        }
+
+    CMPXCollectionPath* mediaPath = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( mediaPath );
+    mediaPath->SelectAllL();
+    
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append( KMPXMediaGeneralUri );
+
+    // Get metadata of given album. Callback to HandleCollectionMediaL
+    iCollectionUtility->Collection().MediaL( *mediaPath, attrs.Array() );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( mediaPath );
+
+    // Wait until signalled to proceed
+    iWait->Start();
+
+    if( iStatus != KErrNone )
+        {
+        if( iStatus == KErrNotFound )
+            {
+            // Album is empty
+            __LOG( "ListAlbumsL: Album is empty" );
+            return;
+            }
+        else // Some other problem
+            {
+            User::Leave( iStatus );
+            }
+        }
+
+    if ( iMedia != 0 )
+        {
+        __LOG( "CUPnPAlbumServices::iMedia exist! ");
+        TMPXAttribute mediaArrayAttr( KMPXMediaIdContainer,
+            EMPXMediaArrayContents );
+
+        // Check if there is more than one item in album
+        if( iMedia->IsSupported( mediaArrayAttr ) )
+            {
+            __LOG("getting album array");
+            CMPXMediaArray* medias = iMedia->ValueCObjectL<CMPXMediaArray>(
+                mediaArrayAttr );
+
+            if( medias )
+                {
+                __LOG( "CUPnPAlbumServices::album array exist! ");
+                CleanupStack::PushL( medias );
+                // Album count
+                TInt count = medias->Count();        
+                __LOG1( "Album count=%d", count );
+
+                for( TInt i = 0; i < count; ++i )
+                    {
+                    __LOG2( "accessing album: item %d of %d",i, count );
+                    const CMPXMedia* entry = (*medias)[i];
+                    const TDesC& uri = entry->ValueText(
+                        KMPXMediaGeneralUri );
+                    __LOG1( "Item uri:[%S]", &uri );
+                    aContentMedia.AppendL( entry->ValueText(
+                        KMPXMediaGeneralUri ) );
+                    }
+                 CleanupStack::PopAndDestroy( medias );
+                 }
+            }
+         else // Handle single item
+            {
+            __LOG("getting single item");
+            const TDesC& uri = iMedia->ValueText( KMPXMediaGeneralUri );
+            __LOG1( "Item uri:[%S]", &uri );
+            aContentMedia.AppendL( iMedia->ValueText( KMPXMediaGeneralUri ) );
+            }
+            
+        delete iMedia;
+        iMedia = 0;
+        }
+    __LOG( "CUPnPAlbumServices::OpenAlbumL - End ");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::IsValidAlbumL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUPnPAlbumServices::IsValidAlbumL(
+    const TDesC& aAlbumName )
+    {
+    TBool found = EFalse;
+
+    __LOG1( "IsValidAlbumL(%S)", &aAlbumName );
+    
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPAlbumServices::IsValidAlbumL iStatus %d return", iStatus );
+        return EFalse;
+        }
+        
+    // Check if already listed
+    if( iAlbumNames->Count() > 0 )
+        {
+        __LOG( "CUPnPAlbumServices::IsValidAlbumL: Already fetched." );
+        TInt count = iAlbumNames->Count();
+        __LOG1( "Album count=%d", count );
+        for( TInt i = 0; i < count; i++ )
+            {
+            if( aAlbumName.Compare( iAlbumNames->MdcaPoint(i) ) == 0 )
+                {
+                __LOG( "IsValidAlbum -> True ");
+                i = count;
+                found = ETrue;
+                }
+            }
+        __LOG( "CUPnPAlbumServices::IsValidAlbumL: Return." );
+        return found;
+        }
+
+    // List albums
+    CMPXCollectionPath* mediaPath = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( mediaPath );
+    mediaPath->SelectAllL();
+
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append( KMPXMediaGeneralId );
+    attrs.Append( KMPXMediaGeneralTitle );
+
+    // Get album data. Callback to HandleCollectionMediaL
+    iCollectionUtility->Collection().MediaL( *mediaPath, attrs.Array() );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( mediaPath );
+
+    // Wait until signalled to proceed
+    iWait->Start();
+
+    if( iStatus != KErrNone )
+        {
+        if( iStatus == KErrNotFound )
+            {
+            // No albums available
+            __LOG( "ListAlbumsL: No albums available" );
+            return EFalse;
+            }
+        else // Some other problem
+            {
+            User::Leave( iStatus );
+            }
+        }
+
+    if ( iMedia != 0 )
+        {
+        __LOG( "CUPnPAlbumServices::iMedia exist! ");
+        TMPXAttribute mediaArrayAttr( KMPXMediaIdContainer,
+            EMPXMediaArrayContents );
+                
+        if( iMedia->IsSupported( mediaArrayAttr ) )
+            {
+            __LOG("getting album array");
+            CMPXMediaArray* medias = iMedia->ValueCObjectL<CMPXMediaArray>(
+                mediaArrayAttr );
+
+            if( medias )
+                {
+                __LOG( "CUPnPAlbumServices::album array exist! ");
+                CleanupStack::PushL( medias );
+                // Album count
+                TInt count = medias->Count();        
+                __LOG1( "Album count=%d", count );
+
+                for( TInt i = 0; i < count; ++i )
+                    {
+                    const CMPXMedia* entry = (*medias)[i];
+                    if( aAlbumName.Compare( 
+                        entry->ValueText( KMPXMediaGeneralTitle ) ) == 0 )
+                        {
+                        __LOG( "IsValidAlbum -> True ");
+                        found = ETrue;
+                        break;
+                        }
+                    }
+                CleanupStack::PopAndDestroy( medias );
+                }
+            }
+        else
+            {
+            __LOG( "iMedia->IsSupported = False!" );
+            }
+        delete iMedia;
+        iMedia = 0;
+        }
+
+    __LOG( "CUPnPAlbumServices::IsValidAlbumL - End ");
+    return found;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::~CUPnPAlbumServices
+// Destructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPAlbumServices::~CUPnPAlbumServices()
+    {
+    __LOG( "CUPnPAlbumServices::~CUPnPAlbumServices" );
+    iAlbumNames->Reset();
+    delete iAlbumNames;
+    iAlbumNames = 0;
+    iAlbumIds->Reset();
+    delete iAlbumIds;
+    iAlbumIds = 0;
+    
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        iCollectionUtility = 0;
+        }
+
+    delete iWait;
+    iWait = 0;
+
+    if( iMedia )
+        {
+        delete iMedia;
+        iMedia = 0;
+        }
+    }
+
+
+// Methods from MMPXCollectionObserver:
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::HandleCollectionMessage
+// Callback for Collection->OpenL()
+// --------------------------------------------------------------------------
+// 
+void CUPnPAlbumServices::HandleCollectionMessage( CMPXMessage* aMsg,
+    TInt aErr )
+
+    {
+    __LOG1( "HandleCollectionMessage: err=%d", aErr );
+	if( aErr == KErrNone)
+	    {
+	    TRAPD( error, DoHandleCollectionMessageL( aMsg ) );
+        if ( error != KErrNone )
+            {
+            __LOG1( "DoHandleCollectionMessageL: leave with %d", error );
+            iStatus = error;
+            iWait->AsyncStop();
+            }
+	    }
+	 else
+	    {
+	    iStatus = aErr;
+	    iWait->AsyncStop();
+	    }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::HandleCollectionMediaL
+// --------------------------------------------------------------------------
+//
+
+void CUPnPAlbumServices::HandleCollectionMediaL( const CMPXMedia& aMedia,
+    TInt aError )
+
+    {
+    __LOG1( "CUPnPAlbumServices::HandleCollectionMediaL: err=%d", aError );
+    if( aError == KErrNone )
+        {                    
+        // delete if already exist
+        if( iMedia )
+            {
+            delete iMedia;
+            iMedia = 0;
+            }
+        iMedia = CMPXMedia::NewL( aMedia );
+        }
+
+    iStatus = aError;
+    iWait->AsyncStop();
+
+    __LOG("CUPnPAlbumServices::HandleCollectionMediaL - End");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::HandleOpenL
+// Callback for Collection->OpenL(path, attrs)
+// --------------------------------------------------------------------------
+// 
+void CUPnPAlbumServices::HandleOpenL( const CMPXMedia& /*aEntries*/,
+    TInt /*aIndex*/, TBool /*aComplete*/, TInt aError )
+    {
+    __LOG1( "CUPnPAlbumServices::HandleOpenL %d", aError);
+    
+    if( aError != KErrNone)
+        {
+        iStatus = aError;
+        iWait->AsyncStop();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::HandleOpenL
+// --------------------------------------------------------------------------
+// 
+void CUPnPAlbumServices::HandleOpenL( 
+    const CMPXCollectionPlaylist& /*aPlaylist*/, TInt aError )
+    {
+    __LOG1( "CUPnPAlbumServices::HandleOpenL %d", aError);
+    
+    if( aError != KErrNone)
+        {
+        iStatus = aError;
+        iWait->AsyncStop();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Converts an ID from TMPXItemId form to descriptor form.
+// --------------------------------------------------------------------------
+//
+const TDesC& CUPnPAlbumServices::Id2Desc( const TMPXItemId& aId )
+    {  
+    iTempBuffer.Num( aId );
+    return iTempBuffer;
+    }
+
+// --------------------------------------------------------------------------
+// Converts an ID from descriptor form to TMPXItemId form.
+// --------------------------------------------------------------------------
+//
+TMPXItemId CUPnPAlbumServices::Desc2Id( const TDesC& aDesc )
+    {
+    TLex convert( aDesc );
+    TUint temp;
+    convert.Val( temp, EDecimal );
+    TMPXItemId id(temp);
+    return id;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAlbumServices::DoHandleCollectionMessageL
+// --------------------------------------------------------------------------
+//
+void CUPnPAlbumServices::DoHandleCollectionMessageL( CMPXMessage* aMsg )
+    {
+    __LOG( "CUPnPAlbumServices::DoHandleCollectionMessageL" );
+
+    if( aMsg && aMsg->IsSupported(KMPXMessageGeneralEvent ) &&
+			aMsg->IsSupported(KMPXMessageGeneralType ) )
+        {
+	    TInt event( *aMsg->Value<TInt>( KMPXMessageGeneralEvent ) );
+	    TInt type( *aMsg->Value<TInt>( KMPXMessageGeneralType ) );
+	    TInt data( *aMsg->Value<TInt>( KMPXMessageGeneralData ) );
+	    
+	    __LOG1("Event: %d", event );
+	    __LOG1("Type: %d", type );
+	    __LOG1("Data: %d", data );
+	     	        
+	    switch ( event )
+            {
+            case TMPXCollectionMessage::EPathChanged:
+                {
+                __LOG( "TMPXCollectionMessage::EPathChanged" );
+                if( type == EMcPathChangedByOpen )
+                    {
+                    __LOG( " Type: EMcPathChangedByOpen " );
+                    // Album collection is ready for use
+                    iStatus = KErrNone;
+                    iWait->AsyncStop();
+                    }
+                }    
+            break;
+            default:
+                {
+                // do nothing
+                } 
+                break;
+            }
+	   }
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnpbrowseplaylistfiller.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,386 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fills MPX playlist by browsing media server content
+*
+*/
+
+
+// INCLUDE FILES
+// upnp stack api
+#include <upnpobject.h>
+
+// MPX framework api
+#include <mpxcollectionutility.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h"
+#include "upnpavdevice.h"
+#include "upnpavbrowsingsession.h"
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for browse filters
+
+// upnpframework / xmlparser api
+#include "upnpxmlparser.h"
+
+// musicadapter internal
+#include "upnpmusicadapter.h"
+#include "upnpbrowseplaylistfiller.h"
+
+// debug
+_LIT16( KComponentLogfile, "musicadapter.txt" );
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KBrowseRequestedCount = 100;
+const TUid KHostAppUid = { 0x10208A0A };  // Host app UID
+const TInt KMaxPlaylistSize = 500; // MAX container size to play
+const TInt KBrowsePeriod = 5000000; // 5 seconds
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::NewL
+// static constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPBrowsePlaylistFiller* CUPnPBrowsePlaylistFiller::NewL( 
+    const TDesC8& aContainerId,
+    TInt aCachedStartIndex,
+    TInt aTotalContainerSize )
+    {
+    __LOG( "CUPnPBrowsePlaylistFiller::NewL" );
+    
+    CUPnPBrowsePlaylistFiller* self = new(ELeave)
+        CUPnPBrowsePlaylistFiller();
+    CleanupStack::PushL( self );
+    self->ConstructL( aContainerId, aCachedStartIndex, aTotalContainerSize );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::CUPnPBrowsePlaylistFiller
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPBrowsePlaylistFiller::CUPnPBrowsePlaylistFiller()
+    : CUPnPPlayListFiller()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::ConstructL
+// 2nd phase constructor.
+// --------------------------------------------------------------------------
+// 
+void CUPnPBrowsePlaylistFiller::ConstructL(
+    const TDesC8& aContainerId,
+    TInt aCachedStartIndex,
+    TInt aTotalContainerSize )
+    {
+    // Create timer for continue browse after short period.
+    iBrowseTimer = CUPnPBrowseTimer::NewL( *this, KBrowsePeriod );
+    iBlocksize = KBrowseRequestedCount;
+    
+    iContainerId = HBufC8::NewL( aContainerId.Length() );
+    iContainerId->Des().Copy( aContainerId );    
+    iCachedStartIndex = aCachedStartIndex;
+
+    iPlaylistInitialSize = KErrUnknown;
+    if ( aTotalContainerSize >= 0 )
+        {
+        iPlaylistInitialSize = Min(
+            aTotalContainerSize - iCachedStartIndex,
+            KMaxPlaylistSize );
+        }
+    iPlaylistActualSize = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::~CUPnPBrowsePlaylistFiller
+// Destructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPBrowsePlaylistFiller::~CUPnPBrowsePlaylistFiller()
+    {
+    delete iBrowseTimer;
+    iBrowseTimer = 0;
+
+    __LOG( "CUPnPBrowsePlaylistFiller::~CUPnPBrowsePlaylistFiller" );
+    if ( iBrowsingSession )
+        {
+        Host().AVController().StopBrowsingSession( *iBrowsingSession );
+        iBrowsingSession = 0;
+        }
+    delete iContainerId;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::FillL
+// Fill track data into the playlist and continue browsing
+// --------------------------------------------------------------------------
+//    
+void CUPnPBrowsePlaylistFiller::FillL(
+    CUPnPMusicAdapter& aHost,
+    CMPXMediaArray& aPlaylist )
+    {
+    __LOG( "CUPnPBrowsePlaylistFiller::Fill" );
+    
+    SetHost( aHost );
+
+    // fill the initial items, increase the index
+    iCurrentIndex = iCachedStartIndex;
+    iPlaylistActualSize = DoFillL( aPlaylist, ObjectArray() );
+    iCurrentIndex += ObjectArray().Count();
+
+    if ( iPlaylistActualSize < iPlaylistInitialSize )
+        {
+        // Start doing more browse requests after short waiting period
+        iBrowseTimer->Start();
+        }
+    else
+        {
+        __LOG( "CUPnPBrowsePlaylistFiller::Fill - \
+        No need to browse" );
+        DoComplete();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::CancelFill
+// Fill track data into the playlist and continue browsing
+// --------------------------------------------------------------------------
+//    
+void CUPnPBrowsePlaylistFiller::CancelFill()
+    {
+    if ( iBrowsingSession )
+        {
+        iBrowsingSession->CancelBrowse();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::PlaylistSize
+// Returns the total playlist size
+// --------------------------------------------------------------------------
+//
+TInt CUPnPBrowsePlaylistFiller::PlaylistSize()
+    {
+    if ( iPlaylistInitialSize >= 0 )
+        {
+        return iPlaylistInitialSize;
+        }
+    else
+        {
+        return ObjectArray().Count();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Methods from MUPnPAVBrowsingSessionObserver
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::BrowseResponse
+// --------------------------------------------------------------------------
+// 
+void CUPnPBrowsePlaylistFiller::BrowseResponse(
+    const TDesC8& aBrowseResponse, TInt aError, TInt /*aMatches*/,
+    TInt aTotalCount, const TDesC8& /*aUpdateId*/ )
+    {
+    __LOG( "CUPnPBrowsePlaylistFiller::BrowseResponse" );
+    TBool continueBrowse = ETrue;
+
+    // Stop browsing if any error in previous browse 
+    if( aError != KErrNone )
+        {
+        // Browse stops to an error - do not continue playlist.
+        __LOG( "CUPnPBrowsePlaylistFiller::BrowseResponse ->error!" );
+        continueBrowse = EFalse;
+        DoComplete();
+        }
+    else 
+        {
+        __LOG( "CUPnPBrowsePlaylistFiller::BrowseResponse - \
+            Error None" );
+
+        TInt error = KErrNone;
+        TRAP( error, AddMediaToCollectionL( aBrowseResponse ) );
+        if( error != KErrNone )
+            {
+            __LOG( "CUPnPBrowsePlaylistFiller::BrowseResponse - \
+            AddMediaToCollectionL leaves!" );
+            continueBrowse = EFalse;
+            DoComplete();
+            }
+        else
+            {
+            if ( iPlaylistActualSize >= iPlaylistInitialSize )
+                {
+                // browse is complete
+                __LOG( "CUPnPBrowsePlaylistFiller::BrowseResult - \
+                    ->playlist size reached." );
+                continueBrowse = EFalse;
+                DoComplete();
+                }
+
+            if ( iCurrentIndex >= aTotalCount )
+                {
+                // browse is complete
+                __LOG( "CUPnPBrowsePlaylistFiller::BrowseResult - \
+                    ->end of data." );
+                continueBrowse = EFalse;
+                DoComplete();
+                }
+            }     
+        }
+
+    if ( continueBrowse )
+        {
+        // Calculate item count to be browsed.
+        iBlocksize = KBrowseRequestedCount;
+        if ( iPlaylistActualSize + iBlocksize > iPlaylistInitialSize )
+            {
+            iBlocksize = iPlaylistInitialSize - iPlaylistActualSize;
+            }
+
+        // Continue the browse request            
+        iBrowseTimer->Continue();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::AddMediaToCollectionL
+// Adds media to collection
+// --------------------------------------------------------------------------
+//    
+void CUPnPBrowsePlaylistFiller::AddMediaToCollectionL( 
+    const TDesC8& aBrowseResponse )
+    {
+    CUPnPXMLParser* parser = NULL;
+    parser = CUPnPXMLParser::NewL();
+    CleanupStack::PushL( parser );
+    RPointerArray<CUpnpObject> array;
+    parser->ParseResultDataL( array, aBrowseResponse );
+       
+    // Update playlist counter
+    iCurrentIndex += KBrowseRequestedCount;
+  
+    TInt count = array.Count();    
+    if( count > 0 )
+        {
+        // Create new media object
+        CMPXMedia* media = CMPXMedia::NewL(); 
+        CleanupStack::PushL( media );
+        // Set collection Uid
+        media->SetTObjectValueL<TUid>( 
+        KMPXMediaGeneralCollectionId,
+        Host().PlaylistCollectionId() );
+        // Set type
+        media->SetTObjectValueL<TMPXGeneralType>( 
+        KMPXMediaGeneralType, EMPXItem );
+        // Set category
+        media->SetTObjectValueL<TMPXGeneralCategory>( 
+        KMPXMediaGeneralCategory, EMPXPlaylist );
+        // Set playlist ID
+        media->SetTObjectValueL<TMPXItemId>(
+        KMPXMediaGeneralId, KHostAppUid.iUid );
+        // Add playlist into media object
+        CMPXMediaArray* playlist = CMPXMediaArray::NewL();
+        CleanupStack::PushL( playlist ); 
+        iPlaylistActualSize += DoFillL( *playlist, array );
+        media->SetCObjectValueL( 
+        KMPXMediaArrayContents, playlist );
+        // Add count of items in playlist
+        media->SetTObjectValueL( 
+        KMPXMediaArrayCount,
+        playlist->Count() );
+        CleanupStack::PopAndDestroy( playlist );
+
+        __LOG( "CUPnPBrowsePlaylistFiller::AddMediaToCollectionL - \
+        Collection->SetSyncL" );
+        // Add new playlist to the collection
+        Host().CollectionUtility().Collection().SetSyncL( *media );
+        CleanupStack::PopAndDestroy( media );
+        }
+    else
+        {
+        __LOG( "CUPnPBrowsePlaylistFiller::AddMediaToCollectionL - \
+        No items received!" );
+        User::Leave( KErrNotFound );
+        }
+    array.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( parser );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::MediaServerDisappeared
+// The media server has vanished
+// --------------------------------------------------------------------------
+//    
+void CUPnPBrowsePlaylistFiller::MediaServerDisappeared( 
+    TUPnPDeviceDisconnectedReason /*aReason*/ )
+    {
+    __LOG( "CUPnPBrowsePlaylistFiller::MediaServerDisappeared" );
+    DoComplete();
+    }
+
+// --------------------------------------------------------------------------
+// Unused callback methods from the interface
+// --------------------------------------------------------------------------
+//    
+ 
+void CUPnPBrowsePlaylistFiller::SearchResponse( 
+    const TDesC8& /*aSearchResponse*/, TInt /*aError*/, TInt /*aMatches*/,
+    TInt /*aTotalCount*/, const TDesC8& /*aUpdateId*/ ) {}
+void CUPnPBrowsePlaylistFiller::SearchCapabilitiesResponse( TInt /*aError*/,
+    const TDesC8& /*aSearchCapabilities*/ ) {}
+void CUPnPBrowsePlaylistFiller::CreateContainerResponse( TInt /*aError*/, 
+    const TDesC8& /*aObjectId*/ ) {}
+void CUPnPBrowsePlaylistFiller::DeleteObjectResponse( TInt /*aError*/ ) {}
+void CUPnPBrowsePlaylistFiller::ReserveLocalMSServicesCompleted( TInt 
+    /*aError*/ ) {}
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePlaylistFiller::HandlePeriod
+// Action when timer has expired.
+// --------------------------------------------------------------------------
+// 
+void CUPnPBrowsePlaylistFiller::HandlePeriod()
+    {
+    __LOG( "CUPnPBrowsePlaylistFiller::HandlePeriod" );
+
+    TRAP_IGNORE( 
+    // start a browsing session if not already started
+    if( iBrowsingSession == 0 )
+        {
+        __LOG( "Start a browsing session" );
+        iBrowsingSession = &Host().AVController()
+            .StartBrowsingSessionL( SourceDevice() );
+        iBrowsingSession->SetObserver( *this );
+        }
+
+    __LOG( "Start doing more browse requests" );
+    // Start doing more browse requests
+    iBrowsingSession->BrowseL( *iContainerId, KFilterMin,
+        MUPnPAVBrowsingSession::EDirectChildren, iCurrentIndex,
+        iBlocksize, KSortNone );
+        );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnpbrowsetimer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Prodes timer services
+*
+*/
+
+
+// INCLUDES
+#include "upnpbrowsetimer.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseTimer::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPBrowseTimer* CUPnPBrowseTimer::NewL(
+    MUPnPBrowseTimerObserver& aObserver,
+    TInt32 aTimerWavelength )
+    {
+    CUPnPBrowseTimer* p = CUPnPBrowseTimer::NewLC(
+        aObserver, aTimerWavelength );
+    CleanupStack::Pop();
+    return p;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseTimer::NewLC
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//  
+CUPnPBrowseTimer* CUPnPBrowseTimer::NewLC(
+    MUPnPBrowseTimerObserver& aObserver,
+    TInt32 aTimerWavelength )
+    {
+    
+    CUPnPBrowseTimer* p = new(ELeave) CUPnPBrowseTimer( aObserver,
+        aTimerWavelength );
+    CleanupStack::PushL( p );
+    p->ConstructL();
+    return p;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseTimer::~CUPnPBrowseTimer
+// Desctructor.
+// --------------------------------------------------------------------------
+//
+CUPnPBrowseTimer::~CUPnPBrowseTimer()
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseTimer::CUPnPBrowseTimer
+// Default constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPBrowseTimer::CUPnPBrowseTimer(
+    MUPnPBrowseTimerObserver& aObserver,
+    TInt32 aTimerWavelength )
+    :CTimer( EPriorityStandard ),
+    iObserver( aObserver ),
+    iTimerWavelength( aTimerWavelength )
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseTimer::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUPnPBrowseTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    CActiveScheduler::Add(this);
+    }
+ 
+// --------------------------------------------------------------------------
+// Periodizer services
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseTimer::Start
+// Starts the periodizer.
+// --------------------------------------------------------------------------
+//
+void CUPnPBrowseTimer::Start()
+    {
+    if ( !IsActive() )
+        {
+        After( TTimeIntervalMicroSeconds32( iTimerWavelength ) );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseTimer::Continue
+// Continues a next step for the periodizer.
+// --------------------------------------------------------------------------
+//
+void CUPnPBrowseTimer::Continue()
+    {
+    After( TTimeIntervalMicroSeconds32( iTimerWavelength ) );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowseTimer::RunL
+// Receives the timer triggering.
+// --------------------------------------------------------------------------
+//
+void CUPnPBrowseTimer::RunL()
+    {
+    // deliver the periodic event to the observer
+    iObserver.HandlePeriod();
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPBrowseTimer::Stop
+// Stops periodizer.
+// --------------------------------------------------------------------------
+//
+void CUPnPBrowseTimer::Stop()
+    {
+    Cancel();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnplitecontainerfiller.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides services for filling MPX playlist
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpresultcacheui.h"
+#include "upnplitecontainerfiller.h"
+
+// debug
+_LIT16( KComponentLogfile, "musicadapter.txt" );
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KMaxPlaylistSize = 500; // MAX container size to play
+
+// METHODS
+
+// --------------------------------------------------------------------------
+// CUPnPLiteSelectionFiller::NewL
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPLiteContainerFiller* CUPnPLiteContainerFiller::NewL(
+    const CUpnpAVDevice& aMediaServer,
+    const CUpnpResultCacheUi& aResultCache )
+    {
+    CUPnPLiteContainerFiller* filler = 
+        new(ELeave)CUPnPLiteContainerFiller( aResultCache );
+    CleanupStack::PushL( filler );
+    filler->ConstructL( aMediaServer );
+    CleanupStack::Pop( filler );
+    return filler;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteContainerFiller::FillL
+// Fill track data into the playlist
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteContainerFiller::FillL(
+    CUPnPMusicAdapter& aHost,
+    CMPXMediaArray& aPlaylist )
+    {
+    __LOG( "CUPnPLiteContainerFiller::FillL" );
+    SetHost( aHost );
+
+    TUint count = iResultCache.TotalNumberOfItems();
+    for( TUint i = 0; i < count; i++ )
+	    {
+	    // Convert to mpx media and add to the playlist.
+    	FillItemMpxPlaylistL( aPlaylist, *iResultCache.ItemAt(i), 0 );
+    	iPlaylistActualSize++;
+	    }
+
+    DoComplete();
+    __LOG( "CUPnPLiteContainerFiller::FillL - End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteContainerFiller::CancelFill
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteContainerFiller::CancelFill()
+    {
+    // no implementation required
+    // - this class does not have async nature
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteContainerFiller::PlaylistSize
+// Returns the total playlist size
+// --------------------------------------------------------------------------
+//
+TInt CUPnPLiteContainerFiller::PlaylistSize()
+    {
+    return iPlaylistActualSize;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteContainerFiller::~CUPnPLiteContainerFiller
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPLiteContainerFiller::~CUPnPLiteContainerFiller()
+    {
+    // None.
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteContainerFiller::CUPnPCachePlaylistFiller
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPLiteContainerFiller::CUPnPLiteContainerFiller( 
+    const CUpnpResultCacheUi& aResultCache )
+    : iResultCache( aResultCache )
+    {
+    // None.
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteContainerFiller::ConstructL
+// 2nd phase constructor.
+// --------------------------------------------------------------------------
+// 
+void CUPnPLiteContainerFiller::ConstructL( 
+    const CUpnpAVDevice& aMediaServer )
+    {
+    __LOG( "CUPnPLiteContainerFiller::ConstructL" );
+    // Set device uid
+    SetSourceDeviceL( aMediaServer );
+    iPlaylistActualSize = 0;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnplitefiller.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides services for filling MPX playlist
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <escapeutils.h> // for unicode conversion
+#include <escapeutils.h> // for unicode conversion
+
+// XML framework api
+#include <mpxcollectionplaylist.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdevice.h" // for the device
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for KClassAudio
+
+// upnpframework / xmlparser api
+#include "upnpobjectlite.h"
+
+// musicadapter internal
+#include "upnpmusicadapter.h" // for Complete(this)
+#include "upnplitefiller.h"
+
+// debug
+_LIT16( KComponentLogfile, "musicadapter.txt" );
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT16( KUPnPPrefix, "upnp:" );
+_LIT16( KSeparator, "*" );
+const TInt KMaxElementSize = 256; // from UPNP/DLNA
+
+// METHODS
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::NewL
+//---------------------------------------------------------------------------
+CUPnPLiteFiller* CUPnPLiteFiller::NewL()
+    {
+    CUPnPLiteFiller* filler = 
+        new(ELeave)CUPnPLiteFiller();
+    CleanupStack::PushL( filler );
+    filler->ConstructL();
+    CleanupStack::Pop( filler );
+    return filler;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::SetSelectedIndex
+// Sets the index of pre-selected item
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPLiteFiller::SetSelectedIndex(
+    TInt aSelectedIndex )
+    {
+    __ASSERTD( aSelectedIndex >= 0, __FILE__, __LINE__ );
+    iSelectedIndex = aSelectedIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::SetSourceDeviceL
+// Set the media server the playlist is located
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteFiller::SetSourceDeviceL( const CUpnpAVDevice& aDevice )
+    {
+    if ( !iSourceDevice )
+        {
+        iSourceDevice = &aDevice;        
+        iDeviceUid = HBufC::NewL( aDevice.Uuid().Length() );
+        iDeviceUid->Des().Copy( aDevice.Uuid() );
+        }
+    else
+        {
+        // we only support playlists from a single device.
+        __ASSERTD( &aDevice == iSourceDevice , __FILE__, __LINE__ );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::SetHost
+// Assigns the host music adapter
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteFiller::SetHost( CUPnPMusicAdapter& aHost )
+    {
+    iHost = &aHost;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::Host
+// returns the host music adapter
+// --------------------------------------------------------------------------
+//
+CUPnPMusicAdapter& CUPnPLiteFiller::Host() const
+    {
+    __ASSERTD( iHost != 0 , __FILE__, __LINE__ );
+    return *iHost;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::DoComplete
+// Completes the object, causing it to be destroyed.
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteFiller::DoComplete()
+    {
+    Host().Complete( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::FillL
+// Fill track data into the playlist
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteFiller::FillL(
+    CUPnPMusicAdapter& /*aHost*/,
+    CMPXMediaArray& /*aPlaylist*/ )
+    {
+    // no implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::CancelFill
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteFiller::CancelFill()
+    {
+    // no implementation required
+    // - this class does not have async nature
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::PlaylistSize
+// Returns the total playlist size
+// --------------------------------------------------------------------------
+//
+TInt CUPnPLiteFiller::PlaylistSize()
+    {
+    // no implementation required
+    return 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::SelectedIndex
+// Index of selected item
+// --------------------------------------------------------------------------
+//
+TInt CUPnPLiteFiller::SelectedIndex() const
+    {
+    return iSelectedIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::~CUPnPLiteFiller
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPLiteFiller::~CUPnPLiteFiller()
+    {
+    delete iDeviceUid;
+    iDeviceUid = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::FillItemMpxPlaylistL
+// Fills a single item to mpx playlist
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteFiller::FillItemMpxPlaylistL(  CMPXMediaArray& aPlaylist,
+    const CUpnpObjectLite& aItem, TInt /*aIndex*/ )
+    {
+    // Create new media object for track
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL( media );
+    // Set type
+    media->SetTObjectValueL<TMPXGeneralType>( 
+        KMPXMediaGeneralType, EMPXItem );
+    // Set gategory
+    media->SetTObjectValueL<TMPXGeneralCategory>( 
+        KMPXMediaGeneralCategory, EMPXSong );
+    // URI
+    if( aItem.IsTypeOf( CUpnpObjectLite::EMusicItem ) )
+        {
+        ConvertToURI( *iDeviceUid, aItem, iTempBuf );
+        }
+    else // item is non audio set uri to zero
+        {
+        iTempBuf.Zero();
+        }
+    media->SetTextValueL( 
+        KMPXMediaGeneralUri, iTempBuf );
+    // Title        
+    media->SetTextValueL( 
+        KMPXMediaGeneralTitle, aItem.Title() );
+    // Add track to the object list
+    aPlaylist.AppendL( media );
+    CleanupStack::Pop( media );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::CUPnPLiteFiller
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPLiteFiller::CUPnPLiteFiller()
+    {
+    iSelectedIndex = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::ConstructL
+// 2nd phase constructor.
+// --------------------------------------------------------------------------
+// 
+void CUPnPLiteFiller::ConstructL()
+    {
+    // None.
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteFiller::ConvertToURI
+// Convert UPnP item to playlist item URI string
+// --------------------------------------------------------------------------
+//  
+void CUPnPLiteFiller::ConvertToURI( const TDesC& aDeviceUid,
+    const CUpnpObjectLite& aItem, TDes& aBuffer )
+    {
+    // Start with upnp prefix
+    aBuffer.Copy( KUPnPPrefix );
+    aBuffer.Append( aDeviceUid );
+
+    aBuffer.Append( KSeparator );
+    // add object id (converting 8->16 bit)
+    TBuf<KMaxElementSize> id16;
+    id16.Copy( aItem.ObjectId() );
+    aBuffer.Append( id16 );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnpliteselectionfiller.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Fills MPX playlist by browsing media server content
+*
+*/
+
+
+// INCLUDE FILES
+// upnpframework / xmlparser api
+#include "upnpobjectlite.h"
+
+// musicadapter internal
+#include "upnpliteselectionfiller.h"
+
+// debug
+_LIT16( KComponentLogfile, "musicadapter.txt" );
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KItemListGranularity = 20;
+
+// METHODS
+
+// --------------------------------------------------------------------------
+// CUPnPLiteSelectionFiller::NewL
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPLiteSelectionFiller* CUPnPLiteSelectionFiller::NewL(
+    const RPointerArray<CUpnpObjectLite>& aObjectList,
+    const CUpnpAVDevice& aMediaServer )
+    {
+    CUPnPLiteSelectionFiller* filler = 
+        new(ELeave)CUPnPLiteSelectionFiller();
+    CleanupStack::PushL( filler );
+    filler->ConstructL( aObjectList, aMediaServer );
+    CleanupStack::Pop( filler );
+    return filler;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteSelectionFiller::FillL
+// Fill track data into the playlist
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteSelectionFiller::FillL(
+    CUPnPMusicAdapter& aHost,
+    CMPXMediaArray& aPlaylist )
+    {
+    __LOG( "CUPnPLiteSelectionFiller::FillL" );
+    SetHost( aHost );
+    
+    TInt count = iObjectList.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        // Convert to mpx media and add to the playlist.
+    	FillItemMpxPlaylistL( aPlaylist, *iObjectList[i], 0 );
+        }
+
+    DoComplete();
+    __LOG( "CUPnPLiteSelectionFiller::FillL - End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteSelectionFiller::CancelFill
+// --------------------------------------------------------------------------
+//
+void CUPnPLiteSelectionFiller::CancelFill()
+    {
+    // no implementation required
+    // - this class does not have async nature
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteSelectionFiller::PlaylistSize
+// Returns the total playlist size
+// --------------------------------------------------------------------------
+//
+TInt CUPnPLiteSelectionFiller::PlaylistSize()
+    {
+    return iObjectList.Count();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteSelectionFiller::~CUPnPLiteSelectionFiller
+//---------------------------------------------------------------------------
+EXPORT_C CUPnPLiteSelectionFiller::~CUPnPLiteSelectionFiller()
+    {
+    iObjectList.Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteSelectionFiller::CUPnPLiteSelectionFiller
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPLiteSelectionFiller::CUPnPLiteSelectionFiller()
+    : iObjectList( KItemListGranularity )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPLiteSelectionFiller::ConstructL
+// 2nd phase constructor.
+// --------------------------------------------------------------------------
+// 
+void CUPnPLiteSelectionFiller::ConstructL( 
+    const RPointerArray<CUpnpObjectLite>& aObjectList,
+    const CUpnpAVDevice& aMediaServer )
+    {
+    __LOG( "CUPnPLiteSelectionFiller::ConstructL" );
+    
+    // Set object list
+    TInt count = aObjectList.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        iObjectList.AppendL( aObjectList[i] );
+        }
+
+    // Set device uid
+    SetSourceDeviceL( aMediaServer );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnpmpxhelper.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,285 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class for some common MPX routines
+*
+*/
+
+
+// INCLUDES
+class MMPXCollection;
+#include <mpxcollectionmediator.h>
+#include <mpxharvesterutility.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionpath.h>
+#include <mpxmedia.h>
+#include <mpxmediageneraldefs.h> // for KMPXMediaGeneralCollectionId
+#include <mpxmediacontainerdefs.h> // for KMPXMediaArrayContents
+#include <mpxcollectiontype.h> // for CMPXCollectionType
+#include <mpxplaylistenginedefs.h> // for EMPXPlaylistTypeM3U
+#include <mpxcollectionplugin.hrh> // for EMPXCollectionPluginHidden and
+#include "upnpmusicadapter.h"      // EMPXCollectionPluginTemporary
+
+// ourselves
+#include "upnpmpxhelper.h" // myself
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPMpxHelper::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMpxHelper* CUPnPMpxHelper::NewL( const TUid& aModeId )
+    {
+    CUPnPMpxHelper* self = new(ELeave)
+        CUPnPMpxHelper();
+    CleanupStack::PushL( self );
+    self->ConstructL( aModeId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMpxHelper::CUPnPMpxHelper
+// Default constructor.
+// --------------------------------------------------------------------------
+//    
+CUPnPMpxHelper::CUPnPMpxHelper()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMpxHelper::ConstructL
+// 2nd phase constructor
+// --------------------------------------------------------------------------
+//    
+void CUPnPMpxHelper::ConstructL( const TUid& aModeId )
+    {
+    iHarvester = CMPXHarvesterFactory::NewL();
+    iCollectionUtil = MMPXCollectionUtility::NewL( 0, aModeId );
+        
+    iMediator = CMPXCollectionMediator::NewL( 
+        iCollectionUtil->Collection(), this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMpxHelper::~CUPnPMpxHelper
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMpxHelper::~CUPnPMpxHelper()
+    {
+    if( iHarvester )
+        {
+        iHarvester->Close();
+        }
+    
+    if( iCollectionUtil )
+        {
+        iCollectionUtil->Close(); 
+        }
+    delete iMediator;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMpxHelper::AddTrackL
+// --------------------------------------------------------------------------
+//
+void CUPnPMpxHelper::AddTrackL( CMPXMedia* aMedia )
+    {
+    // Add to harvester 
+    TInt colUid = iHarvester->AddFileL( aMedia );
+
+    // Add to collection, make sure we set the collection ID
+    aMedia->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, TUid::Uid( colUid ) );
+
+    iMediator->AddItemL( aMedia );
+
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMpxHelper::AddPlaylistL
+// --------------------------------------------------------------------------
+//
+void CUPnPMpxHelper::AddPlaylistL( CMPXMedia* aMedia )
+    {
+    // leave if the given media doesn't contain the following attributes
+    if ( !aMedia->IsSupported( KMPXMediaGeneralType ) ||
+         !aMedia->IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // leave if the given media isn't a playlist
+    TMPXGeneralType mediaType =
+        *aMedia->Value<TMPXGeneralType>( KMPXMediaGeneralType );
+    TMPXGeneralCategory mediaCategory =
+        *aMedia->Value<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+    if ( mediaType != EMPXItem || mediaCategory != EMPXPlaylist )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // leave if the media doesn't contain mandatory attributes
+    if ( !aMedia->IsSupported( KMPXMediaArrayContents ) ||
+         !aMedia->IsSupported( KMPXMediaArrayCount ) )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // check if we are adding new or appending to existing
+    if (!aMedia->IsSupported(KMPXMediaGeneralId))
+        {
+        if (!aMedia->IsSupported(KMPXMediaGeneralTitle) ||
+            !aMedia->IsSupported(KMPXMediaGeneralUri))
+            {
+            User::Leave( KErrArgument );
+            }
+        else
+            {
+            // adding new
+            // find the collection Id
+            HBufC* playlistExtension =
+                iHarvester->PlaylistFileExtensionLC( EMPXPlaylistTypeM3U );
+            TInt collectionId = FindCollectionIdL( *playlistExtension );                
+            CleanupStack::PopAndDestroy( playlistExtension );
+
+            // Add to collection, make sure we set the collection ID.
+            aMedia->SetTObjectValueL<TUid>(
+                KMPXMediaGeneralCollectionId, TUid::Uid( collectionId ));
+            }
+        }
+    else
+        {
+        // appending to existing
+        FillInPlaylistDetailsL( *aMedia );
+        }
+
+    iMediator->AddItemL( aMedia );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMpxHelper::OpenL
+// --------------------------------------------------------------------------
+//
+void CUPnPMpxHelper::AddAndOpenL( const TUid& aHostId, CMPXMedia& aMedia )
+    {
+    // Grab the in memory collection plugin UID
+    // aPluginInfo provides additional resolution to find the plugin
+    //
+    RArray<TUid> ary;
+    CleanupClosePushL( ary );
+    ary.AppendL( TUid::Uid( EMPXCollectionPluginHidden ) );
+    ary.AppendL( TUid::Uid( EMPXCollectionPluginTemporary ) );
+    TUid inMemCollection = iCollectionUtil->CollectionIDL( ary.Array() );
+    CleanupStack::PopAndDestroy( &ary );
+
+    // First step is to add this media to the in memory plugin
+    // Set the item id to be the host ID
+    // 
+    aMedia.SetTObjectValueL( KMPXMediaGeneralCollectionId, inMemCollection );
+    aMedia.SetTObjectValueL( KMPXMediaGeneralId, aHostId.iUid );
+    iCollectionUtil->Collection().AddL( aMedia );
+
+    // Second Step is to construct collection path
+    // | collection id | host id |
+    //
+    CMPXCollectionPath* path = CMPXCollectionPath::NewL();
+    CleanupStack::PushL( path );
+    path->AppendL( inMemCollection.iUid );
+    path->AppendL( aHostId.iUid );
+
+    // Last step is to open this path
+    //
+    iCollectionUtil->Collection().OpenL( *path );
+    CleanupStack::PopAndDestroy( path );
+    }
+
+// ---------------------------------------------------------------------------
+// retrieve collection from URI
+// ResolvePlugin should be able to resolve the plugin without
+// the client looking for the collection Id
+// ---------------------------------------------------------------------------
+//    
+TInt CUPnPMpxHelper::FindCollectionIdL( const TDesC& aUri )   
+    {
+    TInt collectionId(KErrNotFound);
+
+    TParsePtrC parser( aUri );   
+            
+    RPointerArray<CMPXCollectionType> collectionType;
+    iCollectionUtil->Collection().GetSupportedTypesL(collectionType);
+    
+    TInt index(KErrNotFound);
+    TInt count( collectionType.Count() );
+    
+    for (TInt i = 0; i < count; i++)
+        {
+        const CDesCArray& extensions = collectionType[i]->Extensions();
+        
+        if (extensions.FindIsq(parser.Ext(), index) == 0)
+            {
+            collectionId = collectionType[i]->Uid().iUid;
+            break;
+            }
+        }
+        
+    collectionType.ResetAndDestroy();
+    
+    return collectionId;
+    }
+
+// ---------------------------------------------------------------------------
+// retrieve information for the required attributes
+// ---------------------------------------------------------------------------
+//
+void CUPnPMpxHelper::FillInPlaylistDetailsL( CMPXMedia& aMedia )
+    {
+    // retrieve info about the playlist itself
+    RArray<TMPXAttribute> playlistAttributes;
+    CleanupClosePushL(playlistAttributes);
+    playlistAttributes.AppendL(KMPXMediaGeneralId);
+    playlistAttributes.AppendL(KMPXMediaGeneralTitle);
+    playlistAttributes.AppendL(KMPXMediaGeneralUri);
+    playlistAttributes.AppendL(KMPXMediaGeneralCollectionId);
+
+    CMPXMedia* playlistSearchResult = iCollectionUtil->Collection()
+        .FindAllL( aMedia, playlistAttributes.Array() );
+    CleanupStack::PopAndDestroy(&playlistAttributes);
+    CleanupStack::PushL(playlistSearchResult);
+
+    const CMPXMediaArray* results =
+        playlistSearchResult->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+
+    if ( results->Count() != 1 )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    aMedia.SetTObjectValueL(
+        KMPXMediaGeneralId, *(*results)[0]->Value<TMPXItemId>(KMPXMediaGeneralId));
+    aMedia.SetTextValueL(
+        KMPXMediaGeneralTitle, (*results)[0]->ValueText(KMPXMediaGeneralTitle));
+    aMedia.SetTextValueL(
+        KMPXMediaGeneralUri, (*results)[0]->ValueText(KMPXMediaGeneralUri));
+    aMedia.SetTObjectValueL(
+        KMPXMediaGeneralCollectionId, *(*results)[0]->Value<TUid>(KMPXMediaGeneralCollectionId));
+
+    CleanupStack::PopAndDestroy(playlistSearchResult);        
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnpmusicadapter.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,899 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  handles music playing within UPnP framework
+*
+*/
+
+
+// INCLUDE FILES
+// MPX framework api
+#include <mpxcommonframeworkdefs.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxplaybackutility.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxplaybackmessage.h>
+#include <mpxviewutility.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionmessage.h>
+#include <mpxmessagegeneraldefs.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontroller.h"
+#include "upnpavbrowsingsession.h"
+#include "upnpavdevice.h"
+
+// musicadapter internal
+#include "upnpmpxhelper.h"
+#include "upnpplaylistfiller.h"
+#include "upnpmusicadapter.h"
+
+// debug
+_LIT16( KComponentLogfile, "musicadapter.txt" );
+#include "upnplog.h"
+
+// constants
+_LIT16( KTempPlaylistTitle, "TempPlaylist" );
+const TUid KRemotePlayerUid = { 0x200075D8 }; // Remote player UID
+const TUid KLocalPlayerUid = { 0x200075D9 };  // Local player UID
+const TUid KHomeConnectUid = { 0x10208A0A };  // Home Connect app UID
+const TUid KPlaybackDialogUid = { 0x101FFCBD }; // UPnPPlayback dialog UID
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPMusicAdapter* CUPnPMusicAdapter::NewL( 
+MUPnPAVController& aAVController )
+    {
+    __LOG( "CUPnPMusicAdapter::NewL" );
+    
+    CUPnPMusicAdapter* self = new(ELeave) CUPnPMusicAdapter( aAVController );
+    __LOG1( "CUPnPMusicAdapter: self = %x", self );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::CUPnPMusicAdapter
+// Default constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMusicAdapter::CUPnPMusicAdapter( MUPnPAVController& aAVController )
+    : iAVController( aAVController )
+    {
+    iTrackArray = 0;
+    iPlaylist = 0;
+    iState = EStateIdle;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::ConstructL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicAdapter::ConstructL()
+    {
+    __LOG( "CUPnPMusicAdapter::ConstructL" );
+    
+    // Create playbackutility for playback comands
+    iPlaybackUtility = MMPXPlaybackUtility::NewL( KHomeConnectUid, this );
+    __LOG1( "iPlaybackUtility = %x", iPlaybackUtility );
+
+    // Create collectionutility 
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, 
+    KHomeConnectUid );
+    __LOG1( "iCollectionUtility = %x", iCollectionUtility );
+            
+    // Get an instance of view utility
+    iViewUtility = MMPXViewUtility::UtilityL();
+    __LOG1( "iViewUtility = %x", iViewUtility );
+    
+    // internal MPX helper for some advanced operations
+    iMpxHelper = CUPnPMpxHelper::NewL( KHomeConnectUid );
+
+    __LOG( "CUPnPMusicAdapter::ConstructL - end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::~CUPnPMusicAdapter
+// Destructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPMusicAdapter::~CUPnPMusicAdapter()
+    {
+    __LOG( "CUPnPMusicAdapter::~CUPnPMusicAdapter()" );
+
+    if ( iCurrentFillerState == EFillerStateFilling )
+        {
+        iCurrentFiller->CancelFill();
+        }
+
+    delete iMedia;
+    delete iCurrentFiller;    
+    delete iTrackArray;    
+    delete iPlaylist;
+    delete iWait;
+    delete iMpxHelper;
+
+    if( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        iPlaybackUtility = 0;
+        }
+        
+        
+    if( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        iCollectionUtility = 0;
+        }
+    
+    if( iViewUtility )
+        {
+        iViewUtility->Close();
+        iViewUtility = 0;
+        }
+    __LOG( "CUPnPMusicAdapter::~CUPnPMusicAdapter - End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::ExecuteMusicLiteInRemoteL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPMusicAdapter::ExecuteMusicLiteInRemoteL(
+    CEikAppUi* aAppUi,
+    MUPnPPlaylistFiller* aFiller,
+    const CUpnpAVDevice& aRenderer )
+    {
+    __LOG( "CUPnPMusicAdapter::ExecuteMusicLiteInRemoteL" );
+
+    InitState();
+    iAppUi = aAppUi;     
+    iRemotePlayer = ETrue;
+
+    TakeOwnershipOfTheFiller( aFiller );
+    iTargetDevice = &aRenderer;
+
+    // Create and fill playlist
+    CreatePlayListL();
+
+    // show the UI
+    UiShowLoopL();
+ 
+     __LOG1( "CUPnPMusicAdapter::ExecuteMusicInRemoteL returns %d",
+        iReturnCode );
+    return iReturnCode;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::ExecuteMusicLiteInLocalL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPMusicAdapter::ExecuteMusicLiteInLocalL(
+    CEikAppUi* aAppUi,
+    MUPnPPlaylistFiller* aFiller )
+    {
+    __LOG( "CUPnPMusicAdapter::ExecuteMusicLiteInLocalL" );
+
+    InitState();
+    iAppUi = aAppUi;
+    iRemotePlayer = EFalse;
+    
+    TakeOwnershipOfTheFiller( aFiller );
+    iTargetDevice = 0;
+    
+    // Create and fill playlist
+    CreatePlayListL();
+
+    // show the UI
+    UiShowLoopL();
+
+    __LOG1( "CUPnPMusicAdapter::ExecuteMusicInLocalL returns %d",
+        iReturnCode );
+    return iReturnCode;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::ExecuteMusicInRemoteL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPMusicAdapter::ExecuteMusicInRemoteL(
+    CEikAppUi* aAppUi,
+    CUPnPPlayListFiller* aFiller,
+    const CUpnpAVDevice& aRenderer )
+    {
+    __LOG( "CUPnPMusicAdapter::ExecuteMusicInRemoteL" );
+
+    InitState();
+    iAppUi = aAppUi;     
+    iRemotePlayer = ETrue;
+
+    TakeOwnershipOfTheFiller( aFiller );
+    iTargetDevice = &aRenderer;
+
+    // Create and fill playlist
+    CreatePlayListL();
+
+    // show the UI
+    UiShowLoopL();
+ 
+     __LOG1( "CUPnPMusicAdapter::ExecuteMusicInRemoteL returns %d",
+        iReturnCode );
+    return iReturnCode;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::ExecuteMusicInLocalL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPMusicAdapter::ExecuteMusicInLocalL(
+    CEikAppUi* aAppUi,
+    CUPnPPlayListFiller* aFiller )
+    {
+    __LOG( "CUPnPMusicAdapter::ExecuteMusicInLocalL" );
+
+    InitState();
+    iAppUi = aAppUi;
+    iRemotePlayer = EFalse;
+    
+    TakeOwnershipOfTheFiller( aFiller );
+    iTargetDevice = 0;
+    
+    // Create and fill playlist
+    CreatePlayListL();
+
+    // show the UI
+    UiShowLoopL();
+
+    __LOG1( "CUPnPMusicAdapter::ExecuteMusicInLocalL returns %d",
+        iReturnCode );
+    return iReturnCode;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::Dismiss
+// Dismiss the music player UI
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPMusicAdapter::Dismiss( TInt aReturnCode )
+    {
+    Exit( aReturnCode );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::UiShowLoop
+// Wait to show the UI
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::UiShowLoopL()
+    {
+    // ----------------------------------------
+    // PART 1 - wait part
+    // ----------------------------------------
+    if ( iState == EStatePreparing )
+        {
+        // Not yet ready to go. Wait until signalled to proceed
+        iWait = new (ELeave) CActiveSchedulerWait();
+        __LOG( "UiShowLoopL: wait..." );
+        iState = EStatePreparingWait;
+        iWait->Start();
+        delete iWait;
+        iWait = 0;
+        }
+    else 
+        {
+        __LOG( "UiShowLoopL: no need to wait" );
+        }
+
+    // ----------------------------------------
+    // PART 2 - action part
+    // ----------------------------------------
+    if ( iState == EStateInitialising )
+        {
+        __LOG( "Activate playback view" );  
+        iViewUtility->ActivateViewL( KPlaybackDialogUid );
+        iState = EStateClosing;
+        }
+    else if ( iState == EStateClosing )
+        {
+        // Exit signalled before UI was shown
+        }
+    else
+        {
+        // illegal state
+        __PANICD( __FILE__, __LINE__ );
+        }
+    iState = EStateIdle;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::DisplayUI
+// Commands the UI to show
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::DisplayUI()
+    {
+    __LOG1( "CUPnPMusicAdapter::DisplayUI() in state %d",
+        iState );
+    if ( iState == EStatePreparing )
+        {
+        // UiShowLoop can show UI directly - no wait
+        iState = EStateInitialising;
+        }
+    else if ( iState == EStatePreparingWait )
+        {
+        // release wait loop in UiShowLoop
+        __ASSERTD( iWait != 0, __FILE__, __LINE__ );
+        iState = EStateInitialising;
+        iWait->AsyncStop();
+        }
+    else
+        {
+        // should never be here
+        __PANICD( __FILE__, __LINE__ );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::Exit
+// Performs cleanup and releases the execute thread
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::Exit( TInt aReturnCode )
+    {
+    __LOG2( "CUPnPMusicAdapter::Exit(%d) in state %d",
+        aReturnCode, iState );
+    if ( iState == EStatePreparing )
+        {
+        // change state - UiShowLoop will exit immediately
+        iReturnCode = aReturnCode;
+        iState = EStateClosing;
+        }
+    if ( iState == EStatePreparingWait )
+        {
+        // release wait loop in UiShowLoop
+        __ASSERTD( iWait != 0, __FILE__, __LINE__ );
+        iReturnCode = aReturnCode;
+        iState = EStateClosing;
+        iWait->AsyncStop();
+        }
+    else if ( iState == EStateInitialising ||
+        iState == EStateRunning )
+        {
+        __ASSERTD( iViewUtility != 0, __FILE__, __LINE__ );
+        iReturnCode = aReturnCode;
+        iState = EStateClosing;
+        // Send a close command to plugin with this error code.
+        // Plugin will notify that it is not available,
+        // and then the player UI will exit
+        TRAP_IGNORE( iPlaybackUtility->CommandL( 
+            EPbCmdClose, KMusicPluginMessageExit ) );
+        }
+    else if ( iState == EStateClosing )
+        {
+        // do nothing - already in exit process
+        }
+    else
+        {
+        // should never be here
+        __PANICD( __FILE__, __LINE__ );
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::CreatePlayList
+// --------------------------------------------------------------------------
+//    
+void CUPnPMusicAdapter::CreatePlayListL()
+    {
+    __LOG( "CUPnPMusicAdapter::CreatePlayList" );
+    __ASSERTD( iState == EStateIdle, __FILE__, __LINE__ );
+    iState = EStatePreparing;
+
+    // Get collection Uid
+    iPlaylistCollectionId = KInMemoryCollection;
+    iPlaylistCollectionId = iCollectionUtility->Collection()
+        .CollectionIDL( iPlaylistCollectionId );
+
+    // Create and fill the playlist
+    iTrackArray = CMPXMediaArray::NewL();
+    __LOG( "Filling object list" );
+    iCurrentFiller->FillL( *this, *iTrackArray );
+    if ( iCurrentFillerState == EFillerStateIdle )
+        {
+        iCurrentFillerState = EFillerStateFilling;
+        }
+
+    iMedia = CMPXMedia::NewL();
+    // set collection id
+    iMedia->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, iPlaylistCollectionId );
+    // Set type
+    iMedia->SetTObjectValueL<TMPXGeneralType>( 
+        KMPXMediaGeneralType, EMPXItem );
+    // Set category
+    iMedia->SetTObjectValueL<TMPXGeneralCategory>( 
+        KMPXMediaGeneralCategory, EMPXPlaylist );
+    // Set title
+    iMedia->SetTextValueL( 
+        KMPXMediaGeneralTitle, KTempPlaylistTitle );
+    // set contents
+    iMedia->SetCObjectValueL( 
+        KMPXMediaArrayContents, iTrackArray );  
+    // set size
+    __LOG1( "Set Array count=%d", iCurrentFiller->PlaylistSize() );
+    iMedia->SetTObjectValueL( 
+        KMPXMediaArrayCount,  iCurrentFiller->PlaylistSize() );
+
+    __LOG( "Create collection playlist" );
+    // Create collection playlist
+    iMpxHelper->AddAndOpenL( KHomeConnectUid, *iMedia );
+
+    __LOG( "CUPnPMusicAdapter::CreatePlayList - end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::HandleCollectionMessage
+// From MMPXCollectionObserver.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::HandleCollectionMessage(CMPXMessage* aMsg, 
+    TInt aErr )
+    {
+    __LOG1( "CUPnPMusicAdapter::HandleCollectionMessage: error %d", aErr );
+    if( aMsg && aErr == KErrNone )
+        {        
+        TInt event = KErrNotSupported;
+        TInt type = KErrNotSupported;
+        TInt data = KErrNotSupported;
+        
+        if( aMsg->IsSupported( KMPXMessageGeneralEvent ) )
+            {
+            event = *aMsg->Value<TInt>( KMPXMessageGeneralEvent );
+            }
+        if( aMsg->IsSupported( KMPXMessageGeneralType ) )
+            {
+            type = *aMsg->Value<TInt>( KMPXMessageGeneralType );
+            }
+        if( aMsg->IsSupported( KMPXMessageGeneralData ) )
+            {
+            data = *aMsg->Value<TInt>( KMPXMessageGeneralData );
+            }
+
+        TRAPD( error, DoHandleCollectionMessageL( event, type, data ) );
+        if ( error != KErrNone )
+            {
+            __LOG1( "DoHandleCollectionMessageL: leave with %d", error );
+            Exit( error );
+            }
+        }
+    else
+        {
+        Exit( aErr );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::DoHandleCollectionMessageL
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::DoHandleCollectionMessageL(
+    TInt aEvent, TInt /*aType*/, TInt /*aData*/ )
+    {
+    __LOG( "CUPnPMusicAdapter::DoHandleCollectionMessageL" );
+
+    switch ( aEvent )
+        {
+        case TMPXCollectionMessage::EPathChanged:
+            {
+            __LOG( "HandleCollectionMessageL: EPathChanged" );
+
+            if ( iState == EStatePreparing || iState == EStatePreparingWait )
+                {
+                __LOG( "Pick up playlist from collection" );
+                CMPXCollectionPath* path = 
+                iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL( path );
+                // select track with given index
+                __LOG1( "Set selected index = %d",
+                    iCurrentFiller->SelectedIndex() );
+                path->Set( iCurrentFiller->SelectedIndex() );
+
+                __LOG( "Ccreating new playlist" );
+                delete iPlaylist;
+                iPlaylist = NULL;
+                iPlaylist = CMPXCollectionPlaylist::NewL( *path );
+                __LOG1( "iPlaylist = %x", iPlaylist );
+                iPlaylist->SetEmbeddedPlaylist( ETrue );
+                CleanupStack::PopAndDestroy( path );
+
+                // Disable repeat and shuffle modes
+                iPlaylist->SetRepeatEnabled( EFalse );
+                iPlaylist->SetShuffleEnabledL( EFalse );
+
+                // Get subplayers if remote playback
+                if( iRemotePlayer )
+                    {
+                    __LOG( "calling SubPlayerNamesL" );
+                    iPlaybackUtility->PlayerManager().SubPlayerNamesL( *this,
+                        KRemotePlayerUid );
+                    }
+                else // Local playback. Get subplayer is no needed.
+                    {
+                    __LOG( "calling SelectPlayerL(local)" );
+                    iPlaybackUtility->PlayerManager().SelectPlayerL(
+                        KLocalPlayerUid );
+                    __LOG("calling InitL");
+                    iPlaybackUtility->InitL( *iPlaylist, ETrue );          
+                    }
+                }
+            }
+            break;
+        default:
+            {
+            } 
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::HandleSubPlayerNamesL
+// From MMPXPlaybackCallback 
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicAdapter::HandleSubPlayerNamesL( TUid aPlayer, 
+    const MDesCArray* aSubPlayers, TBool aComplete, TInt aError )
+    {
+    TRAPD( error, DoHandleSubPlayerNamesL(
+        aPlayer, aSubPlayers, aComplete, aError ) );
+    if ( error != KErrNone )
+        {
+        __LOG1( "HandleSubPlayerNamesL: leave with %d", error );
+        Exit( error );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::DoHandleSubPlayerNamesL
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicAdapter::DoHandleSubPlayerNamesL( TUid /*aPlayer*/, 
+    const MDesCArray* aSubPlayers, TBool /*aComplete*/, TInt aError )
+    {
+    __LOG( "CUPnPMusicAdapter::HandleSubPlayerNamesL" );
+
+    if( aError == KErrNone)
+        {
+        // Find out Subplayer index
+        TInt count = aSubPlayers->MdcaCount();
+        TInt subplayerIndex = KErrNotFound; 
+            
+        TBuf<256> id16;
+        id16.Copy( iTargetDevice->FriendlyName() );
+                
+        for( TInt i = 0; i < count; i++ )
+            {
+            // If subplayer match.
+            if( !aSubPlayers->MdcaPoint(i).Compare( id16 ) )
+                {
+                subplayerIndex = i;
+                break;
+                }
+            }   
+            
+        if( subplayerIndex != KErrNotFound )
+            {
+            __LOG1( "calling SelectSubPlayerL(%d)", subplayerIndex );
+            iPlaybackUtility->PlayerManager().SelectSubPlayerL(
+            KRemotePlayerUid, subplayerIndex );
+                    
+            iTargetDevice = 0; 
+                                                        
+            __LOG( "calling InitL" );
+            iPlaybackUtility->InitL( *iPlaylist, ETrue );             
+            }
+       else
+            {
+            __LOG( "HandleSubPlayerNamesL: subplayer not found! " );
+            Exit( KErrNotFound );
+            } 
+        }
+    else // Error with SubPlayerNamesL
+        {
+        __LOG1( "HandleSubPlayerNamesL: Error=%d", aError );
+        Exit( aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::HandlePlaybackMessage
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::HandlePlaybackMessage(CMPXMessage* aMsg,
+    TInt aErr )
+    {
+    __LOG1( "HandlePlaybackMessage: error %d", aErr );
+    if( aMsg && aErr == KErrNone )
+        {
+        if (aMsg->IsSupported(KMPXMessageGeneralId))
+            {
+            TInt id = static_cast<TInt>(
+                    *aMsg->Value<TMPXMessageId>(KMPXMessageGeneralId));
+            TInt error(KErrNone);
+            if ( id==KMPXMessageGeneral )
+                {                    
+                TInt event = KErrNotSupported;
+                TInt type = KErrNotSupported;
+                TInt data = KErrNotSupported;
+                
+                if( aMsg->IsSupported( KMPXMessageGeneralEvent ) )
+                    {
+                    event = *aMsg->Value<TInt>( KMPXMessageGeneralEvent );
+                    }
+                if( aMsg->IsSupported( KMPXMessageGeneralType ) )
+                    {
+                    type = *aMsg->Value<TInt>( KMPXMessageGeneralType );
+                    }
+                if( aMsg->IsSupported( KMPXMessageGeneralData ) )
+                    {
+                    data = *aMsg->Value<TInt>( KMPXMessageGeneralData );
+                    }    
+                    
+                TRAP( error, DoHandlePlaybackMessageL( event, type, data ) );
+                }
+            if ( error != KErrNone )
+                {
+                __LOG1( "DoHandlePlaybackMessage: leave with %d", error );
+                Exit( error );
+                }
+            } // else dummy message
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::DoHandlePlaybackMessageL
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::DoHandlePlaybackMessageL( 
+    TInt aEvent, TInt /*aType*/, TInt /*aData*/ )
+    {
+    __LOG( "CUPnPMusicAdapter::DoHandlePlaybackMessageL" );
+
+    switch ( aEvent )
+        {
+        case TMPXPlaybackMessage::EPlayerChanged:
+            {
+            if ( iState == EStatePreparing ||
+                iState == EStatePreparingWait )
+                {
+                DisplayUI();
+                }
+            }   
+            break;                  
+        case TMPXPlaybackMessage::EInitializeComplete:
+            {
+            if ( iState == EStateInitialising )
+                {
+                __LOG( "Calling CommandL( EPbCmdPlay )" );
+                iState = EStateRunning;
+                iPlaybackUtility->CommandL( EPbCmdPlay );
+                }
+            }
+            break;
+        default:
+            {
+            break;
+            }
+        }        
+    }
+
+
+// --------------------------------------------------------------------------
+// Unused callbacks here
+// --------------------------------------------------------------------------
+
+    
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::HandlePropertyL
+// From MMPXPlaybackCallback 
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::HandlePropertyL( 
+    TMPXPlaybackProperty /*aProperty*/, TInt /*aValue*/, TInt /*aError*/ )
+    {
+    __LOG( "CUPnPMusicAdapter::HandlePropertyL - Not used." );
+    // Not used.
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::HandleMediaL
+// From MMPXPlaybackCallback 
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicAdapter::HandleMediaL( 
+    const CMPXMedia& /*aProperties*/, TInt /*aError*/ )
+    {
+    __LOG( "CUPnPMusicAdapter::HandleMediaL - Not used" );
+    // Not used.
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::HandleCollectionMediaL
+// From MMPXCollectionObserver.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::HandleCollectionMediaL(
+    const CMPXMedia& /*aMedia*/, 
+    TInt /*aError*/ )
+    {
+    __LOG( "CUPnPMusicAdapter::HandleCollectionMediaL - Not used!" );
+    // Not used
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::HandleOpenL
+// From MMPXCollectionObserver.
+// Handles the collection entries being opened.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::HandleOpenL(
+    const CMPXMedia& /* aEntries */,
+    TInt /* aIndex */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    __LOG( "CUPnPMusicAdapter::HandleOpenL - not used!" );
+    // Not used
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::HandleOpenL
+// From MMPXCollectionObserver.
+// Handles the item being opened.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::HandleOpenL(
+    const CMPXCollectionPlaylist& /*aPlaylist*/,
+    TInt /*aError*/ )
+    {
+    __LOG( "CUPnPMusicAdapter::HandleOpenL - not used!" );
+    // Not used
+    }
+ 
+ // --------------------------------------------------------------------------
+// CUPnPMusicAdapter::HandleEmbeddedOpenL
+// From MMPXCHelperEmbeddedOpenObserver
+// Handles errors from that occured in embedded mode
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicAdapter::HandleCommandComplete(
+    CMPXCommand* aCommandResult, TInt /*aError*/ )
+    {
+     __LOG( "CUPnPMusicAdapter::HandleCommandComplete - not used!" );
+     delete aCommandResult;
+    // Not used
+    }
+ 
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::InitState
+// initialises the state before execution
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicAdapter::InitState()
+    {
+    iReturnCode = KErrNone;
+    if ( iState != EStateIdle )
+        {
+        // dispose the wait object (just in case)
+        delete iWait;
+        iWait = 0;
+        // dispose temporary class members
+        delete iTrackArray;
+        iTrackArray = 0;
+        delete iMedia;
+        iMedia = 0;
+        delete iPlaylist;
+        iPlaylist = 0;
+        // reset state
+        iState = EStateIdle;
+        }
+    if ( !iViewUtility )
+        {
+        TInt error = KErrNone;
+        TRAP( error, iViewUtility = MMPXViewUtility::UtilityL() );
+	    if( error != KErrNone )
+	        {
+	        __LOG( "InitState: Creating viewutility leaves" );
+	        Exit( error );
+	        }
+	    __LOG1( "iViewUtility = %x", iViewUtility );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::TakeOwnershipOfTheFiller
+// this one should be pretty self-explanatory.
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicAdapter::TakeOwnershipOfTheFiller(
+    MUPnPPlaylistFiller* aFiller )
+    {
+    if ( iCurrentFiller != 0 )
+        {
+        delete iCurrentFiller;
+        iCurrentFiller = 0;
+        }
+    iCurrentFiller = aFiller;
+    iCurrentFillerState = EFillerStateIdle;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::Complete
+// Default constructor.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicAdapter::Complete( MUPnPPlaylistFiller* aFiller )
+    {
+    __LOG( "CUPnPMusicAdapter::Complete" );
+    if ( aFiller == iCurrentFiller )
+        {
+        iCurrentFillerState = EFillerStateComplete;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::AVController
+// Returns the shared AVController resource
+// --------------------------------------------------------------------------
+//    
+MUPnPAVController& CUPnPMusicAdapter::AVController()
+    {
+    return iAVController;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::CollectionUiHelper
+// --------------------------------------------------------------------------
+//
+TUid CUPnPMusicAdapter::PlaylistCollectionId()
+    {
+    return iPlaylistCollectionId;
+    }
+
+    
+// --------------------------------------------------------------------------
+// CUPnPMusicAdapter::CollectionUtility
+// --------------------------------------------------------------------------
+//
+MMPXCollectionUtility& CUPnPMusicAdapter::CollectionUtility()
+    {
+    return *iCollectionUtility;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnpplaylistfiller.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,312 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base class for filling an MPX playlist
+*
+*/
+
+
+// INCLUDES
+// System
+#include <escapeutils.h> // for unicode conversion
+
+// upnp utility 
+#include "upnpitemutility.h"
+
+// upnp stack api
+#include <upnpobject.h>
+
+// XML framework api
+#include <mpxcollectionplaylist.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+
+// upnpframework / avcontroller api
+#include "upnpavdevice.h" // for the device
+
+// upnpframeowrk / avcotnroller helper api
+#include "upnpconstantdefs.h" // for KClassAudio
+
+// musicadapter internal
+#include "upnpmusicadapter.h" // for Complete(this)
+#include "upnpplaylistfiller.h"
+
+// debug
+_LIT16( KComponentLogfile, "musicadapter.txt" );
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT16( KUPnPPrefix, "upnp:" );
+_LIT16( KSeparator, "*" );
+const TInt KMaxElementSize = 256; // from UPNP/DLNA
+const TInt KItemListGranularity = 20;
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPPlayListFiller* CUPnPPlayListFiller::NewL()
+    {
+    CUPnPPlayListFiller* self = new(ELeave)
+        CUPnPPlayListFiller();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::CUPnPPlayListFiller
+// Default constructor.
+// --------------------------------------------------------------------------
+//    
+CUPnPPlayListFiller::CUPnPPlayListFiller()
+    : iItemList( KItemListGranularity )
+    {
+    iSelectedIndex = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::~CUPnPPlayListFiller
+// Destructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPPlayListFiller::~CUPnPPlayListFiller()
+    {
+    __LOG( "CUPnPPlayListFiller::~CUPnPPlayListFiller" );
+    
+    iItemList.Reset();
+    delete iDeviceUid;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::InsertObjectL
+// Fill track data into the playlist
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPPlayListFiller::InsertObjectL(
+    const CUpnpAVDevice& aMediaServer,
+    const CUpnpObject& aObject )
+    {
+    if ( !iSourceDevice )
+        {
+        iSourceDevice = &aMediaServer;        
+        iDeviceUid = HBufC::NewL( aMediaServer.Uuid().Length() );
+        iDeviceUid->Des().Copy( aMediaServer.Uuid() );
+        }
+    else
+        {
+        // we only support playlists from a single device.
+        __ASSERTD( &aMediaServer == iSourceDevice , __FILE__, __LINE__ );
+        }
+
+    iItemList.AppendL( &aObject );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::SetSelectedIndex
+// Sets the index of pre-selected item
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPPlayListFiller::SetSelectedIndex(
+    TInt aSelectedIndex )
+    {
+    __ASSERTD( aSelectedIndex >= 0, __FILE__, __LINE__ );
+    __ASSERTD( aSelectedIndex < iItemList.Count(), __FILE__, __LINE__ );
+    iSelectedIndex = aSelectedIndex;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::FillL
+// Fill track data into the playlist
+// --------------------------------------------------------------------------
+//
+void CUPnPPlayListFiller::FillL(
+    CUPnPMusicAdapter& aHost,
+    CMPXMediaArray& aPlaylist )
+    {
+    __LOG( "CUPnPPlayListFiller::FillL" );
+    SetHost( aHost );
+    DoFillL( aPlaylist, iItemList );
+    DoComplete();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::CancelFill
+// --------------------------------------------------------------------------
+//
+void CUPnPPlayListFiller::CancelFill()
+    {
+    // no implementation required
+    // - this class does not have async nature
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::PlaylistSize
+// Returns the total playlist size
+// --------------------------------------------------------------------------
+//
+TInt CUPnPPlayListFiller::PlaylistSize()
+    {
+    return iItemList.Count();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::ObjectArray
+// returns a non-modifiable reference of the object list
+// --------------------------------------------------------------------------
+//
+const RPointerArray<CUpnpObject>& CUPnPPlayListFiller::ObjectArray()
+    {
+    return iItemList;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::SourceDevice
+// returnsthe media server the playlist is located
+// --------------------------------------------------------------------------
+//
+const CUpnpAVDevice& CUPnPPlayListFiller::SourceDevice()
+    {
+    return *iSourceDevice;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::SetHost
+// Assigns the host music adapter
+// --------------------------------------------------------------------------
+//
+void CUPnPPlayListFiller::SetHost( CUPnPMusicAdapter& aHost )
+    {
+    iHost = &aHost;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::Host
+// returns the host music adapter
+// --------------------------------------------------------------------------
+//
+CUPnPMusicAdapter& CUPnPPlayListFiller::Host() const
+    {
+    __ASSERTD( iHost != 0 , __FILE__, __LINE__ );
+    return *iHost;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::SelectedIndex
+// Index of selected item
+// --------------------------------------------------------------------------
+//
+TInt CUPnPPlayListFiller::SelectedIndex() const
+    {
+    return iSelectedIndex;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::DoFillL
+// Fill track data into the playlist - base class implementation
+// --------------------------------------------------------------------------
+//
+TInt CUPnPPlayListFiller::DoFillL( CMPXMediaArray& aPlaylist,
+    const RPointerArray<CUpnpObject>& aSource, TInt /*aStartIndex*/ )
+    {
+    __LOG( "CUPnPPlayListFiller::DoFillL" );
+    
+    // Add currently cached items to the playlist
+  
+    TInt i = 0;
+    for( ; i < aSource.Count() ; ++i )
+        {
+        DoFillObjectL( aPlaylist, *aSource[i], i );
+        }
+    
+    __LOG( "CUPnPPlayListFiller::DoFillL - end" );
+    
+    return i;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::DoFillObjectL
+// Fills a ingle object to a playlist
+// --------------------------------------------------------------------------
+//
+void CUPnPPlayListFiller::DoFillObjectL(  CMPXMediaArray& aPlaylist,
+    const CUpnpObject& aObject, TInt /*aIndex*/ )
+    {
+    // Create new media object for track
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL( media );
+    // Set type
+    media->SetTObjectValueL<TMPXGeneralType>( 
+        KMPXMediaGeneralType, EMPXItem );
+    // Set gategory
+    media->SetTObjectValueL<TMPXGeneralCategory>( 
+        KMPXMediaGeneralCategory, EMPXSong );
+    // URI
+    if( UPnPItemUtility::BelongsToClass( aObject , KClassAudio ) )
+        {
+        ConvertToURI( *iDeviceUid, aObject, iTempBuf );
+        }
+    else // item is non audio set uri to KUPnPPrefix
+    	{
+    	iTempBuf.Copy( KUPnPPrefix );
+    	}
+    
+    media->SetTextValueL( 
+        KMPXMediaGeneralUri, iTempBuf );
+    // Title
+    HBufC16* buf = 
+        EscapeUtils::ConvertToUnicodeFromUtf8L( aObject.Title() );
+    CleanupStack::PushL( buf );
+    media->SetTextValueL( 
+        KMPXMediaGeneralTitle, *buf );
+    CleanupStack::PopAndDestroy( buf );
+    // Add track to the object list
+    aPlaylist.AppendL( media );
+    CleanupStack::Pop( media );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::DoComplete
+// Completes the object, causing it to be destroyed.
+// --------------------------------------------------------------------------
+//
+void CUPnPPlayListFiller::DoComplete()
+    {
+    Host().Complete( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlayListFiller::ConvertToURI
+// Convert UPnP item to playlist item URI string
+// --------------------------------------------------------------------------
+//  
+void CUPnPPlayListFiller::ConvertToURI( const TDesC& aDeviceUid,
+    const CUpnpObject& aItem, TDes& aBuffer )
+    {
+    // Start with upnp prefix
+    aBuffer.Copy( KUPnPPrefix );
+    aBuffer.Append( aDeviceUid );
+
+    aBuffer.Append( KSeparator );
+    // add object id (converting 8->16 bit)
+    TBuf<KMaxElementSize> id16;
+    id16.Copy( aItem.Id() );
+    aBuffer.Append( id16 );
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnpmusicadapter/src/upnpplaylistservices.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,832 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  provides playlist handling services for UPnP framework
+*
+*/
+
+
+// INCLUDES
+// System
+#include <escapeutils.h> // for unicode conversion
+
+// upnp stack api
+#include <upnpitem.h> // s60 upnp stack
+#include <upnpelement.h> // s60 upnp stack
+
+// MPX framework api
+#include <mpxcollectionutility.h>
+#include <mpxcollectionframeworkdefs.h> // main attribute keys
+#include <mpxmediageneraldefs.h> // commonly used attribute keys
+#include <mpxmediacontainerdefs.h> // container-specific attribute keys
+#include <mpxmediamusicdefs.h> // music-specific attribute keys
+#include <mpxcollectionplugin.hrh> // collection plugin types
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpitemutility.h" // for FindElementByName & ResourceFromItemL
+#include "upnpconstantdefs.h" // for element names
+
+// upnpframework / internal api's
+#include "upnpcdsreselementutility.h" // for UriFromItemL 
+
+// music adapter internal
+#include "upnpmpxhelper.h" // for some mpx operations
+#include "upnpplaylistservices.h" // ourselves
+
+// upnpframework / settings engine api
+#include "upnpsettingsengine.h"     // CUPnPSettingsEngine
+
+// debug
+_LIT16( KComponentLogfile, "musicadapter.txt" );
+#include "upnplog.h"
+
+
+// constant definitions
+const TUid KHomeConnectUid = { 0x10208A0A };
+const TUid KMpxLocalCollectionUid = { 0x101FFC3A };
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPPlaylistServices* CUPnPPlaylistServices::NewL()
+    {
+    __LOG( "CUPnPPlaylistServices::NewL" );
+
+    CUPnPPlaylistServices* self = new(ELeave) CUPnPPlaylistServices();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::CUPnPPlaylistServices
+// Default constructor.
+// --------------------------------------------------------------------------
+//    
+CUPnPPlaylistServices::CUPnPPlaylistServices()
+    {
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::CUPnPPlaylistServices
+// 2nd phase constructor
+// --------------------------------------------------------------------------
+//    
+void CUPnPPlaylistServices::ConstructL()
+    {
+    __LOG( "CUPnPPlaylistServices::ConstructL" );
+    iStatus = KErrNone;
+    
+    iCollectionUtility = MMPXCollectionUtility::NewL(
+        (MMPXCollectionObserver*)0, KMcModePlaylist );
+            
+    // Initialize/Merge music collection databases
+    RArray<TUid> uid;
+    CleanupClosePushL( uid );
+    uid.AppendL( TUid::Uid( EMPXCollectionPluginMusic ) );
+    TUid collection = iCollectionUtility->CollectionIDL( uid.Array() );
+    TRAP( iStatus, iCollectionUtility->Collection().CommandL(
+        EMcCmdCollectionInit,  collection.iUid ) );
+    CleanupStack::PopAndDestroy( &uid );
+
+    iMpxHelper = CUPnPMpxHelper::NewL( KHomeConnectUid );
+    
+    
+    __LOG1( "CUPnPPlaylistServices::ConstructL end iStatus %d",
+         iStatus );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::~CUPnPPlaylistServices
+// Destructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPPlaylistServices::~CUPnPPlaylistServices()
+    {
+    __LOG( "CUPnPPlaylistServices ~()" );
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        iCollectionUtility = 0;
+        }
+
+    delete iMpxHelper;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::ListPlaylistsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPPlaylistServices::ListPlaylistsL(
+    CDesCArray& aPlaylistIds,
+    CDesCArray& aPlaylistNames )
+    {
+    __LOG( "ListPlaylistsL()" );
+    
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPPlaylistServices::ListPlaylistsL iStatus %d return",
+         iStatus );
+        return;
+        }
+        
+    CMPXMedia* result = FindItemL( EPlaylists,
+        KNullDesC, &KMPXMediaGeneralId, &KMPXMediaGeneralTitle );
+    if ( result != 0 )
+        {
+        CleanupStack::PushL( result );
+        __LOG("getting media array");
+        const CMPXMediaArray* medias = result->Value<CMPXMediaArray>(
+            KMPXMediaArrayContents );
+        TInt count = medias->Count();
+        for( TInt i = 0; i < count; ++i )
+            {
+            const CMPXMedia* entry = (*medias)[i];
+            TMPXItemId id = *entry->Value<TMPXItemId>(
+                KMPXMediaGeneralId );
+            const TDesC& title = entry->ValueText(
+                KMPXMediaGeneralTitle );
+            __LOG3( "media array %d/%d [%S]",
+                i, count, &title );
+            aPlaylistIds.AppendL( Id2Desc( id ) );
+            aPlaylistNames.AppendL( title );
+            }
+        CleanupStack::PopAndDestroy( result );
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::OpenPlaylistL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPPlaylistServices::OpenPlaylistL(
+    const TDesC& aPlaylistId,
+    CDesCArray& aContentMedia )
+    {
+    __LOG1( "OpenPlaylistL(%S)", &aPlaylistId );
+
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPPlaylistServices::OpenPlaylistL iStatus %d return",
+         iStatus );
+        return;
+        }
+        
+    CMPXMedia* result = FindItemL( EPlaylistById, aPlaylistId,
+        &KMPXMediaArrayContents, &KMPXMediaGeneralUri );
+    if ( result != 0 )
+        {
+        CleanupStack::PushL( result );
+        const CMPXMediaArray* resultMedias =
+            result->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+
+        if ( resultMedias->Count() == 1 )
+            {
+            // fetch content 
+            CMPXMedia* playlist = FetchPlaylistContentL( aPlaylistId );              
+            if( playlist != 0 )
+                {
+                CleanupStack::PushL( playlist );
+                const CMPXMediaArray* playlistMedias =
+                playlist->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+                if ( playlistMedias )
+                    {
+                    TInt count = playlistMedias->Count();
+                    for( TInt i = 0; i < count; ++i )
+                        {
+                        __LOG2( "accessing mediaList: item %d of %d",
+                            i, count );
+                        const CMPXMedia* entry = (*playlistMedias)[i];
+                        aContentMedia.AppendL( entry->ValueText(
+                            KMPXMediaGeneralUri ) );
+                        }
+                    }
+                CleanupStack::PopAndDestroy( playlist );
+                }
+            }
+        else
+            {
+            __LOG1("Unknown result medias count: %d",
+                resultMedias->Count() );
+            }
+        CleanupStack::PopAndDestroy( result );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    // now ready to return
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::CreateTrackL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPPlaylistServices::CreateTrackL(
+    const TDesC& aTrackPath,
+    const CUpnpItem& aTrackMetadata )
+    {
+    __LOG1( "CreateTrackL(%S)", &aTrackPath );
+
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPPlaylistServices::CreateTrackL iStatus %d return",
+         iStatus );
+        return;
+        }
+        
+    CMPXMedia* item = CMPXMedia::NewL();
+    CleanupStack::PushL( item );
+    item->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    item->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXItem );
+    item->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXSong );
+    item->SetTextValueL(
+        KMPXMediaGeneralUri, aTrackPath );
+    // Insert metadata
+    HBufC16* buf = NULL;
+    // title
+    buf = EscapeUtils::ConvertToUnicodeFromUtf8L( aTrackMetadata.Title() );
+    CleanupStack::PushL( buf );
+    item->SetTextValueL(
+        KMPXMediaGeneralTitle, *buf );
+    CleanupStack::PopAndDestroy( buf );
+    // artist
+    if ( ( buf = GetElementLC( aTrackMetadata, KElementArtist ) ) != 0 )
+        {
+        item->SetTextValueL(
+            KMPXMediaMusicArtist, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    else if ( ( buf = GetElementLC( aTrackMetadata, KElementCreator ) ) != 0 )
+        {
+        item->SetTextValueL(
+            KMPXMediaMusicArtist, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    // album
+    if ( ( buf = GetElementLC( aTrackMetadata, KElementAlbum ) ) != 0 )
+        {
+        item->SetTextValueL(
+            KMPXMediaMusicAlbum, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    // genre
+    if ( ( buf = GetElementLC( aTrackMetadata, KElementGenre ) ) != 0 )
+        {
+        item->SetTextValueL(
+            KMPXMediaMusicGenre, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    // date and year
+    const CUpnpElement* elem = UPnPItemUtility::FindElementByName(
+        aTrackMetadata, KElementDate );
+    if ( elem != 0 )
+        {
+        TTime timestamp;
+        TInt err = 
+            UPnPItemUtility::UPnPDateAsTTime( elem->Value(), timestamp );
+        if( err == KErrNone )
+            {
+            item->SetTObjectValueL<TInt64>( 
+                KMPXMediaGeneralDate, timestamp.Int64() );
+            
+            item->SetTObjectValueL<TInt64>( 
+                KMPXMediaMusicYear, timestamp.Int64() );
+            }
+        }
+        
+    // duration
+    const CUpnpElement* trackResource = 
+        &UPnPItemUtility::ResourceFromItemL( aTrackMetadata );
+     
+    if( trackResource != 0 )
+        {
+        const CUpnpAttribute* attr = UPnPItemUtility
+            ::FindAttributeByName( *trackResource, KAttributeDuration );
+
+        if ( attr != 0 )
+            {
+            TInt ms = 0;
+            UPnPItemUtility
+                ::UPnPDurationAsMilliseconds( attr->Value(), ms );
+            
+            item->SetTObjectValueL<TInt>(
+                KMPXMediaGeneralDuration, ms );
+            }
+        }
+
+    // track number
+    if ( ( buf = GetElementLC( aTrackMetadata, KElementTrackNumber ) ) != 0 )
+        {
+        item->SetTextValueL(
+            KMPXMediaMusicAlbumTrack, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+
+    __LOG("...about to add track...");
+    iMpxHelper->AddTrackL( item );
+
+    CleanupStack::PopAndDestroy( item );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::GetElement
+// --------------------------------------------------------------------------
+//
+HBufC16* CUPnPPlaylistServices::GetElementLC(
+    const CUpnpItem& aSource, const TDesC8& aSourceField ) const
+    {
+    HBufC16* result = 0;
+    const CUpnpElement* elem = UPnPItemUtility::FindElementByName(
+        aSource, aSourceField );
+    if ( elem != 0 )
+        {
+        result = EscapeUtils::ConvertToUnicodeFromUtf8L( elem->Value() );
+        CleanupStack::PushL( result );
+        }
+    return result;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::CreatePlaylistL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPPlaylistServices::CreatePlaylistL(
+    const TDesC& aPlaylistName,
+    const MDesCArray& aTrackPaths,
+    TDes* aPlaylistId )
+    {
+    __LOG1( "CreatePlaylistL(%S)", &aPlaylistName );
+
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPPlaylistServices::CreatePlaylistL iStatus %d return",
+         iStatus );
+        return;
+        }
+        
+    // create a media list
+    CMPXMediaArray* medias = CMPXMediaArray::NewL();
+    CleanupStack::PushL( medias );
+
+    // add track info into the media list
+    for( TInt i = 0; i < aTrackPaths.MdcaCount(); ++i )
+        {
+        TPtrC16 trackUri  = aTrackPaths.MdcaPoint(i);
+        CMPXMedia* entry = CMPXMedia::NewL();
+        CleanupStack::PushL( entry );
+        entry->SetTObjectValueL<TUid>(
+            KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+        entry->SetTObjectValueL<TMPXGeneralType>(
+            KMPXMediaGeneralType, EMPXItem );
+        entry->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, EMPXSong );
+        entry->SetTextValueL(
+            KMPXMediaGeneralUri, trackUri );
+        medias->AppendL( entry );
+        CleanupStack::Pop( entry );
+        }
+
+    // create a media item for the playlist
+    CMPXMedia* playlist = CMPXMedia::NewL();
+    CleanupStack::PushL( playlist );
+
+    CUPnPSettingsEngine* engine = CUPnPSettingsEngine::NewL();;
+    CleanupStack::PushL( engine );
+    
+    HBufC* location = HBufC::NewLC( KMaxFileName );
+    TPtr locationPtr( location->Des() );
+    TBool isPhoneMemory;
+    engine->GetCopyLocationL( locationPtr, isPhoneMemory );
+
+    // add playlist info into the playlist media
+    playlist->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    playlist->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXItem );
+    playlist->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXPlaylist );
+    playlist->SetTextValueL(
+        KMPXMediaGeneralTitle, aPlaylistName );
+    playlist->SetTextValueL(
+        KMPXMediaGeneralUri, locationPtr );
+    playlist->SetCObjectValueL(
+        KMPXMediaArrayContents, medias );
+    playlist->SetTObjectValueL<TInt>(
+        KMPXMediaArrayCount, medias->Count() );
+
+    // add in collection
+    __LOG("...about to add playlist...");
+    iMpxHelper->AddPlaylistL( playlist );
+    
+    iCurrentId = *playlist->Value<TMPXItemId>(
+        KMPXMediaGeneralId );
+
+    CleanupStack::PopAndDestroy( location );
+    CleanupStack::PopAndDestroy( engine );
+    CleanupStack::PopAndDestroy( playlist );
+    CleanupStack::PopAndDestroy( medias );
+
+    // Find out playlist ID
+    if ( aPlaylistId )
+        {
+        __LOG("...about to retrieve playlist id...");
+        aPlaylistId->Copy( Id2Desc( iCurrentId ) );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::AddMediaToPlaylistL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPPlaylistServices::AddMediaToPlaylistL(
+    const TDesC& aPlaylistId,
+    const TDesC& aTrackPath )
+    {
+    __LOG2( "AddMediaToPlaylistL(%S,%S)",
+        &aPlaylistId, &aTrackPath );
+    
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPPlaylistServices::AddMediaToPlaylistL iStatus %d return",
+         iStatus );
+        return;
+        }
+        
+    // create a media list
+    CMPXMediaArray* medias = CMPXMediaArray::NewL();
+    CleanupStack::PushL( medias );
+
+    // add new track to media list
+    CMPXMedia* entry = CMPXMedia::NewL();
+    CleanupStack::PushL( entry );
+    entry->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    entry->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXItem );
+    entry->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXSong );
+    entry->SetTextValueL(
+        KMPXMediaGeneralUri, aTrackPath );
+    medias->AppendL( entry );
+    CleanupStack::Pop( entry );
+
+    // create the playlist delta
+    CMPXMedia* playlistDelta = CMPXMedia::NewL();
+    CleanupStack::PushL( playlistDelta );
+
+    // add playlist info into the playlist delta media
+    playlistDelta->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    playlistDelta->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXItem );
+    playlistDelta->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXPlaylist );
+    playlistDelta->SetTObjectValueL<TMPXItemId>(
+        KMPXMediaGeneralId, Desc2Id( aPlaylistId ) );
+    playlistDelta->SetCObjectValueL(
+        KMPXMediaArrayContents, medias ); // new content
+    playlistDelta->SetTObjectValueL<TInt>(
+        KMPXMediaArrayCount, medias->Count() );
+
+    // add in collection
+    __LOG("Add playlist delta to collection");
+    iMpxHelper->AddPlaylistL( playlistDelta );
+
+    CleanupStack::PopAndDestroy( playlistDelta );
+    CleanupStack::PopAndDestroy( medias );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::DeleteTrackL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPPlaylistServices::DeleteTrackL(
+    const TDesC& aContentFile )
+    {
+    __LOG1( "DeleteTrackL(%S)", &aContentFile );
+    
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPPlaylistServices::DeleteTrackL iStatus %d return",
+         iStatus );
+        return;
+        }
+        
+    // item to delete
+    CMPXMedia* item = CMPXMedia::NewL();
+    CleanupStack::PushL( item );
+    item->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    item->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXItem );
+    item->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXSong );
+    item->SetTextValueL(
+        KMPXMediaGeneralUri, aContentFile );
+    iCollectionUtility->Collection().RemoveL( *item );
+    CleanupStack::PopAndDestroy( item );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::DeletePlaylistL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPPlaylistServices::DeletePlaylistL(
+    const TDesC& aPlaylistId )
+    {
+    __LOG1( "DeletePlaylistL(%S)", &aPlaylistId );
+    
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPPlaylistServices::DeletePlaylistL iStatus %d return",
+         iStatus );
+        return;
+        }
+        
+    // item to delete
+    CMPXMedia* playlist = CMPXMedia::NewL();
+    CleanupStack::PushL( playlist );
+    playlist->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    playlist->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXItem );
+    playlist->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXPlaylist );
+    playlist->SetTObjectValueL<TMPXItemId>(
+        KMPXMediaGeneralId, Desc2Id( aPlaylistId ) );
+    iCollectionUtility->Collection().RemoveL( *playlist );
+    CleanupStack::PopAndDestroy( playlist );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::IsValidTrackL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUPnPPlaylistServices::IsValidTrackL(
+    const TDesC& aContentFile )
+    {
+    __LOG1( "IsValidTrackL(%S)", &aContentFile );
+    
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPPlaylistServices::IsValidTrackL iStatus %d return",
+         iStatus );
+        return EFalse;
+        }
+        
+    TBool found = EFalse;
+    CMPXMedia* track = FindItemL( ESongByUri, aContentFile );
+    if ( track != 0 )
+        {
+        CleanupStack::PushL( track );
+        TInt count = *track->Value<TInt>( KMPXMediaArrayCount );
+        if ( count >= 0 )
+            {
+            found = ETrue;
+            }
+        CleanupStack::PopAndDestroy( track );
+        }
+
+    return found;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaylistServices::IsValidPlaylistL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUPnPPlaylistServices::IsValidPlaylistL(
+    const TDesC& aPlaylistTitle )
+    {
+    __LOG1( "IsValidPlaylistL(%S)", &aPlaylistTitle );
+    
+    if( iStatus != KErrNone)
+        {
+        __LOG1( "CUPnPPlaylistServices::IsValidPlaylistL iStatus %d return",
+         iStatus );
+        return EFalse;
+        }
+        
+    TBool found = EFalse;
+    // find the playlist
+    CMPXMedia* playlist = FindItemL( EPlaylistByTitle, aPlaylistTitle );
+    if ( playlist != 0 )
+        {
+        CleanupStack::PushL( playlist );
+        TInt count = *playlist->Value<TInt>( KMPXMediaArrayCount );
+        if ( count >= 0 )
+            {
+            found = ETrue;
+            }
+        CleanupStack::PopAndDestroy( playlist );
+        }
+        
+    return found;
+    }
+
+
+// --------------------------------------------------------------------------
+// Find a playlist
+// --------------------------------------------------------------------------
+//
+CMPXMedia* CUPnPPlaylistServices::FindItemL(
+    TFindCategory aCategory,
+    const TDesC& aKey,
+    const TMPXAttributeData* aAttribute1,
+    const TMPXAttributeData* aAttribute2,
+    const TMPXAttributeData* aAttribute3 )
+    {
+    __LOG( "FindItemL" );
+    CMPXMedia* criteria = CMPXMedia::NewL();
+    CleanupStack::PushL( criteria );
+    criteria->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    criteria->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXItem );
+
+    // set search keys
+    if ( aCategory == ESongs ||
+        aCategory == ESongByUri )
+        {
+        criteria->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, EMPXSong );
+        if ( aCategory == ESongByUri )
+            {
+            criteria->SetTextValueL( 
+                KMPXMediaGeneralUri, aKey );
+            }
+        }
+    else if ( aCategory == EPlaylists ||
+        aCategory == EPlaylistById ||
+        aCategory == EPlaylistByTitle )
+        {
+        criteria->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, EMPXPlaylist );
+        if ( aCategory == EPlaylistById )
+            {
+            criteria->SetTObjectValueL<TMPXItemId>(
+                KMPXMediaGeneralId, Desc2Id( aKey ) );
+            }
+        else if ( aCategory == EPlaylistByTitle )
+            {
+            criteria->SetTextValueL( 
+                KMPXMediaGeneralTitle, aKey );
+            }
+        }
+    else
+        {
+        __PANICD( __FILE__, __LINE__ );
+        }
+
+
+    // define attributes fetched
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL( attributes );
+    if ( aAttribute1 )
+        {
+        // add attribute 1
+        attributes.AppendL( *aAttribute1 );
+        if ( aAttribute2 )
+            {
+            // add attribute 2
+            attributes.AppendL( *aAttribute2 );
+            if ( aAttribute3 )
+                {
+                // add attribute 3
+                attributes.AppendL( *aAttribute3 );
+                }
+            }
+        }
+    else
+        {
+        // add a dummy attribute because the query will fail if
+        // there are no attributes
+        attributes.AppendL( KMPXMediaGeneralId );
+        }
+
+    // now find
+    CMPXMedia* result = 0;
+    TRAPD( err, result = iCollectionUtility->Collection()
+        .FindAllL( *criteria , attributes.Array() ) );
+    CleanupStack::PopAndDestroy(); // attributes
+    CleanupStack::PopAndDestroy( criteria );
+
+    if ( err == KErrNotFound ||
+         err == KErrPathNotFound )
+        {
+        __LOG1( "FindAll: err=%d - not found.", err );
+        result = 0;
+        }
+    else if ( err != KErrNone )
+        {
+        __LOG1("FindAll: error=%d", err);
+        User::Leave( err );
+        }
+    else
+        {
+        __LOG( "FindAll: ok" );
+        }
+
+    return result;
+    }
+
+
+// --------------------------------------------------------------------------
+// Fetch a playlist content
+// --------------------------------------------------------------------------
+//   
+CMPXMedia* CUPnPPlaylistServices::FetchPlaylistContentL( const TDesC& aId )
+    {
+    __LOG( "FindPlaylistContentL" );
+    CMPXMedia* criteria = CMPXMedia::NewL();
+    CleanupStack::PushL( criteria );
+    criteria->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid );
+    criteria->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXGroup );
+
+    // set search keys
+    criteria->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXSong );    
+    criteria->SetTObjectValueL<TMPXItemId>(
+        KMPXMediaGeneralId, Desc2Id( aId ) );
+        
+    // define attributes fetched
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL( attributes );
+    attributes.AppendL( KMPXMediaGeneralUri );
+    
+    // now find
+    CMPXMedia* result = 0;
+    TRAPD( err, result = iCollectionUtility->Collection()
+        .FindAllL( *criteria , attributes.Array() ) );
+    CleanupStack::PopAndDestroy(); // attributes
+    CleanupStack::PopAndDestroy( criteria );
+    
+    if ( err == KErrNotFound ||
+         err == KErrPathNotFound )
+        {
+        __LOG1( "FindAll: err=%d - not found.", err );
+        result = 0;
+        }
+    else if ( err != KErrNone )
+        {
+        __LOG1("FindAll: error=%d", err);
+        User::Leave( err );
+        }
+    else
+        {
+        __LOG( "FindAll: ok" );
+        }
+
+    return result;
+    }
+
+// --------------------------------------------------------------------------
+// Converts an ID from TMPXItemId form to descriptor form.
+// --------------------------------------------------------------------------
+//
+const TDesC& CUPnPPlaylistServices::Id2Desc( const TMPXItemId& aId )
+    {  
+    iTempBuffer.Num( aId );
+    return iTempBuffer;
+    }
+
+// --------------------------------------------------------------------------
+// Converts an ID from descriptor form to TMPXItemId form.
+// --------------------------------------------------------------------------
+//
+TMPXItemId CUPnPPlaylistServices::Desc2Id( const TDesC& aDesc )
+    {
+    TLex convert( aDesc );
+    TUint temp;
+    convert.Val( temp, EDecimal );
+    TMPXItemId id(temp);
+    return id;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/BWINS/upnputilitiesU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,40 @@
+EXPORTS
+	??1CUPnPMetaDataUtility@@UAE@XZ @ 1 NONAME ; CUPnPMetaDataUtility::~CUPnPMetaDataUtility(void)
+	?AddResElementL@UpnpCdsResElementUtility@@SAXAAVCUpnpItem@@ABVTDesC16@@@Z @ 2 NONAME ; void UpnpCdsResElementUtility::AddResElementL(class CUpnpItem &, class TDesC16 const &)
+	?Album@CUPnPMetaDataUtility@@QBEABVTDesC16@@XZ @ 3 NONAME ; class TDesC16 const & CUPnPMetaDataUtility::Album(void) const
+	?Artist@CUPnPMetaDataUtility@@QBEABVTDesC16@@XZ @ 4 NONAME ; class TDesC16 const & CUPnPMetaDataUtility::Artist(void) const
+	?CreateItemFromFileL@UPnPMetadataFetcher@@SAPAVCUpnpItem@@ABVTDesC16@@@Z @ 5 NONAME ; class CUpnpItem * UPnPMetadataFetcher::CreateItemFromFileL(class TDesC16 const &)
+	?CreateItemFromFileLC@UPnPMetadataFetcher@@SAPAVCUpnpItem@@ABVTDesC16@@@Z @ 6 NONAME ; class CUpnpItem * UPnPMetadataFetcher::CreateItemFromFileLC(class TDesC16 const &)
+	?Date@CUPnPMetaDataUtility@@QBEABVTDesC16@@XZ @ 7 NONAME ; class TDesC16 const & CUPnPMetaDataUtility::Date(void) const
+	?DeleteTempFilesL@UPnPCommonUtils@@SAXXZ @ 8 NONAME ; void UPnPCommonUtils::DeleteTempFilesL(void)
+	?DesC8ToInt@UPnPCommonUtils@@SAHABVTDesC8@@@Z @ 9 NONAME ; int UPnPCommonUtils::DesC8ToInt(class TDesC8 const &)
+	?FetchMetadataL@UPnPMetadataFetcher@@SAXAAVCUpnpObject@@ABVTDesC16@@@Z @ 10 NONAME ; void UPnPMetadataFetcher::FetchMetadataL(class CUpnpObject &, class TDesC16 const &)
+	?FetchMetadataL@UPnPMetadataFetcher@@SAXAAVCUpnpObject@@ABVTDesC16@@ABVTDesC8@@@Z @ 11 NONAME ; void UPnPMetadataFetcher::FetchMetadataL(class CUpnpObject &, class TDesC16 const &, class TDesC8 const &)
+	?FindContainerByTitle@UPnPCommonUtils@@SAPAVCUpnpContainer@@ABVCUpnpContainerList@@ABVTDesC8@@@Z @ 12 NONAME ; class CUpnpContainer * UPnPCommonUtils::FindContainerByTitle(class CUpnpContainerList const &, class TDesC8 const &)
+	?Genre@CUPnPMetaDataUtility@@QBEABVTDesC16@@XZ @ 13 NONAME ; class TDesC16 const & CUPnPMetaDataUtility::Genre(void) const
+	?GetMimeTypeByExtensionL@UPnPCommonUtils@@SAPAVHBufC8@@ABVTDesC16@@@Z @ 14 NONAME ; class HBufC8 * UPnPCommonUtils::GetMimeTypeByExtensionL(class TDesC16 const &)
+	?IntToDesC8LC@UPnPCommonUtils@@SAPAVHBufC8@@ABH@Z @ 15 NONAME ; class HBufC8 * UPnPCommonUtils::IntToDesC8LC(int const &)
+	?IsPlaylistContainerL@UPnPCommonUtils@@SAHABVCUpnpObject@@@Z @ 16 NONAME ; int UPnPCommonUtils::IsPlaylistContainerL(class CUpnpObject const &)
+	?IsUriAbsolute@UpnpCdsResElementUtility@@SAHABVTDesC8@@@Z @ 17 NONAME ; int UpnpCdsResElementUtility::IsUriAbsolute(class TDesC8 const &)
+	?LoadMetaDataL@CUPnPMetaDataUtility@@QAEXABVTDesC16@@@Z @ 18 NONAME ; void CUPnPMetaDataUtility::LoadMetaDataL(class TDesC16 const &)
+	?MemoryCardStateL@UPnPCommonUtils@@SAHXZ @ 19 NONAME ; int UPnPCommonUtils::MemoryCardStateL(void)
+	?NewL@CUPnPConnectionMonitor@@SAPAV1@AAVMUPnPConnectionMonitorObserver@@H@Z @ 20 NONAME ; class CUPnPConnectionMonitor * CUPnPConnectionMonitor::NewL(class MUPnPConnectionMonitorObserver &, int)
+	?NewL@CUPnPMetaDataUtility@@SAPAV1@XZ @ 21 NONAME ; class CUPnPMetaDataUtility * CUPnPMetaDataUtility::NewL(void)
+	?RenameFileL@UPnPCommonUtils@@SAPAVHBufC16@@ABVTDesC16@@@Z @ 22 NONAME ; class HBufC16 * UPnPCommonUtils::RenameFileL(class TDesC16 const &)
+	?ReplaceIllegalFilenameCharactersL@UPnPCommonUtils@@SAPAVHBufC16@@ABVTDesC16@@@Z @ 23 NONAME ; class HBufC16 * UPnPCommonUtils::ReplaceIllegalFilenameCharactersL(class TDesC16 const &)
+	?ReplaceIllegalFilenameCharactersL@UPnPCommonUtils@@SAPAVHBufC8@@ABVTDesC8@@@Z @ 24 NONAME ; class HBufC8 * UPnPCommonUtils::ReplaceIllegalFilenameCharactersL(class TDesC8 const &)
+	?ReplacePlaceHolderInURIL@UPnPCommonUtils@@SAXAAVCUpnpItem@@ABVTInetAddr@@@Z @ 25 NONAME ; void UPnPCommonUtils::ReplacePlaceHolderInURIL(class CUpnpItem &, class TInetAddr const &)
+	?ResolveFileTypeL@UPnPCommonUtils@@SA?AW4TUPnPItemType@@ABVTDesC16@@@Z @ 26 NONAME ; enum TUPnPItemType UPnPCommonUtils::ResolveFileTypeL(class TDesC16 const &)
+	?ResolveMimeTypeL@UPnPCommonUtils@@SAPAVHBufC8@@ABVTDesC16@@@Z @ 27 NONAME ; class HBufC8 * UPnPCommonUtils::ResolveMimeTypeL(class TDesC16 const &)
+	?TTimeToUPnPDateL@UPnPCommonUtils@@SAPAVHBufC16@@VTTime@@@Z @ 28 NONAME ; class HBufC16 * UPnPCommonUtils::TTimeToUPnPDateL(class TTime)
+	?Title@CUPnPMetaDataUtility@@QBEABVTDesC16@@XZ @ 29 NONAME ; class TDesC16 const & CUPnPMetaDataUtility::Title(void) const
+	?IsAudioSupported@UPnPCommonUtils@@SAHABVTDesC8@@@Z @ 30 NONAME ; int UPnPCommonUtils::IsAudioSupported(class TDesC8 const &)
+	?IsImageSupported@UPnPCommonUtils@@SAHABVTDesC8@@@Z @ 31 NONAME ; int UPnPCommonUtils::IsImageSupported(class TDesC8 const &)
+	?IsVideoSupported@UPnPCommonUtils@@SAHABVTDesC8@@@Z @ 32 NONAME ; int UPnPCommonUtils::IsVideoSupported(class TDesC8 const &)
+	?FileExtensionByMimeTypeL@UPnPCommonUtils@@SAPAVHBufC16@@ABVTDesC8@@@Z @ 33 NONAME ; class HBufC16 * UPnPCommonUtils::FileExtensionByMimeTypeL(class TDesC8 const &)
+	?NotifyMediaGalleryL@UpnpGalleryNotifier@@SAXXZ @ 34 NONAME ; void UpnpGalleryNotifier::NotifyMediaGalleryL(void)
+	?DebugSimulateConnectionLostL@CUPnPConnectionMonitor@@SAXXZ @ 35 NONAME ; void CUPnPConnectionMonitor::DebugSimulateConnectionLostL(void)
+	?LoadTitleL@CUPnPMetaDataUtility@@QAEXABVTDesC16@@@Z @ 36 NONAME ; void CUPnPMetaDataUtility::LoadTitleL(class TDesC16 const &)
+	?FixListboxItemTextL@UPnPCommonUtils@@SAPAVHBufC8@@ABVTDesC8@@@Z @ 37 NONAME ; class HBufC8 * UPnPCommonUtils::FixListboxItemTextL(class TDesC8 const &)
+	?NewL@CUPnPPeriodic@@SAPAV1@H@Z @ 38 NONAME ; class CUPnPPeriodic * CUPnPPeriodic::NewL(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/EABI/upnputilitiesU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+EXPORTS
+	_ZN15UPnPCommonUtils10DesC8ToIntERK6TDesC8 @ 1 NONAME
+	_ZN15UPnPCommonUtils11RenameFileLERK7TDesC16 @ 2 NONAME
+	_ZN15UPnPCommonUtils12IntToDesC8LCERKi @ 3 NONAME
+	_ZN15UPnPCommonUtils16DeleteTempFilesLEv @ 4 NONAME
+	_ZN15UPnPCommonUtils16MemoryCardStateLEv @ 5 NONAME
+	_ZN15UPnPCommonUtils16ResolveFileTypeLERK7TDesC16 @ 6 NONAME
+	_ZN15UPnPCommonUtils16ResolveMimeTypeLERK7TDesC16 @ 7 NONAME
+	_ZN15UPnPCommonUtils16TTimeToUPnPDateLE5TTime @ 8 NONAME
+	_ZN15UPnPCommonUtils20FindContainerByTitleERK18CUpnpContainerListRK6TDesC8 @ 9 NONAME
+	_ZN15UPnPCommonUtils20IsPlaylistContainerLERK11CUpnpObject @ 10 NONAME
+	_ZN15UPnPCommonUtils23GetMimeTypeByExtensionLERK7TDesC16 @ 11 NONAME
+	_ZN15UPnPCommonUtils24ReplacePlaceHolderInURILER9CUpnpItemRK9TInetAddr @ 12 NONAME
+	_ZN15UPnPCommonUtils33ReplaceIllegalFilenameCharactersLERK6TDesC8 @ 13 NONAME
+	_ZN15UPnPCommonUtils33ReplaceIllegalFilenameCharactersLERK7TDesC16 @ 14 NONAME
+	_ZN19UPnPMetadataFetcher14FetchMetadataLER11CUpnpObjectRK7TDesC16 @ 15 NONAME
+	_ZN19UPnPMetadataFetcher14FetchMetadataLER11CUpnpObjectRK7TDesC16RK6TDesC8 @ 16 NONAME
+	_ZN19UPnPMetadataFetcher19CreateItemFromFileLERK7TDesC16 @ 17 NONAME
+	_ZN19UPnPMetadataFetcher20CreateItemFromFileLCERK7TDesC16 @ 18 NONAME
+	_ZN20CUPnPMetaDataUtility13LoadMetaDataLERK7TDesC16 @ 19 NONAME
+	_ZN20CUPnPMetaDataUtility4NewLEv @ 20 NONAME
+	_ZN20CUPnPMetaDataUtilityD0Ev @ 21 NONAME
+	_ZN20CUPnPMetaDataUtilityD1Ev @ 22 NONAME
+	_ZN20CUPnPMetaDataUtilityD2Ev @ 23 NONAME
+	_ZN22CUPnPConnectionMonitor4NewLER30MUPnPConnectionMonitorObserveri @ 24 NONAME
+	_ZN24UpnpCdsResElementUtility13IsUriAbsoluteERK6TDesC8 @ 25 NONAME
+	_ZN24UpnpCdsResElementUtility14AddResElementLER9CUpnpItemRK7TDesC16 @ 26 NONAME
+	_ZNK20CUPnPMetaDataUtility4DateEv @ 27 NONAME
+	_ZNK20CUPnPMetaDataUtility5AlbumEv @ 28 NONAME
+	_ZNK20CUPnPMetaDataUtility5GenreEv @ 29 NONAME
+	_ZNK20CUPnPMetaDataUtility5TitleEv @ 30 NONAME
+	_ZNK20CUPnPMetaDataUtility6ArtistEv @ 31 NONAME
+	_ZTI20CUPnPMetaDataUtility @ 32 NONAME ; #<TI>#
+	_ZTI22CUPnPConnectionMonitor @ 33 NONAME ; #<TI>#
+	_ZTV20CUPnPMetaDataUtility @ 34 NONAME ; #<VT>#
+	_ZTV22CUPnPConnectionMonitor @ 35 NONAME ; #<VT>#
+	_ZN15UPnPCommonUtils16IsAudioSupportedERK6TDesC8 @ 36 NONAME
+	_ZN15UPnPCommonUtils16IsImageSupportedERK6TDesC8 @ 37 NONAME
+	_ZN15UPnPCommonUtils16IsVideoSupportedERK6TDesC8 @ 38 NONAME
+	_ZN15UPnPCommonUtils24FileExtensionByMimeTypeLERK6TDesC8 @ 39 NONAME
+	_ZN19UpnpGalleryNotifier19NotifyMediaGalleryLEv @ 40 NONAME
+	_ZN22CUPnPConnectionMonitor28DebugSimulateConnectionLostLEv @ 41 NONAME
+	_ZN20CUPnPMetaDataUtility10LoadTitleLERK7TDesC16 @ 42 NONAME
+	_ZN15UPnPCommonUtils19FixListboxItemTextLERK6TDesC8 @ 43 NONAME
+	_ZN13CUPnPPeriodic4NewLEi @ 44 NONAME
+	_ZTI13CUPnPPeriodic @ 45 NONAME ; #<TI>#
+	_ZTV13CUPnPPeriodic @ 46 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info file for upnp utilities
+*
+*/
+
+
+PRJ_PLATFORMS
+// No requirements
+
+PRJ_EXPORTS
+//internal domain API
+../inc/upnpconnectionmonitor.h                    |../../../inc/upnpconnectionmonitor.h
+../inc/upnpconnectionmonitorobserver.h            |../../../inc/upnpconnectionmonitorobserver.h
+../inc/upnpcdsreselementutility.h                 |../../../inc/upnpcdsreselementutility.h
+../inc/upnpmetadatafetcher.h                      |../../../inc/upnpmetadatafetcher.h
+../inc/upnpcommonutils.h            		  |../../../inc/upnpcommonutils.h
+../inc/upnpmetadatautility.h          		  |../../../inc/upnpmetadatautility.h
+../inc/upnpfileutilitytypes.h        		  |../../../inc/upnpfileutilitytypes.h
+../inc/upnpperiodic.h        		          |../../../inc/upnpperiodic.h
+
+
+PRJ_MMPFILES
+upnputilities.mmp
+
+PRJ_TESTMMPFILES
+// None
+
+PRJ_TESTEXPORTS
+// None
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/group/upnputilities.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP utilities project definition file
+*
+*/
+
+
+#include "../../../group/upnpplatformvar.hrh"
+#include "../../../inc/upnpframeworkfeatures_mmp.hrh"
+
+
+// Build target
+TARGET          upnputilities.dll
+TARGETTYPE      DLL
+UID             0x1000008D 0x10208A13
+
+// Platform security
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+// Include paths
+USERINCLUDE     ../../inc
+USERINCLUDE     ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+
+// Sources
+SOURCEPATH      ../src
+SOURCE          upnpcommonutils.cpp
+SOURCE          upnpmetadatautility.cpp
+SOURCE          upnpmetadatafetcher.cpp
+SOURCE          upnpcdsreselementutility.cpp
+SOURCE          upnpconnectionmonitor.cpp
+SOURCE          upnpgallerynotifier.cpp
+SOURCE          upnpperiodic.cpp
+
+// Core platform
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         charconv.lib
+LIBRARY         esock.lib
+LIBRARY         insock.lib
+LIBRARY         commdb.lib
+LIBRARY         PlatformEnv.lib
+LIBRARY         connmon.lib
+
+// Meta data
+LIBRARY         MetaDataUtility.lib
+
+// MIME 
+LIBRARY         apmime.lib
+LIBRARY         apgrfx.lib
+
+// CAF (WM-DRM)
+LIBRARY         caf.lib
+LIBRARY         cafutils.lib
+
+// CLF
+LIBRARY         ContentListingFramework.lib
+
+// S60 Upnp Stack
+LIBRARY         upnpavobjects.lib
+LIBRARY         upnpipserversutils.lib
+
+// Upnp FW
+LIBRARY         dlnaprofiler.lib
+
+// debug logging facilities
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/inc/upnpcdsreselementutility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utility class for UPnP contentdirectory res (resource)
+*                element related actions.
+*
+*/
+
+
+#ifndef UPNPCDSRESELEMENTUTILITY_H
+#define UPNPCDSRESELEMENTUTILITY_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+class CUpnpElement;
+
+// CLASS DECLARATION
+
+/**
+ * CUpnpCdsResElementUtility provides utility functions for dealing with UPnP 
+ * res (resource) elements. 
+ *
+ * @lib upnputilities.lib
+ * @since Series 60 3.1
+ */
+class UpnpCdsResElementUtility
+    {
+public: // New functions
+
+    /**
+     * Adds a res tag to an existing UPnP item. Res tag has always 
+     * protocolinfo and size parameters. Image files will have resolution 
+     * parameter and audio&video files will have duration parameter filled.
+     * 
+     * @since Series 60 3.1
+     * @param aItem UPnP item that needs res element.
+     * @param aFilename The filename of the resource. Full path included.
+     */
+    IMPORT_C static void AddResElementL(
+        CUpnpItem& aItem,
+        const TDesC& aFilename );
+
+    /**
+     * Checks if the provided uri is absolute uri
+     *
+     * @since Series 60 3.1
+     * @param aUri uri
+     * @return ETrue if the uri is absolute
+     */
+    IMPORT_C static TBool IsUriAbsolute( const TDesC8& aUri );    
+
+    };
+
+#endif // UPNPCDSRESELEMENTUTILITY_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/inc/upnpcommonutils.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,265 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP framework's common utility functions
+*
+*/
+
+
+#ifndef UPNPCOMMONUTILS_H
+#define UPNPCOMMONUTILS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <upnpobject.h>
+#include <f32file.h>
+
+// DATA TYPES
+enum TUPnPItemType
+    {
+    ETypeAudio = 0,
+    ETypeVideo,
+    ETypeImage,
+    ETypePlaylist,
+    ETypeOther
+    };
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+class CUpnpContainer;
+class CUpnpContainerList;
+class CUpnpAttribute;
+class TInetAddr;
+
+// CONSTANTS
+// upload directory
+_LIT( KUpnpUploadDirectory, "Download\\Media\\" );
+
+// CLASS DECLARATION
+
+/**
+* UPnP Framework's common utility functions
+*
+* @lib upnputilities.lib
+* @since S60 3.0
+*/
+class UPnPCommonUtils
+    {
+
+public: // Business logic methods
+
+    /**
+     * Returns status whether memory card is inserted or not.
+     *
+     * @since S60 3.0
+     * @return TBool indicating the status of memory card
+     */
+    IMPORT_C static TBool MemoryCardStateL();
+
+    /**
+     * Resolves the MIME type of a file by it's content, using the 
+     * platform MIME recognizer. Leaves in error cases.
+     *
+     * @since S60 3.0
+     * @param TDesC8& file name (with full path info)
+     * @return HBufC8* mime type
+     */
+    IMPORT_C static HBufC8* ResolveMimeTypeL(
+                                const TDesC& aFileName );
+
+    /**
+     * Resolves the MIME type of a file by it's extension. Leaves in error
+     * cases.
+     *
+     * @since S60 3.0
+     * @param TDesC& const, file name (with full path info)
+     * @return HBufC8* mime type
+     */
+    IMPORT_C static HBufC8* GetMimeTypeByExtensionL( 
+                                const TDesC& aFileName );
+
+    /**
+     * Resolves the type of a file. Leaves in error cases.
+     *
+     * @since S60 3.0
+     * @param TDesC8& file name (with full path info)
+     * @return TUPnPItemType file type
+     */
+    IMPORT_C static TUPnPItemType ResolveFileTypeL( 
+                                const TDesC& aFileName );
+
+    /**
+     * Replaces IP address and port number placeholders of the RES
+     * element's URI string of the given item.
+     *
+     * @since S60 3.1
+     * @param aItem (CUpnpItem&) the item which RES element's URI is to be
+     *        updated
+     * @param aAddress (const TInetAddr&) the address and port number of
+     *        the updated URI
+     */
+    IMPORT_C static void ReplacePlaceHolderInURIL( 
+                                CUpnpItem& aItem,
+                                const TInetAddr& aAddress );
+
+    /**
+     * Replaces the illegal filename characters of the given filename
+     * string and returns a new fixed filename string. The following
+     * characters are replaced with an underscore: >, <, ", \, /, *, |, 
+     * : and ?. 8bit version.
+     *
+     * @since S60 3.1
+     * @param aFileName (const TDesC8&) filename to be checked
+     * @return HBufC8* fixed filename string
+     **/
+    IMPORT_C static HBufC8* ReplaceIllegalFilenameCharactersL( 
+                                const TDesC8& aFileName );
+                    
+    /**
+     * Replaces the illegal filename characters of the given filename
+     * string and returns a new fixed filename string. The following
+     * characters are replaced with an underscore: >, <, ", \, /, *, |, 
+     * : and ?. 16bit version.
+     *
+     * @since S60 3.1
+     * @param aFileName (const TDesC&) filename to be checked
+     * @return HBufC* fixed filename string
+     **/
+    IMPORT_C static HBufC* ReplaceIllegalFilenameCharactersL( 
+                                const TDesC& aFileName );
+
+    /**
+     * Checks if the given CUpnpObject is a playlist container. Leaves if
+     * the given object is not correctly formed. 
+     *
+     * @since S60 3.1
+     * @param aContainer (const CUpnpObject&) filename to be checked
+     * @return TBool
+     **/
+    IMPORT_C static TBool IsPlaylistContainerL( 
+                                const CUpnpObject& aContainer );
+
+    /** 
+     * Return container with given title from list of containers
+     *
+     * @since S60 3.1
+     * @param aList List containig containers to search
+     * @param aTitle Title to search for
+     * @return CUpnpContainer* The pointer to container, NULL if
+     * not found
+     **/
+    IMPORT_C static CUpnpContainer* FindContainerByTitle(
+        const CUpnpContainerList& aList, const TDesC8& aTitle );
+
+    /**
+     * Convert TInt to TDesC8
+     * @since S60 3.1
+     * @param aObject TInt to convert
+     */
+    IMPORT_C static HBufC8* IntToDesC8LC( const TInt& aObject );
+
+    /**
+     * Convert TDesC8 to TInt
+     * @since S60 3.1
+     * @param aObject Descriptor to convert
+     */
+    IMPORT_C static TInt DesC8ToInt( const TDesC8& aObject );
+    
+    /**
+     * Converts TTime to UPnP date string
+     *
+     * @since S60 3.1
+     * @param aTime time
+     * @return UPnP date as a heap descriptor
+     */
+    IMPORT_C static HBufC* TTimeToUPnPDateL( TTime aTime );
+
+    
+    /**
+     * Rename the downloaded file to %s_upnpfwtemp(%s is original filename)
+     * used in play remote item on local device
+     * @since S60 3.1
+     *
+     * @param aFilePath original file path
+     * @return HBufC pointer to the new filepath
+     */
+    IMPORT_C static HBufC* UPnPCommonUtils::RenameFileL( const TDesC& aFilePath );
+    
+    /**
+     * Delete upnp genereated temporary files from download locations
+     * both from phone memory and memory card
+     * Leave in case of fatal errors
+     * @since S60 3.1
+     *
+     */
+    IMPORT_C static void DeleteTempFilesL();
+
+
+     /**
+     * Checks if device supports images 
+     *
+     * @since S60 3.1
+     * @param TDesC8& protocolinfo
+     * @return TBool
+     */
+    IMPORT_C static TBool IsImageSupported(
+                                const TDesC8& aProtocolInfo );
+                                
+                                
+     /**
+     * Checks if device supports audio 
+     *
+     * @since S60 3.1
+     * @param TDesC8& protocolinfo
+     * @return TBool
+     */
+    IMPORT_C static TBool IsAudioSupported(
+                                const TDesC8& aProtocolInfo );
+                                
+                                
+     /**
+     * Checks if device supports video 
+     *
+     * @since S60 3.1
+     * @param TDesC8& protocolinfo
+     * @return TBool
+     */
+    IMPORT_C static TBool IsVideoSupported(
+                                const TDesC8& aProtocolInfo );
+                                
+     /**
+     * Return the file extension according a mime type
+     *
+     * @since S60 3.2
+     * @param const TDesC8& mime type
+     * @return file extension
+     */
+    IMPORT_C static HBufC* FileExtensionByMimeTypeL(
+        const TDesC8& aMimeType );
+    
+    /**
+     * Removes the tab character of the given text
+     * string and returns a new fixed file title string.
+     *
+     * @since S60 3.2.3
+     * @param aText (const TDesC8&) listboxe item text to be checked
+     * @return HBufC8* fixed text string
+     **/
+    IMPORT_C static HBufC8* FixListboxItemTextL( 
+                                const TDesC8& aText );    
+    };
+
+
+#endif  // UPNPCOMMONUTILS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/inc/upnpconnectionmonitor.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors for WLAN connection
+*
+*/
+
+#ifndef C_UPNPCONNECTIONMMONITOR_H
+#define C_UPNPCONNECTIONMMONITOR_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <rconnmon.h>
+
+#include <f32file.h> 
+
+#include "upnpconnectionmonitorobserver.h"
+
+// CONSTANTS
+// none
+
+// MACROS
+// none
+
+// DATA TYPES
+// none
+
+// FUNCTION PROTOTYPES
+// none
+
+// FORWARD DECLARATIONS
+// none
+
+// CLASS DECLARATION
+
+/**
+* CUPnPConnectionMonitor class provides a WLAN connection monitor
+* for UPnP applications.
+*
+* @lib upnputilities.lib
+* @since S60 3.0
+*/
+class CUPnPConnectionMonitor :  public CActive,
+                                public MConnectionMonitorObserver
+    {
+    
+public:  // Constructors and destructor
+    
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CUPnPConnectionMonitor* NewL(
+        MUPnPConnectionMonitorObserver& aObserver, TInt aAccessPoint );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPConnectionMonitor();
+
+    /**
+     * Simulate connection lost case. Calling this method will cause all
+     * instances of the CUPnPConnectionMonitor to call back "ConnectionLost"
+     * via the observer API.
+     *
+     * This method is for module test use only.
+     */
+    IMPORT_C static void DebugSimulateConnectionLostL();
+    
+    /**
+     * Checks current connection ids what is wlan id
+     * and stores it to iConnectionId
+     */
+    void  ParseCurrentConnections();
+    
+protected: // From CActive
+
+    void DoCancel();
+    
+    void RunL();
+
+protected: // From MConnectionMonitorObserver
+
+    /**
+     * Catches the Connection monitor events 
+     * @since Series 60 3.0
+     * @param aConnMonEvent event
+     * @return none
+     */
+    void EventL( const CConnMonEventBase& aConnMonEvent ) ;
+        
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUPnPConnectionMonitor( MUPnPConnectionMonitorObserver& aObserver,
+        TInt aAccessPoint );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+    /**
+     * Checks connection type
+     */
+    TBool IsWlanConnection( TInt aConnectionId);
+
+
+private:    // Data
+
+    // file server (used only in debugging services)
+    RFs iFs;
+
+    // Connection monitor server
+    RConnectionMonitor              iConnectionMonitor;
+
+    // Connection id
+    TInt                            iConnectionId;
+
+    // Callback pointer, not owned
+    MUPnPConnectionMonitorObserver& iObserver;
+
+    // Accesspoint to be observed
+    TInt                            iAccessPoint;
+    };
+
+#endif // C_UPNPCONNECTIONMMONITOR_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/inc/upnpconnectionmonitorobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Connection monitor observer interface class declaration.
+*
+*/
+
+
+#ifndef M_UPNPCONNECTIONMONITOROBSERVER_H
+#define M_UPNPCONNECTIONMONITOROBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+/**
+ * MUPnPConnectionMonitorObserver is an interface for Connection Monitor.
+ *
+ * @lib upnputilities.lib
+ * @since S60 3.0
+ */
+class MUPnPConnectionMonitorObserver
+    {
+public:
+    
+    /**
+     * This function will be called when WLan connection is lost for UPnP 
+     *
+     * @since S60 3.1
+     */    
+    virtual void ConnectionLost() = 0;
+    };
+
+#endif // M_UPNPCONNECTIONMONITOROBSERVER_H
+     
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/inc/upnpfileutilitytypes.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Object-related constant definitions
+*
+*/
+
+
+// System includes
+#include <e32base.h>
+
+// mime types <-> files ext
+
+// XHTML
+_LIT8( KXHtmlMime,  "application/xhtml+xml" );
+_LIT( KXHtmlExt,    ".xhtml" ); 
+
+// HTML
+_LIT8( KHtmlMime,   "text/html" );
+_LIT( KHtmlExt,     ".html" );
+
+// XML
+_LIT8( KXmlMime1,   "text/xml" );       
+_LIT8( KXmlMime2,   "application/xml" );
+_LIT8( KXmlMime3,	"application/x-xml");
+_LIT( KXmlExt,      ".xml" );
+
+// TXT
+_LIT8( KTxtMime,    "text/plain" );
+_LIT8( KTxtMime2,	"application/txt" );
+_LIT8( KTxtMime3,	"browser/internal" );
+_LIT8( KTxtMime4,	"text/anytext" );
+_LIT8( KTxtMime5,	"widetext/plain" );
+_LIT8( KTxtMime6,	"widetext/paragraph" );
+_LIT( KTxtExt,      ".txt" );
+
+// JPEG
+_LIT8( KJpegMime,   "image/jpeg" );
+_LIT( KJpegExt,     ".jpeg" );
+
+// JPG
+_LIT8( KJpegMime2,  "image/jpg" );
+_LIT8( KJpegMime3,  "image/jpe_" );
+_LIT8( KJpegMime4,  "image/pjpeg" );
+_LIT8( KJpegMime5,   "image/vnd.swiftview-jpeg" );
+_LIT( KJpgExt,      ".jpg" );
+
+// GIF
+_LIT8( KGifMime,    "image/gif" );             
+_LIT8( KGifMime2,	"image/x-xbitmap" );
+_LIT8( KGifMime3,	"image/gi_" );
+_LIT( KGifExt,      ".gif" );
+
+// PNG
+_LIT8( KPngMime,    "image/png" );             
+_LIT8( KPngMime2,	"application/png" );
+_LIT8( KPngMime3,	"application/x-png" );
+_LIT( KPngExt,      ".png" );
+
+// MPG
+_LIT8( KMpgMime1,   "video/mpeg");
+_LIT8( KMpgMime2,   "video/mpg");
+_LIT8( KMpgMime3,   "video/x-mpg");
+_LIT8( KMpgMime4,   "video/mpeg2" );
+_LIT8( KMpgMime5,   "application/x-pn-mpg" );
+_LIT8( KMpgMime6,	"video/x-mpeg" );
+_LIT8( KMpgMime7,	"video/x-mpeg2a");
+_LIT8( KMpgMime10,  "image/mpg" );
+_LIT( KMpgExt1,     ".mpg" );
+
+// MPEG4
+_LIT8( KMpeg4Mime,  "video/mpeg4" );
+_LIT( KMpeg4Ext,    ".mpeg4" );
+
+// MP4
+_LIT8( KMp4Mime,    "video/mp4" );
+_LIT8( KMp4Mime2,   "video/mp4v-es" );
+_LIT8( KMp4Mime3,   "audio/mp4" );
+_LIT( KMp4Ext,      ".mp4" );
+
+// AVI
+_LIT8( KAviMime1,   "video/avi" );
+_LIT8( KAviMime2,   "video/msvideo" );
+_LIT8( KAviMime3,   "video/x-msvideo" );
+_LIT8( KAviMime4,   "image/avi" );
+_LIT8( KAviMime5,   "video/xmpg2" );
+_LIT8( KAviMime6,	"application/x-troff-msvideo" );
+_LIT8( KAviMime7, 	"audio/aiff" );
+_LIT8( KAviMime8, 	"audio/avi" );
+_LIT8( KAviMime9,   "video/x-ms-avi" );
+_LIT( KAviExt,      ".avi" );
+
+// MP3
+_LIT8( KMp3Mime1,   "audio/x-mpeg-3");
+_LIT8( KMp3Mime2,   "audio/mpeg3" );           
+_LIT8( KMp3Mime3,   "audio/mpeg" );
+_LIT8( KMp3Mime4,   "audio/x-mpeg" );
+_LIT8( KMp3Mime5,   "audio/mp3" );
+_LIT8( KMp3Mime6,   "audio/x-mp3" );
+_LIT8( KMp3Mime7,   "audio/x-mpeg3" );
+_LIT8( KMp3Mime8,   "audio/mpg" );
+_LIT8( KMp3Mime9,   "audio/x-mpg" );
+_LIT8( KMp3Mime10,  "audio/x-mpegaudio" );
+_LIT( KMp3Ext,      ".mp3" );
+
+//M4A
+_LIT8( KM4aMime,    "audio/x-m4a" );
+_LIT( KM4aExt,      ".m4a" );
+// AAC
+_LIT8( KAacMime,    "audio/aac" );
+_LIT8( KAacMime2,   "audio/vnd.dlna.adts" );
+_LIT8( KAacMime3,   "audio/adts" );
+_LIT8( KAacMime4,   "audio/x-aac" );
+_LIT( KAacExt,      ".aac" );
+
+// WMA             
+_LIT8( KWmaMime,    "audio/x-ms-wma" );        
+_LIT8( KWmaMime2,   "video/x-ms-asf" );
+_LIT( KWmaExt,      ".wma" );
+
+// WMV
+_LIT8( KWmvMime,    "video/x-ms-wmv" );
+_LIT( KWmvExt,      ".wmv" );
+
+// BMP
+_LIT8( KBmpMime,    "image/bmp" );             
+_LIT8( KBmpMime2,   "image/x-bmp" );
+_LIT8( KBmpMime3,   "image/x-bitmap" );
+_LIT8( KBmpMime4,   "image/x-xbitmap" );
+_LIT8( KBmpMime5,   "image/x-ms-bmp" );
+_LIT8( KBmpMime6,   "application/bmp" );
+_LIT8( KBmpMime7,   "application/x-bmp" );
+_LIT8( KBmpMime8,   "application/x-win-bitmap" );
+_LIT8( KBmpMime9,   "application/preview" );
+_LIT( KBmpExt,      ".bmp" );
+
+// WAV
+_LIT8( KAudioXWav,   "audio/x-wav" );
+_LIT8( KAudioWav,   "audio/wav" );
+_LIT8( KAudioL16,   "audio/L16" );
+_LIT( KWavExt,      ".wav" );
+
+// 3GP
+_LIT8( KAudio3gpp,  "audio/3gpp" );
+_LIT8( KVideo3gpp,  "video/3gpp" );
+_LIT( K3gpExt,      ".3gp" );
+
+// AMR
+_LIT8( KAudioAMR,   "audio/AMR" );
+_LIT( KAmrExt,      ".amr" );
+
+// Real audio
+_LIT8( KRAMime8,   "audio/x-pn-realaudio" );
+_LIT( KRAExt,      ".ra" );
+
+// DLNA
+_LIT8( KVideoTts,   "video/vnd.dlna.mpeg-tts" );
+_LIT( KTtsExt,       ".tts" );
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/inc/upnpgallerynotifier.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Functions to notify Media Gallery of new files.
+*
+*/
+
+
+#ifndef UPNPGALLERYNOTIFIER_H
+#define UPNPGALLERYNOTIFIER_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+* Functions to notify Media Gallery of new files.
+*
+* @lib upnputilities.lib
+* @since S60 3.1
+*
+*/
+class UpnpGalleryNotifier
+    {
+
+public:
+
+    /**
+     * Notify CLF about the update in the file system (file added 
+     * or removed).
+     *
+     * @since S60 3.1
+     */
+    IMPORT_C static void NotifyMediaGalleryL();
+
+    };
+
+#endif  // UPNPGALLERYNOTIFIER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/inc/upnpmetadatafetcher.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Meta data fetching utilities
+*
+*/
+
+
+#ifndef UPNPMETADATAFETCHER_H
+#define UPNPMETADATAFETCHER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpObject;
+
+// CLASS DECLARATION
+    
+/**
+* Static meta data fetching utilities.
+*
+* @lib upnputilities.lib
+* @since S60 3.1
+*/
+class UPnPMetadataFetcher
+    {
+
+public:
+
+    /**
+     * Resolves the metadata and fills in the CUpnpObject's metadata 
+     * fields accordingly.
+     * 
+     * @since Series 60 3.1
+     * @param aObject (CUpnpObject&) the target CUpnpObject
+     * @param aFilePath (const TDesC&) the filepath of the file
+     * @param aMimeType (const TDesC8&) the mime type of the file
+     */
+    IMPORT_C static void FetchMetadataL( CUpnpObject& aObject, 
+                                         const TDesC& aFilePath, 
+                                         const TDesC8& aMimeType );
+
+    /**
+     * Resolves the metadata and fills in the CUpnpObject's metadata 
+     * fields accordingly.
+     * 
+     * @since Series 60 3.1
+     * @param aObject (CUpnpObject&) the target CUpnpObject
+     * @param aFilePath (const TDesC&) the filepath of the file
+     */
+    IMPORT_C static void FetchMetadataL( CUpnpObject& aObject, 
+                                         const TDesC& aFilePath );
+
+    /**
+     * Creates a new CUpnpItem from a local file. Resolves the metadata and 
+     * fills in the new CUpnpItem's metadata fields accordingly.
+     * 
+     * @since Series 60 3.1
+     * @param aFilePath (const TDesC&) the filepath of the file
+     * @return (CUpnpItem*) pointer to the newly created CUpnpItem,
+     *         or NULL if the creation of the item or metadata resolving
+     *         fails. Pushes the object into the CleanupStack.
+     */
+    IMPORT_C static CUpnpItem* CreateItemFromFileLC( 
+                                            const TDesC& aFilePath );
+
+    /**
+     * Creates a new CUpnpItem from a local file. Resolves the metadata and 
+     * fills in the new CUpnpItem's metadata fields accordingly.
+     * 
+     * @since Series 60 3.1
+     * @param aFilePath (const TDesC&) the filepath of the file
+     * @return (CUpnpItem*) pointer to the newly created CUpnpItem,
+     *         or NULL if the creation of the item or metadata resolving
+     *         fails.
+     */
+    IMPORT_C static CUpnpItem* CreateItemFromFileL(
+                                            const TDesC& aFilePath );
+
+    };
+
+#endif // UPNPMETADATAFETCHER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/inc/upnpmetadatautility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utility class for meta data gathering for audio files
+*
+*/
+
+#ifndef UPNPMETADATAUTILITY_H
+#define UPNPMETADATAUTILITY_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class CMetaDataUtility;
+
+// CLASS DECLARATION
+
+/**
+* Meta data utility to support UPnP tag information creation
+*
+* @lib upnputilities.lib
+* @since S60 3.0
+*/
+class CUPnPMetaDataUtility : public CBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CUPnPMetaDataUtility* NewL();
+    
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~CUPnPMetaDataUtility();
+
+public: // New functions
+    
+    /**
+    * Loads Meta data from given file into internal data structures.
+    * Leaves in case of error
+    *   - KErrAccessDenied = File is DRM protected
+    *   - KErrNotSupported = Unknown file, meta data cannot be retrieved
+    * @since Series 60 3.0
+    * @param aFileName reference to music file
+    * @return none
+    */
+    IMPORT_C void LoadMetaDataL( const TDesC& aFileName );
+    
+    /**
+    * Returns title information of the file.
+    * @since Series 60 3.0
+    * @param none
+    * @return TDesC& reference to title
+    */
+    IMPORT_C const TDesC& Title() const;
+    
+    /**
+    * Returns artist information of the file.
+    * @since Series 60 3.0
+    * @param none
+    * @return TDesC& reference to artist name
+    */
+    IMPORT_C const TDesC& Artist() const;
+    
+    /**
+    * Returns album information of the file.
+    * @since Series 60 3.0
+    * @param none
+    * @return TDesC& reference to album name
+    */
+    IMPORT_C const TDesC& Album() const;
+    
+    /**
+    * Returns genre information of the file.
+    * @since Series 60 3.0
+    * @param none
+    * @return TDesC& reference to genre name
+    */
+    IMPORT_C const TDesC& Genre() const;
+    
+    /**
+    * Returns date information of the file.
+    * @since Series 60 3.0
+    * @param none
+    * @return TDesC& reference to date
+    */
+    IMPORT_C const TDesC& Date() const;
+    
+    /**
+    * Loads Title from given file into internal data structures.
+    * Leaves in case of error
+    *   - KErrAccessDenied = File is DRM protected
+    *   - KErrNotSupported = Unknown file, meta data cannot be retrieved
+    * @since Series 60 3.0
+    * @param aFileName reference to music file
+    * @return none
+    */
+    IMPORT_C void LoadTitleL( const TDesC& aFileName );
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUPnPMetaDataUtility();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+    
+    /**
+    * Reset member variables
+    */
+    void Reset();
+
+private:    // Data
+
+    // Meta data information
+    HBufC* iTitle;  // owned
+    HBufC* iArtist; // owned
+    HBufC* iAlbum;  // owned
+    HBufC* iGenre;  // owned
+    HBufC* iDate;   // owned
+    
+    // Utility class
+    CMetaDataUtility* iMetaDataUtility; // owned
+    };
+
+#endif      // UPNPMETADATAUTILITY_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/inc/upnpperiodic.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      UPnP framework custom periodic timer
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPPERIODIC_H__
+#define __UPNPPERIODIC_H__
+
+// INCLUDES
+#include <e32base.h>
+
+// CLASS DECLARATION
+/**
+*  Periodic timer active object.
+*
+*
+*  @lib  upnputilities.lib
+*  @since 3.2.3
+*/
+
+class CUPnPPeriodic : public CPeriodic
+    {
+    
+  public:  // Constructors and destructor    
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUPnPPeriodic* NewL( TInt aPriority );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUPnPPeriodic();
+
+    private: // From CPeriodic base class CActive.
+
+        /**
+        * From CActive, called if CUPnPPeriodic function RunL() leaves.
+        * @param aError Standard Symbian OS error code
+        * @return Error code KErrNone
+        */
+        TInt RunError( TInt aError ); 
+
+    private: // Private methods.
+        
+        /**
+        * C++ constructor.
+        */
+        CUPnPPeriodic( TInt aPriority );
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+    
+    } ;
+
+#endif // __UPNPPERIODIC_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/src/upnpcdsreselementutility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utility class for meta data gathering for audio files
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <e32std.h>
+#include <e32base.h>
+
+// upnp stack api
+#include <upnpitem.h> // CUpnpItem
+#include <upnpstring.h>
+#include <upnpelement.h>
+#include <upnpdlnaprotocolinfo.h>
+#include <upnpprotocolinfo.h>
+
+// upnpframework / avcontroller helper api
+#include <upnpconstantdefs.h> // for upnp class defs
+
+// upnpframework internal api's
+#include "upnpresresolver.h" // CUpnpResResolver
+#include "upnpresparameters.h"
+
+// utilities internal
+#include "upnpcommonutils.h"
+#include "upnpcdsreselementutility.h"
+
+_LIT( KHttp, "http://" );
+const TInt KColon = 58;
+const TInt KIpAddLen = 25;
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpCdsResElementUtility::AddResElementL
+// 
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C void UpnpCdsResElementUtility::AddResElementL( 
+                                                CUpnpItem& aItem, 
+                                                const TDesC& aFilename )
+    {
+
+    // Create CUpnpElement for res
+    CUpnpElement* elRes = CUpnpElement::NewL( KElementRes() );
+    CleanupStack::PushL( elRes );
+    elRes->SetFilePathL( aFilename );
+ 
+    // Create res resolver component and put it to CleanupStack
+    CUpnpResResolver* resolver = CUpnpResResolver::NewLC();
+    
+    // Obtain res element parameters using res resolver component.
+    CUpnpResParameters* resParameters = NULL;
+	TRAPD(err, resParameters = resolver->GetResParametersL( aFilename ) );
+
+   if (err == KErrGeneral)	
+    {
+	// File not recognized, handling it manually by adding
+	// following res-item:  'http-get:*:MIMETYPE:*'
+
+   		_LIT8( KProtInfo1, "http-get:");
+    	_LIT8( KStar8, "*");
+    	_LIT8( KColon8, ":");
+    	HBufC8* mimetype = UPnPCommonUtils::ResolveMimeTypeL(aFilename);
+    	mimetype->Des().Trim();		// needs to be trimmed
+
+        TInt resultLen = KProtInfo1().Length() + KStar8().Length() + 
+    	KColon8().Length() + mimetype->Des().Length() + KColon8().Length() +
+        KStar8().Length();
+    	HBufC8* resValue = HBufC8::NewLC( resultLen );
+
+    // construct final value
+	    resValue->Des().Append( KProtInfo1 );
+	    resValue->Des().Append( KStar8 );
+	    resValue->Des().Append( KColon8 );
+	    resValue->Des().Append( *mimetype );
+	    resValue->Des().Append( KColon8 );
+	    resValue->Des().Append( KStar8 );
+
+		CUpnpProtocolInfo* pInfo = CUpnpProtocolInfo::NewL(*resValue);
+		CUpnpAttribute* attribute = CUpnpAttribute::NewLC( KAttributeProtocolInfo() );
+		attribute->SetValueL( pInfo->ProtocolInfoL() );
+		elRes->AddAttributeL( attribute );    
+    	aItem.AddElementL(elRes);
+
+		CleanupStack::Pop( attribute );
+		CleanupStack::PopAndDestroy( resValue );
+		CleanupStack::PopAndDestroy( resolver );
+    	CleanupStack::Pop( elRes );
+  		resValue = NULL;
+    	mimetype = NULL;
+    	
+    	return;
+    }
+    // Fixes ESLX-7B7HBL
+    else if( err )
+        {
+        User::Leave( err );
+        }
+
+    CleanupStack::PushL( resParameters );
+
+    // Add protocolInfo parameter to res element.
+    if ( resParameters->ProtocolInfo().Length() > 0 ) 
+        {
+        CUpnpAttribute* prInfo = CUpnpAttribute::NewLC( KAttributeProtocolInfo() );
+        prInfo->SetValueL( resParameters->ProtocolInfo() );   
+        elRes->AddAttributeL( prInfo ); //transfer ownership
+        CleanupStack::Pop( prInfo );       
+        }
+
+    // Add size parameter to res element.
+
+    HBufC8* sizeString = resParameters->FileSizeL();
+    if ( sizeString ) 
+        {
+        CleanupStack::PushL( sizeString );
+        CUpnpAttribute* size =
+            CUpnpAttribute::NewLC( KAttributeSize() );
+        size->SetValueL( *sizeString );
+
+        elRes->AddAttributeL( size ); //transfer ownership
+        CleanupStack::Pop( size );        
+        CleanupStack::PopAndDestroy( sizeString );
+        sizeString = NULL;
+        }
+
+    if ( resParameters->IsImageFile() ) 
+        {
+        // In image case, add resolution parameter to res element.
+        HBufC8* resolutionString = resParameters->ResolutionL();
+        if ( resolutionString ) 
+            {
+            CleanupStack::PushL( resolutionString );
+            CUpnpAttribute* resolution = 
+                CUpnpAttribute::NewLC( KAttributeResolution() );
+            resolution->SetValueL( *resolutionString );
+            elRes->AddAttributeL( resolution ); //transfer ownership
+            CleanupStack::Pop( resolution );            
+            CleanupStack::PopAndDestroy( resolutionString );
+            resolutionString = NULL;
+            }
+        }
+    else if ( resParameters->IsAudioOrVideoFile() )
+        {
+        // In music or video case, add duration parameter to res element.
+        HBufC8* durationString = resParameters->DurationL();
+        if ( durationString ) 
+            {
+            CleanupStack::PushL( durationString );
+            CUpnpAttribute* duration =
+                CUpnpAttribute::NewLC( KAttributeDuration() );
+            duration->SetValueL( *durationString );
+            elRes->AddAttributeL( duration ); //transfer ownership
+            CleanupStack::Pop( duration );
+            CleanupStack::PopAndDestroy( durationString );
+            durationString = NULL;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( resParameters );
+    CleanupStack::PopAndDestroy( resolver );
+
+    // Attach res element to aItem.
+    aItem.AddElementL( elRes ); //transfer ownership
+    CleanupStack::Pop( elRes );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCdsResElementUtility::IsUriAbsolute
+// 
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+EXPORT_C TBool UpnpCdsResElementUtility::IsUriAbsolute( const TDesC8& aUri )
+    {
+    TInetAddr addr;
+    TBool retVal = EFalse;
+    TBuf<KIpAddLen> ipAddrBuf;
+    // if aUri.Length is less than KHttp().Length(),aUri is invalid
+    if ( aUri.Length() >= KHttp().Length() )
+		{
+		TPtrC8 right = aUri.Right( aUri.Length() - KHttp().Length() );
+
+		TInt posit = right.Locate( TChar( KColon ) );
+		if( posit != KErrNotFound )
+			{
+			TPtrC8 ipAddr = right.Left( posit );
+			if( ipAddr.Length() <= KIpAddLen )
+				{
+				ipAddrBuf.Copy( ipAddr );
+				}
+			}
+
+		if( addr.Input( ipAddrBuf ) == KErrNone )
+			{
+			retVal = ETrue;
+			}
+		}
+
+	return retVal;    
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/src/upnpcommonutils.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1124 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Upnp framework's common utility functions
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <e32std.h>
+#include <upnpstring.h>
+#include <apmrec.h>
+#include <apgcli.h>
+#include <WlanCdbCols.h>            // WLAN_SERVICE
+#include <caf/content.h>                // CAF (WM-DRM check)
+#include <caf/agent.h>                  // CAF (WM-DRM check)
+#include <commdb.h>
+#include <in_sock.h> 
+#include <pathinfo.h>
+
+// upnp stack api
+#include <upnpcontainerlist.h>
+#include <upnpcontainer.h>
+#include <upnpitem.h>
+#include <upnpdevice.h>
+
+// upnpframework / avcontroller helper api
+#include <upnpconstantdefs.h>
+
+// utilities internal
+#include "upnpfileutilitytypes.h"
+#include "upnpcommonutils.h"
+
+_LIT( KComponentLogfile, "upnputilities.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT8( KMimeAudio,          "audio" );
+_LIT8( KMimeVideo,          "video" );
+_LIT8( KMimeImage,          "image" );
+_LIT8( KMimePlaylist,       "audio/mpegurl" );
+
+_LIT16( KXHtml16,           ".XHTML" );
+_LIT16( KHtml16,            ".HTML" );
+_LIT16( KXml16,             ".XML" );
+_LIT16( KTxt16,             ".TXT" );
+_LIT16( KJpeg16,            ".JPEG" );
+_LIT16( KJpg16,             ".JPG" );
+_LIT16( KGif16,             ".GIF" );
+_LIT16( KPng16,             ".PNG" );
+_LIT16( KMpeg16,            ".MPEG" );
+_LIT16( KMpg16,             ".MPG" );
+_LIT16( KMpeg416,           ".MPEG4" );
+_LIT16( KAvi16,             ".AVI" );
+_LIT16( KMp316,             ".MP3" );
+_LIT16( KAac16,             ".AAC" );
+_LIT16( KWma16,             ".WMA" );
+_LIT8( KXHtml,              "application/vnd.pwg-xhtml-print" );
+_LIT8( KHtml,               "text/html" );
+_LIT8( KXml,                "text/xml" );
+_LIT8( KTxt,                "text/plain" );
+_LIT8( KJpg,                "image/jpeg" );
+_LIT8( KGif,                "image/gif" );
+_LIT8( KPng,                "image/png" );
+_LIT8( KMpeg,               "video/mpeg" );
+_LIT8( KMpeg4,              "video/mpeg4" );
+_LIT8( KMp3,                "audio/mpeg" );
+_LIT8( KAac,                "audio/aac" );
+_LIT8( KWma,                "audio/x-ms-wma" );
+_LIT8( KAvi,                "video/x-msvideo" );
+
+
+_LIT(  KLineFeed,           "\r\n");
+_LIT8( KHttpDes,            "http://" );
+_LIT( KTemp,                "upnpfwtemp");
+
+_LIT8( KUnderScore,         "_" );
+_LIT8( KStar,               "*" );
+_LIT8( KColon,              ":");
+_LIT8( KKorp,               "<" );
+_LIT8( KProk,               ">" );
+_LIT8( KQuotation,          "\"" );
+_LIT8( KDoubleBackSlash,    "\\" );
+_LIT8( KSlash,              "/" );
+_LIT8( KQuestionMark,       "?" );
+_LIT8( KPipe,               "|" );
+_LIT8( KTab,                "\t" );
+_LIT8( KSpace,              " " );
+
+const TInt KPlaceHolderLength       = 28;
+const TInt KBufferLength            = 256;
+const TInt KBufferLengthSmall       = 10;
+const TInt KCodeSemicolon           = 58;
+const TInt KMask                    = 0xFF;
+const TInt KCodeDot                 = 46;
+
+
+_LIT( KUpnpDateString,"%F%Y-%M-%D");
+const TInt KMaxDateStringLength = 30;
+
+
+
+_LIT8( KAudioSupport,        "audio/" );
+_LIT8( KImageSupport,        "image/" );
+_LIT8( KVideoSupport,        "video/" );
+
+_LIT8( KImageJpeg,         	"=JPEG_" );
+_LIT8( KImagePng,          	"=PNG_" );
+
+_LIT8( KAudioAc3,         	"=AC3" );
+_LIT8( KAudioAmr,         	"=AMR_" );
+_LIT8( KAudioAtra,         	"=ATRAC3plus" );
+_LIT8( KAudioLpcm,         	"=LPCM" );
+_LIT8( KAudioMp3,         	"=MP3" );
+_LIT8( KAudioAac,         	"=AAC_" );
+_LIT8( KAudioHeaac,        	"=HEAAC_" );
+_LIT8( KAudioBsac,         	"=BSAC_" );
+_LIT8( KAudioWmab,         	"=WMABASE" );
+_LIT8( KAudioWmaf,         	"=WMAFULL" );
+
+_LIT8( KAudioWmap,         	"=WMAPRO" );
+_LIT8( KVideoMpeg,          "=MPEG" );
+_LIT8( KVideoAvc,          	"=AVC_" );
+_LIT8( KVideoWmvm,         	"=WMVMED_" );
+_LIT8( KVideoVmvh,          "=WMVHIGH_" );
+_LIT8( KVideoWmvh,          "=WMVHM_" );
+_LIT8( KVideoWmvspll,       "=WMVSPLL_" );
+_LIT8( KVideoWmvspml,       "=WMVSPML_" );
+// ============================ LOCAL FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::MemoryCardStateL
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool UPnPCommonUtils::MemoryCardStateL()
+    {
+    TDriveInfo driveInfo;
+
+    TBool status = EFalse;
+    RFs fileServer;
+    User::LeaveIfError( fileServer.Connect() );
+    CleanupClosePushL( fileServer );
+    TInt error = fileServer.Drive( driveInfo, EDriveE );
+    CleanupStack::PopAndDestroy( &fileServer );
+
+    //check if memory card is present
+    if ( error == KErrNone && driveInfo.iType == EMediaHardDisk )
+        {
+        status = ETrue;
+        }
+
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::ResolveMimeTypeL
+// Resolves the MIME type of a file. Leaves in error cases.
+// --------------------------------------------------------------------------
+EXPORT_C HBufC8* UPnPCommonUtils::ResolveMimeTypeL( const TDesC& aFileName )
+    {
+    HBufC8* mimetype = NULL;
+
+    mimetype = GetMimeTypeByExtensionL( aFileName );
+
+    // If the mime type was not recognized by the extension, try the 
+    // platform mime type recognizer
+    if( !mimetype )
+        {           
+        // finding server
+        RApaLsSession sess; 
+        TInt error = sess.Connect();
+    
+        // We have FS, File and RApaLs open
+        if ( error == KErrNone )
+            {
+            CleanupClosePushL( sess );
+    
+            TUid id = TUid::Uid( 0 );
+            TDataType type;
+    
+            error = sess.AppForDocument( aFileName, id, type );
+    
+            if( error == KErrNone )
+                {
+                mimetype = HBufC8::NewL( type.Des8().Length() + 
+                                         KLineFeed().Length() );
+                mimetype->Des().Append( type.Des8() );
+                mimetype->Des().Append( KLineFeed() );
+                }
+                
+            // Clean up
+            CleanupStack::PopAndDestroy( &sess );
+            }
+        }
+
+    return mimetype;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::GetMimeTypeByExtensionL
+// Resolves the type of a file. Leaves in error cases.
+// --------------------------------------------------------------------------
+EXPORT_C HBufC8* UPnPCommonUtils::GetMimeTypeByExtensionL(
+    const TDesC& aFileName )
+    {
+    HBufC8* mimetype = NULL;
+    HBufC* tempFilename = aFileName.AllocL();
+    CleanupStack::PushL( tempFilename );
+
+    // Convert letters to upper case
+    tempFilename->Des().UpperCase();
+
+    TParse parse;
+    parse.Set( tempFilename->Des(), NULL, NULL );
+    TBufC<KMaxName> ext( parse.Ext() );
+
+    CleanupStack::PopAndDestroy( tempFilename );
+    tempFilename = NULL;
+
+    // FindC and length calculation is used,
+    // because compareC does not work for undefined reason  
+
+    if ( ext.FindC( KHtml16 ) == 0 && 
+         ext.Length() == KHtml16().Length() )
+        {
+        mimetype = HBufC8::NewLC( KHtml().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KHtml() );
+        }
+    else if ( ext.FindC( KXml16 ) == 0 && 
+              ext.Length() == KXml16().Length() )
+        {
+        mimetype = HBufC8::NewLC( KXml().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KXml() );
+        }
+    else if ( ext.FindC( KTxt16 ) == 0 && 
+              ext.Length() == KTxt16().Length() )
+        {
+        mimetype = HBufC8::NewLC( KTxt().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KTxt() );
+        }
+    else if ( ( ext.FindC( KJpg16 ) == 0 && 
+                ext.Length() == KJpg16().Length() ) ||
+                ( ext.FindC( KJpeg16 ) == 0 && 
+                  ext.Length() == KJpeg16().Length() ) )
+        {
+        mimetype = HBufC8::NewLC( KJpg().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KJpg() );
+        }       
+    else if ( ext.FindC( KGif16 ) == 0 && 
+              ext.Length() == KGif16().Length() )
+        {
+        mimetype = HBufC8::NewLC( KGif().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KGif() );
+        }   
+    else if ( ext.FindC( KPng16 ) == 0 && 
+              ext.Length() == KPng16().Length() )
+        {
+        mimetype = HBufC8::NewLC( KPng().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KPng() );
+        }
+    else if ( ( ext.FindC( KMpg16 ) == 0 &&
+                ext.Length() == KMpg16().Length() ) ||
+                ( ext.FindC( KMpeg16 ) == 0 &&
+                  ext.Length() == KMpeg16().Length() ) )
+        {
+        mimetype = HBufC8::NewLC( KMpeg().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KMpeg() );
+        }
+    else if ( ( ext.FindC( KMpeg416 ) == 0 && 
+                ext.Length() == KMpeg416().Length() ) )
+        {
+        mimetype = HBufC8::NewLC( KMpeg4().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KMpeg4() );
+        }
+    else if ( ext.FindC( KAvi16 ) == 0 && 
+              ext.Length() == KAvi16().Length() )
+        {
+        mimetype = HBufC8::NewLC( KAvi().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KAvi() );
+        }
+    else if ( ext.FindC( KMp316 ) == 0 && 
+              ext.Length() == KMp316().Length() )
+        {
+        mimetype = HBufC8::NewLC( KMp3().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KMp3() );
+        }
+    else if ( ext.FindC( KXHtml16 ) == 0 && 
+              ext.Length() == KXHtml16().Length() )
+        {
+        mimetype = HBufC8::NewLC( KXHtml().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KXHtml() );
+        }
+    else if ( ext.FindC( KAac16 ) == 0 && 
+              ext.Length() == KAac16().Length() )
+        {
+        mimetype = HBufC8::NewLC( KAac().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KAac() );
+        }
+    else if ( ext.FindC( KWma16 ) == 0 && 
+              ext.Length() == KWma16().Length() )
+        {
+        mimetype = HBufC8::NewLC( KWma().Length() );
+        mimetype->Des().Zero();
+        mimetype->Des().Append( KWma() );
+        }
+    else
+        {
+        // Mime type not recognized. Return NULL.        
+        }
+
+    if( mimetype )
+        {
+        CleanupStack::Pop( mimetype );
+        }
+
+    return mimetype;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::ResolveFileTypeL
+// Resolves the MIME type of a file. Leaves in error cases.
+// --------------------------------------------------------------------------
+EXPORT_C TUPnPItemType UPnPCommonUtils::ResolveFileTypeL(
+                                                    const TDesC& aFileName )
+    {
+    TUPnPItemType returnValue = ETypeOther;
+
+    if( aFileName != KNullDesC )
+        {
+
+        HBufC8* mimetype = NULL;
+        mimetype = ResolveMimeTypeL( aFileName );
+        if( mimetype )
+            {
+            CleanupStack::PushL( mimetype );
+
+            if( mimetype->Des().Find( KMimeImage() ) >= 0 )
+                {
+                returnValue = ETypeImage;
+                }
+            else if( mimetype->Des().Find( KMimePlaylist() ) >= 0 )
+                {
+                returnValue = ETypePlaylist;
+                }
+            else if( mimetype->Des().Find( KMimeAudio() ) >= 0 )
+                {
+                returnValue = ETypeAudio;
+                }
+            else if( mimetype->Des().Find( KMimeVideo() ) >= 0 )
+                {
+                returnValue = ETypeVideo;
+                }
+            else
+                {
+                returnValue = ETypeOther;
+                }
+    
+            // Clean up
+            CleanupStack::PopAndDestroy( mimetype );
+            mimetype = NULL;
+            }
+        else
+            {
+            returnValue = ETypeOther;
+            }
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    return returnValue;
+    }
+
+//---------------------------------------------------------------------------
+// UPnPCommonUtils::ReplacePlaceHolderInURIL
+// Replaces IP address and port number placeholders of the RES element's URI
+// string of the given item.
+//---------------------------------------------------------------------------
+//
+EXPORT_C void UPnPCommonUtils::ReplacePlaceHolderInURIL( 
+                                            CUpnpItem& aItem,
+                                            const TInetAddr& aAddress )
+    {
+    __LOG( "UPnPCommonUtils::ReplacePlaceHolderInURIL" );
+    
+    const RUPnPElementsArray& elms = aItem.GetElements();
+    
+    TInt count = elms.Count();
+    TInt i = 0;
+    for( ; i < count; i++)
+        {
+        if( elms[ i ]->Name() == KElementRes )
+            {
+            TPtrC8 ptrC( elms[ i ]->Value() );
+
+            HBufC8* addrBuf = HBufC8::NewLC( KBufferLength );
+            addrBuf->Des().Append( KHttpDes );
+            TBuf8<KBufferLengthSmall> buf;
+            TChar separator( KCodeSemicolon );
+            TChar dot( KCodeDot );
+            TUint32 addr = aAddress.Address();
+            buf.Num( addr >> 24 ); // First part of the ip address
+            addrBuf->Des().Append( buf );
+            addrBuf->Des().Append( dot );
+            buf.Num( ( addr >> 16 ) & KMask ); // Second part of ip address
+            addrBuf->Des().Append( buf );
+            addrBuf->Des().Append( dot );
+            buf.Num( ( addr >> 8 ) & KMask ); // Third part of the ip address
+            addrBuf->Des().Append( buf );
+            addrBuf->Des().Append( dot );
+            buf.Num( addr & KMask ); // last part of the ip address
+            addrBuf->Des().Append( buf );
+            addrBuf->Des().Append( separator );
+
+            buf.Num( aAddress.Port() ); // port number
+            addrBuf->Des().Append( buf );
+            
+            // Append rest of the uri
+            addrBuf->Des().Append( ptrC.Mid( KPlaceHolderLength ) );
+            
+            __LOG8( *addrBuf );
+            
+            elms[ i ]->SetValueL( *addrBuf );
+                        
+            CleanupStack::PopAndDestroy( addrBuf );
+            i = count;
+            }
+        }    
+    }
+    
+//---------------------------------------------------------------------------
+// UPnPCommonUtils::ReplaceIllegalFilenameCharactersL
+// Replaces the illegal filename characters from the given filename string
+// and returns a new fixed filename string. 8bit version.
+//---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+                                        const TDesC8& aFileName )
+    {
+    // Note that this implementation is a bit slow since it goes through the 
+    // descriptor many times. Only one iteration would be optimal solution.
+    HBufC8* buf = HBufC8::NewLC( aFileName.Length() );
+    TPtr8 ptr = buf->Des();
+    ptr.Copy( aFileName );
+    
+    UpnpString::StringReplaceInPlaceL( ptr, 
+                                       KProk(),
+                                       KUnderScore() );
+    UpnpString::StringReplaceInPlaceL( ptr,
+                                       KKorp(),
+                                       KUnderScore() );        
+    UpnpString::StringReplaceInPlaceL( ptr,
+                                       KQuotation(),
+                                       KUnderScore() );
+    UpnpString::StringReplaceInPlaceL( ptr,
+                                       KDoubleBackSlash(),
+                                       KUnderScore() );
+    UpnpString::StringReplaceInPlaceL( ptr, 
+                                       KSlash(),
+                                       KUnderScore() );
+    UpnpString::StringReplaceInPlaceL( ptr,
+                                       KStar(),
+                                       KUnderScore() );
+    UpnpString::StringReplaceInPlaceL( ptr,
+                                       KPipe(),
+                                       KUnderScore() );
+    UpnpString::StringReplaceInPlaceL( ptr,
+                                       KColon(),
+                                       KUnderScore() );
+    UpnpString::StringReplaceInPlaceL( ptr,
+                                       KQuestionMark(),
+                                       KUnderScore() );
+    UpnpString::StringReplaceInPlaceL( ptr,
+                                       KTab(),
+                                       KUnderScore() );
+    CleanupStack::Pop(); // Can't pop by name, name invalid now
+    return buf;
+    }    
+
+//---------------------------------------------------------------------------
+// UPnPCommonUtils::ReplaceIllegalFilenameCharactersL
+// Replaces the illegal filename characters from the given filename string
+// and returns a new fixed filename string. 16bit version.
+//---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( 
+                                        const TDesC& aFilename )
+    {
+    HBufC8* convertedParam = NULL;
+    convertedParam = UpnpString::FromUnicodeL( aFilename );
+    CleanupStack::PushL( convertedParam );
+    
+    HBufC8* replacedFilename8 = NULL;
+    replacedFilename8 = ReplaceIllegalFilenameCharactersL( *convertedParam );
+    CleanupStack::PushL( replacedFilename8 );
+
+    HBufC* replacedFilename16 = NULL;
+    replacedFilename16 = UpnpString::ToUnicodeL( *replacedFilename8 );
+    
+    // Clean up
+    CleanupStack::PopAndDestroy( replacedFilename8 );
+    CleanupStack::PopAndDestroy( convertedParam );
+                                            
+    return replacedFilename16;
+    }    
+
+//---------------------------------------------------------------------------
+// UPnPCommonUtils::IsPlaylistContainerL
+// Checks if the given CUpnpObject is a playlist container.
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool UPnPCommonUtils::IsPlaylistContainerL( 
+                                        const CUpnpObject& aContainer )
+    {
+    TBool returnValue = EFalse;
+    if( aContainer.ObjectType() != EUPnPContainer ||
+        aContainer.ObjectClass() == KNullDesC8 )
+        {
+        User::Leave( KErrArgument );
+        }
+    else
+        {
+        if( aContainer.ObjectClass().CompareF( KClassPlaylist() ) == 0 )
+            {
+            returnValue = ETrue;
+            }        
+        }
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::FindContainerByTitle
+// Finds container from CUpnpContainerList by title field
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpContainer* UPnPCommonUtils::FindContainerByTitle(
+    const CUpnpContainerList& aList, const TDesC8& aTitle )
+    {
+    TBool notFound( ETrue );
+    TInt index( 0 );
+    CUpnpContainer* tmp( NULL );
+
+    while ( index < aList.ObjectCount() && notFound )
+        {
+        tmp = static_cast< CUpnpContainer* >
+            ( aList[ index ] );
+        if ( tmp->Title().Compare( aTitle ) == 0 )
+            {
+            notFound = EFalse;
+            }
+        else
+            {
+            tmp = NULL;
+            }
+        index++;
+        }
+    return tmp;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::IntToDesC8LC
+// Returns IntValue for aObject
+// --------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* UPnPCommonUtils::IntToDesC8LC( 
+    const TInt& aObject )
+    {
+    HBufC8* buf = HBufC8::NewLC(12);
+    TPtr8 ptrBuf = buf->Des();
+
+    ptrBuf.Num(aObject);
+
+    return buf;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::DesC8ToInt
+// Returns IntValue for aObject
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt UPnPCommonUtils::DesC8ToInt( 
+    const TDesC8& aObject )
+    {
+    TLex8 lex( aObject );
+
+    TInt lValue( KErrArgument );
+
+    lex.Val( lValue );
+    return lValue;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::TTimeToUPnPDateL
+// see upnpcommonutils.h
+// --------------------------------------------------------------------------
+EXPORT_C HBufC* UPnPCommonUtils::TTimeToUPnPDateL( TTime aTime )
+    {
+    TBuf<KMaxDateStringLength> date;        
+    aTime.FormatL( date, KUpnpDateString );
+
+    return date.AllocL();
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::RenameFileL
+// see upnpcommonutils.h
+// --------------------------------------------------------------------------
+EXPORT_C HBufC* UPnPCommonUtils::RenameFileL( const TDesC& aFilePath )
+    {
+    
+    //get the file extension include '.',e.g .jpg
+    TInt dot = aFilePath.LocateReverse( KCodeDot );
+    HBufC* extension = NULL;
+    if( dot > 0 ) //if there is extension
+        {
+        extension = aFilePath.Right( aFilePath.Length() - dot ).AllocL();
+        CleanupStack::PushL( extension );
+        }
+    else //if there is no extension
+        {
+        dot = aFilePath.Length();
+        }
+    // get the file path without extension: http://1.2.3//test
+    HBufC* leftString = aFilePath.Left( dot ).AllocL(); 
+    CleanupStack::PushL( leftString );
+    
+    //rename it: http:://1.2.3//test_upnptemp.jpg
+    HBufC* name_upnpfwtemp = NULL;
+    if( extension )
+        {
+        name_upnpfwtemp = HBufC::NewL( leftString->Length() + 
+                                          KTemp().Length() + 
+                                          extension->Length() );    
+        }
+    else
+        {
+        name_upnpfwtemp = HBufC::NewL( leftString->Length() + 
+                                       KTemp().Length() );
+        }
+                            
+    name_upnpfwtemp->Des().Append( *leftString );
+    name_upnpfwtemp->Des().Append( KTemp() );
+    
+    if( extension )
+        {
+        name_upnpfwtemp->Des().Append( *extension );
+        }
+    
+    
+    CleanupStack::PopAndDestroy( leftString );
+    
+    if( extension )
+        {
+        CleanupStack::PopAndDestroy( extension );
+        }
+    
+    
+    CleanupStack::PushL( name_upnpfwtemp );
+    
+    // try to rename the file
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() ); // connect session
+    CleanupClosePushL( fsSession );
+
+    TInt error = fsSession.Rename( aFilePath, *name_upnpfwtemp );
+
+    CleanupStack::PopAndDestroy( &fsSession );
+    CleanupStack::Pop( name_upnpfwtemp ); 
+    
+    if( KErrNone == error )
+        {
+        return name_upnpfwtemp; //transfer ownership
+        }
+    else
+        {
+        delete name_upnpfwtemp;
+        return NULL;
+        }
+    
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::DeleteTempFilesL
+// see upnpcommonutils.h
+// --------------------------------------------------------------------------
+EXPORT_C void UPnPCommonUtils::DeleteTempFilesL()
+    {
+    __LOG("UPnPCommonUtils::\
+DeleteTempFilesL begin");
+
+    RFs fs;
+    User::LeaveIfError( fs.Connect() ); // connect session
+    CleanupClosePushL( fs );
+
+    CFileMan* fileMan = CFileMan::NewL( fs );
+    CleanupStack::PushL( fileMan );
+    _LIT( KAnyChar, "*");
+    _LIT( KAnyExtension, "*.*");
+    _LIT( KUpnpUploadTempDirectory, "Download\\Media\\temp\\" );
+
+    // clean phone memory
+    HBufC* path = HBufC::NewLC( KMaxFileName );
+    TPtrC mcDrive( PathInfo::MemoryCardRootPath() );
+    path->Des().Append( mcDrive );
+    path->Des().Append( KUpnpUploadDirectory );
+    path->Des().Append( KAnyChar );
+    path->Des().Append( KTemp );
+    path->Des().Append( KAnyExtension );
+    fileMan->Delete( *path );
+    
+    path->Des().Zero();
+    path->Des().Append( mcDrive );
+    path->Des().Append( KUpnpUploadTempDirectory );
+    path->Des().Append( KAnyExtension );
+    fileMan->Delete( *path );
+    CleanupStack::PopAndDestroy( path );
+
+    // clean memory card
+    path = HBufC::NewLC( KMaxFileName );
+    TPtrC phoneDrive( PathInfo::PhoneMemoryRootPath() );
+    path->Des().Append( phoneDrive );
+    path->Des().Append( KUpnpUploadDirectory );
+    path->Des().Append( KAnyChar );
+    path->Des().Append( KTemp );
+    path->Des().Append( KAnyExtension );
+    fileMan->Delete( *path );
+    
+    path->Des().Zero();
+    path->Des().Append( phoneDrive );
+    path->Des().Append( KUpnpUploadTempDirectory );
+    path->Des().Append( KAnyExtension );
+    fileMan->Delete( *path );
+    CleanupStack::PopAndDestroy( path );
+
+    CleanupStack::PopAndDestroy( fileMan );
+    CleanupStack::PopAndDestroy( &fs );
+
+    __LOG("UPnPCommonUtils::\
+DeleteTempFilesL end");
+    }
+
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::IsImageSupported
+// see upnpcommonutils.h
+// --------------------------------------------------------------------------    
+ EXPORT_C TBool UPnPCommonUtils::IsImageSupported( const TDesC8& aProtocolInfo )
+	{
+	// simple check
+	if( aProtocolInfo.Find( KImageSupport ) >= 0 )
+		{
+		return ETrue;
+		}
+		
+		
+	// check mime types	
+	if( aProtocolInfo.FindC( KImageJpeg ) > 0 )
+		{
+		return ETrue;
+		}
+		
+	if( aProtocolInfo.FindC( KImagePng ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	return EFalse;
+	}
+	
+	
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::IsAudioSupported
+// see upnpcommonutils.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool UPnPCommonUtils::IsAudioSupported( const TDesC8& aProtocolInfo )
+	{
+	// simple check
+	if( aProtocolInfo.Find( KAudioSupport ) >= 0 )
+		{
+		return ETrue;
+		}
+		
+	
+	// check mime types	
+	if( aProtocolInfo.FindC( KAudioAc3 ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KAudioAmr ) > 0 )
+		{
+		return ETrue;
+		}
+
+	if( aProtocolInfo.FindC( KAudioAtra ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KAudioLpcm ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KAudioMp3 ) > 0 )
+		{
+		return ETrue;
+		}
+
+	if( aProtocolInfo.FindC( KAudioAac ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KAudioHeaac ) > 0 )
+		{
+		return ETrue;
+		}
+
+	if( aProtocolInfo.FindC( KAudioBsac ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KAudioWmab ) > 0 )
+		{
+		return ETrue;
+		}
+			
+	if( aProtocolInfo.FindC( KAudioWmaf ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KAudioWmap ) > 0 )
+		{
+		return ETrue;
+		}
+	
+
+	return EFalse;
+	}
+	
+	
+
+	
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::IsVideoSupported
+// see upnpcommonutils.h
+// --------------------------------------------------------------------------
+EXPORT_C TBool UPnPCommonUtils::IsVideoSupported( const TDesC8& aProtocolInfo )
+	{
+	// simple check
+	if( aProtocolInfo.Find( KVideoSupport ) >= 0 )
+		{
+		return ETrue;
+		}
+		
+		
+	// check mime types		
+	if( aProtocolInfo.FindC( KVideoMpeg ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KVideoAvc ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KVideoWmvm ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KVideoVmvh ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KVideoWmvh ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KVideoWmvspll ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	if( aProtocolInfo.FindC( KVideoWmvspml ) > 0 )
+		{
+		return ETrue;
+		}
+	
+	return EFalse;
+	}
+	
+// --------------------------------------------------------------------------
+// UPnPCommonUtils::FileExtensionByMimeTypeL
+// See upnpfileutility.h
+//---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* UPnPCommonUtils::FileExtensionByMimeTypeL(
+    const TDesC8& aMimeType )
+    {
+    HBufC* fileExt = NULL;
+
+    // XHTML
+    if( aMimeType.CompareC( KXHtmlMime ) == 0 )
+        {
+        fileExt = KXHtmlExt().AllocL();
+        }
+    // HTML
+    else if( aMimeType.CompareC( KHtmlMime ) == 0 )
+        {
+        fileExt = KHtmlExt().AllocL();
+        }
+    // XML
+    else if( aMimeType.CompareC( KXmlMime1 ) == 0 ||
+             aMimeType.CompareC( KXmlMime2 ) == 0 ||
+             aMimeType.CompareC( KXmlMime3 ) == 0  )
+        {
+        fileExt = KXmlExt().AllocL();
+        }
+    // TXT    
+    else if( aMimeType.CompareC( KTxtMime )  == 0 ||
+             aMimeType.CompareC( KTxtMime2 ) == 0 ||
+             aMimeType.CompareC( KTxtMime3 ) == 0 ||
+             aMimeType.CompareC( KTxtMime4 ) == 0 ||
+             aMimeType.CompareC( KTxtMime5 ) == 0 ||
+             aMimeType.CompareC( KTxtMime6 ) == 0  )
+        {
+        fileExt = KTxtExt().AllocL();
+        }
+    // JPEG
+    else if( aMimeType.CompareC( KJpegMime ) == 0 )
+        {
+        fileExt = KJpegExt().AllocL();
+        }
+    // JPG
+    else if( aMimeType.CompareC( KJpegMime2 ) == 0 ||
+             aMimeType.CompareC( KJpegMime3 ) == 0 ||
+             aMimeType.CompareC( KJpegMime4 ) == 0 ||
+             aMimeType.CompareC( KJpegMime5 ) == 0  )
+        {
+        fileExt = KJpgExt().AllocL();
+        }
+    // GIF    
+    else if( aMimeType.CompareC( KGifMime )  == 0 ||
+             aMimeType.CompareC( KGifMime2 ) == 0 ||
+             aMimeType.CompareC( KGifMime3 ) == 0  )
+        {
+        fileExt = KGifExt().AllocL();
+        }
+    // PNG    
+    else if( aMimeType.CompareC( KPngMime )  == 0 ||
+             aMimeType.CompareC( KPngMime2 ) == 0 ||
+             aMimeType.CompareC( KPngMime3 ) == 0  )
+        {
+        fileExt = KPngExt().AllocL();
+        }
+    // MPG    
+    else if( aMimeType.CompareC( KMpgMime1 )  == 0 ||
+             aMimeType.CompareC( KMpgMime2 )  == 0 ||
+             aMimeType.CompareC( KMpgMime3 )  == 0 ||
+             aMimeType.CompareC( KMpgMime4 )  == 0 ||
+             aMimeType.CompareC( KMpgMime5 )  == 0 ||
+             aMimeType.CompareC( KMpgMime6 )  == 0 ||
+             aMimeType.CompareC( KMpgMime7 )  == 0 ||
+             aMimeType.CompareC( KMpgMime10 ) == 0  )
+        {
+        fileExt = KMpgExt1().AllocL();
+        }
+    // MPEG4    
+    else if( aMimeType.CompareC( KMpeg4Mime )  == 0 )
+        {
+        fileExt = KMpeg4Ext().AllocL();
+        }
+    // MP4        
+    else if( aMimeType.CompareC( KMp4Mime )  == 0 ||
+             aMimeType.CompareC( KMp4Mime2 ) == 0 ||
+             aMimeType.CompareC( KMp4Mime3 ) == 0  )
+        {
+        fileExt = KMp4Ext().AllocL();
+        }
+    // AVI
+    else if( aMimeType.CompareC( KAviMime1 ) == 0 ||
+             aMimeType.CompareC( KAviMime2 ) == 0 ||
+             aMimeType.CompareC( KAviMime3 ) == 0 ||
+             aMimeType.CompareC( KAviMime4 ) == 0 ||
+             aMimeType.CompareC( KAviMime5 ) == 0 ||
+             aMimeType.CompareC( KAviMime6 ) == 0 ||
+             aMimeType.CompareC( KAviMime7 ) == 0 ||
+             aMimeType.CompareC( KAviMime8 ) == 0 ||
+             aMimeType.CompareC( KAviMime9 ) == 0 )
+        {
+        fileExt = KAviExt().AllocL();
+        }
+    // MP3
+    else if( aMimeType.CompareC( KMp3Mime1 )  == 0 ||
+             aMimeType.CompareC( KMp3Mime2 )  == 0 ||
+             aMimeType.CompareC( KMp3Mime3 )  == 0 ||
+             aMimeType.CompareC( KMp3Mime4 )  == 0 ||
+             aMimeType.CompareC( KMp3Mime5 )  == 0 ||
+             aMimeType.CompareC( KMp3Mime6 )  == 0 ||
+             aMimeType.CompareC( KMp3Mime7 )  == 0 ||
+             aMimeType.CompareC( KMp3Mime8 )  == 0 ||
+             aMimeType.CompareC( KMp3Mime9 )  == 0 ||
+             aMimeType.CompareC( KMp3Mime10 ) == 0 )
+        {
+        fileExt = KMp3Ext().AllocL();
+        }
+    // AAC    
+    else if( aMimeType.CompareC( KAacMime )   == 0 ||
+             aMimeType.CompareC( KAacMime2 )  == 0 ||
+             aMimeType.CompareC( KAacMime3 )  == 0 ||
+             aMimeType.CompareC( KAacMime4 )  == 0 )
+        {
+        fileExt = KAacExt().AllocL();
+        }
+    //M4a
+    else if( aMimeType.CompareC( KM4aMime )   == 0 )
+       {
+       fileExt = KM4aExt().AllocL();
+       }
+    // WMA    
+    else if( aMimeType.CompareC( KWmaMime )   == 0 ||
+             aMimeType.CompareC( KWmaMime2 )  == 0 )
+        {
+        fileExt = KWmaExt().AllocL();
+        }
+    // BMP
+    else if( aMimeType.CompareC( KBmpMime )  == 0 ||
+             aMimeType.CompareC( KBmpMime2 ) == 0 ||
+             aMimeType.CompareC( KBmpMime3 ) == 0 ||
+             aMimeType.CompareC( KBmpMime4 ) == 0 ||
+             aMimeType.CompareC( KBmpMime5 ) == 0 ||
+             aMimeType.CompareC( KBmpMime6 ) == 0 ||
+             aMimeType.CompareC( KBmpMime7 ) == 0 ||
+             aMimeType.CompareC( KBmpMime8 ) == 0 ||
+             aMimeType.CompareC( KBmpMime9 ) == 0  )
+        {
+        fileExt = KBmpExt().AllocL();
+        }
+    // 3GP
+    else if( aMimeType.CompareC( KAudio3gpp ) == 0 ||
+             aMimeType.CompareC( KVideo3gpp ) == 0 ) 
+        {
+        fileExt = K3gpExt().AllocL();
+        }
+    // AMR
+    else if( aMimeType.CompareC( KAudioAMR )  == 0 )
+        {
+        fileExt = KAmrExt().AllocL();
+        }
+    // WAV
+    else if( aMimeType.CompareC( KAudioWav ) == 0 ||
+             aMimeType.CompareC( KAudioXWav ) == 0 ||
+             aMimeType.FindC( KAudioL16 ) != KErrNotFound )
+        {
+        fileExt = KWavExt().AllocL();
+        }
+    // Real audio    
+    else if ( aMimeType.CompareC( KRAMime8 )  == 0 )
+        {
+        fileExt = KRAExt().AllocL();
+        }
+    // TTS    
+    else if( aMimeType.CompareC( KVideoTts )  == 0 )
+        {
+        fileExt = KTtsExt().AllocL();
+        }
+    // WMV    
+    else if( aMimeType.CompareC( KWmvMime )  == 0 )
+        {
+        fileExt = KWmvExt().AllocL();        
+        }
+    return fileExt;
+    }
+
+//---------------------------------------------------------------------------
+// UPnPCommonUtils::FixListboxItemTextL
+// Removes the tab character of the given text
+// and returns a new fixed text string. 8bit version.
+//---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* UPnPCommonUtils::FixListboxItemTextL( const TDesC8& aText )
+    {
+    HBufC8* fixedText = HBufC8::NewLC( aText.Length() );
+    TPtr8 ptr = fixedText->Des();
+    ptr.Copy( aText );
+    
+    UpnpString::StringReplaceInPlaceL( ptr, 
+                                       KTab(),
+                                       KSpace() );   
+    CleanupStack::Pop(); // Can't pop by name, name invalid now
+    return fixedText;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/src/upnpconnectionmonitor.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,305 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Connection Monitor class implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include <nifvar.h>
+
+#include "upnpconnectionmonitor.h"
+
+// logging
+_LIT( KComponentLogfile, "upnputilities.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+#ifdef __UPNP_CONSOLE_MT__
+_LIT( KConnectionBreakdownSimulationFile, "C:\\Data\\Wlan" );
+#endif // __UPNP_CONSOLE_MT__
+
+
+
+// ========================== MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::CUPnPConnectionMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CUPnPConnectionMonitor::CUPnPConnectionMonitor(
+    MUPnPConnectionMonitorObserver& aObserver, TInt aAccessPoint ) :
+    CActive( EPriorityStandard ),
+    iObserver( aObserver ),
+    iAccessPoint( aAccessPoint )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CUPnPConnectionMonitor* CUPnPConnectionMonitor::NewL(
+    MUPnPConnectionMonitorObserver& aObserver, TInt aAccessPoint )
+    {
+    CUPnPConnectionMonitor* self = new(ELeave) CUPnPConnectionMonitor(
+        aObserver, aAccessPoint );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CUPnPConnectionMonitor::ConstructL()
+    {
+    __LOG( "CUPnPConnectionMonitor::ConstructL" );
+
+#ifdef __UPNP_CONSOLE_MT__
+
+    // monitor filesystem for connection breakdown simulation
+    CActiveScheduler::Add( this );
+    User::LeaveIfError( iFs.Connect() );
+    iFs.NotifyChange( ENotifyFile, iStatus,
+        KConnectionBreakdownSimulationFile );
+    SetActive();
+
+#endif // __UPNP_CONSOLE_MT__
+
+    iConnectionMonitor.ConnectL();
+    iConnectionMonitor.NotifyEventL( *this );
+
+    ParseCurrentConnections();
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::ParseCurrentConnections()
+// ---------------------------------------------------------------------------
+//
+void CUPnPConnectionMonitor::ParseCurrentConnections()
+    {    
+    // Get the count of connections
+    TRequestStatus status = KRequestPending;
+    TUint connectionCount = 0;
+    iConnectionMonitor.GetConnectionCount(connectionCount, status);
+    User::WaitForRequest( status ); 
+    // Go through available connections and check to see
+    // WLAN connection is already running
+    if( !status.Int() )
+        {
+        for( TUint i=1; i < connectionCount+1;  i++ )
+            {
+            TUint connectionId;
+            TUint subConnectionCount;
+
+            iConnectionMonitor.GetConnectionInfo( 
+                                            i,
+                                            connectionId, 
+                                            subConnectionCount);
+
+            if( IsWlanConnection( connectionId ) )
+                {
+                __LOG( "CUPnPConnectionMonitor - Found WLAN connection" );
+                iConnectionId = connectionId;
+                }
+            }   
+        }  
+    __LOG2( "CUPnPConnectionMonitor::ParseCurrentConnections() \
+    wlanId = %d connectionCount = %d ", iConnectionId , connectionCount );
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::~CUPnPConnectionMonitor()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CUPnPConnectionMonitor::~CUPnPConnectionMonitor()
+    {
+#ifdef __UPNP_CONSOLE_MT__
+
+    // stop monitoring filesystem
+    Cancel();
+    iFs.Close();
+
+#endif // __UPNP_CONSOLE_MT__
+
+    // Disconnect from CM server
+    iConnectionMonitor.CancelNotifications();
+    iConnectionMonitor.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::EventL()
+// Receives event from connection monitor
+// ---------------------------------------------------------------------------
+//
+void CUPnPConnectionMonitor::EventL( const CConnMonEventBase& aConnMonEvent )
+    {
+    __LOG1( "CUPnPConnectionMonitor::EventL type %d", aConnMonEvent.EventType() );
+    TUint connectionId = 0;
+
+    switch ( aConnMonEvent.EventType() )
+        {
+        case EConnMonCreateConnection:
+            {
+            const CConnMonCreateConnection* eventCreate; 
+            eventCreate = (const CConnMonCreateConnection*)&aConnMonEvent;
+            connectionId = eventCreate->ConnectionId();
+
+            // Save connectionId if type is WLAN
+            if( IsWlanConnection( connectionId ))
+                {
+                __LOG( "CUPnPConnectionMonitor::EventL EConnMonCreateConnection \
+WLAN connection found" );
+                iConnectionId = connectionId;
+                }
+
+            break;
+            }
+
+        // Connection is deleted
+        case EConnMonDeleteConnection:
+            {
+            const CConnMonDeleteConnection* eventDelete; 
+            eventDelete = 
+                    ( const CConnMonDeleteConnection* ) &aConnMonEvent;
+            connectionId = eventDelete->ConnectionId();
+            
+            // If there is new id for wlan we will pass if statement
+            // because then the current is invalid then
+            ParseCurrentConnections();
+            if( connectionId == iConnectionId )
+                {
+                __LOG( "CUPnPConnectionMonitor::EventL EConnMonDeleteConnection \
+WLAN connection found" );
+                iObserver.ConnectionLost();
+                }
+            break;
+            }
+         default:
+            {
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::IsWlanConnection()
+// Checks if connection type is WLAN
+// ---------------------------------------------------------------------------
+//
+TBool CUPnPConnectionMonitor::IsWlanConnection( TInt aConnectionId)
+    {
+    __LOG( "CUPnPConnectionMonitor::IsWlanConnection" );
+    TBool ret = EFalse;
+    TInt bearer = 0;
+    TInt bearerinfo = 0;
+    
+    TRequestStatus status = KRequestPending;
+    iConnectionMonitor.GetIntAttribute( 
+                                    aConnectionId, 
+                                    0, 
+                                    KBearer, 
+                                    (TInt &) bearer,
+                                    status );
+    User::WaitForRequest( status ); 
+    
+    TRequestStatus status2 = KRequestPending;
+    iConnectionMonitor.GetIntAttribute( 
+                                    aConnectionId, 
+                                    0, 
+                                    KBearerInfo, 
+                                    (TInt &) bearerinfo,
+                                    status2 );
+    User::WaitForRequest( status2 ); 
+    
+    if( bearer == EBearerWLAN && bearerinfo == EBearerWLAN )
+        {
+        ret = ETrue;
+        }
+        
+    return ret;
+    }
+    
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::RunL()
+// Active object run loop
+// ---------------------------------------------------------------------------
+//
+void CUPnPConnectionMonitor::RunL()
+    {
+#ifdef __UPNP_CONSOLE_MT__
+    // simulated connection break has been activated
+    iObserver.ConnectionLost();
+    iFs.Delete( KConnectionBreakdownSimulationFile );
+#endif // __UPNP_CONSOLE_MT__
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::DoCancel()
+// Active object cancel implementation
+// ---------------------------------------------------------------------------
+//
+void CUPnPConnectionMonitor::DoCancel()
+    {
+#ifdef __UPNP_CONSOLE_MT__
+    // cancel notifications from FS
+    iFs.NotifyChangeCancel();
+#endif // __UPNP_CONSOLE_MT__    
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPConnectionMonitor::DebugSimulateConnectionLostL()
+// Simulate connection lost case.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPConnectionMonitor::DebugSimulateConnectionLostL()
+    {
+#ifdef __UPNP_CONSOLE_MT__
+    // signal connection breakdown via filesystem
+    RFs fs;
+    CleanupClosePushL( fs );
+    User::LeaveIfError( fs.Connect() );
+    TInt err = fs.Delete( KConnectionBreakdownSimulationFile );
+    if ( err != KErrNone &&
+         err != KErrNotFound )
+        {
+        User::Leave( err );
+        }
+    
+    RFile file;
+    CleanupClosePushL( file );
+    User::LeaveIfError( file.Create( fs,
+        KConnectionBreakdownSimulationFile, EFileWrite ) );
+    
+    CleanupStack::PopAndDestroy( &file );
+    CleanupStack::PopAndDestroy( &fs );
+    
+#else // __UPNP_CONSOLE_MT__
+    // connection simulation method called, but feature is not active !
+    __PANICD( __FILE__, __LINE__ );
+#endif // __UPNP_CONSOLE_MT__
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/src/upnpgallerynotifier.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Functions to notify Media Gallery of new files.
+*
+*/
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <MCLFContentListingEngine.h>
+#include <ContentListingFactory.h>
+#include "upnpgallerynotifier.h"
+
+// CONSTANTS
+// none
+
+// ============================ LOCAL FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// UpnpGalleryNotifier::NotifyMediaGalleryL();
+// Notify CLF about the update in the file system (file added or
+// removed).
+//---------------------------------------------------------------------------
+//
+EXPORT_C void UpnpGalleryNotifier::NotifyMediaGalleryL()
+    {
+    MCLFContentListingEngine* engine = 
+        ContentListingFactory::NewContentListingEngineLC();  
+    
+    // Do the nofity
+    engine->UpdateItemsL();
+    
+    CleanupStack::PopAndDestroy(); // Do not check pointer (M-class!)
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/src/upnpmetadatafetcher.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,318 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP metadata fetching utilities.
+*
+*/
+
+
+// INCLUDE FILES
+// System
+#include <e32std.h>
+#include <e32base.h>
+
+// upnp stack api
+#include <upnpdevice.h>
+#include <upnpcontainer.h>
+#include <upnpitem.h>
+#include <upnpelement.h>
+#include <upnpstring.h>
+
+// upnpframework / avcontroller helper api
+#include <upnpconstantdefs.h>
+
+// utilities internal
+#include "upnpmetadatautility.h"
+#include "upnpcommonutils.h" 
+#include "upnpmetadatafetcher.h"
+#include "upnpcdsreselementutility.h"
+
+
+// CONSTANTS
+_LIT8( KMimeAudio,  "audio" );
+_LIT8( KMimeVideo,  "video" );
+_LIT8( KMimeImage,  "image" );
+_LIT8( KMimeApplication,    "application" );
+
+_LIT8( KItemCreator,    "None" );
+_LIT8( KRealMediaVideo,     "application/x-pn-realmedia" );
+
+// --------------------------------------------------------------------------
+// UPnPMetadataFetcher::FetchMetadataL
+// Resolves the metadata and fills in the CUpnpObject's metadata fields 
+// accordingly.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void UPnPMetadataFetcher::FetchMetadataL( CUpnpObject& aObject, 
+                                                   const TDesC& aFilePath, 
+                                                   const TDesC8& aMimeType )
+    {
+    CUPnPMetaDataUtility* utility = CUPnPMetaDataUtility::NewL();
+    CleanupStack::PushL( utility );
+
+    // APa: Continue even if the loading of meta data fails
+    // (in S60 3.2 this leaves)
+    TRAP_IGNORE( utility->LoadMetaDataL( aFilePath ) );
+
+    // Get the title from metadata is available, if not, use the filename
+    HBufC8* tempBuf = NULL;
+    if( utility->Title().Length() > 0 )
+        {
+        tempBuf = UpnpString::FromUnicodeL( utility->Title() );
+        CleanupStack::PushL( tempBuf );
+        aObject.SetTitleL( *tempBuf );
+        CleanupStack::PopAndDestroy( tempBuf ); tempBuf = NULL;
+        }
+    else
+        {
+        // Remove the path and file extension from the filename
+        TInt lastDot = 0;
+        TInt lastSlash = 0;
+        TInt length = 0;
+        lastDot = aFilePath.LocateReverseF('.');
+        if( KErrNotFound == lastDot ) //if file extension is not found
+            {
+            lastDot = aFilePath.Length();
+            }
+        lastSlash = aFilePath.LocateReverseF('\\');
+        length = lastDot - lastSlash;
+        HBufC* strippedFilename = NULL;
+        strippedFilename = aFilePath.Mid((lastSlash+1), (length-1)).AllocL();
+        CleanupStack::PushL( strippedFilename );
+
+        // Convert to 8bit, and set the UpnpObject's title value
+        tempBuf = UpnpString::FromUnicodeL( *strippedFilename );
+        CleanupStack::PushL( tempBuf );
+        aObject.SetTitleL( *tempBuf );
+
+        // Clean up
+        CleanupStack::PopAndDestroy( tempBuf ); 
+        tempBuf = NULL;
+        CleanupStack::PopAndDestroy( strippedFilename );
+        strippedFilename = NULL;
+        }
+
+    const RUPnPElementsArray& elms = aObject.GetElements();
+    TInt count = elms.Count();
+    TInt i;
+    TBool found;
+    
+    if( aMimeType.Find( KMimeAudio ) >= 0 )
+        {
+        // Set object class
+        aObject.SetObjectClassL( KClassAudioMusicTrack );
+        
+        // Artist
+        // Try to find the artist element and update it if found
+        tempBuf = UpnpString::FromUnicodeL( utility->Artist() );
+        if( tempBuf )
+            {
+            CleanupStack::PushL( tempBuf );
+            found = EFalse;
+            for( i = 0; i < count; i++)
+                {
+                if( elms[ i ]->Name() == KElementArtist )
+                    {
+                    elms[ i ]->SetValueL( *tempBuf );
+                    found = ETrue;
+                    i = count;
+                    }
+                }
+            if( !found )
+                {
+                // Not found, create a new artist element and add it to the 
+                // item
+                CUpnpElement* element = CUpnpElement::NewLC( KElementArtist );
+                element->SetValueL( *tempBuf );
+                aObject.AddElementL( element );
+                CleanupStack::Pop( element );
+                }
+            CleanupStack::PopAndDestroy( tempBuf ); tempBuf = NULL;    
+                
+            }
+        
+        // Genre
+        // Try to find the genre element and update it if found
+        tempBuf = UpnpString::FromUnicodeL( utility->Genre() );
+        if( tempBuf )
+            {
+            CleanupStack::PushL( tempBuf );
+            found = EFalse;
+            for( i = 0; i < count; i++)
+                {
+                if( elms[ i ]->Name() == KElementGenre )
+                    {
+                    elms[ i ]->SetValueL( *tempBuf );
+                    found = ETrue;
+                    i = count;
+                    }
+                }
+            if( !found )
+                {
+                // Not found, create a new genre element and add it to the 
+                // item
+                CUpnpElement* element = CUpnpElement::NewLC( KElementGenre );
+                element->SetValueL( *tempBuf );
+                aObject.AddElementL( element );
+                CleanupStack::Pop( element );
+                }
+            CleanupStack::PopAndDestroy( tempBuf ); tempBuf = NULL;
+            }
+        
+        // Album
+        // Try to find the album element and update it if found
+        tempBuf = UpnpString::FromUnicodeL( utility->Album() );
+        if( tempBuf )
+            {
+            CleanupStack::PushL( tempBuf );
+            found = EFalse;
+            for( i = 0; i < count; i++)
+                {
+                if( elms[ i ]->Name() == KElementAlbum )
+                    {
+                    elms[ i ]->SetValueL( *tempBuf );
+                    found = ETrue;
+                    i = count;
+                    }
+                }
+            if( !found )
+                {
+                // Not found, create a new album element and add it to the 
+                // item
+                CUpnpElement* element = CUpnpElement::NewLC( KElementAlbum );
+                element->SetValueL( *tempBuf );
+                aObject.AddElementL( element );
+                CleanupStack::Pop( element );
+                }
+            CleanupStack::PopAndDestroy( tempBuf ); tempBuf = NULL;
+            }
+        }
+    else if( aMimeType.Find( KMimeVideo ) >= 0 )
+        {
+        // Set Object class
+        aObject.SetObjectClassL( KClassVideo );
+        }
+    else if( aMimeType.Find( KMimeImage ) >= 0 )
+        {
+        // Set Object class
+        aObject.SetObjectClassL( KClassImage );
+        }
+    else if( aMimeType.Find( KMimeApplication ) >= 0 )
+        {
+        // some special cases here
+        // Fixes EAHN-7ETBH7
+        if( aMimeType.Find( KRealMediaVideo ) >= 0 )
+            {
+            aObject.SetObjectClassL( KClassVideo );
+            }
+        }
+    else
+        {
+        // Do nothing
+        }
+
+    // Date
+    // Try to find the date element and update it if found
+    tempBuf = UpnpString::FromUnicodeL( utility->Date() );
+    if( tempBuf )
+        {
+        CleanupStack::PushL( tempBuf );
+        found = EFalse;
+        for( i = 0; i < count; i++)
+            {
+            if( elms[ i ]->Name() == KElementDate )
+                {
+                elms[ i ]->SetValueL( *tempBuf );
+                found = ETrue;
+                i = count;
+                }
+            }
+        if( !found )
+            {
+            // Not found, create a new date element and add it to the item
+            CUpnpElement* element = CUpnpElement::NewLC( KElementDate );
+            element->SetValueL( *tempBuf );
+            aObject.AddElementL( element );
+            CleanupStack::Pop( element );
+            }
+        CleanupStack::PopAndDestroy( tempBuf ); tempBuf = NULL;
+        }       
+                         
+    CUpnpElement* element = CUpnpElement::NewLC( KElementCreator );
+    element->SetValueL( KItemCreator );
+    aObject.AddElementL( element );
+    CleanupStack::Pop( element );  
+    // Clean up
+    CleanupStack::PopAndDestroy( utility );
+    utility = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPMetadataFetcher::FetchMetadataL
+// Resolves the metadata and fills in the CUpnpObject's metadata fields 
+// accordingly.
+// --------------------------------------------------------------------------
+//
+EXPORT_C void UPnPMetadataFetcher::FetchMetadataL( CUpnpObject& aObject, 
+                                                   const TDesC& aFilePath )
+    {
+    // Resolve the MIME type of the file
+    HBufC8* mimeType = NULL;
+    mimeType = UPnPCommonUtils::ResolveMimeTypeL( aFilePath );
+    if( mimeType )
+        {    
+        CleanupStack::PushL( mimeType );
+        // Fill in the metadata
+        FetchMetadataL( aObject, aFilePath, *mimeType );
+        // Clean up
+        CleanupStack::PopAndDestroy( mimeType );
+        mimeType = NULL;
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// UPnPMetadataFetcher::CreateItemFromFileLC
+// Creates a new CUpnpItem from a local file. Resolves the metadata and fills
+// in the new CUpnpItem's metadata fields accordingly.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpItem* UPnPMetadataFetcher::CreateItemFromFileLC( 
+                                                    const TDesC& aFilePath )
+    {
+    CUpnpItem* item = NULL;
+    item = CUpnpItem::NewL();
+    CleanupStack::PushL( item );
+
+    // Add a res-element to the item
+    UpnpCdsResElementUtility::AddResElementL( *item, aFilePath );
+    // Resolve the metadata
+    FetchMetadataL( *item, aFilePath );
+    
+    return item;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPMetadataFetcher::CreateItemFromFileL
+// Creates a new CUpnpItem from a local file. Resolves the metadata and fills
+// in the new CUpnpItem's metadata fields accordingly.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpItem* UPnPMetadataFetcher::CreateItemFromFileL(
+                                                    const TDesC& aFilePath )
+    {
+    CUpnpItem* item = CreateItemFromFileLC( aFilePath );
+    CleanupStack::Pop( item );
+    return item;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/src/upnpmetadatautility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,342 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utility class for meta data gathering for audio files
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <MetaDataUtility.h>
+#include <MetaDataFieldContainer.h>
+
+#include "upnpmetadatautility.h"
+#include "upnpcommonutils.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// ---------------------------------------------------------------------------
+// CUPnPMetaDataUtility::CUPnPMetaDataUtility
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CUPnPMetaDataUtility::CUPnPMetaDataUtility()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPMetaDataUtility::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CUPnPMetaDataUtility* CUPnPMetaDataUtility::NewL()
+    {
+    CUPnPMetaDataUtility* self = new( ELeave ) CUPnPMetaDataUtility;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPMetaDataUtility::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CUPnPMetaDataUtility::ConstructL()
+    {
+    iMetaDataUtility = CMetaDataUtility::NewL();
+    }
+    
+// ---------------------------------------------------------------------------
+// CUPnPMetaDataUtility::~CUPnPMetaDataUtility()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CUPnPMetaDataUtility::~CUPnPMetaDataUtility()
+    {
+    if ( iMetaDataUtility )
+        {
+        TRAP_IGNORE( iMetaDataUtility->ResetL() );
+        }
+        
+    delete iArtist;
+    delete iAlbum;
+    delete iGenre;
+    delete iTitle;
+    delete iDate;
+    delete iMetaDataUtility;        
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMetaDataUtility::LoadMetaDataL
+// Finds correct MMF controller according to give file name
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPMetaDataUtility::LoadMetaDataL( const TDesC& aFileName )
+    {
+    // Cleanup existing information
+    Reset();
+    
+    RArray<TMetaDataFieldId> wantedFields;
+    CleanupClosePushL( wantedFields );
+    wantedFields.Append( EMetaDataSongTitle );
+    wantedFields.Append( EMetaDataArtist );
+    wantedFields.Append( EMetaDataAlbum );
+    wantedFields.Append( EMetaDataGenre );
+    wantedFields.Append( EMetaDataDate );
+    
+    // Reset to be sure that no allocations are left over
+    iMetaDataUtility->ResetL();
+    
+    // Open the file
+    iMetaDataUtility->OpenFileL( aFileName, wantedFields );
+    
+    // wantedFields is not needed anymore
+    CleanupStack::PopAndDestroy( &wantedFields );
+    
+    // Go through the meta data fields and pick the required ones
+    TInt count = iMetaDataUtility->MetaDataCount();
+    
+    if ( count > 0 )
+        {
+        const CMetaDataFieldContainer& container = 
+                                        iMetaDataUtility->MetaDataFieldsL();
+        TMetaDataFieldId fieldId;
+        for ( TInt index = 0; index < count; index++ )
+            {
+            TPtrC content = container.At( index, fieldId );
+            switch ( fieldId )
+                {
+                case EMetaDataSongTitle:
+                    {
+                    iTitle = content.AllocL();
+                    break;
+                    }
+                case EMetaDataArtist:
+                    {
+                    iArtist = content.AllocL();
+                    break;
+                    }
+                case EMetaDataAlbum:
+                    {
+                    iAlbum = content.AllocL();
+                    break;
+                    }
+                case EMetaDataGenre:
+                    {
+                    iGenre = content.AllocL();
+                    break;
+                    }
+                case EMetaDataDate:
+                    {
+                    iDate = content.AllocL();
+                    break;
+                    }
+                default:
+                    {
+                    // Nothing to do
+                    break;
+                    }
+                }
+            }
+        }
+        
+    if( !iDate )
+        {
+        // Date was not found from metadata, so get it from file properties
+        RFs fs;
+        User::LeaveIfError( fs.Connect() );
+        CleanupClosePushL( fs );
+        RFile file;
+        User::LeaveIfError( file.Open( fs,aFileName, EFileRead |
+            EFileShareReadersOrWriters ) );
+        CleanupClosePushL( file );
+        
+        TTime time;
+        User::LeaveIfError( file.Modified( time ) );
+        
+
+        iDate = UPnPCommonUtils::TTimeToUPnPDateL( time );
+                
+        CleanupStack::PopAndDestroy( &file );        
+        CleanupStack::PopAndDestroy( &fs );        
+
+        }
+    // Cleanup
+    iMetaDataUtility->ResetL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMetaDataUtility::Title
+// Returns title for the song
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CUPnPMetaDataUtility::Title() const
+    {
+    if ( iTitle )
+        {
+        return *iTitle;
+        }
+    else
+        {
+        return KNullDesC;
+        }
+    }   
+        
+// --------------------------------------------------------------------------
+// CUPnPMetaDataUtility::Artist
+// Returns artist for the song
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CUPnPMetaDataUtility::Artist() const
+    {
+    if ( iArtist )
+        {
+        return *iArtist;
+        }
+    else
+        {
+        return KNullDesC;
+        }
+    }       
+        
+// --------------------------------------------------------------------------
+// CUPnPMetaDataUtility::Album
+// Returns album for the song
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CUPnPMetaDataUtility::Album() const
+    {
+    if ( iAlbum )
+        {
+        return *iAlbum;
+        }
+    else
+        {
+        return KNullDesC;
+        }
+    }
+        
+// --------------------------------------------------------------------------
+// CUPnPMetaDataUtility::Genre
+// Returns genre for the song
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CUPnPMetaDataUtility::Genre() const
+    {
+    if ( iGenre )
+        {
+        return *iGenre;
+        }
+    else
+        {
+        return KNullDesC;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMetaDataUtility::Date
+// Returns date for the file
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CUPnPMetaDataUtility::Date() const
+    {
+    if ( iDate )
+        {
+        return *iDate;
+        }
+    else
+        {
+        return KNullDesC;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMetaDataUtility::LoadTitleL
+// Finds the title(ID3 tag) of the file according to give file name
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPMetaDataUtility::LoadTitleL( const TDesC& aFileName )
+    {
+    // Cleanup existing information
+    Reset();
+    
+    RArray<TMetaDataFieldId> wantedFields;
+    CleanupClosePushL( wantedFields );
+    wantedFields.Append( EMetaDataSongTitle );
+    
+    // Reset to be sure that no allocations are left over
+    iMetaDataUtility->ResetL();
+    
+    // Open the file
+    iMetaDataUtility->OpenFileL( aFileName, wantedFields );
+    
+    // wantedFields is not needed anymore
+    CleanupStack::PopAndDestroy( &wantedFields );
+    
+    // Go through the meta data fields and pick the required ones
+    TInt count = iMetaDataUtility->MetaDataCount();
+    
+    if ( count > 0 )
+        {
+        const CMetaDataFieldContainer& container = 
+                                        iMetaDataUtility->MetaDataFieldsL();
+        TMetaDataFieldId fieldId;
+        for ( TInt index = 0; index < count; index++ )
+            {
+            TPtrC content = container.At( index, fieldId );
+            if ( EMetaDataSongTitle == fieldId )
+                {
+                iTitle = content.AllocL();
+                break;
+                }
+            }
+        }
+    
+    // Cleanup
+    iMetaDataUtility->ResetL();
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPMetaDataUtility::Reset
+// Reset member variables
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CUPnPMetaDataUtility::Reset()
+    {
+    delete iTitle;
+    iTitle = NULL;
+    delete iArtist;
+    iArtist = NULL;
+    delete iAlbum;
+    iAlbum = NULL;
+    delete iGenre;
+    iGenre = NULL;
+    delete iDate;
+    iDate = NULL;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpframework/upnputilities/src/upnpperiodic.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      UPnP framework custom periodic timer
+*
+*/
+
+
+
+
+
+
+#include "upnpperiodic.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CUPnPPeriodic::CUPnPPeriodic
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CUPnPPeriodic::CUPnPPeriodic( TInt aPriority ) : 
+    CPeriodic( aPriority )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUPnPPeriodic::CUPnPPeriodic
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUPnPPeriodic::~CUPnPPeriodic()
+    {
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUPnPPeriodic::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUPnPPeriodic::ConstructL()
+    {
+    CPeriodic::ConstructL();
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUPnPPeriodic::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUPnPPeriodic* CUPnPPeriodic::NewL( TInt aPriority )
+    {
+    CUPnPPeriodic* self = new( ELeave ) CUPnPPeriodic( aPriority );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUPnPPeriodic::RunError
+// Called if CUPnPPeriodic function RunL() leaves.
+// -----------------------------------------------------------------------------
+//
+TInt CUPnPPeriodic::RunError( TInt aError )
+
+    {
+  
+    if( aError == KErrNoMemory )
+        return KErrNone;
+    else
+        return aError;
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/cdssynclib/bwins/cdssyncu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,10 @@
+EXPORTS
+	?ChunkCount@CCdsSync@@QAEHXZ @ 1 NONAME ; int CCdsSync::ChunkCount(void)
+	?InitL@CCdsSync@@QAEXAAV?$RPointerArray@VHBufC8@@@@ABHAAVMCdsSyncObserver@@H@Z @ 2 NONAME ; void CCdsSync::InitL(class RPointerArray<class HBufC8> &, int const &, class MCdsSyncObserver &, int)
+	?NewL@CCdsSync@@SAPAV1@XZ @ 3 NONAME ; class CCdsSync * CCdsSync::NewL(void)
+	?NewLC@CCdsSync@@SAPAV1@XZ @ 4 NONAME ; class CCdsSync * CCdsSync::NewLC(void)
+	?NotifySourceDataAddedL@CCdsSync@@QAEXH@Z @ 5 NONAME ; void CCdsSync::NotifySourceDataAddedL(int)
+	?ProcessedItemCount@CCdsSync@@QAEHXZ @ 6 NONAME ; int CCdsSync::ProcessedItemCount(void)
+	?ResetL@CCdsSync@@QAEXXZ @ 7 NONAME ; void CCdsSync::ResetL(void)
+	?SetSearchIndex@CCdsSync@@QAEXH@Z @ 8 NONAME ; void CCdsSync::SetSearchIndex(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/cdssynclib/eabi/cdssyncu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,16 @@
+EXPORTS
+	_ZN8CCdsSync10ChunkCountEv @ 1 NONAME
+	_ZN8CCdsSync14SetSearchIndexEi @ 2 NONAME
+	_ZN8CCdsSync18ProcessedItemCountEv @ 3 NONAME
+	_ZN8CCdsSync22NotifySourceDataAddedLEi @ 4 NONAME
+	_ZN8CCdsSync4NewLEv @ 5 NONAME
+	_ZN8CCdsSync5InitLER13RPointerArrayI6HBufC8ERKiR16MCdsSyncObserveri @ 6 NONAME
+	_ZN8CCdsSync5NewLCEv @ 7 NONAME
+	_ZN8CCdsSync6ResetLEv @ 8 NONAME
+	_ZTI12CCdsSyncImpl @ 9 NONAME ; #<TI>#
+	_ZTI13CCdsSyncSqlAo @ 10 NONAME ; #<TI>#
+	_ZTI8CCdsSync @ 11 NONAME ; #<TI>#
+	_ZTV12CCdsSyncImpl @ 12 NONAME ; #<VT>#
+	_ZTV13CCdsSyncSqlAo @ 13 NONAME ; #<VT>#
+	_ZTV8CCdsSync @ 14 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/cdssynclib/group/cdssync.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for Cds Sync
+*
+*/
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+TARGET        cdssync.dll
+TARGETTYPE    dll
+UID           0x1000008d 0x015D2C17
+
+CAPABILITY CAP_GENERAL_DLL
+                   
+SOURCEPATH    ../src
+
+SOURCE        cdssync.cpp
+SOURCE        cdssyncimplsql.cpp
+SOURCE        cdssyncsqlao.cpp
+
+USERINCLUDE   ../inc
+USERINCLUDE     ../../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY       euser.lib
+LIBRARY       flogger.lib
+LIBRARY       hash.lib
+LIBRARY       xmlframework.lib
+LIBRARY       bafl.lib
+LIBRARY       efsrv.lib
+LIBRARY       cmcommon.lib
+LIBRARY       cmsqlwrapper.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/cdssynclib/inc/cdssync.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Interface class of cdssync.
+*
+*/
+
+
+
+
+
+
+#ifndef __CDSSYNC_H__
+#define __CDSSYNC_H__
+
+#include <e32cons.h>
+#include <e32base.h> 
+
+class CCdsSyncImpl;
+
+/**
+ * Callback class of CdsSync
+ *
+ * @lib cdssync.lib
+ *
+ * @since S60 5.1
+ */
+class MCdsSyncObserver
+    {
+public:
+
+    /**
+     * Indicates the number of processed items.
+     *
+     * @since S60 5.1
+     * @param aItemCount, number of processed items
+     */
+    virtual void ProgressL( TInt aItemCount ) = 0;
+    
+    /**
+     * Indicates that new chunk is completely processed.
+     *
+     * @since S60 5.1     
+     */
+    virtual void ChunkCompleteL() = 0;
+    
+    /**
+     * Whole synchronization is complete without errors
+     *
+     * @since S60 5.1     
+     */
+    virtual void SyncCompleteL() = 0;
+    
+    /**
+     * Error happened during synchronization.
+     *
+     * @since S60 5.1
+     * @param aError, error code
+     */
+    virtual void SyncErrorL( TInt aError ) = 0;
+    };
+
+/**
+ * CDS Sync class definition
+ *
+ * @since S60 5.1
+ */
+class CCdsSync : public CBase
+    {
+
+public:
+    
+    /**
+     * Two-phase constructor
+     */
+    IMPORT_C static CCdsSync* NewLC();
+    
+    /**
+     * Two-phase constructor
+     */
+    IMPORT_C static CCdsSync* NewL();
+        
+    /**
+     * Destructor
+     */
+    virtual ~CCdsSync();
+    
+    
+public:    
+    
+    /**
+     * Initialises the instance with source array and correct device id
+     *
+     * @since S60 5.1
+     * @param aSourceDataArray, array where search responses are added 
+     * @param aDeviceId, database id of the device which is harvested
+     * @param aObserver, callback to observer
+     * @param aAddGranularity, granularity how much items are
+     *        added to db at once
+     */
+    IMPORT_C void InitL( RPointerArray<HBufC8>& aSourceDataArray,
+                         const TInt& aDeviceId, 
+                         MCdsSyncObserver& aObserver,
+                         TInt aAddGranularity);
+    
+    
+    /**
+     * Client indicates that new search response has been added to 
+     * source data array.
+     *
+     * @since S60 5.1
+     * @param aSourceDataComplete, boolean indicating whether the device
+     *                             has been fully searched.
+     */
+    IMPORT_C void NotifySourceDataAddedL( 
+        TBool aSourceDataComplete = EFalse );
+        
+    /**
+     * Reset the cdssync instance to default state.
+     *
+     * @since S60 5.1
+     */
+    IMPORT_C void ResetL();      
+    
+    /**
+     * Returns the source data chunk count including the current chunk 
+     * in process.
+     *
+     * @since S60 5.1
+     * @return TInt, count of chunks to be processed
+     */
+    IMPORT_C TInt ChunkCount();
+    
+    
+    /**
+     * Returns successfully processed item count. 
+     *
+     * @since S60 5.1
+     * @return TInt count of items that has been processed successfully.
+     */
+    IMPORT_C TInt ProcessedItemCount();
+
+    /**
+     * Sets search index to cds sync
+     *
+     * @since S60 5.1
+     * @param aSearchIndex, search index
+     */    
+    IMPORT_C void SetSearchIndex( const TInt aSearchIndex );
+    
+private:
+
+    // Default constructor
+    CCdsSync();
+    
+    // Second-phase constructor
+    void ConstructL(); 
+     
+private:
+    
+    /**
+     * Actual implementation instance
+     */
+    CCdsSyncImpl*                   iSyncImpl;      // Owned
+
+    };
+    
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/cdssynclib/inc/cdssyncimplsql.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,596 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Cds Sync Implementation Header
+*
+*/
+
+
+
+
+
+
+
+#ifndef __CDSSYNCIMPL_H__
+#define __CDSSYNCIMPL_H__
+
+#include <e32cons.h>
+#include <e32base.h> 
+#include <f32file.h>
+#include "cdssync.h"
+#include <xml/parser.h>
+#include <xml/contenthandler.h>
+
+// Forward declarations
+class CCdsSyncSqlAo;
+class MCmSqlMain;
+class CCmSqlPropertyItem;
+class CCmSqlGenericItem;
+class CCmSqlBaseItem;
+
+typedef RPointerArray<CCmSqlPropertyItem> CCmSqlPropertyItemArray;
+
+using namespace Xml;
+
+/**
+ *  CItemResource class definition
+ *
+ *  @lib cdssync.lib
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CItemResource ) : public CBase 
+{
+public:
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CItemResource* NewLC();
+   
+    /**
+     * Two-phased constructor.
+     */    
+    static CItemResource* NewL();
+    
+    /**
+     * Destructor
+     */
+    virtual ~CItemResource();
+    
+private:
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CItemResource();
+
+    /**
+     * Performs the second phase construction.
+     */    
+    void ConstructL();
+
+public:
+    /**
+     * Track duration
+     */
+    HBufC8* iDuration;   // owned
+    /**
+     * Track bitrate
+     */    
+    HBufC8* iBitrate;    // owned
+    /**
+     * File size
+     */
+    HBufC8* iSize;       // owned
+    /**
+     * Item resolution
+     */
+    HBufC8* iResolution; // owned
+    /**
+     * Item uri
+     */
+    HBufC8* iUri;        // owned
+    /**
+     * Item protocol
+     */
+    HBufC8* iProtocol;   // owned
+};
+
+
+/**
+ * CCdsSyncImpl class definition
+ *
+ * @lib cdssync.lib
+ *
+ * @since S60 5.1
+ */    
+class CCdsSyncImpl : public CActive, 
+                     public MContentHandler 
+      {
+
+private:
+
+    // Syncronization status
+    enum TCdsSyncStatus
+        {
+        ECdsSyncIdle,
+        ECdsSyncInitializing,
+        ECdsSyncReadyToParse,
+        ECdsSyncParsing,
+        ECdsSyncFinalizing
+        };
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCdsSyncImpl* NewLC();
+
+    /**
+     * Two-phased constructor.
+     */    
+    static CCdsSyncImpl* NewL();
+    
+    /**
+     * Destructor
+     */    
+    ~CCdsSyncImpl();
+
+public: // new functions    
+
+    /**
+     * Initializes data
+     *
+     * @Since S60 5.1
+     * @param aSourceDataArray, source data
+     * @param aDeviceId, device id where data is retrieved
+     * @param aObserver, process observer
+     * @param aAddGranularity, data granularity
+     */    
+    void InitL( RPointerArray<HBufC8>& aSourceDataArray,
+                         const TInt& aDeviceId, 
+                         MCdsSyncObserver& aObserver,
+                         TInt aAddGranularity);
+
+    /**
+     * Notifies when data is added
+     *
+     * @Since S60 5.1
+     * @param aSourceDataComplete, indicates if all source data is added
+     */
+    void NotifySourceDataAddedL( 
+        TBool aSourceDataComplete = EFalse );
+
+    /**
+     * Cancels operation and cleans data
+     *
+     * @Since S60 5.1     
+     */
+    void ResetL();
+    
+    /**
+     * Called when operation is completed
+     *
+     * @Since S60 5.1
+     * @param aErrCode, error code
+     */    
+    void OperationsCompleteL( TInt aErrCode );
+
+    /**
+     * Notifies observer about progress
+     *
+     * @Since S60 5.1
+     * @param aItemCount, processed items
+     */
+    void ProgressL( TInt aItemCount );
+
+    /**
+     * Returns the chunk count to be processed including current chunk
+     *
+     * @Since S60 5.1
+     * @return TInt, chunk count
+     */    
+    TInt ChunkCount();
+    
+    /**
+     * Returns successfully processed item count. 
+     *
+     * @since S60 5.1
+     * @return TInt, count of items that has been processed successfully.
+     */
+    TInt ProcessedItemCount();
+    
+    /**
+     * Sets search index to cds sync
+     *
+     * @since S60 5.1
+     * @param aSearchIndex, search index
+     */    
+    void SetSearchIndex( const TInt aSearchIndex );    
+    
+    /**
+     * Chunk complete callback
+     *
+     * @since S60 5.1
+     */    
+    void ChunkCompleteL();
+
+// From base class MContentHandler        
+
+    /**
+     * From MContentHandler
+     * See base class definition
+     */     
+    void OnStartDocumentL( const RDocumentParameters& aDocParam, 
+                           TInt aErrorCode );
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnEndDocumentL( TInt aErrorCode );
+    
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnStartElementL( const RTagInfo& aElement, 
+                          const RAttributeArray& aAttributes, 
+                          TInt aErrorCode );
+    
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode );
+
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnContentL( const TDesC8& aBytes, TInt aErrorCode );
+    
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnStartPrefixMappingL( const RString& aPrefix, 
+                                const RString& aUri, 
+                                TInt aErrorCode);
+    
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode );
+
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode );
+
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnSkippedEntityL( const RString& aName, TInt aErrorCode );
+
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnProcessingInstructionL( const TDesC8& aTarget, 
+                                   const TDesC8& aData, 
+                                   TInt aErrorCode);
+    
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    void OnError( TInt aErrorCode );
+
+    /**
+     * From MContentHandler
+     * See base class definition
+     */
+    TAny* GetExtendedInterface( const TInt32 aUid );
+    
+// From base class CActive
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */    
+    void DoCancel();
+    
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */    
+    CCdsSyncImpl();
+
+    /**
+     * Performs the second phase construction.
+     */        
+    void ConstructL();
+
+    /**
+     * Parses profile id
+     *
+     * @since S60 5.1
+     * @param aItem, item data
+     * @param aRes, item resource
+     */
+    void ParseProfileIdL( CCmSqlGenericItem& aItem,
+                          const CItemResource& aRes ) const;
+        
+    /**
+     * Starts background parsing
+     *
+     * @since S60 5.1
+     */
+    TInt DoBackgroundParseL();
+
+    /**
+     * Background parsing callback
+     *
+     * @since S60 5.1
+     * @param aCdsSync, observer
+     */
+    static TInt BackgroundParseL( TAny *aCdsSync );
+
+    /**
+     * Finds attributes
+     *
+     * @since S60 5.1
+     * @param aName, local name
+     * @param aPref, prefix
+     * @param aAttributes, attribute array
+     */
+    TInt FindAttribute( const TDesC8& aName, 
+                        const TDesC8& aPref, 
+                        const RAttributeArray& aAttributes ) const;
+    
+    /**
+     * Parses resolution information
+     *
+     * @since S60 5.1
+     * @param aDes, buffer to be parsed
+     * @param aWidth, image widht
+     * @param aHeight, image height
+     */
+    void ParseResolution( const TDesC8& aDes,
+                          TUint& aWidth,
+                          TUint& aHeight ) const;
+    
+    /**
+     * Parses value from descriptor
+     *
+     * @since S60 5.1
+     * @param aDes, buffer to be parsed
+     * @return TUInt, parsed value     
+     */
+    TUint ParseUint( const TDesC8& aDes ) const;
+
+    /**
+     * Parses value from descriptor
+     *
+     * @since S60 5.1
+     * @param aDes, buffer to be parsed
+     * @return TInt64, parsed value     
+     */
+    TInt64 ParseInt64( const TDesC8& aDes ) const;
+
+    /**
+     * Parses track duration
+     *
+     * @since S60 5.1
+     * @param aDes, buffer to be parsed
+     * @return TReal, duration
+     */
+    TReal ParseDuration( const TDesC8& aDes ) const;
+
+    /**
+     * Parses time
+     *
+     * @since S60 5.1
+     * @param aDes, buffer to be parsed
+     * @return TTime, parsed time
+     */    
+    TTime ParseTime( const TDesC8& aDes ) const;
+
+    /**
+     * Calculates hash value
+     *
+     * @since S60 5.1  
+     * @return HBufC, hash value
+     */
+    HBufC8* CalculateHashL() const;
+
+    /**
+     * Append escpace characters to hash value
+     *
+     * @since S60 5.1
+     * @param aHash, hash value
+     * @return HBufC, hash value with escape charachters
+     */
+    HBufC* EscapeHashLC( const TDesC8& aHash ) const;
+
+    /**
+     * Gets property ID
+     *
+     * @since S60 5.1
+     * @param aMetadataIndex, index for metadata type table
+     * @param aValue, property name
+     * @return TInt64, property id
+     */
+    TInt64 GetPropertyIdL( TInt aMetadataIndex, const TDesC8& aValue ) const;
+
+    /**
+     * Clears item data
+     *
+     * @since S60 5.1
+     */
+    void CleanItemData();
+
+    /**
+     * Removes unchanged items
+     *
+     * @since S60 5.1
+     */
+    void RemoveUnchangedItems();
+
+    /**
+     * Parses uri
+     *
+     * @since S60 5.1
+     */
+    void ParseUri();
+     
+private:
+
+    /**
+     * Cds Sync observer
+     */
+    MCdsSyncObserver*   iObserver;                          // not owned
+    /**
+     * Parser
+     */
+    CParser*            iParser;                            // owned
+    /**
+     * Metadata database
+     */
+    MCmSqlMain*         iMetadataDb;                        // owned
+    /**
+     * Active object for low priority processing
+     */
+    CIdle*              iBackground;                        // owned
+    /**
+     * Cds Sync active object
+     */
+    CCdsSyncSqlAo*      iSqlAo;                             // owned
+    /**
+     * Data chuck
+     */
+    HBufC8* iCurrentDocument;                               // owned
+    /**
+     * Sync status
+     */
+    TCdsSyncStatus    iState;
+    /**
+     * Data buffer
+     */
+    HBufC8* iCurrentContent;                                // owned
+    /**
+     * Item id
+     */    
+    HBufC8* iItemId;                                        // owned
+    /**
+     * Artist name
+     */
+    HBufC8* iArtist;                                        // owned
+    /**
+     * Album name
+     */
+    HBufC8* iAlbum;                                         // owned
+    /**
+     * Title
+     */
+    HBufC8* iTitle;                                         // owned
+    /**
+     * Album class
+     */
+    HBufC8* iClass;                                         // owned
+    /**
+     * Music genre
+     */    
+    HBufC8* iGenre;                                         // owned
+    /**
+     * Album data
+     */
+    HBufC8* iDate;                                          // owned
+    /**
+     * Description field
+     */
+    HBufC8* iDescription;                                   // owned
+    /**
+     * Album art
+     */
+    HBufC8* iAlbumArtUri;                                   // owned
+    /**
+     * Item resource array
+     */
+    RPointerArray<CItemResource> iResources;                // items owned
+    /**
+     * Flag for indicating that source data is ready
+     */
+    TBool iSourceDataComplete;
+    /**
+     * Datachunk index
+     */
+    TInt iChunkIndex;
+    /**
+     * Amount of unchanged items
+     */
+    TInt iUnchangedItemCount;
+    /**
+     * Hash order
+     */    
+    TLinearOrder<CCmSqlBaseItem> iHashOrder;
+    /**
+     * Name order
+     */
+    TLinearOrder<CCmSqlPropertyItem> iNameOrder;
+    /**
+     * Source data array
+     */
+    RPointerArray<HBufC8>* iSourceDataArray;                // not owned
+    /**
+     * Name array
+     */
+    RPointerArray<CCmSqlPropertyItemArray> iNames;          // items owned
+    /**
+     * Array of items to add
+     */
+    RPointerArray<CCmSqlGenericItem> iItemsToAdd;           // items owned
+    /**
+     * Array of items in the database
+     */
+    RPointerArray<CCmSqlBaseItem> iItemsInDb;               // items owned
+    /**
+     * File server session
+     */
+    RFs iFs;
+    /**
+     * Search index
+     */    
+    TInt iSearchIndex;
+    /**
+     * Count of processed items
+     */ 
+    TInt iProcessedItems;
+#ifdef _DEBUG
+    /**
+     * Hash time
+     */ 
+    TInt64 iHashTime;
+#endif // _DEBUG
+    };
+#endif // __CDSSYNCIMPL_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/cdssynclib/inc/cdssyncsqlao.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Cds Sync Active Object header
+*
+*/
+
+
+
+
+
+
+#ifndef CDSSYNCSQLAO_H
+#define CDSSYNCSQLAO_H
+
+// FORWARD DECLARATIONS
+class MCmSqlMain;
+class CCdsSyncImpl;
+class CCmSqlBaseItem;
+class CCmSqlGenericItem;
+
+/**
+ * CCdsSyncSqlAo class
+ *
+ * @lib cdssync.lib
+ *
+ * @since S60 v3.1
+ */
+class CCdsSyncSqlAo : public CActive 
+    {         
+public:
+    // active object states
+    enum TCdsSyncSqlAoState 
+        {
+        ECdsSyncSqlAoIdle = 0,
+        ECdsSyncSqlAoAdding,
+        ECdsSyncSqlAoDeleting,
+        ECdsSyncSqlAoInitializing    
+        };
+        
+    /**
+     * Two-phased constructor.
+     *
+     * @param aSqlDb, Database handler instance
+     * @param aSync, CdsSync implementation instance
+     * @param aItemsToAdd, array of items to be added
+     * @param aItemsToAdd, array of items to be deleted
+     * @param aAddGranularity, count of items added at a time
+     */
+    static CCdsSyncSqlAo* NewL( MCmSqlMain& aSqlDb,
+                                CCdsSyncImpl& aSync,
+                                RPointerArray<CCmSqlGenericItem>& aItemsToAdd,
+                                RPointerArray<CCmSqlBaseItem>& aItemsToDelete,
+                                TInt aAddGranularity );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aSqlDb, Database handler instance
+     * @param aSync, CdsSync implementation instance
+     * @param aItemsToAdd, array of items to be added
+     * @param aItemsToAdd, array of items to be deleted
+     * @param aAddGranularity, count of items added at a time     
+     */
+    static CCdsSyncSqlAo* NewLC( 
+        MCmSqlMain& aSqlDb,
+        CCdsSyncImpl& aSync,
+        RPointerArray<CCmSqlGenericItem>& aItemsToAdd,
+        RPointerArray<CCmSqlBaseItem>& aItemsToDelete,
+        TInt aAddGranularity );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCdsSyncSqlAo();
+ 
+    /**
+     * NotifyItemsAddedL
+     *
+     * @since S60 v3.1
+     * @param aSourceDataComplete, indicates if all source data is added     
+     */
+    void NotifyItemsAddedL( TBool aSourceDataComplete = EFalse );
+
+    /**
+     * Activate
+     *
+     * @since S60 v3.1
+     */
+    void Activate();
+ 
+ protected:
+ 
+// From base class CActive
+
+    /**
+     * From CActive
+     * See base class definition
+     */       
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class definition
+     */
+    void DoCancel();
+        
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @param aSqlDb, Database handler instance
+     * @param aSync, CdsSync implementation instance
+     * @param aItemsToAdd, array of items to be added
+     * @param aItemsToAdd, array of items to be deleted
+     * @param aAddGranularity, count of items added at a time     
+     */   
+    CCdsSyncSqlAo( MCmSqlMain& aSqlDb,
+                   CCdsSyncImpl& aSync,
+                   RPointerArray<CCmSqlGenericItem>& aItemsToAdd,
+                   RPointerArray<CCmSqlBaseItem>& aItemsToDelete,
+                   TInt aAddGranularity );
+
+    /**
+     * Performs the second phase construction.
+     */  
+    void ConstructL();    
+
+    /**
+     * Checks metadata amouts and removes overhead items
+     *
+     * @since S60 v5.1
+     */        
+    void IfOverLimitDeleteMediaItems();                  
+        
+public:
+
+    /**
+     * Active object state 
+     */
+    TCdsSyncSqlAoState                  iState;
+  
+private:
+
+    /**
+     * Database handler
+     */  
+    MCmSqlMain&                         iSqlDb;
+
+    /**
+     * Cds sync implementation reference
+     */
+    CCdsSyncImpl&                       iSync;
+    
+    /**
+     * Array of items to be added
+     */
+    RPointerArray<CCmSqlGenericItem>&   iItemsToAdd;
+    
+    /**
+     * Array of items to be deleted
+     */
+    RPointerArray<CCmSqlBaseItem>&      iItemsToDelete;
+
+    /**
+     * Amount of files to be added at a time
+     */
+    TInt                                iAddGranularity;
+    /**
+     * Flag for indicating that source data is ready
+     */
+    TBool                               iSourceDataComplete;
+
+    /**
+     * Count of items to be added
+     */
+    TInt                                iItemsInAddition;        
+
+#ifdef _DEBUG
+    /**
+     * Time stamps for logging
+     */
+    TTime iOperationTime;
+#endif // _DEBUG
+
+};
+
+#endif // CDSSYNCSQLAO_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/cdssynclib/src/cdssync.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Interface class implementation of CdsSync
+*
+*/
+
+
+
+
+
+
+#include "cdssync.h"
+#include "cdssyncimplsql.h"
+
+
+// --------------------------------------------------------------------------
+// CCdsSync::CCdsSync
+// --------------------------------------------------------------------------
+//
+CCdsSync::CCdsSync()
+    {
+    
+    }
+    
+// --------------------------------------------------------------------------
+// CCdsSync::ConstructL
+// --------------------------------------------------------------------------
+//
+void CCdsSync::ConstructL()
+    {
+    iSyncImpl = CCdsSyncImpl::NewL();
+    }
+
+
+// --------------------------------------------------------------------------
+// CCdsSync::NewL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CCdsSync* CCdsSync::NewL()
+    {
+    CCdsSync* self = CCdsSync::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSync::NewLC
+// --------------------------------------------------------------------------
+//
+EXPORT_C CCdsSync* CCdsSync::NewLC()
+    {
+    CCdsSync* self = new( ELeave ) CCdsSync;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSync::~CCdsSync
+// --------------------------------------------------------------------------
+//
+CCdsSync::~CCdsSync()
+    {
+    delete iSyncImpl;
+    }
+    
+// --------------------------------------------------------------------------
+// CCdsSync::InitL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCdsSync::InitL( RPointerArray<HBufC8>& aSourceDataArray,
+                               const TInt& aDeviceId, 
+                               MCdsSyncObserver& aObserver,
+                               TInt aAddGranularity )
+    {
+    iSyncImpl->InitL( aSourceDataArray, 
+                      aDeviceId, 
+                      aObserver, 
+                      aAddGranularity ); 
+    }
+
+
+// --------------------------------------------------------------------------
+// CCdsSync::NotifySourceDataAddedL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCdsSync::NotifySourceDataAddedL( TBool aSourceDataComplete )
+    {
+    iSyncImpl->NotifySourceDataAddedL( aSourceDataComplete );
+    }
+   
+// --------------------------------------------------------------------------
+// CCdsSync::ResetL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCdsSync::ResetL()
+    {
+    iSyncImpl->ResetL();
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSync::ChunkCount
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CCdsSync::ChunkCount()
+    {
+    return iSyncImpl->ChunkCount();
+    }
+    
+// --------------------------------------------------------------------------
+// CCdsSync::ProcessedItemCount
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CCdsSync::ProcessedItemCount()
+    {
+    return iSyncImpl->ProcessedItemCount();
+    }
+    
+// --------------------------------------------------------------------------
+// CCdsSync::SetSearchIndex
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCdsSync::SetSearchIndex( const TInt aSearchIndex )
+    {
+    iSyncImpl->SetSearchIndex( aSearchIndex );
+    }        
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/cdssynclib/src/cdssyncimplsql.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1605 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Cds Sync Implementation
+*
+*/
+
+
+
+
+
+
+#include <hash.h>
+#include <xml/matchdata.h>
+#include "cmsqlmainfactory.h"
+#include "mcmsqlmain.h"
+#include "cmsqlbaseitem.h"
+#include "cmsqlgenericitem.h"
+#include "cmsqlaudioitem.h"
+#include "cmsqlimageitem.h"
+#include "cmsqlvideoitem.h"
+#include "cmsqlpropertyitem.h"
+#include "cmsqlresolutionpropertyitem.h"
+
+#include "cdssyncimplsql.h"
+#include "cdssyncsqlao.h"
+#include "msdebug.h"
+
+// Constants
+_LIT8( KXmlMimeType, "text/xml" );
+_LIT8( KSymbian, "Symbian");
+_LIT8( KSemicolon, ";");
+
+_LIT8( KXmlCdsDefaultNamespace, 
+       "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/");
+_LIT8( KXmlCdsDcNamespace,"http://purl.org/dc/elements/1.1/");
+_LIT8( KXmlCdsUpnpNamespace,"urn:schemas-upnp-org:metadata-1-0/upnp/");
+
+_LIT8( KAlbum,      "album");
+_LIT8( KArtist,     "artist");
+_LIT8( KClass,      "class");
+_LIT8( KDescription,"description");
+_LIT8( KDate,       "date");
+_LIT8( KGenre,      "genre");
+_LIT8( KId,         "id");
+_LIT8( KItem,       "item");
+_LIT8( KRes,        "res");
+_LIT8( KTitle,      "title");
+_LIT8( KAlbumArtUri, "albumArtURI");
+
+_LIT8( KBitrate,        "bitrate");
+_LIT8( KDuration,       "duration");
+_LIT8( KProtocolInfo,   "protocolInfo");
+_LIT8( KResolution,     "resolution");
+_LIT8( KSize,           "size");
+
+_LIT8( KAudioItem,      "audioItem");
+_LIT8( KImageItem,      "imageItem");
+_LIT8( KVideoItem,      "videoItem");
+_LIT8( KAudioBroadCastItem, "audioItem.audioBroadcast");
+_LIT8( KVideoBroadCastItem, "videoItem.videoBroadcast");
+_LIT8( KDlnaPn,         "DLNA.ORG_PN=" );
+
+const TInt KAlbumIndex =        0;
+const TInt KArtistIndex =       1;
+const TInt KClassIndex =        2;
+const TInt KGenreIndex =        3;
+const TInt KResolutionIndex =   4;
+const TInt KUpnpProfileIndex =  5;
+
+const TCmMetadataField KMetadataTypes[] = 
+    {
+    ECmAlbum, ECmArtist, ECmUpnpClass, ECmGenre, ECmResolution, ECmProfileId
+    };
+
+const TInt KMetadataTypeCount = 6;
+
+const TInt KParseChunkSize = 100 * KKilo; // 100 kB
+
+const TInt KCdsSyncMaxBufLength = 512;
+
+const TInt KCdsSyncPriority = CActive::EPriorityIdle; 
+
+// --------------------------------------------------------------------------
+// CItemResource::NewLC()
+// --------------------------------------------------------------------------
+CItemResource* CItemResource::NewLC()
+    {
+    CItemResource* self=new (ELeave) CItemResource();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CItemResource::~CItemResource()
+// --------------------------------------------------------------------------
+CItemResource::~CItemResource() // destruct - virtual, so no export
+    {
+    delete iDuration;
+    delete iBitrate;
+    delete iSize;    
+    delete iResolution;    
+    delete iProtocol;    
+    delete iUri;    
+    }
+
+// --------------------------------------------------------------------------
+// CItemResource::CItemResource()
+// --------------------------------------------------------------------------
+CItemResource::CItemResource()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CItemResource::ConstructL()
+// --------------------------------------------------------------------------
+void CItemResource::ConstructL()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::NewL()
+// --------------------------------------------------------------------------
+CCdsSyncImpl* CCdsSyncImpl::NewL()
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::NewL"));
+    CCdsSyncImpl* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::NewLC()
+// --------------------------------------------------------------------------
+CCdsSyncImpl* CCdsSyncImpl::NewLC()
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::NewLC"));
+
+    CCdsSyncImpl* self = new (ELeave) CCdsSyncImpl();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::~CCdsSyncImpl()
+// --------------------------------------------------------------------------
+CCdsSyncImpl::~CCdsSyncImpl() 
+    {
+    
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::~CCdsSyncImpl"));
+
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+        
+    // iCurrentContent is owned and needs to be deleted here before it is set
+    // to NULL at CleanItemData-method.
+    if ( iCurrentContent )
+        {
+        delete iCurrentContent;    
+        }    
+    CleanItemData();
+    
+    iState = ECdsSyncIdle;
+    if ( iBackground )
+        {
+        delete iBackground;    
+        }
+    
+    if ( iParser )
+        {
+        delete iParser;    
+        }
+    
+    if ( iCurrentDocument )
+        {
+        delete iCurrentDocument;    
+        }
+    
+    iItemsInDb.ResetAndDestroy();
+    iItemsToAdd.ResetAndDestroy();
+    for ( TInt i = 0; i < iNames.Count(); i++ )
+        {
+        iNames[ i ]->ResetAndDestroy();
+        }
+    iNames.ResetAndDestroy();
+    iFs.Close();
+    
+    if ( iSqlAo )
+        {
+        delete iSqlAo;    
+        }
+    
+    if ( iMetadataDb )
+        {
+        iMetadataDb->Close();    
+        }    
+    }
+
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::CCdsSyncImpl()
+// --------------------------------------------------------------------------
+CCdsSyncImpl::CCdsSyncImpl() : 
+    CActive( EPriorityStandard ),
+    iHashOrder( CCmSqlBaseItem::CompareByHash ),
+    iNameOrder( CCmSqlPropertyItem::CompareItemsByName )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ConstructL() 
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::ConstructL() 
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::ConstructL"));
+
+    CMatchData *matchData = CMatchData::NewL();
+    CleanupStack::PushL( matchData );
+    matchData->SetMimeTypeL( KXmlMimeType );
+    User::LeaveIfError( iFs.Connect() );
+    matchData->SetVariantL( KSymbian );
+
+    iParser  = CParser::NewL( *matchData, *this );
+    CleanupStack::PopAndDestroy( matchData );
+    
+    iBackground = CIdle::NewL( KCdsSyncPriority );
+    iMetadataDb = CCmSqlMainFactory::NewCmSqlMainL( iFs );
+
+    }
+
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ResetL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::ResetL() 
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::ResetL"));
+    LOG(_L("[Cds Sync]\t cleaning objects.."));
+    iBackground->Cancel();
+    if( iSqlAo && iSqlAo->IsActive() && iMetadataDb )
+        {
+        iMetadataDb->CancelAsyncOperation();
+        }
+  
+    delete iSqlAo; 
+    iSqlAo = NULL;
+    
+    iItemsInDb.ResetAndDestroy();
+    iItemsToAdd.ResetAndDestroy();
+    for ( TInt i = 0; i < iNames.Count(); i++ )
+        {
+        iNames[ i ]->ResetAndDestroy();
+        }
+    iNames.ResetAndDestroy();
+    CleanItemData();           
+    }
+
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::InitL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::InitL( RPointerArray<HBufC8>& aSourceDataArray,
+                                   const TInt& aDeviceId, 
+                                   MCdsSyncObserver& aObserver,
+                                   TInt aAddGranularity )
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::InitL"));
+    iSearchIndex = 0;
+    ResetL();
+    
+    LOG(_L("[Cds Sync]\t initializing variables.."));
+    iObserver = &aObserver;
+    iSourceDataArray = &aSourceDataArray;
+    iSourceDataComplete = EFalse;
+    iState = ECdsSyncInitializing;
+    iUnchangedItemCount = 0;
+        
+    LOG(_L("[Cds Sync]\t creating ao.."));
+    iSqlAo = CCdsSyncSqlAo::NewL( 
+        *iMetadataDb, *this, iItemsToAdd, 
+        iItemsInDb, aAddGranularity );
+    
+    LOG(_L("[Cds Sync]\t Requesting existing metadata.."));
+    iMetadataDb->SetMsId( aDeviceId );
+    iMetadataDb->GetItemsL( iItemsInDb, iSqlAo->iStatus );
+    
+    iSqlAo->iState = CCdsSyncSqlAo::ECdsSyncSqlAoInitializing;
+    iSqlAo->Activate();
+        
+    LOG(_L("[Cds Sync]\t done."));
+    }
+
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::RunL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::RunL()
+    {
+    TRACE( Print( _L("[Cds Sync]\t CCdsSyncImpl::RunL,\
+    iStatus %d iState %d"), iStatus.Int(), (TInt)iState ) );
+    
+    switch ( iState )
+        {
+        case ECdsSyncInitializing:
+            {
+            TInt namesCount = iNames.Count();
+            TRACE( Print( 
+                _L("[Cds Sync]\t iNames array size is %d out of %d"),
+                namesCount, 
+                KMetadataTypeCount ) );
+            
+            if ( namesCount == KMetadataTypeCount )
+                {
+                // all arrays ready, sort them
+                iItemsInDb.Sort( iHashOrder );
+                for ( TInt i = 0; i < KMetadataTypeCount; i++ )
+                    {
+                    iNames[ i ]->Sort( iNameOrder );
+                    }
+                iState = ECdsSyncReadyToParse;
+                iSqlAo->iState = CCdsSyncSqlAo::ECdsSyncSqlAoIdle;
+                NotifySourceDataAddedL();
+                }
+            else 
+                {
+                RPointerArray<CCmSqlPropertyItem>* nameArray =
+                    new (ELeave) RPointerArray<CCmSqlPropertyItem>();
+                
+                iMetadataDb->GetPropertyValuesL( 
+                    *nameArray,
+                    iSqlAo->iStatus,
+                    KMetadataTypes[namesCount]
+                );
+                iSqlAo->Activate();
+                iNames.Append( nameArray );
+                }
+            break;
+            }
+        default: 
+            {
+            TRACE( Print( _L("[Cds Sync]\t RunL iState is \
+            not ECdsSyncInitializing" ) ));
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::DoCancel()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::DoCancel()
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::DoCancel"));
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::NotifySourceDataAddedL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::NotifySourceDataAddedL( 
+    TBool aSourceDataComplete ) 
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::NotifySourceDataAdded"));
+    
+    if ( aSourceDataComplete )
+        {
+        iSourceDataComplete = ETrue;
+        }
+    
+    if ( iState == ECdsSyncReadyToParse ) 
+        {
+        if ( iSourceDataArray->Count() )
+            {
+            iCurrentDocument = ( *iSourceDataArray )[ 0 ];
+            iSourceDataArray->Remove( 0 );
+            iChunkIndex = 0;
+            iParser->ParseBeginL();
+            iBackground->Start( 
+                TCallBack( CCdsSyncImpl::BackgroundParseL, this) );
+            iState = ECdsSyncParsing;
+            }
+        else if ( iSourceDataComplete ) 
+            {
+            TRACE( Print( _L
+            ("[Cds Sync]\t parsing complete, %d items to add"), 
+                iItemsToAdd.Count() ));
+            TRACE( Print( _L("[Cds Sync]\t and %d items to remove"), 
+                iItemsInDb.Count() ));
+     
+            iState = ECdsSyncIdle;
+            
+            RemoveUnchangedItems( );
+            
+            iSqlAo->NotifyItemsAddedL( ETrue );
+            }
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ProgressL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::ProgressL( TInt aItemCount )
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::ProgressL"));
+    iObserver->ProgressL( aItemCount );
+    }
+
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ChunkCount()
+// --------------------------------------------------------------------------
+TInt CCdsSyncImpl::ChunkCount()
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::ChunkCount"));
+    TInt chunkCount = iSourceDataArray->Count();
+    if ( iCurrentDocument )
+        {
+        chunkCount++;
+        }
+    return chunkCount;
+    }
+
+// --------------------------------------------------------------------------
+// Increment successfully processed number 
+// --------------------------------------------------------------------------
+//
+TInt CCdsSyncImpl::ProcessedItemCount()
+	{
+	return iProcessedItems;
+	}
+	
+// --------------------------------------------------------------------------
+// Increment chuch number ( search index )
+// --------------------------------------------------------------------------
+//
+void CCdsSyncImpl::SetSearchIndex( const TInt aSearchIndex )
+    {
+    iSearchIndex = aSearchIndex;
+    } 
+        
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ChunkCompleteL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::ChunkCompleteL()
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::ChunkCompleteL"));
+    iObserver->ChunkCompleteL();
+    iProcessedItems = 0;
+    }
+    
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OperationsCompleteL()
+// --------------------------------------------------------------------------
+#ifdef _DEBUG
+void CCdsSyncImpl::OperationsCompleteL( TInt aErrCode ) 
+#else // _DEBUG
+void CCdsSyncImpl::OperationsCompleteL( TInt /*aErrCode*/ ) 
+#endif // _DEBUG
+    {
+    TRACE( Print( _L
+    ("[Cds Sync]\t CCdsSyncImpl::OperationsCompleteL (err %d)"), 
+        aErrCode ));
+    
+    if ( iState == ECdsSyncInitializing )
+        {
+        RunL();
+        }
+    else 
+        {
+        iObserver->SyncCompleteL();    
+        iProcessedItems = 0;  
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::BackgroundParseL()
+// --------------------------------------------------------------------------
+TInt CCdsSyncImpl::BackgroundParseL( TAny* aCdsSync )
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::BackgroundParseL"));
+    
+    return ((CCdsSyncImpl*)aCdsSync)->DoBackgroundParseL();
+    }
+ 
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::DoBackgroundParseL()
+// --------------------------------------------------------------------------
+TInt CCdsSyncImpl::DoBackgroundParseL()
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::DoBackgroundParseL"));
+    if ( iCurrentDocument ) 
+        {
+
+    #ifdef _DEBUG
+        iHashTime = 0;
+        TTime timeBefore;
+        timeBefore.HomeTime();
+    #endif
+        
+        TBool parseMore = 
+            ( iCurrentDocument->Length() - iChunkIndex ) > KParseChunkSize;
+        TPtrC8 parseChunk = 
+            parseMore ?
+            iCurrentDocument->Mid( iChunkIndex, KParseChunkSize ) :
+            iCurrentDocument->Mid( iChunkIndex );
+        
+        iUnchangedItemCount = 0;
+            
+        // in case of leave that is caused by out of memory
+        TRAPD( error, iParser->ParseL( parseChunk ) );
+    	if ( error != KErrNone )
+        	{
+        	TRACE( Print( _L("[Cds Sync]\t Parse error = %d"), error ));
+        	}
+        
+    #ifdef _DEBUG
+        TTime timeAfter;
+        timeAfter.HomeTime();
+        TRACE( Print( _L
+            ("[Cds Sync]\t parsing of %d bytes of XML took %ld microsec"),
+            parseChunk.Size(), 
+            timeAfter.MicroSecondsFrom( timeBefore ).Int64() ) );
+        TRACE( Print( _L
+            ("[Cds Sync]\t of which hash comparison took %ld microsec"), 
+            iHashTime));
+    #endif
+
+        if ( parseMore ) 
+            {
+            iChunkIndex += KParseChunkSize;
+            }
+        else 
+            {
+            // in case of leave that is caused by out of memory
+            TRAPD( err, iParser->ParseEndL() );
+    		if ( err != KErrNone )
+        		{
+        		TRACE( Print( _L("[Cds Sync]\t \
+        		ParseEndL error = %d"), err ));
+        		}
+            iState = ECdsSyncReadyToParse;
+            delete iCurrentDocument; iCurrentDocument = NULL;
+            // check if there's more to parse and trap the leave
+            TRAPD( errOne, NotifySourceDataAddedL() );
+            if ( errOne != KErrNone )
+                {
+                TRACE( Print( _L("[Cds Sync]\t NotifySourceDataAdded \
+                error = %d"), errOne ));
+                }
+            ChunkCompleteL();
+            }
+        iSqlAo->NotifyItemsAddedL();
+        
+        return parseMore;
+        
+        }
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::BackgroundParseL END"));
+    return EFalse;
+    }
+  
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::FindAttribute()
+// --------------------------------------------------------------------------
+TInt CCdsSyncImpl::FindAttribute( const TDesC8& aName, 
+                                  const TDesC8& aPref, 
+                                  const RAttributeArray& aAttributes ) const
+    {
+    TInt returnvalue = KErrNotFound;
+    for ( TInt i = 0; i < aAttributes.Count(); i++ ) 
+        {
+        if ( ( aAttributes[i].Attribute().LocalName().
+               DesC().Compare( aName ) == 0) &&
+             ( aAttributes[i].Attribute().Prefix().
+               DesC().Compare( aPref ) == 0) )
+            {
+            returnvalue = i;
+            // break out from the loop
+            i = aAttributes.Count();
+            }
+        }
+    return returnvalue;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ParseResolution()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::ParseResolution( const TDesC8& aDes,
+                                    TUint& aWidth,
+                                    TUint& aHeight ) const
+    {
+    TLex8 lex( aDes );
+    if ( lex.Val( aWidth ) != KErrNone ) 
+        {
+        aWidth = 0;
+        }
+    if ( lex.Get() != 'x' || lex.Val( aHeight ) != KErrNone ) 
+        {
+        aHeight = 0;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ParseUint()
+// --------------------------------------------------------------------------
+TUint CCdsSyncImpl::ParseUint( const TDesC8& aDes ) const
+    {
+    TUint res = 0;
+    TLex8 lex( aDes );
+    if ( lex.Val( res ) != KErrNone ) 
+        {
+        res = 0;
+        }
+    return res;
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ParseInt64()
+// --------------------------------------------------------------------------
+TInt64 CCdsSyncImpl::ParseInt64( const TDesC8& aDes ) const
+    {
+    TInt64 res = 0;
+    TLex8 lex( aDes );
+    if ( lex.Val( res ) != KErrNone )
+        {
+        res = 0;
+        }
+    return res;
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ParseTime()
+// --------------------------------------------------------------------------
+TTime CCdsSyncImpl::ParseTime( const TDesC8& aDes ) const 
+    {
+    TUint year = 0;
+    TUint month = 1;
+    TUint day = 1;
+    TLex8 lex;
+    
+    TInt dashpos = aDes.Find( _L8("-") );
+    TInt dashpos2 = aDes.Mid( dashpos + 1 ).Find( _L8("-") ) + dashpos + 1;
+    
+    lex = aDes.Left(4);
+    if ( lex.Val( year ) != KErrNone )
+        {
+        year = 0;
+        }        
+    if ( dashpos2-dashpos > 1 ) 
+        {
+        lex = aDes.Mid( dashpos + 1,dashpos2 - dashpos - 1 );
+        if ( lex.Val(month) != KErrNone )
+            {
+            month = 1;
+            }
+            
+        }
+    if (aDes.Length() - dashpos2 > 1) 
+        {
+        lex = aDes.Mid(dashpos2 + 1);
+        if ( lex.Val(day) != KErrNone ) 
+            {
+            day = 1;
+            }            
+        }
+    TDateTime time;
+    if ( time.Set(year, TMonth(month-1), day-1, 0,0,0,0) != KErrNone )
+        {
+        return TTime( TDateTime(0, TMonth(0), 0, 0,0,0,0) );
+        }
+    else
+        {
+        return TTime( time );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ParseDuration()
+// --------------------------------------------------------------------------
+TReal CCdsSyncImpl::ParseDuration( const TDesC8& aDes ) const
+    {
+    TInt multiplier = 1;
+    TInt plusminuspos = aDes.Find( _L8("-") );
+    if ( plusminuspos == KErrNotFound ) 
+        {
+        plusminuspos = aDes.Find( _L8("+") );
+        }
+    else 
+        {
+        multiplier = -1;
+        }
+        
+    TInt hourminutepos = aDes.Find( _L8(":") );
+    TInt minutesecondpos = aDes.Mid( hourminutepos + 1 ).
+         Find( _L8(":") ) + hourminutepos + 1;
+    TInt dotpos = aDes.Find( _L8(".") );
+    TInt slashpos = aDes.Find( _L8("/") );
+
+    TInt hours = 0; TInt minutes = 0; 
+    TReal seconds = 0; TReal f0 = 0; TReal f1=1;    
+    TLex8 lex;
+    
+    if ( hourminutepos - plusminuspos > 1 ) 
+        {
+        lex = aDes.Mid( plusminuspos + 1, hourminutepos - plusminuspos - 1 );
+        if ( lex.Val( hours ) != KErrNone )
+            {
+            hours = 0;
+            }            
+        }
+    if ( minutesecondpos - hourminutepos > 1 ) 
+        {
+        lex = aDes.Mid( hourminutepos + 1, 
+                        minutesecondpos - hourminutepos - 1 );
+        if ( lex.Val(minutes) != KErrNone ) 
+            {
+            minutes = 0;
+            }
+        }
+    if ( (dotpos == KErrNotFound || slashpos == KErrNotFound) 
+          && minutesecondpos != KErrNotFound ) 
+        {
+        lex = aDes.Mid( minutesecondpos + 1 );
+        if ( lex.Val(seconds) != KErrNone )
+            {
+            seconds = 0;
+            }            
+        } 
+    else if (slashpos - dotpos > 1 && dotpos - minutesecondpos > 1 
+            && aDes.Length() - slashpos > 1) 
+        {
+        lex = aDes.Mid( minutesecondpos + 1, dotpos - minutesecondpos - 1 );
+        if ( lex.Val( seconds ) != KErrNone ) 
+            {
+            seconds = 0;
+            }
+        lex = aDes.Mid( dotpos + 1, slashpos - dotpos - 1 );
+        if ( lex.Val(f0) != KErrNone ) 
+            {
+            f0 = 0;
+            }            
+        lex = aDes.Mid( slashpos + 1 );
+        if ( lex.Val(f1) != KErrNone ) 
+            {
+            f1 = 1;
+            }            
+        }
+    
+    return multiplier*(hours * 3600 + minutes * 60 + seconds + f0/f1);
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::CalculateHashL()
+// --------------------------------------------------------------------------
+HBufC8* CCdsSyncImpl::CalculateHashL() const
+    {
+    CSHA1* sha1 = CSHA1::NewL();
+    CleanupStack::PushL( sha1 );
+    sha1->Reset();
+    
+    if ( iArtist ) 
+        {
+        sha1->Update( *iArtist );    
+        }
+    else 
+        {
+        sha1->Update( KNullDesC8() );
+        }
+    
+    if ( iAlbum ) 
+        {
+        sha1->Update( *iAlbum );    
+        }
+    else 
+        {
+        sha1->Update( KNullDesC8() );
+        }
+    
+    if ( iTitle ) 
+        {
+        sha1->Update( *iTitle );
+        }
+    else 
+        {
+        sha1->Update( KNullDesC8() );
+        }
+    
+    if ( iClass ) 
+        {
+        sha1->Update( *iClass );
+        }
+    else 
+        {
+        sha1->Update( KNullDesC8() );
+        }
+    
+    if ( iGenre ) 
+        {
+        sha1->Update( *iGenre );
+        }
+    else 
+        {
+        sha1->Update( KNullDesC8() );
+        }
+        
+    if ( iDate ) 
+        {
+        sha1->Update( *iDate );
+        }
+    else 
+        {
+        sha1->Update( KNullDesC8() );
+        }
+        
+    if( iAlbumArtUri )
+        {
+        sha1->Update( *iAlbumArtUri );
+        }
+    else 
+        {
+        sha1->Update( KNullDesC8() );
+        }        
+    
+    for ( TInt i = 0; i < iResources.Count(); i++ ) 
+        {
+        CItemResource* res = iResources[i];
+        
+        if ( res->iBitrate ) 
+            {
+            sha1->Update( *res->iBitrate );    
+            }
+        else 
+            {
+            sha1->Update( KNullDesC8() );
+            }
+        
+        if ( res->iSize ) 
+            {
+            sha1->Update( *res->iSize );
+            }
+        else 
+            {
+            sha1->Update( KNullDesC8() );
+            }
+        
+        
+        if ( res->iResolution ) 
+            {
+            sha1->Update( *res->iResolution );
+            }
+        else 
+            {
+            sha1->Update( KNullDesC8() );    
+            }
+        
+        
+        if ( res->iDuration ) 
+            {
+            sha1->Update( *res->iDuration );
+            }
+        else 
+            {
+            sha1->Update( KNullDesC8() );    
+            }
+        
+        if ( res->iProtocol ) 
+            {
+            sha1->Update( *res->iProtocol );
+            }
+        else 
+            {
+            sha1->Update( KNullDesC8() );
+            }
+        
+        if ( res->iUri ) 
+            {
+            sha1->Update( *res->iUri );
+            }
+        else 
+            {
+            sha1->Update( KNullDesC8() );            
+            }
+        }
+
+    // get the final hash value.
+    TPtrC8 hash = sha1->Final();
+    
+    // create an object that can be returned and copy hash value there.
+    HBufC8* retval = hash.AllocL();
+
+    // delete SHA1 object.
+    CleanupStack::PopAndDestroy( sha1 );
+    sha1 = NULL;
+    
+    // return 
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::EscapeHashLC()
+// --------------------------------------------------------------------------
+HBufC* CCdsSyncImpl::EscapeHashLC( const TDesC8& aHash ) const
+    {
+    HBufC* escapedHash = HBufC::NewLC( 40 );
+    TPtr ptr = escapedHash->Des();
+    for ( TInt i=0; i < 20; i++ ) 
+        {
+        if ( aHash[i] == 0 ) 
+            {
+            ptr.Append( _L("\\0") );
+            } 
+        else if ( aHash[i] == '\\' )
+            {
+            ptr.Append( _L("\\\\") );
+            } 
+        else
+            {
+            ptr.Append( aHash[i] );
+            }
+        }
+    return escapedHash;    
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::GetPropertyIdL()
+// --------------------------------------------------------------------------
+TInt64 CCdsSyncImpl::GetPropertyIdL( TInt aMetadataIndex,
+                                     const TDesC8& aValue ) const
+    {
+    TInt64 id = 0;
+    
+    TCmMetadataField metadataType = KMetadataTypes[ aMetadataIndex ];
+    
+    CCmSqlPropertyItem* property = NULL;
+    if ( metadataType == ECmResolution )
+        {
+        property = CCmSqlResolutionPropertyItem::NewLC();
+        }
+    else 
+        {
+        property = CCmSqlPropertyItem::NewLC();
+        }
+        
+    
+    property->SetNameL( aValue );
+    CCmSqlPropertyItemArray* properties = iNames[ aMetadataIndex ];
+    TInt index = properties->FindInOrder( property, iNameOrder );
+
+    
+    if ( index == KErrNotFound )
+        {
+        if ( metadataType == ECmResolution ) 
+            {
+            TUint width = 0;
+            TUint height = 0;
+            ParseResolution( aValue, width, height );
+            
+            CCmSqlResolutionPropertyItem* resolutionProperty = 
+                static_cast<CCmSqlResolutionPropertyItem*> ( property );
+            resolutionProperty->SetWidth( width );
+            resolutionProperty->SetHeight( height );
+            resolutionProperty->SetPixelCount( width * height );
+            }
+        
+        property->SetStatus( EFalse );
+        
+        iMetadataDb->SyncAddPropertyItemL( 
+            *property, metadataType );
+        properties->InsertInOrder( property, iNameOrder );
+        id = property->Id();
+        CleanupStack::Pop( property );
+        }
+    else 
+        {
+        id = (*properties)[ index ]->Id();
+        CleanupStack::PopAndDestroy( property );
+        }
+
+    return id;
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::CleanItemData()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::CleanItemData() 
+    {
+    iCurrentContent = NULL;
+
+    delete iItemId; 
+    iItemId = NULL;
+
+    delete iArtist; 
+    iArtist = NULL;
+
+    delete iAlbum; 
+    iAlbum = NULL;
+
+    delete iTitle; 
+    iTitle = NULL;
+
+    delete iClass; 
+    iClass = NULL;
+
+    delete iGenre; 
+    iGenre = NULL;
+
+    delete iDate; 
+    iDate = NULL;
+
+    delete iDescription; 
+    iDescription = NULL;
+    
+    delete iAlbumArtUri;
+    iAlbumArtUri = NULL;
+
+    iResources.ResetAndDestroy();
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnStartDocumentL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnStartDocumentL( const RDocumentParameters&/*aDocParam*/, 
+                                     TInt aErrorCode ) 
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::OnStartDocumentL"));
+
+    if ( aErrorCode ) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }
+        
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnEndDocumentL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnEndDocumentL( TInt aErrorCode ) 
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncImpl::OnEndDocumentL"));
+
+    if (aErrorCode) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }
+        
+
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnStartElementL(
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnStartElementL( const RTagInfo& aElement, 
+                                    const RAttributeArray& aAttributes,
+                                    TInt aErrorCode )
+    {
+    
+    if ( aErrorCode ) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }
+        
+    delete iCurrentContent;
+    iCurrentContent = NULL;
+        
+    const TDesC8& name = aElement.LocalName().DesC();
+    const TDesC8& uri = aElement.Uri().DesC();
+
+    if ( !uri.Compare( KXmlCdsDefaultNamespace ) )
+        {
+        if ( !name.Compare( KItem ) ) // <item>
+            {
+            TInt id = FindAttribute( KId, _L8(""), aAttributes );
+            if ( id != KErrNotFound) 
+                {
+                CleanItemData();
+                iItemId = aAttributes[ id ].Value().DesC().AllocL();
+                }
+            }
+        else if ( !name.Compare( KRes ) ) // <res>
+            {
+            
+            CItemResource* res = CItemResource::NewLC();
+            
+            for (TInt i = 0; i < aAttributes.Count(); i++) 
+                {
+                
+                const TDesC8& attrName = 
+                    aAttributes[i].Attribute().LocalName().DesC();
+                HBufC8* attrValue = aAttributes[i].Value().DesC().AllocL();
+                
+                if ( !attrName.Compare( KBitrate ) )  
+                    {
+                    res->iBitrate = attrValue; 
+                    } 
+                else if ( !attrName.Compare( KSize ) )  
+                    {
+                    res->iSize = attrValue; 
+                    } 
+                else if ( !attrName.Compare( KDuration ) )  
+                    {
+                    res->iDuration = attrValue; 
+                    } 
+                else if ( !attrName.Compare( KResolution ) )  
+                    {
+                    res->iResolution = attrValue; 
+                    } 
+                else if ( !attrName.Compare( KProtocolInfo ) )  
+                    {
+                    res->iProtocol = attrValue; 
+                    } 
+                }
+            iResources.Append( res );
+            CleanupStack::Pop( res );
+            }     
+        }
+    }  
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnEndElementL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnEndElementL( const RTagInfo& aElement, 
+                                  TInt aErrorCode )
+    {
+    if ( aErrorCode ) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }
+        
+    const TDesC8& name = aElement.LocalName().DesC();
+    const TDesC8& uri = aElement.Uri().DesC();
+    
+    if ( !uri.Compare( KXmlCdsDefaultNamespace ) ) 
+        // element from DIDL-Lite namespace
+        {
+        if ( !name.Compare( KRes ) && iCurrentContent ) // </res>
+            {
+            // remove "http://" and IP from URI
+            TInt httpPos = iCurrentContent->Find( _L8("http://") );
+            if ( httpPos != KErrNotFound ) 
+                {
+                TInt ipLength = 
+                    iCurrentContent->Mid( httpPos + 7 ).Find(_L8("/"));
+                if ( ipLength != KErrNotFound ) 
+                    {
+                    iCurrentContent->Des().Delete(0, httpPos + 7 + ipLength);
+                    } 
+                } 
+            iResources[ iResources.Count() - 1 ]->iUri = iCurrentContent;
+            }
+        
+        else if ( !name.Compare( KItem )) // </item>
+            {
+            // calc hash and construct item here
+            HBufC8* hash = CalculateHashL();
+            CleanupStack::PushL( hash );
+            HBufC* escapedHash = EscapeHashLC( *hash );
+            CleanupStack::Pop( escapedHash );
+
+            CleanupStack::PopAndDestroy( hash );
+            hash = NULL;
+            CleanupStack::PushL( escapedHash );
+            
+            CCmSqlBaseItem* baseItem = CCmSqlBaseItem::NewLC();
+            baseItem->SetHashL( *escapedHash );
+            TInt index = iItemsInDb.FindInOrder( baseItem, iHashOrder );
+            CleanupStack::PopAndDestroy( baseItem );
+            
+            if ( index == KErrNotFound ) // new or modified item
+                {
+                CCmSqlGenericItem* item = NULL;
+                
+                // find relevant resources
+                CItemResource* httpRes = NULL;
+                CItemResource* internalRes = NULL;
+                for ( TInt i=0; i < iResources.Count(); i++ )
+                    {
+                    HBufC8* protocol = iResources[ i ]->iProtocol;
+                    if ( protocol )
+                        {
+                        if ( !httpRes && 
+                              protocol->Find(_L8("http-get:")) 
+                                != KErrNotFound )
+                            {
+                            httpRes = iResources[ i ];
+                            }
+                        else if ( !internalRes &&
+                                   protocol->Find(_L8("internal:")) 
+                                    != KErrNotFound )
+                            {
+                            internalRes = iResources[ i ];
+                            }
+                        }
+                    }
+                
+                if( iClass && iClass->Find( KAudioBroadCastItem ) != 
+                    KErrNotFound )
+                    {
+                    // create audio item and set audio specific properties
+                    CCmSqlAudioItem* audioItem = CCmSqlAudioItem::NewLC();
+                    audioItem->SetMediaType( ECmAudioBroadCast );
+                    if ( iGenre ) 
+                        {
+                        audioItem->SetGenreId( 
+                            GetPropertyIdL( KGenreIndex, *iGenre ) );                        
+                        }
+                    item = audioItem;
+                    CleanupStack::Pop( audioItem );
+                    }
+                    
+                else if( iClass && iClass->Find( KVideoBroadCastItem ) != 
+                    KErrNotFound  )
+                    {
+                    // create video item and set image specific properties
+                    CCmSqlVideoItem* videoItem = CCmSqlVideoItem::NewLC();
+                    videoItem->SetMediaType( ECmVideoBroadCast );
+                    if ( iGenre ) 
+                        {
+                        videoItem->SetGenreId( 
+                            GetPropertyIdL( KGenreIndex, *iGenre ) );                        
+                        }
+                    item = videoItem;
+                    CleanupStack::Pop( videoItem );                    
+                    }
+                    
+                else if ( iClass && 
+                          iClass->Find( KAudioItem ) != KErrNotFound )
+                    {
+                    // create audio item and set audio specific properties
+                    CCmSqlAudioItem* audioItem = CCmSqlAudioItem::NewLC();
+                    audioItem->SetMediaType( ECmAudio );
+                    if ( iAlbum ) 
+                        {
+                        audioItem->SetAlbumId( 
+                            GetPropertyIdL( KAlbumIndex, *iAlbum ) );                        
+                        }
+                    if ( iArtist ) 
+                        {
+                        audioItem->SetArtistId( 
+                            GetPropertyIdL( KArtistIndex, *iArtist ) );                        
+                        }
+                    if ( iGenre ) 
+                        {
+                        audioItem->SetGenreId( 
+                            GetPropertyIdL( KGenreIndex, *iGenre ) );                        
+                        }
+                    if( iAlbumArtUri )
+                        {
+                        audioItem->SetAlbumArtUriL( *iAlbumArtUri );
+                        }
+                    if ( httpRes && httpRes->iDuration )
+                        {
+                        audioItem->SetDuration( 
+                            (TInt) ParseDuration( *httpRes->iDuration ) );
+                        }
+                    if ( httpRes && httpRes->iBitrate )
+                        {
+                        audioItem->SetBitrate( 
+                            ParseUint( *httpRes->iBitrate ) );
+                        }
+                    item = audioItem;
+                    CleanupStack::Pop( audioItem );
+                    }
+                
+                else if ( iClass && 
+                          iClass->Find( KImageItem ) != KErrNotFound )
+                    {
+                    // create image item and set image specific properties
+                    CCmSqlImageItem* imageItem = CCmSqlImageItem::NewLC();
+                    imageItem->SetMediaType( ECmImage );
+                    
+                    if ( iDescription )
+                        {
+                        imageItem->SetDescriptionL( *iDescription );
+                        }
+                    if ( internalRes && internalRes->iResolution )
+                        {
+                        imageItem->SetResolutionId(
+                            GetPropertyIdL( KResolutionIndex, 
+                                *internalRes->iResolution ));
+                        }
+                    item = imageItem;
+                    CleanupStack::Pop( imageItem );
+                    }
+                else if ( iClass && 
+                          iClass->Find( KVideoItem ) != KErrNotFound )
+                    {
+                    // create video item and set image specific properties
+                    CCmSqlVideoItem* videoItem = CCmSqlVideoItem::NewLC();
+                    videoItem->SetMediaType( ECmVideo );
+                    if ( iGenre ) 
+                        {
+                        videoItem->SetGenreId( 
+                            GetPropertyIdL( KGenreIndex, *iGenre ) );                        
+                        }
+                    item = videoItem;
+                    CleanupStack::Pop( videoItem );
+                    }
+
+                if ( item )
+                    {
+                    CleanupStack::PushL( item );
+                    // Parsing dlna profile id from protocol info
+                    ParseProfileIdL( *item, *httpRes );
+                    ParseProfileIdL( *item, *internalRes );
+                    // set general properties
+                    item->SetHashL( *escapedHash );
+                    item->SetCdsIdL( *iItemId );
+                    if ( iClass ) 
+                        {
+                        item->SetUpnpclassId( 
+                            GetPropertyIdL( KClassIndex, *iClass ) );                        
+                        }
+                    if ( iTitle )
+                        {
+                        item->SetTitleL( *iTitle );
+                        }
+                    if ( iDate )
+                        {
+                        item->SetDate( ParseTime( *iDate ) );
+                        }
+                    if ( httpRes && httpRes->iUri )
+                        {
+                        item->SetUriL( *httpRes->iUri );
+                        }
+                    if ( httpRes && httpRes->iSize )
+                        {
+                        item->SetSize( ParseUint( *httpRes->iSize ) );
+                        }
+                    else if ( internalRes && internalRes->iSize ) 
+                        {
+                        item->SetSize( ParseUint( *internalRes->iSize ) );
+                        }
+                    TTime currentTime;
+                    currentTime.HomeTime();
+                    item->SetHarvestDate( currentTime );
+                    item->SetSearchId( iSearchIndex );
+                    iItemsToAdd.Append( item ); // transfer ownership
+                    ProgressL(1);
+                    iProcessedItems++;
+                    CleanupStack::Pop( item );
+                    }
+                else
+                    {
+                    LOG(_L("[Cds Sync]\t item == NULL "));
+                    }                    
+                }
+            else // unchanged item
+                {
+                CCmSqlBaseItem* itemToRemove = iItemsInDb[ index ];
+                iItemsInDb.Remove( index );
+                ProgressL(1);
+                iProcessedItems++;
+                delete itemToRemove;
+                }
+            CleanItemData();
+            CleanupStack::PopAndDestroy( escapedHash );
+            }
+        }
+    
+    else if ( !uri.Compare( KXmlCdsDcNamespace ) ) 
+        // element from dc namespace
+        {
+        if ( !name.Compare( KTitle ) ) // </title>
+            {
+            iTitle = iCurrentContent;
+            }
+        else if ( !name.Compare( KDate ) ) // </date>
+            {
+            iDate = iCurrentContent;
+            }
+        else if ( !name.Compare( KDescription ) ) // </description>
+            {
+            iDescription = iCurrentContent;
+            }          
+        }
+    
+    else if ( !uri.Compare( KXmlCdsUpnpNamespace ) ) 
+        // element from UPnP namespace
+        {
+        if ( !name.Compare( KAlbum ) ) // </album>
+            {
+            iAlbum = iCurrentContent;
+            }
+        else if ( !name.Compare( KArtist ) ) // </artist>
+            {
+            iArtist = iCurrentContent;
+            }
+        else if ( !name.Compare( KClass ) ) // </class>
+            {
+            iClass = iCurrentContent;
+            }
+        else if ( !name.Compare( KGenre ) ) // </genre>
+            {
+            iGenre = iCurrentContent;
+            }
+        else if ( !name.Compare( KAlbumArtUri ) ) // </albumarturi>
+            {
+            // Parse uri removes ip and port for iCurrentContent
+            ParseUri();
+            iAlbumArtUri = iCurrentContent;
+            }              
+        }
+    else
+        {
+        delete iCurrentContent;
+        }        
+    
+    iCurrentContent = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnContentL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnContentL( const TDesC8& aBytes, TInt aErrorCode )
+    {
+    if ( aErrorCode ) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }                
+    if ( iCurrentContent )
+        {
+        if( iCurrentContent->Length() + aBytes.Length() < 
+            KCdsSyncMaxBufLength )
+            {
+            iCurrentContent->Des().Append( aBytes );
+            }
+        else
+            {
+            iCurrentContent = iCurrentContent->ReAllocL( 
+                iCurrentContent->Length() + aBytes.Length() );
+            iCurrentContent->Des().Append( aBytes );                
+            }
+        }
+    else 
+        {
+        iCurrentContent = HBufC8::NewL( KCdsSyncMaxBufLength );
+        iCurrentContent->Des().Append( aBytes );
+        }        
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnStartPrefixMappingL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnStartPrefixMappingL( const RString& /* aPrefix */, 
+                                          const RString& /* aUri */, 
+                                          TInt aErrorCode ) 
+    {
+    if (aErrorCode) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }
+        
+    
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnEndPrefixMappingL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnEndPrefixMappingL( const RString& /* aPrefix */, 
+                                        TInt aErrorCode )
+    {
+    if (aErrorCode) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnIgnorableWhiteSpaceL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnIgnorableWhiteSpaceL( const TDesC8& /* aBytes */, 
+                                           TInt aErrorCode ) 
+    {
+    if (aErrorCode) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnSkippedEntityL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnSkippedEntityL( const RString& /* aName */, 
+                                     TInt aErrorCode ) 
+    {
+    if (aErrorCode) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::OnProcessingInstructionL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnProcessingInstructionL( const TDesC8& /* aTarget */, 
+                                             const TDesC8& /* aData */, 
+                                             TInt aErrorCode ) 
+    {
+    if (aErrorCode) 
+        {
+        iObserver->SyncErrorL( aErrorCode );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// void CCdsSyncImpl::OnError() 
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::OnError( TInt aErrorCode ) 
+    {
+    if (aErrorCode && iState != ECdsSyncIdle) 
+        {
+        TRAP_IGNORE( iObserver->SyncErrorL( aErrorCode ) );
+        }
+        
+    
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::GetExtendedInterface() 
+// --------------------------------------------------------------------------
+TAny* CCdsSyncImpl::GetExtendedInterface( const TInt32 /* aUid */ ) 
+    {
+    return NULL;    
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ParseProfileIdL()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::ParseProfileIdL( 
+    CCmSqlGenericItem& aItem, 
+    const CItemResource& aRes ) const
+    {
+    if( &aRes && &aItem )
+        {
+        TInt index( aRes.iProtocol->Find( KDlnaPn() ) );
+        if( KErrNotFound != index )
+            {
+            TInt index2( aRes.iProtocol->Find( KSemicolon() ) );
+            if( KErrNotFound != index2 )
+                {                        
+                HBufC8* temp = 
+                    aRes.iProtocol->Mid( 
+                        index + KDlnaPn().Length(), 
+                        index2 - ( index + KDlnaPn().Length() ) ).AllocLC();
+                aItem.SetUpnpProfileId( 
+                    GetPropertyIdL( KUpnpProfileIndex, *temp ) );
+                CleanupStack::PopAndDestroy( temp );
+                }
+            }
+        }     
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::RemoveUnchangedItems()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::RemoveUnchangedItems()
+    {
+    for( TInt i = iItemsInDb.Count() - 1; i >= 0; i-- )
+        {
+        if( iItemsInDb[i]->SearchId() < iSearchIndex )
+            {
+            CCmSqlBaseItem* itemToRemove = iItemsInDb[ i ];
+            iItemsInDb.Remove( i );
+            delete itemToRemove;            
+            }
+        }    
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncImpl::ParseUri()
+// --------------------------------------------------------------------------
+void CCdsSyncImpl::ParseUri()
+    {
+    // Removes ip and port from iCurrentContent
+    TInt httpPos = iCurrentContent->Find( _L8("http://") );
+    if ( httpPos != KErrNotFound ) 
+        {
+        TInt ipLength = 
+            iCurrentContent->Mid( httpPos + 7 ).Find(_L8("/"));
+        if ( ipLength != KErrNotFound ) 
+            {
+            iCurrentContent->Des().Delete(0, httpPos + 7 + ipLength);
+            } 
+        }  
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/cdssynclib/src/cdssyncsqlao.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,288 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Cds Sync Active Object
+*
+*/
+
+
+
+
+
+
+#include "mcmsqlmain.h"
+#include "cmsqlbaseitem.h"
+#include "cmsqlgenericitem.h"
+#include "cdssyncsqlao.h"
+#include "cdssyncimplsql.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KCdsSyncMaxImageItemCount = 15000;
+const TInt KCdsSyncMaxVideoItemCount = 5000;
+const TInt KCdsSyncMaxItemCount      = 40000;
+
+// --------------------------------------------------------------------------
+// CCdsSyncSqlAo::NewL
+// --------------------------------------------------------------------------
+//
+CCdsSyncSqlAo* CCdsSyncSqlAo::NewL( 
+    MCmSqlMain& aSqlDb,
+    CCdsSyncImpl& aSync,
+    RPointerArray<CCmSqlGenericItem>& aItemsToAdd,
+    RPointerArray<CCmSqlBaseItem>& aItemsToDelete,
+    TInt aAddGranularity )
+    {    
+    CCdsSyncSqlAo* self = CCdsSyncSqlAo::NewLC(
+        aSqlDb,
+        aSync,
+        aItemsToAdd,
+        aItemsToDelete,
+        aAddGranularity );
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// --------------------------------------------------------------------------
+// CCdsSyncSqlAo::NewLC
+// --------------------------------------------------------------------------
+//    
+CCdsSyncSqlAo* CCdsSyncSqlAo::NewLC( 
+    MCmSqlMain& aSqlDb,
+    CCdsSyncImpl& aSync,
+    RPointerArray<CCmSqlGenericItem>& aItemsToAdd,
+    RPointerArray<CCmSqlBaseItem>& aItemsToDelete,
+    TInt aAddGranularity )
+    {    
+    LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::NewLC"));    
+    CCdsSyncSqlAo* self = new (ELeave) CCdsSyncSqlAo( 
+        aSqlDb, aSync, aItemsToAdd, aItemsToDelete, aAddGranularity  
+        ); 
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;
+    }    
+
+// --------------------------------------------------------------------------
+// CCdsSyncSqlAo::~CCdsSyncSqlAo
+// --------------------------------------------------------------------------
+CCdsSyncSqlAo::~CCdsSyncSqlAo()
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::~CCdsSyncSqlAo"));    
+    
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncSqlAo::CCdsSyncSqlAo
+// --------------------------------------------------------------------------
+CCdsSyncSqlAo::CCdsSyncSqlAo( MCmSqlMain& aSqlDb,
+                              CCdsSyncImpl& aSync,
+                              RPointerArray<CCmSqlGenericItem>& aItemsToAdd,
+                              RPointerArray<CCmSqlBaseItem>& aItemsToDelete,
+                              TInt aAddGranularity ) :
+    CActive( CActive::EPriorityIdle ),
+    iState( ECdsSyncSqlAoIdle ),
+    iSqlDb( aSqlDb ),
+    iSync( aSync ),
+    iItemsToAdd( aItemsToAdd ),
+    iItemsToDelete( aItemsToDelete ),
+    iAddGranularity( aAddGranularity ),    
+    iSourceDataComplete( EFalse )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncSqlAo::ConstructL
+// --------------------------------------------------------------------------
+void CCdsSyncSqlAo::ConstructL() 
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::ConstructL"));    
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncSqlAo::NotifyItemsAddedL
+// --------------------------------------------------------------------------
+void CCdsSyncSqlAo::NotifyItemsAddedL( TBool aSourceDataComplete )
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::NotifyItemsAddedL"));
+
+    // Source data is complete
+    if ( aSourceDataComplete )
+        {
+        iSourceDataComplete = ETrue;
+        }
+
+    TRACE( Print( _L("[Cds Sync]\t addarray has %d items, srccomplete %d"), 
+        iItemsToAdd.Count(), iSourceDataComplete ));
+    
+    if ( iState == ECdsSyncSqlAoIdle )
+        {
+        if ( iItemsToAdd.Count() >= iAddGranularity || 
+           ( iSourceDataComplete && iItemsToAdd.Count() ) )
+        
+            {
+            // add more items
+            iStatus = KRequestPending;
+            iItemsInAddition = iItemsToAdd.Count();
+
+        #ifdef _DEBUG
+            iOperationTime.HomeTime();
+        #endif
+
+            TRACE( Print( _L("[Cds Sync]\t starting to add %d items"),
+                 iItemsInAddition ));
+            iSqlDb.AsyncBatchAdd( iItemsToAdd, iStatus );
+            SetActive();    
+            iState = ECdsSyncSqlAoAdding;
+            }
+        else if ( iSourceDataComplete )
+            {
+            // all done, start deleting
+       #ifdef _DEBUG
+            iOperationTime.HomeTime();
+       #endif
+            iSqlDb.AsyncBatchDelete( iItemsToDelete, iStatus );
+            SetActive();
+            iState = ECdsSyncSqlAoDeleting;
+           }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCdsSyncSqlAo::Activate()
+// ---------------------------------------------------------------------------
+void CCdsSyncSqlAo::Activate()
+    {
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncSqlAo::IfOverLimitDeleteMediaItems() 
+// --------------------------------------------------------------------------
+void CCdsSyncSqlAo::IfOverLimitDeleteMediaItems() 
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::IfOverLimitDeleteMediaItems START"));
+    TInt64 musicCount( KErrNone );
+    TInt64 videoCount( KErrNone );
+    TInt64 imageCount( KErrNone );
+    TRAP_IGNORE( iSqlDb.GetMediaCountL( musicCount, ECmAudio ) );
+    TRAP_IGNORE( iSqlDb.GetMediaCountL( videoCount, ECmVideo ) );
+    TRAP_IGNORE( iSqlDb.GetMediaCountL( imageCount, ECmImage ) );
+    TRACE( Print( _L("[Cds Sync]\t Amout of music items %ld"), musicCount ));
+    TRACE( Print( _L("[Cds Sync]\t Amout of image items %ld"), imageCount ));
+    TRACE( Print( _L("[Cds Sync]\t Amout of video items %ld"), videoCount ));
+    if( KCdsSyncMaxImageItemCount < imageCount )
+        {
+        TRAP_IGNORE( iSqlDb.DeleteOldestMediaItemsL( ECmImage, 
+            imageCount - KCdsSyncMaxImageItemCount ) );
+        TRACE( Print( _L("[Cds Sync]\t deleted %ld image items"), 
+            ( imageCount - KCdsSyncMaxImageItemCount )));           
+        TRAP_IGNORE( iSqlDb.GetMediaCountL( imageCount, ECmImage ) );
+        }
+    if( KCdsSyncMaxVideoItemCount < videoCount )
+        {
+        TRAP_IGNORE( iSqlDb.DeleteOldestMediaItemsL( ECmVideo, 
+            videoCount - KCdsSyncMaxVideoItemCount ) );
+        TRACE( Print( _L("[Cds Sync]\t deleted %ld video items"), 
+            ( videoCount - KCdsSyncMaxVideoItemCount )));              
+        TRAP_IGNORE( iSqlDb.GetMediaCountL( videoCount, ECmVideo ) );
+        }
+    if( KCdsSyncMaxItemCount < ( imageCount + videoCount + musicCount ) )
+        {
+        TRAP_IGNORE( iSqlDb.DeleteOldestMediaItemsL( ECmAudio, 
+            ( imageCount + videoCount + musicCount ) - 
+            KCdsSyncMaxItemCount ) );
+        TRACE( Print( _L("[Cds Sync]\t deleted %ld music items"), 
+            ( ( imageCount + videoCount + musicCount ) - 
+            KCdsSyncMaxItemCount )));                     
+        }
+    LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::IfOverLimitDeleteMediaItems END"));
+    }
+    
+// --------------------------------------------------------------------------
+// CCdsSyncSqlAo::RunL() 
+// --------------------------------------------------------------------------
+void CCdsSyncSqlAo::RunL() 
+    {
+    TRACE( Print( _L("[Cds Sync]\t CCdsSyncSqlAo::RunL, iStatus %d"), 
+        iStatus.Int() ));
+    if ( iState == ECdsSyncSqlAoAdding )
+        {
+        iState = ECdsSyncSqlAoIdle;
+        
+    #ifdef _DEBUG
+            
+        TTime timeAfter;
+        timeAfter.HomeTime();
+        TRACE( Print( 
+          _L("[Cds Sync]\t added %d, took %ld microsec, err %d"),
+          iItemsToAdd.Count(), 
+          timeAfter.MicroSecondsFrom( iOperationTime ).Int64(),
+          iStatus.Int() ));
+        TRACE( Print( _L("[Cds Sync]\t array has %d items"), 
+           iItemsToAdd.Count() ));
+        
+    #endif
+        
+        TInt itemCount( iItemsToAdd.Count() );
+        
+        for ( TInt i = 0; i < itemCount; i++ )
+            {
+            delete iItemsToAdd[ 0 ];
+            iItemsToAdd.Remove( 0 );
+            }
+        
+        // check if there's more to add
+        NotifyItemsAddedL();
+        
+        }
+    else if ( iState == ECdsSyncSqlAoInitializing )
+        {
+        iSync.OperationsCompleteL( KErrNone );
+        }
+    else // ECdsSyncSqlAoDeleting
+        {
+    #ifdef _DEBUG
+    
+        TTime timeAfter;
+        timeAfter.HomeTime();
+        TRACE( Print( 
+          _L("[Cds Sync]\t removed %d, took %ld microsec, err %d"),
+          iItemsToDelete.Count(), 
+          timeAfter.MicroSecondsFrom( iOperationTime ).Int64(),
+          iStatus.Int() ));
+    #endif
+            
+        iItemsToDelete.ResetAndDestroy();
+        LOG(_L("[Cds Sync]\t Checking if too much media..."));
+        IfOverLimitDeleteMediaItems();
+        LOG(_L("[Cds Sync]\t Checked!"));
+        LOG(_L("[Cds Sync]\t Deleting unused propertys"));
+        iSqlDb.DeleteUnusedPropertys( );
+        iState = ECdsSyncSqlAoIdle;
+        iSync.OperationsCompleteL( KErrNone );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCdsSyncSqlAo::DoCancel()
+// --------------------------------------------------------------------------
+void CCdsSyncSqlAo::DoCancel()
+    {
+    LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::DoCancel"));    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/cdssync/common/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for project cdssync
+*
+*/
+
+
+
+
+
+
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+../cdssynclib/inc/cdssyncimplsql.h    |../../../inc/cdssyncimplsql.h
+../cdssynclib/inc/cdssync.h           |../../../inc/cdssync.h
+
+PRJ_MMPFILES
+
+../cdssynclib/group/cdssync.mmp
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/bwins/cmcommonu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,319 @@
+EXPORTS
+	?NewL@CCmSqlResolutionPropertyItem@@SAPAV1@XZ @ 1 NONAME ; class CCmSqlResolutionPropertyItem * CCmSqlResolutionPropertyItem::NewL(void)
+	?NewLC@CCmSqlImageItem@@SAPAV1@XZ @ 2 NONAME ; class CCmSqlImageItem * CCmSqlImageItem::NewLC(void)
+	?StoreRule@CCmStoreRule@@QAEXHPAW4TCmMediaType@@@Z @ 3 NONAME ; void CCmStoreRule::StoreRule(int, enum TCmMediaType *)
+	?ListId@CCmFillRule@@QBEIXZ @ 4 NONAME ; unsigned int CCmFillRule::ListId(void) const
+	?SetListId@CCmFillListItem@@QAEXI@Z @ 5 NONAME ; void CCmFillListItem::SetListId(unsigned int)
+	?Status@CCmBaseListItem@@QBE?AW4TCmListItemStatus@@XZ @ 6 NONAME ; enum TCmListItemStatus CCmBaseListItem::Status(void) const
+	?InternalizeL@CCmDriveInfo@@QAEXAAVRReadStream@@@Z @ 7 NONAME ; void CCmDriveInfo::InternalizeL(class RReadStream &)
+	?SetListRealSizeInBytes@CCmFillRule@@QAEXK@Z @ 8 NONAME ; void CCmFillRule::SetListRealSizeInBytes(unsigned long)
+	?AddPropertyItemL@CCmSqlPropertyContainer@@QAEXPAVCCmSqlPropertyItem@@@Z @ 9 NONAME ; void CCmSqlPropertyContainer::AddPropertyItemL(class CCmSqlPropertyItem *)
+	?Priority@CCmFillListItem@@QBEEXZ @ 10 NONAME ; unsigned char CCmFillListItem::Priority(void) const
+	?PrimaryText@CCmBaseListItem@@QBEAAVTDesC16@@XZ @ 11 NONAME ; class TDesC16 & CCmBaseListItem::PrimaryText(void) const
+	?Height@CCmSqlResolutionPropertyItem@@QBEHXZ @ 12 NONAME ; int CCmSqlResolutionPropertyItem::Height(void) const
+	?ExcAlbums@CCmFillRule@@QBEAAVCDesC16Array@@XZ @ 13 NONAME ; class CDesC16Array & CCmFillRule::ExcAlbums(void) const
+	?DeleteRule@CCmFillRule@@QAEXW4TCmMetadataField@@@Z @ 14 NONAME ; void CCmFillRule::DeleteRule(enum TCmMetadataField)
+	??1CCmMediaServerFull@@UAE@XZ @ 15 NONAME ; CCmMediaServerFull::~CCmMediaServerFull(void)
+	?Amount@CCmFillRule@@QBEKXZ @ 16 NONAME ; unsigned long CCmFillRule::Amount(void) const
+	?MediaServerName@CCmMediaServerFull@@QBE?AVTPtrC8@@XZ @ 17 NONAME ; class TPtrC8 CCmMediaServerFull::MediaServerName(void) const
+	?SetId@CCmSqlPropertyItem@@QAEX_J@Z @ 18 NONAME ; void CCmSqlPropertyItem::SetId(long long)
+	?SetArtistId@CCmSqlAudioItem@@QAEX_J@Z @ 19 NONAME ; void CCmSqlAudioItem::SetArtistId(long long)
+	?Bitrate@CCmSqlAudioItem@@QBEHXZ @ 20 NONAME ; int CCmSqlAudioItem::Bitrate(void) const
+	?MediaServerCount@CCmStoreRule@@QBEHXZ @ 21 NONAME ; int CCmStoreRule::MediaServerCount(void) const
+	?CompareItemsByName@CCmSqlPropertyItem@@SAHABV1@0@Z @ 22 NONAME ; int CCmSqlPropertyItem::CompareItemsByName(class CCmSqlPropertyItem const &, class CCmSqlPropertyItem const &)
+	?NewL@CCmSqlBaseItem@@SAPAV1@XZ @ 23 NONAME ; class CCmSqlBaseItem * CCmSqlBaseItem::NewL(void)
+	?DefCount@CCmStoreRule@@QBEHXZ @ 24 NONAME ; int CCmStoreRule::DefCount(void) const
+	?UsedDriveQuota@CCmDriveInfo@@QBE_JXZ @ 25 NONAME ; long long CCmDriveInfo::UsedDriveQuota(void) const
+	?SetType@CCmSqlPropertyContainer@@QAEXW4TCmMetadataField@@@Z @ 26 NONAME ; void CCmSqlPropertyContainer::SetType(enum TCmMetadataField)
+	?AddMediaServerL@CCmFillRule@@QAEHABVTDesC8@@@Z @ 27 NONAME ; int CCmFillRule::AddMediaServerL(class TDesC8 const &)
+	?Status@CCmStoreRule@@QBE?AW4TCmListItemStatus@@XZ @ 28 NONAME ; enum TCmListItemStatus CCmStoreRule::Status(void) const
+	?NewLC@CCmFillListItem@@SAPAV1@IIIW4TCmFillRuleStatus@@@Z @ 29 NONAME ; class CCmFillListItem * CCmFillListItem::NewLC(unsigned int, unsigned int, unsigned int, enum TCmFillRuleStatus)
+	?SetListRealCount@CCmFillRule@@QAEXK@Z @ 30 NONAME ; void CCmFillRule::SetListRealCount(unsigned long)
+	?CompareItemsByName@CCmSqlResolutionPropertyItem@@SAHABV1@0@Z @ 31 NONAME ; int CCmSqlResolutionPropertyItem::CompareItemsByName(class CCmSqlResolutionPropertyItem const &, class CCmSqlResolutionPropertyItem const &)
+	?SetTemplateId@CCmFillRule@@QAEXE@Z @ 32 NONAME ; void CCmFillRule::SetTemplateId(unsigned char)
+	?NewLC@CCmMediaServer@@SAPAV1@XZ @ 33 NONAME ; class CCmMediaServer * CCmMediaServer::NewLC(void)
+	?SetSelected@CCmFillRule@@QAEXW4TCmFillRuleStatus@@@Z @ 34 NONAME ; void CCmFillRule::SetSelected(enum TCmFillRuleStatus)
+	?HarvestDate@CCmSqlGenericItem@@QBE?AVTTime@@XZ @ 35 NONAME ; class TTime CCmSqlGenericItem::HarvestDate(void) const
+	?TrackNumber@CCmSqlAudioItem@@QBEHXZ @ 36 NONAME ; int CCmSqlAudioItem::TrackNumber(void) const
+	?SetPriority@CCmFillListItem@@QAEXE@Z @ 37 NONAME ; void CCmFillListItem::SetPriority(unsigned char)
+	?GetResource@CCmSqlGenericItem@@QAEXAAVTDesC8@@AAH11AA_JH@Z @ 38 NONAME ; void CCmSqlGenericItem::GetResource(class TDesC8 &, int &, int &, int &, long long &, int)
+	?AlbumArtUri@CCmSqlAudioItem@@QBEAAVTDesC8@@XZ @ 39 NONAME ; class TDesC8 & CCmSqlAudioItem::AlbumArtUri(void) const
+	?ExternalizeL@CCmFillListItem@@QBEXAAVRWriteStream@@@Z @ 40 NONAME ; void CCmFillListItem::ExternalizeL(class RWriteStream &) const
+	?NewLC@CCmSqlPropertyContainer@@SAPAV1@XZ @ 41 NONAME ; class CCmSqlPropertyContainer * CCmSqlPropertyContainer::NewLC(void)
+	?Name@CCmSqlPropertyItem@@QBEAAVTDesC8@@XZ @ 42 NONAME ; class TDesC8 & CCmSqlPropertyItem::Name(void) const
+	?Date@CCmSqlGenericItem@@QBE?AVTTime@@XZ @ 43 NONAME ; class TTime CCmSqlGenericItem::Date(void) const
+	?NewLC@CCmStoreListItem@@SAPAV1@XZ @ 44 NONAME ; class CCmStoreListItem * CCmStoreListItem::NewLC(void)
+	?ExcPlayLists@CCmFillRule@@QBEAAVCDesC16Array@@XZ @ 45 NONAME ; class CDesC16Array & CCmFillRule::ExcPlayLists(void) const
+	?SetMethod@CCmFillRule@@QAEXW4TCmFillMethod@@@Z @ 46 NONAME ; void CCmFillRule::SetMethod(enum TCmFillMethod)
+	??1CCmSqlPropertyItem@@UAE@XZ @ 47 NONAME ; CCmSqlPropertyItem::~CCmSqlPropertyItem(void)
+	??1CCmFillRule@@UAE@XZ @ 48 NONAME ; CCmFillRule::~CCmFillRule(void)
+	?NewLC@CCmSqlVideoItem@@SAPAV1@XZ @ 49 NONAME ; class CCmSqlVideoItem * CCmSqlVideoItem::NewLC(void)
+	?ExternalizeL@CCmStoreRuleContainer@@QBEXAAVRWriteStream@@@Z @ 50 NONAME ; void CCmStoreRuleContainer::ExternalizeL(class RWriteStream &) const
+	?SetItemCount@CCmSearchResponseHash@@QAEXH@Z @ 51 NONAME ; void CCmSearchResponseHash::SetItemCount(int)
+	?DeleteFillRule@CCmFillRuleContainer@@QAEXH@Z @ 52 NONAME ; void CCmFillRuleContainer::DeleteFillRule(int)
+	?ExternalizeL@CCmStoreListItem@@QBEXAAVRWriteStream@@@Z @ 53 NONAME ; void CCmStoreListItem::ExternalizeL(class RWriteStream &) const
+	?TemplateId@CCmFillRule@@QBEEXZ @ 54 NONAME ; unsigned char CCmFillRule::TemplateId(void) const
+	?Size@CCmSqlGenericItem@@QBEHXZ @ 55 NONAME ; int CCmSqlGenericItem::Size(void) const
+	?VisibleDate@CCmMediaServerFull@@QBE?AVTTime@@XZ @ 56 NONAME ; class TTime CCmMediaServerFull::VisibleDate(void) const
+	?SetVisibleDate@CCmMediaServerFull@@QAEXVTTime@@@Z @ 57 NONAME ; void CCmMediaServerFull::SetVisibleDate(class TTime)
+	?NewLC@CCmFillRule@@SAPAV1@XZ @ 58 NONAME ; class CCmFillRule * CCmFillRule::NewLC(void)
+	?Title@CCmSqlGenericItem@@QBEAAVTDesC8@@XZ @ 59 NONAME ; class TDesC8 & CCmSqlGenericItem::Title(void) const
+	?StartIndex@CCmSearchResponseHash@@QBEHXZ @ 60 NONAME ; int CCmSearchResponseHash::StartIndex(void) const
+	?DriveNumber@CCmDriveInfo@@QBEHXZ @ 61 NONAME ; int CCmDriveInfo::DriveNumber(void) const
+	?Name@CCmFillRule@@QBEAAVTDesC8@@XZ @ 62 NONAME ; class TDesC8 & CCmFillRule::Name(void) const
+	?FillUsage@CCmMediaServerFull@@QAEHXZ @ 63 NONAME ; int CCmMediaServerFull::FillUsage(void)
+	?SetAmount@CCmFillRule@@QAEXK@Z @ 64 NONAME ; void CCmFillRule::SetAmount(unsigned long)
+	??1CCmSqlBaseItem@@UAE@XZ @ 65 NONAME ; CCmSqlBaseItem::~CCmSqlBaseItem(void)
+	?SetResolutionId@CCmSqlImageItem@@QAEX_J@Z @ 66 NONAME ; void CCmSqlImageItem::SetResolutionId(long long)
+	?SetDriveQuota@CCmDriveInfo@@QAEX_J@Z @ 67 NONAME ; void CCmDriveInfo::SetDriveQuota(long long)
+	?DeleteMediaServer@CCmFillRule@@QAEXABVTDesC8@@@Z @ 68 NONAME ; void CCmFillRule::DeleteMediaServer(class TDesC8 const &)
+	?RemoveExcPlayList@CCmFillRule@@QAEXABVTDesC16@@@Z @ 69 NONAME ; void CCmFillRule::RemoveExcPlayList(class TDesC16 const &)
+	?SystemUpdateID@CCmMediaServer@@QBEHXZ @ 70 NONAME ; int CCmMediaServer::SystemUpdateID(void) const
+	??1CCmStoreRuleContainer@@UAE@XZ @ 71 NONAME ; CCmStoreRuleContainer::~CCmStoreRuleContainer(void)
+	?ExternalizeL@CCmDriveInfo@@QBEXAAVRWriteStream@@@Z @ 72 NONAME ; void CCmDriveInfo::ExternalizeL(class RWriteStream &) const
+	?NewL@CCmSqlPropertyContainer@@SAPAV1@XZ @ 73 NONAME ; class CCmSqlPropertyContainer * CCmSqlPropertyContainer::NewL(void)
+	?UpnpProfileId@CCmSqlGenericItem@@QBE_JXZ @ 74 NONAME ; long long CCmSqlGenericItem::UpnpProfileId(void) const
+	?SetHeight@CCmSqlResolutionPropertyItem@@QAEXH@Z @ 75 NONAME ; void CCmSqlResolutionPropertyItem::SetHeight(int)
+	?SetStatus@CCmFillRule@@QAEXW4TCmListItemStatus@@@Z @ 76 NONAME ; void CCmFillRule::SetStatus(enum TCmListItemStatus)
+	?DeleteMediaServer@CCmFillRule@@QAEXH@Z @ 77 NONAME ; void CCmFillRule::DeleteMediaServer(int)
+	?Description@CCmSqlImageItem@@QBEAAVTDesC8@@XZ @ 78 NONAME ; class TDesC8 & CCmSqlImageItem::Description(void) const
+	?SetDevId@CCmStoreListItem@@QAEXEW4TCmListItemStatus@@@Z @ 79 NONAME ; void CCmStoreListItem::SetDevId(unsigned char, enum TCmListItemStatus)
+	?SetDate@CCmBaseListItem@@QAEXVTTime@@@Z @ 80 NONAME ; void CCmBaseListItem::SetDate(class TTime)
+	?ExcPlayLists@CCmStoreRule@@QAEAAVCDesC16Array@@XZ @ 81 NONAME ; class CDesC16Array & CCmStoreRule::ExcPlayLists(void)
+	?NewL@CCmSqlVideoItem@@SAPAV1@XZ @ 82 NONAME ; class CCmSqlVideoItem * CCmSqlVideoItem::NewL(void)
+	?SetRefId@CCmBaseListItem@@QAEX_K@Z @ 83 NONAME ; void CCmBaseListItem::SetRefId(unsigned long long)
+	?Status@CCmDriveInfo@@QBEHXZ @ 84 NONAME ; int CCmDriveInfo::Status(void) const
+	?Hash@CCmSqlBaseItem@@QBEAAVTDesC16@@XZ @ 85 NONAME ; class TDesC16 & CCmSqlBaseItem::Hash(void) const
+	?SetMediaType@CCmBaseListItem@@QAEXW4TCmMediaType@@@Z @ 86 NONAME ; void CCmBaseListItem::SetMediaType(enum TCmMediaType)
+	?SetDevId@CCmFillListItem@@QAEXE@Z @ 87 NONAME ; void CCmFillListItem::SetDevId(unsigned char)
+	?NewLC@CCmSqlResolutionPropertyItem@@SAPAV1@XZ @ 88 NONAME ; class CCmSqlResolutionPropertyItem * CCmSqlResolutionPropertyItem::NewLC(void)
+	?Size@CCmBaseListItem@@QBEKXZ @ 89 NONAME ; unsigned long CCmBaseListItem::Size(void) const
+	?SetSize@CCmBaseListItem@@QAEXK@Z @ 90 NONAME ; void CCmBaseListItem::SetSize(unsigned long)
+	?NewLC@CCmStoreRule@@SAPAV1@XZ @ 91 NONAME ; class CCmStoreRule * CCmStoreRule::NewLC(void)
+	?InternalizeL@CCmSqlResolutionPropertyItem@@QAEXAAVRReadStream@@@Z @ 92 NONAME ; void CCmSqlResolutionPropertyItem::InternalizeL(class RReadStream &)
+	?NewLC@CCmBaseListItem@@SAPAV1@XZ @ 93 NONAME ; class CCmBaseListItem * CCmBaseListItem::NewLC(void)
+	?MediaServerCount@CCmFillRule@@QBEHXZ @ 94 NONAME ; int CCmFillRule::MediaServerCount(void) const
+	?IsDuplicate@CCmSqlPropertyContainer@@QAEHAAVCCmSqlPropertyItem@@@Z @ 95 NONAME ; int CCmSqlPropertyContainer::IsDuplicate(class CCmSqlPropertyItem &)
+	?InternalizeL@CCmBaseListItem@@QAEXAAVRReadStream@@@Z @ 96 NONAME ; void CCmBaseListItem::InternalizeL(class RReadStream &)
+	?MediaServerL@CCmStoreRule@@QAEABVTDesC8@@H@Z @ 97 NONAME ; class TDesC8 const & CCmStoreRule::MediaServerL(int)
+	?IsActive@CCmMediaServerFull@@QBEEXZ @ 98 NONAME ; unsigned char CCmMediaServerFull::IsActive(void) const
+	?AddFillRuleL@CCmFillRuleContainer@@QAEHPAVCCmFillRule@@@Z @ 99 NONAME ; int CCmFillRuleContainer::AddFillRuleL(class CCmFillRule *)
+	?NewLC@CCmSqlBaseItem@@SAPAV1@XZ @ 100 NONAME ; class CCmSqlBaseItem * CCmSqlBaseItem::NewLC(void)
+	?SetPathL@CCmBaseListItem@@QAEXABVTDesC16@@@Z @ 101 NONAME ; void CCmBaseListItem::SetPathL(class TDesC16 const &)
+	?CompareByHash@CCmSqlBaseItem@@SAHABV1@0@Z @ 102 NONAME ; int CCmSqlBaseItem::CompareByHash(class CCmSqlBaseItem const &, class CCmSqlBaseItem const &)
+	?Method@CCmFillRule@@QBE?AW4TCmFillMethod@@XZ @ 103 NONAME ; enum TCmFillMethod CCmFillRule::Method(void) const
+	?DbId@CCmMediaServer@@QBE_JXZ @ 104 NONAME ; long long CCmMediaServer::DbId(void) const
+	?SetGenreId@CCmSqlAudioItem@@QAEX_J@Z @ 105 NONAME ; void CCmSqlAudioItem::SetGenreId(long long)
+	?DeletePropertyContainer@CCmSqlPropertyCollector@@QAEXH@Z @ 106 NONAME ; void CCmSqlPropertyCollector::DeletePropertyContainer(int)
+	?DevIds@CCmStoreListItem@@QBE?AV?$RArray@H@@XZ @ 107 NONAME ; class RArray<int> CCmStoreListItem::DevIds(void) const
+	?UpdateFileStatusL@CCmStoreListItem@@QAEXEW4TCmListItemStatus@@@Z @ 108 NONAME ; void CCmStoreListItem::UpdateFileStatusL(unsigned char, enum TCmListItemStatus)
+	?DeleteMediaServer@CCmStoreRule@@QAEXABVTDesC8@@@Z @ 109 NONAME ; void CCmStoreRule::DeleteMediaServer(class TDesC8 const &)
+	?SetNameL@CCmSqlPropertyItem@@QAEXABVTDesC8@@@Z @ 110 NONAME ; void CCmSqlPropertyItem::SetNameL(class TDesC8 const &)
+	?SetUpnpclassId@CCmSqlGenericItem@@QAEX_J@Z @ 111 NONAME ; void CCmSqlGenericItem::SetUpnpclassId(long long)
+	?SetAlbumArtUriL@CCmSqlAudioItem@@QAEXABVTDesC8@@@Z @ 112 NONAME ; void CCmSqlAudioItem::SetAlbumArtUriL(class TDesC8 const &)
+	?NewL@CCmFillRule@@SAPAV1@XZ @ 113 NONAME ; class CCmFillRule * CCmFillRule::NewL(void)
+	?SetUriL@CCmFillListItem@@QAEXABVTDesC8@@@Z @ 114 NONAME ; void CCmFillListItem::SetUriL(class TDesC8 const &)
+	?NewL@CCmSearchResponseHash@@SAPAV1@HHABVTDesC8@@@Z @ 115 NONAME ; class CCmSearchResponseHash * CCmSearchResponseHash::NewL(int, int, class TDesC8 const &)
+	?SetDriveNameL@CCmDriveInfo@@QAEXABVTDesC16@@@Z @ 116 NONAME ; void CCmDriveInfo::SetDriveNameL(class TDesC16 const &)
+	?LimitType@CCmFillRule@@QBE?AW4TCmLimitType@@XZ @ 117 NONAME ; enum TCmLimitType CCmFillRule::LimitType(void) const
+	?SetLimitType@CCmFillRule@@QAEXW4TCmLimitType@@@Z @ 118 NONAME ; void CCmFillRule::SetLimitType(enum TCmLimitType)
+	?RuleCount@CCmFillRule@@QBEHXZ @ 119 NONAME ; int CCmFillRule::RuleCount(void) const
+	?ListId@CCmFillListItem@@QBEIXZ @ 120 NONAME ; unsigned int CCmFillListItem::ListId(void) const
+	?Width@CCmSqlResolutionPropertyItem@@QBEHXZ @ 121 NONAME ; int CCmSqlResolutionPropertyItem::Width(void) const
+	?AddRuleParamL@CCmFillRule@@QAEHHH@Z @ 122 NONAME ; int CCmFillRule::AddRuleParamL(int, int)
+	?Type@CCmSqlPropertyContainer@@QAE?AW4TCmMetadataField@@XZ @ 123 NONAME ; enum TCmMetadataField CCmSqlPropertyContainer::Type(void)
+	?AddExcAlbumL@CCmFillRule@@QAEXABVTDesC16@@@Z @ 124 NONAME ; void CCmFillRule::AddExcAlbumL(class TDesC16 const &)
+	??1CCmSqlPropertyContainer@@UAE@XZ @ 125 NONAME ; CCmSqlPropertyContainer::~CCmSqlPropertyContainer(void)
+	?AddStoreRuleL@CCmStoreRuleContainer@@QAEHPAVCCmStoreRule@@@Z @ 126 NONAME ; int CCmStoreRuleContainer::AddStoreRuleL(class CCmStoreRule *)
+	?MediaType@CCmSqlGenericItem@@QBE?AW4TCmMediaType@@XZ @ 127 NONAME ; enum TCmMediaType CCmSqlGenericItem::MediaType(void) const
+	?SetCdsIdL@CCmSqlBaseItem@@QAEXABVTDesC8@@@Z @ 128 NONAME ; void CCmSqlBaseItem::SetCdsIdL(class TDesC8 const &)
+	?NewL@CCmDriveInfo@@SAPAV1@XZ @ 129 NONAME ; class CCmDriveInfo * CCmDriveInfo::NewL(void)
+	?DeleteStoreRule@CCmStoreRuleContainer@@QAEXH@Z @ 130 NONAME ; void CCmStoreRuleContainer::DeleteStoreRule(int)
+	?Uri@CCmFillListItem@@QBEAAVTDesC8@@XZ @ 131 NONAME ; class TDesC8 & CCmFillListItem::Uri(void) const
+	?NewLC@CCmSqlGenericItem@@SAPAV1@XZ @ 132 NONAME ; class CCmSqlGenericItem * CCmSqlGenericItem::NewLC(void)
+	?PropertyContainerCount@CCmSqlPropertyCollector@@QBEHXZ @ 133 NONAME ; int CCmSqlPropertyCollector::PropertyContainerCount(void) const
+	?ItemId@CCmFillListItem@@QBEAAVTDesC8@@XZ @ 134 NONAME ; class TDesC8 & CCmFillListItem::ItemId(void) const
+	?NewLC@CCmFillRuleContainer@@SAPAV1@XZ @ 135 NONAME ; class CCmFillRuleContainer * CCmFillRuleContainer::NewLC(void)
+	?DeleteRule@CCmFillRule@@QAEXW4TCmMetadataField@@W4TCmOperatorType@@@Z @ 136 NONAME ; void CCmFillRule::DeleteRule(enum TCmMetadataField, enum TCmOperatorType)
+	?InternalizeL@CCmStoreRuleContainer@@QAEXAAVRReadStream@@@Z @ 137 NONAME ; void CCmStoreRuleContainer::InternalizeL(class RReadStream &)
+	?SetNameL@CCmFillRule@@QAEHABVTDesC8@@@Z @ 138 NONAME ; int CCmFillRule::SetNameL(class TDesC8 const &)
+	?Selected@CCmFillRule@@QBE?AW4TCmFillRuleStatus@@XZ @ 139 NONAME ; enum TCmFillRuleStatus CCmFillRule::Selected(void) const
+	?MediaType@CCmFillRule@@QBE?AW4TCmMediaType@@XZ @ 140 NONAME ; enum TCmMediaType CCmFillRule::MediaType(void) const
+	?Id@CCmSqlPropertyItem@@QBE_JXZ @ 141 NONAME ; long long CCmSqlPropertyItem::Id(void) const
+	?SortPropertyItem@CCmSqlPropertyContainer@@QAEXXZ @ 142 NONAME ; void CCmSqlPropertyContainer::SortPropertyItem(void)
+	?StoreRuleCount@CCmStoreRuleContainer@@QBEHXZ @ 143 NONAME ; int CCmStoreRuleContainer::StoreRuleCount(void) const
+	?DevId@CCmFillListItem@@QBEEXZ @ 144 NONAME ; unsigned char CCmFillListItem::DevId(void) const
+	?SetSearchId@CCmSqlBaseItem@@QAEX_J@Z @ 145 NONAME ; void CCmSqlBaseItem::SetSearchId(long long)
+	?NewL@CCmSqlPropertyCollector@@SAPAV1@XZ @ 146 NONAME ; class CCmSqlPropertyCollector * CCmSqlPropertyCollector::NewL(void)
+	?ExcAlbums@CCmStoreRule@@QAEAAVCDesC16Array@@XZ @ 147 NONAME ; class CDesC16Array & CCmStoreRule::ExcAlbums(void)
+	?Hash@CCmSearchResponseHash@@QBEABVTDesC8@@XZ @ 148 NONAME ; class TDesC8 const & CCmSearchResponseHash::Hash(void) const
+	?SetUsedDriveQuota@CCmDriveInfo@@QAEX_J@Z @ 149 NONAME ; void CCmDriveInfo::SetUsedDriveQuota(long long)
+	?RemoveExcAlbum@CCmStoreRule@@QAEXABVTDesC16@@@Z @ 150 NONAME ; void CCmStoreRule::RemoveExcAlbum(class TDesC16 const &)
+	?SetSelected@CCmFillListItem@@QAEXW4TCmFillRuleStatus@@@Z @ 151 NONAME ; void CCmFillListItem::SetSelected(enum TCmFillRuleStatus)
+	?SetDriveNumber@CCmDriveInfo@@QAEXH@Z @ 152 NONAME ; void CCmDriveInfo::SetDriveNumber(int)
+	?SetMediaType@CCmFillRule@@QAEXW4TCmMediaType@@@Z @ 153 NONAME ; void CCmFillRule::SetMediaType(enum TCmMediaType)
+	?DriveQuota@CCmDriveInfo@@QBE_JXZ @ 154 NONAME ; long long CCmDriveInfo::DriveQuota(void) const
+	?SetDate@CCmSqlGenericItem@@QAEXABVTTime@@@Z @ 155 NONAME ; void CCmSqlGenericItem::SetDate(class TTime const &)
+	?Selected@CCmStoreRule@@QBE?AW4TCmFillRuleStatus@@XZ @ 156 NONAME ; enum TCmFillRuleStatus CCmStoreRule::Selected(void) const
+	?AlbumId@CCmSqlAudioItem@@QBE_JXZ @ 157 NONAME ; long long CCmSqlAudioItem::AlbumId(void) const
+	?UpnpclassId@CCmSqlGenericItem@@QBE_JXZ @ 158 NONAME ; long long CCmSqlGenericItem::UpnpclassId(void) const
+	?Selected@CCmFillListItem@@QBE?AW4TCmFillRuleStatus@@XZ @ 159 NONAME ; enum TCmFillRuleStatus CCmFillListItem::Selected(void) const
+	?NewLC@CCmSqlPropertyItem@@SAPAV1@XZ @ 160 NONAME ; class CCmSqlPropertyItem * CCmSqlPropertyItem::NewLC(void)
+	?Date@CCmBaseListItem@@QBE?AVTTime@@XZ @ 161 NONAME ; class TTime CCmBaseListItem::Date(void) const
+	??1CCmBaseListItem@@UAE@XZ @ 162 NONAME ; CCmBaseListItem::~CCmBaseListItem(void)
+	?SetId@CCmSqlBaseItem@@QAEX_J@Z @ 163 NONAME ; void CCmSqlBaseItem::SetId(long long)
+	??1CCmSqlAudioItem@@UAE@XZ @ 164 NONAME ; CCmSqlAudioItem::~CCmSqlAudioItem(void)
+	?LoadResourceFileL@CmCommonUtils@@SAHABVTDesC16@@AAVCEikonEnv@@@Z @ 165 NONAME ; int CmCommonUtils::LoadResourceFileL(class TDesC16 const &, class CEikonEnv &)
+	?SetUDNL@CCmMediaServer@@QAEXABVTDesC8@@@Z @ 166 NONAME ; void CCmMediaServer::SetUDNL(class TDesC8 const &)
+	?FillRule@CCmFillRuleContainer@@QBEPAVCCmFillRule@@H@Z @ 167 NONAME ; class CCmFillRule * CCmFillRuleContainer::FillRule(int) const
+	?AddExcPlayListL@CCmFillRule@@QAEXABVTDesC16@@@Z @ 168 NONAME ; void CCmFillRule::AddExcPlayListL(class TDesC16 const &)
+	?ItemCount@CCmSearchResponseHash@@QBEHXZ @ 169 NONAME ; int CCmSearchResponseHash::ItemCount(void) const
+	?SetItemIdL@CCmFillListItem@@QAEXABVTDesC8@@@Z @ 170 NONAME ; void CCmFillListItem::SetItemIdL(class TDesC8 const &)
+	?NewL@CCmSqlPropertyItem@@SAPAV1@XZ @ 171 NONAME ; class CCmSqlPropertyItem * CCmSqlPropertyItem::NewL(void)
+	?StoreUsage@CCmMediaServerFull@@QAEHXZ @ 172 NONAME ; int CCmMediaServerFull::StoreUsage(void)
+	?NewLC@CCmSqlPropertyCollector@@SAPAV1@XZ @ 173 NONAME ; class CCmSqlPropertyCollector * CCmSqlPropertyCollector::NewLC(void)
+	?ExternalizeL@CCmSqlPropertyContainer@@QBEXAAVRWriteStream@@@Z @ 174 NONAME ; void CCmSqlPropertyContainer::ExternalizeL(class RWriteStream &) const
+	?NewLC@CCmMediaServerFull@@SAPAV1@XZ @ 175 NONAME ; class CCmMediaServerFull * CCmMediaServerFull::NewLC(void)
+	??1CCmSqlPropertyCollector@@UAE@XZ @ 176 NONAME ; CCmSqlPropertyCollector::~CCmSqlPropertyCollector(void)
+	?DriveId@CCmDriveInfo@@QBEIXZ @ 177 NONAME ; unsigned int CCmDriveInfo::DriveId(void) const
+	?SetWidth@CCmSqlResolutionPropertyItem@@QAEXH@Z @ 178 NONAME ; void CCmSqlResolutionPropertyItem::SetWidth(int)
+	?NewL@CCmFillListItem@@SAPAV1@XZ @ 179 NONAME ; class CCmFillListItem * CCmFillListItem::NewL(void)
+	?InternalizeL@CCmFillListItem@@QAEXAAVRReadStream@@@Z @ 180 NONAME ; void CCmFillListItem::InternalizeL(class RReadStream &)
+	?MediaServerL@CCmFillRule@@QAEXHAAH@Z @ 181 NONAME ; void CCmFillRule::MediaServerL(int, int &)
+	?SetStatus@CCmDriveInfo@@QAEXH@Z @ 182 NONAME ; void CCmDriveInfo::SetStatus(int)
+	?RuleParamL@CCmFillRule@@QAEXHHPAVTPtrC8@@@Z @ 183 NONAME ; void CCmFillRule::RuleParamL(int, int, class TPtrC8 *)
+	?UpnpClass@CCmFillListItem@@QBEAAVTDesC16@@XZ @ 184 NONAME ; class TDesC16 & CCmFillListItem::UpnpClass(void) const
+	?MediaServerL@CCmFillRule@@QAEABVTDesC8@@H@Z @ 185 NONAME ; class TDesC8 const & CCmFillRule::MediaServerL(int)
+	?SetHashL@CCmSqlBaseItem@@QAEXABVTDesC16@@@Z @ 186 NONAME ; void CCmSqlBaseItem::SetHashL(class TDesC16 const &)
+	?Id@CCmSqlBaseItem@@QBE_JXZ @ 187 NONAME ; long long CCmSqlBaseItem::Id(void) const
+	?SearchId@CCmSqlBaseItem@@QBE_JXZ @ 188 NONAME ; long long CCmSqlBaseItem::SearchId(void) const
+	??1CCmFillRuleContainer@@UAE@XZ @ 189 NONAME ; CCmFillRuleContainer::~CCmFillRuleContainer(void)
+	?ExternalizeL@CCmSqlResolutionPropertyItem@@QBEXAAVRWriteStream@@@Z @ 190 NONAME ; void CCmSqlResolutionPropertyItem::ExternalizeL(class RWriteStream &) const
+	?SetMediaServerNameL@CCmMediaServerFull@@QAEXABVTDesC8@@@Z @ 191 NONAME ; void CCmMediaServerFull::SetMediaServerNameL(class TDesC8 const &)
+	?SetPriority@CCmFillRule@@QAEXE@Z @ 192 NONAME ; void CCmFillRule::SetPriority(unsigned char)
+	?DbId@CCmBaseListItem@@QBE_KXZ @ 193 NONAME ; unsigned long long CCmBaseListItem::DbId(void) const
+	?NewL@CCmSearchResponseHash@@SAPAV1@XZ @ 194 NONAME ; class CCmSearchResponseHash * CCmSearchResponseHash::NewL(void)
+	?InternalizeL@CCmFillRuleContainer@@QAEXAAVRReadStream@@@Z @ 195 NONAME ; void CCmFillRuleContainer::InternalizeL(class RReadStream &)
+	?InternalizeL@CCmSqlPropertyItem@@QAEXAAVRReadStream@@@Z @ 196 NONAME ; void CCmSqlPropertyItem::InternalizeL(class RReadStream &)
+	?SetFillUsage@CCmMediaServerFull@@QAEXH@Z @ 197 NONAME ; void CCmMediaServerFull::SetFillUsage(int)
+	?SetPixelCount@CCmSqlResolutionPropertyItem@@QAEXH@Z @ 198 NONAME ; void CCmSqlResolutionPropertyItem::SetPixelCount(int)
+	?Duration@CCmSqlAudioItem@@QBEHXZ @ 199 NONAME ; int CCmSqlAudioItem::Duration(void) const
+	?SetUpnpClassL@CCmFillListItem@@QAEXABVTDesC16@@@Z @ 200 NONAME ; void CCmFillListItem::SetUpnpClassL(class TDesC16 const &)
+	?SetSelected@CCmStoreRule@@QAEXW4TCmFillRuleStatus@@@Z @ 201 NONAME ; void CCmStoreRule::SetSelected(enum TCmFillRuleStatus)
+	?SetHashL@CCmSearchResponseHash@@QAEXABVTDesC8@@@Z @ 202 NONAME ; void CCmSearchResponseHash::SetHashL(class TDesC8 const &)
+	?SetUriL@CCmSqlGenericItem@@QAEXABVTDesC8@@@Z @ 203 NONAME ; void CCmSqlGenericItem::SetUriL(class TDesC8 const &)
+	?AddPropertyContainerL@CCmSqlPropertyCollector@@QAEHPAVCCmSqlPropertyContainer@@@Z @ 204 NONAME ; int CCmSqlPropertyCollector::AddPropertyContainerL(class CCmSqlPropertyContainer *)
+	?ResourceCount@CCmSqlGenericItem@@QBEHXZ @ 205 NONAME ; int CCmSqlGenericItem::ResourceCount(void) const
+	?SetDriveId@CCmFillListItem@@QAEXI@Z @ 206 NONAME ; void CCmFillListItem::SetDriveId(unsigned int)
+	?AddRuleParamL@CCmFillRule@@QAEHHABVTDesC8@@@Z @ 207 NONAME ; int CCmFillRule::AddRuleParamL(int, class TDesC8 const &)
+	?DriveSize@CCmDriveInfo@@QBE_JXZ @ 208 NONAME ; long long CCmDriveInfo::DriveSize(void) const
+	?SetDriveNumber@CCmFillListItem@@QAEXH@Z @ 209 NONAME ; void CCmFillListItem::SetDriveNumber(int)
+	?Uri@CCmSqlGenericItem@@QBEAAVTDesC8@@XZ @ 210 NONAME ; class TDesC8 & CCmSqlGenericItem::Uri(void) const
+	?Status@CCmSqlPropertyItem@@QBEHXZ @ 211 NONAME ; int CCmSqlPropertyItem::Status(void) const
+	?DriveNumber@CCmFillListItem@@QBEHXZ @ 212 NONAME ; int CCmFillListItem::DriveNumber(void) const
+	?PropertyItem@CCmSqlPropertyContainer@@QAEPAVCCmSqlPropertyItem@@H@Z @ 213 NONAME ; class CCmSqlPropertyItem * CCmSqlPropertyContainer::PropertyItem(int)
+	?PropertyItemCount@CCmSqlPropertyContainer@@QBEHXZ @ 214 NONAME ; int CCmSqlPropertyContainer::PropertyItemCount(void) const
+	?SetTrackNumber@CCmSqlAudioItem@@QAEXH@Z @ 215 NONAME ; void CCmSqlAudioItem::SetTrackNumber(int)
+	?CopyCapability@CCmMediaServerFull@@QBEHXZ @ 216 NONAME ; int CCmMediaServerFull::CopyCapability(void) const
+	?CompareByCdsId@CCmSqlBaseItem@@SAHABV1@0@Z @ 217 NONAME ; int CCmSqlBaseItem::CompareByCdsId(class CCmSqlBaseItem const &, class CCmSqlBaseItem const &)
+	?SecondaryText@CCmBaseListItem@@QBEAAVTDesC16@@XZ @ 218 NONAME ; class TDesC16 & CCmBaseListItem::SecondaryText(void) const
+	?InternalizeL@CCmSqlPropertyCollector@@QAEXAAVRReadStream@@@Z @ 219 NONAME ; void CCmSqlPropertyCollector::InternalizeL(class RReadStream &)
+	?NewLC@CCmDriveInfo@@SAPAV1@XZ @ 220 NONAME ; class CCmDriveInfo * CCmDriveInfo::NewLC(void)
+	?SetStoreUsage@CCmMediaServerFull@@QAEXH@Z @ 221 NONAME ; void CCmMediaServerFull::SetStoreUsage(int)
+	?AddExcAlbumL@CCmStoreRule@@QAEXABVTDesC16@@@Z @ 222 NONAME ; void CCmStoreRule::AddExcAlbumL(class TDesC16 const &)
+	??0CCmSqlPropertyItem@@QAE@ABV0@@Z @ 223 NONAME ; CCmSqlPropertyItem::CCmSqlPropertyItem(class CCmSqlPropertyItem const &)
+	?SetSecondaryTextL@CCmBaseListItem@@QAEXABVTDesC16@@@Z @ 224 NONAME ; void CCmBaseListItem::SetSecondaryTextL(class TDesC16 const &)
+	?SetUpnpProfileId@CCmSqlGenericItem@@QAEX_J@Z @ 225 NONAME ; void CCmSqlGenericItem::SetUpnpProfileId(long long)
+	?NewL@CCmStoreRuleContainer@@SAPAV1@XZ @ 226 NONAME ; class CCmStoreRuleContainer * CCmStoreRuleContainer::NewL(void)
+	?RemoveExcPlayList@CCmStoreRule@@QAEXABVTDesC16@@@Z @ 227 NONAME ; void CCmStoreRule::RemoveExcPlayList(class TDesC16 const &)
+	?NewResourceL@CCmSqlGenericItem@@QAEXABVTDesC8@@HHH_J@Z @ 228 NONAME ; void CCmSqlGenericItem::NewResourceL(class TDesC8 const &, int, int, int, long long)
+	?AddRuleL@CCmFillRule@@QAEHW4TCmMetadataField@@W4TCmOperatorType@@@Z @ 229 NONAME ; int CCmFillRule::AddRuleL(enum TCmMetadataField, enum TCmOperatorType)
+	?ListRealSizeInBytes@CCmFillRule@@QBEKXZ @ 230 NONAME ; unsigned long CCmFillRule::ListRealSizeInBytes(void) const
+	?SetDriveType@CCmDriveInfo@@QAEXI@Z @ 231 NONAME ; void CCmDriveInfo::SetDriveType(unsigned int)
+	?AddExcPlayListL@CCmStoreRule@@QAEXABVTDesC16@@@Z @ 232 NONAME ; void CCmStoreRule::AddExcPlayListL(class TDesC16 const &)
+	?ExternalizeL@CCmMediaServerFull@@QBEXAAVRWriteStream@@@Z @ 233 NONAME ; void CCmMediaServerFull::ExternalizeL(class RWriteStream &) const
+	?NewL@CCmStoreListItem@@SAPAV1@XZ @ 234 NONAME ; class CCmStoreListItem * CCmStoreListItem::NewL(void)
+	?SetDbId@CCmBaseListItem@@QAEX_K@Z @ 235 NONAME ; void CCmBaseListItem::SetDbId(unsigned long long)
+	?InternalizeL@CCmStoreListItem@@QAEXAAVRReadStream@@@Z @ 236 NONAME ; void CCmStoreListItem::InternalizeL(class RReadStream &)
+	?SetDuration@CCmSqlAudioItem@@QAEXH@Z @ 237 NONAME ; void CCmSqlAudioItem::SetDuration(int)
+	?ExternalizeL@CCmBaseListItem@@QBEXAAVRWriteStream@@@Z @ 238 NONAME ; void CCmBaseListItem::ExternalizeL(class RWriteStream &) const
+	?SetPrimaryTextL@CCmBaseListItem@@QAEXABVTDesC16@@@Z @ 239 NONAME ; void CCmBaseListItem::SetPrimaryTextL(class TDesC16 const &)
+	?SetDriveSize@CCmDriveInfo@@QAEX_J@Z @ 240 NONAME ; void CCmDriveInfo::SetDriveSize(long long)
+	?SetIsActive@CCmMediaServerFull@@QAEXE@Z @ 241 NONAME ; void CCmMediaServerFull::SetIsActive(unsigned char)
+	?ListId@CCmStoreRule@@QBEIXZ @ 242 NONAME ; unsigned int CCmStoreRule::ListId(void) const
+	?SetStartIndex@CCmSearchResponseHash@@QAEXH@Z @ 243 NONAME ; void CCmSearchResponseHash::SetStartIndex(int)
+	?ListId@CCmStoreListItem@@QBEIXZ @ 244 NONAME ; unsigned int CCmStoreListItem::ListId(void) const
+	?SetHarvestDate@CCmSqlGenericItem@@QAEXABVTTime@@@Z @ 245 NONAME ; void CCmSqlGenericItem::SetHarvestDate(class TTime const &)
+	?SetMediaType@CCmSqlGenericItem@@QAEXW4TCmMediaType@@@Z @ 246 NONAME ; void CCmSqlGenericItem::SetMediaType(enum TCmMediaType)
+	?SetAlbumId@CCmSqlAudioItem@@QAEX_J@Z @ 247 NONAME ; void CCmSqlAudioItem::SetAlbumId(long long)
+	?NewL@CCmFillRuleContainer@@SAPAV1@XZ @ 248 NONAME ; class CCmFillRuleContainer * CCmFillRuleContainer::NewL(void)
+	?InternalizeL@CCmMediaServerFull@@QAEXAAVRReadStream@@@Z @ 249 NONAME ; void CCmMediaServerFull::InternalizeL(class RReadStream &)
+	?ExternalizeL@CCmSqlPropertyItem@@QBEXAAVRWriteStream@@@Z @ 250 NONAME ; void CCmSqlPropertyItem::ExternalizeL(class RWriteStream &) const
+	?SetDescriptionL@CCmSqlImageItem@@QAEXABVTDesC8@@@Z @ 251 NONAME ; void CCmSqlImageItem::SetDescriptionL(class TDesC8 const &)
+	?AddMediaServerL@CCmFillRule@@QAEHH@Z @ 252 NONAME ; int CCmFillRule::AddMediaServerL(int)
+	?NewL@CCmMediaServer@@SAPAV1@XZ @ 253 NONAME ; class CCmMediaServer * CCmMediaServer::NewL(void)
+	?SetTitleL@CCmSqlGenericItem@@QAEXABVTDesC8@@@Z @ 254 NONAME ; void CCmSqlGenericItem::SetTitleL(class TDesC8 const &)
+	?ArtistId@CCmSqlAudioItem@@QBE_JXZ @ 255 NONAME ; long long CCmSqlAudioItem::ArtistId(void) const
+	?SetCopyCapability@CCmMediaServerFull@@QAEXH@Z @ 256 NONAME ; void CCmMediaServerFull::SetCopyCapability(int)
+	?SetDbId@CCmMediaServer@@QAEX_J@Z @ 257 NONAME ; void CCmMediaServer::SetDbId(long long)
+	?ExternalizeL@CCmSqlPropertyCollector@@QBEXAAVRWriteStream@@@Z @ 258 NONAME ; void CCmSqlPropertyCollector::ExternalizeL(class RWriteStream &) const
+	?DeletePropertyItem@CCmSqlPropertyContainer@@QAEXH@Z @ 259 NONAME ; void CCmSqlPropertyContainer::DeletePropertyItem(int)
+	?ResolutionId@CCmSqlImageItem@@QBE_JXZ @ 260 NONAME ; long long CCmSqlImageItem::ResolutionId(void) const
+	?Priority@CCmFillRule@@QBEEXZ @ 261 NONAME ; unsigned char CCmFillRule::Priority(void) const
+	?SetGenreId@CCmSqlVideoItem@@QAEX_J@Z @ 262 NONAME ; void CCmSqlVideoItem::SetGenreId(long long)
+	?ParamCountL@CCmFillRule@@QBEHH@Z @ 263 NONAME ; int CCmFillRule::ParamCountL(int) const
+	?NewL@CCmSqlImageItem@@SAPAV1@XZ @ 264 NONAME ; class CCmSqlImageItem * CCmSqlImageItem::NewL(void)
+	?NewL@CCmSqlAudioItem@@SAPAV1@XZ @ 265 NONAME ; class CCmSqlAudioItem * CCmSqlAudioItem::NewL(void)
+	?SetStatus@CCmStoreRule@@QAEXW4TCmListItemStatus@@@Z @ 266 NONAME ; void CCmStoreRule::SetStatus(enum TCmListItemStatus)
+	?PropertyContainer@CCmSqlPropertyCollector@@QAEPAVCCmSqlPropertyContainer@@H@Z @ 267 NONAME ; class CCmSqlPropertyContainer * CCmSqlPropertyCollector::PropertyContainer(int)
+	??1CCmStoreRule@@UAE@XZ @ 268 NONAME ; CCmStoreRule::~CCmStoreRule(void)
+	??1CCmStoreListItem@@UAE@XZ @ 269 NONAME ; CCmStoreListItem::~CCmStoreListItem(void)
+	?SetBitrate@CCmSqlAudioItem@@QAEXH@Z @ 270 NONAME ; void CCmSqlAudioItem::SetBitrate(int)
+	?StatusValues@CCmStoreListItem@@QBE?AV?$RArray@W4TCmListItemStatus@@@@XZ @ 271 NONAME ; class RArray<enum TCmListItemStatus> CCmStoreListItem::StatusValues(void) const
+	?NewLC@CCmStoreRuleContainer@@SAPAV1@XZ @ 272 NONAME ; class CCmStoreRuleContainer * CCmStoreRuleContainer::NewLC(void)
+	?NewL@CCmMediaServerFull@@SAPAV1@XZ @ 273 NONAME ; class CCmMediaServerFull * CCmMediaServerFull::NewL(void)
+	?NewLC@CCmFillListItem@@SAPAV1@XZ @ 274 NONAME ; class CCmFillListItem * CCmFillListItem::NewLC(void)
+	?GenreId@CCmSqlAudioItem@@QBE_JXZ @ 275 NONAME ; long long CCmSqlAudioItem::GenreId(void) const
+	?DriveType@CCmDriveInfo@@QBEIXZ @ 276 NONAME ; unsigned int CCmDriveInfo::DriveType(void) const
+	??1CCmFillListItem@@UAE@XZ @ 277 NONAME ; CCmFillListItem::~CCmFillListItem(void)
+	?MediaServer@CCmMediaServer@@QBEABVTDesC8@@XZ @ 278 NONAME ; class TDesC8 const & CCmMediaServer::MediaServer(void) const
+	??1CCmSqlResolutionPropertyItem@@UAE@XZ @ 279 NONAME ; CCmSqlResolutionPropertyItem::~CCmSqlResolutionPropertyItem(void)
+	?AddStoreRuleL@CCmStoreRule@@QAEHW4TCmMediaType@@@Z @ 280 NONAME ; int CCmStoreRule::AddStoreRuleL(enum TCmMediaType)
+	?DriveName@CCmDriveInfo@@QBEAAVTDesC16@@XZ @ 281 NONAME ; class TDesC16 & CCmDriveInfo::DriveName(void) const
+	?NewL@CCmBaseListItem@@SAPAV1@XZ @ 282 NONAME ; class CCmBaseListItem * CCmBaseListItem::NewL(void)
+	?Name@CCmStoreRule@@QBEAAVTDesC8@@XZ @ 283 NONAME ; class TDesC8 & CCmStoreRule::Name(void) const
+	?NewL@CCmStoreRule@@SAPAV1@XZ @ 284 NONAME ; class CCmStoreRule * CCmStoreRule::NewL(void)
+	??1CCmSqlGenericItem@@UAE@XZ @ 285 NONAME ; CCmSqlGenericItem::~CCmSqlGenericItem(void)
+	?RefId@CCmBaseListItem@@QBE_KXZ @ 286 NONAME ; unsigned long long CCmBaseListItem::RefId(void) const
+	?SetNameL@CCmStoreRule@@QAEXABVTDesC8@@@Z @ 287 NONAME ; void CCmStoreRule::SetNameL(class TDesC8 const &)
+	?AddMediaServerL@CCmStoreRule@@QAEHABVTDesC8@@@Z @ 288 NONAME ; int CCmStoreRule::AddMediaServerL(class TDesC8 const &)
+	?NewL@CCmSqlGenericItem@@SAPAV1@XZ @ 289 NONAME ; class CCmSqlGenericItem * CCmSqlGenericItem::NewL(void)
+	?NewLC@CCmSqlAudioItem@@SAPAV1@XZ @ 290 NONAME ; class CCmSqlAudioItem * CCmSqlAudioItem::NewLC(void)
+	?SetStatus@CCmBaseListItem@@QAEXW4TCmListItemStatus@@@Z @ 291 NONAME ; void CCmBaseListItem::SetStatus(enum TCmListItemStatus)
+	?Status@CCmFillRule@@QBE?AW4TCmListItemStatus@@XZ @ 292 NONAME ; enum TCmListItemStatus CCmFillRule::Status(void) const
+	??1CCmSqlImageItem@@UAE@XZ @ 293 NONAME ; CCmSqlImageItem::~CCmSqlImageItem(void)
+	?RuleParamL@CCmFillRule@@QAEXHHAAH@Z @ 294 NONAME ; void CCmFillRule::RuleParamL(int, int, int &)
+	?SetListId@CCmStoreListItem@@QAEXI@Z @ 295 NONAME ; void CCmStoreListItem::SetListId(unsigned int)
+	?MediaType@CCmBaseListItem@@QBE?AW4TCmMediaType@@XZ @ 296 NONAME ; enum TCmMediaType CCmBaseListItem::MediaType(void) const
+	?InternalizeL@CCmSqlPropertyContainer@@QAEXAAVRReadStream@@@Z @ 297 NONAME ; void CCmSqlPropertyContainer::InternalizeL(class RReadStream &)
+	?DriveId@CCmFillListItem@@QBEIXZ @ 298 NONAME ; unsigned int CCmFillListItem::DriveId(void) const
+	?SetWlanScanL@CmCommonUtils@@SAXH@Z @ 299 NONAME ; void CmCommonUtils::SetWlanScanL(int)
+	?PixelCount@CCmSqlResolutionPropertyItem@@QBEHXZ @ 300 NONAME ; int CCmSqlResolutionPropertyItem::PixelCount(void) const
+	?ListRealCount@CCmFillRule@@QBEKXZ @ 301 NONAME ; unsigned long CCmFillRule::ListRealCount(void) const
+	?SetListId@CCmFillRule@@QAEXI@Z @ 302 NONAME ; void CCmFillRule::SetListId(unsigned int)
+	?GenreId@CCmSqlVideoItem@@QBE_JXZ @ 303 NONAME ; long long CCmSqlVideoItem::GenreId(void) const
+	?FillRuleCount@CCmFillRuleContainer@@QBEHXZ @ 304 NONAME ; int CCmFillRuleContainer::FillRuleCount(void) const
+	??1CCmDriveInfo@@UAE@XZ @ 305 NONAME ; CCmDriveInfo::~CCmDriveInfo(void)
+	?SetDriveId@CCmDriveInfo@@QAEXI@Z @ 306 NONAME ; void CCmDriveInfo::SetDriveId(unsigned int)
+	?RuleL@CCmFillRule@@QAEXHPAW4TCmMetadataField@@PAW4TCmOperatorType@@PAH@Z @ 307 NONAME ; void CCmFillRule::RuleL(int, enum TCmMetadataField *, enum TCmOperatorType *, int *)
+	??1CCmSqlVideoItem@@UAE@XZ @ 308 NONAME ; CCmSqlVideoItem::~CCmSqlVideoItem(void)
+	?SetStatus@CCmSqlPropertyItem@@QAEXH@Z @ 309 NONAME ; void CCmSqlPropertyItem::SetStatus(int)
+	?SetSize@CCmSqlGenericItem@@QAEXH@Z @ 310 NONAME ; void CCmSqlGenericItem::SetSize(int)
+	?SetSystemUpdateID@CCmMediaServer@@QAEXH@Z @ 311 NONAME ; void CCmMediaServer::SetSystemUpdateID(int)
+	?RemoveExcAlbum@CCmFillRule@@QAEXABVTDesC16@@@Z @ 312 NONAME ; void CCmFillRule::RemoveExcAlbum(class TDesC16 const &)
+	?StoreRule@CCmStoreRuleContainer@@QAEPAVCCmStoreRule@@H@Z @ 313 NONAME ; class CCmStoreRule * CCmStoreRuleContainer::StoreRule(int)
+	?Path@CCmBaseListItem@@QBEAAVTDesC16@@XZ @ 314 NONAME ; class TDesC16 & CCmBaseListItem::Path(void) const
+	?CdsId@CCmSqlBaseItem@@QBEAAVTDesC8@@XZ @ 315 NONAME ; class TDesC8 & CCmSqlBaseItem::CdsId(void) const
+	?ExternalizeL@CCmFillRuleContainer@@QBEXAAVRWriteStream@@@Z @ 316 NONAME ; void CCmFillRuleContainer::ExternalizeL(class RWriteStream &) const
+	?SetListId@CCmStoreRule@@QAEXI@Z @ 317 NONAME ; void CCmStoreRule::SetListId(unsigned int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/eabi/cmcommonu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,396 @@
+EXPORTS
+	_ZN11CCmFillRule10DeleteRuleE16TCmMetadataField @ 1 NONAME
+	_ZN11CCmFillRule10DeleteRuleE16TCmMetadataField15TCmOperatorType @ 2 NONAME
+	_ZN11CCmFillRule10RuleParamLEiiP6TPtrC8 @ 3 NONAME
+	_ZN11CCmFillRule10RuleParamLEiiRi @ 4 NONAME
+	_ZN11CCmFillRule11SetPriorityEh @ 5 NONAME
+	_ZN11CCmFillRule11SetSelectedE17TCmFillRuleStatus @ 6 NONAME
+	_ZN11CCmFillRule12AddExcAlbumLERK7TDesC16 @ 7 NONAME
+	_ZN11CCmFillRule12MediaServerLEi @ 8 NONAME
+	_ZN11CCmFillRule12MediaServerLEiRi @ 9 NONAME
+	_ZN11CCmFillRule12SetLimitTypeE12TCmLimitType @ 10 NONAME
+	_ZN11CCmFillRule12SetMediaTypeE12TCmMediaType @ 11 NONAME
+	_ZN11CCmFillRule13AddRuleParamLEiRK6TDesC8 @ 12 NONAME
+	_ZN11CCmFillRule13AddRuleParamLEii @ 13 NONAME
+	_ZN11CCmFillRule13SetTemplateIdEh @ 14 NONAME
+	_ZN11CCmFillRule14RemoveExcAlbumERK7TDesC16 @ 15 NONAME
+	_ZN11CCmFillRule15AddExcPlayListLERK7TDesC16 @ 16 NONAME
+	_ZN11CCmFillRule15AddMediaServerLERK6TDesC8 @ 17 NONAME
+	_ZN11CCmFillRule15AddMediaServerLEi @ 18 NONAME
+	_ZN11CCmFillRule16SetListRealCountEm @ 19 NONAME
+	_ZN11CCmFillRule17DeleteMediaServerERK6TDesC8 @ 20 NONAME
+	_ZN11CCmFillRule17DeleteMediaServerEi @ 21 NONAME
+	_ZN11CCmFillRule17RemoveExcPlayListERK7TDesC16 @ 22 NONAME
+	_ZN11CCmFillRule22SetListRealSizeInBytesEm @ 23 NONAME
+	_ZN11CCmFillRule4NewLEv @ 24 NONAME
+	_ZN11CCmFillRule5NewLCEv @ 25 NONAME
+	_ZN11CCmFillRule5RuleLEiP16TCmMetadataFieldP15TCmOperatorTypePi @ 26 NONAME
+	_ZN11CCmFillRule8AddRuleLE16TCmMetadataField15TCmOperatorType @ 27 NONAME
+	_ZN11CCmFillRule8SetNameLERK6TDesC8 @ 28 NONAME
+	_ZN11CCmFillRule9SetAmountEm @ 29 NONAME
+	_ZN11CCmFillRule9SetListIdEj @ 30 NONAME
+	_ZN11CCmFillRule9SetMethodE13TCmFillMethod @ 31 NONAME
+	_ZN11CCmFillRule9SetStatusE17TCmListItemStatus @ 32 NONAME
+	_ZN11CCmFillRuleD0Ev @ 33 NONAME
+	_ZN11CCmFillRuleD1Ev @ 34 NONAME
+	_ZN11CCmFillRuleD2Ev @ 35 NONAME
+	_ZN12CCmDriveInfo10SetDriveIdEj @ 36 NONAME
+	_ZN12CCmDriveInfo12InternalizeLER11RReadStream @ 37 NONAME
+	_ZN12CCmDriveInfo12SetDriveSizeEx @ 38 NONAME
+	_ZN12CCmDriveInfo12SetDriveTypeEj @ 39 NONAME
+	_ZN12CCmDriveInfo13SetDriveNameLERK7TDesC16 @ 40 NONAME
+	_ZN12CCmDriveInfo13SetDriveQuotaEx @ 41 NONAME
+	_ZN12CCmDriveInfo14SetDriveNumberEi @ 42 NONAME
+	_ZN12CCmDriveInfo17SetUsedDriveQuotaEx @ 43 NONAME
+	_ZN12CCmDriveInfo4NewLEv @ 44 NONAME
+	_ZN12CCmDriveInfo5NewLCEv @ 45 NONAME
+	_ZN12CCmDriveInfo9SetStatusEi @ 46 NONAME
+	_ZN12CCmDriveInfoD0Ev @ 47 NONAME
+	_ZN12CCmDriveInfoD1Ev @ 48 NONAME
+	_ZN12CCmDriveInfoD2Ev @ 49 NONAME
+	_ZN12CCmStoreRule11SetSelectedE17TCmFillRuleStatus @ 50 NONAME
+	_ZN12CCmStoreRule12AddExcAlbumLERK7TDesC16 @ 51 NONAME
+	_ZN12CCmStoreRule12ExcPlayListsEv @ 52 NONAME
+	_ZN12CCmStoreRule12MediaServerLEi @ 53 NONAME
+	_ZN12CCmStoreRule13AddStoreRuleLE12TCmMediaType @ 54 NONAME
+	_ZN12CCmStoreRule14RemoveExcAlbumERK7TDesC16 @ 55 NONAME
+	_ZN12CCmStoreRule15AddExcPlayListLERK7TDesC16 @ 56 NONAME
+	_ZN12CCmStoreRule15AddMediaServerLERK6TDesC8 @ 57 NONAME
+	_ZN12CCmStoreRule17DeleteMediaServerERK6TDesC8 @ 58 NONAME
+	_ZN12CCmStoreRule17RemoveExcPlayListERK7TDesC16 @ 59 NONAME
+	_ZN12CCmStoreRule4NewLEv @ 60 NONAME
+	_ZN12CCmStoreRule5NewLCEv @ 61 NONAME
+	_ZN12CCmStoreRule8SetNameLERK6TDesC8 @ 62 NONAME
+	_ZN12CCmStoreRule9ExcAlbumsEv @ 63 NONAME
+	_ZN12CCmStoreRule9SetListIdEj @ 64 NONAME
+	_ZN12CCmStoreRule9SetStatusE17TCmListItemStatus @ 65 NONAME
+	_ZN12CCmStoreRule9StoreRuleEiP12TCmMediaType @ 66 NONAME
+	_ZN12CCmStoreRuleD0Ev @ 67 NONAME
+	_ZN12CCmStoreRuleD1Ev @ 68 NONAME
+	_ZN12CCmStoreRuleD2Ev @ 69 NONAME
+	_ZN13CmCommonUtils12SetWlanScanLEi @ 70 NONAME
+	_ZN13CmCommonUtils17LoadResourceFileLERK7TDesC16R9CEikonEnv @ 71 NONAME
+	_ZN14CCmMediaServer17SetSystemUpdateIDEi @ 72 NONAME
+	_ZN14CCmMediaServer4NewLEv @ 73 NONAME
+	_ZN14CCmMediaServer5NewLCEv @ 74 NONAME
+	_ZN14CCmMediaServer7SetDbIdEx @ 75 NONAME
+	_ZN14CCmMediaServer7SetUDNLERK6TDesC8 @ 76 NONAME
+	_ZN14CCmSqlBaseItem11SetSearchIdEx @ 77 NONAME
+	_ZN14CCmSqlBaseItem13CompareByHashERKS_S1_ @ 78 NONAME
+	_ZN14CCmSqlBaseItem14CompareByCdsIdERKS_S1_ @ 79 NONAME
+	_ZN14CCmSqlBaseItem4NewLEv @ 80 NONAME
+	_ZN14CCmSqlBaseItem5NewLCEv @ 81 NONAME
+	_ZN14CCmSqlBaseItem5SetIdEx @ 82 NONAME
+	_ZN14CCmSqlBaseItem8SetHashLERK7TDesC16 @ 83 NONAME
+	_ZN14CCmSqlBaseItem9SetCdsIdLERK6TDesC8 @ 84 NONAME
+	_ZN14CCmSqlBaseItemD0Ev @ 85 NONAME
+	_ZN14CCmSqlBaseItemD1Ev @ 86 NONAME
+	_ZN14CCmSqlBaseItemD2Ev @ 87 NONAME
+	_ZN15CCmBaseListItem12InternalizeLER11RReadStream @ 88 NONAME
+	_ZN15CCmBaseListItem12SetMediaTypeE12TCmMediaType @ 89 NONAME
+	_ZN15CCmBaseListItem15SetPrimaryTextLERK7TDesC16 @ 90 NONAME
+	_ZN15CCmBaseListItem17SetSecondaryTextLERK7TDesC16 @ 91 NONAME
+	_ZN15CCmBaseListItem4NewLEv @ 92 NONAME
+	_ZN15CCmBaseListItem5NewLCEv @ 93 NONAME
+	_ZN15CCmBaseListItem7SetDateE5TTime @ 94 NONAME
+	_ZN15CCmBaseListItem7SetDbIdEy @ 95 NONAME
+	_ZN15CCmBaseListItem7SetSizeEm @ 96 NONAME
+	_ZN15CCmBaseListItem8SetPathLERK7TDesC16 @ 97 NONAME
+	_ZN15CCmBaseListItem8SetRefIdEy @ 98 NONAME
+	_ZN15CCmBaseListItem9SetStatusE17TCmListItemStatus @ 99 NONAME
+	_ZN15CCmBaseListItemD0Ev @ 100 NONAME
+	_ZN15CCmBaseListItemD1Ev @ 101 NONAME
+	_ZN15CCmBaseListItemD2Ev @ 102 NONAME
+	_ZN15CCmFillListItem10SetDriveIdEj @ 103 NONAME
+	_ZN15CCmFillListItem10SetItemIdLERK6TDesC8 @ 104 NONAME
+	_ZN15CCmFillListItem11SetPriorityEh @ 105 NONAME
+	_ZN15CCmFillListItem11SetSelectedE17TCmFillRuleStatus @ 106 NONAME
+	_ZN15CCmFillListItem12InternalizeLER11RReadStream @ 107 NONAME
+	_ZN15CCmFillListItem13SetUpnpClassLERK7TDesC16 @ 108 NONAME
+	_ZN15CCmFillListItem14SetDriveNumberEi @ 109 NONAME
+	_ZN15CCmFillListItem4NewLEv @ 110 NONAME
+	_ZN15CCmFillListItem5NewLCEjjj17TCmFillRuleStatus @ 111 NONAME
+	_ZN15CCmFillListItem5NewLCEv @ 112 NONAME
+	_ZN15CCmFillListItem7SetUriLERK6TDesC8 @ 113 NONAME
+	_ZN15CCmFillListItem8SetDevIdEh @ 114 NONAME
+	_ZN15CCmFillListItem9SetListIdEj @ 115 NONAME
+	_ZN15CCmFillListItemD0Ev @ 116 NONAME
+	_ZN15CCmFillListItemD1Ev @ 117 NONAME
+	_ZN15CCmFillListItemD2Ev @ 118 NONAME
+	_ZN15CCmSqlAudioItem10SetAlbumIdEx @ 119 NONAME
+	_ZN15CCmSqlAudioItem10SetBitrateEi @ 120 NONAME
+	_ZN15CCmSqlAudioItem10SetGenreIdEx @ 121 NONAME
+	_ZN15CCmSqlAudioItem11SetArtistIdEx @ 122 NONAME
+	_ZN15CCmSqlAudioItem11SetDurationEi @ 123 NONAME
+	_ZN15CCmSqlAudioItem14SetTrackNumberEi @ 124 NONAME
+	_ZN15CCmSqlAudioItem15SetAlbumArtUriLERK6TDesC8 @ 125 NONAME
+	_ZN15CCmSqlAudioItem4NewLEv @ 126 NONAME
+	_ZN15CCmSqlAudioItem5NewLCEv @ 127 NONAME
+	_ZN15CCmSqlAudioItemD0Ev @ 128 NONAME
+	_ZN15CCmSqlAudioItemD1Ev @ 129 NONAME
+	_ZN15CCmSqlAudioItemD2Ev @ 130 NONAME
+	_ZN15CCmSqlImageItem15SetDescriptionLERK6TDesC8 @ 131 NONAME
+	_ZN15CCmSqlImageItem15SetResolutionIdEx @ 132 NONAME
+	_ZN15CCmSqlImageItem4NewLEv @ 133 NONAME
+	_ZN15CCmSqlImageItem5NewLCEv @ 134 NONAME
+	_ZN15CCmSqlImageItemD0Ev @ 135 NONAME
+	_ZN15CCmSqlImageItemD1Ev @ 136 NONAME
+	_ZN15CCmSqlImageItemD2Ev @ 137 NONAME
+	_ZN15CCmSqlVideoItem10SetGenreIdEx @ 138 NONAME
+	_ZN15CCmSqlVideoItem4NewLEv @ 139 NONAME
+	_ZN15CCmSqlVideoItem5NewLCEv @ 140 NONAME
+	_ZN15CCmSqlVideoItemD0Ev @ 141 NONAME
+	_ZN15CCmSqlVideoItemD1Ev @ 142 NONAME
+	_ZN15CCmSqlVideoItemD2Ev @ 143 NONAME
+	_ZN16CCmStoreListItem12InternalizeLER11RReadStream @ 144 NONAME
+	_ZN16CCmStoreListItem17UpdateFileStatusLEh17TCmListItemStatus @ 145 NONAME
+	_ZN16CCmStoreListItem4NewLEv @ 146 NONAME
+	_ZN16CCmStoreListItem5NewLCEv @ 147 NONAME
+	_ZN16CCmStoreListItem8SetDevIdEh17TCmListItemStatus @ 148 NONAME
+	_ZN16CCmStoreListItem9SetListIdEj @ 149 NONAME
+	_ZN16CCmStoreListItemD0Ev @ 150 NONAME
+	_ZN16CCmStoreListItemD1Ev @ 151 NONAME
+	_ZN16CCmStoreListItemD2Ev @ 152 NONAME
+	_ZN17CCmSqlGenericItem11GetResourceER6TDesC8RiS2_S2_Rxi @ 153 NONAME
+	_ZN17CCmSqlGenericItem12NewResourceLERK6TDesC8iiix @ 154 NONAME
+	_ZN17CCmSqlGenericItem12SetMediaTypeE12TCmMediaType @ 155 NONAME
+	_ZN17CCmSqlGenericItem14SetHarvestDateERK5TTime @ 156 NONAME
+	_ZN17CCmSqlGenericItem14SetUpnpclassIdEx @ 157 NONAME
+	_ZN17CCmSqlGenericItem16SetUpnpProfileIdEx @ 158 NONAME
+	_ZN17CCmSqlGenericItem4NewLEv @ 159 NONAME
+	_ZN17CCmSqlGenericItem5NewLCEv @ 160 NONAME
+	_ZN17CCmSqlGenericItem7SetDateERK5TTime @ 161 NONAME
+	_ZN17CCmSqlGenericItem7SetSizeEi @ 162 NONAME
+	_ZN17CCmSqlGenericItem7SetUriLERK6TDesC8 @ 163 NONAME
+	_ZN17CCmSqlGenericItem9SetTitleLERK6TDesC8 @ 164 NONAME
+	_ZN17CCmSqlGenericItemD0Ev @ 165 NONAME
+	_ZN17CCmSqlGenericItemD1Ev @ 166 NONAME
+	_ZN17CCmSqlGenericItemD2Ev @ 167 NONAME
+	_ZN18CCmMediaServerFull10StoreUsageEv @ 168 NONAME
+	_ZN18CCmMediaServerFull11SetIsActiveEh @ 169 NONAME
+	_ZN18CCmMediaServerFull12InternalizeLER11RReadStream @ 170 NONAME
+	_ZN18CCmMediaServerFull12SetFillUsageEi @ 171 NONAME
+	_ZN18CCmMediaServerFull13SetStoreUsageEi @ 172 NONAME
+	_ZN18CCmMediaServerFull14SetVisibleDateE5TTime @ 173 NONAME
+	_ZN18CCmMediaServerFull17SetCopyCapabilityEi @ 174 NONAME
+	_ZN18CCmMediaServerFull19SetMediaServerNameLERK6TDesC8 @ 175 NONAME
+	_ZN18CCmMediaServerFull4NewLEv @ 176 NONAME
+	_ZN18CCmMediaServerFull5NewLCEv @ 177 NONAME
+	_ZN18CCmMediaServerFull9FillUsageEv @ 178 NONAME
+	_ZN18CCmMediaServerFullD0Ev @ 179 NONAME
+	_ZN18CCmMediaServerFullD1Ev @ 180 NONAME
+	_ZN18CCmMediaServerFullD2Ev @ 181 NONAME
+	_ZN18CCmSqlPropertyItem12InternalizeLER11RReadStream @ 182 NONAME
+	_ZN18CCmSqlPropertyItem18CompareItemsByNameERKS_S1_ @ 183 NONAME
+	_ZN18CCmSqlPropertyItem4NewLEv @ 184 NONAME
+	_ZN18CCmSqlPropertyItem5NewLCEv @ 185 NONAME
+	_ZN18CCmSqlPropertyItem5SetIdEx @ 186 NONAME
+	_ZN18CCmSqlPropertyItem8SetNameLERK6TDesC8 @ 187 NONAME
+	_ZN18CCmSqlPropertyItem9SetStatusEi @ 188 NONAME
+	_ZN18CCmSqlPropertyItemC1ERKS_ @ 189 NONAME
+	_ZN18CCmSqlPropertyItemC2ERKS_ @ 190 NONAME
+	_ZN18CCmSqlPropertyItemD0Ev @ 191 NONAME
+	_ZN18CCmSqlPropertyItemD1Ev @ 192 NONAME
+	_ZN18CCmSqlPropertyItemD2Ev @ 193 NONAME
+	_ZN20CCmFillRuleContainer12AddFillRuleLEP11CCmFillRule @ 194 NONAME
+	_ZN20CCmFillRuleContainer12InternalizeLER11RReadStream @ 195 NONAME
+	_ZN20CCmFillRuleContainer14DeleteFillRuleEi @ 196 NONAME
+	_ZN20CCmFillRuleContainer4NewLEv @ 197 NONAME
+	_ZN20CCmFillRuleContainer5NewLCEv @ 198 NONAME
+	_ZN20CCmFillRuleContainerD0Ev @ 199 NONAME
+	_ZN20CCmFillRuleContainerD1Ev @ 200 NONAME
+	_ZN20CCmFillRuleContainerD2Ev @ 201 NONAME
+	_ZN21CCmSearchResponseHash12SetItemCountEi @ 202 NONAME
+	_ZN21CCmSearchResponseHash13SetStartIndexEi @ 203 NONAME
+	_ZN21CCmSearchResponseHash4NewLEiiRK6TDesC8 @ 204 NONAME
+	_ZN21CCmSearchResponseHash4NewLEv @ 205 NONAME
+	_ZN21CCmSearchResponseHash8SetHashLERK6TDesC8 @ 206 NONAME
+	_ZN21CCmStoreRuleContainer12InternalizeLER11RReadStream @ 207 NONAME
+	_ZN21CCmStoreRuleContainer13AddStoreRuleLEP12CCmStoreRule @ 208 NONAME
+	_ZN21CCmStoreRuleContainer15DeleteStoreRuleEi @ 209 NONAME
+	_ZN21CCmStoreRuleContainer4NewLEv @ 210 NONAME
+	_ZN21CCmStoreRuleContainer5NewLCEv @ 211 NONAME
+	_ZN21CCmStoreRuleContainer9StoreRuleEi @ 212 NONAME
+	_ZN21CCmStoreRuleContainerD0Ev @ 213 NONAME
+	_ZN21CCmStoreRuleContainerD1Ev @ 214 NONAME
+	_ZN21CCmStoreRuleContainerD2Ev @ 215 NONAME
+	_ZN23CCmSqlPropertyCollector12InternalizeLER11RReadStream @ 216 NONAME
+	_ZN23CCmSqlPropertyCollector17PropertyContainerEi @ 217 NONAME
+	_ZN23CCmSqlPropertyCollector21AddPropertyContainerLEP23CCmSqlPropertyContainer @ 218 NONAME
+	_ZN23CCmSqlPropertyCollector23DeletePropertyContainerEi @ 219 NONAME
+	_ZN23CCmSqlPropertyCollector4NewLEv @ 220 NONAME
+	_ZN23CCmSqlPropertyCollector5NewLCEv @ 221 NONAME
+	_ZN23CCmSqlPropertyCollectorD0Ev @ 222 NONAME
+	_ZN23CCmSqlPropertyCollectorD1Ev @ 223 NONAME
+	_ZN23CCmSqlPropertyCollectorD2Ev @ 224 NONAME
+	_ZN23CCmSqlPropertyContainer11IsDuplicateER18CCmSqlPropertyItem @ 225 NONAME
+	_ZN23CCmSqlPropertyContainer12InternalizeLER11RReadStream @ 226 NONAME
+	_ZN23CCmSqlPropertyContainer12PropertyItemEi @ 227 NONAME
+	_ZN23CCmSqlPropertyContainer16AddPropertyItemLEP18CCmSqlPropertyItem @ 228 NONAME
+	_ZN23CCmSqlPropertyContainer16SortPropertyItemEv @ 229 NONAME
+	_ZN23CCmSqlPropertyContainer18DeletePropertyItemEi @ 230 NONAME
+	_ZN23CCmSqlPropertyContainer4NewLEv @ 231 NONAME
+	_ZN23CCmSqlPropertyContainer4TypeEv @ 232 NONAME
+	_ZN23CCmSqlPropertyContainer5NewLCEv @ 233 NONAME
+	_ZN23CCmSqlPropertyContainer7SetTypeE16TCmMetadataField @ 234 NONAME
+	_ZN23CCmSqlPropertyContainerD0Ev @ 235 NONAME
+	_ZN23CCmSqlPropertyContainerD1Ev @ 236 NONAME
+	_ZN23CCmSqlPropertyContainerD2Ev @ 237 NONAME
+	_ZN28CCmSqlResolutionPropertyItem12InternalizeLER11RReadStream @ 238 NONAME
+	_ZN28CCmSqlResolutionPropertyItem13SetPixelCountEi @ 239 NONAME
+	_ZN28CCmSqlResolutionPropertyItem18CompareItemsByNameERKS_S1_ @ 240 NONAME
+	_ZN28CCmSqlResolutionPropertyItem4NewLEv @ 241 NONAME
+	_ZN28CCmSqlResolutionPropertyItem5NewLCEv @ 242 NONAME
+	_ZN28CCmSqlResolutionPropertyItem8SetWidthEi @ 243 NONAME
+	_ZN28CCmSqlResolutionPropertyItem9SetHeightEi @ 244 NONAME
+	_ZN28CCmSqlResolutionPropertyItemD0Ev @ 245 NONAME
+	_ZN28CCmSqlResolutionPropertyItemD1Ev @ 246 NONAME
+	_ZN28CCmSqlResolutionPropertyItemD2Ev @ 247 NONAME
+	_ZNK11CCmFillRule10TemplateIdEv @ 248 NONAME
+	_ZNK11CCmFillRule11ParamCountLEi @ 249 NONAME
+	_ZNK11CCmFillRule12ExcPlayListsEv @ 250 NONAME
+	_ZNK11CCmFillRule13ListRealCountEv @ 251 NONAME
+	_ZNK11CCmFillRule16MediaServerCountEv @ 252 NONAME
+	_ZNK11CCmFillRule19ListRealSizeInBytesEv @ 253 NONAME
+	_ZNK11CCmFillRule4NameEv @ 254 NONAME
+	_ZNK11CCmFillRule6AmountEv @ 255 NONAME
+	_ZNK11CCmFillRule6ListIdEv @ 256 NONAME
+	_ZNK11CCmFillRule6MethodEv @ 257 NONAME
+	_ZNK11CCmFillRule6StatusEv @ 258 NONAME
+	_ZNK11CCmFillRule8PriorityEv @ 259 NONAME
+	_ZNK11CCmFillRule8SelectedEv @ 260 NONAME
+	_ZNK11CCmFillRule9ExcAlbumsEv @ 261 NONAME
+	_ZNK11CCmFillRule9LimitTypeEv @ 262 NONAME
+	_ZNK11CCmFillRule9MediaTypeEv @ 263 NONAME
+	_ZNK11CCmFillRule9RuleCountEv @ 264 NONAME
+	_ZNK12CCmDriveInfo10DriveQuotaEv @ 265 NONAME
+	_ZNK12CCmDriveInfo11DriveNumberEv @ 266 NONAME
+	_ZNK12CCmDriveInfo12ExternalizeLER12RWriteStream @ 267 NONAME
+	_ZNK12CCmDriveInfo14UsedDriveQuotaEv @ 268 NONAME
+	_ZNK12CCmDriveInfo6StatusEv @ 269 NONAME
+	_ZNK12CCmDriveInfo7DriveIdEv @ 270 NONAME
+	_ZNK12CCmDriveInfo9DriveNameEv @ 271 NONAME
+	_ZNK12CCmDriveInfo9DriveSizeEv @ 272 NONAME
+	_ZNK12CCmDriveInfo9DriveTypeEv @ 273 NONAME
+	_ZNK12CCmStoreRule16MediaServerCountEv @ 274 NONAME
+	_ZNK12CCmStoreRule4NameEv @ 275 NONAME
+	_ZNK12CCmStoreRule6ListIdEv @ 276 NONAME
+	_ZNK12CCmStoreRule6StatusEv @ 277 NONAME
+	_ZNK12CCmStoreRule8DefCountEv @ 278 NONAME
+	_ZNK12CCmStoreRule8SelectedEv @ 279 NONAME
+	_ZNK14CCmMediaServer11MediaServerEv @ 280 NONAME
+	_ZNK14CCmMediaServer14SystemUpdateIDEv @ 281 NONAME
+	_ZNK14CCmMediaServer4DbIdEv @ 282 NONAME
+	_ZNK14CCmSqlBaseItem2IdEv @ 283 NONAME
+	_ZNK14CCmSqlBaseItem4HashEv @ 284 NONAME
+	_ZNK14CCmSqlBaseItem5CdsIdEv @ 285 NONAME
+	_ZNK14CCmSqlBaseItem8SearchIdEv @ 286 NONAME
+	_ZNK15CCmBaseListItem11PrimaryTextEv @ 287 NONAME
+	_ZNK15CCmBaseListItem12ExternalizeLER12RWriteStream @ 288 NONAME
+	_ZNK15CCmBaseListItem13SecondaryTextEv @ 289 NONAME
+	_ZNK15CCmBaseListItem4DateEv @ 290 NONAME
+	_ZNK15CCmBaseListItem4DbIdEv @ 291 NONAME
+	_ZNK15CCmBaseListItem4PathEv @ 292 NONAME
+	_ZNK15CCmBaseListItem4SizeEv @ 293 NONAME
+	_ZNK15CCmBaseListItem5RefIdEv @ 294 NONAME
+	_ZNK15CCmBaseListItem6StatusEv @ 295 NONAME
+	_ZNK15CCmBaseListItem9MediaTypeEv @ 296 NONAME
+	_ZNK15CCmFillListItem11DriveNumberEv @ 297 NONAME
+	_ZNK15CCmFillListItem12ExternalizeLER12RWriteStream @ 298 NONAME
+	_ZNK15CCmFillListItem3UriEv @ 299 NONAME
+	_ZNK15CCmFillListItem5DevIdEv @ 300 NONAME
+	_ZNK15CCmFillListItem6ItemIdEv @ 301 NONAME
+	_ZNK15CCmFillListItem6ListIdEv @ 302 NONAME
+	_ZNK15CCmFillListItem7DriveIdEv @ 303 NONAME
+	_ZNK15CCmFillListItem8PriorityEv @ 304 NONAME
+	_ZNK15CCmFillListItem8SelectedEv @ 305 NONAME
+	_ZNK15CCmFillListItem9UpnpClassEv @ 306 NONAME
+	_ZNK15CCmSqlAudioItem11AlbumArtUriEv @ 307 NONAME
+	_ZNK15CCmSqlAudioItem11TrackNumberEv @ 308 NONAME
+	_ZNK15CCmSqlAudioItem7AlbumIdEv @ 309 NONAME
+	_ZNK15CCmSqlAudioItem7BitrateEv @ 310 NONAME
+	_ZNK15CCmSqlAudioItem7GenreIdEv @ 311 NONAME
+	_ZNK15CCmSqlAudioItem8ArtistIdEv @ 312 NONAME
+	_ZNK15CCmSqlAudioItem8DurationEv @ 313 NONAME
+	_ZNK15CCmSqlImageItem11DescriptionEv @ 314 NONAME
+	_ZNK15CCmSqlImageItem12ResolutionIdEv @ 315 NONAME
+	_ZNK15CCmSqlVideoItem7GenreIdEv @ 316 NONAME
+	_ZNK16CCmStoreListItem12ExternalizeLER12RWriteStream @ 317 NONAME
+	_ZNK16CCmStoreListItem12StatusValuesEv @ 318 NONAME
+	_ZNK16CCmStoreListItem6DevIdsEv @ 319 NONAME
+	_ZNK16CCmStoreListItem6ListIdEv @ 320 NONAME
+	_ZNK17CCmSqlGenericItem11HarvestDateEv @ 321 NONAME
+	_ZNK17CCmSqlGenericItem11UpnpclassIdEv @ 322 NONAME
+	_ZNK17CCmSqlGenericItem13ResourceCountEv @ 323 NONAME
+	_ZNK17CCmSqlGenericItem13UpnpProfileIdEv @ 324 NONAME
+	_ZNK17CCmSqlGenericItem3UriEv @ 325 NONAME
+	_ZNK17CCmSqlGenericItem4DateEv @ 326 NONAME
+	_ZNK17CCmSqlGenericItem4SizeEv @ 327 NONAME
+	_ZNK17CCmSqlGenericItem5TitleEv @ 328 NONAME
+	_ZNK17CCmSqlGenericItem9MediaTypeEv @ 329 NONAME
+	_ZNK18CCmMediaServerFull11VisibleDateEv @ 330 NONAME
+	_ZNK18CCmMediaServerFull12ExternalizeLER12RWriteStream @ 331 NONAME
+	_ZNK18CCmMediaServerFull14CopyCapabilityEv @ 332 NONAME
+	_ZNK18CCmMediaServerFull15MediaServerNameEv @ 333 NONAME
+	_ZNK18CCmMediaServerFull8IsActiveEv @ 334 NONAME
+	_ZNK18CCmSqlPropertyItem12ExternalizeLER12RWriteStream @ 335 NONAME
+	_ZNK18CCmSqlPropertyItem2IdEv @ 336 NONAME
+	_ZNK18CCmSqlPropertyItem4NameEv @ 337 NONAME
+	_ZNK18CCmSqlPropertyItem6StatusEv @ 338 NONAME
+	_ZNK20CCmFillRuleContainer12ExternalizeLER12RWriteStream @ 339 NONAME
+	_ZNK20CCmFillRuleContainer13FillRuleCountEv @ 340 NONAME
+	_ZNK20CCmFillRuleContainer8FillRuleEi @ 341 NONAME
+	_ZNK21CCmSearchResponseHash10StartIndexEv @ 342 NONAME
+	_ZNK21CCmSearchResponseHash4HashEv @ 343 NONAME
+	_ZNK21CCmSearchResponseHash9ItemCountEv @ 344 NONAME
+	_ZNK21CCmStoreRuleContainer12ExternalizeLER12RWriteStream @ 345 NONAME
+	_ZNK21CCmStoreRuleContainer14StoreRuleCountEv @ 346 NONAME
+	_ZNK23CCmSqlPropertyCollector12ExternalizeLER12RWriteStream @ 347 NONAME
+	_ZNK23CCmSqlPropertyCollector22PropertyContainerCountEv @ 348 NONAME
+	_ZNK23CCmSqlPropertyContainer12ExternalizeLER12RWriteStream @ 349 NONAME
+	_ZNK23CCmSqlPropertyContainer17PropertyItemCountEv @ 350 NONAME
+	_ZNK28CCmSqlResolutionPropertyItem10PixelCountEv @ 351 NONAME
+	_ZNK28CCmSqlResolutionPropertyItem12ExternalizeLER12RWriteStream @ 352 NONAME
+	_ZNK28CCmSqlResolutionPropertyItem5WidthEv @ 353 NONAME
+	_ZNK28CCmSqlResolutionPropertyItem6HeightEv @ 354 NONAME
+	_ZTI11CCmFillRule @ 355 NONAME ; #<TI>#
+	_ZTI12CCmDriveInfo @ 356 NONAME ; #<TI>#
+	_ZTI12CCmStoreRule @ 357 NONAME ; #<TI>#
+	_ZTI14CCmMediaServer @ 358 NONAME ; #<TI>#
+	_ZTI14CCmSqlBaseItem @ 359 NONAME ; #<TI>#
+	_ZTI15CCmBaseListItem @ 360 NONAME ; #<TI>#
+	_ZTI15CCmFillListItem @ 361 NONAME ; #<TI>#
+	_ZTI15CCmSqlAudioItem @ 362 NONAME ; #<TI>#
+	_ZTI15CCmSqlImageItem @ 363 NONAME ; #<TI>#
+	_ZTI15CCmSqlVideoItem @ 364 NONAME ; #<TI>#
+	_ZTI16CCmStoreListItem @ 365 NONAME ; #<TI>#
+	_ZTI17CCmSqlGenericItem @ 366 NONAME ; #<TI>#
+	_ZTI18CCmMediaServerFull @ 367 NONAME ; #<TI>#
+	_ZTI18CCmSqlPropertyItem @ 368 NONAME ; #<TI>#
+	_ZTI20CCmFillRuleContainer @ 369 NONAME ; #<TI>#
+	_ZTI21CCmSearchResponseHash @ 370 NONAME ; #<TI>#
+	_ZTI21CCmStoreRuleContainer @ 371 NONAME ; #<TI>#
+	_ZTI23CCmSqlPropertyCollector @ 372 NONAME ; #<TI>#
+	_ZTI23CCmSqlPropertyContainer @ 373 NONAME ; #<TI>#
+	_ZTI28CCmSqlResolutionPropertyItem @ 374 NONAME ; #<TI>#
+	_ZTV11CCmFillRule @ 375 NONAME ; #<VT>#
+	_ZTV12CCmDriveInfo @ 376 NONAME ; #<VT>#
+	_ZTV12CCmStoreRule @ 377 NONAME ; #<VT>#
+	_ZTV14CCmMediaServer @ 378 NONAME ; #<VT>#
+	_ZTV14CCmSqlBaseItem @ 379 NONAME ; #<VT>#
+	_ZTV15CCmBaseListItem @ 380 NONAME ; #<VT>#
+	_ZTV15CCmFillListItem @ 381 NONAME ; #<VT>#
+	_ZTV15CCmSqlAudioItem @ 382 NONAME ; #<VT>#
+	_ZTV15CCmSqlImageItem @ 383 NONAME ; #<VT>#
+	_ZTV15CCmSqlVideoItem @ 384 NONAME ; #<VT>#
+	_ZTV16CCmStoreListItem @ 385 NONAME ; #<VT>#
+	_ZTV17CCmSqlGenericItem @ 386 NONAME ; #<VT>#
+	_ZTV18CCmMediaServerFull @ 387 NONAME ; #<VT>#
+	_ZTV18CCmSqlPropertyItem @ 388 NONAME ; #<VT>#
+	_ZTV20CCmFillRuleContainer @ 389 NONAME ; #<VT>#
+	_ZTV21CCmSearchResponseHash @ 390 NONAME ; #<VT>#
+	_ZTV21CCmStoreRuleContainer @ 391 NONAME ; #<VT>#
+	_ZTV23CCmSqlPropertyCollector @ 392 NONAME ; #<VT>#
+	_ZTV23CCmSqlPropertyContainer @ 393 NONAME ; #<VT>#
+	_ZTV28CCmSqlResolutionPropertyItem @ 394 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for CM Library
+*
+*/
+
+
+
+
+
+
+
+// Supported platforms
+PRJ_PLATFORMS
+DEFAULT
+
+
+// MMP files
+PRJ_MMPFILES
+cmlibrary.mmp
+
+// Files to be exported
+PRJ_EXPORTS
+../inc/cmfillrulecontainer.h    |../../../../inc/cmfillrulecontainer.h
+../inc/cmfillrule.h             |../../../../inc/cmfillrule.h
+../inc/cmstorerulecontainer.h   |../../../../inc/cmstorerulecontainer.h 
+../inc/cmstorerule.h            |../../../../inc/cmstorerule.h
+../inc/cmmediaserverfull.h      |../../../../inc/cmmediaserverfull.h
+../inc/cmmediaserver.h          |../../../../inc/cmmediaserver.h
+../inc/cmcommontypes.h          |../../../../inc/cmcommontypes.h
+../inc/cmcommon.h               |../../../../inc/cmcommon.h
+../inc/cmbaselistitem.h         |../../../../inc/cmbaselistitem.h
+../inc/cmfilllistitem.h         |../../../../inc/cmfilllistitem.h
+../inc/cmstorelistitem.h        |../../../../inc/cmstorelistitem.h
+../inc/cmsqlgenericitem.h       |../../../../inc/cmsqlgenericitem.h
+../inc/cmsqlimageitem.h         |../../../../inc/cmsqlimageitem.h
+../inc/cmsqlvideoitem.h         |../../../../inc/cmsqlvideoitem.h
+../inc/cmsqlaudioitem.h         |../../../../inc/cmsqlaudioitem.h
+../inc/cmsqlpropertyitem.h      |../../../../inc/cmsqlpropertyitem.h
+../inc/cmsqlpropertycollector.h |../../../../inc/cmsqlpropertycollector.h
+../inc/cmsqlresolutionpropertyitem.h      |../../../../inc/cmsqlresolutionpropertyitem.h
+../inc/cmsqlitemresource.h      |../../../../inc/cmsqlitemresource.h
+../inc/cmsqlbaseitem.h          |../../../../inc/cmsqlbaseitem.h
+../inc/cmsqlpropertycontainer.h |../../../../inc/cmsqlpropertycontainer.h
+../inc/cmdriveinfo.h            |../../../../inc/cmdriveinfo.h
+../inc/cmserviceobserver.h      |../../../../inc/cmserviceobserver.h
+../inc/cmsearchresponsehash.h   |../../../../inc/cmsearchresponsehash.h
+../inc/cmcommonutils.h          |../../../../inc/cmcommonutils.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/group/cmlibrary.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project CM Library
+*
+*/
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+TARGET          cmcommon.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10281FAA
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH     /sys/bin
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          cmfillrulecontainer.cpp
+SOURCE          cmfillrule.cpp
+SOURCE          cmrule.cpp
+SOURCE          cmparam.cpp
+SOURCE          cmmediaserver.cpp
+SOURCE          cmmediaserverfull.cpp
+SOURCE          cmstorerule.cpp
+SOURCE          cmstorerulecontainer.cpp
+
+SOURCE          cmbaselistitem.cpp
+SOURCE          cmfilllistitem.cpp
+SOURCE          cmstorelistitem.cpp
+SOURCE          cmsqlpropertyitem.cpp
+SOURCE          cmsqlpropertycontainer.cpp
+SOURCE          cmsqlpropertycollector.cpp
+SOURCE          cmsqlbaseitem.cpp
+SOURCE          cmsqlgenericitem.cpp
+SOURCE          cmsqlaudioitem.cpp
+SOURCE          cmsqlvideoitem.cpp
+SOURCE          cmsqlimageitem.cpp
+SOURCE          cmsqlitemresource.cpp
+SOURCE          cmsqlresolutionpropertyitem.cpp
+SOURCE          cmdriveinfo.cpp
+SOURCE          cmsearchresponsehash.cpp
+SOURCE          cmcommonutils.cpp
+
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         bafl.lib
+LIBRARY         avkon.lib
+LIBRARY         cone.lib 
+LIBRARY         PlatformEnv.lib
+LIBRARY         commdb.lib
+LIBRARY         ecom.lib
+
+DEBUGLIBRARY    flogger.lib
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmbaselistitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill and store file list items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMBASELISTITEM_H
+#define __CMBASELISTITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmcommon.h"
+#include "cmcommontypes.h"
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+/**
+ *  CCmBaseListItem class
+ *    Capsulating fill and store file list items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmBaseListItem : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmBaseListItem class.
+     * @return pointer to CCmBaseListItem class
+     */
+    IMPORT_C static CCmBaseListItem* NewL();
+    
+    /**
+     * Creates new CCmBaseListItem class and 
+     * leaves the instance in the cleanup stack.
+     * @return pointer to CCmBaseListItem class
+     */
+    IMPORT_C static CCmBaseListItem* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmBaseListItem();
+
+public:
+    
+    // Sets
+    IMPORT_C void SetPrimaryTextL( const TDesC& aText );
+    
+    IMPORT_C void SetSecondaryTextL( const TDesC& aText );
+    
+    IMPORT_C void SetPathL( const TDesC& aText );
+    
+    IMPORT_C void SetSize( const TUint32 aSize );
+    
+    IMPORT_C void SetDate( const TTime aDate );
+    
+    IMPORT_C void SetStatus( const TCmListItemStatus aStatus );
+    
+    IMPORT_C void SetDbId( const TUint64 aId );
+    
+    IMPORT_C void SetRefId( const TUint64 aId );     
+    
+    IMPORT_C void SetMediaType( const TCmMediaType aMediaType );   
+    
+    // Gets
+    IMPORT_C TDesC& PrimaryText() const;
+    
+    IMPORT_C TDesC& SecondaryText() const;
+    
+    IMPORT_C TDesC& Path() const;
+    
+    IMPORT_C TUint32 Size() const;
+    
+    IMPORT_C TTime Date() const;
+    
+    IMPORT_C TCmListItemStatus Status() const;
+    
+    IMPORT_C TUint64 DbId() const;
+    
+    IMPORT_C TUint64 RefId() const;        
+    
+    IMPORT_C TCmMediaType MediaType() const;
+        
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );    
+
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmBaseListItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+protected: // data
+
+    HBufC* iPrimaryText; // owned
+    HBufC* iSecondaryText; // owned
+    HBufC* iPath; // owned
+    TUint32 iSize;
+    TTime iDate;
+    TCmListItemStatus iStatus;
+    TUint64 iId;
+    TUint64 iRefId;    
+    TCmMediaType iMediaType;    
+    
+    };
+
+#endif //  __CMBASELISTITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmcommon.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Common Client/Server header for Content Manager
+*
+*/
+
+
+
+
+
+
+#ifndef CMCOMMON_H
+#define CMCOMMON_H
+
+_LIT(KCmServerExe,"cmserver.exe"); ///<EXE name
+
+// CONSTANTS
+
+// Server name
+_LIT(KCmServerName,"CmServer");
+
+// Panic name
+_LIT(KCmServerPanic, "CmServerPanic");
+
+/// A version must be specified when creating a session with the server
+const TUint KCmServerMajor = 1;
+const TUint KCmServerMinor = 0;
+const TUint KCmServerBuild = 0;
+
+const TUid KCmPropertyCat = {0x10012345};
+const TInt KCmProperty = 1;
+
+const TInt64 KCmMmcLowMemory = 10*KMega;
+
+// Wlan scan intervals [s]
+const TInt KWlanScanNetworkNever = 0;
+const TInt KWlanScanNetworkInterval60 = 60;
+
+// Cds namespace
+_LIT(KCdsNamespace, "http://www.nokia.com/namespaces/metadata/cdssync/");
+
+/**  State information for the Content Manager */
+enum TCmServerState
+    {
+    ECmServerStateDisabled = 0,
+    ECmServerStateIdle = 1,
+    ECmServerStateStoring = 2,
+    ECmServerStateFilling = 3,
+    ECmServerStateHarvesting = 4,
+    ECmServerStateGettingStoreFields = 6,
+    ECmServerStateGettingFillFields = 7,
+    ECmServerStatePreProcessingStore = 8,
+    ECmServerStatePreProcessingFill = 9,
+    ECmServerStateSearchingForServers = 12,
+    ECmServerStateDeleting = 13,
+    ECmServerStatePreProcessingFilllist = 14,
+    ECmServerStateUpdatingFillLists = 15,
+    ECmServerStateDeletingMetadata = 16
+    };
+
+/**  Content Manager services */
+enum TCmService
+    {
+    // main service which must be enabled for anything to work
+    // Note: executable service identifiers equal state identifiers
+    ECmServiceNone = 0,
+    ECmServiceContentManager = 1,
+    ECmServiceStore = 2,
+    ECmServiceFill = 3,
+    ECmServiceHarvest = 4,
+    ECmServiceMemoryManager = 5,
+    ECmServiceGetStoreFields = 6,
+    ECmServiceGetFillFields = 7,
+    ECmServicePreProcessingStore = 8,
+    ECmServicePreProcessingFill = 9,
+    ECmServiceTransferInfoFill = 10,
+    ECmServiceTransferInfoStore = 11,
+    ECmServiceSearchForServers = 12,
+    ECmServiceDeleteFilledFiles = 13,
+    ECmServicePreProcessingFilllist = 14,
+    ECmServiceUpdateFillLists = 15,
+    ECmServiceDeleteMetadata = 16,
+    ECmServiceAutomStoreListProcess = 17
+    };
+
+/**  Content Manager service states */
+enum TCmServiceState
+    {
+    ECmServiceStateDisabled = 0,
+    ECmServiceStateAutomatic
+    };
+
+/// opcodes used in message passing between client and server
+enum TCmRequest
+    {
+    ECmGetServerState = 1,
+    ECmSetServiceState,
+    ECmGetServiceState,
+    ECmExecuteService,
+    ECmSetFillRules,
+    ECmGetFillRules,
+    ECmGetFillRulesSize,
+    ECmGetMediaserversSize,
+    ECmSetMediaServers,
+    ECmSetStoreRules,
+    ECmGetStoreRulesSize,
+    ECmGetFillItemsSize,
+    ECmGetStoreItemsSize,
+    ECmPreProcessFillList,
+    ECmGetItemCount,
+    ECmGetDataBuffer,
+    ECmGetDataFields,
+    ECmGetDataFieldSize,
+    ECmCancel,
+    ECmGetAppWizardState,
+    ECmSetAppWizardState,
+    ECmGetSyncTime,
+    ECmSetFillFileStatuses,
+    ECmGetTransferInfo,
+    ECmUpdateFillLists,
+    ECmDeleteMetadata,
+    ECmDeleteDeletedMediaServers,
+    ECmSetDrives,
+    ECmGetDrivesSize,
+    ECmGetDriveSelectionStatus,
+    ECmApplicationExit,
+    ECmGetFilledFilesSize
+    };
+
+/// Panic enums
+enum TCmClientPanics
+    {
+    ECmClientNoSessionActive,
+    ECmClientBadRequest
+    };
+
+/// Panic enums
+enum TCmServerPanics
+    {
+    EDCmServerIllegalParameter
+    };
+
+class TCmProgressInfo
+    {
+public: // public member variables
+    TCmService iService; // Service identifier
+    TInt iTotalItems;    // Total count of items
+    TInt iProcessedItems;// Processed items
+    TInt iItemsToTransferPerService; // Remaining items per service
+    };
+
+enum TCmListItemStatus
+    {
+    ECmToBeFilled = 1,
+    ECmFilled = 2,
+    ECmToBeRemoved = 4,
+    ECmToBeShrinked = 8,
+    ECmToBeSkipped = 16,
+    ECmSkippedByUser = 32,
+    ECmLocalCopy = 64,
+    ECmStored = 128,
+    ECmKeepOnDevice = 256
+    };
+
+
+enum TCmShrinkResolution
+    {
+    ECmShrinkResScreenSize = 0
+    };
+
+class TCmLowPriorityFilled
+    {
+public: // public member variables
+    HBufC* iFullPath; // Path of the filled file
+    TUint32 iSize;    // Size of the filled file
+    TInt64 iListId;   // Items fill list id
+    };
+
+typedef TPckgC<TCmProgressInfo> TCmProgressInfoPckg;
+
+#endif
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmcommontypes.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Common header for Common component
+*
+*/
+
+
+
+
+
+
+#ifndef CMCOMMONTYPES_H
+#define CMCOMMONTYPES_H
+
+
+
+/// Fill rule method types
+
+enum TFillRuleMethodTypes
+    {
+    ECMRandom = 0,
+    ECMLatest,
+    ECMOldest
+    };
+
+enum TCmLimitType
+    {
+    EUnlimited = 0,
+    EPieces,
+    EMbits
+    };
+
+enum TCmMediaType
+    {
+    ECmAll   = -1,
+    ECmVideo = 0,
+    ECmImage,
+    ECmAudio,
+    ECmAudioBroadCast,
+    ECmVideoBroadCast,
+    ECmOtherVideo,
+    ECmOtherImage
+    };
+    
+enum TCmFillMethod
+    {
+    ECmRandom = 0,
+    ECmLatest,
+    ECmOldest,
+    ECmRandomTrack,
+    ECmRandomAlbum
+    };
+
+enum TCmFillRuleStatus
+    {
+    ECmUnSelected = 0,
+    ECmSelected,
+    ECmDeleted 
+    };
+    
+enum TCmMetadataField
+    {
+    ECmArtist = 0,
+    ECmAlbum,
+    ECmGenre,
+    ECmDuration,
+    ECmDate,
+    ECmTitle,
+    ECmUpnpClass,
+    ECmContentURI,
+    ECmFileSize,
+    ECmBitrate,
+    ECmResolution,
+    ECmFreeText,
+    ECmProfileId,
+    ECmNone
+    };
+
+enum TCmOperatorType
+    {
+    ECmEquals,
+    ECmGreater,
+    ECmSmaller,
+    ECmConsistOf,
+    ECmBeginsWith,
+    ECmEndsWith
+    };                           
+
+enum TCmRuleType
+    {
+    ECmFmFillRule = 1,
+    ECmFmStoreRule
+    };        
+#endif // CMCOMMONTYPES_H
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmcommonutils.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Utilities class description
+*
+*/
+
+
+
+
+
+
+#ifndef CMCOMMONUTILS_H
+#define CMCOMMONUTILS_H
+
+#include <e32base.h>
+
+class CEikonEnv;
+/**
+ * CmCommonUtils class.
+ *
+ * Class provides common methods
+ *
+ * @since S60 3.2
+ * @lib cmlibrary.lib
+ */
+class CmCommonUtils : CBase
+    {
+    public:
+    
+        /**
+         * Loads resource file
+         *
+         * @since S60 3.2
+         * @param aFilePath
+         * @return TInt, resource file offset
+         */
+        IMPORT_C static TInt LoadResourceFileL( const TDesC& aFilePath,
+                                                CEikonEnv& eikonEnv ); 
+
+        /**
+         * Sets wlan scan interval
+         * @since S60 3.2
+         *
+         * @param aInterval, scan interval         
+         */
+        IMPORT_C static void SetWlanScanL( const TInt aInterval );                                                
+    
+    };
+                                
+#endif // CMCOMMONUTILS_H                                
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmdriveinfo.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Definition of drive info class
+*
+*/
+
+
+
+
+
+
+#ifndef C_CCMDRIVEINFO_H
+#define C_CCMDRIVEINFO_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+/**
+ *  Drive info class
+ *
+ *  Provides info about MCs drives
+ *
+ *  @lib cmcommon.lib
+ *  @since S60 3.1
+ */
+ class CCmDriveInfo : public CBase
+    {
+    
+    public:
+    
+        /**
+         * Creates new CCmDriveInfo class.
+         * @param None
+         * @return  pointer to CCmDriveInfo class
+         */    
+        IMPORT_C static CCmDriveInfo* NewL();
+       
+        /**
+         * Creates new CCmDriveInfo class.
+         * @param None
+         * @return  pointer to CCmDriveInfo class
+         */        
+        IMPORT_C static CCmDriveInfo* NewLC();
+        
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CCmDriveInfo();
+            
+    public:
+        /**
+         * Sets drive number
+         * @since S60 3.1
+         * @param aDriveNumber, drive number
+         */
+        IMPORT_C void SetDriveNumber( const TInt aDriveNumber );
+
+        /**
+         * Gets drive number
+         * @since S60 3.1
+         * @return TInt, drive number
+         */
+        IMPORT_C TInt DriveNumber() const;
+        
+        /**
+         * Sets drive type
+         * @since S60 3.1
+         * @param aDriveType, drive type
+         */
+        IMPORT_C void SetDriveType( const TUint aDriveType );
+
+        /**
+         * Gets drive type
+         * @since S60 3.1
+         * @return TUint, drive type
+         */
+        IMPORT_C TUint DriveType() const;
+        
+        /**
+         * Sets drive name
+         * @since S60 3.1
+         * @param aDriveNumber, drive name
+         */
+        IMPORT_C void SetDriveNameL( const TDesC& aDriveName ); 
+
+        /**
+         * Gets drive name
+         * @since S60 3.1
+         * @return TDesC*, drive name
+         */
+        IMPORT_C TDesC& DriveName() const;
+                
+        /**
+         * Sets drive size
+         * @since S60 3.1
+         * @param aDriveSize, drive size
+         */
+        IMPORT_C void SetDriveSize( const TInt64 aDriveSize );
+
+        /**
+         * Gets drive size
+         * @since S60 3.1
+         * @return TInt64, drive size
+         */
+        IMPORT_C TInt64 DriveSize() const;
+
+        /**
+         * Sets drive quota
+         * @since S60 3.1
+         * @param aDriveQuota, drive quota
+         */        
+        IMPORT_C void SetDriveQuota( const TInt64 aDriveQuota );
+
+        /**
+         * Gets drive quota
+         * @since S60 3.1
+         * @return drive quota
+         */        
+        IMPORT_C TInt64 DriveQuota() const;
+ 
+        /**
+         * Sets used drive quota
+         * @since S60 3.1
+         * @param aUsedDriveQuota, used drive quota
+         */        
+        IMPORT_C void SetUsedDriveQuota( const TInt64 aUsedDriveQuota );
+
+        /**
+         * Gets used drive quota
+         * @since S60 3.1
+         * @return used drive quota
+         */        
+        IMPORT_C TInt64 UsedDriveQuota() const;
+                
+        /**
+         * Sets drive id
+         * @since S60 3.1
+         * @param aDriveId, drive id
+         */
+        IMPORT_C void SetDriveId( const TUint aDriveId );
+
+        /**
+         * Gets drive Id
+         * @since S60 3.1
+         * @return TInt, drive id
+         */
+        IMPORT_C TUint DriveId() const;
+
+        /**
+         * Sets drive status
+         * @since S60 3.1
+         * @param aActive, ETrue if drive selected
+         * @return None
+         */        
+        IMPORT_C void SetStatus( const TBool aActive );
+        
+        /**
+         * Gets drive status
+         * @since S60 3.1
+         * @return ETrue if drive selected
+         */        
+        IMPORT_C TBool Status() const;
+        
+        /**
+        * Externalizes container information to stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.1
+        * @param reference to RWriteStream
+        * @return none
+        */
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+        
+        /**
+        * Internalizes container information from stream.
+        * Leaves in case of errors.
+        * @since Series 60 3.1
+        * @param reference to RReadStream
+        * @return none
+        */
+        IMPORT_C void InternalizeL( RReadStream& aStream );        
+        
+    private:
+    
+        /**
+         * CCmDriveInfo.
+         */        
+        CCmDriveInfo();
+            
+        /**
+         * ConstructL.
+         */
+        void ConstructL();
+            
+    private:
+    
+        /**
+         * drive number
+         */
+        TInt                    iDriveNumber;
+        
+        /**
+         * drive type
+         */
+        TUint                   iDriveType;
+        
+        /**
+         * drive name
+         * owned
+         */
+        HBufC*                  iDriveName; 
+        
+        /**
+         * used drive space
+         */
+        TInt64                  iSize;
+
+        /**
+         * drive capasity
+         */        
+        TInt64                  iQuota;
+        
+        /**
+         * used drive capasity
+         */        
+        TInt64                  iUsedQuota;        
+        
+        /**
+         * drive id
+         */
+        TUint                   iUniqueId;
+        
+        /**
+         * drive active
+         */
+         TBool                  iActive;
+                 
+    };
+ 
+#endif // C_CCMDRIVEINFO_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmfilllistitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Fill file list items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMFILLLISTITEM_H
+#define __CMFILLLISTITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmbaselistitem.h"
+#include "cmcommontypes.h"
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+/**
+ *  CCmFillListItem class
+ *  Capsulating Fill file list items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmFillListItem : public CCmBaseListItem
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmFillListItem class.
+     * @return  pointer to CCmFillListItem class
+     */
+    IMPORT_C static CCmFillListItem* NewL();
+    
+    /**
+     * Creates new CCmFillListItem class and 
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmFillListItem class
+     */
+    IMPORT_C static CCmFillListItem* NewLC();
+    
+    /**
+     * Creates new CCmFillListItem class and 
+     * leaves the instance in the cleanup stack.
+     * @param aPriority, item's priority
+     * @param aListId, item's list id
+     * @param aStatus, items's status
+     * @param aSelected, is item on selected list
+     * @return  pointer to CCmFillListItem class
+     */
+    IMPORT_C static CCmFillListItem* NewLC( const TUint aPriority, 
+        const TUint aListId, const TUint aStatus,
+        const TCmFillRuleStatus aSelected );
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmFillListItem();
+
+public:
+    
+    // Sets
+    IMPORT_C void SetUpnpClassL( const TDesC& aUpnpClass );
+    
+    IMPORT_C void SetUriL( const TDesC8& aUri);
+    
+    IMPORT_C void SetItemIdL( const TDesC8& aItemId );
+    
+    IMPORT_C void SetListId( const TUint aId );
+    
+    IMPORT_C void SetDevId( const TUint8 aDevId );
+    
+    IMPORT_C void SetPriority( const TUint8 aPriority );    
+    
+    IMPORT_C void SetSelected( TCmFillRuleStatus aSelected  );
+    
+    IMPORT_C void SetDriveId( const TUint aDriveId );
+    
+    IMPORT_C void SetDriveNumber( const TInt aDriveNumber );
+    
+    // Gets
+    IMPORT_C TDesC& UpnpClass() const;
+    
+    IMPORT_C TDesC8& Uri() const;
+    
+    IMPORT_C TDesC8& ItemId() const;
+    
+    IMPORT_C TUint ListId() const;
+     
+    IMPORT_C TUint8 DevId() const;
+    
+    IMPORT_C TUint8 Priority() const;   
+    
+    IMPORT_C TCmFillRuleStatus Selected() const;
+    
+    IMPORT_C TUint DriveId() const;
+    
+    IMPORT_C TInt DriveNumber() const;
+    
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );    
+
+public:
+
+    /**
+     * Constructor.
+     */
+    CCmFillListItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Second-phase constructor.
+     */    
+    void ConstructL( const TUint aPriority, const TUint aListId, 
+        const TUint aStatus, const TCmFillRuleStatus aSelected );    
+    
+
+private: // data
+    
+    HBufC* iUpnpClass; // owned
+    HBufC8* iUri; // owned
+    HBufC8* iItemId; // owned
+    TUint iListId;
+    TUint8 iDevId;
+    TUint8 iPriority;
+    TCmListItemStatus iStatus;
+    TCmFillRuleStatus iSelected;
+    TUint iDriveId;
+    TInt iDriveNumber;
+    
+    };
+
+#endif //  __CMFILLLISTITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmfillrule.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,532 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill rule
+*
+*/
+
+
+
+
+
+
+#ifndef __CMFILLRULE_H
+#define __CMFILLRULE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h> // CDesCArray typedef
+#include "cmcommontypes.h"
+#include "cmcommon.h"
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+class CCmRule;
+class CCmMediaServer;
+
+/**
+ *  CCmFillRule class
+ *    Capsulating fill rules
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmFillRule : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCMFillRule class.
+     * @param None
+     * @return  pointer to CFillRule class
+     */
+    IMPORT_C static CCmFillRule* NewL();
+    
+    /**
+     * Creates new CCMFillRule class and 
+     * leaves the instance in the cleanup stack.
+     * @param None
+     * @return  pointer to CCMFillRule class
+     */
+    IMPORT_C static CCmFillRule* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmFillRule();
+
+public:
+
+    /**
+     * AddRuleL.
+     * @since Series 60 3.1     
+     * @param aDataField ( metadatafield of the rule )
+     * @param aOperator ( comparison type )
+     * @returns index of the rule
+     */
+    IMPORT_C TInt AddRuleL( TCmMetadataField aDataField, 
+        TCmOperatorType aOperator );
+
+    /**
+     * Rule.
+     * @since Series 60 3.1     
+     * @param aIndex rule index
+     * @param aDataField metadatafield of the rule
+     * @param aOperator rule operator
+     * @param aParamCount param count on return
+     * @returns index of the rule
+     */    
+    IMPORT_C void RuleL( TInt aIndex, TCmMetadataField* aDataField, 
+        TCmOperatorType* aOperator, TInt* aParamCount );
+
+    /**
+     * Deletes rule.
+     * @since Series 60 3.1     
+     * @param aDataField metadatafield of the rule
+     * @returns None
+     */            
+    IMPORT_C void DeleteRule( TCmMetadataField aDataField );
+
+    /**
+     * Deletes rule.
+     * @since Series 60 3.1     
+     * @param aDataField metadatafield of the rule
+     * @param aOper, comparison method
+     * @returns None
+     */     
+    IMPORT_C void DeleteRule( TCmMetadataField aDataField,
+        TCmOperatorType aOper );    
+    
+    /**
+     * AddRuleParamL.
+     * @since Series 60 3.1     
+     * @param aIndex index of the rule
+     * @param aParam parameter
+     * @returns index of the rule
+     */            
+    IMPORT_C TInt AddRuleParamL( TInt aIndex, const TDesC8& aParam );
+
+    /**
+     * AddRuleParamL ( indexed param ).
+     * @since Series 60 3.1     
+     * @param aIndex index of the rule
+     * @param aParam parameter
+     * @returns index of the rule
+     */            
+    IMPORT_C TInt AddRuleParamL( TInt aIndex, TInt aParam );
+        
+    /**
+     * RuleParam.
+     * @since Series 60 3.1     
+     * @param aRuleIndex index to rule
+     * @param aParamIndex index to param
+     * @param aParam, where param is loaded
+     * @returns None
+     */    
+    IMPORT_C void RuleParamL( TInt aRuleIndex, TInt aParamIndex, 
+        TPtrC8* aParam );
+
+    /**
+     * RuleParam.
+     * @since Series 60 3.1     
+     * @param aRuleIndex index to rule
+     * @param aParamIndex index to param
+     * @param aParam, where param is loaded
+     * @returns None
+     */    
+    IMPORT_C void RuleParamL( TInt aRuleIndex, TInt aParamIndex, 
+        TInt& aParam );
+        
+    /**
+     * AddMediaServerL.
+     * @since Series 60 3.1     
+     * @param aUDN
+     * @returns index of the media server
+     */    
+    IMPORT_C TInt AddMediaServerL( const TDesC8& aUDN );
+
+    /**
+     * AddMediaServerL.
+     * @since Series 60 3.1     
+     * @param aDbId
+     * @returns index of the media server
+     */    
+    IMPORT_C TInt AddMediaServerL( TInt aDbId );
+    
+    /**
+     * DeleteMediaServer.
+     * @since Series 60 3.1     
+     * @param aUDN
+     * @returns None
+     */        
+    IMPORT_C void DeleteMediaServer( const TDesC8& aUDN );
+
+    /**
+     * DeleteMediaServer.
+     * @since Series 60 3.1     
+     * @param aDbId
+     * @returns None
+     */        
+    IMPORT_C void DeleteMediaServer( TInt aDbId );
+     
+    /**
+     * AddExcAlbum.
+     * @since Series 60 3.1     
+     * @param aAlbum
+     * @returns None
+     */        
+    IMPORT_C void AddExcAlbumL( const TDesC& aAlbum );
+    
+    /**
+     * AddExcPlayList.
+     * @since Series 60 3.1     
+     * @param aPlayList
+     * @returns None
+     */        
+    IMPORT_C void AddExcPlayListL( const TDesC& aPlayList );
+    
+    /**
+     * RemoveExcAlbumL.
+     * @since Series 60 3.1     
+     * @param aAlbum
+     * @returns None
+     */        
+    IMPORT_C void RemoveExcAlbum( const TDesC& aAlbum );
+    
+    /**
+     * RemoveExcPlayListL.
+     * @since Series 60 3.1     
+     * @param aPlayList
+     * @returns None
+     */        
+    IMPORT_C void RemoveExcPlayList( const TDesC& aPlayList );
+
+    /**
+     * ExcAlbumsL.
+     * @since Series 60 3.1     
+     * @returns array of albums
+     */
+    IMPORT_C CDesCArray& ExcAlbums() const;
+
+    /**
+     * ExcPlayListsL.
+     * @since Series 60 3.1     
+     * @returns array of play lists
+     */
+    IMPORT_C CDesCArray& ExcPlayLists() const;
+        
+    /**
+     * MediaServer.
+     * @since Series 60 3.1     
+     * @param aIndex index of the rule
+     * @returns server uuid
+     */    
+    IMPORT_C const TDesC8& MediaServerL( TInt aIndex );    
+
+    /**
+     * MediaServer.
+     * @since Series 60 3.1     
+     * @param aIndex index of the rule
+     * @param aServer ref. to server
+     * @returns None
+     */    
+    IMPORT_C void MediaServerL( TInt aIndex, TInt& aServer );
+        
+    /**
+     * SetNameL.
+     * @since Series 60 3.1     
+     * @param aName
+     * @returns KErrNone
+     */    
+    IMPORT_C TInt SetNameL( const TDesC8& aName );
+    
+    /**
+     * Name.
+     * @since Series 60 3.1     
+     * @returns name of the fill rule
+     */    
+    IMPORT_C TDesC8& Name() const;
+
+    /**
+     * SetListId.
+     * @since Series 60 3.1     
+     * @param aId
+     * @returns None
+     */        
+    IMPORT_C void SetListId( const TUint aId );
+    
+    /**
+     * ListId.
+     * @since Series 60 3.1     
+     * @returns id of the fill list
+     */        
+    IMPORT_C TUint ListId() const;
+    
+    /**
+     * SetAmount.
+     * @since Series 60 3.1     
+     * @param aAmount
+     * @returns None
+     */    
+    IMPORT_C void SetAmount( TUint32 aAmount );
+
+    /**
+     * Amount.
+     * @since Series 60 3.1     
+     * @returns amount
+     */
+    IMPORT_C TUint32 Amount() const;
+    
+    /**
+     * SetLimitType.
+     * @since Series 60 3.1     
+     * @param aLimitType
+     * @returns None
+     */    
+    IMPORT_C void SetLimitType( TCmLimitType aLimitType );
+    
+    /**
+     * LimitType.
+     * @since Series 60 3.1     
+     * @returns limit type
+     */    
+    IMPORT_C TCmLimitType LimitType() const;
+        
+    /**
+     * SetMediaType.
+     * @since Series 60 3.1     
+     * @param aMediaType
+     * @returns None
+     */    
+    IMPORT_C void SetMediaType( TCmMediaType aMediaType );
+    
+    /**
+     * MediaType.
+     * @since Series 60 3.1     
+     * @returns media type ( video, image, music or what )
+     */    
+    IMPORT_C TCmMediaType MediaType() const;    
+    
+    /**
+     * SetMethod.
+     * @since Series 60 3.1     
+     * @param aMethod
+     * @returns None
+     */    
+    IMPORT_C void SetMethod( TCmFillMethod aMethod );
+    
+    /**
+     * Method.
+     * @since Series 60 3.1     
+     * @returns method
+     */    
+    IMPORT_C TCmFillMethod Method() const;
+
+    /**
+     * SetSelected.
+     * @since Series 60 3.1     
+     * @param aSelected
+     * @returns None
+     */    
+    IMPORT_C void SetSelected( TCmFillRuleStatus aSelected );
+
+    /**
+     * Selected.
+     * @since Series 60 3.1     
+     * @returns status
+     */        
+    IMPORT_C TCmFillRuleStatus Selected() const;
+    
+    /**
+     * SetStatus.
+     * @since Series 60 3.1     
+     * @param aStatus
+     * @returns None
+     */    
+    IMPORT_C void SetStatus( TCmListItemStatus aStatus );
+
+    /**
+     * Selected.
+     * @since Series 60 3.1     
+     * @returns status
+     */    
+    IMPORT_C TCmListItemStatus Status() const;
+            
+    /**
+     * SetPriority.
+     * @since Series 60 3.1     
+     * @param aPriority
+     * @returns None
+     */        
+    IMPORT_C void SetPriority( TUint8 aPriority );
+
+    /**
+     * Priority.
+     * @since Series 60 3.1     
+     * @returns Priority
+     */        
+    IMPORT_C TUint8 Priority() const;
+
+    /**
+     * SetTemplateId.
+     * @since Series 60 3.1     
+     * @param aTemplateId
+     * @returns None
+     */    
+    IMPORT_C void SetTemplateId( TUint8 aTemplateId );
+
+    /**
+     * TemplateId.
+     * @since Series 60 3.1     
+     * @returns TemplateId
+     */
+    IMPORT_C TUint8 TemplateId() const;
+    
+    /**
+     * SetListRealSizeInBytes.
+     * @since Series 60 3.1     
+     * @param aRealSize
+     * @returns None
+     */    
+    IMPORT_C void SetListRealSizeInBytes( TUint32 aRealSize );
+
+    /**
+     * ListRealSizeInBytes.
+     * @since Series 60 3.1     
+     * @returns List's real size
+     */
+    IMPORT_C TUint32 ListRealSizeInBytes() const;
+    
+    /**
+     * SetListRealCount.
+     * @since Series 60 3.1     
+     * @param aRealCount
+     * @returns None
+     */    
+    IMPORT_C void SetListRealCount( TUint32 aRealCount );
+
+    /**
+     * ListRealCount.
+     * @since Series 60 3.1     
+     * @returns List's real count
+     */
+    IMPORT_C TUint32 ListRealCount() const;      
+                
+    /**
+     * RuleCount.
+     * @since Series 60 3.1     
+     * @returns count
+     */    
+    IMPORT_C TInt RuleCount() const;
+    
+    /**
+     * MediaServerCount.
+     * @since Series 60 3.1     
+     * @returns count
+     */    
+    IMPORT_C TInt MediaServerCount() const;
+    
+    /**
+     * ParamCount.
+     * @since Series 60 3.1     
+     * @param aIndex index of the rule
+     * @returns count
+     */    
+    IMPORT_C TInt ParamCountL( TInt aIndex ) const;
+    
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    void InternalizeL( RReadStream& aStream );        
+
+private:
+
+    /**
+     * Constructor.
+     */
+    CCmFillRule();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+    
+    /** Rule name */    
+    HBufC8* iName; // owned
+    
+    /** Amount */
+    TUint32 iAmount;
+    
+    /** List's real size in MBs */
+    TUint32 iRealSize;
+    
+    /** List's real item count */
+    TUint32 iRealCount;
+    
+    /** Limit type */
+    TCmLimitType iLimitType;
+    
+    /** Media type */
+    TCmMediaType iMediaType;
+    
+    /** Method */
+    TCmFillMethod iMethod;
+    
+    /** State of the fill rule ( Selected or not ) */
+    TCmFillRuleStatus iSelected;
+    
+    /** Array rules included to fill rule */
+    RPointerArray<CCmRule> iRuleArray; // items owned
+    
+    /** Array rules included to fill rule */
+    RPointerArray<CCmMediaServer> iMediaServerArray; // items owned
+    
+    /** Priority of the fill rule */
+    TUint8 iPriority;
+    
+    /** Id of the tempate that was used when creating rule */
+    TUint8 iTemplateId;
+    
+    /** Id of the fill list */
+    TUint iId;
+    
+    /** Excluded albums */
+    CDesCArray* iExcAlbums; // owned.
+    
+    /** Excluded playlists */
+    CDesCArray* iExcPlayLists; // owned.
+
+    /** How to handle list items after fill */
+    TCmListItemStatus iStatus;
+    };
+
+#endif //  __CMFILLRULE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmfillrulecontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill rules
+*
+*/
+
+
+
+
+
+
+#ifndef __CMFILLRULECONTAINER_H
+#define __CMFILLRULECONTAINER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+class CCmFillRule;
+
+/**
+ *  CCmFillRuleContainer class
+ *    Capsulating fill rules
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmFillRuleContainer : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmFillRuleContainer class.
+     * @param None
+     * @return  pointer to CCmFillRuleContainer class
+     */
+    IMPORT_C static CCmFillRuleContainer* NewL();
+    
+    /**
+     * Creates new CCmFillRuleContainer class and 
+     * leaves the instance in the cleanup stack.
+     * @param None
+     * @return  pointer to CCmFillRuleContainer class
+     */
+    IMPORT_C static CCmFillRuleContainer* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmFillRuleContainer();
+
+public:
+
+    /**
+     * AddFillRuleL.
+     * @since Series 60 3.1     
+     * @param aRule
+     * @returns index of the rule
+     */
+    IMPORT_C TInt AddFillRuleL( CCmFillRule* aRule );
+ 
+     /**
+     * DeleteFillRule.
+     * @since Series 60 3.1
+     * @param aIndex
+     * @returns None
+     */   
+    IMPORT_C void DeleteFillRule( TInt aIndex );
+
+    /**
+     * FillRule.
+     * @since Series 60 3.1     
+     * @param aIndex rule index
+     * @returns fill rule
+     */    
+    IMPORT_C CCmFillRule* FillRule( TInt aIndex ) const;
+
+    /**
+     * FillRuleCount.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns count
+     */    
+    IMPORT_C TInt FillRuleCount() const;
+    
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );    
+    
+private:
+
+    /**
+     * Constructor.
+     */
+    CCmFillRuleContainer();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+    
+    /** Array rules included to fill rule */
+    RPointerArray<CCmFillRule> iFillRuleArray; // items owned
+    
+
+    };
+
+#endif //  __CMFILLRULECONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmmediaserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Media server
+*
+*/
+
+
+
+
+
+
+#ifndef __CMMEDIASERVER_H
+#define __CMMEDIASERVER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+/**
+ *  CCmMediaServer class
+ *    Capsulating media servers
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmMediaServer : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmMediaServer class.
+     * @param aUDN
+     * @return  pointer to CCmMediaServer class
+     */
+    IMPORT_C static CCmMediaServer* NewL();
+
+    /**
+     * Creates new CCmMediaServer class and
+     * leaves the instance in the cleanup stack.
+     * @param aUDN
+     * @return  pointer to CCmMediaServer class
+     */
+    IMPORT_C static CCmMediaServer* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmMediaServer();
+
+public:
+
+    /**
+     * MediaServer
+     * @since Series 60 3.1
+     * @param None
+     * @return media servers udn
+     */
+    IMPORT_C const TDesC8& MediaServer() const;
+
+    /**
+     * SetUDNL
+     * @since Series 60 3.1
+     * @param aUDN, UDN of the media server
+     * @return None
+     */
+    IMPORT_C void SetUDNL( const TDesC8& aUDN );
+
+    /**
+     * Media server's db id
+     * @since Series 60 3.1
+     * @param None
+     * @return Server's db id
+     */
+    IMPORT_C TInt64 DbId() const;
+
+    /**
+     * SetDbId
+     * @since Series 60 3.1
+     * @param aDbId
+     * @return None
+     */
+    IMPORT_C void SetDbId( const TInt64 aDbId );
+
+    /**
+     * SystemUpdateID
+     * @since Series 60 3.1
+     * @param None
+     * @return systemupdateID
+     */
+    IMPORT_C TInt SystemUpdateID() const;
+
+    /**
+     * SetSystemUpdateID
+     * @since Series 60 3.1
+     * @param aSystemUpdateID
+     * @return None
+     */
+    IMPORT_C void SetSystemUpdateID( const TInt aSystemUpdateID );
+    
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    void ExternalizeL( RWriteStream& aStream ) const;
+
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    void InternalizeL( RReadStream& aStream );
+
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmMediaServer();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+
+
+protected: // data
+
+    /** UDN */
+    HBufC8* iUDN; // owned
+
+    /** Database id */
+    TInt64 iDbId;
+
+    /** SystemUpdateID */
+    TInt iSystemUpdateID;
+
+    };
+
+#endif //  __CMMEDIASERVER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmmediaserverfull.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Media server
+*
+*/
+
+
+
+
+
+
+#ifndef __CMMEDIASERVERFULL_H
+#define __CMMEDIASERVERFULL_H
+
+#include <e32base.h>
+#include "cmmediaserver.h"
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+/**
+ *  CCmMediaServerFull class
+ *    Capsulating media servers
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmMediaServerFull : public CCmMediaServer
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmMediaServerFull class.
+     * @param None
+     * @return  pointer to CCmMediaServerFull class
+     */
+    IMPORT_C static CCmMediaServerFull* NewL();
+
+    /**
+     * Creates new CCmMediaServerFull class and
+     * leaves the instance in the cleanup stack.
+     * @param None
+     * @return  pointer to CCmMediaServerFull class
+     */
+    IMPORT_C static CCmMediaServerFull* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmMediaServerFull();
+
+public:
+
+    /**
+     * SetUDNL
+     * @since Series 60 3.1
+     * @return name
+     */
+    IMPORT_C TPtrC8 MediaServerName() const;
+
+    /**
+     * SetMediaServerNameL
+     * @since Series 60 3.1
+     * @param aName
+     * @return None
+     */
+    IMPORT_C void SetMediaServerNameL( const TDesC8& aName );
+
+    /**
+     * VisibleDate
+     * @since Series 60 3.1
+     * @param None
+     * @return visible date
+     */
+    IMPORT_C TTime VisibleDate() const;
+
+    /**
+     * SetVisibleDate
+     * @since Series 60 3.1
+     * @param Time
+     * @return None
+     */
+    IMPORT_C void SetVisibleDate( TTime aTime );
+
+    /**
+     * IsActive
+     * @since Series 60 3.1
+     * @param None
+     * @return Is active flag
+     */
+    IMPORT_C TUint8 IsActive() const;
+
+    /**
+     * SetIsActive
+     * @since Series 60 3.1
+     * @param aIsActive
+     * @return None
+     */
+     IMPORT_C void SetIsActive( TUint8 aIsActive );
+
+    /**
+     * Gets copy capability information
+     * @since Series 60 3.1
+     * @return TBool, ETrue if copy capable, EFalse otherwise
+     */
+     IMPORT_C TBool CopyCapability() const;
+
+    /**
+     * Sets copy capability information
+     * @since Series 60 3.1
+     * @param aCopyCapable
+     * @return None
+     */
+     IMPORT_C void SetCopyCapability( TBool aCopyCapability );
+
+    /**
+     * Sets server store usage status
+     * @since Series60 3.2
+     * @param aUsed, status value
+     */
+    IMPORT_C void SetStoreUsage(
+                    TBool aUsed );
+
+    /**
+     * Gets server store usage status
+     * @since Series60 3.2
+     * @return TBool, usage status value
+     */
+    IMPORT_C TBool StoreUsage();
+
+    /**
+     * Sets server fill usage status
+     * @since Series60 3.2
+     * @param aUsed, status value
+     */
+    IMPORT_C void SetFillUsage(
+                    TBool aUsed );
+
+    /**
+     * Gets server fill usage status
+     * @since Series60 3.2
+     * @return TBool, usage status value
+     */
+    IMPORT_C TBool FillUsage();
+
+    /**
+    * Externalizes media server information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+    /**
+    * Internalizes media server information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+private:
+
+
+private: // data
+
+    /** Name */
+    HBufC8* iName; // owned
+
+    /** Visible date */
+    TTime iVisibleDate;
+
+    /** Is active flag */
+    TUint8 iIsActive;
+
+    /** Copy capability flag **/
+    TBool iCopyCapability;
+    
+    /** Fill usage **/
+    TBool iFillServer;
+    
+    /** Store usage **/
+    TBool iStoreServer;
+
+    };
+
+#endif //  __CMMEDIASERVERFULL_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmparam.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Rule parameters
+*
+*/
+
+
+
+
+
+
+#ifndef __CMPARAM_H
+#define __CMPARAM_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+/**
+ *  CCmParam class
+ *    Capsulating rule params
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CCmParam ): public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmParam class.
+     * @return pointer to CCmParam class
+     */
+    static CCmParam* NewL();
+    
+    /**
+     * Creates new CCmParam class and 
+     * leaves the instance in the cleanup stack.
+     * @return pointer to CCmParam class
+     */
+    static CCmParam* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmParam();
+
+public:
+
+    /**
+     * Param
+     * @since Series 60 3.1          
+     * @param aParam, on return parameter value
+     * @return  None
+     */
+    void Param( TPtrC8* aParam );
+
+    /**
+     * Param
+     * @since Series 60 3.1          
+     * @param aParam, on return parameter value
+     * @return  None
+     */    
+    void Param( TInt& aParam );
+    
+    /**
+     * SetComparisonDataL
+     * @since Series 60 3.1          
+     * @param aComparisonData, datafield value
+     * @return  None
+     */
+    void SetComparisonDataL( const TDesC8& aComparisonData );
+    
+    /**
+     * SetComparisonData (indexed)
+     * @since Series 60 3.1          
+     * @param aComparisonData, datafield value
+     * @return  None
+     */
+    void SetComparisonData( TInt aComparisonData );
+    
+    /**
+     * ComparisonData
+     * @since Series 60 3.1          
+     * @param None
+     * @return  returns datafield
+     */    
+    const TDesC8& ComparisonData() const;
+    
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    void InternalizeL( RReadStream& aStream );    
+
+private:
+
+    /**
+     * Constructor.
+     */
+    CCmParam();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+    
+    /** datafield */
+    HBufC8* iDataField; // owned
+    
+    /** indexed data field */
+    TInt iDataFieldIndexed;
+
+    };
+
+#endif //  __CMPARAM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmrule.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Rules
+*
+*/
+
+
+
+
+
+
+#ifndef __CMRULE_H
+#define __CMRULE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmcommontypes.h"
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+class CCmParam;
+
+/**
+ *  CCmRule class
+ *    Capsulating rules
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CCmRule ) : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmRule class.
+     * @param aDataField
+     * @param aOperator
+     * @return  pointer to CCmRule class
+     */
+    static CCmRule* NewL();
+    
+    /**
+     * Creates new CCmRule class and 
+     * leaves the instance in the cleanup stack.
+     * @param aDataField
+     * @param aOperator
+     * @return  pointer to CCmRule class
+     */
+    static CCmRule* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmRule();
+
+public:
+
+    /**
+     * AddRuleParamL
+     * @since Series 60 3.1     
+     * @param aParam
+     * @return  index of the param
+     */
+    TInt AddRuleParamL( const TDesC8& aParam );
+
+    /**
+     * AddRuleParamL ( indexed param )
+     * @since Series 60 3.1     
+     * @param aParam
+     * @return  index of the param
+     */
+    TInt AddRuleParamL( TInt aParam );
+    
+    /**
+     * Rule
+     * @since Series 60 3.1          
+     * @param aDataField, metadatafield on return
+     * @param aOperator, operator on return
+     * @param aParamCount, param count on return
+     * @return None
+     */    
+    void Rule( TCmMetadataField* aDataField, TCmOperatorType* aOperator,
+        TInt* aParamCount );
+
+    /**
+     * RuleParam
+     * @since Series 60 3.1          
+     * @param aParamIndex, parameter index
+     * @param aParam, param
+     * @return None
+     */        
+    void RuleParamL( TInt aParamIndex, TPtrC8* aParam );
+    
+    /**
+     * RuleParam
+     * @since Series 60 3.1          
+     * @param aParamIndex, parameter index
+     * @param aParam, param
+     * @return None
+     */        
+    void RuleParamL( TInt aParamIndex, TInt& aParam );
+    
+    /**
+     * SetMetadataField
+     * @since Series 60 3.1          
+     * @param aDataField, sets comparison field
+     * @return None
+     */        
+    void SetMetadataField( TCmMetadataField aDataField );
+
+    /**
+     * SetOperator
+     * @since Series 60 3.1          
+     * @param aOperator, sets operator of the rule
+     * @return None
+     */            
+    void SetOperator( TCmOperatorType aOperator );
+        
+    /**
+     * RuleParamsCount
+     * @since Series 60 3.1          
+     * @return Count of rule params
+     */    
+    TInt RuleParamsCount() const;
+    
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    void InternalizeL( RReadStream& aStream );        
+    
+private:
+
+    /**
+     * Constructor.
+     */
+    CCmRule();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+    
+    /** Metadata field */
+    TCmMetadataField iMetadataField;
+    
+    /** Operator */
+    TCmOperatorType iOperator;
+    
+    /** Array rules included to fill rule*/
+    RPointerArray<CCmParam> iRuleParamsArray; // items owned
+
+    };
+    
+#endif //  __CMRULE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsearchresponsehash.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Search response hash
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSEARCHRESPONSEHASH_H
+#define __CMSEARCHRESPONSEHASH_H
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+/**
+ *  CCmSearchResponseHash class
+ *  Capsulating search responce hash
+ *  @lib cmcommon.lib
+ *  @since S60 v3.2
+ */
+class CCmSearchResponseHash : public CBase
+    {
+public:
+    
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSearchResponseHash class.
+     * @param aStartIndex, starting search index
+     * @param aItemCount, count of search items
+     * @param aHash, calculated hash code
+     * @return  pointer to CCmSearchResponseHash class
+     */        
+    IMPORT_C static CCmSearchResponseHash* NewL( TInt aStartIndex,
+                                         TInt aItemCount,
+                                         const TDesC8& aHash );
+
+    /**
+     * Creates new CCmSearchResponseHash class.
+     * @param None
+     * @return  pointer to CCmSearchResponseHash class
+     */ 
+    IMPORT_C static CCmSearchResponseHash* NewL();                                             
+ 
+    /**
+     * Destructor
+     */      
+    virtual ~CCmSearchResponseHash();
+    
+public:
+        
+    /**
+     * Returns hash code
+     * @param None
+     * @return  Hash code 
+     */         
+    IMPORT_C const TDesC8& Hash() const;
+
+    /**
+     * Returns hash code
+     * @param None
+     * @return  Hash code 
+     */ 
+    IMPORT_C void SetHashL( const TDesC8& aHash );     
+    
+    /**
+     * Returns starting index of search
+     * @param None
+     * @return  starting index 
+     */     
+    IMPORT_C TInt StartIndex() const;
+    
+    /**
+     * Sets starting index
+     * @param aStartIndex, starting searh index
+     * @return None
+     */     
+    IMPORT_C void SetStartIndex( TInt aStartIndex );
+    
+    /**
+     * Returns item count
+     * @param None
+     * @return  Item count 
+     */     
+    IMPORT_C TInt ItemCount() const;
+    
+    /**
+     * Sets item count
+     * @param aItemCount, count of items
+     * @return  None
+     */     
+    IMPORT_C void SetItemCount( TInt aItemCount );
+        
+     /**
+    * Externalizes search has information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes search hash information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    void InternalizeL( RReadStream& aStream );    
+        
+private:
+
+    /**
+     * Constructor
+     */ 
+    CCmSearchResponseHash();
+        
+    /**
+     * Constructor
+     */         
+    void ConstructL( TInt aStartIndex,
+                         TInt aItemCount,
+                         const TDesC8& aHash );
+        
+private:
+
+    /** Start search index **/
+    TInt    iStartIndex;
+    
+    /** Item count **/        
+    TInt    iItemCount;
+        
+    /** Hash code **/        
+    HBufC8* iHash;          // owned
+    
+    };
+
+#endif //  __CMSEARCHRESPONCSEHASH_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmserviceobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Callback interface to Fill manager
+*
+*/
+
+
+
+
+
+
+
+#ifndef M_CMSERVICEOBSERVER_H
+#define M_CMSERVICEOBSERVER_H
+
+/**
+ *  Cm service observer
+ *  @lib cmlibrary.lib
+ *  @since S60 v3.1
+ */
+
+//  INCLUDES
+#include    "cmcommon.h"
+
+
+// CLASS DECLARATION
+
+class MCmServiceObserver
+    {
+    public:
+        virtual void ServiceExecuted( TCmService aService, 
+                                      TInt aErrCode ) = 0;
+        virtual void ExecuteServiceL( TCmService aService ) = 0;
+    };
+
+
+#endif // M_CMFMTRANSFEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlaudioitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLAUDIOITEM_H
+#define __CMSQLAUDIOITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmsqlgenericitem.h"
+
+// FORWARD DECLARATIONS
+
+/**
+ *  CCmSqlAudioItem class
+ *  Capsulating sql items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmSqlAudioItem : public CCmSqlGenericItem
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSqlAudioItem class.
+     * @param None
+     * @return  pointer to CCmSqlAudioItem class
+     */
+    IMPORT_C static CCmSqlAudioItem* NewL();
+    
+    /**
+     * Creates new CCmSqlAudioItem class and 
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmSqlAudioItem class
+     */
+    IMPORT_C static CCmSqlAudioItem* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmSqlAudioItem();
+    
+public:
+
+    /**
+    * Sets artist id
+    * @since Series 60 3.1
+    * @param aArtistId, artist Id
+    * @return None
+    */  
+    IMPORT_C void SetArtistId( const TInt64 aArtistId );
+
+    /**
+    * Sets album id
+    * @since Series 60 3.1
+    * @param aAlbumId, Album Id
+    * @return None
+    */     
+    IMPORT_C void SetAlbumId( const TInt64 aAlbumId );
+    
+    /**
+    * Sets genre id
+    * @since Series 60 3.1
+    * @param aGenreId, Genre Id
+    * @return None
+    */     
+    IMPORT_C void SetGenreId( const TInt64 aGenreId );
+    
+    /**
+    * Sets duration
+    * @since Series 60 3.1
+    * @param aDuration, duration
+    * @return None
+    */     
+    IMPORT_C void SetDuration( const TInt aDuration );
+    
+    /**
+    * Sets bitrate
+    * @since Series 60 3.1
+    * @param aBitrate, Bitrate
+    * @return None
+    */     
+    IMPORT_C void SetBitrate( const TInt aBitrate );
+    
+    /**
+    * Sets track number
+    * @since Series 60 3.1
+    * @param aTrackNumber, Track number
+    * @return None
+    */     
+    IMPORT_C void SetTrackNumber( const TInt aTrackNumber );
+    
+    /**
+    * Sets albumarturi number
+    * @since Series 60 3.1
+    * @param aAlbumArtUri, album art uri
+    * @return None
+    */     
+    IMPORT_C void SetAlbumArtUriL( const TDesC8& aAlbumArtUri );
+
+    /**
+    * Gets artist id
+    * @since Series 60 3.1
+    * @param None
+    * @return artist id
+    */    
+    IMPORT_C TInt64 ArtistId() const;
+
+    /**
+    * Gets album id
+    * @since Series 60 3.1
+    * @param None
+    * @return album id
+    */     
+    IMPORT_C TInt64 AlbumId() const;
+
+    /**
+    * Gets genre id
+    * @since Series 60 3.1
+    * @param None
+    * @return genre id
+    */     
+    IMPORT_C TInt64 GenreId() const;
+
+    /**
+    * Gets duration of the item ( in seconds )
+    * @since Series 60 3.1
+    * @param None
+    * @return duration
+    */     
+    IMPORT_C TInt Duration() const;
+
+    /**
+    * Gets bitrate of the item ( bits/sec )
+    * @since Series 60 3.1
+    * @param None
+    * @return bitrate
+    */     
+    IMPORT_C TInt Bitrate() const;
+   
+    /**
+    * Gets track number
+    * @since Series 60 3.1
+    * @param None
+    * @return track number
+    */     
+    IMPORT_C TInt TrackNumber() const;
+    
+    /**
+    * Gets album art uri of the item
+    * @since Series 60 3.1
+    * @return Album art uri
+    */    
+    IMPORT_C TDesC8& AlbumArtUri() const;    
+    
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmSqlAudioItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+    
+    // Artist id
+    TInt64 iArtistId;
+    
+    // Album id
+    TInt64 iAlbumId;
+    
+    // Genre id
+    TInt64 iGenreId;
+    
+    // Duration in seconds
+    TInt iDuration;
+    
+    // Bitrate in bits/sec
+    TInt iBitrate;
+    
+    // Track number
+    TInt iTrackNumber;
+    
+    // Album art uri
+    HBufC8* iAlbumArtUri; // owned    
+    
+    };
+
+#endif //  __CMSQLAUDIOITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlbaseitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLBASEITEM_H
+#define __CMSQLBASEITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmcommontypes.h"
+
+// FORWARD DECLARATIONS
+class CSHA1;
+
+/**
+ *  CCmSqlBaseItem class
+ *  Capsulating sql items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmSqlBaseItem : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSqlBaseItem class.
+     * @param None
+     * @return  pointer to CCmSqlBaseItem class
+     */
+    IMPORT_C static CCmSqlBaseItem* NewL();
+    
+    /**
+     * Creates new CCmSqlBaseItem class and 
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmSqlBaseItem class
+     */
+    IMPORT_C static CCmSqlBaseItem* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmSqlBaseItem();
+
+public:
+
+    /**
+    * Sets database id 
+    * @since Series 60 3.1
+    * @param aId, database id
+    * @return None
+    */
+    IMPORT_C void SetId( const TInt64 aId );
+ 
+    /**
+    * Sets cds id ( received from media server )
+    * @since Series 60 3.1
+    * @param aCdsId, cds id
+    * @return None
+    */   
+    IMPORT_C void SetCdsIdL( const TDesC8& aCdsId );
+
+    /**
+    * Sets hash value
+    * @since Series 60 3.1
+    * @param aHash, hash value
+    * @return None
+    */    
+    IMPORT_C void SetHashL( const TDesC& aHash );
+
+    /**
+    * Sets search id of item
+    * @since S60 3.1
+    * @param aSearchId, search id
+    * @return None
+    */     
+    IMPORT_C void SetSearchId( const TInt64 aSearchId );
+    
+    /**
+    * Gets database id
+    * @since Series 60 3.1
+    * @param None
+    * @return Database id
+    */ 
+    IMPORT_C TInt64 Id() const;
+
+    /**
+    * Gets cds id ( received from media server )
+    * @since Series 60 3.1
+    * @param None
+    * @return CdsId
+    */    
+    IMPORT_C TDesC8& CdsId() const;
+    
+    /**
+    * Gets hash value
+    * @since Series 60 3.1
+    * @param None
+    * @return Hash value
+    */    
+    IMPORT_C TDesC& Hash() const;
+
+    /**
+    * Gets search id of item
+    * @since Series 60 3.1
+    * @param None
+    * @return Search id
+    */      
+    IMPORT_C TInt64 SearchId() const;
+    
+    /**
+    * Compares items
+    * @since Series 60 3.1
+    * @param aFirst, first item
+    * @param aSecond, second item
+    * @return Comparison result
+    */     
+    IMPORT_C static TInt CompareByHash( const CCmSqlBaseItem& aFirst,
+                                        const CCmSqlBaseItem& aSecond );
+                               
+    /**
+    * Compares items
+    * @since Series 60 3.1
+    * @param aFirst, first item
+    * @param aSecond, second item
+    * @return Comparison result
+    */     
+    IMPORT_C static TInt CompareByCdsId( const CCmSqlBaseItem& aFirst,
+                                         const CCmSqlBaseItem& aSecond );
+     
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmSqlBaseItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+protected: // data
+  
+    // Database id
+    TInt64 iId;
+    
+    // Item id received from media server
+    HBufC8* iCdsId; // owned
+    
+    // Calculated hash code
+    HBufC* iHash; // owned
+    
+    // Search id
+    TInt64 iSearchId;
+    
+    };
+
+#endif //  __CMSQLBASEITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlgenericitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLGENERICITEM_H
+#define __CMSQLGENERICITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmsqlbaseitem.h"
+
+// FORWARD DECLARATIONS
+class CCmSqlItemResource;
+
+/**
+ *  CCmSqlGenericItem class
+ *    Capsulating sql items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmSqlGenericItem : public CCmSqlBaseItem
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSqlGenericItem class.
+     * @param Nonw
+     * @return  pointer to CCmSqlGenericItem class
+     */
+    IMPORT_C static CCmSqlGenericItem* NewL();
+    
+    /**
+     * Creates new CCmSqlGenericItem class and 
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmSqlGenericItem class
+     */
+    IMPORT_C static CCmSqlGenericItem* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmSqlGenericItem();
+
+public:
+
+    /**
+    * Sets size of the item
+    * @since Series 60 3.1
+    * @param aSize, size in bytes
+    * @return None
+    */
+    IMPORT_C void SetSize( const TInt aSize );
+    
+    /**
+    * Sets title of the item
+    * @since Series 60 3.1
+    * @param aTitle, Metadata title
+    * @return None
+    */    
+    IMPORT_C void SetTitleL( const TDesC8& aTitle );
+
+    /**
+    * Sets date
+    * @since Series 60 3.1
+    * @param aDate, date
+    * @return None
+    */    
+    IMPORT_C void SetDate( const TTime& aDate );
+    
+    /**
+    * Sets harvesting time
+    * @since Series 60 3.1
+    * @param aHarvestDate, harvesting time
+    * @return None
+    */    
+    IMPORT_C void SetHarvestDate( const TTime& aHarvestDate );    
+    
+    /**
+    * Sets upnp class id
+    * @since Series 60 3.1
+    * @param aUpnpclassId, id values of the upnp class
+    * @return None
+    */    
+    IMPORT_C void SetUpnpclassId( const TInt64 aUpnpclassId );
+
+    /**
+    * Sets upnp profile id
+    * @since Series 60 3.1
+    * @param aUpnpProfileId, id values of the upnp profile
+    * @return None
+    */    
+    IMPORT_C void SetUpnpProfileId( const TInt64 aUpnpProfileId );    
+    
+    /**
+    * Sets Item uri
+    * @since Series 60 3.1
+    * @param aUri, Item uri
+    * @return None
+    */     
+    IMPORT_C void SetUriL( const TDesC8& aUri );
+
+    /**
+    * Sets media type of the item
+    * @since Series 60 3.1
+    * @param aMType, media type
+    * @return None
+    */     
+    IMPORT_C void SetMediaType( const TCmMediaType aMType );
+    
+    /**
+    * Creates new resource for the item
+    * @since Series 60 3.1
+    * @param aUri, uri of the resource
+    * @param aSize, size of the resource
+    * @param aDuration, duration of the resource
+    * @param aBitrate, bitrate of the resource
+    * @param aResolutionId, id to right resolution
+    * @return None
+    */     
+    IMPORT_C void NewResourceL( const TDesC8& aUri, 
+        const TInt aSize, const TInt aDuration, const TInt aBitrate,
+        const TInt64 aResolutionId );    
+
+    /**
+    * Gets size of the item
+    * @since Series 60 3.1
+    * @return Size
+    */        
+    IMPORT_C TInt Size() const;
+
+    /**
+    * Gets Title of the item
+    * @since Series 60 3.1
+    * @return Title
+    */    
+    IMPORT_C TDesC8& Title() const;
+
+    /**
+    * Gets date
+    * @since Series 60 3.1
+    * @return Date
+    */    
+    IMPORT_C TTime Date() const;
+
+    /**
+    * Gets harvest date
+    * @since Series 60 3.1
+    * @return Harvesting date
+    */    
+    IMPORT_C TTime HarvestDate() const;
+        
+    /**
+    * Gets upnp class id
+    * @since Series 60 3.1
+    * @return Upnp class id
+    */ 
+    IMPORT_C TInt64 UpnpclassId() const;
+
+    /**
+    * Gets upnp profile id
+    * @since Series 60 3.1
+    * @param None
+    * @return Upnp profile id
+    */ 
+    IMPORT_C TInt64 UpnpProfileId( ) const;
+    
+    /**
+    * Gets item uri
+    * @since Series 60 3.1
+    * @return Item uri
+    */    
+    IMPORT_C TDesC8& Uri() const;
+ 
+    /**
+    * Gets media type
+    * @since Series 60 3.1
+    * @return Media type
+    */    
+    IMPORT_C TCmMediaType MediaType() const;
+
+    /**
+    * Gets count of resources
+    * @since Series 60 3.1
+    * @return Resource count
+    */
+    IMPORT_C TInt ResourceCount() const;
+        
+    /**
+    * Gets resource data
+    * @since Series 60 3.1
+    * @param aUri, uri of the resource
+    * @param aSize, size of the resource
+    * @param aDuration, duration of the resource
+    * @param aBitrate, bitrate of the resource
+    * @param aResolutionId, resolution id of the resource
+    * @param aIndex, index of the resource
+    * @return None
+    */    
+    IMPORT_C void GetResource( TDesC8& aUri, TInt& aSize, 
+    TInt& aDuration, TInt& aBitrate, TInt64& aResolutionId, TInt aIndex );    
+    
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmSqlGenericItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+protected: // data  
+    
+    // Size of the item in bytes
+    TInt iSize;
+    
+    // Title
+    HBufC8* iTitle; // owned
+    
+    // Date
+    TTime iDate;
+    
+    // Date
+    TTime iHarvestDate;    
+    
+    // Upnp class id
+    TInt64 iUpnpclassId;
+    
+    // Upnp profile id
+    TInt64 iUpnpProfileId;
+    
+    // Search id
+    TInt64 iSearchId;
+    
+    // Uri
+    HBufC8* iUri; // owned
+    
+    // Media type
+    TCmMediaType iMType;
+    
+    // Resource array
+    RPointerArray<CCmSqlItemResource> iResources; // items owned
+    
+    };
+
+#endif //  __CMSQLGENERICITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlimageitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLIMAGEITEM_H
+#define __CMSQLIMAGEITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmsqlgenericitem.h"
+
+// FORWARD DECLARATIONS
+
+/**
+ *  CCmSqlImageItem class
+ *  Capsulating sql item
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmSqlImageItem : public CCmSqlGenericItem
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSqlImageItem class.
+     * @param None
+     * @return  pointer to CCmSqlImageItem class
+     */
+    IMPORT_C static CCmSqlImageItem* NewL();
+    
+    /**
+     * Creates new CCmSqlImageItem class and 
+     * leaves the instance in the cleanup stack.
+     * @return pointer to CCmSqlImageItem class
+     */
+    IMPORT_C static CCmSqlImageItem* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmSqlImageItem();
+  
+public:
+
+    /**
+    * Sets resolution id
+    * @since Series 60 3.1
+    * @param aResolutionId, resolution id
+    * @return None
+    */ 
+    IMPORT_C void SetResolutionId( const TInt64 aResolutionId );
+
+    /**
+    * Sets description field
+    * @since Series 60 3.1
+    * @param aDescription, description text
+    * @return None
+    */     
+    IMPORT_C void SetDescriptionL( const TDesC8& aDescription );
+
+    /**
+    * Gets resolution id
+    * @since Series 60 3.1
+    * @return Resolution id
+    */     
+    IMPORT_C TInt64 ResolutionId() const;
+
+    /**
+    * Gets description text
+    * @since Series 60 3.1
+    * @return Description text
+    */    
+    IMPORT_C TDesC8& Description() const;
+    
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmSqlImageItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data  
+    
+    // Resolution id 
+    TInt64 iResolutionId;
+    
+    // Description data
+    HBufC8* iDescription; // owned
+    
+    };
+
+#endif //  __CMSQLIMAGEITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlitemresource.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLITEMRESOURCE_H
+#define __CMSQLITEMRESOURCE_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+/**
+ *  CCmSqlItemResource class
+ *  Capsulating sql items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CCmSqlItemResource ) : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSqlItemResource class.
+     * @param None
+     * @return  pointer to CCmSqlItemResource class
+     */
+    static CCmSqlItemResource* NewL();
+    
+    /**
+     * Creates new CCmSqlItemResource class and 
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmSqlItemResource class
+     */
+    static CCmSqlItemResource* NewLC();
+
+    /**
+     * Creates new CCmSqlItemResource class and 
+     * leaves the instance in the cleanup stack.
+     * @param aUri
+     * @param aSize
+     * @param aDuration
+     * @param aBitrate
+     * @param aResolutionId
+     * @return pointer to CCmSqlItemResource class
+     */
+    static CCmSqlItemResource* NewLC( const TDesC8& aUri, 
+    const TInt aSize, const TInt aDuration, const TInt aBitrate,
+    const TInt64 aResolutionId );
+        
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSqlItemResource();
+
+public:
+
+    /**
+    * Sets uri of the resource
+    * @since Series 60 3.1
+    * @param aUri, resource uri
+    * @return None
+    */ 
+    void SetUriL( const TDesC8& aUri );
+    
+    /**
+    * Sets size of resource
+    * @since Series 60 3.1
+    * @param aSize, size of the resource
+    * @return None
+    */     
+    void SetSize( const TInt aSize );
+    
+    /**
+    * Sets duration of resource
+    * @since Series 60 3.1
+    * @param aDuration, duration of the resource
+    * @return None
+    */     
+    void SetDuration( const TInt aDuration );
+    
+    /**
+    * Sets bitrate of resource
+    * @since Series 60 3.1
+    * @param aBitrate, bitrate of the resource
+    * @return None
+    */     
+    void SetBitrate( const TInt aBitrate );
+    
+    /**
+    * Sets resolution id of resource
+    * @since Series 60 3.1
+    * @param aResolutionId, id of resolution
+    * @return None
+    */     
+    void SetResolutionId( const TInt64 aResolutionId );    
+    
+    /**
+    * Gets Uri
+    * @since Series 60 3.1
+    * @param None
+    * @return iUri
+    */     
+    TDesC8& Uri() const;
+    
+    /**
+    * Gets size 
+    * @since Series 60 3.1
+    * @param None
+    * @return iSize
+    */     
+    TInt Size() const;
+    
+    /**
+    * Gets duration
+    * @since Series 60 3.1
+    * @param None
+    * @return iDuration
+    */     
+    TInt Duration() const;
+    
+    /**
+    * Gets bitrate
+    * @since Series 60 3.1
+    * @param None
+    * @return iBitrate
+    */ 
+    TInt Bitrate() const;
+    
+    /**
+    * Gets resolution id
+    * @since Series 60 3.1
+    * @param None
+    * @return iResolutionId
+    */ 
+    TInt ResolutionId() const;    
+    
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmSqlItemResource();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL( const TDesC8& aUri, 
+        const TInt aSize, const TInt aDuration, const TInt aBitrate,
+        const TInt64 aResolutionId );    
+
+protected: // data  
+    
+    // Name
+    HBufC8* iUri; // owned
+    
+    // Size of the resource
+    TInt iSize;
+
+    // Duration of the resource
+    TInt iDuration;
+        
+    // Bitrate of the resource
+    TInt iBitrate;
+     
+    // Id to resolution
+    TInt64 iResolutionId;
+    
+    };
+
+#endif //  __CMSQLITEMRESOURCE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlpropertycollector.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating property container objects
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLPROPERTYCOLLECTOR_H
+#define __CMSQLPROPERTYCOLLECTOR_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+class CCmSqlPropertyContainer;
+
+/**
+ *  CCmSqlPropertyCollector class
+ *  Capsulating property item objects
+ *  @lib cmcommon.lib
+ *  @since S60 v3.1
+ */
+class CCmSqlPropertyCollector : public CBase
+    {
+
+    public:
+
+        /* Constructors and destructor. */
+
+        /**
+         * Creates new CCmSqlPropertyCollector class.
+         * @param None
+         * @return  pointer to CCmSqlPropertyCollector class
+         */
+        IMPORT_C static CCmSqlPropertyCollector* NewL();
+
+        /**
+         * Creates new CCmSqlPropertyCollector class and
+         * leaves the instance in the cleanup stack.
+         * @return  pointer to CCmSqlPropertyCollector class
+         */
+        IMPORT_C static CCmSqlPropertyCollector* NewLC();
+
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CCmSqlPropertyCollector();
+
+    public:
+
+        /**
+         *
+         * @since Series 60 3.1
+         * @param CCmSqlPropertyContainer*
+         * @return TInt
+        */
+        IMPORT_C TInt AddPropertyContainerL(
+                        CCmSqlPropertyContainer* aContainer );
+
+        /**
+         *
+         * @since Series 60 3.1
+         * @param aIndex
+         */
+        IMPORT_C void DeletePropertyContainer( TInt aIndex );
+
+        /**
+         *
+         * @since Series 60 3.1
+         * @param aIndex
+         * @return CCmSqlPropertyContainer*
+         */
+        IMPORT_C CCmSqlPropertyContainer* PropertyContainer( TInt aIndex );
+
+        /**
+         *
+         * @since Series 60 3.1
+         * @return TInt
+         */
+        IMPORT_C TInt PropertyContainerCount() const;
+
+    public:
+
+        /**
+         * Externalizes container information to stream.
+         * Leaves in case of errors.
+         * @since Series 60 3.1
+         * @param reference to RWriteStream
+         * @return none
+         */
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+        /**
+         * Internalizes container information from stream.
+         * Leaves in case of errors.
+         * @since Series 60 3.1
+         * @param reference to RReadStream
+         * @return none
+         */
+        IMPORT_C void InternalizeL( RReadStream& aStream );
+
+    protected:
+
+        /**
+         * Constructor.
+         */
+        CCmSqlPropertyCollector();
+
+        /**
+         * Second-phase constructor.
+         */
+        void ConstructL();
+
+
+    private: // data
+     
+        /**
+         * array of metadata containers
+         */
+        RPointerArray<CCmSqlPropertyContainer> iPropertyContainers;
+    };
+
+
+#endif //  __CMSQLPROPERTYCOLLECTOR_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlpropertycontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating property item objects
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLPROPERTYCONTAINER_H
+#define __CMSQLPROPERTYCONTAINER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmcommontypes.h"
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+class CCmSqlPropertyItem;
+
+/**
+ *  CCmSqlPropertyContainer class
+ *  Capsulating property item objects
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmSqlPropertyContainer : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSqlPropertyContainer class.
+     * @param None
+     * @return  pointer to CCmSqlPropertyContainer class
+     */
+    IMPORT_C static CCmSqlPropertyContainer* NewL();
+
+    /**
+     * Creates new CCmSqlPropertyContainer class and
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmSqlPropertyContainer class
+     */
+    IMPORT_C static CCmSqlPropertyContainer* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmSqlPropertyContainer();
+
+public:
+
+    /**
+    *
+    * @since Series 60 3.1
+    * @param CCmSqlPropertyItem*
+    */
+    IMPORT_C void AddPropertyItemL( CCmSqlPropertyItem* aItem );
+
+    /**
+    *
+    * @since Series 60 3.1
+    * @param aIndex
+    */
+    IMPORT_C void DeletePropertyItem( TInt aIndex );
+
+    /**
+    *
+    * @since Series 60 3.1
+    * @param aIndex
+    * @return CCmSqlPropertyItem*
+    */
+    IMPORT_C CCmSqlPropertyItem* PropertyItem( TInt aIndex );
+
+    /**
+    *
+    * @since Series 60 3.1
+    * @return TInt
+    */
+    IMPORT_C TInt PropertyItemCount() const;
+
+    /**
+    *
+    * @since Series 60 3.1
+    * @return TInt
+    */
+    IMPORT_C void SetType( TCmMetadataField aType );
+
+    /**
+    *
+    * @since Series 60 3.1
+    * @return TCmMetadataField
+    */
+    IMPORT_C TCmMetadataField Type( );
+
+    /**
+    *
+    * @since Series 60 3.1
+    * @param aItem, item to be checked
+    * @return ETrue if duplicate
+    */
+    IMPORT_C TBool IsDuplicate( CCmSqlPropertyItem& aItem );
+
+public:
+
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+
+    /**
+     * Sort item by alphabet
+     * @since S60 5.1
+     *
+     * @param None
+     * @return none
+     */
+    IMPORT_C void SortPropertyItem( );
+
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmSqlPropertyContainer();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * The function which determines the order of two class T type objects
+     *
+     * @since S60 5.1
+     * @param aItemOne, first item
+     * @param aItemTwo, second item
+     * @return TInt, match value
+     */
+    static TInt CompareItem( const CCmSqlPropertyItem& aItemOne,
+                                const CCmSqlPropertyItem& aItemTwo );
+                                
+private: // data
+
+    RPointerArray<CCmSqlPropertyItem> iPropertyItems; // items owned
+    TCmMetadataField                  iType;
+    };
+
+
+#endif //  __CMSQLPROPERTYCONTAINER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlpropertyitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating property items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLPROPERTYITEM_H
+#define __CMSQLPROPERTYITEM_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+/**
+ *  CCmSqlPropertyItem class
+ *  Capsulating property items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmSqlPropertyItem : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSqlPropertyItem class.
+     * @param None
+     * @return  pointer to CCmSqlPropertyItem class
+     */
+    IMPORT_C static CCmSqlPropertyItem* NewL();
+
+    /**
+     * Creates new CCmSqlPropertyItem class and
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmSqlPropertyItem class
+     */
+    IMPORT_C static CCmSqlPropertyItem* NewLC();
+
+    IMPORT_C CCmSqlPropertyItem( const CCmSqlPropertyItem& aItem );
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmSqlPropertyItem();
+
+public:
+
+    /**
+    * Sets database id
+    * @since Series 60 3.1
+    * @param aId, database id
+    * @return None
+    */
+    IMPORT_C void SetId( const TInt64 aId );
+
+    /**
+    * Sets value of the property in textual format
+    * @since Series 60 3.1
+    * @param aName, text field
+    * @return None
+    */
+    IMPORT_C void SetNameL( const TDesC8& aName );
+
+    /**
+    * Sets status of the item
+    * @since Series 60 3.1
+    * @param aStatus, ETrue if item already in db
+    * @return None
+    */
+    IMPORT_C void SetStatus( const TBool aStatus );
+
+    /**
+    * Gets database id
+    * @since Series 60 3.1
+    * @param None
+    * @return Database id
+    */
+    IMPORT_C TInt64 Id() const;
+
+    /**
+    * Gets property text value
+    * @since Series 60 3.1
+    * @param None
+    * @return Property value
+    */
+    IMPORT_C TDesC8& Name() const;
+
+    /**
+    * Gets status of the item
+    * @since Series 60 3.1
+    * @param None
+    * @return Status ( ETrue if item already in db )
+    */
+    IMPORT_C TBool Status() const;
+
+    /**
+    * Compares items
+    * @since Series 60 3.1
+    * @param aFirst, first item
+    * @param aSecond, second item
+    * @return Comparison result
+    */
+    IMPORT_C static TInt CompareItemsByName( const CCmSqlPropertyItem& aFirst,
+                               const CCmSqlPropertyItem& aSecond );
+
+public:
+
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmSqlPropertyItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+
+
+private: // data
+
+    // Database id
+    TInt64 iId;
+
+    // Property value
+    HBufC8* iName; // owned
+
+    // Status value
+    TBool iStatus;
+
+
+    };
+
+
+#endif //  __CMSQLPROPERTYITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlresolutionpropertyitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating resolution property items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLRESOLUTIONPROPERTYITEM_H
+#define __CMSQLRESOLUTIONPROPERTYITEM_H
+
+// INCLUDES
+#include "cmsqlpropertyitem.h"
+
+// FORWARD DECLARATIONS
+
+/**
+ *  CCmSqlResolutionPropertyItem class
+ *  Capsulating resolution property items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.1
+ */
+class CCmSqlResolutionPropertyItem : public CCmSqlPropertyItem
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSqlResolutionPropertyItem class.
+     * @param None
+     * @return  pointer to CCmSqlResolutionPropertyItem class
+     */
+    IMPORT_C static CCmSqlResolutionPropertyItem* NewL();
+    
+    /**
+     * Creates new CCmSqlResolutionPropertyItem class and 
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmSqlResolutionPropertyItem class
+     */
+    IMPORT_C static CCmSqlResolutionPropertyItem* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmSqlResolutionPropertyItem();
+
+public: 
+
+    /**
+    * Sets width of the image
+    * @since Series 60 3.1
+    * @param aWidth, width of the image
+    * @return None
+    */
+    IMPORT_C void SetWidth( const TInt aWidth );
+    
+    /**
+    * Sets height of the image
+    * @since Series 60 3.1
+    * @param aHeight, height of the image
+    * @return None
+    */    
+    IMPORT_C void SetHeight( const TInt aHeight );
+   
+    /**
+    * Sets pixel count of the item 
+    * @since Series 60 3.1
+    * @param aSize, size of video or image item ( in bytes )
+    * @return None
+    */   
+    IMPORT_C void SetPixelCount( const TInt aPixelCount );
+
+    /**
+    * Gets width of the image
+    * @since Series 60 3.1
+    * @param None
+    * @return Duration
+    */    
+    IMPORT_C TInt Width() const;
+    
+    /**
+    * Gets height of the image
+    * @since Series 60 3.1
+    * @param None
+    * @return Bitrate
+    */    
+    IMPORT_C TInt Height() const;
+    
+    /**
+    * Gets pixel count of the image
+    * @since Series 60 3.1
+    * @param None
+    * @return Bitrate
+    */    
+    IMPORT_C TInt PixelCount() const;    
+    
+    /**
+    * Compares items
+    * @since Series 60 3.1
+    * @param aFirst, first item
+    * @param aSecond, second item
+    * @return Comparison result
+    */     
+    IMPORT_C static TInt CompareItemsByName( 
+        const CCmSqlResolutionPropertyItem& aFirst,
+        const CCmSqlResolutionPropertyItem& aSecond );
+                                                  
+public:
+        
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );    
+
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmSqlResolutionPropertyItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+  
+    // Width of image
+    TInt iWidth;
+    
+    // Height of image
+    TInt iHeight;
+   
+    // Pixel count of image 
+    TInt iPixelCount; 
+     
+    };
+
+                                                          
+#endif //  __CMSQLRESOLUTIONPROPERTYITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmsqlvideoitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLVIDEOITEM_H
+#define __CMSQLVIDEOITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmsqlgenericitem.h"
+
+// FORWARD DECLARATIONS
+
+/**
+ *  CCmSqlVideoItem class
+ *  Capsulating sql items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmSqlVideoItem : public CCmSqlGenericItem
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmSqlVideoItem class.
+     * @param None
+     * @return  pointer to CCmSqlVideoItem class
+     */
+    IMPORT_C static CCmSqlVideoItem* NewL();
+    
+    /**
+     * Creates new CCmSqlVideoItem class and 
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmSqlVideoItem class
+     */
+    IMPORT_C static CCmSqlVideoItem* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmSqlVideoItem();
+  
+public:
+
+    /**
+    * Sets genre id
+    * @since Series 60 3.1
+    * @param aGenreId, genre
+    * @return None
+    */
+    IMPORT_C void SetGenreId( const TInt64 aGenreId );
+
+    /**
+    * Gets genre id
+    * @since Series 60 3.1
+    * @param None
+    * @return genre id
+    */     
+    IMPORT_C TInt64 GenreId() const;
+    
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmSqlVideoItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+    
+    // Genre id
+    TInt64 iGenreId;
+    
+    };
+
+#endif //  __CMSQLVIDEOITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmstorelistitem.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Store file list items
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSTORELISTITEM_H
+#define __CMSTORELISTITEM_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmbaselistitem.h"
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+/**
+ *  CCmStoreListItem class
+ *    Capsulating Store file list items
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmStoreListItem : public CCmBaseListItem
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmStoreListItem class.
+     * @return  pointer to CCmStoreListItem class
+     */
+    IMPORT_C static CCmStoreListItem* NewL();
+    
+    /**
+     * Creates new CCmStoreListItem class and 
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CCmStoreListItem class
+     */
+    IMPORT_C static CCmStoreListItem* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmStoreListItem();
+
+public:
+    
+    // Sets
+    IMPORT_C void SetListId( const TUint aListId );
+        
+    IMPORT_C void SetDevId( const TUint8 aId, TCmListItemStatus aStatus );
+
+    // Gets
+    IMPORT_C TUint ListId() const;
+    
+    IMPORT_C RArray<TInt> DevIds() const;
+    
+    IMPORT_C RArray<TCmListItemStatus> StatusValues() const;
+    
+    IMPORT_C void UpdateFileStatusL( const TUint8 aId, 
+                        TCmListItemStatus aStatus );
+    
+    /** 
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );    
+
+protected:
+
+    /**
+     * Constructor.
+     */
+    CCmStoreListItem();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+
+    TUint iListId;
+    RArray<TInt>iDeviceIds;
+    RArray<TCmListItemStatus>iStatusValues;
+    };
+
+#endif //  __CMSTORELISTITEM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmstorerule.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,307 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill rule
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSTORERULE_H
+#define __CMSTORERULE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include "cmcommontypes.h"
+#include "cmcommon.h"
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+class CCmMediaServer;
+
+class TCmStoreRuleMediaServers
+    {
+public: // public member variables
+    CCmMediaServer* iMediaServer; // Media server object
+    TCmMediaType iMediaType;      // Media type
+    };
+    
+/**
+ *  CCmStoreRule class
+ *    Capsulating store rules
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmStoreRule : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmStoreRule class.
+     * @param None
+     * @return  pointer to CCmStoreRule class
+     */
+    IMPORT_C static CCmStoreRule* NewL();
+    
+    /**
+     * Creates new CCmStoreRule class and 
+     * leaves the instance in the cleanup stack.
+     * @param None
+     * @return  pointer to CCmStoreRule class
+     */
+    IMPORT_C static CCmStoreRule* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmStoreRule();
+
+public:
+
+    /**
+     * AddStoreRuleL.
+     * @since Series 60 3.1     
+     * @param aMediaType
+     * @returns index of the rule
+     */
+    IMPORT_C TInt AddStoreRuleL( TCmMediaType aMediaType );
+
+    /**
+     * StoreRule.
+     * @since Series 60 3.1     
+     * @param aIndex rule index
+     * @param aMediaType
+     * @returns index of the rule
+     */    
+    IMPORT_C void StoreRule( TInt aIndex, TCmMediaType* aMediaType );
+
+    /**
+     * AddMediaServerL.
+     * @since Series 60 3.1     
+     * @param aUDN
+     * @returns index of the media server
+     */    
+    IMPORT_C TInt AddMediaServerL( const TDesC8& aUDN );
+    
+    /**
+     * DeleteMediaServer.
+     * @since Series 60 3.1     
+     * @param aUDN
+     * @returns None
+     */        
+    IMPORT_C void DeleteMediaServer( const TDesC8& aUDN );
+
+    /**
+     * AddExcAlbumL.
+     * @since Series 60 3.1     
+     * @param aAlbum
+     * @returns None
+     */        
+    IMPORT_C void AddExcAlbumL( const TDesC& aAlbum );
+    
+    /**
+     * AddExcPlayListL.
+     * @since Series 60 3.1     
+     * @param aPlayList
+     * @returns None
+     */        
+    IMPORT_C void AddExcPlayListL( const TDesC& aPlayList );
+    
+    /**
+     * RemoveExcAlbum.
+     * @since Series 60 3.1     
+     * @param aAlbum
+     * @returns None
+     */        
+    IMPORT_C void RemoveExcAlbum( const TDesC& aAlbum );
+    
+    /**
+     * RemoveExcPlayList.
+     * @since Series 60 3.1     
+     * @param aPlayList
+     * @returns None
+     */        
+    IMPORT_C void RemoveExcPlayList( const TDesC& aPlayList );
+
+    /**
+     * ExcAlbums.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns array of albums
+     */
+    IMPORT_C CDesCArray& ExcAlbums();
+
+    /**
+     * ExcPlayLists.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns array of play lists
+     */
+    IMPORT_C CDesCArray& ExcPlayLists();
+                
+    /**
+     * MediaServer.
+     * @since Series 60 3.1     
+     * @param aIndex index of the rule
+     * @returns server uuid
+     */    
+    IMPORT_C const TDesC8& MediaServerL( TInt aIndex );    
+    
+    /**
+     * SetNameL.
+     * @since Series 60 3.1     
+     * @param aName
+     * @returns None
+     */    
+    IMPORT_C void SetNameL( const TDesC8& aName );
+    
+    /**
+     * Name.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns name of the fill rule
+     */    
+    IMPORT_C TDesC8& Name() const;
+    
+    /**
+     * SetListId.
+     * @since Series 60 3.1     
+     * @param aId
+     * @returns None
+     */        
+    IMPORT_C void SetListId( const TUint aId );
+    
+    /**
+     * ListId.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns id of the store list
+     */        
+    IMPORT_C TUint ListId() const;
+    
+    /**
+     * SetSelected.
+     * @since Series 60 3.1     
+     * @param aSelected
+     * @returns None
+     */    
+    IMPORT_C void SetSelected( TCmFillRuleStatus aSelected );
+
+    /**
+     * Selected.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns status
+     */        
+    IMPORT_C TCmFillRuleStatus Selected() const;
+
+    /**
+     * SetStatus.
+     * @since Series 60 3.1     
+     * @param aStatus
+     * @returns None
+     */    
+    IMPORT_C void SetStatus( TCmListItemStatus aStatus );
+
+    /**
+     * Status.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns status
+     */    
+    IMPORT_C TCmListItemStatus Status() const;
+            
+    /**
+     * DefCount.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns count
+     */    
+    IMPORT_C TInt DefCount() const;
+    
+    /**
+     * MediaServerCount.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns count
+     */    
+    IMPORT_C TInt MediaServerCount() const;
+    
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    void InternalizeL( RReadStream& aStream );        
+
+private:
+
+    /**
+     * Constructor.
+     */
+    CCmStoreRule();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+    
+    /** Rule name */
+    HBufC8* iName; // owned
+    
+    /** Selected or not */
+    TCmFillRuleStatus iSelected;
+    
+    /** Rule defs */    
+    RArray<TCmMediaType> iRuleDefs;
+       
+    /** Array rules included to fill rule*/
+    RPointerArray<CCmMediaServer> iMediaServers; // items owned
+    
+    /** Id of the fill list */
+    TUint iId;
+    
+    /** Excluded albums */
+    CDesCArray* iExcAlbums; // owned
+    
+    /** Excluded playlists */
+    CDesCArray* iExcPlayLists; // owned
+    
+    /** How to handle list items after store */
+    TCmListItemStatus iStatus;
+
+    };
+
+#endif //  __CMSTORERULE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/inc/cmstorerulecontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating store rules
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSTORERULECONTAINER_H
+#define __CMSTORERULECONTAINER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+class CCmStoreRule;
+
+/**
+ *  CCmStoreRuleContainer class
+ *    Capsulating store rules
+ *  @lib cmcommon.lib
+ *  @since S60 v3.0
+ */
+class CCmStoreRuleContainer : public CBase
+    {
+
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CCmStoreRuleContainer class.
+     * @param None
+     * @return  pointer to CCmStoreRuleContainer class
+     */
+    IMPORT_C static CCmStoreRuleContainer* NewL();
+    
+    /**
+     * Creates new CCmStoreRuleContainer class and 
+     * leaves the instance in the cleanup stack.
+     * @param None
+     * @return  pointer to CCmStoreRuleContainer class
+     */
+    IMPORT_C static CCmStoreRuleContainer* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmStoreRuleContainer();
+
+public:
+
+    /**
+     * AddStoreRuleL.
+     * @since Series 60 3.1     
+     * @param aRule
+     * @returns index of the rule
+     */
+    IMPORT_C TInt AddStoreRuleL( CCmStoreRule* aRule );
+
+    /**
+     * DeleteStoreRule.
+     * @since Series 60 3.1
+     * @param Index
+     * @returns None
+     */    
+    IMPORT_C void DeleteStoreRule( TInt aIndex );
+
+    /**
+     * StoreRule.
+     * @since Series 60 3.1     
+     * @param aIndex rule index
+     * @returns store rule
+     */    
+    IMPORT_C CCmStoreRule* StoreRule( TInt aIndex );
+
+    /**
+     * StoreRuleCount.
+     * @since Series 60 3.1     
+     * @param None
+     * @returns count
+     */    
+    IMPORT_C TInt StoreRuleCount() const;
+    
+    /**
+    * Externalizes container information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+    
+    /**
+    * Internalizes container information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.1
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );    
+    
+private:
+
+    /**
+     * Constructor.
+     */
+    CCmStoreRuleContainer();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+    
+    // Array rules included to fill rule. 
+    RPointerArray<CCmStoreRule> iStoreRuleArray; // Items owned
+
+    };
+
+#endif //  __CMSTORERULECONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmbaselistitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill and store file lists
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmbaselistitem.h"
+#include "msdebug.h"
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmBaseListItem* CCmBaseListItem::NewL()
+    {   
+    CCmBaseListItem* self = CCmBaseListItem::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmBaseListItem* CCmBaseListItem::NewLC()
+    {    
+    CCmBaseListItem* self = new ( ELeave ) CCmBaseListItem();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmBaseListItem::~CCmBaseListItem()
+    {
+    delete iPrimaryText;
+    delete iSecondaryText;
+    delete iPath;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SetPrimaryTextL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::SetPrimaryTextL( const TDesC& aText )
+    {
+    if( &aText )
+        {
+        delete iPrimaryText;
+        iPrimaryText = NULL;
+        iPrimaryText = aText.AllocL();        
+        }
+    else
+        {
+        delete iPrimaryText;
+        iPrimaryText = NULL;
+        iPrimaryText = KNullDesC().AllocL();     
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SetSecondaryTextL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::SetSecondaryTextL( const TDesC& aText )
+    {
+    if( &aText )
+        {
+        delete iSecondaryText;
+        iSecondaryText = NULL;
+        iSecondaryText = aText.AllocL();        
+        }
+    else
+        {
+        delete iSecondaryText;
+        iSecondaryText = NULL;        
+        iSecondaryText = KNullDesC().AllocL();     
+        }            
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SetPathL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::SetPathL( const TDesC& aText )
+    {
+    if( &aText )
+        {
+        delete iPath;
+        iPath = NULL;
+        iPath = aText.AllocL();        
+        }
+    else
+        {
+        delete iPath;
+        iPath = NULL;        
+        iPath = KNullDesC().AllocL();     
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SetSize
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::SetSize( const TUint32 aSize )
+    {
+    iSize = aSize;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SetDate
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::SetDate( const TTime aDate )
+    {
+    iDate = aDate;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SetStatus
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::SetStatus( const TCmListItemStatus aStatus )
+    {
+    iStatus = aStatus;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SetDbId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::SetDbId( const TUint64 aId )
+    {
+    iId = aId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SetRefId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::SetRefId( const TUint64 aId )
+    {
+    iRefId = aId;
+    } 
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SetMediaType
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::SetMediaType( const TCmMediaType aMediaType )
+    {
+    iMediaType = aMediaType;
+    }
+                
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::PrimaryText
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC& CCmBaseListItem::PrimaryText() const
+    {
+    return *iPrimaryText;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::SecondaryText
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC& CCmBaseListItem::SecondaryText() const
+    {
+    return *iSecondaryText;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::Path
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC& CCmBaseListItem::Path() const
+    {
+    return *iPath;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::Size
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CCmBaseListItem::Size() const
+    {
+    return iSize;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::Date
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TTime CCmBaseListItem::Date() const
+    {
+    return iDate;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::Status
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmListItemStatus CCmBaseListItem::Status() const
+    {
+    return iStatus;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::DbId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint64 CCmBaseListItem::DbId() const
+    {
+    return iId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::RefId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint64 CCmBaseListItem::RefId() const
+    {
+    return iRefId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::MediaType
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmMediaType CCmBaseListItem::MediaType() const
+    {
+    return iMediaType;
+    }
+            
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iPrimaryText->Length() );
+    if ( iPrimaryText )
+        {
+        aStream << *iPrimaryText;
+        }
+    else
+        {
+        aStream << KNullDesC();
+        }
+    aStream.WriteInt32L( iSecondaryText->Length() );
+    if ( iSecondaryText )
+        {
+        aStream << *iSecondaryText;
+        }
+    else
+        {
+        aStream << KNullDesC();
+        }
+        
+    aStream.WriteInt32L( iPath->Length() );
+    if ( iPath )
+        {
+        aStream << *iPath;
+        }
+    else
+        {
+        aStream << KNullDesC();
+        }
+                
+    aStream.WriteInt32L( iSize );
+    aStream.WriteUint32L( iDate.Int64() );
+    aStream.WriteInt32L( iStatus );
+    aStream.WriteUint32L( iId );
+    aStream.WriteUint32L( iRefId );    
+    aStream.WriteInt32L( iMediaType );    
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmBaseListItem::InternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmBaseListItem::InternalizeL( RReadStream& aStream )
+    {
+    // Content
+    delete iPrimaryText;
+    iPrimaryText = NULL;
+
+    TInt bufLength = aStream.ReadInt32L();    
+    iPrimaryText = HBufC::NewL( aStream, bufLength ); 
+
+    delete iSecondaryText;
+    iSecondaryText = NULL;
+
+    bufLength = aStream.ReadInt32L();    
+    iSecondaryText = HBufC::NewL( aStream, bufLength );
+
+    delete iPath;
+    iPath = NULL;
+
+    bufLength = aStream.ReadInt32L();    
+    iPath = HBufC::NewL( aStream, bufLength );    
+    iSize = aStream.ReadInt32L();
+    iDate = aStream.ReadUint32L();
+    iStatus = (TCmListItemStatus)aStream.ReadInt32L();
+    iId = aStream.ReadUint32L();
+    iRefId = aStream.ReadUint32L();     
+    iMediaType = static_cast<TCmMediaType>( aStream.ReadInt32L() );
+    }
+        
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmBaseListItem::CCmBaseListItem()
+    {            
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmBaseListItem::ConstructL()
+    {
+    iPrimaryText = KNullDesC().AllocL();    
+    iSecondaryText = KNullDesC().AllocL();    
+    iPath = KNullDesC().AllocL();
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmcommonutils.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implementation of common utility class
+*
+*/
+
+
+
+
+
+
+#include <f32file.h>
+#include <bautils.h>
+#include <eikenv.h>
+#include <AknUtils.h>
+#include <commdb.h>
+#include <WlanCdbCols.h>
+#include <wlanmgmtclient.h>
+#include <pathinfo.h>
+
+#include "cmcommonutils.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CmCommonUtils::LoadResourceFileL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CmCommonUtils::LoadResourceFileL( const TDesC& aFilePath,
+                                                CEikonEnv& eikonEnv )
+    {
+    LOG(_L("[CmCommonUtils]\t CmCommonUtils::LoadResourceFileL"));
+        
+    TInt resFileOffset( 0 );
+            
+    RFs& fileSession = eikonEnv.FsSession();
+
+    // Load resource file
+    TFileName rscFileName( aFilePath );
+    TInt err = CompleteWithAppPath( rscFileName );
+    if ( err != KErrNone )
+        {
+        User::LeaveIfError( err);
+        }
+
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( fileSession, rscFileName ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    TRAP( err, resFileOffset = eikonEnv.AddResourceFileL( rscFileName ) );
+    if ( err != KErrNone )
+        {
+        // try memory card drive
+        rscFileName.Copy( PathInfo::MemoryCardRootPath() );
+        rscFileName.Delete( 2, 2 ); // remove '//'
+        rscFileName.Append( aFilePath );
+        resFileOffset = eikonEnv.AddResourceFileL( rscFileName );
+        }
+    
+    return resFileOffset;    
+    }
+
+// ---------------------------------------------------------------------------
+// CmCommonUtils::SetWlanScanL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CmCommonUtils::SetWlanScanL( const TInt aInterval )
+    {
+    LOG(_L("[CmCommonUtils]\t CmCommonUtils::SetWlanScanL"));
+
+#ifndef __WINS__
+
+    // open commsdb
+    CCommsDatabase* commsDb = CCommsDatabase::NewL();
+    CleanupStack::PushL( commsDb );
+
+    // open wlan table
+    CCommsDbTableView* view = commsDb->OpenViewMatchingUintLC
+        (
+        TPtrC( WLAN_DEVICE_SETTINGS ),
+        TPtrC( WLAN_DEVICE_SETTINGS_TYPE ), KWlanUserSettings
+        );
+
+    User::LeaveIfError( view->GotoFirstRecord() );
+    User::LeaveIfError( view->UpdateRecord() );
+
+    // set scan interval
+    view->WriteUintL( TPtrC( WLAN_BG_SCAN_INTERVAL ), aInterval );
+
+    view->WriteBoolL( TPtrC( WLAN_ALLOW_RADIO_MEASUREMENTS ), ETrue );
+    view->WriteBoolL( TPtrC( WLAN_POWER_MODE ), EFalse );
+    User::LeaveIfError( view->PutRecordChanges() );
+
+    CleanupStack::PopAndDestroy( view );
+    CleanupStack::PopAndDestroy( commsDb );
+
+    CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL();
+    CleanupStack::PushL( wlanMgmtClient );
+    // notify about changes
+    wlanMgmtClient->NotifyChangedSettings();
+    CleanupStack::PopAndDestroy( wlanMgmtClient );
+#endif
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmdriveinfo.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,263 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implementation of drive info class
+*
+*/
+
+
+
+
+
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmdriveinfo.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// --------------------------------------------------------------------------
+// CCmDriveInfo::NewL
+// --------------------------------------------------------------------------
+EXPORT_C CCmDriveInfo* CCmDriveInfo::NewL()
+    {
+    CCmDriveInfo* self = CCmDriveInfo::NewLC();
+    CleanupStack::Pop( self );
+    return self;    
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::NewLC
+// --------------------------------------------------------------------------
+EXPORT_C CCmDriveInfo* CCmDriveInfo::NewLC()
+    {
+    CCmDriveInfo* self = new ( ELeave ) CCmDriveInfo();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;     
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmDriveInfo::~CCmDriveInfo()
+    {
+    delete iDriveName;          
+    }
+                        
+// --------------------------------------------------------------------------
+// CCmDriveInfo::SetDriveNumber
+// --------------------------------------------------------------------------
+EXPORT_C void CCmDriveInfo::SetDriveNumber( const TInt aDriveNumber )
+    {
+    iDriveNumber = aDriveNumber;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::DriveNumber
+// --------------------------------------------------------------------------
+EXPORT_C TInt CCmDriveInfo::DriveNumber() const
+    {
+    return iDriveNumber;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::SetDriveType
+// --------------------------------------------------------------------------
+EXPORT_C void CCmDriveInfo::SetDriveType( const TUint aDriveType )
+    {
+    iDriveType = aDriveType;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::DriveType
+// --------------------------------------------------------------------------
+EXPORT_C TUint CCmDriveInfo::DriveType() const
+    {
+    return iDriveType;
+    }
+        
+// --------------------------------------------------------------------------
+// CCmDriveInfo::SetDriveName
+// --------------------------------------------------------------------------
+EXPORT_C void CCmDriveInfo::SetDriveNameL( const TDesC& aDriveName )
+    {
+    delete iDriveName;
+    iDriveName = NULL;        
+
+    if( &aDriveName )
+        {
+        iDriveName = aDriveName.AllocL();
+        }
+    else
+        {
+        iDriveName = KNullDesC().AllocL();
+        }      
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::DriveName
+// --------------------------------------------------------------------------
+EXPORT_C TDesC& CCmDriveInfo::DriveName() const
+    {
+    return *iDriveName;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::SetDriveSize
+// --------------------------------------------------------------------------
+EXPORT_C void CCmDriveInfo::SetDriveSize( const TInt64 aDriveSize )
+    {
+    iSize = aDriveSize;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::DriveSize
+// --------------------------------------------------------------------------
+EXPORT_C TInt64 CCmDriveInfo::DriveSize() const
+    {
+    return iSize;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::SetDriveSize
+// --------------------------------------------------------------------------
+EXPORT_C void CCmDriveInfo::SetDriveQuota( const TInt64 aDriveQuota )
+    {
+    iQuota = aDriveQuota;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::DriveSize
+// --------------------------------------------------------------------------
+EXPORT_C TInt64 CCmDriveInfo::DriveQuota() const
+    {
+    return iQuota;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::SetUsedDriveSize
+// --------------------------------------------------------------------------
+EXPORT_C void CCmDriveInfo::SetUsedDriveQuota( const TInt64 aUsedDriveQuota )
+    {
+    iUsedQuota = aUsedDriveQuota;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::UsedDriveQuota
+// --------------------------------------------------------------------------
+EXPORT_C TInt64 CCmDriveInfo::UsedDriveQuota() const
+    {
+    return iUsedQuota;
+    }
+        
+// --------------------------------------------------------------------------
+// CCmDriveInfo::SetDriveId
+// --------------------------------------------------------------------------
+EXPORT_C void CCmDriveInfo::SetDriveId( const TUint aDriveId )
+    {
+    iUniqueId = aDriveId; 
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::DriveId
+// --------------------------------------------------------------------------
+EXPORT_C TUint CCmDriveInfo::DriveId() const
+    {
+    return iUniqueId;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::SetStatus
+// --------------------------------------------------------------------------
+EXPORT_C void CCmDriveInfo::SetStatus( const TBool aActive )
+    {
+    iActive = aActive;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDriveInfo::Status
+// --------------------------------------------------------------------
+EXPORT_C TBool CCmDriveInfo::Status() const
+    {
+    return iActive;
+    }
+// ---------------------------------------------------------------------------
+// CCmDriveInfo::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDriveInfo::ExternalizeL( RWriteStream& aStream ) const
+    {    
+    aStream.WriteInt32L( iDriveNumber );
+    aStream.WriteInt32L( iDriveType );    
+    if ( iDriveName )
+        {
+        aStream.WriteInt32L( iDriveName->Length() );    
+        aStream << *iDriveName;
+        }
+    else
+        {
+        aStream.WriteInt32L( 0 );    
+        aStream << KNullDesC();
+        }
+    
+    aStream.WriteUint32L( I64HIGH( iSize ) );
+    aStream.WriteUint32L( I64LOW( iSize ) );
+    
+    aStream.WriteUint32L( I64HIGH( iQuota ) );
+    aStream.WriteUint32L( I64LOW( iQuota ) );
+    
+    aStream.WriteUint32L( I64HIGH( iUsedQuota ) );
+    aStream.WriteUint32L( I64LOW( iUsedQuota ) );
+    
+    aStream.WriteInt32L( iUniqueId );
+    aStream.WriteInt32L( (TInt)iActive );                    
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmDriveInfo::InternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDriveInfo::InternalizeL( RReadStream& aStream )
+    {       
+    iDriveNumber = aStream.ReadInt32L();
+    iDriveType = aStream.ReadInt32L();
+
+    delete iDriveName;
+    iDriveName = NULL;
+
+    TInt bufLength = aStream.ReadInt32L();    
+    iDriveName = HBufC::NewL( aStream, bufLength );
+    
+    iSize = MAKE_TINT64( aStream.ReadUint32L(), aStream.ReadUint32L() );
+    iQuota = MAKE_TINT64( aStream.ReadUint32L(), aStream.ReadUint32L() );
+    iUsedQuota = MAKE_TINT64( aStream.ReadUint32L(), aStream.ReadUint32L() );
+    iUniqueId = aStream.ReadInt32L();
+    iActive = (TBool)aStream.ReadInt32L();                            
+    }
+     
+// --------------------------------------------------------------------------
+// CCmDriveInfo::CCmDriveInfo
+// --------------------------------------------------------------------------
+CCmDriveInfo::CCmDriveInfo()
+    {
+    }
+                
+// --------------------------------------------------------------------------
+// CCmDriveInfo::ConstructL
+// --------------------------------------------------------------------------
+void CCmDriveInfo::ConstructL()
+    {
+    iDriveName = KNullDesC().AllocL();
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmfilllistitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,397 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill file list item
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmfilllistitem.h"
+#include "msdebug.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmFillListItem* CCmFillListItem::NewL()
+    {    
+    CCmFillListItem* self = CCmFillListItem::NewLC();
+    CleanupStack::Pop( self ); 
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmFillListItem* CCmFillListItem::NewLC()
+    {    
+    CCmFillListItem* self = new ( ELeave ) CCmFillListItem();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// NewLC with parameters
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C CCmFillListItem* CCmFillListItem::NewLC( const TUint aPriority, 
+    const TUint aListId, const TUint aStatus, 
+    const TCmFillRuleStatus aSelected )
+    {
+    CCmFillListItem* self = new ( ELeave ) CCmFillListItem();
+    CleanupStack::PushL( self );
+    self->ConstructL( aPriority, aListId, aStatus, aSelected ); 
+    return self;
+    }
+        
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmFillListItem::~CCmFillListItem()
+    {
+    delete iUpnpClass;
+    delete iUri;
+    delete iItemId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::SetUpnpClassL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::SetUpnpClassL( const TDesC& aUpnpClass )
+    {
+    if( &aUpnpClass )
+        {
+        delete iUpnpClass;
+        iUpnpClass = NULL;
+        iUpnpClass = aUpnpClass.AllocL();        
+        }
+    else
+        {
+        delete iUpnpClass;
+        iUpnpClass = NULL;
+        iUpnpClass = KNullDesC().AllocL();        
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::SetUriL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::SetUriL( const TDesC8& aUri )
+    {
+    if( &aUri )
+        {
+        delete iUri;
+        iUri = NULL;
+        iUri = aUri.AllocL();         
+        }
+    else
+        {
+        delete iUri;
+        iUri = NULL;
+        iUri = KNullDesC8().AllocL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::SetItemIdL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::SetItemIdL( const TDesC8& aItemId )
+    {
+    if( &aItemId )
+        {
+        delete iItemId;
+        iItemId = NULL;
+        iItemId = aItemId.AllocL();         
+        }
+    else
+        {
+        delete iItemId;
+        iItemId = NULL;
+        iItemId = KNullDesC8().AllocL();
+        }            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::SetListId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::SetListId( const TUint aId )
+    {
+    iListId = aId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::SetDevId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::SetDevId( const TUint8 aDevId )
+    {
+    iDevId = aDevId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::SetPriority
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::SetPriority( const TUint8 aPriority )
+    {
+    iPriority = aPriority;
+    }       
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::SetSelected
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::SetSelected( 
+    TCmFillRuleStatus aSelected  )
+    {
+    iSelected = aSelected;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::SetDriveId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::SetDriveId( const TUint aDriveId )
+    {
+    iDriveId = aDriveId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::SetDriveNumber
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmFillListItem::SetDriveNumber( const TInt aDriveNumber )
+    {
+    iDriveNumber = aDriveNumber;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::UpnpClass
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC& CCmFillListItem::UpnpClass() const
+    {
+    return *iUpnpClass;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::Uri
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CCmFillListItem::Uri() const
+    {
+    return *iUri;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::ItemId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CCmFillListItem::ItemId() const
+    {
+    return *iItemId;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::ListId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint CCmFillListItem::ListId() const
+    {
+    return iListId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::DevId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint8 CCmFillListItem::DevId() const
+    {
+    return iDevId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::Priority
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint8 CCmFillListItem::Priority() const
+    {
+    return iPriority;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::Selected
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmFillRuleStatus CCmFillListItem::Selected() const
+    {
+    return iSelected;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::DriveId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint CCmFillListItem::DriveId() const
+    {
+    return iDriveId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillListItem::DriveNumber
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmFillListItem::DriveNumber() const
+    {
+    return iDriveNumber;
+    }
+                     
+// ---------------------------------------------------------------------------
+// CCmFillListItem::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iUpnpClass->Length() );
+    if ( iUpnpClass )
+        {
+        aStream << *iUpnpClass;
+        }
+    else
+        {
+        aStream << KNullDesC();
+        }
+    aStream.WriteInt32L( iUri->Length() );
+    if ( iUri )
+        {
+        aStream << *iUri;
+        }
+    else
+        {
+        aStream << KNullDesC();
+        }
+    aStream.WriteInt32L( iItemId->Length() );
+    if ( iItemId )
+        {
+        aStream << *iItemId;
+        }
+    else
+        {
+        aStream << KNullDesC();
+        }
+                
+    aStream.WriteUint16L( iListId );
+    aStream.WriteUint8L( iDevId );
+    aStream.WriteUint8L( iPriority );
+    aStream.WriteInt32L( iSelected );
+    aStream.WriteUint32L( iDriveId );
+    aStream.WriteInt32L( iDriveNumber );
+    CCmBaseListItem::ExternalizeL(aStream);         
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmFillListItem::InternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillListItem::InternalizeL( RReadStream& aStream )
+    {
+    // Content
+    if ( iUpnpClass )
+        {
+        delete iUpnpClass;
+        iUpnpClass = NULL;
+        }
+    TInt bufLength = aStream.ReadInt32L();    
+    iUpnpClass = HBufC::NewL( aStream, bufLength ); 
+    if ( iUri )
+        {
+        delete iUri;
+        iUri = NULL;
+        }
+    bufLength = aStream.ReadInt32L();    
+    iUri = HBufC8::NewL( aStream, bufLength );
+    if ( iItemId )
+        {
+        delete iItemId;
+        iItemId = NULL;
+        }
+    bufLength = aStream.ReadInt32L();    
+    iItemId = HBufC8::NewL( aStream, bufLength );    
+    iListId = aStream.ReadUint16L();
+    iDevId = aStream.ReadUint8L();
+    iPriority = aStream.ReadUint8L();
+    iSelected = (TCmFillRuleStatus)aStream.ReadInt32L();
+    iDriveId = aStream.ReadUint32L();
+    iDriveNumber = aStream.ReadInt32L();
+    CCmBaseListItem::InternalizeL(aStream);      
+    }
+        
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmFillListItem::CCmFillListItem()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmFillListItem::ConstructL()
+    {
+    // construct base class
+    CCmBaseListItem::ConstructL();
+    
+    // then construct the rest
+    iUpnpClass = KNullDesC().AllocL();
+    iUri = KNullDesC8().AllocL();
+    iItemId = KNullDesC8().AllocL();
+    }
+    
+// ---------------------------------------------------------------------------
+// ConstructL with parameters
+// ---------------------------------------------------------------------------
+//    
+void CCmFillListItem::ConstructL( const TUint aPriority, const TUint aListId, 
+    const TUint aStatus, const TCmFillRuleStatus aSelected )
+    {
+    // construct base class
+    CCmBaseListItem::ConstructL();
+    
+    SetPriority( aPriority );
+    SetListId( aListId );
+    SetStatus( (TCmListItemStatus)aStatus );
+    SetSelected( aSelected );
+    iUpnpClass = KNullDesC().AllocL();
+    iUri = KNullDesC8().AllocL();
+    iItemId = KNullDesC8().AllocL();      
+    }          
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmfillrule.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,782 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill rule
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmmediaserver.h"
+#include "cmfillrule.h"
+#include "cmrule.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KArrayGranularity = 16;
+const TInt KArrayGranularityContainer = 8;
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmFillRule* CCmFillRule::NewL()
+    {   
+    CCmFillRule* self = CCmFillRule::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmFillRule* CCmFillRule::NewLC()
+    {    
+    CCmFillRule* self = new ( ELeave ) CCmFillRule();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmFillRule::~CCmFillRule()
+    {
+    delete iName;
+
+    iRuleArray.ResetAndDestroy();
+    iRuleArray.Close();
+    iMediaServerArray.ResetAndDestroy();
+    iMediaServerArray.Close();
+    
+    iExcPlayLists->Reset();
+    iExcAlbums->Reset();
+            
+    delete iExcPlayLists;
+    delete iExcAlbums;             
+    }
+
+// ---------------------------------------------------------------------------
+// Add new rule into FillRule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmFillRule::AddRuleL( TCmMetadataField aDataField, 
+    TCmOperatorType aOperator )
+    {
+    CCmRule* rule = CCmRule::NewLC();
+    rule->SetMetadataField(aDataField);
+    rule->SetOperator(aOperator);
+    iRuleArray.AppendL( rule ); // transfer ownership
+    CleanupStack::Pop( rule );
+    TInt index = iRuleArray.Count() - 1;    
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// Get rule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::RuleL( TInt aIndex, TCmMetadataField* aDataField, 
+    TCmOperatorType* aOperator, TInt* aParamCount )
+    {
+    // check parameter
+    if ( aIndex < 0 || aIndex >= iRuleArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    iRuleArray[aIndex]->Rule( aDataField, aOperator, aParamCount );
+    }
+
+// ---------------------------------------------------------------------------
+// Delete rule
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmFillRule::DeleteRule( TCmMetadataField aDataField,
+    TCmOperatorType aOper )
+    {
+    TCmMetadataField dataField; TCmOperatorType oper;
+    TInt count;
+    for( TInt i = 0; i < iRuleArray.Count(); i++ )
+        {
+        iRuleArray[i]->Rule( &dataField, &oper, &count );
+        if( dataField == aDataField && oper == aOper )
+            {
+            delete iRuleArray[i];
+            iRuleArray.Remove(i);
+            iRuleArray.Compress();            
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Delete rule
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmFillRule::DeleteRule( TCmMetadataField aDataField )
+    {
+    TCmMetadataField dataField; TCmOperatorType oper;
+    TInt count;
+    for( TInt i = 0; i < iRuleArray.Count(); i++ )
+        {
+        iRuleArray[i]->Rule( &dataField, &oper, &count );
+        if( dataField == aDataField )
+            {
+            delete iRuleArray[i];
+            iRuleArray.Remove(i);
+            iRuleArray.Compress();            
+            }
+        }
+    }    
+// ---------------------------------------------------------------------------
+// Add new rule param into FillRule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmFillRule::AddRuleParamL( TInt aIndex, const TDesC8& aParam )
+    {
+    // check parameter
+    if ( aIndex < 0 || aIndex >= iRuleArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    return iRuleArray[aIndex]->AddRuleParamL( aParam );
+    }    
+
+// ---------------------------------------------------------------------------
+// Add new rule param into FillRule ( Indexed param )
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmFillRule::AddRuleParamL( TInt aIndex, TInt aParam )
+    {
+    // check parameter
+    if ( aIndex < 0 || aIndex >= iRuleArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    return iRuleArray[aIndex]->AddRuleParamL( aParam );
+    } 
+    
+// ---------------------------------------------------------------------------
+// Get rule param
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::RuleParamL( TInt aRuleIndex, TInt aParamIndex, 
+    TPtrC8* aParam )
+    {
+    // check parameter
+    if ( aRuleIndex < 0 || aRuleIndex >= iRuleArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    iRuleArray[aRuleIndex]->RuleParamL( aParamIndex, aParam );
+    }
+
+// ---------------------------------------------------------------------------
+// Get rule param
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::RuleParamL( TInt aRuleIndex, TInt aParamIndex, 
+    TInt& aParam )
+    {
+    // check parameter
+    if ( aRuleIndex < 0 || aRuleIndex >= iRuleArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    iRuleArray[aRuleIndex]->RuleParamL( aParamIndex, aParam );
+    }
+        
+// ---------------------------------------------------------------------------
+// Add new media server into FillRule
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmFillRule::AddMediaServerL( const TDesC8& aUDN )
+    {
+    CCmMediaServer* server = CCmMediaServer::NewLC();
+    server->SetUDNL( aUDN );
+    iMediaServerArray.AppendL( server );
+    TInt index = iMediaServerArray.Count() - 1;    
+    CleanupStack::Pop(server);
+    return index;        
+    }
+
+// ---------------------------------------------------------------------------
+// Add new media server into FillRule
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmFillRule::AddMediaServerL( TInt aDbId )
+    {
+    CCmMediaServer* server = CCmMediaServer::NewLC();
+    server->SetDbId( aDbId );
+    iMediaServerArray.AppendL( server );
+    TInt index = iMediaServerArray.Count() - 1;    
+    CleanupStack::Pop(server);
+    return index;        
+    }
+    
+// ---------------------------------------------------------------------------
+// Delete media server from the fill rule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::DeleteMediaServer( const TDesC8& aUDN )
+    {
+    TBool deleted( EFalse );
+    for( TInt i = 0; i < iMediaServerArray.Count() && !deleted; i++ )
+        {
+        if( KErrNone == iMediaServerArray[i]->MediaServer().Compare(aUDN) )
+            {
+            delete iMediaServerArray[i];
+            iMediaServerArray.Remove(i);
+            iMediaServerArray.Compress();
+            deleted = ETrue;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Delete media server from the fill rule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::DeleteMediaServer( TInt aDbId )
+    {
+    TBool deleted( EFalse );
+    for( TInt i = 0; i < iMediaServerArray.Count() && !deleted; i++ )
+        {
+        if( iMediaServerArray[i]->DbId() == aDbId )
+            {
+            delete iMediaServerArray[i];
+            iMediaServerArray.Remove(i);
+            iMediaServerArray.Compress();
+            deleted = ETrue;
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// Adds one album into excluded list
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::AddExcAlbumL( const TDesC& aAlbum )
+    {
+    iExcAlbums->AppendL( aAlbum );
+    }
+
+// ---------------------------------------------------------------------------
+// Adds one playlist into excluded list
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmFillRule::AddExcPlayListL( const TDesC& aPlayList )
+    {
+    iExcPlayLists->AppendL( aPlayList );
+    }    
+
+// ---------------------------------------------------------------------------
+// Removes defined album from the excluded list
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::RemoveExcAlbum( const TDesC& aAlbum )
+    {
+    TInt pos( KErrNone );
+    TInt err( iExcAlbums->Find( aAlbum, pos ) );
+    if( err == KErrNone )
+        {
+        iExcAlbums->Delete( pos );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Removes defined playlist from the excluded list
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmFillRule::RemoveExcPlayList( const TDesC& aPlayList )
+    {
+    TInt pos( KErrNone );
+    TInt err( iExcPlayLists->Find( aPlayList, pos ) );
+    if( err == KErrNone )
+        {
+        iExcPlayLists->Delete( pos );
+        }    
+    }    
+
+// ---------------------------------------------------------------------------
+// Returns excluded albums
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CDesCArray& CCmFillRule::ExcAlbums() const
+    {
+    return *iExcAlbums;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns excluded playlists
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CDesCArray& CCmFillRule::ExcPlayLists() const
+    {
+    return *iExcPlayLists;
+    }
+        
+// ---------------------------------------------------------------------------
+// Get media server
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C const TDesC8& CCmFillRule::MediaServerL( TInt aIndex )
+    {
+    // check parameter
+    if ( aIndex < 0 || aIndex >= iMediaServerArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    return iMediaServerArray[aIndex]->MediaServer();
+    }
+
+// ---------------------------------------------------------------------------
+// Get media server
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmFillRule::MediaServerL( TInt aIndex, TInt& aServer )
+    {
+    // check parameter
+    if ( aIndex < 0 || aIndex >= iMediaServerArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    aServer = iMediaServerArray[aIndex]->DbId();
+    }
+        
+// ---------------------------------------------------------------------------
+// Returns count of rules
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmFillRule::RuleCount() const
+    {
+    return iRuleArray.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// Returns count of media servers
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmFillRule::MediaServerCount() const
+    {
+    return iMediaServerArray.Count();
+    }    
+
+// ---------------------------------------------------------------------------
+// returns count of params ( in specific rule )
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmFillRule::ParamCountL( TInt aIndex ) const
+    {
+    // check parameter
+    if ( aIndex < 0 || aIndex >= iRuleArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    return iRuleArray[aIndex]->RuleParamsCount();
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets FillRule name
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmFillRule::SetNameL( const TDesC8& aName )
+    {
+    delete iName;
+    iName = NULL;
+    iName = aName.AllocL();
+    return KErrNone;        
+    }
+    
+// ---------------------------------------------------------------------------
+// Get Name
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CCmFillRule::Name() const
+    {
+    return *iName;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets list id, when storing data into db this values isn't used as a 
+// db list id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetListId( const TUint aId )
+    {
+    iId = aId;
+    }
+
+// ---------------------------------------------------------------------------
+// Get list id
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TUint CCmFillRule::ListId() const
+    {
+    return iId;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets amount
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetAmount( TUint32 aAmount )
+    {
+    iAmount = aAmount;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns amount
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CCmFillRule::Amount() const
+    {
+    return iAmount;
+    }
+        
+// ---------------------------------------------------------------------------
+// Sets limit type ( MB or pcs. )
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetLimitType( TCmLimitType aLimitType )
+    {
+    iLimitType = aLimitType;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns limit type
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmLimitType CCmFillRule::LimitType() const
+    {
+    return iLimitType;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets media type
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetMediaType( TCmMediaType aMediaType )
+    {
+    iMediaType = aMediaType;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns media type
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TCmMediaType CCmFillRule::MediaType() const
+    {
+    return iMediaType;
+    }    
+        
+// ---------------------------------------------------------------------------
+// Sets method ( random, newest, oldest etc. )
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetMethod( TCmFillMethod aMethod )
+    {
+    iMethod = aMethod;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns method
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmFillMethod CCmFillRule::Method() const
+    {
+    return iMethod;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets selected state
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetSelected( TCmFillRuleStatus aSelected )
+    {
+    iSelected = aSelected;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns method
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmFillRuleStatus CCmFillRule::Selected() const
+    {
+    return iSelected;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetStatus( TCmListItemStatus aStatus )
+    {
+    iStatus = aStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmListItemStatus CCmFillRule::Status() const
+    {
+    return iStatus;
+    }
+    
+// ---------------------------------------------------------------------------
+// Set priority
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetPriority( TUint8 aPriority )
+    {
+    iPriority = aPriority;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns priority
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint8 CCmFillRule::Priority() const
+    {
+    return iPriority;
+    }    
+    
+// ---------------------------------------------------------------------------
+// Set template id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetTemplateId( TUint8 aTemplateId )
+    {
+    iTemplateId = aTemplateId;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns template id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint8 CCmFillRule::TemplateId() const
+    {
+    return iTemplateId;
+    }
+
+// ---------------------------------------------------------------------------
+// Set list's real size in Bytes
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetListRealSizeInBytes( TUint32 aRealSize )
+    {
+    iRealSize = aRealSize;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns list's real size in Bytes
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CCmFillRule::ListRealSizeInBytes() const
+    {
+    return iRealSize;
+    }
+
+// ---------------------------------------------------------------------------
+// Set list's real size in pieces
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRule::SetListRealCount( TUint32 aRealCount )
+    {
+    iRealCount = aRealCount;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns ist's real size in pieces
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CCmFillRule::ListRealCount() const
+    {
+    return iRealCount;
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmFillRule::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CCmFillRule::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iName->Length() );
+    if ( iName )
+        {
+        aStream << *iName;
+        }
+    else
+        {
+        aStream << KNullDesC8();
+        }      
+    aStream.WriteInt32L( iAmount );
+    aStream.WriteInt32L( iRealSize );
+    aStream.WriteInt32L( iRealCount );
+    aStream.WriteInt16L( (TInt)iLimitType );
+    aStream.WriteInt16L( (TInt)iMethod );
+    aStream.WriteInt16L( (TInt)iMediaType );
+    aStream.WriteInt16L((TInt)iSelected );
+    aStream.WriteInt16L((TInt)iStatus );
+    aStream.WriteInt8L(iPriority);
+    aStream.WriteInt8L( iTemplateId );
+    aStream.WriteInt32L( iId );
+    
+    aStream.WriteInt16L( iRuleArray.Count() );
+    for ( TInt index(0); index < iRuleArray.Count(); index++ )
+        {
+        iRuleArray[index]->ExternalizeL( aStream );
+        }
+        
+    aStream.WriteInt16L( iMediaServerArray.Count() );
+    for ( TInt index(0); index < iMediaServerArray.Count(); index++ )
+        {
+        iMediaServerArray[index]->ExternalizeL( aStream );
+        }
+
+    aStream.WriteInt16L( iExcAlbums->Count() );
+    for ( TInt index(0); index < iExcAlbums->Count(); index++ )
+        {
+        aStream.WriteInt32L( iExcAlbums[index].Length() );
+        aStream << iExcAlbums->MdcaPoint(index);
+        }
+        
+    aStream.WriteInt16L( iExcPlayLists->Count() );
+    for ( TInt index(0); index < iExcPlayLists->Count(); index++ )
+        {
+        aStream.WriteInt32L( iExcPlayLists[index].Length() );
+        aStream << iExcPlayLists->MdcaPoint(index);
+        }             
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmFillRule::InternalizeL
+// ---------------------------------------------------------------------------
+//
+void CCmFillRule::InternalizeL( RReadStream& aStream )
+    {
+    // Content
+    delete iName;
+    iName = NULL;
+
+    TInt bufLength = aStream.ReadInt32L();    
+    iName = HBufC8::NewL( aStream, bufLength );
+    
+    // cleanup
+    iRuleArray.ResetAndDestroy();
+    
+    iAmount = aStream.ReadInt32L();
+    iRealSize = aStream.ReadInt32L();
+    iRealCount = aStream.ReadInt32L();
+    iLimitType = (TCmLimitType)aStream.ReadInt16L();
+    iMethod = (TCmFillMethod)aStream.ReadInt16L();
+    iMediaType = (TCmMediaType)aStream.ReadInt16L();
+    iSelected = (TCmFillRuleStatus)aStream.ReadInt16L();
+    iStatus = (TCmListItemStatus)aStream.ReadInt16L();
+    iPriority = (TUint8)aStream.ReadInt8L();
+    iTemplateId = (TUint8)aStream.ReadInt8L();
+    iId = (TUint)aStream.ReadInt32L();
+    
+    // rule count 
+    TInt ruleCount = aStream.ReadInt16L();
+    
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < ruleCount; index++ )
+        {
+        CCmRule* newRule = CCmRule::NewLC();
+        newRule->InternalizeL( aStream );   
+        iRuleArray.AppendL( newRule );
+        CleanupStack::Pop( newRule ); 
+        newRule = NULL;
+        }
+        
+    // cleanup
+    iMediaServerArray.ResetAndDestroy();
+    
+    // media Server count
+    TInt mediaServerCount = aStream.ReadInt16L();
+    
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < mediaServerCount; index++ )
+        {
+        CCmMediaServer* newServer = CCmMediaServer::NewLC();
+        newServer->InternalizeL( aStream );     
+        iMediaServerArray.AppendL( newServer );
+        CleanupStack::Pop( newServer ); 
+        newServer = NULL;
+        }
+        
+    TInt excAlbumsCount( aStream.ReadInt16L() );
+    bufLength = KErrNone;
+    HBufC* temp = NULL;
+    for ( TInt index(0); index < excAlbumsCount ; index++ )
+        {
+        bufLength = aStream.ReadInt32L();
+        temp = HBufC::NewLC( aStream, bufLength );
+        iExcAlbums->AppendL( *temp );
+        CleanupStack::PopAndDestroy( temp );
+        temp = NULL;
+        }         
+
+    TInt excPlayListCount( aStream.ReadInt16L() );
+    bufLength = KErrNone;
+    for ( TInt index(0); index < excPlayListCount ; index++ )
+        {
+        bufLength = aStream.ReadInt32L();
+        temp = HBufC::NewLC( aStream, bufLength );
+        iExcPlayLists->AppendL( *temp );
+        CleanupStack::PopAndDestroy( temp );
+        temp = NULL;
+        }                         
+    }
+                
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmFillRule::CCmFillRule() : 
+    iRuleArray( KArrayGranularity ), 
+    iMediaServerArray( KArrayGranularity )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmFillRule::ConstructL()
+    {
+    iExcAlbums = new ( ELeave ) CDesCArrayFlat( KArrayGranularityContainer );
+    iExcPlayLists = 
+        new ( ELeave ) CDesCArrayFlat( KArrayGranularityContainer );    
+    }    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmfillrulecontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill rules
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmfillrulecontainer.h"
+#include "cmfillrule.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KFillRuleArrayGranularity = 16;
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmFillRuleContainer* CCmFillRuleContainer::NewL()
+    {
+    TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::NewL() start")));    
+    CCmFillRuleContainer* self = CCmFillRuleContainer::NewLC();
+    CleanupStack::Pop( self );
+    TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::NewL() end"))); 
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmFillRuleContainer* CCmFillRuleContainer::NewLC()
+    {
+    TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::NewLC() start")));    
+    CCmFillRuleContainer* self = new ( ELeave ) CCmFillRuleContainer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::NewLC() end"))); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmFillRuleContainer::~CCmFillRuleContainer()
+    {
+    TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::~CCmFillRuleContainer()\
+         start")));
+    iFillRuleArray.ResetAndDestroy();
+    iFillRuleArray.Close();
+    TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::~CCmFillRuleContainer()\
+        end")));     
+    }
+
+// ---------------------------------------------------------------------------
+// Add new rule into FillRule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmFillRuleContainer::AddFillRuleL( CCmFillRule* aRule )
+    {
+    iFillRuleArray.AppendL( aRule );
+    TInt index = iFillRuleArray.Count() - 1;    
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// Deletes fill rule with the given index
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRuleContainer::DeleteFillRule( TInt aIndex )
+    {
+    if( iFillRuleArray.Count() > aIndex )
+        {
+        delete iFillRuleArray[aIndex];
+        iFillRuleArray.Remove(aIndex);
+        iFillRuleArray.Compress();
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// Get rule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmFillRule* CCmFillRuleContainer::FillRule( TInt aIndex ) const
+    {
+    return iFillRuleArray[aIndex];
+    }
+
+// ---------------------------------------------------------------------------
+// Returns count of rules
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmFillRuleContainer::FillRuleCount() const
+    {
+    return iFillRuleArray.Count();
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFillRuleContainer::ExternalizeL
+// Writes the content to stream.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmFillRuleContainer::ExternalizeL( 
+    RWriteStream& aStream ) const
+    {
+    // Let's write the count of fill rules to stream first
+    aStream.WriteInt16L( iFillRuleArray.Count() );
+    for ( TInt index = 0; index < iFillRuleArray.Count(); index++ )
+        {
+        CCmFillRule* rule = iFillRuleArray[index];    
+        // Then the object itself
+        rule->ExternalizeL( aStream );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillRuleContainer::InternalizeL
+// Fills container information from stream
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmFillRuleContainer::InternalizeL( RReadStream& aStream )
+    {
+    // Then internalize the objects
+    if ( iFillRuleArray.Count() > KErrNone )
+        {
+        iFillRuleArray.ResetAndDestroy();
+        }
+    // First the count of fill rules
+    TInt ruleCount = aStream.ReadInt16L();
+    
+    // Then internalize them from the stream one by one
+    for ( TInt index = 0; index < ruleCount; index++ )
+        {
+        CCmFillRule* newItem = CCmFillRule::NewL();
+        CleanupStack::PushL( newItem );
+        newItem->InternalizeL( aStream );
+        AddFillRuleL( newItem );
+        CleanupStack::Pop( newItem );
+        newItem = NULL;
+        }
+    }
+                  
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmFillRuleContainer::CCmFillRuleContainer() : 
+    iFillRuleArray( KFillRuleArrayGranularity )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmFillRuleContainer::ConstructL()
+    {
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmmediaserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Media servers
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+
+#include "cmmediaserver.h"
+#include "msdebug.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmMediaServer* CCmMediaServer::NewL()
+    {
+    CCmMediaServer* self = CCmMediaServer::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmMediaServer* CCmMediaServer::NewLC()
+    {
+    CCmMediaServer* self = new ( ELeave ) CCmMediaServer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCmMediaServer::~CCmMediaServer()
+    {
+    delete iUDN;
+    }
+
+// ---------------------------------------------------------------------------
+// Retrieve mediaserver info
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CCmMediaServer::MediaServer() const
+    {
+    return *iUDN;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets UDN of the media server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServer::SetUDNL( const TDesC8& aUDN )
+    {
+    delete iUDN;
+    iUDN = NULL;
+
+    if( &aUDN )
+        {
+        iUDN = aUDN.AllocL();
+        }
+    else
+        {
+        iUDN = KNullDesC8().AllocL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets database id of the media server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CCmMediaServer::DbId() const
+    {
+    return iDbId;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns SystemUpdateID
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmMediaServer::SystemUpdateID() const
+    {
+    return iSystemUpdateID;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets SystemUpdateID
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServer::SetSystemUpdateID(
+    const TInt aSystemUpdateID )
+    {
+    iSystemUpdateID = aSystemUpdateID;
+    }
+    
+// ---------------------------------------------------------------------------
+// Gets database id of the media server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServer::SetDbId( const TInt64 aDbId )
+    {
+    iDbId = aDbId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMediaServer::ExternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+void CCmMediaServer::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iUDN->Length() );
+
+    if ( iUDN )
+        {
+        aStream << *iUDN;
+        }
+    else
+        {
+        aStream << KNullDesC8();
+        }
+    aStream.WriteUint32L( iDbId );
+    aStream.WriteInt32L( iSystemUpdateID );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMediaServer::InternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+void CCmMediaServer::InternalizeL( RReadStream& aStream )
+    {
+    if ( iUDN )
+        {
+        delete iUDN;
+        iUDN = NULL;
+        }
+    TInt bufLength = aStream.ReadInt32L();
+    iUDN = HBufC8::NewL( aStream, bufLength );
+    iDbId = aStream.ReadUint32L();
+    iSystemUpdateID = aStream.ReadInt32L();
+    }
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CCmMediaServer::CCmMediaServer()
+    {
+    iSystemUpdateID = KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmMediaServer::ConstructL()
+    {
+    iUDN = KNullDesC8().AllocL();
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmmediaserverfull.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Media servers
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+
+#include "cmmediaserverfull.h"
+#include "msdebug.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmMediaServerFull* CCmMediaServerFull::NewL()
+    {
+    CCmMediaServerFull* self = CCmMediaServerFull::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmMediaServerFull* CCmMediaServerFull::NewLC()
+    {
+    CCmMediaServerFull* self = new ( ELeave ) CCmMediaServerFull();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmMediaServerFull::~CCmMediaServerFull()
+    {
+    delete iName;
+    iVisibleDate = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns name of the media server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPtrC8 CCmMediaServerFull::MediaServerName() const
+    {
+    return *iName;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets media server name
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServerFull::SetMediaServerNameL( const TDesC8& aName )
+    {
+    delete iName;
+    iName = NULL;
+    iName = aName.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// Returns visible date of the media server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TTime CCmMediaServerFull::VisibleDate() const
+    {
+    return iVisibleDate;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets visible date of the media server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServerFull::SetVisibleDate( TTime aTime )
+    {
+    iVisibleDate = aTime;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets is active status of the media server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint8 CCmMediaServerFull::IsActive() const
+    {
+    return iIsActive;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets is active status of the media server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServerFull::SetIsActive( TUint8 aIsActive )
+    {
+    iIsActive = aIsActive;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets copy capability info
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmMediaServerFull::CopyCapability() const
+    {
+    return iCopyCapability;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets copy capability info
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServerFull::SetCopyCapability( TBool aCopyCapability )
+    {
+    iCopyCapability = aCopyCapability;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Sets server status ( used for store )
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServerFull::SetStoreUsage( TBool aUsed )
+    {
+    iStoreServer = aUsed;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets server status ( store usage )
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmMediaServerFull::StoreUsage()
+    {    
+    return iStoreServer;
+    }  
+
+// ---------------------------------------------------------------------------
+// Sets server status ( used for fill )
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServerFull::SetFillUsage( TBool aUsed )
+    {
+    iFillServer = aUsed;
+    }        
+
+// ---------------------------------------------------------------------------
+// Gets server status ( fill usage )
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmMediaServerFull::FillUsage()
+    {    
+    return iFillServer;
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFillRule::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServerFull::ExternalizeL( RWriteStream& aStream ) const
+    {
+    CCmMediaServer::ExternalizeL(aStream);
+    aStream.WriteInt32L( iName->Length() );
+    if ( iName )
+        {
+        aStream << *iName;
+        }
+    else
+        {
+        aStream << KNullDesC8();
+        }    
+    aStream << iVisibleDate.Int64();
+    aStream.WriteInt8L( iIsActive );
+    aStream.WriteInt8L( iCopyCapability );
+    aStream.WriteInt8L( iFillServer );
+    aStream.WriteInt8L( iStoreServer );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmFillRule::InternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmMediaServerFull::InternalizeL( RReadStream& aStream )
+    {
+    CCmMediaServer::InternalizeL(aStream);
+    if ( iName )
+        {
+        delete iName;
+        iName = NULL;
+        }
+    TInt bufLength = aStream.ReadInt32L();
+    iName = HBufC8::NewL( aStream, bufLength );    
+    TInt64 tempTime;
+    aStream >> tempTime;
+    iVisibleDate = tempTime;
+    iIsActive = aStream.ReadInt8L();
+    iCopyCapability = aStream.ReadInt8L();
+    iFillServer = aStream.ReadInt8L();
+    iStoreServer = aStream.ReadInt8L();
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmparam.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Rule parameters
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+
+#include "cmparam.h"
+#include "msdebug.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CCmParam* CCmParam::NewL()
+    {   
+    CCmParam* self = CCmParam::NewLC();
+    CleanupStack::Pop( self ); 
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmParam* CCmParam::NewLC()
+    {    
+    CCmParam* self = new ( ELeave ) CCmParam();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCmParam::~CCmParam()
+    {
+    delete iDataField;      
+    }
+
+// ---------------------------------------------------------------------------
+// Retrieve param info 
+// ---------------------------------------------------------------------------
+//
+void CCmParam::Param( TPtrC8* aParam )
+    {
+    aParam->Set( *iDataField );
+    }
+
+// ---------------------------------------------------------------------------
+// Retrieve param info 
+// ---------------------------------------------------------------------------
+//
+void CCmParam::Param( TInt& aParam )
+    {
+    aParam = iDataFieldIndexed;
+    }
+        
+// ---------------------------------------------------------------------------
+// Sets datafield value
+// ---------------------------------------------------------------------------
+//
+void CCmParam::SetComparisonDataL( const TDesC8& aComparisonData )
+    {
+    delete iDataField;
+    iDataField = NULL;
+    iDataField = aComparisonData.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets datafield value ( indexed )
+// ---------------------------------------------------------------------------
+//
+void CCmParam::SetComparisonData( TInt aComparisonData )
+    {
+    iDataFieldIndexed = aComparisonData;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns datafield
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CCmParam::ComparisonData() const
+    {
+    return *iDataField;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmParam::ExternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+void CCmParam::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iDataField->Length() );
+    
+    if ( iDataField )
+        {
+        aStream << *iDataField;
+        }
+    else
+        {
+        aStream << KNullDesC8();
+        }
+        
+    aStream.WriteInt32L( iDataFieldIndexed );             
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmParam::InternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+void CCmParam::InternalizeL( RReadStream& aStream )
+    {
+    // Content
+    delete iDataField;
+    iDataField = NULL;
+
+    TInt bufLength = aStream.ReadInt32L();
+    iDataField = HBufC8::NewL( aStream, bufLength );
+    iDataFieldIndexed = aStream.ReadInt32L();           
+    }
+        
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmParam::CCmParam()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmParam::ConstructL()
+    {
+    iDataField = KNullDesC8().AllocL();
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmrule.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Rule parameters
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmparam.h"
+#include "cmrule.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KRuleParamArrayGranularity = 16;
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CCmRule* CCmRule::NewL()
+    {    
+    CCmRule* self = CCmRule::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmRule* CCmRule::NewLC()
+    {    
+    CCmRule* self = new ( ELeave ) CCmRule(  );
+    CleanupStack::PushL( self );
+    self->ConstructL(  ); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCmRule::~CCmRule()
+    {
+    iRuleParamsArray.ResetAndDestroy();     
+    }
+
+// ---------------------------------------------------------------------------
+// Adds rule param
+// ---------------------------------------------------------------------------
+//
+TInt CCmRule::AddRuleParamL( const TDesC8& aParam )
+    {
+    CCmParam* param = CCmParam::NewLC();
+    param->SetComparisonDataL( aParam );
+    iRuleParamsArray.Append( param ); // transfer ownership
+    CleanupStack::Pop( param );
+    TInt index = iRuleParamsArray.Count() - 1;    
+    return index;    
+    }
+
+// ---------------------------------------------------------------------------
+// Adds rule param ( indexed param )
+// ---------------------------------------------------------------------------
+//
+TInt CCmRule::AddRuleParamL( TInt aParam )
+    {
+    CCmParam* param = CCmParam::NewLC();
+    param->SetComparisonData( aParam );
+    iRuleParamsArray.Append( param ); // transfer ownership
+    CleanupStack::Pop( param );
+    TInt index = iRuleParamsArray.Count() - 1;    
+    return index;    
+    }
+    
+// ---------------------------------------------------------------------------
+// Loads rule
+// ---------------------------------------------------------------------------
+//
+void CCmRule::Rule( TCmMetadataField* aDataField, TCmOperatorType* aOperator, 
+    TInt* aParamCount )
+    {
+    *aDataField = iMetadataField;
+    *aOperator = iOperator;
+    *aParamCount = iRuleParamsArray.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// Loads rule param
+// ---------------------------------------------------------------------------
+//
+void CCmRule::RuleParamL( TInt aParamIndex, TPtrC8* aParam )
+    {
+    // check parameter
+    if ( aParamIndex < 0 || aParamIndex >= iRuleParamsArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    iRuleParamsArray[aParamIndex]->Param( aParam );
+    }
+
+// ---------------------------------------------------------------------------
+// Loads rule param
+// ---------------------------------------------------------------------------
+//
+void CCmRule::RuleParamL( TInt aParamIndex, TInt& aParam )
+    {
+    // check parameter
+    if ( aParamIndex < 0 || aParamIndex >= iRuleParamsArray.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    iRuleParamsArray[aParamIndex]->Param( aParam );
+    }
+        
+// ---------------------------------------------------------------------------
+// Sets metadata field
+// ---------------------------------------------------------------------------
+//    
+void CCmRule::SetMetadataField( TCmMetadataField aDataField )
+    {
+    iMetadataField = aDataField;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets operator of the rule
+// ---------------------------------------------------------------------------
+//    
+void CCmRule::SetOperator( TCmOperatorType aOperator )
+    {
+    iOperator = aOperator;
+    }
+
+// ---------------------------------------------------------------------------
+// Return count of the parameter 
+// ---------------------------------------------------------------------------
+//
+TInt CCmRule::RuleParamsCount() const
+    {
+    return iRuleParamsArray.Count();    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmRule::ExternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+void CCmRule::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt16L( (TInt)iMetadataField );
+       
+    aStream.WriteInt16L( (TInt)iOperator );    
+    aStream.WriteInt16L( iRuleParamsArray.Count() );    
+    
+    for ( TInt index(0); index < iRuleParamsArray.Count(); index++ )
+        {
+        iRuleParamsArray[index]->ExternalizeL( aStream );
+        }
+          
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmRule::InternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+void CCmRule::InternalizeL( RReadStream& aStream )
+    {
+    // Content
+    iMetadataField = (TCmMetadataField)aStream.ReadInt16L();    
+    
+    iOperator = (TCmOperatorType)aStream.ReadInt16L();
+    
+    // cleanup
+    iRuleParamsArray.ResetAndDestroy();
+    
+    // rule param count
+    TInt ruleParamCount = aStream.ReadInt16L();
+    
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < ruleParamCount; index++ )
+        {
+        CCmParam* newRuleParam = CCmParam::NewLC();
+        newRuleParam->InternalizeL( aStream );   
+        iRuleParamsArray.AppendL( newRuleParam );
+        CleanupStack::Pop( newRuleParam ); 
+        newRuleParam = NULL;
+        }
+                     
+    }
+            
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmRule::CCmRule() : iRuleParamsArray( KRuleParamArrayGranularity )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmRule::ConstructL()
+    {
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsearchresponsehash.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating Media servers
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+
+#include "cmsearchresponsehash.h"
+#include "msdebug.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSearchResponseHash* CCmSearchResponseHash::NewL( TInt aStartIndex,
+                                                             TInt aItemCount,
+                                                             const TDesC8& aHash )
+    {    
+    CCmSearchResponseHash* self = new ( ELeave ) CCmSearchResponseHash( );
+    CleanupStack::PushL( self );
+    self->ConstructL( aStartIndex, aItemCount, aHash );
+    CleanupStack::Pop( self );  
+    return self;  
+    }
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSearchResponseHash* CCmSearchResponseHash::NewL()
+    {    
+    CCmSearchResponseHash* self = new ( ELeave ) CCmSearchResponseHash();
+    return self;  
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CCmSearchResponseHash::CCmSearchResponseHash()
+    {  
+    }
+    
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCmSearchResponseHash::~CCmSearchResponseHash()
+    {
+    delete iHash;  
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmSearchResponseHash::ConstructL( TInt aStartIndex,
+                                        TInt aItemCount,
+                                        const TDesC8& aHash )
+    {    
+    SetStartIndex( aStartIndex );
+    SetItemCount( aItemCount );
+    SetHashL( aHash );
+    }
+    
+// ---------------------------------------------------------------------------
+// SetHashL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSearchResponseHash::SetHashL( const TDesC8& aHash )
+    {    
+    delete iHash;
+    iHash = NULL;
+    iHash = aHash.AllocL();
+    }
+        
+// ---------------------------------------------------------------------------
+// Hash
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CCmSearchResponseHash::Hash() const
+    {    
+    if ( iHash )
+        {
+        return *iHash;
+        }
+    else
+        {
+        return KNullDesC8();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SetStartIndex
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSearchResponseHash::SetStartIndex( TInt aStartIndex )
+    {
+    iStartIndex = aStartIndex;    
+    }
+
+// ---------------------------------------------------------------------------
+// StartIndex
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSearchResponseHash::StartIndex() const
+    {
+    return iStartIndex; 
+    }
+
+// ---------------------------------------------------------------------------
+// SetItemCount
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSearchResponseHash::SetItemCount( TInt aItemCount )
+    {
+    iItemCount = aItemCount;    
+    }
+
+// ---------------------------------------------------------------------------
+// ItemCount
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSearchResponseHash::ItemCount() const
+    {
+    return iItemCount; 
+    }
+
+
+// -----------------------------------------------------------------------------
+// ExternalizeL
+// -----------------------------------------------------------------------------
+//
+void CCmSearchResponseHash::ExternalizeL( RWriteStream& aStream ) const
+    {      
+    aStream.WriteInt32L( Hash().Length() );
+    aStream << Hash();
+    aStream.WriteInt32L( StartIndex() );
+    aStream.WriteInt32L( ItemCount() );
+    }
+        
+        
+// -----------------------------------------------------------------------------
+// InternalizeL
+// -----------------------------------------------------------------------------
+//
+void CCmSearchResponseHash::InternalizeL( RReadStream& aStream )
+    {
+    delete iHash; iHash = NULL;
+    TInt bufLength = aStream.ReadInt32L();    
+    iHash = HBufC8::NewL( aStream, bufLength );
+    
+    iStartIndex = aStream.ReadInt32L();
+    iItemCount = aStream.ReadInt32L();
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlaudioitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include "cmsqlaudioitem.h"
+#include "msdebug.h"
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlAudioItem* CCmSqlAudioItem::NewL()
+    {   
+    CCmSqlAudioItem* self = CCmSqlAudioItem::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmSqlAudioItem* CCmSqlAudioItem::NewLC()
+    {    
+    CCmSqlAudioItem* self = new ( ELeave ) CCmSqlAudioItem();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlAudioItem::~CCmSqlAudioItem()
+    {
+    delete iAlbumArtUri;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::SetArtistId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlAudioItem::SetArtistId( const TInt64 aArtistId )
+    {
+    iArtistId = aArtistId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::SetAlbumId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlAudioItem::SetAlbumId( const TInt64 aAlbumId )
+    {
+    iAlbumId = aAlbumId;
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::SetGenreId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlAudioItem::SetGenreId( const TInt64 aGenreId )
+    {
+    iGenreId = aGenreId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::SetDuration
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlAudioItem::SetDuration( const TInt aDuration )
+    {
+    iDuration = aDuration;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::SetBitrate
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlAudioItem::SetBitrate( const TInt aBitrate )
+    {
+    iBitrate = aBitrate;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::SetTrackNumber
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlAudioItem::SetTrackNumber( const TInt aTrackNumber )
+    {
+    iTrackNumber = aTrackNumber;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::SetAlbumArtUriL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlAudioItem::SetAlbumArtUriL( const TDesC8& aAlbumArtUri )
+    {
+    delete iAlbumArtUri;
+    iAlbumArtUri = NULL;
+
+    if( &aAlbumArtUri )
+        {
+        iAlbumArtUri = aAlbumArtUri.AllocL();
+        }
+    else
+        {
+        iAlbumArtUri = KNullDesC8().AllocL();
+        }     
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::ArtistId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CCmSqlAudioItem::ArtistId() const
+    {
+    return iArtistId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::AlbumId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CCmSqlAudioItem::AlbumId() const
+    {
+    return iAlbumId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::GenreId
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt64 CCmSqlAudioItem::GenreId() const
+    {
+    return iGenreId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::Duration
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C TInt CCmSqlAudioItem::Duration() const
+    {
+    return iDuration;
+    } 
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::Bitrate
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlAudioItem::Bitrate() const
+    {
+    return iBitrate;
+    }        
+
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::TrackNumber
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlAudioItem::TrackNumber() const
+    {
+    return iTrackNumber;
+    }
+  
+// ---------------------------------------------------------------------------
+// CCmSqlAudioItem::AlbumArtUri
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CCmSqlAudioItem::AlbumArtUri() const
+    {
+    return *iAlbumArtUri;
+    }
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmSqlAudioItem::CCmSqlAudioItem()
+    {                
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlAudioItem::ConstructL()
+    {
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlbaseitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include "cmsqlbaseitem.h"
+#include "msdebug.h"
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlBaseItem* CCmSqlBaseItem::NewL()
+    {   
+    CCmSqlBaseItem* self = CCmSqlBaseItem::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmSqlBaseItem* CCmSqlBaseItem::NewLC()
+    {    
+    CCmSqlBaseItem* self = new ( ELeave ) CCmSqlBaseItem();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlBaseItem::~CCmSqlBaseItem()
+    {
+    delete iCdsId;
+    delete iHash;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::SetId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlBaseItem::SetId( const TInt64 aId )
+    {
+    iId = aId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::SetCdsIdL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlBaseItem::SetCdsIdL( const TDesC8& aCdsId )
+    {
+    delete iCdsId;
+    iCdsId = NULL;
+
+    if( &aCdsId )
+        {
+        iCdsId = aCdsId.AllocL();
+        }
+    else
+        {
+        iCdsId = KNullDesC8().AllocL();
+        }               
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::SetHashL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlBaseItem::SetHashL( const TDesC& aHash )
+    {
+    delete iHash;
+    iHash = NULL;
+
+    if( &aHash )
+        {
+        iHash = aHash.AllocL();
+        }
+    else
+        {
+        iHash = KNullDesC().AllocL();
+        }     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::SetSearchId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlBaseItem::SetSearchId( 
+    const TInt64 aSearchId )
+    {
+    iSearchId = aSearchId;     
+    } 
+    
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::Id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CCmSqlBaseItem::Id() const
+    {
+    return iId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::CdsId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CCmSqlBaseItem::CdsId() const
+    {
+    return *iCdsId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::Hash
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC& CCmSqlBaseItem::Hash() const
+    {
+    return *iHash;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::SearchId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CCmSqlBaseItem::SearchId() const
+    {
+    return iSearchId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::CompareByHash
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlBaseItem::CompareByHash( 
+    const CCmSqlBaseItem& aFirst, const CCmSqlBaseItem& aSecond )
+    {
+    return aFirst.Hash().Compare( aSecond.Hash() );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlBaseItem::CompareByCdsId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlBaseItem::CompareByCdsId( 
+    const CCmSqlBaseItem& aFirst, const CCmSqlBaseItem& aSecond )
+    {
+    return aFirst.CdsId().Compare( aSecond.CdsId() );
+    }
+            
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmSqlBaseItem::CCmSqlBaseItem()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlBaseItem::ConstructL()
+    {
+    iCdsId = KNullDesC8().AllocL();
+    iHash = KNullDesC().AllocL();
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlgenericitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill and store file lists
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include "cmsqlitemresource.h"
+#include "cmsqlgenericitem.h"
+#include "msdebug.h"
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlGenericItem* CCmSqlGenericItem::NewL()
+    {   
+    CCmSqlGenericItem* self = CCmSqlGenericItem::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmSqlGenericItem* CCmSqlGenericItem::NewLC()
+    {    
+    CCmSqlGenericItem* self = new ( ELeave ) CCmSqlGenericItem();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlGenericItem::~CCmSqlGenericItem()
+    {
+    delete iTitle;
+    delete iUri;
+
+    iResources.ResetAndDestroy();
+    iResources.Close();            
+    }
+   
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::SetSize
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::SetSize( const TInt aSize )
+    {
+    iSize = aSize;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::SetTitleL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::SetTitleL( const TDesC8& aTitle )
+    {
+    delete iTitle;
+    iTitle = NULL;
+
+    if( &aTitle )
+        {
+        iTitle = aTitle.AllocL();
+        }
+    else
+        {
+        iTitle = KNullDesC8().AllocL();
+        }               
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::SetDate
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::SetDate( const TTime& aDate )
+    {
+    iDate = aDate;     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::SetHarvestDate
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::SetHarvestDate( const TTime& aHarvestDate )
+    {
+    iHarvestDate = aHarvestDate;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::SetUpnpclassId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::SetUpnpclassId( const TInt64 aUpnpclassId )
+    {
+    iUpnpclassId = aUpnpclassId;     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::SetUpnpProfileId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::SetUpnpProfileId( 
+    const TInt64 aUpnpProfileId )
+    {
+    iUpnpProfileId = aUpnpProfileId;     
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::SetUriL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::SetUriL( const TDesC8& aUri )
+    {
+    delete iUri;
+    iUri = NULL;
+
+    if( &aUri )
+        {
+        iUri = aUri.AllocL();
+        }
+    else
+        {
+        iUri = KNullDesC8().AllocL();
+        }          
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::SetMediaType
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::SetMediaType( const TCmMediaType aMType )
+    {
+    iMType = aMType;     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::NewResourceL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::NewResourceL( const TDesC8& aUri, 
+    const TInt aSize, const TInt aDuration, const TInt aBitrate,
+    const TInt64 aResolutionId )
+    {
+    CCmSqlItemResource* item = CCmSqlItemResource::NewLC( 
+        aUri, aSize, aDuration, aBitrate, aResolutionId );
+    iResources.Append( item );
+    CleanupStack::Pop( item );  
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::Size
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlGenericItem::Size() const
+    {
+    return iSize;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::Title
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CCmSqlGenericItem::Title() const
+    {
+    return *iTitle;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::Date
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TTime CCmSqlGenericItem::Date() const
+    {
+    return iDate;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::HarvestDate
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TTime CCmSqlGenericItem::HarvestDate() const
+    {
+    return iHarvestDate;
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::UpnpclassId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CCmSqlGenericItem::UpnpclassId() const
+    {
+    return iUpnpclassId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::UpnpProfileId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CCmSqlGenericItem::UpnpProfileId() const
+    {
+    return iUpnpProfileId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::Uri
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CCmSqlGenericItem::Uri() const
+    {
+    return *iUri;
+    } 
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::MediaType
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmMediaType CCmSqlGenericItem::MediaType() const
+    {
+    return iMType;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::ResourceCount
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlGenericItem::ResourceCount() const
+    {
+    return iResources.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlGenericItem::GetResource
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlGenericItem::GetResource( TDesC8& aUri, TInt& aSize, 
+    TInt& aDuration, TInt& aBitrate, TInt64& aResolutionId, TInt aIndex )
+    {
+    if( aIndex < iResources.Count() )
+        {
+        aUri = iResources[aIndex]->Uri();
+        aSize = iResources[aIndex]->Size();
+        aDuration = iResources[aIndex]->Duration();
+        aBitrate = iResources[aIndex]->Bitrate();
+        aResolutionId = iResources[aIndex]->ResolutionId();        
+        }
+    }
+            
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmSqlGenericItem::CCmSqlGenericItem()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlGenericItem::ConstructL()
+    {
+    iUri = KNullDesC8().AllocL();
+    iTitle = KNullDesC8().AllocL();
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlimageitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include "cmsqlimageitem.h"
+#include "msdebug.h"
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlImageItem* CCmSqlImageItem::NewL()
+    {   
+    CCmSqlImageItem* self = CCmSqlImageItem::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmSqlImageItem* CCmSqlImageItem::NewLC()
+    {    
+    CCmSqlImageItem* self = new ( ELeave ) CCmSqlImageItem();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlImageItem::~CCmSqlImageItem()
+    {
+    delete iDescription;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlImageItem::SetResolutionId
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C void CCmSqlImageItem::SetResolutionId( const TInt64 aResolutionId )
+    {
+    iResolutionId = aResolutionId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlImageItem::SetDescription
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C void CCmSqlImageItem::SetDescriptionL( const TDesC8& aDescription )
+    {
+    delete iDescription;
+    iDescription = NULL;
+
+    if( &aDescription )
+        {
+        iDescription = aDescription.AllocL();        
+        }
+    else
+        {
+        iDescription = KNullDesC8().AllocL();
+        }    
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSqlImageItem::ResolutionId
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C TInt64 CCmSqlImageItem::ResolutionId() const
+    {
+    return iResolutionId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlImageItem::Description
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C TDesC8& CCmSqlImageItem::Description() const
+    {
+    return *iDescription;
+    }
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmSqlImageItem::CCmSqlImageItem()
+    {               
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlImageItem::ConstructL()
+    {
+    iDescription = KNullDesC8().AllocL();
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlitemresource.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql items
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include "cmsqlitemresource.h"
+#include "msdebug.h"
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CCmSqlItemResource* CCmSqlItemResource::NewL()
+    {   
+    CCmSqlItemResource* self = CCmSqlItemResource::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmSqlItemResource* CCmSqlItemResource::NewLC()
+    {    
+    CCmSqlItemResource* self = new ( ELeave ) CCmSqlItemResource();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }
+
+// ---------------------------------------------------------------------------
+// NewLC( const TDesC8& aUri, 
+//    const TInt aSize, const TInt aDuration, const TInt aBitrate,
+//    const TInt64 aResolutionId )
+// ---------------------------------------------------------------------------
+//
+CCmSqlItemResource* CCmSqlItemResource::NewLC( const TDesC8& aUri, 
+    const TInt aSize, const TInt aDuration, const TInt aBitrate,
+    const TInt64 aResolutionId )
+    {
+    CCmSqlItemResource* self = new ( ELeave ) CCmSqlItemResource();
+    CleanupStack::PushL( self );
+    self->ConstructL( aUri, aSize, aDuration, aBitrate, aResolutionId ); 
+    return self;     
+    }
+    
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCmSqlItemResource::~CCmSqlItemResource()
+    {
+    delete iUri;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::SetUriL
+// ---------------------------------------------------------------------------
+//        
+void CCmSqlItemResource::SetUriL( const TDesC8& aUri )
+    {
+    delete iUri;
+    iUri = NULL;
+
+    if( &aUri )
+        {
+        iUri = aUri.AllocL();        
+        }
+    else
+        {
+        iUri = KNullDesC8().AllocL();
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::SetSize
+// ---------------------------------------------------------------------------
+//        
+void CCmSqlItemResource::SetSize( const TInt aSize )
+    {
+    iSize = aSize;   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::SetDuration
+// ---------------------------------------------------------------------------
+//        
+void CCmSqlItemResource::SetDuration( const TInt aDuration )
+    {
+    iDuration = aDuration;   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::SetBitrate
+// ---------------------------------------------------------------------------
+//        
+void CCmSqlItemResource::SetBitrate( const TInt aBitrate )
+    {
+    iBitrate = aBitrate;   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::SetResolutionId
+// ---------------------------------------------------------------------------
+//        
+void CCmSqlItemResource::SetResolutionId( 
+    const TInt64 aResolutionId )
+    {
+    iResolutionId = aResolutionId;   
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::Uri
+// ---------------------------------------------------------------------------
+//     
+TDesC8& CCmSqlItemResource::Uri() const
+    {
+    return *iUri;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::Size
+// ---------------------------------------------------------------------------
+//        
+TInt CCmSqlItemResource::Size() const
+    {
+    return iSize;
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::Duration
+// ---------------------------------------------------------------------------
+//        
+TInt CCmSqlItemResource::Duration() const
+    {
+    return iDuration;
+    } 
+
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::Bitrate
+// ---------------------------------------------------------------------------
+//        
+TInt CCmSqlItemResource::Bitrate() const
+    {
+    return iBitrate;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlItemResource::ResolutionId
+// ---------------------------------------------------------------------------
+//        
+TInt CCmSqlItemResource::ResolutionId() const
+    {
+    return iResolutionId;
+    }
+                
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmSqlItemResource::CCmSqlItemResource()
+    {               
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlItemResource::ConstructL()
+    {
+    iUri = KNullDesC8().AllocL();
+    }    
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlItemResource::ConstructL( const TDesC8& aUri, 
+    const TInt aSize, const TInt aDuration, const TInt aBitrate,
+    const TInt64 aResolutionId )
+    {
+    if ( &aUri )
+        {
+        iUri = aUri.AllocL();
+        }
+    else
+        {
+        iUri = KNullDesC8().AllocL();
+        }    
+    iSize = aSize;
+    iDuration = aDuration;
+    iBitrate = aBitrate;
+    iResolutionId = aResolutionId;
+    } 
+    
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlpropertycollector.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating property container objects
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmsqlpropertycontainer.h"
+#include "cmsqlpropertycollector.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KArrayGranularity = 16;
+
+// ======== LOCAL FUNCTIONS ========
+// --------------------------------------------------------------------------
+// NewL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyCollector* CCmSqlPropertyCollector::NewL()
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::NewL"));
+    
+    CCmSqlPropertyCollector* self = CCmSqlPropertyCollector::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// NewLC
+// --------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyCollector* CCmSqlPropertyCollector::NewLC()
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::NewLC"));
+    
+    CCmSqlPropertyCollector* self = new ( ELeave ) CCmSqlPropertyCollector();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyCollector::~CCmSqlPropertyCollector()
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::\
+    ~CCmSqlPropertyCollector"));
+    
+    iPropertyContainers.ResetAndDestroy();
+    iPropertyContainers.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CCmSqlPropertyCollector::AddPropertyContainerL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlPropertyCollector::AddPropertyContainerL(
+    CCmSqlPropertyContainer* aContainer )
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::AddPropertyContainerL"));
+    
+    iPropertyContainers.AppendL( aContainer );
+    TInt index = iPropertyContainers.Count() - 1;
+    return index;
+    }
+
+// --------------------------------------------------------------------------
+// CCmSqlPropertyCollector::DeletePropertyContainer
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyCollector::DeletePropertyContainer( TInt aIndex )
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::\
+    DeletePropertyContainer"));
+    
+    if( iPropertyContainers.Count() > aIndex )
+        {
+        delete iPropertyContainers[aIndex];
+        iPropertyContainers.Remove(aIndex);
+        iPropertyContainers.Compress();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCCmSqlPropertyCollector::PropertyContainer
+// --------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyContainer*
+                CCmSqlPropertyCollector::PropertyContainer( TInt aIndex )
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::PropertyContainer"));
+    
+    return iPropertyContainers[aIndex];
+    }
+
+// --------------------------------------------------------------------------
+// CCmSqlPropertyCollector::PropertyContainerCount
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlPropertyCollector::PropertyContainerCount() const
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::PropertyContainerCount"));
+    
+    return iPropertyContainers.Count();
+    }
+
+// --------------------------------------------------------------------------
+// CCmSqlPropertyCollector::ExternalizeL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyCollector::ExternalizeL(
+    RWriteStream& aStream ) const
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::ExternalizeL"));
+    
+    // Let's write the count of fill rules to stream first
+    aStream.WriteInt16L( iPropertyContainers.Count() );
+    for ( TInt index = 0; index < iPropertyContainers.Count(); index++ )
+        {
+        CCmSqlPropertyContainer* container = iPropertyContainers[index];
+        // Then the object itself
+        container->ExternalizeL( aStream );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmSqlPropertyCollector::InternalizeL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyCollector::InternalizeL( RReadStream& aStream )
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::InternalizeL"));
+    
+    // Then internalize the objects
+    if ( iPropertyContainers.Count() > KErrNone )
+        {
+        iPropertyContainers.ResetAndDestroy();
+        }
+    // First the count of fill rules
+    TInt itemCount = aStream.ReadInt16L();
+
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < itemCount; index++ )
+        {
+        CCmSqlPropertyContainer* newContainer =
+                                CCmSqlPropertyContainer::NewL();
+        CleanupStack::PushL( newContainer );
+        newContainer->InternalizeL( aStream );
+        AddPropertyContainerL( newContainer );
+        CleanupStack::Pop( newContainer );
+        newContainer = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Default constructor
+// --------------------------------------------------------------------------
+//
+CCmSqlPropertyCollector::CCmSqlPropertyCollector() :
+    iPropertyContainers( KArrayGranularity )
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::\
+    CCmSqlPropertyCollector"));
+    }
+
+// --------------------------------------------------------------------------
+// ConstructL
+// --------------------------------------------------------------------------
+//
+void CCmSqlPropertyCollector::ConstructL()
+    {
+    LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::ConstructL"));
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlpropertycontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating propety item objects
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmsqlpropertyitem.h"
+#include "cmsqlpropertycontainer.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KArrayGranularity = 16;
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyContainer* CCmSqlPropertyContainer::NewL()
+    {
+    CCmSqlPropertyContainer* self = CCmSqlPropertyContainer::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyContainer* CCmSqlPropertyContainer::NewLC()
+    {
+    CCmSqlPropertyContainer* self = new ( ELeave ) CCmSqlPropertyContainer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyContainer::~CCmSqlPropertyContainer()
+    {
+    iPropertyItems.ResetAndDestroy();
+    iPropertyItems.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::AddPropertyItemL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyContainer::AddPropertyItemL(
+    CCmSqlPropertyItem* aItem )
+    {
+    iPropertyItems.AppendL( aItem );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::DeletePropertyItem
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyContainer::DeletePropertyItem( TInt aIndex )
+    {
+    if( iPropertyItems.Count() > aIndex )
+        {
+        delete iPropertyItems[aIndex];
+        iPropertyItems.Remove(aIndex);
+        iPropertyItems.Compress();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::PropertyItem
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyItem* CCmSqlPropertyContainer::PropertyItem(
+    TInt aIndex )
+    {
+    return iPropertyItems[aIndex];
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::PropertyItemCount
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlPropertyContainer::PropertyItemCount() const
+    {
+    return iPropertyItems.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::SetType
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyContainer::SetType( TCmMetadataField aType )
+    {
+    iType = aType;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::Type
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmMetadataField CCmSqlPropertyContainer::Type( )
+    {
+    return iType;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::IsDuplicate
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmSqlPropertyContainer::IsDuplicate(
+    CCmSqlPropertyItem& aItem )
+    {
+    TBool ret( EFalse );
+    TInt64 id( aItem.Id() );
+    TInt count( iPropertyItems.Count() );
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( id == iPropertyItems[i]->Id() )
+            {
+            ret = ETrue;
+            // Duplicate found => end loop
+            i = count;
+            }
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyContainer::ExternalizeL(
+    RWriteStream& aStream ) const
+    {
+    // Let's write the count of fill rules to stream first
+    aStream.WriteInt16L( iPropertyItems.Count() );
+    aStream.WriteUint8L( iType );
+    for ( TInt index = 0; index < iPropertyItems.Count(); index++ )
+        {
+        CCmSqlPropertyItem* item = iPropertyItems[index];
+        // Then the object itself
+        item->ExternalizeL( aStream );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::InternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyContainer::InternalizeL( RReadStream& aStream )
+    {
+    // Then internalize the objects
+    if ( iPropertyItems.Count() > KErrNone )
+        {
+        iPropertyItems.ResetAndDestroy();
+        }
+    // First the count of fill rules
+    TInt itemCount = aStream.ReadInt16L();
+    iType = (TCmMetadataField)aStream.ReadInt8L();
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < itemCount; index++ )
+        {
+        CCmSqlPropertyItem* newItem = CCmSqlPropertyItem::NewL();
+        CleanupStack::PushL( newItem );
+        newItem->InternalizeL( aStream );
+        AddPropertyItemL( newItem );
+        CleanupStack::Pop( newItem );
+        newItem = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyContainer::SortPropertyItem
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyContainer::SortPropertyItem( )
+    {
+    if( ( ECmArtist == iType ) || ( ECmAlbum == iType )
+               || ( ECmGenre == iType ) || ( ECmTitle == iType ) )
+        {
+        if( iPropertyItems.Count() > 0 )
+            {
+            iPropertyItems.Sort( TLinearOrder<CCmSqlPropertyItem>
+                                ( CCmSqlPropertyContainer::CompareItem ) );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CCmSqlPropertyContainer::CCmSqlPropertyContainer() :
+    iPropertyItems( KArrayGranularity )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlPropertyContainer::ConstructL()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmSqlPropertyContainer::CompareItem
+// -----------------------------------------------------------------------------
+//
+TInt CCmSqlPropertyContainer::CompareItem(
+    const CCmSqlPropertyItem& aItemOne,const CCmSqlPropertyItem& aItemTwo )
+    {
+    TInt ret = 0;
+    ret = ( aItemOne.Name() ).CompareC( aItemTwo.Name() );
+    return ret;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlpropertyitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating propety items
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmsqlpropertyitem.h"
+#include "msdebug.h"
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyItem* CCmSqlPropertyItem::NewL()
+    {
+    CCmSqlPropertyItem* self = CCmSqlPropertyItem::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyItem* CCmSqlPropertyItem::NewLC()
+    {
+    CCmSqlPropertyItem* self = new ( ELeave ) CCmSqlPropertyItem();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyItem::~CCmSqlPropertyItem()
+    {
+    delete iName;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyItem::SetId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyItem::SetId( const TInt64 aId )
+    {
+    iId = aId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyItem::SetNameL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyItem::SetNameL( const TDesC8& aName )
+    {
+    delete iName;
+    iName = NULL;
+    if( &aName )
+        {
+        iName = aName.AllocL();
+        }
+    else
+        {
+        iName = KNullDesC8().AllocL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyItem::SetStatus
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyItem::SetStatus( const TBool aStatus )
+    {
+    iStatus = aStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyItem::Id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CCmSqlPropertyItem::Id() const
+    {
+    return iId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyItem::Name
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CCmSqlPropertyItem::Name() const
+    {
+    return *iName;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyItem::Status
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmSqlPropertyItem::Status() const
+    {
+    return iStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// CompareItemsByName
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlPropertyItem::CompareItemsByName(
+    const CCmSqlPropertyItem& aFirst, const CCmSqlPropertyItem& aSecond )
+    {
+    return aFirst.Name().Compare( aSecond.Name() );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyItem::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyItem::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iName->Length() );
+    if ( iName )
+        {
+        aStream << *iName;
+        }
+    else
+        {
+        aStream << KNullDesC8();
+        }
+    aStream.WriteUint32L( iId );
+    aStream.WriteInt32L( iStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlPropertyItem::InternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlPropertyItem::InternalizeL( RReadStream& aStream )
+    {
+    // Content
+    if ( iName )
+        {
+        delete iName;
+        iName = NULL;
+        }
+    TInt bufLength = aStream.ReadInt32L();
+    iName = HBufC8::NewL( aStream, bufLength );
+
+    iId = aStream.ReadUint32L();
+    iStatus = (TBool)aStream.ReadInt32L();
+    }
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CCmSqlPropertyItem::CCmSqlPropertyItem()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Copy constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlPropertyItem::CCmSqlPropertyItem(
+                                    const CCmSqlPropertyItem& aItem ) :
+    iId( aItem.iId ), iStatus( aItem.iStatus )
+    {
+    iName = aItem.Name().Alloc();
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlPropertyItem::ConstructL()
+    {
+    iName = KNullDesC8().AllocL();
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlresolutionpropertyitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating resolution propety items
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmsqlresolutionpropertyitem.h"
+#include "msdebug.h"
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlResolutionPropertyItem* CCmSqlResolutionPropertyItem::NewL()
+    {   
+    CCmSqlResolutionPropertyItem* self = 
+        CCmSqlResolutionPropertyItem::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmSqlResolutionPropertyItem* CCmSqlResolutionPropertyItem::NewLC()
+    {    
+    CCmSqlResolutionPropertyItem* self = 
+        new ( ELeave ) CCmSqlResolutionPropertyItem();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlResolutionPropertyItem::~CCmSqlResolutionPropertyItem()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlResolutionPropertyItem::SetWidth
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlResolutionPropertyItem::SetWidth( const TInt aWidth )
+    {
+    iWidth = aWidth;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlResolutionPropertyItem::SetHeight
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlResolutionPropertyItem::SetHeight( const TInt aHeight )
+    {
+    iHeight = aHeight;               
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlResolutionPropertyItem::SetPixelCount
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlResolutionPropertyItem::SetPixelCount( 
+    const TInt aPixelCount )
+    {
+    iPixelCount = aPixelCount;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlResolutionPropertyItem::Width
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlResolutionPropertyItem::Width() const
+    {
+    return iWidth;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlResolutionPropertyItem::Height
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlResolutionPropertyItem::Height() const
+    {
+    return iHeight;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlResolutionPropertyItem::PixelCount
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlResolutionPropertyItem::PixelCount() const
+    {
+    return iPixelCount;
+    }
+
+// ---------------------------------------------------------------------------
+// CompareItemsByName
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmSqlResolutionPropertyItem::CompareItemsByName( 
+    const CCmSqlResolutionPropertyItem& aFirst, 
+    const CCmSqlResolutionPropertyItem& aSecond )
+    {
+    return aFirst.Name().Compare( aSecond.Name() );
+    }
+                                                               
+// ---------------------------------------------------------------------------
+// CCmSqlResolutionPropertyItem::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlResolutionPropertyItem::ExternalizeL( 
+    RWriteStream& aStream ) const
+    {      
+    aStream.WriteInt32L( iWidth );
+    aStream.WriteInt32L( iHeight );     
+    aStream.WriteInt32L( iPixelCount );
+    CCmSqlPropertyItem::ExternalizeL( aStream );
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSqlResolutionPropertyItem::InternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmSqlResolutionPropertyItem::InternalizeL( 
+    RReadStream& aStream )
+    {
+    iWidth = aStream.ReadInt32L();
+    iHeight = aStream.ReadInt32L();
+    iPixelCount = aStream.ReadInt32L();
+    CCmSqlPropertyItem::InternalizeL( aStream );
+    }
+        
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmSqlResolutionPropertyItem::CCmSqlResolutionPropertyItem()
+    {               
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlResolutionPropertyItem::ConstructL()
+    {
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmsqlvideoitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating sql itemss
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include "cmsqlvideoitem.h"
+#include "msdebug.h"
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlVideoItem* CCmSqlVideoItem::NewL()
+    {   
+    CCmSqlVideoItem* self = CCmSqlVideoItem::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmSqlVideoItem* CCmSqlVideoItem::NewLC()
+    {    
+    CCmSqlVideoItem* self = new ( ELeave ) CCmSqlVideoItem();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmSqlVideoItem::~CCmSqlVideoItem()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlVideoItem::SetGenreId
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C void CCmSqlVideoItem::SetGenreId( const TInt64 aGenreId )
+    {
+    iGenreId = aGenreId;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlVideoItem::GenreId
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C TInt64 CCmSqlVideoItem::GenreId() const
+    {
+    return iGenreId;
+    }
+   
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmSqlVideoItem::CCmSqlVideoItem()
+    {                
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlVideoItem::ConstructL()
+    {
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmstorelistitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating store file list item
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmstorelistitem.h"
+#include "msdebug.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmStoreListItem* CCmStoreListItem::NewL()
+    {    
+    CCmStoreListItem* self = CCmStoreListItem::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmStoreListItem* CCmStoreListItem::NewLC()
+    {   
+    CCmStoreListItem* self = new ( ELeave ) CCmStoreListItem();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmStoreListItem::~CCmStoreListItem()
+    {
+    iDeviceIds.Reset();
+    iDeviceIds.Close();
+    iStatusValues.Reset();
+    iStatusValues.Close();    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmStoreListItem::SetListId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreListItem::SetListId( const TUint aListId )
+    {
+    iListId = aListId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmStoreListItem::SetDevId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreListItem::SetDevId( const TUint8 aId, 
+    TCmListItemStatus aStatus )
+    {
+    iDeviceIds.Append( aId );
+    iStatusValues.Append( aStatus );
+    }    
+    
+// ---------------------------------------------------------------------------
+// CCmStoreListItem::ListId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint CCmStoreListItem::ListId() const
+    {
+    return iListId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmStoreListItem::DevIds
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RArray<TInt> CCmStoreListItem::DevIds() const
+    {
+    return iDeviceIds;
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmStoreListItem::StatusValues
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RArray<TCmListItemStatus> CCmStoreListItem::StatusValues() const
+    {
+    return iStatusValues;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmStoreListItem::UpdateFileStatusL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreListItem::UpdateFileStatusL( const TUint8 aId, 
+    TCmListItemStatus aStatus )
+    {
+    // Find index of the device
+    TInt index( iDeviceIds.FindL( aId ) );
+    if( KErrNotFound != index )
+        {
+        // Use index when updating status value
+        iStatusValues[index] = aStatus;
+        }
+
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmStoreListItem::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreListItem::ExternalizeL( RWriteStream& aStream ) const
+    {                
+    aStream.WriteUint16L( iListId );
+    aStream.WriteUint16L( iDeviceIds.Count() );
+    for( TInt i = 0; i < iDeviceIds.Count(); i++ )
+        {
+        aStream.WriteInt16L( iDeviceIds[i] );    
+        }
+    aStream.WriteInt16L( iStatusValues.Count() );
+    for( TInt i = 0; i < iStatusValues.Count(); i++ )
+        {
+        aStream.WriteInt16L( iStatusValues[i] );    
+        }            
+    CCmBaseListItem::ExternalizeL(aStream);              
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmStoreListItem::InternalizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreListItem::InternalizeL( RReadStream& aStream )
+    {
+    iListId = aStream.ReadUint16L();
+    TUint count( aStream.ReadUint16L() );
+    iDeviceIds.Reset();
+    for( TInt i = 0; i < count; i++ )
+        {
+        iDeviceIds.Append( aStream.ReadInt16L() );
+        }
+    count = aStream.ReadUint16L();
+    iStatusValues.Reset();
+    for( TInt i = 0; i < count; i++ )
+        {
+        iStatusValues.Append( (TCmListItemStatus) aStream.ReadInt16L() );
+        }        
+    CCmBaseListItem::InternalizeL(aStream);               
+    }
+        
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmStoreListItem::CCmStoreListItem()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmStoreListItem::ConstructL()
+    {
+    // construct base class
+    CCmBaseListItem::ConstructL();
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmstorerule.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,465 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating store rule
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmmediaserver.h"
+#include "cmstorerule.h"
+#include "msdebug.h"
+
+// CONSTANTS
+const TInt KArrayGranularity = 16;
+const TInt KArrayGranularityContainer = 8;
+
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmStoreRule* CCmStoreRule::NewL()
+    {    
+    CCmStoreRule* self = CCmStoreRule::NewLC();
+    CleanupStack::Pop( self ); 
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmStoreRule* CCmStoreRule::NewLC()
+    {    
+    CCmStoreRule* self = new ( ELeave ) CCmStoreRule();
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmStoreRule::~CCmStoreRule()
+    {
+    delete iName;
+
+    iRuleDefs.Reset();
+    iRuleDefs.Close();
+
+    iMediaServers.ResetAndDestroy();
+    iMediaServers.Close();
+    
+    iExcPlayLists->Reset();
+    iExcAlbums->Reset();
+
+    delete iExcPlayLists;
+    delete iExcAlbums;      
+    }
+
+// ---------------------------------------------------------------------------
+// Add new rule into StoreRule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmStoreRule::AddStoreRuleL( TCmMediaType aMediaType )
+    {    
+    iRuleDefs.AppendL( aMediaType );
+    TInt index = iRuleDefs.Count() - 1;    
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// Get rule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRule::StoreRule( TInt aIndex, TCmMediaType* aMediaType )
+    {
+    *aMediaType = (TCmMediaType)iRuleDefs[aIndex];
+    }
+        
+// ---------------------------------------------------------------------------
+// Add new media server into FillRule
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmStoreRule::AddMediaServerL( const TDesC8& aUDN )
+    {
+    CCmMediaServer* server = CCmMediaServer::NewLC();
+    server->SetUDNL( aUDN );    
+    iMediaServers.Append( server );
+    CleanupStack::Pop( server );    
+    TInt index = iMediaServers.Count() - 1;    
+    return index;        
+    }
+
+// ---------------------------------------------------------------------------
+// Delete media server from the store rule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRule::DeleteMediaServer( const TDesC8& aUDN )
+    {
+    TBool deleted( EFalse );
+    for( TInt i = 0; i < iMediaServers.Count() && !deleted; i++ )
+        {
+        if( KErrNone == iMediaServers[i]->MediaServer().Compare(aUDN) )
+            {
+            delete iMediaServers[i];
+            iMediaServers.Remove(i);
+            iMediaServers.Compress();
+            deleted = ETrue;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Adds one album into excluded list
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRule::AddExcAlbumL( const TDesC& aAlbum )
+    {
+    TRACE(Print(_L("[COMMON]\t AddExcAlbumL( %S )"), &aAlbum ));
+    HBufC* temp = aAlbum.AllocL();
+    CleanupStack::PushL( temp );
+    iExcAlbums->AppendL( *temp );
+    CleanupStack::Pop( temp );
+    }
+
+// ---------------------------------------------------------------------------
+// Adds one playlist into excluded list
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmStoreRule::AddExcPlayListL( const TDesC& aPlayList )
+    {
+    HBufC* temp = aPlayList.AllocL();
+    CleanupStack::PushL( temp );
+    iExcPlayLists->AppendL( *temp );
+    CleanupStack::Pop( temp );
+    }
+
+// ---------------------------------------------------------------------------
+// Removes one album from the excluded list
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRule::RemoveExcAlbum( const TDesC& aAlbum )
+    {
+    TInt pos( KErrNone );
+    TInt err( iExcAlbums->Find( aAlbum, pos, ECmpNormal ) );
+    if( err == KErrNone )
+        {
+        iExcAlbums->Delete( pos );
+        iExcAlbums->Compress();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Removes one playlist from the excluded list
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmStoreRule::RemoveExcPlayList( const TDesC& aPlayList )
+    {
+    TInt pos( KErrNone );
+    TInt err( iExcPlayLists->Find( aPlayList, pos, ECmpNormal ) );
+    if( err == KErrNone )
+        {
+        iExcPlayLists->Delete( pos );
+        iExcPlayLists->Compress();
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// Returns excluded albums
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CDesCArray& CCmStoreRule::ExcAlbums()
+    {
+    return *iExcAlbums;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns excluded playlists
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CDesCArray& CCmStoreRule::ExcPlayLists()
+    {
+    return *iExcPlayLists;
+    }
+            
+// ---------------------------------------------------------------------------
+// Get media server
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C const TDesC8& CCmStoreRule::MediaServerL( TInt aIndex )
+    {
+    // check parameter
+    if ( aIndex < 0 || aIndex >= iMediaServers.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    return iMediaServers[aIndex]->MediaServer();
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns count of rules
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmStoreRule::DefCount() const
+    {
+    return iRuleDefs.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// Returns count of media servers
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmStoreRule::MediaServerCount() const
+    {
+    return iMediaServers.Count();
+    }    
+
+// ---------------------------------------------------------------------------
+// Sets FillRule name
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRule::SetNameL( const TDesC8& aName )
+    {
+    delete iName;
+    iName = NULL;
+    iName = aName.AllocL();        
+    }
+
+// ---------------------------------------------------------------------------
+// Get Name
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TDesC8& CCmStoreRule::Name() const
+    {
+    return *iName;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets list id, when storing data into db this values isn't used as a 
+// db list id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRule::SetListId( const TUint aId )
+    {
+    iId = aId;
+    }
+
+// ---------------------------------------------------------------------------
+// Get list id
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TUint CCmStoreRule::ListId() const
+    {
+    return iId;
+    }
+            
+// ---------------------------------------------------------------------------
+// Sets selected state
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRule::SetSelected( TCmFillRuleStatus aSelected )
+    {
+    iSelected = aSelected;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns method
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmFillRuleStatus CCmStoreRule::Selected() const
+    {
+    return iSelected;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets rule's status ( e.g ECmToBeRemoved )
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRule::SetStatus( TCmListItemStatus aStatus )
+    {
+    iStatus = aStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns status 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCmListItemStatus CCmStoreRule::Status() const
+    {
+    return iStatus;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmStoreRule::ExternalizeL
+// ---------------------------------------------------------------------------
+//
+void CCmStoreRule::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iName->Length() );
+    if ( iName )
+        {
+        aStream << *iName;
+        }
+    else
+        {
+        aStream << KNullDesC8();
+        }      
+        
+    aStream.WriteInt16L((TInt)iSelected );    
+    aStream.WriteInt16L((TInt)iStatus );
+    
+    aStream.WriteInt16L( iRuleDefs.Count() );
+    for ( TInt index(0); index < iRuleDefs.Count(); index++ )
+        {
+        aStream.WriteInt16L((TInt)iRuleDefs[index] );
+        }
+        
+    aStream.WriteInt16L( iMediaServers.Count() );
+    for ( TInt index(0); index < iMediaServers.Count(); index++ )
+        {
+        iMediaServers[index]->ExternalizeL( aStream );
+        }
+    TRACE(Print(_L("[COMMON]\t iExcAlbums->Count() = %d"), 
+        iExcAlbums->Count() ));    
+    aStream.WriteInt16L( iExcAlbums->Count() );
+    for ( TInt index(0); index < iExcAlbums->Count(); index++ )
+        {
+        TRACE(Print(_L("[COMMON]\t iExcAlbums[index].Length() = %d"), 
+            iExcAlbums->MdcaPoint(index).Length() ));                
+        aStream.WriteInt32L( iExcAlbums->MdcaPoint(index).Length() );
+        aStream << iExcAlbums->MdcaPoint(index);
+        }
+    TRACE(Print(_L("[COMMON]\t iExcPlayLists->Count() = %d"), 
+        iExcPlayLists->Count() ));         
+    aStream.WriteInt16L( iExcPlayLists->Count() );
+    for ( TInt index(0); index < iExcPlayLists->Count(); index++ )
+        {
+        TRACE(Print(_L("[COMMON]\t iExcPlayLists[index].Length() = %d"), 
+            iExcPlayLists->MdcaPoint(index).Length() ));
+        aStream.WriteInt32L( iExcPlayLists->MdcaPoint(index).Length() );
+        aStream << iExcPlayLists->MdcaPoint(index);
+        }
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmFillRule::InternalizeL
+// ---------------------------------------------------------------------------
+//
+void CCmStoreRule::InternalizeL( RReadStream& aStream )
+    {
+    // Content
+    if ( iName )
+        {
+        delete iName;
+        iName = NULL;
+        }
+    TInt bufLength = aStream.ReadInt32L();    
+    iName = HBufC8::NewL( aStream, bufLength );
+    
+    // cleanup
+    iRuleDefs.Reset();
+ 
+    iSelected = (TCmFillRuleStatus)aStream.ReadInt16L();
+    iStatus = (TCmListItemStatus)aStream.ReadInt16L();
+    
+    // rule count 
+    TInt ruleCount = aStream.ReadInt16L();
+    
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < ruleCount; index++ )
+        {
+        iRuleDefs.Append((TCmMediaType)aStream.ReadInt16L());   
+        }
+        
+    // cleanup
+    iMediaServers.ResetAndDestroy();
+    
+    // media Server count
+    TInt mediaServerCount = aStream.ReadInt16L();
+    
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < mediaServerCount; index++ )
+        {
+        CCmMediaServer* server = CCmMediaServer::NewLC();    
+        server->InternalizeL( aStream );
+        iMediaServers.Append( server );
+        CleanupStack::Pop( server );   
+        server = NULL;
+        }
+    iExcAlbums->Reset();   
+    TInt excAlbumsCount( aStream.ReadInt16L() );
+    bufLength = KErrNone;
+    HBufC* temp;
+    TRACE(Print(_L("[COMMON]\t excAlbumsCount = %d"), excAlbumsCount ));    
+    for ( TInt index(0); index < excAlbumsCount ; index++ )
+        {
+        bufLength = aStream.ReadInt32L();
+        TRACE(Print(_L("[COMMON]\t bufLength = %d"), bufLength )); 
+        temp = HBufC::NewL( aStream, bufLength );
+        CleanupStack::PushL( temp );
+        iExcAlbums->AppendL( *temp );
+        CleanupStack::Pop( temp );
+        temp = NULL;
+        }         
+    iExcPlayLists->Reset();
+    TInt excPlayListCount( aStream.ReadInt16L() );
+    bufLength = KErrNone;
+    TRACE(Print(_L("[COMMON]\t excPlayListCount = %d"), excPlayListCount ));
+    for ( TInt index(0); index < excPlayListCount ; index++ )
+        {
+        bufLength = aStream.ReadInt32L();
+        TRACE(Print(_L("[COMMON]\t bufLength = %d"), bufLength ));
+        temp = HBufC::NewL( aStream, bufLength );
+        CleanupStack::PushL( temp );
+        iExcPlayLists->AppendL( *temp );
+        CleanupStack::Pop( temp );
+        temp = NULL;
+        }                 
+    }
+                
+// ---------------------------------------------------------------------------
+// Default constructor
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//    
+CCmStoreRule::CCmStoreRule() : 
+    iRuleDefs( KArrayGranularity ), 
+    iMediaServers( KArrayGranularity )
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmStoreRule::ConstructL()
+    {
+    iExcAlbums = new ( ELeave ) CDesCArrayFlat( KArrayGranularityContainer );
+    iExcPlayLists = 
+        new ( ELeave ) CDesCArrayFlat( KArrayGranularityContainer );
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmlibrary/src/cmstorerulecontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Capsulating fill rules
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32std.h>
+#include <s32mem.h>
+#include "cmstorerulecontainer.h"
+#include "cmstorerule.h"
+#include "msdebug.h"
+ 
+// CONSTANTS
+const TInt KStoreRuleArrayGranularity = 16;
+ 
+// ======== LOCAL FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmStoreRuleContainer* CCmStoreRuleContainer::NewL()
+    {
+    TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::NewL() start")));    
+    CCmStoreRuleContainer* self = CCmStoreRuleContainer::NewLC();
+    CleanupStack::Pop( self );
+    TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::NewL() end"))); 
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmStoreRuleContainer* CCmStoreRuleContainer::NewLC()
+    {
+    TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::NewLC() start")));    
+    CCmStoreRuleContainer* self = new ( ELeave ) CCmStoreRuleContainer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::NewLC() end"))); 
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmStoreRuleContainer::~CCmStoreRuleContainer()
+    {
+    TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::\
+        ~CCmStoreRuleContainer() start")));
+    iStoreRuleArray.ResetAndDestroy();
+    iStoreRuleArray.Close();
+    TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::\
+        ~CCmStoreRuleContainer() end")));     
+    }
+
+// ---------------------------------------------------------------------------
+// Add new rule into store rule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmStoreRuleContainer::AddStoreRuleL( CCmStoreRule* aRule )
+    {
+    iStoreRuleArray.AppendL( aRule );
+    TInt index = iStoreRuleArray.Count() - 1;    
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// Deletes store rule with the given index
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRuleContainer::DeleteStoreRule( TInt aIndex )
+    {
+    if( iStoreRuleArray.Count() > aIndex )
+        {
+        delete iStoreRuleArray[aIndex];
+        iStoreRuleArray.Remove(aIndex);
+        iStoreRuleArray.Compress();
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// Get rule
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmStoreRule* CCmStoreRuleContainer::StoreRule( TInt aIndex )
+    {
+    return iStoreRuleArray[aIndex];
+    }
+
+// ---------------------------------------------------------------------------
+// Returns count of rules
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmStoreRuleContainer::StoreRuleCount() const
+    {
+    return iStoreRuleArray.Count();
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmFillRuleContainer::ExternalizeL
+// Writes the content to stream.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmStoreRuleContainer::ExternalizeL( 
+    RWriteStream& aStream ) const
+    {
+    // Let's write the count of fill rules to stream first
+    aStream.WriteInt16L( iStoreRuleArray.Count() );
+    for ( TInt index = 0; index < iStoreRuleArray.Count(); index++ )
+        {
+        CCmStoreRule* rule = iStoreRuleArray[index];    
+        // Then the object itself
+        rule->ExternalizeL( aStream );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPContainer::InternalizeL
+// Fills container information from stream
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmStoreRuleContainer::InternalizeL( RReadStream& aStream )
+    {
+    // Then internalize the objects
+    if ( iStoreRuleArray.Count() > KErrNone )
+        {
+        iStoreRuleArray.ResetAndDestroy();
+        }
+    // First the count of fill rules
+    TInt ruleCount = aStream.ReadInt16L();
+    
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < ruleCount; index++ )
+        {
+        CCmStoreRule* newItem = CCmStoreRule::NewL();
+        CleanupStack::PushL( newItem );
+        newItem->InternalizeL( aStream );
+        AddStoreRuleL( newItem );
+        CleanupStack::Pop( newItem ); 
+        newItem = NULL;
+        }
+    }
+                    
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmStoreRuleContainer::CCmStoreRuleContainer() : 
+    iStoreRuleArray( KStoreRuleArrayGranularity )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmStoreRuleContainer::ConstructL()
+    {
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/bwins/cmsettingsengineu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewCmSettingsEngineL@CCmSettingsFactory@@SAPAVMCmSettings@@XZ @ 1 NONAME ; class MCmSettings * CCmSettingsFactory::NewCmSettingsEngineL(void)
+	?NewCmSettingsEngineLC@CCmSettingsFactory@@SAPAVMCmSettings@@XZ @ 2 NONAME ; class MCmSettings * CCmSettingsFactory::NewCmSettingsEngineLC(void)
+
Binary file upnpharvester/common/cmsettings/data/10281FAB.txt has changed
Binary file upnpharvester/common/cmsettings/data/keys_mediaservant.xls has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/eabi/cmsettingsengineu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN18CCmSettingsFactory20NewCmSettingsEngineLEv @ 1 NONAME
+	_ZN18CCmSettingsFactory21NewCmSettingsEngineLCEv @ 2 NONAME
+	_ZTI17CCmSettingsEngine @ 3 NONAME ; #<TI>#
+	_ZTV17CCmSettingsEngine @ 4 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for CM Settings Engine
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/cmsettingsfactory.h   |../../../../inc/cmsettingsfactory.h
+../inc/cmsettings.h   |../../../../inc/cmsettings.h
+
+// Central repository default keys
+../data/10281FAB.txt    /epoc32/release/winscw/udeb/z/private/10202be9/10281FAB.txt
+../data/10281FAB.txt    /epoc32/release/winscw/urel/z/private/10202be9/10281FAB.txt
+../data/10281FAB.txt    /epoc32/release/armv5/udeb/z/private/10202be9/10281FAB.txt
+../data/10281FAB.txt    /epoc32/release/armv5/urel/z/private/10202be9/10281FAB.txt
+
+PRJ_MMPFILES
+cmsettingsengine.mmp
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/group/cmsettingsengine.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project CM Settings Engine
+*
+*/
+
+
+
+
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET                  cmsettingsengine.dll
+TARGETTYPE              DLL
+UID                     0x1000008D 0x10281FAB
+
+VENDORID                VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+SOURCEPATH              ../src
+SOURCE                  cmsettingsfactory.cpp
+SOURCE                  cmsettingsengine.cpp
+
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../../../inc
+USERINCLUDE             ../../../../group
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 euser.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 bafl.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 upnpserviceframework.lib
+LIBRARY                 cmcommon.lib
+LIBRARY                 PlatformEnv.lib
+LIBRARY                 upnpsettingsengine.lib
+
+DEBUGLIBRARY            flogger.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/inc/cmsettings.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,238 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CM Settings class
+*
+*/
+
+
+
+
+
+
+
+#ifndef M_CCMSETTINGS_H
+#define M_CCMSETTINGS_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmcommon.h"
+
+// FORWARD DECLARATIONS
+class CRepository;
+class CCmDriveInfo;
+class RFs;
+
+/**
+ *  Defines the cmsettings interface
+ *
+ *  This class defines the cmsettings interface. Provides methods to
+ *  execute fill specific services
+ *
+ *  @lib cmsettings.lib
+ *  @since S60 v3.2
+ */
+class MCmSettings
+    {
+
+public: // New functions
+
+    /**
+     * Gets the status for the Content Manager service
+     *
+     * @since S60 3.1
+     * @param aService indicates service
+     * @param aState state enum is returned here
+     * @return status of the operation
+     */
+    virtual TInt GetServiceState( const TCmService aService,
+                                   TCmServiceState& aState ) const = 0;
+
+     /**
+     * Sets Content Manager service state
+     *
+     * @since S60 3.1
+     * @param aState TCmServerState to indicate state
+     * @return status of the operation
+     */
+    virtual TInt SetServiceState( const TCmService aService,
+                                   const TCmServiceState aState ) = 0;
+
+    /**
+     * Gets defined MMC information.
+     *
+     * @since S60 3.1
+     * @param aName MMC card's name (max length KMaxFileName)
+     * @param aId MMC car's unique id
+     * @return status of the operation
+     */
+//    virtual TInt GetMmcInformation( TDes& aName, TUint& aId ) const = 0;
+
+
+    /**
+     * Sets defined MMC information.
+     *
+     * @since S60 3.1
+     * @param aName MMC card's name (max length KMaxFileName)
+     * @param aId MMC car's unique id
+     * @return status of the operation
+     */
+//    virtual TInt SetMmcInformation( const TDesC& aName, const TUint aId ) = 0;
+
+
+    /**
+     * Gets defined IAP information.
+     *
+     * @since S60 3.1
+     * @param aIap access point info is stored here
+     * @return status of the operation
+     */
+   virtual TInt GetIapL( TInt& aIap ) const = 0;
+
+    /**
+     * Gets next runtime information for the specified service.
+     *
+     * @since S60 3.1
+     * @param aService content manager service
+     * @param aRuntime the next date and time service is run.
+     * @return status of the operation
+     */
+    virtual TInt GetNextRuntime( const TCmService aService,
+                                  TTime& aRuntime ) const = 0;
+
+
+    /**
+     * Sets next runtime information for the specified service.
+     *
+     * @since S60 3.1
+     * @param aService content manager service
+     * @param aNextTime the next date and time service is run.
+     * @return status of the operation
+     */
+    virtual TInt SetNextRuntime( const TCmService aService,
+                                  const TTime aRuntime ) = 0;
+
+
+    /**
+     * Gets device discovery delay
+     *
+     * @since S60 3.1
+     * @param aDelay device discovery delay
+     * @return status of the operation
+     */
+    virtual TInt GetDiscoveryDelay( TInt& aDelay ) const = 0;
+
+
+    /**
+     * Sets device discovery delay
+     *
+     * @since S60 3.1
+     * @param aDelay device discovery delay
+     * @return status of the operation
+     */
+    virtual TInt SetDiscoveryDelay( const TInt aDelay ) = 0;
+
+
+    /**
+     * Gets automatic sync settings
+     *
+     * @since S60 3.1
+     * @param aAutoSync automatic sync settings
+     * @return status of the operation
+     */
+    virtual TInt GetAutoSync( TBool& aAutoSync ) const = 0;
+
+
+    /**
+     * Sets automatic sync settings
+     *
+     * @since S60 3.1
+     * @param aAutoSync automatic sync settings
+     * @return status of the operation
+     */
+    virtual TInt SetAutoSync( const TBool aAutoSync ) = 0;
+
+     /**
+     * Gets memory manager status
+     *
+     * @since S60 3.1
+     * @param aMmStatus memory manager status
+     * @return status of the operation
+     */
+    virtual TInt GetMemoryManagerStatus( TBool& aMmStatus ) const = 0;
+
+     /**
+     * Sets memory manager status
+     *
+     * @since S60 3.1
+     * @param aMmStatus memory manager status
+     * @return status of the operation
+     */
+    virtual TInt SetMemoryManagerStatus( const TBool aMmStatus ) = 0;
+
+    /**
+     * Gets search item count
+     *
+     * @since S60 3.1
+     * @param aItemCount result item count
+     * @return status of the operation
+     */
+    virtual TInt GetSearchCount( TInt& aItemCount ) const = 0;
+
+    /**
+     * Gets add item count
+     *
+     * @since S60 3.1
+     * @param aItemCount result item count
+     * @return status of the operation
+     */
+    virtual TInt GetAddCount( TInt& aItemCount ) const = 0;
+
+    /**
+     * ???
+     *
+     * @since S60 3.1
+     * @param aAppWizardState ??
+     * @return TInt ???
+     */
+    virtual TInt GetAppWizardInformation( TInt& aAppWizardState ) const = 0;
+
+    /**
+     * ???
+     *
+     * @since S60 3.1
+     * @return TInt ???
+     */
+    virtual TInt SetAppWizardInformation() = 0;
+
+    /**
+     * ???
+     *
+     * @since S60 3.1
+     * @param aFs ??
+     * @param aDrives ??
+     */
+    virtual void DriveListL( RFs& aFs,
+                              RPointerArray<CCmDriveInfo>& aDrives ) const = 0;
+
+    /**
+     * Deletes the object
+     *
+     * @since S60 3.1
+     */
+	virtual void Close() = 0;
+
+    };
+
+
+#endif // M_CCMSETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/inc/cmsettingsengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CM Settings Engine main class
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_CCMSETTINGSENGINE_H
+#define C_CCMSETTINGSENGINE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmcommon.h"
+#include "cmsettings.h"
+
+// FORWARD DECLARATIONS
+class CRepository;
+class CCmDriveInfo;
+class RFs;
+
+/**
+ *  Settings engine class for the cenrep keys
+ *
+ *  Provides interface to get persistent settings information
+ *  for different ContentManager modules.
+ *
+ *  @lib cmsettingsengine
+ *  @since S60 3.1
+ */
+class CCmSettingsEngine : public CBase,
+                          public MCmSettings
+    {
+
+public: // Constructors and destructor
+
+    // 2-phase constructor
+    static CCmSettingsEngine* NewL();
+
+    // 2-phase constructor
+    static CCmSettingsEngine* NewLC();
+
+    // Destructor
+    virtual ~CCmSettingsEngine();
+
+public: // New functions
+
+    /**
+     * Gets the status for the Content Manager service
+     *
+     * @since S60 3.1
+     * @param aService indicates service
+     * @param aState state enum is returned here
+     * @return status of the operation
+     */
+    TInt GetServiceState( const TCmService aService,
+                                   TCmServiceState& aState ) const;
+
+     /**
+     * Sets Content Manager service state
+     *
+     * @since S60 3.1
+     * @param aState TCmServerState to indicate state
+     * @return status of the operation
+     */
+    TInt SetServiceState( const TCmService aService,
+                                   const TCmServiceState aState );
+
+    /**
+     * Gets defined IAP information.
+     *
+     * @since S60 3.1
+     * @param aIap access point info is stored here
+     * @return status of the operation
+     */
+   TInt GetIapL( TInt& aIap ) const;
+
+    /**
+     * Gets next runtime information for the specified service.
+     *
+     * @since S60 3.1
+     * @param aService content manager service
+     * @param aRuntime the next date and time service is run.
+     * @return status of the operation
+     */
+    TInt GetNextRuntime( const TCmService aService,
+                                  TTime& aRuntime ) const;
+
+
+    /**
+     * Sets next runtime information for the specified service.
+     *
+     * @since S60 3.1
+     * @param aService content manager service
+     * @param aNextTime the next date and time service is run.
+     * @return status of the operation
+     */
+    TInt SetNextRuntime( const TCmService aService,
+                                  const TTime aRuntime );
+
+
+    /**
+     * Gets device discovery delay
+     *
+     * @since S60 3.1
+     * @param aDelay device discovery delay
+     * @return status of the operation
+     */
+    TInt GetDiscoveryDelay( TInt& aDelay ) const;
+
+
+    /**
+     * Sets device discovery delay
+     *
+     * @since S60 3.1
+     * @param aDelay device discovery delay
+     * @return status of the operation
+     */
+    TInt SetDiscoveryDelay( const TInt aDelay );
+
+
+    /**
+     * Gets automatic sync settings
+     *
+     * @since S60 3.1
+     * @param aAutoSync automatic sync settings
+     * @return status of the operation
+     */
+    TInt GetAutoSync( TBool& aAutoSync ) const;
+
+
+    /**
+     * Sets automatic sync settings
+     *
+     * @since S60 3.1
+     * @param aAutoSync automatic sync settings
+     * @return status of the operation
+     */
+    TInt SetAutoSync( const TBool aAutoSync );
+
+     /**
+     * Gets memory manager status
+     *
+     * @since S60 3.1
+     * @param aMmStatus memory manager status
+     * @return status of the operation
+     */
+    TInt GetMemoryManagerStatus( TBool& aMmStatus ) const;
+
+     /**
+     * Sets memory manager status
+     *
+     * @since S60 3.1
+     * @param aMmStatus memory manager status
+     * @return status of the operation
+     */
+    TInt SetMemoryManagerStatus( const TBool aMmStatus );
+
+    /**
+     * Gets search item count
+     *
+     * @since S60 3.1
+     * @param aItemCount result item count
+     * @return status of the operation
+     */
+    TInt GetSearchCount( TInt& aItemCount ) const;
+
+    /**
+     * Gets add item count
+     *
+     * @since S60 3.1
+     * @param aItemCount result item count
+     * @return status of the operation
+     */
+    TInt GetAddCount( TInt& aItemCount ) const;
+
+    /**
+     * ???
+     *
+     * @since S60 3.1
+     * @param aAppWizardState ??
+     * @return TInt ???
+     */
+    TInt GetAppWizardInformation( TInt& aAppWizardState ) const;
+
+    /**
+     * ???
+     *
+     * @since S60 3.1
+     * @return TInt ???
+     */
+    TInt SetAppWizardInformation();
+
+    /**
+     * ???
+     *
+     * @since S60 3.1
+     * @param aFs ??
+     * @param aDrives ??
+     */
+    void DriveListL( RFs& aFs,
+                              RPointerArray<CCmDriveInfo>& aDrives ) const;
+
+    /**
+     * Deletes the object
+     *
+     * @since S60 3.1
+     */
+	void Close();
+
+private:
+    CCmSettingsEngine();
+
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Central Repository access
+     */
+    CRepository*                    iRepository;        // owned
+
+    };
+
+
+#endif // C_CCMSETTINGSENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/inc/cmsettingsfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Abstract factory for CMSettings
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_CMSETTINGSFACTORY_H
+#define C_CMSETTINGSFACTORY_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+/* Forward declarations. */
+class MCmSettings;
+
+/**
+ *  Abstract factory for CMSettings
+ *
+ *  @lib cmsettings.lib
+ *  @since S60 v3.1
+ */
+class CCmSettingsFactory : public CBase
+    {
+
+public:
+
+    /**
+     * Creates a new instance of CSSettings
+     * @return  pointer to CCmSettingsEngine class
+     */
+    IMPORT_C static MCmSettings* NewCmSettingsEngineL();
+
+    /**
+     * Creates a new instance of CSSettings. Instance is left in
+     * cleanup stack.
+     * @return  pointer to CCmSettingsEngine class
+     */
+    IMPORT_C static MCmSettings* NewCmSettingsEngineLC();
+
+    };
+
+#endif // C_CMSETTINGSFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/inc/contentmanagercrkeys.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:     
+*     Definitions of internal keys related to Content Manager
+*     settings in CenRep
+*
+*/
+
+
+
+
+
+#ifndef CONTENTMANAGERCRKEYS_H
+#define CONTENTMANAGERCRKEYS_H
+
+#include <e32std.h>
+
+
+/**
+ * Content Manager UID
+ *
+ */
+const TUid KCRUidCmContentManager = {0x10281FAB};
+
+/**
+ * KCmContentManagerState
+ * Defines persistent state information of the Content Manager
+ *
+ */
+const TUint32 KCmContentManagerState = 0x00000101;
+
+/**
+ * KCmHarvesterState
+ * Defines persistent state information of the metadata harvester
+ *
+ */
+const TUint32 KCmHarvesterState = 0x00000102;
+
+/**
+ * KCmFillState
+ * Defines whether fill service state.
+ *
+ */
+const TUint32 KCmFillState = 0x00000103;
+
+/**
+ * KCmStoreState
+ * Defines whether store service state.
+ *
+ */
+const TUint32 KCmStoreState = 0x00000104;
+
+/**
+ * KCmMemoryManagerState
+ * Defines whether memory manager state.
+ */
+const TUint32 KCmMemoryManagerState = 0x00000105;
+
+/**
+ * KCmNextHarvestTime
+ * Defines the date/time when next harvesting starts
+ */
+const TUint32 KCmNextHarvestTime = 0x00000106;
+
+/**
+ * KCmHarvestValue
+ * Defines the harvesting period.
+ */
+const TUint32 KCmHarvestPeriod = 0x00000107;
+
+/**
+ * KCmNextFillTime
+ * Defines the date/time when next content fill starts
+ */
+const TUint32 KCmNextFillTime = 0x00000108;
+
+/**
+ * KCmFillPeriod
+ * Defines the content fill period.
+ */
+const TUint32 KCmFillPeriod = 0x00000109;
+
+/**
+ * KCmNextStoreTime
+ * Defines the date/time when next content store starts
+ */
+const TUint32 KCmNextStoreTime = 0x0000010A;
+
+/**
+ * KCmStorePeriod
+ * Defines the content store period.
+ */
+const TUint32 KCmStorePeriod = 0x0000010B;
+
+/**
+ * KCmDiscoveryDelay
+ * Maximum time for device discovery
+ */
+const TUint32 KCmDiscoveryDelay = 0x0000010C;
+
+/**
+ * KCmAutoSync
+ * Automatic synchronization state
+ */
+const TUint32 KCmAutoSync = 0x0000010D;
+
+/**
+ * KCmSearchCount
+ * Item count for search
+ */
+const TUint32 KCmSearchCount = 0x0000010E;
+
+/**
+ * KCmSearchCount
+ * Item count for database adding
+ */
+const TUint32 KCmAddCount = 0x0000010F;
+
+/**
+ * KCmAppWizardState
+ * MediaServant wizard state
+ */
+const TUint32 KCmAppWizardState = 0x00000110;
+
+#endif  // CONTENTMANAGERCRKEYS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/src/cmsettingsengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,535 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CM Settings Engine implementation
+*
+*/
+
+
+
+
+
+
+#include <e32base.h>
+#include <e32const.h>
+#include <bautils.h>
+#include <f32file.h>
+#include <centralrepository.h>
+#ifdef __SERIES60_31__
+#include <upnpnetworkaccess.h>
+#else
+#include "upnpsettingsengine.h"
+#endif
+#include "cmdriveinfo.h"
+#include <driveinfo.h>
+
+#include "msdebug.h"
+#include "cmsettingsengine.h"
+#include "contentmanagercrkeys.h"
+
+
+// Constants
+
+const TInt KTimeLength = 64;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CCmSettingsEngine::CCmSettingsEngine()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CCmSettingsEngine::ConstructL()
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::ConstructL"));
+
+    iRepository = CRepository::NewL( KCRUidCmContentManager );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phase API constructor
+// ---------------------------------------------------------------------------
+//
+CCmSettingsEngine* CCmSettingsEngine::NewL()
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::NewL"));
+
+    CCmSettingsEngine* self = CCmSettingsEngine::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phase API constructor
+// ---------------------------------------------------------------------------
+//
+CCmSettingsEngine* CCmSettingsEngine::NewLC()
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::NewLC"));
+
+    CCmSettingsEngine* self = new( ELeave ) CCmSettingsEngine;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCmSettingsEngine::~CCmSettingsEngine()
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::~CCmSettingsEngine"));
+
+    delete iRepository;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Gets Content Manager service's state
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::GetServiceState(
+    const TCmService aService,
+    TCmServiceState& aState ) const
+    {
+    TInt error( KErrNone );
+    TInt state( 0 );
+
+    switch ( aService )
+        {
+        case ECmServiceContentManager:
+            {
+            error = iRepository->Get( KCmContentManagerState, state ) ;
+            break;
+            }
+        case ECmServiceHarvest:
+            {
+            error = iRepository->Get( KCmHarvesterState, state ) ;
+            break;
+            }
+        case ECmServiceFill:
+            {
+            error = iRepository->Get( KCmFillState, state ) ;
+            break;
+            }
+        case ECmServiceStore:
+            {
+            error = iRepository->Get( KCmStoreState, state ) ;
+            break;
+            }
+        case ECmServiceMemoryManager:
+            {
+            error = iRepository->Get( KCmMemoryManagerState, state ) ;
+            break;
+            }
+        default:
+            {
+            LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetServiceState \
+            service not found"));
+            error = KErrNotFound;
+            break;
+            }
+        }
+
+    if ( !error )
+        {
+        TRACE(Print(_L("[CmSettinsEngine]\t CCmSettingsEngine::\
+        GetServiceState state = %d"), state ));
+        // converting the value back
+        aState = (TCmServiceState) state;
+        }
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Set Content Manager service state
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::SetServiceState(
+                                const TCmService aService,
+                                const TCmServiceState aState )
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetServiceState"));
+
+    TInt error( KErrNone );
+
+    switch ( aService )
+        {
+        case ECmServiceContentManager:
+            {
+            error = iRepository->Set( KCmContentManagerState, (TInt)aState ) ;
+            break;
+            }
+        case ECmServiceHarvest:
+            {
+            error = iRepository->Set( KCmHarvesterState, (TInt)aState ) ;
+            break;
+            }
+        case ECmServiceFill:
+            {
+            error = iRepository->Set( KCmFillState, (TInt)aState ) ;
+            break;
+            }
+        case ECmServiceStore:
+            {
+            error = iRepository->Set( KCmStoreState, (TInt)aState ) ;
+            break;
+            }
+        case ECmServiceMemoryManager:
+            {
+            error = iRepository->Set( KCmMemoryManagerState, (TInt)aState ) ;
+            break;
+            }
+        default:
+            {
+            error = KErrNotFound;
+            break;
+            }
+        }
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets IAP information from Home Network's cenrep key
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::GetIapL( TInt& aIap ) const
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetIapL"));
+
+#ifdef __SERIES60_31__
+    CUpnpNetworkAccess* access = CUpnpNetworkAccess::NewL( KCRUidUPnPStack );
+    TInt error( access->Get( CUpnpNetworkAccess::KUPnPStackIapId, aIap ) );
+    delete access;
+#else
+    CUPnPSettingsEngine* settings = CUPnPSettingsEngine::NewLC();
+    TInt error( settings->GetAccessPoint( aIap ) );
+    CleanupStack::PopAndDestroy( settings );
+#endif
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets next start time information for specified service
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::GetNextRuntime( const TCmService aService,
+                                                 TTime& aRuntime ) const
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetNextRuntime"));
+
+    TBuf<KTimeLength> time;
+    TPtrC timePtr( time );
+    TInt error( KErrNone );
+
+    if ( aService == ECmServiceStore )
+        {
+        error = iRepository->Get( KCmNextStoreTime, time );
+        }
+    else // ECmServiceFill
+        {
+        error = iRepository->Get( KCmNextFillTime, time );
+        }
+
+    if ( !error )
+        {
+        // convert string to TInt64
+        TInt64 timeInt;
+        TLex lex( timePtr );
+        lex.Val( timeInt );
+        aRuntime = timeInt;
+        }
+
+    return error;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Sets next start time information for specified service
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::SetNextRuntime( const TCmService aService,
+                                                 const TTime aNextTime )
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetNextRuntime"));
+
+    TInt error( KErrNone );
+    TBuf<KTimeLength> nextRunTime;
+    nextRunTime.AppendNum( aNextTime.Int64() );
+
+    if (aService == ECmServiceStore)
+        {
+        error = iRepository->Set( KCmNextStoreTime, nextRunTime );
+        }
+    else // ECmServiceFill
+        {
+        error = iRepository->Set( KCmNextFillTime, nextRunTime ) ;
+        }
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets discovery delay.
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::GetDiscoveryDelay( TInt& aDelay ) const
+    {
+    TInt error( KErrNone );
+    
+    error = iRepository->Get( KCmDiscoveryDelay, aDelay );
+    TRACE(Print(_L("[CmSettinsEngine]\t CCmSettingsEngine::\
+    GetDiscoveryDelay delay = %d"), aDelay));
+    
+    return error;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Sets discovery delay
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::SetDiscoveryDelay( const TInt aDelay )
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetDiscoveryDelay"));
+
+    return iRepository->Set( KCmDiscoveryDelay, aDelay );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::GetAutoSync( TBool& aAutoSync ) const
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetAutoSync"));
+
+    TInt error( KErrNotFound );
+
+    TInt autoSyncInt;
+    error = iRepository->Get( KCmAutoSync, autoSyncInt );
+
+    aAutoSync = (TBool) autoSyncInt;
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets synchronization state
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::SetAutoSync( const TBool aAutoSync )
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetAutoSync"));
+
+    return iRepository->Set( KCmAutoSync, (TInt)aAutoSync ) ;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets memory manager's status
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::GetMemoryManagerStatus(
+    TBool& aMmStatus ) const
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetMemoryManagerStatus"));
+
+    TInt mmInt;
+
+    TInt error = iRepository->Get( KCmMemoryManagerState, mmInt );
+
+    if ( !error )
+        {
+        aMmStatus = (TBool) mmInt;
+        }
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets memory manager's status
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::SetMemoryManagerStatus(
+    const TBool aMmStatus )
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetMemoryManagerStatus"));
+
+    return iRepository->Set( KCmMemoryManagerState, (TInt)aMmStatus ) ;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets item count for search action
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::GetSearchCount( TInt& aItemCount ) const
+    {
+    TInt error( KErrNone );
+    error = iRepository->Get( KCmSearchCount, aItemCount );
+    TRACE(Print(_L("[CmSettinsEngine]\t CCmSettingsEngine::\
+    GetSearchCount count = %d"), aItemCount));
+    
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets item count for database add operation
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::GetAddCount( TInt& aAddCount ) const
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetAddCount"));
+
+    return iRepository->Get( KCmAddCount, aAddCount );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Gets app wizard execution status info.
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::GetAppWizardInformation(
+    TInt& aAppWizardState ) const
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::\
+    GetAppWizardInformation"));
+
+    return iRepository->Get( KCmAppWizardState, aAppWizardState );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets app wizard execution status info.
+// ---------------------------------------------------------------------------
+//
+TInt CCmSettingsEngine::SetAppWizardInformation()
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::\
+    SetAppWizardInformation"));
+
+
+    // application wizard run -> set status 1
+    return iRepository->Set( KCmAppWizardState, 1 ) ;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Gets information about MCs drives
+// ---------------------------------------------------------------------------
+//
+void CCmSettingsEngine::DriveListL(
+    RFs& aFs,
+    RPointerArray<CCmDriveInfo>& aDrives ) const
+    {
+    LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::DriveListL"));
+
+
+    TDriveList list;
+    TDriveInfo info;
+
+    aFs.DriveList( list );
+    
+    TInt drive( KErrNotFound );                                                         
+    TInt error = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage,
+                                             drive );
+    TRACE( Print(_L("[CmSettinsEngine]\t GetDefaultDrive error = %d, drive = %d"),
+    error, drive ) );
+
+    
+    for( TInt driveNumber = 0 ; driveNumber <= EDriveZ ; driveNumber++ )
+        {
+        if( list[driveNumber] ) // is drive available
+            {
+            TUint drvStatus( 0 );
+            aFs.Drive( info, driveNumber );
+            
+            TRACE( Print(_L("[CmSettinsEngine]\t drivenumber = %d"),
+                      driveNumber ) );
+            User::LeaveIfError(DriveInfo::GetDriveStatus( aFs,
+                                                          driveNumber,
+                                                          drvStatus ) );                                                                      
+                                                          
+            TRACE( Print(_L("[CmSettinsEngine]\t removable drive = %d"),
+                      drvStatus & DriveInfo::EDriveRemovable ) );
+
+            TInt removableStatus = drvStatus & DriveInfo::EDriveRemovable;
+            // Check if drive is internal hard disc or memory card
+            if( 
+                ((!error && driveNumber == drive ) && !removableStatus ) ||
+                ( removableStatus && ( info.iType != EMediaNotPresent ) ) )
+                {
+
+                TRACE( Print(_L("[CmSettinsEngine]\t info.iType = %d"),
+                       info.iType ) );
+                TRACE( Print(_L("[CmSettinsEngine]\t info.iDriveAtt = %d"),
+                       info.iDriveAtt ) );                       
+
+                HBufC* memoryCardName = NULL;
+                CCmDriveInfo* driveInfo = CCmDriveInfo::NewLC();
+                TVolumeInfo volInfo;
+                aFs.Volume( volInfo, driveNumber );
+
+                TRACE( Print(_L("[CmSettinsEngine]\t volInfo.iName = %S"),
+                       &volInfo.iName ) );
+
+                if ( volInfo.iName.Compare( KNullDesC() ) )
+                    {
+                    memoryCardName = volInfo.iName.AllocLC();
+                    driveInfo->SetDriveNameL( *memoryCardName );
+                    }
+                else
+                    {
+                    driveInfo->SetDriveNameL( KNullDesC() );
+                    }
+                // collect drive information
+                driveInfo->SetDriveNumber( driveNumber );
+                driveInfo->SetDriveType( removableStatus );
+                driveInfo->SetDriveSize( volInfo.iSize );
+                driveInfo->SetDriveId( volInfo.iUniqueID );
+
+                aDrives.Append( driveInfo );
+
+                if ( memoryCardName )
+                    {
+                    CleanupStack::PopAndDestroy( memoryCardName );
+                    }
+                CleanupStack::Pop( driveInfo );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Deletes the object
+// ---------------------------------------------------------------------------
+//
+void CCmSettingsEngine::Close()
+    {
+    delete this;
+	}
+	
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsettings/src/cmsettingsfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      The factory for CMSettings
+*
+*/
+
+
+
+
+
+
+#include "cmsettingsfactory.h"
+#include "cmsettingsengine.h"
+#include "cmsettings.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+EXPORT_C MCmSettings* CCmSettingsFactory::NewCmSettingsEngineL()
+    {
+    return CCmSettingsEngine::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//    
+EXPORT_C MCmSettings* CCmSettingsFactory::NewCmSettingsEngineLC()
+    {
+    return CCmSettingsEngine::NewLC();
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/bwins/cmsqlwrapperu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewCmSqlMainL@CCmSqlMainFactory@@SAPAVMCmSqlMain@@AAVRFs@@@Z @ 1 NONAME ; class MCmSqlMain * CCmSqlMainFactory::NewCmSqlMainL(class RFs &)
+	?NewCmSqlMainLC@CCmSqlMainFactory@@SAPAVMCmSqlMain@@AAVRFs@@@Z @ 2 NONAME ; class MCmSqlMain * CCmSqlMainFactory::NewCmSqlMainLC(class RFs &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/eabi/cmsqlwrapperu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,12 @@
+EXPORTS
+	_ZN17CCmSqlMainFactory13NewCmSqlMainLER3RFs @ 1 NONAME
+	_ZN17CCmSqlMainFactory14NewCmSqlMainLCER3RFs @ 2 NONAME
+	_ZTI10CCmSqlMain @ 3 NONAME ; #<TI>#
+	_ZTI14CCmSqlDbClause @ 4 NONAME ; #<TI>#
+	_ZTI16CCmSqlConnection @ 5 NONAME ; #<TI>#
+	_ZTI19CCmSqlDbMaintenance @ 6 NONAME ; #<TI>#
+	_ZTV10CCmSqlMain @ 7 NONAME ; #<VT>#
+	_ZTV14CCmSqlDbClause @ 8 NONAME ; #<VT>#
+	_ZTV16CCmSqlConnection @ 9 NONAME ; #<VT>#
+	_ZTV19CCmSqlDbMaintenance @ 10 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for SQL wrapper
+*
+*/
+
+
+// Supported platforms
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_EXPORTS
+../inc/cmsqlmainfactory.h   |../../../../inc/cmsqlmainfactory.h
+../inc/mcmsqlmain.h         |../../../../inc/mcmsqlmain.h
+
+// MMP files
+PRJ_MMPFILES
+cmsqlwrapper.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/group/cmsqlwrapper.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project SQL wrapper
+*
+*/
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+TARGET          cmsqlwrapper.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x1028290D
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH      /sys/bin
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          cmsqlmain.cpp
+SOURCE          cmsqlmainfactory.cpp
+SOURCE          cmsqldbmaintenance.cpp
+SOURCE          cmsqlconnection.cpp
+SOURCE          cmsqldbclause.cpp
+
+LIBRARY         bafl.lib
+LIBRARY         sqldb.lib
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+LIBRARY         cmcommon.lib
+LIBRARY         charconv.lib
+DEBUGLIBRARY    flogger.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/inc/cmsqlclausedef.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,297 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQL clause definitions
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLCLAUSEDEF_H__
+#define __CMSQLCLAUSEDEF_H__
+
+// ---------------------------------------------------------------------------
+// Misc definitions
+// ---------------------------------------------------------------------------
+//
+
+_LIT8( KCmSqlEmpty, "" );
+_LIT8( KCmSqlSpace, " " );
+_LIT8( KCmSqlLeftBracket, " ( " );
+_LIT8( KCmSqlRightBracket, " ) " );
+_LIT8( KCmSqlComma, ", " );
+_LIT8( KCmSqlDot, "." );
+_LIT8( KCmSqlEqual, " = " );
+_LIT8( KCmSqlGreater, " >= " );
+_LIT8( KCmSqlSmaller, " <= " );
+_LIT8( KCmSqlLike, " LIKE " );
+_LIT8( KCmSqlSemicolon, ";" );
+_LIT8( KCmSqlVariable, "? " );
+_LIT8( KCmSqlAppendString, "%S " );
+_LIT8( KCmSqlConsistOf, " %%S% " );
+_LIT8( KCmSqlBeginsWith, " %S% " );
+_LIT8( KCmSqlEndsWith, " %%S " );
+_LIT8( KCmSqlAppendInteger, "%d " );
+_LIT8( KCmSqlAppendLong, "%ld " );
+
+_LIT8( KCmSqlDummyTrueCriteria, "1 " );
+_LIT8( KCmSqlDummyFalseCriteria, "0 " );
+
+_LIT8( KCmSqlSelect, "SELECT " );
+_LIT8( KCmSqlFrom, "FROM " );
+_LIT8( KCmSqlAs, "AS " );
+_LIT8( KCmSqlIn, "IN " );
+_LIT8( KCmSqlOr, "OR" );
+_LIT8( KCmSqlAnd, "AND " );
+_LIT8( KCmSqlAll, "* " );
+_LIT8( KCmSqlOrderByDate, "ORDER BY Date " );
+_LIT8( KCmSqlOrderByRandom, "ORDER BY Random() " );
+_LIT8( KCmSqlLimit, "LIMIT " );
+_LIT8( KCmSqlOffset, "OFFSET " );
+_LIT8( KCmSqlAsc, "ASC ");
+_LIT8( KCmSqlDesc, "DESC " );
+_LIT8( KCmSqlSortValue, "sortvalue" ); // Used when sorting object
+                                   // query by property value
+
+_LIT8( KCmSqlCollateNoCase, " COLLATE NOCASE " ); // case insensitive sort
+
+_LIT8( KCmSqlBaseSelect, 
+       "SELECT Title, Date, Size, Uri, DeviceId, ItemId, Id "
+       "FROM Items WHERE (" 
+     );
+                                            
+_LIT8( KCmSqlMusicSelect, "SELECT Title, a.Value, Size, Uri, DeviceId, "
+                          "ItemId, Id FROM Items LEFT JOIN Artists a "
+                          "ON Items.ArtistId = a.ArtistId LEFT JOIN Albums b "
+                          "ON Items.AlbumId = b.AlbumId "
+                          "WHERE ("
+                          );
+
+_LIT8( KCmSqlSelectArtistById, "Items.ArtistId = " );
+_LIT8( KCmSqlSelectAlbumById, "Items.AlbumId = " );
+_LIT8( KCmSqlSelectGenreById, "Items.GenreId = " );
+_LIT8( KCmSqlSelectResolutionById, "Items.ResolutionId = " );
+_LIT8( KCmSqlSelectUpnpclassById, "Items.UpnpclassId = " );
+_LIT8( KCmSqlFilterUpnpProfileId, "Items.ProfileId != " );
+
+_LIT8( KCmSqlSelectTitle, "Items.Id = " );
+_LIT8( KCmSqlSelectDuration, "Items.Duration " );
+_LIT8( KCmSqlSelectBitrate, "Items.Bitrate " );
+_LIT8( KCmSqlSelectSize, "Items.Size " );
+_LIT8( KCmSqlSelectDeviceId, "Items.DeviceId = ");
+_LIT8( KCmSqlSelectDate, "Items.Date ");
+_LIT8( KCmSqlArtist, "Artists " );
+_LIT8( KCmSqlAlbum, "Albums " );
+_LIT8( KCmSqlGenre, "Genres " );
+_LIT8( KCmSqlUpnpclass, "Upnpclasses " );
+_LIT8( KCmSqlResolutions, "Resolutions " );
+_LIT8( KCmSqlUpnpProfiles, "UpnpProfiles " );
+
+_LIT8( KCmSqlArtistId, "ArtistId" );
+_LIT8( KCmSqlAlbumId, "AlbumId" );
+_LIT8( KCmSqlGenreId, "GenreId" );
+_LIT8( KCmSqlProfileId, "ProfileId" );
+_LIT8( KCmSqlUpnpclassId, "UpnpclassId" );
+_LIT8( KCmSqlResolutionId, "ResolutionId" );
+
+_LIT8( KCmSqlSelectMediatype, " ( Mediatype = %d ) " );
+_LIT8( KCmSqlFreeTextSelectAudio, 
+    "( Items.Title LIKE \'%%%S%%\' ) OR ( a.Value LIKE \'%%%S%%\' ) OR "
+    "( b.Value LIKE \'%%%S%%\' ) " );
+    
+_LIT8( KCmSqlFreeTextSelectImageOrVideo, "( Items.Title LIKE \'%%%S%%\' ) " );
+
+_LIT8(KCmSqlBeginTransaction, "BEGIN;");
+_LIT8(KCmSqlCommit, "COMMIT;");
+
+_LIT8( KCmSqlSelectMaxIndex, "SELECT count(*) FROM %S" );
+
+_LIT8( KCmSqlSelectMaxPropertyIndex, "SELECT MAX( %S ) FROM %S" );
+
+_LIT8( KCmSqlSelectMaxItemIndex, "SELECT MAX( Id ) FROM Items;" );
+
+_LIT8( KCmSqlSelectItemId, "SELECT Id FROM Items WHERE "
+    "( LOWER(Title) = ? AND Size = ? AND DeviceId = ? )" 
+    );  
+
+_LIT8( KCmSqlFilteredPropertySelect, "SELECT Items.Id, Items.Title, "
+    "Items.ArtistId, b.Value, Items.AlbumId, a.Value, Items.GenreId, "
+    "c.Value FROM Items LEFT JOIN Artists b "
+    "ON Items.ArtistId = b.ArtistId LEFT JOIN Albums a "
+    "ON Items.AlbumId = a.AlbumId LEFT JOIN Genres c "
+    "ON Items.GenreId = c.GenreId "
+    "WHERE Items.Mediatype = 2 "
+    );
+
+_LIT8( KCmSqlFilteredPropertySelectVideo, "SELECT Id, Title "
+    "FROM Items WHERE Mediatype = 0 "
+    );
+
+_LIT8( KCmSqlWhere,
+    "WHERE "
+    );
+        
+// ---------------------------------------------------------------------------
+// INSERT STATEMENTS
+// ---------------------------------------------------------------------------
+//
+// Inserting item
+_LIT8( KCmSqlInsertItem,
+    "INSERT INTO Items( " 
+    "ItemId, Hash, Uri, Title, AlbumArtUri, DeviceId, Duration, Bitrate, "
+    "Date, HarvestDate, Size, Mediatype, UpnpclassId, ArtistId, AlbumId, "
+    "GenreId, ResolutionId, ProfileId, SearchId )"
+    "VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );"
+    );
+
+// Inserting resource
+_LIT8( KCmSqlInsertResource,
+    "INSERT INTO Resources( " 
+    "ResItemId, ResResolution, ResUri, Size, ResDuration, ResBitrate )"
+    "VALUES( ?, ?, ?, ?, ?, ? );"
+    );
+   
+// Inserting artist into artist table
+_LIT8( KCmSqlInsertArtist,
+    "INSERT INTO Artists( " 
+    "Value ) "
+    "VALUES( ? );"
+    );
+
+// Inserting album into album table
+_LIT8( KCmSqlInsertAlbum,
+    "INSERT INTO Albums( " 
+    "Value ) "
+    "VALUES( ? );"
+    );
+
+// Inserting genre into genre table    
+_LIT8( KCmSqlInsertGenre,
+    "INSERT INTO Genres( " 
+    "Value ) "
+    "VALUES( ? );"
+    );
+
+// Inserting upnp class into upnp class table
+_LIT8( KCmSqlInsertUpnpclass,
+    "INSERT INTO Upnpclasses( " 
+    "Value ) "
+    "VALUES( ? );"
+    );
+    
+// Inserting upnp class into upnp class table
+_LIT8( KCmSqlInsertUpnpProfile,
+    "INSERT INTO UpnpProfiles( " 
+    "Value ) "
+    "VALUES( ? );"
+    );
+        
+// Inserting resolution into resolution table
+_LIT8( KCmSqlInsertResolution,
+    "INSERT INTO Resolutions( " 
+    "Value, Width, Height, PixelCount ) "
+    "VALUES( ?, ?, ?, ? );"
+    );        
+            
+// ---------------------------------------------------------------------------
+// SELECT STATEMENTS
+// ---------------------------------------------------------------------------
+//
+// Selecting items harvested from the defined server
+_LIT8( KCmSqlSelectGenericItem, 
+    "SELECT Id, ItemId, Hash, SearchId "
+    "FROM Items "
+    "WHERE DeviceId = ? "
+    "ORDER BY Hash;"
+    );
+
+_LIT8( KCmSqlSelectPropertyValues,
+    "SELECT * FROM %S "
+    "ORDER BY Value;"    
+    );
+
+_LIT8( KCmSqlValidateTableExistence,
+    "SELECT count(*)"
+        " FROM Items;"
+        );
+
+_LIT8( KCmSqlSelectTitleAndId,  
+    "SELECT Id, Title "
+    "FROM Items "
+    "WHERE MediaType = %d "
+    "ORDER BY Title;"
+    );
+
+_LIT8( KCmSqlSelectMediaCount,
+    "SELECT count(*) FROM Items WHERE Mediatype = ?;"
+    );            
+
+_LIT8( KCmSqlSelectLimitHarvestDate,
+    "SELECT HarvestDate FROM Items WHERE ( Mediatype = ? ) ORDER BY "
+    "HarvestDate ASC LIMIT ?;"
+    );
+    
+// ---------------------------------------------------------------------------
+// DELETE STATEMENTS
+// ---------------------------------------------------------------------------
+//
+_LIT8( KCmSqlDeleteItem, 
+    "DELETE FROM Items "
+    "WHERE Id = ? ;"
+    );
+    
+_LIT8( KCmSqlDeleteResource, 
+    "DELETE FROM Resources "
+    "WHERE ResItemId = ? ;"
+    );
+    
+_LIT8( KCmSqlDeleteMetadata, 
+    "DELETE FROM Items WHERE DeviceId = ?;" 
+    );        
+
+_LIT8( KCmSqlDeleteOldestMediaItems, 
+    "DELETE FROM Items WHERE HarvestDate <= ? AND MediaType = ?;"
+    );
+    
+_LIT8( KCmSqlDeleteUnusedAlbums, 
+    "DELETE FROM Albums WHERE AlbumId "
+    "NOT IN ( SELECT AlbumId FROM Items );"
+    );
+    
+_LIT8( KCmSqlDeleteUnusedArtists, 
+    "DELETE FROM Artists WHERE ArtistId "
+    "NOT IN ( SELECT ArtistId FROM Items );"
+    );
+    
+_LIT8( KCmSqlDeleteUnusedGenres,
+    "DELETE FROM Genres WHERE GenreId "
+    "NOT IN ( SELECT GenreId FROM Items );"
+    );
+    
+_LIT8( KCmSqlDeleteUnusedUpnpclasses,
+    "DELETE FROM Upnpclasses WHERE UpnpclassId "
+    "NOT IN ( SELECT UpnpclassId FROM Items );"
+    );
+    
+_LIT8( KCmSqlDeleteUnusedUpnpProfileIds,
+    "DELETE FROM UpnpProfiles WHERE ProfileId "
+    "NOT IN ( SELECT ProfileId FROM Items );"
+    );
+                                              
+#endif // __CMSQLCLAUSEDEF_H__
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/inc/cmsqlconnection.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,575 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQLite Connection class
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_CMSQLCONNECTION_H
+#define C_CMSQLCONNECTION_H
+
+#include <e32base.h>
+#include <sqldb.h>
+#include "cmcommontypes.h"
+
+/* Forward declarations. */
+class CCmSqlBaseItem;
+class CCmSqlGenericItem;
+class CCmSqlPropertyItem;
+class CCmBaseListItem;
+class CCmFillListItem;
+class CCmFillRule;
+class CCmSqlPropertyCollector;
+class CCmSqlPropertyContainer;
+
+// Constants
+const TUint KCmSqlBatchSize = 100;
+
+// CLASS DECLARATION
+ /**
+  *  Class represents methods to communication with SQLite database API.
+  *
+  *  @lib cmsqlwrapper.lib
+  *
+  *  @since S60 5.1
+  */
+class CCmSqlConnection : public CBase
+    {
+
+private:
+
+    // Operation modes
+    enum TCmSqlOperationMode
+        {
+        ECmSqlFillItemGet = 1,
+        ECmSqlBaseItemGet,
+        ECmSqlPropertyValueGet,
+        ECmSqlGenericItemAdd,
+        ECmSqlPropertyItemAdd,
+        ECmSqlIdle,
+        ECmSqlDeletingMetadata,
+        ECmSqlFilteredPropertyGet        
+        };
+public:
+        
+    /**
+     * Two-phased constructor.
+     */
+    static CCmSqlConnection* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCmSqlConnection* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSqlConnection();
+
+    /**
+     * Open database (creates if doesn't exist)
+     *
+     * @since S60 5.1
+     * @param aDb, Database filename and path
+     * @return error code
+     */        
+    TInt OpenDb( const TDesC& aDb );
+
+    /**
+     * Close opened database
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void CloseDb();
+
+    /**
+     * Creates db file
+     * @since S60 5.1
+     * @param aDb, Database filename and path
+     * @return error code
+     */  
+    TInt CreateDbFile( const TDesC& aDb ); 
+     
+    /**
+     * Validates database existence and format
+     *
+     * @since S60 5.1
+     * @param None
+     * @return ETrue if db valid
+     */    
+    TBool Validate();
+
+    /**
+     * Executes sql command
+     *
+     * @since S60 5.1
+     * @param aCommand, command to be executed
+     * @return None
+     */    
+    void ExecuteL( const TDesC8& aCommand );
+    
+    /**
+     * Cance asyncronous operation
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void CancelAsyncOperation();
+    
+    /**
+     * Setting media server id
+     *
+     * @since S60 5.1
+     * @param aId, media server id to be used
+     * @return None
+     */ 
+    void SetMsId( TUint aId );
+
+    /**
+     * Setting mmc quota
+     *
+     * @since S60 5.1
+     * @param aQuota, quota to be used
+     * @return None
+     */     
+    void SetQuota( TInt64 aQuota );        
+
+    /**
+     * Asyncronous batch add
+     *
+     * @since S60 5.1
+     * @param aItems, items to be inserted into database
+     * @param aStatus, request status to be completed after insert is ready
+     * @return None
+     */
+    void AsyncBatchAdd( RPointerArray<CCmSqlGenericItem>& aItems, 
+        TRequestStatus& aStatus );
+
+    /**
+     * Asyncronous property item batch add
+     *
+     * @since S60 5.1
+     * @param aItems, items to be inserted into database
+     * @param aField, property type identifier
+     * @param aStatus, request status to be completed after insert is ready
+     * @return None
+     */
+    void AsyncBatchAddPropertyItems( 
+        RPointerArray<CCmSqlPropertyItem>& aItems, TCmMetadataField aField,
+        TRequestStatus& aStatus );
+
+    /**
+     * Syncronous property item add
+     *
+     * @since S60 5.1
+     * @param aItem, item to be inserted into database
+     * @param aField, property type identifier
+     * @return None
+     */    
+    void SyncAddPropertyItemL( 
+        CCmSqlPropertyItem& aItem, TCmMetadataField aField );
+
+    /**
+     * Asyncronous item batch delete
+     *
+     * @since S60 5.1
+     * @param aItems, items to be deleted
+     * @param aStatus, request status to be completed
+     * @return None
+     */        
+    void AsyncBatchDelete( RPointerArray<CCmSqlBaseItem>& aItems, 
+        TRequestStatus& aStatus );
+
+    /**
+     * Asyncronous metadata delete
+     *
+     * @since S60 5.1
+     * @param aMsIds, defines where metadata is harvested
+     * @param aStatus, request status to be completed
+     * @return None
+     */ 
+    void AsyncMetadataDelete( RArray<TInt>& aMsIds, 
+        TRequestStatus& aStatus );
+    
+    /**
+     * SELECT XXX oldest and delete those
+     * Delete defined amount of media items
+     *
+     * @since S60 5.1
+     * @param aType, media type identifier
+     * @param aCount, amount to be deleted
+     * @return None
+     */    
+    void DeleteOldestMediaItemsL( TCmMediaType aType, TInt64 aCount );
+
+    /**
+     * Deletes unused propertys
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    void DeleteUnusedPropertys( );
+                
+     /**
+     * Asyncronous metadata column qyery
+     *
+     * @since S60 5.1
+     * @param aItems, listed base items ( included only ItemId, dbId and 
+     *                 Hash code )
+     * @param aStatus, request status to be completed when result set ready
+     * @return None
+     */   
+    void GetItemsL( RPointerArray<CCmSqlBaseItem>& aItems,
+        TRequestStatus& aStatus );
+        
+     /**
+     * Asyncronous metadata qyery for fill list
+     *
+     * @since S60 5.1
+     * @param aItems, listed fill list items
+     * @param aClause, sql clause to be executed
+     * @param aRule, used fill list
+     * @param aStatus, request status to be completed when result set ready
+     * @return None
+     */   
+    void GetFillItemsL( RPointerArray<CCmFillListItem>& aItems,
+        TDesC8& aClause, CCmFillRule& aRule, TRequestStatus& aStatus );
+                
+     /**
+     * Asyncronous metadata column qyery
+     *
+     * @since S60 5.1
+     * @param aItems, listed property values
+     * @param aClause, sql clause to be executed
+     * @param aStatus, request status to be completed when result set ready
+     * @return None
+     */   
+    void GetPropertyValuesL( RPointerArray<CCmSqlPropertyItem>& aItems,
+        TDesC8& aClause, TRequestStatus& aStatus );
+
+    /**
+     * Asyncronous metadata filtered property values query
+     *
+     * @since S60 5.1
+     * @param aPropertys, result array reference
+     * @param aClause, sql clause to be executed     
+     * @param aStatus, request status to be completed     
+     * @return None
+     */         
+    void GetFilteredPropertyValuesL( 
+        CCmSqlPropertyCollector& aPropertys, const TDesC8& aClause, 
+        TRequestStatus& aStatus );
+        
+     /**
+     * Returns amount of media items
+     *
+     * @since S60 5.1
+     * @param aCount, media amount on return
+     * @param aType, media type
+     * @return None
+     */    
+    void GetMediaCountL( TInt64& aCount, TCmMediaType aType );
+    
+     /**
+     * Returns ETrue if item exist in db
+     *
+     * @since S60 5.1
+     * @param aItem, item
+     * @param aDevId, device id
+     * @return ETrue if exists
+     */ 
+    TBool ExistsL( const CCmBaseListItem& aItem, const TInt aDevId );    
+                 
+private:
+
+    /**
+     * Static callback method for db handling
+     *
+     * @since S60 5.1
+     * @param aDbHandler, database handler
+     * @return None
+     */
+    static TInt BatchAdd( TAny* aDbHandler );
+
+    /**
+     * Adds items into db in background
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    TInt DoBatchAdd();
+
+    /**
+     * Static callback method for db handling
+     *
+     * @since S60 5.1
+     * @param aDbHandler, database handler
+     * @return None     
+     */    
+    static TInt BatchDelete( TAny* aDbHandler );
+    
+    /**
+     * Deletes items from db 
+     *
+     * @since S60 5.1
+     * @param None     
+     * @return None     
+     */    
+    TInt DoBatchDelete();
+    
+    /**
+     * Static callback method for db handling
+     *
+     * @since S60 5.1
+     * @param aDbHandler, database handler
+     * @return None     
+     */
+    static TInt BatchGetL( TAny* aDbHandler );
+    
+    /**
+     * Gets items from db
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */    
+    TInt DoBatchGetL();
+    
+    /**
+     * Collect item data
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */
+    void CollectItemDataL();
+
+    /**
+     * Adds generic item into db
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */    
+    void AddItemL();
+    
+    /**
+     * Adds property item into db
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */    
+    void AddPropertyItemL();
+
+    /**
+     * Adds resource item into db
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */     
+    void AddResourceL();
+
+    /**
+     * Deletes items from the item table
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */    
+    void DeleteItemL();
+
+    /**
+     * Deletes resource from the resources table
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */     
+    void DeleteResourceL();
+
+    /**
+     * Deletes metadata from defined server
+     *
+     * @since S60 5.1
+     * @param aMsId, mediaserver id
+     * @return None     
+     */      
+    void DeleteMetadataFromDefServerL( const TInt aMsId );
+
+    /**
+     * Formats row count query clause, used in property
+     * indexing
+     *
+     * @since S60 5.1
+     * @param aField, metadata field
+     * @return None     
+     */
+    void FormatRowCountQueryL( TCmMetadataField aField );
+    
+    /**
+     * Returns row count, used in property indexing
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */    
+    TInt64 RowCountL();
+
+    /**
+     * Helper function for format maximun index query 
+     *
+     * @since S60 5.1
+     * @param aId, item id
+     * @param aTable, table name
+     * @return None     
+     */ 
+    void FormatCountQueryL(  const TDesC8& aId, const TDesC8& aTable );
+    
+    /**
+     * Helper function for getting filtered propertys
+     *
+     * @since S60 5.1
+     * @param aContainer, propertycontainer
+     * @param aIndex1, column index
+     * @param aIndex2, column index
+     * @return None     
+     */     
+    void GetFilteredPropertysL( CCmSqlPropertyContainer& aContainer, 
+        const TInt aIndex1, const TInt aIndex2 );
+    
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmSqlConnection();
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+        
+private:
+
+    /**
+     * iDatabase, interface to Sqlite database
+     */    
+    RSqlDatabase iDatabase;
+    
+    /**
+     * iStatement, interface to Sqlite database
+     */
+    RSqlStatement iStatement;
+    
+    /**
+     * Pending request status
+     */
+    TRequestStatus* iStatus;
+
+    /**
+     * Media server id
+     */
+    TUint iMsId;
+    
+    /**
+     * User mmc quota
+     */
+    TInt64 iQuota;
+    
+    /**
+     * Generic item array pointer
+     */
+    RPointerArray<CCmSqlGenericItem>* iGenericItems;            // not owned
+    
+    /**
+     * Base item array pointer
+     */
+    RPointerArray<CCmSqlBaseItem>* iBaseItems;                  // not owned
+    
+    /**
+     * Fill list item array pointer
+     */
+    RPointerArray<CCmFillListItem>* iFillItems;                 // not owned
+    
+    /**
+     * Property item array pointer
+     */
+    RPointerArray<CCmSqlPropertyItem>* iPropertyItems;          // not owned
+    
+    /**
+     * Filtered property item array pointer
+     */
+    CCmSqlPropertyCollector* iPropertyCollector;                // not owned
+    
+    /**
+     * Mediaserver ids
+     */
+    RArray<TInt>* iMsIds;                                       // not owned
+       
+    /**
+     * Asyncronous database handler
+     */
+    CIdle* iAsyncDbHandler;                                     // owned
+    
+    /**
+     * Operation mode
+     */
+    TCmSqlOperationMode iMode;
+    
+    /**
+     * Index to item array
+     */
+    TInt iIndex;
+    
+    /**
+     * Property table identifier
+     */
+    TCmMetadataField iField;
+    
+    /**
+     * Fill list
+     */
+    CCmFillRule* iList;                                         // not owned
+    
+    /**
+     * Fill list size
+     */
+    TInt64 iListSize;
+    
+    /**
+     * Maximun size of the fill list in Bytes
+     */
+    TInt64 iListMaxSize;
+    
+    /**
+     * Used to get max count of items
+     */
+    HBufC8* iCountQuery;                                        // Owned
+    
+    };
+
+#endif //  C_CMSQLCONNECTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/inc/cmsqldbclause.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,245 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQL clause handling class
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_CMSQLDBCLAUSE_H
+#define C_CMSQLDBCLAUSE_H
+
+#include <e32base.h>
+
+/**
+ *  CCmSqlDbClause class
+ *  Part of SQL wrapper. SQL wrapper is part of
+ *  Content manager component.CCmSqlDbClause formats needed sql clauses
+ *
+ *  @lib cmsqlwrapper.lib
+ *
+ *  @since S60 v3.1
+ */
+class CCmSqlDbClause : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCmSqlDbClause* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCmSqlDbClause* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSqlDbClause();
+    
+public: 
+
+    /**
+     * Starts to generate sql query clause according to 
+     * fill rule and fill method
+     *
+     * @since S60 5.1     
+     * @param aRule, fill rule
+     * @param aField, metadata field      
+     * @param aMedia, media type
+     * @return None
+     */
+    void FormatClauseL( CCmFillRule& aRule, 
+        TCmMetadataField aField = ECmNone, TCmMediaType aMedia = ECmAll );
+
+    /**
+     * Starts to generate sql query clause according to 
+     * property collector
+     *
+     * @since S60 5.1     
+     * @param aPropertys, propertys to be filtered
+     * @return None
+     */
+    void FormatFilteringClauseL( CCmSqlPropertyCollector& aPropertys );
+    
+    /**
+     * Returns sql clause
+     *
+     * @since S60 5.1     
+     * @param None
+     * @return iClause, reference
+     */    
+    TDesC8& ClauseL() const;
+    
+     /**
+     * Sets profile filters
+     *
+     * @since S60 5.1
+     * @param aProfileIds, profile ids
+     * @return None
+     */
+    void SetDlnaProfileFilters( const RArray<TInt64>& aProfileIds );
+    
+private:
+
+    /**
+     * Formats fill rules media type into sql clause
+     * @param aRule, fill rule
+     *
+     * @since S60 5.1
+     * @return None
+     */
+    void FormatMediatypeL( CCmFillRule& aRule );
+    
+    /**
+     * Formats fill rule params into sql clause
+     *
+     * @since S60 5.1
+     * @param aRule, fill rule
+     * @return None
+     */
+    void FormatParamsL( CCmFillRule& aRule );
+
+    /**
+     * Formats fill rule media servers into sql clause
+     *
+     * @since S60 5.1
+     * @param aRule, fill rule
+     * @return None
+     */
+    void FormatDevicesL( CCmFillRule& aRule );
+
+    /**
+     * Formats fill rule query result ordering into sql clause
+     *
+     * @since S60 5.1
+     * @param aMethod, ordering method
+     * @return None
+     */
+    void FormatOrderingL( TCmFillMethod aMethod );
+
+    /**
+     * Formats fill rule query amount into sql clause
+     *
+     * @since S60 5.1
+     * @param aRule, fill rule
+     * @return None
+     */
+    void FormatAmountL( CCmFillRule& aRule );
+
+    /**
+     * Formats fill rule metadata field into sql clause
+     *
+     * @since S60 5.1
+     * @param aField, metadata field to be set in query
+     * @param aMediaType, media type of the fill list 
+     * @return None
+     */ 
+    void FormatMetadataColumnL( TCmMetadataField aField, 
+        TCmMediaType aMediaType );
+
+    /**
+     * Formats fill rule operator into sql clause
+     *
+     * @since S60 5.1
+     * @param aMetadataColum, metadata field to be set in query
+     * @param aOper, operator of query results
+     * @return None
+     */    
+    void FormatOperatorL( TCmMetadataField aMetadataColum, 
+        TCmOperatorType aOper );
+
+    /**
+     * Formats property values query
+     *
+     * @since S60 5.1
+     * @param aField, identified property
+     * @param aMedia, identified media type
+     * @return None
+     */     
+    void FormatProperyQueryL( TCmMetadataField aField, 
+        TCmMediaType aMedia = ECmAll );
+        
+    /**
+     * Formats profile filters into sql clause
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */ 
+    void FormatProfileFiltersL();    
+
+    /**
+     * Formats property filters into sql clause
+     *
+     * @since S60 5.1
+     * @param aPropertys, property collector
+     * @return None
+     */     
+    void FormatPropertyFilterL( 
+        CCmSqlPropertyCollector& aPropertys );
+
+    /**
+     * Adds property filters into sql clause
+     *
+     * @since S60 5.1
+     * @param aContainer, property container
+     * @param aField, property field
+     * @param aClause, clause to be modified
+     * @return None
+     */         
+    void AddPropertyFilterL( 
+        CCmSqlPropertyContainer& aContainer, const TDesC8& aField,
+        HBufC8*& aClause  );
+        
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmSqlDbClause();
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private:
+    
+    /**
+     * Formated clause
+     */
+    HBufC8* iClause;                                // Owned
+    
+    /** 
+     * Temporal free text clause
+     */
+    HBufC8* iFreeText;                              // Owned
+    
+    /**
+     * Profile ids which need to be filtered out
+     */
+    RArray<TInt64> iProfileFilters;
+    
+    };
+
+#endif //  C_CMSQLDBCLAUSE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/inc/cmsqldbmaintenance.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQL database maintenance class
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_CMSQLDBMAINTENANCE_H
+#define C_CMSQLDBMAINTENANCE_H
+
+#include <e32base.h>
+
+// Forward declarations
+class CCmSqlConnection;
+
+/**
+ *  CCmSqlDbMaintenance class
+ *  Part of SQL wrapper. SQL wrapper is part of
+ *  Content manager component.CCmSqlDbMaintenance creates needed
+ *  database tables and initializes connenction to the database
+ *
+ *  @lib cmsqlwrapper.lib
+ *
+ *  @since S60 v3.1
+ */
+class CCmSqlDbMaintenance : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCmSqlDbMaintenance* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCmSqlDbMaintenance* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSqlDbMaintenance();    
+    
+    /**
+     * Initializes database connection
+     *
+     * @since S60 5.1
+     * @param aConnection, reference to connection class
+     * @return Error code
+     */    
+    TInt InitConnection( CCmSqlConnection& aConnection );
+
+    /**
+     * Closes database connection
+     *
+     * @since S60 5.1
+     * @param aConnection, reference to connection class
+     * @return None
+     */        
+    void CloseConnection( CCmSqlConnection& aConnection );
+
+    /**
+     * Creates db file
+     *
+     * @since S60 5.1
+     * @param aConnection, reference to connection class
+     * @return Error code
+     */  
+    TInt CreateDbFile( CCmSqlConnection& aConnection );    
+    
+    /**
+     * Creates database tables
+     *
+     * @since S60 5.1
+     * @param aConnection, reference to connection class
+     * @return None
+     */        
+    void CreateDb( CCmSqlConnection& aConnection );
+
+    /**
+     * Creates database indexes
+     *
+     * @since S60 5.1
+     * @param aConnection, reference to connection class
+     * @return None
+     */        
+    void CreateIndexes( CCmSqlConnection& aConnection );
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmSqlDbMaintenance();
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private: // data
+
+    };
+
+#endif //  C_CMSQLDBMAINTENANCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/inc/cmsqlmain.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,302 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main class in the SQL wrapper component
+*
+*/
+
+
+
+
+
+
+#ifndef C_CMSQLMAIN_H
+#define C_CMSQLMAIN_H
+
+#include <e32base.h>
+#include "mcmsqlmain.h"
+
+// Forward declarations
+class RFs;
+
+/**
+ *  CCmSqlMain class ( Interface to sql wrapper )
+ *  Part of SQL wrapper. SQL wrapper is part of
+ *  Content manager component.
+ *
+ *  @lib cmsqlwrapper.lib
+ *
+ *  @since S60 5.1
+ */
+class CCmSqlMain : public CBase,
+                   public MCmSqlMain
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aFs, ref to file server session
+     * @return  pointer to CCmSqlMain class
+     */
+    static CCmSqlMain* NewL( RFs& aFs );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aFs, ref to file server session
+     * @return  pointer to CCmSqlMain class
+     */
+    static CCmSqlMain* NewLC( RFs& aFs );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmSqlMain();
+
+    /**
+     * Canceling operation
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    void CancelAsyncOperation();
+
+    /**
+     * Setting media server id
+     *
+     * @since S60 5.1
+     * @param aId, id to be used
+     * @return None
+     */ 
+    void SetMsId( TUint aId );
+
+    /**
+     * Setting mmc quota
+     *
+     * @since S60 5.1
+     * @param aQuota, quota to be used in unlimited fill lists
+     * @return None
+     */     
+    void SetQuota( TInt64 aQuota );
+
+    /**
+     * Setting dlna profile filters
+     *
+     * @since S60 5.1
+     * @param aProfileIds, unsupported profile ids
+     * @return None
+     */    
+    void SetDlnaProfileFilters( const RArray<TInt64>& aProfileIds );
+     
+    /**
+     * Asyncronous batch add
+     *
+     * @since S60 5.1
+     * @param aItems, items to be added
+     * @param aStatus, request status to be completed
+     * @return None
+     */
+    void AsyncBatchAdd( RPointerArray<CCmSqlGenericItem>& aItems, 
+        TRequestStatus& aStatus );
+
+    /**
+     * Asyncronous batch property value add
+     *
+     * @since S60 5.1
+     * @param aItems, property items to be added
+     * @param aField, property identifier
+     * @param aStatus, request status to be completed
+     * @return None
+     */ 
+    void AsyncBatchAddPropertyItems( 
+         RPointerArray<CCmSqlPropertyItem>& aItems, TCmMetadataField aField, 
+         TRequestStatus& aStatus );
+
+    /**
+     * Syncronous property value add
+     *
+     * @since S60 5.1
+     * @param aItem, property item to be added
+     * @param aField, property identifier     
+     * @return None
+     */         
+    void SyncAddPropertyItemL( CCmSqlPropertyItem& aItem, 
+        TCmMetadataField aField );
+    
+    /**
+     * Asyncronous batch delete
+     *
+     * @since S60 5.1
+     * @param aItems, items to be deleted
+     * @param aStatus, request status to be completed
+     * @return None
+     */       
+    void AsyncBatchDelete( RPointerArray<CCmSqlBaseItem>& aItems, 
+        TRequestStatus& aStatus );
+
+    /**
+     * Asyncronous metadata delete
+     *
+     * @since S60 5.1
+     * @param aMsIds, defines where metadata is harvested
+     * @param aStatus, request status to be completed
+     * @return None
+     */ 
+    void AsyncMetadataDelete( RArray<TInt>& aMsIds, 
+        TRequestStatus& aStatus );
+
+    /**
+     * SELECT XXX oldest and delete those
+     * Delete defined amount of media items
+     *
+     * @since S60 5.1
+     * @param aType, media type identifier
+     * @param aCount, amount to be deleted
+     * @return None
+     */    
+    void DeleteOldestMediaItemsL( TCmMediaType aType, 
+        TInt64 aCount );
+
+    /**
+     * Deletes unused propertys
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    void DeleteUnusedPropertys( );
+        
+    /**
+     * Asyncronous metadata query
+     *
+     * @since S60 5.1
+     * @param aItems, result array reference
+     * @param aStatus, request status to be completed
+     * @return None
+     */        
+    void GetItemsL( RPointerArray<CCmSqlBaseItem>& aItems, 
+        TRequestStatus& aStatus );
+
+    /**
+     * Asyncronous fill list item query
+     *
+     * @since S60 5.1
+     * @param aItems, result array reference
+     * @param aRule, fill list used as a query clause parameter
+     * @param aStatus, request status to be completed
+     * @return None 
+     */
+    void GetFillItemsL( RPointerArray<CCmFillListItem>& aItems,
+        CCmFillRule& aRule, TRequestStatus& aStatus );
+        
+    /**
+     * Asyncronous metadata property values query
+     *
+     * @since S60 5.1
+     * @param aItems, result array reference
+     * @param aStatus, request status to be completed     
+     * @param aField, property identifier ( e.g. artist )
+     * @param aMedia, media type identifier ( e.g. audio )
+     * @return None
+     */   
+    void GetPropertyValuesL( 
+        RPointerArray<CCmSqlPropertyItem>& aItems, TRequestStatus& aStatus, 
+        TCmMetadataField aField, TCmMediaType aMedia = ECmAll );
+
+    /**
+     * Asyncronous metadata filtered property values query
+     *
+     * @since S60 5.1
+     * @param aPropertys, result array reference
+     * @param aStatus, request status to be completed     
+     * @return None
+     */         
+    void GetFilteredPropertyValuesL( 
+        CCmSqlPropertyCollector& aPropertys, TRequestStatus& aStatus );
+
+     /**
+     * Returns amount of media items
+     *
+     * @since S60 5.1
+     * @param aCount, media amount on return
+     * @param aType, media type
+     * @return None
+     */    
+    void GetMediaCountL( TInt64& aCount, TCmMediaType aType );
+    
+     /**
+     * Returns ETrue if item exist in db
+     *
+     * @since S60 5.1
+     * @param aItem, item
+     * @param aDevId, device id
+     * @return ETrue if exists
+     */ 
+    TBool ExistsL( const CCmBaseListItem& aItem, const TInt aDevId );
+    
+    /**
+     * Deletes the object
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None     
+     */
+	void Close();
+	
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     *
+     * @since S60 5.1
+     * @param aFs, file server
+     * @return None
+     */
+    CCmSqlMain( RFs& aFs );
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private:
+
+    /**
+     * Clause format class
+     */
+    CCmSqlDbClause* iClause;                        // Owned
+    
+    /**
+     * Database maintenance class
+     */
+    CCmSqlDbMaintenance* iMaintenance;              // Owned
+    
+    /**
+     * Database connection class
+     */
+    CCmSqlConnection* iConnection;                  // Owned
+    
+    /**
+     * Reference to file server session
+     */
+    RFs& iFs;
+
+    };
+
+#endif //  C_CMSQLMAIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/inc/cmsqlmainfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Abstract factory for CMSettings
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_CMSQLMAINFACTORY_H
+#define C_CMSQLMAINFACTORY_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+/* Forward declarations. */
+class MCmSqlMain;
+class RFs;
+
+/**
+ *  Abstract factory for CCmSqlMain
+ *
+ *  @lib cmsettings.lib
+ *
+ *  @since S60 5.1
+ */
+class CCmSqlMainFactory : public CBase
+    {
+
+public:
+
+    /**
+     * Creates a new instance of CCmSqlMain
+     *
+     * @since S60 5.1
+     * @param aFs, file server
+     * @return  pointer to CCmSqlMain class
+     */
+    IMPORT_C static MCmSqlMain* NewCmSqlMainL( RFs& aFs );
+
+    /**
+     * Creates a new instance of CCmSqlMain. Instance is left in
+     * cleanup stack.
+     *
+     * @since S60 5.1
+     * @param aFs, file server
+     * @return  pointer to CCmSqlMain class
+     */
+    IMPORT_C static MCmSqlMain* NewCmSqlMainLC( RFs& aFs );
+
+    };
+
+#endif // C_CMSQLMAINFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/inc/cmsqlmaintenanceclauses.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,233 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Includes SQL clauses for creating and dropping tables/indexes
+*
+*/
+
+
+
+
+
+
+#ifndef __CMSQLMAINTENANCECLAUSES_H__
+#define __CMSQLMAINTENANCECLAUSES_H__
+
+///////////////////////////////////////////////////////////////////
+// DROP CLAUSES
+///////////////////////////////////////////////////////////////////
+_LIT8( KCmSqlDropArtists, "DROP TABLE Artists;");
+_LIT8( KCmSqlDropGenres, "DROP TABLE Genres;" );
+_LIT8( KCmSqlDropAlbums, "DROP TABLE Albums;" );
+_LIT8( KCmSqlDropUpnpProfiles, "DROP TABLE UpnpProfiles;" );
+_LIT8( KCmSqlDropUpnpClasses, "DROP TABLE Upnpclasses;" );
+_LIT8( KCmSqlDropResolutions, "DROP TABLE Resolutions;" );
+_LIT8( KCmSqlDropResources, "DROP TABLE Resources;" );
+_LIT8( KCmSqlDropItems, "DROP TABLE Items;" );
+
+///////////////////////////////////////////////////////////////////
+// CREATE CLAUSES FOR TABLES
+///////////////////////////////////////////////////////////////////
+_LIT8( KCmSqlCreateArtists, 
+    "CREATE TABLE Artists("
+        "ArtistId           INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+        "Value              TEXT NOT NULL UNIQUE);"
+        );
+
+_LIT8( KCmSqlCreateGenres, 
+    "CREATE TABLE Genres("
+        "GenreId           INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+        "Value             TEXT NOT NULL UNIQUE);"
+        );
+        
+_LIT8( KCmSqlCreateAlbums, 
+    "CREATE TABLE Albums("
+        "AlbumId           INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+        "Value             TEXT NOT NULL UNIQUE);"
+        );
+
+_LIT8( KCmSqlCreateResolutions, 
+    "CREATE TABLE Resolutions("
+        "ResolutionId       INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+        "Value              TEXT NOT NULL UNIQUE,"
+        "Width              INTEGER,"
+        "Height             INTEGER,"
+        "PixelCount         INTEGER);"
+        );
+            
+_LIT8( KCmSqlCreateUpnpclasses, 
+    "CREATE TABLE Upnpclasses("
+        "UpnpclassId        INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+        "Value              TEXT NOT NULL UNIQUE);"
+        );            
+        
+_LIT8( KCmSqlCreateUpnpProfiles, 
+    "CREATE TABLE UpnpProfiles("
+        "ProfileId          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+        "Value              TEXT NOT NULL UNIQUE);"
+        );                         
+        
+_LIT8( KCmSqlCreateResources, 
+    "CREATE TABLE Resources("
+        "ResourceId       INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+        "ResItemId        INTEGER NOT NULL REFERENCES Items( Id ),"
+        "ResResolution    INTEGER REFERENCES Resolutions( ResolutionId ),"
+        "ResUri           TEXT NOT NULL,"
+        "Size             INTEGER,"
+        "ResDuration      INTEGER,"
+        "ResBitrate       INTEGER);"
+        );
+
+_LIT8( KCmSqlCreateItems, 
+    "CREATE TABLE Items("
+        "Id                 INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+        "ItemId             TEXT NOT NULL,"
+        "Hash               TEXT NOT NULL,"
+        "Uri                TEXT NOT NULL,"
+        "Title              TEXT NOT NULL,"
+        "AlbumArtUri        TEXT,"
+        "DeviceId           INTEGER NOT NULL,"
+        "Duration           INTEGER,"
+        "Bitrate            INTEGER,"
+        "Date               DATETIME,"
+        "HarvestDate        DATETIME,"
+        "Size               INTEGER,"
+        "Mediatype          INTEGER,"
+        "SearchId           INTEGER,"
+        "UpnpclassId        INTEGER REFERENCES Upnpclasses( UpnpclassId ),"
+        "ArtistId           INTEGER REFERENCES Artists( ArtistId ),"
+        "AlbumId            INTEGER REFERENCES Albums( AlbumId ),"
+        "GenreId            INTEGER REFERENCES Genres( GenreId ),"
+        "ProfileId          INTEGER REFERENCES UpnpProfiles( ProfileId ),"
+        "ResolutionId       INTEGER REFERENCES Resolutions( ResolutionId ) );"
+        );
+                
+///////////////////////////////////////////////////////////////////
+// INDEXES
+///////////////////////////////////////////////////////////////////
+_LIT8( KCmSqlCreateItemsIdIndex, 
+    "CREATE INDEX ItemsId_Index ON Items(Id);"
+    );
+
+_LIT8( KCmSqlCreateItemTitleIndex, 
+    "CREATE INDEX Item_Title_Index ON Items(Title);"
+    );
+    
+_LIT8( KCmSqlCreateItemDateIndex, 
+    "CREATE INDEX Item_Date_Index ON Items(Date);"
+    );        
+
+_LIT8( KCmSqlCreateItemHarvestDateIndex, 
+    "CREATE INDEX Item_HarvestDate_Index ON Items(HarvestDate);"
+    ); 
+    
+_LIT8( KCmSqlCreateItemArtistIndex, 
+    "CREATE INDEX Item_Artist_Index ON Items(ArtistId);"
+    );
+
+_LIT8( KCmSqlCreateItemAlbumIndex, 
+    "CREATE INDEX Item_Album_Index ON Items(AlbumId);"
+    );
+    
+_LIT8( KCmSqlCreateItemGenreIndex, 
+    "CREATE INDEX Item_Genre_Index ON Items(GenreId);"
+    );
+    
+_LIT8( KCmSqlCreateItemUpnpclassIndex, 
+    "CREATE INDEX Item_Upnpclass_Index ON Items(UpnpclassId);"
+    );
+
+_LIT8( KCmSqlCreateItemUpnpProfileIndex, 
+    "CREATE INDEX Item_UpnpProfile_Index ON Items(ProfileId);"
+    );                         
+
+_LIT8( KCmSqlCreateItemResolutionIndex, 
+    "CREATE INDEX Item_Resolution_Index ON Items(ResolutionId);"
+    );
+
+_LIT8( KCmSqlCreateItemMediatypeIndex, 
+    "CREATE INDEX Item_Mediatype_Index ON Items(Mediatype);" 
+    );
+
+_LIT8( KCmSqlCreateAlbumIdIndex,
+    "CREATE INDEX AlbumId_Index ON Albums(AlbumId);" 
+    );
+
+_LIT8( KCmSqlCreateArtistIdIndex,
+    "CREATE INDEX ArtistId_Index ON Artists(ArtistId);" 
+    ); 
+
+_LIT8( KCmSqlCreateGenreIdIndex,
+    "CREATE INDEX GenreId_Index ON Genres(GenreId);" 
+    );
+        
+// Dropping indexes
+_LIT8( KCmSqlDropItemsIdIndex, 
+    "DROP INDEX ItemsId_Index;"
+    );
+
+_LIT8( KCmSqlDropItemTitleIndex,
+    "DROP INDEX Item_Title_Index;"
+    );
+    
+_LIT8( KCmSqlDropItemDateIndex,
+    "DROP INDEX Item_Date_Index;"
+    ); 
+    
+_LIT8( KCmSqlDropItemHarvestDateIndex,
+    "DROP INDEX Item_HarvestDate_Index;"
+    );             
+
+_LIT8( KCmSqlDropItemArtistIndex, 
+    "DROP INDEX Item_Artist_Index;"
+    ); 
+
+_LIT8( KCmSqlDropItemAlbumIndex, 
+    "DROP INDEX Item_Album_Index;"
+    );                
+
+_LIT8( KCmSqlDropItemGenreIndex, 
+    "DROP INDEX Item_Genre_Index;"
+    ); 
+    
+_LIT8( KCmSqlDropItemUpnpclassIndex, 
+    "DROP INDEX Item_Upnpclass_Index;"
+    );
+    
+_LIT8( KCmSqlDropItemUpnpProfileIndex, 
+    "DROP INDEX Item_UpnpProfile_Index;"
+    );                 
+
+_LIT8( KCmSqlDropItemResolutionIndex, 
+    "DROP INDEX Item_Resolution_Index;"
+    );
+
+_LIT8( KCmSqlDropItemMediatypeIndex, 
+    "DROP INDEX Item_Mediatype_Index;" 
+    );
+
+_LIT8( KCmSqlDropAlbumIdIndex,
+    "DROP INDEX AlbumId_Index;" 
+    );
+
+_LIT8( KCmSqlDropArtistIdIndex,
+    "DROP INDEX ArtistId_Index;" 
+    ); 
+
+_LIT8( KCmSqlDropGenreIdIndex,
+    "DROP INDEX GenreId_Index;" 
+    );
+                                                                            
+#endif // __CMSQLMAINTENANCECLAUSES_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/inc/mcmsqlmain.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main class in the SQL wrapper component
+*
+*/
+
+
+
+
+
+
+#ifndef M_MCMSQLMAIN_H
+#define M_MCMSQLMAIN_H
+
+#include <e32base.h>
+#include <badesca.h>
+#include "cmcommon.h"
+#include "cmcommontypes.h"  
+            
+/* Forward declarations. */
+class RFs;
+class CCmSqlDbMaintenance;
+class CCmSqlConnection;
+class CCmSqlDbClause;
+class CCmBaseListItem;
+class CCmSqlBaseItem;
+class CCmFillRule;
+class CCmFillListItem;
+class CCmSqlGenericItem;
+class CCmSqlPropertyItem;
+class CCmBaseListItem;
+class CCmSqlPropertyCollector;
+
+/**
+ *  MCmSqlMain class ( Interface to sql wrapper )
+ *  Part of SQL wrapper. SQL wrapper is part of
+ *  Content manager component.
+ *
+ *  @lib cmsqlwrapper.lib
+ *
+ *  @since S60 5.1
+ */
+class MCmSqlMain
+    {
+public:
+
+    /**
+     * Canceling operation
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */
+    virtual void CancelAsyncOperation() = 0;
+
+    /**
+     * Setting media server id
+     *
+     * @since S60 5.1     
+     * @param aId, id to be used
+     * @return None
+     */ 
+    virtual void SetMsId( TUint aId ) = 0;
+
+    /**
+     * Setting mmc quota
+     *
+     * @since S60 5.1
+     * @param aQuota, quota to be used in unlimited fill lists
+     * @return None
+     */     
+    virtual void SetQuota( TInt64 aQuota ) = 0;
+
+    /**
+     * Setting dlna profile filters
+     *
+     * @since S60 5.1     
+     * @param aProfileIds, unsupported profile ids
+     * @return None
+     */    
+    virtual void SetDlnaProfileFilters( const RArray<TInt64>& aProfileIds ) = 0;
+     
+    /**
+     * Asyncronous batch add
+     *
+     * @since S60 5.1
+     * @param aItems, items to be added
+     * @param aStatus, request status to be completed
+     * @return None
+     */
+    virtual void AsyncBatchAdd( RPointerArray<CCmSqlGenericItem>& aItems, 
+        TRequestStatus& aStatus ) = 0;
+
+    /**
+     * Asyncronous batch property value add
+     *
+     * @since S60 5.1
+     * @param aItems, property items to be added
+     * @param aField, property identifier
+     * @param aStatus, request status to be completed
+     * @return None
+     */ 
+    virtual void AsyncBatchAddPropertyItems( 
+         RPointerArray<CCmSqlPropertyItem>& aItems, TCmMetadataField aField, 
+         TRequestStatus& aStatus ) = 0;
+
+    /**
+     * Syncronous property value add
+     *
+     * @since S60 5.1
+     * @param aItem, property item to be added
+     * @param aField, property identifier     
+     * @return None
+     */         
+    virtual void SyncAddPropertyItemL( CCmSqlPropertyItem& aItem, 
+        TCmMetadataField aField ) = 0;
+    
+    /**
+     * Asyncronous batch delete
+     *
+     * @since S60 5.1
+     * @param aItems, items to be deleted
+     * @param aStatus, request status to be completed
+     * @return None
+     */       
+    virtual void AsyncBatchDelete( RPointerArray<CCmSqlBaseItem>& aItems, 
+        TRequestStatus& aStatus ) = 0;
+
+    /**
+     * Asyncronous metadata delete
+     *
+     * @since S60 5.1
+     * @param aMsIds, defines where metadata is harvested
+     * @param aStatus, request status to be completed
+     * @return None
+     */ 
+    virtual void AsyncMetadataDelete( RArray<TInt>& aMsIds, 
+        TRequestStatus& aStatus ) = 0;
+
+    /**
+     * SELECT XXX oldest and delete those
+     * Delete defined amount of media items
+     *
+     * @since S60 5.1
+     * @param aType, media type identifier
+     * @param aCount, amount to be deleted
+     * @return None
+     */    
+    virtual void DeleteOldestMediaItemsL( TCmMediaType aType, 
+        TInt64 aCount ) = 0;
+
+    /**
+     * Deletes unused propertys
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    virtual void DeleteUnusedPropertys( ) = 0;
+        
+    /**
+     * Asyncronous metadata query
+     *
+     * @since S60 5.1
+     * @param aItems, result array reference
+     * @param aStatus, request status to be completed
+     * @return None
+     */        
+    virtual void GetItemsL( RPointerArray<CCmSqlBaseItem>& aItems, 
+        TRequestStatus& aStatus ) = 0;
+
+    /**
+     * Asyncronous fill list item query
+     *
+     * @since S60 5.1
+     * @param aItems, result array reference
+     * @param aRule, fill list used as a query clause parameter
+     * @param aStatus, request status to be completed
+     * @return None 
+     */
+    virtual void GetFillItemsL( RPointerArray<CCmFillListItem>& aItems,
+        CCmFillRule& aRule, TRequestStatus& aStatus ) = 0;
+        
+    /**
+     * Asyncronous metadata property values query
+     *
+     * @since S60 5.1
+     * @param aItems, result array reference
+     * @param aStatus, request status to be completed     
+     * @param aField, property identifier ( e.g. artist )
+     * @param aMedia, media type identifier ( e.g. audio )
+     * @return None
+     */   
+    virtual void GetPropertyValuesL( 
+        RPointerArray<CCmSqlPropertyItem>& aItems, TRequestStatus& aStatus, 
+        TCmMetadataField aField, TCmMediaType aMedia = ECmAll ) = 0;
+
+    /**
+     * Asyncronous metadata filtered property values query
+     *
+     * @since S60 5.1
+     * @param aPropertys, result array reference
+     * @param aStatus, request status to be completed     
+     * @return None
+     */         
+    virtual void GetFilteredPropertyValuesL( 
+        CCmSqlPropertyCollector& aPropertys, TRequestStatus& aStatus ) = 0;
+
+     /**
+     * Returns amount of media items
+     *
+     * @since S60 5.1
+     * @param aCount, media amount on return
+     * @param aType, media type
+     * @return None
+     */    
+    virtual void GetMediaCountL( TInt64& aCount, TCmMediaType aType ) = 0;
+    
+     /**
+     * Returns ETrue if item exist in db
+     *
+     * @since S60 5.1
+     * @param aItem, item
+     * @param aDevId, device id
+     * @return ETrue if exists
+     */ 
+    virtual TBool ExistsL( const CCmBaseListItem& aItem, const TInt aDevId ) = 0;
+
+    /**
+     * Deletes the object
+     *
+     * @since S60 5.1
+     */
+	virtual void Close() = 0;
+	
+    };
+
+#endif //  M_MCMSQLMAIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/src/cmsqlconnection.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1331 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQLite Connection class
+*
+*/
+
+
+
+
+
+
+#include <utf.h>
+#include "cmsqlclausedef.h"
+#include "cmsqlresolutionpropertyitem.h"
+#include "cmsqlaudioitem.h"
+#include "cmsqlvideoitem.h"
+#include "cmsqlimageitem.h"
+#include "cmfilllistitem.h"
+#include "cmfillrule.h"
+#include "cmsqlpropertycollector.h"
+#include "cmsqlpropertycontainer.h"
+#include "cmsqlconnection.h"
+#include "msdebug.h"
+
+_LIT8( KCmSqlPragmaCacheSize, 
+    "PRAGMA cache_size=1024;PRAGMA page_size=4096;"
+    );                   
+
+#ifdef _DEBUG
+_LIT( KCmSqlWrapper, "SqlWrapper");
+#endif // _DEBUG
+                            
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::NewL
+// ---------------------------------------------------------------------------
+//
+CCmSqlConnection* CCmSqlConnection::NewL()
+    {
+    TRACE(Print(_L("[SQL wrapper]\t CCmSqlConnection::NewL()")));
+    CCmSqlConnection* self = CCmSqlConnection::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmSqlConnection* CCmSqlConnection::NewLC()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::NewLC"));
+    CCmSqlConnection* self = new ( ELeave ) CCmSqlConnection();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;  
+    }    
+        
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::~CCmSqlConnection
+// ---------------------------------------------------------------------------
+//
+CCmSqlConnection::~CCmSqlConnection()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::~CCmSqlConnection"));
+    CloseDb();
+    if( iAsyncDbHandler )
+        {
+        iAsyncDbHandler->Cancel();
+        delete iAsyncDbHandler;       
+        }
+        
+    delete iCountQuery;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::OpenDb
+// ---------------------------------------------------------------------------
+//
+TInt CCmSqlConnection::OpenDb( const TDesC& aDb )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::OpenDb"));
+    
+    TInt err( iDatabase.Open( aDb, NULL ) );
+    if( err == KErrNone )
+        {
+        err = iDatabase.Exec( KCmSqlPragmaCacheSize );        
+        if ( err != KErrNone )
+            {
+            TRACE(Print(_L("[SQL wrapper]\t KCmSqlPragmaCacheSize\
+             error %d"), err));        
+            }        
+        }
+    return err;    
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::CloseDb
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::CloseDb()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CloseDb"));
+    
+    iDatabase.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::CreateDbFile
+// ---------------------------------------------------------------------------
+//
+TInt CCmSqlConnection::CreateDbFile( const TDesC& aDb )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CreateDbFile"));
+    
+    return iDatabase.Create( aDb );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::Validate
+// ---------------------------------------------------------------------------
+//
+TBool CCmSqlConnection::Validate()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::Validate"));
+    
+    TBool retval = EFalse;
+
+    // In the test period it is useful that the database is re-created
+    // every run. because most of the test cases are automatic and require
+    // a known initial state.
+    TInt ret( KErrNone );
+    TInt err = iStatement.Prepare( iDatabase, 
+        KCmSqlValidateTableExistence );
+    // Loop only one row in results
+    if( err )
+        {
+        ret = KErrGeneral;
+        }
+    else
+        {
+        err = iStatement.Next();    
+        if ( err != KSqlAtRow )  
+            {
+            ret = KErrGeneral;       
+            }
+        iStatement.Reset();
+        iStatement.Close();          
+        }    
+    
+
+    if ( ret == KErrNone ) 
+        {
+        retval = ETrue;
+        }
+
+    return retval;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::ExecuteL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::ExecuteL( const TDesC8& aCommand )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::ExecuteL"));
+    
+    TInt err( iDatabase.Exec( aCommand ) );
+    if ( KErrNone > err  )
+        {
+#ifdef _DEBUG        
+        TPtrC errorMsg( iDatabase.LastErrorMessage() );
+        TRACE(Print(_L("[SQL wrapper]\t errorMsg: %S"), &errorMsg ));
+#endif        
+        User::Leave( err );    
+        }    
+    }
+             
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::CancelAsyncOperation
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::CancelAsyncOperation()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CancelAsyncOperation"));
+    
+    if( ECmSqlBaseItemGet == iMode || ECmSqlFillItemGet == iMode ||
+        ECmSqlPropertyValueGet == iMode )
+        {
+        iStatement.Reset();
+        iStatement.Close();        
+        }
+    
+    iMode = ECmSqlIdle;        
+    
+    if ( iAsyncDbHandler->IsActive() )
+        {
+        User::RequestComplete( iStatus, KErrCancel );
+        iAsyncDbHandler->Cancel();
+        TRACE(Print(_L("[SQL wrapper]\t Canceled...")));
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::SetMsId
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::SetMsId( TUint aId )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::SetMsId"));
+    
+    iMsId = aId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::SetQuota
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::SetQuota( TInt64 aQuota )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::SetQuota"));
+    
+    iQuota = aQuota;
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::AsyncBatchAdd
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::AsyncBatchAdd( 
+    RPointerArray<CCmSqlGenericItem>& aItems, TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AsyncBatchAdd"));
+    
+    __ASSERT_DEBUG( iAsyncDbHandler,\
+        User::Panic( KCmSqlWrapper, KErrCorrupt ));
+    iStatus = &aStatus;        
+    
+    if( !iAsyncDbHandler->IsActive() )
+        {    
+        iIndex = 0;
+        iGenericItems = &aItems;
+        iMode = ECmSqlGenericItemAdd;  
+        iAsyncDbHandler->Start( TCallBack( BatchAdd, this ) );
+        }
+    else
+        {
+        User::RequestComplete( iStatus, KErrNotReady );
+        }            
+    }
+
+// ---------------------------------------------------------------------------
+// ACCmSqlConnection::syncBatchAddPropertyItems 
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::AsyncBatchAddPropertyItems( 
+    RPointerArray<CCmSqlPropertyItem>& aItems, TCmMetadataField aField,
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AsyncBatchAddPropertyItems"));
+    
+    __ASSERT_DEBUG( iAsyncDbHandler,\
+        User::Panic( KCmSqlWrapper, KErrCorrupt ));
+    iStatus = &aStatus;        
+    
+    if( !iAsyncDbHandler->IsActive() )
+        {    
+        iIndex = 0;
+        iField = aField;
+        iPropertyItems = &aItems;
+        iMode = ECmSqlPropertyItemAdd;
+        iAsyncDbHandler->Start( TCallBack( BatchAdd, this ) );
+        }
+    else
+        {
+        User::RequestComplete( iStatus, KErrNotReady );
+        } 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::SyncAddPropertyItemL 
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::SyncAddPropertyItemL( 
+    CCmSqlPropertyItem& aItem, TCmMetadataField aField )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::SyncAddPropertyItemL"));
+    
+    iIndex = 0;
+    iField = aField;
+    RPointerArray<CCmSqlPropertyItem> temp;
+    CleanupClosePushL( temp );
+    temp.AppendL( &aItem );
+    iPropertyItems = &temp;
+    AddPropertyItemL();
+    FormatRowCountQueryL( aField );
+    // Autoincremented row index is used as a item id
+    aItem.SetId( RowCountL() );
+    delete iCountQuery;
+    iCountQuery = NULL;
+    temp.Reset();
+    CleanupStack::PopAndDestroy( &temp );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::AsyncBatchDelete
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlConnection::AsyncBatchDelete( 
+    RPointerArray<CCmSqlBaseItem>& aItems, 
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AsyncBatchDelete"));
+    
+    __ASSERT_DEBUG( iAsyncDbHandler,\
+        User::Panic( KCmSqlWrapper, KErrCorrupt ));
+    iStatus = &aStatus;        
+     
+    if( !iAsyncDbHandler->IsActive() )
+        {
+        iBaseItems = &aItems;
+        iIndex = 0;    
+        iAsyncDbHandler->Start( TCallBack( BatchDelete, this ) );
+        }        
+    else
+        {
+        User::RequestComplete( iStatus, KErrNotReady );
+        } 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::AsyncMetadataDelete
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::AsyncMetadataDelete( RArray<TInt>& aMsIds, 
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AsyncMetadataDelete"));
+    
+    __ASSERT_DEBUG( iAsyncDbHandler,\
+        User::Panic( KCmSqlWrapper, KErrCorrupt ));
+    iStatus = &aStatus;         
+    
+    if( !iAsyncDbHandler->IsActive() )
+        {
+        iMsIds = &aMsIds;
+        iIndex = 0;
+        iMode = ECmSqlDeletingMetadata;    
+        iAsyncDbHandler->Start( TCallBack( BatchDelete, this ) );
+        }        
+    else
+        {
+        User::RequestComplete( iStatus, KErrNotReady );
+        } 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::DeleteOldestMediaItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::DeleteOldestMediaItemsL( TCmMediaType aType, 
+    TInt64 aCount )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DeleteOldestMediaItemsL"));
+    
+    TInt err = iStatement.Prepare( iDatabase, KCmSqlSelectLimitHarvestDate );
+    TInt64 timestamp( KErrNone );
+    User::LeaveIfError( err );
+    iStatement.BindInt( 0, aType );
+    iStatement.BindInt64( 1, aCount );
+    
+    while( KSqlAtRow == iStatement.Next() )
+        {
+        timestamp = iStatement.ColumnInt64( 0 );
+        }
+    
+    iStatement.Reset();
+    iStatement.Close();    
+    
+    if( timestamp )
+        {
+        err = iStatement.Prepare( iDatabase, KCmSqlDeleteOldestMediaItems );
+        User::LeaveIfError( err );
+        iStatement.BindInt64( 0, timestamp );
+        iStatement.BindInt( 1, aType );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();  
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::DeleteUnusedPropertys()
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::DeleteUnusedPropertys( )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DeleteUnusedPropertys"));
+    
+    iDatabase.Exec( KCmSqlDeleteUnusedAlbums );
+    iDatabase.Exec( KCmSqlDeleteUnusedArtists );
+    iDatabase.Exec( KCmSqlDeleteUnusedGenres );
+    iDatabase.Exec( KCmSqlDeleteUnusedUpnpclasses );
+    iDatabase.Exec( KCmSqlDeleteUnusedUpnpProfileIds );  
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::GetItemsL
+// ---------------------------------------------------------------------------
+// 
+void CCmSqlConnection::GetItemsL( RPointerArray<CCmSqlBaseItem>& aItems,
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetItemsL"));
+    
+    __ASSERT_DEBUG( iAsyncDbHandler,\
+        User::Panic( KCmSqlWrapper, KErrCorrupt ));
+    iStatus = &aStatus;         
+    
+    if( !iAsyncDbHandler->IsActive() )
+        {    
+        iBaseItems = &aItems;
+        iMode = ECmSqlBaseItemGet;
+        iIndex = 0;
+        TInt err = iStatement.Prepare( iDatabase, 
+            KCmSqlSelectGenericItem );
+        User::LeaveIfError( err );
+        iStatement.BindInt( 0, iMsId );   
+        iAsyncDbHandler->Start( TCallBack( BatchGetL, this ) );
+        }        
+    else
+        {
+        User::RequestComplete( iStatus, KErrNotReady );
+        } 
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::GetFillItemsL
+// ---------------------------------------------------------------------------
+// 
+void CCmSqlConnection::GetFillItemsL( RPointerArray<CCmFillListItem>& aItems,
+    TDesC8& aClause, CCmFillRule& aRule, TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetFillItemsL"));
+    
+    __ASSERT_DEBUG( iAsyncDbHandler,\
+        User::Panic( KCmSqlWrapper, KErrCorrupt ));  
+    iStatus = &aStatus;    
+    
+    if( !iAsyncDbHandler->IsActive() )
+        {    
+        iList = &aRule;
+        iIndex = 0;
+        iListSize = 0;
+        iListMaxSize = 0;
+        iFillItems = &aItems;
+        iMode = ECmSqlFillItemGet;
+        if( EMbits == iList->LimitType() )
+            {
+            // Converting list max size to bytes
+            iListMaxSize = ( iList->Amount() * 1000000 );
+            }
+        // Unlimited lists are limited to mmc quota    
+        else if( EUnlimited == iList->LimitType() )
+            {
+            iListMaxSize = iQuota;
+            }
+            
+        TInt err = iStatement.Prepare( iDatabase, aClause );
+        User::LeaveIfError( err );  
+        iAsyncDbHandler->Start( TCallBack( BatchGetL, this ) );
+        }
+    else
+        {
+        User::RequestComplete( iStatus, KErrNotReady );
+        } 
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::GetPropertyValuesL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlConnection::GetPropertyValuesL( 
+    RPointerArray<CCmSqlPropertyItem>& aItems, TDesC8& aClause,
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetPropertyValuesL"));
+    
+    __ASSERT_DEBUG( iAsyncDbHandler,\
+        User::Panic( KCmSqlWrapper, KErrCorrupt ));
+    iStatus = &aStatus;        
+    
+    if( !iAsyncDbHandler->IsActive() )
+        {
+        iPropertyItems = &aItems;
+        iIndex = 0;
+        iMode = ECmSqlPropertyValueGet;
+        TInt err = iStatement.Prepare( iDatabase, aClause );
+        User::LeaveIfError( err );
+        iAsyncDbHandler->Start( TCallBack( BatchGetL, this ) );        
+        }        
+    else
+        {
+        User::RequestComplete( iStatus, KErrNotReady );
+        }  
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::GetFilteredPropertyValuesL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlConnection::GetFilteredPropertyValuesL( 
+    CCmSqlPropertyCollector& aPropertys, const TDesC8& aClause, 
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetFilteredPropertyValuesL"));
+    
+    __ASSERT_DEBUG( iAsyncDbHandler,\
+        User::Panic( KCmSqlWrapper, KErrCorrupt ));
+    iStatus = &aStatus;        
+    
+    if( !iAsyncDbHandler->IsActive() )
+        {
+        iPropertyCollector = &aPropertys;
+        iIndex = 0;
+        iMode = ECmSqlFilteredPropertyGet;
+        TInt err = iStatement.Prepare( iDatabase, aClause );
+        User::LeaveIfError( err );
+        iAsyncDbHandler->Start( TCallBack( BatchGetL, this ) );  
+        }        
+    else
+        {
+        User::RequestComplete( iStatus, KErrNotReady );
+        }     
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::GetMediaCountL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::GetMediaCountL( TInt64& aCount, 
+    TCmMediaType aType )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetMediaCountL"));
+    
+    TInt err = iStatement.Prepare( iDatabase, KCmSqlSelectMediaCount );
+    User::LeaveIfError( err );
+    err = iStatement.BindInt( 0, aType );
+    
+    if( !err )
+        {
+        if( KSqlAtRow == iStatement.Next() )
+            {
+            aCount = iStatement.ColumnInt( 0 );
+            }
+        iStatement.Reset();
+        iStatement.Close();
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::ExistsL
+// ---------------------------------------------------------------------------
+//   
+TBool CCmSqlConnection::ExistsL( const CCmBaseListItem& aItem, 
+    const TInt aDevId )    
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::ExistsL"));
+    
+    TBool exists( EFalse );
+    
+    TInt err = iStatement.Prepare( iDatabase, KCmSqlSelectItemId );
+    User::LeaveIfError( err );
+    
+    // convert lowercase
+    TBuf<KMaxFileName> temp;
+    temp.Copy(aItem.PrimaryText());
+    temp.LowerCase();
+    
+    iStatement.BindText( 0, temp );
+    iStatement.BindInt( 1, aItem.Size() );
+    iStatement.BindInt( 2, aDevId );     
+        
+    if( KSqlAtRow == iStatement.Next() )
+        {
+        exists = ETrue;
+        }
+    
+    iStatement.Reset();
+    iStatement.Close();
+    return exists;            
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::BatchAdd
+// ---------------------------------------------------------------------------
+//  
+TInt CCmSqlConnection::BatchAdd( TAny* aDbHandler )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::BatchAdd"));
+    
+    return ((CCmSqlConnection*)aDbHandler)->DoBatchAdd();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::DoBatchAdd
+// ---------------------------------------------------------------------------
+//
+TInt CCmSqlConnection::DoBatchAdd()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DoBatchAdd"));
+    
+    TInt ret( EFalse );
+    // Add items in chucks of X items ( x must be changeable )
+    // return true if not all added
+    TInt err( iDatabase.Exec( KCmSqlBeginTransaction ) ); 
+    TInt added( 0 );
+    switch( iMode )
+        {
+        case ECmSqlPropertyItemAdd:
+            {
+            if( iPropertyItems )
+                {
+                LOG(_L("[SQL Wrapper]\t Adding property item batch"));
+                // Add batch size pcs. items at a time
+                for( TInt i = iIndex; i < iPropertyItems->Count() && 
+                    ( ( added + 1 ) % KCmSqlBatchSize != 0 ) ; i++ )
+                    {
+                    if( ( *iPropertyItems )[i] )
+                        {                            
+                        TRAP_IGNORE( AddPropertyItemL() );
+                        }
+                    iIndex++;    
+                    ret = ETrue;
+                    added++;
+                    }                               
+                } 
+            break;
+            }        
+        case ECmSqlGenericItemAdd:
+            {
+            if( iGenericItems )
+                {
+                LOG(_L("[SQL Wrapper]\t Adding generic item batch"));
+                // Add batch size pcs. items at a time
+                for( TInt i = iIndex; i < iGenericItems->Count()  && 
+                    ( ( added + 1 ) % KCmSqlBatchSize != 0 ) ; i++ )
+                    {
+                    if( (*iGenericItems)[i] )
+                        {
+                        TRAP_IGNORE( AddItemL() );
+                        TRAP_IGNORE( AddResourceL() );
+                        }
+                    iIndex++;     
+                    ret = ETrue;
+                    added++;
+                    }                                
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }    
+        }
+    err = iDatabase.Exec( KCmSqlCommit );         
+    if( !ret )
+        {
+        LOG(_L("[SQL Wrapper]\t Completing Async batch add..."));
+        User::RequestComplete( iStatus, KErrNone );   
+        }            
+    return ret;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::BatchDelete
+// ---------------------------------------------------------------------------
+//  
+TInt CCmSqlConnection::BatchDelete( TAny* aDbHandler )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::BatchDelete"));
+    
+    return ((CCmSqlConnection*)aDbHandler)->DoBatchDelete();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::DoBatchDelete
+// ---------------------------------------------------------------------------
+//
+TInt CCmSqlConnection::DoBatchDelete()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DoBatchDelete"));
+    
+    TInt ret( EFalse );
+    // Delete items in chucks of KCmSqlBatchSize items
+    // return true if not all deleted
+    if( iMode == ECmSqlDeletingMetadata )
+        {
+        if( iIndex < iMsIds->Count() )
+            {
+            TRAP_IGNORE( 
+                DeleteMetadataFromDefServerL( (*iMsIds)[iIndex] ) );
+            iIndex++;
+            ret = ETrue;            
+            }
+        }
+    else
+        {
+        TInt err( iDatabase.Exec( KCmSqlBeginTransaction ) );
+        TInt count( 0 );
+        for( TInt i = iIndex; i < iBaseItems->Count() && 
+            ((count + 1 ) % KCmSqlBatchSize != 0 ) ; i++ )
+            {
+            TRAP_IGNORE( DeleteItemL() );
+            TRAP_IGNORE( DeleteResourceL() ); 
+            count++;
+            iIndex++;
+            ret = ETrue;     
+            }    
+        err = iDatabase.Exec( KCmSqlCommit );        
+        }
+    if( !ret )
+        {
+        User::RequestComplete( iStatus, KErrNone );
+        }                
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::BatchGetL
+// ---------------------------------------------------------------------------
+//  
+TInt CCmSqlConnection::BatchGetL( TAny* aDbHandler )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::BatchGetL"));
+    
+    return ((CCmSqlConnection*)aDbHandler)->DoBatchGetL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::DoBatchGetL
+// ---------------------------------------------------------------------------
+//
+TInt CCmSqlConnection::DoBatchGetL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DoBatchGetL() start"));
+    TInt ret( EFalse ); 
+    
+    // Get items in chucks of KCmSqlBatchSize
+    TInt stat( KSqlAtRow ); 
+    for( TInt i = 0; i < KCmSqlBatchSize && 
+        stat == KSqlAtRow ; i++ )
+        {
+        stat = iStatement.Next();
+        if( stat == KSqlAtRow )
+            {
+            CollectItemDataL();
+            ret = ETrue;
+            if( iMode == ECmSqlFillItemGet && 
+                iListSize > iListMaxSize && 
+                iListMaxSize )
+                {
+                stat = KSqlAtEnd;
+                }
+            } 
+        }
+                
+    // If no items found or quota is full    
+    if( stat == KSqlAtEnd || !ret )
+        {
+        ret = EFalse;
+        iStatement.Reset();
+        iStatement.Close();
+        iMode = ECmSqlIdle;
+        User::RequestComplete( iStatus, KErrNone );
+        }        
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::CollectItemDataL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::CollectItemDataL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CollectItemDataL"));
+    
+    switch( iMode )
+        {
+        case ECmSqlFillItemGet:
+            {
+            CCmFillListItem* item = CCmFillListItem::NewLC(
+                iList->Priority(), iList->ListId(), iList->Status(),
+                iList->Selected() );
+            item->SetMediaType( iList->MediaType() );    
+            item->SetPrimaryTextL( iStatement.ColumnTextL( 0 ) );
+            item->SetSecondaryTextL( iStatement.ColumnTextL( 1 ) );
+            TPtrC8 data;
+            item->SetSize(iStatement.ColumnInt( 2 ) );
+            iListSize = iListSize + item->Size(); 
+            data.Set( iStatement.ColumnBinaryL( 3 ) ); 
+            item->SetUriL( data );
+            item->SetDevId(iStatement.ColumnInt( 4 ) );   
+            data.Set( iStatement.ColumnBinaryL( 5 ) );
+            item->SetItemIdL( data );
+            item->SetDbId( iStatement.ColumnInt64( 6 ) );             
+            if( iListSize > iListMaxSize && iListMaxSize )
+                {
+                CleanupStack::PopAndDestroy( item );
+                }
+            else
+                {
+                iFillItems->AppendL( item ); 
+                CleanupStack::Pop( item );
+                }
+            break;
+            }        
+        case ECmSqlBaseItemGet:
+            {
+            CCmSqlBaseItem* item = CCmSqlBaseItem::NewL();
+            CleanupStack::PushL( item ); 
+            item->SetId( iStatement.ColumnInt64( 0 ) );
+            TPtrC8 data = iStatement.ColumnBinaryL( 1 );
+            item->SetCdsIdL( data );
+            item->SetHashL( iStatement.ColumnTextL( 2 ) );
+            item->SetSearchId( iStatement.ColumnInt64( 3 ) );
+            iBaseItems->AppendL( item );
+            CleanupStack::Pop( item );
+            break;
+            }        
+        case ECmSqlPropertyValueGet:
+            {
+            CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewL();
+            CleanupStack::PushL( item );
+            item->SetId( iStatement.ColumnInt64( 0 ) );
+            TPtrC data16 = iStatement.ColumnTextL( 1 );
+            HBufC8* data8bitBuf = HBufC8::NewLC(
+                data16.Length());
+            TPtr8 data8bitPtr = data8bitBuf->Des();
+            TInt conversionError = 
+                CnvUtfConverter::ConvertFromUnicodeToUtf8( data8bitPtr, 
+                    data16 );
+            if( !conversionError )
+                {
+                item->SetNameL( data8bitPtr );
+                }
+            CleanupStack::PopAndDestroy( data8bitBuf );                    
+            item->SetStatus( ETrue );
+            iPropertyItems->AppendL( item );
+            CleanupStack::Pop( item );
+            break;
+            }
+        case ECmSqlFilteredPropertyGet:
+            {
+            TInt couunt = iPropertyCollector->PropertyContainerCount();
+            for( TInt i = 0 ; i < couunt; i++ )
+                {
+                CCmSqlPropertyContainer* temp = 
+                    iPropertyCollector->PropertyContainer( i );
+                switch( temp->Type() )
+                    {
+                    case ECmTitle:
+                        {
+                        GetFilteredPropertysL( *temp, 0, 1 );
+                        break;
+                        }                    
+                    case ECmArtist:
+                        {
+                        GetFilteredPropertysL( *temp, 2, 3 );
+                        break;
+                        }                    
+                    case ECmAlbum:
+                        {
+                        GetFilteredPropertysL( *temp, 4, 5 );
+                        break;
+                        }                    
+                    case ECmGenre:
+                        {
+                        GetFilteredPropertysL( *temp, 6, 7 );
+                        break;
+                        }                    
+                    default:
+                        {
+                        break;
+                        }
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }                       
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::AddItemL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::AddItemL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AddItemL"));
+    
+    TInt err = iStatement.Prepare( iDatabase, KCmSqlInsertItem );
+    User::LeaveIfError( err );        
+    // Bind item prameters
+    if( &(*iGenericItems)[iIndex]->CdsId() ) 
+        {
+        iStatement.BindBinary( 0, 
+            (*iGenericItems)[iIndex]->CdsId() );            
+        }
+    if( &(*iGenericItems)[iIndex]->Hash() )
+        {
+        iStatement.BindText( 1, 
+            (*iGenericItems)[iIndex]->Hash() );                            
+        }
+    if( &(*iGenericItems)[iIndex]->Uri()  )
+        {
+        iStatement.BindBinary( 2, 
+            (*iGenericItems)[iIndex]->Uri() );                             
+        }
+    if( &(*iGenericItems)[iIndex]->Title() )
+        {
+        HBufC* data16bitBuf = HBufC::NewLC(
+            iGenericItems->operator[](iIndex)->Title().Length());
+        TPtr data16bitPtr = data16bitBuf->Des();
+        TInt conversionError = 
+            CnvUtfConverter::ConvertToUnicodeFromUtf8( data16bitPtr, 
+                (*iGenericItems)[iIndex]->Title() );
+        if( !conversionError )
+            {
+            iStatement.BindText( 3, data16bitPtr );
+            }
+        CleanupStack::PopAndDestroy( data16bitBuf );
+        }
+    iStatement.BindInt( 5, iMsId ); 
+    
+    iStatement.BindInt64( 8, 
+        (*iGenericItems)[iIndex]->Date().Int64() ); 
+    iStatement.BindInt64( 9, 
+        (*iGenericItems)[iIndex]->HarvestDate().Int64() );
+    iStatement.BindInt( 10, 
+        (*iGenericItems)[iIndex]->Size() );
+    iStatement.BindInt( 11, 
+        (*iGenericItems)[iIndex]->MediaType() );
+    iStatement.BindInt64( 12, 
+        (*iGenericItems)[iIndex]->UpnpclassId() );         
+    iStatement.BindInt64( 17, 
+        (*iGenericItems)[iIndex]->UpnpProfileId() );
+    iStatement.BindInt64( 18, 
+        (*iGenericItems)[iIndex]->SearchId() );        
+        
+    switch( (*iGenericItems)[iIndex]->MediaType() )
+        {
+        case ECmAudio:
+            {
+            CCmSqlAudioItem* item = static_cast<CCmSqlAudioItem*>(
+                (*iGenericItems)[iIndex] );
+            iStatement.BindInt( 6, item->Duration() );
+            iStatement.BindInt( 7, item->Bitrate() );                     
+            iStatement.BindInt64( 13, item->ArtistId() );
+            iStatement.BindInt64( 14, item->AlbumId() );
+            iStatement.BindInt64( 15, item->GenreId() );
+            if( &item->AlbumArtUri()  )
+                {
+                iStatement.BindBinary( 4, item->AlbumArtUri() );
+                }            
+            break;
+            }            
+        case ECmVideo:
+            {
+            CCmSqlVideoItem* item = static_cast<CCmSqlVideoItem*>(
+                (*iGenericItems)[iIndex] );
+            iStatement.BindInt64( 15, item->GenreId() );
+            break;
+            }            
+        case ECmImage:
+            {
+            CCmSqlImageItem* item = static_cast<CCmSqlImageItem*>(
+                (*iGenericItems)[iIndex] );                    
+            iStatement.BindInt64( 16, item->ResolutionId() );
+            }            
+        default:
+            {
+            break;
+            }
+        }
+    iStatement.Exec();        
+    iStatement.Reset();
+    iStatement.Close();        
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::AddPropertyItemL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::AddPropertyItemL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AddPropertyItemL"));
+    
+    TInt err( KErrNone );
+    switch( iField )
+        {
+        case ECmArtist:
+            {
+            err = iStatement.Prepare( iDatabase, KCmSqlInsertArtist );
+            break;
+            }            
+        case ECmAlbum:
+            {
+            err = iStatement.Prepare( iDatabase, KCmSqlInsertAlbum );
+            break;
+            }            
+        case ECmGenre:
+            {
+            err = iStatement.Prepare( iDatabase, KCmSqlInsertGenre );
+            break;
+            }            
+        case ECmUpnpClass:
+            {
+            err = iStatement.Prepare( iDatabase, KCmSqlInsertUpnpclass );
+            break;
+            }
+        case ECmProfileId:
+            {
+            err = iStatement.Prepare( iDatabase, KCmSqlInsertUpnpProfile );
+            break;
+            }
+        case ECmResolution:
+            {
+            err = iStatement.Prepare( iDatabase, KCmSqlInsertResolution );
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    User::LeaveIfError( err );
+    HBufC* data16bitBuf = HBufC::NewLC(
+        (*iPropertyItems)[iIndex]->Name().Length());
+    TPtr data16bitPtr = data16bitBuf->Des();
+    
+    TInt conversionError = 
+        CnvUtfConverter::ConvertToUnicodeFromUtf8( data16bitPtr, 
+            (*iPropertyItems)[iIndex]->Name() );
+    
+    if( !conversionError )
+        {
+        iStatement.BindText( 0, data16bitPtr );
+        }    
+    CleanupStack::PopAndDestroy( data16bitBuf );                  
+    
+    if( ECmResolution == iField )
+        {
+        CCmSqlResolutionPropertyItem* resolution =
+            static_cast<CCmSqlResolutionPropertyItem*> 
+            ( (*iPropertyItems)[iIndex] );
+        iStatement.BindInt( 1, resolution->Width() );
+        iStatement.BindInt( 2, resolution->Height() );
+        iStatement.BindInt( 3, resolution->PixelCount() );
+        resolution = NULL;                                                 
+        }            
+    iStatement.Exec();
+    iStatement.Reset();
+    iStatement.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::AddResourceL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::AddResourceL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AddResourceL"));
+    
+    TPtrC8 uri;
+    TInt size( KErrNone );
+    TInt duration( KErrNone );
+    TInt bitrate( KErrNone );
+    TInt64 resolutionId( KErrNone );
+    TInt err( KErrNone );    
+    for( TInt i = 0; i < 
+        (*iGenericItems)[iIndex]->ResourceCount(); 
+        i++ )
+        {
+        FormatRowCountQueryL( ECmTitle );
+        // Resources references to it's item
+        TInt64 itemId( RowCountL() );        
+        err = iStatement.Prepare( iDatabase, KCmSqlInsertResource );
+        User::LeaveIfError( err );
+        (*iGenericItems)[iIndex]->GetResource( uri, size,
+            duration, bitrate, resolutionId, i );
+  
+         // Bind item prameters
+        iStatement.BindInt64( 0, itemId );
+        iStatement.BindInt64( 1, resolutionId );
+        if( &uri )
+            {
+            iStatement.BindBinary( 2, uri );
+            }
+        iStatement.BindInt( 3, size );
+        iStatement.BindInt( 4, duration );
+        iStatement.BindInt( 5, bitrate );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();            
+        }          
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::DeleteItemL()
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::DeleteItemL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DeleteItemL"));
+    
+    TInt err = iStatement.Prepare( iDatabase, KCmSqlDeleteItem );
+    User::LeaveIfError( err );
+    iStatement.BindInt64( 0,  
+        (*iBaseItems)[iIndex]->Id() );    
+    iStatement.Exec();
+    iStatement.Reset();
+    iStatement.Close();     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::DeleteResourceL()
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::DeleteResourceL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DeleteResourceL"));
+    
+    TInt err = iStatement.Prepare( iDatabase, KCmSqlDeleteResource );
+    User::LeaveIfError( err );
+    iStatement.BindInt64( 0,  
+        (*iBaseItems)[iIndex]->Id() );
+    iStatement.Exec();
+    iStatement.Reset();
+    iStatement.Close();      
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::DeleteMetadataFromDefServerL()
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::DeleteMetadataFromDefServerL( const TInt aMsId )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::\
+    DeleteMetadataFromDefServerL"));
+    
+    TRACE(Print(_L("[SQL wrapper]\t CCmSqlConnection::\
+        DeleteMetadataFromDefServerL aMsId = %d"), aMsId ));    
+    TInt err = iStatement.Prepare( iDatabase, KCmSqlDeleteMetadata );
+    User::LeaveIfError( err );
+    iStatement.BindInt( 0, aMsId );    
+    iStatement.Exec();
+    iStatement.Reset();
+    iStatement.Close();     
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::FormatRowCountQueryL()
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::FormatRowCountQueryL( TCmMetadataField aField )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::FormatRowCountQueryL"));
+
+    switch( aField )
+        {
+        case ECmArtist:
+            {
+            FormatCountQueryL( KCmSqlArtistId(), KCmSqlArtist() );  
+            break;
+            }            
+        case ECmAlbum:
+            {
+            FormatCountQueryL( KCmSqlAlbumId(), KCmSqlAlbum() );            
+            break;
+            }            
+        case ECmGenre:
+            {
+            FormatCountQueryL( KCmSqlGenreId(), KCmSqlGenre() );            
+            break;
+            }            
+        case ECmUpnpClass:
+            {
+            FormatCountQueryL( KCmSqlUpnpclassId(), KCmSqlUpnpclass() );
+            break;
+            }
+        case ECmProfileId:
+            {
+            FormatCountQueryL( KCmSqlProfileId(), KCmSqlUpnpProfiles() );
+            break;            
+            }
+        case ECmResolution:
+            {
+            FormatCountQueryL( KCmSqlResolutionId(), KCmSqlResolutions() );
+            break;
+            }
+        case ECmTitle:
+            {
+            delete iCountQuery;
+            iCountQuery = NULL;
+            iCountQuery = HBufC8::NewL( KCmSqlSelectMaxItemIndex().Length() );
+            iCountQuery->Des().Append( KCmSqlSelectMaxItemIndex );            
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::RowCountL()
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmSqlConnection::RowCountL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::RowCountL"));
+    
+    TInt err = iStatement.Prepare( iDatabase, *iCountQuery );
+    TInt64 count( KErrNone );
+    User::LeaveIfError( err );
+    err = iStatement.Next();
+    if ( KSqlAtRow == err )  
+        {
+        count = iStatement.ColumnInt( 0 );
+        }
+    iStatement.Reset();
+    iStatement.Close();
+    return count;          
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::FormatCountQueryL()
+// ---------------------------------------------------------------------------
+//
+void CCmSqlConnection::FormatCountQueryL( const TDesC8& aId, 
+    const TDesC8& aTable )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::FormatCountQueryL"));
+    
+    delete iCountQuery;
+    iCountQuery = NULL;    
+    iCountQuery = HBufC8::NewL( KCmSqlSelectMaxIndex().Length() + 
+       aId.Length() + aTable.Length() + KCmSqlSemicolon().Length() );
+    HBufC8* temp = HBufC8::NewLC( KCmSqlSelectMaxIndex().Length() + 
+       aTable.Length() + KCmSqlSemicolon().Length() );               
+    temp->Des().Append( KCmSqlSelectMaxPropertyIndex );            
+    iCountQuery->Des().Format( temp->Des(), &aId, &aTable );
+    iCountQuery->Des().Append( KCmSqlSemicolon );
+    CleanupStack::PopAndDestroy( temp );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::GetFilteredPropertysL()
+// ---------------------------------------------------------------------------
+//  
+void CCmSqlConnection::GetFilteredPropertysL( 
+    CCmSqlPropertyContainer& aContainer, const TInt aIndex1, 
+    const TInt aIndex2 )
+    {
+    CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC();
+    item->SetId( iStatement.ColumnInt64( aIndex1 ) );
+    item->SetStatus( ETrue );
+    
+    TPtrC data16 = iStatement.ColumnTextL( aIndex2 );
+    HBufC8* data8bitBuf = HBufC8::NewLC(
+            data16.Length() * 3 );
+    TPtr8 data8bitPtr = data8bitBuf->Des();
+    TInt conversionError =
+        CnvUtfConverter::ConvertFromUnicodeToUtf8( data8bitPtr,
+            data16 );
+    if( !conversionError )
+        {
+        item->SetNameL( data8bitPtr );
+        }
+    CleanupStack::PopAndDestroy( data8bitBuf );
+    
+    if( !aContainer.IsDuplicate( *item ) )
+        {
+        aContainer.AddPropertyItemL( item );
+        CleanupStack::Pop( item );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( item );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::CCmSqlConnection
+// ---------------------------------------------------------------------------
+//    
+CCmSqlConnection::CCmSqlConnection()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CCmSqlConnection"));
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmSqlConnection::ConstructL
+// ---------------------------------------------------------------------------
+//   
+void CCmSqlConnection::ConstructL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlConnection::ConstructL"));
+    
+    iAsyncDbHandler = CIdle::NewL( CActive::EPriorityStandard );      
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/src/cmsqldbclause.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,944 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQL database sql clause class
+*
+*/
+
+
+
+
+
+
+#include <utf.h>
+#include "cmfillrule.h"
+#include "cmsqlpropertycollector.h"
+#include "cmsqlpropertycontainer.h"
+#include "cmsqlpropertyitem.h"
+#include "cmsqldbclause.h"
+#include "cmsqlclausedef.h"
+#include "msdebug.h"                                                    
+
+// CONSTANTS
+// The size of buf that need to allot for store the rule amount
+const TUint KCmRuleAmountSize = 5;
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::NewL
+// ---------------------------------------------------------------------------
+//
+CCmSqlDbClause* CCmSqlDbClause::NewL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::NewL"));    
+    CCmSqlDbClause* self = CCmSqlDbClause::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmSqlDbClause* CCmSqlDbClause::NewLC()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::NewLC"));    
+    CCmSqlDbClause* self = new ( ELeave ) CCmSqlDbClause();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::~CCmSqlDbClause
+// ---------------------------------------------------------------------------
+//
+CCmSqlDbClause::~CCmSqlDbClause()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::~CCmSqlDbClause"));    
+    
+    delete iClause;
+    delete iFreeText;
+    iProfileFilters.Reset();        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatClauseL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::FormatClauseL( CCmFillRule& aRule,
+    TCmMetadataField aField, TCmMediaType aMedia )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatClauseL"));    
+    
+    delete iClause;
+    iClause = NULL;   
+    if( aField == ECmNone && &aRule )
+        {
+        if( ECmAudio != aRule.MediaType() )
+            {
+            iClause = KCmSqlBaseSelect().AllocL();    
+            }
+        else
+            {
+            iClause = KCmSqlMusicSelect().AllocL();
+            }
+        TRACE(Print(_L("[SQL wrapper]\t Formating media type...")));
+        FormatMediatypeL( aRule );
+        TRACE(Print(_L("[SQL wrapper]\t Formating params...")));
+        FormatParamsL( aRule );
+        TRACE(Print(_L("[SQL wrapper]\t Formating devices...")));
+        FormatDevicesL( aRule );
+        TRACE(Print(_L("[SQL wrapper]\t Formating profile filters...")));
+        FormatProfileFiltersL();
+        TRACE(Print(_L("[SQL wrapper]\t Formating ordering...")));
+        FormatOrderingL( aRule.Method() );
+        TRACE(Print(_L("[SQL wrapper]\t Formating amount...")));
+        FormatAmountL( aRule );
+        // Finish clause    
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlSemicolon().Length() );
+        iClause->Des().Append( KCmSqlSemicolon() );     
+        }
+    else
+        {
+        FormatProperyQueryL( aField, aMedia );
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatFilteringClauseL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::FormatFilteringClauseL( 
+    CCmSqlPropertyCollector& aPropertys )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatFilteringClauseL"));    
+    
+    delete iClause;
+    iClause = NULL;
+
+    TInt count = aPropertys.PropertyContainerCount();
+
+    if( count == 1 && aPropertys.PropertyContainer( 0 )->Type() == ECmTitle)
+        {
+        //video
+        iClause = KCmSqlFilteredPropertySelectVideo().AllocL();
+        }
+    else
+        {
+        iClause = KCmSqlFilteredPropertySelect().AllocL();
+        }
+
+    FormatPropertyFilterL( aPropertys );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::ClauseL
+// ---------------------------------------------------------------------------
+//
+TDesC8& CCmSqlDbClause::ClauseL() const
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::ClauseL"));    
+    
+#ifdef _DEBUG    
+    HBufC* data16bitBuf = HBufC::NewLC(iClause->Length());
+    TPtr data16bitPtr = data16bitBuf->Des();
+       
+    TInt conversionError = 
+        CnvUtfConverter::ConvertToUnicodeFromUtf8(data16bitPtr, 
+                                                *iClause );
+    TPtrC temp;                                                
+    for( TInt i = 0; i < (data16bitPtr.Length())/100 + 1 ; i++ ) 
+        {
+        if( i == (data16bitPtr.Length())/100 )
+            {
+            temp.Set( data16bitPtr.Mid(100*i ) );
+            TRACE( Print(_L("SQL clause %S"), &temp ) ); 
+            }
+        else
+            {
+            temp.Set( data16bitPtr.Mid(100*i, 100 ) );
+            TRACE( Print(_L("SQL clause %S"), &temp ) ); 
+            }        
+        }
+    CleanupStack::PopAndDestroy( data16bitBuf );
+#endif    
+    return *iClause;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::SetDlnaProfileFilters
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::SetDlnaProfileFilters( 
+    const RArray<TInt64>& aProfileIds )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::SetDlnaProfileFilters"));    
+    
+    iProfileFilters.Reset();
+    for( TInt i = 0; i < aProfileIds.Count() ; i++ )
+        {
+        iProfileFilters.InsertInSignedKeyOrder( aProfileIds[i] );
+        }
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatMediatypeL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::FormatMediatypeL( CCmFillRule& aRule )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatMediatypeL"));    
+    
+    TBuf8<20>mediatype;
+    mediatype.Format( KCmSqlSelectMediatype, aRule.MediaType() );
+    iClause = iClause->ReAllocL( iClause->Length() + mediatype.Length() );
+    iClause->Des().Append( mediatype );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatParamsL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::FormatParamsL( CCmFillRule& aRule )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatParamsL"));    
+    
+    TCmMetadataField metadataColum;
+    TPtrC8 dataField;
+    TInt dataFieldIndex;
+    TCmOperatorType oper;
+    TInt paramCount;
+    TBool operatorAdded( EFalse );   
+    for( TInt i = 0; i < aRule.RuleCount(); i++ )
+        {
+        aRule.RuleL( i, &metadataColum, &oper, &paramCount );
+        if( paramCount )
+            {            
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlAnd().Length() + KCmSqlLeftBracket().Length()  );
+            iClause->Des().Append( KCmSqlAnd );
+            iClause->Des().Append( KCmSqlLeftBracket() );                
+            for( TInt j = 0; j < paramCount; j++ )
+                {
+                iClause = iClause->ReAllocL( iClause->Length() + 
+                    KCmSqlLeftBracket().Length() );
+                iClause->Des().Append( KCmSqlLeftBracket() );
+                              
+                FormatMetadataColumnL( metadataColum, aRule.MediaType() );
+                // Data field may change to integer value ( index to table )
+                aRule.RuleParamL( i, j, &dataField );
+                aRule.RuleParamL( i, j, dataFieldIndex );
+                
+                // If rule is free text rule, operator is already appended 
+                // into Sql clause
+                operatorAdded = EFalse;
+                if( ECmFreeText != metadataColum &&
+                    ECmArtist != metadataColum &&
+                    ECmAlbum != metadataColum &&
+                    ECmResolution != metadataColum &&
+                    ECmGenre != metadataColum && 
+                    ECmUpnpClass != metadataColum && 
+                    ECmTitle != metadataColum )
+                    {
+                    FormatOperatorL( metadataColum, oper );
+                    operatorAdded = ETrue;
+                    }
+                      
+                if( dataField.Size() && 
+                    ( iFreeText || ECmDate == metadataColum || 
+                    ECmFileSize == metadataColum || 
+                    ECmDuration == metadataColum ) )
+                    {
+                    if( ECmDate != metadataColum && 
+                        ECmFileSize != metadataColum && 
+                        ECmDuration != metadataColum )
+                        {
+                        TInt multiplier( 1 );
+                        if( aRule.MediaType() == ECmAudio && 
+                            metadataColum == ECmFreeText )
+                            {
+                            // Three fields are used in audio free text search
+                            multiplier = 3;
+                            }
+                        iFreeText = iFreeText->ReAllocL( iFreeText->Length() +
+                            ( dataField.Length() * multiplier ) );  
+                        HBufC8* temp = HBufC8::NewMaxL( iFreeText->Length() + 
+                            ( dataField.Length() * multiplier ) );
+                        // Format dataField into clause
+                        if( multiplier == 1 )
+                            {                    
+                            temp->Des().Format( *iFreeText, &dataField );
+                            }
+                        else
+                            {
+                            temp->Des().Format( *iFreeText, &dataField, 
+                                &dataField, &dataField );   
+                            } 
+                        if( iFreeText )
+                            {
+                            delete iFreeText; 
+                            iFreeText = NULL;
+                            }
+                        iClause = iClause->ReAllocL( iClause->Length() + 
+                            temp->Length() );
+                        iClause->Des().Append( *temp );
+                        delete temp;                        
+                        }
+                    else
+                        {
+                        // Date is appended in TInt64 format
+                        TLex8 lex( dataField );
+                        TInt64 num;
+                        lex.Val( num );
+                        iClause = iClause->ReAllocL( iClause->Length() + 
+                            dataField.Length() );                    
+                        iClause->Des().AppendNum( num );
+                        }            
+                    }
+                else
+                    {
+                    if( operatorAdded )
+                        {
+                        iClause = iClause->ReAllocL( iClause->Length() + 
+                            sizeof( dataFieldIndex ) );
+                            
+                        HBufC8* temp = HBufC8::NewMaxLC( iClause->Length() );
+                        temp->Des().Format( *iClause, dataFieldIndex );
+                        delete iClause;
+                        iClause = NULL;
+                        iClause = temp->AllocL();
+                        CleanupStack::PopAndDestroy( temp );
+                        }
+                    else
+                        {
+                        iClause = iClause->ReAllocL( iClause->Length() + 
+                            sizeof( dataFieldIndex ) );                    
+                        iClause->Des().AppendNum( dataFieldIndex );
+                        }      
+                    }    
+
+                iClause = iClause->ReAllocL( iClause->Length() + 
+                    KCmSqlRightBracket().Length() );
+                iClause->Des().Append( KCmSqlRightBracket() );         
+                
+                if( j < paramCount - 1 )
+                    {
+                    iClause = iClause->ReAllocL( iClause->Length() + 
+                        KCmSqlOr().Length() );
+                    iClause->Des().Append( KCmSqlOr() );            
+                    }            
+                }
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlRightBracket().Length() );
+            iClause->Des().Append( KCmSqlRightBracket() );             
+            }            
+        }      
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatDevicesL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlDbClause::FormatDevicesL( CCmFillRule& aRule )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatDevicesL"));    
+    
+    TPtrC8 mediaServer;
+    TInt msId(0);
+    if( aRule.MediaServerCount() )
+        {
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlAnd().Length() );
+        iClause->Des().Append( KCmSqlAnd() );
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlLeftBracket().Length() );
+        iClause->Des().Append( KCmSqlLeftBracket() );                
+        }
+    for( TInt k = 0; k < aRule.MediaServerCount(); k++ )
+        {
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlLeftBracket().Length() );
+        iClause->Des().Append( KCmSqlLeftBracket() );                
+        aRule.MediaServerL( k, msId );
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlSelectDeviceId().Length() + sizeof( msId ) );
+        iClause->Des().Append( KCmSqlSelectDeviceId );
+        iClause->Des().AppendNum( msId );
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlRightBracket().Length() );
+        iClause->Des().Append( KCmSqlRightBracket() );          
+        if( k < aRule.MediaServerCount() - 1 )
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlOr().Length() );
+            iClause->Des().Append( KCmSqlOr() );            
+            }
+        }
+    if( aRule.MediaServerCount() )
+        {
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlRightBracket().Length() );
+        iClause->Des().Append( KCmSqlRightBracket() );                
+        }                     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatOrderingL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::FormatOrderingL( TCmFillMethod aMethod )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatOrderingL"));    
+    
+    switch( aMethod )
+        {
+        case ECmRandom:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlOrderByRandom().Length() );
+            iClause->Des().Append( KCmSqlOrderByRandom() );              
+            break;
+            }
+        case ECmLatest:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlOrderByDate().Length() + KCmSqlDesc().Length() );
+            iClause->Des().Append( KCmSqlOrderByDate() );
+            iClause->Des().Append( KCmSqlDesc() );             
+            break;
+            }        
+        case ECmOldest:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlOrderByDate().Length() + KCmSqlAsc().Length() );
+            iClause->Des().Append( KCmSqlOrderByDate() );
+            iClause->Des().Append( KCmSqlAsc() );
+            break;
+            }        
+        default:
+            {
+            break;
+            }
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatAmountL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::FormatAmountL( CCmFillRule& aRule )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatAmountL"));    
+    
+    if( aRule.LimitType() == EPieces )
+        {
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlLimit().Length() + KCmRuleAmountSize  );
+        iClause->Des().Append( KCmSqlLimit() );
+        iClause->Des().AppendNum( aRule.Amount() );        
+        }
+    else if( aRule.LimitType() == EMbits )
+        {
+        // If amount is wanted in MBytes, no possibility to 
+        // LIMIT result set in this phase
+        }
+    else
+        {
+        // Unlimited rule
+        // Fill quota is used as a maximun amount
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatMetadataColumnL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::FormatMetadataColumnL( TCmMetadataField aField,
+    TCmMediaType aMediaType )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatMetadataColumnL"));    
+    
+    if( iFreeText )
+        {
+        delete iFreeText; iFreeText = NULL;
+        }
+    TRACE(Print(_L("[SQL wrapper]\t Formating data field = %d"), 
+        (TInt) aField ));             
+    
+    switch( aField )
+        {       
+        case ECmArtist:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlSelectArtistById().Length() );
+            iClause->Des().Append( KCmSqlSelectArtistById() );
+            break;
+            }                    
+        case ECmAlbum:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlSelectAlbumById().Length() );
+            iClause->Des().Append( KCmSqlSelectAlbumById() );            
+            break;
+            }        
+        case ECmGenre:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlSelectGenreById().Length() );
+            iClause->Des().Append( KCmSqlSelectGenreById() );               
+            break;
+            }        
+        case ECmDuration:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlSelectDuration().Length() );
+            iClause->Des().Append( KCmSqlSelectDuration() );              
+            break;
+            }        
+        case ECmTitle:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlSelectTitle().Length() );
+            iClause->Des().Append( KCmSqlSelectTitle() );
+            break;
+            }        
+        case ECmUpnpClass:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlSelectUpnpclassById().Length() );
+            iClause->Des().Append( KCmSqlSelectUpnpclassById );    
+            break;
+            }        
+        case ECmContentURI:
+            {
+            LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatMetadataColumnL \
+            aField = ECmContentURI"));
+            break;
+            }        
+        case ECmFileSize:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlSelectSize().Length() );
+            iClause->Des().Append( KCmSqlSelectSize() );            
+            break;
+            }        
+        case ECmBitrate:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlSelectBitrate().Length() );
+            iClause->Des().Append( KCmSqlSelectBitrate );    
+            break;
+            }        
+        case ECmResolution:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() +
+                KCmSqlSelectResolutionById().Length() );
+            iClause->Des().Append( KCmSqlSelectResolutionById );    
+            break;
+            }
+        case ECmDate:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() +
+                KCmSqlSelectDate().Length() );
+            iClause->Des().Append( KCmSqlSelectDate );
+            break;
+            }  
+        case ECmFreeText:
+            {
+            switch( aMediaType )
+                {
+                case ECmAudio:
+                    {
+                    // Title, Artist or album field contains specified field
+                    iFreeText = KCmSqlFreeTextSelectAudio().AllocL();
+                    break;
+                    }                
+                case ECmImage:           
+                case ECmVideo: 
+                    {
+                    // Title contains specified field
+                    iFreeText = KCmSqlFreeTextSelectImageOrVideo().AllocL();
+                    break;
+                    }
+                default:
+                    {
+                    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::\
+                    FormatMetadataColumnL mediatype not found"));                    
+                    break;
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatMetadataColumnL \
+            field not found"));
+            break;
+            }    
+        }      
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatOperatorL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::FormatOperatorL( TCmMetadataField aMetadataColum, 
+    TCmOperatorType aOper )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatOperatorL"));    
+    
+    switch( aOper )
+        {           
+        case ECmEquals:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlEqual().Length() + KCmSqlAppendString().Length() );
+            iClause->Des().Append( KCmSqlEqual() );
+            iClause->Des().Append( KCmSqlAppendInteger() );
+            break;
+            }
+        // Greater and smaller operator are always integer operators    
+        case ECmGreater:
+            {
+            if( aMetadataColum != ECmDate && aMetadataColum != ECmFileSize && 
+                aMetadataColum != ECmDuration )
+                {            
+                iClause = iClause->ReAllocL( iClause->Length() + 
+                                             KCmSqlGreater().Length() + 
+                                             KCmSqlAppendInteger().Length() );
+                iClause->Des().Append( KCmSqlGreater() );
+                iClause->Des().Append( KCmSqlAppendInteger() );
+                }
+            else
+                {
+                iClause = iClause->ReAllocL( iClause->Length() + 
+                    KCmSqlGreater().Length() + KCmSqlAppendLong().Length() );
+                iClause->Des().Append( KCmSqlGreater() );                
+                }    
+            break;
+            } 
+        case ECmSmaller:
+            {
+            if( aMetadataColum != ECmDate && aMetadataColum != ECmFileSize &&
+                aMetadataColum != ECmDuration )
+                {
+                iClause = iClause->ReAllocL( iClause->Length() + 
+                                             KCmSqlSmaller().Length() + 
+                                             KCmSqlAppendInteger().Length() );
+                iClause->Des().Append( KCmSqlSmaller() );
+                iClause->Des().Append( KCmSqlAppendInteger() );
+                }
+            else
+                {
+                iClause = iClause->ReAllocL( iClause->Length() + 
+                    KCmSqlSmaller().Length() + KCmSqlAppendLong().Length() );
+                iClause->Des().Append( KCmSqlSmaller() );               
+                }                  
+            break;
+            } 
+        case ECmConsistOf:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlLike().Length() + KCmSqlConsistOf().Length() );
+            iClause->Des().Append( KCmSqlLike() );
+            iClause->Des().Append( KCmSqlConsistOf() );             
+            break;
+            } 
+        case ECmBeginsWith:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlLike().Length() + KCmSqlBeginsWith().Length() );
+            iClause->Des().Append( KCmSqlLike() );
+            iClause->Des().Append( KCmSqlBeginsWith() );              
+            break;
+            }
+        case ECmEndsWith:
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlLike().Length() + KCmSqlEndsWith().Length() );
+            iClause->Des().Append( KCmSqlLike() );
+            iClause->Des().Append( KCmSqlEndsWith() );              
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatProperyQueryL
+// ---------------------------------------------------------------------------
+//     
+void CCmSqlDbClause::FormatProperyQueryL( TCmMetadataField aField,
+    TCmMediaType aMedia )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatProperyQueryL"));    
+    
+    if( iClause )
+        {
+        delete iClause;
+        iClause = NULL;
+        }
+    
+    switch( aField )
+        {
+        case ECmArtist:
+            {           
+            iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + 
+                KCmSqlArtist().Length() );
+            TPtr8 ptr( iClause->Des() );    
+            ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlArtist );
+            break;
+            }        
+        case ECmAlbum:
+            {
+            iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + 
+                KCmSqlAlbum().Length() );
+            TPtr8 ptr( iClause->Des() );    
+            ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlAlbum );           
+            break;
+            }        
+        case ECmGenre:
+            {
+            iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + 
+                KCmSqlGenre().Length() );
+            TPtr8 ptr( iClause->Des() );    
+            ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlGenre );
+            break;
+            }        
+        case ECmUpnpClass:
+            {
+            iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + 
+                KCmSqlUpnpclass().Length() );
+            TPtr8 ptr( iClause->Des() );    
+            ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlUpnpclass );
+            break;
+            }
+        case ECmTitle:
+            {           
+            iClause = HBufC8::NewL( KCmSqlSelectTitleAndId().Length() + 
+                sizeof( aMedia ) );
+            TPtr8 ptr( iClause->Des() );    
+            ptr.Format( KCmSqlSelectTitleAndId, aMedia );                 
+            break;
+            }
+        case ECmResolution:
+            {
+            iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + 
+                KCmSqlResolutions().Length() );
+            TPtr8 ptr( iClause->Des() );    
+            ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlResolutions );
+            break;
+            }
+        case ECmProfileId:
+            {
+            iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + 
+                KCmSqlResolutions().Length() );
+            TPtr8 ptr( iClause->Des() );    
+            ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlUpnpProfiles );
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatProfileFiltersL
+// ---------------------------------------------------------------------------
+//     
+void CCmSqlDbClause::FormatProfileFiltersL(  )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatProfileFiltersL"));    
+    
+    if( iProfileFilters.Count() )
+        {
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlAnd().Length() );
+        iClause->Des().Append( KCmSqlAnd() );
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlLeftBracket().Length() );
+        iClause->Des().Append( KCmSqlLeftBracket() );                
+        }
+    for( TInt k = 0; k < iProfileFilters.Count(); k++ )
+        {
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlLeftBracket().Length() );
+        iClause->Des().Append( KCmSqlLeftBracket() );                
+
+        iClause = iClause->ReAllocL( iClause->Length() + 
+                                     KCmSqlFilterUpnpProfileId().Length() + 
+                                     sizeof( iProfileFilters[k] ) );
+        iClause->Des().Append( KCmSqlFilterUpnpProfileId );
+        iClause->Des().AppendNum( iProfileFilters[k] );
+        
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlRightBracket().Length() );
+        iClause->Des().Append( KCmSqlRightBracket() );          
+        if( k < iProfileFilters.Count() - 1 )
+            {
+            iClause = iClause->ReAllocL( iClause->Length() + 
+                KCmSqlAnd().Length() );
+            iClause->Des().Append( KCmSqlAnd() );            
+            }
+        }
+    if( iProfileFilters.Count() )
+        {
+        iClause = iClause->ReAllocL( iClause->Length() + 
+            KCmSqlRightBracket().Length() );
+        iClause->Des().Append( KCmSqlRightBracket() );                
+        }
+    iClause = iClause->ReAllocL( iClause->Length() + 
+        KCmSqlRightBracket().Length() );
+    iClause->Des().Append( KCmSqlRightBracket() );          
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::FormatPropertyFilterL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::FormatPropertyFilterL( 
+    CCmSqlPropertyCollector& aPropertys )
+    {    
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatPropertyFilterL"));    
+    
+    CCmSqlPropertyContainer* container = NULL;
+    HBufC8* temp = NULL;   
+    for( TInt i = 0; i < aPropertys.PropertyContainerCount(); i++ )
+        {
+        container = aPropertys.PropertyContainer( i );        
+        switch( container->Type() )
+            {
+            case ECmTitle:
+                {
+                AddPropertyFilterL( *container, 
+                    KCmSqlSelectTitle(), temp );                   
+                break;
+                }
+            case ECmArtist:
+                {
+                AddPropertyFilterL( *container, 
+                    KCmSqlSelectArtistById(), temp );                               
+                break;
+                }
+            case ECmAlbum:
+                {
+                AddPropertyFilterL( *container, 
+                    KCmSqlSelectAlbumById(), temp );                                
+                break;
+                }
+            case ECmGenre:
+                {
+                AddPropertyFilterL( *container, 
+                    KCmSqlSelectGenreById(), temp );
+                break;
+                }
+            default:
+                {
+                break;
+                }                                                                
+            }
+        container = NULL;
+        }
+    
+    if( temp )
+        {
+        iClause = iClause->ReAllocL( iClause->Length() + temp->Length() );
+        iClause->Des().Append( *temp );
+        delete temp;        
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbClause::AddPropertyFilterL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbClause::AddPropertyFilterL( 
+    CCmSqlPropertyContainer& aContainer, const TDesC8& aField, 
+    HBufC8*& aClause )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::AddPropertyFilterL"));    
+    
+    if( aClause && aContainer.PropertyItemCount() )
+        {
+        aClause = aClause->ReAllocL( aClause->Length() + 
+            KCmSqlAnd().Length() + ( 2 * KCmSqlSpace().Length() ) );
+        aClause->Des().Append( KCmSqlSpace() );
+        aClause->Des().Append( KCmSqlAnd() );
+        aClause->Des().Append( KCmSqlSpace() );                       
+        }
+    if( aContainer.PropertyItemCount() && !aClause )
+        {
+        aClause = KCmSqlAnd().AllocL();
+        }
+    if( aContainer.PropertyItemCount() && aClause )
+        {
+        aClause = aClause->ReAllocL( aClause->Length() +
+        		KCmSqlLeftBracket().Length() );
+        aClause->Des().Append( KCmSqlLeftBracket );
+        
+        for( TInt j = 0; j < aContainer.PropertyItemCount() ; j++ )
+            {
+            aClause = aClause->ReAllocL( aClause->Length() + 
+                KCmSqlSelectTitle().Length() + 
+                sizeof( aContainer.PropertyItem( j )->Id() ) );
+            aClause->Des().Append( aField );
+            aClause->Des().AppendNum( 
+                aContainer.PropertyItem( j )->Id() );
+           if( j < aContainer.PropertyItemCount() - 1 )
+                {
+                aClause = aClause->ReAllocL( aClause->Length() + 
+                    KCmSqlOr().Length() + ( 2 * KCmSqlSpace().Length() ) );
+                aClause->Des().Append( KCmSqlSpace() );
+                aClause->Des().Append( KCmSqlOr() );
+                aClause->Des().Append( KCmSqlSpace() );             
+                }                                                         
+            }
+        
+        aClause = aClause->ReAllocL( aClause->Length() +
+        		KCmSqlRightBracket().Length() );
+        aClause->Des().Append( KCmSqlRightBracket );
+        
+        for( TInt k = 0; k < aContainer.PropertyItemCount() ; k++ )
+            {                        
+            aContainer.DeletePropertyItem( k );
+            k--;
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmSqlDbClause::CCmSqlDbClause()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::CCmSqlDbClause"));    
+    }
+ 
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//   
+void CCmSqlDbClause::ConstructL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::ConstructL"));    
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/src/cmsqldbmaintenance.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQL database maintenance class
+*
+*/
+
+
+
+
+
+
+#include "cmsqldbmaintenance.h"
+#include "cmsqlconnection.h"
+#include "cmsqlmaintenanceclauses.h"
+#include "msdebug.h" 
+
+// Constants
+_LIT(KCmSqlDatabase, "C:\\System\\Data\\MediaServant\\cmmetadatacache.sq");
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::NewL
+// ---------------------------------------------------------------------------
+//
+CCmSqlDbMaintenance* CCmSqlDbMaintenance::NewL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::NewL"));
+        
+    CCmSqlDbMaintenance* self = CCmSqlDbMaintenance::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmSqlDbMaintenance* CCmSqlDbMaintenance::NewLC()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::NewLC"));   
+    
+    CCmSqlDbMaintenance* self = new ( ELeave ) CCmSqlDbMaintenance();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::~CCmSqlDbMaintenance
+// ---------------------------------------------------------------------------
+//
+CCmSqlDbMaintenance::~CCmSqlDbMaintenance()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::~CCmSqlDbMaintenance"));   
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::InitConnection
+// ---------------------------------------------------------------------------
+//
+TInt CCmSqlDbMaintenance::InitConnection(
+    CCmSqlConnection& aConnection )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::InitConnection"));   
+    
+    return aConnection.OpenDb( KCmSqlDatabase );   
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::CloseConnection
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbMaintenance::CloseConnection(
+    CCmSqlConnection& aConnection )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CloseConnection"));   
+    
+    aConnection.CloseDb();        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::CreateDbFile
+// ---------------------------------------------------------------------------
+//
+TInt CCmSqlDbMaintenance::CreateDbFile( CCmSqlConnection& aConnection )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CreateDbFile"));   
+    
+    return aConnection.CreateDbFile( KCmSqlDatabase );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::CreateDb
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbMaintenance::CreateDb( 
+    CCmSqlConnection& aConnection )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CreateDb"));
+    LOG(_L("[SQL wrapper]\t Dropping tables..."));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropArtists ));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropGenres ));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropAlbums ));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropResolutions ));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropUpnpProfiles ));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropUpnpClasses ));  
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropResources ));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItems ));
+           
+    LOG(_L("[SQL wrapper]\t Creating tables..."));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateArtists ) );    
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateGenres ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateAlbums ) );      
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateResolutions ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateUpnpProfiles ) ); 
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateUpnpclasses ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateResources ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItems ) );     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::CreateIndexes
+// ---------------------------------------------------------------------------
+//
+void CCmSqlDbMaintenance::CreateIndexes( 
+    CCmSqlConnection& aConnection )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CreateIndexes"));
+    
+    LOG(_L("[SQL wrapper]\t Dropping indexes..."));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemsIdIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemTitleIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemArtistIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemAlbumIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemGenreIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemUpnpclassIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemResolutionIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemDateIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemHarvestDateIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemUpnpProfileIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemMediatypeIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropAlbumIdIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropArtistIdIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropGenreIdIndex ) );
+    
+    LOG(_L("[SQL wrapper]\t Creating indexes..."));
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemsIdIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemTitleIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemArtistIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemAlbumIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemGenreIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemUpnpclassIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemResolutionIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemDateIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemHarvestDateIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemUpnpProfileIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemMediatypeIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateAlbumIdIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateArtistIdIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateGenreIdIndex ) );
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::CCmSqlDbMaintenance
+// ---------------------------------------------------------------------------
+//    
+CCmSqlDbMaintenance::CCmSqlDbMaintenance()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CCmSqlDbMaintenance"));
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmSqlDbMaintenance::ConstructL
+// ---------------------------------------------------------------------------
+//   
+void CCmSqlDbMaintenance::ConstructL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::ConstructL"));
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/src/cmsqlmain.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,325 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main class in the SQL Wrapper component
+*
+*/
+
+
+
+
+
+
+#include <bautils.h>
+#include "cmsqlconnection.h"
+#include "cmsqldbmaintenance.h"
+#include "cmsqldbclause.h"
+#include "cmsqlmain.h"
+#include "msdebug.h"
+
+// CONSTANTS
+_LIT(KCmSqlDirC, "C:\\System\\Data\\MediaServant\\");
+ 
+// ---------------------------------------------------------------------------
+// CCmSqlMain::NewL
+// ---------------------------------------------------------------------------
+//
+CCmSqlMain* CCmSqlMain::NewL( RFs& aFs )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::NewL"));    
+    CCmSqlMain* self = CCmSqlMain::NewLC( aFs );
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmSqlMain::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmSqlMain* CCmSqlMain::NewLC( RFs& aFs )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::NewLC"));
+    CCmSqlMain* self = new ( ELeave ) CCmSqlMain( aFs );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::~CCmSqlMain
+// ---------------------------------------------------------------------------
+//
+CCmSqlMain::~CCmSqlMain()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::~CCmSqlMain"));
+    delete iClause;
+    delete iMaintenance;
+    delete iConnection;   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::CancelAsyncOperation
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::CancelAsyncOperation()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::CancelAsyncOperation"));
+    
+    iConnection->CancelAsyncOperation();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::SetMsId
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::SetMsId( TUint aId )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::SetMsId"));
+    
+    iConnection->SetMsId( aId );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::SetQuota
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::SetQuota( TInt64 aQuota )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::SetQuota"));
+    
+    iConnection->SetQuota( aQuota );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::SetDlnaProfileFilters
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::SetDlnaProfileFilters( 
+    const RArray<TInt64>& aProfileIds )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::SetDlnaProfileFilters"));
+    
+    iClause->SetDlnaProfileFilters( aProfileIds );
+    }
+            
+// ---------------------------------------------------------------------------
+// CCmSqlMain::AsyncBatchAdd
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::AsyncBatchAdd( 
+    RPointerArray<CCmSqlGenericItem>& aItems, TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::AsyncBatchAdd"));
+    
+    iConnection->AsyncBatchAdd( aItems, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::AsyncBatchAddPropertyItems
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::AsyncBatchAddPropertyItems( 
+    RPointerArray<CCmSqlPropertyItem>& aItems, TCmMetadataField aField,
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::AsyncBatchAddPropertyItems"));
+    
+    iConnection->AsyncBatchAddPropertyItems( aItems, aField, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::SyncAddPropertyItemL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::SyncAddPropertyItemL( 
+    CCmSqlPropertyItem& aItem, TCmMetadataField aField )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::SyncAddPropertyItemL"));
+    
+    iConnection->SyncAddPropertyItemL( aItem, aField );
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmSqlMain::AsyncBatchDelete
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlMain::AsyncBatchDelete( 
+    RPointerArray<CCmSqlBaseItem>& aItems, 
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::AsyncBatchDelete"));
+    
+    iConnection->AsyncBatchDelete( aItems, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::AsyncMetadataDelete
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlMain::AsyncMetadataDelete( 
+    RArray<TInt>& aMsIds, TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::AsyncMetadataDelete"));
+    
+    iConnection->AsyncMetadataDelete( aMsIds, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::DeleteOldestMediaItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::DeleteOldestMediaItemsL( TCmMediaType aType, 
+    TInt64 aCount )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::DeleteOldestMediaItemsL"));
+    
+    iConnection->DeleteOldestMediaItemsL( aType, aCount );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::DeleteUnusedPropertys
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::DeleteUnusedPropertys( )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::DeleteUnusedPropertys"));
+    
+    iConnection->DeleteUnusedPropertys( );
+    }
+            
+// ---------------------------------------------------------------------------
+// CCmSqlMain::GetItemsL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlMain::GetItemsL( RPointerArray<CCmSqlBaseItem>& aItems,
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetItemsL"));
+    
+    iConnection->GetItemsL( aItems, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::GetFillItemsL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlMain::GetFillItemsL( 
+    RPointerArray<CCmFillListItem>& aItems, CCmFillRule& aRule, 
+    TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetFillItemsL"));
+    
+    iClause->FormatClauseL( aRule );
+    iConnection->GetFillItemsL( aItems, iClause->ClauseL(), aRule, aStatus );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlMain::GetPropertyValuesL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlMain::GetPropertyValuesL( 
+    RPointerArray<CCmSqlPropertyItem>& aItems, TRequestStatus& aStatus,
+    TCmMetadataField aField, TCmMediaType aMedia )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetPropertyValuesL"));
+    
+    CCmFillRule* rule = NULL;
+    iClause->FormatClauseL( *rule, aField, aMedia );
+    iConnection->GetPropertyValuesL( aItems, iClause->ClauseL(), 
+                                      aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::GetFilteredPropertyValuesL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlMain::GetFilteredPropertyValuesL( 
+    CCmSqlPropertyCollector& aPropertys, TRequestStatus& aStatus )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetFilteredPropertyValuesL"));
+    
+    iClause->FormatFilteringClauseL( aPropertys );
+    iConnection->GetFilteredPropertyValuesL( aPropertys, iClause->ClauseL(), 
+                                      aStatus );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmSqlMain::GetMediaCountL
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::GetMediaCountL( TInt64& aCount, 
+    TCmMediaType aType )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetMediaCountL"));
+    
+    iConnection->GetMediaCountL( aCount, aType );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::Exists
+// ---------------------------------------------------------------------------
+//   
+TBool CCmSqlMain::ExistsL( const CCmBaseListItem& aItem, 
+    const TInt aDevId )    
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::ExistsL"));
+    
+    return iConnection->ExistsL( aItem, aDevId );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::Close
+// ---------------------------------------------------------------------------
+//
+void CCmSqlMain::Close()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::Close"));
+    
+    delete this;
+	}
+    
+// ---------------------------------------------------------------------------
+// CCmSqlMain::CCmSqlMain
+// ---------------------------------------------------------------------------
+//    
+CCmSqlMain::CCmSqlMain( RFs& aFs ): iFs( aFs )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::CCmSqlMain"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmSqlMain::ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmSqlMain::ConstructL()
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMain::ConstructL"));
+    
+    TRAP_IGNORE( BaflUtils::EnsurePathExistsL( iFs, KCmSqlDirC ) );   
+    iClause = CCmSqlDbClause::NewL();
+    iMaintenance = CCmSqlDbMaintenance::NewL();
+    iConnection = CCmSqlConnection::NewL();
+    
+    if( iMaintenance->InitConnection(*iConnection) )
+        {
+        iMaintenance->CreateDbFile( *iConnection );
+        }
+    if( !iConnection->Validate() )
+        {
+        iMaintenance->CreateDb( *iConnection );
+        iMaintenance->CreateIndexes( *iConnection );        
+        }        
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/cmsqlwrapper/src/cmsqlmainfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      The factory for CCmSqlMain
+*
+*/
+
+
+
+
+
+
+#include "cmsqlmainfactory.h"
+#include "cmsqlmain.h"
+#include "mcmsqlmain.h"
+#include "msdebug.h"
+
+// --------------------------------------------------------------------------
+// CCmSqlMainFactory::NewCmSqlMainL
+// --------------------------------------------------------------------------
+//
+EXPORT_C MCmSqlMain* CCmSqlMainFactory::NewCmSqlMainL( RFs& aFs )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMainFactory::NewCmSqlMainL"));
+    
+    return CCmSqlMain::NewL( aFs );
+    }
+
+// --------------------------------------------------------------------------
+// CCmSqlMainFactory::NewCmSqlMainL
+// --------------------------------------------------------------------------
+//    
+EXPORT_C MCmSqlMain* CCmSqlMainFactory::NewCmSqlMainLC( RFs& aFs )
+    {
+    LOG(_L("[SQL Wrapper]\t CCmSqlMainFactory::NewCmSqlMainLC"));
+    
+    return CCmSqlMain::NewLC( aFs );
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/bwins/cmdatabasemanageru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,83 @@
+EXPORTS
+	?IncrementShrinkTimeL@CCmDmMain@@QAEHHH@Z @ 1 NONAME ; int CCmDmMain::IncrementShrinkTimeL(int, int)
+	?QueryFillFileListL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmBaseListItem@@@@ABVTDesC8@@I@Z @ 2 NONAME ; int CCmDmMain::QueryFillFileListL(class RPointerArray<class CCmBaseListItem> &, class TDesC8 const &, unsigned int)
+	?UpdateFillTransferStatus@CCmDmMain@@QAEXIPAVCCmFillListItem@@@Z @ 3 NONAME ; void CCmDmMain::UpdateFillTransferStatus(unsigned int, class CCmFillListItem *)
+	?GetFillFileCount@CCmDmMain@@QAEHABVTDesC8@@IAAH@Z @ 4 NONAME ; int CCmDmMain::GetFillFileCount(class TDesC8 const &, unsigned int, int &)
+	?NewLC@CCmDmMain@@SAPAV1@XZ @ 5 NONAME ; class CCmDmMain * CCmDmMain::NewLC(void)
+	?SetMediaServersL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmMediaServerFull@@@@@Z @ 6 NONAME ; int CCmDmMain::SetMediaServersL(class RPointerArray<class CCmMediaServerFull> &)
+	?UpdateTransferInfo@CCmDmMain@@QAEHW4TCmService@@HH@Z @ 7 NONAME ; int CCmDmMain::UpdateTransferInfo(enum TCmService, int, int)
+	?QueryMediaServerL@CCmDmMain@@QAEHPAVCCmMediaServerFull@@@Z @ 8 NONAME ; int CCmDmMain::QueryMediaServerL(class CCmMediaServerFull *)
+	?UpdateFillListDriveStatusesL@CCmDmMain@@QAEXPAVCCmDriveInfo@@0H@Z @ 9 NONAME ; void CCmDmMain::UpdateFillListDriveStatusesL(class CCmDriveInfo *, class CCmDriveInfo *, int)
+	?SetDrivesL@CCmDmMain@@QAEXAAV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 10 NONAME ; void CCmDmMain::SetDrivesL(class RPointerArray<class CCmDriveInfo> &)
+	?UpdateDownloadHistory@CCmDmMain@@QAEHIAA_J0@Z @ 11 NONAME ; int CCmDmMain::UpdateDownloadHistory(unsigned int, long long &, long long &)
+	?QueryFillRuleL@CCmDmMain@@QAEHPAVCCmFillRule@@@Z @ 12 NONAME ; int CCmDmMain::QueryFillRuleL(class CCmFillRule *)
+	??1CCmDmMain@@UAE@XZ @ 13 NONAME ; CCmDmMain::~CCmDmMain(void)
+	?SetFillListRealCountAndSizeL@CCmDmMain@@QAEX_J00@Z @ 14 NONAME ; void CCmDmMain::SetFillListRealCountAndSizeL(long long, long long, long long)
+	?AddMediaServerL@CCmDmMain@@QAEHPAVCCmMediaServerFull@@@Z @ 15 NONAME ; int CCmDmMain::AddMediaServerL(class CCmMediaServerFull *)
+	?KBytesToBeFilled@CCmDmMain@@QAE_JEI@Z @ 16 NONAME ; long long CCmDmMain::KBytesToBeFilled(unsigned char, unsigned int)
+	?UpdateFillRuleSelected@CCmDmMain@@QAEHABVTDesC8@@H@Z @ 17 NONAME ; int CCmDmMain::UpdateFillRuleSelected(class TDesC8 const &, int)
+	?SetProgressInfo@CCmDmMain@@QAEHHH@Z @ 18 NONAME ; int CCmDmMain::SetProgressInfo(int, int)
+	?BytesFilled@CCmDmMain@@QAE_JI@Z @ 19 NONAME ; long long CCmDmMain::BytesFilled(unsigned int)
+	?FillFileCount@CCmDmMain@@QAEHI@Z @ 20 NONAME ; int CCmDmMain::FillFileCount(unsigned int)
+	?QuerySelectedFillRuleNamesL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC8@@@@H@Z @ 21 NONAME ; void CCmDmMain::QuerySelectedFillRuleNamesL(class RPointerArray<class HBufC8> &, int)
+	?QueryHashValuesL@CCmDmMain@@QAEHHAAV?$RPointerArray@VCCmSearchResponseHash@@@@@Z @ 22 NONAME ; int CCmDmMain::QueryHashValuesL(int, class RPointerArray<class CCmSearchResponseHash> &)
+	?NewL@CCmDmMain@@SAPAV1@XZ @ 23 NONAME ; class CCmDmMain * CCmDmMain::NewL(void)
+	?AddStoredL@CCmDmMain@@QAEHABVTDesC16@@ABVTDesC8@@VTTime@@@Z @ 24 NONAME ; int CCmDmMain::AddStoredL(class TDesC16 const &, class TDesC8 const &, class TTime)
+	?DeleteAllStoreRules@CCmDmMain@@QAEHXZ @ 25 NONAME ; int CCmDmMain::DeleteAllStoreRules(void)
+	?DeleteStoreFiles@CCmDmMain@@QAEHXZ @ 26 NONAME ; int CCmDmMain::DeleteStoreFiles(void)
+	?GetSyncTime@CCmDmMain@@QAEHAAVTTime@@@Z @ 27 NONAME ; int CCmDmMain::GetSyncTime(class TTime &)
+	?QueryAllStoreFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmStoreListItem@@@@@Z @ 28 NONAME ; int CCmDmMain::QueryAllStoreFilesL(class RPointerArray<class CCmStoreListItem> &)
+	?QueryStoreRuleL@CCmDmMain@@QAEHPAVCCmStoreRule@@@Z @ 29 NONAME ; int CCmDmMain::QueryStoreRuleL(class CCmStoreRule *)
+	?DeleteFillFiles@CCmDmMain@@QAEHXZ @ 30 NONAME ; int CCmDmMain::DeleteFillFiles(void)
+	?QueryMediaServerId@CCmDmMain@@QAE_JABVTDesC8@@@Z @ 31 NONAME ; long long CCmDmMain::QueryMediaServerId(class TDesC8 const &)
+	?GetStoreFileCountNoDuplicatesL@CCmDmMain@@QAEXAAHI@Z @ 32 NONAME ; void CCmDmMain::GetStoreFileCountNoDuplicatesL(int &, unsigned int)
+	?QuerySelectedStoreRuleNamesL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC8@@@@H@Z @ 33 NONAME ; void CCmDmMain::QuerySelectedStoreRuleNamesL(class RPointerArray<class HBufC8> &, int)
+	?AddHashValue@CCmDmMain@@QAEH_JPAVCCmSearchResponseHash@@@Z @ 34 NONAME ; int CCmDmMain::AddHashValue(long long, class CCmSearchResponseHash *)
+	?QueryStoredRowL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC16@@@@ABVTDesC8@@H@Z @ 35 NONAME ; void CCmDmMain::QueryStoredRowL(class RPointerArray<class HBufC16> &, class TDesC8 const &, int)
+	?PrepareQueryCmdL@CCmDmMain@@QAEXW4TCMQueryCmdType@@@Z @ 36 NONAME ; void CCmDmMain::PrepareQueryCmdL(enum TCMQueryCmdType)
+	?DeleteItemsByFillListId@CCmDmMain@@QAEHH@Z @ 37 NONAME ; int CCmDmMain::DeleteItemsByFillListId(int)
+	?QueryStoreRuleNamesL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC8@@@@@Z @ 38 NONAME ; void CCmDmMain::QueryStoreRuleNamesL(class RPointerArray<class HBufC8> &)
+	?UpdateFillListItemPriority@CCmDmMain@@QAEHPAVCCmFillRuleContainer@@@Z @ 39 NONAME ; int CCmDmMain::UpdateFillListItemPriority(class CCmFillRuleContainer *)
+	?GetLowPriorityFilledFilesL@CCmDmMain@@QAEHHAAV?$RPointerArray@VCCmFillListItem@@@@@Z @ 40 NONAME ; int CCmDmMain::GetLowPriorityFilledFilesL(int, class RPointerArray<class CCmFillListItem> &)
+	?DeleteAllFillRules@CCmDmMain@@QAEHXZ @ 41 NONAME ; int CCmDmMain::DeleteAllFillRules(void)
+	?NewLC@CCmDmSqlDbMaintenance@@SAPAV1@XZ @ 42 NONAME ; class CCmDmSqlDbMaintenance * CCmDmSqlDbMaintenance::NewLC(void)
+	?UpdateFillRuleGroupInfo@CCmDmMain@@QAEHXZ @ 43 NONAME ; int CCmDmMain::UpdateFillRuleGroupInfo(void)
+	?QueryDeletedItemsListsL@CCmDmMain@@QAEXAAV?$RPointerArray@VCCmBaseListItem@@@@I@Z @ 44 NONAME ; void CCmDmMain::QueryDeletedItemsListsL(class RPointerArray<class CCmBaseListItem> &, unsigned int)
+	?ListSize@CCmDmMain@@QAE_JW4TCmRuleType@@ABVTDesC8@@I@Z @ 45 NONAME ; long long CCmDmMain::ListSize(enum TCmRuleType, class TDesC8 const &, unsigned int)
+	?GetTransferInfo@CCmDmMain@@QAEHW4TCmService@@AAH1@Z @ 46 NONAME ; int CCmDmMain::GetTransferInfo(enum TCmService, int &, int &)
+	?QueryDrivesL@CCmDmMain@@QAEXAAV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 47 NONAME ; void CCmDmMain::QueryDrivesL(class RPointerArray<class CCmDriveInfo> &)
+	?SetStoreFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmStoreListItem@@@@@Z @ 48 NONAME ; int CCmDmMain::SetStoreFilesL(class RPointerArray<class CCmStoreListItem> &)
+	?GetMediaServersL@CCmDmMain@@QAEXAAV?$RPointerArray@VCCmMediaServerFull@@@@@Z @ 49 NONAME ; void CCmDmMain::GetMediaServersL(class RPointerArray<class CCmMediaServerFull> &)
+	?QueryAllFillFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmFillListItem@@@@@Z @ 50 NONAME ; int CCmDmMain::QueryAllFillFilesL(class RPointerArray<class CCmFillListItem> &)
+	?QueryStoreFileListL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmBaseListItem@@@@ABVTDesC8@@I@Z @ 51 NONAME ; int CCmDmMain::QueryStoreFileListL(class RPointerArray<class CCmBaseListItem> &, class TDesC8 const &, unsigned int)
+	?UpdateMediaServerInfo@CCmDmMain@@QAEHPAVCCmMediaServerFull@@@Z @ 52 NONAME ; int CCmDmMain::UpdateMediaServerInfo(class CCmMediaServerFull *)
+	?DeleteMediaServer@CCmDmMain@@QAEHABVTDesC8@@@Z @ 53 NONAME ; int CCmDmMain::DeleteMediaServer(class TDesC8 const &)
+	?UpdateUploadHistory@CCmDmMain@@QAEHIAA_J0@Z @ 54 NONAME ; int CCmDmMain::UpdateUploadHistory(unsigned int, long long &, long long &)
+	?AddStoreFile@CCmDmMain@@QAEHAAVCCmStoreListItem@@@Z @ 55 NONAME ; int CCmDmMain::AddStoreFile(class CCmStoreListItem &)
+	?GetAllStoreFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmStoreListItem@@@@I@Z @ 56 NONAME ; int CCmDmMain::GetAllStoreFilesL(class RPointerArray<class CCmStoreListItem> &, unsigned int)
+	?SetFillListStateL@CCmDmMain@@QAEXIW4TCmFillRuleStatus@@@Z @ 57 NONAME ; void CCmDmMain::SetFillListStateL(unsigned int, enum TCmFillRuleStatus)
+	?DeleteHashValuesL@CCmDmMain@@QAEXHH@Z @ 58 NONAME ; void CCmDmMain::DeleteHashValuesL(int, int)
+	?DeleteDeletedMediaServersL@CCmDmMain@@QAEXXZ @ 59 NONAME ; void CCmDmMain::DeleteDeletedMediaServersL(void)
+	?GetProgressInfo@CCmDmMain@@QAEHAAH0@Z @ 60 NONAME ; int CCmDmMain::GetProgressInfo(int &, int &)
+	?StoreFileCount@CCmDmMain@@QAEHI@Z @ 61 NONAME ; int CCmDmMain::StoreFileCount(unsigned int)
+	?GetFillListNameL@CCmDmMain@@QAEXAAPAVHBufC8@@_J@Z @ 62 NONAME ; void CCmDmMain::GetFillListNameL(class HBufC8 * &, long long)
+	?QueryAllMediaServersL@CCmDmMain@@QAEHPAVCCmMediaServerFull@@@Z @ 63 NONAME ; int CCmDmMain::QueryAllMediaServersL(class CCmMediaServerFull *)
+	?DeleteDeletedItemsL@CCmDmMain@@QAEXXZ @ 64 NONAME ; void CCmDmMain::DeleteDeletedItemsL(void)
+	?QueryFillRuleNamesL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC8@@@@@Z @ 65 NONAME ; void CCmDmMain::QueryFillRuleNamesL(class RPointerArray<class HBufC8> &)
+	?UpdateStoreTransferStatus@CCmDmMain@@QAEXI_J0@Z @ 66 NONAME ; void CCmDmMain::UpdateStoreTransferStatus(unsigned int, long long, long long)
+	?GetStoreFileCount@CCmDmMain@@QAEHABVTDesC8@@IAAH@Z @ 67 NONAME ; int CCmDmMain::GetStoreFileCount(class TDesC8 const &, unsigned int, int &)
+	?DeleteFillRuleByName@CCmDmMain@@QAEHABVTDesC8@@@Z @ 68 NONAME ; int CCmDmMain::DeleteFillRuleByName(class TDesC8 const &)
+	?SetSyncTime@CCmDmMain@@QAEHXZ @ 69 NONAME ; int CCmDmMain::SetSyncTime(void)
+	?AddStoreRuleL@CCmDmMain@@QAEHPAVCCmStoreRule@@@Z @ 70 NONAME ; int CCmDmMain::AddStoreRuleL(class CCmStoreRule *)
+	?GetAvgImageShrinkTime@CCmDmMain@@QAEHXZ @ 71 NONAME ; int CCmDmMain::GetAvgImageShrinkTime(void)
+	?KBytesToBeStored@CCmDmMain@@QAE_JEI@Z @ 72 NONAME ; long long CCmDmMain::KBytesToBeStored(unsigned char, unsigned int)
+	?NewL@CCmDmSqlDbMaintenance@@SAPAV1@XZ @ 73 NONAME ; class CCmDmSqlDbMaintenance * CCmDmSqlDbMaintenance::NewL(void)
+	?QueryMediaServerUdn@CCmDmMain@@QAEHAAPAVHBufC8@@J@Z @ 74 NONAME ; int CCmDmMain::QueryMediaServerUdn(class HBufC8 * &, long)
+	?RestoreFileStatusesL@CCmDmMain@@QAEXABV?$RPointerArray@VCCmFillListItem@@@@ABVTDesC8@@@Z @ 75 NONAME ; void CCmDmMain::RestoreFileStatusesL(class RPointerArray<class CCmFillListItem> const &, class TDesC8 const &)
+	?SetFillFiles@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmFillListItem@@@@@Z @ 76 NONAME ; int CCmDmMain::SetFillFiles(class RPointerArray<class CCmFillListItem> &)
+	?UpdateStatusValues@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmBaseListItem@@@@@Z @ 77 NONAME ; int CCmDmMain::UpdateStatusValues(class RPointerArray<class CCmBaseListItem> &)
+	?GetAllFillFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmFillListItem@@@@I@Z @ 78 NONAME ; int CCmDmMain::GetAllFillFilesL(class RPointerArray<class CCmFillListItem> &, unsigned int)
+	?StoreFileCountNoDuplicates@CCmDmMain@@QAEHXZ @ 79 NONAME ; int CCmDmMain::StoreFileCountNoDuplicates(void)
+	?AddFillRuleL@CCmDmMain@@QAEHPAVCCmFillRule@@@Z @ 80 NONAME ; int CCmDmMain::AddFillRuleL(class CCmFillRule *)
+	?QueryTransferHistory@CCmDmMain@@QAEXABVTDesC8@@AA_J111@Z @ 81 NONAME ; void CCmDmMain::QueryTransferHistory(class TDesC8 const &, long long &, long long &, long long &, long long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/eabi/cmdatabasemanageru.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,87 @@
+EXPORTS
+	_ZN9CCmDmMain10AddStoredLERK7TDesC16RK6TDesC85TTime @ 1 NONAME
+	_ZN9CCmDmMain10SetDrivesLER13RPointerArrayI12CCmDriveInfoE @ 2 NONAME
+	_ZN9CCmDmMain11BytesFilledEj @ 3 NONAME
+	_ZN9CCmDmMain11GetSyncTimeER5TTime @ 4 NONAME
+	_ZN9CCmDmMain11SetSyncTimeEv @ 5 NONAME
+	_ZN9CCmDmMain12AddFillRuleLEP11CCmFillRule @ 6 NONAME
+	_ZN9CCmDmMain12AddHashValueExP21CCmSearchResponseHash @ 7 NONAME
+	_ZN9CCmDmMain12AddStoreFileER16CCmStoreListItem @ 8 NONAME
+	_ZN9CCmDmMain12QueryDrivesLER13RPointerArrayI12CCmDriveInfoE @ 9 NONAME
+	_ZN9CCmDmMain12SetFillFilesER13RPointerArrayI15CCmFillListItemE @ 10 NONAME
+	_ZN9CCmDmMain13AddStoreRuleLEP12CCmStoreRule @ 11 NONAME
+	_ZN9CCmDmMain13FillFileCountEj @ 12 NONAME
+	_ZN9CCmDmMain14QueryFillRuleLEP11CCmFillRule @ 13 NONAME
+	_ZN9CCmDmMain14SetStoreFilesLER13RPointerArrayI16CCmStoreListItemE @ 14 NONAME
+	_ZN9CCmDmMain14StoreFileCountEj @ 15 NONAME
+	_ZN9CCmDmMain15AddMediaServerLEP18CCmMediaServerFull @ 16 NONAME
+	_ZN9CCmDmMain15DeleteFillFilesEv @ 17 NONAME
+	_ZN9CCmDmMain15GetProgressInfoERiS0_ @ 18 NONAME
+	_ZN9CCmDmMain15GetTransferInfoE10TCmServiceRiS1_ @ 19 NONAME
+	_ZN9CCmDmMain15QueryStoreRuleLEP12CCmStoreRule @ 20 NONAME
+	_ZN9CCmDmMain15QueryStoredRowLER13RPointerArrayI7HBufC16ERK6TDesC8i @ 21 NONAME
+	_ZN9CCmDmMain15SetProgressInfoEii @ 22 NONAME
+	_ZN9CCmDmMain16DeleteStoreFilesEv @ 23 NONAME
+	_ZN9CCmDmMain16GetAllFillFilesLER13RPointerArrayI15CCmFillListItemEj @ 24 NONAME
+	_ZN9CCmDmMain16GetFillFileCountERK6TDesC8jRi @ 25 NONAME
+	_ZN9CCmDmMain16GetFillListNameLERP6HBufC8x @ 26 NONAME
+	_ZN9CCmDmMain16GetMediaServersLER13RPointerArrayI18CCmMediaServerFullE @ 27 NONAME
+	_ZN9CCmDmMain16KBytesToBeFilledEhj @ 28 NONAME
+	_ZN9CCmDmMain16KBytesToBeStoredEhj @ 29 NONAME
+	_ZN9CCmDmMain16PrepareQueryCmdLE15TCMQueryCmdType @ 30 NONAME
+	_ZN9CCmDmMain16QueryHashValuesLEiR13RPointerArrayI21CCmSearchResponseHashE @ 31 NONAME
+	_ZN9CCmDmMain16SetMediaServersLER13RPointerArrayI18CCmMediaServerFullE @ 32 NONAME
+	_ZN9CCmDmMain17DeleteHashValuesLEii @ 33 NONAME
+	_ZN9CCmDmMain17DeleteMediaServerERK6TDesC8 @ 34 NONAME
+	_ZN9CCmDmMain17GetAllStoreFilesLER13RPointerArrayI16CCmStoreListItemEj @ 35 NONAME
+	_ZN9CCmDmMain17GetStoreFileCountERK6TDesC8jRi @ 36 NONAME
+	_ZN9CCmDmMain17QueryMediaServerLEP18CCmMediaServerFull @ 37 NONAME
+	_ZN9CCmDmMain17SetFillListStateLEj17TCmFillRuleStatus @ 38 NONAME
+	_ZN9CCmDmMain18DeleteAllFillRulesEv @ 39 NONAME
+	_ZN9CCmDmMain18QueryAllFillFilesLER13RPointerArrayI15CCmFillListItemE @ 40 NONAME
+	_ZN9CCmDmMain18QueryFillFileListLER13RPointerArrayI15CCmBaseListItemERK6TDesC8j @ 41 NONAME
+	_ZN9CCmDmMain18QueryMediaServerIdERK6TDesC8 @ 42 NONAME
+	_ZN9CCmDmMain18UpdateStatusValuesER13RPointerArrayI15CCmBaseListItemE @ 43 NONAME
+	_ZN9CCmDmMain18UpdateTransferInfoE10TCmServiceii @ 44 NONAME
+	_ZN9CCmDmMain19DeleteAllStoreRulesEv @ 45 NONAME
+	_ZN9CCmDmMain19DeleteDeletedItemsLEv @ 46 NONAME
+	_ZN9CCmDmMain19QueryAllStoreFilesLER13RPointerArrayI16CCmStoreListItemE @ 47 NONAME
+	_ZN9CCmDmMain19QueryFillRuleNamesLER13RPointerArrayI6HBufC8E @ 48 NONAME
+	_ZN9CCmDmMain19QueryMediaServerUdnERP6HBufC8l @ 49 NONAME
+	_ZN9CCmDmMain19QueryStoreFileListLER13RPointerArrayI15CCmBaseListItemERK6TDesC8j @ 50 NONAME
+	_ZN9CCmDmMain19UpdateUploadHistoryEjRxS0_ @ 51 NONAME
+	_ZN9CCmDmMain20DeleteFillRuleByNameERK6TDesC8 @ 52 NONAME
+	_ZN9CCmDmMain20IncrementShrinkTimeLEii @ 53 NONAME
+	_ZN9CCmDmMain20QueryStoreRuleNamesLER13RPointerArrayI6HBufC8E @ 54 NONAME
+	_ZN9CCmDmMain20QueryTransferHistoryERK6TDesC8RxS3_S3_S3_ @ 55 NONAME
+	_ZN9CCmDmMain20RestoreFileStatusesLERK13RPointerArrayI15CCmFillListItemERK6TDesC8 @ 56 NONAME
+	_ZN9CCmDmMain21GetAvgImageShrinkTimeEv @ 57 NONAME
+	_ZN9CCmDmMain21QueryAllMediaServersLEP18CCmMediaServerFull @ 58 NONAME
+	_ZN9CCmDmMain21UpdateDownloadHistoryEjRxS0_ @ 59 NONAME
+	_ZN9CCmDmMain21UpdateMediaServerInfoEP18CCmMediaServerFull @ 60 NONAME
+	_ZN9CCmDmMain22UpdateFillRuleSelectedERK6TDesC8i @ 61 NONAME
+	_ZN9CCmDmMain23DeleteItemsByFillListIdEi @ 62 NONAME
+	_ZN9CCmDmMain23QueryDeletedItemsListsLER13RPointerArrayI15CCmBaseListItemEj @ 63 NONAME
+	_ZN9CCmDmMain23UpdateFillRuleGroupInfoEv @ 64 NONAME
+	_ZN9CCmDmMain24UpdateFillTransferStatusEjP15CCmFillListItem @ 65 NONAME
+	_ZN9CCmDmMain25UpdateStoreTransferStatusEjxx @ 66 NONAME
+	_ZN9CCmDmMain26DeleteDeletedMediaServersLEv @ 67 NONAME
+	_ZN9CCmDmMain26GetLowPriorityFilledFilesLEiR13RPointerArrayI15CCmFillListItemE @ 68 NONAME
+	_ZN9CCmDmMain26StoreFileCountNoDuplicatesEv @ 69 NONAME
+	_ZN9CCmDmMain26UpdateFillListItemPriorityEP20CCmFillRuleContainer @ 70 NONAME
+	_ZN9CCmDmMain27QuerySelectedFillRuleNamesLER13RPointerArrayI6HBufC8Ei @ 71 NONAME
+	_ZN9CCmDmMain28QuerySelectedStoreRuleNamesLER13RPointerArrayI6HBufC8Ei @ 72 NONAME
+	_ZN9CCmDmMain28SetFillListRealCountAndSizeLExxx @ 73 NONAME
+	_ZN9CCmDmMain28UpdateFillListDriveStatusesLEP12CCmDriveInfoS1_i @ 74 NONAME
+	_ZN9CCmDmMain30GetStoreFileCountNoDuplicatesLERij @ 75 NONAME
+	_ZN9CCmDmMain4NewLEv @ 76 NONAME
+	_ZN9CCmDmMain5NewLCEv @ 77 NONAME
+	_ZN9CCmDmMain8ListSizeE11TCmRuleTypeRK6TDesC8j @ 78 NONAME
+	_ZN9CCmDmMainD0Ev @ 79 NONAME
+	_ZN9CCmDmMainD1Ev @ 80 NONAME
+	_ZN9CCmDmMainD2Ev @ 81 NONAME
+	_ZTI21CCmDmSqlDbMaintenance @ 82 NONAME ; #<TI>#
+	_ZTI9CCmDmMain @ 83 NONAME ; #<TI>#
+	_ZTV21CCmDmSqlDbMaintenance @ 84 NONAME ; #<VT>#
+	_ZTV9CCmDmMain @ 85 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for Database Manager
+*
+*/
+
+
+// Supported platforms
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_EXPORTS
+../inc/cmdmmain.h         |../../../../inc/cmdmmain.h
+
+// MMP files
+PRJ_MMPFILES
+cmdatabasemanager.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/group/cmdatabasemanager.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project Database Manager
+*
+*/
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+TARGET          cmdatabasemanager.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10281FA9
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH      /sys/bin
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          cmdmmain.cpp
+SOURCE          cmdmsqldbmaintenance.cpp
+SOURCE          cmdmsqliteconnection.cpp
+
+LIBRARY         bafl.lib
+LIBRARY         sqldb.lib
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+LIBRARY         cmcommon.lib
+DEBUGLIBRARY    flogger.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/inc/cmdmmain.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,952 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main class in the Database manager component
+*
+*/
+
+
+
+
+
+
+#ifndef C_CMDMMAIN_H
+#define C_CMDMMAIN_H
+
+#include <e32base.h>
+#include <badesca.h>
+#include "cmcommon.h"
+#include "cmcommontypes.h"
+
+// Operation types
+enum TCMQueryCmdType
+    {
+    EFillRuleQuery = 1,
+    EMediaServerInfoQyery,
+    EMediaServerIdQuery,
+    EMediaServerUDNQuery,
+    EMediaServersAllQuery,
+    EHashValueQuery,
+    EFilledQuery,
+    EStoredQuery,
+    EFilledRowQuery,
+    EStoredRowQuery,
+    ESelectedFillRuleQuery,
+    EFillRuleNamesQuery,
+    EStoreRuleQuery,
+    EStoreRuleNamesQuery,
+    ESelectedStoreRuleQuery,
+    ETransferHistoryQuery,
+    EFillFilesQuery,
+    EStoreFilesQuery,
+    EAllFillFilesQuery,
+    EAllStoreFilesQuery,
+    EFilledLowPriorityQuery,
+    EAllFillFilesStatusQuery,
+    EAllStoreFilesStatusQuery,
+    EDeletedFillFilesQuery,
+    EDrivesQuery
+    };    
+            
+/* Forward declarations. */
+class CCmDmSqlDbMaintenance;
+class CCmDmSQLiteConnection;
+class CCmFillRule;
+class CCmFillRuleContainer;
+class CCmMediaServerFull;
+class CCmStoreRule;
+class CCmBaseListItem;
+class CCmFillListItem;
+class CCmStoreListItem;
+class CCmSearchResponseHash;
+class CCmDriveInfo;
+
+
+/**
+ *  CCmDmMain class
+ *  Part of Database manager. Database manager is part of
+ *  Content manager component.
+ *
+ *  @lib cmdatabasemanager.lib
+ *
+ *  @since S60 5.1
+ */
+class CCmDmMain : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CCmDmMain* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CCmDmMain* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CCmDmMain();
+
+    /**
+     * Prepares query command
+     *
+     * @since S60 5.1
+     * @param aType type of query
+     * @return None
+     */        
+    IMPORT_C void PrepareQueryCmdL( TCMQueryCmdType aType );
+        
+    /**
+     * Query fill rule
+     *
+     * @since S60 5.1
+     * @param aFillRule
+     * @return TInt, Error code 
+     */    
+    IMPORT_C TInt QueryFillRuleL( CCmFillRule* aFillRule );
+
+    /**
+     * Query names of selected fill rules
+     *
+     * @since S60 5.1
+     * @param aNames
+     * @param aSelected
+     * @return None 
+     */        
+    IMPORT_C void QuerySelectedFillRuleNamesL( 
+        RPointerArray<HBufC8>& aNames, 
+        TInt aSelected );
+
+    /**
+     * Query names of fill rules
+     *
+     * @since S60 5.1
+     * @param aNames, on return fill rule names
+     * @return None 
+     */    
+    IMPORT_C void QueryFillRuleNamesL( RPointerArray<HBufC8>& aNames );
+    
+    /**
+     * Query store rule
+     *
+     * @since S60 5.1
+     * @param aStoreRule, store list
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt QueryStoreRuleL( CCmStoreRule* aStoreRule );
+    
+    /**
+     * Query store rule names
+     *
+     * @since S60 5.1
+     * @param aNames, list names
+     * @return None
+     */    
+    IMPORT_C void QueryStoreRuleNamesL( RPointerArray<HBufC8>& aNames );
+
+    /**
+     * Query selected store rule names
+     *
+     * @since S60 5.1
+     * @param aNames, list names
+     * @param aSelected, selection status
+     * @return None
+     */        
+    IMPORT_C void QuerySelectedStoreRuleNamesL( 
+        RPointerArray<HBufC8>& aNames,
+        TInt aSelected );
+
+    /**
+     * Query media server info
+     *
+     * @since S60 5.1
+     * @param aMediaServer, mediaserver
+     * @return TInt, Error code 
+     */            
+    IMPORT_C TInt QueryMediaServerL( CCmMediaServerFull* aMediaServer );
+    
+    /**
+     * Query media server ids
+     *
+     * @since S60 5.1
+     * @param aUDN, server UDN
+     * @return TInt64, Media server id 
+     */        
+    IMPORT_C TInt64 QueryMediaServerId( const TDesC8& aUDN );
+
+    /**
+     * Query media server udn
+     *
+     * @since S60 5.1
+     * @param aUDN, server UDN
+     * @param aId, server id
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt QueryMediaServerUdn( HBufC8*& aUdn, const TInt32 aId );
+
+    /**
+     * Query All Media servers
+     *
+     * @since S60 5.1
+     * @param aMediaServer, mediaserver
+     * @return TInt, Error code 
+     */    
+    IMPORT_C TInt QueryAllMediaServersL( CCmMediaServerFull* aMediaServer );
+
+    /**
+     * Get media servers
+     *
+     * @since S60 5.1
+     * @param aMediaServers, mediaserver list
+     * @return None 
+     */    
+    IMPORT_C void GetMediaServersL( 
+        RPointerArray<CCmMediaServerFull>& aMediaServers );
+        
+    /**
+     * Query filled
+     *
+     * @since S60 5.1
+     * @param aDrive, drive id
+     * @param aFilled, fill list items
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt GetLowPriorityFilledFilesL( 
+        TInt aDrive, 
+        RPointerArray<CCmFillListItem>& aFilled );
+
+    /**
+     * Query fill file list
+     *
+     * @since S60 5.1
+     * @param aItems, fill list items
+     * @param aName, fill list name
+     * @param aStatus, list status
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt QueryFillFileListL( 
+        RPointerArray<CCmBaseListItem>& aItems, 
+        const TDesC8& aName, 
+        TUint aStatus );
+
+    /**
+     * Query fill file list
+     *
+     * @since S60 5.1
+     * @param aItems, fill list items
+     * @param aStatus, list status
+     * @return TInt, Error code 
+     */    
+    IMPORT_C TInt GetAllFillFilesL( 
+        RPointerArray<CCmFillListItem>& aItems, 
+        TUint aStatus );
+        
+    /**
+     * Query store file list
+     *
+     * @since S60 5.1
+     * @param aItems, list items
+     * @param aName, list name
+     * @param aStatus, list status
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt QueryStoreFileListL( 
+        RPointerArray<CCmBaseListItem>& aItems, 
+        const TDesC8& aName, 
+        TUint aStatus );
+
+    /**
+     * Query store file list
+     *
+     * @since S60 5.1
+     * @param aItems, list items
+     * @param aStatus, list status
+     * @return TInt, Error code 
+     */    
+    IMPORT_C TInt GetAllStoreFilesL( 
+        RPointerArray<CCmStoreListItem>& aItems, 
+        TUint aStatus );
+        
+    /**
+     * Query all fill files
+     * @since S60 5.1
+     * @param aItems
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt QueryAllFillFilesL( 
+        RPointerArray<CCmFillListItem>& aItems );
+
+    /**
+     * Query all store files
+     *
+     * @since S60 5.1
+     * @param aItems, list items
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt QueryAllStoreFilesL( 
+        RPointerArray<CCmStoreListItem>& aItems );
+    
+    /**
+     * Query all stored ( use aFile as a query parameter )
+     *
+     * @since S60 5.1
+     * @param aFiles, stored files
+     * @param aUDN, server udn
+     * @param aAmount, amount of files
+     * @return None
+     */        
+    IMPORT_C void QueryStoredRowL( 
+        RPointerArray<HBufC16>& aFiles, 
+        const TDesC8& aUDN, 
+        TInt aAmount );    
+
+    /**
+     * Query transfer history
+     *
+     * @since S60 5.1
+     * @param aUdn, server udn
+     * @param aDownloadData, download data size
+     * @param aUploadData, upload data size
+     * @param aDownloadTime, download time
+     * @param aUploadTime, upload time 
+     * @return None 
+     */        
+    IMPORT_C void QueryTransferHistory( 
+        const TDesC8& aUdn, 
+        TInt64& aDownloadData,
+        TInt64& aUploadData, 
+        TInt64& aDownloadTime, 
+        TInt64& aUploadTime );
+
+    /**
+     * Query deleted items list
+     *
+     * @since S60 5.1
+     * @param aUdn, server udn
+     * @param aArray, array of deleted items
+     * @param aStatus, status info
+     * @return None 
+     */  
+    IMPORT_C void QueryDeletedItemsListsL( 
+        RPointerArray<CCmBaseListItem>& aArray, 
+        TUint aStatus );
+        
+    /**
+     * Query drives
+     *
+     * @since S60 5.1
+     * @param aDrives, drive array
+     * @return None 
+     */     
+    IMPORT_C void QueryDrivesL( RPointerArray<CCmDriveInfo>& aDrives );   
+    
+    /**
+     * Avarage image shrinking time 
+     *
+     * @since S60 5.1
+     * @return TInt, Avarage image shrinking time in millisecond 
+     */        
+    IMPORT_C TInt GetAvgImageShrinkTime();
+
+    /**
+     * Get list name using list id 
+     *
+     * @since S60 5.1
+     * @param aListName, name of the fill list
+     * @param aListId, id of the named list
+     * @return None
+     */     
+    IMPORT_C void GetFillListNameL( 
+        HBufC8*& aListName, 
+        const TInt64 aListId );
+    
+    /**
+     * Set fill file list
+     *
+     * @since S60 5.1
+     * @param aItems, fill list items
+     * @return TInt Error code 
+     */    
+    IMPORT_C TInt SetFillFiles( RPointerArray<CCmFillListItem>& aItems );
+
+    /**
+     * Set store file list
+     *
+     * @since S60 5.1
+     * @param aItems, store list items
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt SetStoreFilesL( RPointerArray<CCmStoreListItem>& aItems );
+    
+    /**
+     * Adds one item into store file list
+     *
+     * @since S60 5.1
+     * @param aItem, store list item
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt AddStoreFile( CCmStoreListItem& aItem );        
+    
+    /**
+     * Add stored item
+     *
+     * @since S60 5.1
+     * @param aFileName, file name
+     * @param aUDN, server udn
+     * @param aTimeStamp, timestamp
+     * @return TInt, Error code 
+     */     
+    IMPORT_C TInt AddStoredL( 
+        const TDesC& aFileName, 
+        const TDesC8& aUDN, 
+        TTime aTimeStamp );   
+    
+    /**
+     * Add fill rule
+     *
+     * @since S60 5.1
+     * @param aFillRule, fill list
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt AddFillRuleL( CCmFillRule* aFillRule );
+    
+    /**
+     * Add store rule
+     *
+     * @since S60 5.1
+     * @param aStoreRule, store list
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt AddStoreRuleL( CCmStoreRule* aStoreRule );    
+    
+    /**
+     * Add Media server
+     *
+     * @since S60 5.1
+     * @param aMediaServer, media server
+     * @return TInt, Error code 
+     */
+    IMPORT_C TInt AddMediaServerL( CCmMediaServerFull* aMediaServer );
+    
+    /**
+     * Add hash value
+     *
+     * @since S60 5.1
+     * @param aMediaServerId, media server id
+     * @param aHashValue, hash value
+     * @return TInt, Error code 
+     */
+    IMPORT_C TInt AddHashValue( TInt64 aMediaServerId, 
+                                CCmSearchResponseHash* aHashValue );
+
+    /**
+     * Query hash values
+     *
+     * @since S60 5.1
+     * @param aMediaServerId, media server id
+     * @param aHashValues, hash value
+     * @return TInt, Error code 
+     */                                       
+    IMPORT_C TInt QueryHashValuesL( TInt aMediaServer, 
+        RPointerArray<CCmSearchResponseHash>& aHashValues );                                       
+
+    /**
+     * Sets is active status of the media server
+     *
+     * @since S60 5.1
+     * @param aServers, mediaservers
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt SetMediaServersL( 
+        RPointerArray<CCmMediaServerFull>& aServers );    
+
+    /**
+     * Sets last syncs time
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Error code 
+     */    
+    IMPORT_C TInt SetSyncTime();
+
+    /**
+     * Gets last syncs time
+     *
+     * @since S60 5.1
+     * @param aTime last sync time
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt GetSyncTime( TTime& aTime );
+    
+    /**
+     * Sets Progress info
+     * @since S60 5.1
+     *
+     * @param aTransferred how many files transferred
+     * @param aTotalCount how many will be trasferred
+     * @return TInt, Error code 
+     */    
+    IMPORT_C TInt SetProgressInfo( TInt aTransferred, TInt aTotalCount );
+
+    /**
+     * Gets Progress info
+     *
+     * @since S60 5.1
+     * @param aTransferred how many files transferred
+     * @param aTotalCount how many will be trasferred
+     * @return TInt, Error code 
+     */    
+    IMPORT_C TInt GetProgressInfo( 
+        TInt& aTransferred, 
+        TInt& aTotalCount );    
+
+    /**
+     * Sets Drives info
+     *
+     * @since S60 5.1
+     * @param aDrives, drives to be set into database
+     * @return None
+     */ 
+    IMPORT_C void SetDrivesL( RPointerArray<CCmDriveInfo>& aDrives );
+        
+    /**
+     * Remove media server info from database
+     *
+     * @since S60 5.1
+     * @param aUDN, server udn
+     * @return TInt, Error code 
+     */         
+    IMPORT_C TInt DeleteMediaServer( const TDesC8& aUDN );
+
+    /**
+     * Remove fill rule from database
+     *
+     * @since S60 5.1
+     * @param aName, fill list name
+     * @return TInt, Error code 
+     */         
+    IMPORT_C TInt DeleteFillRuleByName( const TDesC8& aName );
+    
+    /**
+     * Delete all fill rules
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Error code 
+     */         
+    IMPORT_C TInt DeleteAllFillRules();
+
+    /**
+     * Delete all store rules
+     *
+     * @since S60 5.1
+     * @param None
+     * @return Error code 
+     */        
+    IMPORT_C TInt DeleteAllStoreRules();
+
+    /**
+     * Deletes all fill files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return Error code 
+     */        
+    IMPORT_C TInt DeleteFillFiles();
+
+    /**
+     * Deletes all store files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Error code 
+     */        
+    IMPORT_C TInt DeleteStoreFiles();
+
+    /**
+     * Delete deleted items 
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    IMPORT_C void DeleteDeletedItemsL();
+
+    /**
+     * Delete items by FillListId
+     *
+     * @since S60 5.1
+     * @param FillListId, fill list id
+     * @return TInt, Error code
+     */
+    IMPORT_C TInt DeleteItemsByFillListId( TInt aFillListId );
+
+    /**
+     * Delete deleted media servers
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */      
+    IMPORT_C void DeleteDeletedMediaServersL();
+    
+    /**
+    * Deletes hash values
+    *
+    * @since S60 5.1
+    * @param aMediaServerId, media server id
+    * @param aSearchIndex, search index
+    * @return None
+    */   
+    IMPORT_C void DeleteHashValuesL( const TInt aMediaserverId,
+            const TInt aSearchIndex );
+
+    /**
+     * Update media server info
+     *
+     * @since S60 5.1
+     * @param aMediaServer, media server
+     * @return TInt, Error code 
+     */         
+    IMPORT_C TInt UpdateMediaServerInfo( CCmMediaServerFull* aMediaServer );
+    
+    /**
+     * Update status of the fill rule ( selected or not )
+     *
+     * @since S60 5.1
+     * @param aName, list name
+     * @param aSelected, selection status
+     * @return TInt, Error code 
+     */         
+    IMPORT_C TInt UpdateFillRuleSelected( 
+        const TDesC8& aName, 
+        TInt aSelected );
+
+    /**
+     * Update Download history
+     *
+     * @since S60 5.1
+     * @param aMediaServerId, server id
+     * @param aDownloadData, download data size 
+     * @param aDownloadTime, download time
+     * @return TInt, Error code 
+     */    
+    IMPORT_C TInt UpdateDownloadHistory( 
+        TUint aMediaServerId,
+        TInt64& aDownloadData, 
+        TInt64& aDownloadTime );
+    
+    /**
+     * Update Upload history
+     *
+     * @since S60 5.1
+     * @param aMediaServerId, server id
+     * @param aUploadData, upload data size
+     * @param aUploadTime, upload time
+     * @return TInt, Error code
+     */    
+    IMPORT_C TInt UpdateUploadHistory( 
+        TUint aMediaServerId,
+        TInt64& aUploadData, 
+        TInt64& aUploadTime );
+
+    /**
+     * Update status values
+     *
+     * @since S60 5.1
+     * @param aStatusValues, status values of items
+     * @return TInt, Error code 
+     */
+    IMPORT_C TInt UpdateStatusValues( 
+        RPointerArray<CCmBaseListItem>& aStatusValues );
+        
+    /**
+     * Update fill list drive statuses
+     *
+     * @since S60 5.1
+     * @param aDrive, drive info
+     * @para aDriveSelected, if ETrue drive selected but slot changed
+     * @return None 
+     */    
+    IMPORT_C void UpdateFillListDriveStatusesL( 
+        CCmDriveInfo* aOrigDrive, 
+        CCmDriveInfo* aNewDrive, 
+        TBool aDriveSelected );     
+
+    /**
+     * Update fill list item priorities
+     *
+     * @since S60 5.1
+     * @param aContainer, fill list container 
+     * @return TInt, Error code 
+     */
+    IMPORT_C TInt UpdateFillListItemPriority( 
+        CCmFillRuleContainer* aContainer );                
+
+    /**
+     * Update fill selection state into fill file table
+     *
+     * @since S60 5.1
+     * @param aListName, fill list name
+     * @param aState, fill list status
+     * @return None
+     */
+    IMPORT_C void SetFillListStateL( 
+        const TUint aListName, 
+        TCmFillRuleStatus aState );
+
+    /**
+     *
+     * Restoring file statuses
+     * @since S60 5.1
+     * @param aItems, array of filled items
+     * @param aListName, list name
+     * @return None
+     */
+    IMPORT_C void RestoreFileStatusesL( 
+        const RPointerArray<CCmFillListItem>& aItems, 
+        const TDesC8& aListName );
+                
+    /**
+     *
+     * Increment image shrinking history info
+     *
+     * @since S60 5.1
+     * @param aImageCount, image count
+     * @param aMilliSeconds, shrinking time
+     * @return TInt, Error code 
+     */            
+    IMPORT_C TInt IncrementShrinkTimeL( 
+        TInt aImageCount, 
+        TInt aMilliSeconds );
+
+    /**
+     * Returns size of the named list
+     *
+     * @since S60 5.1
+     * @param aType, List type
+     * @param aListName, list name 
+     * @param aStatus, list status
+     * @return TInt64, Size in bytes
+     */        
+    IMPORT_C TInt64 ListSize( 
+        TCmRuleType aType, 
+        const TDesC8& aListName,
+        TUint aStatus );
+
+    /**
+     * Returns file count which are waiting to be stored
+     *
+     * @since S60 5.1
+     * @param aStatus, file status
+     * @return TInt, File count
+     */                                
+    IMPORT_C TInt StoreFileCount( TUint aStatus );
+
+    /**
+     * Returns file count which are waiting to be stored
+     *
+     * @since S60 5.1
+     * @param None
+     * @return size of the list
+     */      
+    IMPORT_C TInt StoreFileCountNoDuplicates();
+    
+    /**
+     * Returns file count which are waiting to be filled
+     *
+     * @since S60 5.1
+     * @param aStatus, file status
+     * @return TInt, File count
+     */        
+    IMPORT_C TInt FillFileCount( TUint aStatus );
+
+    /**
+     * Returns data amount filled
+     * @since S60 5.1
+     * @param aID id of fill rule
+     * @return sum of file sizes
+     */        
+    IMPORT_C TInt64 BytesFilled( 
+        TUint aID );
+
+    /**
+     * Returns data amount to be filled
+     * @since S60 5.1
+     * @param aMediaServerId, media server id
+     * @param aStatus, file status
+     * @return TInt64, sum of file sizes
+     */        
+    IMPORT_C TInt64 KBytesToBeFilled( 
+        TUint8 aMediaServerId, 
+        TUint aStatus );
+
+    /**
+     * Returns data amount to be stored
+     *
+     * @since S60 5.1
+     * @param aMediaServerId, media server id
+     * @param aStatus, file status
+     * @return TInt64, sum of file sizes
+     */        
+    IMPORT_C TInt64 KBytesToBeStored( 
+        TUint8 aMediaServerId, 
+        TUint aStatus );
+
+    /**
+     * Updates list size and approx. transfer time
+     *
+     * @since S60 5.1
+     * @param aService, contentmanager service
+     * @param aCount, item count
+     * @param aTime, transfer time in milliseconds
+     * @return TInt, error code
+     */           
+    IMPORT_C TInt UpdateTransferInfo( 
+        TCmService aService, 
+        TInt aCount, 
+        TInt aTime );      
+
+    /**
+     * Updates file status
+     *
+     * @since S60 v3.1
+     * @param aStatus, file status
+     * @param aFid, file id
+     * @param aMsId, server id
+     * @return None
+     */         
+    IMPORT_C void UpdateStoreTransferStatus( 
+        TUint aStatus,
+        TInt64 aFid, 
+        TInt64 aMsId );        
+        
+    /**
+     * Updates file status
+     *
+     * @since S60 5.1
+     * @param aStatus, file status
+     * @param aItem, fill list item
+     * @return None
+     */
+    IMPORT_C void UpdateFillTransferStatus( 
+        TUint aStatus, 
+        CCmFillListItem* aItem );
+        
+    /**
+     * Get list size and approx. transfer time
+     *
+     * @since S60 5.1
+     * @param aService, content manager service
+     * @param aCount pieces, item count
+     * @param aTime, transfer time in milliseconds
+     * @return TInt, error code
+     */            
+    IMPORT_C TInt GetTransferInfo( 
+        TCmService aService, 
+        TInt& aCount, 
+        TInt& aTime );
+
+    /**
+     * Files to be stored and included into specified list
+     *
+     * @since S60 5.1
+     * @param aListName, store list name
+     * @param aStatus, list status
+     * @param aCount, item count
+     * @return TInt, error code
+     */            
+    IMPORT_C TInt GetStoreFileCount( 
+        const TDesC8& aListName, 
+        TUint aStatus, 
+        TInt& aCount );
+             
+     /**
+     * Files to be filled and included into specified list
+     *
+     * @since S60 5.1
+     * @param aListName, fill list name
+     * @param aStatus, list status
+     * @param aCount, item count
+     * @return TInt, error code
+     */            
+    IMPORT_C TInt GetFillFileCount( 
+        const TDesC8& aListName, 
+        TUint aStatus, 
+        TInt& aCount );
+
+    /**
+     * Files to be store
+     *
+     * @since S60 5.1
+     * @param aCount, file count 
+     * @param aStatus, file status
+     * @return None
+     */
+    IMPORT_C void GetStoreFileCountNoDuplicatesL( 
+        TInt& aCount, 
+        TUint aStatus );        
+        
+     /**
+     * Sets fill list real information
+     *
+     * @since S60 5.1
+     * @param aListId, list id
+     * @param aRealCount, item count
+     * @param aRealSize, list size
+     * @return None
+     */          
+    IMPORT_C void SetFillListRealCountAndSizeL( 
+        TInt64 aListId, 
+        TInt64 aRealCount, 
+        TInt64 aRealSize );  
+
+    /**
+    * update the fill rule realsize and realcount field
+    *
+    * @since S60 5.1
+    * @return TInt, error code
+    */        
+    IMPORT_C TInt UpdateFillRuleGroupInfo();
+    
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmDmMain();
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private:
+
+    /**
+     * Pointer to SQLite connection class
+     */
+    CCmDmSQLiteConnection* iConnection;             // owned
+    
+    /**
+     * Pointer to database maintenance class
+     */
+    CCmDmSqlDbMaintenance* iMaintenance;            // owned
+    };
+
+#endif //  C_CMDMMAIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/inc/cmdmsqlclausedef.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,931 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQL clause definitions
+*
+*/
+
+
+
+
+
+
+#ifndef __CMDMSQLCLAUSEDEF_H__
+#define __CMDMSQLCLAUSEDEF_H__
+
+// ---------------------------------------------------------------------------
+// SELECT clauses
+// ---------------------------------------------------------------------------
+//
+_LIT8( KSelectDeviceInfoByUDN, "SELECT " 
+    "MediaServerID, UDN, Name, SystemUpdateID, VisibleDate, IsActive, FillUsage " 
+    "FROM MediaServers " 
+    "WHERE UDN = ?"
+    );
+    
+_LIT8( KSelectAllMediaServers, "SELECT " 
+    "UDN, Name, SystemUpdateID, VisibleDate, IsActive, MediaServerID, "
+    "CopyCapability, FillUsage, StoreUsage " 
+    "FROM MediaServers"
+    );
+        
+_LIT8( KSelectMediaServerIDByUDN, 
+    "SELECT "
+    "MediaServerID "
+    "FROM MediaServers "
+    "WHERE UDN = ?"
+    );
+
+_LIT8( KSelectHashValuesByMediaServer, "SELECT " 
+    "StartIndex, ItemCount, Hash " 
+    "FROM HashValues "
+    "WHERE MediaServerID = ?"
+    );
+    
+_LIT8( KSelectMediaServerUDNByID, 
+    "SELECT "
+    "UDN "
+    "FROM MediaServers "
+    "WHERE MediaServerID = ?"
+    );       
+
+_LIT8( KSelectStoredByUDN, 
+    "SELECT "
+    "StoredFile " 
+    "FROM Stored " 
+    "WHERE MediaServerID = ( " 
+    "SELECT MediaServerID "
+    "FROM MediaServers "
+    "WHERE UDN = ? )"
+    );
+    
+_LIT8( KIsFileAlreadyStored,
+    "SELECT "
+    "MediaServerID "
+    "FROM MediaServers "
+    "WHERE MediaServerID = ( "    
+    "SELECT "
+    "MediaServerID "
+    "FROM Stored "
+    "WHERE StoredFile = ? ) "
+    "AND "
+    "UDN = ?"   
+    );  
+
+_LIT8( KSelectID,
+    "SELECT "
+    "IDValue "
+    "FROM IDs "
+    "WHERE IDType = ?"
+    );
+
+_LIT8( KSelectRuleGroupID,
+    "SELECT "
+    "RuleGroupID "
+    "FROM FillRuleGroup "
+    "WHERE Name = ?"
+    );
+    
+_LIT8( KSelectStoreRuleID,
+    "SELECT "
+    "StoreRuleId "
+    "FROM StoreRules "
+    "WHERE Name = ?"
+    );
+
+// Loading Fill Rule 1.    
+_LIT8( KSelectFillRule,
+    "SELECT "
+    "RuleGroupID, Name, Method, LimitType, Quantity, Selected, Priority, "
+    "TemplateId, MediaType, Status, RealCount, RealSize "
+    "FROM FillRuleGroup "
+    "WHERE Name = ? "
+    "ORDER BY Priority ASC"
+    );
+    
+// Loading Fill Rule 2.                
+_LIT8( KSelectRule,
+    "SELECT "
+    "RuleID, MetadataField, Operator "
+    "FROM Rules "
+    "JOIN FillRuleGroup frg ON Rules.RuleGroupID = frg.RuleGroupID "
+    "WHERE frg.Name = ?"
+    );
+
+// Loading Fill Rule 3.    
+_LIT8( KSelectRuleParams, 
+    "SELECT "
+    "ComparisonFieldData "
+    "FROM RuleParams "
+    "WHERE RuleID = ( SELECT "
+    "RuleID "
+    "FROM Rules "
+    "WHERE RuleGroupID = ( SELECT "
+    "RuleGroupID "
+    "FROM FillRuleGroup "
+    "WHERE Name = ? ))"
+    );
+
+// Loading Fill Rule 3.1    
+_LIT8( KSelectRuleParamsByRuleID, 
+    "SELECT "
+    "ComparisonFieldData, ComparisonFieldIndex "
+    "FROM RuleParams "
+    "WHERE RuleID = ?"
+    );
+    
+// Loading Fill Rule 4.    
+_LIT8( KSelectMediaServerID, 
+    "SELECT "
+    "MediaServerID "
+    "FROM RuleGroupServers "
+    "WHERE RuleGroupID = ( SELECT "
+    "RuleGroupID "
+    "FROM FillRuleGroup "
+    "WHERE Name = ? )"
+    );
+
+// Loading Fill Rule 4.1    
+_LIT8( KSelectMediaServerIDByRuleGroupID, 
+    "SELECT "
+    "MediaServerID "
+    "FROM RuleGroupServers "
+    "WHERE RuleGroupID = ?"
+    );
+    
+// Loading Fill Rule 5.    
+_LIT8( KSelectRuleUDNs, 
+    "SELECT "
+    "UDN "
+    "FROM MediaServers "
+    "WHERE MediaServerID = ( SELECT "
+    "MediaServerID "
+    "FROM RuleGroupServers "
+    "WHERE RuleGroupID = ( SELECT "
+    "RuleGroupID "
+    "FROM FillRuleGroup "
+    "WHERE Name = ? ))"
+    );
+
+// Loading Fill Rule 5.1    
+_LIT8( KSelectRuleUDNsByMediaServerID, 
+    "SELECT "
+    "UDN "
+    "FROM MediaServers "
+    "WHERE MediaServerID = ?"
+    );
+    
+// Loading selected ( or not selected rules )    
+_LIT8( KSelectSelectedFillRuleNames, 
+    "SELECT "
+    "Name "
+    "FROM FillRuleGroup "
+    "WHERE Selected = ?"
+    );        
+
+// Loading all fill rule names
+_LIT8( KSelectFillRuleNames, 
+    "SELECT "
+    "Name "
+    "FROM FillRuleGroup"
+    );
+
+_LIT8( KSelectFillRuleName, 
+    "SELECT Name "
+    "FROM FillRuleGroup "
+    "WHERE RuleGroupID = ?"
+    );
+    
+// Loading Store Rule 1.    
+_LIT8( KSelectStoreRule,
+    "SELECT "
+    "StoreRuleID, Name, Selected, Status "
+    "FROM StoreRules "
+    "WHERE Name = ?"
+    );
+
+// Loading Store Rule 2.                
+_LIT8( KSelectStoreRuleDefs,
+    "SELECT "
+    "StoreRuleParamId, MediaType "
+    "FROM StoreRuleParams "
+    "WHERE StoreRuleID = ( SELECT "
+    "StoreRuleID "
+    "FROM StoreRules "
+    "WHERE Name = ? )"
+    );
+
+// Loading Store rule 3.    
+_LIT8( KSelectStoreRuleMediaServerID, 
+    "SELECT "
+    "MediaServerID "
+    "FROM StoreRuleServers "
+    "WHERE StoreRuleID = ?"
+    );
+    
+// Loading all store rule names
+_LIT8( KSelectStoreRuleNames, 
+    "SELECT "
+    "Name "
+    "FROM StoreRules"
+    );        
+
+// Loading selected ( or not selected rules )    
+_LIT8( KSelectSelectedStoreRuleNames, 
+    "SELECT "
+    "Name "
+    "FROM StoreRules "
+    "WHERE Selected = ?"
+    );    
+
+_LIT8( KSelectFillFiles, 
+    "SELECT "
+    "PrimaryText, SecondaryText, Path, Size, Status, Date, FileId, RefId "
+    "FROM FillFiles "
+    "WHERE ((Status & ? ) AND ( FillListId = "
+    "( SELECT RuleGroupId FROM FillRuleGroup WHERE Name = ? ) ) ) "
+    "ORDER BY PrimaryText"
+    );
+    
+_LIT8( KSelectDeletedFillFiles,
+    "SELECT "
+    "PrimaryText, SecondaryText, Path, Size, Status, Date, FileId "
+    "FROM FillFiles "
+    "WHERE ((Status & ? ) AND ( Selected = '2' ) )"
+    "ORDER BY PrimaryText"
+    );
+        
+_LIT8( KSelectAllFillFiles, 
+    "SELECT "
+    "FileId, PrimaryText, SecondaryText, Path, Uri, ItemId, UpnpClass, "
+    "MediaType, Priority, Size, Status, Date, FillListId, MediaServerId, "
+    "RefId, Selected, DriveId, DriveNumber "
+    "FROM FillFiles "
+    "ORDER BY Priority ASC"
+    );    
+    
+_LIT8( KGetAllFillFiles, 
+    "SELECT "
+    "FileId, PrimaryText, SecondaryText, Path, Uri, ItemId, UpnpClass, "
+    "MediaType, Priority, Size, Status, Date, FillListId, MediaServerId, "
+    "RefId, Selected, DriveId, DriveNumber "
+    "FROM FillFiles "
+    "WHERE ( Status & ? ) "
+    "ORDER BY Priority ASC"
+    );    
+        
+_LIT8( KSelectStoreFiles, 
+    "SELECT "
+    "PrimaryText, SecondaryText, Path, Size, Date "
+    "FROM StoreFiles "
+    "WHERE (StoreListId = "
+    "( SELECT StoreRuleID FROM StoreRules WHERE Name = ? )) "
+    "ORDER BY PrimaryText"
+    );
+
+_LIT8( KSelectAllStoreFiles, 
+    "SELECT "
+    "FileId, PrimaryText, SecondaryText, Path, Size, sfd.Status, "
+    "StoreListId, sfd.MediaServerId "
+    "FROM StoreFiles JOIN StoreFileServers sfd ON FileId = sfd.Fid"    
+    );
+
+_LIT8( KGetAllStoreFiles, 
+    "SELECT "
+    "PrimaryText, SecondaryText, Path, Size, sfd.Status, "
+    "StoreListId, sfd.MediaServerId "
+    "FROM StoreFiles JOIN StoreFileServers sfd ON FileId = sfd.Fid "
+    "WHERE ( sfd.Status & ? )"
+    );         
+
+_LIT8( KSelectLowestPriorityFilled,
+    "SELECT "
+    "Path, Size, FillListId, FileId "
+    "FROM FillFiles "
+    "WHERE ( Status & ? ) "
+    "AND ( Priority = "
+    "( SELECT MAX(Priority) FROM FillFiles "
+    "WHERE ( Status & ? AND RefId = '0' AND DriveNumber = ? ) ) )"
+    "ORDER BY Priority DESC"
+    );
+
+_LIT8( KSelectTransferHistory, 
+    "SELECT "
+    "DownloadData, UploadData, DownloadTime, UploadTime "
+    "FROM MediaServers "
+    "WHERE UDN = ?"
+    );
+
+// Count all files from selected store lists ( multiple servers included )
+_LIT8( KStoreFileCount,
+    "SELECT count(*) "
+    "FROM StoreRules "
+    "JOIN StoreFiles files,  StoreFileServers servers ON files.StoreListId = StoreRuleId "
+    "WHERE selected = '1' AND servers.FId = files.FileId  AND servers.status & ?" 
+    );
+
+_LIT8( KStoreFileCountNoDuplicates,
+    "SELECT count(*) "
+    "FROM StoreRules "
+    "JOIN StoreFiles files ON files.StoreListId = StoreRuleId "
+    "WHERE selected = '1'" 
+    );
+        
+_LIT8( KFillFileCount,
+    "SELECT count(*) "
+    "FROM FillFiles "
+    "WHERE status & ? AND RefId = '0' AND Selected = '1'"
+    );
+    
+_LIT8( KImageShrinkingInfo,
+    "SELECT Count, Time "
+    "FROM ImageShrinkingInfo"
+    );
+
+_LIT8( KTranferValues,
+    "SELECT Count "
+    "FROM TransferInfo "
+    "WHERE Service = ?"
+    );
+
+_LIT8( KStoreListFileCount,
+    "SELECT count(*) "
+    "FROM StoreFiles JOIN StoreRules sr ON StoreListId = sr.StoreRuleId "
+    "WHERE sr.Name = ?"
+    ); 
+
+_LIT8( KFillListFileCount,
+    "SELECT count(*) "
+    "FROM FillFiles "
+    "WHERE (( Status & ?) AND (FillListId = "
+    "(SELECT RuleGroupID FROM FillRuleGroup WHERE Name = ?)) AND "
+    "( Selected = '1') )"
+    );
+    
+_LIT8( KGetSyncTime, 
+    "SELECT * "
+    "FROM SyncTime" 
+    );               
+
+_LIT8( KGetProgressInfo,
+    "SELECT Trasferred, TotalCount "
+    "FROM ProgressInfo" 
+    ); 
+
+_LIT8( KGetFillListStatus,
+    "SELECT Status "
+    "FROM FillRuleGroup "
+    "WHERE Name = ?"
+    );
+    
+_LIT8( KGetDrives, 
+    "SELECT DriveNumber, DriveType, DriveName, Size, Quota, UsedQuota, "
+    "UniqueId, Active "
+    "FROM DrivesInfo "
+    "ORDER BY DriveType ASC"
+    );
+                                  
+// ---------------------------------------------------------------------------
+// INSERT clauses
+// ---------------------------------------------------------------------------
+//    
+// FillRuleGroup table
+_LIT8( KAddFillGroup,
+    "INSERT INTO FillRuleGroup("
+        "RuleGroupID, Name, Method, LimitType, Quantity, "
+        "Selected, Priority, TemplateId, MediaType, Status, RealCount, "
+        "RealSize )"
+        "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+        );
+        
+// Rules table
+_LIT8( KAddRule,
+    "INSERT INTO Rules("
+        "RuleID, RuleGroupID, MetadataField, Operator )"
+        "VALUES(?, ?, ?, ?)"
+        );
+        
+_LIT8( KAddRuleParam,
+    "INSERT INTO RuleParams("
+    "RuleParamID, RuleID, ComparisonFieldData, ComparisonFieldIndex )"
+    "VALUES(?, ?, ?, ?)"
+    );
+    
+_LIT8( KAddRuleGroupServer,
+    "INSERT INTO RuleGroupServers("
+    "RuleGroupID, MediaServerID )"
+    "VALUES(?, ?)"
+    );            
+
+_LIT8( KAddMediaServer,
+    "INSERT INTO MediaServers("
+    "MediaServerID, UDN, Name, SystemUpdateID, VisibleDate, "
+    "DownloadData, UploadData, DownloadTime, UploadTime, "
+    "IsActive, CopyCapability, FillUsage, StoreUsage )"
+    "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+    );
+
+_LIT8( KAddHashValue,
+    "INSERT INTO HashValues("
+    "MediaServerID, StartIndex, ItemCount, Hash )"
+    "VALUES(?, ?, ?, ?)"
+    );
+    
+    
+_LIT8( KAddStored,
+    "INSERT INTO Stored("
+    "StoredID, StoredFile, MediaServerID, Date )"
+    "VALUES(?, ?, ?, ?)"
+    );
+            
+_LIT8( KAddIDs,
+    "INSERT INTO IDs("
+    "IDValue, IDType )"
+    "VALUES(?, ?)"
+    );
+    
+_LIT8( KAddStoreRule,
+    "INSERT INTO StoreRules("
+    "StoreRuleId, Name, Selected, Status )"
+    "VALUES(?, ?, ?, ?)"
+    );
+    
+_LIT8( KAddStoreRuleParams,
+    "INSERT INTO StoreRuleParams("
+    "StoreRuleId, StoreRuleParamId, MediaType )"
+    "VALUES(?, ?, ?)"
+    );    
+
+_LIT8( KAddStoreRuleServers,
+    "INSERT INTO StoreRuleServers("
+    "StoreRuleId, MediaServerID )"
+    "VALUES(?, ?)"
+    );
+
+_LIT8( KAddFillFile, 
+    "INSERT INTO FillFiles("
+    "FileId, PrimaryText, SecondaryText, Path, Uri, ItemId, UpnpClass, "
+    "MediaType, Priority, Size, Status, Date, FillListId, MediaServerId, "
+    "RefId, Selected, DriveId, DriveNumber ) "
+    "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"  
+    );
+
+_LIT8( KAddStoreFile, 
+    "INSERT INTO StoreFiles("
+    "FileId, PrimaryText, SecondaryText, Path, Size, Date, StoreListId) "
+    "VALUES(?, ?, ?, ?, ?, ?, ?)"  
+    );    
+           
+_LIT8( KAddStoreFileServer, 
+    "INSERT INTO StoreFileServers("
+    "Fid, MediaServerId, Status ) "
+    "VALUES(?, ?, ?)"  
+    );
+        
+_LIT8( KInitShrinkingTime,
+    "INSERT INTO ImageShrinkingInfo("
+    "Count, Time ) "
+    "VALUES(0, 0)"      
+    );    
+        
+_LIT8( KInitTransferInfo,
+     "INSERT INTO TransferInfo("
+    "Service, Count, Time ) "
+    "VALUES(?,0,0)"    
+    );        
+
+_LIT8( KSetSyncTime,
+    "INSERT INTO SyncTime("
+    "Time ) "
+    "VALUES( ? )"
+    );
+    
+_LIT8( KSetProgressInfo,
+    "INSERT INTO ProgressInfo( "
+    "Trasferred, TotalCount ) "
+    "VALUES( ?, ? )"
+    ); 
+
+_LIT8( KSetDrivesInfo,
+    "INSERT INTO DrivesInfo("
+    "DriveNumber, DriveType, DriveName, Size, Quota, UsedQuota, UniqueId, "
+    "Active ) "
+    "VALUES( ?, ?, ?, ?, ?, ?, ?, ? )"
+    ); 
+                            
+// count queries
+   
+_LIT8( KValidateTableExistence,
+    "SELECT count(*)"
+        " FROM IDs"
+        );
+
+// Sum queries
+_LIT8( KFillListSize,
+    "SELECT SUM(Size) "
+    "FROM FillFiles "
+    "WHERE (( Status & ?) AND (FillListId = "
+    "(SELECT RuleGroupID FROM FillRuleGroup WHERE Name = ?)))"
+    );
+    
+_LIT8( KStoreListSize,
+    "SELECT SUM(Size) "
+    "FROM StoreFiles "
+    "WHERE ( StoreListId = "
+    "( SELECT StoreRuleId FROM StoreRules WHERE Name = ? ))"
+    );    
+
+_LIT8( KDataAmountFilled,
+    "SELECT SUM(Size) "
+    "FROM FillFiles "
+    "WHERE (( Status & 2 ) AND ( FillListId = ? ))" 
+    );
+_LIT8( KDataAmountToBeFilled,
+    "SELECT SUM(Size) "
+    "FROM FillFiles "
+    "WHERE (( Status & ?) AND (MediaServerId = ?) AND "
+    "( Selected = '1'))" 
+    );
+
+_LIT8( KDataAmountToBeStored,
+    "SELECT SUM(Size) "
+    "FROM StoreFiles JOIN StoreFileServers sfd ON FileId = sfd.Fid "
+    "WHERE ((sfd.MediaServerId = ?) AND (sfd.Status & ?))" 
+    );
+
+_LIT8( KTranferTime,
+    "SELECT Time "
+    "FROM TransferInfo "
+    "WHERE Service = ?"
+    );
+
+_LIT8( KGetStoreFileCountNoDuplicates, 
+    "SELECT COUNT( DISTINCT Fid ) "
+    "FROM StoreFileServers servers "
+    "JOIN StoreFiles files, StoreRules rules "
+    "ON (files.FileId = servers.Fid AND rules.StoreRuleId = files.StoreListId) "
+    "WHERE (servers.Status & ? AND rules.Selected = 1)" 
+    );    
+                             
+// ---------------------------------------------------------------------------
+// UPDATE / REPLACE clauses
+// ---------------------------------------------------------------------------
+//
+_LIT8( KUpdateMediaServerInfo,
+    "UPDATE MediaServers"
+        " SET Name = ?, "
+        "SystemUpdateID = ?, "
+        "VisibleDate = ?"
+        " WHERE UDN = ?"
+        );
+        
+_LIT8( KUpdateFillRule,
+    "UPDATE FillRuleGroup"
+    " SET Quantity = ?"
+    " WHERE Name = ?"
+    );
+    
+_LIT8( KUpdateID,
+    "UPDATE IDs"
+    " SET IDValue = ?"
+    " WHERE IDType = ?"
+    );
+    
+// Updating Fill rules selected state
+_LIT8( KUpdateFillRuleSelected, 
+    "UPDATE FillRuleGroup"
+    " SET Selected = ?"
+    " WHERE Name = ?"
+    );
+
+// Updating Fill rules selected state
+_LIT8( KUpdateFillRuleRealInformation, 
+    "UPDATE FillRuleGroup"
+    " SET RealCount = ?, RealSize = ?"
+    " WHERE RuleGroupID = ?"
+    );      
+
+// Updating download history
+_LIT8( KUpdateDownloadHistory,
+    "UPDATE MediaServers "
+    "SET DownloadData = DownloadData + ?, DownloadTime = DownloadTime + ? "
+    "WHERE MediaServerId = ?"
+    );
+        
+// Updating upload history        
+_LIT8( KUpdateUploadHistory,
+    "UPDATE MediaServers "
+    "SET UploadData = UploadData + ?, UploadTime = UploadTime + ? "
+    "WHERE MediaServerId = ?"
+    );
+    
+_LIT8( KIncrementImageShrinkingInfo,
+    "UPDATE ImageShrinkingInfo "
+    "SET Count = Count + ?, Time = Time + ?"
+    );    
+
+_LIT8( KUpdateTransferInfo,
+    "UPDATE TransferInfo "
+    "SET Count = ?, Time = ? "
+    "WHERE Service = ?"
+    );
+
+//updates active status, name, fillusage and storeusage
+_LIT8( KUpdateMsIsActive,
+    "UPDATE MediaServers "
+    "SET IsActive = ?, SystemUpdateID = ?, Name = ?, FillUsage = ?, StoreUsage = ? "
+    "WHERE UDN = ?"
+    );
+    
+_LIT8( KInitIsActiveFlags,
+    "UPDATE MediaServers "
+    "SET IsActive = '0'"
+    );    
+
+_LIT8( KUpdateFileStatus,
+    "UPDATE FillFiles "
+    "SET Status = ? "
+    "WHERE ( ( FileId = ? ) OR ( RefId = ? ) )"
+    );
+
+_LIT8( KUpdateFillItemPriorities, 
+    "UPDATE FillFiles "
+    "SET Priority = ?, Selected = ? "
+    "WHERE FillListId = "
+    "( SELECT RuleGroupID FROM FillRuleGroup "
+    "WHERE Name = ? )"
+    );
+
+//Updates Fill item's status if the status isn't equal to
+//ECmFilled    
+_LIT8( KUpdateFillItemStatusByRuleName, 
+    "UPDATE FillFiles "
+     "SET Status = ? "
+    "WHERE  FillListId = "
+    "( SELECT RuleGroupID FROM FillRuleGroup "
+    "WHERE Name = ? )"
+    "AND ( Status > '2' OR Status < '2' )"
+    "AND ( Status != '64' )"
+    );
+           
+// Updates highest priority item as a target for
+// the reference
+_LIT8( KUpdateFillItemRef_Zero,
+    "UPDATE FillFiles "
+    "SET RefId = '0' WHERE ( Priority = "
+    "( SELECT MIN( Priority ) FROM FillFiles "
+    "WHERE Selected = '1' ) )"
+    );
+
+_LIT8( KRestoreListItemStatuses, 
+    "UPDATE FillFiles "
+    "SET Status = ? "
+    "WHERE (( FillListId = ? ) AND ( RefId = '0' ) )"
+    );
+
+_LIT8( KRestoreFileStatus, 
+    "UPDATE FillFiles "
+    "SET Status = ? "
+    "WHERE ( FileId = ? OR RefId = ? )"
+    );
+
+_LIT8( KUpdateSelectionStatus,
+    "UPDATE FillFiles "
+    "SET Selected = ?, "
+    "FillListId = 255, "
+    "Priority = 255 "
+    "WHERE FillListId = ?"
+    );
+
+_LIT8( KUpdateStoreTransferStatus, 
+    "UPDATE StoreFileServers SET Status = ? WHERE "
+    "Fid = ? AND MediaServerId = ?;"
+    );
+            
+_LIT8( KUpdateFillTransferStatus, 
+    "UPDATE FillFiles SET Status = ?, Path = ?, "
+    "DriveId = ?, DriveNumber = ? WHERE "
+    "MediaServerId =? AND ((FileId =? AND FillListId =?) OR (RefId =?));"
+    );
+
+_LIT8( KUpdateFillDriveInfo,
+    "UPDATE FillFiles "
+        "SET DriveNumber = ?, "
+        "DriveId = ? "
+        "WHERE DriveId = ?"
+        );
+
+_LIT8( KUpdateFillDriveAndStatusInfo,
+    "UPDATE FillFiles "
+        "SET Path = ?, "
+        "DriveNumber = ?, "
+        "DriveId = ?, "
+        "Status = ? " // Set all to EToBeFilled
+        "WHERE DriveId = ?"
+        );
+                                            
+// ---------------------------------------------------------------------------
+// REMOVE clauses
+// ---------------------------------------------------------------------------
+//
+_LIT8( KRemoveMediaServersByUDN,
+    "DELETE FROM MediaServers"
+    " WHERE UDN = ?"
+    );
+    
+_LIT8( KRemoveFillRuleByName,
+    "DELETE FROM FillRuleGroup"
+    " WHERE Name = ?"
+    );
+        
+_LIT8( KRemoveRuleByRuleGroupID,
+    "DELETE FROM Rules"
+    " WHERE RuleGroupID = (SELECT "
+    "RuleGroupID "
+    "FROM FillRuleGroup "
+    "WHERE Name = ? )"
+    );
+
+_LIT8( KRemoveRuleParamsByRuleID,
+    "DELETE FROM RuleParams"
+    " WHERE RuleID = (SELECT "
+    "RuleID "
+    "FROM Rules "
+    "WHERE RuleGroupID = (SELECT "
+    "RuleGroupID "
+    "FROM FillRuleGroup "
+    "WHERE Name = ? ) )"
+    );
+
+_LIT8( KRemoveRuleGroupServers,
+    "DELETE FROM RuleGroupServers "
+    "WHERE RuleGroupID = (SELECT "
+    "RuleGroupID "
+    "FROM FillRuleGroup "
+    "WHERE Name = ? )"
+    );
+    
+/** Delete all fill rules */ 
+   
+_LIT8( KRemoveFillRuleAll,
+    "DELETE FROM FillRuleGroup"
+    );
+        
+_LIT8( KRemoveRuleAll,
+    "DELETE FROM Rules"
+    );
+
+_LIT8( KRemoveRuleParamAll,
+    "DELETE FROM RuleParams"
+    );
+
+_LIT8( KRemoveRuleGroupServerAll,
+    "DELETE FROM RuleGroupServers"
+    );
+    
+/** Delete all store rules */
+
+_LIT8( KRemoveStoreRuleServers,
+    "DELETE FROM StoreRuleServers"
+    );
+        
+_LIT8( KRemoveStoreRuleParams,
+    "DELETE FROM StoreRuleParams"
+    );
+
+_LIT8( KRemoveStoreRules,
+    "DELETE FROM StoreRules"
+    );
+
+_LIT8( KRemoveRuleGroupServer,
+    "DELETE FROM RuleGroupServers "
+    "WHERE RuleGroupID = ? AND MediaServerID = ?"
+    );
+    
+_LIT8( KRemoveStoreRuleServer,
+    "DELETE FROM StoreRuleServers "
+    "WHERE StoreRuleID = ? AND MediaServerID = ?"
+    );
+
+/** Delete All Filled files */
+_LIT8( KRemoveFillFiles, 
+    "DELETE FROM FillFiles"
+    );
+    
+/** Delete all fill rule's files */
+_LIT8( KRemoveFillList, 
+    "DELETE FROM FillFiles "
+    "WHERE FillListId = ( SELECT RuleGroupID FROM FillRuleGroup "
+    "WHERE Name = ?)"
+    );    
+    
+/** Delete all fillFiles by defined FillListId */
+_LIT8( KRemoveFillListItems, 
+    "DELETE FROM FillFiles "
+    "WHERE FillListId = ?"
+    );
+    
+/** Delete Stored file */
+_LIT8( KRemoveStoreFile, 
+    "DELETE FROM StoreFiles "
+    "WHERE PrimaryText = ?"
+    );    
+        
+/** Delete All Stored files */
+_LIT8( KRemoveStoreFiles, 
+    "DELETE FROM StoreFiles"
+    );
+    
+_LIT8( KRemoveStoreFileServers,
+    "DELETE FROM StoreFileServers"
+    );    
+ 
+/** Delete in active fill rule servers */
+_LIT8( KRemoveInActiveFillRuleServers,
+    "DELETE FROM RuleGroupServers "
+    "WHERE MediaServerID IN ( SELECT MediaServerID "
+    "FROM MediaServers WHERE MediaServers.FillUsage = '0' )"
+    ); 
+
+/** Delete in active store rule servers */    
+_LIT8( KRemoveInActiveStoreRuleServers,
+    "DELETE FROM StoreRuleServers "
+    "WHERE MediaServerID IN ( SELECT MediaServerID "
+    "FROM MediaServers WHERE StoreUsage = '0')"    
+    );
+    
+/** Delete in active fill files */    
+_LIT8( KRemoveInActiveFillFiles,
+    "DELETE FROM FillFiles "
+    "WHERE MediaServerId IN ( SELECT MediaServerID "
+    "FROM MediaServers WHERE FillUsage = '0' )" 
+    );    
+
+/** Delete in active store file servers */
+_LIT8( KRemoveInActiveStoreFilesServers,
+    "DELETE FROM StoreFileServers "
+    "WHERE MediaServerId IN ( SELECT MediaServerID "
+    "FROM MediaServers WHERE StoreUsage = '0')" 
+    ); 
+
+/** Delete in active store files */
+_LIT8( KRemoveInActiveStoreFiles,
+    "DELETE FROM StoreFiles "
+    "WHERE FileId NOT IN ( SELECT Fid "
+    "FROM StoreFileServers )"    
+    );
+
+_LIT8( KRemoveProgressInfo,
+    "DELETE FROM ProgressInfo"
+    );
+    
+_LIT8( KRemoveDrivesInfo,
+    "DELETE FROM DrivesInfo"
+    );    
+
+_LIT8( KRemoveSyncTime,
+    "DELETE FROM SyncTime"
+    );
+
+_LIT8( KRemoveDeletedFillFiles, 
+    "DELETE FROM FillFiles "
+    "WHERE Selected = '2'"
+    );
+
+_LIT8( KRemoveDeletedMediaServers, 
+    "DELETE FROM MediaServers "
+    "WHERE FillUsage = '0' AND StoreUsage = '0'"
+    );
+
+_LIT8( KRemoveHash,
+    "DELETE FROM HashValues "
+    "WHERE ( ( MediaServerID = ? ) AND ( StartIndex >= ? ) )"
+    );
+
+_LIT8( KSetNullRealSizes,
+    "UPDATE FillRuleGroup SET RealCount = '0', RealSize = '0' "
+    "WHERE RuleGroupID NOT IN "
+    "( SELECT FillListId FROM FillFiles ) "
+    );
+    
+// ---------------------------------------------------------------------------
+// TRANSACTION HANDLING
+// ---------------------------------------------------------------------------
+//
+_LIT8(KCmDbBeginTransaction, "BEGIN");
+_LIT8(KCmDbSqlCommit, "COMMIT");
+                                    
+#endif // __CMDMSQLCLAUSEDEF_H__
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/inc/cmdmsqldbmaintenance.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQL database maintenance class
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_CMDMSQLDBMAINTENANCE_H
+#define C_CMDMSQLDBMAINTENANCE_H
+
+#include <e32base.h>
+
+/** Literals */
+_LIT( KCmDatabase, "c:\\System\\Data\\MediaServant\\cm_database.sq");
+_LIT( KCmDbDir, "c:\\System\\Data\\MediaServant\\");
+
+/* Forward declarations. */
+class CCmDmSQLiteConnection;
+
+/**
+ *  CCmDmSqlDbMaintenance class
+ *  Part of Database manager. Database manager is part of
+ *  Content manager component.CCMDMSqlDbMaintenance creates needed
+ *  database tables and initializes connenction to the database
+ *
+ *  @lib cmdatabasemanager.lib
+ *
+ *  @since S60 5.1
+ */
+class CCmDmSqlDbMaintenance : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CCmDmSqlDbMaintenance* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CCmDmSqlDbMaintenance* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmDmSqlDbMaintenance();    
+    
+    /**
+     * Initializes database connection
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Error code
+     */    
+    TInt InitConnection( CCmDmSQLiteConnection& aConnection );
+
+    /**
+     * Closes database connection
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void CloseConnection( CCmDmSQLiteConnection& aConnection );
+
+    /**
+     * Creates db file
+     *
+     * @since S60 5.1
+     * @param aConnection, reference to connection class
+     * @return TInt, Error code
+     */  
+    TInt CreateDbFile( CCmDmSQLiteConnection& aConnection );
+        
+    /**
+     * Creates database tables
+     *
+     * @since S60 5.1
+     * @param aConnection, sqlite connection
+     * @return None
+     */        
+    void CreateDb( CCmDmSQLiteConnection& aConnection );
+
+    /**
+     * Creates database indexes
+     *
+     * @since S60 5.1
+     * @param aConnection, sqlite connection
+     * @return None
+     */        
+    void CreateIndexes( CCmDmSQLiteConnection& aConnection );
+
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmDmSqlDbMaintenance();
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+
+    };
+
+#endif //  C_CMDMSQLDBMAINTENANCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/inc/cmdmsqliteconnection.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1147 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQLite Connection class
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_CMDMSQLITECONNECTION_H
+#define C_CMDMSQLITECONNECTION_H
+
+#include <e32base.h>
+
+#include "sqldb.h" // Symbian SQLite
+#include "cmdmmain.h" // TCMQueryCmdType
+
+/* Forward declarations. */
+class CCmFillRule;
+class CCmMediaServerFull;
+class CCmStoreRule;
+class CCmBaseListItem;
+class CCmFillListItem;
+class CCmStoreListItem;
+class CCmDriveInfo;
+
+
+// CLASS DECLARATION
+ /**
+ *  Class represents methods to communication with SQLite database API.
+ *  @lib cmdatabasemanager.lib
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( CCmDmSQLiteConnection ): public CBase
+    {
+
+public:
+
+    // ID types
+    enum TTypeOfID
+        {
+        ERuleGroupID = 1,
+        ERuleID,
+        ERuleParamID,
+        EMediaServerID,
+        EStoredID,
+        EFilledID,
+        EStoreRuleID,
+        EStoreRuleParamID,
+        EFillFileListId,
+        EStoreFileListId
+        };
+        
+    /**
+     * Two-phased constructor.
+     */
+    static CCmDmSQLiteConnection* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCmDmSQLiteConnection* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCmDmSQLiteConnection();
+
+    /**
+     * Open database (creates if doesn't exist)
+     *
+     * @since S60 5.1
+     * @param aDb, Database filename and path
+     * @return TInt, Error code
+     */        
+    TInt OpenDb( const TDesC& aDb );
+
+    /**
+     * Close opened database
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void CloseDb();
+   
+    /**
+     * Initializes Database ids
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */        
+    void InitIDs();
+    
+    /**
+     * Initializes Database id
+     *
+     * @since S60 5.1
+     * @param aType, ID type
+     * @return None
+     */           
+    void SetID( TTypeOfID aType );
+
+    /**
+     * Backups id to database
+     *
+     * @since S60 5.1
+     * @param aType, ID type
+     * @param aID, ID value
+     * @return None
+     */            
+    void BackUpIdL( TTypeOfID aType, TUint64 aID );
+        
+    /**
+     * Loads Database ids
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */            
+    void LoadIDs();
+    
+    /**
+     * Loads Database id
+     *
+     * @since S60 5.1
+     * @param aId, ID value
+     * @param aType, ID type
+     * @return None
+     */        
+    void LoadIDL( TUint64& aId, TTypeOfID aType );
+
+    /**
+     * Creates db file
+     * @since S60 5.1
+     * @param aDb, Database filename and path
+     * @return TInt, error code
+     */  
+    TInt CreateDbFile( const TDesC& aDb ); 
+        
+    /**
+     * Check Validity of database
+     *
+     * @since S60 5.1
+     * @param None
+     * @return ETrue if database is OK
+     */            
+    TBool Validate();
+    
+    /**
+     * Execute sql command (not a query)
+     *
+     * @since S60 5.1
+     * @param aCommand, SQL clause to be executed (can include wildcards)
+     * @return TInt, KErrNone if successful, otherwise one of the error codes.
+     */
+    void ExecuteL( const TDesC8& aCommand );
+ 
+    /**
+     * Sets fill file list into db
+     *
+     * @since S60 5.1
+     * @param aItems, fill list item array
+     * @return TInt, Error code
+     */            
+    TInt SetFillFiles( RPointerArray<CCmFillListItem>& aItems );
+    
+    /**
+     * Sets store file list into db
+     *
+     * @since S60 5.1
+     * @param aItems, store list item array
+     * @return TInt, Error code
+     */    
+    TInt SetStoreFilesL( RPointerArray<CCmStoreListItem>& aItems );
+
+    /**
+     * Set one store file into db
+     *
+     * @since S60 5.1
+     * @param aItem, store list item
+     * @return TInt, Error code
+     */      
+    TInt AddStoreFile( CCmStoreListItem& aItem );
+    
+    /**
+     * Add stored media into database
+     *
+     * @since S60 5.1
+     * @param aFileName, store file name
+     * @param aUDN, mediaserver udn
+     * @param aTimeStamp, timestamp
+     * @return TInt, Error code
+     */                
+    TInt AddStoredL( 
+        const TDesC& aFileName, 
+        const TDesC8& aUDN, 
+        TTime aTimeStamp );
+
+    /**
+     * Add fill rule into database
+     *
+     * @since S60 5.1
+     * @param aFillRule, fill list
+     * @return TInt, Error code
+     */              
+    TInt AddFillRuleL( CCmFillRule* aFillRule );
+    
+    /**
+     * Add fill rule specific media servers
+     *
+     * @since S60 5.1
+     * @param aFillRule, fill list
+     * @return TInt, Error code
+     */            
+    TInt AddFillRuleMediaServersL( CCmFillRule* aFillRule );
+
+    /**
+     * Add fill rule informations and parameters
+     *
+     * @since S60 5.1
+     * @param aFillRule, fill list
+     * @return TInt, Error code
+     */            
+    TInt AddFillRuleRulesAndParamsL( CCmFillRule* aFillRule );
+    
+    /**
+     * Add store rule
+     *
+     * @since S60 5.1
+     * @param aStoreRule, store list
+     * @return TInt, Error code
+     */        
+    TInt AddStoreRuleL( CCmStoreRule* aStoreRule );
+
+    /**
+     * Add store rule informations and parameters
+     *
+     * @since S60 5.1
+     * @param aStoreRule, store list
+     * @return TInt, Error code
+     */        
+    TInt AddStoreRuleParamsL( CCmStoreRule* aStoreRule );
+
+    /**
+     * Add store rule mediaServers
+     *
+     * @since S60 5.1
+     * @param aStoreRule, store list
+     * @return TInt, Error code
+     */        
+    TInt AddStoreRuleMediaServersL( CCmStoreRule* aStoreRule );
+
+    /**
+     * Add media server info into database
+     *
+     * @since S60 5.1
+     * @param aMediaServer, media server
+     * @return TInt, Error code
+     */              
+    TInt AddMediaServerL( CCmMediaServerFull* aMediaServer );
+
+    /**
+     * Add hash value
+     *
+     * @since S60 5.1
+     * @param aMediaServer, media server id
+     * @param aHashValue, hash value
+     * @return TInt, Error code
+     */
+    TInt AddHashValue( TInt64 aMediaServerId, 
+                                       CCmSearchResponseHash* aHashValue );
+
+    /**
+     * Query hash value
+     *
+     * @since S60 5.1
+     * @param aMediaServer, media server id
+     * @param aHashValues, hash values
+     * @return TInt, Error code
+     */    
+    TInt QueryHashValuesL( TInt aMediaServer, 
+        RPointerArray<CCmSearchResponseHash>& aHashValues );
+    
+    /**
+     * Sets is active status of the media server
+     * Sets the Media server's name
+     * @since S60 5.1
+     * @param aServers, server list
+     * @return TInt, Error code 
+     */        
+    TInt SetMediaServersL( 
+        RPointerArray<CCmMediaServerFull>& aServers );    
+
+    /**
+     * Sets last syncs time
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Error code 
+     */    
+     TInt SetSyncTime();
+
+    /**
+     * Gets last syncs time
+     * @since S60 5.1
+     * @param aTime last sync time
+     * @return TInt, Error code 
+     */        
+    TInt GetSyncTime( TTime& aTime );
+
+    /**
+     * Sets Progress info
+     * @since S60 5.1
+     * @param aTransferred how many files transferred
+     * @param aTotalCount how many will be trasferred
+     * @return TInt, Error code 
+     */    
+    TInt SetProgressInfo( TInt aTransferred, TInt aTotalCount );
+
+    /**
+     * Gets Progress info
+     * @since S60 5.1
+     * @param aTransferred how many files transferred
+     * @param aTotalCount how many will be trasferred
+     * @return TInt, Error code 
+     */    
+    TInt GetProgressInfo( TInt& aTransferred, TInt& aTotalCount );
+
+    /**
+     * Sets Drives info
+     * @since S60 5.1
+     * @param aDrives, drives to be set into database
+     * @return TInt, None
+     */ 
+    void SetDrivesL( RPointerArray<CCmDriveInfo>& aDrives );
+            
+    /**
+     * Delete media server info from the database
+     *
+     * @since S60 5.1
+     * @param aUDN, server udn
+     * @return TInt, Error code
+     */        
+    TInt DeleteMediaServer( const TDesC8& aUDN );
+
+    /**
+     * Delete fill rule
+     *
+     * @since S60 5.1
+     * @param aName, fill list name
+     * @return TInt, Error code
+     */            
+    TInt DeleteFillRuleByName( const TDesC8& aName );
+
+    /**
+     * Delete all fill rules
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Error code
+     */                
+    TInt DeleteAllFillRules();
+
+    /**
+     * Delete all store rules
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Error code
+     */    
+    TInt DeleteAllStoreRules(); 
+    
+    /**
+     * Delete all fill files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Error code
+     */             
+    TInt DeleteFillFiles();
+
+    /**
+     * Delete all store files
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Error code
+     */         
+    TInt DeleteStoreFiles();
+
+    /**
+     * Delete deleted items 
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */     
+    void DeleteDeletedItemsL();
+    
+    /**
+     * Delete deleted media servers
+     *
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */      
+    void DeleteDeletedMediaServersL();
+
+    /**
+    * Deletes hash values
+    *
+    * @since S60 5.1
+    * @param aMediaServerId, media server id
+    * @param aSearchIndex, search index
+    * @return None
+    */   
+    void DeleteHashValuesL( const TInt aMediaserverId,
+            const TInt aSearchIndex );
+                    
+    /**
+     * Update media server info
+     *
+     * @since S 60 5.1
+     * @param aMediaServer, mediaserver
+     * @return TInt, Error code
+     */            
+    TInt UpdateMediaServerInfo( CCmMediaServerFull* aMediaServer );
+    
+    /**
+     * Update Fill rules selected state
+     *
+     * @since S60 5.1
+     * @param aName, fill list name
+     * @param aSelected, selection status
+     * @return TInt, Error code
+     */        
+    TInt UpdateFillRuleSelected( const TDesC8& aName, TInt aSelected );
+    
+    /**
+    * update the fill rule realsize and realcount field
+    * @since S60 5.1
+    * @return TInt, error code
+    */      
+    TInt UpdateFillRuleGroupInfo();
+
+    /**
+     * Update download history 
+     *
+     * @since S60 5.1
+     * @param aMediaServerId, mediaserver id
+     * @param aDownloadData, download data size
+     * @param aDownloadTime, download time
+     * @return TInt, Error code
+     */          
+    TInt UpdateDownloadHistory( TUint aMediaServerId, TInt64& aDownloadData,
+                                TInt64& aDownloadTime );
+
+    /**
+     * Update upload history 
+     *
+     * @since S60 5.1
+     * @param aMediaServerId, mediaserver id
+     * @param aUploadData, upload data size
+     * @param aUploadTime, upload time
+     * @return TInt, Error code
+     */                                     
+    TInt UpdateUploadHistory( TUint aMediaServerId, TInt64& aUploadData, 
+                            TInt64& aUploadTime );
+
+    /**
+     * Update status values
+     *
+     * @since S60 5.1
+     * @param aStatusValues, item statuses
+     * @return TInt, Error code 
+     */
+    TInt UpdateStatusValues( 
+        RPointerArray<CCmBaseListItem>& aStatusValues );
+
+    /**
+     * Update fill list drive statuses
+     *
+     * @since S60 5.1
+     * @param aDrive, drive info
+     * @para aDriveSelected, if ETrue drive selected but slot changed
+     * @return None 
+     */     
+    void UpdateFillListDriveStatusesL( CCmDriveInfo* aOrigDrive, 
+        CCmDriveInfo* aNewDrive, TBool aDriveSelected ); 
+                                            
+    /**
+     * Update fill list item priorities and status
+     *
+     * @since S60 5.1
+     * @param aContainer, fill list container 
+     * @return TInt, Error code 
+     */
+    TInt UpdateFillListItemPriority( CCmFillRuleContainer* aContainer );
+
+    /**
+     * Update fill selection state into fill file table
+     *
+     * @since S60 5.1
+     * @param aListName, fill list name
+     * @param aState, list status
+     * @return None
+     */
+    void SetFillListStateL( const TUint aListName, 
+        TCmFillRuleStatus aState );
+
+    /**
+     * Restoring file statuses
+     *
+     * @since S60 5.1
+     * @param aFileNames, array of filled items
+     * @param aListName, list name
+     * @return None
+     */
+    void RestoreFileStatusesL( 
+        const RPointerArray<CCmFillListItem>& aItems, 
+        const TDesC8& aListName );
+
+    /**
+     * DoRestoring file statuses
+     *
+     * @since S60 5.1
+     * @param aItems, array of filled items
+     * @param aStatus, Status to be restored
+     * @return None
+     */
+    void DoRestoreFileStatusesL( 
+        const RPointerArray<CCmFillListItem>& aItems,
+        const TUint aStatus );
+                    
+    /**
+     * Initializes all reference ids to zero
+     * @since S60 5.1
+     * @param None
+     * @return None
+     */    
+    void SetRefIdsToZero();
+              
+    /**
+     * Increment image shrinking history info
+     * @since S60 5.1
+     * @param aImageCount, image count
+     * @param aMilliSeconds, shrinking time
+     * @return TInt, Error code 
+     */            
+    TInt IncrementShrinkTimeL( TInt aImageCount, 
+        TInt aMilliSeconds );
+    
+    /**
+     * Prepare query
+     *
+     * @since S60 5.1
+     * @param Type, query type
+     * @return None
+     */         
+    void PrepareQueryCmdL( TCMQueryCmdType aType );
+    
+    /**
+     * Query fill rule
+     *
+     * @since S60 5.1
+     * @param aFillRule, fill list
+     * @return TInt, Error code
+     */         
+    TInt QueryFillRuleL( CCmFillRule* aFillRule );
+
+    /**
+     * Query fill rule servers
+     *
+     * @since S60 5.1
+     * @param aFillRule, fill list
+     * @param aRuleGroupID, rule group id
+     * @return TInt, Error code
+     */    
+    TInt QueryFillRuleServersL( CCmFillRule* aFillRule, 
+                                TUint64 aRuleGroupID );
+    
+    /**
+     * Query fill rule params
+     *
+     * @since S60 5.1
+     * @param aFillRule, fill list
+     * @return TInt, Error code
+     */    
+    TInt QueryFillRuleParamsL( CCmFillRule* aFillRule );
+
+    /**
+     * Query selected ( 1 = selected and  0 = unselected ) 
+     * fill rule names
+     *
+     * @since S60 5.1
+     * @param aNames, list names
+     * @param aSelected, selection status
+     * @return None
+     */             
+    void QuerySelectedFillRuleNamesL( RPointerArray<HBufC8>& aNames, 
+        TInt aSelected );
+
+    /**
+     * Query names of all fill rules
+     *
+     * @since S60 5.1
+     * @param aNames, on return fill rule names
+     * @return None
+     */         
+    void QueryFillRuleNamesL( RPointerArray<HBufC8>& aNames );
+
+    /**
+     * Query store rule
+     *
+     * @since S60 5.1
+     * @param aStoreRule, store list
+     * @return TInt, Error code
+     */        
+    TInt QueryStoreRuleL( CCmStoreRule* aStoreRule );
+    
+    /**
+     * Query store rule defs
+     *
+     * @since S60 5.1
+     * @param aStoreRule, store list
+     * @param aRuleGroupID, rule group id
+     * @return TInt, Error code
+     */        
+    TInt QueryStoreRuleDefsL( CCmStoreRule* aStoreRule, 
+                              TUint64 aRuleGroupID );
+
+    /**
+     * Query store rule names
+     *
+     * @since S60 5.1
+     * @param aNames, store list names
+     * @return None
+     */        
+    void QueryStoreRuleNamesL( RPointerArray<HBufC8>& aNames );
+
+    /**
+     * Query selected store rule namess
+     *
+     * @since S60 5.1
+     * @param aNames, store list names
+     * @param aSelected, selection status
+     * @return TInt, Error code
+     */        
+    void QuerySelectedStoreRuleNamesL( RPointerArray<HBufC8>& aNames,
+        TInt aSelected );  
+        
+    /**
+     * Query media server
+     *
+     * @since S60 5.1
+     * @param aMediaServer, mediaserver
+     * @return TInt, Error code
+     */             
+    TInt QueryMediaServerL( CCmMediaServerFull* aMediaServer );
+
+    /**
+     * Query media server Id
+     *
+     * @since S60 5.1
+     * @param aUDN, server udn
+     * @return TInt64, Server id
+     */         
+    TInt64 QueryMediaServerId( const TDesC8& aUDN );
+
+    /**
+     * Query media server udn
+     *
+     * @since S60 5.1
+     * @param aUDN, server udn
+     * @param aId, server id
+     * @return TInt, Error code
+     */        
+    TInt QueryMediaServerUdn( HBufC8*& aUdn, 
+        const TInt32 aId );    
+
+    /**
+     * Query all media servers
+     *
+     * @since S60 5.1
+     * @param aMediaServer, mediaserver
+     * @return TInt, Error code
+     */    
+    TInt QueryAllMediaServersL( CCmMediaServerFull* aMediaServer );
+    
+    /**
+     * Get media servers
+     *
+     * @since S60 5.1
+     * @param aMediaServers, mediaserver list
+     * @return None 
+     */    
+    void GetMediaServersL( 
+        RPointerArray<CCmMediaServerFull>& aMediaServers );    
+         
+    /**
+     * Query all lowest priority filled files
+     *
+     * @since S60 5.1
+     * @param aDrive, drive id
+     * @param aFilled, list of filled items
+     * @return TInt, Error code 
+     */             
+    TInt GetLowPriorityFilledFilesL( TInt aDrive,
+        RPointerArray<CCmFillListItem>& aFilled );
+
+    /**
+     * Query all files defined in fill file list using fill list name as
+     * a query parameter
+     *
+     * @since S60 5.1
+     * @param aItems, fill list items
+     * @param aName, fill list name
+     * @param aStatus, selection status
+     * @return TInt, Error code 
+     */        
+    TInt QueryFillFileListL( 
+        RPointerArray<CCmBaseListItem>& aItems, 
+        const TDesC8& aName, 
+        TUint aStatus );
+        
+     /**
+     * Query fill file list
+     * @since S60 5.1
+     * @param aItems, fill list items
+     * @param aStatus, list status
+     * @return TInt, Error code 
+     */    
+    TInt GetAllFillFilesL( 
+        RPointerArray<CCmFillListItem>& aItems, TUint aStatus );    
+        
+    /**
+     * Query all files defined in store file list using store list name as
+     * a query parameter
+     *
+     * @since S60 5.1
+     * @param aItems, store list items
+     * @param aName, store list name
+     * @param aStatus, store list status
+     * @return TInt, Error code 
+     */            
+    TInt QueryStoreFileListL( 
+        RPointerArray<CCmBaseListItem>& aItems, 
+        const TDesC8& aName, 
+        TUint aStatus );
+
+     /**
+     * Query store file list
+     * @since S60 5.1
+     * @param aItems, store list items
+     * @param aStatus, list status
+     * @return TInt, Error code 
+     */    
+    TInt GetAllStoreFilesL( 
+        RPointerArray<CCmStoreListItem>& aItems, TUint aStatus );
+                
+    /**
+     * Query all files defined in fill file list
+     *
+     * @since S60 5.1
+     * @param aItems, fill list items
+     * @return TInt, Error code 
+     */        
+    TInt QueryAllFillFilesL( RPointerArray<CCmFillListItem>& aItems);
+
+    /**
+     * Query all files defined in store file list
+     *
+     * @since S60 5.1
+     * @param aItems, store list items
+     * @return TInt, Error code 
+     */        
+    TInt QueryAllStoreFilesL( RPointerArray<CCmStoreListItem>& aItems );
+         
+    /**
+     * Query stored row
+     *
+     * @since S60 5.1
+     * @param aFiles, stored items
+     * @param aUDN, server udn
+     * @param aAmount, item count
+     * @return None
+     */         
+    void QueryStoredRowL( 
+        RPointerArray<HBufC16>& aFiles, 
+        const TDesC8& aUDN, 
+        TInt aAmount );
+
+    /**
+     * Query transfer history
+     *
+     * @since S60 5.1
+     * @param aUdn, server udn
+     * @param aDownloadData, downloaded data
+     * @param aUploadData, uploaded data
+     * @param aDownloadTime, download time
+     * @param aUploadTime, upload time
+     * @return None
+     */        
+    void QueryTransferHistory( 
+        const TDesC8& aUdn, 
+        TInt64& aDownloadData, 
+        TInt64& aUploadData, 
+        TInt64& aDownloadTime, 
+        TInt64& aUploadTime );
+
+
+    /**
+     * Query deleted items list
+     *
+     * @since S60 5.1
+     * @param aUdn, server udn
+     * @param aArray, deleted items
+     * @param aStatus, item status
+     * @return None 
+     */  
+    void QueryDeletedItemsListsL( 
+        RPointerArray<CCmBaseListItem>& aArray, TUint aStatus );
+        
+    /**
+     * Query drives
+     *
+     * @since S60 5.1
+     * @param aDrives, drive array
+     * @return None 
+     */     
+    void QueryDrivesL( RPointerArray<CCmDriveInfo>& aDrives ); 
+    
+    /**
+     * Avarage image shrinking time 
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, Avarage image shrinking time in millisecond 
+     */        
+    TInt GetAvgImageShrinkTime();
+
+    /**
+     * Get list name using list id 
+     *
+     * @since S60 5.1
+     * @param aListName, name of the fill list
+     * @param aListId, id of the named list
+     * @return None
+     */     
+    void GetFillListNameL( HBufC8*& aListName, 
+        const TInt64 aListId );
+            
+    /**
+     * Returns size of the named fill list
+     *
+     * @since S60 5.1
+     * @param aListName, fill list name
+     * @param aStatus, list status
+     * @return TInt64, size of the list
+     */    
+    TInt64 FillListSize( const TDesC8& aListName, TUint aStatus );
+    
+    /**
+     * Returns size of the named store list
+     *
+     * @since S60 5.1
+     * @param aListName, store list name
+     * @param aStatus, lis status
+     * @return TInt64, size of the list
+     */    
+    TInt64 StoreListSize( const TDesC8& aListName, TUint aStatus );
+
+    /**
+     * Returns file count which are waiting to be stored
+     *
+     * @since S60 5.1
+     * @param aStatus, item status
+     * @return TInt, size of the list
+     */        
+    TInt StoreFileCount( TUint aStatus );
+
+    /**
+     * Returns file count which are waiting to be stored
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, size of the list
+     */      
+    TInt StoreFileCountNoDuplicates();
+
+    /**
+     * Returns file count which are waiting to be filled
+     *
+     * @since S60 5.1
+     * @param aStatus, item status
+     * @return TInt, size of the list
+     */    
+    TInt FillFileCount( TUint aStatus );
+    
+    /**
+     * Returns data amount filled
+     * @since S60 v3.1
+     * @param aID id of fill rule
+     * @return sum of file sizes
+     */        
+    TInt64 BytesFilled( TUint aID );
+
+    /**
+     * @since S60 5.1
+     * @param aMediaServerId, mediaserver id
+     * @param aStatus, item status
+     * @return TInt64, sum of file sizes
+     */        
+    TInt64 KBytesToBeFilled( TUint8 aMediaServerId, 
+        TUint aStatus );
+
+    /**
+     * Returns data amount to be stored
+     *
+     * @since S60 5.1
+     * @param aMediaServerId, mediaserver id
+     * @param aStatus, item status
+     * @return TInt64, sum of file sizes
+     */        
+    TInt64 KBytesToBeStored( TUint8 aMediaServerId, 
+        TUint aStatus );    
+    
+    /**
+     * Updates list size and approx. transfer time
+     *
+     * @since S60 5.1
+     * @param aService, service
+     * @param aCount, pieces
+     * @param aTime, in milliseconds
+     * @return TInt, error code
+     */           
+    TInt UpdateTransferInfo( TCmService aService, 
+        TInt aCount, TInt aTime );     
+
+    /**
+     * Updates file status
+     *
+     * @since S60 5.1
+     * @param aStatus, transfer status
+     * @param aFid, file id
+     * @param aMsId, server id
+     * @return None
+     */         
+    void UpdateStoreTransferStatus( TUint aStatus,
+        TInt64 aFid, TInt64 aMsId ); 
+
+    /**
+     * Updates file status
+     *
+     * @since S60 5.1
+     * @param aStatus, transfer status
+     * @param aItem, fill list item
+     * @return None
+     */
+    void UpdateFillTransferStatus( TUint aStatus, 
+        CCmFillListItem* aItem );
+        
+    /**
+     * Get list size and approx. transfer time
+     *
+     * @since S60 5.1
+     * @param aService, service
+     * @param aCount, pieces
+     * @param aTime, in milliseconds
+     * @return TInt, error code
+     */            
+    TInt GetTransferInfo( TCmService aService, TInt& aCount, TInt& aTime );
+
+    /**
+     * Files to be stored and included into specified list
+     *
+     * @since S60 5.1
+     * @param aListName, store list name
+     * @param aStatus, list status
+     * @param aCount, pieces
+     * @return TInt, error code
+     */            
+    TInt GetStoreFileCount( 
+        const TDesC8& aListName, 
+        TUint aStatus, 
+        TInt& aCount );
+             
+    /**
+     * Files to be filled and included into specified list
+     *
+     * @since S60 5.1
+     * @param aListName, fill list name
+     * @param aStatus, list status
+     * @param aCount, pieces
+     * @return TInt, error code
+     */            
+    TInt GetFillFileCount( 
+        const TDesC8& aListName, 
+        TUint aStatus, 
+        TInt& aCount );
+
+    /**
+     * Files to be stored
+     * @since S60 5.1
+     * @param aCount, file count
+     * @param aStatus, status
+     * @return None
+     */
+    void GetStoreFileCountNoDuplicatesL( TInt& aCount, TUint aStatus );
+    
+    /**
+     * Sets fill list real information
+     *
+     * @since S60 5.1
+     * @param aListId, fill list id
+     * @param aRealCount, real item count
+     * @param aRealSize, real data size
+     * @return None
+     */          
+    void SetFillListRealCountAndSizeL( TInt64 aListId, 
+        TInt64 aRealCount, TInt64 aRealSize );            
+    
+    /**
+     * Deletes in active rule servers
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */
+    TInt DeleteInActiveRuleServers();
+    
+    /**
+     * Deletes in active rule servers
+     *
+     * @since S60 5.1
+     * @param None
+     * @return TInt, error code
+     */    
+    TInt DeleteInActiveFiles();
+    
+    /**
+     * Deletes item by FillListId
+     *
+     * @since S60 5.1
+     * @param FillListId, fill list id
+     * @return TInt error code
+     */ 
+    TInt DeleteItemsByFillListId( TInt aFillListId );
+                
+    /**
+     * Returns rule id with defined type
+     *
+     * @since S60 5.1
+     * @param aName, rule name
+     * @param aType, rule type
+     * @return TInt64, Rule id
+     */    
+    TInt64 RuleId( const TDesC8& aName, TCmRuleType aType );
+    
+               
+private:
+
+    /**
+     * Performs the first phase of two phase construction.
+     */
+    CCmDmSQLiteConnection();
+
+    /**
+     * Performs the second phase construction.
+     */
+    void ConstructL();
+    
+
+private:
+    
+    /**
+     * iDatabase, interface to Sqlite database
+     */    
+    RSqlDatabase iDatabase;
+    
+    /**
+     * iStatement, interface to Sqlite database
+     */
+    RSqlStatement iStatement;
+    
+    /**
+     * rule group id
+     */
+    TUint64 iRuleGroupID;
+    /**
+     * rule id
+     */
+    TUint64 iRuleID;
+    /**
+     * rule param id
+     */
+    TUint64 iRuleParamID;
+    /**
+     * mediaserver id
+     */    
+    TUint64 iMediaServerID;
+    /**
+     * stored id
+     */    
+    TUint64 iStoredID;
+    /**
+     * filled id
+     */
+    TUint64 iFilledID;
+    /**
+     * store rule id
+     */
+    TUint64 iStoreRuleID;
+    /**
+     * store rule param id
+     */
+    TUint64 iStoreRuleParamID;
+    /**
+     * fill file id
+     */    
+    TUint64 iFillFileId;
+    /**
+     * store file id
+     */
+    TUint64 iStoreFileId;    
+    /**
+     * Query handle
+     */
+    TInt iHandle;
+    
+    };
+
+#endif //  C_CMDMSQLITECONNECTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/inc/cmdmsqlmaintenanceclauses.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Includes SQL clauses for creating and dropping tables 
+*
+*/
+
+
+
+
+
+
+#ifndef __CMDMSQLMAINTENANCECLAUSES_H__
+#define __CMDMSQLMAINTENANCECLAUSES_H__
+
+///////////////////////////////////////////////////////////////////
+// DROP CLAUSES
+///////////////////////////////////////////////////////////////////
+
+// Drop tables
+_LIT8( KDropFillRuleGroup,      "DROP TABLE FillRuleGroup;" );
+_LIT8( KDropRules,              "DROP TABLE Rules;" );
+_LIT8( KDropRuleParams,         "DROP TABLE RuleParams;" );
+_LIT8( KDropRuleGroupServers,   "DROP TABLE RuleGroupServers;" );
+_LIT8( KDropMediaServers,       "DROP TABLE MediaServers;" );
+_LIT8( KDropHashValues,         "DROP TABLE HashValues;" );
+_LIT8( KDropStored,             "DROP TABLE Stored;" );
+_LIT8( KDropFilled,             "DROP TABLE Filled;" );
+_LIT8( KDropIDs,                "DROP TABLE IDs;" );
+_LIT8( KDropStoreRules,         "DROP TABLE StoreRules;" );
+_LIT8( KDropStoreRuleParams,    "DROP TABLE StoreRuleParams;");
+_LIT8( KDropStoreRuleServers,   "DROP TABLE StoreRuleServers;");
+
+_LIT8( KDropFillFiles,          "DROP TABLE FillFiles;");
+_LIT8( KDropStoreFiles,         "DROP TABLE StoreFiles;");
+_LIT8( KDropStoreFileServers,   "DROP TABLE StoreFileServers;");
+_LIT8( KDropImageShrinkingInfo, "DROP TABLE ImageShrinkingInfo;");
+_LIT8( KDropTransferInfo,       "DROP TABLE TransferInfo;");
+_LIT8( KDropSyncTime,           "DROP TABLE SyncTime;");
+_LIT8( KDropProgressInfo,       "DROP TABLE ProgressInfo;"); 
+
+_LIT8( KDropDrivesInfo,          "DROP TABLE DrivesInfo;");
+
+///////////////////////////////////////////////////////////////////
+// CREATE CLAUSES FOR TABLES
+///////////////////////////////////////////////////////////////////
+
+// ONTOLOGY TABLES
+_LIT8( KCreateFillRuleGroup,
+        "CREATE TABLE FillRuleGroup("
+            "RuleGroupID        INTEGER NOT NULL,"
+            "Name               TEXT NOT NULL,"
+            "Method             INTEGER,"
+            "LimitType          INTEGER,"
+            "Quantity           INTEGER,"
+            "Selected           INTEGER,"
+            "Priority           INTEGER,"
+            "TemplateId         INTEGER,"
+            "MediaType          INTEGER,"
+            "Status             INTEGER,"
+            "RealCount          INTEGER,"
+            "RealSize           INTEGER,"
+            "PRIMARY KEY(RuleGroupID));"
+            );
+
+_LIT8( KCreateRules, 
+        "CREATE TABLE Rules("
+            "RuleID             INTEGER NOT NULL,"
+            "RuleGroupID        INTEGER NOT NULL,"
+            "MetadataField      INTEGER,"
+            "Operator           INTEGER,"
+            "PRIMARY KEY(RuleID));"
+            );
+
+_LIT8( KCreateRuleParams, 
+        "CREATE TABLE RuleParams("
+            "RuleParamID        INTEGER NOT NULL,"
+            "RuleID             INTEGER NOT NULL,"
+            "ComparisonFieldData TEXT,"
+            "ComparisonFieldIndex INTEGER,"
+            "PRIMARY KEY(RuleParamID));"
+            );
+            
+_LIT8( KCreateRuleGroupServers, 
+        "CREATE TABLE RuleGroupServers("
+            "RuleGroupID        INTEGER NOT NULL,"
+            "MediaServerID      INTEGER NOT NULL);"
+            );
+            
+_LIT8( KCreateMediaServers, 
+        "CREATE TABLE MediaServers("
+            "MediaServerID          INTEGER NOT NULL,"
+            "UDN                    TEXT NOT NULL,"
+            "Name                   TEXT NOT NULL,"
+            "SystemUpdateID         INTEGER,"
+            "VisibleDate            DATETIME,"
+            "DownloadData           INTEGER,"
+            "UploadData             INTEGER,"
+            "DownloadTime           INTEGER,"
+            "UploadTime             INTEGER,"
+            "IsActive               INTEGER,"
+            "CopyCapability         INTEGER,"
+            "FillUsage              INTEGER,"
+            "StoreUsage             INTEGER,"
+            "PRIMARY KEY(MediaServerID));"
+            );
+
+_LIT8( KCreateHashValues, 
+        "CREATE TABLE HashValues("
+            "HashValueID            INTEGER NOT NULL,"
+            "MediaServerID          INTEGER NOT NULL,"
+            "StartIndex             INTEGER NOT NULL,"
+            "ItemCount              INTEGER NOT NULL,"
+            "Hash                   TEXT NOT NULL,"
+            "PRIMARY KEY(HashValueID));"
+            );
+            
+            
+_LIT8( KCreateStored, 
+        "CREATE TABLE Stored("
+            "StoredFile             TEXT NOT NULL,"
+            "StoredID               INTEGER NOT NULL,"
+            "MediaServerID          INTEGER NOT NULL," 
+            "Date                   DATETIME,"
+            "PRIMARY KEY(StoredID));"
+            );           
+
+_LIT8( KCreateIDs, 
+        "CREATE TABLE IDs("
+            "IDValue                INTEGER NOT NULL,"
+            "IDType                 INTEGER NOT NULL,"
+            "PRIMARY KEY(IDType));"
+            );
+            
+_LIT8( KCreateStoreRules, 
+        "CREATE TABLE StoreRules("
+            "StoreRuleId            INTEGER NOT NULL,"
+            "Name                   TEXT NOT NULL,"
+            "Selected               INTEGER,"
+            "Status                 INTEGER,"
+            "PRIMARY KEY(StoreRuleId));"
+            );
+            
+_LIT8( KCreateStoreRuleParams, 
+        "CREATE TABLE StoreRuleParams("
+            "StoreRuleId            INTEGER NOT NULL,"
+            "StoreRuleParamId       INTEGER NOT NULL,"
+            "MediaType              INTEGER,"
+            "PRIMARY KEY(StoreRuleParamId));"
+            );
+
+_LIT8( KCreateStoreRuleServers, 
+        "CREATE TABLE StoreRuleServers("
+            "StoreRuleId            INTEGER NOT NULL,"
+            "MediaServerID          INTEGER NOT NULL);"
+            );
+                   
+_LIT8( KCreateFillFiles, 
+        "CREATE TABLE FillFiles("
+            "FileId                 INTEGER NOT NULL,"
+            "PrimaryText            TEXT NOT NULL,"    
+            "SecondaryText          TEXT,"    
+            "Path                   TEXT,"
+            "Uri                    TEXT NOT NULL,"
+            "ItemId                 TEXT NOT NULL,"
+            "UpnpClass              TEXT,"
+            "MediaType              INTEGER,"
+            "Priority               INTEGER,"// Highest priority is zero
+            "Size                   INTEGER,"// In bytes
+            "Status                 INTEGER,"                
+            "Date                   DATETIME,"
+            "FillListId             INTEGER NOT NULL,"
+            "MediaServerId          INTEGER NOT NULL,"
+            "Selected               INTEGER,"
+            "RefId                  INTEGER,"
+            "DriveId                INTEGER,"
+            "DriveNumber            INTEGER );"
+            //"PRIMARY KEY(FileId));"
+            );
+                    
+_LIT8( KCreateStoreFiles, 
+        "CREATE TABLE StoreFiles("
+            "FileId                 INTEGER NOT NULL,"
+            "PrimaryText            TEXT NOT NULL,"
+            "SecondaryText          TEXT,"
+            "Path                   TEXT,"
+            "Size                   INTEGER,"
+            "Date                   DATETIME,"
+            "StoreListId            INTEGER NOT NULL,"
+            "PRIMARY KEY(FileId));"
+            );
+                       
+_LIT8( KCreateStoreFileServers, 
+        "CREATE TABLE StoreFileServers("
+            "Fid                    INTEGER NOT NULL,"
+            "MediaServerId          INTEGER NOT NULL,"
+            "Status                 INTEGER );"
+            );                                    
+
+_LIT8( KCreateImageShrinkingInfo, 
+        "CREATE TABLE ImageShrinkingInfo("
+            "Count                  INTEGER,"
+            "Time                   INTEGER );"
+            );
+            
+_LIT8( KCreateTransferInfo,
+        "CREATE TABLE TransferInfo("
+            "Service                INTEGER,"
+            "Count                  INTEGER,"
+            "Time                   INTEGER,"
+            "PRIMARY KEY(Service));"
+        );
+
+_LIT8( KCreateSyncTime,
+        "CREATE TABLE SyncTime("
+        "Time                       DATETIME );"
+        );
+        
+_LIT8( KCreateProgressInfo,
+        "CREATE TABLE ProgressInfo("
+        "Trasferred                 INTEGER,"
+        "TotalCount                 INTEGER );"
+        );        
+
+_LIT8( KCreateDrivesInfo,
+        "CREATE TABLE  DrivesInfo("
+        "DriveNumber                INTEGER,"
+        "DriveType                  INTEGER,"
+        "DriveName                  TEXT,"
+        "Size                       INTEGER,"
+        "Quota                      INTEGER,"
+        "UsedQuota                  INTEGER,"
+        "UniqueId                   INTEGER,"
+        "Active                     INTEGER );"
+        );
+               
+///////////////////////////////////////////////////////////////////
+// CREATE CLAUSES FOR INDEXES
+///////////////////////////////////////////////////////////////////
+_LIT8( KCreateStoreStatusIndex, 
+        "CREATE INDEX Store_status_index ON StoreFiles(Status);"
+        );
+
+_LIT8( KCreateFillStatusIndex, 
+        "CREATE INDEX Fill_status_index ON FillFiles(Status);"
+        );        
+
+_LIT8( KCreateFillListIdIndex, 
+        "CREATE INDEX FillListIdIndex ON FillFiles(FillListId);"
+        ); 
+
+_LIT8( KCreateFillItemRefIndex,
+        "CREATE INDEX FillList_Ref_Index ON FillFiles( FileId, "
+        "RefId, Priority, Selected );"
+        );
+                
+// Dropping indexes
+_LIT8( KDropStoreStatusIndex, 
+    "DROP INDEX Store_status_index;"
+    );
+
+_LIT8( KDropFillStatusIndex,
+    "DROP INDEX Fill_status_index;"
+    );    
+
+_LIT8( KDropFillListIdIndex, 
+        "DROP INDEX FillListIdIndex;"
+        );
+        
+_LIT8( KDropFillItemRefIndex,
+        "DROP INDEX FillList_Ref_Index;"
+        );         
+            
+#endif // __CMDMSQLMAINTENANCECLAUSES_H__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/src/cmdmmain.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,962 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main class in the Database manager component
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include <bautils.h>
+#include "cmdmsqliteconnection.h"
+#include "cmdmsqldbmaintenance.h"
+#include "cmfillrule.h"
+#include "cmstorerule.h"
+#include "cmmediaserverfull.h"
+#include "cmbaselistitem.h"
+#include "cmfilllistitem.h"
+#include "cmstorelistitem.h"
+#include "cmdriveinfo.h"
+#include "cmdmmain.h"
+#include "msdebug.h"
+
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmDmMain* CCmDmMain::NewL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::NewL()"));   
+    CCmDmMain* self = CCmDmMain::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmDmMain::NewLC
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C CCmDmMain* CCmDmMain::NewLC()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::NewLC()"));
+    CCmDmMain* self = new ( ELeave ) CCmDmMain();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::~CCmDmMain
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmDmMain::~CCmDmMain()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::~CCmDmMain()")); 
+    delete iConnection;
+    iConnection = NULL;
+    delete iMaintenance;
+    iMaintenance = NULL;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::PrepareQueryCmdL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::PrepareQueryCmdL( TCMQueryCmdType aType )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::PrepareQueryCmdL()")); 
+    iConnection->PrepareQueryCmdL( aType );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryFillRuleL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::QueryFillRuleL( CCmFillRule* aFillRule )
+    {
+    return iConnection->QueryFillRuleL( aFillRule );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QuerySelectedFillRuleNamesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::QuerySelectedFillRuleNamesL( 
+    RPointerArray<HBufC8>& aNames, TInt aSelected )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QuerySelectedFillRuleNamesL()")); 
+    iConnection->QuerySelectedFillRuleNamesL( aNames, aSelected );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryFillRuleNamesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::QueryFillRuleNamesL( RPointerArray<HBufC8>& aNames )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryFillRuleNamesL()")); 
+    iConnection->QueryFillRuleNamesL( aNames );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryStoreRuleL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::QueryStoreRuleL(CCmStoreRule* aStoreRule)
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoreRuleL()")); 
+    return iConnection->QueryStoreRuleL( aStoreRule );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryStoreRuleNamesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::QueryStoreRuleNamesL( RPointerArray<HBufC8>& aNames )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoreRuleNamesL()")); 
+    iConnection->QueryStoreRuleNamesL( aNames );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QuerySelectedStoreRuleNamesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::QuerySelectedStoreRuleNamesL(
+    RPointerArray<HBufC8>& aNames, TInt aSelected )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QuerySelectedStoreRuleNamesL()")); 
+    iConnection->QuerySelectedStoreRuleNamesL( aNames, aSelected );
+    }        
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryMediaServerL
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::QueryMediaServerL( CCmMediaServerFull* aMediaServer )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryMediaServerL()")); 
+    return iConnection->QueryMediaServerL( aMediaServer );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryMediaServerId
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt64 CCmDmMain::QueryMediaServerId( const TDesC8& aUDN )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryMediaServerId()")); 
+    return iConnection->QueryMediaServerId( aUDN );
+    }
+
+// ---------------------------------------------------------------------------
+// CmDmMain::QueryMediaServerUdn
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::QueryMediaServerUdn( HBufC8*& aUdn, 
+    const TInt32 aId )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryMediaServerUdn()")); 
+    return iConnection->QueryMediaServerUdn( aUdn, aId );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryAllMediaServersL
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::QueryAllMediaServersL( 
+    CCmMediaServerFull* aMediaServer )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryAllMediaServersL()")); 
+    return iConnection->QueryAllMediaServersL( aMediaServer );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetMediaServersL
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CCmDmMain::GetMediaServersL( 
+    RPointerArray<CCmMediaServerFull>& aMediaServers )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetMediaServersL()")); 
+    iConnection->GetMediaServersL( aMediaServers );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetLowPriorityFilledFilesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::GetLowPriorityFilledFilesL( TInt aDrive,
+    RPointerArray<CCmFillListItem>& aFilled )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetLowPriorityFilledFilesL()")); 
+    return iConnection->GetLowPriorityFilledFilesL( aDrive, aFilled );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryFillFileListL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::QueryFillFileListL( 
+    RPointerArray<CCmBaseListItem>& aItems, 
+    const TDesC8& aName, 
+    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryFillFileListL()")); 
+    return iConnection->QueryFillFileListL( aItems, aName, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetAllFillFilesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::GetAllFillFilesL( 
+                                    RPointerArray<CCmFillListItem>& aItems,
+                                    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetAllFillFilesL()")); 
+    return iConnection->GetAllFillFilesL( aItems, aStatus );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryStoreFileListL
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::QueryStoreFileListL( 
+    RPointerArray<CCmBaseListItem>& aItems, 
+    const TDesC8& aName, 
+    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoreFileListL()")); 
+    return iConnection->QueryStoreFileListL( aItems, aName, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetAllStoreFilesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::GetAllStoreFilesL( 
+    RPointerArray<CCmStoreListItem>& aItems, TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetAllStoreFilesL()")); 
+    return iConnection->GetAllStoreFilesL( aItems, aStatus );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryAllFillFilesL
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::QueryAllFillFilesL( 
+    RPointerArray<CCmFillListItem>& aItems )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryAllFillFilesL()")); 
+    return iConnection->QueryAllFillFilesL( aItems );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryAllStoreFilesL
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::QueryAllStoreFilesL( 
+    RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryAllStoreFilesL()")); 
+    return iConnection->QueryAllStoreFilesL( aItems );    
+    }
+            
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryStoredRowL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::QueryStoredRowL( RPointerArray<HBufC16>& aFiles, 
+    const TDesC8& aUDN, 
+    TInt aAmount )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoredRowL()")); 
+    iConnection->QueryStoredRowL( aFiles, aUDN, aAmount );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryTransferHistory
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::QueryTransferHistory( 
+    const TDesC8& aUdn, 
+    TInt64& aDownloadData, 
+    TInt64& aUploadData, 
+    TInt64& aDownloadTime, 
+    TInt64& aUploadTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryTransferHistory()")); 
+    iConnection->QueryTransferHistory( aUdn, aDownloadData, 
+        aUploadData, aDownloadTime, aUploadTime );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryDeletedItemsListsL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::QueryDeletedItemsListsL( 
+    RPointerArray<CCmBaseListItem>& aArray, TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryDeletedItemsListsL()")); 
+    iConnection->QueryDeletedItemsListsL( aArray, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryDrivesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::QueryDrivesL( RPointerArray<CCmDriveInfo>& aDrives )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryDrivesL()")); 
+    iConnection->QueryDrivesL( aDrives );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetAvgImageShrinkTime
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::GetAvgImageShrinkTime()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetAvgImageShrinkTime()")); 
+    return iConnection->GetAvgImageShrinkTime();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetFillListNameL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::GetFillListNameL( HBufC8*& aListName, 
+    const TInt64 aListId )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetFillListNameL()")); 
+    return iConnection->GetFillListNameL( aListName, aListId );
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmDmMain::SetFillFiles
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::SetFillFiles( 
+    RPointerArray<CCmFillListItem>& aItems )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::SetFillFiles()")); 
+    return iConnection->SetFillFiles( aItems );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::SetStoreFilesL
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::SetStoreFilesL( 
+    RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::SetStoreFilesL()")); 
+    return iConnection->SetStoreFilesL( aItems );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::AddStoreFile
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::AddStoreFile( CCmStoreListItem& aItem )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::AddStoreFile()")); 
+    return iConnection->AddStoreFile( aItem );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::AddStoredL
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::AddStoredL( 
+    const TDesC& aFileName, 
+    const TDesC8& aUDN, 
+    TTime aTimeStamp )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::AddStoredL()")); 
+    return iConnection->AddStoredL( aFileName, aUDN, aTimeStamp );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::AddFillRuleL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::AddFillRuleL( CCmFillRule* aFillRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::AddFillRuleL()")); 
+    return iConnection->AddFillRuleL( aFillRule );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::AddStoreRuleL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::AddStoreRuleL( CCmStoreRule* aStoreRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::AddStoreRuleL()")); 
+    return iConnection->AddStoreRuleL( aStoreRule );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::AddMediaServerL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::AddMediaServerL( CCmMediaServerFull* aMediaServer )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::AddMediaServerL()")); 
+    return iConnection->AddMediaServerL( aMediaServer );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::AddHashValue
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::AddHashValue( TInt64 aMediaServerId, 
+                                       CCmSearchResponseHash* aHashValue )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::AddHashValue()")); 
+    return iConnection->AddHashValue( aMediaServerId, aHashValue );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::QueryHashValuesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::QueryHashValuesL( TInt aMediaServer, 
+        RPointerArray<CCmSearchResponseHash>& aHashValues )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::QueryHashValuesL()")); 
+    return iConnection->QueryHashValuesL( aMediaServer, aHashValues );
+    }
+// ---------------------------------------------------------------------------
+// CCmDmMain::SetMediaServersL  
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::SetMediaServersL( 
+    RPointerArray<CCmMediaServerFull>& aServers )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::SetMediaServersL()")); 
+    return iConnection->SetMediaServersL( aServers );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::SetSyncTime
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::SetSyncTime()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::SetSyncTime()")); 
+    return iConnection->SetSyncTime();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetSyncTime
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::GetSyncTime( TTime& aTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetSyncTime()")); 
+    return iConnection->GetSyncTime( aTime );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::SetProgressInfo
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::SetProgressInfo( TInt aTransferred, 
+    TInt aTotalCount)
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::SetProgressInfo()")); 
+    return iConnection->SetProgressInfo( aTransferred, aTotalCount );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetProgressInfo
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::GetProgressInfo( TInt& aTransferred, 
+    TInt& aTotalCount )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetProgressInfo()")); 
+    return iConnection->GetProgressInfo( aTransferred, aTotalCount );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::SetDrivesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::SetDrivesL( RPointerArray<CCmDriveInfo>& aDrives )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::SetDrivesL()")); 
+    iConnection->SetDrivesL( aDrives );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteMediaServer
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::DeleteMediaServer( const TDesC8& aUDN )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteMediaServer()")); 
+    return iConnection->DeleteMediaServer( aUDN );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteFillRuleByName
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C TInt CCmDmMain::DeleteFillRuleByName( const TDesC8& aName )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteFillRuleByName()")); 
+    return iConnection->DeleteFillRuleByName( aName );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteAllFillRules
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::DeleteAllFillRules()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteAllFillRules()")); 
+    return iConnection->DeleteAllFillRules();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteAllStoreRules
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::DeleteAllStoreRules()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteAllStoreRules()")); 
+    return iConnection->DeleteAllStoreRules();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteFillFiles
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::DeleteFillFiles()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteFillFiles()")); 
+    return iConnection->DeleteFillFiles();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteStoreFiles
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::DeleteStoreFiles()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteStoreFiles()")); 
+    return iConnection->DeleteStoreFiles();
+    }
+                      
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteDeletedItemsL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::DeleteDeletedItemsL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteDeletedItemsL()")); 
+    iConnection->DeleteDeletedItemsL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteItemsByFillListId
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::DeleteItemsByFillListId( TInt aFillListId )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteItemsByFillListId()")); 
+    return iConnection->DeleteItemsByFillListId( aFillListId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteDeletedMediaServersL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::DeleteDeletedMediaServersL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteDeletedMediaServersL()")); 
+    iConnection->DeleteDeletedMediaServersL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::DeleteHashValuesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::DeleteHashValuesL( const TInt aMediaserverId,
+    const TInt aSearchIndex )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteHashValuesL()")); 
+    iConnection->DeleteHashValuesL( aMediaserverId, aSearchIndex );  
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateMediaServerInfo
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::UpdateMediaServerInfo( 
+    CCmMediaServerFull* aMediaServer )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateMediaServerInfo()")); 
+    return iConnection->UpdateMediaServerInfo( aMediaServer );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateFillRuleSelected
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::UpdateFillRuleSelected( 
+    const TDesC8& aName, 
+    TInt aSelected )    
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillRuleSelected()")); 
+    return iConnection->UpdateFillRuleSelected( aName, aSelected );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateDownloadHistory
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::UpdateDownloadHistory( TUint aMediaServerId,
+    TInt64& aDownloadData, TInt64& aDownloadTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateDownloadHistory()")); 
+    return iConnection->UpdateDownloadHistory( aMediaServerId,
+        aDownloadData, aDownloadTime );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateUploadHistory
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::UpdateUploadHistory( TUint aMediaServerId,
+    TInt64& aUploadData, TInt64& aUploadTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateUploadHistory()")); 
+    return iConnection->UpdateUploadHistory( aMediaServerId,
+        aUploadData, aUploadTime );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateStatusValues
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::UpdateStatusValues( 
+    RPointerArray<CCmBaseListItem>& aStatusValues )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateStatusValues()")); 
+    return iConnection->UpdateStatusValues( aStatusValues );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateFillListDriveStatusesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::UpdateFillListDriveStatusesL( 
+    CCmDriveInfo* aOrigDrive, CCmDriveInfo* aNewDrive, 
+    TBool aDriveSelected )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillListDriveStatusesL()")); 
+    iConnection->UpdateFillListDriveStatusesL( 
+        aOrigDrive, aNewDrive, aDriveSelected );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateFillListItemPriority
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::UpdateFillListItemPriority( 
+    CCmFillRuleContainer* aContainer )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillListItemPriority()")); 
+    return iConnection->UpdateFillListItemPriority( aContainer );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::SetFillListStateL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::SetFillListStateL( const TUint aListId, 
+    TCmFillRuleStatus aState )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::SetFillListStateL()")); 
+    iConnection->SetFillListStateL( aListId, aState );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::RestoreFileStatusesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::RestoreFileStatusesL( 
+    const RPointerArray<CCmFillListItem>& aItems, const TDesC8& aListName )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::RestoreFileStatusesL()")); 
+    return iConnection->RestoreFileStatusesL( aItems, aListName );
+    }
+            
+// ---------------------------------------------------------------------------
+// CCmDmMain::IncrementShrinkTimeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::IncrementShrinkTimeL( TInt aImageCount, 
+    TInt aMilliSeconds )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::IncrementShrinkTimeL()")); 
+    return iConnection->IncrementShrinkTimeL( aImageCount,
+        aMilliSeconds );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::ListSize
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CCmDmMain::ListSize( 
+    TCmRuleType aType, 
+    const TDesC8& aListName,
+    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::ListSize()")); 
+    
+    TInt64 size( KErrNone );
+    if( aType == ECmFmFillRule )
+        {
+        size = iConnection->FillListSize( aListName, aStatus );
+        }
+    else
+        {
+        size = iConnection->StoreListSize( aListName, aStatus );
+        }
+    return size;        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::StoreFileCount
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::StoreFileCount( TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::StoreFileCount()")); 
+    return iConnection->StoreFileCount( aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::StoreFileCountNoDuplicates
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::StoreFileCountNoDuplicates()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::StoreFileCountNoDuplicates()")); 
+    return iConnection->StoreFileCountNoDuplicates();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::FillFileCount
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::FillFileCount( TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::FillFileCount()")); 
+    return iConnection->FillFileCount( aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Amount of data filled
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt64 CCmDmMain::BytesFilled( TUint aID )
+    {
+    return iConnection->BytesFilled( aID );
+    }
+
+
+// CCmDmMain::KBytesToBeFilled
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt64 CCmDmMain::KBytesToBeFilled( TUint8 aMediaServerId, 
+    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::KBytesToBeFilled()")); 
+    return iConnection->KBytesToBeFilled( aMediaServerId, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::KBytesToBeStored
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt64 CCmDmMain::KBytesToBeStored( TUint8 aMediaServerId, 
+    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::KBytesToBeStored()")); 
+    return iConnection->KBytesToBeStored( aMediaServerId, aStatus );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateTransferInfo
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::UpdateTransferInfo( TCmService aService, 
+    TInt aCount, TInt aTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateTransferInfo()")); 
+    return iConnection->UpdateTransferInfo( aService, aCount, aTime );
+    }   
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateStoreTransferStatus
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::UpdateStoreTransferStatus( TUint aStatus,
+    TInt64 aFid, TInt64 aMsId )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateStoreTransferStatus()")); 
+    iConnection->UpdateStoreTransferStatus( aStatus, aFid, aMsId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateFillTransferStatus
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::UpdateFillTransferStatus( TUint aStatus, 
+    CCmFillListItem* aItem )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillTransferStatus()")); 
+    iConnection->UpdateFillTransferStatus( aStatus, aItem );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetTransferInfo
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::GetTransferInfo( TCmService aService, 
+    TInt& aCount, TInt& aTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetTransferInfo()")); 
+    return iConnection->GetTransferInfo( aService, aCount, aTime );
+    }
+   
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetStoreFileCount
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CCmDmMain::GetStoreFileCount( 
+    const TDesC8& aListName, 
+    TUint aStatus, 
+    TInt& aCount )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetStoreFileCount()")); 
+    return iConnection->GetStoreFileCount( aListName, aStatus, aCount );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetFillFileCount
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::GetFillFileCount( 
+    const TDesC8& aListName, 
+    TUint aStatus, 
+    TInt& aCount )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetFillFileCount()")); 
+    return iConnection->GetFillFileCount( aListName, aStatus, aCount );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::GetStoreFileCountNoDuplicatesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::GetStoreFileCountNoDuplicatesL( TInt& aCount,
+    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::GetStoreFileCountNoDuplicatesL()")); 
+    iConnection->GetStoreFileCountNoDuplicatesL( aCount, aStatus );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmMain::SetFillListRealCountAndSizeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmDmMain::SetFillListRealCountAndSizeL( TInt64 aListId, 
+    TInt64 aRealCount, TInt64 aRealSize )
+    {    
+    TRACE( Print( _L("CCmDmMain::SetFillListRealCountAndSizeL \
+                    aListId =%ld,aRealCount=%ld,aRealSize=%ld"),
+                    aListId,aRealCount, aRealSize ) );
+
+    TInt64 realCount = ( aRealCount > 0 ) ? aRealCount : 0;
+    TInt64 realSize = ( aRealSize > 0 ) ? aRealSize : 0;
+    iConnection->SetFillListRealCountAndSizeL( 
+        aListId, realCount, realSize );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::UpdateFillRuleGroupInfo
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmDmMain::UpdateFillRuleGroupInfo()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillRuleGroupInfo()")); 
+    return iConnection->UpdateFillRuleGroupInfo();
+    }   
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::CCmDmMain
+// ---------------------------------------------------------------------------
+//    
+CCmDmMain::CCmDmMain()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::CCmDmMain()")); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmMain::ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CCmDmMain::ConstructL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmMain::ConstructL()")); 
+    
+    RFs fs;
+    CleanupClosePushL( fs );
+    TInt err = fs.Connect();    
+    TRAP(err, BaflUtils::EnsurePathExistsL(fs, KCmDbDir));
+    CleanupStack::PopAndDestroy( &fs );
+    
+    iConnection = CCmDmSQLiteConnection::NewL();
+    iMaintenance = CCmDmSqlDbMaintenance::NewL(); 
+    if( iMaintenance->InitConnection(*iConnection) )
+        {
+        iMaintenance->CreateDbFile( *iConnection );
+        }
+    if( !iConnection->Validate() )
+        {
+        iMaintenance->CreateDb( *iConnection );
+        iMaintenance->CreateIndexes( *iConnection );
+        iConnection->InitIDs();        
+        }         
+                
+    iConnection->LoadIDs(); 
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/src/cmdmsqldbmaintenance.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQL database maintenance class
+*
+*/
+
+
+
+
+
+
+#include "cmdmsqliteconnection.h"
+#include "cmdmsqlmaintenanceclauses.h"
+#include "cmdmsqldbmaintenance.h"
+#include "cmdmsqlclausedef.h"
+#include "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::NewL
+// ---------------------------------------------------------------------------
+//
+CCmDmSqlDbMaintenance* CCmDmSqlDbMaintenance::NewL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::NewL()"));
+     
+    CCmDmSqlDbMaintenance* self = CCmDmSqlDbMaintenance::NewLC();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmDmSqlDbMaintenance* CCmDmSqlDbMaintenance::NewLC()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::NewLC()"));
+        
+    CCmDmSqlDbMaintenance* self = new ( ELeave ) CCmDmSqlDbMaintenance();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::~CCmDmSqlDbMaintenance
+// ---------------------------------------------------------------------------
+//
+CCmDmSqlDbMaintenance::~CCmDmSqlDbMaintenance()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::~CCmDmSqlDbMaintenance()"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::InitConnection
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSqlDbMaintenance::InitConnection(
+    CCmDmSQLiteConnection& aConnection )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::InitConnection()"));
+    return aConnection.OpenDb( KCmDatabase );        
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::CloseConnection
+// ---------------------------------------------------------------------------
+//
+void CCmDmSqlDbMaintenance::CloseConnection(
+    CCmDmSQLiteConnection& aConnection )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CloseConnection()"));
+    aConnection.CloseDb();        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::CreateDbFile
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSqlDbMaintenance::CreateDbFile( 
+    CCmDmSQLiteConnection& aConnection )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CreateDbFile()"));
+    return aConnection.CreateDbFile( KCmDatabase );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::CreateDb
+// ---------------------------------------------------------------------------
+//
+void CCmDmSqlDbMaintenance::CreateDb( 
+    CCmDmSQLiteConnection& aConnection )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CreateDb()"));
+    
+    /// DROP tables
+    TRAP_IGNORE( aConnection.ExecuteL( KDropFillRuleGroup ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropRules ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropRuleParams ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropRuleGroupServers ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropMediaServers ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropHashValues ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropStored ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropFilled ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropIDs ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropStoreRules ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropStoreRuleParams ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropStoreRuleServers ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropFillFiles ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropStoreFiles ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropStoreFileServers ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropImageShrinkingInfo ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropTransferInfo ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropSyncTime ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropProgressInfo ));
+    TRAP_IGNORE( aConnection.ExecuteL( KDropDrivesInfo ));
+     
+    // Create tables
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateFillRuleGroup ) );    
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateRules ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateRuleParams ) );   
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateRuleGroupServers ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateMediaServers ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateHashValues ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateStored ) );   
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateIDs ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreRules ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreRuleParams ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreRuleServers ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateFillFiles ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreFiles ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreFileServers ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateImageShrinkingInfo ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateTransferInfo ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateSyncTime ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateProgressInfo ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateDrivesInfo ));
+    
+    // Init clauses
+    TRAP_IGNORE( aConnection.ExecuteL( KInitShrinkingTime ) );       
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::CreateIndexes
+// ---------------------------------------------------------------------------
+//
+void CCmDmSqlDbMaintenance::CreateIndexes( 
+    CCmDmSQLiteConnection& aConnection )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CreateIndexes()"));
+    
+    // Drop indexes
+    TRAP_IGNORE( aConnection.ExecuteL( KDropFillListIdIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KDropFillItemRefIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KDropStoreStatusIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KDropFillStatusIndex ) );
+    
+    // Create indexes
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateFillListIdIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateFillItemRefIndex ) );        
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreStatusIndex ) );
+    TRAP_IGNORE( aConnection.ExecuteL( KCreateFillStatusIndex ) );
+    }    
+    
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::CCmDmSqlDbMaintenance
+// ---------------------------------------------------------------------------
+//    
+CCmDmSqlDbMaintenance::CCmDmSqlDbMaintenance()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CCmDmSqlDbMaintenance()"));
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmDmSqlDbMaintenance::ConstructL
+// ---------------------------------------------------------------------------
+//   
+void CCmDmSqlDbMaintenance::ConstructL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::ConstructL()"));
+    }    
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/common/dbmanager/src/cmdmsqliteconnection.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,3678 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      SQLite Connection class
+*
+*/
+
+
+
+
+
+
+#include "cmdmsqliteconnection.h"
+#include "cmdmsqlclausedef.h"
+#include "cmfillrule.h"
+#include "cmfillrulecontainer.h"
+#include "cmmediaserverfull.h"
+#include "cmstorerule.h"
+#include "cmfilllistitem.h"
+#include "cmstorelistitem.h"
+#include "cmdriveinfo.h"
+#include "cmsearchresponsehash.h"
+#include "msdebug.h"
+
+// Constants
+_LIT8( KCmDbPragmaCacheSize, "PRAGMA cache_size=4096;PRAGMA page_size=4096;");
+const TUint8 KAmountOfIDs = 10;
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::NewL
+// ---------------------------------------------------------------------------
+//
+CCmDmSQLiteConnection* CCmDmSQLiteConnection::NewL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::NewL()"));
+    
+    CCmDmSQLiteConnection* self = CCmDmSQLiteConnection::NewLC();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::NewLC
+// ---------------------------------------------------------------------------
+//    
+CCmDmSQLiteConnection* CCmDmSQLiteConnection::NewLC()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::NewLC()"));
+    
+    CCmDmSQLiteConnection* self = new ( ELeave ) CCmDmSQLiteConnection();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::~CCmDmSQLiteConnection
+// ---------------------------------------------------------------------------
+//
+CCmDmSQLiteConnection::~CCmDmSQLiteConnection()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::~CCmDmSQLiteConnection()"));
+    
+    TRAP_IGNORE( BackUpIdL( ERuleGroupID, iRuleGroupID ) );
+    TRAP_IGNORE( BackUpIdL( ERuleID, iRuleID ) );
+    TRAP_IGNORE( BackUpIdL( ERuleParamID, iRuleParamID ) );
+    TRAP_IGNORE( BackUpIdL( EMediaServerID, iMediaServerID ) );
+    TRAP_IGNORE( BackUpIdL( EStoredID, iStoredID ) );
+    TRAP_IGNORE( BackUpIdL( EFilledID, iFilledID ) );
+    TRAP_IGNORE( BackUpIdL( EStoreRuleID, iStoreRuleID ) );
+    TRAP_IGNORE( BackUpIdL( EStoreRuleParamID, iStoreRuleParamID ) );
+    TRAP_IGNORE( BackUpIdL( EFillFileListId, iFillFileId ) );
+    TRAP_IGNORE( BackUpIdL( EStoreFileListId, iStoreFileId ) );
+    CloseDb();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::OpenDb
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::OpenDb( const TDesC& aDb )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::OpenDb()"));
+    
+    TInt err( iDatabase.Open( aDb, NULL ) );
+    if ( err != KErrNone )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t CCmDmSQLiteConnection::OpenDb()\
+         error %d"), err));
+        }
+    else 
+        {
+        err = iDatabase.Exec( KCmDbPragmaCacheSize );        
+        
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::CloseDb
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::CloseDb()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::CloseDb()"));
+    
+    iDatabase.Close();         
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::InitIDs
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::InitIDs()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::InitIDs()"));
+    
+    TInt err = iStatement.Prepare( iDatabase, KAddIDs );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            CCmDmSQLiteConnection::SetIDs() FAILED ")));
+        }
+    else
+        {
+        for( TInt j=1; j <= KAmountOfIDs ; j++ )
+            {    
+            SetID( static_cast<TTypeOfID>(j) );
+            }
+        iStatement.Close();        
+        }          
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetID
+// ---------------------------------------------------------------------------
+//    
+void CCmDmSQLiteConnection::SetID( TTypeOfID aType )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetID()"));
+    
+    // Init all ids to one    
+    iStatement.BindInt64( 0, 1 );
+    iStatement.BindInt( 1, aType );
+    iStatement.Exec();
+    iStatement.Reset();        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::BackUpIdL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::BackUpIdL( TTypeOfID aType, TUint64 aID )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::BackUpIdL()"));
+    
+    iStatement.PrepareL( iDatabase, KUpdateID );
+    iStatement.BindInt64( 0, aID );
+    iStatement.BindInt( 1, aType );
+    iStatement.Exec();
+    iStatement.Reset();
+    iStatement.Close();
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::LoadIDs
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::LoadIDs()
+    {    
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::LoadIDs()"));
+    
+    TRAP_IGNORE( LoadIDL( iRuleGroupID, ERuleGroupID ) );
+    TRAP_IGNORE( LoadIDL( iRuleID, ERuleID ) );
+    TRAP_IGNORE( LoadIDL( iRuleParamID, ERuleParamID ) );
+    TRAP_IGNORE( LoadIDL( iMediaServerID, EMediaServerID ) );
+    TRAP_IGNORE( LoadIDL( iStoredID, EStoredID ) );
+    TRAP_IGNORE( LoadIDL( iFilledID, EFilledID ) );
+    TRAP_IGNORE( LoadIDL( iStoreRuleID, EStoreRuleID ) );
+    TRAP_IGNORE( LoadIDL( iStoreRuleParamID, EStoreRuleParamID ) );
+    TRAP_IGNORE( LoadIDL( iFillFileId, EFillFileListId) );
+    TRAP_IGNORE( LoadIDL( iStoreFileId, EStoreFileListId) );       
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::LoadIDL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::LoadIDL( TUint64& aId, TTypeOfID aType )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::LoadIDL()"));
+    
+    TInt err = iStatement.Prepare( iDatabase, KSelectID );
+    if( err )
+            {
+            TRACE(Print(_L("[DATABASE MANAGER]\t \
+                CCmDmSQLiteConnection::LoadIDL() FAILED ")));
+            User::Leave( err );
+            }
+    else
+        {
+        iStatement.BindInt( 0, aType );
+        
+        // get id
+        err = iStatement.Next();
+        if (  err == KSqlAtRow )  
+            {
+            aId = iStatement.ColumnInt64( 0 );
+            }
+        iStatement.Reset();
+        iStatement.Close();                    
+        }            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::CreateDbFile
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::CreateDbFile( const TDesC& aDb )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::CreateDbFile()"));
+    
+    TInt err( iDatabase.Create( aDb ) );
+    return err;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::Validate
+// ---------------------------------------------------------------------------
+//
+TBool CCmDmSQLiteConnection::Validate()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::Validate()"));
+    
+    TInt ret( KErrNone );
+    TInt err = iStatement.Prepare( iDatabase, 
+        KValidateTableExistence );
+    // Loop only one row in results
+    if( err )
+        {
+        ret = KErrGeneral;
+        }
+    else
+        {
+        err = iStatement.Next();    
+        if ( err != KSqlAtRow )  
+            {
+            ret = KErrGeneral;       
+            }
+        iStatement.Reset();
+        iStatement.Close();          
+        }                     
+    TBool retval = EFalse;
+    if ( ret == KErrNone ) 
+        {
+        retval = ETrue;
+        }
+    return retval;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::ExecuteL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::ExecuteL( const TDesC8& aCommand )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::ExecuteL()"));
+    
+    TInt err( iDatabase.Exec( aCommand ) );
+    if ( KErrNone > err  )
+        {
+        User::Leave( err );    
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetFillFiles
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::SetFillFiles( 
+    RPointerArray<CCmFillListItem>& aItems )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetFillFiles()"));
+    
+    iDatabase.Exec( KCmDbBeginTransaction );
+    TInt err(KErrNone);
+    for( TInt i = 0; i < aItems.Count(); i++ )
+        {
+        err = iStatement.Prepare( iDatabase, KAddFillFile );
+        if( err )
+            {
+            TRACE(Print(_L("[DATABASE MANAGER]\t Prepare err = %d"), err ));
+            }
+        else
+            {
+            iStatement.BindInt64( 0, aItems[i]->DbId() );  
+            iStatement.BindText( 1, aItems[i]->PrimaryText() );
+            iStatement.BindText( 2, 
+                aItems[i]->SecondaryText() );
+            iStatement.BindText( 3, aItems[i]->Path() );
+            iStatement.BindBinary( 4, aItems[i]->Uri() );
+            iStatement.BindBinary( 5, aItems[i]->ItemId() );
+            iStatement.BindText( 6, aItems[i]->UpnpClass() );
+            iStatement.BindInt( 7, aItems[i]->MediaType() );
+            iStatement.BindInt( 8, aItems[i]->Priority() );
+            iStatement.BindInt( 9, aItems[i]->Size() );
+            iStatement.BindInt( 10, aItems[i]->Status() );
+            iStatement.BindInt64( 11, aItems[i]->Date().Int64() );
+            iStatement.BindInt( 12, aItems[i]->ListId() );
+            iStatement.BindInt( 13, aItems[i]->DevId() );
+            iStatement.BindInt64( 14, aItems[i]->RefId() );
+            iStatement.BindInt( 15, aItems[i]->Selected() );
+            iStatement.BindInt64( 16, aItems[i]->DriveId() );
+            iStatement.BindInt( 17, aItems[i]->DriveNumber() );
+            iStatement.Exec();
+            iStatement.Reset();  
+            iStatement.Close();        
+            }            
+        }
+    iDatabase.Exec( KCmDbSqlCommit );
+    return err;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetStoreFilesL
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::SetStoreFilesL( 
+    RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetStoreFilesL()"));
+    
+    iDatabase.Exec( KCmDbBeginTransaction );
+    TInt err(KErrNone);
+    for( TInt i = 0; i < aItems.Count(); i++ )
+        {
+        err = iStatement.Prepare( iDatabase, KAddStoreFile );
+        if( err )
+            {
+            err = KErrGeneral;
+            }
+        else
+            {   
+            iStatement.BindInt64( 0, iStoreFileId );
+            iStatement.BindText( 1, aItems[i]->PrimaryText() );
+            iStatement.BindText( 2, 
+                aItems[i]->SecondaryText() );
+            iStatement.BindText( 3, aItems[i]->Path() );
+            iStatement.BindInt( 4, aItems[i]->Size() );
+            iStatement.BindInt64( 5, aItems[i]->Date().Int64() );
+            iStatement.BindInt( 6, aItems[i]->ListId() );
+            iStatement.Exec();
+            iStatement.Reset();
+            iStatement.Close();            
+            }    
+        /** INSERT Server */
+        RArray<TInt> serverIds( aItems[i]->DevIds() );
+        RArray<TCmListItemStatus> statusValues( aItems[i]->StatusValues() );
+        for( TInt j = 0; j < serverIds.Count(); j++ )
+            {
+            err = iStatement.Prepare( iDatabase, KAddStoreFileServer );
+            if( err )
+                {
+                err = KErrGeneral;
+                }
+            else
+                {
+                iStatement.BindInt64( 0, iStoreFileId );
+                iStatement.BindInt( 1, serverIds[j] );
+                iStatement.BindInt( 2, statusValues[j] );
+                iStatement.Exec();
+                iStatement.Reset();
+                iStatement.Close();            
+                }            
+            }
+        iStoreFileId++;                        
+        }
+    iDatabase.Exec( KCmDbSqlCommit );
+    BackUpIdL( EStoreFileListId, iStoreFileId );
+    return err;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddStoreFile
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::AddStoreFile( CCmStoreListItem& aItem )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddStoreFile()"));
+    
+    TInt err(KErrNone);
+    err = iStatement.Prepare( iDatabase, KAddStoreFile );
+    if( err )
+        {
+        err = KErrGeneral;
+        }
+    else
+        {
+        iStatement.BindInt64( 0, iStoreFileId );
+        iStatement.BindText( 1, aItem.PrimaryText() );
+        iStatement.BindText( 2, aItem.SecondaryText() );
+        iStatement.BindText( 3, aItem.Path() );
+        iStatement.BindInt( 4, aItem.Size() );
+        iStatement.BindInt64( 5, aItem.Date().Int64() );
+        iStatement.BindInt64( 6, aItem.ListId() );            
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+        /** INSERT Server */
+        RArray<TInt>serverIds( aItem.DevIds() );
+        RArray<TCmListItemStatus>statusValues( aItem.StatusValues() );        
+        for( TInt j = 0; j < serverIds.Count() ; j++ )
+            {
+            err = iStatement.Prepare( iDatabase, KAddStoreFileServer );
+            if( err )
+                {
+                err = KErrGeneral;
+                }
+            else
+                {
+                iStatement.BindInt64( 0, iStoreFileId );
+                iStatement.BindInt( 1, serverIds[j] );
+                iStatement.BindInt( 2, statusValues[j] );
+                iStatement.Exec();
+                iStatement.Reset();
+                iStatement.Close();            
+                }            
+            }                
+        }
+    iStoreFileId++;            
+    return err;
+    }
+            
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddStoredL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::AddStoredL( 
+    const TDesC& aFileName, 
+    const TDesC8& aUDN, 
+    TTime aTimeStamp )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddStoredL()"));
+    /* FIRST QYERY MediaServerID from the MediaServer table
+    using UDN */
+    TInt err = iStatement.Prepare( iDatabase, KSelectMediaServerIDByUDN ) ;
+    TUint64 mediaServerID(0);    
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t KSelectMediaServerIDByUDN \
+            FAILED ")));
+        err = KErrGeneral;
+        }
+    else
+        {
+        iStatement.BindBinary( 0, aUDN );
+        // Loop only one row in results
+        err = iStatement.Next();
+        if ( err == KSqlAtRow )  
+            {
+            // Get cell contents    
+            mediaServerID = iStatement.ColumnInt64( 0 );
+            iStatement.Reset();            
+            iStatement.Close();  // Destruct statement  
+            err = KErrNone;          
+            }        
+        }
+            
+    err = iStatement.Prepare( iDatabase, KAddStored );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t KAddStored FAILED ")));
+        err = KErrGeneral;
+        }
+    else
+        {
+        iStatement.BindInt64( 0, iStoredID );
+        iStatement.BindText( 1, aFileName );          
+        iStatement.BindInt64( 2, mediaServerID );    
+        iStatement.BindInt64( 3, aTimeStamp.Int64() );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+        err = KErrNone;   
+        }
+    iStoredID++;
+    BackUpIdL( EStoredID, iStoredID );                
+
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddFillRuleL
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::AddFillRuleL( CCmFillRule* aFillRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddFillRuleL()"));
+    
+    iDatabase.Exec( KCmDbBeginTransaction );
+    TInt err = iStatement.Prepare( iDatabase, KAddFillGroup );
+    
+    if ( err == KErrNone )
+        {
+        if( aFillRule->ListId() )
+            {
+            iRuleGroupID = aFillRule->ListId();
+            }
+        iStatement.BindInt64( 0, iRuleGroupID );        
+        iStatement.BindBinary( 1, aFillRule->Name() );
+        iStatement.BindInt( 2, aFillRule->Method() );
+        iStatement.BindInt( 3, aFillRule->LimitType() );
+        iStatement.BindInt( 4, aFillRule->Amount() );
+        iStatement.BindInt( 5, aFillRule->Selected() );
+        iStatement.BindInt( 6, aFillRule->Priority() );
+        iStatement.BindInt( 7, aFillRule->TemplateId() );
+        iStatement.BindInt( 8, aFillRule->MediaType() );
+        iStatement.BindInt( 9, aFillRule->Status() );
+        iStatement.BindInt64( 10, aFillRule->ListRealCount() );
+        iStatement.BindInt64( 11, aFillRule->ListRealSizeInBytes() );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();                
+   
+        err = AddFillRuleMediaServersL( aFillRule );
+                
+        if ( err == KErrNone )
+            {
+            err = AddFillRuleRulesAndParamsL( aFillRule );            
+            }
+        if ( err == KErrNone )
+            {
+            iRuleGroupID++;
+            BackUpIdL( ERuleGroupID, iRuleGroupID );
+            }
+        }               
+
+    iDatabase.Exec( KCmDbSqlCommit );    
+        
+    // in error cases force return value to KErrGeneral
+    return ( err ? KErrGeneral : KErrNone );  
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddFillRuleMediaServersL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::AddFillRuleMediaServersL( CCmFillRule* aFillRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    AddFillRuleMediaServersL()"));
+    
+    TInt mediaServerCount( aFillRule->MediaServerCount() );
+    
+    TInt mediaserverID(0);
+    TInt err( KErrNone );
+    for( TInt i = 0; i < mediaServerCount ; i++ )
+        {
+        TPtrC8 udn = aFillRule->MediaServerL( i );
+        aFillRule->MediaServerL( i, mediaserverID );
+        if( udn.Length() )
+            {
+            err = 
+                iStatement.Prepare( iDatabase, KSelectMediaServerIDByUDN );
+            if( !err )
+                {
+                iStatement.BindBinary( 0, udn );                 
+                // Loop all rows in results
+                while ( iStatement.Next() == KSqlAtRow )  
+                    {
+                    // Get cell contents    
+                    mediaserverID = iStatement.ColumnInt64( 0 );
+                    }                
+                }
+            iStatement.Reset();                     
+            iStatement.Close();                                               
+            }
+        if( mediaserverID > 0 )
+            {
+            err = iStatement.Prepare( iDatabase, KAddRuleGroupServer );
+            if( err )
+                {
+                err = KErrGeneral;
+                }
+            else
+                {
+                iStatement.BindInt64( 0, 
+                    iRuleGroupID );    
+                iStatement.BindInt64( 1, 
+                    mediaserverID );
+                iStatement.Exec();
+                iStatement.Reset();
+                iStatement.Close();
+                err = KErrNone;                                          
+                }             
+            }                              
+        }            
+    
+    return err;        
+    }
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddFillRuleRulesAndParamsL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::AddFillRuleRulesAndParamsL( 
+    CCmFillRule* aFillRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    AddFillRuleRulesAndParamsL()"));
+    
+    TInt ruleCount(aFillRule->RuleCount());
+    TInt err( KErrNone );
+    TCmMetadataField metadataField;
+    TPtrC8 dataField;
+    TInt dataIndex;
+    TCmOperatorType oper;
+    TInt parameterCount(0);   
+    for( TInt j = 0; j < ruleCount; j++)
+        {
+        aFillRule->RuleL( j, &metadataField, &oper, &parameterCount );
+
+        err = iStatement.Prepare( iDatabase, KAddRule );
+        
+        if( err )
+            {
+            TRACE(Print(_L("[DATABASE MANAGER]\t \
+                CCmDmSQLiteConnection::AddFilledL() FAILED ")));
+            err = KErrGeneral;
+            }
+        else
+            {
+            iStatement.BindInt64( 0, iRuleID );
+            iStatement.BindInt64( 1, iRuleGroupID );
+            iStatement.BindInt( 2, metadataField );
+            iStatement.BindInt( 3, oper );
+            iStatement.Exec();
+            iStatement.Reset();        
+            iStatement.Close(); 
+            err = KErrNone; 
+            }
+        
+        // Add params of the rule to table        
+        for( TInt k = 0; k < parameterCount; k++)
+            {
+            aFillRule->RuleParamL( j, k, &dataField );
+            aFillRule->RuleParamL( j, k, dataIndex );
+            err = iStatement.Prepare( iDatabase, KAddRuleParam );
+            
+            if( err )
+                {
+                TRACE(Print(_L("[DATABASE MANAGER]\t \
+                    CCmDmSQLiteConnection::AddFilledL() FAILED ")));
+                err = KErrGeneral;
+                }
+            else
+                {
+                iStatement.BindInt64( 0, iRuleParamID );
+                iRuleParamID++; 
+                iStatement.BindInt64( 1, iRuleID );
+                if( dataField.Length() )
+                    {
+                    iStatement.BindBinary( 2, dataField );    
+                    }
+                else
+                    {
+                    iStatement.BindInt64( 3, dataIndex );
+                    }
+                iStatement.Exec();
+                iStatement.Reset();      
+                iStatement.Close();
+                err = KErrNone;  
+                }            
+            }
+        iRuleID++;            
+        }
+    BackUpIdL( ERuleID, iRuleID );
+    BackUpIdL( ERuleParamID, iRuleParamID );                    
+
+    return err;
+    }        
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddStoreRuleL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::AddStoreRuleL( CCmStoreRule* aStoreRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddStoreRuleL()"));
+    
+    TInt err = iStatement.Prepare( iDatabase, KAddStoreRule );
+    
+    if ( err == KErrNone )
+        {
+        iStatement.BindInt64( 0, iStoreRuleID );
+        iStatement.BindBinary( 1, aStoreRule->Name() );
+        iStatement.BindInt( 2, aStoreRule->Selected() );
+        iStatement.BindInt( 3, aStoreRule->Status() );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+    
+        err = AddStoreRuleParamsL( aStoreRule );
+
+        if ( err == KErrNone )
+            {
+            err = AddStoreRuleMediaServersL( aStoreRule );
+            }
+        if ( err == KErrNone )
+            {
+            iStoreRuleID++;
+            BackUpIdL( EStoreRuleID, iStoreRuleID );
+            }
+        }
+  
+    // in error cases force return value to KErrGeneral
+    return ( err ? KErrGeneral : KErrNone );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddStoreRuleParamsL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::AddStoreRuleParamsL( CCmStoreRule* aStoreRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddStoreRuleParamsL()"));
+    
+    TInt err( KErrNone );
+    TCmMediaType mediaType; 
+    // Ensin tavara fillrule group tauluun
+    for(TInt i = 0; i < aStoreRule->DefCount(); i++ )
+        {
+        aStoreRule->StoreRule(i, &mediaType);
+        err = iStatement.Prepare( iDatabase, KAddStoreRuleParams );    
+        if( err )
+            {
+            TRACE(Print(_L("[DATABASE MANAGER]\t \
+                CCmDmSQLiteConnection::AddStoreRuleParamsL() FAILED ")));
+            err = KErrGeneral;
+            }
+        else
+            {        
+            iStatement.BindInt64( 0, iStoreRuleID );
+            iStatement.BindInt64( 1, iStoreRuleParamID );
+            iStatement.BindInt( 2, (TInt)mediaType );
+            iStatement.Exec();
+            iStatement.Reset();
+            iStatement.Close();            
+            }
+        iStoreRuleParamID++;            
+        }
+    BackUpIdL( EStoreRuleParamID, iStoreRuleParamID );        
+
+    return err;        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddStoreRuleMediaServersL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::AddStoreRuleMediaServersL( 
+    CCmStoreRule* aStoreRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    AddStoreRuleMediaServersL()"));
+    
+    TInt err( KErrNone );         
+    TInt mediaServerCount( aStoreRule->MediaServerCount() );
+    TRACE(Print(_L("[DATABASE MANAGER]\t \
+        mediaServerCount = %d "), mediaServerCount));    
+    if( mediaServerCount > KErrNone )
+        {
+        for( TInt i = 0; i < mediaServerCount ; i++ )
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectMediaServerIDByUDN );        
+
+            TUint64 mediaserverID(0);            
+            TPtrC8 udn = aStoreRule->MediaServerL( i );
+            iStatement.BindBinary( 0, udn );
+            if( err )
+                {
+                err = KErrGeneral;
+                }
+            else
+                {        
+                // Loop all rows in results
+                if ( iStatement.Next() == KSqlAtRow )
+                    {
+                    // Get cell contents    
+                    mediaserverID = iStatement.ColumnInt64( 0 );
+                    iStatement.Reset();
+                    iStatement.Close();                         
+                    err = iStatement.Prepare( iDatabase, 
+                        KAddStoreRuleServers );
+                    if( err )
+                        {
+                        err = KErrGeneral;
+                        }
+                    else
+                        {
+                        iStatement.BindInt64( 0, iStoreRuleID );    
+                        iStatement.BindInt64( 1, mediaserverID );
+                        iStatement.Exec();
+                        iStatement.Reset();
+                        iStatement.Close();
+                        err = KErrNone;
+                        }
+                                        
+                    }   
+                }               
+            }        
+        }               
+    
+    return err;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddMediaServerL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::AddMediaServerL( 
+    CCmMediaServerFull* aMediaServer )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddMediaServerL()"));    
+    
+    TInt err = iStatement.Prepare( iDatabase, KAddMediaServer );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            CCmDmSQLiteConnection::AddMediaServerL() FAILED ")));
+        err = KErrGeneral;
+        }
+    else
+        {
+        iStatement.BindInt64( 0, iMediaServerID ); 
+        iStatement.BindBinary( 1, aMediaServer->MediaServer() );
+        iStatement.BindBinary( 2, aMediaServer->MediaServerName() );
+        iStatement.BindInt( 3, aMediaServer->SystemUpdateID() );
+        iStatement.BindInt64( 4, aMediaServer->VisibleDate().Int64() );
+        iStatement.BindInt( 5, KErrNone );
+        iStatement.BindInt( 6, KErrNone );
+        iStatement.BindInt( 7, KErrNone );
+        iStatement.BindInt( 8, KErrNone );
+        iStatement.BindInt( 9, KErrNone );
+        iStatement.BindInt( 10, (TInt)aMediaServer->CopyCapability() );
+        iStatement.BindInt( 11, aMediaServer->FillUsage() );
+        iStatement.BindInt( 12, aMediaServer->StoreUsage() );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+        err = KErrNone;  
+        }
+    iMediaServerID++;
+    BackUpIdL( EMediaServerID, iMediaServerID );        
+   
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::AddHashValue
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::AddHashValue( TInt64 aMediaServerId, 
+                                          CCmSearchResponseHash* aHashValue )
+    
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddHashValue()"));
+        
+    TInt err = iStatement.Prepare( iDatabase, KAddHashValue );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            CCmDmSQLiteConnection::AddHashValue() FAILED ")));
+        err = KErrGeneral;
+        }
+    else
+        {
+        iStatement.BindInt64( 0, aMediaServerId ); 
+        iStatement.BindInt( 1, aHashValue->StartIndex() );
+        iStatement.BindInt( 2, aHashValue->ItemCount()  );
+        iStatement.BindBinary( 3, aHashValue->Hash() );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+        err = KErrNone;  
+        }
+      
+    return err;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetMediaServersL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::SetMediaServersL( 
+    RPointerArray<CCmMediaServerFull>& aServers )  
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetMediaServersL()"));    
+    TInt err( KErrNone );
+    
+    TInt sqlRet( iDatabase.Exec( KInitIsActiveFlags ) );
+
+    if ( sqlRet >= KErrNone )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            %d rows have been changed/inserted/deleted"), sqlRet ));
+
+        TInt id( KErrNone );
+        // Add new servers into 
+        HBufC8* uuid = NULL;
+        for( TInt j = 0; j < aServers.Count(); j++ )
+            {
+            uuid = aServers[j]->MediaServer().AllocLC();
+            PrepareQueryCmdL(EMediaServerIdQuery);
+            id = QueryMediaServerId( *uuid );
+            if( id == KErrNotFound )
+                {
+                AddMediaServerL( aServers[j] );
+                }
+            CleanupStack::PopAndDestroy( uuid );
+            uuid = NULL;    
+            }
+        
+        for( TInt i = 0; i < aServers.Count() ; i++ )
+            {
+            err = iStatement.Prepare( iDatabase, KUpdateMsIsActive );
+        
+            if( err )
+                {
+                TRACE(Print(_L("[DATABASE MANAGER]\t \
+                CCmDmSQLiteConnection::SetMediaServersL() FAILED ")));
+                err = KErrGeneral;
+                }
+            else
+                {
+                iStatement.BindInt( 0, aServers[i]->IsActive() );
+                iStatement.BindInt( 1, aServers[i]->SystemUpdateID() );
+                //update the server name
+                iStatement.BindBinary( 2, aServers[i]->MediaServerName() );
+                iStatement.BindInt( 3, aServers[i]->FillUsage() );
+                iStatement.BindInt( 4, aServers[i]->StoreUsage() );
+                iStatement.BindBinary( 5, aServers[i]->MediaServer() );
+                iStatement.Exec();                
+                }
+            iStatement.Reset(); 
+            iStatement.Close();            
+            }     
+        
+        if ( err == KErrNone )
+            {
+            err = DeleteInActiveRuleServers();
+            }
+    	        
+        if ( err == KErrNone )
+            {
+            err = DeleteInActiveFiles();            
+            }        
+        }
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetSyncTime
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::SetSyncTime()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetSyncTime()"));    
+    
+    TInt err( iDatabase.Exec( KRemoveSyncTime ) );   
+    
+    if ( err == KErrNone )
+        {
+        err = iStatement.Prepare( iDatabase, KSetSyncTime );
+        if ( err == KErrNone )
+            {
+            TTime time;
+            time.HomeTime();
+            iStatement.BindInt64( 0, time.Int64() );
+            iStatement.Exec();               
+            }
+        iStatement.Reset(); 
+        iStatement.Close();         
+        }
+    // in error cases force return value to KErrGeneral
+    return ( err ? KErrGeneral : KErrNone ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetSyncTime
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::GetSyncTime( TTime& aTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetSyncTime()"));    
+    
+    TInt err( iStatement.Prepare( iDatabase, KGetSyncTime ) );
+    aTime = KErrNone;
+    if( err )
+        {
+        err = KErrGeneral;  
+        }
+    else
+        {
+        err = iStatement.Next(); 
+        if ( err == KSqlAtRow )  
+            { 
+            aTime = iStatement.ColumnInt64( 0 );
+            err = KErrNone;                
+            }
+        }
+    iStatement.Reset(); 
+    iStatement.Close();     
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetProgressInfo
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::SetProgressInfo( TInt aTransferred, 
+    TInt aTotalCount)
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetProgressInfo()"));    
+    
+    TInt err( iDatabase.Exec( KRemoveProgressInfo ) );
+    if ( err == KErrNone )
+        {
+        err = iStatement.Prepare( iDatabase, KSetProgressInfo );
+        if( err )
+            {
+            err = KErrGeneral;
+            }
+        else
+            {
+            iStatement.BindInt( 0, aTransferred );
+            iStatement.BindInt( 1, aTotalCount );
+            iStatement.Exec();        
+            }
+        iStatement.Reset(); 
+        iStatement.Close();                 
+        }
+        
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetProgressInfo
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::GetProgressInfo( TInt& aTransferred, 
+    TInt& aTotalCount )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetProgressInfo()"));    
+    
+    TInt err( iStatement.Prepare( iDatabase, KGetProgressInfo ) );
+    if( err )
+        {
+        err = KErrGeneral;  
+        }
+    else
+        {
+        err = iStatement.Next();
+        if ( err == KSqlAtRow )  
+            {
+            aTransferred = iStatement.ColumnInt( 0 );
+            aTotalCount = iStatement.ColumnInt( 1 );
+            err = KErrNone;                         
+            }
+        }
+    iStatement.Reset(); 
+    iStatement.Close();     
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetDrivesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::SetDrivesL( RPointerArray<CCmDriveInfo>& aDrives )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetDrivesL()"));    
+    
+    TInt err( iDatabase.Exec( KRemoveDrivesInfo ) );
+    
+    if ( err == KErrNone)
+        {
+        iDatabase.Exec( KCmDbBeginTransaction );   
+        for( TInt i = 0; i < aDrives.Count(); i++ )
+            {
+            err = iStatement.Prepare( iDatabase, KSetDrivesInfo );
+            User::LeaveIfError( err ); 
+            iStatement.BindInt( 0, aDrives[i]->DriveNumber() );
+            iStatement.BindInt( 1, aDrives[i]->DriveType() );
+            iStatement.BindText( 2, aDrives[i]->DriveName() );
+            iStatement.BindInt64( 3, aDrives[i]->DriveSize() );
+            iStatement.BindInt64( 4, aDrives[i]->DriveQuota() );
+            iStatement.BindInt64( 5, aDrives[i]->UsedDriveQuota() );
+            iStatement.BindInt64( 6, aDrives[i]->DriveId() );
+            iStatement.BindInt( 7, aDrives[i]->Status() );
+            iStatement.Exec();
+            iStatement.Reset();
+            iStatement.Close();
+            }        
+        }
+    iDatabase.Exec( KCmDbSqlCommit );              
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::PrepareQueryCmdL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::PrepareQueryCmdL( TCMQueryCmdType aType )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::PrepareQueryCmdL()"));
+    
+    TInt err( KErrNone );                  
+    switch( aType )
+        {
+        case EFillRuleQuery:
+            {
+            iDatabase.Exec( KCmDbBeginTransaction );
+            err = iStatement.Prepare( iDatabase, KSelectFillRule );
+            break;
+            }
+        case EMediaServerInfoQyery:
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectDeviceInfoByUDN );
+            break;
+            }
+        case EMediaServerIdQuery:
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectMediaServerIDByUDN );            
+            break;
+            }
+        case EMediaServerUDNQuery:
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectMediaServerUDNByID );
+            break;    
+            }
+        case EMediaServersAllQuery:
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectAllMediaServers );
+            break;            
+            }          
+        case EHashValueQuery:
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectHashValuesByMediaServer );
+            break;            
+            }          
+        case EStoredQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KIsFileAlreadyStored );
+            break;
+            }         
+        case EStoredRowQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KSelectStoredByUDN );
+            break;
+            }
+        case ESelectedFillRuleQuery:
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectSelectedFillRuleNames);
+            break;
+            }
+        case EFillRuleNamesQuery:
+            {
+            iDatabase.Exec( KCmDbBeginTransaction );
+            err = iStatement.Prepare( iDatabase, KSelectFillRuleNames );
+            break;
+            }
+        case EStoreRuleQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KSelectStoreRule );
+            break;
+            }
+        case EStoreRuleNamesQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KSelectStoreRuleNames );
+            break;
+            }
+        case ESelectedStoreRuleQuery:
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectSelectedStoreRuleNames );
+            break;
+            } 
+        case ETransferHistoryQuery:
+            {    
+            err = iStatement.Prepare(  iDatabase, 
+                KSelectTransferHistory );
+            break;
+            }
+        case EFillFilesQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KSelectFillFiles );
+            break;
+            }
+        case EDeletedFillFilesQuery:
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectDeletedFillFiles );
+            break;
+            }
+        case EStoreFilesQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KSelectStoreFiles );
+            break;
+            }        
+        case EAllFillFilesQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KSelectAllFillFiles );
+            break;
+            }        
+        case EAllStoreFilesQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KSelectAllStoreFiles ); 
+            break;
+            }        
+        case EFilledLowPriorityQuery:
+            {
+            err = iStatement.Prepare( iDatabase, 
+                KSelectLowestPriorityFilled );
+            break;
+            }
+        case EAllFillFilesStatusQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KGetAllFillFiles );
+            break;
+            }
+        case EAllStoreFilesStatusQuery:    
+            {
+            err = iStatement.Prepare( iDatabase, KGetAllStoreFiles );
+            break;
+            }
+        case EDrivesQuery:
+            {
+            err = iStatement.Prepare( iDatabase, KGetDrives );
+            break;
+            }
+        default:
+            {
+            LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::PrepareQueryCmdL() \
+            type not found"));
+            break;
+            }
+                                                            
+        }
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t err = %d "), err ));        
+        User::Leave( err ); 
+        }      
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryFillRuleL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::QueryFillRuleL( CCmFillRule* aFillRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleL()"));
+            
+    TInt err( KErrNone );
+    TUint64 ruleGroupID(0);
+    TPtrC8 tempptr;
+    iStatement.BindBinary( 0, aFillRule->Name() );                
+    // Loop only one row in results
+    err = iStatement.Next();
+    if ( err == KSqlAtRow )
+        {
+        // Get cell contents
+        ruleGroupID = iStatement.ColumnInt64( 0 );
+        aFillRule->SetListId( (TUint8)ruleGroupID );
+        iStatement.ColumnBinary( 1, tempptr );
+        aFillRule->SetNameL( tempptr );
+        aFillRule->SetMethod( 
+            (TCmFillMethod)iStatement.ColumnInt( 2 ) );
+        aFillRule->SetLimitType( 
+            (TCmLimitType)iStatement.ColumnInt( 3 ) );
+        aFillRule->SetAmount( 
+            iStatement.ColumnInt( 4 ) );
+        aFillRule->SetSelected( 
+            (TCmFillRuleStatus)iStatement.ColumnInt( 5 ) );
+        aFillRule->SetPriority( 
+            (TUint8)iStatement.ColumnInt( 6 ) );
+        aFillRule->SetTemplateId( 
+            (TUint8)iStatement.ColumnInt( 7 ) );
+        aFillRule->SetMediaType( 
+            (TCmMediaType)iStatement.ColumnInt( 8 ) );
+        aFillRule->SetStatus( 
+            (TCmListItemStatus)iStatement.ColumnInt( 9 ) );
+        aFillRule->SetListRealCount( iStatement.ColumnInt( 10 ) );    
+        aFillRule->SetListRealSizeInBytes( 
+            iStatement.ColumnInt(11) );
+        err = KErrNone;             
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    err = QueryFillRuleServersL( aFillRule, ruleGroupID );
+    if ( err )
+        {
+        LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleL() \
+        error getting servers"));
+        }
+
+    err = QueryFillRuleParamsL( aFillRule );    
+    if ( err )
+        {
+        LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleL() \
+        error getting fill list parameters"));
+        }
+    
+    iDatabase.Exec( KCmDbSqlCommit );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryFillRuleServersL
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::QueryFillRuleServersL( CCmFillRule* aFillRule, 
+    TUint64 aRuleGroupID )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleServersL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, 
+        KSelectMediaServerIDByRuleGroupID ) );
+    RArray<TUint64> mediaServerIds;
+    CleanupClosePushL( mediaServerIds );
+    if( err )
+        {
+        LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+        QueryFillRuleServersL() select mediaserver fail"));
+        }
+    else
+        {
+        iStatement.BindInt64( 0, aRuleGroupID );        
+        // Loop all rows in results
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            mediaServerIds.Append( 
+                iStatement.ColumnInt64(0) );             
+            }    
+        iStatement.Reset();            
+        iStatement.Close();  // Destruct statement
+        }
+            
+    TInt mediaServerCount( mediaServerIds.Count());
+
+    for( TInt mediaServerIndex = 0; mediaServerIndex < mediaServerCount ; 
+         mediaServerIndex++ )
+        {   
+        aFillRule->AddMediaServerL( 
+            mediaServerIds[mediaServerIndex]);
+        }
+        
+    mediaServerIds.Reset();
+    CleanupStack::PopAndDestroy( &mediaServerIds );
+    
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryFillRuleParamsL
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::QueryFillRuleParamsL( CCmFillRule* aFillRule )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleParamsL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KSelectRule ) );
+    RArray<TUint64> ruleIds;    
+    CleanupClosePushL( ruleIds );
+    TPtrC8 temp;
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            CCmDmSQLiteConnection::QueryFillRule() FAIL5")));
+        err = KErrGeneral; 
+        }
+    else
+        {    
+        iStatement.BindBinary( 0, aFillRule->Name() );
+        // Loop all rows in results
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell content
+            ruleIds.Append( iStatement.ColumnInt64( 0 ) );
+            aFillRule->AddRuleL( 
+                (TCmMetadataField)iStatement.ColumnInt( 1 ), 
+                (TCmOperatorType)iStatement.ColumnInt( 2 ) );
+            }            
+        
+        iStatement.Reset();            
+        iStatement.Close();  // Destruct statement
+        }
+        
+    TInt numberOfRules( ruleIds.Count() );              
+    for( TInt index = 0; index < numberOfRules ; index++ )
+        {
+        err = iStatement.Prepare( iDatabase, 
+            KSelectRuleParamsByRuleID );
+        if( err )
+            {
+            TRACE(Print(_L("[DATABASE MANAGER]\t \
+                KSelectRuleParamsByRuleID FAIL")));
+            err = KErrGeneral;            
+            }
+        else
+            {
+            iStatement.BindInt64( 0, ruleIds[index] );
+            // Loop all rows in results
+            for ( err = iStatement.Next(); 
+                  err == KSqlAtRow; 
+                  err = iStatement.Next() )
+                {
+                // Get cell contents
+                iStatement.ColumnBinary( 0, temp );
+                if( temp.Length() )
+                    {
+                    aFillRule->AddRuleParamL( index, temp );
+                    }
+                else
+                    {
+                    aFillRule->AddRuleParamL( index, 
+                        iStatement.ColumnInt64( 1 ) );
+                    }                                           
+                }
+            iStatement.Reset();            
+            iStatement.Close();  // Destruct statement                    
+            }    
+        }                                          
+    
+    ruleIds.Reset();
+    CleanupStack::PopAndDestroy( &ruleIds );
+            
+    TRACE(Print(_L("[DATABASE MANAGER]\t \
+        CCmDmSQLiteConnection::QueryFillRule() end")));
+    return err;                                
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QuerySelectedFillRuleNamesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::QuerySelectedFillRuleNamesL( 
+    RPointerArray<HBufC8>& aNames, TInt aSelected )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    QuerySelectedFillRuleNamesL()"));   
+    
+    iStatement.BindInt( 0, aSelected );      
+    // Loop only one row in results
+    TPtrC8 tempPtr;
+    while( KSqlAtRow == iStatement.Next() )   
+        {
+        // Get cell contents
+        iStatement.ColumnBinary( 0, tempPtr );
+        aNames.Append( tempPtr.AllocL() ); 
+        }    
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement                                     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryFillRuleNamesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::QueryFillRuleNamesL( 
+    RPointerArray<HBufC8>& aNames )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleNamesL()"));   
+                     
+    // Loop only one row in results
+    TPtrC8 temp;
+    while( KSqlAtRow == iStatement.Next() )  
+        {
+        // Get cell contents               
+        iStatement.ColumnBinary( 0, temp );        
+        aNames.Append( temp.AllocL() );                   
+        }    
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement
+    iDatabase.Exec( KCmDbSqlCommit );                     
+    TRACE(Print(_L("[DATABASE MANAGER]\t CCmDmSQLiteConnection::\
+        QueryFillRuleNamesL() end")));                   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryStoreRuleL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::QueryStoreRuleL( CCmStoreRule* aStoreRule )    
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoreRuleL()"));
+    
+    TUint64 ruleGroupID(0);
+    TPtrC8 temp;
+    iStatement.BindBinary( 0, aStoreRule->Name() );                
+    // Loop only one row in results
+    TInt err( iStatement.Next() );
+    if ( err == KSqlAtRow )  
+        {
+        // Get cell contents
+        ruleGroupID = iStatement.ColumnInt64( 0 );
+        aStoreRule->SetListId( ruleGroupID );
+        iStatement.ColumnBinary( 1, temp );
+        aStoreRule->SetNameL( temp );   
+        aStoreRule->SetSelected( 
+            (TCmFillRuleStatus)iStatement.ColumnInt( 2 ) );
+        aStoreRule->SetStatus( 
+            (TCmListItemStatus)iStatement.ColumnInt( 3 ) );
+        err = KErrNone;                               
+        }    
+    iStatement.Reset();             
+    iStatement.Close();  // Destruct statement
+    err = QueryStoreRuleDefsL( aStoreRule, ruleGroupID );
+    
+    return err;        
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryStoreRuleDefsL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::QueryStoreRuleDefsL( CCmStoreRule* aStoreRule,
+    TUint64 aRuleGroupID )    
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoreRuleDefsL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KSelectStoreRuleDefs ) );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            CCmDmSQLiteConnection::QueryStoreRuleL() FAIL5")));
+        err = KErrGeneral; 
+        }
+    else
+        {  
+        TPtrC8 temp;  
+        iStatement.BindBinary( 0, aStoreRule->Name() );
+        // Loop all rows in results
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents
+            aStoreRule->AddStoreRuleL( 
+                (TCmMediaType)iStatement.ColumnInt( 1 ) ); 
+            }            
+        
+        iStatement.Reset();            
+        iStatement.Close();  // Destruct statement
+
+        err = iStatement.Prepare( iDatabase, KSelectStoreRuleMediaServerID );
+        RArray<TUint64> mediaServerIds;
+        CleanupClosePushL( mediaServerIds );        
+        
+        if( err )
+            {
+            TRACE( Print(
+                _L("[DATABASE MANAGER]\t KSelectMediaServerID FAIL") ) );
+            }
+        else
+            {
+            iStatement.BindInt64( 0, aRuleGroupID );
+            // Loop all rows in results
+            for ( err = iStatement.Next(); 
+                  err == KSqlAtRow; 
+                  err = iStatement.Next() )
+                {
+                // Get cell contents    
+                mediaServerIds.Append( 
+                    iStatement.ColumnInt64( 0 ));
+                }
+            iStatement.Reset();            
+            iStatement.Close();// Destruct statement
+            TInt mediaServerCount( mediaServerIds.Count() );             
+            for( TInt mediaServerIndex = 0; 
+                mediaServerIndex < mediaServerCount ; mediaServerIndex++ )
+                {
+                err = iStatement.Prepare( iDatabase, 
+                    KSelectRuleUDNsByMediaServerID );
+                if( err )
+                    {
+                    TRACE(Print(_L("[DATABASE MANAGER]\t \
+                        KSelectRuleUDNsByMediaServerID FAIL")));
+                    err = KErrGeneral;            
+                    }
+                else
+                    {
+                    iStatement.BindInt64( 0, 
+                        mediaServerIds[mediaServerIndex] );
+                    // Loop all rows in results
+                        for ( err = iStatement.Next(); 
+                              err == KSqlAtRow; 
+                              err = iStatement.Next() )
+                        {
+                        // Get cell contents
+                        iStatement.ColumnBinary( 0, temp );
+                        aStoreRule->AddMediaServerL( temp );
+                        }
+                    iStatement.Reset();            
+                    iStatement.Close();  // Destruct statement
+                    }                                                         
+                }
+            mediaServerIds.Reset();
+            CleanupStack::PopAndDestroy( &mediaServerIds );
+            }
+        }        
+    return err;        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryStoreRuleNamesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::QueryStoreRuleNamesL( 
+    RPointerArray<HBufC8>& aNames )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoreRuleNamesL()"));  
+    
+    // Loop only one row in results
+    TPtrC8 temp;
+    while( KSqlAtRow == iStatement.Next() )  
+        {
+        // Get cell contents               
+        iStatement.ColumnBinary( 0, temp );
+        aNames.Append( temp.AllocL() );             
+        }    
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement                        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QuerySelectedStoreRuleNamesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::QuerySelectedStoreRuleNamesL(
+    RPointerArray<HBufC8>& aNames, TInt aSelected )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    QuerySelectedStoreRuleNamesL()"));
+        
+    // Do binding only for the first row
+    iStatement.BindInt( 0, aSelected );
+    // Loop only one row in results
+    TPtrC8 temp;
+    while( KSqlAtRow == iStatement.Next() )  
+        {
+        // Get cell contents
+        iStatement.ColumnBinary( 0, temp );
+        aNames.Append( temp.AllocL() );                
+        }    
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement                    
+    }    
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryMediaServerL
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::QueryMediaServerL( 
+    CCmMediaServerFull* aMediaServer )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryMediaServerL()"));
+          
+    iStatement.BindBinary( 0, aMediaServer->MediaServer() ); 
+        // Loop only one row in results
+    TInt err( KErrNotFound );
+    if ( KSqlAtRow == iStatement.Next() )  
+        {
+        TPtrC8 temp;
+        // Get cell contents
+        iStatement.ColumnBinary( 2, temp );    
+        aMediaServer->SetMediaServerNameL( temp );
+        aMediaServer->SetSystemUpdateID( 
+            iStatement.ColumnInt( 3 ) );
+        aMediaServer->SetVisibleDate( 
+            iStatement.ColumnInt64( 4 ) );
+        aMediaServer->SetIsActive( 
+            iStatement.ColumnInt( 5 ) ); 
+        aMediaServer->SetFillUsage( 
+            iStatement.ColumnInt( 6 ) );
+        err = KErrNone;             
+        }    
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement            
+
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryMediaServerId
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmDmSQLiteConnection::QueryMediaServerId( const TDesC8& aUDN )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryMediaServerId()"));
+    
+    iStatement.BindBinary( 0, aUDN );
+    // Loop only one row in results
+    TInt err( KErrNotFound );
+    if ( KSqlAtRow == iStatement.Next() )  
+        {
+        // Get cell contents   
+        err = iStatement.ColumnInt64( 0 );        
+        }    
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement            
+
+    return err;        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryMediaServerUdn
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::QueryMediaServerUdn( HBufC8*& aUdn, 
+                                                 const TInt32 aId )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryMediaServerId()"));
+    
+    iStatement.BindInt64( 0, aId );
+    // Loop only one row in results
+    TInt err( iStatement.Next() );
+    if ( err == KSqlAtRow )  
+        {
+        // Get cell contents
+        TPtrC8 temp;
+        iStatement.ColumnBinary( 0, temp );
+        aUdn = temp.Alloc();
+        err = KErrNone;
+        }
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement            
+
+    return err;        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryAllMediaServersL
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::QueryAllMediaServersL( 
+    CCmMediaServerFull* aMediaServer )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryAllMediaServersL()"));
+    
+    // Loop only one row in results
+    TInt err( KErrNotFound );
+    if ( KSqlAtRow == iStatement.Next() )  
+        {
+        TPtrC8 temp;
+        // Get cell contents
+        iStatement.ColumnBinary( 0, temp );
+        aMediaServer->SetUDNL(temp);  
+        iStatement.ColumnBinary( 1, temp );    
+        aMediaServer->SetMediaServerNameL( temp );
+        aMediaServer->SetSystemUpdateID( 
+            iStatement.ColumnInt( 2 ) );
+        aMediaServer->SetVisibleDate( 
+            iStatement.ColumnInt64( 3 ) );
+        aMediaServer->SetIsActive( 
+            iStatement.ColumnInt( 4 ) );
+        aMediaServer->SetDbId( 
+            iStatement.ColumnInt( 5 ) );            
+        aMediaServer->SetCopyCapability( (TBool)iStatement.ColumnInt( 6 ) );
+        aMediaServer->SetFillUsage( iStatement.ColumnInt( 7 ) );
+        aMediaServer->SetStoreUsage( iStatement.ColumnInt( 8 ) );
+        err = KErrNone;                                       
+        }      
+    if( KErrNotFound == err )
+        {
+        iStatement.Reset();                
+        iStatement.Close();  // Destruct statement    
+        }            
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetMediaServersL
+// ---------------------------------------------------------------------------
+//    
+void CCmDmSQLiteConnection::GetMediaServersL( 
+    RPointerArray<CCmMediaServerFull>& aMediaServers )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetMediaServersL()"));
+       
+    iStatement.PrepareL( iDatabase, KSelectAllMediaServers );
+    // Loop only one row in results
+    while ( KSqlAtRow == iStatement.Next() )  
+        {
+        CCmMediaServerFull* server = CCmMediaServerFull::NewLC();
+        TPtrC8 temp;
+        // Get cell contents
+        iStatement.ColumnBinary( 0, temp );
+        server->SetUDNL(temp);  
+        iStatement.ColumnBinary( 1, temp );    
+        server->SetMediaServerNameL( temp );
+        server->SetSystemUpdateID( 
+            iStatement.ColumnInt( 2 ) );
+        server->SetVisibleDate( 
+            iStatement.ColumnInt64( 3 ) );
+        server->SetIsActive( 
+            iStatement.ColumnInt( 4 ) );
+        server->SetDbId( 
+            iStatement.ColumnInt( 5 ) );
+        server->SetCopyCapability( 
+            iStatement.ColumnInt( 6 ) );
+        server->SetFillUsage( iStatement.ColumnInt( 7 ) );                
+        server->SetStoreUsage( iStatement.ColumnInt( 8 ) );                
+            
+        aMediaServers.AppendL( server ); // transfer ownership
+        CleanupStack::Pop( server );
+        server = NULL;
+        }      
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement               
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryHashValuesL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::QueryHashValuesL( TInt aMediaServer, 
+    RPointerArray<CCmSearchResponseHash>& aHashValues )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryHashValuesL()"));
+    
+    iStatement.BindInt( 0, aMediaServer );        
+    // Loop only one row in results
+    TInt err( KErrNone );
+    while( ( err = iStatement.Next( ) ) == KSqlAtRow ) 
+        {
+        CCmSearchResponseHash* newHash = CCmSearchResponseHash::NewL();
+        CleanupStack::PushL( newHash );
+        // Get cell contents   
+        newHash->SetStartIndex( iStatement.ColumnInt( 0 ));
+        newHash->SetItemCount( iStatement.ColumnInt( 1 ));  
+        TPtrC8 temp; 
+        iStatement.ColumnBinary( 2, temp );
+        newHash->SetHashL( temp );
+        aHashValues.AppendL( newHash );             
+        CleanupStack::Pop( newHash );
+        
+        }    
+    iStatement.Reset( );                
+    iStatement.Close( );  // Destruct statement            
+    
+    return err;        
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetLowPriorityFilledFilesL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::GetLowPriorityFilledFilesL( TInt aDrive,
+    RPointerArray<CCmFillListItem>& aFilled )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    GetLowPriorityFilledFilesL()"));
+    
+    TPtrC temp;
+    TUint32 size( KErrNone );
+    TInt64 listId( KErrNone );
+    TInt64 fileId( KErrNone );      
+    iStatement.BindInt( 0, (TInt)ECmFilled );
+    iStatement.BindInt( 1, (TInt)ECmFilled );
+    iStatement.BindInt( 2, aDrive );
+    TInt err( KErrNone );        
+
+    for ( err = iStatement.Next(); 
+          err == KSqlAtRow; 
+          err = iStatement.Next() )
+        {
+        iStatement.ColumnText( 0, temp );
+        size = iStatement.ColumnInt( 1 );
+        listId = iStatement.ColumnInt( 2 );
+        fileId = iStatement.ColumnInt64( 3 );   
+        if( temp.Length() )
+            {
+            CCmFillListItem* filled = CCmFillListItem::NewLC();
+            filled->SetPathL( temp );
+            filled->SetSize( size );
+            filled->SetListId( listId );
+            filled->SetDbId( fileId );
+            aFilled.Append( filled );
+            CleanupStack::Pop( filled );                
+            }                                
+        }
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement    
+    return err;            
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryFillFileListL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::QueryFillFileListL( 
+    RPointerArray<CCmBaseListItem>& aItems, 
+    const TDesC8& aName, 
+    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillFileListL()"));
+    
+    iStatement.BindInt( 0, aStatus );
+    iStatement.BindBinary( 1, aName );
+    TPtrC temp;
+    TInt ret( KErrNone );
+    while( iStatement.Next() == KSqlAtRow )
+        {
+        CCmBaseListItem* item = CCmBaseListItem::NewLC();
+        /**
+        Read rows into package
+        */
+        iStatement.ColumnText( 0, temp );
+        item->SetPrimaryTextL( temp );
+        iStatement.ColumnText( 1, temp );
+        item->SetSecondaryTextL( temp );
+        iStatement.ColumnText( 2, temp );
+        item->SetPathL( temp );                           
+        item->SetSize( iStatement.ColumnInt64( 3 ));
+        item->SetStatus(
+            (TCmListItemStatus)iStatement.ColumnInt( 4 ));
+        item->SetDate( iStatement.ColumnInt64( 5 ) );
+        item->SetDbId( iStatement.ColumnInt64( 6 ) );
+        item->SetRefId( iStatement.ColumnInt64( 7 ) );
+        aItems.Append( item );
+        CleanupStack::Pop( item );
+        }
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement    
+    return ret;            
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetAllFillFilesL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::GetAllFillFilesL( 
+                                    RPointerArray<CCmFillListItem>& aItems,
+                                    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetAllFillFilesL()"));
+    
+    TInt ret(KErrNone);
+    TPtrC temp16;
+    TPtrC8 temp8;
+    iStatement.BindInt( 0, aStatus );
+    while( iStatement.Next() == KSqlAtRow)
+        {
+        CCmFillListItem* item = CCmFillListItem::NewLC();
+        /**
+        Read rows into package
+        */
+        item->SetDbId( iStatement.ColumnInt64( 0 ) );
+        iStatement.ColumnText( 1, temp16 );
+        item->SetPrimaryTextL( temp16 );
+        iStatement.ColumnText( 2, temp16 );
+        if ( temp16.Length() != 0 ) 
+            {
+            item->SetSecondaryTextL( temp16 );
+            }
+        else 
+            {
+            item->SetSecondaryTextL( KNullDesC() );
+            }
+        
+        iStatement.ColumnText( 3, temp16 );
+        if ( temp16.Length() != 0 ) 
+            {
+            item->SetPathL( temp16 );
+            }
+        else 
+            {
+            item->SetPathL( KNullDesC() );
+            }
+        iStatement.ColumnBinary( 4, temp8 );
+        item->SetUriL( temp8 );
+        iStatement.ColumnBinary( 5, temp8 );
+        item->SetItemIdL( temp8 );   
+        iStatement.ColumnText( 6, temp16 );
+        item->SetUpnpClassL( temp16 );
+        item->SetMediaType( (TCmMediaType)
+            iStatement.ColumnInt( 7 ) );    
+        item->SetPriority( iStatement.ColumnInt( 8 ) );
+        item->SetSize( iStatement.ColumnInt64( 9 ) );
+        item->SetStatus(
+            (TCmListItemStatus)iStatement.ColumnInt( 10 ) );
+        item->SetDate( iStatement.ColumnInt64( 11 ) );
+        item->SetListId( iStatement.ColumnInt( 12 ) );
+        item->SetDevId( iStatement.ColumnInt( 13 ) );
+        item->SetRefId( iStatement.ColumnInt64( 14 ) );
+        item->SetSelected( (TCmFillRuleStatus)
+            iStatement.ColumnInt( 15 ) );
+        item->SetDriveId( iStatement.ColumnInt64( 16 ) );
+        item->SetDriveNumber( iStatement.ColumnInt( 17 ) );    
+        aItems.Append( item );
+        CleanupStack::Pop( item );
+        }       
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement    
+    return ret;    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryStoreFileListL
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::QueryStoreFileListL( 
+    RPointerArray<CCmBaseListItem>& aItems, 
+    const TDesC8& aName, 
+    TUint /*aStatus*/ )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoreFileListL()"));
+    
+    TInt ret(KErrNone);
+    TPtrC temp16;
+    iStatement.BindBinary( 0, aName );
+    while( iStatement.Next() == KSqlAtRow )
+        {
+        CCmBaseListItem* item = CCmBaseListItem::NewLC();        
+        /**
+        Read rows into package
+        */
+        iStatement.ColumnText( 0, temp16 );
+        item->SetPrimaryTextL( temp16 );
+        iStatement.ColumnText( 1, temp16 );
+        item->SetSecondaryTextL( temp16 );
+        iStatement.ColumnText( 2, temp16 );
+        item->SetPathL( temp16 );                       
+        item->SetSize( iStatement.ColumnInt64( 3 ) );
+        item->SetDate( iStatement.ColumnInt64( 4 ) );
+        aItems.Append(item); // transfer ownership
+        CleanupStack::Pop( item );
+        }
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement    
+    return ret;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetAllStoreFilesL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::GetAllStoreFilesL( 
+    RPointerArray<CCmStoreListItem>& aItems, TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetAllStoreFilesL()"));
+    
+    TInt ret(KErrNone);
+    iStatement.BindInt( 0, aStatus );
+    TPtrC temp16;
+    TUint status(KErrNone);
+    TUint8 devId(KErrNone);
+    while( iStatement.Next() == KSqlAtRow )
+        {
+        CCmStoreListItem* item = CCmStoreListItem::NewL();
+        CleanupStack::PushL( item );
+        /**
+        Read rows into package
+        */
+        iStatement.ColumnText( 0, temp16 );
+        item->SetPrimaryTextL( temp16 );
+        iStatement.ColumnText( 1, temp16 );
+        item->SetSecondaryTextL( temp16 );
+        iStatement.ColumnText( 2, temp16 );
+        item->SetPathL( temp16 );                        
+        item->SetSize( iStatement.ColumnInt64( 3 ));
+        status = iStatement.ColumnInt( 4 );
+        item->SetListId( iStatement.ColumnInt( 5 ) );
+        devId = iStatement.ColumnInt( 6 );
+        item->SetDevId( devId, (TCmListItemStatus)status );            
+        aItems.Append( item ); // transfer ownership
+        CleanupStack::Pop( item );
+        }       
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement    
+    return ret;    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryAllFillFilesL
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::QueryAllFillFilesL( 
+    RPointerArray<CCmFillListItem>& aItems )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryAllFillFilesL()"));
+    
+    TInt ret(KErrNone);
+    TPtrC temp16;
+    TPtrC8 temp8;
+    while( iStatement.Next() == KSqlAtRow )
+        {
+        CCmFillListItem* item = CCmFillListItem::NewL();
+        CleanupStack::PushL( item );
+        /**
+        Read rows into package
+        */
+        item->SetDbId( iStatement.ColumnInt64( 0 ) );
+        iStatement.ColumnText( 1, temp16 );
+        item->SetPrimaryTextL( temp16 );
+        iStatement.ColumnText( 2, temp16 );
+        item->SetSecondaryTextL( temp16 );
+        iStatement.ColumnText( 3, temp16 );
+        item->SetPathL( temp16 );             
+        iStatement.ColumnBinary( 4, temp8 );
+        item->SetUriL( temp8 );
+        iStatement.ColumnBinary( 5, temp8 );
+        item->SetItemIdL( temp8 );   
+        iStatement.ColumnText( 6, temp16 );
+        item->SetUpnpClassL( temp16 );
+        item->SetMediaType( (TCmMediaType)
+            iStatement.ColumnInt( 7 ) );    
+        item->SetPriority( iStatement.ColumnInt( 8 ) );
+        item->SetSize( iStatement.ColumnInt64( 9 ));
+        item->SetStatus(
+            (TCmListItemStatus)iStatement.ColumnInt( 10 ));
+        item->SetDate( iStatement.ColumnInt64( 11 ) );
+        item->SetListId( iStatement.ColumnInt( 12 ) );
+        item->SetDevId( iStatement.ColumnInt( 13 ) );
+        item->SetRefId( iStatement.ColumnInt64( 14 ) );
+        item->SetSelected( ( TCmFillRuleStatus )
+            iStatement.ColumnInt( 15 ));
+        item->SetDriveId( iStatement.ColumnInt64( 16 ) );
+        item->SetDriveNumber( iStatement.ColumnInt( 17 ) );    
+        aItems.Append( item ); // transfer ownership
+        CleanupStack::Pop( item );
+        }
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement    
+    return ret;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryAllStoreFilesL
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::QueryAllStoreFilesL( 
+    RPointerArray<CCmStoreListItem>& aItems )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryAllStoreFilesL()"));
+    
+    TInt ret(KErrNone);
+    TPtrC temp16;
+    TBool found( EFalse );
+    TInt foundIndex( KErrNone );    
+    while( iStatement.Next() == KSqlAtRow )
+        {
+        CCmStoreListItem* item = CCmStoreListItem::NewL();
+        CleanupStack::PushL( item );
+        /**
+        Read rows into package
+        */
+        item->SetDbId( iStatement.ColumnInt64( 0 ) );
+        iStatement.ColumnText( 1, temp16  );
+        item->SetPrimaryTextL( temp16 );
+        iStatement.ColumnText( 2, temp16 );
+        item->SetSecondaryTextL( temp16 );    
+        iStatement.ColumnText( 3, temp16 );
+        item->SetPathL( temp16 );                               
+        item->SetSize( iStatement.ColumnInt64( 4 ) );
+        TCmListItemStatus status = 
+            (TCmListItemStatus)iStatement.ColumnInt( 5 );
+
+        item->SetListId( iStatement.ColumnInt( 6 ) );
+        TInt devId = iStatement.ColumnInt( 7 );
+        item->SetDevId( devId, status );            
+        for( TInt i = 0; i < aItems.Count() && !found ; i++ )
+            {
+            if( aItems[i]->DbId() == item->DbId() )
+                {
+                found = ETrue;
+                foundIndex = i;
+                }
+            }
+        if( !found )
+            {
+            aItems.Append( item ); // transfer ownership
+            CleanupStack::Pop( item );
+            }
+        else
+            {
+            aItems[foundIndex]->SetDevId( devId, status );
+            CleanupStack::PopAndDestroy( item ); // Destroy item
+            }        
+        found = EFalse;
+        }
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement    
+    return ret;    
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryStoredRowL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::QueryStoredRowL( 
+    RPointerArray<HBufC16>& aFiles, 
+    const TDesC8& aUDN, 
+    TInt aAmount )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoredRowL()"));
+           
+    iStatement.BindBinary( 0, aUDN );
+    TInt amount = aAmount;    
+    // Loop only one row in results
+    while( KSqlAtRow == iStatement.Next() || amount == 0 )  
+        {
+        // Get cell contents    
+        TPtrC temp;
+        iStatement.ColumnText( 0, temp );
+        aFiles.Append( temp.AllocL() ); 
+        if( amount != KErrNotFound )
+            {
+            amount--;
+            }
+        }    
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement                           
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryTransferHistory
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::QueryTransferHistory( 
+    const TDesC8& aUdn,
+    TInt64& aDownloadData, 
+    TInt64& aUploadData, 
+    TInt64& aDownloadTime, 
+    TInt64& aUploadTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryTransferHistory()"));
+    
+    iStatement.BindBinary( 0, aUdn );
+    // Loop only one row
+    if( KSqlAtRow == iStatement.Next() )  
+        {
+        // Get cell contents    
+        aDownloadData = iStatement.ColumnInt64( 0 );
+        aUploadData = iStatement.ColumnInt64( 1 );
+        aDownloadTime = iStatement.ColumnInt64( 2 );
+        aUploadTime = iStatement.ColumnInt64( 3 );  
+        }        
+    iStatement.Reset();                
+    iStatement.Close();               
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryDeletedItemsListsL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::QueryDeletedItemsListsL( 
+    RPointerArray<CCmBaseListItem>& aArray, TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    QueryDeletedItemsListsL()"));
+
+    TPtrC temp16;
+    iStatement.BindInt( 0, aStatus );        
+    while( iStatement.Next() == KSqlAtRow )
+        {
+        CCmBaseListItem* item = CCmBaseListItem::NewLC();
+        /**
+        Read rows into package
+        */
+        iStatement.ColumnText( 0, temp16 );
+        item->SetPrimaryTextL( temp16 );
+        iStatement.ColumnText( 1, temp16 );
+        item->SetSecondaryTextL( temp16 );
+        iStatement.ColumnText( 2, temp16 );
+        item->SetPathL( temp16 );                          
+        item->SetSize( iStatement.ColumnInt64( 3 ) );
+        item->SetStatus(
+            (TCmListItemStatus)iStatement.ColumnInt( 4 ) );
+        item->SetDate(iStatement.ColumnInt64( 5 ) );
+        item->SetDbId( iStatement.ColumnInt64( 6 ) );
+        aArray.Append( item );
+        CleanupStack::Pop( item );
+        }
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::QueryDrivesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::QueryDrivesL( 
+    RPointerArray<CCmDriveInfo>& aDrives )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryDrivesL()"));
+    
+    TPtrC temp16;       
+    while( iStatement.Next() == KSqlAtRow )
+        {
+        CCmDriveInfo* drive = CCmDriveInfo::NewLC();
+        /**
+        Read rows into package
+        */
+        drive->SetDriveNumber( iStatement.ColumnInt( 0 ) );
+        drive->SetDriveType( iStatement.ColumnInt( 1 ) );
+        iStatement.ColumnText( 2, temp16 );
+        if ( temp16.Length() != 0 ) 
+            {
+            drive->SetDriveNameL( temp16 );
+            }
+        else 
+            {
+            drive->SetDriveNameL( KNullDesC() );
+            }           
+        drive->SetDriveSize( iStatement.ColumnInt64( 3 ) );
+        drive->SetDriveQuota( iStatement.ColumnInt64( 4 ) );
+        drive->SetUsedDriveQuota( iStatement.ColumnInt64( 5 ) );
+        drive->SetDriveId( iStatement.ColumnInt64( 6 ) );
+        drive->SetStatus( (TBool)iStatement.ColumnInt( 7 ) );
+        aDrives.Append( drive );
+        CleanupStack::Pop( drive ); 
+        }   
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement     
+    }
+      
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetAvgImageShrinkTime
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::GetAvgImageShrinkTime()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetAvgImageShrinkTime()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KImageShrinkingInfo ) );
+    TInt64 count( KErrNone );
+    TInt64 time( KErrNone );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            KImageShrinkingInfo illegal err = %d"), err ));
+        }
+    else
+        {
+        // Loop only one row
+        err = iStatement.Next();
+        if( err == KSqlAtRow )  
+            {
+            // Get cell contents    
+            count = iStatement.ColumnInt64( 0 );
+            time = iStatement.ColumnInt64( 1 );                   
+            }        
+        }
+        
+    iStatement.Reset();                
+    iStatement.Close();
+    if( count != KErrNone )
+        {
+        return TInt(time/count);
+        }
+    else
+        {
+        return KErrNone;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetFillListNameL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::GetFillListNameL( HBufC8*& aListName, 
+    const TInt64 aListId )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetFillListNameL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KSelectFillRuleName ) );
+    if( err )
+        {
+        User::Leave( err );
+        }
+    else
+        {
+        iStatement.BindInt64( 0, aListId );
+        // Loop only one row
+        err = iStatement.Next();
+        if( err == KSqlAtRow )  
+            {
+            TPtrC8 temp;
+            iStatement.ColumnBinary( 0, temp );
+            aListName = temp.Alloc();
+            }        
+        }
+    iStatement.Reset();                
+    iStatement.Close();   
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteMediaServer
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::DeleteMediaServer( const TDesC8& aUDN )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteMediaServer()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KRemoveMediaServersByUDN ) );
+    if( !err )
+        {    
+        iStatement.BindBinary( 0, aUDN );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+        }
+
+    // In error cases for return value to KErrGeneral
+    return ( err ? KErrGeneral : KErrNone );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteFillRuleByName
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::DeleteFillRuleByName( const TDesC8& aName )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteFillRuleByName()"));
+    
+    // Remove ruleparams
+    TInt err( iStatement.Prepare( iDatabase, KRemoveRuleParamsByRuleID) );
+    if( !err )
+        {
+        iStatement.BindBinary( 0, aName );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close(); 
+
+        // Remove rules
+        err = iStatement.Prepare( iDatabase, KRemoveRuleByRuleGroupID);
+        iStatement.BindBinary( 0, aName );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();     
+
+        // Remove Mediaservers from the mapping table
+        err = iStatement.Prepare( iDatabase, KRemoveRuleGroupServers);
+        iStatement.BindBinary( 0, aName );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+
+        // Remove FillRules
+        err = iStatement.Prepare( iDatabase, KRemoveFillRuleByName );
+        iStatement.BindBinary( 0, aName );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+        }
+    
+    // In error cases for return value to KErrGeneral
+    return ( err ? KErrGeneral : KErrNone );         
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteAllFillRules
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::DeleteAllFillRules()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteAllFillRules()"));
+    
+    // Remove ruleparams
+    TInt err( iStatement.Prepare( iDatabase, KRemoveRuleParamAll ) );
+    if( !err )
+        {
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close(); 
+
+        // Remove rules
+        err = iStatement.Prepare( iDatabase, KRemoveRuleAll );
+        if( !err )
+            {
+            iStatement.Exec();
+            iStatement.Reset();
+            iStatement.Close();     
+
+            // Remove Mediaservers from the mapping table
+            err = iStatement.Prepare( iDatabase, KRemoveRuleGroupServerAll);
+            if( !err )
+                {
+                iStatement.Exec();
+                iStatement.Reset();
+                iStatement.Close();
+
+                // Remove FillRules
+                err = iStatement.Prepare( iDatabase, KRemoveFillRuleAll );
+                if( !err )
+                    {
+                    iStatement.Exec();
+                    iStatement.Reset();
+                    iStatement.Close();
+                    }
+                }
+            }
+        iRuleGroupID = 1;
+        iRuleID = 1;
+        iRuleParamID = 1;             
+        }
+
+    // In error cases for return value to KErrGeneral
+    return ( err ? KErrGeneral : KErrNone );          
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteAllStoreRules
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::DeleteAllStoreRules()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteAllStoreRules()"));
+    
+    // Remove ruleparams     
+    TInt err = iStatement.Prepare( iDatabase, KRemoveStoreRuleServers );
+    if( !err )
+        {
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+
+        // Remove rules
+        err = iStatement.Prepare( iDatabase, KRemoveStoreRuleParams );
+        if( !err )
+            {
+            iStatement.Exec();
+            iStatement.Reset();
+            iStatement.Close();
+            // Remove Mediaservers from the mapping table
+            err = iStatement.Prepare( iDatabase, KRemoveStoreRules );
+            if( !err )
+                {
+                iStatement.Exec();
+                iStatement.Reset();
+                iStatement.Close();
+                }
+            else
+                {
+                err = KErrGeneral;
+                }
+            }
+        else
+            {
+            err = KErrGeneral;
+            }
+        }
+
+    iStoreRuleID = 1;
+    iStoreRuleParamID = 1;                
+  
+    return err;         
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteFillFiles
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::DeleteFillFiles()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteFillFiles()"));
+    
+    return iDatabase.Exec( KRemoveFillFiles );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteStoreFiles
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::DeleteStoreFiles()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteStoreFiles()"));
+    
+    iDatabase.Exec( KRemoveStoreFiles );    
+    TInt err = iDatabase.Exec( KRemoveStoreFileServers );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteDeletedItemsL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::DeleteDeletedItemsL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteDeletedItemsL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KRemoveDeletedFillFiles ) );
+    if( !err )
+        {    
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close(); 
+        }
+    else
+        {
+        User::Leave( err );
+        }   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteDeletedMediaServersL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::DeleteDeletedMediaServersL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    DeleteDeletedMediaServersL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KRemoveDeletedMediaServers ) );
+    if( !err )
+        {    
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close(); 
+        }
+    else
+        {
+        User::Leave( err );
+        }   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteHashValuesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::DeleteHashValuesL( const TInt aMediaserverId,
+    const TInt aSearchIndex )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteHashValuesL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KRemoveHash ) );    
+    if( !err )
+        {
+        iStatement.BindInt( 0, aMediaserverId );
+        iStatement.BindInt( 1, aSearchIndex );
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+        }
+    else
+        {
+        User::Leave( err );
+        }            
+    }
+                
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateMediaServerInfo
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::UpdateMediaServerInfo( 
+    CCmMediaServerFull* aMediaServer )    
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateMediaServerInfo()"));
+    
+    // Remove ruleparams
+    TInt err( iStatement.Prepare( iDatabase, KUpdateMediaServerInfo ) );
+    if( !err )
+        {    
+        iStatement.BindBinary( 0, aMediaServer->MediaServerName() );
+        iStatement.BindInt( 1, aMediaServer->SystemUpdateID() );
+        iStatement.BindInt64( 2, aMediaServer->VisibleDate().Int64() );
+        iStatement.BindBinary( 3, aMediaServer->MediaServer() );    
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();
+        }
+  
+    // In error cases for return value to KErrGeneral
+    return ( err ? KErrGeneral : KErrNone ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateFillRuleSelected
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::UpdateFillRuleSelected( 
+    const TDesC8& aName, 
+    TInt aSelected )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateFillRuleSelected()"));
+    
+    // Update Fill Rule
+    TInt err( iStatement.Prepare( iDatabase, KUpdateFillRuleSelected ) );
+    if( !err )
+        {
+        iStatement.BindInt( 0, aSelected );
+        iStatement.BindBinary( 1, aName );    
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();        
+        }    
+        
+    // In error cases for return value to KErrGeneral
+    return ( err ? KErrGeneral : KErrNone ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateFillRuleGroupInfo
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::UpdateFillRuleGroupInfo()
+	{
+	LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+	UpdateFillRuleGroupInfo()"));
+	
+	TInt err = iDatabase.Exec( KSetNullRealSizes );
+	return err;
+	}
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateDownloadHistory
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::UpdateDownloadHistory( TUint aMediaServerId,
+    TInt64& aDownloadData, TInt64& aDownloadTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateDownloadHistory()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KUpdateDownloadHistory ) );
+    if( !err )
+        {
+        iStatement.BindInt64( 0, aDownloadData );
+        iStatement.BindInt64( 1, aDownloadTime );
+        iStatement.BindInt( 2, aMediaServerId );
+        err = iStatement.Exec();
+        iStatement.Reset(  );
+        iStatement.Close();         
+        }
+    return err;        
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateUploadHistory
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::UpdateUploadHistory( TUint aMediaServerId,
+    TInt64& aUploadData, TInt64& aUploadTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateUploadHistory()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KUpdateUploadHistory ) );
+    if( !err )
+        {
+        iStatement.BindInt64( 0, aUploadData );
+        iStatement.BindInt64( 1, aUploadTime );
+        iStatement.BindInt( 2, aMediaServerId );
+        err = iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();         
+        }
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateStatusValues
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::UpdateStatusValues( 
+    RPointerArray<CCmBaseListItem>& aStatusValues )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateStatusValues()"));
+    
+    TInt err( KErrNone );
+    iDatabase.Exec( KCmDbBeginTransaction );    
+    err = iStatement.Prepare( iDatabase, KUpdateFileStatus );    
+    if( !err ) 
+        {
+        for( TInt i = 0; i < aStatusValues.Count(); i++ )
+            {        
+            iStatement.BindInt64( 0, aStatusValues[i]->Status() );
+            iStatement.BindInt64( 1, aStatusValues[i]->DbId() );          
+            iStatement.BindInt64( 2, aStatusValues[i]->DbId() );
+            iStatement.Exec();
+            iStatement.Reset();             
+            }        
+        }
+    iStatement.Close();        
+    iDatabase.Exec( KCmDbSqlCommit );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateFillListDriveStatusesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::UpdateFillListDriveStatusesL( 
+    CCmDriveInfo* aOrigDrive, CCmDriveInfo* aNewDrive, 
+    TBool aDriveSelected )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    UpdateFillListDriveStatusesL()"));
+    
+    if( aDriveSelected )
+        {
+        // Update only drive number and drive id
+        TInt err( iStatement.Prepare( iDatabase, KUpdateFillDriveInfo ) );
+        User::LeaveIfError( err );
+        iStatement.BindInt( 0, aNewDrive->DriveNumber() );
+        iStatement.BindInt64( 1, aNewDrive->DriveId() );
+        iStatement.BindInt64( 2, aOrigDrive->DriveId() );       
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();                 
+        }
+    else
+        {
+        // Set path, drive number, drive id, quota, size to null and
+        // update fill status to orginal
+        TInt err( iStatement.Prepare( iDatabase, 
+            KUpdateFillDriveAndStatusInfo ) );
+        User::LeaveIfError( err );
+        iStatement.BindText( 0, KNullDesC() );
+        iStatement.BindInt( 1, 0 );
+        iStatement.BindInt64( 2, 0 );
+        iStatement.BindInt( 3, (TInt)ECmToBeFilled );
+        iStatement.BindInt64( 4, aOrigDrive->DriveId() );       
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();                          
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateFillListItemPriority
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::UpdateFillListItemPriority( 
+    CCmFillRuleContainer* aContainer )    
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    UpdateFillListItemPriority()"));
+    
+    iDatabase.Exec( KCmDbBeginTransaction );    
+    TInt err( iStatement.Prepare( iDatabase, KUpdateFillItemPriorities ) );
+    if ( !err )
+        {
+        for( TInt i = 0; i < aContainer->FillRuleCount(); i++ )    
+            {        
+            iStatement.BindInt( 0, aContainer->FillRule( i )->Priority() );
+            iStatement.BindInt( 1, aContainer->FillRule( i )->Selected() );
+            iStatement.BindBinary( 2, aContainer->FillRule( i )->Name() );
+            iStatement.Exec();
+            iStatement.Reset();                
+            }      
+        }
+    iStatement.Close();        
+    iDatabase.Exec( KCmDbSqlCommit );
+    
+    //update fill item's status 
+    iDatabase.Exec( KCmDbBeginTransaction );    
+    TInt err1( iStatement.Prepare( 
+        iDatabase, KUpdateFillItemStatusByRuleName ) );
+    if ( !err1 )
+        {
+        for( TInt i = 0; i < aContainer->FillRuleCount(); i++ )    
+            {        
+            iStatement.BindInt( 0, aContainer->FillRule( i )->Status() );
+            iStatement.BindBinary( 1, aContainer->FillRule( i )->Name() );
+            iStatement.Exec();
+            iStatement.Reset();            
+            }                        
+        }
+    iStatement.Close();
+    iDatabase.Exec( KCmDbSqlCommit );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetFillListStateL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::SetFillListStateL( const TUint aListId, 
+    TCmFillRuleStatus aState )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetFillListStateL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KUpdateSelectionStatus ) );
+    if( err )
+        {
+        User::Leave( err );
+        }
+    else
+        {
+        iStatement.BindInt( 0, aState );   
+        iStatement.BindInt( 1, aListId );
+        iStatement.Exec();
+        iStatement.Reset();   
+        iStatement.Close();        
+        }         
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::RestoreFileStatusesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::RestoreFileStatusesL( 
+    const RPointerArray<CCmFillListItem>& aItems, 
+    const TDesC8& aListName )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::RestoreFileStatusesL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KGetFillListStatus ) );
+    TRACE( Print( _L("[DB MNGR]\t KGetFillListStatus err = %d "), 
+        err ) );    
+    
+    TUint status( KErrNone );
+        
+    if( err )
+        {
+        User::Leave( err ); 
+        }        
+    else
+        {
+        iStatement.BindBinary( 0, aListName );
+        err = iStatement.Next();
+        if ( err == KSqlAtRow )  
+            {
+            status = iStatement.ColumnInt( 0 );
+            }
+        }
+    TRACE( Print( _L("[DB MNGR]\t Status to be updated = %d "), 
+        status ) );        
+    iStatement.Reset(); 
+    iStatement.Close();
+    DoRestoreFileStatusesL( aItems, status );   
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DoRestoreFileStatusesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::DoRestoreFileStatusesL( 
+                        const RPointerArray<CCmFillListItem>& aItems, 
+                        const TUint aStatus )
+    {
+    
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DoRestoreFileStatusesL"));
+    
+    iDatabase.Exec( KCmDbBeginTransaction );    
+    TInt err( iStatement.Prepare( iDatabase, KRestoreFileStatus ) );    
+    
+    if( err )
+        {
+        User::Leave( err );
+        }
+        
+    for( TInt i = 0; i < aItems.Count(); i++ )
+        {            
+        iStatement.BindInt( 0, aStatus );
+        iStatement.BindInt64( 1, aItems[i]->DbId() );
+        iStatement.BindInt64( 2, aItems[i]->DbId() );
+        iStatement.Exec();
+        iStatement.Reset();           
+        }
+        
+    iStatement.Close();        
+    iDatabase.Exec( KCmDbSqlCommit );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetRefIdsToZero
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::SetRefIdsToZero()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetRefIdsToZero()"));
+    
+    iDatabase.Exec( KUpdateFillItemRef_Zero );        
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::IncrementShrinkTimeL
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::IncrementShrinkTimeL( TInt aImageCount, 
+    TInt aMilliSeconds )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::IncrementShrinkTimeL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KIncrementImageShrinkingInfo ) );
+    if( err )
+        {
+        User::Leave( err );
+        }
+    else
+        {
+        iStatement.BindInt64( 0, aImageCount );
+        iStatement.BindInt64( 1, aMilliSeconds );
+        err = iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();        
+        }        
+    return err;  
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::FillListSize
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmDmSQLiteConnection::FillListSize( const TDesC8& aListName, 
+                                             TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::FillListSize()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KFillListSize ) );
+    TInt64 size(KErrNone);
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            FillListSize illegal err = %d"), err ));
+        }
+    else
+        {
+        iStatement.BindInt( 0, aStatus );
+        iStatement.BindBinary( 1, aListName );
+
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            size = iStatement.ColumnInt64( 0 );             
+            }        
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    return size;          
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::StoreListSize
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmDmSQLiteConnection::StoreListSize( 
+    const TDesC8& aListName, 
+    TUint /*aStatus*/ )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::StoreListSize()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KStoreListSize ) );
+    TInt64 size(KErrNone);
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            StoreListSize illegal err = %d"), err ));
+        }
+    else
+        {
+        iStatement.BindBinary( 0, aListName );
+
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            size = iStatement.ColumnInt64( 0 );
+            }        
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    return size;      
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::StoreFileCount
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::StoreFileCount( TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::StoreFileCount()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KStoreFileCount ) );
+    TInt count(KErrNone);
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            Illegal err = %d"), err ));
+        }
+    else
+        {
+        iStatement.BindInt( 0, aStatus );
+
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            count = iStatement.ColumnInt( 0 );               
+            }        
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    return count;  
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::StoreFileCountNoDuplicates
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::StoreFileCountNoDuplicates()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    StoreFileCountNoDuplicates()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KStoreFileCountNoDuplicates ) );
+    TInt count(KErrNone);
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            Illegal err = %d"), err ));
+        }
+    else
+        {
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() ) 
+            {
+            // Get cell contents    
+            count = iStatement.ColumnInt( 0 );                
+            }        
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    return count;  
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::FillFileCount
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::FillFileCount( TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::FillFileCount()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KFillFileCount ) );
+    TInt count(KErrNone);
+    if( err )
+        {
+        // Do nothing
+        }
+    else
+        {
+        iStatement.BindInt( 0, aStatus );
+
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            count = iStatement.ColumnInt( 0 );             
+            }        
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    return count;      
+    }
+
+// ---------------------------------------------------------------------------
+// Returns size of the filled items
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmDmSQLiteConnection::BytesFilled( TUint aID )
+    {
+    TInt err( iStatement.Prepare( iDatabase, KDataAmountFilled ) );
+    TInt64 size(KErrNone);
+    if( err )
+        {
+        return size;
+        }
+    else
+        {
+        iStatement.BindInt( 0, aID );
+
+        for ( err = iStatement.Next();
+              err == KSqlAtRow;
+              err = iStatement.Next() )
+            {
+            // Get cell contents
+            size = iStatement.ColumnInt64( 0 );
+            }
+        }
+    iStatement.Reset();
+    iStatement.Close();  // Destruct statement
+    return size;
+    }
+
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmDmSQLiteConnection::KBytesToBeFilled( TUint8 aMediaServerId, 
+    TUint aStatus )    
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::KBytesToBeFilled()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KDataAmountToBeFilled ) );
+    TInt64 size(KErrNone);
+    if( err )
+        {
+        return size;
+        }
+    else
+        {
+        iStatement.BindInt( 0, aStatus );
+        iStatement.BindInt( 1, aMediaServerId );
+
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            size = iStatement.ColumnInt64( 0 );             
+            }         
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    return (size/1000);     
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::KBytesToBeStored
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmDmSQLiteConnection::KBytesToBeStored( TUint8 aMediaServerId, 
+    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::KBytesToBeStored()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KDataAmountToBeStored ) );
+    TInt64 size(KErrNone);
+    if( !err )
+        {
+        iStatement.BindInt( 0, aMediaServerId );
+        iStatement.BindInt( 1, aStatus );
+
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            size = iStatement.ColumnInt64( 0 );             
+            }        
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    return (size/1000); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateTransferInfo
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::UpdateTransferInfo( TCmService aService, 
+    TInt aCount, TInt aTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateTransferInfo()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KInitTransferInfo ) );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            KInitTransferInfo illegal err = %d"), err ));
+        }
+    else
+        {
+        iStatement.BindInt( 0, aService );
+        err = iStatement.Exec();                  
+        }
+    iStatement.Reset();
+    iStatement.Close();         
+    err = iStatement.Prepare( iDatabase, KUpdateTransferInfo );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            KUpdateTransferInfo illegal err = %d"), err ));
+        }
+    else
+        {
+        iStatement.BindInt( 0, aCount );
+        iStatement.BindInt( 1, aTime );
+        iStatement.BindInt( 2, aService );
+        err = iStatement.Exec();         
+        }
+    iStatement.Reset();
+    iStatement.Close();                    
+    return err;          
+    }   
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateStoreTransferStatus
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::UpdateStoreTransferStatus( TUint aStatus,
+    TInt64 aFid, TInt64 aMsId )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    UpdateStoreTransferStatus()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KUpdateStoreTransferStatus ));
+    if( err )
+        {
+        
+        }
+    else
+        {
+        iStatement.BindInt( 0, aStatus );
+        iStatement.BindInt64( 1, aFid );
+        iStatement.BindInt64( 2, aMsId );
+        err = iStatement.Exec();
+        }
+    iStatement.Reset();
+    iStatement.Close();                
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::UpdateFillTransferStatus
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::UpdateFillTransferStatus( TUint aStatus, 
+    CCmFillListItem* aItem )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    UpdateFillTransferStatus()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KUpdateFillTransferStatus ));
+    if( err )
+        {
+        LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+        UpdateFillTransferStatus() error preparing statement"));       
+        }
+    else
+        {
+        iStatement.BindInt( 0, aStatus );
+        iStatement.BindText( 1, aItem->Path() );
+        iStatement.BindInt64( 2, aItem->DriveId() );
+        iStatement.BindInt( 3, aItem->DriveNumber() );
+        iStatement.BindInt64( 4, aItem->DevId() );
+        iStatement.BindInt64( 5, aItem->DbId() );
+        iStatement.BindInt64( 6, aItem->ListId() );
+        iStatement.BindInt64( 7, aItem->DbId() );
+        err = iStatement.Exec();
+        }
+    iStatement.Reset();
+    iStatement.Close();      
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetTransferInfo
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::GetTransferInfo( TCmService aService, 
+    TInt& aCount, TInt& aTime )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetTransferInfo()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KTranferValues ) );
+    aCount = 0;
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            KTranferValues illegal err = %d"), err ));
+        }
+    else
+        {
+        iStatement.BindInt( 0, aService );
+
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            aCount = iStatement.ColumnInt( 0 );
+            err = KErrNone;                   
+            }        
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    err = iStatement.Prepare( iDatabase, KTranferTime );
+    aTime = 0;
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            KTranferTime illegal err = %d"), err ));
+        }
+    else
+        {
+        iStatement.BindInt( 0, aService );
+
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            aTime = iStatement.ColumnInt( 0 );
+            err = KErrNone;                  
+            }        
+        }
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement            
+    return err;         
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetStoreFileCount
+// ---------------------------------------------------------------------------
+//    
+TInt CCmDmSQLiteConnection::GetStoreFileCount( 
+    const TDesC8& aListName, 
+    TUint /*aStatus*/, 
+    TInt& aCount )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetStoreFileCount()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KStoreListFileCount ) );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            GetStoreFileCount illegal err = %d"), err ));
+        }
+    else
+        {
+        iStatement.BindBinary( 0, aListName );
+
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() )
+            {
+            // Get cell contents    
+            aCount = iStatement.ColumnInt( 0 );
+            err = KErrNone;             
+            }        
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    return err;  
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::GetFillFileCount
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::GetFillFileCount( 
+    const TDesC8& aListName, 
+    TUint aStatus, 
+    TInt& aCount )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetFillFileCount()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, KFillListFileCount ) );
+    if( err )
+        {
+        TRACE(Print(_L("[DATABASE MANAGER]\t \
+            GetFillFileCount illegal err = %d"), err ));
+        }
+    else
+        {
+        iStatement.BindInt( 0, aStatus );        
+        iStatement.BindBinary( 1, aListName );
+        for ( err = iStatement.Next(); 
+              err == KSqlAtRow; 
+              err = iStatement.Next() ) 
+            {
+            // Get cell contents    
+            aCount = iStatement.ColumnInt64( 0 );
+            err = KErrNone;                               
+            }        
+        }    
+    iStatement.Reset();            
+    iStatement.Close();  // Destruct statement
+    return err;  
+    }
+
+// ---------------------------------------------------------------------------
+// CmDmSQLiteConnection::GetStoreFileCountNoDuplicatesL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::GetStoreFileCountNoDuplicatesL( TInt& aCount,
+    TUint aStatus )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    GetStoreFileCountNoDuplicatesL()"));
+    
+    TInt err( iStatement.Prepare( iDatabase, 
+        KGetStoreFileCountNoDuplicates ));
+    if( err )
+        {
+        User::Leave( err );
+        }
+    else
+        {
+        iStatement.BindInt( 0, aStatus );
+        if( KSqlAtRow == iStatement.Next() )
+            {
+            aCount = iStatement.ColumnInt( 0 );
+            }
+        iStatement.Reset();
+        iStatement.Close();    
+        }        
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::SetFillListRealCountAndSizeL
+// ---------------------------------------------------------------------------
+//
+void CCmDmSQLiteConnection::SetFillListRealCountAndSizeL( TInt64 aListId,
+    TInt64 aRealCount, TInt64 aRealSize )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    SetFillListRealCountAndSizeL()"));
+    
+    // Update Fill Rule
+    TInt err = iStatement.Prepare( iDatabase, 
+                                   KUpdateFillRuleRealInformation );
+    if( !err )
+        {
+        iStatement.BindInt64( 0, aRealCount );
+        iStatement.BindInt64( 1, aRealSize );
+        iStatement.BindInt64( 2, aListId );    
+        iStatement.Exec();
+        iStatement.Reset();
+        iStatement.Close();     
+        }
+    else
+        {
+        User::Leave( err );
+        }        
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteInActiveRuleServers
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::DeleteInActiveRuleServers()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    DeleteInActiveRuleServers()"));
+    
+    TInt err( KErrNone );
+    err = iDatabase.Exec( KRemoveInActiveFillRuleServers );
+    if( err >= KErrNone )
+        {
+        err = iDatabase.Exec( KRemoveInActiveStoreRuleServers );
+        }
+    if( err >= KErrNone )
+        {
+        err = KErrNone;
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteInActiveFiles
+// ---------------------------------------------------------------------------
+//
+TInt CCmDmSQLiteConnection::DeleteInActiveFiles()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteInActiveFiles()"));
+    
+    TInt err( KErrNone );
+    iDatabase.Exec( KRemoveInActiveFillFiles );
+    iDatabase.Exec( KRemoveInActiveStoreFilesServers );
+    err = iDatabase.Exec( KRemoveInActiveStoreFiles );
+    if( err >= KErrNone )
+        {
+        err = KErrNone;
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::DeleteItemsByFillListId
+// ---------------------------------------------------------------------------
+//   
+TInt CCmDmSQLiteConnection::DeleteItemsByFillListId( TInt aFillListId )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\
+    DeleteItemsByFillListId()"));
+    
+    TInt err( KErrNone );
+    err = iStatement.Prepare( iDatabase, KRemoveFillListItems );
+    iStatement.BindInt( 0, aFillListId );
+    iStatement.Exec();
+    iStatement.Reset();
+    iStatement.Close();   
+    return err;
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::RuleId
+// ---------------------------------------------------------------------------
+//
+TInt64 CCmDmSQLiteConnection::RuleId( 
+    const TDesC8& aName, 
+    TCmRuleType aType )
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::RuleId()"));
+    
+    TInt64 ret( KErrNone );
+    // Fill rule id        
+    if( ECmFmFillRule == aType )
+        {
+        ret = iStatement.Prepare( iDatabase, KSelectRuleGroupID );        
+        }
+    // Store rule id        
+    else
+        {
+        ret = iStatement.Prepare( iDatabase, KSelectStoreRuleID );        
+        }
+    if( ret )
+        {
+        ret = KErrGeneral;
+        }
+    else
+        {
+        iStatement.BindBinary( 0, aName );                
+        // Loop only one row in results
+        ret = iStatement.Next();
+        if ( ret == KSqlAtRow )  
+            {
+            // Get cell contents   
+            ret = iStatement.ColumnInt64( 0 );        
+            }    
+        }
+    iStatement.Reset();                
+    iStatement.Close();  // Destruct statement            
+    TRACE(Print(_L("[DATABASE MANAGER]\t CCmDmSQLiteConnection::RuleId()\
+         end")));
+    return ret;        
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::CCmDmSQLiteConnection
+// ---------------------------------------------------------------------------
+//    
+CCmDmSQLiteConnection::CCmDmSQLiteConnection()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::CCmDmSQLiteConnection()"));
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmDmSQLiteConnection::ConstructL
+// ---------------------------------------------------------------------------
+//   
+void CCmDmSQLiteConnection::ConstructL()
+    {
+    LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::ConstructL()"));   
+    }    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for CM Metadata Harvester
+*
+*/
+
+
+
+
+
+
+#include "../../group/upnpplatformvar.hrh"
+
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+../install/upnpharvester_stub.SIS   /epoc32/data/z/system/install/upnpharvester_stub.sis
+../install/10281fab.cre             /epoc32/release/armv5/urel/z/private/10202be9/10281fab.cre
+../rom/upnpharvester.iby            CORE_MW_LAYER_IBY_EXPORT_PATH(upnpharvester.iby)
+
+PRJ_MMPFILES
+
+#include "../common/cmlibrary/group/bld.inf"
+#include "../common/cmsettings/group/bld.inf"
+#include "../common/dbmanager/group/bld.inf"
+#include "../common/cmsqlwrapper/group/bld.inf"
+#include "../cdssync/common/bld.inf"
+#include "../mdhserver/group/bld.inf"
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
+// None
+
+//  End of File
Binary file upnpharvester/install/10281fab.cre has changed
Binary file upnpharvester/install/cenrep.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/install/cenrep.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:     cenrep
+;
+&EN
+
+; Header
+#{ "Upnp Harvester CenRep file"}, (0x10202BE9), 1, 0, 0, TYPE=SP
+
+; Supports Series 60 v3.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Localised vendor name
+%{"Nokia-EN"}
+; Unique vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\urel\z\private\10202be9\10281fab.cre"-"!:\private\10202be9\persists\10281fab.cre"
\ No newline at end of file
Binary file upnpharvester/install/cenrep.sisx has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/install/make_upnpharvester_sis.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,25 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:     Makes upnpharvester sisx
+rem
+
+makesis cenrep.pkg
+signsis cenrep.sis cenrep.sisx rd.cer rd-key.pem
+
+makesis upnpharvester.pkg
+signsis upnpharvester.sis upnpharvester.sisx  rd.cer rd-key.pem
+del ..\sis\upnpharvester.sis /F
+del ..\sis\upnpharvester.sisx /F
+move .\upnpharvester.sis ..\sis
+move .\upnpharvester.sisx ..\sis
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/install/make_upnpharvester_stub_sis.bat	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:     upnpharvester stub sis
+rem
+
+del upnpharvester_stub.sis /F
+makesis -s upnpharvester_stub.pkg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/install/upnpharvester.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,43 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:     mediaservant pkg
+;
+&EN
+
+; standard SIS file header
+#{"Upnp Harvester"},(0x20022D5C),1,1,0, TYPE=SA, RU
+
+;Localized Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;Supports Series 60 v 3.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+
+; Files to copy
+"\epoc32\release\armv5\urel\cmsqlwrapper.dll"-"!:\sys\bin\cmsqlwrapper.dll"
+"\epoc32\release\armv5\urel\cmcommon.dll"-"!:\sys\bin\cmcommon.dll"
+"\epoc32\release\armv5\urel\cmdatabasemanager.dll"-"!:\sys\bin\cmdatabasemanager.dll"
+"\epoc32\release\armv5\urel\cmmdhclient.dll"-"!:\sys\bin\cmmdhclient.dll"
+"\epoc32\release\armv5\urel\cmmdh.exe"-"!:\sys\bin\cmmdh.exe"
+"\epoc32\release\armv5\urel\cmsettingsengine.dll"-"!:\sys\bin\cmsettingsengine.dll"
+"\epoc32\release\armv5\urel\cdssync.dll"-"!:\sys\bin\cdssync.dll"
+
+; central repository
+;@"cenrep.sisx", (0x10202BE9)
+
+; End of File
Binary file upnpharvester/install/upnpharvester_stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/install/upnpharvester_stub.pkg	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,41 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:     upnpharvester_stub
+;
+&EN
+
+; standard SIS file header
+#{"Upnp Harvester"},(0x20022D5C),1,1,0, TYPE=SA
+
+;Localized Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;Supports Series 60 v 3.0
+;[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+""-"z:\sys\bin\cmsqlwrapper.dll"
+""-"z:\sys\bin\cmcommon.dll"
+""-"z:\sys\bin\cmdatabasemanager.dll"
+""-"z:\sys\bin\cmmdhclient.dll"
+""-"z:\sys\bin\cmmdh.exe"
+""-"z:\sys\bin\cmsettingsengine.dll"
+""-"z:\sys\bin\cdssync.dll"
+
+""-"z:\private\10202be9\10281FAB.txt"
+
+""-"z:\system\data\MediaServant\CM_Database.sq"
+""-"z:\system\data\MediaServant\cmmetadatacache.sq"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/bwins/cmmdhclientu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewCmMdhClientL@CCmMdhClientFactory@@SAPAVMCmMdhClient@@AAVMCmServiceObserver@@@Z @ 1 NONAME ; class MCmMdhClient * CCmMdhClientFactory::NewCmMdhClientL(class MCmServiceObserver &)
+	?NewCmMdhClientLC@CCmMdhClientFactory@@SAPAVMCmMdhClient@@AAVMCmServiceObserver@@@Z @ 2 NONAME ; class MCmMdhClient * CCmMdhClientFactory::NewCmMdhClientLC(class MCmServiceObserver &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/eabi/cmmdhclientu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN19CCmMdhClientFactory15NewCmMdhClientLER18MCmServiceObserver @ 1 NONAME
+	_ZN19CCmMdhClientFactory16NewCmMdhClientLCER18MCmServiceObserver @ 2 NONAME
+	_ZTI12CCmMdhClient @ 3 NONAME ; #<TI>#
+	_ZTV12CCmMdhClient @ 4 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for CM Metadata Harvester
+*
+*/
+
+
+
+
+
+
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+// ADO internal interface
+../inc/client/mdhclientsession.h          |../../../inc/mdhclientsession.h
+../inc/client/mdhclientfactory.h          |../../../inc/mdhclientfactory.h
+../inc/client/mmdhclient.h                |../../../inc/mmdhclient.h
+
+PRJ_MMPFILES
+
+mdhclient.mmp
+mdhserver.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/group/mdhclient.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project specification file for CM Metadata Harvester client
+*
+*/
+
+
+
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/mdhuids.hrh"
+
+TARGET          cmmdhclient.dll
+TARGETTYPE      dll
+UID             0x1000008D KCmMdhClientUid
+
+CAPABILITY CAP_GENERAL_DLL
+
+SOURCEPATH      ../src/client
+SOURCE          mdhclientsession.cpp
+SOURCE          mdhclient.cpp
+SOURCE          mdhclientfactory.cpp
+
+USERINCLUDE     ../inc/client
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+
+DEBUGLIBRARY    flogger.lib
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/group/mdhserver.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project file 
+*
+*/
+
+
+
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/mdhuids.hrh"
+
+TARGET              cmmdh.exe
+
+TARGETTYPE          exe
+
+TARGETPATH          /system/programs
+UID                 0x1000008d KCmMdhServerUid
+
+CAPABILITY          CAP_SERVER
+VENDORID            VID_DEFAULT
+
+// Minimum heap size 2MB, maximum heap size 8MB, stack size 32kB
+EPOCHEAPSIZE   4096 16388608
+EPOCSTACKSIZE  65536
+
+
+SOURCEPATH          ../src/server
+SOURCE              mdhservermain.cpp
+SOURCE              mdhserver.cpp
+SOURCE              mdhserversession.cpp
+SOURCE              mdhavcpadapter.cpp
+SOURCE              mdhmediaservercontainer.cpp
+SOURCE              mdhmetadatacollector.cpp
+SOURCE              mdhconnectionmonitor.cpp
+
+
+USERINCLUDE         ../inc
+USERINCLUDE         ../../../inc
+USERINCLUDE         ../inc/server
+USERINCLUDE         ../../cdssync/cdssynclib/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// UPnP stack
+LIBRARY         AVControlFramework.lib
+LIBRARY         upnpserviceframework.lib
+LIBRARY         upnpipserversutils.lib
+
+LIBRARY         cdssync.lib
+LIBRARY         cmdatabasemanager.lib 
+LIBRARY         cmcommon.lib
+LIBRARY         cmsettingsengine.lib
+
+
+// Central Repository
+LIBRARY         centralrepository.lib
+
+LIBRARY             euser.lib
+LIBRARY             ecom.lib
+LIBRARY             estor.lib
+LIBRARY             efsrv.lib
+LIBRARY             connmon.lib
+LIBRARY             hash.lib
+DEBUGLIBRARY        flogger.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/client/mdhclient.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester server's client header
+*
+*/
+
+
+
+
+
+
+
+#ifndef CMMDHCLIENT_H
+#define CMMDHCLIENT_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    "mdhclientsession.h"
+#include    "mmdhclient.h"
+
+// FORWARD DECLARATION
+class RCmMdhSession;
+class MCmServiceObserver;
+
+// CLASS DECLARATION
+/**
+*  Metadata Harvester client
+*
+*  @lib cmmdhclient.lib
+*  @since S60 3.1
+*/
+class CCmMdhClient : public CActive,
+                     public MCmMdhClient
+    {
+    public:
+    
+        enum TCmMdhClientState  
+            {
+            ECmMdhClientIdle = 0,
+            ECmMdhClientSearching,
+            ECmMdhClientHarvesting
+            };
+
+    public:
+    
+        /**
+        * Two-phased constructor.
+        */
+        static CCmMdhClient* NewL( MCmServiceObserver& aServer );
+       
+        /**
+        * Two-phased constructor.
+        */       
+        static CCmMdhClient* NewLC( MCmServiceObserver& aServer );
+ 
+        /**
+        * Destructor
+        */            
+        virtual ~CCmMdhClient();
+                   
+    public:
+            
+        /**
+        * Starts harvesting
+        * @since S60 3.1
+        * @return Error code
+        */        
+        TInt Harvest();
+    
+        /**
+        * Cancels request
+        * @since S60 3.1
+        * @return Error code
+        */        
+        void Stop();
+	
+    /**
+     * Deletes the object
+     * @since S60 3.1
+     */
+		void Close();
+	
+    private:
+            
+        /**
+         * From CActive
+         * Callback function.
+         * Invoked to handle responses from the server.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         * Cancels any outstanding operation.
+         */
+        void DoCancel();
+        
+    private:
+ 
+        /**
+        * Default constructor
+        */        
+        CCmMdhClient( MCmServiceObserver& aServer );
+        
+        /**
+        * ConstructL
+        */        
+        void ConstructL( );
+                
+    private:
+    
+        /** Instance of mdh session */
+        RCmMdhSession iMdhSession;
+        
+        /** Observer */
+        MCmServiceObserver& iServer;
+        
+        /** State of the client */
+        TCmMdhClientState iState;
+    };
+    
+#endif      // CMMDHCLIENT_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/client/mdhclientfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Abstract factory for MdhClient
+*
+*/
+
+
+
+
+
+
+
+#ifndef C_CMMDHCLIENTFACTORY_H
+#define C_CMMDHCLIENTFACTORY_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+/* Forward declarations. */
+class MCmMdhClient;
+class MCmServiceObserver;
+
+/**
+ *  Abstract factory for MdhClient
+ *
+ *  @lib cmmdhclient.lib
+ *  @since S60 v3.1
+ */
+class CCmMdhClientFactory : public CBase
+    {
+
+public:
+
+    /**
+     * Creates a new instance of CSMdhClient
+     * @return  pointer to CCmMdhClientEngine class
+     */
+    IMPORT_C static MCmMdhClient* NewCmMdhClientL( MCmServiceObserver& aServer );
+
+    /**
+     * Creates a new instance of CSMdhClient. Instance is left in
+     * cleanup stack.
+     * @return  pointer to CCmMdhClientEngine class
+     */
+    IMPORT_C static MCmMdhClient* NewCmMdhClientLC( MCmServiceObserver& aServer );
+
+    };
+
+#endif // C_CMMDHCLIENTFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/client/mdhclientsession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester server's client header
+*
+*/
+
+
+
+
+
+
+
+#ifndef CMMDHCLIENTSESSION_H
+#define CMMDHCLIENTSESSION_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// DATA TYPES
+
+// CLASS DECLARATION
+
+/**
+*  Metadata Harvester session
+*
+*  @lib cmmdhclient.lib
+*  @since S60 3.1
+*/
+class RCmMdhSession : public RSessionBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Session constructor.
+        */
+        RCmMdhSession();
+        
+      
+    public: // New functions
+        
+        /**
+        * Make the client-server connection with Metadata Harvester.
+        * @since S60 3.1
+        * @param None
+        * @return Status code depending on the success.
+        */
+        TInt Connect();
+        
+        /**
+        * Cancel ongoing search or harvest operation
+        * @since S60 3.1
+        * @param None
+        * @return void
+        */
+        void Cancel();
+    
+        /**
+        * Search for media neighbourhood servers
+        * @since S60 3.1
+        * @param aStatus asynchronous request status
+        * @return void
+        */
+        void SearchMediaservers( TRequestStatus& aStatus );
+        
+        
+        /**
+        * Harvest and synchronize metadata
+        * @since S60 3.1
+        * @param aStatus, asynchronous request status
+        * @return void
+        */
+        void Harvest( TRequestStatus& aStatus );
+        
+    };
+    
+
+#endif      // CMMDHCLIENTSESSION_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/client/mmdhclient.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester server's client header
+*
+*/
+
+
+
+
+
+
+#ifndef MCMMDHCLIENT_H
+#define MCMMDHCLIENT_H
+
+//  INCLUDES
+
+// FORWARD DECLARATION
+
+// CLASS DECLARATION
+/**
+*  Metadata Harvester client
+*
+*  @lib mcmmdhclient.lib
+*  @since S60 3.1
+*/
+class MCmMdhClient
+    {
+    public:
+            
+        /**
+        * Starts harvesting
+        * @since S60 3.1
+        * @return Error code
+        */        
+        virtual TInt Harvest() = 0;
+		
+		/**
+        * Cancels request
+        * @since S60 3.1
+        */        
+        virtual void Stop() = 0;
+
+    /**
+     * Deletes the object
+     * @since S60 3.1
+     */
+		virtual void Close() = 0;
+		
+    };
+    
+#endif      // MCMMDHCLIENT_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/mdhcommon.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Common Client/Server header for CM Metadata Harvester
+*
+*/
+
+
+
+
+
+
+#ifndef CMMDHCOMMON_H
+#define CMMDHCOMMON_H
+
+_LIT(KCmMdhServerExe,"cmmdh.exe"); ///<EXE name
+
+// CONSTANTS
+
+// Server name
+_LIT(KCmMdhServerName,"CmMdhServer");
+
+// Panic name
+_LIT(KCmMdhServerPanic, "CmMdhServerPanic");
+
+//const TUid KCmMetadataHarvesterUid3={0x0EFFEFEF};
+
+/// A version must be specified when creating a session with the server
+const TUint KCmMdhServerMajor = 1;
+const TUint KCmMdhServerMinor = 0;
+const TUint KCmMdhServerBuild = 0;
+
+/// opcodes used in message passing between client and server
+enum TCmMdhRequest
+    {
+    ECmMdhSearchMediaservers,
+    ECmMdhHarvest,
+    ECmMdhCancel
+    };
+
+/// Panic enums
+enum TCmMdhClientPanics
+    {
+    ECmMdhClientNoSessionActive,
+    ECmMdhClientBadRequest
+    };
+
+/// Panic enums
+enum TCmMdhServerPanics
+    {
+    EDCmMdhServerIllegalParameter
+    };
+
+#endif
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/mdhuids.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Specifies the UID values used in Metadata Harvester.
+*
+*/
+
+
+
+
+
+
+#ifndef MDH_UIDS_HRH
+#define MDH_UIDS_HRH
+
+// Metadata Harvester module Uids  NOTE! Change these according to correct values
+#define KCmMdhClientUid                 0x10281FA5
+#define KCmMdhServerUid                 0x10281FA6
+
+
+#endif  // MDH_UIDS_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/server/mdhavcpadapter.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,605 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AvControlPoint adapter helper class
+*
+*/
+
+
+
+
+
+
+#ifndef CMMDHAVCPADAPTER
+#define CMMDHAVCPADAPTER
+
+//  INCLUDES
+#include "upnpavcontrolpointobserver.h"
+
+// CLASS DECLARATION
+
+/**
+*  Interface class.
+*  This class implements a observer interface for AV controlpoint
+*
+*  @since S60 3.1
+*/
+class CCmMdhAvControlPointAdapter: public CBase, 
+                                   public MUpnpAVControlPointObserver
+        {
+    public:  // Constructors and destructor
+
+       /**
+        * Two-phased constructor.
+        */
+        static CCmMdhAvControlPointAdapter* NewL();
+
+       /**
+        * Two-phased constructor.
+        */        
+        static CCmMdhAvControlPointAdapter* NewLC();
+        
+       /**
+        * Destructor
+        */        
+        virtual ~CCmMdhAvControlPointAdapter();
+        
+    protected:
+    
+       /**
+        * ConstructL
+        */    
+        void ConstructL();
+        
+       /**
+        * Default constructor
+        */        
+        CCmMdhAvControlPointAdapter();
+        
+        
+    public: // Functions from base classes
+    
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void RcSetVolumeResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr, 
+            const TDesC8& aInstance, 
+            const TDesC8& aChannel, 
+            const TDesC8& aDesiredVolume);
+            public: // New functions
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void RcVolumeResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr, 
+            const TDesC8& aInstance, 
+            const TDesC8& aChannel, 
+            const TDesC8& aCurrentVolume); 
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void RcSetMuteResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr, 
+            const TDesC8& aInstance, 
+            const TDesC8& aChannel, 
+            const TDesC8& aDesiredMute);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void RcMuteResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr, 
+            const TDesC8& aInstance, 
+            const TDesC8& aChannel, 
+            const TDesC8& aCurrentMute); 
+       
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtSetTransportUriResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aCurrentUri,
+            const TDesC8& aCurrentUriMetaData);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtSetNextTransportUriResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aNextUri,
+            const TDesC8& aNextUriMetaData);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtMediaInfoResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aNrTracks,
+            const TDesC8& aMediaDuration,
+            const TDesC8& aCurrentUri,
+            const TDesC8& aCurrentUriMetaData,
+            const TDesC8& aNextUri,
+            const TDesC8& aNextUriMetaData,
+            const TDesC8& aPlayMedium,
+            const TDesC8& aRecordMedium,
+            const TDesC8& aWriteStatus);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtGetTransportInfoResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aCurrenTransportState,
+            const TDesC8& aCurrentTransportStatus,
+            const TDesC8& aCurrentSpeed);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtPositionInfoResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aTrack,
+            const TDesC8& aTrackDuration,
+            const TDesC8& aTrackMetaData,
+            const TDesC8& aTrackURI,
+            const TDesC8& aRelTime,
+            const TDesC8& aAbsTime,
+            const TDesC8& aRelCount,
+            const TDesC8& aAbsCount);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtDeviceCapabilitiesResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aPlayMedia,
+            const TDesC8& aRecMedia,
+            const TDesC8& aRecQualityMode);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtTransportSettingsResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aPlayMode,
+            const TDesC8& aRecQualityMode);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtStopResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtPlayResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aSpeed);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtPauseResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtRecordResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtSeekResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aUnit,
+            const TDesC8& aTarget);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtNextResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtPreviousResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtSetPlayModeResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aNewPlayMode);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtSetRecordModeResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aNewRecordQuality);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtCurrentTransportActionsResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aInstanceId,
+            const TDesC8& aActions);
+            
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsSearchCapabilitiesResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSearchCaps);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsSortCapabilitiesResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSortCaps);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsSystemUpdateIdResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            TInt aSystemUpdateId);
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsBrowseResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aObjectID,
+            const TDesC8&  aBrowseFlag,
+            const TDesC8&  aFilter,
+            TInt aIndex,
+            TInt aRequest,
+            const TDesC8&  aSortCriteria,
+            const TDesC8&  aResult,
+            TInt aReturned,
+            TInt aMatches,
+            const TDesC8&  aUpdateID);
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsSearchResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aContainerId,
+            const TDesC8& aSearchCriteria,
+            const TDesC8& aFilter,
+            TInt aIndex,
+            TInt aRequest,
+            const TDesC8& aSortCriteria,
+            const TDesC8& aResult,
+            TInt aReturned,
+            TInt aMatches,
+            const TDesC8& aUpdateID);
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsDestroyObjectResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aObjectId );
+        
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsUpdateObjectResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aObjectId,
+            const TDesC8& aCurrentTagValue,
+            const TDesC8& aNewTagValue );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */       
+        virtual void CdsImportResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSourceURI,
+            const TDesC8& aDestinationURI,
+            const TDesC8& aTransferId );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */      
+        virtual void CdsExportResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSourceURI,
+            const TDesC8& aDestinationURI,
+            const TDesC8& aTransferId );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */      
+        virtual void CdsStopTransferResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aTransferId );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */         
+        virtual void CdsCTransferProgressResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aTransferId,
+            const TDesC8& aTransferStatus,
+            const TDesC8& aTransferLength,            
+            const TDesC8& aTransferTotal );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */ 
+        virtual void CdsDeleteResourceResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aResourceUri );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */ 
+        virtual void CdsCreateReferenceResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aContainerId, 
+            const TDesC8& aObjectId, 
+            const TDesC8& aNewId );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */ 
+        virtual void CdsCreateObjectResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aContainerID, 
+            const TDesC8& aElements, 
+            const TDesC8& aObjectID, 
+            const TDesC8& aResult );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */ 
+        virtual void CmProtocolInfoResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSource, 
+            const TDesC8& aSink );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */        
+        virtual void CmPrepareResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aRemoteProtocolInfo,
+            const TDesC8& aPeerConnectionManager,
+            const TDesC8& aPeerConnectionId,
+            const TDesC8& aDirection,
+            TInt aConnection,
+            TInt aTransport,
+            TInt aRsc );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */        
+        virtual void CmComplete(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            TInt aConnection );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */         
+        virtual void CmCurrentConnections(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aConnections);
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */   
+        virtual void CmCurrentInfo(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            TInt rscId, 
+            TInt transportId, 
+            const TDesC8& aProtocolInfo,
+            const TDesC8& aPeerConnectionManager, 
+            TInt peerId, 
+            const TDesC8& aDirection, 
+            const TDesC8& aStatus );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsUpdateEvent(
+                const TDesC8& aUuid,
+                TInt aSystemUpdateId
+                );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsContainerEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aConteinerIds
+                );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CdsTransferEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aTransferIds
+                );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void RcLastChangeEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aLastChange
+                );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void AvtLastChangeEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aLastChange
+                );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CmSourceEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aSource
+                );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CmSinkEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aSink
+                );
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void CmConnectionsEvent(
+                const TDesC8& aUuid,
+                const TDesC8& aConnections
+                );
+        //*****************************************************************
+        // Device and http functions.
+        //*****************************************************************
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void HttpResponseL(CUpnpHttpMessage* aMessage);
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void DeviceDiscoveredL(CUpnpDevice* aDevice);
+
+        /**
+         * See upnpavcontrolpointobserver.h
+         */
+        virtual void DeviceDisappearedL(CUpnpDevice* aDevice);
+    };
+
+#endif      // CMMDHAVCPADAPTER   
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/server/mdhconnectionmonitor.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      MdH Connection Monitor class declaration
+*
+*/
+
+
+
+
+
+#ifndef C_MDHCONNECTIONMMONITOR_H
+#define C_MDHCONNECTIONMMONITOR_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <rconnmon.h>
+
+#include "mdhconnectionmonitorobserver.h"
+
+// CONSTANTS
+// none
+
+// MACROS
+// none
+
+// DATA TYPES
+// none
+
+// FUNCTION PROTOTYPES
+// none
+
+// FORWARD DECLARATIONS
+// none
+
+// CLASS DECLARATION
+
+/**
+* CMdHConnectionMonitor provides connection monitor for 
+* Metadata harvester.
+*
+* @lib mdhserver.exe
+* @since S60 3.1
+*/
+class CMdHConnectionMonitor :  public CBase,
+                               public MConnectionMonitorObserver
+    {
+    
+public:  // Constructors and destructor
+    
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CMdHConnectionMonitor* NewL(
+        MMdHConnectionMonitorObserver& aObserver, TInt aAccessPoint );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMdHConnectionMonitor();
+
+
+protected: // From MConnectionMonitorObserver
+
+    /**
+     * Catches the Connection monitor events 
+     * @since S60 3.1
+     * @param aConnMonEvent event
+     * @return none
+     */
+    void EventL( const CConnMonEventBase& aConnMonEvent ) ;
+
+        
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMdHConnectionMonitor( MMdHConnectionMonitorObserver& aObserver,
+        TInt aAccessPoint );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+
+private:    // Data
+
+    // Connection monitor server
+    RConnectionMonitor              iConnectionMonitor;
+
+    // Connection id
+    TInt                            iConnectionId;
+
+    // Callback pointer
+    // not owned
+    MMdHConnectionMonitorObserver& iObserver;
+
+    // Accesspoint to be observed
+    TInt                            iAccessPoint;
+
+    };
+
+#endif // C_MDHCONNECTIONMMONITOR_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/server/mdhconnectionmonitorobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      MdH Connection monitor observer interface class declaration.
+*
+*/
+
+
+
+
+
+
+#ifndef M_MDHCONNECTIONMONITOROBSERVER_H
+#define M_MDHCONNECTIONMONITOROBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+/**
+ * MMdHConnectionMonitorObserver is an interface for Connection Monitor.
+ *
+ * @lib mdhserver.exe
+ * @since S60 3.1
+ */
+class MMdHConnectionMonitorObserver
+    {
+public:
+    
+    /**
+     * This function will be called when WLan connection is lost for mdh 
+     *
+     * @since S60 3.1
+     */    
+    virtual void ConnectionLost() = 0;
+    };
+
+#endif // M_MDHCONNECTIONMONITOROBSERVER_H
+     
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/server/mdhmediaservercontainer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,466 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester's media server container header
+*
+*/
+
+
+
+
+
+
+
+#ifndef CMMDHMEDIASERVERCONTAINER_H
+#define CMMDHMEDIASERVERCONTAINER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <upnpavcontrolpoint.h>
+
+#include "mdhconnectionmonitorobserver.h"
+#include "mdhavcpadapter.h"
+#include "cmcommon.h"
+
+//  CONSTANTS
+
+_LIT8( KRootContainerId, "0" );
+    
+_LIT8( KSearchCriteria, 
+    "upnp:class derivedfrom &quot;object.item&quot; and @refID exists false");
+    
+_LIT8( KSearchFilter,    "*" );
+_LIT8( KMdhSearchFilter, "dc:title,dc:date,upnp:class,"
+    "upnp:album,upnp:artist,upnp:genre,res,upnp:albumArtURI,"
+    "res@size,res@duration,@restricted,res@resolution,"
+    "res@bitrate" );
+    
+_LIT8( KSortCriteria,    "" );
+
+
+// FORWARD DECLARATIONS
+class CMdHConnectionMonitor;
+class CCmMdhMetadataCollector; 
+class CCmMdhServer;
+class CCmDmMain;
+class CCmSettingsEngine;
+class CCmMediaServerFull;
+class CCmSearchResponseHash;
+class MCmSettings;
+
+// DATA TYPES
+
+enum TCmMdhMediaserverState
+    {
+    ECmMdhMediaserverSynchronized = 1,
+    ECmMdhMediaserverNotSynchronized,
+    ECmMdhMediaserverNoSearchCaps
+    };
+
+// CLASS DECLARATION
+/**
+*  CCmMdhMediaserverInfo
+*  Encapsulates server information
+*
+*  @since S60 3.1
+*/
+
+class CCmMdhMediaserverInfo : public CBase
+    {
+    public:
+    
+        /**
+         * Creates new CCmMdhMediaserverInfo class
+         * @return  pointer to CCmSmItemInfo class
+         */    
+        static CCmMdhMediaserverInfo* NewL();
+        
+        /**
+         * Creates new CCmMdhMediaserverInfo class
+         * @return  pointer to CCmSmItemInfo class
+         */           
+        static CCmMdhMediaserverInfo* NewLC();
+        
+        /**
+         * Destructor
+         */           
+        ~CCmMdhMediaserverInfo();
+        
+    private:
+    
+        /**
+         * Default constructor
+         */              
+        CCmMdhMediaserverInfo();
+        
+        /**
+         * ConstructL
+         */         
+        void ConstructL();
+    
+    public:
+        
+        /** Media server identifier */
+        HBufC8* iUuid;
+        
+        /** State of media server */
+        TCmMdhMediaserverState iMediaserverState;
+        
+        /** media server's Systemupdate id */
+        TInt iSystemUpdateId;    
+    }; 
+   
+   
+// CLASS DECLARATION
+
+/**
+*  CCmMdhMediaserverContainer
+*  This is a class for metadata harvester server's
+*  media server container component
+*
+*  @since S60 3.1
+*/
+class CCmMdhMediaserverContainer : public CCmMdhAvControlPointAdapter,
+                                   public MMdHConnectionMonitorObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCmMdhMediaserverContainer* NewL( CCmMdhServer& aMdhServer );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCmMdhMediaserverContainer();
+        
+    public: // Functions from base classes
+
+        /**
+        * Handles UPnP device discoveries.
+        * @param aDevice Device that is discovered.
+        */
+        void DeviceDiscoveredL( CUpnpDevice* aDevice );
+
+        /**
+        * Handles UPnP device disappears.
+        * @param aDevice Device that disappeared.
+        */
+        void DeviceDisappearedL( CUpnpDevice* aDevice );   
+        
+        /**
+        * Observer callback for Content Directory Search function.
+        * @since Series 60 2.0
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aContainerId
+        * @param aSearchCriteria
+        * @param aFilter
+        * @param aIndex
+        * @param arequest
+        * @param aSortCriteria
+        * @param aResult
+        * @param aReturned
+        * @param aMatches
+        * @param aUpdateID
+        */
+        void CdsSearchResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aContainerId,
+            const TDesC8& aSearchCriteria,
+            const TDesC8& aFilter,
+            TInt aIndex,
+            TInt aRequest,
+            const TDesC8& aSortCriteria,
+            const TDesC8& aResult,
+            TInt aReturned,
+            TInt aMatches,
+            const TDesC8& aUpdateID );     
+        
+        /**
+        * Observer callback for Content Directory 
+        * GetSearchCapabilities function.
+        * @since Series 60 2.0
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSearchCaps
+        */
+        void CdsSearchCapabilitiesResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aSearchCaps );
+            
+        /**
+        * Observer callback for Content Directory 
+        * GetSystemUpdateID function.
+        * @since Series 60 2.0
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aSystemUpdateId
+        */
+        void CdsSystemUpdateIdResponse(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            TInt aSystemUpdateId );
+        
+    
+    public: // From MUPnPConnectionMonitorObserver
+    
+         /**
+         * This function will be called when WLan connection is lost
+         * for UPnP 
+         *
+         * @since S60 3.1
+         */ 
+         virtual void ConnectionLost();
+    
+             
+    public: // New functions
+    
+        /**
+        * Searchs for media servers
+        * @since Series 60 2.0
+        */
+        void SearchMediaserversL();
+        
+        /**
+        * Harvests media servers
+        * @since Series 60 2.0
+        */
+        void HarvestMediaserversL();
+        
+        /**
+        * Static timer callback function
+        * @since Series 60 2.0
+        * @param aNy media server container instance
+        */
+        static TInt SearchTimerCompletedL( TAny* aNy );
+        
+        /**
+        * Timer callback function
+        * @since Series 60 2.0
+        */
+        TInt DoSearchTimerCompletedL();
+        
+        /**
+        * Harvest completion callback function
+        * @param aErr error code
+        * @since Series 60 2.0
+        */
+        void HarvestCompleteL( TInt aErr );
+        
+        /**
+        * Cancels harvest
+        * @since Series 60 2.0
+        */
+        void CancelSearchL();
+        
+        /**
+        * Cancels search
+        * @since Series 60 2.0
+        */
+        void CancelHarvestL();
+        
+        /**
+        * Gets media server id from database
+        * @since Series 60 2.0
+        * @param aSearchCaps
+        * @return media server id
+        */
+        TInt IdForMediaServerL( TDesC8& aUuid );
+        
+        /**
+        * Sends progress info
+        * @since Series 60 2.0
+        * @param aProgress progressed item count
+        */
+        void SendProgressInfo( TInt aProgress );
+
+        /**
+        * Add hash for search response
+        * @since S60 3.2
+        * @param aMediaServerId, media server id
+        * @param aSearchIndex, search index
+        * @param aItemCount, item count
+        * @param aHash, hash code
+        * @return error code
+        */        
+        TInt AddHashValueForResponseL( TInt aMediaServerId, 
+                                       TInt aSearchIndex, 
+                                       TInt aItemCount, 
+                                       const TDesC8& aHash ); 
+
+        /**
+        * Retrieves hash codes for defined media server
+        * @since S60 3.2
+        * @param aMediaServerId, media server id
+        * @param aHashValues, hash codes
+        * @return None
+        */                                     
+        void HashValuesForMediaServerL( TInt aMediaServerId,
+            RPointerArray<CCmSearchResponseHash>& aHashValues );
+
+        /**
+        * Deletes hash values
+        * @since S60 3.2
+        * @param aMediaServerId, media server id
+        * @param aSearchIndex, search index
+        * @return None
+        */
+        void DeleteOldHashValuesL( const TInt aMediaserverId,
+            const TInt aSearchIndex );                        
+  
+    private:
+
+       /**
+        * Constructor.
+        */
+        CCmMdhMediaserverContainer(CCmMdhServer& aMdhServer);
+         
+       /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Harvest a media server
+        * @since Series 60 2.0
+        * @param aMediaServerIndex media server array index
+        */
+        void DoHarvestMediaserverL( TInt aMediaserverIndex );
+        
+        
+        /**
+        * Adds a media server to database if it doesn't exist there
+        * @since Series 60 2.0
+        * @param aMediaServe media server device object
+        * @return whether server is active or not (new servers are not active)
+        */
+        TBool AddToDbIfNewL( CUpnpDevice& aMediaserver );
+        
+        /**
+        * Decreases pending responses counter and finishes search if ready
+        * @since Series 60 2.0
+        */
+        void DecResponsesAndFinishIfReadyL();
+        
+        /**
+        * Leaving version of method CdsSystemUpdateIdResponse.
+        * @since Series 60 3.1
+        * @param aErr UPnP error code.
+        * @param aSystemUpdateId
+        */
+        void CdsSystemUpdateIdResponseL(
+            const TDesC8& aUuid,
+            TInt aErr,
+            TInt aSystemUpdateId );
+
+        /**
+        * Leaving version of GetSearchCapabilities function.
+        * @since Series 60 3.1
+        * @param aUuid Source device UUID. 
+        * @param aErr UPnP error code.
+        * @param aSearchCaps
+        */
+        void CdsSearchCapabilitiesResponseL(
+            const TDesC8& aUuid,
+            TInt aErr,
+            const TDesC8& aSearchCaps );
+            
+        /**
+        * Leaving version of CdsSearchResponseL function.
+        * @since Series 60 3.1
+        * @param aUuid Source device UUID. 
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aContainerId
+        * @param aSearchCriteria
+        * @param aFilter
+        * @param aIndex
+        * @param arequest
+        * @param aSortCriteria
+        * @param aResult
+        * @param aReturned
+        * @param aMatches
+        * @param aUpdateID
+        */
+        void CdsSearchResponseL(
+            const TDesC8& aUuid,
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aResult,
+            TInt aReturned,
+            TInt aMatches );  
+            
+    private:    // Data
+    
+        // metadata collector container
+        CCmMdhMetadataCollector* iMetadataCollector;    // owned
+        
+        // av control point
+        CUpnpAVControlPoint* iAvControlPoint;           // owned
+        
+        // databse manager
+        CCmDmMain* iDbManager;                          // owned
+        
+        // reference to host server
+        CCmMdhServer& iMdhServer;
+        
+        // Settings engine
+        MCmSettings*        iSettings;                  // owned
+        
+        // Connection monitor
+        CMdHConnectionMonitor* iMdHConMon;              // owned
+        
+        // timer 
+        CPeriodic* iTimer;                              // owned
+        
+        // array for media server information
+        RPointerArray<CCmMdhMediaserverInfo> iMediaservers; // items owned
+        
+        // array of old media servers
+        RPointerArray<CCmMediaServerFull> iOldMediaServers; // items owned
+        
+        TCmProgressInfo iProgressInfo;
+        
+        // index for storing which media server we are harvesting
+        TInt iMediaserverIndex;
+        
+        TInt iResponsesPending;
+        
+        TInt iTotalItemCount;
+ 
+        // The IAP that is used
+        TInt iIap;
+        
+        TBool iHarvestErrCode;
+        
+        TBool iHarvestActive;
+        
+        TBool iAllFound;
+        
+        //index of havest item which has been sent to property
+        TInt iPropertyItemIndex;
+   
+    };
+
+#endif      // CMMDHMEDIASERVERCONTAINER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/server/mdhmetadatacollector.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester's metadata collector header
+*
+*/
+
+
+
+
+
+
+
+#ifndef CMMDHMETADATACOLLECTOR_H
+#define CMMDHMETADATACOLLECTOR_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "cdssync.h"
+
+// FORWARD DECLARATIONS
+class CCmMdhMediaserverContainer;
+class CUpnpAVControlPoint;
+class CSHA1;
+class CCmSearchResponseHash;
+
+// DATA TYPES
+   
+// CLASS DECLARATION
+
+/**
+*  CCmMdhMetadataCollector
+*  This is a class for metadata harvester server's
+*  metadata collector component
+*
+*  @since Series 60 3.0
+*/
+class CCmMdhMetadataCollector: public CBase, public MCdsSyncObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCmMdhMetadataCollector* NewL( 
+            CCmMdhMediaserverContainer& aMediaserverContainer,
+            CUpnpAVControlPoint& aControlPoint,
+            TInt aSearchChunkSize, 
+            TInt aAddGranularity);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCmMdhMetadataCollector();
+        
+    public: // New functions
+    
+        /**
+        * Observer callback for Content Directory Search function.
+        * @since Series 60 2.0
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aResult
+        * @param aReturned
+        * @param aMatches
+        */
+        void CCmMdhMetadataCollector::CdsSearchResponse(
+            TInt aSessionId,
+            TInt aErr,
+            const TDesC8& aResult,
+            TInt aReturned,
+            TInt aMatches);
+        
+        /**
+        * Harvests a media server
+        * @since Series 60 2.0
+        * @param aUuid uuid
+        */
+        void HarvestMediaserverL( TDesC8& aUuid );
+        
+        /**
+        * Cancels harvest
+        * @since Series 60 2.0
+        * @param aUuid uuid
+        */
+        void CancelHarvest();
+        
+        /**
+        * Static timer callback function
+        * @since Series 60 2.0
+        * @param aNy instance of this class
+        */
+        static TInt TimeoutTimerCompletedL( TAny* aNy );
+        
+        
+        /**
+        * Timer callback function
+        * @since Series 60 2.0
+        */
+        TInt DoTimeoutTimerCompletedL();
+        
+
+    public: // MCdsSyncObserver functions 
+           
+        /**
+        * Send progress data
+        * @since S60 3.1
+        * @param aItemCount progressed items count
+        */
+        void ProgressL( TInt aItemCount );
+        
+        /**
+        * Notification of processed chunk
+        * @since S60 3.1
+        */
+        void ChunkCompleteL();        
+        
+        /**
+        * Cds Sync completion callback function
+        * @since S60 3.1
+        */
+        void SyncCompleteL();
+        
+        /**
+        * Cds Sync error callback function
+        * @since S60 3.1
+        * @param aError error code
+        */
+        void SyncErrorL( TInt aError );
+    
+    private:
+
+       /**
+        * Constructor.
+        */
+        CCmMdhMetadataCollector(
+            CCmMdhMediaserverContainer& aMediaserverContainer,
+            CUpnpAVControlPoint& aAvControlPoint,
+            TInt aSearchChunkSize,
+            TInt aAddGranularity);
+         
+       /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Harvests a media server
+        * @since Series 60 2.0
+        */
+        void DoHarvestMediaserverL();
+        
+        /**
+        * Handles Content Directory search response processing.
+        * @since Series 60 3.1
+        * @param aSessionId 
+        * @param aErr UPnP error code.
+        * @param aResult
+        * @param aReturned
+        * @param aMatches
+        */
+        void HandleSearchResponseL( TInt aSessionId, 
+                                    TInt aErr, 
+                                    const TDesC8& aResult, 
+                                    TInt aReturned, 
+                                    TInt aMatches );
+    private:    // Data
+    
+        // Cds synchronizer (owned)
+        CCdsSync* iCdsSync;
+    
+        RPointerArray<HBufC8> iSourceDataArray; // elements owned
+        
+        // reference to mediaserver container 
+        CCmMdhMediaserverContainer& iMediaserverContainer;
+        
+        // reference to av control point
+        CUpnpAVControlPoint& iAvControlPoint;
+        
+        // timeout timer 
+        CPeriodic* iTimer; // owned
+        
+        TInt    iSearchIndex;
+        TInt    iSearchRetryCount;
+        TInt    iSearchChunkSize;
+        TInt    iAddGranularity;
+        TInt    iSessionId;
+        TInt    iItemsToParse;
+        TBool   iResultIncomplete;
+        TBool   iCanceled;
+        TBool   iInit;
+        
+        HBufC8* iUuid;       // owned
+        HBufC8* iXmlToParse; // owned
+        
+        TInt    iMediaServerId;
+        
+#ifdef _DEBUG
+        TTime   iDebugTime;
+#endif // _DEBUG
+
+
+        CSHA1*              iHashGenerator;
+        
+        RPointerArray<CCmSearchResponseHash> iHashValues;
+        
+        TInt                iTempStartIndex;
+                
+    };
+
+#endif      // CMMDHMETADATACOLLECTOR_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/server/mdhserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester server executable header file
+*
+*/
+
+
+
+
+
+
+
+#ifndef MDHSERVER_H
+#define MDHSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+#include "mdhmediaservercontainer.h"
+
+// ---------------------------------------------------------------
+// Server's policy
+// ---------------------------------------------------------------
+
+//Total number of ranges
+const TUint KCmMdhServerRangeCount = 2;
+
+//Definition of the ranges of IPC numbers
+const TInt KCmMdhServerRanges[KCmMdhServerRangeCount] = 
+        {
+        0,
+        3
+        };
+
+//Policy to implement for each of the above ranges        
+const TUint8 KCmMdhServerElementsIndex[KCmMdhServerRangeCount] = 
+        {
+        1, //applies to 1st range
+        CPolicyServer::ENotSupported
+        };
+
+//Specific capability checks
+const CPolicyServer::TPolicyElement KCmMdhServerElements[] = 
+        {
+        {_INIT_SECURITY_POLICY_C3(ECapabilityNetworkServices,
+            ECapabilityReadUserData, ECapabilityWriteUserData ),
+            CPolicyServer::EFailClient },
+        {_INIT_SECURITY_POLICY_C1(ECapabilityNetworkServices),
+            CPolicyServer::EFailClient}
+        };
+
+//Package all the above together into a policy
+const CPolicyServer::TPolicy KCmMdhServerPolicy =
+        {
+        //specifies all connect attempts should pass
+        CPolicyServer::EAlwaysPass, 
+        KCmMdhServerRangeCount,
+        KCmMdhServerRanges,
+        KCmMdhServerElementsIndex,
+        KCmMdhServerElements
+        };
+
+
+// DATA TYPES
+
+enum TCmMdhServerState
+        {
+        ECmMdhServerStateIdle = 0,
+        ECmMdhServerStateSearching,
+        ECmMdhServerStateHarvesting
+        };
+
+// FORWARD DECLARATIONS
+
+// FUNCTION PROTOTYPES
+
+// Method to panic server in case of serious error
+void PanicServer( TInt aPanic );
+// Method to panic client if e.g. message is malformed
+void PanicClient( const RMessage2& aMessage, TInt aPanic );
+
+
+// CLASS DECLARATION
+
+/**
+*  Dummy Server Core class
+*
+*  @lib CmMdhServer
+*  @since Series 60 3.1
+*/
+class CCmMdhServer : public CPolicyServer
+    {
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCmMdhServer* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCmMdhServer();
+
+    public: // New functions
+    
+        /**
+        * Sets server's state
+        * @since S60 3.1 
+        * @param aServerState, server state
+        * @param aErrCode error code.
+        */
+        void SetServerStateL( TCmMdhServerState aServerState, 
+                              TInt aErrCode = KErrNone );
+
+        /**
+        * Decrement server sessions
+        * @since S60 3.1 
+        */        
+        void DecrementSessions();
+
+        /**
+        * Returns server's current state
+        * @since S60 3.1
+        * @return server state
+        */         
+        TCmMdhServerState ServerState();
+ 
+         /**
+        * Set current asyncronous message
+        * @since S60 3.1
+        * @param aMessage, message
+        */        
+        void SetCurrentAsyncMsg( const RMessage2& aMessage );
+    
+         /**
+        * Creates media server container instance
+        * @since S60 3.1
+        */         
+        void CreateMediaserverContainerL();
+        
+         /**
+        * Destroys media server container instance
+        * @since S60 3.1
+        */        
+        void DestroyMediaserverContainer();   
+                
+         /**
+        * Returns media server container reference
+        * @since S60 3.1
+        * @return media server container
+        */        
+        CCmMdhMediaserverContainer& MediaserverContainer();
+    
+        /**
+        * Increments sessions
+        * @since S60 3.1
+        */ 
+        void IncrementSessions();             
+    
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CCmMdhServer();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Functions from base classes
+        
+        CSession2* NewSessionL( const TVersion& aVersion,
+                                const RMessage2& aMessage ) const;
+    
+
+    private:    // Data
+        
+        /** Current asyncronous message */
+        RMessage2                   iCurrentAsyncMsg;
+        
+        /** Media server container ( owned ) */
+        CCmMdhMediaserverContainer* iMediaserverContainer; 
+        
+        /** Server state */
+        TCmMdhServerState           iServerState;
+        
+        /** Count of sessions */
+        TInt                       iSessionCount;
+        
+    };
+
+
+#endif // MDHSERVER_H
+           
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/inc/server/mdhserversession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester server session header
+*
+*/
+
+
+
+
+
+
+
+#ifndef CMMDHSERVERSESSION_H
+#define CMMDHSERVERSESSION_H
+
+//  INCLUDES
+#include <e32std.h>
+//include "mdhmediaservercontainer.h"
+
+// FORWARD DECLARATIONS
+
+class CCmMdhMediaserverContainer;
+class CCmMdhServer;
+
+// CLASS DECLARATION
+
+/**
+*  CCmMdhSession
+*  This is a class for metadata harvester server main session
+*
+*  @lib -
+*  @since Series 60 3.0
+*/
+class CCmMdhSession : public CSession2
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCmMdhSession* NewL( 
+            CCmMdhMediaserverContainer* aMediaserverContainer, 
+            CCmMdhServer& aServer );
+        
+        /**
+        * Destructor.
+        */
+        ~CCmMdhSession();
+        
+    public: // Functions from base classes
+
+        /**
+        * ServiceL from base class CSession2.
+        * @since Series 60 3.0
+        * @param aMessage Message for Metadata Harvester
+        * @return void
+        */
+        void ServiceL( const RMessage2 &aMessage );
+        
+    public: // New functions
+    
+    private:
+
+       /**
+        * Constructor.
+        */
+        CCmMdhSession( CCmMdhMediaserverContainer* aMediaserverContainer, 
+            CCmMdhServer& aServer );
+         
+       /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Server returns the server reference.
+        * @since Series 60 3.1
+        * @param void
+        * @return Metadata harvester server reference
+        */      
+        CCmMdhServer& Server();
+
+        /**
+        * Completes message with busy error code if server is busy
+        * @since Series 60 3.1
+        * @param aMessage message
+        * @return ETrue if completed
+        */      
+        TBool CompleteIfBusy( const RMessage2& aMessage );
+        
+
+    private:    // Data
+    
+        // media server container pointer (not owned)
+        CCmMdhMediaserverContainer* iMediaserverContainer;
+                
+        // Server
+        CCmMdhServer& iServer;        
+   
+    };
+
+#endif      // CMMDHSERVERSESSION_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/client/mdhclient.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester server's client
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include    "mdhclient.h"
+#include    "cmserviceobserver.h"
+#include    "msdebug.h"
+
+// ---------------------------------------------------------------------------
+// Two-phase API constructor
+// ---------------------------------------------------------------------------
+// 
+CCmMdhClient* CCmMdhClient::NewL( MCmServiceObserver& aServer )
+    {
+    CCmMdhClient* self = CCmMdhClient::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;   
+    }
+    
+// ---------------------------------------------------------------------------
+// Two-phase API constructor
+// ---------------------------------------------------------------------------
+// 
+CCmMdhClient* CCmMdhClient::NewLC( MCmServiceObserver& aServer )
+    {    
+    CCmMdhClient* self = new ( ELeave ) CCmMdhClient( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;      
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCmMdhClient::~CCmMdhClient()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhClient::~CCmMdhClient\n"));
+    Cancel();
+    iMdhSession.Close();
+    LOG(_L("[CmMdh Server]\t CCmMdhClient::~CCmMdhClient end\n"));
+    }
+        
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CCmMdhClient::CCmMdhClient( MCmServiceObserver& aServer ) : 
+    CActive( EPriorityStandard ),
+    iServer( aServer ), iState( ECmMdhClientIdle )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhClient::CCmMdhClient\n"));
+    CActiveScheduler::Add( this ); 
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmMdhClient::ConstructL( )
+    {        
+    }
+
+// ---------------------------------------------------------------------------
+// Harvest
+// ---------------------------------------------------------------------------
+//
+TInt CCmMdhClient::Harvest()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhClient::Harvest\n"));
+    
+    if ( IsActive() )
+        {
+        return KErrNotReady; 
+        }
+    
+    TInt errCode = iMdhSession.Connect();
+    if (errCode != KErrNone)
+        {
+        return errCode;
+        }
+    iMdhSession.SearchMediaservers( iStatus );
+    SetActive();
+    iState = ECmMdhClientSearching;
+    return KErrNone;
+    }
+    
+// ---------------------------------------------------------------------------
+// Stop
+// ---------------------------------------------------------------------------
+//
+void CCmMdhClient::Stop()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhClient::Stop\n"));
+	Cancel();
+    }	
+	
+// ---------------------------------------------------------------------------
+// Close
+// ---------------------------------------------------------------------------
+//
+void CCmMdhClient::Close()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhClient::Close\n"));
+	delete this;
+    }	
+	
+// ---------------------------------------------------------------------------
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCmMdhClient::DoCancel()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhClient::DoCancel\n"));
+    iMdhSession.Cancel();
+    iMdhSession.Close();
+    iState = ECmMdhClientIdle;
+    iServer.ServiceExecuted( ECmServiceHarvest, KErrCancel );
+    LOG(_L("[CmMdh Server]\t CCmMdhClient::DoCancel end\n"));
+    }
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CCmMdhClient::RunL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhClient::RunL\n"));
+    if ( iState == ECmMdhClientSearching && 
+         iStatus == KErrNone )
+        {
+        iMdhSession.Harvest( iStatus );
+        SetActive();
+        iState = ECmMdhClientHarvesting;
+        }
+    else // iState == ECmMdhClientHarvesting or error in search
+        {
+        iMdhSession.Close();
+        iState = ECmMdhClientIdle;
+        iServer.ServiceExecuted ( ECmServiceHarvest, iStatus.Int() );
+        }
+    }
+
+// End of file
+
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/client/mdhclientfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      The factory for MdHClient
+*
+*/
+
+
+
+
+
+
+#include "mdhclientfactory.h"
+#include "mmdhclient.h"
+#include "mdhclient.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+EXPORT_C MCmMdhClient* CCmMdhClientFactory::NewCmMdhClientL( MCmServiceObserver& aServer )
+    {
+    return CCmMdhClient::NewL( aServer );
+    }
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//    
+EXPORT_C MCmMdhClient* CCmMdhClientFactory::NewCmMdhClientLC( MCmServiceObserver& aServer )
+    {
+    return CCmMdhClient::NewLC( aServer );
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/client/mdhclientsession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester server's client
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include    "mdhclientsession.h"
+#include    "mdhcommon.h"
+#include    "msdebug.h"
+
+
+// CONSTANTS
+// Number of retries to start server
+const TInt KServerRetries = 2;
+
+// =========================== LOCAL FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// StartServer
+// Starts the CM Metadata Harvester server.
+// Returns: TInt error: Error status of the CM Metadata Harvester startup.
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+// StartServer
+// Creates a new process for the server and starts it up.
+// ---------------------------------------------------------------------------
+//
+static TInt StartServer()
+    {
+    LOG(_L("[CmMdh Server]\t StartServer\n"));
+    
+    TInt result( KErrNone );
+    // create server - if one of this name does not already exist
+    TFindServer findServer( KCmMdhServerName );
+    TFullName name;
+    if ( findServer.Next( name ) != KErrNone ) // we don't exist already
+        {
+        
+        TRequestStatus status( KRequestPending );
+        RProcess server;
+        // Create the server process
+        result = server.Create( KCmMdhServerExe, KNullDesC );       
+        if( result != KErrNone )
+            {
+            return result;
+            }
+    
+        // Process created successfully
+        server.Resume(); // start it going
+        server.Rendezvous( status );
+        
+        // Wait until the completion of the server creation
+        // server signals us when it's up
+        User::WaitForRequest( status );
+        
+        
+        if( status != KErrNone )
+            {
+            server.Close();
+            return status.Int();
+            }
+            
+        
+        // Server created successfully
+        server.Close(); // we can close the handle to server process now
+        }
+    return result;
+    }
+
+
+// ========================== MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// RCmMdhSession::RCmMdhSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+RCmMdhSession::RCmMdhSession()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// RCmMdhSession::Connect
+// Starts and creates a session of CM Metadata Harvester 
+// ---------------------------------------------------------------------------
+//
+TInt RCmMdhSession::Connect()
+    {
+    TInt tryLoop = 0;
+    TInt errCode = 0;
+
+    for ( tryLoop = 0; tryLoop < KServerRetries; tryLoop++ )
+        {
+        errCode = CreateSession(KCmMdhServerName, 
+            TVersion( KCmMdhServerMajor, KCmMdhServerMinor, 
+                    KCmMdhServerBuild ) );
+        //gives MessageSlots of -1
+        //this uses global pool rather than local pool
+
+        TRACE(Print(_L("[CmMdh Server]\t RCmMdhSession::Connect New Session \
+                            created with status %d\n"), errCode));
+        if( errCode == KErrNotSupported )
+            {
+            TRACE(Print(_L("[CmMdh Server]\t Version not supported!\n") ));
+            return errCode;            
+            }
+        if ( errCode != KErrNotFound &&  errCode != KErrServerTerminated )
+            {
+            return errCode;
+            }
+
+        errCode = StartServer();
+
+        if ( errCode != KErrNone && errCode != KErrAlreadyExists )
+            {
+            return errCode;
+            }
+            
+        }
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// RCmMdhSession::SearchMediaServers
+// Searchs for neighborhood media servers
+// ---------------------------------------------------------------------------
+//
+void RCmMdhSession::SearchMediaservers( TRequestStatus& aStatus )
+    {
+    LOG(_L("[CmMdh Server]\t RCmMdhSession::SearchMediaservers\n"));
+    
+    SendReceive(ECmMdhSearchMediaservers, TIpcArgs(), aStatus);
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// RCmMdhSession::Harvest
+// Harvests and synchronizes metadata from found mediaservers
+// ---------------------------------------------------------------------------
+//
+void RCmMdhSession::Harvest( TRequestStatus& aStatus )
+    {
+    LOG(_L("[CmMdh Server]\t RCmMdhSession::SearchMediaServers\n"));
+    
+    SendReceive(ECmMdhHarvest, TIpcArgs(), aStatus);
+    }
+
+// ---------------------------------------------------------------------------
+// RCmMdhSession::Cancel
+// ---------------------------------------------------------------------------
+//
+void RCmMdhSession::Cancel()
+    {
+    LOG(_L("[CmMdh Server]\t RCmMdhSession::Cancel\n"));
+    
+    SendReceive(ECmMdhCancel, TIpcArgs());
+    }
+
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/server/mdhavcpadapter.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,669 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      AvControlPoint adapter helper class implementation
+*
+*/
+
+
+
+
+
+
+#include "mdhavcpadapter.h"
+
+// ---------------------------------------------------------------------------
+// Two-phase API constructor
+// ---------------------------------------------------------------------------
+// 
+CCmMdhAvControlPointAdapter* CCmMdhAvControlPointAdapter::NewL()
+    {
+    CCmMdhAvControlPointAdapter* self = 
+        CCmMdhAvControlPointAdapter::NewLC( );
+    CleanupStack::Pop( self );
+    return self;      
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phase API constructor
+// ---------------------------------------------------------------------------
+//     
+CCmMdhAvControlPointAdapter* CCmMdhAvControlPointAdapter::NewLC()
+    {
+    CCmMdhAvControlPointAdapter* self = 
+        new ( ELeave ) CCmMdhAvControlPointAdapter( );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;        
+    }
+   
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//     
+CCmMdhAvControlPointAdapter::~CCmMdhAvControlPointAdapter()
+    {
+    
+    }
+  
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//    
+CCmMdhAvControlPointAdapter::CCmMdhAvControlPointAdapter()
+    {
+    
+    }   
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//         
+void CCmMdhAvControlPointAdapter::ConstructL()
+    {
+    
+    }  
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//          
+void CCmMdhAvControlPointAdapter::RcSetVolumeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& /*aDesiredVolume*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::RcVolumeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& /*aCurrentVolume*/) { /*nothing*/ } 
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::RcSetMuteResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& /*aDesiredMute*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::RcMuteResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/, 
+    const TDesC8& /*aInstance*/, 
+    const TDesC8& /*aChannel*/, 
+    const TDesC8& /*aCurrentMute*/) { /*nothing*/ } 
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtSetTransportUriResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aCurrentUri*/,
+    const TDesC8& /*aCurrentUriMetaData*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtSetNextTransportUriResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNextUri*/,
+    const TDesC8& /*aNextUriMetaData*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtMediaInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNrTracks*/,
+    const TDesC8& /*aMediaDuration*/,
+    const TDesC8& /*aCurrentUri*/,
+    const TDesC8& /*aCurrentUriMetaData*/,
+    const TDesC8& /*aNextUri*/,
+    const TDesC8& /*aNextUriMetaData*/,
+    const TDesC8& /*aPlayMedium*/,
+    const TDesC8& /*aRecordMedium*/,
+    const TDesC8& /*aWriteStatus*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtGetTransportInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aCurrenTransportState*/,
+    const TDesC8& /*aCurrentTransportStatus*/,
+    const TDesC8& /*aCurrentSpeed*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtPositionInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aTrack*/,
+    const TDesC8& /*aTrackDuration*/,
+    const TDesC8& /*aTrackMetaData*/,
+    const TDesC8& /*aTrackURI*/,
+    const TDesC8& /*aRelTime*/,
+    const TDesC8& /*aAbsTime*/,
+    const TDesC8& /*aRelCount*/,
+    const TDesC8& /*aAbsCount*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtDeviceCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aPlayMedia*/,
+    const TDesC8& /*aRecMedia*/,
+    const TDesC8& /*aRecQualityMode*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtTransportSettingsResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aPlayMode*/,
+    const TDesC8& /*aRecQualityMode*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtStopResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtPlayResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aSpeed*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtPauseResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtRecordResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtSeekResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aUnit*/,
+    const TDesC8& /*aTarget*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtNextResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/) { /*nothing*/ }
+/**
+* Observer callback for rendering control AV Previous response.
+* @since Series 60 2.0
+* @param aUuid Source device UUID. 
+* @param aSessionId 
+* @param aErr UPnP error code.
+*/
+void CCmMdhAvControlPointAdapter::AvtPreviousResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtSetPlayModeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNewPlayMode*/) { /*nothing*/ }
+/**
+* Observer callback for rendering control AV set record qualityresponse.
+* @since Series 60 2.0
+* @param aUuid Source device UUID. 
+* @param aSessionId 
+* @param aErr UPnP error code.
+* @param aNewRecordQuality
+*/
+void CCmMdhAvControlPointAdapter::AvtSetRecordModeResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aNewRecordQuality*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtCurrentTransportActionsResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aInstanceId*/,
+    const TDesC8& /*aActions*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsSearchCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSearchCaps*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsSortCapabilitiesResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSortCaps*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsSystemUpdateIdResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*aSystemUpdateId*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsBrowseResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aObjectID*/,
+    const TDesC8& /* aBrowseFlag*/,
+    const TDesC8& /* aFilter*/,
+    TInt /*aIndex*/,
+    TInt /*aRequest*/,
+    const TDesC8& /* aSortCriteria*/,
+    const TDesC8& /* aResult*/,
+    TInt /*aReturned*/,
+    TInt /*aMatches*/,
+    const TDesC8& /* aUpdateID*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsSearchResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aContainerId*/,
+    const TDesC8& /*aSearchCriteria*/,
+    const TDesC8& /*aFilter*/,
+    TInt /*aIndex*/,
+    TInt /*aRequest*/,
+    const TDesC8& /*aSortCriteria*/,
+    const TDesC8& /*aResult*/,
+    TInt /*aReturned*/,
+    TInt /*aMatches*/,
+    const TDesC8& /*aUpdateID*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsDestroyObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aObjectId */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsUpdateObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aObjectId*/,
+    const TDesC8& /*aCurrentTagValue*/,
+    const TDesC8& /*aNewTagValue */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//       
+void CCmMdhAvControlPointAdapter::CdsImportResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSourceURI*/,
+    const TDesC8& /*aDestinationURI*/,
+    const TDesC8& /*aTransferId */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//       
+void CCmMdhAvControlPointAdapter::CdsExportResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSourceURI*/,
+    const TDesC8& /*aDestinationURI*/,
+    const TDesC8& /*aTransferId */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//        
+void CCmMdhAvControlPointAdapter::CdsStopTransferResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aTransferId */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//         
+void CCmMdhAvControlPointAdapter::CdsCTransferProgressResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aTransferId*/,
+    const TDesC8& /*aTransferStatus*/,
+    const TDesC8& /*aTransferLength*/,            
+    const TDesC8& /*aTransferTotal */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//  
+void CCmMdhAvControlPointAdapter::CdsDeleteResourceResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aResourceUri */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//  
+void CCmMdhAvControlPointAdapter::CdsCreateReferenceResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aContainerId*/, 
+    const TDesC8& /*aObjectId*/, 
+    const TDesC8& /*aNewId */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//  
+void CCmMdhAvControlPointAdapter::CdsCreateObjectResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aContainerID*/, 
+    const TDesC8& /*aElements*/, 
+    const TDesC8& /*aObjectID*/, 
+    const TDesC8& /*aResult */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//  
+void CCmMdhAvControlPointAdapter::CmProtocolInfoResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aSource*/, 
+    const TDesC8& /*aSink */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//         
+void CCmMdhAvControlPointAdapter::CmPrepareResponse(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aRemoteProtocolInfo*/,
+    const TDesC8& /*aPeerConnectionManager*/,
+    const TDesC8& /*aPeerConnectionId*/,
+    const TDesC8& /*aDirection*/,
+    TInt /*aConnection*/,
+    TInt /*aTransport*/,
+    TInt /*aRsc */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//          
+void CCmMdhAvControlPointAdapter::CmComplete(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*aConnection */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//          
+void CCmMdhAvControlPointAdapter::CmCurrentConnections(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    const TDesC8& /*aConnections*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+//    
+void CCmMdhAvControlPointAdapter::CmCurrentInfo(
+    const TDesC8& /*aUuid*/,
+    TInt /*aSessionId*/,
+    TInt /*aErr*/,
+    TInt /*rscId*/, 
+    TInt /*transportId*/, 
+    const TDesC8& /*aProtocolInfo*/,
+    const TDesC8& /*aPeerConnectionManager*/, 
+    TInt /*peerId*/, 
+    const TDesC8& /*aDirection*/, 
+    const TDesC8& /*aStatus */) { /*nothing*/ }
+
+//*****************************************************************
+//Functions for UPnP event handling
+//*****************************************************************
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsUpdateEvent(
+        const TDesC8& /*aUuid*/,
+        TInt /*aSystemUpdateId
+        */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsContainerEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aConteinerIds
+        */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CdsTransferEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aTransferIds
+        */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::RcLastChangeEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aLastChange
+        */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::AvtLastChangeEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aLastChange
+        */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CmSourceEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aSource
+        */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CmSinkEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aSink
+        */) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::CmConnectionsEvent(
+        const TDesC8& /*aUuid*/,
+        const TDesC8& /*aConnections
+        */) { /*nothing*/ }
+
+//*****************************************************************
+// Device and http functions.
+//*****************************************************************
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::HttpResponseL(
+    CUpnpHttpMessage* /*aMessage*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::DeviceDiscoveredL(
+    CUpnpDevice* /*aDevice*/) { /*nothing*/ }
+
+// ---------------------------------------------------------------------------
+// See upnpavcontrolpointobserver.h
+// ---------------------------------------------------------------------------
+// 
+void CCmMdhAvControlPointAdapter::DeviceDisappearedL(
+    CUpnpDevice* /*aDevice*/) { /*nothing*/ }
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/server/mdhconnectionmonitor.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      UPnP Connection Monitor class implementation.
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <nifvar.h>
+
+#include "mdhconnectionmonitor.h"
+
+// ========================== MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// CMdHConnectionMonitor::CMdHConnectionMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMdHConnectionMonitor::CMdHConnectionMonitor(
+    MMdHConnectionMonitorObserver& aObserver, TInt aAccessPoint ) :
+    iObserver( aObserver ),
+    iAccessPoint( aAccessPoint )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMdHConnectionMonitor::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMdHConnectionMonitor* CMdHConnectionMonitor::NewL(
+    MMdHConnectionMonitorObserver& aObserver, TInt aAccessPoint )
+    {
+    CMdHConnectionMonitor* self = new(ELeave) CMdHConnectionMonitor(
+        aObserver, aAccessPoint );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMdHConnectionMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMdHConnectionMonitor::ConstructL()
+    {    
+    iConnectionMonitor.ConnectL();
+
+    iConnectionMonitor.NotifyEventL( *this );
+
+    // Get the count of connections
+    TRequestStatus status = KRequestPending;
+    TUint connectionCount = 0;
+    iConnectionMonitor.GetConnectionCount(connectionCount, status);
+    User::WaitForRequest( status ); 
+    
+    // Go through available connections and check to see
+    // if connection with iAccessPoint IAP is already running
+    if( status == KErrNone )
+        {
+        for( TUint i=1; i < connectionCount+1;  i++ )
+            {
+            TUint connectionId;
+            TUint subConnectionCount;
+            TUint iapId = 0;
+
+            iConnectionMonitor.GetConnectionInfo( 
+                                            i,
+                                            connectionId, 
+                                            subConnectionCount);
+
+            TRequestStatus status = KRequestPending;
+
+            iConnectionMonitor.GetUintAttribute( 
+                                            connectionId, 
+                                            0, 
+                                            KIAPId, 
+                                            (TUint &) iapId,
+                                            status );
+            User::WaitForRequest( status ); 
+
+            // Save connectionId if same iap
+            if( status == KErrNone && iAccessPoint == iapId )
+                {
+                iConnectionId = connectionId;
+                }
+            }    
+        }    
+
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CMdHConnectionMonitor::~CMdHConnectionMonitor()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMdHConnectionMonitor::~CMdHConnectionMonitor()
+    {
+    iConnectionMonitor.CancelNotifications();
+
+    // Disconnect from CM server
+    iConnectionMonitor.Close();
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CMdHConnectionMonitor::EventL()
+// Connection monitor observer
+// ---------------------------------------------------------------------------
+//
+void CMdHConnectionMonitor::EventL( const CConnMonEventBase& aConnMonEvent )
+    {
+
+    TUint connectionId = 0;
+
+    switch ( aConnMonEvent.EventType() )
+        {
+        case EConnMonCreateConnection:
+            {
+            TUint iapId = 0;
+
+            const CConnMonCreateConnection* eventCreate; 
+            eventCreate = (const CConnMonCreateConnection*)&aConnMonEvent;
+            connectionId = eventCreate->ConnectionId();
+
+            TRequestStatus status = KRequestPending;
+
+            // Get IAP id
+            iConnectionMonitor.GetUintAttribute( 
+                                            eventCreate->ConnectionId(), 
+                                            0, 
+                                            KIAPId, 
+                                            iapId, 
+                                            status );
+            User::WaitForRequest( status ); 
+
+            // Save connectionId if same iap
+            if( iAccessPoint == iapId )
+                {
+                iConnectionId = connectionId;
+                }
+
+            break;
+            }
+
+        // Connection is deleted
+        case EConnMonDeleteConnection:
+            {
+            const CConnMonDeleteConnection* eventDelete; 
+            eventDelete = 
+                    ( const CConnMonDeleteConnection* ) &aConnMonEvent;
+            connectionId = eventDelete->ConnectionId();
+
+            // If connection id same as in createConnection
+            if( connectionId == iConnectionId )
+                {
+                // Callback function
+                iObserver.ConnectionLost();
+                }
+
+            break;
+            }
+         default:
+            {
+            break;
+            }
+        }
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/server/mdhmediaservercontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,967 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester server's mediaserver container component
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+#include    <e32property.h>
+#include    <f32file.h>
+
+#include    "cmsettingsfactory.h"
+#include    "cmsettings.h"
+#include    "cmdmmain.h"
+#include    "cmmediaserverfull.h"
+#include    "cmsearchresponsehash.h"
+#include    "cmsettings.h"
+#include    <upnpstring.h>
+#include    <upnperrors.h>
+#include    "mdhconnectionmonitor.h"
+#include    "mdhmediaservercontainer.h"
+#include    "mdhmetadatacollector.h"
+#include    "mdhserver.h"
+#include    "msdebug.h"
+
+
+// CONSTANTS
+#ifdef __SERIES60_31__
+_LIT8( KAVControlPointFriendlyName,  "AVDevice" );
+#endif //__SERIES60_31__
+_LIT8( KMediaServer,                 "MediaServer" );
+#ifdef _DEBUG
+_LIT8( KFriendlyNameTag,             "friendlyName" );
+#endif
+
+const TInt KDefaultCaculateSize = 100;
+const TInt KDefaultChunkSize = 150;
+const TInt KDefaultAddGranularity = 500;
+
+// amount of microseconds in one second
+const TInt KMicrosecondsInSecond = 1000000;
+// ---------------------------------------------------------------------------
+// Two-phase API constructor
+// ---------------------------------------------------------------------------
+// 
+CCmMdhMediaserverInfo* CCmMdhMediaserverInfo::NewL( )
+    {  
+    CCmMdhMediaserverInfo* self = CCmMdhMediaserverInfo::NewLC( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phase API constructor
+// ---------------------------------------------------------------------------
+//     
+CCmMdhMediaserverInfo* CCmMdhMediaserverInfo::NewLC()
+    {   
+    CCmMdhMediaserverInfo* self = new ( ELeave ) CCmMdhMediaserverInfo( );
+    CleanupStack::PushL( self );
+    self->ConstructL( );    
+    return self;  
+    }    
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+// 
+CCmMdhMediaserverInfo::~CCmMdhMediaserverInfo()
+    {
+    delete iUuid;
+    }
+    
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//            
+CCmMdhMediaserverInfo::CCmMdhMediaserverInfo( )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCmMdhMediaserverInfo::ConstructL( )
+    {
+                                  
+    } 
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+CCmMdhMediaserverContainer* CCmMdhMediaserverContainer::NewL(
+    CCmMdhServer& aMdhServer)
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::NewL"));
+
+    CCmMdhMediaserverContainer* self =
+        new (ELeave) CCmMdhMediaserverContainer(aMdhServer);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor.
+// ---------------------------------------------------------------------------
+CCmMdhMediaserverContainer::CCmMdhMediaserverContainer(
+    CCmMdhServer& aMdhServer)
+    :iMdhServer( aMdhServer )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             CCmMdhMediaserverContainer"));
+    iAvControlPoint = NULL;
+    iMetadataCollector = NULL;
+    iTimer = NULL;
+    iMediaserverIndex = 0;
+    iResponsesPending = 0;
+    iTotalItemCount = 0;
+    iHarvestErrCode = KErrNone;
+    iHarvestActive = EFalse;
+    iPropertyItemIndex = 0;
+    iProgressInfo.iService = ECmServiceHarvest;
+    }
+
+// ---------------------------------------------------------------------------
+// 2nd phase constructor.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::ConstructL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::ConstructL"));
+    iDbManager = CCmDmMain::NewL();
+    iSettings = CCmSettingsFactory::NewCmSettingsEngineL();
+    iSettings->GetIapL( iIap );
+    TRACE( Print( _L("[CmMdh Server]\t Monitoring iap %d"), iIap ));
+    iMdHConMon = CMdHConnectionMonitor::NewL( *this, iIap );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+CCmMdhMediaserverContainer::~CCmMdhMediaserverContainer()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             ~CCmMdhMediaserverContainer"));
+
+    TRACE( Print( _L("[CmMdh Server]\t deleting %d media servers"),
+        iMediaservers.Count()));
+
+    iMediaservers.ResetAndDestroy();
+    iOldMediaServers.ResetAndDestroy();
+
+    LOG(_L("[CmMdh Server]\t deleting settings engine.."));
+	if ( iSettings )
+	    {
+	    iSettings->Close();    
+	    }
+
+    LOG(_L("[CmMdh Server]\t deleting db manager.."));
+    if ( iDbManager )
+        {
+        delete iDbManager;    
+        }    
+
+    LOG(_L("[CmMdh Server]\t deleting metadata collector.."));
+    if ( iMetadataCollector )
+        {
+        delete iMetadataCollector;
+        }
+
+    LOG(_L("[CmMdh Server]\t deleting av control point.."));
+    if ( iAvControlPoint )
+        {
+        delete iAvControlPoint;    
+        }
+
+    LOG(_L("[CmMdh Server]\t deleting timer.."));
+    if ( iTimer )
+        {
+        delete iTimer;    
+        }
+    
+    LOG(_L("[CmMdh Server]\t deleting connection monitor.."));
+    if ( iMdHConMon )
+        {
+        delete iMdHConMon;    
+        }
+    
+    LOG(_L("[CmMdh Server]\t All deleted.."));
+    }
+        
+// ---------------------------------------------------------------------------
+// Harvest a media server
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::DoHarvestMediaserverL(
+    TInt aMediaserverIndex )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             DoHarvestMediaserverL"));
+    iMdhServer.SetServerStateL(ECmMdhServerStateHarvesting);
+    if ( iMediaservers[aMediaserverIndex]->iMediaserverState
+        == ECmMdhMediaserverNotSynchronized)
+        {
+        iMetadataCollector->HarvestMediaserverL(
+            *iMediaservers[aMediaserverIndex]->iUuid );
+        iHarvestActive = ETrue;
+        }
+    else
+        {
+        LOG(_L("[CmMdh Server]\t No search caps or \
+                                 no sync needed, skipping.."));
+        HarvestCompleteL( KErrNone );
+        }
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             DoHarvestMediaserverL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// Adds a media server to database if it doesn't exist there
+// ---------------------------------------------------------------------------
+TBool CCmMdhMediaserverContainer::AddToDbIfNewL( CUpnpDevice& aMediaserver )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::AddToDbIfNewL"));
+
+    CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC();
+    tempServer->SetUDNL( aMediaserver.Uuid() );
+    iDbManager->PrepareQueryCmdL( EMediaServerInfoQyery );
+    TInt errCode = iDbManager->QueryMediaServerL( tempServer );
+    TBool ret = EFalse;
+    
+    if ( errCode != KErrNotFound )
+        {
+        TRACE( Print( _L("[CmMdh Server]\t FillUsage: %d"),
+        		tempServer->FillUsage()));
+        ret = (TBool)tempServer->FillUsage();
+        iAllFound = ETrue;
+        for( TInt i = 0 ; i < iOldMediaServers.Count(); i++ )
+            {
+            if( KErrNotFound != aMediaserver.Uuid().Match(
+                iOldMediaServers[i]->MediaServer() ) )
+                {
+                TRACE( Print( _L("[CmMdh Server]\t In db...")));
+                iOldMediaServers[i]->SetFillUsage( EFalse );
+                }
+            if( iOldMediaServers[i]->FillUsage())
+                {
+                TRACE( Print( _L("[CmMdh Server]\t All not found")));
+                iAllFound = EFalse;
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( tempServer );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Decreases pending responses counter and finishes search if ready
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::DecResponsesAndFinishIfReadyL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             DecResponsesAndFinishIfReadyL"));
+    if ( !(--iResponsesPending )  )
+        {
+        if( iAllFound )
+	        {
+	        DoSearchTimerCompletedL();	
+	        }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Static timer callback function.
+// ---------------------------------------------------------------------------
+TInt CCmMdhMediaserverContainer::SearchTimerCompletedL( TAny* aInstance )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             SearchTimerCompleted"));
+    return ((CCmMdhMediaserverContainer*)aInstance)
+        ->DoSearchTimerCompletedL();
+   }
+
+// ---------------------------------------------------------------------------
+// Timer callback function.
+// ---------------------------------------------------------------------------
+TInt CCmMdhMediaserverContainer::DoSearchTimerCompletedL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+        DoSearchTimerCompleted"));
+    delete iTimer;
+    iTimer = NULL;
+    TRACE( Print( _L("[CmMdh Server]\t Found %d media servers"),
+        iMediaservers.Count()));
+
+    if ( !iResponsesPending )
+        {
+        iOldMediaServers.ResetAndDestroy();
+        iMdhServer.SetServerStateL(ECmMdhServerStateIdle);
+        }
+    return KErrNone;
+   }
+
+// ---------------------------------------------------------------------------
+// Handles UPnP device discoveries.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::DeviceDiscoveredL( CUpnpDevice* aDevice )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::DeviceDiscoveredL"));
+
+#ifdef _DEBUG
+
+    HBufC* uuid = UpnpString::ToUnicodeL( aDevice->Uuid() );
+    HBufC* name = UpnpString::ToUnicodeL(
+                    aDevice->DescriptionProperty( KFriendlyNameTag() ));
+    HBufC* type = UpnpString::ToUnicodeL( aDevice->DeviceType() );
+    TRACE( Print(_L("[CmMdh Server]\t type: %S uuid: %S, name %S"),
+        type, uuid, name ));
+    delete uuid;
+    delete name;
+    delete type;
+
+#endif
+
+
+    if (!iTimer) // search is no more active
+        {
+        LOG(_L("[CmMdh Server]\t Search no more active, returning.."));
+        return;
+        }
+
+    if( aDevice->DeviceType().Find(KMediaServer) != KErrNotFound && 
+        !iAllFound )
+        {
+        LOG(_L("[CmMdh Server]\t Found a media server"));
+
+        if ( AddToDbIfNewL( *aDevice ) )
+            {
+            ++iResponsesPending;
+            iAvControlPoint->CdsSearchCapabilitiesActionL( aDevice->Uuid() );
+            }
+#ifdef _DEBUG
+
+        else
+            {
+            LOG(_L("[CmMdh Server]\t not active, skipping.."));
+            }
+#endif
+
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// Handles UPnP device disappears.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::DeviceDisappearedL(
+    CUpnpDevice* /* aDevice */ )
+    {
+    LOG( _L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+             DeviceDisappearedL") );
+    }
+
+// ---------------------------------------------------------------------------
+// Searches UPnP Media servers.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::SearchMediaserversL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             SearchMediaServersL"));
+
+    iResponsesPending = 0;
+    iProgressInfo.iTotalItems = 0;
+    iProgressInfo.iProcessedItems = 0;
+
+    if ( !iAvControlPoint )
+        {
+        iSettings->GetIapL( iIap );
+        // Create and start (automatic) the AV control point
+        TRACE( Print( _L("[CmMdh Server]\t IAP to use is  %d"), iIap));
+        LOG( _L("[CmMdh Server]\t Creating AV control point..." ) );
+
+        iAvControlPoint = CUpnpAVControlPoint::NewL( *this );
+        }
+        
+    LOG( _L("[CmMdh Server]\t Creating CPeriodic timer..." ) );
+    iTimer = CPeriodic::NewL(EPriorityHigh);
+
+    TInt deviceDiscoveryDelay;
+    iSettings->GetDiscoveryDelay( deviceDiscoveryDelay );
+    TRACE(Print(_L("[CmMdh Server]\t using device discovery delay %d\n"),
+        deviceDiscoveryDelay));
+
+    iTimer->Start(deviceDiscoveryDelay * KMicrosecondsInSecond,
+                  0,
+                  TCallBack(SearchTimerCompletedL, this));
+
+    iMdhServer.SetServerStateL(ECmMdhServerStateSearching);
+
+    iOldMediaServers.ResetAndDestroy();
+    iDbManager->GetMediaServersL( iOldMediaServers );
+    
+    for ( TInt i = 0; i < iOldMediaServers.Count(); i++ )
+        {
+        if ( !iOldMediaServers[i]->FillUsage() &&
+             iOldMediaServers[i]->SystemUpdateID() != KErrNotFound )
+            {
+            iOldMediaServers[i]->SetSystemUpdateID( KErrNotFound );
+            iDbManager->UpdateMediaServerInfo( iOldMediaServers[i] );
+            }
+        }
+    
+    iAllFound = EFalse;
+    SendProgressInfo ( 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// Harvests media servers
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::HarvestMediaserversL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             HarvestMediaserversL"));
+
+    if ( !iAvControlPoint )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    if ( !iMediaservers.Count() )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    TBool harvestNeeded = EFalse;
+    for ( TInt i = 0; i < iMediaservers.Count(); i++ )
+        {
+        if (iMediaservers[i]->iMediaserverState
+            == ECmMdhMediaserverNotSynchronized )
+            {
+            harvestNeeded = ETrue;
+            i = iMediaservers.Count(); // break from the loop
+            }
+        }
+
+    if ( !harvestNeeded )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    if ( !iMetadataCollector )
+        {
+        LOG( _L("[CmMdh Server]\t Creating metadata collector.." ) );
+
+        TInt searchCount = KDefaultChunkSize;
+        TInt addGranularity = KDefaultAddGranularity;
+        iSettings->GetSearchCount( searchCount );
+        iSettings->GetAddCount( addGranularity );
+        TRACE( Print(
+            _L("[CmMdh Server]\t using chunk size %d and addgran %d"),
+            searchCount, addGranularity));
+        iMetadataCollector =
+            CCmMdhMetadataCollector::NewL(
+                *this, *iAvControlPoint, searchCount, addGranularity );
+
+        }
+    iMediaserverIndex = 0;
+    iHarvestErrCode = KErrNone;
+    DoHarvestMediaserverL( iMediaserverIndex );
+
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             HarvestMediaserversL end"));
+
+    }
+
+// ---------------------------------------------------------------------------
+// Harvest completion callback function
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::HarvestCompleteL( TInt aErr )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::HarvestComplete"));
+    iHarvestActive = EFalse;
+    if ( aErr != KErrNone )
+        {
+        iHarvestErrCode = aErr;
+        }
+    else
+        {
+        TInt newUpdateId =
+            iMediaservers[iMediaserverIndex]->iSystemUpdateId;
+        if ( newUpdateId ) // was set to 0 if no update needed
+            {
+            // store changed systemupdateid
+            CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC();
+            tempServer->SetUDNL(
+                *(iMediaservers[iMediaserverIndex]->iUuid) );
+            iDbManager->PrepareQueryCmdL( EMediaServerInfoQyery );
+            TInt errCode = iDbManager->QueryMediaServerL( tempServer );
+            if ( errCode != KErrNotFound )
+                {
+                TRACE( Print( _L
+                    ("[CmMdh Server]\t Updating systemupdateid to %d.."),
+                    newUpdateId ));
+
+                tempServer->SetSystemUpdateID( newUpdateId );
+                iDbManager->UpdateMediaServerInfo( tempServer );
+                }
+            CleanupStack::PopAndDestroy( tempServer );
+            }
+        }
+
+    if ( ++iMediaserverIndex < iMediaservers.Count() )
+        {
+        // harvest next
+        DoHarvestMediaserverL( iMediaserverIndex );
+        }
+    else
+        {
+        // no more media servers
+        iMdhServer.SetServerStateL(ECmMdhServerStateIdle, iHarvestErrCode);
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Cancels search
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::CancelSearchL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::CancelSearchL"));
+    if (!iTimer) // no search is active
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    iTimer->Cancel();
+    iMediaservers.ResetAndDestroy();
+    delete iTimer;
+    iTimer = NULL;
+    iMdhServer.SetServerStateL(ECmMdhServerStateIdle, KErrCancel);
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels harvest
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::CancelHarvestL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::CancelHarvestL"));
+    iHarvestActive = EFalse;
+    iMetadataCollector->CancelHarvest();
+    iMdhServer.SetServerStateL(ECmMdhServerStateIdle, KErrCancel);
+    }
+
+// ---------------------------------------------------------------------------
+// Gets media server id from database
+// ---------------------------------------------------------------------------
+TInt CCmMdhMediaserverContainer::IdForMediaServerL( TDesC8& aUuid )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::IdForMediaServerL"));
+
+    iDbManager->PrepareQueryCmdL( EMediaServerIdQuery );
+
+    TInt id = iDbManager->QueryMediaServerId( aUuid );
+    TRACE( Print( _L("[CmMdh Server]\t returning id %d"), id));
+
+    return id;
+    }
+
+// ---------------------------------------------------------------------------
+// Sends progress info
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::SendProgressInfo( TInt aProgress )
+    {
+    TRACE( Print( _L(
+        "[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                          SendProgressInfo( %d )"),
+        aProgress));
+
+#ifdef _DEBUG
+
+    TInt alloc;
+    TInt cells = User::Heap().AllocSize( alloc );
+    TInt size = User::Heap().Size();
+    TRACE(Print(_L("[CmMdh Server]\t heap allocsize %d, size %d, cells %d"),
+        alloc, size, cells ));
+
+#endif
+
+
+    if ( iProgressInfo.iTotalItems > iProgressInfo.iProcessedItems )
+        {
+        iProgressInfo.iProcessedItems += aProgress;
+        TCmProgressInfoPckg progressPckg( iProgressInfo );
+        TRACE( Print( _L("[CmMdh Server]\t processed: %d total %d"),
+                iProgressInfo.iProcessedItems, iProgressInfo.iTotalItems) );
+        
+        if ( ( iProgressInfo.iTotalItems <= iProgressInfo.iProcessedItems ) ||
+             ( iProgressInfo.iTotalItems > iProgressInfo.iProcessedItems &&
+               iProgressInfo.iProcessedItems > 0 &&
+               ( iProgressInfo.iProcessedItems - iPropertyItemIndex ) >=
+               iProgressInfo.iTotalItems / KDefaultCaculateSize )
+           )
+            {
+            iPropertyItemIndex = iProgressInfo.iProcessedItems;
+            TInt err = RProperty::Set( KCmPropertyCat, KCmProperty, 
+                                   progressPckg );
+            TRACE( Print( _L("[CmMdh Server]\t RProperty::Set returned %d"), 
+                   err)); 
+            }
+        else
+            {
+            LOG(_L("[CmMdh Server]\t progress small no need to pub&sub"));
+            }
+        }
+
+    else
+        {
+        iProgressInfo.iProcessedItems += aProgress;
+        LOG(_L("[CmMdh Server]\t Bigger than 100%% or not beginning"));
+        }
+
+    }
+
+
+// Responses
+
+// ---------------------------------------------------------------------------
+// Observer callback for Content Directory Search function.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::CdsSearchResponse(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& /*aContainerId*/,
+        const TDesC8& /*aSearchCriteria*/,
+        const TDesC8& /*aFilter*/,
+        TInt /*aIndex*/,
+        TInt /*aRequest*/,
+        const TDesC8& /*aSortCriteria*/,
+        const TDesC8& aResult,
+        TInt aReturned,
+        TInt aMatches,
+        const TDesC8& /*aUpdateID*/)
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             CdsSearchResponse"));
+
+    TRAPD( err, CdsSearchResponseL( aUuid, 
+                                    aSessionId, 
+                                    aErr, 
+                                    aResult,
+                                    aReturned,
+                                    aMatches ) );
+    if ( err ) 
+        {
+        TRACE( Print(_L("[CmMdh Server]\t CdsSearchResponseL leaved with err:\
+             %d"), err ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Leaving version of CdsSearchResponseL callback.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::CdsSearchResponseL(
+        const TDesC8& aUuid,
+        TInt aSessionId,
+        TInt aErr,
+        const TDesC8& aResult,
+        TInt aReturned,
+        TInt aMatches
+        )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             CdsSearchResponseL"));
+    if ( iHarvestActive )
+        {
+        iMetadataCollector->CdsSearchResponse(
+            aSessionId, aErr, aResult, aReturned, aMatches );
+        }
+    else if ( iTimer || iResponsesPending ) // media server search active
+        {
+        if ( aErr != EHttpOk )
+            {
+            for( TInt i = 0; i < iMediaservers.Count(); i++ )
+                {
+                if ( *(iMediaservers[i]->iUuid) == aUuid )
+                    {
+                    LOG(_L("[CmMdh Server]\t search error, \
+                            will not sync this.."));
+                    iMediaservers[i]->iMediaserverState =
+                        ECmMdhMediaserverNoSearchCaps;
+                    iMediaservers[i]->iSystemUpdateId = 0;
+                    }
+                }
+            }
+        else
+            {
+            iProgressInfo.iTotalItems += aMatches;
+            TRACE( Print( _L("[CmMdh Server]\t total item count \
+                                increased to %d"),
+            iProgressInfo.iTotalItems));
+            if( iAllFound )
+                {
+                // when all servers are discovered,1 percentage is 
+                // set.
+                SendProgressInfo( iProgressInfo.iTotalItems / 
+                				  KDefaultCaculateSize );
+                iProgressInfo.iProcessedItems = 0;
+                delete iTimer;
+                iTimer = NULL;
+                iOldMediaServers.ResetAndDestroy();
+                TRACE( Print( _L("[CmMdh Server]\t All servers found!!!")));
+                }
+            }
+        DecResponsesAndFinishIfReadyL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Observer callback for Content Directory SearchCapabilities function.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::CdsSearchCapabilitiesResponse(
+            const TDesC8& aUuid,
+            TInt /* aSessionId */,
+            TInt aErr,
+            const TDesC8& aSearchCaps )
+    {
+
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             CdsSearchCapabilitiesResponse"));
+
+    TRAPD( err, CdsSearchCapabilitiesResponseL( aUuid, 
+                                                aErr, 
+                                                aSearchCaps ) );
+    if ( err ) 
+        {
+        TRACE( Print(_L("[CmMdh Server]\t CdsSearchCapabilitiesResponseL \
+            leaved with err: %d"), err ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+//  Leaving version of CdsSystemUpdateIdResponse callback.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::CdsSearchCapabilitiesResponseL(
+            const TDesC8& aUuid,
+            TInt aErr,
+            const TDesC8& aSearchCaps )
+    {
+
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             CdsSearchCapabilitiesResponseL"));
+
+#ifdef _DEBUG
+
+    HBufC* sc = UpnpString::ToUnicodeL( aSearchCaps );
+    TRACE( Print(_L("[CmMdh Server]\t err: %d caps: %S"),
+        aErr, sc ));
+    delete sc;
+
+#endif
+
+
+    HBufC8* uuid = HBufC8::NewL( aUuid.Length() );
+    uuid->Des().Copy( aUuid );
+    CleanupStack::PushL( uuid );
+    CCmMdhMediaserverInfo* info = CCmMdhMediaserverInfo::NewL( );
+    CleanupStack::PushL( info );
+    info->iUuid = uuid;
+    iMediaservers.AppendL( info );
+
+    if ( aErr == EHttpOk && aSearchCaps.Length() ) // has search capabilities
+        {
+        info->iMediaserverState = ECmMdhMediaserverNotSynchronized;
+        iAvControlPoint->CdsSystemUpdateIdActionL( aUuid );
+        }
+    else
+        {
+        DecResponsesAndFinishIfReadyL();
+        info->iSystemUpdateId = 0;
+        info->iMediaserverState = ECmMdhMediaserverNoSearchCaps;
+        }
+
+    CleanupStack::Pop( info );
+    CleanupStack::Pop( uuid );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Observer callback for Content Directory GetSystemUpdateID function.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::CdsSystemUpdateIdResponse(
+            const TDesC8& aUuid,
+            TInt /* aSessionId */,
+            TInt aErr,
+            TInt aSystemUpdateId )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             CdsSystemUpdateIdResponse"));
+
+    TRACE( Print(_L("[CmMdh Server]\t err: %d suid: %d"),
+        aErr, aSystemUpdateId ));
+    
+    TRAPD( err, CdsSystemUpdateIdResponseL( aUuid, 
+                                            aErr, 
+                                            aSystemUpdateId ) );
+    if ( err ) 
+        {
+        TRACE( Print(_L("[CmMdh Server]\t CdsSystemUpdateIdResponseL leaved \
+            with err: %d"), err ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Leaving version of CdsSystemUpdateIdResponse callback.
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::CdsSystemUpdateIdResponseL(
+            const TDesC8& aUuid,
+            TInt aErr,
+            TInt aSystemUpdateId )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             CdsSystemUpdateIdResponseL"));
+
+    TRACE( Print(_L("[CmMdh Server]\t err: %d suid: %d"),
+        aErr, aSystemUpdateId ));
+    for( TInt i = 0; i < iMediaservers.Count(); i++ )
+        {
+        if ( *(iMediaservers[i]->iUuid) == aUuid )
+
+            {
+            LOG(_L("[CmMdh Server]\t checking \
+                     media server's systemupdateid.."));
+
+            TInt errCode = KErrNotFound;
+            if ( aErr == EHttpOk )
+                {
+                CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC();
+                tempServer->SetUDNL( aUuid );
+                iDbManager->PrepareQueryCmdL( EMediaServerInfoQyery );
+                errCode = iDbManager->QueryMediaServerL( tempServer );
+                if ( errCode != KErrNotFound )
+                    {
+                    TRACE( Print( _L
+                        ("[CmMdh Server]\t returned id %d, old id %d"),
+                        aSystemUpdateId, tempServer->SystemUpdateID() ));
+
+
+                    if ( aSystemUpdateId == tempServer->SystemUpdateID() )
+                        {
+                        LOG(_L("[CmMdh Server]\t systemupdateid \
+                            match, no sync needed.."));
+                        iMediaservers[i]->iMediaserverState =
+                            ECmMdhMediaserverSynchronized;
+                        iMediaservers[i]->iSystemUpdateId = 0;
+                        DecResponsesAndFinishIfReadyL();
+                        }
+                    else
+                        {
+                        iMediaservers[i]->iSystemUpdateId = aSystemUpdateId;
+                        errCode = iAvControlPoint->CdsSearchActionL( aUuid,
+                                          KRootContainerId,
+                                          KSearchCriteria,
+                                          KSearchFilter,
+                                          0,
+                                          1,
+                                          KSortCriteria );
+                        TRACE( Print( _L("[CmMdh Server]\t search \
+                            request returned %d"), errCode));
+                        }
+                    }
+                CleanupStack::PopAndDestroy( tempServer );
+                }
+            if ( aErr != EHttpOk || errCode < 0 )
+                {
+                LOG(_L("[CmMdh Server]\t error with systemupdate \
+                    id response, not syncing this.."));
+                iMediaservers[i]->iMediaserverState =
+                    ECmMdhMediaserverSynchronized;
+                iMediaservers[i]->iSystemUpdateId = 0;
+                DecResponsesAndFinishIfReadyL();
+                }
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Observer callback for upnp utilities
+// Called when wlan connection is lost
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::ConnectionLost()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\
+                             ConnectionLost"));
+    iHarvestActive = EFalse;
+    if( iMetadataCollector )
+        {
+        iMetadataCollector->CancelHarvest();
+        }
+    TRAP_IGNORE( iMdhServer.SetServerStateL( ECmMdhServerStateIdle, 
+                                             KErrDisconnected ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhMediaserverContainer::AddHashValueForResponseL
+// ---------------------------------------------------------------------------        
+TInt CCmMdhMediaserverContainer::AddHashValueForResponseL(
+                                                          TInt aMediaServerId, 
+                                                          TInt aSearchIndex, 
+                                                          TInt aItemCount, 
+                                                          const TDesC8& aHash ) 
+    {
+    CCmSearchResponseHash* newHash = CCmSearchResponseHash::NewL( aSearchIndex,
+                                                                  aItemCount,
+                                                                  aHash );
+    CleanupStack::PushL( newHash );
+    TInt errCode = iDbManager->AddHashValue( aMediaServerId, newHash );
+    CleanupStack::PopAndDestroy( newHash );  
+    return errCode;                                                                
+    }
+    
+// ---------------------------------------------------------------------------
+// Gets media server hash values
+// ---------------------------------------------------------------------------
+void CCmMdhMediaserverContainer::HashValuesForMediaServerL( TInt aMediaServerId,
+    RPointerArray<CCmSearchResponseHash>& aHashValues )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::HashValuesForMediaServerL"));
+
+    iDbManager->PrepareQueryCmdL( EHashValueQuery );
+    
+    TInt err = iDbManager->QueryHashValuesL( aMediaServerId, aHashValues );
+
+    return;
+    }
+
+// ---------------------------------------------------------------------------
+// Deletes old hash values
+// ---------------------------------------------------------------------------    
+void CCmMdhMediaserverContainer::DeleteOldHashValuesL( const TInt aMediaserverId,
+    const TInt aSearchIndex )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::DeleteOldHashValuesL"));
+    iDbManager->DeleteHashValuesL( aMediaserverId, aSearchIndex );
+    }
+    
+// End of file
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/server/mdhmetadatacollector.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,490 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata Harvester server's metadata collector component
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+#include <upnpstring.h>
+#include <upnpavcontrolpoint.h>
+#include <upnperrors.h> // HTTP error codes
+#include <hash.h>
+#include "cmsearchresponsehash.h"
+#include "mdhmetadatacollector.h"
+#include "msdebug.h"
+#include "mdhmediaservercontainer.h"
+
+// CONSTANTS
+
+const TInt KSearchTimeout = 120000000;
+const TInt KMaxSearchRetries = 3;
+const TInt KSearchCountLimit = 1;
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+CCmMdhMetadataCollector* CCmMdhMetadataCollector::NewL( 
+        CCmMdhMediaserverContainer& aMediaserverContainer,
+        CUpnpAVControlPoint& aControlPoint,
+        TInt aSearchChunkSize, 
+        TInt aAddGranularity )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::NewL"));
+    
+    CCmMdhMetadataCollector* self = new (ELeave) CCmMdhMetadataCollector ( 
+        aMediaserverContainer, aControlPoint, 
+        aSearchChunkSize, aAddGranularity );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+CCmMdhMetadataCollector::CCmMdhMetadataCollector( 
+        CCmMdhMediaserverContainer& aMediaserverContainer,
+        CUpnpAVControlPoint& aAvControlPoint,
+        TInt aSearchChunkSize,
+        TInt aAddGranularity ) :
+    iMediaserverContainer( aMediaserverContainer ), 
+    iAvControlPoint ( aAvControlPoint ),
+    iSearchChunkSize( aSearchChunkSize ), 
+    iAddGranularity( aAddGranularity )
+     
+    {
+    iCdsSync = NULL;
+    iXmlToParse = NULL;
+    iUuid = NULL;
+    iTimer = NULL;
+    iSearchRetryCount = 0;
+    iSessionId = 0;
+    iTempStartIndex = -1;
+    }
+
+
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+void CCmMdhMetadataCollector::ConstructL()
+    {
+    iHashGenerator = CSHA1::NewL();
+    }
+        
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CCmMdhMetadataCollector::~CCmMdhMetadataCollector()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\
+                             ~CCmMdhMetadataCollector"));
+    delete iCdsSync;
+    delete iXmlToParse;
+    delete iTimer;
+    iSourceDataArray.ResetAndDestroy();
+    delete iHashGenerator;
+    delete iUuid;
+    iHashValues.ResetAndDestroy();  
+    }
+    
+// ---------------------------------------------------------------------------
+// Harvests a media server
+// ---------------------------------------------------------------------------
+void CCmMdhMetadataCollector::DoHarvestMediaserverL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::DoHarvestMediaserver"));
+    
+    // iUuid must be set before calling this method.
+    if ( !iUuid ) 
+        {
+        User::Leave( KErrNotReady );
+        }
+        
+#ifdef _DEBUG
+    
+    HBufC* uuid = UpnpString::ToUnicodeL( *iUuid );
+    TRACE( Print(_L("[CmMdh Server]\t search request, uuid: %S, \
+        searchIndex %d, chunk size %d"), 
+        uuid, iSearchIndex, iSearchChunkSize ));
+    delete uuid;
+    uuid = NULL;
+    iDebugTime.HomeTime();
+    
+#endif
+
+    TInt err = iAvControlPoint.CdsSearchActionL( *iUuid,
+                                      KRootContainerId,
+                                      KSearchCriteria,
+                                      KMdhSearchFilter,
+                                      iSearchIndex,
+                                      iSearchChunkSize,
+                                      KSortCriteria );
+    TRACE( Print( _L("[CmMdh Server]\t search request returned %d"), err));
+    if ( err > 0 ) 
+        {
+        iSessionId = err;
+        }
+    LOG( _L("[CmMdh Server]\t creating CPeriodic \
+        timer for search timeout..." ) );
+    iTimer = CPeriodic::NewL(EPriorityHigh);
+    iTimer->Start(KSearchTimeout, 0, TCallBack(TimeoutTimerCompletedL, this));
+    
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\
+        DoHarvestMediaserver end"));
+    
+    }  
+    
+// ---------------------------------------------------------------------------
+// Harvests a media server
+// ---------------------------------------------------------------------------
+void CCmMdhMetadataCollector::HarvestMediaserverL( TDesC8& aUuid )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::HarvestMediaserver"));
+    iSearchIndex = 0;
+    delete iUuid; iUuid = NULL;
+    iUuid = aUuid.AllocL();
+    iItemsToParse = 0;
+    
+#ifdef _DEBUG
+    
+    HBufC* uuid = UpnpString::ToUnicodeL( aUuid );
+    
+    TRACE( Print( _L("[CmMdh Server]\t starting \
+            to harvest, uuid: %S"), uuid));
+    delete uuid;
+    
+#endif
+    
+    if ( !iCdsSync )
+        {
+        iCdsSync = CCdsSync::NewL();
+        }    
+    iResultIncomplete = ETrue;
+    iCanceled = EFalse;
+    iSearchRetryCount = 0;
+    iSourceDataArray.ResetAndDestroy();
+    iHashValues.ResetAndDestroy();
+    
+    iMediaServerId = iMediaserverContainer.IdForMediaServerL( aUuid );
+    iMediaserverContainer.HashValuesForMediaServerL( iMediaServerId, iHashValues );
+    
+    iCdsSync->InitL( iSourceDataArray,
+                     iMediaServerId, 
+                     *this,
+                     iAddGranularity );
+                     
+    DoHarvestMediaserverL();
+   
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\
+        HarvestMediaserver end"));
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels harvest
+// ---------------------------------------------------------------------------
+void CCmMdhMetadataCollector::CancelHarvest()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::CancelHarvestL"));
+    if( iCdsSync )
+        {
+        // cancel parsing and mde operations
+        TRAP_IGNORE( iCdsSync->ResetL() ); 
+        }
+    if ( iTimer )
+        {
+        iTimer->Cancel();
+        delete iTimer; iTimer = NULL;
+        }
+
+    // Remove old hash values
+    TRAP_IGNORE(iMediaserverContainer.DeleteOldHashValuesL(
+                                              iMediaServerId,
+                                              iTempStartIndex ) );
+
+    iTempStartIndex = -1;
+    iSourceDataArray.ResetAndDestroy();
+    iCanceled = ETrue;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Static timer callback function
+// ---------------------------------------------------------------------------
+TInt CCmMdhMetadataCollector::TimeoutTimerCompletedL(TAny* aInstance)
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\
+                             TimeoutTimerCompletedL"));
+    return static_cast<CCmMdhMetadataCollector*>
+        ( aInstance )->DoTimeoutTimerCompletedL();
+    }
+   
+// ---------------------------------------------------------------------------
+// Timer callback function
+// ---------------------------------------------------------------------------
+TInt CCmMdhMetadataCollector::DoTimeoutTimerCompletedL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\
+                             DoTimeoutTimerCompletedL"));
+    
+    delete iTimer; iTimer = NULL;
+    
+    iMediaserverContainer.HarvestCompleteL( KErrTimedOut );
+    
+    return KErrNone;
+   }
+
+
+   
+// ---------------------------------------------------------------------------
+// Observer callback for Content Directory Search function.
+// ---------------------------------------------------------------------------
+void CCmMdhMetadataCollector::CdsSearchResponse( TInt aSessionId, 
+                                                 TInt aErr, 
+                                                 const TDesC8& aResult, 
+                                                 TInt aReturned, 
+                                                 TInt aMatches )
+    { 
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::CdsSearchResponse")); 
+    TRACE( Print( _L("[CmMdh Server]\t session %d err %d \
+        returned:%d matches %d"), 
+        aSessionId, aErr, aReturned, aMatches) );
+
+
+    TRAPD( err, HandleSearchResponseL( aSessionId, 
+                                       aErr,
+                                       aResult, 
+                                       aReturned, 
+                                       aMatches ) );
+                                      
+    if ( err ) 
+        {
+        TRACE( Print( _L("[CmMdh Server]\t HandleSearchResponse leaved with \
+                          error %d"), err ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles search response.
+// ---------------------------------------------------------------------------
+void CCmMdhMetadataCollector::HandleSearchResponseL( TInt aSessionId, 
+                                                     TInt aErr, 
+                                                     const TDesC8& aResult, 
+                                                     TInt aReturned, 
+                                                     TInt aMatches )
+    { 
+    LOG(_L(
+        "[CmMdh Server]\t CCmMdhMetadataCollector::HandleSearchResponseL") );
+
+    if ( iSessionId != aSessionId ) 
+        {
+        LOG( _L("[CmMdh Server]\t session id mismatch, returning.."));
+        return;
+        }
+    else 
+        {
+        iSessionId = 0;
+        }
+
+#ifdef _DEBUG
+    TTime tempTime;
+    tempTime.HomeTime();
+    
+    TRACE( Print( _L("[CmMdh Server]\t search request took %ld microsec"), 
+        tempTime.MicroSecondsFrom( iDebugTime ).Int64() ));
+#endif
+    
+    if ( iTimer )
+        {
+        iTimer->Cancel();
+        delete iTimer;
+        iTimer = NULL;
+        }
+    
+    if ( iXmlToParse )
+        {
+        LOG( _L("[CmMdh Server]\t deleting old xml buffer.."));
+    
+        delete iXmlToParse;
+        iXmlToParse = NULL;
+        }
+    
+    if ( iCanceled )
+        {
+        LOG(_L("[CmMdh Server]\t harvest canceled, returning..")); 
+        return;
+        }
+        
+    if ( aErr && aErr != EHttpOk )
+        {
+        if ( aErr == EActionFailed && 
+             iSearchRetryCount++ < KMaxSearchRetries ) 
+            // 501 = EActionFailed, retrying 
+            {
+            TRACE( Print( _L("[CmMdh Server]\t retrying search, retry #%d"), 
+                    iSearchRetryCount ));
+            DoHarvestMediaserverL();
+            }
+        else 
+            {
+            LOG(_L("[CmMdh Server]\t Unrecoverable response \
+                error, aborting.. ")); 
+            delete iTimer; iTimer = NULL;    
+            iMediaserverContainer.HarvestCompleteL( aErr );
+            }
+        return;
+        }
+        
+    // Check the hash value (or should it be checked in the cdssync side...?)
+    iHashGenerator->Reset();
+    iHashGenerator->Update( aResult );
+    TPtrC8 hashValue = iHashGenerator->Final();
+
+    TBool foundMatch( EFalse );
+    for ( TInt index(0); index < iHashValues.Count() && !foundMatch; index++ )
+        {
+        CCmSearchResponseHash* hashInstance = iHashValues[index];
+        if ( hashInstance->StartIndex() == iSearchIndex 
+             && hashInstance->ItemCount() == aReturned 
+             && hashInstance->Hash() == hashValue )
+                {
+                LOG( _L("[CmMdh Server]\t FOUND HASH MATCH!!"));
+                foundMatch = ETrue;
+                // Update last matching search chuck to cds sync component
+                iCdsSync->SetSearchIndex( iSearchIndex + aReturned );
+                }
+        }
+
+    if ( !foundMatch )
+        {
+        // Before updating hash values, remove all changed hash values
+        iMediaserverContainer.DeleteOldHashValuesL( iMediaServerId, 
+                                                  iSearchIndex );
+        
+        iMediaserverContainer.AddHashValueForResponseL( iMediaServerId,
+                                                        iSearchIndex,
+                                                        aReturned,
+                                                        hashValue );
+
+        // Save information about hash value in database in order to delete it
+        iTempStartIndex = iSearchIndex;
+
+        TRACE( Print( _L("[CmMdh Server]\t HASH= Index:%d\tCount:%d\tHash:%S"),
+            iSearchIndex, aReturned, &hashValue ));    
+        
+        iSearchIndex += aReturned;
+        iResultIncomplete = iSearchIndex < aMatches;
+        iSearchRetryCount = 0;
+        iItemsToParse = aReturned;        
+        HBufC8* xmlToParse = aResult.AllocL();
+        iSourceDataArray.Append( xmlToParse );
+        TRACE( Print( _L("[CmMdh Server]\t source data array has %d items"), 
+            iSourceDataArray.Count() ));
+         
+        iCdsSync->NotifySourceDataAddedL( !iResultIncomplete );
+        
+        if ( iResultIncomplete && iCdsSync->ChunkCount() < KSearchCountLimit )
+            {
+            DoHarvestMediaserverL();
+            } 
+        }
+    else    // Found matching parsed search response
+        {
+        iSearchIndex += aReturned;
+        iResultIncomplete = iSearchIndex < aMatches;
+        iSearchRetryCount = 0;
+        iItemsToParse = aReturned;
+        // Send progress
+        iMediaserverContainer.SendProgressInfo( aReturned );
+        
+        if ( iResultIncomplete && iCdsSync->ChunkCount() < KSearchCountLimit )
+            {
+            DoHarvestMediaserverL();
+            }
+        else
+            {
+            iMediaserverContainer.HarvestCompleteL( KErrNone );
+            }             
+        }
+    }
+
+    
+// ---------------------------------------------------------------------------
+// Sends progress data
+// ---------------------------------------------------------------------------
+void CCmMdhMetadataCollector::ProgressL( TInt aItemCount ) 
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::ProgressL")); 
+    
+    iMediaserverContainer.SendProgressInfo( aItemCount );
+
+    }
+
+// ---------------------------------------------------------------------------
+// Cds Sync chunk completion callback function
+// ---------------------------------------------------------------------------
+void CCmMdhMetadataCollector::ChunkCompleteL() 
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::ChunkCompleteL")); 
+    
+    // to check if all of the items have been processed successfully
+    // If it is not, the percentage need to be increased for those
+    // items that are not processed successfully
+    TInt processedItems = iCdsSync->ProcessedItemCount();
+    if ( iItemsToParse > processedItems )
+    	{
+    	ProgressL( iItemsToParse - processedItems );
+    	}
+    if ( iResultIncomplete && iCdsSync->ChunkCount() < KSearchCountLimit )
+        {
+        DoHarvestMediaserverL();
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// Cds Sync completion callback function
+// ---------------------------------------------------------------------------
+void CCmMdhMetadataCollector::SyncCompleteL() 
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::SyncCompleteL")); 
+    if ( iCanceled )
+        {
+        LOG(_L("[CmMdh Server]\t harvest canceled, returning..")); 
+        return;
+        }
+    
+    iMediaserverContainer.HarvestCompleteL( KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// Cds Sync error callback function
+// ---------------------------------------------------------------------------
+#ifdef _DEBUG
+void CCmMdhMetadataCollector::SyncErrorL( TInt aError ) 
+#else // _DEBUG
+void CCmMdhMetadataCollector::SyncErrorL( TInt /*aError*/ ) 
+#endif // _DEBUG
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::SyncErrorL")); 
+    TRACE( Print( _L("[CmMdh Server]\t error is %d"), aError ));
+    }
+    
+
+        
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/server/mdhserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,341 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Server core
+*
+*/
+
+
+
+
+
+
+#include    <e32base.h>
+
+#include    "mdhserver.h"
+#include    "mdhcommon.h"
+#include    "mdhserversession.h"
+#include    "mdhmediaservercontainer.h"
+
+#include    "msdebug.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCmMdhServer::CCmMdhServer
+// constructor
+// ---------------------------------------------------------------------------
+//
+CCmMdhServer::CCmMdhServer()
+    : CPolicyServer( CActive::EPriorityHigh, KCmMdhServerPolicy )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::CCmMdhServer"));
+    iServerState = ECmMdhServerStateIdle;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMdhServer::ConstructL
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CCmMdhServer::ConstructL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::ConstructL"));
+    
+    iSessionCount = 0;
+    
+    StartL( KCmMdhServerName );
+    
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::ConstructL end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhServer::NewLC
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CCmMdhServer* CCmMdhServer::NewLC()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::NewLC"));
+    CCmMdhServer *self = new (ELeave) CCmMdhServer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhServer::~CCmMdhServer
+// destructor
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CCmMdhServer::~CCmMdhServer()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::~CCmMdhServer"));
+    delete iMediaserverContainer;
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::~CCmMdhServer end"));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhServer::
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCmMdhServer::CreateMediaserverContainerL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::CreateMediaserverContainerL"));
+    
+    if ( !iMediaserverContainer )
+        {
+        iMediaserverContainer = 
+            CCmMdhMediaserverContainer::NewL( *this );
+        LOG(_L("[CmMdh Server]\t MediaserverContainer created"));
+        }
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhServer::DestroyMediaserverContainer
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCmMdhServer::DestroyMediaserverContainer() 
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::DestroyMediaserverContainer"));
+    
+    if ( iMediaserverContainer )
+        {
+        delete iMediaserverContainer; iMediaserverContainer = NULL;
+        LOG(_L("[CmMdh Server]\t MediaserverContainer destroyed"));
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMdhServer::MediaserverContainer
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CCmMdhMediaserverContainer& CCmMdhServer::MediaserverContainer() 
+    {
+    return *iMediaserverContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhServer::NewSessionL
+// Creates a new session to the server if version information is correct.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CSession2* CCmMdhServer::NewSessionL( const TVersion & aVersion, 
+                                      const RMessage2 &/*aMessage*/) const
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::NewSessionL"));
+
+#ifdef _DEBUG
+    
+    TInt alloc;
+    TInt cells = User::Heap().AllocSize( alloc );
+    TInt size = User::Heap().Size();
+    TRACE( Print(
+        _L("[CmMdh Server]\t NewSessionL allocsize %d, size %d, cells %d"), 
+        alloc, 
+        size, 
+        cells ) );
+ 
+#endif
+    
+    // check we're the right version
+    TVersion version( KCmMdhServerMajor, 
+                      KCmMdhServerMinor, 
+                      KCmMdhServerBuild);
+                      
+    if( !User::QueryVersionSupported( version, aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    // make new session
+    return CCmMdhSession::NewL( iMediaserverContainer, 
+        *const_cast<CCmMdhServer*>(this) );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhServer::SetServerStateL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCmMdhServer::SetServerStateL( TCmMdhServerState aServerState, 
+                                     TInt aErrCode /* = KErrNone */)
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::SetServerState"));
+    TRACE( Print( _L("[CmMdh Server]\t Setting server state from %d to %d"), 
+               iServerState, aServerState));
+
+    if ( iServerState == aServerState ) 
+        {
+        return;
+        }
+    
+    TBool validTransition = EFalse;
+    
+    switch ( iServerState )
+        {
+        case ECmMdhServerStateIdle:
+            if ( aServerState ) // search or harvest started
+                {
+                validTransition = ETrue;
+                }
+            break;
+        case ECmMdhServerStateSearching:
+            if ( aServerState == ECmMdhServerStateIdle ) // search complete
+                {
+                if ( aErrCode )
+                    {
+                    //DestroyMediaserverContainer();
+                    }
+                iCurrentAsyncMsg.Complete( aErrCode );
+                validTransition = ETrue;    
+                }
+            break;
+        case ECmMdhServerStateHarvesting:
+            if ( aServerState == ECmMdhServerStateIdle ) // harvest complete
+                {
+                //DestroyMediaserverContainer();
+                LOG(_L("[CmMdh Server]\t Completing..."));
+                iCurrentAsyncMsg.Complete( aErrCode );
+                LOG(_L("[CmMdh Server]\t Completed..."));
+                validTransition = ETrue;
+                if ( iSessionCount <= 0)
+                    {
+                    // shutdown server 
+                    LOG(_L("[CmMdh Server]\t Harvest complete, \
+                        shutting down.."));
+                    CActiveScheduler::Stop();
+                    }
+                }
+            break;
+         default:
+            // nothing
+            break;
+        }
+    if (validTransition) 
+        {
+        iServerState = aServerState;   
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhServer::DecrementSessions
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCmMdhServer::DecrementSessions()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::DecrementSessions"));
+    
+    if ( --( iSessionCount) <= 0 
+      && iServerState!= ECmMdhServerStateHarvesting ) 
+      {
+      LOG(_L("[CmMdh Server]\t Destroying media server container..."));
+      DestroyMediaserverContainer();
+      // shutdown server
+      LOG(_L("[CmMdh Server]\t No sessions left, shutting down.."));
+      CActiveScheduler::Stop();
+      }
+#ifdef _DEBUG
+    
+    TInt alloc;
+    TInt cells = User::Heap().AllocSize( alloc );
+    TInt size = User::Heap().Size();
+    TRACE( Print(
+        _L(
+        "[CmMdh Server]\t DecrementSessions allocsize %d, size %d, cells %d"
+          ),
+        alloc, 
+        size, 
+        cells )); 
+#endif      
+    }
+
+// --------------------------------------------------------------------------
+// CCmMdhServer::IncrementSessions
+// --------------------------------------------------------------------------
+void CCmMdhServer::IncrementSessions() 
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::IncrementSessions"))
+    ++iSessionCount;    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMdhServer::ServerState
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TCmMdhServerState CCmMdhServer::ServerState()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhServer::ServerState"));
+    return iServerState;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmMdhServer::SetCurrentAsyncMsg
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCmMdhServer::SetCurrentAsyncMsg( const RMessage2& aMessage )
+    {
+    LOG(_L("[CmMdh Server]\t CCmServer::SetCurrentAsyncMsg"));
+    iCurrentAsyncMsg = aMessage;
+    }
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+// PanicServer
+// Server panic handler
+// Panic our own thread
+// ---------------------------------------------------------------------------
+//
+void PanicServer(TInt aPanic)
+    {
+    TRACE(Print(_L("[CmMdh Server]\t PanicServer: Reason = %d\n"), aPanic));
+    User::Panic( KCmMdhServerPanic, aPanic );
+    }
+
+// ---------------------------------------------------------------------------
+// PanicClient
+// Client panic handler
+// RMessage2::Panic() also completes the message. This is:
+// (a) important for efficient cleanup within the kernel
+// (b) a problem if the message is completed a second time
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void PanicClient( const RMessage2& aMessage, TInt aPanic )
+    {
+    TRACE(Print(_L("[CmMdh Server]\t PanicClient: Reason = %d\n"), aPanic));
+    aMessage.Panic( KCmMdhServerPanic, aPanic );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/server/mdhservermain.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Main functions to start the Metadata Harvester server
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "mdhserver.h"
+#include "mdhcommon.h"
+#include "msdebug.h"
+
+
+// LOCAL FUNCTION PROTOTYPES
+void RunServerL();
+
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// E32Main
+//
+// Module entry point
+// ---------------------------------------------------------------------------
+//
+
+TInt E32Main()
+    {
+    LOG(_L("[CmMdh Server]\t E32Main"));
+    
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    TInt error = KErrNoMemory;
+    if ( cleanup )
+        {
+        TRAP( error, RunServerL() );
+        delete cleanup;
+        }
+    __UHEAP_MARKEND;
+    
+    return error;
+    }
+
+
+// ---------------------------------------------------------------------------
+// RunServerL
+// 
+// Constructs Active Scheduler and starts the server up & running
+// ---------------------------------------------------------------------------
+//
+void RunServerL()
+    {
+    LOG(_L("[CmMdh Server]\t RunServerL"));
+    // Create and install the active scheduler we need
+    CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    // Create server
+    CCmMdhServer* server = CCmMdhServer::NewLC();
+
+    // Initialisation complete, now signal the client
+    User::LeaveIfError( RThread().RenameMe( KCmMdhServerName ) );
+    RProcess::Rendezvous( KErrNone );
+
+    // Ready to run
+    CActiveScheduler::Start();
+
+    // Cleanup the server and scheduler
+    CleanupStack::PopAndDestroy( server );
+    CleanupStack::PopAndDestroy( scheduler );
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/mdhserver/src/server/mdhserversession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Session implementation class for Metadata Harvester Server
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <s32mem.h>
+#include    "mdhserversession.h"
+#include    "mdhcommon.h"
+#include    "mdhserver.h"
+#include    "mdhmediaservercontainer.h"
+
+#include    "msdebug.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+// ---------------------------------------------------------------------------
+// Two-phase API constructor
+// ---------------------------------------------------------------------------
+//
+CCmMdhSession* CCmMdhSession::NewL( 
+    CCmMdhMediaserverContainer* aMediaserverContainer, CCmMdhServer& aServer )
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhSession::NewL"));
+    CCmMdhSession* self = 
+        new (ELeave) CCmMdhSession( aMediaserverContainer, aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CCmMdhSession::CCmMdhSession( 
+    CCmMdhMediaserverContainer* aMediaserverContainer, 
+    CCmMdhServer& aServer ): iServer( aServer )
+    {
+        iMediaserverContainer = aMediaserverContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//    
+void CCmMdhSession::ConstructL()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhSession::ConstructL"))
+    iServer.IncrementSessions();
+    }
+            
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCmMdhSession::~CCmMdhSession()
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhSession::~CCmMdhSession"));
+    iServer.DecrementSessions();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhSession::Server
+// Returns a reference to server
+// ---------------------------------------------------------------------------
+//
+CCmMdhServer& CCmMdhSession::Server()
+    {
+    return *static_cast<CCmMdhServer*>
+        (const_cast<CServer2*>(CSession2::Server()));
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhSession::CompleteIfBusy
+// Completes message with busy error code if server is busy
+// ---------------------------------------------------------------------------
+TBool CCmMdhSession::CompleteIfBusy(const RMessage2& aMessage)
+    {
+    if (iServer.ServerState()) // operation already in progress
+        {
+        aMessage.Complete(KErrInUse);
+        return ETrue;
+        }
+    return EFalse;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmMdhSession::ServiceL
+// Implements CSession2 -derived ServiceL -method.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCmMdhSession::ServiceL(const RMessage2& aMessage)
+    {
+    LOG(_L("[CmMdh Server]\t CCmMdhSession::ServiceL"));
+    
+    switch ( aMessage.Function() )
+        {
+        case ECmMdhSearchMediaservers:
+            {
+            LOG(_L("[CmMdh Server]\t ECmMdhSearchMediaServers request"));
+            if ( !CompleteIfBusy(aMessage) ) 
+                {
+                iServer.SetCurrentAsyncMsg( aMessage );
+                iServer.CreateMediaserverContainerL();
+                iServer.MediaserverContainer().SearchMediaserversL();        
+                }
+            break;    
+            }
+        case ECmMdhHarvest:
+            {
+            LOG(_L("[CmMdh Server]\t ECmMdhHarvest request"));
+            iServer.SetCurrentAsyncMsg( aMessage );
+            iServer.CreateMediaserverContainerL();
+            iServer.MediaserverContainer().HarvestMediaserversL();
+            break;
+            }
+        case ECmMdhCancel:
+            {
+            LOG(_L("[CmMdh Server]\t ECmMdhCancel request"));
+            switch ( iServer.ServerState() )
+                {
+                case ECmMdhServerStateSearching:
+                    {
+                    iServer.MediaserverContainer().CancelSearchL();
+                    iServer.DestroyMediaserverContainer();
+                
+                    aMessage.Complete( KErrNone );
+                    break;
+                    }
+                case ECmMdhServerStateHarvesting:
+                    {
+                    iServer.MediaserverContainer().CancelHarvestL();
+                    iServer.DestroyMediaserverContainer();
+                
+                    aMessage.Complete( KErrNone );
+                    break;
+                    }
+                default: 
+                    {
+                    aMessage.Complete( KErrNotReady );
+                    break;
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            // Unknown opcode --> panic client
+            PanicClient( aMessage, ECmMdhClientBadRequest );
+            break;
+            }
+        }    
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpharvester/rom/upnpharvester.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:     upnpharvester
+*
+*/
+
+
+
+
+#ifndef __UPNPHARVESTER_IBY__
+#define __UPNPHARVESTER_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+#include <productvariant.hrh>
+
+// Application and setup wizard
+
+file=ABI_DIR\BUILD_DIR\cmsqlwrapper.dll \sys\bin\cmsqlwrapper.dll
+file=ABI_DIR\BUILD_DIR\cmcommon.dll \sys\bin\cmcommon.dll
+file=ABI_DIR\BUILD_DIR\cmdatabasemanager.dll \sys\bin\cmdatabasemanager.dll
+file=ABI_DIR\BUILD_DIR\cmmdhclient.dll \sys\bin\cmmdhclient.dll
+file=ABI_DIR\BUILD_DIR\cmmdh.exe \sys\bin\cmmdh.exe
+file=ABI_DIR\BUILD_DIR\cmsettingsengine.dll \sys\bin\cmsettingsengine.dll
+file=ABI_DIR\BUILD_DIR\cdssync.dll \sys\bin\cdssync.dll
+data=\epoc32\release\armv5\urel\z\private\10202be9\10281FAB.txt \private\10202be9\10281FAB.txt
+
+// export upnpharvester_stub.sis file
+data=ZSYSTEM\install\upnpharvester_stub.sis    system\install\upnpharvester_stub.sis 
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __UPNPHARVESTER_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/bwins/upnpavobjectsU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,144 @@
+EXPORTS
+	??0CUpnpAttribute@@AAE@XZ @ 1 NONAME ; CUpnpAttribute::CUpnpAttribute(void)
+	??1CUpnpItem@@UAE@XZ @ 2 NONAME ; CUpnpItem::~CUpnpItem(void)
+	??1CUpnpObject@@UAE@XZ @ 3 NONAME ; CUpnpObject::~CUpnpObject(void)
+	??ACUpnpContainer@@QAEPAVCUpnpObject@@H@Z @ 4 NONAME ; class CUpnpObject * CUpnpContainer::operator[](int)
+	??ACUpnpObjectList@@QBEPAVCUpnpObject@@H@Z @ 5 NONAME ; class CUpnpObject * CUpnpObjectList::operator[](int) const
+	?AddAttributeL@CUpnpElement@@QAEXPAVCUpnpAttribute@@@Z @ 6 NONAME ; void CUpnpElement::AddAttributeL(class CUpnpAttribute *)
+	?AddElementL@CUpnpObject@@QAEXPAVCUpnpElement@@@Z @ 7 NONAME ; void CUpnpObject::AddElementL(class CUpnpElement *)
+	?AddResourceL@CUpnpObject@@QAEXABVTDesC16@@ABVTDesC8@@@Z @ 8 NONAME ; void CUpnpObject::AddResourceL(class TDesC16 const &, class TDesC8 const &)
+	?AppendObjectL@CUpnpContainer@@QAEXAAVCUpnpObject@@@Z @ 9 NONAME ; void CUpnpContainer::AppendObjectL(class CUpnpObject &)
+	?AppendObjectL@CUpnpContainerList@@QAEXAAVCUpnpObject@@@Z @ 10 NONAME ; void CUpnpContainerList::AppendObjectL(class CUpnpObject &)
+	?AppendObjectL@CUpnpItemList@@QAEXAAVCUpnpObject@@@Z @ 11 NONAME ; void CUpnpItemList::AppendObjectL(class CUpnpObject &)
+	?AppendObjectL@CUpnpObjectList@@QAEXAAVCUpnpObject@@@Z @ 12 NONAME ; void CUpnpObjectList::AppendObjectL(class CUpnpObject &)
+	?CloneL@CUpnpFileTransferEvent@@QAEPAV1@XZ @ 13 NONAME ; class CUpnpFileTransferEvent * CUpnpFileTransferEvent::CloneL(void)
+	?ContentDirectoryObjectId@CUpnpFileTransferEvent@@QAEHXZ @ 14 NONAME ; int CUpnpFileTransferEvent::ContentDirectoryObjectId(void)
+	?CopyL@CUpnpBrowseCriteria@@QAEXABV1@@Z @ 15 NONAME ; void CUpnpBrowseCriteria::CopyL(class CUpnpBrowseCriteria const &)
+	?CopyL@CUpnpElement@@QAEXABV1@@Z @ 16 NONAME ; void CUpnpElement::CopyL(class CUpnpElement const &)
+	?CopyL@CUpnpObject@@QAEXABV1@@Z @ 17 NONAME ; void CUpnpObject::CopyL(class CUpnpObject const &)
+	?Direction@CUpnpFileTransferEvent@@QAE?AW4TDirection@1@XZ @ 18 NONAME ; enum CUpnpFileTransferEvent::TDirection CUpnpFileTransferEvent::Direction(void)
+	?ErrorCode@CUpnpFileTransferEvent@@QAEHXZ @ 19 NONAME ; int CUpnpFileTransferEvent::ErrorCode(void)
+	?ExternalizeL@CUpnpBrowseCriteria@@QBEXAAVRWriteStream@@@Z @ 20 NONAME ; void CUpnpBrowseCriteria::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CUpnpContainer@@UBEXAAVRWriteStream@@@Z @ 21 NONAME ; void CUpnpContainer::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CUpnpElement@@QBEXAAVRWriteStream@@@Z @ 22 NONAME ; void CUpnpElement::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CUpnpFileTransferEvent@@UBEXAAVRWriteStream@@@Z @ 23 NONAME ; void CUpnpFileTransferEvent::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CUpnpItem@@UBEXAAVRWriteStream@@@Z @ 24 NONAME ; void CUpnpItem::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CUpnpMediaServerEventList@@QBEXAAVRWriteStream@@@Z @ 25 NONAME ; void CUpnpMediaServerEventList::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CUpnpObjectList@@QBEXAAVRWriteStream@@@Z @ 26 NONAME ; void CUpnpObjectList::ExternalizeL(class RWriteStream &) const
+	?FilePath@CUpnpElement@@QBEABVTDesC16@@XZ @ 27 NONAME ; class TDesC16 const & CUpnpElement::FilePath(void) const
+	?FilePath@CUpnpFileTransferEvent@@QAEAAVTDesC16@@XZ @ 28 NONAME ; class TDesC16 & CUpnpFileTransferEvent::FilePath(void)
+	?Filter@CUpnpBrowseCriteria@@QBEABVTDesC8@@XZ @ 29 NONAME ; class TDesC8 const & CUpnpBrowseCriteria::Filter(void) const
+	?FindObject@CUpnpContainer@@QAEPAVCUpnpObject@@ABVTDesC8@@@Z @ 30 NONAME ; class CUpnpObject * CUpnpContainer::FindObject(class TDesC8 const &)
+	?FindObject@CUpnpObjectList@@QAEPAVCUpnpObject@@ABVTDesC8@@@Z @ 31 NONAME ; class CUpnpObject * CUpnpObjectList::FindObject(class TDesC8 const &)
+	?GetAttributes@CUpnpElement@@QAEABV?$RPointerArray@VCUpnpAttribute@@@@XZ @ 32 NONAME ; class RPointerArray<class CUpnpAttribute> const & CUpnpElement::GetAttributes(void)
+	?GetElements@CUpnpObject@@QAEABV?$RPointerArray@VCUpnpElement@@@@XZ @ 33 NONAME ; class RPointerArray<class CUpnpElement> const & CUpnpObject::GetElements(void)
+	?GetPointerArray@CUpnpMediaServerEventList@@QAEAAV?$RPointerArray@VCUpnpMediaServerEvent@@@@XZ @ 34 NONAME ; class RPointerArray<class CUpnpMediaServerEvent> & CUpnpMediaServerEventList::GetPointerArray(void)
+	?Id@CUpnpObject@@QBEABVTDesC8@@XZ @ 35 NONAME ; class TDesC8 const & CUpnpObject::Id(void) const
+	?IdsToDes8L@CUpnpObjectList@@QBEPAVHBufC8@@XZ @ 36 NONAME ; class HBufC8 * CUpnpObjectList::IdsToDes8L(void) const
+	?InternalizeL@CUpnpBrowseCriteria@@QAEXAAVRReadStream@@@Z @ 37 NONAME ; void CUpnpBrowseCriteria::InternalizeL(class RReadStream &)
+	?InternalizeL@CUpnpContainer@@UAEXAAVRReadStream@@@Z @ 38 NONAME ; void CUpnpContainer::InternalizeL(class RReadStream &)
+	?InternalizeL@CUpnpElement@@QAEXAAVRReadStream@@@Z @ 39 NONAME ; void CUpnpElement::InternalizeL(class RReadStream &)
+	?InternalizeL@CUpnpFileTransferEvent@@UAEXAAVRReadStream@@@Z @ 40 NONAME ; void CUpnpFileTransferEvent::InternalizeL(class RReadStream &)
+	?InternalizeL@CUpnpItem@@UAEXAAVRReadStream@@@Z @ 41 NONAME ; void CUpnpItem::InternalizeL(class RReadStream &)
+	?InternalizeL@CUpnpMediaServerEventList@@QAEXAAVRReadStream@@@Z @ 42 NONAME ; void CUpnpMediaServerEventList::InternalizeL(class RReadStream &)
+	?InternalizeL@CUpnpObjectList@@QAEXAAVRReadStream@@@Z @ 43 NONAME ; void CUpnpObjectList::InternalizeL(class RReadStream &)
+	?IsRequired@CUpnpElement@@QBEHXZ @ 44 NONAME ; int CUpnpElement::IsRequired(void) const
+	?Name@CUpnpAttribute@@QBEABVTDesC8@@XZ @ 45 NONAME ; class TDesC8 const & CUpnpAttribute::Name(void) const
+	?Name@CUpnpElement@@QBEABVTDesC8@@XZ @ 46 NONAME ; class TDesC8 const & CUpnpElement::Name(void) const
+	?NewL@CUpnpAttribute@@SAPAV1@ABVTDesC8@@@Z @ 47 NONAME ; class CUpnpAttribute * CUpnpAttribute::NewL(class TDesC8 const &)
+	?NewL@CUpnpBrowseCriteria@@SAPAV1@ABVTDesC8@@@Z @ 48 NONAME ; class CUpnpBrowseCriteria * CUpnpBrowseCriteria::NewL(class TDesC8 const &)
+	?NewL@CUpnpContainer@@SAPAV1@XZ @ 49 NONAME ; class CUpnpContainer * CUpnpContainer::NewL(void)
+	?NewL@CUpnpContainerList@@SAPAV1@XZ @ 50 NONAME ; class CUpnpContainerList * CUpnpContainerList::NewL(void)
+	?NewL@CUpnpElement@@SAPAV1@ABVTDesC8@@@Z @ 51 NONAME ; class CUpnpElement * CUpnpElement::NewL(class TDesC8 const &)
+	?NewL@CUpnpFileTransferEvent@@SAPAV1@XZ @ 52 NONAME ; class CUpnpFileTransferEvent * CUpnpFileTransferEvent::NewL(void)
+	?NewL@CUpnpFileTransferEventList@@SAPAV1@XZ @ 53 NONAME ; class CUpnpFileTransferEventList * CUpnpFileTransferEventList::NewL(void)
+	?NewL@CUpnpItem@@SAPAV1@XZ @ 54 NONAME ; class CUpnpItem * CUpnpItem::NewL(void)
+	?NewL@CUpnpItemList@@SAPAV1@XZ @ 55 NONAME ; class CUpnpItemList * CUpnpItemList::NewL(void)
+	?NewL@CUpnpObjectList@@SAPAV1@XZ @ 56 NONAME ; class CUpnpObjectList * CUpnpObjectList::NewL(void)
+	?NewLC@CUpnpAttribute@@SAPAV1@ABVTDesC8@@@Z @ 57 NONAME ; class CUpnpAttribute * CUpnpAttribute::NewLC(class TDesC8 const &)
+	?NewLC@CUpnpBrowseCriteria@@SAPAV1@ABVTDesC8@@@Z @ 58 NONAME ; class CUpnpBrowseCriteria * CUpnpBrowseCriteria::NewLC(class TDesC8 const &)
+	?NewLC@CUpnpContainerList@@SAPAV1@XZ @ 59 NONAME ; class CUpnpContainerList * CUpnpContainerList::NewLC(void)
+	?NewLC@CUpnpElement@@SAPAV1@ABVTDesC8@@@Z @ 60 NONAME ; class CUpnpElement * CUpnpElement::NewLC(class TDesC8 const &)
+	?NewLC@CUpnpFileTransferEvent@@SAPAV1@XZ @ 61 NONAME ; class CUpnpFileTransferEvent * CUpnpFileTransferEvent::NewLC(void)
+	?NewLC@CUpnpFileTransferEventList@@SAPAV1@XZ @ 62 NONAME ; class CUpnpFileTransferEventList * CUpnpFileTransferEventList::NewLC(void)
+	?NewLC@CUpnpItemList@@SAPAV1@XZ @ 63 NONAME ; class CUpnpItemList * CUpnpItemList::NewLC(void)
+	?NewLC@CUpnpObjectList@@SAPAV1@XZ @ 64 NONAME ; class CUpnpObjectList * CUpnpObjectList::NewLC(void)
+	?ObjectClass@CUpnpObject@@QBEABVTDesC8@@XZ @ 65 NONAME ; class TDesC8 const & CUpnpObject::ObjectClass(void) const
+	?ObjectCount@CUpnpContainer@@QAEHXZ @ 66 NONAME ; int CUpnpContainer::ObjectCount(void)
+	?ObjectCount@CUpnpObjectList@@QBEHXZ @ 67 NONAME ; int CUpnpObjectList::ObjectCount(void) const
+	?ParentId@CUpnpObject@@QBEABVTDesC8@@XZ @ 68 NONAME ; class TDesC8 const & CUpnpObject::ParentId(void) const
+	?ProgressState@CUpnpFileTransferEvent@@QAE?AW4TProgressState@1@XZ @ 69 NONAME ; enum CUpnpFileTransferEvent::TProgressState CUpnpFileTransferEvent::ProgressState(void)
+	?RefId@CUpnpItem@@QBEABVTDesC8@@XZ @ 70 NONAME ; class TDesC8 const & CUpnpItem::RefId(void) const
+	?Remove@CUpnpObjectList@@QAEPAVCUpnpObject@@ABVTDesC8@@@Z @ 71 NONAME ; class CUpnpObject * CUpnpObjectList::Remove(class TDesC8 const &)
+	?RemoveAndDestroy@CUpnpObjectList@@QAEXABVTDesC8@@@Z @ 72 NONAME ; void CUpnpObjectList::RemoveAndDestroy(class TDesC8 const &)
+	?RemoveAttributeL@CUpnpElement@@QAEXPBVCUpnpAttribute@@@Z @ 73 NONAME ; void CUpnpElement::RemoveAttributeL(class CUpnpAttribute const *)
+	?RemoveElementL@CUpnpObject@@QAEXPBVCUpnpElement@@@Z @ 74 NONAME ; void CUpnpObject::RemoveElementL(class CUpnpElement const *)
+	?RemoveObjectL@CUpnpContainer@@QAEXABVTDesC8@@@Z @ 75 NONAME ; void CUpnpContainer::RemoveObjectL(class TDesC8 const &)
+	?RequestedCount@CUpnpBrowseCriteria@@QBEHXZ @ 76 NONAME ; int CUpnpBrowseCriteria::RequestedCount(void) const
+	?Restricted@CUpnpObject@@QBEHXZ @ 77 NONAME ; int CUpnpObject::Restricted(void) const
+	?SetContentDirectoryObjectId@CUpnpFileTransferEvent@@QAEXH@Z @ 78 NONAME ; void CUpnpFileTransferEvent::SetContentDirectoryObjectId(int)
+	?SetDirection@CUpnpFileTransferEvent@@QAEXW4TDirection@1@@Z @ 79 NONAME ; void CUpnpFileTransferEvent::SetDirection(enum CUpnpFileTransferEvent::TDirection)
+	?SetErrorCode@CUpnpFileTransferEvent@@QAEXH@Z @ 80 NONAME ; void CUpnpFileTransferEvent::SetErrorCode(int)
+	?SetFilePathL@CUpnpElement@@QAEXABVTDesC16@@@Z @ 81 NONAME ; void CUpnpElement::SetFilePathL(class TDesC16 const &)
+	?SetFilePathL@CUpnpFileTransferEvent@@QAEXABVTDesC16@@@Z @ 82 NONAME ; void CUpnpFileTransferEvent::SetFilePathL(class TDesC16 const &)
+	?SetFilterL@CUpnpBrowseCriteria@@QAEXABVTDesC8@@@Z @ 83 NONAME ; void CUpnpBrowseCriteria::SetFilterL(class TDesC8 const &)
+	?SetIdL@CUpnpObject@@QAEXABVTDesC8@@@Z @ 84 NONAME ; void CUpnpObject::SetIdL(class TDesC8 const &)
+	?SetIsRequired@CUpnpElement@@QAEXH@Z @ 85 NONAME ; void CUpnpElement::SetIsRequired(int)
+	?SetNameL@CUpnpAttribute@@QAEXABVTDesC8@@@Z @ 86 NONAME ; void CUpnpAttribute::SetNameL(class TDesC8 const &)
+	?SetNameL@CUpnpElement@@QAEXABVTDesC8@@@Z @ 87 NONAME ; void CUpnpElement::SetNameL(class TDesC8 const &)
+	?SetObjectClassL@CUpnpObject@@QAEXABVTDesC8@@@Z @ 88 NONAME ; void CUpnpObject::SetObjectClassL(class TDesC8 const &)
+	?SetParentIdL@CUpnpObject@@QAEXABVTDesC8@@@Z @ 89 NONAME ; void CUpnpObject::SetParentIdL(class TDesC8 const &)
+	?SetProgressState@CUpnpFileTransferEvent@@QAEXW4TProgressState@1@@Z @ 90 NONAME ; void CUpnpFileTransferEvent::SetProgressState(enum CUpnpFileTransferEvent::TProgressState)
+	?SetRefIdL@CUpnpItem@@QAEXABVTDesC8@@@Z @ 91 NONAME ; void CUpnpItem::SetRefIdL(class TDesC8 const &)
+	?SetRequestedCount@CUpnpBrowseCriteria@@QAEXH@Z @ 92 NONAME ; void CUpnpBrowseCriteria::SetRequestedCount(int)
+	?SetRestricted@CUpnpObject@@QAEXH@Z @ 93 NONAME ; void CUpnpObject::SetRestricted(int)
+	?SetStartingIndex@CUpnpBrowseCriteria@@QAEXH@Z @ 94 NONAME ; void CUpnpBrowseCriteria::SetStartingIndex(int)
+	?SetTitleL@CUpnpObject@@QAEXABVTDesC8@@@Z @ 95 NONAME ; void CUpnpObject::SetTitleL(class TDesC8 const &)
+	?SetTransferId@CUpnpFileTransferEvent@@QAEXH@Z @ 96 NONAME ; void CUpnpFileTransferEvent::SetTransferId(int)
+	?SetValueL@CUpnpAttribute@@QAEXABVTDesC8@@@Z @ 97 NONAME ; void CUpnpAttribute::SetValueL(class TDesC8 const &)
+	?SetValueL@CUpnpElement@@QAEXABVTDesC8@@@Z @ 98 NONAME ; void CUpnpElement::SetValueL(class TDesC8 const &)
+	?SetWriteStatus@CUpnpObject@@QAEXH@Z @ 99 NONAME ; void CUpnpObject::SetWriteStatus(int)
+	?StartingIndex@CUpnpBrowseCriteria@@QBEHXZ @ 100 NONAME ; int CUpnpBrowseCriteria::StartingIndex(void) const
+	?Title@CUpnpObject@@QBEABVTDesC8@@XZ @ 101 NONAME ; class TDesC8 const & CUpnpObject::Title(void) const
+	?ToDes8L@CUpnpBrowseCriteria@@QBEPAVHBufC8@@XZ @ 102 NONAME ; class HBufC8 * CUpnpBrowseCriteria::ToDes8L(void) const
+	?ToDes8L@CUpnpMediaServerEventList@@QBEPAVHBufC8@@XZ @ 103 NONAME ; class HBufC8 * CUpnpMediaServerEventList::ToDes8L(void) const
+	?ToDes8L@CUpnpObject@@QBEPAVHBufC8@@XZ @ 104 NONAME ; class HBufC8 * CUpnpObject::ToDes8L(void) const
+	?ToDes8L@CUpnpObjectList@@QBEPAVHBufC8@@XZ @ 105 NONAME ; class HBufC8 * CUpnpObjectList::ToDes8L(void) const
+	?TransferId@CUpnpFileTransferEvent@@QAEHXZ @ 106 NONAME ; int CUpnpFileTransferEvent::TransferId(void)
+	?Value@CUpnpAttribute@@QBEABVTDesC8@@XZ @ 107 NONAME ; class TDesC8 const & CUpnpAttribute::Value(void) const
+	?Value@CUpnpElement@@QBEABVTDesC8@@XZ @ 108 NONAME ; class TDesC8 const & CUpnpElement::Value(void) const
+	?WriteStatus@CUpnpObject@@QBEHXZ @ 109 NONAME ; int CUpnpObject::WriteStatus(void) const
+	?OpParameterL@CUpnpDlnaProtocolInfo@@QAE?AVTPtrC8@@XZ @ 110 NONAME ; class TPtrC8 CUpnpDlnaProtocolInfo::OpParameterL(void)
+	?SetPnParameterL@CUpnpDlnaProtocolInfo@@QAEXABVTDesC8@@@Z @ 111 NONAME ; void CUpnpDlnaProtocolInfo::SetPnParameterL(class TDesC8 const &)
+	?GetOtherParams@CUpnpDlnaProtocolInfo@@QAE?AVTPtrC8@@XZ @ 112 NONAME ; class TPtrC8 CUpnpDlnaProtocolInfo::GetOtherParams(void)
+	?FourthField@CUpnpProtocolInfo@@UAE?AVTPtrC8@@XZ @ 113 NONAME ; class TPtrC8 CUpnpProtocolInfo::FourthField(void)
+	?SetThirdFieldL@CUpnpProtocolInfo@@QAEXABVTDesC8@@@Z @ 114 NONAME ; void CUpnpProtocolInfo::SetThirdFieldL(class TDesC8 const &)
+	?FlagsParameterL@CUpnpDlnaProtocolInfo@@QAE?AVTPtrC8@@XZ @ 115 NONAME ; class TPtrC8 CUpnpDlnaProtocolInfo::FlagsParameterL(void)
+	?NewL@CUpnpProtocolInfoLocal@@SAPAV1@ABVTDesC8@@@Z @ 116 NONAME ; class CUpnpProtocolInfoLocal * CUpnpProtocolInfoLocal::NewL(class TDesC8 const &)
+	?SetSecondFieldL@CUpnpProtocolInfo@@QAEXABVTDesC8@@@Z @ 117 NONAME ; void CUpnpProtocolInfo::SetSecondFieldL(class TDesC8 const &)
+	?SetOpParameterL@CUpnpDlnaProtocolInfo@@QAEXW4TDlnaParams@UpnpDlnaProtocolInfo@@H@Z @ 118 NONAME ; void CUpnpDlnaProtocolInfo::SetOpParameterL(enum UpnpDlnaProtocolInfo::TDlnaParams, int)
+	?ProtocolInfoL@CUpnpProtocolInfo@@QAE?AVTPtrC8@@XZ @ 119 NONAME ; class TPtrC8 CUpnpProtocolInfo::ProtocolInfoL(void)
+	?SetFirstFieldL@CUpnpProtocolInfo@@QAEXABVTDesC8@@@Z @ 120 NONAME ; void CUpnpProtocolInfo::SetFirstFieldL(class TDesC8 const &)
+	?NewL@CUpnpDlnaProtocolInfo@@SAPAV1@ABVTDesC8@@@Z @ 121 NONAME ; class CUpnpDlnaProtocolInfo * CUpnpDlnaProtocolInfo::NewL(class TDesC8 const &)
+	?NewL@CUpnpProtocolInfoLocal@@SAPAV1@ABVTDesC8@@0@Z @ 122 NONAME ; class CUpnpProtocolInfoLocal * CUpnpProtocolInfoLocal::NewL(class TDesC8 const &, class TDesC8 const &)
+	?FourthField@CUpnpDlnaProtocolInfo@@UAE?AVTPtrC8@@XZ @ 123 NONAME ; class TPtrC8 CUpnpDlnaProtocolInfo::FourthField(void)
+	?SetDlnaFlag@CUpnpDlnaProtocolInfo@@QAEXW4TDlnaFlags@UpnpDlnaProtocolInfo@@H@Z @ 124 NONAME ; void CUpnpDlnaProtocolInfo::SetDlnaFlag(enum UpnpDlnaProtocolInfo::TDlnaFlags, int)
+	?SecondField@CUpnpProtocolInfo@@QAE?AVTPtrC8@@XZ @ 125 NONAME ; class TPtrC8 CUpnpProtocolInfo::SecondField(void)
+	?CiParameter@CUpnpDlnaProtocolInfo@@QAEHXZ @ 126 NONAME ; int CUpnpDlnaProtocolInfo::CiParameter(void)
+	?PsParameter@CUpnpDlnaProtocolInfo@@QAE?AVTPtrC8@@XZ @ 127 NONAME ; class TPtrC8 CUpnpDlnaProtocolInfo::PsParameter(void)
+	?NewL@CUpnpProtocolInfo@@SAPAV1@XZ @ 128 NONAME ; class CUpnpProtocolInfo * CUpnpProtocolInfo::NewL(void)
+	?SetCiParameter@CUpnpDlnaProtocolInfo@@QAEXH@Z @ 129 NONAME ; void CUpnpDlnaProtocolInfo::SetCiParameter(int)
+	?NewL@CUpnpDlnaProtocolInfo@@SAPAV1@XZ @ 130 NONAME ; class CUpnpDlnaProtocolInfo * CUpnpDlnaProtocolInfo::NewL(void)
+	?DlnaFlag@CUpnpDlnaProtocolInfo@@QAEHW4TDlnaFlags@UpnpDlnaProtocolInfo@@@Z @ 131 NONAME ; int CUpnpDlnaProtocolInfo::DlnaFlag(enum UpnpDlnaProtocolInfo::TDlnaFlags)
+	?ThirdField@CUpnpProtocolInfo@@QAE?AVTPtrC8@@XZ @ 132 NONAME ; class TPtrC8 CUpnpProtocolInfo::ThirdField(void)
+	?NewL@CUpnpProtocolInfoLocal@@SAPAV1@ABVTDesC8@@H@Z @ 133 NONAME ; class CUpnpProtocolInfoLocal * CUpnpProtocolInfoLocal::NewL(class TDesC8 const &, int)
+	?OpParameter@CUpnpDlnaProtocolInfo@@QAEHW4TDlnaParams@UpnpDlnaProtocolInfo@@@Z @ 134 NONAME ; int CUpnpDlnaProtocolInfo::OpParameter(enum UpnpDlnaProtocolInfo::TDlnaParams)
+	?NewL@CUpnpProtocolInfo@@SAPAV1@ABVTDesC8@@@Z @ 135 NONAME ; class CUpnpProtocolInfo * CUpnpProtocolInfo::NewL(class TDesC8 const &)
+	?SetOpParameterL@CUpnpDlnaProtocolInfo@@QAEXABVTDesC8@@@Z @ 136 NONAME ; void CUpnpDlnaProtocolInfo::SetOpParameterL(class TDesC8 const &)
+	?SetOtherParamL@CUpnpDlnaProtocolInfo@@QAEXABVTDesC8@@@Z @ 137 NONAME ; void CUpnpDlnaProtocolInfo::SetOtherParamL(class TDesC8 const &)
+	?FirstField@CUpnpProtocolInfo@@QAE?AVTPtrC8@@XZ @ 138 NONAME ; class TPtrC8 CUpnpProtocolInfo::FirstField(void)
+	?SetFourthFieldL@CUpnpProtocolInfo@@QAEXABVTDesC8@@@Z @ 139 NONAME ; void CUpnpProtocolInfo::SetFourthFieldL(class TDesC8 const &)
+	?SetFlagsParameterL@CUpnpDlnaProtocolInfo@@QAEXABVTDesC8@@@Z @ 140 NONAME ; void CUpnpDlnaProtocolInfo::SetFlagsParameterL(class TDesC8 const &)
+	?SetPsParameterL@CUpnpDlnaProtocolInfo@@QAEXABVTDesC8@@@Z @ 141 NONAME ; void CUpnpDlnaProtocolInfo::SetPsParameterL(class TDesC8 const &)
+	?PnParameter@CUpnpDlnaProtocolInfo@@QAE?AVTPtrC8@@XZ @ 142 NONAME ; class TPtrC8 CUpnpDlnaProtocolInfo::PnParameter(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/eabi/upnpavobjectsU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,181 @@
+EXPORTS
+	_ZN11CUpnpObject11AddElementLEP12CUpnpElement @ 1 NONAME
+	_ZN11CUpnpObject11GetElementsEv @ 2 NONAME
+	_ZN11CUpnpObject12AddResourceLERK7TDesC16RK6TDesC8 @ 3 NONAME
+	_ZN11CUpnpObject12SetParentIdLERK6TDesC8 @ 4 NONAME
+	_ZN11CUpnpObject13SetRestrictedEi @ 5 NONAME
+	_ZN11CUpnpObject14RemoveElementLEPK12CUpnpElement @ 6 NONAME
+	_ZN11CUpnpObject14SetWriteStatusEi @ 7 NONAME
+	_ZN11CUpnpObject15SetObjectClassLERK6TDesC8 @ 8 NONAME
+	_ZN11CUpnpObject5CopyLERKS_ @ 9 NONAME
+	_ZN11CUpnpObject6SetIdLERK6TDesC8 @ 10 NONAME
+	_ZN11CUpnpObject9SetTitleLERK6TDesC8 @ 11 NONAME
+	_ZN11CUpnpObjectD0Ev @ 12 NONAME
+	_ZN11CUpnpObjectD1Ev @ 13 NONAME
+	_ZN11CUpnpObjectD2Ev @ 14 NONAME
+	_ZN12CUpnpElement12InternalizeLER11RReadStream @ 15 NONAME
+	_ZN12CUpnpElement12SetFilePathLERK7TDesC16 @ 16 NONAME
+	_ZN12CUpnpElement13AddAttributeLEP14CUpnpAttribute @ 17 NONAME
+	_ZN12CUpnpElement13GetAttributesEv @ 18 NONAME
+	_ZN12CUpnpElement13SetIsRequiredEi @ 19 NONAME
+	_ZN12CUpnpElement16RemoveAttributeLEPK14CUpnpAttribute @ 20 NONAME
+	_ZN12CUpnpElement4NewLERK6TDesC8 @ 21 NONAME
+	_ZN12CUpnpElement5CopyLERKS_ @ 22 NONAME
+	_ZN12CUpnpElement5NewLCERK6TDesC8 @ 23 NONAME
+	_ZN12CUpnpElement8SetNameLERK6TDesC8 @ 24 NONAME
+	_ZN12CUpnpElement9SetValueLERK6TDesC8 @ 25 NONAME
+	_ZN13CUpnpItemList13AppendObjectLER11CUpnpObject @ 26 NONAME
+	_ZN13CUpnpItemList4NewLEv @ 27 NONAME
+	_ZN13CUpnpItemList5NewLCEv @ 28 NONAME
+	_ZN14CUpnpAttribute4NewLERK6TDesC8 @ 29 NONAME
+	_ZN14CUpnpAttribute5NewLCERK6TDesC8 @ 30 NONAME
+	_ZN14CUpnpAttribute8SetNameLERK6TDesC8 @ 31 NONAME
+	_ZN14CUpnpAttribute9SetValueLERK6TDesC8 @ 32 NONAME
+	_ZN14CUpnpAttributeC1Ev @ 33 NONAME
+	_ZN14CUpnpAttributeC2Ev @ 34 NONAME
+	_ZN14CUpnpContainer10FindObjectERK6TDesC8 @ 35 NONAME
+	_ZN14CUpnpContainer11ObjectCountEv @ 36 NONAME
+	_ZN14CUpnpContainer12InternalizeLER11RReadStream @ 37 NONAME
+	_ZN14CUpnpContainer13AppendObjectLER11CUpnpObject @ 38 NONAME
+	_ZN14CUpnpContainer13RemoveObjectLERK6TDesC8 @ 39 NONAME
+	_ZN14CUpnpContainer4NewLEv @ 40 NONAME
+	_ZN14CUpnpContainerixEi @ 41 NONAME
+	_ZN15CUpnpObjectList10FindObjectERK6TDesC8 @ 42 NONAME
+	_ZN15CUpnpObjectList12InternalizeLER11RReadStream @ 43 NONAME
+	_ZN15CUpnpObjectList13AppendObjectLER11CUpnpObject @ 44 NONAME
+	_ZN15CUpnpObjectList16RemoveAndDestroyERK6TDesC8 @ 45 NONAME
+	_ZN15CUpnpObjectList4NewLEv @ 46 NONAME
+	_ZN15CUpnpObjectList5NewLCEv @ 47 NONAME
+	_ZN15CUpnpObjectList6RemoveERK6TDesC8 @ 48 NONAME
+	_ZN18CUpnpContainerList13AppendObjectLER11CUpnpObject @ 49 NONAME
+	_ZN18CUpnpContainerList4NewLEv @ 50 NONAME
+	_ZN18CUpnpContainerList5NewLCEv @ 51 NONAME
+	_ZN19CUpnpBrowseCriteria10SetFilterLERK6TDesC8 @ 52 NONAME
+	_ZN19CUpnpBrowseCriteria12InternalizeLER11RReadStream @ 53 NONAME
+	_ZN19CUpnpBrowseCriteria16SetStartingIndexEi @ 54 NONAME
+	_ZN19CUpnpBrowseCriteria17SetRequestedCountEi @ 55 NONAME
+	_ZN19CUpnpBrowseCriteria4NewLERK6TDesC8 @ 56 NONAME
+	_ZN19CUpnpBrowseCriteria5CopyLERKS_ @ 57 NONAME
+	_ZN19CUpnpBrowseCriteria5NewLCERK6TDesC8 @ 58 NONAME
+	_ZN22CUpnpFileTransferEvent10TransferIdEv @ 59 NONAME
+	_ZN22CUpnpFileTransferEvent12InternalizeLER11RReadStream @ 60 NONAME
+	_ZN22CUpnpFileTransferEvent12SetDirectionENS_10TDirectionE @ 61 NONAME
+	_ZN22CUpnpFileTransferEvent12SetErrorCodeEi @ 62 NONAME
+	_ZN22CUpnpFileTransferEvent12SetFilePathLERK7TDesC16 @ 63 NONAME
+	_ZN22CUpnpFileTransferEvent13ProgressStateEv @ 64 NONAME
+	_ZN22CUpnpFileTransferEvent13SetTransferIdEi @ 65 NONAME
+	_ZN22CUpnpFileTransferEvent16SetProgressStateENS_14TProgressStateE @ 66 NONAME
+	_ZN22CUpnpFileTransferEvent24ContentDirectoryObjectIdEv @ 67 NONAME
+	_ZN22CUpnpFileTransferEvent27SetContentDirectoryObjectIdEi @ 68 NONAME
+	_ZN22CUpnpFileTransferEvent4NewLEv @ 69 NONAME
+	_ZN22CUpnpFileTransferEvent5NewLCEv @ 70 NONAME
+	_ZN22CUpnpFileTransferEvent6CloneLEv @ 71 NONAME
+	_ZN22CUpnpFileTransferEvent8FilePathEv @ 72 NONAME
+	_ZN22CUpnpFileTransferEvent9DirectionEv @ 73 NONAME
+	_ZN22CUpnpFileTransferEvent9ErrorCodeEv @ 74 NONAME
+	_ZN25CUpnpMediaServerEventList12InternalizeLER11RReadStream @ 75 NONAME
+	_ZN25CUpnpMediaServerEventList15GetPointerArrayEv @ 76 NONAME
+	_ZN26CUpnpFileTransferEventList4NewLEv @ 77 NONAME
+	_ZN26CUpnpFileTransferEventList5NewLCEv @ 78 NONAME
+	_ZN9CUpnpItem12InternalizeLER11RReadStream @ 79 NONAME
+	_ZN9CUpnpItem4NewLEv @ 80 NONAME
+	_ZN9CUpnpItem9SetRefIdLERK6TDesC8 @ 81 NONAME
+	_ZN9CUpnpItemD0Ev @ 82 NONAME
+	_ZN9CUpnpItemD1Ev @ 83 NONAME
+	_ZN9CUpnpItemD2Ev @ 84 NONAME
+	_ZNK11CUpnpObject10RestrictedEv @ 85 NONAME
+	_ZNK11CUpnpObject11ObjectClassEv @ 86 NONAME
+	_ZNK11CUpnpObject11WriteStatusEv @ 87 NONAME
+	_ZNK11CUpnpObject2IdEv @ 88 NONAME
+	_ZNK11CUpnpObject5TitleEv @ 89 NONAME
+	_ZNK11CUpnpObject7ToDes8LEv @ 90 NONAME
+	_ZNK11CUpnpObject8ParentIdEv @ 91 NONAME
+	_ZNK12CUpnpElement10IsRequiredEv @ 92 NONAME
+	_ZNK12CUpnpElement12ExternalizeLER12RWriteStream @ 93 NONAME
+	_ZNK12CUpnpElement4NameEv @ 94 NONAME
+	_ZNK12CUpnpElement5ValueEv @ 95 NONAME
+	_ZNK12CUpnpElement8FilePathEv @ 96 NONAME
+	_ZNK14CUpnpAttribute4NameEv @ 97 NONAME
+	_ZNK14CUpnpAttribute5ValueEv @ 98 NONAME
+	_ZNK14CUpnpContainer12ExternalizeLER12RWriteStream @ 99 NONAME
+	_ZNK15CUpnpObjectList10IdsToDes8LEv @ 100 NONAME
+	_ZNK15CUpnpObjectList11ObjectCountEv @ 101 NONAME
+	_ZNK15CUpnpObjectList12ExternalizeLER12RWriteStream @ 102 NONAME
+	_ZNK15CUpnpObjectList7ToDes8LEv @ 103 NONAME
+	_ZNK15CUpnpObjectListixEi @ 104 NONAME
+	_ZNK19CUpnpBrowseCriteria12ExternalizeLER12RWriteStream @ 105 NONAME
+	_ZNK19CUpnpBrowseCriteria13StartingIndexEv @ 106 NONAME
+	_ZNK19CUpnpBrowseCriteria14RequestedCountEv @ 107 NONAME
+	_ZNK19CUpnpBrowseCriteria6FilterEv @ 108 NONAME
+	_ZNK19CUpnpBrowseCriteria7ToDes8LEv @ 109 NONAME
+	_ZNK22CUpnpFileTransferEvent12ExternalizeLER12RWriteStream @ 110 NONAME
+	_ZNK25CUpnpMediaServerEventList12ExternalizeLER12RWriteStream @ 111 NONAME
+	_ZNK25CUpnpMediaServerEventList7ToDes8LEv @ 112 NONAME
+	_ZNK9CUpnpItem12ExternalizeLER12RWriteStream @ 113 NONAME
+	_ZNK9CUpnpItem5RefIdEv @ 114 NONAME
+	_ZTI11CUpnpObject @ 115 NONAME ; #<TI>#
+	_ZTI12CUpnpElement @ 116 NONAME ; #<TI>#
+	_ZTI13CUpnpItemList @ 117 NONAME ; #<TI>#
+	_ZTI14CUpnpAttribute @ 118 NONAME ; #<TI>#
+	_ZTI14CUpnpContainer @ 119 NONAME ; #<TI>#
+	_ZTI15CUpnpObjectList @ 120 NONAME ; #<TI>#
+	_ZTI18CUpnpContainerList @ 121 NONAME ; #<TI>#
+	_ZTI19CUpnpBrowseCriteria @ 122 NONAME ; #<TI>#
+	_ZTI21CUpnpMediaServerEvent @ 123 NONAME ; #<TI>#
+	_ZTI22CUpnpFileTransferEvent @ 124 NONAME ; #<TI>#
+	_ZTI25CUpnpMediaServerEventList @ 125 NONAME ; #<TI>#
+	_ZTI26CUpnpFileTransferEventList @ 126 NONAME ; #<TI>#
+	_ZTI9CUpnpItem @ 127 NONAME ; #<TI>#
+	_ZTV11CUpnpObject @ 128 NONAME ; #<VT>#
+	_ZTV12CUpnpElement @ 129 NONAME ; #<VT>#
+	_ZTV13CUpnpItemList @ 130 NONAME ; #<VT>#
+	_ZTV14CUpnpAttribute @ 131 NONAME ; #<VT>#
+	_ZTV14CUpnpContainer @ 132 NONAME ; #<VT>#
+	_ZTV15CUpnpObjectList @ 133 NONAME ; #<VT>#
+	_ZTV18CUpnpContainerList @ 134 NONAME ; #<VT>#
+	_ZTV19CUpnpBrowseCriteria @ 135 NONAME ; #<VT>#
+	_ZTV21CUpnpMediaServerEvent @ 136 NONAME ; #<VT>#
+	_ZTV22CUpnpFileTransferEvent @ 137 NONAME ; #<VT>#
+	_ZTV25CUpnpMediaServerEventList @ 138 NONAME ; #<VT>#
+	_ZTV26CUpnpFileTransferEventList @ 139 NONAME ; #<VT>#
+	_ZTV9CUpnpItem @ 140 NONAME ; #<VT>#
+	_ZN17CUpnpProtocolInfo10FirstFieldEv @ 141 NONAME
+	_ZN17CUpnpProtocolInfo10ThirdFieldEv @ 142 NONAME
+	_ZN17CUpnpProtocolInfo11FourthFieldEv @ 143 NONAME
+	_ZN17CUpnpProtocolInfo11SecondFieldEv @ 144 NONAME
+	_ZN17CUpnpProtocolInfo13ProtocolInfoLEv @ 145 NONAME
+	_ZN17CUpnpProtocolInfo14SetFirstFieldLERK6TDesC8 @ 146 NONAME
+	_ZN17CUpnpProtocolInfo14SetThirdFieldLERK6TDesC8 @ 147 NONAME
+	_ZN17CUpnpProtocolInfo15SetFourthFieldLERK6TDesC8 @ 148 NONAME
+	_ZN17CUpnpProtocolInfo15SetSecondFieldLERK6TDesC8 @ 149 NONAME
+	_ZN17CUpnpProtocolInfo4NewLERK6TDesC8 @ 150 NONAME
+	_ZN17CUpnpProtocolInfo4NewLEv @ 151 NONAME
+	_ZN21CUpnpDlnaProtocolInfo11CiParameterEv @ 152 NONAME
+	_ZN21CUpnpDlnaProtocolInfo11FourthFieldEv @ 153 NONAME
+	_ZN21CUpnpDlnaProtocolInfo11OpParameterEN20UpnpDlnaProtocolInfo11TDlnaParamsE @ 154 NONAME
+	_ZN21CUpnpDlnaProtocolInfo11PnParameterEv @ 155 NONAME
+	_ZN21CUpnpDlnaProtocolInfo11PsParameterEv @ 156 NONAME
+	_ZN21CUpnpDlnaProtocolInfo11SetDlnaFlagEN20UpnpDlnaProtocolInfo10TDlnaFlagsEi @ 157 NONAME
+	_ZN21CUpnpDlnaProtocolInfo12OpParameterLEv @ 158 NONAME
+	_ZN21CUpnpDlnaProtocolInfo14GetOtherParamsEv @ 159 NONAME
+	_ZN21CUpnpDlnaProtocolInfo14SetCiParameterEi @ 160 NONAME
+	_ZN21CUpnpDlnaProtocolInfo14SetOtherParamLERK6TDesC8 @ 161 NONAME
+	_ZN21CUpnpDlnaProtocolInfo15FlagsParameterLEv @ 162 NONAME
+	_ZN21CUpnpDlnaProtocolInfo15SetOpParameterLEN20UpnpDlnaProtocolInfo11TDlnaParamsEi @ 163 NONAME
+	_ZN21CUpnpDlnaProtocolInfo15SetOpParameterLERK6TDesC8 @ 164 NONAME
+	_ZN21CUpnpDlnaProtocolInfo15SetPnParameterLERK6TDesC8 @ 165 NONAME
+	_ZN21CUpnpDlnaProtocolInfo15SetPsParameterLERK6TDesC8 @ 166 NONAME
+	_ZN21CUpnpDlnaProtocolInfo18SetFlagsParameterLERK6TDesC8 @ 167 NONAME
+	_ZN21CUpnpDlnaProtocolInfo4NewLERK6TDesC8 @ 168 NONAME
+	_ZN21CUpnpDlnaProtocolInfo4NewLEv @ 169 NONAME
+	_ZN21CUpnpDlnaProtocolInfo8DlnaFlagEN20UpnpDlnaProtocolInfo10TDlnaFlagsE @ 170 NONAME
+	_ZN22CUpnpProtocolInfoLocal4NewLERK6TDesC8 @ 171 NONAME
+	_ZN22CUpnpProtocolInfoLocal4NewLERK6TDesC8S2_ @ 172 NONAME
+	_ZN22CUpnpProtocolInfoLocal4NewLERK6TDesC8i @ 173 NONAME
+	_ZTI17CUpnpProtocolInfo @ 174 NONAME ; #<TI>#
+	_ZTI21CUpnpDlnaProtocolInfo @ 175 NONAME ; #<TI>#
+	_ZTI22CUpnpProtocolInfoLocal @ 176 NONAME ; #<TI>#
+	_ZTV17CUpnpProtocolInfo @ 177 NONAME ; #<VT>#
+	_ZTV21CUpnpDlnaProtocolInfo @ 178 NONAME ; #<VT>#
+	_ZTV22CUpnpProtocolInfoLocal @ 179 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/group/avobjects.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,69 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification file for UPnPObjects library.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGETTYPE      DLL
+// Build target
+TARGET          upnpavobjects.dll
+UID             0x1000008D 0x10208A13
+
+
+VERSION 10.1
+paged
+
+// Platform security
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// Include paths
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+
+// Sources
+SOURCEPATH      ../src
+SOURCE          upnpobject.cpp
+SOURCE          upnpcontainer.cpp
+SOURCE          upnpitem.cpp
+SOURCE          upnpitemlist.cpp
+SOURCE          upnpelement.cpp
+SOURCE          upnpattribute.cpp
+SOURCE          upnpbrowsecriteria.cpp
+SOURCE          upnpobjectlist.cpp
+SOURCE          upnpcontainerlist.cpp
+SOURCE          upnpfiletransferevent.cpp
+SOURCE          upnpfiletransfereventlist.cpp
+SOURCE          upnpmediaserverevent.cpp
+SOURCE          upnpmediaservereventlist.cpp
+SOURCE          upnpdlnaprotocolinfo.cpp
+SOURCE          upnpprotocolinfo.cpp
+SOURCE          upnpprotocolinfolocal.cpp
+
+
+// Libraries
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         charconv.lib // for UTF8 encoding
+DEFFILE         upnpavobjects
+
+// Logging
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,31 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for the UPnPLibrary component
+*
+*/
+
+PRJ_PLATFORMS
+// No requirements
+
+PRJ_EXPORTS
+../inc/upnpfiletransfereventlist.h  |../../inc/upnpfiletransfereventlist.h
+../inc/upnpmediaservereventlist.h   |../../inc/upnpmediaservereventlist.h
+../inc/upnpprotocolinfolocal.h      |../../../inc/upnpprotocolinfolocal.h
+../inc/upnpcustomlog.h              |../../inc/upnpcustomlog.h
+
+PRJ_MMPFILES
+avobjects.mmp
+
+PRJ_TESTEXPORTS
+// None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/inc/upnpcustomlog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,294 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares Logger Functions
+*
+*/
+
+
+
+
+
+#ifndef C_UPNPCUSTOMLOG_H
+#define C_UPNPCUSTOMLOG_H
+
+#include <flogger.h>
+#include <e32svr.h>
+
+// UPNP_LOG :
+//1 - logging, UDEB
+//0 - no logging, UREL
+
+//UPNP_FLOGGING = file logging, default in UDEB
+//UPNP_CLOGGING = console logging
+
+
+#ifndef _DEBUG
+    // UREL
+    #define UPNP_LOG  0   // No logging in UREL builds
+
+#else
+
+    // UDEB
+    #define UPNP_LOG  1
+    #define UPNP_FLOGGING //File logger
+    //#define UPNP_CLOGGING //console logger
+
+    _LIT(KEventLogFile, "EventActionLog.txt");
+    // If log file is not defined in CPP file, use UPnPStackLog as default
+    #ifndef KLogFile
+        #define KLogFile _L("UPnPStack.txt")
+    #endif
+
+#endif
+
+_LIT(KLogFolder,"upnp");
+const TInt KMaxLogLen = 256;
+//_LIT(KLogFile, LOG_FILE);
+
+// Writing some descriptor into log
+// LOGT(own_desc);
+//
+// Writing data into log
+// LOGS("My log string");
+//
+// Writing data with one decimal parameter
+// LOGS1("Log with decimal parameter %i", desimalValue);
+//
+// Writing data with one decimal and hexa parameter
+// LOGS2("Log with decimal and hexa parameters %i %x", desimalValue, hexaValue);
+//
+// Writing data with one descriptor and decimal parameters
+// LOGS2("String %S and decimal value %i", &stringData, decimalValue);
+//
+// Writing User::AllocSize
+// LOGM;
+
+#if UPNP_LOG == 1
+
+#ifdef UPNP_FLOGGING
+
+static void DoOutput(TDesC8& aData)
+    {
+    if(!aData.Length())
+        {
+        return;
+        }
+    RFileLogger logger;
+    logger.Connect();
+
+    logger.CreateLog( KLogFolder(), KLogFile, EFileLoggingModeAppend);
+    logger.Write( aData.Mid(0,(aData.Length()<KMaxLogLen)? aData.Length():KMaxLogLen) );
+
+    logger.CloseLog();
+    logger.Close();
+    }
+
+static void DebugStringNarrowL(const char* aFmt, ...)
+    {
+    VA_LIST args;
+    VA_START(args, aFmt);
+
+    TPtrC8 fmt(reinterpret_cast<const unsigned char *>(aFmt));
+
+    HBufC8* buf = HBufC8::NewLC(KMaxLogLen);
+
+    buf->Des().FormatList(fmt, args);
+    DoOutput(*buf);
+
+    VA_END(args);
+    CleanupStack::PopAndDestroy(buf);
+    }
+
+static void DebugStringWideL(const char* aFmt, ...)
+    {
+    VA_LIST args;
+    VA_START(args, aFmt);
+
+    TPtrC8 fmt(reinterpret_cast<const unsigned char *>(aFmt));
+
+    HBufC* fmt16 = HBufC::NewLC(fmt.Length());
+    fmt16->Des().Copy(fmt);
+
+    HBufC* buf = HBufC::NewLC(KMaxLogLen);
+    TPtrC pointer = fmt16->Des() ;
+    buf->Des().FormatList(pointer, args);
+
+    HBufC8* buf8 = HBufC8::NewLC(buf->Length());
+    buf8->Des().Copy(*buf);
+
+    DoOutput(*buf8);
+
+    VA_END(args);
+
+    CleanupStack::PopAndDestroy(buf8);
+    CleanupStack::PopAndDestroy(buf);
+    CleanupStack::PopAndDestroy(fmt16);
+    }
+
+
+static void DebugBufferL(const TDesC8& aBuf)
+    {
+    DebugStringNarrowL("\"%S\"", &aBuf);
+    }
+
+static void DebugBufferL(const TDesC& aBuf)
+    {
+    DebugStringWideL("\"%S\"", &aBuf);
+    }
+
+static void DebugTimeL()
+    {
+    TTime time;
+    time.UniversalTime();
+
+    TBuf<64> dateTimeString;
+
+    _LIT(KTimeString, "%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B");
+    time.FormatL(dateTimeString, KTimeString);
+    DebugBufferL(dateTimeString);
+
+    }
+
+
+// ------------ Content Directory logging specific ---------------
+_LIT(KInfoFormatString, "INFO#%S#%S#%d#%S");
+_LIT(KErrFormatString, "ERROR#%S#%S#%d#%S");
+
+static void LOGCD(const char* aInFunction, const char* aCalledFunction, TInt aErrorCode, const char* aComment)
+{
+    // Transforming parameters from 'const char *' into 'HBufC'
+    TPtrC8 InFunction8(reinterpret_cast<const unsigned char *>(aInFunction));
+    HBufC* InFunction16 = HBufC::NewLC(128);
+    InFunction16->Des().Copy(InFunction8);
+
+    TPtrC8 CalledFunction8(reinterpret_cast<const unsigned char *>(aCalledFunction));
+    HBufC* CalledFunction16 = HBufC::NewLC(128);
+    CalledFunction16->Des().Copy(CalledFunction8);
+
+    TPtrC8 Comment8(reinterpret_cast<const unsigned char *>(aComment));
+    HBufC* Comment16 = HBufC::NewLC(128);
+    Comment16->Des().Copy(Comment8);
+
+    // preparing main 16bit buffer
+    HBufC* buf = HBufC::NewLC(KMaxLogLen);
+
+    // formating all together in 16bit descriptor
+    if(aErrorCode < 0)
+    {
+        buf->Des().Format(KErrFormatString, &*InFunction16, &*CalledFunction16, aErrorCode, &*Comment16);
+    }
+    else
+    {
+        buf->Des().Format(KInfoFormatString, &*InFunction16, &*CalledFunction16, aErrorCode, &*Comment16);
+    }
+
+    // converting 16bit descriptor into 8bit one
+    HBufC8* buf8 = HBufC8::NewLC(buf->Length());
+    buf8->Des().Copy(*buf);
+
+    // main file logging
+    DoOutput(*buf8);
+
+    // cleaning
+    CleanupStack::PopAndDestroy(buf8);
+    CleanupStack::PopAndDestroy(buf);
+    CleanupStack::PopAndDestroy(Comment16);
+    CleanupStack::PopAndDestroy(CalledFunction16);
+    CleanupStack::PopAndDestroy(InFunction16);
+}
+
+
+    #define LOGTIME DebugTimeL()
+    #define LOG(x) DebugStringNarrowL x
+    #define LOG8(x) DebugStringNarrowL x
+    #define LOG16(x) DebugStringWideL x
+
+    #define LOGT(A)
+    #define LOGS(A)      LOG16((A))
+    #define LOGS1(A,B)   LOG16((A,B))
+    #define LOGS2(A,B,C) LOG16((A,B,C))
+    #define LOGM
+
+    #define LOGTH(H,A)       LOGT(A)
+    #define LOGSH(H,A)       LOGS(A)
+    #define LOGS1H(H,A,B)    LOGS1(A,B)
+    #define LOGS2H(H,A,B,C)  LOGS2(A,B,C)
+
+    #define ACTIONSEND(A)
+    #define ACTIONRECV(A,B)
+
+static void LOGSQL(const char* aInFunction, const char* aCalledFunction, TInt aErrorCode, const TDesC* aCommand)
+{
+    LOGCD(aInFunction, aCalledFunction, aErrorCode, "SQL Command:");
+
+    // log whole sql command separately
+    LOGS1("%S", aCommand);
+}
+
+
+
+#else     // UPNP_CLOGGING = console logging
+    #define LOGS(A)      RDebug::Print(_L(A));
+    #define LOGS1(A,B)   RDebug::Print(_L(A),B);
+    #define LOGS2(A,B,C) RDebug::Print(_L(A),B,C);
+
+    #define LOGT(A)
+    #define LOGM
+    #define ACTIONSEND(A)
+    #define ACTIONRECV(A,B)
+
+    #define LOGTH(H,A)       LOGT(A)
+    #define LOGSH(H,A)       LOGS(A)
+    #define LOGS1H(H,A,B)    LOGS1(A,B)
+    #define LOGS2H(H,A,B,C)  LOGS2(A,B,C)
+    #define LOGCD(A,B,C,D)
+    #define LOGSQL(A,B,C,D)
+
+    #define LOGTIME
+    #define LOG(x)
+    #define LOG8(x)
+    #define LOG16(x)
+
+
+#endif //UPNP_LOG == 1
+
+#else // UPNP_LOG == 0 or invalid
+    #define LOGT(A)
+    #define LOGS(A)
+    #define LOGS1(A,B)
+    #define LOGS2(A,B,C)
+    #define LOGM
+    #define ACTIONSEND(A)
+    #define ACTIONRECV(A,B)
+
+    #define LOGTH(H,A)
+    #define LOGSH(H,A)
+    #define LOGS1H(H,A,B)
+    #define LOGS2H(H,A,B,C)
+
+    #define LOGCD(A,B,C,D)
+    #define LOGSQL(A,B,C,D)
+
+    #define LOGTIME
+    #define LOG(x)
+    #define LOG8(x)
+    #define LOG16(x)
+
+#endif // UPNP_LOG
+
+#define LOG_FUNC_NAME LOGS( __PRETTY_FUNCTION__ )
+
+#endif // C_UPNPCUSTOMLOG_H
+
+// End Of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/inc/upnpfiletransfereventlist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,84 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server file transfer event list
+*
+*/
+
+
+#ifndef C_UPNPFILETRANSFEREVENTLIST_H
+#define C_UPNPFILETRANSFEREVENTLIST_H
+
+// INCLUDES
+#include "upnpobject.h"
+#include "upnpmediaservereventlist.h"
+
+#include <e32base.h>
+#include <s32mem.h>
+
+
+
+
+
+
+
+
+
+
+// FORWARD DECLARATIONS
+class CUpnpMediaServerEventList;
+class CUpnpMediaServerEvent;
+
+
+// CLASS DECLARATION
+
+/**
+*  CUpnpFileTransferEventList class
+*
+*  @since Series 60 3.1
+*/
+class CUpnpFileTransferEventList : public CUpnpMediaServerEventList
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CUpnpFileTransferEventList* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CUpnpFileTransferEventList* NewLC();
+
+    /**
+     * Internalizes CUpnpFileTransferEventList class object
+     */
+    virtual void InternalizeSubTypeL( RReadStream& aStream );
+
+    /**
+     * Destructor.
+     */
+    ~CUpnpFileTransferEventList();
+
+private:
+
+    /**
+     * Constructor.
+     */
+    CUpnpFileTransferEventList();
+    };
+
+#endif      // C_UPNPFILETRANSFEREVENTLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/inc/upnpmediaservereventlist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,127 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server event list
+*
+*/
+
+
+#ifndef C_UPNPMEDIASERVEREVENTLIST_H
+#define C_UPNPMEDIASERVEREVENTLIST_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include "upnpobject.h"
+#include "upnpobject.h"
+#include "upnpmediaserverevent.h"
+
+
+
+
+
+
+
+// DATA TYPES
+typedef RPointerArray<CUpnpMediaServerEvent> RUpnpMediaServerEventList;
+
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+class CUpnpMediaServerEvent;
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for Media Server events lists
+*
+*  @since Series 60 3.1
+*/
+class CUpnpMediaServerEventList : public CBase
+    {
+public:  // Constructors and destructor
+
+
+
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpMediaServerEventList();
+
+public: // New functions
+
+    /**
+    * Serialize the whole list to a heap based descriptor.
+    * @since Series 60 3.0
+    * @return pointer to the descriptor where the list is serialized.
+    */
+    IMPORT_C HBufC8* ToDes8L() const;
+
+    /**
+    * Returns RPointerArray of the itemlist
+    * @since Series 60 3.0
+    * @param TBool indicating whether recursive count is needed
+    * @return TInt count information
+    */
+    IMPORT_C RUpnpMediaServerEventList& GetPointerArray( );
+
+public:
+
+    /**
+    * Externalizes itemlist information to stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.0
+    * @param reference to RWriteStream
+    * @return none
+    */
+    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+    /**
+    * Internalizes itemlist information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.0
+    * @param reference to RReadStream
+    * @return none
+    */
+    IMPORT_C void InternalizeL( RReadStream& aStream );
+
+protected:
+
+    /**
+    * Internalizes itemlist information from stream.
+    * Leaves in case of errors.
+    * @since Series 60 3.0
+    * @param reference to RReadStream
+    * @return none
+    */
+    virtual void InternalizeSubTypeL( RReadStream& aStream ) = 0;
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpMediaServerEventList();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL( );
+
+protected:
+    // items
+    RUpnpMediaServerEventList   iEvents;
+    };
+
+#endif      // C_UPNPMEDIASERVEREVENTLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/inc/upnpprotocolinfolocal.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,191 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares ProtocolInfo field wrapper. 
+*
+*/
+
+
+#ifndef C_CUPNPPROTOCOLINFOLOCAL_H
+#define C_CUPNPPROTOCOLINFOLOCAL_H
+
+#include <e32base.h>
+#include "upnpdlnaprotocolinfo.h"
+
+	_LIT8( KOneChar, "1" );
+	_LIT8( KZeroChar, "0" );
+
+	_LIT8( KDEFAULT_1ST_PARAM, "http-get");
+	_LIT8( KDEFAULT_STAR_PARAM, "*");
+
+	const char KDlnaDelimeter = ';';
+	const char KDlnaTokenizer = '=';
+	const char KDlnaAllStar = '*';
+
+	//Length of string from which should be serialized TInt into iDlnaFlags
+	const TInt KMAX_INT_LENGTH_STRING = 8 ;
+
+	// There are only 4 TInt32 or TUint32 flags serialized in DLNA.ORG_FLAGS parameter.
+	const TInt KDLNA_FLAGS_NUMBER = 4; 
+	//to represent the 32-byte-size of TUIn32
+	const TInt K32BIT = 32;
+	//number of all flags
+	const TInt KDLNA_FLAGS_QUANTITY = KDLNA_FLAGS_NUMBER * K32BIT;
+	
+	_LIT8(KAllValues, "*");
+
+	_LIT8( KDLNA_PN, "DLNA.ORG_PN");
+	_LIT8( KDLNA_OP, "DLNA.ORG_OP");
+	_LIT8( KDLNA_PS, "DLNA.ORG_PS");
+	_LIT8( KDLNA_CI, "DLNA.ORG_CI");
+	_LIT8( KDLNA_FLAGS, "DLNA.ORG_FLAGS");
+
+	const char KDLNA_BOOLEAN_FALSE = '0';
+	const char KDLNA_BOOLEAN_TRUE = '1';
+
+	enum ADDITIONAL_INFO
+		{
+		NO_DLNA_DATA = -1,
+		NO_ADDITIONAL_INFO = 0,
+		JPEG_SM = 1, 
+		JPEG_MED, 
+		JPEG_LRG,
+		JPEG_TN,	
+		JPEG_SM_ICO,
+		JPEG_LRG_ICO,
+		PNG_TN, 
+		PNG_SM_ICO,
+		PNG_LRG_ICO,
+		PNG_LRG, 
+		MP3, 
+		};
+
+	_LIT8(KMT_IMAGE_JPEG, "image/jpeg");
+	_LIT8(KMT_IMAGE_PNG, "image/png");
+	_LIT8(KMT_IMAGE_GIF, "image/gif");
+	_LIT8(KMT_IMAGE_BMP, "image/bmp");
+	_LIT8(KMT_AUDIO_MP3, "audio/mpeg");
+	_LIT8(KMT_TEXT_PLAIN, "text/plain");
+
+	_LIT8( KMimeImage,      "image" );		
+	_LIT8( KMimeAudio,      "audio" );
+	_LIT8( KMimeVideo,      "video" );
+
+	_LIT8(KDEFAULT_FOURTH_FIELD_OP_PATTERN, "*DLNA.ORG_OP=??*");
+	_LIT8(KDEFAULT_FOURTH_FIELD_AVIMAGE_PATTERN, "*DLNA.ORG_FLAGS=????????????????????????????????*");
+	
+class CUpnpProtocolInfoLocal: public CUpnpDlnaProtocolInfo
+{
+	
+	private:
+    	 /** 
+    	 * Constructor of the class     	 
+    	 */
+    	 CUpnpProtocolInfoLocal();
+
+	
+	public: 
+	
+    	 /**
+    	 * Destructor of the class. 
+    	 */
+    	 virtual ~CUpnpProtocolInfoLocal();	
+    	 
+    	 /**
+    	 * Method for creating instance of class. 
+    	 * aInputString has to contain protocolInfo string. 
+    	 */
+    	IMPORT_C static CUpnpProtocolInfoLocal* NewL(const TDesC8& aInputString);
+    	 
+    	 /**
+    	 * Creates Default value of ProtocolInfo containing DLNA.ORG_PN specific data. 
+    	 * aMimeType - name of mime type for file. 
+    	 * aAdditionalInfo - additional information about what DLNA.ORG_PN type should be used. 
+    	 * Default behaviour is choosen according to aMimeType, when aAdditionalInfo is equal to NO_ADDITIONAL_INFO.
+    	 * image/jpeg 	---- JPEG_LRG
+    	 * image/png  	---- PNG_LRG
+    	 * audio/mp3	---- MP3
+    	 * rest not defined. 
+    	 */
+    	IMPORT_C static CUpnpProtocolInfoLocal* NewL(const TDesC8& aMimeType, TInt aAdditionalInfo);
+    	IMPORT_C static CUpnpProtocolInfoLocal* NewL(const TDesC8& aMimeType, const TDesC8& aDlnaPn);
+	
+    //MEMBER METHODS used internally 	
+	private: 
+	
+    	 /**
+    	 *  Method for creating instance of class. 
+    	 * aInputString has to contain protocolInfo string. 
+    	 */
+    	 void ConstructL(const TDesC8& aInputString);	 	 
+    	 void ConstructFromDlnaPnL(const TDesC8& aMimeType, const TDesC8& aDlnaPn);	 
+    	 
+    	 /**
+    	 * Creates object for further use. 
+    	 * uses DefaultValue. 
+    	 * aMimeType - mime type will be compared case insensitive. 
+    	 * aAdditionalInfo - flag saying which specific DLNA.ORG_PN should be used. 
+    	 *   values taken from ADDITIONAL_INFO
+    	 */  
+    	 void ConstructL(const TDesC8& aMimeType, TInt aAdditionalInfo);
+	 
+	 private:
+	 
+    	 /**
+    	 * Main function for creating from mime type. 
+    	 * See ConstructL(TDesC8&, TInt)
+    	 */
+    	 void ChooseDlnaL(const TDesC8& aMimeType, TInt aAdditionalInfo);
+    	 		 
+    	 /**
+    	 * Fills up default values to create protocolInfo in form: "http-get:*:*:*"
+    	 */
+    	 void DefaultValuesL();
+    	 
+    	 /**
+    	 * Fills dlna parameters according only to additionalInfo which is int value. 
+    	 * aAdditionalInfo - int value denoting value which should be taken into consideration.
+    	 */
+    	 void FillAccordingToAddInfoL(TInt aAdditionalInfo);
+
+    	 /**
+    	 * Fills dlna parameters according only to info in mime type. 
+    	 * aMimeType - name of a mime type.
+    	 */
+    	 void FillAccordingToMimeL(const TDesC8& aMimeType);
+    	 
+    	 /**
+    	 * Does nothing.
+    	 */
+    	 void ZeroParameters();    
+    	 
+    	 /**
+    	 * This member function sets defult values for optional parameters 
+    	 * of 4-th field of protocolInfo 
+    	 * Value for Audio/Video:
+    	 * DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01500000000000000000000000000000
+    	 * Value for Image :
+    	 * DLNA.ORG_OP=01;DLNA.ORG_FLAGS=00D00000000000000000000000000000
+    	 *
+    	 */
+    	 void SetDefaultFourthField();     	     	 	 	 	 	 
+    	 
+    	 /**
+         * This function produces a string containing all info taken from fourth ProtocolInfo field    	 
+         * aBuffer - on this variable values are appended. 
+         */
+         virtual void GetFourthParameterInternalL(TDes8& aBuffer);     	 	 	 	 	 
+};
+
+#endif // C_CUPNPPROTOCOLINFOLOCAL_H
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpattribute.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,202 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnPAttribute implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpattribute.h"
+#include "upnpelement.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttribute::ConstructL(const TDesC8& aName)
+{
+    iName = aName.AllocL();
+    iValue = KNullDesC8().AllocL();
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpAttribute* CUpnpAttribute::NewLC(const TDesC8& aName)
+{
+    CUpnpAttribute* self = new( ELeave ) CUpnpAttribute;
+    CleanupStack::PushL( self );
+    self->ConstructL(aName);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpAttribute* CUpnpAttribute::NewL(const TDesC8& aName)
+{
+    CUpnpAttribute* self = NewLC(aName);
+    CleanupStack::Pop(self);
+    return self;
+}    
+
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::CUpnpAttribute
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpAttribute::CUpnpAttribute()
+    {
+    }
+
+// Destructor
+CUpnpAttribute::~CUpnpAttribute()
+    {
+    delete iName;
+    delete iValue;	
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::SetNameL
+// Sets name for the attribute.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAttribute::SetNameL( const TDesC8& aName )
+    {
+    HBufC8* tmp = aName.AllocL();
+    delete iName;
+    iName = tmp;    
+    }
+      
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::Name
+// Returns name of the attribute. If null, returns KNullDesC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpAttribute::Name() const
+    {
+    return *iName;   
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::SetValueL
+// Sets scope for the attribute.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpAttribute::SetValueL( const TDesC8& aValue )
+    {
+    HBufC8* tmp = aValue.AllocL();
+    delete iValue;
+    iValue = tmp;
+    }
+        
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::Value
+// Returns scope of the attribute. If null, returns KNullDesC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpAttribute::Value() const
+    {
+    return *iValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::ExternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttribute::ExternalizeL( RWriteStream& aStream ) const
+    {
+	TInt ExternalizationLength = MapItemNameToProperLength(*iName);
+
+	SafeExternalizeL(aStream, *iName, KMaxUpnpObjStringLen);
+	SafeExternalizeL(aStream, *iValue, ExternalizationLength);
+    }
+        
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::InternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttribute::InternalizeL( RReadStream& aStream )
+    {
+    delete iName;
+    iName = NULL;
+    iName = HBufC8::NewL( aStream, KMaxUpnpObjStringLen );
+	
+	TInt InternalizationLength = MapItemNameToProperLength(*iName);
+
+    
+    delete iValue;
+    iValue = NULL;
+    iValue = HBufC8::NewL( aStream, InternalizationLength );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::SafeExternalizeL
+// Writes safely aNumber of characters from the content to the stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttribute::SafeExternalizeL(RWriteStream& aStream, const TDesC8& aDesc, const TInt aNumber) const
+{	
+    if( aDesc.Length() > aNumber )    
+		aStream << aDesc.Mid(0, aNumber);
+    else
+		aStream << aDesc;    
+}	
+
+// -----------------------------------------------------------------------------
+// CUpnpAttribute::MapItemNameToProperLength
+// Counts how many bytes will be used for internalization
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAttribute::MapItemNameToProperLength(TDesC8& aItemName) const
+{
+	// Requirement [7.3.17.4]: The following metadata properties must not exceed 256 bytes each in the XML-escaped form encoded in UTF-8:
+	// - All length-unlimited DIDL-Lite schema defined attributes for <res>, except res@importUri.
+	if( aItemName == _L8("importUri") )
+    {
+		return KMaxUpnpObjLongStringLen; //1024		
+    }	
+	else if( aItemName == _L8("duration") ||
+			 aItemName == _L8("size") ||
+		     aItemName == _L8("resolution") ||
+		 	 aItemName == _L8("childCount")
+	)
+	{						
+		return KMaxUpnpObjStringLen; // 256
+	}
+	else
+	{
+		return KMaxUpnpObjStringLen; // 256
+	}
+}
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpbrowsecriteria.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,225 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnPBrowseCriteria implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpbrowsecriteria.h"
+#include "upnpattribute.h"
+#include "upnpobject.h"
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpBrowseCriteria::ConstructL(const TDesC8& aFilter)
+{
+    iFilter = aFilter.AllocL();
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpBrowseCriteria* CUpnpBrowseCriteria::NewLC(const TDesC8& aFilter)
+{
+    CUpnpBrowseCriteria* self = new( ELeave ) CUpnpBrowseCriteria;
+    CleanupStack::PushL( self );
+    self->ConstructL(aFilter);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpBrowseCriteria* CUpnpBrowseCriteria::NewL(const TDesC8& aFilter)
+{
+    CUpnpBrowseCriteria* self = NewLC(aFilter);
+    CleanupStack::Pop(self);
+    return self;
+}  
+  
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::CUpnpBrowseCriteria
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpBrowseCriteria::CUpnpBrowseCriteria()
+    {
+    }
+
+// Destructor
+CUpnpBrowseCriteria::~CUpnpBrowseCriteria()
+    {
+    delete iFilter;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::SetFilterL
+// Sets filter.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpBrowseCriteria::SetFilterL( const TDesC8& aFilter )
+    {
+    HBufC8* tmp = aFilter.AllocL();
+    delete iFilter;
+    iFilter = tmp;    
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::GetFilter
+// Returns filter. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpBrowseCriteria::Filter() const
+    {
+    return *iFilter;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::SetRequestCount
+// Sets request count.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpBrowseCriteria::SetRequestedCount( TInt aRequestedCount )
+    {
+    iRequestedCount=aRequestedCount;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::RequestedCount
+// Returns requested count
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpBrowseCriteria::RequestedCount() const
+    {
+    return iRequestedCount;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::SetStartingIndex
+// Sets starting index.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpBrowseCriteria::SetStartingIndex( TInt aStartingIndex)
+    {
+    iStartingIndex=aStartingIndex;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::StartingIndex
+// Returns starting index
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpBrowseCriteria::StartingIndex() const
+    {
+    return iStartingIndex;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::CopyL
+// Copies the content from parameter CUpnpElement to this
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpBrowseCriteria::CopyL( const CUpnpBrowseCriteria& aBrowseCriteria )
+    {
+    CBufFlat* buffer = CBufFlat::NewL( sizeof( aBrowseCriteria ) );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream outStream;
+    outStream.Open( *buffer );
+    CleanupClosePushL( outStream );
+    RBufReadStream inStream;
+    inStream.Open( *buffer );
+    CleanupClosePushL( inStream );
+    aBrowseCriteria.ExternalizeL( outStream );
+    InternalizeL( inStream );	
+    CleanupStack::PopAndDestroy( 3 );   // inStream && outStream && buffer
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::ExternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpBrowseCriteria::ExternalizeL( RWriteStream& aStream ) const
+    {
+        aStream << *iFilter;
+        aStream.WriteInt32L(RequestedCount());
+        aStream.WriteInt32L(StartingIndex());
+    }
+        
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::InternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpBrowseCriteria::InternalizeL( RReadStream& aStream )
+    {
+     
+    delete iFilter;
+    iFilter = NULL;
+    iFilter = HBufC8::NewL( aStream,KMaxUpnpObjStringLen);
+    
+    iRequestedCount=aStream.ReadInt32L();
+    iStartingIndex=aStream.ReadInt32L();
+    }
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCriteria::ToDes8L
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+EXPORT_C HBufC8* CUpnpBrowseCriteria::ToDes8L() const
+{
+    // serialize object
+    CBufFlat* buf = CBufFlat::NewL(KDefBufferGranularity);
+    CleanupStack::PushL(buf);
+    RBufWriteStream stream(*buf);
+    CleanupClosePushL(stream);
+    
+    stream << *this;
+    
+    // create heap descriptor
+    HBufC8* hbuf = HBufC8::NewLC(buf->Size());
+    TPtr8 ptr(hbuf->Des());
+    buf->Read(0, ptr, buf->Size());
+    
+    // clean up
+    CleanupStack::Pop(hbuf);
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    
+    return hbuf;
+}
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpcontainer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,197 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP container class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include    <upnpstring.h>
+#include    <e32base.h>
+#include    "upnpcontainer.h"
+#include    "upnpitem.h"
+#include    "upnpobjectlist.h"
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpContainer::CUpnpContainer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpContainer::CUpnpContainer()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContainer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpContainer::ConstructL(  )
+    {
+    CUpnpObject::ConstructL(  );
+    iObjects = CUpnpObjectList::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContainer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+
+EXPORT_C CUpnpContainer* CUpnpContainer::NewL()
+    {
+    CUpnpContainer* self = new( ELeave ) CUpnpContainer;
+
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+
+    return self;
+    }
+    
+// Destructor
+CUpnpContainer::~CUpnpContainer()
+    {
+    delete iObjects;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContainer::AppendObjectL
+// Appends object to internal array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContainer::AppendObjectL( CUpnpObject& aNewObject )
+    {
+    // Set the parent Id to this container 
+    aNewObject.SetParentIdL( Id() );
+    iObjects->AppendObjectL( aNewObject );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContainer::RemoveObjectL
+// Removes object from internal array according to ID.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContainer::RemoveObjectL( const TDesC8& aObjectId )
+    {
+    iObjects->RemoveAndDestroy(aObjectId);
+    }
+             
+// -----------------------------------------------------------------------------
+// CUpnpContainer::FindObject
+// Finds object from internal array according to id. Is recursive, so goes down
+// the object tree.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpObject* CUpnpContainer::FindObject( const TDesC8& aObjectId )
+    {
+    CUpnpObject* ret = NULL;
+    if ( Id() == aObjectId )
+        {
+        ret = this;
+        }
+    else
+        {
+        for (TInt i = 0; i < iObjects->ObjectCount(); i++ )
+            {
+            if ( (*iObjects)[i]->ObjectType() == EUPnPContainer )
+                {
+                // Containers can contain more stuff --> recursive action needed.
+                CUpnpObject* tmp = (static_cast<CUpnpContainer*>((*iObjects)[i]))
+                                    ->FindObject( aObjectId );
+                if ( tmp )
+                    {
+                    ret = tmp;
+                    break;
+                    }
+                }
+            else
+                {
+                // Need to check items
+                if ( (*iObjects)[i]->Id() == aObjectId )
+                    {
+                    ret = (*iObjects)[i];
+                    break;
+                    }
+                }
+            }
+        }
+    return ret;
+    }
+        
+// -----------------------------------------------------------------------------
+// CUpnpContainer::ObjectCount
+// Counts objects (including containers) from the object tree (recursive / not 
+// recursive)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpContainer::ObjectCount()
+    {
+    return iObjects->ObjectCount();
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpContainer::ExternalizeL
+// Writes the content to stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContainer::ExternalizeL( RWriteStream& aStream ) const
+    {
+    BaseExternalizeL( aStream );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContainer::InternalizeL
+// Fills container information from stream
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+EXPORT_C void CUpnpContainer::InternalizeL( RReadStream& aStream )
+    {
+    BaseInternalizeL( aStream );
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpContainer::ObjectType
+// Returns item-type
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUPnPObjectType CUpnpContainer::ObjectType() const
+    {
+    return EUPnPContainer;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContainer::ObjectType
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpObject* CUpnpContainer::operator[](TInt aIndex)
+    {
+    return (*iObjects)[aIndex];
+    }
+  
+   
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpcontainerlist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,103 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP container class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include	"upnpobject.h"
+#include    "upnpcontainerlist.h"
+
+
+
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpContainerList::CUpnpContainerList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpContainerList::CUpnpContainerList()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContainerList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpContainerList::ConstructL( )
+    {
+    CUpnpObjectList::ConstructL();
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpContainerList::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpContainerList* CUpnpContainerList::NewL()
+    {
+    CUpnpContainerList* self = NewLC();
+    CleanupStack::Pop(self);
+
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContainerList::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpContainerList* CUpnpContainerList::NewLC()
+    {
+    CUpnpContainerList* self = new( ELeave ) CUpnpContainerList;
+
+    CleanupStack::PushL( self );
+    self->ConstructL(  );
+
+    return self;
+    }
+      
+// -----------------------------------------------------------------------------
+// CUpnpItemList::~CUpnpContainerList
+// -----------------------------------------------------------------------------
+//
+CUpnpContainerList::~CUpnpContainerList()
+    {
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContainerList::AppendObjectL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContainerList::AppendObjectL( CUpnpObject& aNewObject )
+    {
+    // leave if not an item
+    if(aNewObject.ObjectType() != EUPnPContainer)
+        {
+        User::Leave(KErrArgument);
+        }
+
+    CUpnpObjectList::AppendObjectL(aNewObject);
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpdlnaprotocolinfo.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,865 @@
+/** @file
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ProtocolInfo DLNA functionality class 
+*
+*/
+
+
+#include "upnpdlnaprotocolinfo.h"
+#include "upnpdlnaprotocolinfocons.h"
+#include "upnpprotocolinfolocal.h"
+
+#include <e32base.h>
+#include <e32cons.h>
+
+using namespace UpnpDlnaProtocolInfo;
+
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::CProtocolInfoDlna()
+//  Constructor of the class
+//-----------------------------------------------------------------
+CUpnpDlnaProtocolInfo::CUpnpDlnaProtocolInfo(): CUpnpProtocolInfo(),
+                                            iDlnaCi( KErrNotFound ) 
+    {    
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::~CProtocolInfoDlna()
+//  Destructor of the class
+//-----------------------------------------------------------------
+CUpnpDlnaProtocolInfo::~CUpnpDlnaProtocolInfo()
+    {    
+    delete iDlnaPn; 
+    delete iDlnaPs; 
+    delete iOtherParams;
+    delete iFlagsParam;
+    delete iOpParam;
+    }
+
+
+//-----------------------------------------------------------------
+// CProtocolInfoDlna::NewL
+// Factory method for creating instance of class. aInputString must contain protocolInfo string.
+//-----------------------------------------------------------------
+EXPORT_C CUpnpDlnaProtocolInfo* CUpnpDlnaProtocolInfo::NewL()
+    {
+    CUpnpDlnaProtocolInfo* newElement = new (ELeave) CUpnpDlnaProtocolInfo();
+    CleanupStack::PushL( newElement );
+    CleanupStack::Pop( newElement );
+    return newElement; 
+    }
+
+    
+//-----------------------------------------------------------------
+// CProtocolInfoDlna::NewL
+// Factory method for creating instance of class. aInputString must contain protocolInfo string.
+//-----------------------------------------------------------------
+EXPORT_C CUpnpDlnaProtocolInfo* CUpnpDlnaProtocolInfo::NewL(const TDesC8& aInputString)
+    {
+    CUpnpDlnaProtocolInfo* newElement = new (ELeave) CUpnpDlnaProtocolInfo();
+    CleanupStack::PushL( newElement );
+    newElement->BaseConstructL( aInputString );     
+    CleanupStack::Pop( newElement );
+    return newElement; 
+    }
+    
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ConstructL(TDesC8& aInputString)
+//  Method for creating instance of class. aInputString must contain protocolInfo string.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::ConstructL(const TDesC8& aInputString) 
+    {
+    BaseConstructL(aInputString);
+    
+    TInt result = ParseL( aInputString );
+    if ( result != KErrNone ) 
+        {
+        User::Leave( result );            
+        }
+    }
+
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetOpTimeParam(TBool aValue)
+//  Setter for DLNA.ORG_OP time seek parameter.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::SetOpTimeParam(TBool aValue)
+    {
+    SetDlnaParam( aValue, A_VAL );
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetOpRangeParam(TBool aValue)
+//  Setter for DLNA.ORG_OP range seek parameter.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::SetOpRangeParam(TBool aValue)
+    {
+    return SetDlnaParam( aValue, B_VAL );
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetDlnaFlag(TBool aValue, TInt aFlagIndex)
+//  Setter for DLNA_FLAGS
+//-----------------------------------------------------------------
+void  CUpnpDlnaProtocolInfo::SetDlnaFlag(TBool aValue, TUint8 aFlagIndex)
+    {
+    if ( aFlagIndex >= KDLNA_FLAGS_QUANTITY) return;
+    TInt index = aFlagIndex / K32BIT;
+    SetIntBit32((TUint32&) iDlnaFlags[ index ], aValue, aFlagIndex);
+    }    
+    
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::GetDlnaFlag(TInt aFlagIndex)
+//  Getter for DLNA_FLAGS
+//-----------------------------------------------------------------
+TBool CUpnpDlnaProtocolInfo::GetDlnaFlag(TInt aFlagIndex)
+    {
+    if ( aFlagIndex >= KDLNA_FLAGS_QUANTITY ) return EFalse;
+    TUint8 index = aFlagIndex / K32BIT;
+    TUint8 bit_index = aFlagIndex % K32BIT;
+    TUint32 bit = 1<<bit_index;    
+    if ( iDlnaFlags[ index ]  & bit )
+        {
+        return ETrue;
+        }
+    else 
+        {
+        return EFalse;
+        }
+    
+    }        
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ParseL(TDesC8& aInputString)
+//  Parses aInputString into protocolInfo object.
+//-----------------------------------------------------------------
+TInt CUpnpDlnaProtocolInfo::ParseL(const TDesC8& aInputString)
+    {
+        TInt result = KErrNone;        
+        CUpnpProtocolInfo::ParseL(aInputString);
+        
+        result = ParseForthParameterL();
+        if ( iDlnaPn != NULL)
+            {
+            delete iFourthParameter; 
+            iFourthParameter = NULL;
+            }
+        return result;        
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ParseForthParameterL()
+//  Parses the fourth field.
+//-----------------------------------------------------------------
+TInt CUpnpDlnaProtocolInfo::ParseForthParameterL()
+    {
+    HBufC8* forth = iFourthParameter;
+    if ( !forth )
+        {
+        return KErrArgument;
+        }
+
+    TLex8 input(*forth);
+    TBool end = EFalse;
+    while( (!input.Eos()) && (!end))
+        {
+        ParseAtomToDelimeter( input, KDlnaTokenizer);
+        TPtrC8 name(input.MarkedToken());
+        Skip(input,1);
+        end = ParseForthParameterInternalL( name, input);
+        }
+    return KErrNone;
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ParseDlnaPsParamL(TLex8& aLexer)
+//  Parses DLNA.ORG_PS params.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::ParseDlnaPsParamL(TLex8& aLexer)
+    {
+    ParseAtomToDelimeter(aLexer, KDlnaDelimeter);
+    TPtrC8 value (aLexer.MarkedToken());
+    if ( aLexer.MarkedToken().Length() == 0 ) User::Leave( KErrArgument );
+    SetPsParameterL(value);
+    SkipAndMark(aLexer, 1);
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ParseDlnaPnParamL(TLex8& aLexer)
+//  Parses DLNA.ORG_PN params.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::ParseDlnaPnParamL(TLex8& aLexer)
+    {
+    ParseAtomToDelimeter(aLexer, KDlnaDelimeter);
+    TPtrC8 value (aLexer.MarkedToken());
+    if ( aLexer.MarkedToken().Length() == 0 ) User::Leave( KErrArgument );
+    SetPnParameterL(value);
+    SkipAndMark(aLexer, 1);
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ParseDlnaOpParamL(TLex8& aLexer)
+//  Parses DLNA.ORG_OP params.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::ParseDlnaOpParamL(TLex8& aLexer)
+    {
+    ParseAtomToDelimeter(aLexer, KDlnaDelimeter);
+    TPtrC8 value (aLexer.MarkedToken());
+    if (value.Length() != 2) User::Leave( KErrArgument );
+    TChar character = value[0]; 
+    User::LeaveIfError(CheckBooleanValue(character));
+    SetOpTimeParam(character == KDLNA_BOOLEAN_TRUE);    
+    character = value[1]; 
+    User::LeaveIfError(CheckBooleanValue(character));
+    SetOpRangeParam(character == KDLNA_BOOLEAN_TRUE);
+    //SetOpParameter
+    SkipAndMark(aLexer, 1);
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ParseDlnaCiParamL(TLex8& aLexer)
+//  Parses DLNA.ORG_CI params.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::ParseDlnaCiParamL(TLex8& aLexer)
+    {
+    ParseAtomToDelimeter(aLexer, KDlnaDelimeter);
+    TPtrC8 value (aLexer.MarkedToken());
+    if (value.Length() != 1) User::Leave( KErrArgument );
+    TChar character = value[0]; 
+    User::LeaveIfError(CheckBooleanValue(character));    
+    SetCiParameter(character == KDLNA_BOOLEAN_TRUE);
+    //SetOpParameter
+    SkipAndMark(aLexer, 1);
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ParseDlnaFlagsParamL(TLex8& aLexer)
+//  Parses DLNA.ORG_FLAGS params.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::ParseDlnaFlagsParamL(TLex8& aLexer)
+    {
+    ParseAtomToDelimeter(aLexer, KDlnaDelimeter);
+    
+    if ( aLexer.MarkedToken().Length() != 
+        KDLNA_FLAGS_NUMBER * KMAX_INT_LENGTH_STRING) 
+        User::Leave( KErrArgument );
+    
+    TLex8 plagLex(aLexer.MarkedToken());    
+    
+    for(int i = 0; i < KDLNA_FLAGS_NUMBER; i++)
+        {
+        plagLex.Mark();
+        plagLex.Inc( KMAX_INT_LENGTH_STRING );
+        TPtrC8 value (plagLex.MarkedToken());
+        // check if values are from HEX range
+        for (TInt j = 0; j < KMAX_INT_LENGTH_STRING;j++)
+            if (!((value[j] >='0' &&  value[j] <='9') ||
+                (value[j] >='a' &&  value[j] <='f') || 
+                (value[j] >='A' &&  value[j] <='F')))
+                User::Leave( KErrArgument );
+        
+        TLex8* ptr = new TLex8(value);
+        User::LeaveIfError(ptr->Val(iDlnaFlags[i], EHex)); 
+        delete ptr;
+        }
+    SkipAndMark(aLexer,1);
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ParseOtherParamsL(TLex8& aLexer)
+//  Parses other params.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::ParseOtherParamsL(TLex8& /*aLexer*/)
+    {
+    if ( iDlnaPn != NULL )
+        {
+        
+        //    SetOtherParamL(aLexer.RemainderFromMark());
+        }
+    }
+    
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::ParseForthParameterInternalL( TDesC8& aName, TLex8& aLexer)
+//  Parses the fourth param.
+//-----------------------------------------------------------------
+TBool CUpnpDlnaProtocolInfo::ParseForthParameterInternalL( const TDesC8& aName, TLex8& aLexer)
+    {
+    TBool result = EFalse;
+    if ( aName.Compare(KDLNA_PN) == 0)
+        {
+        aLexer.Mark();
+        ParseDlnaPnParamL(aLexer);
+        }
+    else if ( aName.Compare(KDLNA_OP) == 0 )
+        {
+        aLexer.Mark();
+        ParseDlnaOpParamL(aLexer);
+        }
+    else if ( aName.Compare(KDLNA_PS) == 0 )
+        {
+        aLexer.Mark();
+        ParseDlnaPsParamL(aLexer);
+        }
+    else if ( aName.Compare(KDLNA_CI) == 0 )        
+        {
+        aLexer.Mark();
+        ParseDlnaCiParamL(aLexer);
+        }
+    else if ( aName.Compare(KDLNA_FLAGS) == 0 )                
+        {
+        aLexer.Mark();
+        ParseDlnaFlagsParamL(aLexer);
+        }
+    else 
+        {
+        ParseOtherParamsL(aLexer);
+        result = ETrue;
+        }
+    return result;
+    }
+        
+//-----------------------------------------------------------------
+//  CUpnpDlnaProtocolInfo::FourthField()
+//  
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpDlnaProtocolInfo::FourthField()
+    {
+     TRAPD( error, FourthParameterInternalL() )
+     if ( error )
+         { 
+         return KNullDesC8();
+         }    
+    return iFourthParameter->Des();
+    }
+
+
+//-----------------------------------------------------------------
+//  CUpnpDlnaProtocolInfo::FourthParameterInternalL()
+//  
+//-----------------------------------------------------------------    
+void CUpnpDlnaProtocolInfo::FourthParameterInternalL()
+    {
+    TInt len = GetFourthParameterLength();
+    
+    HBufC8* buf = HBufC8::NewLC(len);
+    TPtr8 bufPtr(buf->Des());
+    GetFourthParameterInternalL(bufPtr);
+    
+    delete iFourthParameter;
+    iFourthParameter = buf;
+    
+    CleanupStack::Pop(buf);        
+    }
+    
+    
+        
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetIntBit(TInt& aParameter, TBool aValue, TInt aBitNumber)
+//  Setter for DLNA_FLAGS
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::SetIntBit8(TUint8& aParameter, TBool aValue, TUint8 aBitNumber)
+    {
+    if ( aBitNumber >= KMAX_INT_LENGTH_STRING ) return;
+    if ( ! (aValue == EFalse) )
+        {
+        aParameter |= (TUint8)1<<aBitNumber;
+        }
+    else
+        {
+        aParameter  &= ~((TUint8)1<<aBitNumber);
+        }
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetIntBit(TInt& aParameter, TBool aValue, TInt aBitNumber)
+//  Setter for DLNA_FLAGS
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::SetIntBit32(TUint32& aParameter, TBool aValue, TUint8 aBitNumber)
+    {
+    if ( aBitNumber >= K32BIT ) return;
+    if ( ! (aValue == EFalse) )
+        {
+        aParameter |= (TUint32)1<<aBitNumber;
+        }
+    else
+        {
+        aParameter  &= ~((TUint32)1<<aBitNumber);
+        }
+    }    
+    
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetDlnaParam(TBool aValue, TInt aParamIndex)
+//  Setter for a DLNA parameter.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::SetDlnaParam(TBool aValue, TUint8 aParamIndex)
+    {
+    SetIntBit8((TUint8&) iParams, aValue, aParamIndex);
+    }    
+            
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::GetDlnaParam(TInt aParamIndex)
+//  Getter for DLNA params.
+//-----------------------------------------------------------------
+TBool CUpnpDlnaProtocolInfo::GetDlnaParam(TInt aParamIndex)
+    {
+     return ( iParams  & ((TUint8)1<<aParamIndex));
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::IsDlnaFlagsSet()
+//  This function returns ETrue if at least one dlna flag is set
+//-----------------------------------------------------------------
+TBool CUpnpDlnaProtocolInfo::IsDlnaFlagsSet()
+    {
+    for( int i = 0; i < KDLNA_FLAGS_NUMBER  ; i++)
+        {
+        if (iDlnaFlags[i] != 0 )
+            return ETrue;     
+        }
+    //if not DLNA flags not set
+    return EFalse;        
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::GetForthParameterInternalL(TPtr8& aBuffer)
+//  This function produces a string containing all info taken from fourth ProtocolInfo field
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::GetFourthParameterInternalL(TDes8& aBuffer)
+    {
+    
+    //if ( FourthField() != KNullDesC8)
+    //    {
+    //    aBuffer.Append( *iFourthParameter );
+    //    return;
+    //    }    
+    
+    
+    if ( PnParameter() == KNullDesC8 )        
+        {
+        aBuffer.Append(KDlnaAllStar);
+        return;
+        }
+    aBuffer.Append( KDLNA_PN );
+    aBuffer.Append( KDlnaTokenizer ); 
+    aBuffer.Append( *iDlnaPn );
+    if ( GetDlnaOpRangeParam() || GetDlnaOpTimeParam() )
+        {
+        aBuffer.Append( KDlnaDelimeter ); 
+        aBuffer.Append( KDLNA_OP );
+        aBuffer.Append( KDlnaTokenizer ); 
+        aBuffer.Append( GetDlnaOpTimeParam() ? KDLNA_BOOLEAN_TRUE:KDLNA_BOOLEAN_FALSE); //Time value 0,1
+        aBuffer.Append( GetDlnaOpRangeParam() ? KDLNA_BOOLEAN_TRUE:KDLNA_BOOLEAN_FALSE); //Range value 0,1
+        }
+    if ( PsParameter() != KNullDesC8 )
+        {
+        aBuffer.Append( KDlnaDelimeter ); 
+        aBuffer.Append( KDLNA_PS );
+        aBuffer.Append( KDlnaTokenizer ); 
+        aBuffer.Append( *iDlnaPs );
+        }
+    if ( iDlnaCi != KErrNotFound )
+        {
+        aBuffer.Append( KDlnaDelimeter ); 
+        aBuffer.Append( KDLNA_CI );
+        aBuffer.Append( KDlnaTokenizer ); 
+        aBuffer.Append( iDlnaCi ? KOneChar() : KZeroChar() ); 
+        }
+    
+    TBool saveDlnaFlags = IsDlnaFlagsSet();
+    
+    if ( saveDlnaFlags )
+        {
+        aBuffer.Append( KDlnaDelimeter ); 
+        aBuffer.Append( KDLNA_FLAGS );
+        aBuffer.Append( KDlnaTokenizer ); 
+        SerializeDlnaFlagsL( aBuffer );
+        }
+    if ( GetOtherParams() != KNullDesC8) 
+        {
+        aBuffer.Append( KDlnaDelimeter ); 
+        aBuffer.Append( *iOtherParams );
+        }
+    }
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::GetForthParameterParameterLength
+//  This function returns length of the string containing all relevant information from fourth ProtocolInfo field. 
+//-----------------------------------------------------------------
+TInt CUpnpDlnaProtocolInfo::GetFourthParameterLength()
+    {
+    
+    //if ( FourthField() != KNullDesC8)
+    //    {
+    //    return iFourthParameter->Length();
+    //    }
+    
+    
+    if ( PnParameter() == KNullDesC8 )        
+        {
+        return 1; 
+        }
+    TInt result = 0; 
+    result += KDLNA_PN.operator()().Length();
+    result += 1 ; 
+    result += iDlnaPn->Length();
+    if ( GetDlnaOpRangeParam() || GetDlnaOpTimeParam() )
+        {
+        result += 1; // ; 
+        result += KDLNA_OP.operator()().Length();
+        result += 1; //= 
+        result += 1; //Time value 0,1
+        result += 1; //Range value 0,1
+        }
+    if ( PsParameter() != KNullDesC8 )
+        {
+        result += 1; // ; separator
+        result += KDLNA_PS.operator()().Length();
+        result += 1; // = 
+        result += iDlnaPs->Length();
+        }
+    if ( iDlnaCi != KErrNotFound )
+        {
+        result += 1; //; 
+        result += KDLNA_CI.operator()().Length();
+        result += 1; //= 
+        result += 1; // value 
+        }
+    
+    TBool saveDlnaFlags = IsDlnaFlagsSet();
+    
+    if ( saveDlnaFlags )
+        {
+        result += 1; //; 
+        result += KDLNA_FLAGS.operator()().Length();
+        result += 1; // = 
+        result += KDLNA_FLAGS_NUMBER * KMAX_INT_LENGTH_STRING; // Values length
+        }
+    if ( GetOtherParams() != KNullDesC8 ) 
+        {
+        result += 1; //; 
+        result += iOtherParams->Length();
+        }
+    return result;
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SerializeDlnaFlagsL(TPtr8& aBuffer)
+//  Serializes iDlnaFlags member variable into a string.
+//-----------------------------------------------------------------
+void CUpnpDlnaProtocolInfo::SerializeDlnaFlagsL(TDes8& aBuffer)
+    {
+    HBufC8* number = HBufC8::NewL(KMAX_INT_LENGTH_STRING);
+    TPtr8 ptrNumber( number->Des() );
+    for(int i = 0; i < KDLNA_FLAGS_NUMBER ; i++)    
+        {
+        ptrNumber.NumFixedWidth(iDlnaFlags[i], EHex, KMAX_INT_LENGTH_STRING);
+        ptrNumber.UpperCase();
+        aBuffer.Append( *number);
+        }
+    delete number;
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::GetDlnaOpTimeParam()
+//  Getter for DLNA.ORG_OP time seek parameter.
+//-----------------------------------------------------------------
+TBool CUpnpDlnaProtocolInfo::GetDlnaOpTimeParam()
+    {
+    return GetDlnaParam(A_VAL);
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::GetDlnaOpRangeParam()
+//  Getter for DLNA.ORG_OP range seek parameter.
+//-----------------------------------------------------------------
+TBool CUpnpDlnaProtocolInfo::GetDlnaOpRangeParam()
+    {
+    return GetDlnaParam(B_VAL);
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetOpParameterL(TPtrC8 aValue)
+//  Setter for DLNA.ORG_OP parameter.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpDlnaProtocolInfo::SetOpParameterL(const TDesC8& aValue)
+    {                   
+    TPtrC8 opParamName;
+    TPtrC8 opParamValue;
+        
+    //---- getting a proper value of DLNA.ORG_OP param --
+    if ( aValue.Locate(KDlnaTokenizer) > KErrNotFound )
+    {
+        TLex8 lexer(aValue);    
+        ParseAtomToDelimeter( lexer, KDlnaTokenizer);
+        opParamName.Set( lexer.MarkedToken() );
+        
+        if ( opParamName != KDLNA_OP)
+            {
+            User::Leave(KErrBadDescriptor);    
+            }
+        
+        Skip(lexer, 1);            
+        opParamValue.Set( lexer.Remainder() );         
+        }
+    else
+        {
+        opParamValue.Set(aValue);            
+        }
+                
+    //---- parsing DLNA.ORG_OP param value ---------------
+    if ( opParamValue.Length() == 2 && 
+        !CheckBooleanValue(((TChar)opParamValue[0])) && 
+        !CheckBooleanValue(((TChar)opParamValue[1])) 
+        )
+        {                        
+        TBool opTimeParam = ((TChar)opParamValue[0]).GetNumericValue();
+        TBool opRangeParam = ((TChar)opParamValue[1]).GetNumericValue();
+        
+        SetOpTimeParam(opTimeParam);
+        SetOpRangeParam(opRangeParam);        
+        }
+    else 
+        {        
+        User::Leave(KErrBadDescriptor);
+        }                                                                                        
+    } 
+    
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetOpParameterL(UpnpDlnaProtocolInfo::TDlnaParams param,TBool aValue)
+//  Setter for DLNA.ORG_OP parameter.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpDlnaProtocolInfo::SetOpParameterL(UpnpDlnaProtocolInfo::TDlnaParams param,TBool aValue)
+    {
+    SetDlnaParam( aValue, param );
+    }
+    
+//-----------------------------------------------------------------
+//  CUpnpDlnaProtocolInfo::OpParameterL()
+//  Getter for DLNA.ORG_OP parameter.
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpDlnaProtocolInfo::OpParameterL()
+    {
+    TBool opTimeParam = GetDlnaOpTimeParam();
+    TBool opRangeParam = GetDlnaOpRangeParam();
+    HBufC8* opParameter = HBufC8::NewLC(2);    
+    opParameter->Des().AppendNum( opTimeParam ? 1:0 );
+    opParameter->Des().AppendNum( opRangeParam ? 1:0 );           
+       
+    CleanupStack::Pop(opParameter);
+       
+    delete iOpParam;
+    iOpParam = opParameter;
+    return iOpParam->Des();
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetOpParameterL(UpnpDlnaProtocolInfo::TDlnaParams param,TBool aValue)
+//  Setter for DLNA.ORG_OP parameter.
+//-----------------------------------------------------------------
+EXPORT_C TBool CUpnpDlnaProtocolInfo::OpParameter(UpnpDlnaProtocolInfo::TDlnaParams param)
+    {
+    return GetDlnaParam( param );
+    }
+    
+//-----------------------------------------------------------------
+//  CUpnpDlnaProtocolInfo::SetFlagsParameterL(const TDesC8& flags)
+//  Setter for DLNA.ORG_CI parameter.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpDlnaProtocolInfo::SetFlagsParameterL(const TDesC8& flags)
+    {                
+    TPtrC8 flagsParamName(KDLNA_FLAGS);        
+    TLex8 lexer(flags);
+    TInt len = flags.Length();
+                
+    //---- getting a proper value of DLNA.ORG_FLAGS ----
+    if ( flags.Locate(KDlnaTokenizer) > KErrNotFound )
+        {                    
+        ParseAtomToDelimeter( lexer, KDlnaTokenizer);
+        flagsParamName.Set( lexer.MarkedToken() );
+            
+        if ( flagsParamName != KDLNA_FLAGS )
+            {
+            User::Leave(KErrBadDescriptor);    
+            }
+            
+        Skip(lexer, 1);
+        TPtrC8 tmp = lexer.Remainder();
+                        
+        len = tmp.Length();
+        lexer = tmp;
+        }                                        
+        
+    //---- checking if DLNA.ORG_FLAGS has proper value --                
+    if (len != 32)
+        {
+        User::Leave( KErrBadDescriptor );
+        }
+        
+    while( !lexer.Eos() )
+        {
+        if ( !lexer.Get().IsHexDigit() )
+            {
+            User::Leave( KErrBadDescriptor );
+            }
+        }
+        
+    lexer.UnGetToMark();                                                
+    ParseForthParameterInternalL( flagsParamName, lexer );                       
+    }
+    
+//-----------------------------------------------------------------
+//  CUpnpDlnaProtocolInfo::FlagsParameterL()
+//  Getter for DLNA.ORG_CI parameter.
+//----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpDlnaProtocolInfo::FlagsParameterL()
+    {
+    TInt len = KDLNA_FLAGS_NUMBER * KMAX_INT_LENGTH_STRING; // Values length
+    HBufC8* flagsParameter = HBufC8::NewLC(len);
+    TPtr8 ptr = flagsParameter->Des();
+    SerializeDlnaFlagsL(ptr);
+    CleanupStack::Pop(flagsParameter);    
+    delete iFlagsParam;
+    iFlagsParam = flagsParameter;            
+    return iFlagsParam->Des();
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetCiParameter(TBool aValue)
+//  Setter for DLNA.ORG_CI parameter.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpDlnaProtocolInfo::SetCiParameter(TBool aValue)
+    {
+    iDlnaCi = aValue;
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::CiParameter()
+//  Getter for DLNA.ORG_CI parameter.
+//-----------------------------------------------------------------
+EXPORT_C TBool CUpnpDlnaProtocolInfo::CiParameter()
+    {
+    return !(iDlnaCi <= 0);
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetOtherParamsL(TDesC8& aValue)
+//  Setter for other parameter value.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpDlnaProtocolInfo::SetOtherParamL(const TDesC8& aValue)
+     {
+     if ( iOtherParams)
+         {
+         delete iOtherParams;
+         iOtherParams = NULL;
+         }
+     iOtherParams = aValue.AllocL();
+     }    
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::GetOtherParams()
+//  Getter for other parameter value.
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpDlnaProtocolInfo::GetOtherParams()
+     {
+     if ( iOtherParams )
+         {
+         return iOtherParams->Des();
+         }
+     else
+         {
+         return KNullDesC8();
+         }
+     }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetDlnaFlag(TBool aValue,TInt flag)
+//  Setter for a single flag.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpDlnaProtocolInfo::SetDlnaFlag(UpnpDlnaProtocolInfo::TDlnaFlags flag, TBool aValue)
+    {
+    SetDlnaFlag( aValue, flag);
+    }
+
+//-----------------------------------------------------------------
+//  ProtocolInfo::DlnaFlag()
+//  Getter for a single flag.
+//-----------------------------------------------------------------
+EXPORT_C TBool CUpnpDlnaProtocolInfo::DlnaFlag(UpnpDlnaProtocolInfo::TDlnaFlags flag)
+    {
+    return GetDlnaFlag(flag);
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetDlnaPnParameterL(TDesC8& aValue)
+//  Setter for DLNA.ORG_PN.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpDlnaProtocolInfo::SetPnParameterL(const TDesC8& aValue)
+     {
+    if ( iDlnaPn )
+        {
+        delete iDlnaPn ; 
+        iDlnaPn = NULL;
+        }
+    iDlnaPn = aValue.AllocL();
+    }
+ 
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::GetDlnaPnParameter()
+//  Getter for DLNA.ORG_PN.
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpDlnaProtocolInfo::PnParameter()
+    {
+     if ( iDlnaPn )
+         {
+         return iDlnaPn->Des();
+         }
+     else 
+         {
+         return KNullDesC8();
+         }
+     }
+
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::SetDlnaPsParameterL(TDesC8& aValue)
+//  Setter for DLNA.ORG_PS.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpDlnaProtocolInfo::SetPsParameterL(const TDesC8& aValue)
+    {
+    if ( iDlnaPs )
+        {
+        delete iDlnaPs ; 
+        iDlnaPs = NULL;
+        }
+    iDlnaPs = aValue.AllocL();    
+    }
+ 
+//-----------------------------------------------------------------
+//  CProtocolInfoDlna::GetDlnaPsParameter()
+//  Getter for DLNA.ORG_PS.
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpDlnaProtocolInfo::PsParameter()
+     {
+     if ( iDlnaPs )
+         {
+         return iDlnaPs->Des();
+         }
+     else
+        {
+        return KNullDesC8();
+        }
+     }
+
+     
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpelement.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,365 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnPElement implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpelement.h"
+#include "upnpobject.h"
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElement::ConstructL(const TDesC8& aName)
+{
+    iElementName = aName.AllocL();
+    iElementValue = KNullDesC8().AllocL();
+    iFilePath = KNullDesC().AllocL();
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpElement* CUpnpElement::NewLC(const TDesC8& aName)
+{
+    CUpnpElement* self = new( ELeave ) CUpnpElement;
+    CleanupStack::PushL( self );
+    self->ConstructL(aName);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpElement* CUpnpElement::NewL(const TDesC8& aName)
+{
+    CUpnpElement* self = NewLC(aName);
+    CleanupStack::Pop(self);
+    return self;
+}    
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::CUpnpElement
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpElement::CUpnpElement()
+    {
+    }
+
+// Destructor
+CUpnpElement::~CUpnpElement()
+    {
+    delete iElementName;
+    delete iElementValue;
+    delete iFilePath;
+    iAttributes.ResetAndDestroy();
+    iAttributes.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::SetElementNameL
+// Sets name for the attribute.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpElement::SetNameL( const TDesC8& aElementName )
+    {
+    HBufC8* tmp = aElementName.AllocL();
+    delete iElementName;
+    iElementName = tmp;    
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpElement::Name
+// Returns name of the attribute. If null, returns KNullDesC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpElement::Name() const
+    {
+    return *iElementName;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpElement::SetElementNameL
+// Sets name for the attribute.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpElement::SetValueL( const TDesC8& aElementValue )
+    {
+    HBufC8* tmp = aElementValue.AllocL();
+    delete iElementValue;
+    iElementValue = tmp;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpElement::Name
+// Returns name of the attribute. If null, returns KNullDesC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpElement::Value() const
+    {
+    return *iElementValue;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpElement::SetFilePathL
+// Returns path of the attribute res. If null, returns KNullDesC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpElement::SetFilePathL(const TDesC& aFilePath)
+    {
+    HBufC* tmp = aFilePath.AllocL();
+    delete iFilePath;
+    iFilePath = tmp;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpElement::FilePath
+// Returns path of the attribute res. If null, returns KNullDesC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CUpnpElement::FilePath() const
+    {
+    return *iFilePath;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpElement::AddAttributeL
+// Returns name of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpElement::AddAttributeL( CUpnpAttribute* aNewAttribute )
+    {
+    if ( aNewAttribute )
+        {
+        iAttributes.AppendL( aNewAttribute );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::RemoveAttributeL
+// Returns name of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpElement::RemoveAttributeL( const CUpnpAttribute* aNewAttribute )
+    {
+    for ( TInt index(0); index < iAttributes.Count(); index++ )
+        {
+        if ( iAttributes[index] == aNewAttribute )
+            {
+            iAttributes.Remove( index );
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::Name
+// Returns name of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const RUPnPAttributesArray& CUpnpElement::GetAttributes()
+    {
+    return iAttributes;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::CopyL
+// Copies the content from parameter CUpnpElement to this
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpElement::CopyL( const CUpnpElement& aElement )
+    {
+      
+    CBufFlat* buffer = CBufFlat::NewL( sizeof( aElement ) );
+    CleanupStack::PushL( buffer );
+
+    RBufWriteStream outStream;
+    outStream.Open( *buffer );
+    CleanupClosePushL( outStream );
+	
+    RBufReadStream inStream;
+    inStream.Open( *buffer );
+    CleanupClosePushL( inStream );
+	
+    aElement.ExternalizeL( outStream );
+    InternalizeL( inStream );
+	
+    CleanupStack::PopAndDestroy( 3 );   // inStream && outStream && buffer
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpElement::ExternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpElement::ExternalizeL( RWriteStream& aStream ) const
+    {
+	TInt ExternalizationLength = MapItemNameToProperLength(*iElementName);
+
+	SafeExternalizeL(aStream, *iElementName, KMaxUpnpObjStringLen);
+	SafeExternalizeL(aStream, *iElementValue, ExternalizationLength);
+	SafeExternalize16L(aStream, *iFilePath, KMaxUpnpObjLongStringLen);
+
+    aStream.WriteInt8L( IsRequired() );
+       
+    aStream.WriteInt16L( iAttributes.Count() );
+    for ( TInt index(0); index < iAttributes.Count(); index++ )
+        {
+        iAttributes[index]->ExternalizeL( aStream );
+        }
+    }
+        
+// -----------------------------------------------------------------------------
+// CUpnpElement::InternalizeL
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpElement::InternalizeL( RReadStream& aStream )
+    {	
+    delete iElementName;
+    iElementName = NULL;
+    iElementName = HBufC8::NewL( aStream, KMaxUpnpObjStringLen );
+    
+	TInt InternalizationLength = MapItemNameToProperLength(*iElementName);
+
+    // Element value   
+    delete iElementValue;
+    iElementValue = NULL;
+    iElementValue = HBufC8::NewL( aStream, InternalizationLength );
+    
+    // FilePath
+    delete iFilePath;
+    iFilePath = NULL;
+    iFilePath = HBufC::NewL( aStream, KMaxUpnpObjLongStringLen );
+    
+    // Is required
+    SetIsRequired( aStream.ReadInt8L() );
+      
+    // cleanup
+    iAttributes.ResetAndDestroy();
+    
+    // Attributes count
+    TInt attributesCount = aStream.ReadInt16L();
+	
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < attributesCount; index++ )
+        {
+        CUpnpAttribute* newAttribute = CUpnpAttribute::NewLC();
+        newAttribute->InternalizeL( aStream );
+        iAttributes.AppendL( newAttribute );
+        CleanupStack::Pop( newAttribute ); 
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpElement::SetIsRequired
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpElement::SetIsRequired(TBool aIsRequired)
+{
+    iIsRequired = aIsRequired;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElement::IsRequired
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpElement::IsRequired() const
+{
+    return iIsRequired;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::SafeExternalizeL
+// Writes safely aNumber of characters from the content to the stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpElement::SafeExternalizeL(RWriteStream& aStream, const TDesC8& aDesc, const TInt aNumber) const
+{	
+    if( aDesc.Length() > aNumber )    
+		aStream << aDesc.Mid(0, aNumber);
+    else
+		aStream << aDesc;    
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::SafeExternalize16L
+// Writes safely aNumber of characters from the content to the stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpElement::SafeExternalize16L(RWriteStream& aStream, const TDesC& aDesc, const TInt aNumber) const
+{	
+    if( aDesc.Length() > aNumber )    
+		aStream << aDesc.Mid(0, aNumber);
+    else
+		aStream << aDesc;    
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElement::MapItemNameToProperLength
+// Counts how many bytes will be used for internalization
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpElement::MapItemNameToProperLength(TDesC8& aItemName) const
+{
+	// DLNA Networked Device Interoperability Guidelines
+	// Requirement [7.3.17.4]: The following metadata properties must not exceed 256 bytes each in the XML-escaped form encoded in UTF-8	
+	if( aItemName == _L8("dc:date") ||
+		aItemName == _L8("dc:creator") ||
+		aItemName == _L8("upnp:genre") ||
+		aItemName == _L8("upnp:album") ||
+		aItemName == _L8("upnp:albumArtURI") ||
+		aItemName == _L8("upnp:channelNr") ||
+		aItemName == _L8("upnp:channelName")
+	)
+    {
+		return KMaxUpnpObjStringLen; // 256
+    }	
+	else 
+	{
+		return KMaxUpnpObjLongStringLen; //1024
+	}
+}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpfiletransferevent.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,243 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Upnp Media Server file transfer event
+*
+*/
+
+#include "upnpfiletransferevent.h"
+
+
+// ---------------------------------------------------------------------------
+// CUpnpFileTransferEvent::CUpnpFileTransferEvent
+// ---------------------------------------------------------------------------
+//
+CUpnpFileTransferEvent::CUpnpFileTransferEvent(): 
+                            CUpnpMediaServerEvent(0)
+    {    
+    }   
+
+// ---------------------------------------------------------------------------
+// CUpnpFileTransferEvent::~CUpnpFileTransferEvent
+// ---------------------------------------------------------------------------
+//
+CUpnpFileTransferEvent::~CUpnpFileTransferEvent()
+    {
+    delete iFilePath;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CUpnpFileTransferEvent::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileTransferEvent::ConstructL()
+    {
+    iFilePath = HBufC::NewL(0);
+    }
+   
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::NewLC
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpFileTransferEvent* CUpnpFileTransferEvent::NewLC()
+    {
+    CUpnpFileTransferEvent* self = new( ELeave ) CUpnpFileTransferEvent;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpFileTransferEvent* CUpnpFileTransferEvent::NewL()
+    {
+    CUpnpFileTransferEvent* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }    
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::ProgressState
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C CUpnpFileTransferEvent::TProgressState CUpnpFileTransferEvent::ProgressState()
+    {
+    return (TProgressState) iProgress;
+    }
+ 
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::SetProgressState
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C void CUpnpFileTransferEvent::SetProgressState( TProgressState aState )
+    {
+    iProgress = aState;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::Direction
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C CUpnpFileTransferEvent::TDirection CUpnpFileTransferEvent::Direction()
+    {
+    return (TDirection) iDirection;    
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::SetDirection
+// -----------------------------------------------------------------------------
+//       
+EXPORT_C void CUpnpFileTransferEvent::SetDirection( TDirection aDirection )
+    {
+    iDirection = aDirection;            
+    }
+ 
+    
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::TransferId
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C TInt CUpnpFileTransferEvent::TransferId()
+    {
+    return iTransferId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::SetTransferId
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C void CUpnpFileTransferEvent::SetTransferId( TInt aTransferId )
+    {
+    iTransferId = aTransferId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::ContentDirectoryObjectId
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C TInt CUpnpFileTransferEvent::ContentDirectoryObjectId()
+    {
+    return iContentDirectoryObjectId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::SetContentDirectoryObjectId
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C void CUpnpFileTransferEvent::SetContentDirectoryObjectId( TInt aObjectId )
+    {
+    iContentDirectoryObjectId = aObjectId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::FilePath
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C TDesC& CUpnpFileTransferEvent::FilePath()
+    {
+    return *iFilePath;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::SetFilePath
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C void CUpnpFileTransferEvent::SetFilePathL(const TDesC& aFilePath)
+    {
+    delete iFilePath;
+    iFilePath = NULL;
+    iFilePath = aFilePath.AllocL();
+    }
+    
+
+// -----------------------------------------------------------------------------
+//  CUpnpFileTransferEvent::ErrorCode
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C TInt CUpnpFileTransferEvent::ErrorCode()
+    {
+    return iErrorCode;
+    }
+
+    
+    
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::SetErrorCode
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C void CUpnpFileTransferEvent::SetErrorCode( TInt aError )
+    {
+    iErrorCode = aError;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::CloneL
+// -----------------------------------------------------------------------------
+//   
+EXPORT_C CUpnpFileTransferEvent* CUpnpFileTransferEvent::CloneL()
+    {
+    CUpnpFileTransferEvent* event = CUpnpFileTransferEvent::NewLC();
+    event->SetProgressState( ( TProgressState ) iProgress);
+    event->SetDirection( ( TDirection ) iDirection);
+    event->SetFilePathL(*iFilePath);
+    event->SetContentDirectoryObjectId(iContentDirectoryObjectId);
+    event->SetTransferId(iTransferId);
+    event->SetErrorCode(iErrorCode);
+    CleanupStack::Pop(event);
+    return event;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::ExternalizeL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileTransferEvent::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream << *iFilePath;
+    aStream.WriteInt32L( iProgress );
+    aStream.WriteInt32L( iDirection );    
+    aStream.WriteInt32L( iContentDirectoryObjectId );
+    aStream.WriteInt32L( iTransferId );
+    aStream.WriteInt32L( iErrorCode );
+                
+    }
+        
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferEvent::InternalizeL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileTransferEvent::InternalizeL( RReadStream& aStream )
+    {
+     // Filter
+    delete iFilePath;
+    iFilePath = NULL;
+    iFilePath = HBufC16::NewL( aStream, 256 );
+    
+    iProgress =  aStream.ReadInt32L();
+    iDirection = aStream.ReadInt32L();
+    iContentDirectoryObjectId = aStream.ReadInt32L();
+    iTransferId = aStream.ReadInt32L();
+    iErrorCode = aStream.ReadInt32L();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpfiletransfereventlist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,92 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server file transfer event list
+*
+*/
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    "upnpfiletransfereventlist.h"
+#include    "upnpmediaserverevent.h"
+#include    "upnpfiletransferevent.h"
+
+
+
+
+
+
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpFileTransferEventList* CUpnpFileTransferEventList::NewL()
+    {
+    CUpnpFileTransferEventList* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpFileTransferEventList* CUpnpFileTransferEventList::NewLC()
+    {
+    CUpnpFileTransferEventList* self = new( ELeave ) CUpnpFileTransferEventList;
+    CleanupStack::PushL( self );
+    self->ConstructL(  );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::NewL
+// -----------------------------------------------------------------------------
+//
+void CUpnpFileTransferEventList::InternalizeSubTypeL( RReadStream& aStream )
+    {
+    CUpnpFileTransferEvent* newEvent = CUpnpFileTransferEvent::NewLC();
+	newEvent->InternalizeL( aStream );
+	iEvents.AppendL( newEvent );   
+	CleanupStack::Pop();         
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::NewL
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransferEventList::CUpnpFileTransferEventList()
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::NewL
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransferEventList::~CUpnpFileTransferEventList()
+    {    
+    }
+
+
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpitem.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,132 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP container class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include	"upnpobject.h"
+#include    "upnpitem.h"
+
+
+
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpItem::CUpnpItem
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpItem::CUpnpItem()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpItem::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpItem::ConstructL(  )
+    {
+    iRefId = KNullDesC8().AllocL();
+    CUpnpObject::ConstructL(  );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpItem::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpItem* CUpnpItem::NewL( )
+    {
+    CUpnpItem* self = new( ELeave ) CUpnpItem;    
+	self->ConstructL();
+    return self;
+    }
+
+    
+// Destructor
+EXPORT_C CUpnpItem::~CUpnpItem()
+    {
+    delete iRefId;
+    }
+         
+// -----------------------------------------------------------------------------
+// CUpnpItem::SetRefIdL
+// Sets file name for the object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpItem::SetRefIdL( const TDesC8& aRefIdL )
+    {
+    HBufC8* tmp = aRefIdL.AllocL();
+    delete iRefId;
+    iRefId = tmp;    
+    }
+      
+// -----------------------------------------------------------------------------
+// CUpnpItem::FileName
+// Returns filename of the object. If null, returns KNullDesC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpItem::RefId() const
+    {
+    return *iRefId;
+    }    
+      
+// -----------------------------------------------------------------------------
+// CUpnpItem::ExternalizeL
+// Writes the content to stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpItem::ExternalizeL( RWriteStream& aStream ) const
+    {
+    BaseExternalizeL( aStream );
+    aStream << RefId();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpItem::InternalizeL
+// Fills item information from stream
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+EXPORT_C void CUpnpItem::InternalizeL( RReadStream& aStream )
+    {
+    BaseInternalizeL( aStream );
+    delete iRefId;
+    iRefId = NULL;
+    iRefId = HBufC8::NewL( aStream, KMaxUpnpObjStringLen );    
+    }
+// -----------------------------------------------------------------------------
+// CUpnpItem::ObjectType
+// Returns item-type
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUPnPObjectType CUpnpItem::ObjectType() const
+    {
+    return EUPnPItem;
+    }
+  
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpitemlist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,103 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP container class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include	"upnpobject.h"
+#include    "upnpitemlist.h"
+    
+
+
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpItemList::CUpnpItemList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpItemList::CUpnpItemList()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpItemList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpItemList::ConstructL( )
+    {
+    CUpnpObjectList::ConstructL();
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpItemList::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpItemList* CUpnpItemList::NewL()
+    {
+    CUpnpItemList* self = NewLC();
+    CleanupStack::Pop(self);
+
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpItemList::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpItemList* CUpnpItemList::NewLC()
+    {
+    CUpnpItemList* self = new( ELeave ) CUpnpItemList;
+
+    CleanupStack::PushL( self );
+    self->ConstructL(  );
+
+    return self;
+    }
+      
+// -----------------------------------------------------------------------------
+// CUpnpItemList::~CUpnpItemList
+// -----------------------------------------------------------------------------
+//
+CUpnpItemList::~CUpnpItemList()
+    {
+    }
+// -----------------------------------------------------------------------------
+// CUpnpItemList::AppendObjectL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpItemList::AppendObjectL( CUpnpObject& aNewObject )
+    {
+    // leave if not an item
+    if(aNewObject.ObjectType() != EUPnPItem)
+        {
+        User::Leave(KErrArgument);
+        }
+
+    CUpnpObjectList::AppendObjectL(aNewObject);
+    }
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpmediaserverevent.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Upnp Media Server event
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpmediaserverevent.h"
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEvent::CUpnpMediaServerEvent
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerEvent::CUpnpMediaServerEvent(TInt aType) : iEventType( aType )
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEvent::~CUpnpMediaServerEvent
+// Connect destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerEvent::~CUpnpMediaServerEvent()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEvent::GetEventType
+// Type getter
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMediaServerEvent::GetEventType()
+    {
+    return iEventType;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpmediaservereventlist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,140 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP container class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include    "upnpmediaservereventlist.h"
+#include    "upnpmediaserverevent.h"
+
+#include    <e32base.h>
+
+
+
+
+
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::CUpnpMediaServerEventList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerEventList::CUpnpMediaServerEventList()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerEventList::ConstructL( )
+    {
+    }
+    
+      
+// Destructor
+CUpnpMediaServerEventList::~CUpnpMediaServerEventList()
+    {
+    iEvents.ResetAndDestroy();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::ExternalizeL
+// Writes the content to stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpMediaServerEventList::ExternalizeL( RWriteStream& aStream ) const
+	{
+    // Let's write the count of items to stream first
+    aStream.WriteInt16L( iEvents.Count() );
+    for ( TInt i = 0; i < iEvents.Count(); i++ )
+        {
+        // Then the object itself
+        iEvents[i]->ExternalizeL( aStream );
+        }
+	}
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::InternalizeL
+// Fills container information from stream
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+EXPORT_C void CUpnpMediaServerEventList::InternalizeL( RReadStream& aStream )
+    {
+	// internalize the objects
+    iEvents.ResetAndDestroy();
+    
+    // First the count of individual objects
+	TInt itemCount = aStream.ReadInt16L();
+
+	// Then internalize them from the stream one by one
+	for (TInt index = 0; index < itemCount; index++ )
+	    {	    
+	    InternalizeSubTypeL(aStream);	    
+	    }
+    }
+    
+    
+EXPORT_C  RPointerArray<CUpnpMediaServerEvent>&  CUpnpMediaServerEventList::GetPointerArray( )
+    {
+    return iEvents;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventList::ToDes8L
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+EXPORT_C HBufC8* CUpnpMediaServerEventList::ToDes8L() const
+{
+    // serialize object
+    CBufFlat* buf = CBufFlat::NewL(KDefBufferGranularity);
+    CleanupStack::PushL(buf);
+    RBufWriteStream stream(*buf);
+    CleanupClosePushL(stream);
+    
+    stream << *this;
+    
+    // create heap descriptor
+    HBufC8* hbuf = HBufC8::NewLC(buf->Size());
+    TPtr8 ptr(hbuf->Des());
+    buf->Read(0, ptr, buf->Size());
+    
+    // clean up
+    CleanupStack::Pop(hbuf);
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    
+    return hbuf;
+}
+
+
+
+
+
+
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpobject.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,435 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnPObject implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpobject.h" 
+
+
+_LIT8(KContainer,"container"); 
+_LIT8(KItem,"item");
+_LIT8(KRes,"res");
+_LIT8(KProtocolinfo,"protocolInfo");
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::CUpnpObject
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpObject::CUpnpObject()
+    {
+    iRestricted = ETrue;
+    }
+    
+// Destructor
+EXPORT_C CUpnpObject::~CUpnpObject()
+    {
+    delete iId;
+    delete iParentId;
+    delete iTitle;
+    delete iObjectClass;
+    iElements.ResetAndDestroy();
+    iElements.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpObject::ConstructL(  )
+    {
+    iId = KNullDesC8().AllocL();
+    iParentId = KNullDesC8().AllocL();
+    iTitle = KNullDesC8().AllocL();
+    iObjectClass = KNullDesC8().AllocL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::SetIdL
+// Sets Object Id
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::SetIdL( const TDesC8& aId )
+    {
+    HBufC8* tmp = aId.AllocL();
+    delete iId;
+    iId = tmp;    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::Id
+// Returns Id of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpObject::Id() const
+    {
+    return *iId; 
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::SetParentIdL
+// Sets Parent Id for the object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::SetParentIdL( const TDesC8& aParentId )
+    {
+    HBufC8* tmp = aParentId.AllocL();
+    delete iParentId;
+    iParentId = tmp;
+    }
+       
+// -----------------------------------------------------------------------------
+// CUpnpObject::ParentId
+// Returns Parent Id of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C  const TDesC8& CUpnpObject::ParentId() const
+    {
+    return *iParentId;
+    }
+  
+// -----------------------------------------------------------------------------
+// CUpnpObject::AddElementL
+// Returns name of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::AddElementL( CUpnpElement* aNewElement )
+    {
+    if ( aNewElement )
+        {
+        iElements.AppendL( aNewElement );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::Name
+// Returns name of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::RemoveElementL( const CUpnpElement* aNewElement )
+    {
+    for ( TInt index(0); index < iElements.Count(); index++ )
+        {
+        if ( iElements[index] == aNewElement )
+            {
+            iElements.Remove( index );
+           break;
+            }
+        }
+    }  
+// -----------------------------------------------------------------------------
+// CUpnpObject::GetElements
+// Returns name of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const RUPnPElementsArray& CUpnpObject::GetElements()
+    {
+    return iElements;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpObject::SetNameL
+// Sets name for the object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::SetTitleL( const TDesC8& aTitle )
+    {
+    HBufC8* tmp = aTitle.AllocL();
+    delete iTitle;
+    iTitle = tmp;  
+    }
+      
+// -----------------------------------------------------------------------------
+// CUpnpObject::Name
+// Returns name of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpObject::Title() const
+    {
+    return *iTitle;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpObject::SetObjectClassL
+// Sets class object for the object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::SetObjectClassL( const TDesC8& aObjectClass )
+    {
+    ValidateClassL(aObjectClass); // leaves on error
+    HBufC8* tmp = aObjectClass.AllocL();
+    delete iObjectClass;
+    iObjectClass = tmp;  
+    }
+// -----------------------------------------------------------------------------
+// CUpnpObject::ValidateClassL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObject::ValidateClassL(const TDesC8& aObjectClass)   
+{
+    // verify the class
+    if( ObjectType() == EUPnPContainer )
+    { // it must contains "container" string
+        if( aObjectClass.Find(KContainer) == KErrNotFound )
+        {
+            User::Leave(KErrArgument);
+        }
+    }
+    else if(ObjectType() == EUPnPItem)
+    {// it must contains "item" string
+        if( aObjectClass.Find(KItem) == KErrNotFound )
+        {
+            User::Leave(KErrArgument);
+        }
+    }
+    else
+    { // should never happen
+        User::Invariant();
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpObject::ObjectClass
+// Returns objectclass of the object. If null, returns KNullDesC8
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpObject::ObjectClass() const
+    {
+    return *iObjectClass;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::SetRestriction()
+// Sets the restriction info. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::SetRestricted( TBool aRestriction )
+    {
+    iRestricted = aRestriction;
+    }
+   
+// -----------------------------------------------------------------------------
+// CUpnpObject::Restriction()
+// Gets the restriction info. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpObject::Restricted() const
+    {
+    return iRestricted;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::SetWriteStatus()
+// Sets the restriction info. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::SetWriteStatus( TBool aWriteStatus )
+    {
+    iWriteStatus = aWriteStatus;
+    }
+   
+// -----------------------------------------------------------------------------
+// CUpnpObject::Restriction()
+// Gets the restriction info. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpObject::WriteStatus() const
+    {
+    return iWriteStatus;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpObject::CopyL
+// Copies the content from parameter CUpnpObject to this
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::CopyL( const CUpnpObject& aObject )
+    {
+    // Check that parameter type is also item
+    if ( aObject.ObjectType() != ObjectType() )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    CBufFlat* buffer = CBufFlat::NewL( sizeof( aObject ) );
+    CleanupStack::PushL( buffer );
+
+    RBufWriteStream outStream;
+    outStream.Open( *buffer );
+    CleanupClosePushL( outStream );
+	
+    RBufReadStream inStream;
+    inStream.Open( *buffer );
+    CleanupClosePushL( inStream );
+	
+    aObject.ExternalizeL( outStream );
+    InternalizeL( inStream );
+	
+    CleanupStack::PopAndDestroy( 3 );   // inStream && outStream && buffer
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::BaseExternalizeL
+// Writes the content to stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObject::BaseExternalizeL( RWriteStream& aStream ) const 
+    { 
+		
+    SafeExternalizeL(aStream, Id(), KMaxUpnpObjStringLen);
+    SafeExternalizeL(aStream, ParentId(), KMaxUpnpObjStringLen);
+    
+    aStream.WriteInt8L(Restricted());
+            
+    SafeExternalizeL(aStream, Title(), KMaxUpnpObjStringLen);                            
+    SafeExternalizeL(aStream, ObjectClass(), KMaxUpnpObjStringLen);
+    
+    // Elements
+    aStream.WriteInt16L( iElements.Count() );
+    for ( TInt index(0); index < iElements.Count(); index++ )
+        {
+        iElements[index]->ExternalizeL( aStream );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpObject::SafeExternalizeL
+// Writes safely aNumber of characters from the content to the stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObject::SafeExternalizeL(RWriteStream& aStream, const TDesC8& aDesc, const TInt aNumber) const
+{	
+    if( aDesc.Length() > aNumber )    
+		aStream << aDesc.Mid(0, aNumber);
+    else
+		aStream << aDesc;    
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::BaseInternalizeL
+// Fills item information from stream
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+void CUpnpObject::BaseInternalizeL( RReadStream& aStream )
+    {
+    delete iId;
+    iId = NULL;
+    iId = HBufC8::NewL( aStream, KMaxUpnpObjStringLen  );
+    
+    delete iParentId;
+    iParentId = NULL;
+    iParentId = HBufC8::NewL( aStream, KMaxUpnpObjStringLen );
+    iRestricted = aStream.ReadInt8L();
+    
+    // Name (title)
+    delete iTitle;
+    iTitle = NULL;
+    iTitle = HBufC8::NewL( aStream, KMaxUpnpObjStringLen );
+    
+    // ObjectClass
+    delete iObjectClass;
+    iObjectClass = NULL;
+    iObjectClass = HBufC8::NewL( aStream, KMaxUpnpObjStringLen );	
+            
+    // Elements internalization
+    iElements.ResetAndDestroy();
+    
+    // Elements count
+    TInt elementsCount = aStream.ReadInt16L();	
+    // Then internalize them from the stream one by one
+    for (TInt index = 0; index < elementsCount; index++ )
+        {
+        CUpnpElement* newElement = CUpnpElement::NewLC();
+        newElement->InternalizeL( aStream );
+        iElements.AppendL( newElement );
+        CleanupStack::Pop( newElement ); 
+        }
+	    
+    }
+// -----------------------------------------------------------------------------
+// CUpnpObject::ToDes8L
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+EXPORT_C HBufC8* CUpnpObject::ToDes8L() const
+{
+    // serialize object
+    CBufFlat* buf = CBufFlat::NewL(KDefBufferGranularity);
+    CleanupStack::PushL(buf);
+    RBufWriteStream stream(*buf);
+    CleanupClosePushL(stream);
+    
+    stream << *this;
+    
+    // create heap descriptor
+    HBufC8* hbuf = HBufC8::NewLC(buf->Size());
+    TPtr8 ptr(hbuf->Des());
+    buf->Read(0, ptr, buf->Size());
+    
+    // clean up
+    CleanupStack::Pop(hbuf);
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    
+    return hbuf;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpObject::AddResourceL
+// Attaches proper <res> element (resource associated with an UPnP object) to protocolInfo
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObject::AddResourceL( const TDesC16& aFilename,const TDesC8& aProtocolinfo )
+    {
+	CUpnpElement* elRes = CUpnpElement::NewL(KRes);
+    CleanupStack::PushL( elRes ); 
+    elRes->SetFilePathL(aFilename); 
+   
+    CUpnpAttribute* atImportUri =
+    CUpnpAttribute::NewL(KProtocolinfo);
+    CleanupStack::PushL(atImportUri);
+    atImportUri->SetValueL(aProtocolinfo);
+    elRes->AddAttributeL(atImportUri);
+    CleanupStack::Pop(atImportUri);        
+      
+    AddElementL( elRes );
+    CleanupStack::Pop( elRes );  
+    }
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpobjectlist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,321 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP container class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include	"upnpobject.h"
+#include    "upnpobjectlist.h"
+#include    "upnpitem.h"
+#include    "upnpcontainer.h"
+
+
+
+
+
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::CUpnpObjectList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpObjectList::CUpnpObjectList()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectList::ConstructL( )
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpObjectList* CUpnpObjectList::NewL()
+    {
+    CUpnpObjectList* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpObjectList* CUpnpObjectList::NewLC()
+    {
+    CUpnpObjectList* self = new( ELeave ) CUpnpObjectList;
+    CleanupStack::PushL( self );
+    self->ConstructL(  );
+    return self;
+    }
+      
+// Destructor
+CUpnpObjectList::~CUpnpObjectList()
+    {
+    iObjects.ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::AppendObjectL
+// Appends object to internal array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObjectList::AppendObjectL( CUpnpObject& aNewObject )
+    {
+    iObjects.AppendL( &aNewObject );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::RemoveAndDestroy
+// Removes and destroys object from internal array according to ID.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObjectList::RemoveAndDestroy( const TDesC8& aId )
+    {
+    TInt idx = FindObjectIndex(aId);
+    if(idx != KErrNotFound)
+        {
+        delete iObjects[idx];
+        iObjects.Remove(idx);
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::Remove
+// Detaches object from internal array according to ID and resturns its address.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpObject* CUpnpObjectList::Remove( const TDesC8& aId )
+    {
+    CUpnpObject* ret = NULL;
+    TInt idx = FindObjectIndex(aId);
+    if(idx != KErrNotFound)
+        {
+        ret = iObjects[idx];
+        iObjects.Remove(idx);
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::FindObject
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpObject* CUpnpObjectList::FindObject( const TDesC8& aId )
+    {
+    CUpnpObject* ret = NULL;
+    TInt idx = FindObjectIndex(aId);
+    if(idx != KErrNotFound)
+        {
+        ret = iObjects[idx];
+        }
+    return ret;
+    }
+  
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::ObjectCount
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpObjectList::FindObjectIndex(const TDesC8& aObjId) const
+    {
+    TInt ret = KErrNotFound;
+    
+    // try to find the object with given id
+    for(TInt i = 0; i < iObjects.Count(); i++)
+        {
+        if(iObjects[i]->Id() == aObjId)
+            {
+            ret = i;
+            // stop searching
+            break;
+            }
+        }
+        
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::ObjectCount
+// Counts objects 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpObjectList::ObjectCount( ) const
+    {    
+    return iObjects.Count();
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::GetObjectL
+// Returns object from object array according to index
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpObject* CUpnpObjectList::operator[]( TInt aIndex ) const
+    {
+    return iObjects[aIndex];
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::ExternalizeL
+// Writes the content to stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpObjectList::ExternalizeL( RWriteStream& aStream ) const
+	{
+    // Let's write the count of items to stream first
+    aStream.WriteInt16L( iObjects.Count() );
+    for ( TInt i = 0; i < iObjects.Count(); i++ )
+        {
+        // Need to put the type of the object to stream
+        TPckg<TUPnPObjectType> type( iObjects[i]->ObjectType() );
+        aStream << type;
+        // Then the object itself
+        iObjects[i]->ExternalizeL( aStream );
+        }
+	}
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::InternalizeL
+// Fills container information from stream
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+EXPORT_C void CUpnpObjectList::InternalizeL( RReadStream& aStream )
+    {
+	// internalize the objects
+    iObjects.ResetAndDestroy();
+
+	// First the count of individual objects
+	TInt itemCount = aStream.ReadInt16L();
+
+    TUPnPObjectType type = EUPnPItem;
+    TPckg<TUPnPObjectType> typePkg( type );
+	
+	// Then internalize them from the stream one by one
+	for (TInt index = 0; index < itemCount; index++ )
+	    {
+	    aStream >> typePkg;
+	    
+	    switch ( type )
+	        {
+	        case EUPnPItem:
+	            {
+	            CUpnpItem* newItem = CUpnpItem::NewL();
+	            CleanupStack::PushL( newItem );
+	            newItem->InternalizeL( aStream );
+	            AppendObjectL( *newItem );
+	            CleanupStack::Pop(); 
+	            break;
+	            }
+	        case EUPnPContainer:
+	            {
+	            CUpnpContainer* newObj = CUpnpContainer::NewL();
+	            CleanupStack::PushL( newObj );
+	            newObj->InternalizeL( aStream );
+	            AppendObjectL( *newObj );
+	            CleanupStack::Pop(); 
+	            break;
+	            }
+	        default:
+	            {
+	            break;
+	            }
+	        }
+	    }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::ToDes8L
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+EXPORT_C HBufC8* CUpnpObjectList::ToDes8L() const
+{
+    // serialize object
+    CBufFlat* buf = CBufFlat::NewL(KDefBufferGranularity);
+    CleanupStack::PushL(buf);
+    RBufWriteStream stream(*buf);
+    CleanupClosePushL(stream);
+    
+    stream << *this;
+    
+    // create heap descriptor
+    HBufC8* hbuf = HBufC8::NewLC(buf->Size());
+    TPtr8 ptr(hbuf->Des());
+    buf->Read(0, ptr, buf->Size());
+    
+    // clean up
+    CleanupStack::Pop(hbuf);
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    
+    return hbuf;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectList::ToDes8L
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+EXPORT_C HBufC8* CUpnpObjectList::IdsToDes8L() const
+{
+    // serialize object
+    CBufFlat* buf = CBufFlat::NewL(KDefBufferGranularity);
+    CleanupStack::PushL(buf);
+    RBufWriteStream stream(*buf);
+    CleanupClosePushL(stream);
+    
+    // number of elements
+    TInt n = ObjectCount();
+    stream.WriteInt32L(n);
+    
+    // write each element
+    for(TInt i = 0; i < n; i++)
+    {
+        stream << ( iObjects[i]->Id() );
+    }
+    
+    // create heap descriptor
+    HBufC8* hbuf = HBufC8::NewLC(buf->Size());
+    TPtr8 ptr(hbuf->Des());
+    buf->Read(0, ptr, buf->Size());
+    
+    // clean up
+    CleanupStack::Pop(hbuf);
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    
+    return hbuf;
+}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpprotocolinfo.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,381 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ProtocolInfo base functionality class 
+*
+*/
+
+
+#include "upnpprotocolinfo.h"
+
+#include <e32base.h>
+#include <e32cons.h>
+
+
+const char KProtocolInfoDelimeter = ':'; 
+
+
+//-----------------------------------------------------------------
+//  CProtocolInfo::CProtocolInfo()
+//  Constructor of the class
+//-----------------------------------------------------------------
+CUpnpProtocolInfo::CUpnpProtocolInfo()
+    {
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfo::~CProtocolInfo()
+//  Destructor of the class
+//-----------------------------------------------------------------
+CUpnpProtocolInfo::~CUpnpProtocolInfo()
+    {
+    delete iFirstParameter; 
+    delete iSecondParameter; 
+    delete iThirdParameter; 
+    delete iFourthParameter;    
+    delete iProtocolInfo;
+    }
+
+
+//-----------------------------------------------------------------
+// CProtocolInfo::NewL
+// Factory method for creating instance of class. aInputString must contain protocolInfo string.
+//-----------------------------------------------------------------
+EXPORT_C CUpnpProtocolInfo* CUpnpProtocolInfo::NewL()
+    {
+    CUpnpProtocolInfo* newElement = new (ELeave) CUpnpProtocolInfo();
+    CleanupStack::PushL( newElement );
+    CleanupStack::Pop( newElement );
+    return newElement; 
+    }
+    
+//-----------------------------------------------------------------
+// CProtocolInfo::NewL
+// Factory method for creating instance of class. aInputString must contain protocolInfo string.
+//-----------------------------------------------------------------
+EXPORT_C CUpnpProtocolInfo* CUpnpProtocolInfo::NewL(const TDesC8& aInputString)
+    {
+    CUpnpProtocolInfo* newElement = new (ELeave) CUpnpProtocolInfo();
+    CleanupStack::PushL( newElement );
+    newElement->BaseConstructL( aInputString );     
+    CleanupStack::Pop( newElement );
+    return newElement; 
+    }
+    
+//-----------------------------------------------------------------
+//  CProtocolInfo::BaseConstructL(TDesC8& aInputString)
+//  Method for creating instance of class. aInputString must contain protocolInfo string.
+//-----------------------------------------------------------------
+void CUpnpProtocolInfo::BaseConstructL(const TDesC8& aInputString)
+    {
+    TInt result = ParseL( aInputString );
+    if ( result != KErrNone ) 
+        {
+        User::Leave( result );            
+        }
+    }
+
+
+//-----------------------------------------------------------------
+//  CProtocolInfo::ParseL(TDesC8& aInputString)
+//  Parses aInputString into protocolInfo object.
+//-----------------------------------------------------------------
+TInt CUpnpProtocolInfo::ParseL(const TDesC8& aInputString)
+    {
+    TLex8 input(aInputString);
+    TInt i = 0;
+    TInt result = KErrNone;
+    while( (!input.Eos()) )
+        {
+        ParseAtomToDelimeter( input, KProtocolInfoDelimeter);
+        SetParameterL(i++, input.MarkedToken());
+        SkipAndMark( input, 1 );
+        }
+            
+    return result;        
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfo::GetFourthParameterParameterLength
+//  This function returns length of the string containing all relevant information from fourth ProtocolInfo field. 
+//-----------------------------------------------------------------
+TInt CUpnpProtocolInfo::GetFourthParameterLength()
+    {
+    if ( FourthField() != KNullDesC8)
+        {
+        return iFourthParameter->Length();
+        }
+    else
+        {
+        return 0;        
+        }    
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfo::ParseAtomToDelimeter(TLex8& aLexeme, TChar aDelimeter)
+//  It marks a string placed between start position and aDelimeter
+//-----------------------------------------------------------------
+void CUpnpProtocolInfo::ParseAtomToDelimeter(TLex8& aLexeme, TChar aDelimeter)
+    {
+    aLexeme.Mark(); 
+    while( ( aLexeme.Peek() != aDelimeter ) && ( !aLexeme.Eos() ) )
+        {
+        aLexeme.Inc();        
+        }
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfo::SetParameterL(TInt aWhich, TDesC8& aValue)    
+//  Sets protcolInfo parameters in object.
+//-----------------------------------------------------------------
+void CUpnpProtocolInfo::SetParameterL(TInt aWhich, const TDesC8& aValue)    
+    {
+    switch ( aWhich )
+        {
+        case 0: // FIrst parameter.
+            SetFirstFieldL(aValue);
+            break;
+        case 1: //Second parameter
+            SetSecondFieldL(aValue);
+            break; 
+        case 2: // third parameter. 
+            SetThirdFieldL(aValue);
+            break;
+        case 3: // fourth parameter. 
+            SetFourthFieldL(aValue);
+            break;
+        default: 
+            User::Leave(KErrTooBig);
+        }
+    }
+        
+//-----------------------------------------------------------------
+//  CProtocolInfo::SkipAndMark(TLex8& aLexer, TInt aValue)
+//  Skips aValue characters and marks after end of skipping.
+//-----------------------------------------------------------------
+void CUpnpProtocolInfo::SkipAndMark(TLex8& aLexer, TInt aValue)
+    {
+    if (!aLexer.Eos())
+        {
+        aLexer.SkipAndMark(aValue);
+        }
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfo::Skip(TLex8& aLexer, TInt aValue)
+//  Skips aValue characters. Do not mark
+//-----------------------------------------------------------------
+void CUpnpProtocolInfo::Skip(TLex8& aLexer, TInt aValue)
+    {
+    if (!aLexer.Eos())
+        {
+        aLexer.Inc(aValue);
+        }
+    }    
+        
+//-----------------------------------------------------------------
+//  CProtocolInfo::CheckBooleanValue()
+//  Check if character contains correct value for boolean type (1 or 0)
+//-----------------------------------------------------------------     
+TInt CUpnpProtocolInfo::CheckBooleanValue(TChar aCharacter)
+    {
+    if (aCharacter == '0' || 
+        aCharacter == '1')
+        return KErrNone;
+    else
+        return KErrArgument;
+    }
+
+//-----------------------------------------------------------------
+// CProtocolInfo::GetProtocolInfoLength()
+// Returns the length of the string currently stored in the class.
+//-----------------------------------------------------------------
+TInt CUpnpProtocolInfo::GetProtocolInfoLength()
+    {
+    TInt result = 0; 
+    result += FirstField().Length();
+    result++;
+    result += SecondField().Length();
+    result++; 
+    result += ThirdField().Length(); 
+    result++; 
+    result += GetFourthParameterLength();
+    return result; 
+    }
+
+//// PUBLIC ACCESS METHODS EXPORTED INTERFACE    
+//-----------------------------------------------------------------
+//  CProtocolInfo::GetProtocolInfoL()
+//  Getter for pointer to ProtocolInfo
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpProtocolInfo::ProtocolInfoL()
+    {
+    const TInt size = GetProtocolInfoLength();
+    HBufC8* buffer = HBufC8::NewL(size);
+    CleanupStack::PushL( buffer );
+    TPtr8 bufPtr(buffer->Des());
+    bufPtr.Append(FirstField());
+    bufPtr.Append(KProtocolInfoDelimeter);
+    bufPtr.Append(SecondField());
+    bufPtr.Append(KProtocolInfoDelimeter);
+    bufPtr.Append(ThirdField());
+    bufPtr.Append(KProtocolInfoDelimeter);
+    GetFourthParameterInternalL(bufPtr);
+    if ( iProtocolInfo ) 
+        {
+        delete iProtocolInfo;
+        iProtocolInfo = NULL;            
+        }
+    iProtocolInfo = bufPtr.Alloc();
+    CleanupStack::PopAndDestroy( buffer );
+    return iProtocolInfo->Des();    
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfo::GetFirstField()
+//  Getter for pointer to first parameter.
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpProtocolInfo::FirstField()
+    {
+    if ( iFirstParameter )
+        {
+        return iFirstParameter->Des(); 
+        }
+    else
+        {
+        return KNullDesC8();
+        }
+    }
+    
+//-----------------------------------------------------------------
+//  CProtocolInfo::SetFirstFieldL(TDesC8& aValue)
+//  Setter for first parameter.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpProtocolInfo::SetFirstFieldL(const TDesC8& aValue)
+    {
+    if ( aValue == KNullDesC8 )
+        {
+        return; 
+        }
+    if ( iFirstParameter )
+        {
+        delete iFirstParameter; 
+        iFirstParameter = NULL;
+        }
+    iFirstParameter = aValue.AllocL();
+    }
+    
+//-----------------------------------------------------------------
+//  CProtocolInfo::GetSecondField()
+//  Getter for second parameter.
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpProtocolInfo::SecondField()
+    {
+    if ( iSecondParameter )
+        {
+        return iSecondParameter->Des(); 
+        }
+    else
+        {
+        return KNullDesC8();
+        }
+    }
+    
+//-----------------------------------------------------------------
+// CProtocolInfo::SetSecondFieldL(TDesC8& aValue)
+//  Setter for second parameter.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpProtocolInfo::SetSecondFieldL(const TDesC8& aValue)
+    {
+    if ( aValue == KNullDesC8 )
+        {
+        return; 
+        }
+    if ( iSecondParameter )
+        {
+        delete iSecondParameter;
+        iSecondParameter = NULL; 
+        }
+    iSecondParameter = aValue.AllocL();
+    }
+    
+//-----------------------------------------------------------------
+//  CProtocolInfo::GetThirdField()
+//  Getter for third parameter.
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpProtocolInfo::ThirdField()
+    {
+    if ( iThirdParameter )
+        {
+        return iThirdParameter->Des(); 
+        }
+    else 
+        {
+        return KNullDesC8();
+        }
+    }
+    
+//-----------------------------------------------------------------
+//  CProtocolInfo::SetThirdFieldL(TDesC8& aValue)
+//  Setter for third parameter.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpProtocolInfo::SetThirdFieldL(const TDesC8& aValue)
+    {
+    if ( iThirdParameter )
+        {
+        delete iThirdParameter; 
+        iThirdParameter = NULL;
+        }
+    iThirdParameter = aValue.AllocL();
+
+    }
+
+//-----------------------------------------------------------------
+//  CProtocolInfo::GetFourthField()
+//  Getter for fourth parameter.
+//-----------------------------------------------------------------
+EXPORT_C TPtrC8 CUpnpProtocolInfo::FourthField()
+    {
+    if ( iFourthParameter )
+        {
+        return iFourthParameter->Des(); 
+        }
+    else 
+        {
+        return KNullDesC8(); 
+        }
+    }
+    
+//-----------------------------------------------------------------
+//  CProtocolInfo::SetFourthFieldL(TDesC8& aValue)
+//  Setter for fourth parameter value.
+//-----------------------------------------------------------------
+EXPORT_C void CUpnpProtocolInfo::SetFourthFieldL(const TDesC8& aValue)
+    {
+    if ( iFourthParameter )
+        {
+        delete iFourthParameter; 
+        iFourthParameter = NULL;
+        }
+    iFourthParameter = aValue.AllocL();
+    }
+        
+//-----------------------------------------------------------------
+//  CProtocolInfo::GetFourthParameterInternalL
+//-----------------------------------------------------------------
+void CUpnpProtocolInfo::GetFourthParameterInternalL(TDes8& aBuffer)
+    {
+    aBuffer.Append(FourthField());        
+    }
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/avobjects/src/upnpprotocolinfolocal.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,354 @@
+/** @file
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares ProtocolInfo field wrapper. 
+*
+*/
+
+
+#include "upnpprotocolinfolocal.h"
+#include "upnpdlnaprotocolinfocons.h"
+
+#include <e32base.h>
+#include <e32cons.h>
+
+using namespace UpnpDlnaProtocolInfo;
+
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::CUpnpProtocolInfoLocal()
+//  Constructor of the class
+//-----------------------------------------------------------------
+CUpnpProtocolInfoLocal::CUpnpProtocolInfoLocal(): CUpnpDlnaProtocolInfo()
+    {
+    }
+
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::~CUpnpProtocolInfoLocal()
+//  Destructor of the class
+//-----------------------------------------------------------------
+CUpnpProtocolInfoLocal::~CUpnpProtocolInfoLocal()
+    {
+    }
+
+//-----------------------------------------------------------------
+// CUpnpProtocolInfoLocal::NewL
+// Method for creating instance of class. aInputString has to contain protocolInfo string.
+//-----------------------------------------------------------------
+EXPORT_C CUpnpProtocolInfoLocal* CUpnpProtocolInfoLocal::NewL(const TDesC8& aInputString)
+    {
+    CUpnpProtocolInfoLocal* newElement = new (ELeave) CUpnpProtocolInfoLocal();
+    CleanupStack::PushL( newElement );
+    newElement->ConstructL( aInputString ); 
+    newElement->SetDefaultFourthField();      
+    CleanupStack::Pop( newElement );
+    return newElement; 
+    }
+    
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::NewL
+//  Method for creating instance of class. 
+//  aMimeType - mime type for file.
+//  aAdditionalInfo - additional information about what DLNA.ORG_PN type should be used
+//-----------------------------------------------------------------
+EXPORT_C CUpnpProtocolInfoLocal* CUpnpProtocolInfoLocal::NewL(const TDesC8& aMimeType, TInt aAdditionalInfo)
+    {
+    CUpnpProtocolInfoLocal* newElement = new (ELeave) CUpnpProtocolInfoLocal();
+    CleanupStack::PushL( newElement );
+    newElement->ConstructL( aMimeType, aAdditionalInfo ); 
+    CleanupStack::Pop( newElement );
+    return newElement;   
+    }
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::NewL
+//  Method for creating instance of class.
+//  aMimeType - mime type for file.
+//-----------------------------------------------------------------
+EXPORT_C CUpnpProtocolInfoLocal* CUpnpProtocolInfoLocal::NewL(const TDesC8& aMimeType, const TDesC8& aDlnaPn)
+    {
+    CUpnpProtocolInfoLocal* self = new (ELeave) CUpnpProtocolInfoLocal();
+    CleanupStack::PushL( self );
+    self->ConstructFromDlnaPnL( aMimeType, aDlnaPn ); 
+    CleanupStack::Pop( self );
+    return self;   
+    }
+
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::ConstructFromDlnaPnL(const TDesC8& aMimeType, const TDesC8& aDlnaPn)
+//  Method for creating instance of class. aInputString has to contain protocolInfo string.
+//-----------------------------------------------------------------
+void CUpnpProtocolInfoLocal::ConstructFromDlnaPnL(const TDesC8& aMimeType, const TDesC8& aDlnaPn)
+    {
+    SetFirstFieldL(KDEFAULT_1ST_PARAM);
+    SetSecondFieldL(KDEFAULT_STAR_PARAM);
+    SetThirdFieldL(aMimeType);
+    
+    /*
+    * Requirements:
+    * 1)  7.3.28.3 MM CMS:GetProtocolInfo Rules: Formatting options for Connection Manager Service 
+    * 2)  7.3.134.3 MM/CM General Rules for CDS:CreateObject Errors: Bad Class or ProtoInfo 
+    *
+    * This concerns the following protocolInfo's:
+    *
+    *       http-get:*:image/jpeg:*
+    *       http-get:*:image/gif:*
+    *       http-get:*:audio/mpeg:*
+    *       http-get:*:audio/mp4:*
+    *       http-get:*:*:*
+    */
+    if ( aDlnaPn == KDEFAULT_STAR_PARAM )
+        {
+        SetFourthFieldL(aDlnaPn);
+        }
+    else
+        {
+        SetPnParameterL(aDlnaPn);
+        SetDefaultFourthField();
+        }            
+    }
+
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::ConstructL(TDesC8& aInputString)
+//  Method for creating instance of class. aInputString has to contain protocolInfo string.
+//-----------------------------------------------------------------
+void CUpnpProtocolInfoLocal::ConstructL(const TDesC8& aInputString)
+    {
+    CUpnpDlnaProtocolInfo::ConstructL(aInputString);
+    }
+
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::ConstructL(TDesC8& aInputString)
+//  Method for creating instance of class.
+//-----------------------------------------------------------------
+void CUpnpProtocolInfoLocal::ConstructL(const TDesC8& aMimeType, TInt aAdditionalInfo)
+    {
+    DefaultValuesL();
+    ChooseDlnaL(aMimeType, aAdditionalInfo);
+    }
+
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::ChooseDlnaL(TDesC8& aMimeType, TInt aAdditionalInfo)
+//  Main function for creating from mime type.
+//-----------------------------------------------------------------
+void CUpnpProtocolInfoLocal::ChooseDlnaL(const TDesC8& aMimeType, TInt aAdditionalInfo)
+    {
+    switch(aAdditionalInfo)
+        {
+        case NO_DLNA_DATA: 
+            break; 
+        case NO_ADDITIONAL_INFO: 
+            FillAccordingToMimeL(aMimeType);
+            break;
+            
+        default: 
+            FillAccordingToAddInfoL(aAdditionalInfo);
+            break; 
+        }
+    }
+    
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::DefaultValuesL()
+//  Fills up default values to create protocolInfo in form: "http-get:*:*:*"
+//-----------------------------------------------------------------
+void CUpnpProtocolInfoLocal::DefaultValuesL()
+    {
+    SetFirstFieldL(KDEFAULT_1ST_PARAM());
+    SetSecondFieldL(KDEFAULT_STAR_PARAM());
+    SetThirdFieldL(KDEFAULT_STAR_PARAM());
+    SetFourthFieldL( KDEFAULT_STAR_PARAM() );
+    }    
+
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::FillAccordingToAddInfoL(TInt aAdditionalInfo)
+//  Fills dlna parameters according only to additionalInfo which is TInt value.
+//-----------------------------------------------------------------
+void CUpnpProtocolInfoLocal::FillAccordingToAddInfoL(TInt aAdditionalInfo)
+    {
+    switch(aAdditionalInfo)
+        {
+        case JPEG_SM: 
+            SetPnParameterL( KDLNA_PN_JPEG_SM() );
+            break; 
+        case JPEG_MED:
+            SetPnParameterL( KDLNA_PN_JPEG_MED() );
+            break; 
+        case JPEG_LRG:
+            SetPnParameterL( KDLNA_PN_JPEG_LRG() );
+            break; 
+        case JPEG_TN:
+            SetPnParameterL( KDLNA_PN_JPEG_TN() );
+            break;
+        case JPEG_SM_ICO:
+            SetPnParameterL( KDLNA_PN_JPEG_SM_ICO() );
+            break;
+        case JPEG_LRG_ICO:
+            SetPnParameterL( KDLNA_PN_JPEG_LRG_ICO() );
+            break;
+        case PNG_TN:
+            SetPnParameterL( KDLNA_PN_PNG_TN() );
+            break;
+        case PNG_SM_ICO:
+            SetPnParameterL( KDLNA_PN_PNG_SM_ICO() );
+            break;
+        case PNG_LRG_ICO:
+            SetPnParameterL( KDLNA_PN_PNG_LRG_ICO() );
+            break;
+        case PNG_LRG:
+            SetPnParameterL(  KDLNA_PN_PNG_LRG() );
+            break;
+        case MP3:
+            SetPnParameterL( KDLNA_PN_MP3() );
+            break;
+        default:
+            break;
+        }
+        SetFourthFieldL( KNullDesC8() );        
+    }
+    
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::FillAccordingToMimeL(TDesC8& aMimeType)
+//  Fills dlna parameters according only to info in mime type.
+//-----------------------------------------------------------------
+void CUpnpProtocolInfoLocal::FillAccordingToMimeL(const TDesC8& aMimeType)
+    {
+    HBufC8* mimeTypeH = aMimeType.AllocLC();
+    TPtr8 mimeType(mimeTypeH->Des());
+    mimeType.LowerCase();
+    if ( mimeType.Compare( KMT_IMAGE_JPEG ) == 0 )
+        {
+        SetPnParameterL(KDLNA_PN_JPEG_LRG() );
+        }
+    else if (mimeType.Compare( KMT_IMAGE_PNG ) == 0 )
+        {
+        SetPnParameterL( KDLNA_PN_PNG_LRG() );    
+        }
+    else if ( mimeType.Compare( KMT_AUDIO_MP3 ) == 0 )
+        {
+        SetPnParameterL( KDLNA_PN_MP3() );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy(mimeTypeH);
+        return;
+        }
+    CleanupStack::PopAndDestroy(mimeTypeH);
+    SetFourthFieldL( KNullDesC8() );
+    }        
+    
+//-----------------------------------------------------------------
+//  CUpnpProtocolInfoLocal::SetDefaultForthParameter()
+//  This member function sets defult values for optional parameters of 4th field
+//-----------------------------------------------------------------
+void CUpnpProtocolInfoLocal::SetDefaultFourthField()
+    {
+    
+    if ( iThirdParameter -> FindC( KMimeImage() ) != 0 && 
+        iThirdParameter -> FindC( KMimeAudio() ) != 0 &&
+        iThirdParameter -> FindC( KMimeVideo() ) != 0 )
+        {
+        return;
+        }
+        
+    SetOpTimeParam(EFalse);
+    SetOpRangeParam(ETrue);
+    
+    iDlnaFlags[0] = 0;
+    iDlnaFlags[1] = 0;
+    iDlnaFlags[2] = 0;
+    iDlnaFlags[3] = 0;
+    
+    if ( iThirdParameter -> FindC( KMimeImage() ) == 0 ) 
+        {
+        SetDlnaFlag( ETrue, TM_I_FLAG);
+        SetDlnaFlag( ETrue, TM_B_FLAG);
+        }
+
+    if ( iThirdParameter -> FindC( KMimeAudio() ) == 0 ) 
+        {
+        SetDlnaFlag( ETrue, TM_S_FLAG);
+        SetDlnaFlag( ETrue, TM_B_FLAG);
+        }
+    
+    if ( iThirdParameter -> FindC( KMimeVideo() ) == 0 ) 
+        {
+        SetDlnaFlag( ETrue, TM_S_FLAG);
+        SetDlnaFlag( ETrue, TM_B_FLAG);
+        }    
+    SetDlnaFlag( ETrue, DLNA_V1_5_FLAG );
+    }        
+    
+void CUpnpProtocolInfoLocal::GetFourthParameterInternalL(TDes8& aBuffer)    
+    {
+    _LIT8( KTempAsterix, "*");
+    if (iFourthParameter)
+        {
+        if ( iFourthParameter->Des() == KTempAsterix())
+            {
+            aBuffer.Append(iFourthParameter->Des());                
+            }        
+            else
+            {
+            CUpnpDlnaProtocolInfo::GetFourthParameterInternalL(aBuffer);                
+            }
+        }
+     else
+        {  
+        if ( PnParameter() == KNullDesC8 )        
+            {
+            aBuffer.Append(KDlnaAllStar);
+            return;
+            }
+        aBuffer.Append( KDLNA_PN );
+        aBuffer.Append( KDlnaTokenizer ); 
+        aBuffer.Append( *iDlnaPn );
+        if ( GetDlnaOpRangeParam() || GetDlnaOpTimeParam() )
+            {
+            aBuffer.Append( KDlnaDelimeter ); 
+            aBuffer.Append( KDLNA_OP );
+            aBuffer.Append( KDlnaTokenizer ); 
+            aBuffer.Append( GetDlnaOpTimeParam() ? KDLNA_BOOLEAN_TRUE:KDLNA_BOOLEAN_FALSE); //Time value 0,1
+            aBuffer.Append( GetDlnaOpRangeParam() ? KDLNA_BOOLEAN_TRUE:KDLNA_BOOLEAN_FALSE); //Range value 0,1
+            }
+        if ( PsParameter() != KNullDesC8 )
+            {
+        //    aBuffer.Append( KDlnaDelimeter ); 
+        //    aBuffer.Append( KDLNA_PS );
+        //    aBuffer.Append( KDlnaTokenizer ); 
+        //    aBuffer.Append( *iDlnaPs );
+            }
+        if ( iDlnaCi != KErrNotFound )
+            {
+            aBuffer.Append( KDlnaDelimeter ); 
+            aBuffer.Append( KDLNA_CI );
+            aBuffer.Append( KDlnaTokenizer ); 
+            aBuffer.Append( iDlnaCi ? KOneChar() : KZeroChar() ); 
+            }
+        
+        TBool saveDlnaFlags = IsDlnaFlagsSet();
+        
+        if ( saveDlnaFlags )
+            {
+            aBuffer.Append( KDlnaDelimeter ); 
+            aBuffer.Append( KDLNA_FLAGS );
+            aBuffer.Append( KDlnaTokenizer ); 
+            SerializeDlnaFlagsL( aBuffer );
+            }
+        if ( GetOtherParams() != KNullDesC8) 
+            {
+            aBuffer.Append( KDlnaDelimeter ); 
+            aBuffer.Append( *iOtherParams );
+            }
+        }           
+    }
+    
+    
+//end of file
Binary file upnpmediaserver/cenrep/keys_upnpmediaserver.xls has changed
Binary file upnpmediaserver/conf/upnpmediaserver.confml has changed
Binary file upnpmediaserver/conf/upnpmediaserver_101F978F.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/connectionmanagerservice/BWINS/AVConnectionManagerU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CUpnpCM@@SAPAV1@AAVCUpnpDevice@@ABVTDesC8@@ABVTDesC16@@@Z @ 1 NONAME ; class CUpnpCM * CUpnpCM::NewL(class CUpnpDevice &, class TDesC8 const &, class TDesC16 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/connectionmanagerservice/EABI/AVConnectionManagerU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN7CUpnpCM4NewLER11CUpnpDeviceRK6TDesC8RK7TDesC16 @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/connectionmanagerservice/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,22 @@
+/** @file
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for the Connection Manager Service component
+*
+*/
+
+PRJ_EXPORTS
+../inc/upnpcm.h |../../inc/upnpcm.h
+
+PRJ_MMPFILES
+connectionmanagerservice.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/connectionmanagerservice/group/connectionmanagerservice.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,52 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*     This is the project specification file for Upnp.
+*
+*/
+#include <platform_paths.hrh>
+
+TARGETTYPE      DLL
+TARGET          avconnectionmanager.dll
+UID             0x1000008d 0x1020415A
+
+
+VERSION 10.1
+paged
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          upnpcm.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+LIBRARY         euser.lib
+LIBRARY         bafl.lib
+
+// UPnP
+LIBRARY         upnpserviceframework.lib
+LIBRARY         upnpipserversutils.lib
+LIBRARY         upnpavobjects.lib
+LIBRARY         avmediaserverclient.lib
+
+
+LIBRARY         flogger.lib
+DEFFILE         AVConnectionManager
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/connectionmanagerservice/inc/upnpcm.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,145 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares ConnectionManager class
+*
+*/
+class CUpnpSecurityManager;
+
+
+#ifndef C_CUPNPCM_H
+#define C_CUPNPCM_H
+
+// INCLUDES
+#include "upnpserviceimplementation.h"
+
+const TInt KGranularity = 10;
+const TInt KBufExpandSize = 128;
+_LIT8(KConnectionManagerType, "ConnectionManager:1" );
+
+/**
+*  Declares ConnectionManager class
+*  This service-type enables modeling of streaming capabilities of A/V devices, 
+*  and binding of those capabilities between devices.
+*
+*  @upnpcm.lib
+*  @since Series60 2.6
+*/
+NONSHARABLE_CLASS( CUpnpCM ): public CUpnpServiceImplementation
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUpnpCM* NewL( CUpnpDevice& aParentService, 
+                                       const TDesC8& aMediaTypes,
+                                       const TDesC& aDescriptionPath );
+        /**
+        * Destructor.
+        */
+        ~CUpnpCM();
+                
+    public: // Functions from CUpnpServiceImplementation
+
+        /**
+        * ActionReceivedLD
+        * From CUpnpServiceImplementation,Handles actions received from the 
+        * ServiceFramework, see coments in base class
+        * @since Series60 2.0
+        * @param aAction Pointer to Action element that is going to be handled
+        */
+        void ActionReceivedLD( CUpnpAction* aAction );
+
+    public: // Functions from CConnectionManager
+
+        /**
+        * GetProtocolInfo
+        * From CConnectionManager,Handles GetProtocolInfo actions by setting
+        * the needed information to aAction
+        * @since Series60 2.0
+        * @param aAction Instructions
+        * @return TUpnpErrocCode, Returns an error code if the operation has
+        * failed
+        */
+        TUpnpErrorCode GetProtocolInfoL( CUpnpAction* aAction );
+
+        /**
+        * PrepareForConnection
+        * From CConnectionManager,Handles PrepareForConnection actions 
+        * according to instructions
+        * @since Series60 2.0
+        * @param aAction Instructions
+        * @return TUpnpErrocCode, Returns an error code if the operation
+        * has failed
+        */
+        TUpnpErrorCode PrepareForConnection( CUpnpAction* aAction );
+
+        /**
+        * ConnectionComplete
+        * From CConnectionManager,Releases the connection specified in the
+        * aAction
+        * @since Series60 2.0
+        * @param aAction Instructions
+        * @return TUpnpErrocCode, Returns an error code if the operation has
+        * failed
+        */
+        TUpnpErrorCode ConnectionComplete( CUpnpAction* aAction );
+
+        /**
+        * GetCurrentConnectionIDsL
+        * From CConnectionManager,Check the current connections and inserts a 
+        * CSV list of them into the aAction
+        * @since Series 602.0
+        * @param aAction Instructions
+        * @return TUpnpErrocCode, Returns an error code if the operation has 
+        * failed
+        */
+        TUpnpErrorCode GetCurrentConnectionIDsL( CUpnpAction* aAction );
+
+        /**
+        * GetCurrentConnectionIDsL
+        * From CConnectionManager,Checks the ConnectionInfo of the connection 
+        * specified in the aAction and sets the data to aAction
+        * @since Series60 2.0
+        * @param aAction Instructions
+        * @return TUpnpErrocCode, Returns an error code if the operation has 
+        * failed
+        */
+        TUpnpErrorCode GetCurrentConnectionInfoL( CUpnpAction* aAction );
+        
+	private: 	
+		/**
+        * C++ default constructor.
+        */
+        CUpnpCM(CUpnpDevice& aDevice);
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        * @param aParentService Reference to parent service
+        */
+        void ConstructL( const TDesC8& aMediaTypes, const TDesC& aDescriptionPath );    
+
+    private: 
+
+        HBufC8* CreateProtocolInfosL(const TDesC8& aMediaTypes );
+		void GetMediaListFromStringL(CPtrC8Array* aList, const TDesC8& aMediaTypes);
+
+    private:
+        CUpnpSecurityManager* iSecurityManager;
+		
+	};
+
+#endif // C_CUPNPCM_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/connectionmanagerservice/src/upnpcm.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,364 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares ConnectionManager class
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <upnpdlnaprotocolinfo.h>
+#include "upnpprotocolinfolocal.h"
+
+#include <e32std.h>
+#include "upnpcm.h"
+#include "upnperrors.h"
+#include "upnpargument.h"
+#include "upnpcommonupnplits.h"
+#include "upnpdeviceimplementationbase.h"
+#include "upnpsecuritymanager.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::CUpnpCM
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpCM::CUpnpCM( CUpnpDevice& aDevice ) : CUpnpServiceImplementation(aDevice)
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::~CUpnpCM
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCM::~CUpnpCM()
+	{
+	delete iSecurityManager;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::ConstructL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpCM* CUpnpCM::NewL( CUpnpDevice& aDevice, 
+                                 const TDesC8& aMediaTypes,
+                                 const TDesC& aDescriptionPath )
+	{
+	CUpnpCM* self = new (ELeave) CUpnpCM(aDevice);
+	CleanupStack::PushL( self );
+	self->ConstructL( aMediaTypes, aDescriptionPath );
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpCM::ConstructL( const TDesC8& aMediaTypes, const TDesC& aDescriptionPath )
+	{
+	BaseConstructL( aDescriptionPath, KConnectionManagerType() );	
+	
+	// create ptocolInfos string
+	HBufC8* protInfs = CreateProtocolInfosL(aMediaTypes);
+	CleanupStack::PushL(protInfs);
+	
+	// set variable	
+	SetStateVariableL( KProtInf, KEmptyString);
+	SetStateVariableL( KSourceInf, *protInfs );
+	SetStateVariableL( KSinkInf, KEmptyString );
+		
+	// clean up
+	CleanupStack::PopAndDestroy(protInfs);
+	
+	SetStateVariableL( KCurConId,KZero );
+	SetStateVariableL( KRcsId, UpnpCD::KMinusOne );
+	SetStateVariableL( KAvtransId, UpnpCD::KMinusOne );
+	SetStateVariableL( KConMan, KEmptyString );
+    SetStateVariableL( KConId, UpnpCD::KMinusOne );
+	SetStateVariableL( KDirection, KOutput );
+	SetStateVariableL( KConStat, KOk );
+	
+	iSecurityManager = CUpnpSecurityManager::NewInstanceFromUpnpSettingsL();
+	}
+// -----------------------------------------------------------------------------
+// CUpnpCM::CreateProtocolInfosL
+// Handle action received from ServiceFramework
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpCM::CreateProtocolInfosL(const TDesC8& aMediaTypes )
+    {
+	// parse comma separated media types
+	CPtrC8Array* pairs = new(ELeave) CPtrC8Array(KGranularity);
+	CleanupStack::PushL(pairs);
+	GetMediaListFromStringL(pairs, aMediaTypes);
+
+	// buffer
+	CBufFlat* buf = CBufFlat::NewL(KBufExpandSize);
+	CleanupStack::PushL(buf);
+
+	// for each media element
+	for (TInt i = 0; i < pairs->Count(); i++ )
+	    {
+		// create protocolInfo
+		TInt pos(KErrNotFound);
+		User::LeaveIfError(pos = (*pairs)[i].Find(KColon));
+		TPtrC8 a((*pairs)[i].Left(pos));
+		CUpnpProtocolInfoLocal* protInfo = 
+				CUpnpProtocolInfoLocal::NewL( (*pairs)[i].Left(pos), (*pairs)[i].Mid(pos+1) );
+		CleanupStack::PushL(protInfo);
+		
+		// get protocolInfo string
+		TPtrC8 protocolInfo = protInfo->ProtocolInfoL();
+		HBufC8* protStr = protocolInfo.Alloc();
+		CleanupStack::PushL(protStr);
+		
+		// add to the buffer
+		buf->InsertL(buf->Size(), *protStr);
+		
+		// add separator
+		buf->InsertL(buf->Size(), KComma);
+		CleanupStack::PopAndDestroy(protStr);
+		CleanupStack::PopAndDestroy(protInfo);
+	    }
+	// delete last separator
+	buf->Delete(buf->Size() - 1,KComma().Length());
+	
+	// alloc heap descriptor
+	HBufC8* ret = buf->Ptr(0).AllocL();	
+	
+	// clean up
+	CleanupStack::PopAndDestroy(buf);
+	CleanupStack::PopAndDestroy(pairs);
+	
+	// return descritpor
+	return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::GetMediaListFromStringL
+// Handle action received from ServiceFramework
+// -----------------------------------------------------------------------------
+//
+void CUpnpCM::GetMediaListFromStringL(CPtrC8Array* aList, const TDesC8& aMediaTypes)
+    {
+	TPtrC8 ml(aMediaTypes);
+	TInt pos = KErrNotFound;
+	while ((pos = ml.Find(KComma)) != KErrNotFound)
+	    {
+		aList->AppendL(ml.Left(pos));
+		ml.Set(ml.Mid(pos+1));
+	    }
+	aList->AppendL(ml);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::ActionReceivedLD
+// Handle action received from ServiceFramework
+// -----------------------------------------------------------------------------
+//
+void CUpnpCM::ActionReceivedLD( CUpnpAction* aAction )
+	{
+	CleanupStack::PushL( aAction );
+        //check security
+    if ( iSecurityManager &&
+            KErrNone != iSecurityManager->AuthorizeAction( aAction ) )
+        {
+        //server returns upnp error action failed when not authorized
+        User::Leave(EActionFailed);
+        }
+	TUpnpErrorCode eCode = EHttpOk;
+
+    if ( !aAction )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+	if ( aAction->Name().Compare( KGetProtInfo ) == 0 )
+		{
+		//Get supported Protocols
+		eCode = GetProtocolInfoL( aAction );
+		}
+	else if ( aAction->Name().Compare( KGetCurConIds ) == 0 ) 
+		{
+		//Get Current Connection IDs 
+		eCode = GetCurrentConnectionIDsL( aAction );
+		}
+	else if ( aAction->Name().Compare( KGetCurConInfo ) == 0 )
+		{
+		//Get Current Connection Info
+		eCode = GetCurrentConnectionInfoL( aAction );
+		}
+	else if ( aAction->Name().Compare( KPrepareForConnection ) == 0 ) 
+		{
+		eCode = PrepareForConnection( aAction );
+		}
+	else if ( aAction->Name().Compare( KConnectionComplete ) == 0 )
+		{
+		eCode = ConnectionComplete( aAction );
+		}
+    else
+        {
+        // Action not defined
+		eCode = EInvalidAction;
+        }
+	SendL( aAction, eCode );
+	CleanupStack::PopAndDestroy( aAction );
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::GetProtocolInfoL
+// Checks current stateVariables from stateVariableList returns Protocol-related
+// info
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpCM::GetProtocolInfoL( CUpnpAction* aAction )
+	{			
+	if ( aAction->SetArgumentL( KSource, 
+				StateVariableValue( KSourceInf )) == KErrNone && 
+				
+ 		aAction->SetArgumentL( KSink, 
+				StateVariableValue( KSinkInf )) == KErrNone) 
+		{
+		return EHttpOk;
+		}
+	else 	
+		{
+		return EInvalidArgs;
+		}					
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::PrepareForConnection
+// Gets source and sink protocol info
+// source = iSourceProtocolInfo
+// sink = iSinkProtocolInfo
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpCM::PrepareForConnection( CUpnpAction* /*aAction*/ )
+	{
+    // Not implemented in Media Server side.
+	return ENotImplemented;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::ConnectionComplete
+// Fetch the AVTransport ID by giving ConnectionID
+// iAVTransport->GetAVTransportID(ConnectionID)
+// remove this ID from ConnectionIDs
+// release network resources
+// Cleanup
+// Update source & sink devices information in stateVariableList
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpCM::ConnectionComplete( CUpnpAction* /*aAction*/ )
+	{
+    // Not implemented in Media Server side.
+	return ENotImplemented;
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::GetCurrentConnectionIDsL
+// Check the current connections and insert a CSV list of them into the aAction
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpCM::GetCurrentConnectionIDsL( CUpnpAction* aAction )
+	{
+	if ( aAction->SetArgumentL( KConnectionIDs, 
+				StateVariableValue( KCurConId )) == KErrNone) 
+		{
+		return EHttpOk;
+		}
+	else 	
+		{
+		return EInvalidArgs;
+		}	
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpCM::GetCurrentConnectionInfoL
+// Checks the ConnectionInfo of the connection specified in the aAction and sets
+// the data to aAction
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpCM::GetCurrentConnectionInfoL( CUpnpAction* aAction )
+	{
+	/**
+	*Check the given connection is set up by PrepareForConnection()
+	*if(connectionID == 0){
+	*iRcsID=-1;
+	*iAVTransportID = -1;
+	*iProtocolInfo = NULL;
+	*iPeerConnectionManager = NULL;
+	*iPeerConnectionID = -1;
+	*iDirection = input (or output);
+	*iStatus = OK (or Unknown);
+	* Gets the connection information by given connection ID.. 
+	*
+	*Acceptable Error Codes
+	*	EInvalidArgs	=	402
+	*	EParameterMismatch = 706
+	**/	
+
+	const TDesC8& connectionID = aAction->ArgumentValue( KArgument() ); 
+	TLex8 string( connectionID );
+	TInt testInt;
+	TInt error = string.Val( testInt );
+	if ( error != KErrNone )
+		{
+		return EInvalidArgs;
+		}
+
+	if ( connectionID.CompareC( KZero() ) == 0 )
+		{
+		if ( aAction->SetArgumentL( KTypeRcsID, 
+				StateVariableValue( KRcsId )) == KErrNone && 
+				
+ 			aAction->SetArgumentL( KTypeAVTransportID, 
+				StateVariableValue( KAvtransId )) == KErrNone && 
+				
+ 			aAction->SetArgumentL( KTypeProtocolInfo, 
+				StateVariableValue( KArgTypeProtocolInfo )) == KErrNone && 
+				
+ 			aAction->SetArgumentL( KTypePeerConnectionManager, 
+				StateVariableValue( KConMan )) == KErrNone && 
+				
+ 			aAction->SetArgumentL( KTypePeerConnectionID, 
+				StateVariableValue( KConId )) == KErrNone && 
+				
+ 			aAction->SetArgumentL( KTypeDirection, 
+				StateVariableValue( KDirection )) == KErrNone && 	
+				
+ 			aAction->SetArgumentL( KTypeStatus, 
+				StateVariableValue( KConStat )) == KErrNone ) 
+			{
+			return EHttpOk;
+			}
+		else 	
+			{
+			return EInvalidArgs;
+			}
+		} 
+	
+	return EParameterMismatch;
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/BWINS/AVContentDirectoryU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,28 @@
+EXPORTS
+	?UnknownHttpEventReceivedL@CUpnpContentDirectory@@QAEXAAVCUpnpHttpMessage@@@Z @ 1 NONAME ; void CUpnpContentDirectory::UnknownHttpEventReceivedL(class CUpnpHttpMessage &)
+	?SendActionL@CUpnpContentDirectory@@QAEXPAVCUpnpAction@@W4TUpnpErrorCode@@@Z @ 2 NONAME ; void CUpnpContentDirectory::SendActionL(class CUpnpAction *, enum TUpnpErrorCode)
+	?NewL@CUpnpContentDirectoryService@@SAPAV1@XZ @ 3 NONAME ; class CUpnpContentDirectoryService * CUpnpContentDirectoryService::NewL(void)
+	?ShareReferenceListL@CUpnpContentDirectoryService@@QAEXPAVCUpnpItemList@@PAH@Z @ 4 NONAME ; void CUpnpContentDirectoryService::ShareReferenceListL(class CUpnpItemList *, int *)
+	?NewLC@CUpnpContentDirectoryService@@SAPAV1@UTUpnpCdSettings@@@Z @ 5 NONAME ; class CUpnpContentDirectoryService * CUpnpContentDirectoryService::NewLC(struct TUpnpCdSettings)
+	?GetSingleContainerL@CUpnpContentDirectoryService@@QAEPAVCUpnpContainer@@H@Z @ 6 NONAME ; class CUpnpContainer * CUpnpContentDirectoryService::GetSingleContainerL(int)
+	?AddressChangeL@CUpnpContentDirectoryService@@QAEXXZ @ 7 NONAME ; void CUpnpContentDirectoryService::AddressChangeL(void)
+	?UnshareItemL@CUpnpContentDirectoryService@@QAEXH@Z @ 8 NONAME ; void CUpnpContentDirectoryService::UnshareItemL(int)
+	?SendMessageL@CUpnpContentDirectory@@QAEXPAVCUpnpHttpMessage@@@Z @ 9 NONAME ; void CUpnpContentDirectory::SendMessageL(class CUpnpHttpMessage *)
+	?ShareReferenceL@CUpnpContentDirectoryService@@QAEXPAVCUpnpItem@@@Z @ 10 NONAME ; void CUpnpContentDirectoryService::ShareReferenceL(class CUpnpItem *)
+	?GetContentDirectory@CUpnpContentDirectoryService@@QAEPAVCUpnpContentDirectory@@XZ @ 11 NONAME ; class CUpnpContentDirectory * CUpnpContentDirectoryService::GetContentDirectory(void)
+	?UnshareItemListL@CUpnpContentDirectoryService@@QAEXAAV?$RArray@H@@PAH@Z @ 12 NONAME ; void CUpnpContentDirectoryService::UnshareItemListL(class RArray<int> &, int *)
+	?GetAddress@CUpnpContentDirectoryService@@QAE?AVTInetAddr@@XZ @ 13 NONAME ; class TInetAddr CUpnpContentDirectoryService::GetAddress(void)
+	?NewTransactionL@CUpnpContentDirectory@@UAEXABVTDesC8@@0ABVTInetAddr@@AAPAVCUpnpHttpServerTransaction@@@Z @ 14 NONAME ; void CUpnpContentDirectory::NewTransactionL(class TDesC8 const &, class TDesC8 const &, class TInetAddr const &, class CUpnpHttpServerTransaction * &)
+	?NewL@CUpnpContentDirectoryService@@SAPAV1@UTUpnpCdSettings@@@Z @ 15 NONAME ; class CUpnpContentDirectoryService * CUpnpContentDirectoryService::NewL(struct TUpnpCdSettings)
+	?SetDownloadDirectoryL@CUpnpContentDirectoryService@@QAEXABVTDesC16@@@Z @ 16 NONAME ; void CUpnpContentDirectoryService::SetDownloadDirectoryL(class TDesC16 const &)
+	?ShareItemListL@CUpnpContentDirectoryService@@QAEXPAVCUpnpItemList@@PAH@Z @ 17 NONAME ; void CUpnpContentDirectoryService::ShareItemListL(class CUpnpItemList *, int *)
+	?ShareObjectL@CUpnpContentDirectoryService@@QAEXPAVCUpnpObject@@@Z @ 18 NONAME ; void CUpnpContentDirectoryService::ShareObjectL(class CUpnpObject *)
+	?SetSender@CUpnpContentDirectory@@QAEXPAVMUpnpCdsSender@@@Z @ 19 NONAME ; void CUpnpContentDirectory::SetSender(class MUpnpCdsSender *)
+	?UnshareContainerL@CUpnpContentDirectoryService@@QAEXH@Z @ 20 NONAME ; void CUpnpContentDirectoryService::UnshareContainerL(int)
+	?GetItemListL@CUpnpContentDirectoryService@@QAEXHPAVCUpnpBrowseCriteria@@PAHPAVCUpnpItemList@@@Z @ 21 NONAME ; void CUpnpContentDirectoryService::GetItemListL(int, class CUpnpBrowseCriteria *, int *, class CUpnpItemList *)
+	?GetContainerListL@CUpnpContentDirectoryService@@QAEXHPAVCUpnpBrowseCriteria@@PAHPAVCUpnpContainerList@@@Z @ 22 NONAME ; void CUpnpContentDirectoryService::GetContainerListL(int, class CUpnpBrowseCriteria *, int *, class CUpnpContainerList *)
+	?HttpTransferEventReceivedL@CUpnpContentDirectory@@QAEXAAVCUpnpHttpMessage@@@Z @ 23 NONAME ; void CUpnpContentDirectory::HttpTransferEventReceivedL(class CUpnpHttpMessage &)
+	?NewLC@CUpnpContentDirectoryService@@SAPAV1@XZ @ 24 NONAME ; class CUpnpContentDirectoryService * CUpnpContentDirectoryService::NewLC(void)
+	?SetThumbnailDirectoryL@CUpnpContentDirectoryService@@QAEXABVTDesC16@@@Z @ 25 NONAME ; void CUpnpContentDirectoryService::SetThumbnailDirectoryL(class TDesC16 const &)
+	?GetSharedItemL@CUpnpContentDirectoryService@@QAEPAVCUpnpItem@@H@Z @ 26 NONAME ; class CUpnpItem * CUpnpContentDirectoryService::GetSharedItemL(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/EABI/AVContentDirectoryU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,89 @@
+EXPORTS
+	_ZN21CUpnpContentDirectory11SendActionLEP11CUpnpAction14TUpnpErrorCode @ 1 NONAME
+	_ZN21CUpnpContentDirectory12SendMessageLEP16CUpnpHttpMessage @ 2 NONAME
+	_ZN21CUpnpContentDirectory15NewTransactionLERK6TDesC8S2_RK9TInetAddrRP26CUpnpHttpServerTransaction @ 3 NONAME
+	_ZN21CUpnpContentDirectory25UnknownHttpEventReceivedLER16CUpnpHttpMessage @ 4 NONAME
+	_ZN21CUpnpContentDirectory26HttpTransferEventReceivedLER16CUpnpHttpMessage @ 5 NONAME
+	_ZN21CUpnpContentDirectory9SetSenderEP14MUpnpCdsSender @ 6 NONAME
+	_ZN28CUpnpContentDirectoryService10GetAddressEv @ 7 NONAME
+	_ZN28CUpnpContentDirectoryService12GetItemListLEiP19CUpnpBrowseCriteriaPiP13CUpnpItemList @ 8 NONAME
+	_ZN28CUpnpContentDirectoryService12ShareObjectLEP11CUpnpObject @ 9 NONAME
+	_ZN28CUpnpContentDirectoryService12UnshareItemLEi @ 10 NONAME
+	_ZN28CUpnpContentDirectoryService14AddressChangeLEv @ 11 NONAME
+	_ZN28CUpnpContentDirectoryService14GetSharedItemLEi @ 12 NONAME
+	_ZN28CUpnpContentDirectoryService14ShareItemListLEP13CUpnpItemListPi @ 13 NONAME
+	_ZN28CUpnpContentDirectoryService15ShareReferenceLEP9CUpnpItem @ 14 NONAME
+	_ZN28CUpnpContentDirectoryService16UnshareItemListLER6RArrayIiEPi @ 15 NONAME
+	_ZN28CUpnpContentDirectoryService17GetContainerListLEiP19CUpnpBrowseCriteriaPiP18CUpnpContainerList @ 16 NONAME
+	_ZN28CUpnpContentDirectoryService17UnshareContainerLEi @ 17 NONAME
+	_ZN28CUpnpContentDirectoryService19GetContentDirectoryEv @ 18 NONAME
+	_ZN28CUpnpContentDirectoryService19GetSingleContainerLEi @ 19 NONAME
+	_ZN28CUpnpContentDirectoryService19ShareReferenceListLEP13CUpnpItemListPi @ 20 NONAME
+	_ZN28CUpnpContentDirectoryService21SetDownloadDirectoryLERK7TDesC16 @ 21 NONAME
+	_ZN28CUpnpContentDirectoryService22SetThumbnailDirectoryLERK7TDesC16 @ 22 NONAME
+	_ZN28CUpnpContentDirectoryService4NewLE15TUpnpCdSettings @ 23 NONAME
+	_ZN28CUpnpContentDirectoryService4NewLEv @ 24 NONAME
+	_ZN28CUpnpContentDirectoryService5NewLCE15TUpnpCdSettings @ 25 NONAME
+	_ZN28CUpnpContentDirectoryService5NewLCEv @ 26 NONAME
+	_ZTI14CUpnpCdsSender @ 27 NONAME ; #<TI>#
+	_ZTI14CUpnpTableBean @ 28 NONAME ; #<TI>#
+	_ZTI15CUpnpMapElement @ 29 NONAME ; #<TI>#
+	_ZTI15CUpnpMimeMapper @ 30 NONAME ; #<TI>#
+	_ZTI15CUpnpObjectBean @ 31 NONAME ; #<TI>#
+	_ZTI16CUpnpCdDbFactory @ 32 NONAME ; #<TI>#
+	_ZTI16CUpnpElementBean @ 33 NONAME ; #<TI>#
+	_ZTI17CUpnpFileTransfer @ 34 NONAME ; #<TI>#
+	_ZTI17CUpnpLocalStorage @ 35 NONAME ; #<TI>#
+	_ZTI17CUpnpStateHandler @ 36 NONAME ; #<TI>#
+	_ZTI17CUpnpTransferBase @ 37 NONAME ; #<TI>#
+	_ZTI18CUpnpAttributeBean @ 38 NONAME ; #<TI>#
+	_ZTI18CUpnpFilterElement @ 39 NONAME ; #<TI>#
+	_ZTI18CUpnpResourcesBean @ 40 NONAME ; #<TI>#
+	_ZTI19CUpnpElementFactory @ 41 NONAME ; #<TI>#
+	_ZTI20CUpnpMetadataStorage @ 42 NONAME ; #<TI>#
+	_ZTI20CUpnpTransferHandler @ 43 NONAME ; #<TI>#
+	_ZTI21CUpnpContentDirectory @ 44 NONAME ; #<TI>#
+	_ZTI21CUpnpTransferUploader @ 45 NONAME ; #<TI>#
+	_ZTI21CUpnpXmlContentFilter @ 46 NONAME ; #<TI>#
+	_ZTI22CUpnpAutoDestroyObject @ 47 NONAME ; #<TI>#
+	_ZTI23CUpnpContentDirectoryDb @ 48 NONAME ; #<TI>#
+	_ZTI23CUpnpTransferController @ 49 NONAME ; #<TI>#
+	_ZTI23CUpnpTransferDownloader @ 50 NONAME ; #<TI>#
+	_ZTI26CUpnpAutoDestroyObjectList @ 51 NONAME ; #<TI>#
+	_ZTI28CUpnpContentDirectoryService @ 52 NONAME ; #<TI>#
+	_ZTI29CUpnpHttpFileServeTransaction @ 53 NONAME ; #<TI>#
+	_ZTI30CUpnpFileTransferTimerObserver @ 54 NONAME ; #<TI>#
+	_ZTI31CUpnpHttpFileReceiveTransaction @ 55 NONAME ; #<TI>#
+	_ZTI8CUpnpMapI7HBufC16E @ 56 NONAME ; #<TI>#
+	_ZTV14CUpnpCdsSender @ 57 NONAME ; #<VT>#
+	_ZTV14CUpnpTableBean @ 58 NONAME ; #<VT>#
+	_ZTV15CUpnpMapElement @ 59 NONAME ; #<VT>#
+	_ZTV15CUpnpMimeMapper @ 60 NONAME ; #<VT>#
+	_ZTV15CUpnpObjectBean @ 61 NONAME ; #<VT>#
+	_ZTV16CUpnpCdDbFactory @ 62 NONAME ; #<VT>#
+	_ZTV16CUpnpElementBean @ 63 NONAME ; #<VT>#
+	_ZTV17CUpnpFileTransfer @ 64 NONAME ; #<VT>#
+	_ZTV17CUpnpLocalStorage @ 65 NONAME ; #<VT>#
+	_ZTV17CUpnpStateHandler @ 66 NONAME ; #<VT>#
+	_ZTV17CUpnpTransferBase @ 67 NONAME ; #<VT>#
+	_ZTV18CUpnpAttributeBean @ 68 NONAME ; #<VT>#
+	_ZTV18CUpnpFilterElement @ 69 NONAME ; #<VT>#
+	_ZTV18CUpnpResourcesBean @ 70 NONAME ; #<VT>#
+	_ZTV19CUpnpElementFactory @ 71 NONAME ; #<VT>#
+	_ZTV20CUpnpMetadataStorage @ 72 NONAME ; #<VT>#
+	_ZTV20CUpnpTransferHandler @ 73 NONAME ; #<VT>#
+	_ZTV21CUpnpContentDirectory @ 74 NONAME ; #<VT>#
+	_ZTV21CUpnpTransferUploader @ 75 NONAME ; #<VT>#
+	_ZTV21CUpnpXmlContentFilter @ 76 NONAME ; #<VT>#
+	_ZTV22CUpnpAutoDestroyObject @ 77 NONAME ; #<VT>#
+	_ZTV23CUpnpContentDirectoryDb @ 78 NONAME ; #<VT>#
+	_ZTV23CUpnpTransferController @ 79 NONAME ; #<VT>#
+	_ZTV23CUpnpTransferDownloader @ 80 NONAME ; #<VT>#
+	_ZTV26CUpnpAutoDestroyObjectList @ 81 NONAME ; #<VT>#
+	_ZTV28CUpnpContentDirectoryService @ 82 NONAME ; #<VT>#
+	_ZTV29CUpnpHttpFileServeTransaction @ 83 NONAME ; #<VT>#
+	_ZTV30CUpnpFileTransferTimerObserver @ 84 NONAME ; #<VT>#
+	_ZTV31CUpnpHttpFileReceiveTransaction @ 85 NONAME ; #<VT>#
+	_ZTV8CUpnpMapI7HBufC16E @ 86 NONAME ; #<VT>#
+	_ZThn144_N21CUpnpContentDirectory15NewTransactionLERK6TDesC8S2_RK9TInetAddrRP26CUpnpHttpServerTransaction @ 87 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,29 @@
+/** @file
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for the Content Directory Service component
+*
+*/
+
+
+PRJ_EXPORTS
+
+../inc/upnpcontentdirectoryservice.h |../../inc/upnpcontentdirectoryservice.h
+../inc/upnpcontentdirectoryeventobserver.h |../../inc/upnpcontentdirectoryeventobserver.h
+../inc/upnpcontentdirectoryglobals.h |../../inc/upnpcontentdirectoryglobals.h
+../inc/upnpcdsettings.h |../../inc/upnpcdsettings.h 
+
+PRJ_MMPFILES
+contentdirectoryservice.mmp
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/group/contentdirectoryservice.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,116 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*     This is the project specification file for Upnp.
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGETTYPE      DLL
+
+TARGET          avcontentdirectory.dll
+UID             0x1000008d 0x10204159
+
+
+VERSION 10.1
+paged
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          upnpcontentdirectory.cpp
+SOURCE          upnpelementfactory.cpp
+SOURCE          upnpcontainerupdateid.cpp
+SOURCE          upnpcontentdirectorydb.cpp
+SOURCE          upnpfiletransfer.cpp
+SOURCE          upnpelementbean.cpp
+SOURCE          upnpattributebean.cpp
+SOURCE          upnpobjectbean.cpp
+SOURCE          upnpfilterelement.cpp
+SOURCE          upnpthumbnailcreator.cpp
+SOURCE          upnptablebean.cpp
+SOURCE          upnperror.cpp
+SOURCE          upnpresourcesbean.cpp
+SOURCE          upnpcdutils.cpp
+SOURCE          upnpcddbfactory.cpp
+SOURCE          upnpcontentdirectoryservice.cpp
+SOURCE          upnpmetadatastorage.cpp
+SOURCE          upnplocalstorage.cpp
+SOURCE          upnpfiletransfertimerobserver.cpp
+SOURCE          upnpautodestroyobjectlist.cpp
+SOURCE          upnpautodestroyobject.cpp
+SOURCE          upnpsender.cpp
+SOURCE          upnpmapbase.cpp
+SOURCE          upnpmapelement.cpp
+SOURCE          upnpxmlcontentfilter.cpp
+SOURCE          upnpstatehandler.cpp
+SOURCE          upnpmimemapper.cpp
+SOURCE          upnpmspathutility.cpp
+
+SOURCE          upnptransferbase.cpp
+SOURCE          upnptransferdownloader.cpp
+SOURCE          upnptransferuploader.cpp
+
+SOURCE          upnptransfercontroller.cpp
+SOURCE          upnptransferhandler.cpp
+
+SOURCE          dlna/upnpdlnafilter.cpp 
+SOURCE          dlna/upnphttpfileservetransaction.cpp
+SOURCE          dlna/upnphttpfilereceivetransaction.cpp
+SOURCE          dlna/upnpdlnafilterheaders.cpp
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../inc/dlna
+
+//central repository
+LIBRARY         centralrepository.lib
+LIBRARY         upnpipserversutils.lib
+LIBRARY         upnpserviceframework.lib
+LIBRARY         upnpavobjects.lib
+LIBRARY         httptransfer.lib
+LIBRARY         dlnawebserver.lib
+LIBRARY         avmediaserverclient.lib
+LIBRARY         xmlenginedom.lib
+LIBRARY         xmlengineutils.lib
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         insock.lib 
+LIBRARY         esock.lib 
+LIBRARY         bafl.lib
+LIBRARY         estor.lib   
+LIBRARY         edbms.lib 
+LIBRARY         ecom.lib
+LIBRARY         sysutil.lib
+LIBRARY         PlatformEnv.lib
+LIBRARY         estlib.lib 
+LIBRARY         inetprotutil.lib
+LIBRARY         imageconversion.lib
+LIBRARY         bitmaptransforms.lib
+LIBRARY         fbscli.lib
+LIBRARY         charconv.lib
+LIBRARY         cafutils.lib
+LIBRARY         caf.lib
+
+DEBUGLIBRARY    flogger.lib
+DEFFILE         AVContentDirectory
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/dlna/upnpdlnacorelation.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,45 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dlna corelation variables
+*
+*/
+
+
+
+#ifndef C_TUPNPDLNACORELATION_H
+#define C_TUPNPDLNACORELATION_H
+
+//  INCLUDES
+#include <e32base.h>
+
+//FORWARD DECLARATIONS
+// CLASS DECLARATION
+
+/**
+*  Stores dlna corelation info
+*
+*  @since Series60 5.0
+*/
+struct TUpnpDlnaCorelation
+    {
+    TBool iStreamingSupport;
+    TBool iInteractiveSupport;
+    TBool iBackgrondSupport;
+    TBool iGetContentFeaturesExist;
+    TBool iGetContentFeaturesIsOK;
+    TPtrC8 iFourthField;
+    };
+
+#endif      // C_TUPNPDLNACORELATION_H   
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/dlna/upnpdlnafilter.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,233 @@
+/** @file
+ * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpDlnaFilter declaration.
+ *
+ */
+
+#ifndef UPNPDLNAFILTER_H
+#define UPNPDLNAFILTER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h> 
+#include "upnphttpservertransactioncreator.h"
+
+class MUpnpContentDirectoryDataFinder;
+class CUpnpHttpMessage;
+class CUpnpDlnaProtocolInfo;
+class CUpnpSecurityManager;
+class CUpnpHttpFileServeTransaction;
+class CUpnpHttpFileReceiveTransaction;
+class CUpnpDlnaFilterHeaders;
+class TUpnpDlnaCorelation;
+
+// CLASS DECLARATION
+
+/**
+ *  CUpnpDlnaFilter
+ * 
+ */
+NONSHARABLE_CLASS( CUpnpDlnaFilter ) : public CBase,
+        public MUpnpHttpServerTransactionCreator
+    {
+public:
+    // Public Constructors and destructor
+
+    /**
+     * Destructor.
+     */
+    ~CUpnpDlnaFilter();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUpnpDlnaFilter* NewL( MUpnpContentDirectoryDataFinder* aFinder,
+        CUpnpSecurityManager* aSecurityManager );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUpnpDlnaFilter* NewLC( MUpnpContentDirectoryDataFinder* aFinder,
+        CUpnpSecurityManager* aSecurityManager );
+
+    //from MUpnpHttpServerTransactionCreator
+    virtual void NewTransactionL(
+        const TDesC8& aMethod, const TDesC8& aUri, 
+        const TInetAddr& aSender, CUpnpHttpServerTransaction*& aResultTrans );
+
+    //from MUpnpHttpServerTransactionCreator
+
+    /**
+     * Checks correctness of path to, requested in HTTP message, file and 
+     *  changes its format to be compliant with Symbian's file system.
+     * @since Series60 2.6
+     * @param aMsg HTTP message containing file request.
+     * @param aPathWithNewMethod reference which is filled with formated path 
+     *  to requested file.
+     **/
+    void FormatPathL( CUpnpHttpFileServeTransaction *aTransaction, TDes &aPath );
+
+    /**
+     * Add appropriate directives to http header according to DLNA specification
+     * @param aTransaction http transaction
+     * @return KErrNone header prepared successfully, otherwise -EHttpNotFound
+     *         If DLNA correlations are wrong error from then it returns an error
+     */
+    TInt PrepareHeaderL( CUpnpHttpFileServeTransaction &aTransaction );
+
+    /**
+     * Method checks DLNA transferMode for POST messages.
+     * @since Series60 2.6
+     * @param aPostMessage - incoming POST message with upload to be saved in file.
+     * @return ETrue if POST can be accepted.
+     **/
+    TInt CheckDLNAPostCorrelationsL(CUpnpHttpFileReceiveTransaction& aTransaction);
+
+    /**
+     * Determines download path basing on incomming POST message and media path got
+     *  from server. Result is saved in iInFilename. 
+     *  If file should not be saved, flag iSaveToFile will be set to EFalse.
+     * @since Series60 2.6
+     * @param aPostMessage - incoming POST message with upload to be saved in file.
+     * @return download path or NULL in case of error
+     */
+    HBufC* DetermineDownloadPathL(CUpnpHttpFileReceiveTransaction& aTransaction);
+
+    //security manager getter
+    CUpnpSecurityManager* SecurityManager();
+    
+    //file server session getter        
+    RFs& FileSession();
+
+    /**
+     * Check if resource is accessible 
+     * @param aFileName data source file name
+     * @param aSender sender
+     * @return KErrNone if resource is accessible, otherwise -EHttpNotFound
+     */
+    TInt AuthorizeRequestL( const TDesC& aFileName, const TInetAddr& aSender );
+
+public:
+    // protected
+    // Private Constructors
+
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CUpnpDlnaFilter( MUpnpContentDirectoryDataFinder* aFinder,
+        CUpnpSecurityManager* aSecurityManager );
+
+    /**
+     * EPOC default constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+
+private:
+
+    /**
+     * Find protocolInfo by contentUri (Not by importUri) and extract 3rd field,
+     * using ContentDirectory.
+     * @param aFullContentUri uri to be searched in database
+     *       (full value of resource with IP:port prefix).
+     * @return a3rdhField 3rdhField from protocolInfo (if it is DLNA compatible) which is
+     *       related to founded resource. Ownership is transfered to the caller.
+     */
+    HBufC8* CUpnpDlnaFilter::ThirdFieldFromCdL( const TDesC8& aContentUri );
+
+    /**
+     * Gets name of file with content for given object's id.
+     * @param aObjectId id of the ContentDirecotry object holding the content
+     * @param aFileName pointer to buffer in which the name of the file will be returned.
+     *       Buffer for aFileName has to allocated first.
+     */
+    void GetMediaFileNameL( TInt aObjectId, TPtr& aFileName );
+
+    /**
+     * Find a folder shared from DB (ContentDirectory).
+     * @param aUrlPath Name of URL path that needs to be found and converted
+     * to aFolderPath
+     * @param aFileName Name of shared file (can be null if just folder is looking for).
+     * @param aSystemPath Name of shared folder.
+     * @return KErrNone or another of the system error codes.
+     */
+    TInt FindSharedFolderDBL(const TDesC8& aUrlPath, const TDesC8& aFileName,
+            HBufC8*& aSystemPath);
+
+    /**
+     * Checks if specified URI exists in database and returns object id for
+     *  given URI or KErrNotFound if URI is no registered in database.
+     * @param aImportUri uri to be searched in databse.
+     * @return objId if successful or KErrnone if object wasn't found.
+     */
+    TInt CheckImportUriL( TDesC8& aImportUri );
+
+    /**
+     * Checks DLNA correlations for given message.
+     * @since Series60 2.6
+     * @param aMessage message for which correlations check will be performed 
+     *  exists for given message.
+     * @return KErrNone if no HTTPerror problem occurs	 
+     **/
+    TInt CheckDLNACorrelationsL( CUpnpHttpFileServeTransaction& aTransaction );
+
+
+    /**
+     * Method returns content type of a resource
+     * @since Series60 3.2
+     * @param aMessage, aMime, aFilename
+     * @return KErrNone if mime type retrieved with no errors
+     **/
+    TInt GetContentTypeL( CUpnpHttpFileServeTransaction &aTransaction, HBufC8*& aMime,
+        const TDesC16& aFilename );
+ 
+
+    CUpnpDlnaProtocolInfo* ProtocolInfoL( const TDesC8& aContentUri );
+
+    void AddHeaderIfNotEmptyL( const TDesC8& aHeaderName, 
+        CUpnpHttpFileServeTransaction& aTransaction );
+    
+    
+    HBufC* MakeFileNameUniqueL( const TDesC& aFilename, RFs& aFs );
+
+    HBufC* PreparePostfixToMakeFileUniqueL( const TDesC& aFilename, RFs& aFs );
+    
+    HBufC* PrepareBaseFileNameL( const TDesC& aFilename, RFs& aFs );
+    
+    TInt CheckCorelationL( CUpnpHttpFileServeTransaction& aTransaction,
+                            TUpnpDlnaCorelation& aDlnaCorelation );
+                            
+    TInt CheckTransferModeL( CUpnpHttpFileServeTransaction& aTransaction,
+                             TUpnpDlnaCorelation& aDlnaCorelation );
+                             
+    TInt AppendCorelationHeadersL( CUpnpHttpFileServeTransaction& aTransaction,
+                             TUpnpDlnaCorelation& aDlnaCorelation, TDesC8& aTransferMode  );
+	
+protected:	
+	
+    // Pointer to ContentDirectoryDataFinder implementation.
+    // Not owned.
+    MUpnpContentDirectoryDataFinder* iCdDataFinder;
+    
+    CUpnpSecurityManager* iSecurityManager;
+    
+    // protocol info for dlna corelation
+    CUpnpDlnaProtocolInfo* iProtocolInfo;
+
+    RFs iFs;
+    
+    };
+
+#endif // UPNPDLNAFILTER_H
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/dlna/upnpdlnafilterheaders.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,77 @@
+/** @file
+ * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpDlnaFilterHeaders declaration.
+ *
+ */
+
+#ifndef UPNPDLNAFILTERHEADERS_H
+#define UPNPDLNAFILTERHEADERS_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+class CUpnpHttpMessage;
+class TInetAddr;
+
+NONSHARABLE_CLASS( CUpnpDlnaFilterHeaders ) : public CBase
+    {
+public: 
+	
+    static CUpnpDlnaFilterHeaders* NewL(); 
+    
+    /**
+     * Standard Destructor
+     */
+	~CUpnpDlnaFilterHeaders();
+
+    /**
+     * Adds header to temporary held CUpnpHttpMessage instance
+     */
+    void AddHeaderL( const TDesC8& aName, const TDesC8& aValue );
+    
+    /**
+     * Remove header from temporary held CUpnpHttpMessage instance
+     */
+    void RemoveHeaderL( const TDesC8& aName );
+    
+    /**
+     * Get specified by name header value
+     */    
+    TDesC8& QueryHeader( const TDesC8& aHeaderName );
+ 
+    /**
+     * Retrieves sender IP address from temporary CUpnpHttpMessage
+     */    
+    TInetAddr& Sender();
+
+private:
+    /**
+     * Constructor
+     */
+    CUpnpDlnaFilterHeaders();
+    
+    /**
+     * Second phase constructor 
+     */
+    void ConstructL();
+    
+private:
+	// Single CUpnpHttpMessage instance to hold temporary headers and 
+	// sender IP
+    CUpnpHttpMessage* iHeaderContainer;
+    }; 
+
+
+#endif // UPNPDLNAFILTERHEADERS_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/dlna/upnphttpfilereceivetransaction.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,76 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpHttpFileReceiveTransaction declaration.
+ *
+ */
+#ifndef UPNPHTTPFILERECEIVETRANSACTION_H_
+#define UPNPHTTPFILERECEIVETRANSACTION_H_
+
+// INCLUDES
+#include "upnphttpservertransaction.h"
+#include <in_sock.h>
+
+// FORWARD DECLARATION
+class CUpnpDlnaFilter;
+class CUpnpDlnaFilterHeaders;
+class CUpnpDlnaFilterHeaders;
+
+/**
+ *  Transaction serving incoming dlna transfer ( http post, upload usecase ). 
+ *  
+ */
+class CUpnpHttpFileReceiveTransaction: public CUpnpHttpServerTransaction
+    {
+public:
+    /**
+    * Constructors and destructors.
+    */
+    static CUpnpHttpFileReceiveTransaction* NewL( 
+        CUpnpDlnaFilter& aClientContext, const TInetAddr& aSender, const TDesC8& aUri );
+        
+    ~CUpnpHttpFileReceiveTransaction();
+    
+    /**
+     * Getter.
+     */
+    CUpnpDlnaFilterHeaders& FilterHeaders();
+
+    /**
+     * Base class callback implementation
+     */ 
+    virtual void OnCallbackL( TUpnpHttpServerEvent aEvent );
+    
+    const TDesC8& SenderUri();
+
+protected:
+    CUpnpHttpFileReceiveTransaction( CUpnpDlnaFilter& aClientContext );
+    void ConstructL( const TInetAddr& aSender, const TDesC8& aSenderUri );  
+    
+private:
+    void DoCallbackL( TUpnpHttpServerEvent aEvent );    
+
+    void InitializeFilterHeadersL();
+    
+private:
+    // Sender Uri.
+    HBufC8* iSenderUri;
+    // Sender address.
+    TInetAddr iSender;
+    
+    CUpnpDlnaFilter& iClientContext;
+    CUpnpDlnaFilterHeaders* iFilterHeaders;
+    TFileName iFileName;
+    };
+
+#endif /* UPNPHTTPFILERECEIVETRANSACTION_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/dlna/upnphttpfileservetransaction.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,64 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpHttpFileServeTransaction declaration.
+ *
+ */
+#ifndef UPNPHTTPFILESERVETRANSACTION_H_
+#define UPNPHTTPFILESERVETRANSACTION_H_
+
+#include "upnphttpservertransaction.h"
+
+class CUpnpDlnaFilter;
+class CUpnpDlnaFilterHeaders;
+class TInetAddr;
+
+class CUpnpHttpFileServeTransaction: public CUpnpHttpServerTransaction
+    {
+public:
+    ~CUpnpHttpFileServeTransaction();  
+    
+    const TDesC8& SenderUri();
+    
+    HBufC16* PathWithNewMethodL();
+    
+    static CUpnpHttpFileServeTransaction* NewL( 
+        CUpnpDlnaFilter& aClientContext, const TInetAddr& aSender, const TDesC8& aUri );
+    
+    CUpnpDlnaFilterHeaders& FilterHeaders();
+    
+public:
+    virtual void OnCallbackL( TUpnpHttpServerEvent aEvent );
+    
+protected:
+    CUpnpHttpFileServeTransaction( CUpnpDlnaFilter& aClientContext );
+    void ConstructL( const TInetAddr& aSender, const TDesC8& aSenderUri );    
+    
+private:
+    void DoCallbackL( TUpnpHttpServerEvent aEvent ); 
+    
+    void InitializeFilterHeadersL();    
+    
+private:
+    // Sender Uri.
+    HBufC8* iSenderUri;
+    // Sender address.
+    TInetAddr iSender;
+    
+    CUpnpDlnaFilter& iClientContext;
+    CUpnpDlnaFilterHeaders* iFilterHeaders;
+    
+    TFileName iPathWithNewMethod;
+    };
+
+#endif /* UPNPHTTPFILESERVETRANSACTION_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpattributebean.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,181 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Attribute table data handler
+*
+*/
+
+
+
+#ifndef C_CUPNPATTRIBUTEBEAN_H
+#define C_CUPNPATTRIBUTEBEAN_H
+
+//  INCLUDES
+#include "upnptablebean.h"
+#include <e32base.h>
+#include <d32dbms.h>
+
+class CUpnpAttribute;
+class CUpnpElement;
+
+/**
+*  Stores the data of attribute table row.
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpAttributeBean: public CUpnpTableBean
+{
+    public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpAttributeBean* NewLC();
+    
+    /**
+    * Two-phase constructor
+    * aparam aRowSet a rowset of the attribute table
+    */
+    static CUpnpAttributeBean* NewLC(const RDbRowSet& aRowSet);
+    
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpAttributeBean();
+
+    public: // New functions
+    
+        void AttachAttrL(CUpnpElement* aElm);
+    /**
+    * Sets the RDbRowset and sets all values from this rowset.
+    * @since Series S60 3.0
+    * @param aRowSet a rowset of the attribute table
+    */
+    void SetL(const RDbRowSet& aRowSet);
+    
+    /**
+    * Sets iAtrId value.
+    * @since Series S60 3.0
+    * @param aElId value of atr_id in the Attribute table
+    */
+    void SetAtrId(TInt aElId);
+        
+    /**
+    * Sets iAtrName value.
+    * @since Series S60 3.0
+    * @param aAtrName value of Atr_name in the Attribute table
+    */
+    void SetAtrNameL(const TDesC8& aAtrName);
+        
+    /**
+    * Sets iAtrIsRequired value.
+    * @since Series S60 3.0
+    * @param aAtrIsRequired value of Atr_is_required in the Attribute table
+    */
+    void SetAtrIsRequired(TBool aAtrIsRequired);
+        
+    /**
+    * Sets iAtrValue value.
+    * @since Series S60 3.0
+    * @param aAtrValue value of Atr_value in the Attribute table
+    */
+    void SetAtrValueL(const RDbRowSet& aRowSet, const TInt aColNo);
+		void SetAtrValueL(const TDesC8& aVal);
+        
+    /**
+    * Sets iAtrObjId value.
+    * @since Series S60 3.0
+    * @param aAtrObjId value of Atr_obj_id in the Attribute table
+    */
+    void SetAtrElmId(TInt aAtrObjId);
+        
+    /**
+    * Gets iAtrId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iAtrId
+    */
+    TInt AtrId() const;
+        
+    /**
+    * Gets iAtrName value.
+    * @since Series S60 3.0
+    * @return Value of iAtrName
+    */
+    TDesC8& AtrName() const;
+        
+    /**
+    * Gets iAtrIsRequired value.
+    * @since Series S60 3.0
+    * @return Gets the value of iAtrIsRequired
+    */
+    TBool AtrIsRequired() const;
+        
+    /**
+    * Gets iAtrValue value.
+    * @since Series S60 3.0
+    * @return Value of iAtrValue
+    */
+    TDesC8& AtrValue() const;
+        
+    /**
+    * Gets iAtrObjId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iAtrObjId
+    */
+    TInt AtrElmId() const;
+
+    /**
+    * Adds attribute to the given TXmlEngElement.
+    * @since Series S60 3.0
+    * @param TXmlEngElement
+    * @return just attached attribute
+    */
+    TXmlEngAttr AttachAttrL(TXmlEngElement aElement);
+
+    private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpAttributeBean();
+
+    /**
+    * Second phase of the constructor.
+    *
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    private:    // Data
+    // Attribute Id
+    TInt        iAtrId;
+    // Attribute name buffer
+    HBufC8*     iAtrName;
+    //
+    TBool       iAtrHasAttribute;
+    //Attribute Element Id
+    TInt        iAtrElmId;
+    //
+    TBool       iAtrIsRequired;
+    // Attribute value buffer
+    HBufC8*     iAtrValue;
+};
+
+// inline functions
+#include"upnpattributebean.inl"
+
+#endif      // C_CUPNPATTRIBUTEBEAN_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpattributebean.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,95 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Attribute table data handler - inline functions
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::SetAtrId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpAttributeBean::SetAtrId(TInt aElId)
+{
+        iAtrId = aElId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::SetAtrIsRequired
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpAttributeBean::SetAtrIsRequired(TBool aAtrIsRequired)
+{
+        iAtrIsRequired = aAtrIsRequired;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::SetAtrObjId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpAttributeBean::SetAtrElmId(TInt aAtrElmId)
+{
+        iAtrElmId = aAtrElmId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::AtrId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpAttributeBean::AtrId() const
+{
+        return iAtrId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::AtrName
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TDesC8& CUpnpAttributeBean::AtrName() const
+{
+        return *iAtrName;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::AtrIsRequired
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TBool CUpnpAttributeBean::AtrIsRequired() const
+{
+        return iAtrIsRequired;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::AtrValue
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TDesC8& CUpnpAttributeBean::AtrValue() const
+{
+        return *iAtrValue;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::AtrObjId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpAttributeBean::AtrElmId() const
+{
+        return iAtrElmId;
+}
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpautodestroyobject.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,90 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+#ifndef C_CUPNPAUTODESTROYOBJECT_H
+#define C_CUPNPAUTODESTROYOBJECT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <upnpnotifytimer.h>
+
+//FORWARD DECLARATIONS
+class CUpnpContentDirectory;
+class CUpnpNotifyTimer;
+
+
+// CLASS DECLARATION
+
+/**
+*  Auto destroy object
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpAutoDestroyObject: public CBase, public MUpnpNotifyTimerObserver
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpAutoDestroyObject* NewL(CUpnpContentDirectory* aCd, TInt aObjId, TInt aResId );
+
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpAutoDestroyObject* NewLC(CUpnpContentDirectory* aCd, TInt aObjId, TInt aResId );
+    
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpAutoDestroyObject();
+
+public: // New functions
+    virtual void TimerEventL(CUpnpNotifyTimer* aTimer);
+    TInt GetResId();
+    TInt GetObjId();
+    void SetTransferStartedL(TBool aVal);
+    void RenewTimerL();    
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpAutoDestroyObject(CUpnpContentDirectory* aCd, TInt aObjId, TInt aResId);
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+private:    // Data
+    CUpnpContentDirectory*      iCd;        // not owned
+    CUpnpNotifyTimer*           iEventTimer;
+    TInt                        iResId;
+    TInt                        iObjectId;
+    TBool                       iTransferStarted;
+    TBool                       iTimeElapsed;
+};
+
+#endif      // C_CUPNPAUTODESTROYOBJECT_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpautodestroyobjectlist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,89 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+#ifndef C_CUPNPAUTODESTROYOBJECTLIST_H
+#define C_CUPNPAUTODESTROYOBJECTLIST_H
+
+//  INCLUDES
+#include <e32base.h>
+
+//FORWARD DESCLARATIONS
+class CUpnpAutoDestroyObject;
+
+// CLASS DECLARATION
+
+/**
+*  Auto destroy object
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpAutoDestroyObjectList: public CBase
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpAutoDestroyObjectList* NewL();
+
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpAutoDestroyObjectList* NewLC();
+    
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpAutoDestroyObjectList();
+
+public: // New functions
+
+    void AppendL(const CUpnpAutoDestroyObject* aObj);
+    void RemoveAndDestroyL(TInt aIndex);
+    TInt FindObjIndexByObjId(TInt aObjId);
+    TInt FindObjIndexByResId(TInt aResId);
+    CUpnpAutoDestroyObject* operator[](TInt aIndex);
+    void TransferFailL(TInt aResId);
+    TInt Count();
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpAutoDestroyObjectList();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+private:
+
+private:    // Data
+    // main array
+    RPointerArray<CUpnpAutoDestroyObject> iArray;
+};
+
+#endif      // C_CUPNPAUTODESTROYOBJECTLIST_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcddbfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,202 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Database for MediaServer
+*
+*/
+
+
+
+#ifndef C_CUPNPCDDBFACTORY_H
+#define C_CUPNPCDDBFACTORY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <d32dbms.h>
+#include <s32file.h>
+#include <upnperrors.h>
+
+// CLASS DECLARATION
+class CUpnpMetadataStorage;
+
+
+
+/**
+*  Database factory.
+*
+*
+*  @lib ContentDirectoryDb.lib
+*  @since Series 60 3.0
+*/
+class CUpnpCdDbFactory : public CBase
+{
+ public:  // Constructors and destructor
+ 
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpCdDbFactory* NewLC();
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpCdDbFactory* NewL();
+
+    /**
+    * Destructor
+    */
+    ~CUpnpCdDbFactory();
+    
+ public: // New functions
+ 
+    /**
+    * @since Series60 3.1
+    * @param aDatabaseFileName Databse filename
+    * @return 
+    */
+    CUpnpMetadataStorage* CreateMetadataStorageL(const TDesC& aDatabaseFileName);
+
+    /**
+    * Creates database file
+    * @since Series S60 3.1
+    * @param aDbFileName Database filename
+    */
+    void CreateDatabaseFileL(const TDesC& aDbFileName);
+
+    /**
+    * @since Series60 3.2
+    * @return Column set for table Object.
+    */
+    CDbColSet* CreateObjectTableColumnSequenceLC();
+
+    /**
+    * @since Series60 3.2
+    * @return Column set for table Element.
+    */
+    CDbColSet* CreateElementTableColumnSequenceLC();
+
+    /**
+    * @since Series60 3.2
+    * @return Column set for table Attribute.
+    */
+    CDbColSet* CreateAttributeTableColumnSequenceLC();
+
+    /**
+    * @since Series60 3.2
+    * @return Column set for table Resource.
+    */
+    CDbColSet* CreateResourceTableColumnSequenceLC();
+
+    /**
+    * @since Series60 3.2
+    * @return Column set for table Sequence.
+    */
+    CDbColSet* CreateSequenceTableColumnSequenceLC();
+
+
+ private:
+    /**
+    * C++ default constructor.
+    */
+    CUpnpCdDbFactory();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+    
+    /**
+    * Creates database file. Invoke by CreateDatabaseFileL
+    * @since Series S60 3.1
+    * @param aDbFileName Database filename
+    */
+    void DoCreateDatabaseFileL(const TDesC& aDbFileName);
+
+    /**
+    * Creates empty database
+    * @since Series S60 3.1
+    * @param aDbFileName Database filename
+    */
+    void CreateEmptyDbL(const TDesC& aDbFileName);
+    
+    /**
+    * Create objects table
+    * @since Series S60 3.1
+    */
+    void CreateObjectTableL();
+    
+    /**
+    * Create elements table
+    * @since Series S60 3.1
+    */
+    void CreateElementTableL();
+    
+    /**
+    * Create attributes table
+    * @since Series S60 3.1
+    */
+    void CreateAttributeTableL();
+    
+    /**
+    * Create resources table
+    * @since Series S60 3.1
+    */
+    void CreateResourceTableL();
+    
+    /**
+    * Create sequences table
+    * @since Series S60 3.1
+    */
+    void CreateSequenceTableL();
+    
+    /**
+    * Constructs database
+    * @since Series S60 3.1
+    * @param aDatabaseFileName
+    */
+    void ConstructDbL(const TFileName& aDatabaseFileName);  
+        
+    /**
+    * Opens database
+    * @since Series S60 3.1
+    * @param aDatabaseFileName  Database filename
+    */
+    void OpenDbL( const TFileName& aDatabaseFileName );
+        
+    /**
+    * 
+    * @since Series S60 3.1
+    * @param aWeight
+    */
+    void DbChangedL(TInt aWeight);    
+        
+    /**
+    * Insterts initial data
+    * @since Series S60 3.1
+    */
+    void InsertInitialDataL();
+
+ private:    // Data
+ 
+    // file server session
+    RFs         iFs;
+
+    RDbStoreDatabase    iStoreDb;
+    
+    CFileStore*     iFileStore;  
+ 
+};
+
+#endif // C_CUPNPCDDBFACTORY_H
+
+// End Of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcdsettings.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,52 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ContentDirectory Initializer
+*
+*/
+
+#ifndef C_CUPNPCDSETTINGS_H
+#define C_CUPNPCDSETTINGS_H
+
+//  INCLUDES
+#include <e32base.h>
+
+//FORWARD DECLARATIONS
+class CUpnpDevice;
+class MUpnpThumbnailCreatorObserver;
+class MUpnpContentDirectoryEventObserver;
+class MUpnpTransferInterface;
+// CLASS DECLARATION
+
+/**
+*  Stores ContentDirectory settings values.
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+struct TUpnpCdSettings
+{
+    CUpnpDevice*                        iDevice; 
+    const TDesC&                        iDownloadDir;
+    const TDesC&                        iThumbnailDir;
+    const TDesC&                        iDescriptionPath;
+    MUpnpThumbnailCreatorObserver*      iThmbObs;
+    TBool                               iCreateThumbnail;
+    TInt                                iMaxRequestCount;
+    MUpnpContentDirectoryEventObserver* iEventObserver;    
+    const TDesC&                        iObjectsXmlPath;
+    MUpnpTransferInterface*             iTransfer;
+};
+
+#endif      // C_CUPNPCDSETTINGS_H   
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcdssender.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,36 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Error - this is internal class that converts 
+*                TInt to TUpnpErrorCode it helps to avoid excessive casting                    
+*
+*/
+
+#ifndef M_UPNPCDSSENDER
+#define M_UPNPCDSSENDER
+
+#include "upnperrors.h"
+
+class CUpnpAction;
+class CUpnpHttpMessage;
+
+
+// Sender interface
+class MUpnpCdsSender
+{
+ public:
+    virtual void SendL(CUpnpAction* aAction, TUpnpErrorCode aError)=0;
+    virtual void SendL( CUpnpHttpMessage* aMessage )=0;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcdutils.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,261 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ContentDirectory utils,
+*
+*/
+
+
+
+#ifndef CDUTILS_H
+#define CDUTILS_H
+
+//  INCLUDES
+#include <xmlengdom.h>
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  Set of utils functions.
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class UpnpCdUtils
+{
+ public:
+ 
+    static void ValidateFilePath(TDes8& aPath);
+    static void ValidateFilePath(TDes& aPath);
+    static void ValidateSrcUriL(TDesC8& aPath,TDesC8& aIp);
+    /**
+    * Removes white spaces (and '\r \n \t and space') from the given descriptor 
+    * @since Series S60 3.0
+    * @param aString descriptor to be processed
+    */
+    static void RemoveWhiteSpacesL(TDes8& aString);
+
+    /**
+    * Checking if there are white spaces(and '\r \n \t and space' ) in the given descriptor
+    * @since Series S60 3.1
+    * @param aString 
+    * @return boolean
+    */
+    static TBool IsWhiteString(const TDesC8& aString);
+    
+    /**
+    * Gets element
+    * @since Series S60 3.1
+    * @param aFragment 
+    * @return TXmlEngElement
+    */      
+    static TXmlEngElement GetObjectElementL(RXmlEngDocument& aFragment);
+    
+    /**
+    * Checks if Ref id value exists
+    * @since Series S60 5.0 HN
+    * @param aFragment 
+    * @return TBool
+    */     
+    static TBool HasRefIdL( RXmlEngDocument& aFragment );
+    
+    /**
+    * Encodes Xml 
+    * @since Series S60 3.1
+    * @param aString
+    * @return descriptor pointer
+    */
+    static HBufC8* EncodeXmlStringL(const TDesC8& aString);
+    
+     
+   	static HBufC* Des8ToDesL(const TDesC8& aString);
+    
+    /**
+    * Conversion from TDes8 to TDes16
+    * @since Series S60 3.1
+    * @param aString
+    * @return descriptor pointer
+    */
+    static HBufC* Des8ToDesLC(const TDesC8& aString);
+    
+    /**
+    * Conversion from TDes16 to TDes8
+    * @since Series S60 3.1
+        * @param aString
+    * @return descrptor pointer
+    */
+    static HBufC8* DesToDes8LC(const TDesC& aString);
+       
+    /*
+    * Getter
+    * @since Series S60 3.1
+        * @param aUri
+    * @return TInt
+    */
+    static TInt64 ResIdFromUriL(const TDesC8& aUri);
+    
+    /*
+    * Getter
+    * @since Series S60 3.1
+    * @param aUri
+    * @return TPtrC8
+    */
+    static TPtrC8 ResIdFromUriDesL(const TDesC8& aUri);
+    
+    /*
+    * Sets Object Id
+    * @since Series S60 3.1
+    * @param aElement TXmlEngElement of the element
+    * @param aId Id
+    */
+
+    static void SetObjectIdL(TXmlEngElement aElement, TInt aId);
+    /*
+    * Sets refID
+    * @since Series S60 5.0 HN
+    * @param aElement TXmlEngElement of the element
+    * @param aRefId
+    */
+    static void SetObjectRefIdL(TXmlEngElement aElement, TInt aRefId);
+    
+    /*
+    * Sets parentID
+    * @since Series S60 5.0 HN
+    * @param aElement TXmlEngElement of the element
+    * @param aRefId
+    */
+    static void SetObjectParentIdL(TXmlEngElement aElement, TInt aParentId);
+        
+    /*
+     * Sets restricted field
+     * @since Series S60 5.0 HN
+     * @param aElement TXmlEngElement of the element
+     * @param aRestrictedFlag
+     */
+    static void SetRestrictedFieldL( TXmlEngElement aElement, TBool aRestrictedFlag );
+
+    /*
+    * Sets Container Id
+    * @since Series S60 3.1
+    * @param aElement TXmlEngElement of the element
+    * @param aParentId ParentId
+    */
+    static void SetContainerIdL(TXmlEngElement aElement, TInt aParentId);
+   	static HBufC8* BuildImportUriLC(TInt aResId);
+   	static HBufC8* BuildImportUriShorterLC(TInt64 aResId);
+	static HBufC8* BuildContentUriL(TInt aResId, const TDesC& aFileExten, TDesC8& aObjectId);
+    static HBufC8* UpnpCdUtils::RandomizeL(TInt aRange);
+    /**
+    * Checks whether the element is required and removes the attribute notifying it
+    * @since Series S60 3.0
+    * @param aElement TXmlEngElement of the element
+    * @param aObjId aCd pointer to the ContentDirectory object - it provides a function which deletes
+    *               a file from the private directory
+    * @param ETrue if the element is required, otherwise EFalse
+    */
+    static TBool IsElementRequiredL(TXmlEngElement aElement);
+        /**
+    * Replaces the the first occurrence of true/false sequence with 1/0 within given descriptor 
+    * @since Series S60 3.0
+    * @param aBuf descriptor pointer
+    */
+    static void ReplaceTrueFalse(HBufC8* aBuf);
+
+    /**
+    * Gets the full name with namespace of the given element.
+    * @since Series S60 3.0
+    * @param aElement an element to get the name of
+    * @return descriptor with the namespace:name of the element, 
+    *              the caller should delete it when it is no longer needed
+    */
+    static HBufC8* GetElmNameWithNsL(TXmlEngElement aElement);
+     
+    static HBufC* EscapeAposL(const TDesC&  aValue);
+    static TBool ValidateDateL(  TPtrC8 aValue );
+    
+    /**
+    * Converts TDesC8 to TUint
+    */
+    static TInt StringToTUint(const TDesC8& aStr, TUint* aInt);
+    
+    /**
+    * Checks whether input string contains a specific number of digits and whether whole number fit into specific range
+    * @since Series S60 3.0
+    * @param aInput input descriptor [a number]
+    * @param aNumber number of digits the descriptor should contain
+    * @param aExactDigitsNumber should the number have exact number of digits or not
+    * @param aRange the number mustn't exceed the specified range
+    * @return ETrue if condition is fulfilled
+    */
+    static TBool AreDigitsInSpecificRange(const TDesC8& aInput, TInt aNumber, TBool aExactDigitsNumber, TUint32 aRange); 
+    
+    /**
+    * Validates res@duration attribute
+    * @since Series S60 3.0
+    * @param aInput descriptor containing duration value to validate
+    * @return ETrue if res@duration has proper format
+    */
+    static TBool ValidateDurationValue(const TDesC8& aInput);  
+    
+    /**
+    * Split string into pieces with delimeter
+    * @since Series S60 3.0
+    * @param aLexeme a lexer to parse
+    * @param aDelimeter delimeter    
+    */
+    static void SplitStringByDelimeter(TLex8& aLexeme, TChar aDelimeter);
+    
+    /**
+    * Skip characters in lexer
+    * @since Series S60 3.0
+    * @param aLexer a lexer to parse
+    * @param aValue number of characters to skip
+    */
+    static void Skip(TLex8& aLexer, TInt aValue);
+        
+         /**
+    * Extracts integer value from descriptor
+    * @param aStr descriptor to be extracted
+    * @param aInt integer to be fill in
+    * @return error status
+    */
+    static TInt StringToInteger(const TDesC8& aStr, TInt* aInt);
+            
+ private:
+     enum TPlaces
+        {
+        EYear = 4,
+        EMonth = 7,
+        EDay = 10,
+        EHour = 13,
+        EMinute = 16,
+        ESecond = 19,
+        EZone1 = 20,
+        EHourOffset1 = 22,
+        EMiliSecond = 23,
+        EZone2 = 24,
+        ETimeOffset1 = 25,
+        EHourOffset2 = 26,
+        ETimeOffset2 = 29
+        };
+    /*
+    * C++ default constructor.
+    */
+    UpnpCdUtils();
+};
+
+#endif      // CDUTILS_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcontainerupdateid.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,58 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Container UpdateID
+*
+*/
+
+
+
+#ifndef C_CUPNPCONTAINERUPDATEID_H
+#define C_CUPNPCONTAINERUPDATEID_H
+
+#include <e32std.h>
+
+
+
+
+/**
+*  Storage Struct for conainerupdateId
+*
+*  @lib ContentDirectory
+*  @since Series 60 2.6
+*/
+class TUpnpContainerUpdateId
+{
+public:
+    // Constructors and destructor
+    
+    
+    /*
+    * C++ default constructor.
+    */
+    TUpnpContainerUpdateId();
+
+public:
+    // Data
+
+    
+    // Container Id
+    HBufC8* iContainerId;
+    
+
+    TInt    iUpdateId;
+};
+
+#endif      // C_CUPNPCONTAINERUPDATEID_H   
+        
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,922 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares ContentDirectory class.
+*
+*/
+
+
+#ifndef C_CUPNPCONTENTDIRECTORY_H
+#define C_CUPNPCONTENTDIRECTORY_H
+
+
+// INCLUDES
+#include "upnpserviceimplementation.h"
+#include "upnpelementfactory.h"
+
+// new xml
+#include <xmlengdom.h>
+
+#include "upnpfiletransfer.h"
+#include "upnpcontentdirectorydatafinder.h"
+#include "upnpthumbnailcreator.h"
+#include "upnpcdsettings.h"
+#include "upnptransferobserver.h"
+#include "upnphttpservertransactioncreator.h"
+#include "upnphttpserverobserver.h"
+
+// FORWARD DECLARATIONS
+
+class CUpnpElementFactory;
+class TUpnpContainerUpdateId;
+class CUpnpFileTransferTimerObserver;
+class CUpnpObject;
+class CUpnpItem;
+class CUpnpContentDirectoryDb;
+class CProtocolInfo;
+class CUpnpMetadataStorage;
+class CUpnpAutoDestroyObjectList;
+class MUpnpContentDirectoryEventObserver;
+class CUpnpFileTransferEvent;
+class MUpnpCdsSender;
+class CUpnpStateHandler;
+class CUpnpTransferUploader;
+class CUpnpMimeMapper;
+class CUpnpTransferController;
+class MUpnpTransferInterface;
+class CUpnpDlnaFilter;
+class CUpnpHttpServerSession;
+class CUpnpSecurityManager;
+
+// CONSTANTS
+static const TInt KMaxImportExportTransfers = 3;
+_LIT8( KContentDirectoryType, "ContentDirectory:1" );
+
+// CLASS DECLARATION
+
+/**
+*  @brief Main Content Directory Service Class
+*
+*  @lib ServiceFramework.lib
+*  @since Series60 2.6
+*/
+class CUpnpContentDirectory :             
+                public CUpnpServiceImplementation, 
+                public MUpnpContentDirectoryDataFinder,
+                public MUpnpThumbnailCreatorObserver,
+                public MUpnpTransferObserver,
+                public MUpnpHttpServerTransactionCreator,
+                public MUpnpHttpServerObserver
+{
+public: // Constructors and destructors
+    
+    /**
+    * Two-phased constructor for creating Content Directory Service (CDS).
+    * @since Series60 2.6
+    * @param aService Parent service 
+    */
+    static CUpnpContentDirectory* NewL( TUpnpCdSettings aSettings, 
+                                        CUpnpMetadataStorage* aMetadataStorage,
+                                        MUpnpTransferInterface* aTransfer );
+
+    /**
+    * Destructor function; called automatically from the destructor of a 
+    * derived class
+    **/
+    virtual ~CUpnpContentDirectory();
+    IMPORT_C void SetSender(MUpnpCdsSender* aSender);
+            
+
+public: //from CUpnpServiceImplementation
+    
+    CUpnpStateHandler* CUpnpContentDirectory::StateHandler();
+    /**
+    * Handles auto destroy events.
+    * @since Series 60 2.6
+    * @param aObjIdn id of evented upnp object
+    */
+    void AutoDestroyEventL(TInt aObjId, TBool aDeleteObj);
+
+    /**
+    * This functions is a entry point for actions. See coments in base class
+    * @since Series 60 2.6
+    * @param aAction Action received by CDS.
+    */
+    void ActionReceivedLD( CUpnpAction* aAction );
+    
+    /**
+    * Hnadle unknown http event
+    * Export for interneal use only    
+    */
+    IMPORT_C void UnknownHttpEventReceivedL( CUpnpHttpMessage& aHttpMsg );
+    
+    /**
+    * Handles address change event    
+    */
+    void AddressChangeL();
+    
+    /**
+    * This function is for informing service from evented statevariables.
+    * @since Series 60 2.6
+    * @param aVariableName Name of the evented statevariable.
+    */
+    void StateVariableEvented(const TDesC8& aVariableName);
+      
+    /**
+    * Checks if specified importUri is in database still active.
+    * @param aImportUri uri to be searched in databse. 
+    * @return objId if successful
+    */
+    TInt CheckImportUriL(const TDesC8& aImportUri);
+
+    /**
+    * Inserts Ip and Port
+    * @since Series S60 3.1
+    * @param aString
+    */
+    void InsertRealIpAndPortL(TDes8& aString);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aString
+    * @return descriptor pointer
+    */  
+    HBufC8* InsertIpAndPortPlaceholderL(const TDesC8& aString);
+    
+    /**
+    * Find protocolInfo by importUri (Not by importUri).
+    * @param aImportUri uri to be searched in database (Value of resource).
+    * @return aProtocolInfo related to resorce which has been founded 
+    */  
+    CUpnpDlnaProtocolInfo* GetProtocolInfoByImportUriL(const TDesC8& aImportUri);
+    
+    /**
+    * Gets infomation about protocol
+    * @since Series S60 3.1
+    * @param aContentUri
+    * @parma aProtocolInfo
+    * @return
+    */
+    TInt GetProtocolInfoL(const TDesC8& aContentUri, CUpnpDlnaProtocolInfo*& aProtocolInfo);
+        
+    /**
+    * Gets title of the object with given id from ContentDirectory service. 
+    * @since Series60 2.6
+    * @param aObjectId id of the object.
+    * @param aValue pointer to buffer in which the tilte of the object will be returned.
+    *       Buffer for aValue has to allocated first.
+    **/
+    void GetTitleForUriL( TInt aObjectId, TPtr& aValue );
+        
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aUrlPath
+    * @param aFileName
+    * @param aSystemPath
+    */
+    TInt FindSharedFolderL( const TDesC& aUrlPath, const TDesC& aFileName, HBufC*& aSystemPath);
+        
+    /**
+    *
+    * @since Series S60 3.1
+    * @return TPtrC
+    */
+    const TPtrC MediaRealDir();
+        
+        
+    /**
+    * Sets download directory
+    * @since Series S60 3.1
+    * @param aDownloadDir this directory is going to be set as download directory
+    * @return TInt
+    */
+    void SetDownloadDirectoryL(const TDesC& aDownloadDir);
+        
+    /**
+    * Sets thumbnail directory
+    * @since Series S60 3.1
+    * @param aDownloadDir this directory is going to be set as thumbnail directory
+    * @return TInt
+    */
+    void SetThumbnailDirectoryL(const TDesC& aDownloadDir);    
+    
+    TInetAddr GetAddress();
+    IMPORT_C void SendActionL(CUpnpAction* aAction, TUpnpErrorCode aError);
+    IMPORT_C void SendMessageL( CUpnpHttpMessage* aMessage );
+    CUpnpAutoDestroyObjectList* GetAutoDestroyObjectList();
+    
+    // For internal use only
+    IMPORT_C void HttpTransferEventReceivedL(CUpnpHttpMessage& aHttpMsg);
+    
+    /**
+    * Sends transfer failed event to Media Server       
+    * @param aSessionId transaction identifier
+    * @param aStatusCode HTTP Status code
+    */
+    void NotifyTransferFailL(TInt aSessionId, TInt aStatusCode);
+    
+    /**
+    * Sends transfer stopped event to Media Server       
+    * @param aSessionId transaction identifier
+    * @param aType import/export
+    */
+    void NotifyTransferStoppedL( TInt aSessionId, CUpnpFileTransfer::TTransferType aType);
+
+     // new functions for httptransfer.dll intergration
+    void HttpGetStartedSoapNotifyL(TInt aSessionId);    
+    void HttpPostStartedL(TInt aSessionId);   
+              
+
+    // helper functions
+    TCurrentAction ExecutedAction();
+    void SetExecutedAction(TCurrentAction aAction);
+    
+    
+    /**
+    * This function is a entry point for http messages.
+    * received from Symbian HTTP Stack
+    * @since Series 60 3.2
+    * @param aSessionId identifier of the HTTP request.
+    * @param aHttpStatusCode HTTP error code.
+    */
+    void HttpResponseReceivedL( TInt aSessionId,
+                                TInt aStatusCode);   
+    
+    /**
+    * Getter
+    * @since Series 60 3.2
+    * @return Event Observer
+    */
+    MUpnpContentDirectoryEventObserver* EventObserver();
+    
+public://temporary public methods
+
+    void TransferCompleteL(TInt aResId, TInt aObjId);
+    
+    void TransferProgress( TInt aId, TInt aBytes, TInt aTotalBytes );
+    
+    void TransferStartL(const TDesC8& aImpUri);
+
+    /** 
+    * This fuction removes a TransferID from the TransferIDs Statevariable
+    * @since Series 60 2.6
+    * @param aTransferID a id of file transfer
+    **/
+    void RemoveFileTransferFromTransferIDsStateVariableL(TInt aTransferID);
+    
+    /** 
+    * This fuction adds a TransferID to the TransferIDs Statevariable
+    * @since Series 60 2.6
+    * @param aTransferID a id of file transfer
+    **/
+    void AddFileTransferToTransferIDsStateVariableL( TInt aTransferID );
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aFileName
+    * @return boolean whether given file is drmfile
+    */
+    TBool IsDrmFileL(const TDesC& aFileName);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aFileName
+    * @return boolean whether given file is drmfile
+    */
+    TBool IsDrmFileL(const TDesC8& aFileName);
+    
+
+     /** 
+    * This functions is used for generating correct res tags for finished downloads.
+    * @param aOnlyThumbnail  this method is used during two action - ImportResource and CreateObject. 
+    *                           In CreateObject case res can be created by passed argument so we only thumbail has to be created
+    * @since Series 60 2.6
+    * @return error code. KErrNone if no errors.
+    **/
+    TInt CreateResTagL( TInt aSessionId, 
+                       TDesC8& aFilePath, 
+                        TInt aImportNumber,
+                        TBool aOnlyThumbnail = EFalse  );
+
+
+    /**
+    * Notify transfer          
+    * @param aSessionId HTTP transaction identifier 
+    */    
+    void NotifyOutgoingTransferL (TInt aSessionId); 
+    
+    
+    CUpnpContentDirectoryDb*  ContentDirectoryDb();
+    
+    MUpnpTransferInterface* TransferHandler();
+    
+public: //from MUpnpTransferObserver
+    
+    virtual void TransferCompletedL( TInt akey, TInt aResultCode );
+
+public: //from MUpnpHttpServerTransactionCreator
+
+        IMPORT_C virtual void NewTransactionL(
+        const TDesC8& aMethod, const TDesC8& aUri, 
+        const TInetAddr& aSender, CUpnpHttpServerTransaction*& aResultTrans );
+
+private: //form MUpnpHttpServerObserver
+    virtual void HttpEventLD( CUpnpHttpMessage* aMessage );
+    
+private://private methods
+
+
+    void PrepareAutoDestroyObjectL(TXmlEngElement aObject, TInt aObjId);
+
+    /**
+    * Gets ip and port number
+    * @since Series S60 3.1
+    * @return descriptor pointer
+    */
+    HBufC8* GetIpAndPortDes8L();
+
+    /**
+    * Sets size
+    * @since Series S60 3.1
+    * @parma aSize
+    * @parma aFilePath
+    */
+    void SetResSizeL(TXmlEngAttr aSize, const TDesC& aFilePath);
+        
+    /**
+    * Adds Import URI to Element
+    * @since Series S60 3.1
+    * @param aElement
+    */
+    void AddImportUriToElL(TXmlEngElement aElement);
+        
+    /**
+    *
+    * @since Series S60 3.1
+    * @return descriptor pointer
+    */
+    HBufC8* BuildImportUriLC();
+    HBufC8* BuildImportUriShorterLC();
+        
+    /**
+    * Checking whether thumbnail is available
+    * @since Series S60 3.1
+    * @param aFile
+    * @return 
+    **/
+    TBool IsThumbnailAvailableL(const TDesC& aFile);
+    
+    /**
+    * Checking whether thumbnail is available
+    * @since Series S60 3.1
+    * @param aFile 
+    * @return
+    */
+    TBool IsThumbnailAvailableL(const TDesC8& aFile);
+    
+    /**
+    * Creates thumbnail
+    * @since Series S60 3.1
+    * @param a SrcFile
+    * @param aObjId
+    */
+    void CreateThumbnailL(const TDesC& aSrcFile, TInt aObjId);
+    
+    /**
+    * Adds new res tag
+    * @since Series S60 3.1
+    * @param aObjEl 
+    */
+    void AddNewResTagL(TXmlEngElement aObjEl);
+    
+    /**
+    * Creates a name for thumbnail
+    * @since Series S60 3.1
+    * @param aFileName
+    * @return descriptor pointer
+    */
+    HBufC* CreateNameForThumbnailL(const TDesC& aFileName);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aRes
+    */      
+    void HandleLocalResourcesL(TXmlEngElement aRes, TInt aObjectId);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @parma aFileName
+    * @return descriptor pointer
+    */
+    HBufC8* BuildContentUriL(const TDesC& aFileExt, TInt aObjectId);  
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aAction  
+    * @param aSenAndDestroy
+    * @return
+    */
+    TInt DoActionReceivedL( CUpnpAction* aAction );
+    
+    /**
+    * 
+    * since Series S60 3.1
+    * @param aObjs
+    * return descriptor pointer
+    */
+    HBufC8* SerializeObjectsListL(const RArray<RXmlEngDocument>& aObjs);
+              
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aObj
+    * @param aImportUri
+    * @param ANewFile
+    */
+    void DeleteOldResourcesL( RXmlEngDocument& aObj, const TDesC8& aImportUri,
+                              const TDesC& aNewFile );
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @parma aMessage
+    * return descriptor pointer
+    */
+    HBufC8* GetImportUriLC(CUpnpHttpMessage* aMessage);     
+       
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aFileName
+    * @param aNextKey
+    * @return descriptor pointer
+    */
+    HBufC* BuildThumbnailUrlPathL(const TDesC& aFilename, const TDesC& aNextKey);
+
+    /**
+    * This function gets mime type for specified file. 
+    * @since Series 60 3.1
+    * @param aFilename -  filename, for which mimeType will be taken.
+    * @return pointer to variable storing mimeType. 
+    */
+    HBufC8* GetMimeTypeLC(const TDesC8& aFilename);    
+
+    /**
+    * Removes thumbnail creator and corresponding objectId from lists. 
+    * @since Series 60 3.1
+    * @param aThCreator - thumbnail creator for which the information will be deleted.
+    */
+    void RemoveThCreatorAndObjectIdLD( CUpnpThumbnailCreator* aThCreator);
+
+    /**
+    * Gives object id for specified thumbnail creator. 
+    * @since Series 60 3.1
+    * @param aThCreator - thumbnail creator for which object id will be searched for. 
+    * @return object id for specified thumbnail creator. 
+    */
+    TInt GetObjectIdFromThCreator( CUpnpThumbnailCreator* aThCreator);
+
+    /**
+    * Gives this server address in predefined format. 
+    * @since Series 60 3.1
+    * @return pointer to address. 
+    */
+    HBufC8* CreateAddressValueLC();
+
+    /**
+    * This function creates ProtocolInfo object for further use. 
+    * @since Series 60 3.1
+    * @param aMimeType - mime type, for which ProtocolInfo will be created.
+    * @param aAddInfo - additional information which can be choosen according to mime type and image size. 
+    * @return pointer to CProtocolInfo object, which describes all protocolInfo values for this element.
+    */
+    CUpnpDlnaProtocolInfo* CreateProtocolInfoFromMimeL(const TDesC8& aMimeType, TInt aAddInfo );
+
+    /**
+    * This function retrieves title from object description. 
+    * @since Series 60 3.1
+    * @param aObjId - objecty id for which title will be retrieved. 
+    * @return pointer to HBufC, with specified value. 
+    */
+    HBufC* GetFileNameL( TInt aObjId );    
+    HBufC* GetFileNameWithoutPathL( TInt aObjId );
+    
+    /**
+    * This function add underscore and number to existing filename. 
+    * @since Series 60 3.2
+    * @param aFileName - file that probably exist. 
+    * @return pointer to HBufC, with specified value. 
+    */
+    HBufC* CreateFileNameL( const TDesC16& aFileName );
+   
+    /**
+    * This function puts on stack upnp:class value for specific mime type.  
+    * @since Series 60 3.1
+    * @param aMimeType - mime type from which additional information will be retrieved. 
+    * @return pointer to HBufC8 object with new value, if the type is unknown there is null returned.
+    * Mapping: 
+    * image/* - object.item.imageItem
+    * video/* - object.item.videoItem 
+    * audio/* - object.item.audioItem 
+    * text/* - object.item.textItem 
+    */ 
+    HBufC8* GetItemTypeFromMimeTypeLC(const TDesC8& aMimeType);
+        
+    /**
+    * This function compares upnp:class tag value, with value denoted by aMimeType. 
+    * @since Series 60 3.1
+    * @param obj - object for which needed changes will be applied.
+    * @param aMimeType - mime type from which additional information will be retrieved. 
+    */ 
+    void CheckItemTypeForObjectL( RXmlEngDocument& obj, const TDesC8&  aMimeType );
+        
+  
+    /**
+    * This function returns a XML fragment containing the XML in the parameter
+    * @since Series 60 2.6
+    * @param aBuffer the XML is in this buffer
+    * @return A new CSenDomFragment that is on the cleanup stack
+    */
+    RXmlEngDocument XmlFragmentL(const TDesC8& aBuffer);
+        
+    /**
+    * This fuctions converts one XML element to a string 
+    * @since Series 60 2.6
+    * @param aResp XML string
+    * @param aSen an Sen element to be converted to string
+    */
+    void BrowseElementL( HBufC8*& aResp, TXmlEngElement& aSen );
+
+    /**
+    * This fuctions is a getter for container updateID. 
+    * @since Series 60 2.6
+    * @param aID ID of the container which updateID is returned
+    * @return a updateId of container
+    */
+    TInt ContainerUpdateId( const TDesC8& aContainerID );
+
+
+    /**
+    * Function to add data to metadb
+    * @param aFragment fragment to add to db
+    * @param aContainer container where to add data
+    * @param aId parameter returned by AddToMetaDbL method, stands for item id
+    * @return upnperrorcode descriping situation
+    */
+    TUpnpErrorCode AddToMetaDbL( RXmlEngDocument& aFragment, TInt aContainer, TInt* aId,
+                                 TBool aIsLocal );
+
+    /*
+    *
+    * @since Series S60 3.1
+    * @param aFragment
+    * @param aImportUris
+    * @param aRess
+    * @param aLocal
+    * @param aCreateThumbnailRes
+    * @param aNextKey
+    * @return upnperrorcode descriping situation
+    */
+    TUpnpErrorCode PrepareCreateOperationL( RXmlEngDocument& aFragment, 
+        RArray<TXmlEngAttr>& aImportUris, RArray<TXmlEngElement>& aRess, TBool& aLocal,
+        TBool& aCreateThumbnailRes, TInt& aNextKey );
+
+    /**
+    * Related to CreateObject, resultset of create is created here
+    * @since Series 60 2.6
+    * @param aAction action data structure is needed here
+    * @param aElement element added to db
+    * @param aId element's id
+    **/
+    void ConstructCreateResultsetL( CUpnpAction*& aAction, 
+                                    RXmlEngDocument aElement, 
+                                    TInt aId );
+
+ 
+    /** 
+    * Function for creating a new object
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode CreateObjectL( CUpnpAction*& aAction );
+    /** 
+    * Function for browsing values of objects
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode BrowseL( CUpnpAction*& aAction );
+
+    /** 
+    * Function for destroying objects
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode DestroyObjectL( CUpnpAction*& aAction );
+
+    /** 
+    * Function for creating refense items
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode CreateReferenceL( CUpnpAction*& aAction );
+
+    /** 
+    * Function to solve CDS's search capabilities
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @retrun upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode GetSearchCapabilitiesL( CUpnpAction*& aAction );
+
+    /** 
+    * Function to solve CDS's sort capabilities
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode GetSortCapabilitiesL( CUpnpAction*& aAction );
+
+    /** 
+    * Getter for CDS's SystemUpdateID
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode GetSystemUpdateIdL( CUpnpAction*& aAction );
+
+    /** 
+    * Function for importing resources
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode ImportResourceL( CUpnpAction*& aAction );
+
+    /** 
+    * Function for exporting resources
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    */
+    TUpnpErrorCode ExportResourceL( CUpnpAction*& aAction );
+
+    /** 
+    * Function for stopping ongoing file transfer (import / export)
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @retrun upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode StopTransferResourceL( CUpnpAction*& aAction );
+
+    /** 
+    * Function for getting information about ongoing file transfer
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode GetTransferProgressL( CUpnpAction*& aAction );
+
+    /** 
+    * This functions removes a "res" tag from a object
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @return upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode DeleteResourceL( CUpnpAction*& aAction );
+
+    /**
+    * This function changes file name and its extension. 
+    * @since Series 60 3.1
+    * @param aFilePath - the target file. 
+    * @param aMimeType - mime type, for which file extension will be choosen. 
+    */
+    HBufC8* ChangeFileNameWithExtensionL(TDesC8& aFilePath, const TDesC8& aMimeType );
+ 
+ 
+   
+    /**
+    * @param aOnlyThumbnail  this method is used during two action - ImportResource and CreateObject. 
+    *           In CreateObject case res can be created by passed argument so we only thumbail has to be created
+    */
+    TInt CreateResTagInternalL( TInt aSessionId, 
+                                TDesC8& aFilePath,
+                                HBufC8* aImportUri, 
+                                TBool aOnlyThumbnail );
+
+    /**
+    * calls CreateResTagInternalL but KErrCorrupted is TRAPed in order to invoke recovery on DB
+    */
+    TInt CreateResTagInternalWithDBRecoveryL( TInt aSessionId,
+                                              TDesC8& aFilePath, 
+                                              HBufC8* aImportUri, 
+                                              TBool aOnlyThumbnail = EFalse );
+    
+private:    // New functions    
+
+   
+    void DoSendActionL(CUpnpAction* aAction, TUpnpErrorCode aError);
+    void DoSendMessageL(CUpnpHttpMessage* aMessage);
+    TBool IsValidUrlPath(const TDesC& aUrlPath);
+    
+    /**
+    * Gets protocolInfo from mimeType.
+    * @param aMimeType mime type for which protocolInfo will be created.
+    * @return string with protocolInfo
+    */
+    HBufC8* ProtocolInfoFromMimeL( const TDesC8& aMimeType, TInt aAddInfo, TBool aOpRangeParam,
+                                   TBool aCiParam = EFalse );
+
+    HBufC8* ProtocolInfoFromMimeL(const TDesC8& aMimeType, TXmlEngElement& aResEl);
+    
+    /**
+    * Notify message when the thumbnail creation has been finished. 
+    * From MUpnpThumbnailCreatorObserver interface.
+    * @param aThCreator this is a thumbnail creator.
+    * @param aResult result from thumbnail creation.
+    */
+    void NotifyThumbnailResultL( CUpnpThumbnailCreator* aThCreator, TInt aResult );
+
+    /**
+    * Notify message when the thumbnail creation has been finished. 
+    * From MUpnpThumbnailCreatorObserver interface.
+    * @param aThCreator this is a thumbnail creator.
+    * @param aResult result from thumbnail creation.
+    */
+    CUpnpThumbnailCreator* CreateThumbnailCreatorL(TInt aObjectId);
+    
+    /**
+    * Cheks if object exists.
+    * @param aObjectId
+    */
+    TBool IsObjectExistL( TInt aObjectId );
+    
+    /**
+    * Cheks if object is valid.
+    * if object doesn't exist or has no parent 
+    * object is removed from autodestoy table and EFalse is returned
+    * @param aObjectId
+    */
+    TBool ValidateObjectL( TInt aObjectId );
+         
+    /**
+    * Handles DB error
+    * Tries to recover, if fails tries to recreate
+    * @since Series S60 3.2
+    * @return TInt - KErrNone if succeed
+    */
+    TInt HandleDbError( TInt aError );
+    
+    /**
+    * Checks DB and disk Space
+    * Tries to recover DB, if fails tries to recreate
+    * @since Series S60 3.2
+    * @param aAction received action
+    * @return EFalse if succeed
+    */
+    TBool IsDbOrDiskProblemL( CUpnpAction* aAction );
+    
+    /**
+    * Determines if DB has benn recovered successfully
+    * returns ETrue if yes
+    * @param a Error - DB is revovered only if aError equal KErrCorrupted
+    * @since Series S60 3.2
+    * @returns ETrue if succeed 
+    */
+    TBool DataBaseHasBeenRecoveredL( TInt aError );
+    
+    /**
+    * Returns DB creation status
+    * @since Series S60 3.2
+    * @return TBool
+    */
+    TBool IsDbCreated(); 
+
+    /**
+    * Updates import URI
+    * @since Series S60 3.2
+    * @return TPtrC8
+    */
+    TPtrC8 UpdateImportUriL( const TDesC8& aImportUri );
+    
+private: // Constructors
+    
+    /**
+    * C++ default constructor.
+    */
+    CUpnpContentDirectory( CUpnpDevice& aDevice, 
+                           MUpnpThumbnailCreatorObserver* aThmbObs,
+                           MUpnpTransferInterface* aTransfer
+                         );
+
+    /**
+    * Second phase of the constructor.
+    * Initialises a DOM tree.
+    * By default Symbian 2nd phase constructor is private.
+    * @param service Parent service
+    */
+    void ConstructL( TUpnpCdSettings aSettings, 
+                     CUpnpMetadataStorage* aMetadataStorage 
+                   );
+    
+    void ConstructHttpL();
+    
+private:
+    
+    //Array containing objects ids, which will be updated after Thumbnail creation.
+    RArray<TInt> iThObjectIds;
+    
+    // Array of thumbnail creators in which creators can be searched for.
+    RPointerArray<CUpnpThumbnailCreator> iThumbnailCreators;
+
+    // Next free object ID, owned
+    TInt iNextFreeID;
+
+    // Pointerarray for pending actions (used in Import and Export), owned
+    //RPointerArray<CUpnpAction> iPendingActions;
+
+    // Elementfactory, owned
+    CUpnpElementFactory* iElementdb;
+    
+       
+    // Database
+    CUpnpContentDirectoryDb* iContentDirectoryDb;
+        
+    // file session
+    RFs iFs;
+    
+    // Download directory
+    HBufC* iDownloadDir;
+    
+   // Thumbnail directory
+    HBufC* iThumbDir;
+    // connection try to bitmap and font server. 
+    // if there is no such connection there will be no thumbcreated. 
+    TInt iBitmapServerConnection;
+        
+    TBool iEcomUsed;
+        
+    // Thumbnail creator observer
+    MUpnpThumbnailCreatorObserver* iThmbObs;
+
+    // auto-destroy object list    
+    CUpnpAutoDestroyObjectList* iAutoDestroyObjects;
+
+    
+    // Event observer
+    MUpnpContentDirectoryEventObserver* iEventObserver;
+    
+    // Thumbnail creation flag
+    TBool iCreateThumbnails; 
+    
+    // Max number of browsed object
+    TInt iMaxRequestCount;
+
+    TCurrentAction iCurrentAction;
+    
+    RXmlEngDOMImplementation iDOMImpl;
+    
+    MUpnpCdsSender* iSender; // not owned
+        
+    CUpnpMimeMapper* iMimeToExtMap;
+        
+    HBufC* iObjectsXmlPath;
+    
+    CUpnpStateHandler* iStateHandler;
+         
+
+    CUpnpTransferController* iTransferController;
+    
+    MUpnpTransferInterface* iTransferHandler;
+    
+    CUpnpDlnaFilter* iDlnaFilter;
+    
+    CUpnpHttpServerSession* iHttpServerSession;
+    
+    CUpnpSecurityManager* iSecurityManager;
+    
+    };
+
+#endif  // C_CUPNPCONTENTDIRECTORY_H
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectorydatafinder.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,99 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is a interface, which allows to comunicate with 
+*				 ContentDirectory service to obtain informations related to 
+*				 reqested Uri such as path on physical drive to requested Uri 
+*				 or DLNA specyfic informations and flag for this Uri.
+*
+*/
+
+
+
+#ifndef C_MUPNPCONTENTDIRECTORYDATAFINDER_H
+#define C_MUPNPCONTENTDIRECTORYDATAFINDER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "upnpprotocolinfo.h"
+#include "upnpdlnaprotocolinfo.h"
+
+// FORWARD DECLARATIONS
+class CUpnpContentDirectory;
+
+/**
+* This is a interface, which allows to comunicate with ContentDirectory service
+* to obtain informations related to reqested Uri such as path on physical drive
+* to requested Uri or DLNA specyfic informations and flag for this Uri.
+* @lib DLNAwebserver.lib
+* @since Series 60 2.6
+**/
+class MUpnpContentDirectoryDataFinder 
+    {
+public: 
+
+    /**
+    * Checks if specified importUri is in database still active.
+    * @since Series60 2.6
+    * @param aImportUri uri to be searched in databse. 
+    * @return objId if successful or KErrnone if object wasn't found.
+    **/
+    virtual TInt CheckImportUriL( const TDesC8& aImportUri ) = 0;
+  
+    /**
+    * Gets title of the object with given id from ContentDirectory service. 
+    * @since Series60 2.6
+    * @param aObjectId id of the object.
+    * @param aValue pointer to buffer in which the tilte of the object will be returned.
+    *       Buffer for aValue has to allocated first.
+    **/
+    virtual void GetTitleForUriL( TInt aObjectId, TPtr& aValue ) = 0;
+    
+    /**
+    * Finds protocolInfo by contentUri (Not by importUri).
+    * @since Series60 2.6
+    * @param aContentUri uri to be searched in database (Value of resource).
+    * @param aProtocolInfo ProtocolInfo related to resorce which has been founded. 
+    *       Ownership is transfered to the caller.
+    * @return KErrNone if successful, otherwise another of the system error codes 
+    **/
+    virtual TInt GetProtocolInfoL( const TDesC8& aContentUri, 
+                                   CUpnpDlnaProtocolInfo*& aProtocolInfo ) = 0;
+   
+    /**
+    * Find shared folder for urlpath
+    * @since Series60 2.6
+    * @param aUrlPath Name of URL path connected to shared folder.
+    * @param aFileName Name of file.Can be empty.
+    * @param aFolderPath Name of shared folder.
+    * @return KErrNone or another of the system error codes.
+    **/ 
+    virtual TInt FindSharedFolderL( const TDesC& aUrlPath, 
+                                    const TDesC& aFileName, 
+                                    HBufC*& aFolderPath ) = 0;
+                                    
+    /**
+    * Find protocolInfo by importUri.
+    * @param aImportUritUri uri to be searched in database (Value of resource).
+    * @return ProtocolInfo related to resorce which has been founded. Ownership 
+    *       is transfered to the caller.
+    */
+    virtual CUpnpDlnaProtocolInfo* GetProtocolInfoByImportUriL( 
+                                  const TDesC8& aImportUri) = 0;
+
+
+    };
+
+#endif      // C_MUPNPCONTENTDIRECTORYDATAFINDER_H
+     
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectorydb.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,591 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Database for MediaServer
+*
+*/
+
+
+
+#ifndef C_CUPNPCONTENTDIRECTORYDB_H
+#define C_CUPNPCONTENTDIRECTORYDB_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <d32dbms.h>
+#include <s32file.h>
+#include <flogger.h>
+#include <upnperrors.h>
+#include <xmlengdom.h>
+
+
+// CLASS DECLARATION
+class CUpnpElementBean;
+class CUpnpFilterElement;
+class CUpnpAttributeBean;
+class CUpnpObjectBean;
+class CUpnpDlnaProtocolInfo;
+class CUpnpShareMapBean;
+class CUpnpResourcesBean;
+class CUpnpMetadataStorage;
+
+
+
+/**
+*  Database for AVContentDirectory.
+*  Implements a database which is used to store descriptors of shared content.
+*
+*  @lib ContentDirectoryDb.lib
+*  @since Series 60 3.0
+*/
+class CUpnpContentDirectoryDb : public CBase
+{
+ public:  // Constructors and destructor
+ 
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpContentDirectoryDb* NewLC(CUpnpMetadataStorage* aMetadataStorage);
+    static CUpnpContentDirectoryDb* NewL(CUpnpMetadataStorage* aMetadataStorage);
+
+    /**
+    * Destructor
+    */
+    ~CUpnpContentDirectoryDb();
+    
+ public: // New functions
+    
+    /**
+    * Checks if object with the given id exists, is a container and its 'restricted' attribute has value of 'false'
+    * @since Series S60 3.0
+    * @param aObjId id of the object to be checked
+    * @return returns EUpnpOk if object with the given id exists in database and is a "non restricted conainer"
+    */
+    TUpnpErrorCode CheckObjectRestrictionL(TInt aObjId);
+
+    /**
+    * Inserts object into database 
+    * @since Series S60 3.0
+    * @param aFragment RDocuemnt of the document to be added to database
+    * @param aId id of the object  
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode InsertObjectL( RXmlEngDocument& aFragment, TInt aContainer, TInt* aId);
+    
+    /**
+    * Function returns DIDL-Lite XML fragment with metadata for requested object.
+    * IMPORTANT: 1. Caller takes responsibility for returned document and is 
+    *               obliged to close it.
+    *        2. The root element of the document is <DIDL-Lite> element and
+    *               the object's element is its direct, onluy child.
+    * @param aObjectID id of requested object.
+    * @param aDoc handler to document containing object's metadata.
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode GetObjectL( TInt aObjectID, RXmlEngDocument& aDoc, 
+                               const TDesC8& aFilterString);
+                    
+    /**
+    * Gets id of reffered object 
+    * @since Series S60 3.0
+    * @param aObjectId object id
+    * @return reffered object id.
+    */
+    TInt ReferedObjectIdL( TInt aObjectId );
+    
+    /**
+    * Gets object list
+    * @since Series S60 3.1
+    * @param aParentId
+    * @parem aList
+    * @return upnperrorcode descriping situation
+    */
+    TUpnpErrorCode GetObjectListL(TInt aParentId, RArray<TInt>& aList);
+    
+    /**
+    * Deletes object from database
+    * @since Series S60 3.0
+    * @param aObjId id of the object to be deleted
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode DeleteObjectL(TInt aObjId,RArray<TInt>& aRefList, TBool aDeleteResource=ETrue);
+    
+    /**
+    * Updates the metadata of the object with specified id
+    * @since Series S60 3.0
+    * @param aObjId id of the object to be updated
+    * @param  aFragment XML DOM tree with the updated object's metadata
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode UpdateObjectL(TInt aObjId, RXmlEngDocument& aFragment);
+    
+
+    /**
+    * Deletes the res elements with the specified value.
+    * @since Series S60 3.0
+    * @param aResVal value of the res element which is to be deleted
+    * @param aTumbailResVal value of the thumbail res element which is to be deleted
+    */
+    void DeleteResourceL(const TDesC8& aResVal, RArray<TInt>& aContIds);
+
+    /**
+    * Gets object by its attribute value.
+    * @since Series S60 3.0
+    * @param aDoc on return, it contains the object's data
+    * @param aObjId on, return it contains the object's id
+    * @param aAttrName attribute's name
+    * @param aAttrVal attribute's value
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode GetObjectByAttrL(RXmlEngDocument& aDoc, TInt* aObjId, 
+                                    const TDesC8& aAttrName, const TDesC8& aAttrVal);   
+
+    /**
+    * Checks the restrictions of the parent object of the given object.
+    * @since Series S60 3.0
+    * @param aObjId object's id
+    * @return returns EUpnpOk if object with the given id exists in database and is a "non restricted conainer"    
+    */
+    TUpnpErrorCode CheckParentRestrictionL(TInt aObjId);
+
+    /**
+    * Gets the object id by its attribute value.
+    * @since Series S60 3.0
+    * @param aAttrName attribute's name
+    * @param aAttrVal attribute's value
+    * @return object's id
+    */
+    TInt GetObjIdByAttrL(const TDesC8& aAttrName, const TDesC8& aAttrVal);
+
+    /**
+    * Gets the object id by its attribute value. Uses LIKE operator for comparison
+    * @since Series S60 3.0
+    * @param aAttrName attribute's name
+    * @param aAttrVal attribute's value
+    * @return object's id
+    */
+    TInt GetObjIdByAttrLikeL(const TDesC8& aAttrName, const TDesC8& aAttrVal);
+
+
+    /**
+    * Prepares a new RXmlEngDocument with DIDL-Lite element 
+    * @since Series S60 3.0
+    * @return Returns just created document
+    */
+    RXmlEngDocument PrepareDidlDocumentL();
+    
+    
+    /**
+    * Find protocolInfo by contentUri (Not by importUri).
+    * @param aContentUri uri to be searched in database (Value of resource).
+    * @param aProtocolInfo ProtocolInfo related to resorce which has been founded. Ownership is transfered to the caller.
+    * @return KErrNone if successful, otherwise another of the system-wide error codes 
+    */
+    TInt GetProtocolInfoL(const TDesC8& aContentUri, CUpnpDlnaProtocolInfo*& aProtocolInfo); // virtual
+
+    
+    /**
+    * Gets object list
+    * @since Series S60 3.1
+    * @param aIds
+    * @param aFilter
+    * @param aObjs
+    * @return upnperrorcode descriping situation
+    */
+    void GetObjectListL(const RArray<TInt>& aIds, const TDesC8& aFilter, RArray<RXmlEngDocument>& aObjs);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aObjId
+    * @return boolean whether can be nested
+    */
+    TBool CanBeNestedL(TInt aObjId);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aResBean
+    */
+    void AddResourceL(CUpnpResourcesBean* aResBean, TInt aObjId);
+    
+    /**
+    * Deletes resource
+    * @since Series S60 3.1
+    * @param aResId
+	* @param aDeleteFile
+    */
+    void DeleteResourceByResIdL(TInt64 aResId, TBool aDeleteFile = ETrue);
+    
+    /**
+    * Deletes resource
+    * @since Series S60 3.1
+    * @param aResId
+	* @param aDeleteFile
+    */
+    void DeleteResourceByObjIdL(TInt aObjId, TBool aDeleteFile = ETrue);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aOldDir
+    */
+    void NewMediaDirectoryL(const TDesC& aOldDir);
+    
+    /**
+    * Gets resource
+    * @since Series S60 3.1
+    * @param aResId
+    * @return pointer to CUpnpResourceBean
+    */
+    CUpnpResourcesBean* GetResourceL(TInt64 aResId);
+    
+    /**
+    * Gets attribute
+    * @since Series S60 3.1
+    * @param aElmId
+    * @param aAttrName
+    * @param aAttrVal
+    * @return pointer to CUpnpAttributesBean
+    */
+    CUpnpAttributeBean* GetAttrByNameL(TInt aElmId, const TDesC8& aAttrName, HBufC8*& aAttrVal);
+    
+    /**
+    * Gets attribute
+    * @since Series S60 3.1
+    * @param aAttrName
+    * @param aAttrVal
+    * @return pointer to CUpnpAttributeBean
+    */
+    CUpnpAttributeBean* GetAttrByValueL(const TDesC8& aAttrName, const TDesC8& aAttrVal);
+    
+    /**
+    * Gest protocol info
+    * @since Series S60 3,1
+    * @param aImportUri
+    * @return descriptor pointer
+    */
+    HBufC8* GetProtocolInfoByImportUriL(const TDesC8& aImportUri);
+    
+    
+    /**
+    * Getter
+    * @since Series S60 3.1
+    * @return TInt
+    */
+    TInt GetKeyForUriL();
+    
+    /**
+    * Gets first object ID by element value
+    * @param aElmName - element name
+    * @param aElmValue - element value
+    * @return object ID
+    */
+    TInt GetObjectIdByElementValueLikeL(const TDesC8& aElmName, const TDesC8& aElmValue);
+
+    /**
+    * Gets the parent object's id of the object with given id.
+    * @since Series S60 3.1
+    * @param aObjectId child object id
+    * @return parentid
+    */
+    TInt GetParentIdL(TInt aObjectId);
+    /**
+    * Gets the next object's id .
+    * @since Series S60 3.1
+    * @return id
+    */
+    TInt GetObjectIdL();
+    /**
+    * Gets the next object's id .
+    * @since Series S60 3.1
+    * @return id
+    */
+    HBufC8* GetObjectTitleL(TInt aId);
+
+   /**
+    * Checks if database have propper columns in each table.
+    * If not it leaves with KErrCorrupt.
+    * @since Series S60 3.2
+    */
+    void CheckDatabaseL();  
+    
+   /**
+    * Handles DB error
+    * Tries to recover, if fails tries to recreate
+    * @since Series S60 3.2
+    * @return TInt - KErrNone if succed
+    */
+    TInt HandleDbError( TInt aError );
+
+    /**
+    * Recreates the database file.
+    * @since Series S60 3.1
+    */
+    TInt RecreateDatabaseFile();
+    
+    /**
+    * Returns DB creation status
+    * @since Series S60 3.2
+    * @return TBool
+    */
+    TBool IsDbCreated();
+
+ private:
+    
+    /**
+    * Getter
+    * @since Series S60 3.1
+    * @param aObjId
+    * @return pointer to CUpnpObjectBean
+    */
+    CUpnpObjectBean* GetObjBeanLC(TInt aObjId);
+    
+    /**
+    * Gets object
+    * @since Series S60 3.1
+    * @param aIns
+    * @param AresVal
+    */
+    void GetObjectsByResourceL(RArray<TInt>& aIds, const TDesC& aResVal);
+       
+      
+    /**
+    * Gets element
+    * @since Series S60 3.1
+    * @param aElmName
+    * @param ElmValue
+    * @return TInt
+    */
+    TInt GetElmIdByNameAndValL(const TDesC& aElmName, const TDesC& aElmValue);
+    
+    /**
+    * Gets attribute
+    * @since Series S60 3.1
+    * @param aElmId
+    * @param aAttrName
+    * @param aAttrValue
+    */
+    void GetAttrValueByNameL(TInt aElmId, const TDesC8& aAttrName, HBufC8*& aAttrVal);
+
+    /**
+    * Performs resource deletion of the object being destroyed
+    * @since Series S60 3.0
+    * @param aObjId aObjId id of the object being destroyed
+    * @param aObjId aCd pointer to the ContentDirectory object - it provides a function which deletes
+    *                  a file from the private directory
+    */
+    void DeleteResourcesL(TInt aObjId);
+
+    /**
+    * Performs the DeleteResource operation. 
+    * Deletes each res element with the value of aResVal and corresponding thumnail res elements
+    * @since Series S60 3.0
+    * @param aResVal value of the res whis is to be deleted
+    * @param aThumbailResVal value of the thumbail res whis is to be deleted
+    */
+    void DoDeleteResourceL(const TDesC8& aResVal, RArray<TInt>& aContIds);
+
+
+    /**
+    * Sets the childCount attribute in the given object's element.
+    * @since Series S60 3.0
+    * @param aElement object's element
+    * @param aId object's id
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    void SetChildCountL(TXmlEngElement aElement, TInt aId);
+    
+    /**
+    * Adds all (existing in the database) properties to the object's element.
+    * @since Series S60 3.0
+    * @param aElement object's element
+    * @param aObjBean object table description object
+    */
+    void AddAllPropertiesL(TXmlEngElement aElement, CUpnpObjectBean* aObjBean);
+
+    /**
+    * Adds new attribute to the element.
+    * @since Series S60 3.0
+    * @param aElement object's element
+    * @param aAttrName the name of the attribute which is to be added
+    * @param aElementId id of the element which the attribute belongs to
+    * @param aObjectId id of the object which the elements belongs to
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    void AddAttributeL( TXmlEngElement aElement, const TDesC8& aAttrName, TInt aElementId, TInt aObjectId );
+
+    /**
+    * Adds a requested properties to the object's element.
+    * @since Series S60 3.0
+    * @param aObjectID object's id
+    * @param aElement an array containing filter elements of the requested property
+    * @param aFilterElements ?description
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode AddRequestedPropertiesL(TInt aObjectID,TXmlEngElement aElement,
+                                           const RPointerArray<CUpnpFilterElement>& aFilterElements);
+
+    /**
+    * Adds requested element to the object's element.
+    * @since Series S60 3.0
+    * @param aElement an element wich we want to add a new element to
+    * @param aObjectID id of the object
+    * @param aReqElement filter object of the element to be added
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    void AddElementL(TXmlEngElement aElement, TInt aObjectID, const CUpnpFilterElement* aReqElement);
+
+    /**
+    * Adds required property to the object.
+    * @since Series S60 3.0
+    * @param aElement TXmlEngElement of the object which is to be added the required property
+    * @param aObjId id of the object being processed
+    * @param aFilterElement CUpnpFilterElement object of the property to be added
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode AddRequiredPropertyL(TXmlEngElement aElement, TInt aObjId, CUpnpFilterElement* aFilterElement);
+    
+    /**
+    * Parses filter string.
+    * @since Series S60 3.0
+    * @param aFilter filter string to be parsed
+    * @param aList  On return, contains CFilterElements objects of the filter string
+    */
+    void ParseFilterStringL(const TDesC8& aFilter, RPointerArray<CUpnpFilterElement>& aList);
+
+    /**
+    * Performs get object operation.
+    * @since Series S60 3.0
+    * @param aObjectID id of requested object.
+    * @param aDoc handler to document containing object's metadata.
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode DoGetObjectL(TInt aObjectID, RXmlEngDocument& aDoc, TBool aAll);
+ 
+    /**
+    * Inserts element into database 
+    * @since Series S60 3.0
+    * @param aElementel TXmlEngElement of the element to be inserted
+    * @param aObjId id of the object this element belongs to
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode InsertElementL(const TXmlEngElement& aElementel, TInt aObjId);
+ 
+    /**
+    * Performs object update; a transaction should be started before calling this function
+    * @since Series S60 3.0
+    * @param aObjId id of the object to be updated
+    * @param  aFragment XML DOM tree with the updated object's metadata
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode DoUpdateObjectL(TInt aObjId, TXmlEngElement aFragment);
+
+    /**
+    * Inserts updated object into database
+    * @since Series S60 3.0
+    * @param aObjId id of the object
+    * @param  aFragment XML DOM tree with the updated object's metadata
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode InsertUpdatedL(TInt aObjId, TXmlEngElement& aElement);
+
+    /**
+    * Sets the id attribute in the given object; adds attribute if does not exist
+    * @since Series S60 3.0
+    * @param aElement TXmlEngElement of the object
+    * @return value of the id
+    */
+    TInt SetObjectIdL(TXmlEngElement& aElement);
+
+    /**
+    * Inserts object into database; a transaction should be started before calling this function 
+    * @since Series S60 3.0
+    * @param param descr
+    * @return EUpnpOk, if successful; Leaves if the object could not be inserted into the database
+    *     In case it leaves the transaction must be rolled back
+    */
+    TUpnpErrorCode DoInsertObjectL( TXmlEngElement& aElement, TInt aContainerId, TInt* aId);
+
+
+    
+    /**
+    * Inserts attributes of the given element into the database
+    * @since Series S60 3.0
+    * @param aElement TXmlEngElement of the element 
+    * @param aElmId id of the element
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode InsertAttributesL(const TXmlEngElement aElement, TInt aElmId,TInt aObjId);
+    
+
+    /**
+    * Checks if the given attribute has a corresponding marker attr in the given array
+    * @since Series S60 3.0
+    * @param aAttr TXmlEngAttr of the attribute to be chceck
+    * @param aMarkers an array containing marker attributes
+    * @return ETrue if the attribute is required, otherwise EFalse
+    */
+    TBool IsAttrRequiredL(const TXmlEngAttr& aAttr, RArray<TXmlEngAttr>& aMarkers);
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpContentDirectoryDb(CUpnpMetadataStorage* aMetadataStorage);
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    /**
+    * If data base file is present it just opens it, 
+    * otherwise creates new database storage file.
+    * @since Series S60 3.0
+    * @param aDatabaseFileName name of storage file
+    */
+    void ConstructDbL(const TFileName& aDatabaseFileName);
+    
+    /**
+    * Opens existing database.
+    * @since Series S60 3.0
+    * @param aDatabaseFileName name of storage file
+    */
+    void OpenDbL( const TFileName& aDatabaseFileName );
+    
+    /**
+    * Adds elements that are children of inquired object to passed DOM TXmlEngElement.
+    * @param aObjectID - id of the object, which child elements will be added.
+    * @param aObjectElement - element to which the elements will be added.
+    */
+    void AddElementsL( TInt aObjectID, TXmlEngElement aObjectElement, TBool aAll );
+    
+    /**
+    * Adds attributes to passed DOM TXmlEngElement.
+    * @param aElementID - id of the element, which attributes will be added.
+    * @param aObjectId id of the object which the elements belongs to
+    * @param aElement - element to which the attributes will be added.
+    */
+    void AddAttributesL( TInt aElementID, TInt aObjectID, TXmlEngElement& aElement, TBool aAll );
+    
+
+    
+
+ private:    // Data
+    CUpnpMetadataStorage* iMetadataStorage; // not owned
+    RXmlEngDOMImplementation iDOMImpl;
+ };
+
+#endif //CCONTENTDIRECTORYDB_H
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectorydbdebug.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,225 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Database for MediaServer
+*
+*/
+
+
+
+#ifndef C_CUPNPCONTENTDIRECTORYDB_DEBUG_H
+#define C_CUPNPCONTENTDIRECTORYDB_DEBUG_H
+
+// Note that _DEBUG is automatically defined for debug builds
+
+// To enable file logging: please comment following #ifdef line and 
+// uncomment #ifdef TRUE
+#ifdef _DEBUG
+//#ifndef TRUE // to disable logging & debug in all builds
+//#ifdef TRUE // to enable logging & debug in all builds
+
+/****************************** LOGGING ON ***********************************/
+// INCLUDES
+#include <flogger.h>
+
+// CONSTANTS
+//_LIT(___KLogDir___, "ContentDirectoryDb");
+_LIT(___KLogDir___, "ContentDirectoryDb");
+_LIT(___KLogFile___, "ContentDirectoryDb.log");
+_LIT(___KLogOpeningLine___, "INFO####ContentDirectoryDb.log file opened.");
+_LIT(___KInfoFormatString___,"INFO#%S#%S#%d#%S");
+_LIT(______KSqlComment______,"ERROR#%S#%S#%d#%S");
+_LIT(KSqlComment,"SQL Command:");
+
+// MACROS
+/** Replaces the log file
+*/
+#define __LOG_OPEN()            RFileLogger::Write(___KLogDir___, ___KLogFile___, EFileLoggingModeOverwrite, ___KLogOpeningLine___)
+
+/** For internal use (long comments) - do not use in the code 
+*/
+#define __LOG_STRING(string)            RFileLogger::Write(___KLogDir___, ___KLogFile___, EFileLoggingModeAppend, string);
+
+/** For internal use (long comments) - do not use in the code 
+*/
+#define __LOG_ALL(longstring) \
+    { \
+    TInt ___iLogZ___ = 0; \
+    TInt ___amountLogZ___ = 100; \
+    while(___iLogZ___<longstring.Length()) \
+        { \
+        if(( longstring.Length()-___iLogZ___) < 100) \
+            ___amountLogZ___ = longstring.Length()-___iLogZ___; \
+        __LOG_STRING(longstring.Mid(___iLogZ___,___amountLogZ___)); \
+        ___iLogZ___+=100; \
+        } \
+    } 
+    
+/** Logs error - this is intended to use in the code
+* @param in_function: quoted string - name of function in which the called_function gets called, max 30 chars
+* @param called_function:  quoted string - just called function, ussually it returns error_code, max 30 chars
+* @param error_code: integer - error code returned by just called function
+* @param comment:  quoted string - your comment, if longer than 50 chars will be expanded to the sequent line(s)
+*/
+#define __LOG(in_function,called_function,error_code,comment) \
+    {\
+    _LIT(___KInFunction___,in_function);\
+    _LIT(___KCalledFunction___,called_function);\
+    _LIT(___KComment___,comment);\
+    TInt ___comment_max_length___ = 50;\
+    if(error_code<0)\
+    {\
+        TPtrC ___comment_part___(___KComment___().Left(___comment_max_length___));\
+        RFileLogger::WriteFormat(___KLogDir___, ___KLogFile___, EFileLoggingModeAppend, ______KSqlComment______, &___KInFunction___, &___KCalledFunction___, error_code, &___comment_part___);\
+    }\
+    else\
+    {\
+        TPtrC ___comment_part___(___KComment___().Left(___comment_max_length___));\
+        RFileLogger::WriteFormat(___KLogDir___, ___KLogFile___, EFileLoggingModeAppend, ___KInfoFormatString___, &___KInFunction___, &___KCalledFunction___, error_code, &___comment_part___);\
+    }\
+    if(___KComment___().Length()>___comment_max_length___)\
+    {\
+        TPtrC ___continuation___((___KComment___().Mid(___comment_max_length___)));\
+        __LOG_ALL(___continuation___);\
+    }\
+    }
+
+#define __LOG_INFO(in_function,called_function,error_code,comment) \
+    {\
+    _LIT(___KInFunction___,in_function);\
+    _LIT(___KCalledFunction___,called_function);\
+    _LIT(___KComment___,comment);\
+    TInt ___comment_max_length___ = 50;\
+    TPtrC ___comment_part___((___KComment___().Left(___comment_max_length___)));\
+    RFileLogger::WriteFormat(___KLogDir___, ___KLogFile___, EFileLoggingModeAppend, ___KInfoFormatString___, &___KInFunction___, &___KCalledFunction___, error_code, &___comment_part___);\
+    if(___KComment___().Length()>___comment_max_length___)\
+    {\
+        TPtrC ___continuation___((___KComment___().Mid(___comment_max_length___)));\
+        __LOG_ALL(___continuation___);\
+    }\
+    }
+
+#define __LOG_ERROR(in_function,called_function,error_code,comment) \
+    {\
+    _LIT(___KInFunction___,in_function);\
+    _LIT(___KCalledFunction___,called_function);\
+    _LIT(___KComment___,comment);\
+    TInt ___comment_max_length___ = 50;\
+    TPtrC ___comment_part___(___KComment___().Left(___comment_max_length___));\
+    RFileLogger::WriteFormat(___KLogDir___, ___KLogFile___, EFileLoggingModeAppend, ______KSqlComment______, &___KInFunction___, &___KCalledFunction___, error_code, &___comment_part___);\
+    if(___KComment___().Length()>___comment_max_length___)\
+    {\
+        TPtrC ___continuation___((___KComment___().Mid(___comment_max_length___)));\
+        __LOG_ALL(___continuation___);\
+    }\
+    }
+
+// file versions
+
+#define __LOG_OPEN_FILE(file, string)           RFileLogger::Write(___KLogDir___, file, EFileLoggingModeOverwrite, string)
+
+#define __LOG_TO_FILE(file,in_function,called_function,error_code,comment) \
+    {\
+    _LIT(___KInFunction___,in_function);\
+    _LIT(___KCalledFunction___,called_function);\
+    _LIT(___KComment___,comment);\
+    TInt ___comment_max_length___ = 50;\
+    if(error_code<0)\
+    {\
+        RFileLogger::WriteFormat(___KLogDir___, file, EFileLoggingModeAppend, ______KSqlComment______, &___KInFunction___, &___KCalledFunction___, error_code, &(___KComment___().Left(___comment_max_length___)));\
+    }\
+    else\
+    {\
+        RFileLogger::WriteFormat(___KLogDir___, file, EFileLoggingModeAppend, ___KInfoFormatString___, &___KInFunction___, &___KCalledFunction___, error_code, &(___KComment___().Left(___comment_max_length___)));\
+    }\
+    if(___KComment___().Length()>___comment_max_length___)\
+    {\
+        TPtrC ___continuation___((___KComment___().Mid(___comment_max_length___)));\
+        __LOG_ALL(___continuation___);\
+    }\
+    }
+
+#define __LOG_INFO_TO_FILE(file,in_function,called_function,error_code,comment) \
+    {\
+    _LIT(___KInFunction___,in_function);\
+    _LIT(___KCalledFunction___,called_function);\
+    _LIT(___KComment___,comment);\
+    TInt ___comment_max_length___ = 50;\
+    RFileLogger::WriteFormat(___KLogDir___, ___KLogFile___, EFileLoggingModeAppend, ___KInfoFormatString___, &___KInFunction___, &___KCalledFunction___, error_code, &(___KComment___().Left(___comment_max_length___)));\
+    if(___KComment___().Length()>__comment_max_length__)\
+    {\
+        TPtrC ___continuation___((___KComment___().Mid(___comment_max_length___)));\
+        __LOG_ALL(___continuation___);\
+    }\
+    }
+
+#define __LOG_ERROR_TO_FILE(file,in_function,called_function,error_code,comment) \
+    {\
+    _LIT(___KInFunction___,in_function);\
+    _LIT(___KCalledFunction___,called_function);\
+    _LIT(___KComment___,comment);\
+    TInt ___comment_max_length___ = 50;\
+    RFileLogger::WriteFormat(___KLogDir___, ___KLogFile___, EFileLoggingModeAppend, ______KSqlComment______, &___KInFunction___, &___KCalledFunction___, error_code, &(___KComment___().Left(___comment_max_length___)));\
+    if(___KComment___().Length()>___comment_max_length___)\
+    {\
+        TPtrC ___continuation___((___KComment___().Mid(___comment_max_length___)));\
+        __LOG_ALL(___continuation___);\
+    }\
+    }
+
+
+// module specific defines 
+
+/** Logs sql Command
+*/
+#define __LOG_SQL_COMMAND(in_function,called_function,error_code,command) \
+    {\
+    _LIT(___KInFunction___,in_function);\
+    _LIT(___KCalledFunction___,called_function);\
+    if(error_code < 0 )\
+    {\
+        RFileLogger::WriteFormat(___KLogDir___, ___KLogFile___, EFileLoggingModeAppend, ______KSqlComment______, &___KInFunction___, &___KCalledFunction___, error_code, &KSqlComment);\
+        __LOG_ALL(command);\
+    }\
+    else\
+    {\
+        RFileLogger::WriteFormat(___KLogDir___, ___KLogFile___, EFileLoggingModeAppend, ___KInfoFormatString___, &___KInFunction___, &___KCalledFunction___, error_code, &KSqlComment);\
+        __LOG_ALL(command);\
+    }\
+    }
+
+
+#else
+/****************************** LOGGING OFF **********************************/
+
+#define __LOG_OPEN()
+#define __LOG_STRING(string)
+#define __LOG_ALL(longstring)
+#define __LOG(in_function,called_function,error_code,comment)
+#define __LOG_INFO(in_function,called_function,error_code,comment)
+#define __LOG_ERROR(in_function,called_function,error_code,comment)
+#define __LOG_OPEN_FILE(file, string)
+#define __LOG_TO_FILE(file,in_function,called_function,error_code,comment)
+#define __LOG_INFO_TO_FILE(file,in_function,called_function,error_code,comment)
+#define __LOG_ERROR_TO_FILE(file,in_function,called_function,error_code,comment)
+
+// module specific defines defines 
+/** Logs sql Command
+*/
+#define __LOG_SQL_COMMAND(in_function,called_function,error_code,command)
+
+#endif // _DEBUG
+
+#endif // C_CUPNPCONTENTDIRECTORYDB_DEBUG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectoryeventobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File transfer event observer
+*
+*/
+
+
+
+
+#ifndef C_CUPNPCONTENTDIRECTORYEVENTOBSERVER_H
+#define C_CUPNPCONTENTDIRECTORYEVENTOBSERVER_H
+
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class CUpnpFileTransferEvent;
+
+// CLASS DECLARATION
+
+/** 
+  File transfer event observer
+  */
+class MUpnpContentDirectoryEventObserver 
+    {
+public:
+    virtual void FileTransferEvent(CUpnpFileTransferEvent *aMessage) = 0;   
+    
+    };
+
+
+#endif // C_CUPNPCONTENTDIRECTORYEVENTOBSERVER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectoryglobals.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,404 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Database for MediaServer
+*
+*/
+
+#ifndef C_UPNPCONTENTDIRECTORYDBGLOBALS_H
+#define C_UPNPCONTENTDIRECTORYDBGLOBALS_H
+#include <platform_paths.hrh>
+#include <bldvariant.hrh>
+// CONSTANTS
+
+// integers
+const TInt KMaxIntegerLen               = 10;
+const TInt KMaxIDResLength              = 18;
+const TInt KMaxLongIntegerLen           = 20;
+const TInt KMaxBoolLen                  = 1;
+const TInt KColNameMaxLenth             = 10;
+const TInt KDefaultGranularity          = 5;
+const TInt KRespBufGranularity          = 128;
+const TInt KMinDiskSpace                = 10000;
+const TInt KDownloadContId              = 1;
+const TInt KAvailableNestedLevels       = 23;
+const TInt KMaxUpnpLongStringLen        = 1024;
+const TInt KMaxUpnpStringLen            = 255;
+const TInt KCommitEveryNum              = 200;
+const TInt KOnlyOnePair                 = 2;
+const TInt KExtensionLength             = 10;
+const TInt KThumbnailWidth              = 40; 
+const TInt KThumbnailHeight             = 30;
+const TInt KDefaultThumbnailSize        = 5120; // 5 kb
+const TInt KHttpGetStarted              = 800;  
+const TInt KHttpPostStarted             = 801;  
+const TInt KThumbnailDirLen             = 10;
+const TInt KCompactWeight               = 10000; // specify how often 
+const TInt KDeleteWeight                = 5;   // Compact function is called.
+const TInt KExecuteWeight               = 1;   
+const TInt KCharSize                    = 2;                                                  
+const TInt KAutoDestroyTimeLimit        = 35000000;
+const TInt KMapKeyMaxLength             = 32;
+const TInt KRandomMax                   = 8999;
+const TInt KRandomMin                   = 1000;
+const TInt KRandomRangeLength           = 4;
+const TInt KMaxSlashAmount              = 4;
+const TInt KCharLen						= 1;   
+
+// files
+_LIT(  KObjectsXmlFileName,             "z:objects.xml"                     );
+_LIT(  KDefaultMediaDrive,              "C:"                                );
+_LIT(  KMediaPath,                      "Media"                             );
+_LIT(  KDownloadPath,                   "Download"                          );
+_LIT8( KMediaPath8,                     "Media"                             );
+_LIT(  KThumbnailPath,                  "Thumbnail"                         );
+_LIT(  KSearchThumbnailPathPattern,     "/Thumbnail/"                       );
+_LIT(  KMediaThumbnailPath,             "Media/Thumbnail"                   );
+_LIT(  KMainDir,                        "\\"                                );
+_LIT(  KDiskPathElSep,                  "\\"                                );
+_LIT(  KSlash,                          "/"                                 );
+_LIT(  KDefaultThumbExtension,          ".jpeg"                             );
+_LIT(  KThumbDirectory11,               "Thumbnail\\"                       );
+_LIT8( KThumbMimeType,                  "image/jpeg"                        );
+_LIT(  KDefaultUploadDir,               "data\\Download\\Media\\"			);
+_LIT(  KThumbnailSubDir,                "thumbnail\\"                       );
+
+
+// common strings
+_LIT(  KSemicolon,                      ";"                                 );
+_LIT8( KSemicolon8,                     ";"                                 );
+_LIT(  KCol,                            ":"                                 );
+_LIT(  KCommaStr,                       ","                                 );
+_LIT8( KCommaStr8,                      ","                                 );
+_LIT(  KFalseString,                    "false"                             );
+_LIT8( KFalseString8,                   "false"                             );
+_LIT(  KFalseValue,                     "0"                                 );
+_LIT8( KFalseValue8,                    "0"                                 );
+_LIT(  KAsterisk,                       "*"                                 );
+_LIT8( KAsterisk8,                      "*"                                 );
+_LIT(  KAtStr,                          "@"                                 );
+_LIT8( KAtStr8,                         "@"                                 );
+_LIT8( KHash8,                          "#"                                 );
+_LIT8( KHashASCII8,                     "%23"                               );
+_LIT(  KMinusOne,                       "-1"                                );
+_LIT8( KMinusOne8,                      "-1"                                );
+_LIT(  KDot,                            "."                                 );
+_LIT8( KDot8,                           "."                                 );
+_LIT(  KPathSeparator,                  "."                                 );
+_LIT8( KPathSeparator8,                 "."                                 );
+_LIT(  KQuot,                           "'"                                 );
+_LIT(  KUndersc,                        "_"                                 );
+ 
+_LIT(  KTrueString,                     "true"                              );
+_LIT8( KTrueString8,                    "true"                              );
+_LIT(  KTrueValue,                      "1"                                 );
+_LIT8( KTrueValue8,                     "1"                                 );
+_LIT(  KNullString,                     ""                                  );
+_LIT(  KSpc,                            " "                                 );
+
+// 8bit strings
+_LIT8( KNewLine,                        "\r\n"                              );
+_LIT8( KLF8,                            "\n"                                );
+_LIT8( KTwoSpaces,                      "  "                                );
+_LIT8( KNullString8,                    ""                                  );
+
+// anyContainer support
+_LIT8( KAnyContainerIndicator8,         "DLNA.ORG_AnyContainer"             );
+_LIT(  KAnyContainerIndicator,          "DLNA.ORG_AnyContainer"             );
+const TInt KAnyContainerId              = 1;
+
+// forbidden paths
+_LIT8( KForbiddenDrivez,                "z"                                 );
+_LIT8( KForbiddenDriveZ,                "Z"                                 );
+_LIT8( KForbiddenPrivatePattern,        "/?/private*"                       );
+
+
+// Database structures' names
+// object table
+_LIT(  KObjectTableName,                "object"                            );
+_LIT8( KObjectTableName8,               "object"                            );
+_LIT(  KObjIdColName,                   "id"                                );
+_LIT(  KObjParentIdColName,             "parentID"                          );
+_LIT(  KObjTiltleColName,               "title"                             );
+_LIT8( KObjTiltleColName8,              "title"                             );
+_LIT(  KObjClassColName,                "class"                             );
+_LIT8( KObjClassColName8,               "class"                             );
+_LIT(  KObjRestrictedColName,           "restricted"                        );
+_LIT(  KObjSearchableColName,           "searchable"                        );
+_LIT(  KObjRefIdColName,                "refID"                             );
+_LIT(  KObjPathColName,                 "path"                              );
+_LIT(  KObjIdIndexName,                 "obj_id_index"                      );
+_LIT(  KRefIdIndexName,                 "ref_id_index"                      );
+// element table
+_LIT(  KElementTableName,               "element"                           );
+_LIT8( KElementTableName8,              "element"                           );
+_LIT(  KElmIdColName,                   "elm_id"                            );
+_LIT(  KElmNameColName,                 "elm_name"                          );
+_LIT(  KElmHasAttrColName,              "elm_has_attribute"                 );
+_LIT(  KElmObjIdColName,                "elm_obj_id"                        );
+_LIT(  KElmValueColName,                "elm_value"                         );
+_LIT(  KElmIsRequiredColName,           "elm_is_required"                   );
+_LIT(  KElmIdIndexName,                 "elm_id_index"                      );
+_LIT(  KElmObjIdIndexName,              "elm_obj_id_index"                  );
+// attributes table 
+_LIT(  KAttributeTableName,             "attribute"                         );
+_LIT8( KAttributeTableName8,            "attribute"                         );
+_LIT(  KAtrIdColName,                   "atr_id"                            );
+_LIT(  KAtrNameColName,                 "atr_name"                          );
+_LIT(  KAtrElmIdColName,                "atr_elm_id"                        );
+_LIT(  KAtrObjIdColName,                "atr_elm_id"                        );
+_LIT(  KAtrValueColName,                "atr_value"                         );
+_LIT(  KAtrIsRequiredColName,           "atr_is_required"                   );
+_LIT(  KAtrIdIndexName,                 "atr_id_index"                      );
+_LIT(  KAtrElmIdIndexName,              "atr_elm_id_index"                  );
+_LIT(  KAtrIdObjColName,                "atr_id_obj"                        );
+// resources table
+_LIT(  KResourcesTableName,             "resources"                         );
+_LIT(  KRscIdColName,                   "rsc_id"                            );
+_LIT(  KRscPathColName,                 "rsc_path"                          );
+_LIT(  KRscReadonlyColName,             "rsc_readonly"                      );
+_LIT(  KRscThumbnailColName,            "rsc_thumbnail"                     );
+_LIT(  KRscIdObjIndexName,              "rsc_id_obj_index"                  );
+_LIT(  KRscIdIndexName,                 "rsc_id_index"                      );
+_LIT(  KRscIdObjColName,                "rsc_id_obj"                        );
+// sequences table
+_LIT(  KSequencesTableName,             "sequences"                         );
+_LIT(  KSeqColNameColName,              "seq_col_name"                      );
+_LIT(  KSeqNextKeyColName,              "seq_next_key"                      );
+_LIT(  KSeqColNameIndexName,            "seq_col_name_index"                );
+// importUri sequence
+_LIT(  KImportUriId,                    "uriId"                             );
+_LIT8( KImportUriId8,                   "uriId"                             );
+// database name
+_LIT(  KDatabaseFileName,               "c:AVMediaServerStore"              );
+
+// upnp 
+_LIT8( KContainerClass8,                "object.container"                  );
+_LIT(  KItemClass,                      "object.item"                       );
+_LIT8( KClassTagName,                   "class"                             );
+_LIT8( KTitleTagName,                   "title"                             );
+_LIT(  KClassTagNameWithNs,             "upnp:class"                        );
+_LIT8( KClassTagNameWithNs8,            "upnp:class"                        );
+_LIT(  KTitleTagNameWithNs,             "dc:title"                          );
+_LIT8( KTitleTagNameWithNs8,            "dc:title"                          );
+_LIT(  KResStr,                         "res"                               );
+_LIT8( KMimeBegin,                      "&quot;http-get:*:"                 );
+_LIT8( KMimeEnd,                        ":*&quot;"                          );
+_LIT8( KItemTypeImage,                  "imageItem"                         );
+_LIT8( KItemTypeAudio,                  "audioItem"                         );
+_LIT8( KItemTypeVideo,                  "videoItem"                         );
+_LIT8( KHTTPHeader,                     "http://"                           );
+_LIT8( KDrmMatchString,                 "<xmrcc:*/*>*"                      );
+_LIT8( KRequiredAtrName,                "el_required"                       );
+_LIT8( KRequiredAtrSuf,                 "_req"                              );
+_LIT8( KRequiredAtrSufPattern,          "*_req"                             );
+_LIT8( KProtInfoReqAtrSufPattern,       "protocolInfo_req"                  );
+_LIT8( KIpPortPlaceholder8,             "___.___.___.___:_____"             );
+_LIT(  KIpPortPlaceholder,              "___.___.___.___:_____"             );
+_LIT8( KTitle,                          "title"                             );
+_LIT8( KProInfoBegin,                   "http-get:*:"                       );
+_LIT8( KProInfoEnd,                     ":*"                                );
+_LIT8( KCompleted,                      "COMPLETED"                         );
+_LIT8( KError,                          "ERROR"                             );
+_LIT8( KInProgress,                     "IN_PROGRESS"                       );
+_LIT8( KStopped,                        "STOPPED"                           );
+_LIT8( KBrowseChilds,                   "BrowseDirectChildren"              );
+_LIT8( KBrowseFlag,                     "BrowseFlag"                        );
+_LIT8( KBrowseMeta,                     "BrowseMetadata"                    );
+_LIT8( KContainerID,                    "ContainerID"                       );
+_LIT8( KChildCount,                     "childCount"                        );
+_LIT(  KChildCount16,                   "childCount"                        );
+_LIT8( KContainer,                      "container"                         );
+_LIT8( KContainerUpdateIDs,             "ContainerUpdateIDs"                );
+_LIT8( KCurrentTagValue,                "CurrentTagValue"                   );
+_LIT8( KDcNsPrefix,                     "dc"                                );
+_LIT8( KDestinationURI,                 "DestinationURI"                    );
+_LIT8( KDidlEnd,                        "</DIDL-Lite>"                      );
+_LIT8( KXmlnsNsUri,                     "urn:schemas-upnp-org:"
+                                        "metadata-1-0/DIDL-Lite/"           );
+_LIT8( KCmlnsNsPref,                    "xmlns"                             );
+_LIT8( KDcNsUri,                        "http://purl.org/dc/elements/1.1/"  );
+_LIT8( KDcNsPref,                       "dc"                                );
+_LIT8( KUpnpNsUri,                      "urn:schemas-upnp-org:"
+                                        "metadata-1-0/upnp/"                );
+_LIT8( KUpnpNsPref,                     "upnp");
+_LIT8( KDidlTag,                        "<DIDL-Lite xmlns=\"urn:schemas-upnp"
+                                        "-org:metadata-1-0/DIDL-Lite/\" "
+                                        "xmlns:dc=\"http://purl.org/dc/"
+                                        "elements/1.1/\" xmlns:upnp=\"urn:"
+                                        "schemas-upnp-org:metadata-1-0/upnp"
+                                        "/\" xmlns:dlna=\"urn:schemas-dlna-"
+                                        "org:metadata-1-0\">");
+_LIT8( KElements,                       "Elements"                          );
+_LIT8( KFilter,                         "Filter"                            );
+_LIT8( KId,                             "Id"                                );
+_LIT8( KIdAttrName,                     "id"                                );
+_LIT(  KimportUri,                      "importUri"                         );
+_LIT8( KImportUri8,                     "importUri"                         );
+_LIT8( KItem,                           "item"                              );
+_LIT8( KNumberReturned,                 "NumberReturned"                    );
+_LIT8( KNewID,                          "NewID"                             );
+_LIT8( KNewTagValue,                    "NewTagValue"                       );
+_LIT8( KParentID,                       "parentID"                          );
+_LIT8( KRefID,                          "refID"                             );
+_LIT8( KRequestedCount,                 "RequestedCount"                    );
+_LIT8( KResourceURI,                    "ResourceURI"                       );
+_LIT8( KRestricted,                     "restricted"                        );
+_LIT8( KResult,                         "Result"                            );
+_LIT8( KCreator8,                       "dc:creator"                        );
+_LIT8( KDate8,                       "date"                        );
+_LIT8( KDuration8,                       "duration"                        );
+_LIT8( KSearchCaps,                     "SearchCaps"                        );
+_LIT8( KSearchCapabilities,             "");
+
+_LIT8( KSearchCapsVariableName,         "SearchCapabilities"                ); 
+
+_LIT8( KSearchClassTag,                 "<upnp:searchClass>"                );
+_LIT8( KSearchClassTagEnd,              "</upnp:searchClass>"               );
+_LIT8( KSize,                           "size"                              );
+_LIT8( KStartingIndex,                  "StartingIndex"                     );
+_LIT8( KSortCaps,                       "SortCaps"                          );
+_LIT8( KSortCapsVariableName,           "SortCapabilities"                  );
+_LIT8( KSortCapabilities,               ""                                  );
+_LIT8( KSortCriteria,                   "SortCriteria"                      );
+_LIT8( KSourceURI,                      "SourceURI"                         );
+_LIT8( KSystemUpdateID,                 "SystemUpdateID"                    );
+_LIT8( KTransferID,                     "TransferID"                        );
+_LIT8( KTransferIDs,                    "TransferIDs"                       );
+_LIT8( KTransferStatus,                 "TransferStatus"                    );
+_LIT8( KTransferLength,                 "TransferLength"                    );
+_LIT8( KTransferTotal,                  "TransferTotal"                     );
+_LIT8( KTotalMatches,                   "TotalMatches"                      );
+_LIT8( KUpnpNsPrefix,                   "upnp"                              );
+_LIT8( KUpdateID,                       "UpdateID"                          );
+_LIT8( KHttpTag,                        "http://"                           );
+_LIT(  KHttpTag16,                      "http://"                           );
+_LIT8( KprotocolInfo,                   "protocolInfo"                      );
+_LIT(  KProtocolInfo,                   "protocolInfo"                      );
+_LIT8( KDlnaPrefix,                     "dlna"                              );
+_LIT8( KDlnaProfileID,                  "dlna:profileID"                    );
+_LIT8( KProfileID,                      "profileID"                         );
+_LIT8( KDefaultProfileID,               "JPEG_TN"                           );
+_LIT8( KAlbumArtURI,                    "upnp:albumArtURI"                  );
+_LIT8( KXmlnsDlna,                      "urn:schemas-dlna-org:metadata-1-0/");
+_LIT8( KEmptyProtocolInfoVal8,          "http-get:*:*:*"                    );
+_LIT8( KRootNode,                       "<DIDL-Lite xmlns:dc=\"http://purl."
+                                        "org/dc/elements/1.1/\" xmlns:upnp="
+                                        "\"urn:schemas-upnp-org:metadata-1-"
+                                        "0/upnp/\" xmlns=\"urn:schemas-upnp"
+                                        "-org:metadata-1-0/DIDL-Lite/\">"   );
+_LIT8( KSearchable,                     "searchable"                        );
+_LIT8( KUpdateIds,                      "0,0"                               );
+_LIT8( KBrowse,                         "Browse"                            );
+_LIT8( KCreateReference,                "CreateReference"                   );
+_LIT8( KCreateObject,                   "CreateObject"                      );
+_LIT8( KDeleteResource,                 "DeleteResource"                    );
+_LIT8( KDestroyObject,                  "DestroyObject"                     );
+_LIT8( KExportResource,                 "ExportResource"                    );
+_LIT8( KGetSearchCapabilities,          "GetSearchCapabilities"             );
+_LIT8( KGetSortCapabilities,            "GetSortCapabilities"               );
+_LIT8( KGetSystemUpdateID,              "GetSystemUpdateID"                 ); 
+_LIT8( KGetTransferProgress,            "GetTransferProgress"               );
+_LIT8( KImportResource,                 "ImportResource"                    );
+_LIT8( KSearch,                         "Search"                            );
+_LIT8( KStopTransferResource,           "StopTransferResource"              );
+_LIT8( KMetadata,                       "urn:schemas-upnp-org:metadata"
+                                        "-1-0/upnp/"                        );
+_LIT8( KXmlNsDc,                        "xmlns:dc=\"http://purl.org/dc"
+                                        "/elements/1.1/\""                  );
+_LIT8( KType,                           "type"                              ); 
+_LIT8( KElement,                        "e"                                 );
+_LIT8( KClass,                          "class"                             );
+_LIT8( KImportUri,                      "importUri"                         );
+_LIT(  KImportUri16,                    "importUri"                         );
+_LIT8( KCharR,                          "r"                                 ); 
+_LIT8( KIParent,                        "i"                                 );
+_LIT8( KProperties,                     "ps"                                );
+_LIT8( KName,                           "n"                                 );
+_LIT8( KAttribute,                      "Attribute"                         );
+_LIT8( KResAttr,                        "res"                               );
+_LIT8( KMultiple,                       "m"                                 );
+_LIT8( KRes,                            "res"                               );
+_LIT(  KRes16,                          "res"                               );
+_LIT8( KNestAttr,                       "a"                                 );
+_LIT8( KObject,                         "object"                            );
+_LIT8( KDidlLite,                       "DIDL-Lite"                         );
+_LIT8( KTrue,                           "true"                              );
+_LIT8( KObjectProperty,                 "p"                                 );
+_LIT8( KObjectName,                     "n"                                 );
+_LIT8( KRequiredObject,                 "r"                                 );
+_LIT8( KMultiValueObject,               "m"                                 );
+_LIT8( KVendorDescriptor,               "desc"                              );
+_LIT8( KColon8,                         ":"                                 );
+_LIT8( KArtist,                         "artist"                            );
+_LIT8( KAlbum,                          "album"                             );
+_LIT8( KImageMime,                      "image"                             );
+_LIT8( KTextMime,                       "text"                              );
+_LIT8( KVideoMime,                      "video"                             );
+_LIT8( KAudioMime,                      "audio"                             );
+_LIT8( KObjectClassAudioItem,           "object.item.audioItem"             );
+_LIT8( KObjectClassVideoItem,           "object.item.videoItem"             );  
+_LIT8( KObjectClassTextItem,            "object.item.textItem"              );    
+_LIT8( KObjectClassImageItem,           "object.item.imageItem"             );      
+_LIT8( KJpegLrg,                        "JPEG_LRG"                          );
+_LIT8( KJpegMed,                        "JPEG_MED"                          );
+_LIT8( KJpegSm,                         "JPEG_SM"                           );
+
+// SQL Strings
+_LIT(  KDeleteFromSqlCmd,               "DELETE FROM %S WHERE %S=%S"        );
+_LIT(  KOpenParant,                     "("                                 );
+_LIT(  KValuesOpen,                     " VALUES("                          );
+_LIT(  KCloseParant,                    ")"                                 );
+_LIT(  KInsertInto,                     "INSERT INTO "                      );
+_LIT(  KOnlyRequiredFromElement,        " AND elm_is_required=1"            );
+_LIT(  KNamedElFromElement,             " AND elm_name='%S'"                );
+_LIT(  KSelectFromObjectSqlCmd,         "SELECT %S FROM object WHERE id=%d" );
+_LIT(  KOnlyRequiredFromAtr,            " AND atr_is_required=1"            );
+_LIT(  KNamedAtrFromAttribute,          " AND atr_name='%S'"                );
+_LIT(  KFullPathFromShareMap,           " OR %S='%S'"                       );
+_LIT(  KSelectFromSqlCmd,               "SELECT %S FROM %S WHERE %S='%S'"   );
+_LIT(  KSelectFromNumSqlCmd,            "SELECT %S FROM %S WHERE %S=%d"     );
+_LIT(  KSelectFromNumNotEqSqlCmd,       "SELECT %S FROM %S WHERE %S<>%d"    );
+_LIT(  KAndConditionSqlCmd,             " AND %S='%S'"                      );
+_LIT(  KAndLikeConditionSqlCmd,         " AND %S LIKE '*%S'"               );
+_LIT(  KSelectAttributeByValueSqlCmd,   "SELECT * FROM attribute WHERE atr_value LIKE '*%S*' AND atr_name = '%S' ");
+_LIT(  KNewMediaDirSqlCmd,              "UPDATE resources SET rsc_readonly=1 WHERE rsc_path LIKE '%S*' AND rsc_readonly=0");
+_LIT(  KInsertElementSqlCmd,            "INSERT INTO element (elm_id,elm_name,elm_value,elm_has_attribute,elm_obj_id,elm_is_required)VALUES(%d,'%S','%S',%d,%d,%d)");
+_LIT(  KInsertAttributeSqlCmd,          "INSERT INTO attribute(atr_id,atr_name,atr_value,atr_elm_id,atr_is_required) VALUES(%d,'%S','%S',%d,%d)");
+_LIT(  KGetObjectListSqlCmd,            "SELECT id FROM object WHERE parentID=%d");
+_LIT(  KGetItemListSqlCmd,              "SELECT id FROM object WHERE parentID=%d AND class LIKE 'object.item*'");
+_LIT(  KGetContainerListSqlCmd,         "SELECT id FROM object WHERE parentID=%d AND class LIKE 'object.container*'");
+_LIT(  KSelectIdFromElSqlCmd,           "SELECT elm_id, elm_name, elm_value FROM element WHERE elm_obj_id=%d" );
+_LIT(  KDeleteResElSqlCmd,              "DELETE FROM element WHERE elm_value='%S' AND elm_obj_id=%d");
+_LIT(  KSelectObjectFromObjSqlCmd,      "SELECT id, parentID, title, class, restricted, searchable, refID FROM object WHERE id = %d");
+_LIT(  KSelectElmFromElmSqlCmd,         "SELECT elm_name, elm_value, elm_has_attribute, elm_id, elm_is_required FROM element WHERE elm_obj_id = %d");
+_LIT(  KSelectAtrFromAttrSqlCmd,        "SELECT atr_name, atr_value FROM attribute WHERE atr_elm_id = %d");
+_LIT(  KSelectAtrFromAttrByObjSqlCmd,   "SELECT atr_name, atr_value, atr_elm_id FROM attribute WHERE atr_id_obj = %d");
+
+// initial data
+_LIT(  KInit1,                          "INSERT INTO object (id,parentID,title,class,restricted,searchable,path) VALUES(0,-1,'root','object.container',0,1,'-1')");
+_LIT(  KInit2,                          "INSERT INTO object (id,parentID,title,class,restricted,searchable,path) VALUES(1,0,'Uploaded','object.container',0,1,'-1.0')");
+_LIT(  KInit3,                          "INSERT INTO sequences(seq_col_name,seq_next_key) VALUES('object',2)" );
+_LIT(  KInit4,                          "INSERT INTO sequences(seq_col_name,seq_next_key) VALUES('element',0)");
+_LIT(  KInit5,                          "INSERT INTO sequences(seq_col_name,seq_next_key) VALUES('attribute',0)");
+_LIT(  KInit6,                          "INSERT INTO sequences(seq_col_name,seq_next_key) VALUES('uriId',1)"  );
+
+
+enum TCurrentAction 
+{
+    EUndefinedAction = 0,
+    ECreateObjectAction = 1,
+};
+
+#endif //C_UPNPCONTENTDIRECTORYDBGLOBALS_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpcontentdirectoryservice.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,331 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Directory factory class
+*
+*/
+
+
+#ifndef UPNPCONTENTDIRECTORYSERVICE_H
+#define UPNPCONTENTDIRECTORYSERVICE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <upnpobject.h>
+#include "upnpcdsettings.h"
+#include <in_sock.h>
+
+// FORWARD DECLARATION
+class CUpnpService;
+class MUpnpThumbnailCreatorObserver;
+class CUpnpContentDirectory;
+class CUpnpItem;
+class CUpnpItemList;
+class CUpnpContainerList;
+class CUpnpBrowseCriteria;
+class CUpnpContainer;
+class CUpnpMetadataStorage;
+class CUpnpLocalStorage;
+class MUpnpContentDirectoryEventObserver;
+class TUpnpCdSettings;
+class MUpnpTransfer;
+class CUpnpCdsSender;
+class CUpnpTransferHandler;
+
+/**
+*  Content Directory factory class.
+*  
+*
+*  @lib ?library
+*  @since Series60 3.1
+*/
+class CUpnpContentDirectoryService : public CBase
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor for creating Content Directory Service (CDS).
+    * @since Series60 3.1
+    * @param aService Parent service 
+    */
+    IMPORT_C static CUpnpContentDirectoryService* NewL( TUpnpCdSettings aSettings );
+
+    /**
+    * Two-phased constructor for creating Content Directory Service (CDS).
+    * @since Series60 3.1
+    * @param aService Parent service 
+    */
+    IMPORT_C static CUpnpContentDirectoryService* NewLC( TUpnpCdSettings aSettings );
+        
+    /**
+    * Two-phased constructor for offline mode.
+    * @since Series60 3.1
+    */
+    IMPORT_C static CUpnpContentDirectoryService* NewL();
+
+    /**
+    * Two-phased constructor for offline mode.
+    * @since Series60 3.1
+    */
+    IMPORT_C static CUpnpContentDirectoryService* NewLC();
+        
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpContentDirectoryService();
+
+public: // New functions
+        
+    /**
+    * Sets download directory
+    * @since Series S60 3.1
+    * @param aDownloadDir this directory is going to be set as download directory
+    * @return KerrNone is return if OK
+    */
+    IMPORT_C void SetDownloadDirectoryL(const TDesC& aDownloadDir);
+           
+    /**
+    * Sets thumbnail directory
+    * @since Series S60 3.1
+    * @param aDownloadDir this directory is going to be set as thumbnail directory
+    * @return KerrNone is return if OK
+    */
+    IMPORT_C void SetThumbnailDirectoryL(const TDesC& aDownloadDir);
+    
+    /**
+    * Gets local inet address 
+    *
+    * @since Series S60 3.1
+    * @return address
+    */
+    IMPORT_C TInetAddr GetAddress();    
+    
+    /**
+    * Gets pointer to CUpnpContentDirectory 
+    *
+    * @since Series S60 3.1
+    * @return pointer to CUpnpContentDirectory 
+    */
+    IMPORT_C CUpnpContentDirectory* GetContentDirectory();
+    
+    /**
+    * Handles address change event    
+    * used only by media server engine
+    */
+    IMPORT_C void AddressChangeL();
+
+
+public: // Metadata API 
+    /**    
+    * Shares a single object item/container.
+    * After creation input object is updated with:
+    * - iId - generated object identifier
+    * - "res" element value - in offline sharing there is no possible to set ip:port 
+    *    information in URL. "Res" value example: http:///00000001/filename. 
+    *
+    * @since S60 3.1
+    * @param aObject object to be shared.
+    */            
+    IMPORT_C void ShareObjectL( CUpnpObject* aObject );
+    
+	/**    
+    * Creates a single 'reference object' upon given refId
+    * 
+    * @since S60 5.0 HN
+    * @param aItem reference object to be created
+    */            
+	IMPORT_C void ShareReferenceL( CUpnpItem* aItem );
+
+	/**
+    * Creates some reference items, located at specific container, pointing onto specific objects
+    *
+    * @since S60 5.0 HN
+    * @param aItemList 'reference item' list which are to be shared
+    * @param aExecutionStatus reference pointing to the index of item list
+    */
+	IMPORT_C void ShareReferenceListL( CUpnpItemList* aItemList, 
+                                  TInt* aExecutionStatus );
+
+    /**
+    * Unshares existing item from the Media Server.
+    * Item with specified id is removed from database regardless "restricted" property value.           
+    *
+    * @since S60 3.1
+    * @param aItemId item which is unshared
+    */
+    IMPORT_C void UnshareItemL( TInt aItemId );
+        
+    /**
+    * Unshares existing container from the Media Server.
+    * Container with its whole branch is removed from database regardless "restricted" 
+    * property value for this container and any object in branch.
+    * Object removing is a bottom-up process. If removing of particular object fails 
+    * whole operation is broken and error is returned.     
+    *
+    * Note: The iId value is not verified whether it points to a container or item. 
+    * Therefore, clients must not use UnshareContainer method with ids pointing to an 
+    * item or other way round. 
+    *	
+    * @since S60 3.1
+    * @param aContainerId container which is unshared
+    */
+    IMPORT_C void UnshareContainerL( TInt aContainerId );    
+    
+    /**
+    * Gets shared item information from MediaServer. 
+    * This operation returns all properties. Browse criteria is not used.
+    * Information is returned to item reference.
+    *
+    * @since S60 3.1
+    * @param aItemId item id
+    * @return aItem item
+    */
+    IMPORT_C CUpnpItem* GetSharedItemL( TInt aItemId );    
+    
+    /**
+    * Shares a list.
+    * Database transaction is committed each 11 objects created into database. 
+    * This empirical value is hard coded in current implementation. 
+    * If an execution of task fails when creating object (e.g. 776-th item on list) 
+    * error code is retuned (aExecStatus), which points to last successfully created item index [1...total count] 
+    * (e.g. aExecutionStatus = 770 last item in database is object number 770, 
+    * if no object is cretated index = 0, if all are created index = total count).
+    *
+    * For each created item respective input object is updated with:
+    * - iId
+    * - "res" element value
+    *
+    * @since S60 3.1
+    * @param aItemList reference to item list which are to be shared.
+    * @param aExecutionStatus reference pointing to the index of item list
+    */
+    IMPORT_C void ShareItemListL( CUpnpItemList* aItemList, 
+                                  TInt* aExecutionStatus );
+
+    /**
+    * Unshares existing items from the MediaServer.
+    * Each Item from list is removed from database regardless "restricted" property value.
+    * Database transaction is committed each 11 objects removed database. 
+    * If an execution of task fails when creating object error code is retuned, 
+    * which points to last successfully removed item index.
+    *
+    * @since S60 3.1
+    * @param aItemList list of items which are to be unshared
+    * @param aExecutionStatus reference pointing to the index of item list    
+    */                                  
+    IMPORT_C void UnshareItemListL( RArray<TInt>& aItemList, 
+                                    TInt* aExecutionStatus);
+                                    
+
+    /**
+    * Gets items information according to supported browse criteria.
+    * Note: There are only two possible values of filter:
+    * -	"" (empty filter) only required properties will be returned
+    * -	"*" (asterisk)  all properties will be returned
+    * Information is returned to container reference.    
+    *
+    * @since S60 3.1
+    * @param aContainerId id of the container of which items are to be returned
+    * @param aBrowseCriteria specifies request details, such as requestCount, startingIndes, filter
+    * @param aItemList reference to item list where information is updated.
+    */                                    
+    IMPORT_C void GetItemListL( TInt aContainerId, 
+                                CUpnpBrowseCriteria* aBrowseCriteria, 
+                                TInt* aTotalMatches, 
+                                CUpnpItemList* aItemList );
+                                
+                                
+    /**
+    * Gets containers information according to supported browse criteria.
+    * Note: There are only two possible values of filter:
+    * -	"" (empty filter) only required properties will be returned
+    * -	"*" (asterisk)  all properties will be returned
+    * Information is returned to container reference. 
+    * Nested containers are not returned.   
+    *
+    * @since S60 3.1
+    * @param aContainerId id of the container of which items are to be returned
+    * @param aBrowseCriteria specifies request details, such as requestCount, startingIndes, filter
+    * @param aContainerList reference to item list where information is updated.
+    * @param aTotalMatches total matches
+    */                              
+    IMPORT_C void GetContainerListL( TInt aContainerId, 
+                                     CUpnpBrowseCriteria* aBrowseCriteria, 
+                                     TInt* aTotalMatches, 
+                                     CUpnpContainerList* aContainerList );
+                                     
+    /**
+    * Gets container information 
+    * Nested container and items are not returned.
+    * This operation returns all properties. Browse criteria is not used.
+    *
+    * @since S60 3.1
+    * @param aContainerId container id
+    * @return container object
+    */                                     
+    IMPORT_C CUpnpContainer* GetSingleContainerL( TInt aContainerId );
+    
+    
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpContentDirectoryService();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL( TUpnpCdSettings aSettings );
+    void ConstructL();
+
+    /**
+    * Database corruption recovery handlers
+    */
+    void HandleDbErrorL( TInt aError ) ;
+
+    /**
+    * Recreates data base
+    */
+    void RecreateDbL( TInt aError ) ;
+
+    /**
+    * Checks if data base is created
+    * if not tries to recover it
+    * if fails leaves
+    */
+    void CheckDbL();
+    
+    /**
+    * Checks if server is in online mode
+    */
+    TBool IsOnlineMode();
+
+private:  
+    //
+    CUpnpContentDirectory*  iCd;                // owned
+    //
+    CUpnpMetadataStorage*   iMetadataStorage;   // owned
+    //
+    CUpnpLocalStorage*      iLocalStorage;      // owned
+    //
+    CUpnpCdsSender*         iSender;            // owned
+        
+    CUpnpTransferHandler*   iTransferHandler;    
+    
+    
+    };
+
+#endif      // UPNPCONTENTDIRECTORYSERVICE_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpelementbean.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,198 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+#ifndef C_CUPNPELEMENTBEAN_H
+#define C_CUPNPELEMENTBEAN_H
+
+//  INCLUDES
+#include "upnptablebean.h"
+#include <e32base.h>
+#include <d32dbms.h>
+
+class CUpnpElement;
+class CUpnpObject;
+class CUri8;
+
+// CLASS DECLARATION
+
+/**
+*  Stores the data of element table row.
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpElementBean: public CUpnpTableBean 
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpElementBean* NewLC();
+
+    /**
+    * Two-phased constructor.
+    * @param aRowSet
+    */
+    static CUpnpElementBean* NewLC(const RDbRowSet& aRowSet);
+    
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpElementBean();
+
+public: // New functions
+    
+        CUpnpElement* AttachElmL(CUpnpObject* aElm);
+    /**
+    * Sets all values of the object value.
+    * @since Series S60 3.0
+    * @param aRowSet
+    */
+    void SetL(const RDbRowSet& aRowSet);
+    
+    /**
+    * Sets iElmId value.
+    * @since Series S60 3.0
+    * @param aElId value of elm_id in the element table
+    */
+    void SetElmId(TInt aElId);
+        
+    /**
+    * Sets iElmName value.
+    * @since Series S60 3.0
+    * @param aElmName value of elm_name in the element table
+    */
+    void SetElmNameL(const TDesC8& aElmName);
+        
+    /**
+    * Sets iElmHasAttribute value.
+    * @since Series S60 3.0
+    * @param aElmHasAttribute value of elm_has_attribute in the element table
+    */
+    void SetElmHasAttribute(TBool aElmHasAttribute);
+        
+    /**
+    * Sets iElmIsRequired value.
+    * @since Series S60 3.0
+    * @param aElmIsRequired value of elm_is_required in the element table
+    */
+    void SetElmIsRequired(TBool aElmIsRequired);
+        
+    /**
+    * Sets iElmValue value.
+    * @since Series S60 3.0
+    * @param aElmValue value of elm_value in the element table
+    */
+    void SetElmValueL(const RDbRowSet& aRowSet, const TInt aColNo);
+		void SetElmValueL(const TDesC8& aVal);
+        
+    /**
+    * Sets iElmObjId value.
+    * @since Series S60 3.0
+    * @param aElmObjId value of elm_obj_id in the element table
+    */
+    void SetElmObjId(TInt aElmObjId);
+        
+    /**
+    * Gets iElmId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmId
+    */
+    TInt ElmId() const;
+        
+    /**
+    * Gets iElmName value.
+    * @since Series S60 3.0
+    * @return Value of iElmName
+    */
+		TDesC8& ElmName() const;
+        
+    /**
+    * Gets iElmHasAttribute value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmHasAttribute
+    */
+    TBool ElmHasAttribute() const;
+        
+    /**
+    * Gets iElmIsRequired value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmIsRequired
+    */
+    TBool ElmIsRequired() const;
+        
+    /**
+    * Gets iElmValue value.
+    * @since Series S60 3.0
+    * @return Value of iElmValue
+    */
+    TDesC8& ElmValue() const;
+        
+    /**
+    * Gets iElmObjId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmObjId
+    */
+    TInt ElmObjId() const;
+        
+    /**
+    * Adds the whole element to the given TXmlEngElement.
+    * @param aElement a element to which the value will be attached
+    * @since Series S60 3.0
+    */
+    TXmlEngElement AttachElmL(TXmlEngElement aElement) const;
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpElementBean();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+    
+    HBufC8* ValAsUriL() const;
+
+private:    // Data
+    // Element Id
+    TInt        iElmId;
+    // Element Name
+    HBufC8*     iElmName;
+    //
+    TBool       iElmHasAttribute;
+    // 
+    TInt        iElmObjId;
+    //
+    TBool       iElmIsRequired;
+    // Element Value
+    HBufC8*     iElmValue;
+};
+
+// inline functions
+#include"upnpelementbean.inl"
+
+#endif      // C_CUPNPELEMENTBEAN_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpelementbean.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,102 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler - inline functions
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::SetElmId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpElementBean::SetElmId(TInt aElId)
+{
+        iElmId = aElId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::SetElmHasAttribute
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpElementBean::SetElmHasAttribute(TBool aElmHasAttribute)
+{
+        iElmHasAttribute = aElmHasAttribute;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::SetElmIsRequired
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpElementBean::SetElmIsRequired(TBool aElmIsRequired)
+{
+        iElmIsRequired = aElmIsRequired;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::SetElmObjId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpElementBean::SetElmObjId(TInt aElmObjId)
+{
+        iElmObjId = aElmObjId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::ElmId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpElementBean::ElmId() const
+{
+        return iElmId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::ElmHasAttribute
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TBool CUpnpElementBean::ElmHasAttribute() const
+{
+        return iElmHasAttribute;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::ElmIsRequired
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TBool CUpnpElementBean::ElmIsRequired() const
+{
+        return iElmIsRequired;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::ElmValue
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TDesC8& CUpnpElementBean::ElmValue() const
+{
+        return *iElmValue;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::ElmObjId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpElementBean::ElmObjId() const
+{
+        return iElmObjId;
+}
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpelementfactory.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,305 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares ElementFactory class.
+*
+*/
+
+
+#ifndef C_CUPNPELEMENTFACTORY_H
+#define C_CUPNPELEMENTFACTORY_H
+
+
+// INCLUDES
+
+#include <xmlengdom.h>
+#include <xmlengdocument.h>
+#include "upnpcontentdirectory.h"
+#include "upnpfiletransfer.h"
+#include "upnperrors.h" // Added by ClassView
+#include "upnpdominterface.h"
+
+// FORWARD DECLARATIONS
+
+class CUpnpElementFactory;
+class TUpnpContainerUpdateId;
+class CUpnpFileTransferTimerObserver;
+class CUpnpObject;
+class CUpnpItem;
+
+
+// FORWARD DECLARATIONS
+
+class CUpnpContentDirectory;
+
+// CLASS DECLARATION
+
+/**
+*  @brief Used to create content objects
+*
+*
+*  @lib contentdirectory.lib
+*  @since Series60 2.6
+*/
+class CUpnpElementFactory : public CBase
+{
+public: // Constructors and destructors
+                         
+    /**
+    * Gets active element from XML document. An active element
+    * is a first element different from <DIDL-Lite> element.
+    * @param aDocument XML document which will be search for active element.
+    * @return handler to active element.
+    */
+    TXmlEngElement ActiveElementL( const RXmlEngDocument& aDocument );
+    
+    /**
+    * Extracts active element from XML document. 
+    * An active element is a first element different from <DIDL-Lite> element.
+    * IMPORTANT: Caller takes responsibility for returned element. 
+    * @param aDocument XML document which will be search for active element.
+    * @return handler to extracted active element.
+    */
+    RXmlEngDocument ExtractActiveElementL( const RXmlEngDocument& aDocument );
+    
+    /**
+    * Checks if two elements are equal and have exactly the same subtrees.
+    * @param aFirst - first element to compare
+    * @param aSecond - second element to compare
+    * @return ETrue if elemants are equal.
+    */
+    TBool ElementsMatchL( TXmlEngElement aFirst, TXmlEngElement aSecond );
+    
+    /**
+    * Counts elements in array that have the same name.
+    * @param aName - name of elements, which will be counted.
+    * @param aArray - array with elements to count.
+    * @return number of found elements.
+    */ 
+    TInt CountElementsL( const TDesC8& aName, RArray<RXmlEngDocument>& aArray );
+    
+    /**
+    * Counts elements in array that have the same name.
+    * @param aName - name of elements, which will be counted.
+    * @param aArray - array with elements to count.
+    * @return number of found elements.
+    */ 
+    TInt CountElementsL( const TDesC8& aName, RArray<TXmlEngElement>& aArray );   
+    
+    /**
+    * Gets classes descriptions for given object.
+    * @param aObject - element representing object, which classes 
+    *   descriptions we wan to acquire
+    * @param aArray - (OUT) reference to array which will be filled with classes
+    *   descriptions. 
+    * @param aObjType - object type [item or container]
+    */
+    void ClassesL( const TXmlEngElement& aObject, RArray<TXmlEngElement>& aArray, const TDesC8& aObjType = KNullDesC8() );
+    
+    /**
+    * Constructs descriptor with element's name and namespace prefix separated with colon.
+    * IMPORTANT: As the function name indicates, it leaves pointer to heap descriptor on 
+    * cleanup stack.
+    * @param aElement - element for which descriptor will be constructed.
+    * @return  - pointer to descriptor, allocated on the heap, containing element's name with prefix.
+    */ 
+    HBufC8* NameWithNsLC( const TXmlEngElement& aElement );
+    
+
+    /**
+    * Two-phased constructor for building CUpnpElementFactory.
+    * @since Series60 2.6
+    */
+    static CUpnpElementFactory* NewL( const TDesC& aObjectsXmlPath );
+
+    /**
+    * Two-phased constructor for building CUpnpElementFactory.
+    * @since Series60 2.6
+    */
+    static CUpnpElementFactory* NewLC( const TDesC& aObjectsXmlPath );
+
+    /**
+    * Destructor function; called automatically from the destructor of a 
+    * derived class
+    */
+    virtual ~CUpnpElementFactory();
+
+    /**
+    * Function to validate a new object given by Control Point, especially 
+    * upnp:class element field eg. object.item.musictrack
+    * IMPORTANT: If objects's description is invalid due to missing elements
+    * it tries to repair it by adding those missing elements.
+    * @since Series60 2.6
+    * @param aElement element (xml) given by Control Point
+    * @param aUpdateItem 
+    * @return Returns a error code that is to be sent to caller of action.
+    */
+    TUpnpErrorCode ValidateNewObjectL( const TXmlEngElement& aNewElement, TBool aNew = ETrue, TBool aLocalSharing = EFalse );
+    
+    /**     
+    * Function gets pointer to CUpnpContentDirectory and puts it into CUpnpElementFactory object 
+    * @param aCD - pointer to CUpnpContentDirectory object
+    */ 
+    void GetContentDirectoryReference(CUpnpContentDirectory* aCD);
+    
+private: // Constructors
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpElementFactory();
+
+    /**
+    * Second phase of the constructor.
+    * By default Symbian 2nd phase constructor is private.
+    * @param service Parent service
+    */
+    void ConstructL(const TDesC& aObjectsXmlPath);
+
+private: // New functions
+    
+    void ValidateBigImageL( TXmlEngElement aObj);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aPattern
+    * @return boolean 
+    */
+    TBool IsRequiredL(TXmlEngElement aPattern);
+    
+    /**
+    * Getter
+    * @since Series S60 3.1
+    * @param aPropertyName
+    * @param aClassList
+    * @return TXmlEngElement
+    */
+    TXmlEngElement GetPatternForResAttrL(const TDesC8& aPropertyName, RArray<TXmlEngElement>& aClassList );
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aElement
+    * @param aClassList
+    */
+    void ValidateResElL( TXmlEngElement aElement, RArray<TXmlEngElement>& aClassList);
+    
+    /**
+    * Validates element
+    * @since Series S60 3.1
+    * @param aElement
+    * @param aClasList
+    */
+    void ValidateElementL(TXmlEngElement aElement, RArray<TXmlEngElement>& aClassList);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aObj
+    * @parma aClassList
+    */
+    void ValidatePropertiesL(TXmlEngElement aObj, RArray<TXmlEngElement>& aClassList);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aObj
+    * @param aClassList
+    */
+    void ValidateMainAttributesL(TXmlEngElement aObj, RArray<TXmlEngElement>& aClassList);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aAttr
+    * @parma aPattern
+    */
+    void ValidateElWithPatternL(TXmlEngElement aAttr, TXmlEngElement aPattern);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aAttr
+    * @param aPattern
+    */
+    void ValidateAttrWithPatternL(TXmlEngAttr aAttr, TXmlEngElement aPattern);
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aPropertyName
+    * @param aClassList
+    * @return TXmlEngElement
+    */
+    TXmlEngElement GetPatternL( const TDesC8& aPropertyName, RArray<TXmlEngElement>& aClassList, const TDesC8& aType );
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aElement
+    * @return boolean
+    */
+    TBool IsClassElement( const TXmlEngElement& aElement );
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aElement
+    * @return boolean
+    */
+    TBool IsNotEmptyImportUriL( const TXmlEngElement& aElement );
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aElement
+    * @return boolean
+    */
+    TBool IsMainObjectTagL(TXmlEngElement aElement);
+
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aProtocolInfo
+    * @param aLocalSharing
+    * @return descriptor pointer
+    */        
+    HBufC8* ValidateProtocolInfoInResL( const TDesC8& aProtocolInfo, TBool aLocalSharing );
+    
+    /**
+    *
+    * @since Series S60 3.1
+    * @param aElement    
+    */
+    void CheckDurationOfResElementL(const TXmlEngElement& aElement);
+    
+    /**
+    *
+    * @since Series S60 3.2
+    * @param aElement    
+    */
+    void CheckSizeOfResElementL(const TXmlEngElement& aElement);
+                    
+private: // Data
+
+    // owned
+    RXmlEngDocument               iDocument;
+    // Pointer to content directory
+    CUpnpContentDirectory*  iContentDirectory;
+    RXmlEngDOMImplementation iDOMImpl;
+};
+
+#endif  // C_CUPNPELEMENTFACTORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnperror.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,55 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Error - this is internal class that converts 
+*                TInt to TUpnpErrorCode it helps to avoid excessive casting                    
+*
+*/
+
+
+
+#ifndef C_TUPNPERROR_H
+#define C_TUPNPERROR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "upnperrors.h"
+
+// CLASS DECLARATION
+
+/**
+*  Convers TInt to TUpnpErrorCode
+*
+*  @lib 
+*  @since Series60 2.6
+*/
+class TUpnpError
+{
+public: 
+    /**
+    * Constructor
+    */
+    TUpnpError(TInt aErrCode);
+        
+    /**
+    * Convertion operator
+    */
+    operator TUpnpErrorCode();
+    
+private: 
+    TUpnpErrorCode iUpnpErrCode;
+};
+
+#endif      // C_TUPNPERROR_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpfiletransfer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,139 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements th upnpfiletransfer class
+*
+*/
+
+
+
+#ifndef C_CUPNPFILETRANSFER_H
+#define C_CUPNPFILETRANSFER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+#include "upnpcons.h"
+#include "upnphttpmessage.h" 
+
+// FORWARD DECLARATIONS
+class CUpnpFileTransferEvent;
+
+
+/**
+*  Storage Struct for file transfer
+*
+*  @lib ContentDirectory
+*  @since Series 60 2.6
+*/
+class CUpnpFileTransfer: public CBase
+{
+public:
+//transfer type
+enum TTransferType
+    {
+    EImport, 
+    EExport,
+    EUpload
+    };
+
+public:
+    // Constructors and destructor
+    
+    /**
+    * Two-phased constructor. returns a pointer to the new element.    
+    */
+    static CUpnpFileTransfer* NewL(TInt aTransferId, TInt aObjectId, TTransferType aType);
+    
+    /**
+    * Two-phased constructor. returns a pointer to the new element.    
+    */
+    static CUpnpFileTransfer* NewLC(TInt aTransferId, TInt aObjectId, TTransferType aType);
+
+    /**
+    * Destructor. Deletes the element from memory. 
+    */
+    virtual ~CUpnpFileTransfer();
+    
+    TTransferStatus TransferState( );
+    
+    void SetTransferState(TTransferStatus aState);
+    
+    TInt ImportNumber();
+    
+    void SetImportNumber(TInt aNum);
+    
+    TInt TransferLength();
+    
+    void SetTransferLength(TInt aLen);
+    
+    TInt TransferTotal();
+    
+    void SetTransferTotal(TInt aTotal);
+    
+    TTransferType TransferType();
+    
+    TInt ObjectId();
+    
+    CUpnpFileTransferEvent* Event();
+    
+    void SetEvent(CUpnpFileTransferEvent* aEvent);
+    
+    CUpnpFileTransferEvent* RemoveEvent();
+    
+    TInt TransferId();
+    
+    
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpFileTransfer(TInt aTransferId, TInt aObjectId, TTransferType aType);
+    
+    void ConstructL();    
+
+public:
+    // Data
+    
+    // Transfer Id
+    TInt         iTransferId;
+
+    // Transfer state
+    TTransferStatus iTransferState;
+    
+    //
+    TBool        iRemove;
+    
+    // used for checking if file transfer is Import (GET)
+    // or Export (POST). iGet is ETrue if transfer was Import
+    TBool        iGet;
+    
+    TTransferType iType;
+    
+    // last number in Import uri to match HTTP 200 OK with Import uri
+    // number
+    TInt         iImportNumber;
+    
+    TInt         iTransferLength;
+    TInt         iTransferTotal;
+    // Object id
+    TInt         iObjectId;
+    
+    CUpnpFileTransferEvent* iEvent;
+    
+};
+
+#endif      // C_CUPNPFILETRANSFER_H   
+        
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpfiletransfertimerobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,104 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements the upnpfiletransfertimerobserver class
+*
+*/
+
+
+
+#ifndef C_CUPNPFILETRANSFERTIMEROBSERVER_H
+#define C_CUPNPFILETRANSFERTIMEROBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "upnpnotifytimer.h"
+
+// FORWARD DECLARATIONS
+class CUpnpContentDirectory;
+class MUpnpContentDirectoryEventObserver;
+class CUpnpFileTransferTimerObserver;
+
+const TInt KFileTransferStorageTime = 30000000;
+
+class MUpnpFileTransferTimerObserver
+    {
+public:
+   /**
+    * Callback for filetransfer timer events
+    * @since Series 60 2.6
+    * @return Error code
+    */
+    virtual void TransferEvent( CUpnpFileTransferTimerObserver* aTimer ) = 0;
+    };
+
+
+/**
+*  This is a observer for timer events. This is needed since CDS allready
+*  is a observer for statevariable events.
+*
+*  @lib ContentDirectory
+*  @since Series 60 2.6
+*/
+class CUpnpFileTransferTimerObserver : public CBase, public MUpnpNotifyTimerObserver
+{
+public: // Constructors and destructors
+
+    /**
+    * Two-phased constructor for creating FiletransferTimerObsever
+    * @since Series60 2.6
+    * @param aService Parent service 
+    */
+    static CUpnpFileTransferTimerObserver* NewLC( MUpnpFileTransferTimerObserver* aCd, TInt aTransferId);
+
+    /**
+    * Two-phased constructor for creating FiletransferTimerObsever
+    * @since Series60 2.6
+    * @param aService Parent service 
+    */
+    //static CUpnpFileTransferTimerObserver* NewLC(CUpnpContentDirectory* aCd);
+
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpFileTransferTimerObserver();
+
+private:
+    /**
+    * C++ default constructor.
+    */
+    CUpnpFileTransferTimerObserver( MUpnpFileTransferTimerObserver* aCd, TInt aTransferId );
+    
+    /**
+    * Second phase of the constructor.
+    * Initialises a DOM tree.
+    * By default Symbian 2nd phase constructor is private.
+    * @param service Parent service
+    */
+    void ConstructL();
+
+public: //from NotifyTimerObserver
+    void TimerEventL( CUpnpNotifyTimer* aTimer );
+    TInt TransferId();
+    
+private: //data
+    // Notify timer, owned
+    MUpnpFileTransferTimerObserver* iCd;
+    CUpnpNotifyTimer*    iEventTimer;
+    TInt iTransferId;
+    
+    };
+
+#endif      // C_CUPNPFILETRANSFERTIMEROBSERVER_H   
+        
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpfilterelement.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,104 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains data for filtering
+*
+*/
+
+
+
+#ifndef C_CUPNPFILTERELEMENT_H
+#define C_CUPNPFILTERELEMENT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+
+/**
+*  Contains data for filtering
+*/
+class CUpnpFilterElement: public CBase
+{
+ public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpFilterElement* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpFilterElement();
+
+ public: // New functions
+    
+    /**
+    * Set the iElementName value.
+    * @since Series S60 3.0
+    * @param aElName the name of the element
+    */
+    void SetElementNameL( const TDesC8& aElName );
+
+    /**
+    * Adds the attribute to the attributes list
+    * @since Series S60 3.0
+    * @param aAttrName the name of the attribute
+    */
+    void AppendAttributeL( const TDesC8& aAttrName );
+
+    /**
+    * Gets the number of attributes in the filter element
+    * @since Series S60 3.0
+    * @return Number of attributes
+    */
+    TInt Count() const;
+
+    /**
+    * Gets element name
+    * @since Series S60 3.0
+    * @return Non modifable pointer descriptor to the name
+    */
+    TPtrC8 ElementName() const;
+
+    /**
+    * Gets the name of the attribute located at the specified position
+    * @since Series S60 3.0
+    * @return Non modifable pointer descriptor to the attribute name
+    */
+    TPtrC8 operator[](TInt aPos) const;
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpFilterElement();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+ private:    // Data
+    //Element name
+    HBufC8*         iElementName;
+    
+    //Array of element's attributes
+    CDesC8ArrayFlat*    iAttributes;
+
+};
+
+#endif      // C_CUPNPFILTERELEMENT_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnplocalstorage.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,115 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Local interface
+*
+*/
+
+
+
+#ifndef UPNPLOCALSTORAGE_H
+#define UPNPLOCALSTORAGE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <upnpobject.h>
+
+// FORWARD DECLARATIONS
+class CUpnpMetadataStorage;
+class CUpnpItem;
+class CUpnpItemList;
+class CUpnpContainerList;
+class CUpnpBrowseCriteria;
+class CUpnpContainer;
+class CUpnpObjectBean;
+class CUpnpElement;
+class CUpnpElementBean;
+class CUpnpAttributeBean;
+class CUpnpAttribute;
+class CUpnpObject;
+class CUpnpContentDirectory;
+class CUpnpStateHandler;
+
+// CLASS DECLARATION
+
+/**
+*  Local interface
+*
+*  @lib avcontentdirectory.lib
+*  @since Series 60 3.0
+*/
+class CUpnpLocalStorage : public CBase
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpLocalStorage* NewL(CUpnpMetadataStorage* aMetadataStorage);
+    static CUpnpLocalStorage* NewLC(CUpnpMetadataStorage* aMetadataStorage);
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpLocalStorage();
+
+public: // New functions
+    
+		void ShareObjectL(CUpnpObject* aItem);
+		void ShareReferenceL( CUpnpItem* aItem );
+		void ShareReferenceListL( CUpnpItemList* aItemList, TInt* aExecutionStatus );
+		void UnshareItemL(TInt aItemId);
+		void UnshareContainerL(TInt aItemId);
+		CUpnpItem* GetSharedItemL(TInt aItemId);
+		void ShareItemListL(CUpnpItemList* aItemList, TInt* aExecutionStatus);
+		void UnshareItemListL(RArray<TInt>& aItemList, TInt* aExecutionStatus);
+		void GetItemListL(TInt aContainerId, CUpnpBrowseCriteria* aBrowseCriteria, TInt* aTotalMatches, CUpnpItemList* aItemList);
+		void GetContainerListL(TInt aContainerId, CUpnpBrowseCriteria* aBrowseCriteria, TInt* aTotalMatches, CUpnpContainerList* aList);
+		void SetStateHandler(CUpnpStateHandler* aStateHandler);
+		CUpnpContainer* GetSingleContainerL(TInt aContainerId);
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CUpnpLocalStorage(CUpnpMetadataStorage* aMetadataStorage);
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        void AddAttributesL( TInt aElmId, CUpnpElement* aElm );
+        void AddElementsL( TInt aObjectID, CUpnpObject* aObj );
+        void GetObjectL(TInt aObjId, CUpnpObject* aObj, TBool aAll = ETrue);
+        void HandleResourcesL(CUpnpObject* aItem);
+		void DoShareObjectL(TInt aContainer, CUpnpObject* aItem);
+		void DoShareReferenceL( TInt aContainerId, CUpnpItem* aRefItem ); 
+		CUpnpObjectBean* CreateObjectBeanLC(CUpnpObject* aItem);
+		CUpnpElementBean* CreateElementBeanLC(CUpnpElement& aItem);
+		CUpnpAttributeBean* CreateAttributeBeanLC(CUpnpAttribute& aAttr);
+		void ValidateContainerL(TInt aContainerId);
+		void ValidateItemL(TInt aItemId);
+		HBufC8* ValAsUriL(const TDesC8& aElmValue) const ;
+		TInt ReferedObjectIdL(TInt aObjectId);
+
+private:    // Data
+    CUpnpMetadataStorage*   iMetadataStorage; // not owned
+    CUpnpStateHandler* iStateHandler; // not owned
+
+};
+
+#endif      // UPNPLOCALSTORAGE_H
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpmap.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,126 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares ContentDirectory class.
+*
+*/
+
+
+
+#ifndef UPNPMAP_H
+#define UPNPMAP_H
+
+
+#include <e32std.h>
+#include "upnpmapelement.h"
+#include "upnpmapbase.h"
+
+
+// FORWARD DECLARATIONS
+
+/**
+* Implementation of simple map
+*
+*  @lib ContentDirectory
+*  @since Series 60 2.6
+*/
+template<class T>
+class CUpnpMap : public CUpnpMapBase
+{
+public:
+    /**
+    * Two-phased constructor.
+    */
+
+    /**
+    * Destructor.
+    */
+	virtual ~CUpnpMap();
+
+    /**
+    * Adds the whole element to the given TXmlEngElement.
+    * @param aElement a element to which the value will be attached
+    * @since Series S60 3.0
+    */
+	void PutL(const TDesC8& aKey, T* aValue);
+    const T* Get(const TDesC8& aKey);
+	T* Remove(const TDesC8& aKey);
+
+	void Clear();
+
+public:
+    /**
+    * C++ default constructor.
+    */
+	CUpnpMap();
+};
+
+// -----------------------------------------------------------------------------
+// CUpnpMap::CUpnpMap
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+template<class T>
+CUpnpMap<T>::CUpnpMap()
+{
+}
+// -----------------------------------------------------------------------------
+// CUpnpMap::Get
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+template<class T>
+const T* CUpnpMap<T>::Get(const TDesC8& aKey)
+{
+    return static_cast<T*>( CUpnpMapBase::Get(aKey) );
+}
+// -----------------------------------------------------------------------------
+// CUpnpMap::Get
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+template<class T>
+void CUpnpMap<T>::PutL(const TDesC8& aKey, T* aValue)
+{
+    CUpnpMapBase::PutL(aKey, aValue);
+}
+// -----------------------------------------------------------------------------
+// CUpnpMap::~CUpnpMap
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+template<class T>
+CUpnpMap<T>::~CUpnpMap()
+{
+    Clear();
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapBase::Clear
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+template<class T>
+void CUpnpMap<T>::Clear()
+{
+    while(iFirst)
+    {
+        CUpnpMapElement* next = iFirst->Next();
+        delete static_cast<T*>( iFirst->Value() );
+        delete iFirst;
+        iFirst = next;
+    }
+}
+
+
+#endif // UPNPMAP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpmapbase.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,68 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares ContentDirectory class.
+*
+*/
+
+
+
+#ifndef UPNPMAPBASE_H
+#define UPNPMAPBASE_H
+
+
+#include <e32std.h>
+#include"upnpmapelement.h"
+
+
+// FORWARD DECLARATIONS
+
+/**
+* Implementation of simple map
+*
+*  @lib ContentDirectory
+*  @since Series 60 2.6
+*/
+class CUpnpMapBase: public CBase
+{
+public:
+
+    /**
+    * Adds the whole element to the given TXmlEngElement.
+    * @param aElement a element to which the value will be attached
+    * @since Series S60 3.0
+    */
+	void PutL(const TDesC8& aKey, TAny* aValue);
+    TAny* Get(const TDesC8& aKey);
+	TAny* Remove(const TDesC8& aKey);
+
+	virtual void Clear() = 0;
+
+protected:
+
+    /**
+    * C++ default constructor.
+    */
+	CUpnpMapBase();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+	void ConstructL();
+
+protected: // Data
+
+	CUpnpMapElement* iFirst; // owned
+};
+
+#endif // UPNPMAPBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpmapelement.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,88 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+#ifndef UPNPMAPELEMENT_H
+#define UPNPMAPELEMENT_H
+
+//  INCLUDES
+#include "upnptablebean.h"
+#include <e32base.h>
+#include <d32dbms.h>
+
+class CUpnpElement;
+class CUpnpObject;
+class CUri8;
+
+// CLASS DECLARATION
+
+/**
+*  Stores the data of element table row.
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpMapElement: public CBase 
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpMapElement* NewLC(const TDesC8& aKey, TAny* aValue);
+    static CUpnpMapElement* NewL(const TDesC8& aKey, TAny* aValue);
+
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpMapElement();
+
+public: // New functions
+    
+    /**
+    * Adds the whole element to the given TXmlEngElement.
+    * @param aElement a element to which the value will be attached
+    * @since Series S60 3.0
+    */
+    const TDesC8& Key();
+    TAny* Value();
+    CUpnpMapElement* Next();
+    void SetNext(CUpnpMapElement* aNext);
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpMapElement(TAny* iItem);
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL(const TDesC8& aKey);
+    
+
+private:    // Data
+    HBufC8*             iKey; // owned
+    TAny*               iValue;// not owned
+    CUpnpMapElement*    iNext;// not owned
+};
+
+#endif      // UPNPMAPELEMENT_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpmetadatastorage.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,482 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Database for MediaServer
+*
+*/
+
+
+
+#ifndef UPNPMETADATASTORAGE_H
+#define UPNPMETADATASTORAGE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+#include <d32dbms.h>
+#include <s32file.h>
+#include <upnperrors.h>
+#include <xmlengdom.h>
+
+// FORWARD DECLARATIONS
+class CUpnpObjectBean;
+class CUpnpElementBean;
+class CUpnpAttributeBean;
+class CUpnpResourcesBean;
+
+// CLASS DECLARATION
+
+/**
+*  Metadata storage
+*
+*  @lib avcontentdirectory.lib
+*  @since Series 60 3.0
+*/
+class CUpnpMetadataStorage : public CBase
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpMetadataStorage* NewL(const TDesC& aDatabaseFileName);
+    static CUpnpMetadataStorage* NewLC(const TDesC& aDatabaseFileName);
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpMetadataStorage();
+
+public: // New functions
+    
+    /**
+    * Deletes object from database
+    * @since Series S60 3.0
+    * @param aObjId id of the object to be deleted
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+        TBool IsContainerL(TInt aObjId);
+        void DeleteResourcesL(RArray<TInt>& aObjList);
+        void AddResourceL(CUpnpResourcesBean* aResBean, TInt aObjId);
+       	TUpnpErrorCode DoDeleteObjectL(TInt aObjId, TBool aDeleteResource, TBool aDeleteRef=ETrue );
+		void InsertIntoAttributeTableL(TInt aElmId, CUpnpAttributeBean* aAtrBn, TInt aObjId, TInt aAtrId);
+ 		TInt InsertIntoElementTableL(TInt aObjId, CUpnpElementBean* aElmBn, TInt aElmId);
+		TInt InsertIntoObjectTableL(TInt aContainer, CUpnpObjectBean* aObjBn);
+    /**
+    * @since Series S60 3.1
+    * @param aObjId
+    * @return RDbView
+    */
+    RDbView GetObjViewL(TInt aObjId);
+        
+    /**
+    *
+    * @since Series S60 3.1
+    */
+    void BeginTransactionL();
+    
+    /**
+    *
+    * @since Series S60 3.1
+    */
+    void CommitTransactionL();
+    
+    /**
+    *
+    * @since Series S60 3.1
+    */
+    void RollbackTransactionL();
+        
+    /**
+    * Getter
+    * @since Series S30 3.1
+    * @param aObjectID
+    * @param aAll
+    * @return RDbView
+    */
+    RDbView GetElementsViewL(TInt aObjectID, TBool aAll);
+        
+    /**
+    * Getter
+    * @since Series S30 3.1
+    * @param aElementID
+    * @param aAll
+    * @return RDbView
+    */
+    RDbView GetAttributesViewL(TInt aElementID, TBool aAll);
+       
+    /**
+    * Getter
+    * @since Series S30 3.2
+    * @param aObjectID
+    * @param aAll
+    * @return RDbView
+    */
+    RDbView GetAttributesViewByObjectIdL( TInt aObjectID, TBool aAll );
+
+    /**
+    * Getter
+    * @since Series S30 3.1
+    * @param aAttrNameID
+    * @param aAttrVal
+    * @return 
+    */
+    TInt GetElmIdForAttrL(const TDesC8& aAttrName, const TDesC8& aAttrVal);
+        
+    /**
+    * Getter
+    * @since Series S30 3.1
+    * @param aAttrName
+    * @param aAttrVal
+    * @return 
+    */
+    TInt GetElmIdForAttrLikeL(const TDesC8& aAttrName, const TDesC8& aAttrVal);
+        
+    /**
+    * 
+    * @since Series S30 3.1
+    * @param aResVal
+    * @param aObjId
+    */
+    void DeleteResElL(const TDesC& aResVal, TInt ObjId);
+        
+    /**
+    * Getter
+    * @since Series S30 3.1
+    * @param aResVal
+    * @return RDbView
+    */
+    RDbView GetViewOfObjectListForResL(const TDesC& aResVal);
+        
+    /**
+    * Getter
+    * @since Series S30 3.1
+    * @param aElmName
+    * @param aElmValue
+    * @return RDbView
+    */
+    RDbView GetViewOfElmIdByNameAndValL(const TDesC& aElmName,  const TDesC& aElmValue);
+        
+    /**
+    * Getter
+    * @since Series S30 3.1
+    * @param aAttrName
+    * @param aAttrVal
+    * @return RDbView
+    */
+    RDbView GetAttrViewL(const TDesC8& aAttrName, const TDesC8& aAttrVal);
+        
+    /**
+    * Getter
+    * @since Series S30 3.1
+    * @param aElmId
+    * @param aAttrName
+    * @return RDbView
+    */
+    RDbView GetAttrViewL(TInt aElmId, const TDesC8& aAttrName);
+    
+    /**
+    * Getter
+    * @since Series S30 3.2
+    * @param aBjectId
+    * @param aAttrName
+    * @return RDbView
+    */
+    RDbView GetAttrViewByObjectIdL(TInt aBjectId, const TDesC8& aAttrName);    
+        
+    /**
+    * 
+    * @since Series S30 3.1
+    * @param aSqlQuery
+    * @return RDbView
+    */
+    RDbView PrepareViewL(const TDesC& aSqlQuery);
+        
+    /**
+    * Getter
+    * @since Series S30 3.1
+    * @param aSqlQuery
+    * @return RDbView
+    */
+	RDbView GetEvaluatedViewL(const TDesC& aSqlQuery);
+ 	HBufC8* GetObjectPathL(TInt aObjId);
+ 	HBufC8* GetObjectTitleL(TInt aObjId);
+	void ExecuteL(const TDesC& aSqlCommand);
+ 	CUpnpResourcesBean* GetResourceL(TInt64 aResId);
+	void DeleteResourceByObjIdL(TInt aObjId, TBool aDeleteFile=ETrue);
+	void DeleteResourceByResIdL(TInt64 aResId, TBool aDeleteFile=ETrue);
+	void DeleteObjectsL(TInt aObjId);
+	void DeleteElementsL(TInt aObjId);
+	void DeleteAttributesL(TInt aObjId);
+	void DeleteReferencesL(TInt aObjId,RArray<TInt>& aRefList);
+
+    /**
+    * Performs object deletion; a transaction should be started before calling this function
+    * @since Series S60 3.0
+    * @param id of the object to be deleted
+    * @param aObjId aCd pointer to the ContentDirectory object - it provides a function which deletes
+    * 				a file from the private directory
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+ 	TInt DoDeleteObjectL(TInt aObjId,RArray<TInt>& aRefList,
+ 	                     RArray<TInt>& aResList, TBool aDeleteResource, TBool aLocal, TBool aDeleteRef = ETrue );
+
+    /**
+    * Checks the restrictions of the parent object of the given object.
+    * @since Series S60 3.0
+    * @param aObjId object's id
+	* @return returns EUpnpOk if object with the given id exists in database and is a "non restricted conainer"    
+	*/
+	TUpnpErrorCode CheckParentRestrictionL(TInt aObjId);
+
+    /**
+    * Deletes object from database
+    * @since Series S60 3.0
+    * @param aObjId id of the object to be deleted
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+	TUpnpErrorCode DeleteObjectL(TInt aObjId,RArray<TInt>& aRefList, TBool aDeleteResource,
+	                             TBool aLocal = EFalse, TBool aDeleteRef = ETrue );
+   	
+
+    /**
+    * Gets the descriptor value of the specified column in the rowset.
+    * @since Series S60 3.0
+    * @param aRowset rowset object
+    * @param aColNo the number of the column to be get the value of
+    * @return descriptor containing the value of the specified column,
+    *       the caller should delete it when it is no longer needed
+    */
+    HBufC8* GetColDesValFromRowSetL(RDbRowSet aRowset, TDbColNo aColNo);
+
+    /**
+    * Gets the value of childCount property for the given object.
+    * @since Series S60 3.0
+    * @param aObjId object's id
+    * @return value of childCount property
+    */
+    TInt GetChildCountL(TInt aObjId);
+        
+    /**
+    * Gets the parent object's id of the object with given id.
+    * @since Series S60 3.0
+    * @param aObjId child object id
+    * @return perent object id
+    */
+    TInt GetParentIdL(TInt aObjId);
+
+    /**
+    * Gets the id of the object which the element with given id belongs to.
+    * @since Series S60 3.0
+    * @param aId element's id
+    * @return object's id
+    */
+    TInt GetObjIdForElmIdL(TInt aId);
+
+    /**
+    * Gets id of reffered object 
+    * @since Series S60 3.0
+    * @param aObjectId object id
+    * @return reffered object id.
+    */
+    TInt ReferedObjectIdL( TInt aObjectId );
+
+    /**
+    * Gets the next free id in the specified table 
+    * @since Series S60 3.0
+    * @param aName name of the table
+    * @return TInt next free id in the specified table
+    */
+    TInt GetNextKeyL(const TDesC8& aName);
+    TInt GetNextKeyL(const TDesC8& aName, TInt aAmount);
+    /**
+    * Gets the next free id in the specified table 
+    * @since Series S60 3.0
+    * @param aName name of the table
+    * @return TInt next free id in the specified table
+    */
+    TInt NextKeyL(const TDesC8& aName);
+
+    /**
+    * Insert object's data into 'object' table
+    * @since Series S60 3.0
+    * @param aElement TXmlEngElement of the object to be added
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    void InsertObjectIntoObjectTableL(const TXmlEngElement& aElement);
+
+    /**
+    * Inserts single attribute into the database 
+    * @since Series S60 3.0
+    * @param aAttr TXmlEngAttr of the attribute to be inserted
+    * @param aElmId id of the element this attribute belongs to
+    * 2param aIsRequired 
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    void InsertAttributeL(const TXmlEngAttr aAttr, TInt aElmId, TBool aIsRequired, TInt aObjId);
+
+    /**
+    * Inserts element into database 
+    * @since Series S60 3.0
+    * @param aElementel TXmlEngElement of the element to be inserted
+    * @param aObjId id of the object this element belongs to
+    */
+    TInt  InsertElementL(const TXmlEngElement& aElementel, TInt aObjId);
+
+    /**
+    * Gets the database view of the named element of the specified object.
+    * @since Series S60 3.0
+    * @param aObjId object's id
+    * @param aElName name of the element which we want to get the view of
+    * @return ?description
+    */
+    RDbView GetElementViewL(TInt aObjId, const TDesC8& aElName);
+
+    /**
+    * Adds an attribute from object table to the object's main element.
+    * @since Series S60 3.0
+    * @param aElement object's element
+    * @param aId object's id
+    * @param aName name of the attribute which is to be added
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode AddMainTagAttrL(TXmlEngElement aElement, TInt aId, const TDesC8& aName);
+
+
+    /**
+    * Gets the list direct children of object with specified id
+    * @since Series S60 3.0
+    * @param aParentId id of the parent object
+    * @param aList an array to be filled with object
+    * @return EUpnpOk, if successful; Otherwise, one of the other Upnp error codes.
+    */
+    TUpnpErrorCode GetObjectListL(TInt aParentId, RArray<TInt>& aList);
+    TUpnpErrorCode GetItemListL(TInt aParentId, RArray<TInt>& aList);
+    TUpnpErrorCode GetContainerListL(TInt aParentId, RArray<TInt>& aList);
+
+    /**
+    * Checks if object with the given id exists, is a container and its 'restricted' attribute has value of 'false'
+    * @since Series S60 3.0
+    * @param aObjId id of the object to be checked
+    * @return returns EUpnpOk if object with the given id exists in database and is a "non restricted conainer"
+    */
+    TUpnpErrorCode CheckObjectRestrictionL(TInt aObjId);
+
+    /**
+    * Recovers the database.
+    * @since Series S60 3.1
+    * @return Standard error code
+    */
+    TInt RecoverDatabase();
+
+    /**
+    * Recreates the database file.
+    * @since Series S60 3.1
+    */
+    void RecreateDatabaseFileL();
+
+    /**
+    * Checks if all database columns in each table have propper definitions.
+    * If not, it leaves with KErrCorrupt.
+    * @since Series S60 3.2
+    */
+    void CheckDatabaseL();  
+
+    /**
+    * Handles DB error
+    * Tries to recover, if fails tries to recreate
+    * @since Series S60 3.2
+    * @return TInt - KErrNone if succed
+    */
+    TInt HandleDbError( TInt aError );
+    
+    /**
+    * Returns DB creation status
+    * @since Series S60 3.2
+    * @return TBool
+    */
+    TBool IsDbCreated();
+   
+    
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpMetadataStorage();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL(const TDesC& aDatabaseFileName);
+
+private:
+    
+    void CompactDbL();    
+    TInt AddSubObjectsL(TInt aObjId, RArray<TInt>& aObjList, RArray<TInt>& aResList, TBool aLocal);
+
+    /**
+    * Compare two column sets (type, maxsize and attributes). Used by CheckDatabaseL() function.
+    * Leaves with KErrCorrupt when columns are not agree.
+    * @since Series S60 3.2
+    * @param aColSet1 First column set to compare
+    * @param aColSet2 Second column set to compare
+    */
+    void CompareDbColSetsL( CDbColSet *aColSet1, CDbColSet *aColSet2 );
+
+    /**
+    * Deletes the file
+    * @since Series S30 3.1
+    * @param aPath
+    */
+    void DeleteFileL(const TDesC& aPath);
+        
+    /**
+    *
+    * @since Series S30 3.1
+    * @param aElement
+    * @return descriptor pointer
+    */
+    HBufC8* CreatePathValL(const TXmlEngElement& aElement);
+		HBufC8* CreatePathValL(TInt aParentId);
+    /**
+    * Opens database
+    * @since Series S30 3.1
+    * @param aDatabaseFileName
+    */
+    void OpenDbL( const TFileName& aDatabaseFileName );
+        
+    /**
+    *
+    * @since Series S30 3.1
+    * @param aWeight
+    */
+    void DbChangedL(TInt aWeight);
+
+private:    
+
+    // For use of iFileStore
+    RFs                iFsSession; 
+    // For database operations
+    RDbStoreDatabase    iDatabase;  
+    TBool               iIsOpen;
+    // For creating and opening database files
+    CFileStore*         iFileStore; 
+    // compact counter
+    TInt                iCompactCounter;
+
+};
+
+#endif      // UPNPMETADATASTORAGE_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpmimemapper.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,201 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+#ifndef UPNPMIMEMAPPER_H
+#define UPNPMIMEMAPPER_H
+
+//  INCLUDES
+#include "upnptablebean.h"
+#include "upnpmap.h"
+#include <e32base.h>
+#include <d32dbms.h>
+
+
+// Mapping file extensions 
+_LIT8( KExtensionJpg,                   "jpg"                               );
+_LIT8( KExtensionPng,                   "png"                               );
+_LIT8( KExtensionTxt,                   "txt"                               );
+_LIT8( KExtensionMp3,                   "mp3"                               );
+_LIT8( KExtensionGif,                   "gif"                               );
+_LIT8( KExtensionBmp,                   "bmp"                               );
+_LIT( KExtensionWav,                   ".wav"                               );
+_LIT( KExtensionAac,                   ".aac"                               );
+
+
+
+// mime types <-> files ext
+_LIT8( KXHtmlMime,   "application/xhtml+xml" ); _LIT( KXHtmlExt,".xhtml" ); 
+_LIT8( KHtmlMime,    "text/html" );             _LIT( KHtmlExt, ".html" );
+_LIT8( KXmlMime1,    "text/xml" );       
+_LIT8( KXmlMime2,    "application/xml" );
+_LIT8( KXmlMime3,	"application/x-xml");       _LIT( KXmlExt,  ".xml" );
+_LIT8( KTxtMime,     "text/plain" );
+_LIT8( KTxtMime2,	"application/txt" );
+_LIT8( KTxtMime3,	"browser/internal" );
+_LIT8( KTxtMime4,	"text/anytext" );
+_LIT8( KTxtMime5,	"widetext/plain" );
+_LIT8( KTxtMime6,	"widetext/paragraph" );            _LIT( KTxtExt,  ".txt" );
+_LIT8( KJpegMime,    "image/jpeg" );            _LIT( KJpegExt, ".jpeg" );
+_LIT8( KJpegMime2,  "image/jpg" );
+_LIT8( KJpegMime3,   "image/jpe_" );
+_LIT8( KJpegMime4,   "image/pjpeg" );  
+_LIT8( KJpegMime5,    "image/vnd.swiftview-jpeg" );  
+
+_LIT8( KJpgMime,    "image/jpeg" );            _LIT( KJpgExt, ".jpg" );
+_LIT8( KJpgMime2,  "image/jpg" );  
+_LIT8( KJpgMime3,   "image/jpe_" );  
+_LIT8( KJpgMime4,   "image/pjpeg" );  
+_LIT8( KJpgMime5,    "image/vnd.swiftview-jpeg" );  
+
+_LIT8( KGifMime,     "image/gif" );             _LIT( KGifExt,  ".gif" );
+_LIT8( KGifMime2,	"image/x-xbitmap" );   
+_LIT8( KGifMime3,	"image/gi_" );   
+
+_LIT8( KPngMime,     "image/png" );             _LIT( KPngExt,  ".png" );
+_LIT8( KPngMime2,	 "application/png" );  
+_LIT8( KPngMime3,	 "application/x-png" );  
+
+_LIT8( KMpgMime1,    "video/mpeg");             _LIT( KMpgExt1,  ".mpg" );
+_LIT8( KMpgMime2,    "video/mpg");   
+_LIT8( KMpgMime3,     "video/x-mpg");  
+_LIT8( KMpgMime4,     "video/mpeg2" );  
+_LIT8( KMpgMime5,     "application/x-pn-mpg" );  
+_LIT8( KMpgMime6,	    "video/x-mpeg" );  
+_LIT8( KMpgMime7,	    "video/x-mpeg2a");  
+_LIT8( KMpgMime8,     "audio/mpeg" );   
+_LIT8( KMpgMime9,	    "audio/x-mpeg" );  
+_LIT8( KMpgMime10,   "image/mpg" );   
+
+_LIT8( KMpeg4Mime,   "video/mpeg4" );           _LIT( KMpeg4Ext,".mpeg4" );
+
+_LIT8( KMp4Mime,     "video/mp4" );             _LIT( KMp4Ext,  ".mp4" );
+_LIT8( KMp4Mime2,   "video/mp4v-es" );      
+_LIT8( KMp4Mime3,   "audio/mp4" );		
+
+_LIT8( KAviMime1,    "video/avi" );
+_LIT8( KAviMime2,    "video/msvideo" );
+_LIT8( KAviMime3,    "video/x-msvideo" );       _LIT( KAviExt,  ".avi" );
+_LIT8( KAviMime4,    "image/avi" );        
+_LIT8( KAviMime5,    "video/xmpg2" );   
+_LIT8( KAviMime6,	 "application/x-troff-msvideo" );   
+_LIT8( KAviMime7, 	 "audio/aiff" );                       
+_LIT8( KAviMime8, 	 "audio/avi" );			
+
+_LIT8( KMp3Mime1,    "audio/x-mpeg-3");
+_LIT8( KMp3Mime2,    "audio/mpeg3" );           _LIT( KMp3Ext,  ".mp3" );
+_LIT8( KMp3Mime3,    "audio/mpeg" );        // 1)   _LIT( KMpgExt2,  ".mp3" );
+_LIT8( KMp3Mime4,    "audio/x-mpeg" );   
+_LIT8( KMp3Mime5,    "audio/mp3" );        
+_LIT8( KMp3Mime6,    "audio/x-mp3" );      
+_LIT8( KMp3Mime7,    "audio/x-mpeg3" );  
+_LIT8( KMp3Mime8,     "audio/mpg" );        
+_LIT8( KMp3Mime9,     "audio/x-mpg" );       
+_LIT8( KMp3Mime10,   "audio/x-mpegaudio" );  
+
+_LIT8( KAacMime,     "audio/aac" );             _LIT( KAacExt,  ".aac" );
+_LIT8( KWmaMime,     "audio/x-ms-wma" );        _LIT( KWmaExt,  ".wma" );
+_LIT8( KWmaMime2,   "video/x-ms-asf" );     
+
+_LIT8( KBmpMime,     "image/bmp" );             _LIT( KBmpExt,  ".bmp" );
+_LIT8( KBmpMime2,    "image/x-bmp" );    
+_LIT8( KBmpMime3,    "image/x-bitmap" );  
+_LIT8( KBmpMime4,    "image/x-xbitmap" );  
+_LIT8( KBmpMime5,    "image/x-ms-bmp" );  
+_LIT8( KBmpMime6,    "application/bmp" );    
+_LIT8( KBmpMime7,    "application/x-bmp" );    
+_LIT8( KBmpMime8,    "application/x-win-bitmap" );     
+_LIT8( KBmpMime9,     "application/preview" );    
+
+_LIT8( KAudioL16,     "audio/L16" );
+_LIT8( KAudioVnd,     "audio/vnd.dlna.adts" );
+
+_LIT8( KAudio3gpp,     "audio/3gpp" ); 
+_LIT8( KVideo3gpp,     "video/3gpp" ); 
+_LIT( K3gpExt,  ".3gp" );
+_LIT8( KAudioAMR,     "audio/AMR" );     _LIT( KAmrExt,  ".amr" );
+
+_LIT8(KAudioWav, "audio/wav");
+_LIT8(KVideoWmv, "video/x-ms-wmv");     _LIT( KWmvExt,    ".wmv" );
+_LIT8(KVideoAvi, "video/x-ms-avi");
+
+_LIT8(KRealMedia, "application/vnd.rn-realmedia");  _LIT( KRmExt,    ".rm" );
+_LIT8(KRealAudio, "audio/vnd.rn-realaudio");        _LIT( KRealAudioExt,    ".ra" );
+_LIT8(KPmRealAudioPlugin, "audio/x-pn-realaudio-plugin"); _LIT( KPmRealAudioPluginExt,    ".rpm" );
+_LIT8(KPmRealAudio, "audio/x-pn-realaudio");        _LIT( KPmRealAudioExt,    ".ra" );
+_LIT8(KRealVideo, "video/vnd.rn-realvideo");        _LIT( KRealVideoExt,    ".rv" );
+
+// CLASS DECLARATION
+
+/**
+*  Provides mime type to file extention mapping.
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpMimeMapper: public CBase 
+    {
+public:  // Constructors and destructor
+    
+        /**
+        * Two-phased constructor.
+        */
+    static CUpnpMimeMapper* NewL();
+
+     /**
+        * Destructor.
+        */
+    virtual ~CUpnpMimeMapper();
+
+public: // New functions
+    
+
+    void AddMimeMapElL( const TDesC8& aKey, const TDesC& aVal );
+    void InitMimeToExtensionMapL();
+    
+    /**
+    * This function gives extension to a file.  
+    * @since Series 60 3.1
+    * @param aMimeType - mime type from which additional information will be retrieved. 
+    * @return pointer to HBufC8 object with extension value for this file. 
+    */
+    HBufC8* GetExtensionL( const TDesC8& aMimeType );
+    
+    const HBufC* Get( const TDesC8& aKey );
+
+private:
+
+  /**
+    * C++ default constructor.
+    */
+    CUpnpMimeMapper();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+    void ConstructL();
+   
+private:    // Data
+
+    CUpnpMap<HBufC>* iMimeToExtMap;
+  
+    };
+
+#endif      // UPNPMIMEMAPPER_H   
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpmspathutility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+*
+* Description:  Utility class to get path related info for the media files
+*/
+
+
+
+
+
+
+#ifndef UPNP_MSPATHUTILITY_H
+#define UPNP_MSPATHUTILITY_H
+
+// INCLUDE FILES
+#include <e32base.h>    // CBase
+#include <f32file.h>    // TDriveNumber
+#include <xmlengdom.h>
+
+// FORWARD DECLARATIONS
+class CRepository;
+class CUpnpDlnaProtocolInfo;
+
+// CLASS DECLARATION
+/**
+ *  Path utility class to get path related info for the media files
+ *  @lib upnpcontentdirectoryservice.lib
+ *  Note:- This class needs to be revisited once mediaserver refactoring is 
+ *         over as there is definitely the need to remove duplicate code
+ *        
+ */
+NONSHARABLE_CLASS ( CUPnPMSPathUtility ) : public CBase
+    {
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUPnPMSPathUtility* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUPnPMSPathUtility* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPMSPathUtility();
+        
+        
+public: // new functions
+
+    /**
+     * Gets the drive for the copy operation
+     * @param aDrive, reference to copy path drive
+     */
+    void GetCopyPathDriveL( TDriveNumber& aDrive ) const;
+
+    /**
+     * Gets the path of the upnp item's file to be copied
+     * @param aItem, an xml item
+     * @param aProInfo, proto info of the resource of the xml item
+     * @return HBufC*, copy path. Ownership is transferred to the caller
+     *          Leaves in case of an error.    
+     */
+    HBufC* GetCopyPathL( const TXmlEngElement& aItem,
+                         CUpnpDlnaProtocolInfo& aProInfo ) const;
+
+    /**
+     * Gets and creates (if necessary) the path of the upnp item's 
+     * file to be copied.
+     * @param aItem, an xml item
+     * @param aProInfo, proto info of the resource of the xml item
+     * @return HBufC*, copy path. Ownership is transferred to the caller
+     *          Leaves in case of an error.    
+     */
+    HBufC* CreateCopyPathL( const TXmlEngElement& aItem,
+                            CUpnpDlnaProtocolInfo& aProInfo ) const;
+    
+private:
+    enum TMediaServerKeys 
+        {
+        EFriendlyName = 1, 
+        EUploadDirectory = 2, 
+        ESupportedMedia = 3, 
+        ESecurityManager = 4,
+        EModelUrl = 5,
+        EModelDescription = 6,
+        EModelNumber = 7,
+        ESerialNumber = 8,
+        EPresentationUrl = 9,
+        EModelName = 10,
+        EManufacturer = 11,
+        EManufacturerUrl = 12,
+        EUpnpMediaServerThumbnails = 13,
+        KUpnpMediaServerBrowseLimit = 14
+        };
+    
+    // DATA TYPES
+    enum TUPnPItemType
+        {
+        ETypeAudio = 0,
+        ETypeVideo,
+        ETypeImage,
+        ETypePlaylist,
+        ETypeOther
+        };
+    
+    /**
+     * C++ default constructor.
+     */
+    CUPnPMSPathUtility();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL(TUid aRepositoryUid);
+
+    /**
+     * Gets and creates (if necessary) the path of the upnp item's 
+     * file to be copied.
+     * @param aItem, an xml item
+     * @param aProInfo, proto info of the resource of the xml item
+     * @param aCreatePath, If ETrue path gets created otherwise not.
+     * @param aDriveNumber, drive number to be used for the path calculation
+     * @return HBufC*, copy path. Ownership is transferred to the caller
+     *          Leaves in case of an error.    
+     */
+    HBufC* GetCreateCopyPathL(const TXmlEngElement& aItem,
+                              CUpnpDlnaProtocolInfo& aProInfo,
+                              TBool aCreatePath,
+                              TDriveNumber aDriveNumber ) const;
+    /**
+    * Returns the file type according a mime type
+    *
+    * @param const TDesC8& mime type
+    * @return TUPnPItemType file type
+    */
+   TUPnPItemType FileTypeByMimeTypeL( const TDesC8& aMimeType ) const;
+   
+    /**
+     * Appends year, month and day to the path.
+     * @param aPath, path of the upnp item
+     * @param aItem, an xml item
+     */        
+    void AppendYearMonthDayL( 
+            TDes& aPath, const TXmlEngElement& aItem ) const;
+    
+    /**
+     * Appends artist and album to the path.
+     * @param aPath, path of the upnp item
+     * @param aItem, an xml item
+     */        
+    void AppendArtistAlbumL( 
+            TDes& aPath, const TXmlEngElement& aItem ) const;
+    
+    /**
+     * Appends data to the path's buffer.
+     * Leaves if data exceeds the maxlength of the buffer
+     * 
+     * @param aPath, path of the upnp item
+     * @param aData, data which needs to be appended
+     */    
+    void AppendDataL( TDes& aPath, const TDesC& aData ) const;
+    
+    /**
+     * Checks whether the data can be appended to buffer or not.
+     * Leaves if data exceeds the maxlength of the buffer
+     * 
+     * @param aPath, path of the upnp item
+     * @param aData, data which needs to be appended
+     */    
+    void CheckBufferSpaceL( const TDes& aPath, 
+            const TDesC& aData ) const;
+    
+    /**
+     * Checks whether the data of the specified length
+     * can be appended to buffer or not.
+     * Leaves if data exceeds the maxlength of the buffer
+     * 
+     * @param aPath, path of the upnp item
+     * @param aLength, length of the data which needs to be appended
+     */    
+    void CheckBufferSpaceL( const TDes& aPath, 
+            const TInt& aLength ) const;
+       
+    /**
+     * Converts given upnp date string into TTime.
+     *
+     * @param aUpnpDate value from item's dc:date element
+     * @param aTime out variable to receive corresponding TTime
+     * @return KErrNone if conversion was succesful, otherwise < 0
+     *         for error values see TTime::Parse()
+     */
+    void UPnPDateAsTTimeL( const TDesC8& aUpnpDate,
+        TTime& aTime ) const;
+
+private:    // data
+
+    /**
+    * Central repository client
+    * Note:- CUpnpMediaServerSettings is not used to avoid dependency
+    */  
+    CRepository* iRepository;
+    
+    };
+
+#endif  // UPNP_MSPATHUTILITY_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpobjectbean.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,273 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+#ifndef C_CUPNPOBJECTBEAN_H
+#define C_CUPNPOBJECTBEAN_H
+
+//  INCLUDES
+#include "upnptablebean.h"
+#include <e32base.h>
+#include <d32dbms.h>
+#include <xmlengdom.h>
+
+class CUpnpObject;
+
+// CLASS DECLARATION
+
+/**
+*  Stores the data of object table row.
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpObjectBean: public CUpnpTableBean 
+{
+    public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    //static CUpnpObjectBean* NewL();
+    static CUpnpObjectBean* NewLC();
+    static CUpnpObjectBean* NewLC(const RDbRowSet& aRowSet);
+    static CUpnpObjectBean* NewL(const RDbRowSet& aRowSet);
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpObjectBean();
+
+    public: // New functions
+    	void CopyToUpnpObjectL(CUpnpObject* aElement);
+    /**
+    * Sets 
+    * @since Series S60 3.0
+    * @param aRowSet
+    */
+    void SetL(const RDbRowSet& aRowSet);
+
+    /**
+    * Sets iObjId value.
+    * @since Series S60 3.0
+    * @param aObjId value of id in the 'object' table
+    */
+    void SetObjId(TInt aObjId);
+
+    /**
+    * Sets iObjParentId value.
+    * @since Series S60 3.0
+    * @param aObjParentId value of 'parentID' in the object table
+    */
+    void SetObjParentId(TInt aObjParentId);
+
+    /**
+    * Sets iObjTitle value.
+    * @since Series S60 3.0
+    * @param aObjTitle value of 'title' in the object table
+    */
+    void SetObjTitleL(const TDesC8& aObjTitle);
+
+    /**
+    * Sets iObjClass value.
+    * @since Series S60 3.0
+    * @param aObjClass value of 'class' in the object table
+    */
+    void SetObjClassL(const TDesC8& aObjClass);
+
+    /**
+    * Sets iObjRestricted value.
+    * @since Series S60 3.0
+    * @param aObjRestricted value of 'restricted' in the object table
+    */
+    void SetObjRestricted(TBool aObjRestricted);
+
+    /**
+    * Sets iObjSearchable value.
+    * @since Series S60 3.0
+    * @param aObjSearchable value of 'searchable' in the object table, -1 when undefined
+    */
+    void SetObjSearchable(TInt aObjSearchable);
+
+    /**
+    * Sets iObjRefId value.
+    * @since Series S60 3.0
+    * @param aObjRefId value of 'refID' in the object table
+    */
+    void SetObjRefId(TInt aObjRefId);
+        
+    /**
+    * Gets iElmId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmId
+    */  
+    TInt ObjId() const;
+        
+    /**
+    * Gets iElmId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmId
+    */  
+    TInt ObjParentId() const;
+        
+    /**
+    * Gets iElmId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmId
+    */  
+    TDesC8& ObjTitle() const;
+        
+    /**
+    * Gets iElmId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmId
+    */  
+    TDesC8& ObjClass() const;
+        
+    /**
+    * Gets iElmId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmId
+    */  
+    TBool ObjRestricted() const;
+        
+    /**
+    * Gets iElmId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmId
+    */  
+    TInt ObjSearchable() const;
+        
+    /**
+    * Gets iElmId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iElmId
+    */  
+    TInt ObjRefId() const;
+        
+    /**
+    * Adds object element and all required properties to the given TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    * @return TXmlEngElement just added object alement
+    */  
+    TXmlEngElement AttachObjectElL(TXmlEngElement aElement);
+        
+    /**
+    * Adds object element and all properties to the given TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    */  
+    TXmlEngElement AttachWholeObjectElL(TXmlEngElement aElement);
+
+    /**
+    * Adds refId attribute to the given object's TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    * @return TXmlEngAttr just added object alement
+    */  
+    void AttachRefIdL(TXmlEngElement aElement);
+    
+    /**
+    * Adds searchable attr to the given object's TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    * @return TXmlEngAttr just added object alement
+    */  
+    void AttachSearchableL(TXmlEngElement aElement);
+ 
+ private: 
+    /**
+    * Adds all required properties to the given object's TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    */  
+    void AttachRequiredPropertiesL(TXmlEngElement);
+        
+    /**
+    * Adds id attr to the given object's TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    */  
+    void AttachIdL(TXmlEngElement aElement);
+    
+    /**
+    * Adds ParentId attr to the given object's TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    */  
+    void AttachParentIdL(TXmlEngElement aElement);
+    
+    /**
+    * Adds restricted attr to the given object's TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    * @return TXmlEngAttr just added object alement
+    */  
+    void AttachRestrictedL(TXmlEngElement aElement);
+
+    /**
+    * Adds title element to the given object's TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    */  
+    void AttachTitleL(TXmlEngElement aElement);
+    
+    /**
+    * Adds class element to the given object's TXmlEngElement.
+    * @since Series S60 3.0
+    * @param aElement
+    */  
+    void AttachClassL(TXmlEngElement aElement);
+        
+        
+    private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpObjectBean();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    private:    // Data
+        
+    // Object Id
+    TInt        iObjId;
+    // Object parent Id
+    TInt        iObjParentId;
+    // Object Title
+    HBufC8*     iObjTitle;
+    // Object Class
+    HBufC8*     iObjClass;
+    //
+    TBool       iObjRestricted;
+    //
+    TInt        iObjSearchable;
+    // Object Reference Id
+    TInt        iObjRefId;
+};
+
+// inline functions
+#include"upnpobjectbean.inl"
+
+#endif      // C_CUPNPOBJECTBEAN_H   
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpobjectbean.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,130 @@
+/** @file
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler - inline functions
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::SetObjSearchable
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpObjectBean::SetObjSearchable(TInt aObjSearchable)
+{
+        iObjSearchable = aObjSearchable;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::SetObjId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpObjectBean::SetObjId(TInt aObjId)
+{
+        iObjId = aObjId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::SetObjParentId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpObjectBean::SetObjParentId(TInt aObjParentId)
+{
+        iObjParentId = aObjParentId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::SetObjRestricted
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpObjectBean::SetObjRestricted(TBool aObjRestricted)
+{
+        iObjRestricted = aObjRestricted;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::SetObjRefId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpObjectBean::SetObjRefId(TInt aObjRefId)
+{
+        iObjRefId = aObjRefId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::ObjId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpObjectBean::ObjId() const
+{
+        return iObjId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::ObjParentID
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpObjectBean::ObjParentId() const
+{
+        return iObjParentId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::ObjTitle
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TDesC8& CUpnpObjectBean::ObjTitle() const
+{
+        return *iObjTitle;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::ObjClass
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TDesC8& CUpnpObjectBean::ObjClass() const
+{
+        return *iObjClass;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::ObjRestricted
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TBool CUpnpObjectBean::ObjRestricted() const
+{
+        return iObjRestricted;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::ObjSearchable
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TBool CUpnpObjectBean::ObjSearchable() const
+{
+        return iObjSearchable;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::ObjRefId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpObjectBean::ObjRefId() const
+{
+        return iObjRefId;
+}
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpresourcesbean.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,161 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+#ifndef UPNPRESOURCESBEAN_H
+#define UPNPRESOURCESBEAN_H
+
+//  INCLUDES
+#include "upnptablebean.h"
+#include <e32base.h>
+#include <d32dbms.h>
+
+class CUpnpElement;
+
+// CLASS DECLARATION
+/**
+*  Stores the data of resources table row.
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpResourcesBean: public CUpnpTableBean 
+{
+    public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpResourcesBean* NewLC();
+    static CUpnpResourcesBean* NewL(const RDbRowSet& aRowSet);
+    static CUpnpResourcesBean* NewLC(const RDbRowSet& aRowSet);
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpResourcesBean();
+
+    public: // New functions
+    /**
+    * Sets  value.
+    * @since Series S60 3.0
+    * @param  value of  in the element table
+    */
+    void SetL(const RDbRowSet& aRowSet);
+
+    /**
+    * Sets iId value.
+    * @since Series S60 3.0
+    * @param aId value of rsc_id in the 'shareMap' table
+    */
+    void SetId(TInt64 aId);
+
+    /**
+    * Sets iObjectId value.
+    * @since Series S60 3.0
+    * @param aObjectId value of rsc_object_id in the 'shareMap' table
+    */
+    void SetObjectId(TInt aObjectId);
+    
+    /**
+    * Sets iPath value.
+    * @since Series S60 3.0
+    * @param aPath value of rsc_path in the 'resources' table
+    */
+    void SetPathL(const TDesC& aPath);
+    void SetPathL(const TDesC8& aPath);
+
+    /**
+    * Sets iIsReadonly value.
+    * @since Series S60 3.0
+    * @param IsReadonly value of rsc_is_readonly in the 'resources' table
+    */
+    void SetIsReadonly(TBool aIsReadonly);
+    
+    /**
+    * Sets iIsThumbnail value.
+    * @since Series S60 3.0
+    * @param IsThumbnail value of rsc_is_thumbnail in the 'resources' table
+    */
+    void SetIsThumbnail(TBool aIsThumbnail);
+
+    /**
+    * Gets iId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iId
+    */  
+    TInt64 Id() const;
+ 
+    /**
+    * Gets iObjectId value.
+    * @since Series S60 3.0
+    * @return Gets the value of iObjectId
+    */  
+    TInt ObjectId() const;
+        
+    /**
+    * Gets iPath value.
+    * @since Series S60 3.0
+    * @return Gets the value of iPath
+    */  
+    TDesC& Path() const;
+        
+        
+    /**
+    * Gets iIsReadonly value.
+    * @since Series S60 3.0
+    * @return Gets the value of iIsReadonly
+    */  
+    TInt IsReadonly() const;
+    
+    /**
+    * Gets iIsThumbnail value.
+    * @since Series S60 3.0
+    * @return Gets the value of iIsThumbnail
+    */  
+    TInt IsThumbnail() const;
+        
+    private:
+
+    /**
+    * C++ default constructor.
+    */
+    CUpnpResourcesBean();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    private:    // Data
+    // Id
+    TInt64    iId;
+    // ObjectId
+    TInt    iObjectId;
+    // Path
+    HBufC*  iPath;
+    //
+    TInt    iIsReadonly;
+    //
+    TInt    iIsThumbnail;
+};
+
+// inline functions
+#include"upnpresourcesbean.inl"
+
+#endif      // UPNPRESOURCESBEAN_H
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpresourcesbean.inl	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,102 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler - inline functions
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::SetIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpResourcesBean::SetId(TInt64 aId)
+{
+        iId = aId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::SetObjectIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpResourcesBean::SetObjectId(TInt aObjectId)
+{
+        iObjectId = aObjectId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::SetIsReadonlyL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpResourcesBean::SetIsReadonly(TBool aIsReadonly)
+{
+        iIsReadonly = aIsReadonly;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::SetIsThumbnail
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpResourcesBean::SetIsThumbnail(TBool aIsThumbnail)
+{
+        iIsThumbnail = aIsThumbnail;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::Id
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt64 CUpnpResourcesBean::Id() const
+{
+        return iId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::ObjectId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpResourcesBean::ObjectId() const
+{
+        return iObjectId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::Path
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TDesC& CUpnpResourcesBean::Path() const
+{
+        return *iPath;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::IsReadonly
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpResourcesBean::IsReadonly() const
+{
+        return iIsReadonly;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::IsThumbnail
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TInt CUpnpResourcesBean::IsThumbnail() const
+{
+        return iIsThumbnail;
+}
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpsender.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,82 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+#ifndef C_CUPNPSENDER_H
+#define C_CUPNPSENDER_H
+
+//  INCLUDES
+#include "upnperrors.h"
+#include "upnpcdssender.h"
+#include <e32base.h>
+
+class CUpnpAction;
+class CUpnpHttpMessage;
+class CUpnpContentDirectory;
+
+// CLASS DECLARATION
+
+/**
+*  Stores the data of object table row.
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpCdsSender: public CBase , public MUpnpCdsSender
+{
+    public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpCdsSender* NewLC(CUpnpContentDirectory* aCd);
+    static CUpnpCdsSender* NewL(CUpnpContentDirectory* aCd);
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpCdsSender();
+
+    public: // New functions
+    /**
+    * Sets 
+    * @since Series S60 3.0
+    * @param aRowSet
+    */
+    void SendL(CUpnpAction* aAction, TUpnpErrorCode aError);
+    void SendL( CUpnpHttpMessage* aMessage );
+
+
+ private: 
+    /**
+    * C++ default constructor.
+    */
+    CUpnpCdsSender(CUpnpContentDirectory* aCd);
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+ private:    // Data
+    CUpnpContentDirectory* iCd;
+        
+};
+
+#endif      // C_CUPNPSENDER_H   
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpstatehandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,87 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  State handler
+*
+*/
+
+
+#ifndef C_CUPNPSTATEHANDLER_H
+#define C_CUPNPSTATEHANDLER_H
+
+//  INCLUDES
+#include "e32base.h"
+
+class TUpnpContainerUpdateId;
+class CUpnpContentDirectory;
+
+class CUpnpStateHandler :
+        public CBase              
+    {
+    public: // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        CUpnpStateHandler (  );
+
+        /**
+        * Destructor.
+        */
+        ~CUpnpStateHandler ();  
+                                                                
+    public: // New functions
+        static CUpnpStateHandler* NewL(CUpnpContentDirectory* aCd);         
+        void  ConstructL(CUpnpContentDirectory* aCd);        
+        /**
+        * This fuction increases a value of SystemUpdateID. 
+        * @since Series 60 2.6
+        * @return a new value of SystemUpdateID 
+        */
+        TInt IncreaseSystemUpdateIdL();
+        
+        /**
+        * This fuctions increases a container update ID.
+        * @since Series 60 2.6
+        * @param aContainerID a ID of the container whichs updateID is increased
+        */
+        void IncreaseContainerUpdateIdL( const TDesC8& aContainerID );
+        
+        
+        RArray<TUpnpContainerUpdateId>& ContainerUpdateIds( );
+        TInt ContainerUpdateId( const TDesC8& aContainerID );
+        /**
+        * This function is for informing service from evented statevariables.
+        * @since Series 60 2.6
+        * @param aVariableName Name of the evented statevariable.
+        */
+        void StateVariableEvented(const TDesC8& aVariableName);
+        TBool IsEnable();
+    private:        
+        //array for containerUpdateId elements
+        RArray<TUpnpContainerUpdateId>  iContainerUpdateIds;
+        // This must be changed everytime when content changes.
+        TUint iSystemUpdateId;
+        // iContainerUpdateIds subarray. 
+        //It contains info about some containers' changes,
+        // collected before sending next NOTIFY event.             
+        RArray<TUpnpContainerUpdateId>  iCurrentContainerUpdateIds;
+        // this tells if statevariable is evented after last modification
+        TBool iContainerUpdateIdsEvented;
+        CUpnpContentDirectory* iCd;
+    };
+    
+
+#endif      // C_CUPNPSTATEHANDLER_H
+        
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnptablebean.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,67 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+#ifndef C_CUPNPTABLEBEAN_H
+#define C_CUPNPTABLEBEAN_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <d32dbms.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for tables' bean classes.
+*
+*  @lib ContentDirectory.lib
+*  @since Series60 3.1
+*/
+class CUpnpTableBean : public CBase
+{
+ public: 
+
+    // marks the value of the member has not yet been set i.e. has no value
+    static const TInt KUndef = -1;
+
+ protected: // New functions
+
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpTableBean();
+        
+    /**
+    * C++ default constructor.
+    */
+    CUpnpTableBean();
+
+    /**
+    * Reads the LONG VARCHAR (EDbColLongText) column's value.
+    * @since Series ?XX ?SeriesXX_version
+    * @param RowSet
+    * @param aColNo
+    * @return descriptors pointer
+    */
+    HBufC8* ReadLongTextColL(const RDbRowSet& aRowSet, const TInt aColNo);
+};
+
+#endif      // C_CUPNPTABLEBEAN_H
+        
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpthumbnailcreator.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,213 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares ThumbnailCreator class.
+*
+*/
+
+
+
+#ifndef C_CUPNPTHUMBNAILCREATOR_H
+#define C_CUPNPTHUMBNAILCREATOR_H
+
+//INCLUDE
+#include <e32base.h>
+#include <f32file.h>
+#include <gulicon.h>
+#include <mdaimageconverter.h>
+#include "upnpcontentdirectoryglobals.h"
+
+
+//FORWARD DECLARATIONS
+class CImageEncoder;
+class CImageDecoder;
+class CBitmapScaler;
+class CFbsBitmap;
+class CUpnpThumbnailCreator;
+class MUpnpThumbnailCreatorObserver;
+
+
+/**
+*  @brief Thumbnail Creator Observer
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+class MUpnpThumbnailCreatorObserver
+{ 
+public:
+    /*
+    *
+    * @since Series S60 3.1
+    * @param aThCreator
+    * @param Result
+    */
+    virtual void NotifyThumbnailResultL(CUpnpThumbnailCreator* aThCreator, TInt aResult ) = 0;
+};
+
+
+
+/**
+*  @brief Thumbnail Creator
+*
+*  @lib AVContentDirectory.lib
+*  @since Series60 3.1
+*/
+NONSHARABLE_CLASS( CUpnpThumbnailCreator ): public CActive
+    {
+public:
+
+    enum TPhase
+    {
+        EDecode,
+        EEncode,
+        EScaling,
+        ESleep,
+        EDecodeObject
+    };
+
+
+    /**
+    * Two-phased constructor for building CUpnpThumbnailCreator.
+    * @since Series60 3.1
+    * @param aObserver
+    */
+    static CUpnpThumbnailCreator* NewLC( MUpnpThumbnailCreatorObserver* aObserver );
+
+    /**
+    * Destructor function; called automatically from the destructor of a 
+    * derived class
+    **/
+    ~CUpnpThumbnailCreator();
+
+
+    /**
+    * Function creates thumbnail for given image file
+    * @since Series60 3.1
+    * @param aSourceFile full file name
+    **/
+    void CreateL( const TDesC& aSourceFile, const TDesC& aThumbName );
+
+    /**
+    *
+    * @since Sereries S60 3.1
+    */
+    TFileName GetFileName();
+
+    /**
+    *
+    * @since Sereries S60 3.1
+    */
+    TPtrC GetFileExt();
+
+    /**
+    * Getter for file size 
+    */
+    TFileName GetPath();
+    
+    /**
+    * Getter for file size 
+    **/
+    TSize GetSize(const TDesC& aSourceFile);
+
+private:
+
+    /**
+    * By default Symbian 2nd phase constructor is private
+    * @since Series60 3.1
+    */     
+    void ConstructL();
+
+    /**
+    * First phase constructor.
+    * @param aObserver - pointer to observer
+    * @since Series60 3.1
+    **/
+    CUpnpThumbnailCreator( MUpnpThumbnailCreatorObserver* aObserver );
+
+    /**
+    * Encode bitmap to jpeg and writes it to file.
+    * @since Series60 3.1
+    **/
+    void EncodeAndConvertL();
+
+    /**
+    * Implementation of pure virtual from CActive
+    * serves decoding phases completion
+    * @since Series60 3.1
+    */
+    void RunL();
+
+    /**
+    * Implementation of virtual from CActive
+    * serves decoding phases completion
+    * @since Series60 3.1
+    */
+    TInt RunError(TInt aErr);
+
+    /**
+    * Implementation of pure virtual from CActive
+    * @since Series60 3.1
+    */
+    void DoCancel();
+
+    /**
+    * Calculate resizing ratio (2,4 and 8) for decoder
+    * in order not to create big bitmaps into memory 
+    * @param aLoadSize - function stores computed size in it
+    * @since Series60 3.1
+    */
+    void CalculateSize( TSize& aLoadSize );
+
+    /**
+    * Used internally by CalculateSize
+    * @since Series60 3.1
+    */
+    TInt DivisionCeil( const TInt aVal, const TInt aDiv );
+
+
+private:
+    //Observer
+    MUpnpThumbnailCreatorObserver* iObserver;
+    //File server
+    RFs                     iFs;
+    //Image decoder
+    CImageDecoder*          iDecoder;
+    //Image encoder
+    CImageEncoder*          iEncoder;
+    //Scaler
+    CBitmapScaler*          iScaler;
+    //Bitmap
+    CFbsBitmap*             iBitmap;
+    //Bitmap default size
+    TSize                   iSize;
+
+    // Parser
+    TParse                  iParse;
+    // Extension
+    TBuf<KExtensionLength>  iExtension;
+    //State enum
+    TPhase                  iPhase;
+    //File name e.g. pic.jpg
+    TFileName               iFileName;
+    //Path
+    TPath                   iPath;
+    //Image type uid
+    TUid                    iImageType;
+    //Old image size 
+    TSize                   iOldSize; 
+    //frame info
+    TFrameInfo              iInfo;
+    };
+
+#endif  // C_CUPNPTHUMBNAILCREATOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnptransferbase.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,127 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  class for sending/receiving HTTP request/response 
+*                using Symbian HTTP client 
+*
+*/
+
+
+#ifndef C_CUPNPTRANSFERBASE_H
+#define C_CUPNPTRANSFERBASE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "httptransferobserver.h"
+#include "upnptransferobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpContentDirectory;
+class CHttpTransferBase;
+class MUpnpTransferObserver;
+
+const TInt KDefaultAccessPoint = 11;
+const TInt KDefaultBuffer = 64000;
+const TInt KNumOfConcurrentTransactions = 2;
+
+class CUpnpTransferBase: public CBase , public MHttpTransferObserver
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpTransferBase();
+
+// from base class  MHttpTransferObserver
+
+   virtual void ReadyForTransferL( TAny* aKey);
+     
+   /**
+    * Gets transfer progress callback
+    *
+    * @since S60 v3.2
+    * @param aKey the file identifier
+    * @param aBytes transferred
+    * @param aTotalBytes all bytes to be transferred
+    */
+   virtual void TransferProgress( TAny* aKey, 
+                                  TInt aBytes, 
+                                  TInt aTotalBytes );
+                                   
+   virtual void TransferCompleted( TAny* aKey, TInt aStatus );     
+
+
+
+
+public: // New functions
+
+     /**
+     * Creates new CHttpFile object and adds it to the iFileQueue
+     *
+     * @since S60 v3.2
+     * @param aUri Uri of the downloaded object
+     * @param aTargetPath Local path of the object
+     * @param aKey Identifier of the object
+     */
+    void CreateAndQueueHttpFileL( const TDesC8& aUri, 
+                                  const TDesC& aTargetPath, 
+                                  TInt aKey );
+    
+    /**
+    * Sets a header
+    *
+    * @since S60 v3.2
+    * @param aKey the file identifier
+    * @param aFieldName The field name, e.g. 'Content-Type'
+    * @param aFieldValue The field value. e.g. 'text/plain'
+    */
+    void SetHeaderL( TInt aKey,
+                     const TDesC8& aFieldName, 
+                     const TDesC8& aFieldValue );
+    
+    /**
+    * Turns on/off transfer progress callbacks
+    *
+    * @since S60 v3.2
+    * @param aKey the file identifier
+    * @param aSwitchOn tuning on/off    
+    */
+    void TrackProgess(TInt aKey, TBool aSwitchOn);   
+          
+
+    /**
+    * cancels transfer
+    *
+    * @since S60 v3.2
+    * @param aKey the file identifier   
+    */         
+    virtual void CancelTransfer( TInt aKey);     
+  
+ protected: 
+    /**
+    * C++ default constructor.
+    */
+    CUpnpTransferBase( MUpnpTransferObserver* aCd );
+    
+    // new functions
+    TInt MapStatus( TInt aErrorCode );
+    
+ protected:    // Data
+    MUpnpTransferObserver* iObserver;
+    CHttpTransferBase* iHttpTransferBase;
+    
+    
+};
+
+#endif // C_CUPNPTRANFERBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnptransfercontroller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,154 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef C_CUPNPTRANSFERCONTROLLER_H
+#define C_CUPNPTRANSFERCONTROLLER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "upnpnotifytimer.h"
+#include "upnperrors.h"
+#include "upnpfiletransfer.h"
+#include "upnpfiletransfertimerobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpContentDirectory;
+class CUpnpFileTransferEvent;
+class CUpnpHttpMessage;
+
+/**
+*  This is a class controlling upload and downloads
+*
+*  @lib ContentDirectory
+*  @since Series 60 2.6
+*/
+class CUpnpTransferController: public CBase, public MUpnpFileTransferTimerObserver
+{
+public: // Constructors and destructors
+
+    /**
+    * Two-phased constructor 
+    * @since Series60 2.6
+    * @param aService Parent service 
+    */
+    static CUpnpTransferController* NewL( CUpnpContentDirectory* aCd );
+
+
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpTransferController();
+
+     /**
+    * This functions is a entry point for http messages.
+    * received from Symbian HTTP Stack
+    * @since Series 60 3.2
+    * @param aSessionId identifier of the HTTP request.
+    * @param aHttpStatusCode HTTP error code.
+    */
+    void HttpResponseReceivedL( TInt aSessionId,
+                                TInt aStatusCode);   
+                                
+    /** 
+    * Function for stopping ongoing file transfer (import / export)
+    * @since Series 60 2.6
+    * @param aAction received action
+    * @retrun upnperrorcode descriping situation
+    **/
+    TUpnpErrorCode StopTransferResourceL( TInt aId ); 
+    
+    
+    /**
+    * This function return a file transfer from CDs list.
+    * @since Series 60 2.6
+    * @param aTransferId transferid to be checked
+    * @return TUpnpFileTransfer.
+    */
+    TInt Transfer( TInt aTransferId );
+    
+    /**
+    * This functions returns export/import file transfers which are in progress state       
+    * @param aResult number of file transfers in progress state 
+    */
+    TBool IsMaxImportExportTransfers();
+        
+    /**
+    * This function removes a file transfer event from list and return it.
+    * @since Series 60 2.6
+    * @param aTransferId transferid to be checked
+    * @return TUpnpFileTransfer.
+    */
+    CUpnpFileTransferEvent* RemoveTransferLC( TInt aTransferId );
+    
+    CUpnpFileTransferEvent* TransferL( TInt aTransferId );
+
+    /**
+    * Callback for filetransfer timer events
+    * @since Series 60 2.6
+    * @return Error code
+    */
+    void TransferEvent( CUpnpFileTransferTimerObserver* aTimer );
+    
+     /**
+    * Append transfer to transfer list for eventing purpose        
+    * @param aHttpMsg 
+    */
+    void AddIncomingTransferInternalL(CUpnpHttpMessage* aHttpMsg);
+    
+    void TransferFailL(CUpnpHttpMessage* aHttpMsg);
+
+     /**
+    * Sends transfer failed event to Media Server       
+    * @param aHttpMsg 
+    */
+    void NotifyTransferFailL(CUpnpHttpMessage* aHttpMsg);
+                                
+private:
+    /**
+    * C++ default constructor.
+    */
+    CUpnpTransferController( CUpnpContentDirectory* aCd );
+    
+    /**
+    * Second phase of the constructor.
+    * Initialises a DOM tree.
+    * By default Symbian 2nd phase constructor is private.
+    * @param service Parent service
+    */
+    void ConstructL();
+    
+
+
+public: 
+
+    //array for filetransfers  
+    RPointerArray<CUpnpFileTransfer> iFileTransfers;
+    
+    
+    RPointerArray<CUpnpFileTransferTimerObserver> iStatusTimers;
+
+    
+private: 
+    CUpnpContentDirectory* iContentDirectory;
+           
+    };
+
+#endif      // C_CUPNPTRANSFERCONTROLLER_H 
+        
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnptransferdownloader.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,78 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  class for sending HTTP request using Symbian HTTP client 
+*
+*/
+
+
+#ifndef C_CUPNPTRANSFERDOWNLOADER_H
+#define C_CUPNPTRANSFERDOWNLOADER_H
+
+// INCLUDES
+#include "upnptransferbase.h"
+#include "upnpsender.h"
+#include "upnpfiletransfer.h"
+
+// FORWARD DECLARATIONS
+class CHttpDownloader;
+
+class CUpnpTransferDownloader: public CUpnpTransferBase
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpTransferDownloader* NewLC( MUpnpTransferObserver* aCd );
+    static CUpnpTransferDownloader* NewL( MUpnpTransferObserver* aCd );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpTransferDownloader();
+
+public: // New functions
+ 
+    /**
+     * Method for downloading the file. Creates and enqueues the file
+     *
+     */
+    void DownloadFileL(const TDesC8& aUri,
+                       const TDesC& aTargetPath, 
+                       TInt aKey);
+     /**
+     * Method for downloading the file. Creates and enqueues the file
+     *
+     * @since S60 v3.2
+     */
+     void DownloadFileL( TInt aKey );
+
+ private: 
+    /**
+    * C++ default constructor.
+    */
+    CUpnpTransferDownloader( MUpnpTransferObserver* aCd );
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+ private:    // Data
+
+};
+
+#endif // C_CUPNPTRANSFERDOWNLOADER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnptransferhandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,117 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef C_CUPNPTRANSFERHANDLER_H
+#define C_CUPNPTRANSFERHANDLER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "upnpnotifytimer.h"
+#include "upnperrors.h"
+#include "upnpfiletransfertimerobserver.h"
+#include "upnptransferinterface.h"
+#include "upnptransferobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpContentDirectory;
+class CUpnpTransferDownloader;
+class CUpnpTransferUploader;
+
+
+/**
+*  This is a facade class used for communication between CD and uploader/downloader
+*
+*  @lib ContentDirectory
+*  @since Series 60 2.6
+*/
+class CUpnpTransferHandler: public CBase,
+                            public MUpnpTransferInterface,
+                            public MUpnpTransferObserver
+    {
+public: // Constructors and destructors
+
+    /**
+    * Two-phased constructor
+    * @since Series60 2.6
+    * @param aService Parent service
+    */
+    static CUpnpTransferHandler* NewL( );
+
+
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpTransferHandler();
+
+    void SetObserver( MUpnpTransferObserver* aObserver );
+
+public: // form MUpnpTransferInterface
+
+    virtual void UploadFileL( TInt aKey,
+                              const TDesC8& aUri,
+                              const TDesC& aTargetPath,
+                              const TDesC8& aContentType
+                             );
+
+    virtual void DownloadFileL( TInt aKey,
+                                const TDesC8& aUri,
+                                const TDesC& aTargetPath
+                              );
+
+    virtual void TrackUploadProgress( TInt aKey, TBool aSwitchOn );
+
+    virtual void TrackDownloadProgress( TInt aKey, TBool aSwitchOn );
+
+    virtual void CancelUpload( TInt aKey );
+
+    virtual void CancelDownload( TInt aKey );
+
+public: // form MUpnpTransferObserver
+
+    virtual void TransferCompletedL( TInt aKey, TInt aResultCode );
+
+    virtual void TransferProgress( TInt akey,
+                                   TInt aBytes,
+                                   TInt aTotalBytes);
+
+protected:
+    /**
+    * C++ default constructor.
+    */
+    CUpnpTransferHandler();
+
+    /**
+    * Second phase of the constructor.
+    * Initialises a DOM tree.
+    * By default Symbian 2nd phase constructor is private.
+    * @param service Parent service
+    */
+    void ConstructL();
+
+private:
+    MUpnpTransferObserver* iObserver;
+
+    CUpnpTransferDownloader* iDownloader;
+
+    CUpnpTransferUploader* iUploader;
+    };
+
+#endif      // C_CUPNPTRANSFERHANDLER_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnptransferinterface.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,56 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef C_CUPNPTRANSERINTERFACE_H
+#define C_CUPNPTRANSERINTERFACE_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// Transfer interface for handling transfer
+class MUpnpTransferInterface
+    {
+ public:
+    virtual void UploadFileL( TInt aKey,
+                              const TDesC8& aUri,
+                              const TDesC& aTargetPath,
+                              const TDesC8& aContentType
+                              ) = 0;
+                        
+    virtual void DownloadFileL( TInt aKey,
+                                const TDesC8& aUri,
+                                const TDesC& aTargetPath 
+                                ) = 0;
+                            
+    virtual void TrackUploadProgress( TInt aKey, 
+                                TBool aSwitchOn )=0;
+
+    virtual void TrackDownloadProgress( TInt aKey, 
+                                TBool aSwitchOn )=0;
+                                  
+    virtual void CancelUpload( TInt aKey ) = 0;                                  
+    
+    virtual void CancelDownload( TInt aKey ) = 0;
+    
+    };
+
+    
+#endif      // C_CUPNPTRANSERINTERFACE_H 
+        
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnptransferobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,39 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef C_CUPNPTRANSFEROBSERVER_H
+#define C_CUPNPTRANSFEROBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// Transfer interface for handling transfer
+class MUpnpTransferObserver
+    {
+ public:                                                          
+    virtual void TransferCompletedL( TInt akey, TInt aResultCode ) = 0;   
+    
+    virtual void TransferProgress( TInt akey, 
+                                   TInt aBytes,
+                                   TInt aTotalBytes) = 0;                                      
+    };
+
+#endif      // C_CUPNPTRANSFEROBSERVER_H 
+        
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnptransferuploader.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,84 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  class for receiving HTTP response using Symbian HTTP client 
+*
+*/
+
+
+#ifndef C_CUPNPTRANSFERUPLOADER_H
+#define C_CUPNPTRANSFERUPLOADER_H
+
+// INCLUDES
+#include "upnptransferbase.h"
+
+// FORWARD DECLARATIONS
+class CHttpUploader;
+
+class CUpnpTransferUploader: public CUpnpTransferBase
+{
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CUpnpTransferUploader* NewLC( MUpnpTransferObserver* aCd );
+    static CUpnpTransferUploader* NewL( MUpnpTransferObserver* aCd );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CUpnpTransferUploader();
+    
+public: // New functions
+ 
+    /**
+     * Method for uploading the file. Creates and enqueues the file
+     *
+     * @since S60 v3.2
+     */
+    void UploadFileL(TInt aKey);
+    
+    /**
+     * Empty implementation
+     *
+     */
+    void DownloadFileL(const TDesC8& aUri,
+                       const TDesC& aTargetPath, 
+                       TInt aKey);
+    
+    /**
+     * Method for uploading the file. Creates and enqueues the file
+     *
+     */                   
+    void UploadFileL( const TDesC8& aUri,const TDesC& aTargetPath,
+                        const TDesC8& aContentType, TInt aKey);                       
+                                                
+
+ private: 
+    /**
+    * C++ default constructor.
+    */
+    CUpnpTransferUploader( MUpnpTransferObserver* aCd );
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+ private:    // Data
+};
+
+#endif // C_CUPNPTRANSFERUPLOADER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/inc/upnpxmlcontentfilter.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Xml responses serialization filter
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <xmlengdom.h>
+#include <xmlengnodefilter.h>
+
+//using namespace Xml;
+
+/**
+*  @brief Xml responses serialization filter
+*
+*  @lib ContentDirectory.lib
+*  @since Series60 3.2
+*/
+class CUpnpXmlContentFilter : public CBase, MXmlEngNodeFilter
+    {
+public: // from MXmlEngNodeFilter
+
+    /**
+    * Filters node by type CDATA and comments are rejected
+    * @since Series60 3.2
+    * @param aNode node
+    */    
+    virtual TXmlEngNodeFilterResult AcceptNode(TXmlEngNode aNode);
+    
+public:
+        
+    /**
+    * Aplies filter and serializes aElement to descriptor 
+    * @since Series60 3.2
+    * @param aService Parent service 
+    */
+    static HBufC8* SerializeLC(RXmlEngDocument& aDoc, TXmlEngElement& aElement );
+
+    };
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/dlna/upnpdlnafilter.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,901 @@
+/** @file
+ * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpDlnaFilter implementation.
+ *
+ */
+// INCLUDES
+#include <bautils.h> 
+#include "upnpdlnafilter.h"
+#include "upnpstring.h"
+#include "upnpcons.h"
+#include "upnpcontentdirectorydatafinder.h"
+#include "upnphttpmessage.h"
+#include "upnpdlnaprotocolinfo.h"
+#include "upnpfileutils.h"
+#include "upnpsecuritymanager.h"
+#define KLogFile _L("DLNAWebServer.txt")
+#include "upnpcustomlog.h"
+#include "upnphttpfilereceivetransaction.h"
+#include "upnphttpfileservetransaction.h"
+#include "upnpdlnafilterheaders.h"
+#include "upnpcommonupnplits.h"
+#include "upnpdlnacorelation.h"
+
+// CONSTANTS
+_LIT8( KDlnaFilter, "DLNA");
+_LIT8( KIpPortPlaceholder8, "___.___.___.___:_____" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::CUpnpDlnaFilter
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaFilter::CUpnpDlnaFilter( MUpnpContentDirectoryDataFinder* aFinder,
+    CUpnpSecurityManager* aSecurityManager ) :
+    iCdDataFinder( aFinder ), iSecurityManager( aSecurityManager )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::~CUpnpDlnaFilter
+// C++ default destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaFilter::~CUpnpDlnaFilter()
+    {
+    iFs.Close();
+    delete iProtocolInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaFilter* CUpnpDlnaFilter::NewLC(
+    MUpnpContentDirectoryDataFinder* aFinder,
+    CUpnpSecurityManager* aSecurityManager )
+    {
+    CUpnpDlnaFilter* self = new (ELeave) CUpnpDlnaFilter( aFinder,
+        aSecurityManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaFilter* CUpnpDlnaFilter::NewL(
+    MUpnpContentDirectoryDataFinder* aFinder,
+    CUpnpSecurityManager* aSecurityManager )
+    {
+    CUpnpDlnaFilter* self =
+            CUpnpDlnaFilter::NewLC( aFinder, aSecurityManager );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::ConstructL
+// EPOC default constructor for performing 2nd stage construction.
+// -----------------------------------------------------------------------------
+//
+void CUpnpDlnaFilter::ConstructL()
+    {
+    User::LeaveIfError( iFs.Connect() );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::SecurityManager
+// 
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManager* CUpnpDlnaFilter::SecurityManager()
+    {
+    return iSecurityManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::CheckImportUriL
+// Checks if specified URI exists in database and returns object id for
+//      given URI or KErrNotFound if URI is no registered in database.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpDlnaFilter::CheckImportUriL( TDesC8& aImportUri )
+    {
+    TInt lastPosOfSlash = aImportUri.LocateReverse( '/' );
+    if ( lastPosOfSlash < 0 )
+        {
+        return KErrGeneral;
+        }
+    HBufC8* path = aImportUri.AllocLC();
+    TInt result = KErrNone;
+    result = iCdDataFinder->CheckImportUriL( path->Des() );
+    CleanupStack::PopAndDestroy( path );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::Get3rdFieldFromCdL
+// Find protocolInfo by contentUri (Not by importUri) and extract 3rd field,
+//      using ContentDirectory.
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpDlnaFilter::ThirdFieldFromCdL( const TDesC8& aContentUri )
+    {
+    HBufC8* result = NULL;
+    CUpnpDlnaProtocolInfo* protocolInfo = ProtocolInfoL( aContentUri );
+    if ( protocolInfo )
+        {
+        TPtrC8 thirdField = protocolInfo->ThirdField();
+        if ( thirdField != KNullDesC8() )
+            {
+            result = thirdField.AllocL();
+            }
+        }
+    delete protocolInfo;
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::ProtocolInfoL
+// 
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaProtocolInfo* CUpnpDlnaFilter::ProtocolInfoL( const TDesC8& aContentUri )
+    {
+    //  "http:/:/" prefix is added to content path to provide backward 
+    // compatibility with old testing tools
+    HBufC8* fullContentUri = HBufC8::NewL( UpnpHTTP::KHTTPUrl().Length()
+            + KIpPortPlaceholder8().Length() + aContentUri.Length() );
+    CleanupStack::PushL( fullContentUri );
+    
+    fullContentUri->Des().Append( UpnpHTTP::KHTTPUrl );
+    fullContentUri->Des().Append( KIpPortPlaceholder8 );
+    fullContentUri->Des().Append( aContentUri );
+    
+    CUpnpDlnaProtocolInfo* protocolInfo = NULL;
+    if ( iCdDataFinder->GetProtocolInfoL( *fullContentUri, protocolInfo ) != KErrNone )
+        {
+        delete protocolInfo;
+        protocolInfo = NULL;
+        }
+    CleanupStack::PopAndDestroy( fullContentUri );
+    return protocolInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::GetMediaFileNameL
+// Gets name of file with content for given object's id.
+// -----------------------------------------------------------------------------
+//
+void CUpnpDlnaFilter::GetMediaFileNameL( TInt aObjectId, TPtr& aFileName )
+    {
+    if ( aObjectId <= KErrNone )
+        {
+        return;
+        }
+    iCdDataFinder->GetTitleForUriL( aObjectId, aFileName );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::FindSharedFolderDBL
+// Find a folder shared from DB (ContentDirectory).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpDlnaFilter::FindSharedFolderDBL( const TDesC8& aUrlPath,
+    const TDesC8& aFileName, HBufC8*& aSystemPath )
+    {
+    HBufC* unicodeSharedFolder = NULL;
+    TInt result = KErrNone;
+    HBufC16* urlPathUnicode = UpnpString::ToUnicodeL( aUrlPath );
+    CleanupStack::PushL( urlPathUnicode );
+    HBufC16* fileNameUnicode = UpnpString::ToUnicodeL( aFileName );
+    CleanupStack::PushL( fileNameUnicode );
+
+    result = iCdDataFinder->FindSharedFolderL( *urlPathUnicode,
+        *fileNameUnicode, unicodeSharedFolder );
+    if ( unicodeSharedFolder )
+        {
+        CleanupStack::PushL( unicodeSharedFolder );
+        HBufC8* sharedFolder =
+                UpnpString::FromUnicodeL( *unicodeSharedFolder );
+        CleanupStack::PopAndDestroy( unicodeSharedFolder );
+        aSystemPath = sharedFolder;
+        }
+
+    CleanupStack::PopAndDestroy( fileNameUnicode );
+    CleanupStack::PopAndDestroy( urlPathUnicode );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpDlnaFilter::CheckDLNAPostCorrelationsL
+//
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpDlnaFilter::CheckDLNAPostCorrelationsL( CUpnpHttpFileReceiveTransaction& aTransaction )
+    {
+    TPtrC8 contentURI = aTransaction.SenderUri();
+    HBufC8* decodedContentURI = HBufC8::NewLC( contentURI.Length() );
+    TPtr8 ptrDecodedContentURI = decodedContentURI->Des();
+    ptrDecodedContentURI.Copy( contentURI );
+    UpnpString::ReplaceHttpCharacters( ptrDecodedContentURI );
+
+    TBool streamingSupport = 0;
+    TBool interactiveSupport = 0;
+
+    CUpnpDlnaProtocolInfo* protocolInfo = NULL;
+    TRAPD( error, protocolInfo =
+            iCdDataFinder->GetProtocolInfoByImportUriL( *decodedContentURI ) );
+    CleanupStack::PopAndDestroy( decodedContentURI );
+    if ( error )
+        {
+        if ( error == ERestrictedObject || error == ERestrictedParentObject )
+            {
+            return -EHttpForbidden;
+            }
+        else if ( error == ENoSuchObject )
+            {
+            return -EHttpNotFound;
+            }
+        else
+            {
+            return -EHttpBadRequest;
+            }
+        }
+    CleanupStack::PushL( protocolInfo );
+    if ( protocolInfo->FourthField().Find( KDlnaFilter ) == KErrNotFound )
+        {
+        aTransaction.FilterHeaders().RemoveHeaderL( UpnpDLNA::KHdrTransferMode );
+        CleanupStack::PopAndDestroy( protocolInfo );
+        return KErrNone;
+        }
+    else
+        {
+        streamingSupport = protocolInfo->DlnaFlag(
+            UpnpDlnaProtocolInfo::TM_S_FLAG );
+        interactiveSupport = protocolInfo->DlnaFlag(
+            UpnpDlnaProtocolInfo::TM_I_FLAG );
+        CleanupStack::PopAndDestroy( protocolInfo );
+        }
+
+    TDesC8& transferMode = aTransaction.FilterHeaders().QueryHeader(
+                           UpnpDLNA::KHdrTransferMode );
+
+    if ( transferMode.Length() > 0 )
+        {
+        if ( (transferMode.CompareC( UpnpDLNA::KTransferModeStreaming ) == 0
+                && !streamingSupport) || (transferMode.CompareC(
+            UpnpDLNA::KTransferModeInteractive ) == 0 && !interactiveSupport) )
+            {
+            return -EHttpNotAcceptable;
+            }
+
+        if ( transferMode.CompareC( UpnpDLNA::KTransferModeStreaming ) != 0
+                && transferMode.CompareC( UpnpDLNA::KTransferModeInteractive )
+                        != 0 && transferMode.CompareC(
+            UpnpDLNA::KTransferModeBackground ) != 0 )
+            {
+            return -EHttpBadRequest;
+            }
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpDlnaFilter::CheckDLNACorrelations
+//
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpDlnaFilter::CheckDLNACorrelationsL( CUpnpHttpFileServeTransaction& aTransaction )
+    {
+    TPtrC8 contentURI = aTransaction.SenderUri() ;
+    HBufC8* decodedContentURI = HBufC8::NewL( contentURI.Length() );
+    TPtr8 ptrDecodedContentURI = decodedContentURI->Des();
+    ptrDecodedContentURI.Copy( contentURI );
+    UpnpString::ReplaceHttpCharacters( ptrDecodedContentURI );
+    CleanupStack::PushL( decodedContentURI );
+    delete iProtocolInfo;
+    iProtocolInfo = NULL;
+    iProtocolInfo = ProtocolInfoL( *decodedContentURI );
+    CleanupStack::PopAndDestroy( decodedContentURI );    
+    TPtrC8 fourthField( KNullDesC8 );
+    if ( iProtocolInfo )
+        {
+        fourthField.Set( iProtocolInfo->FourthField() );
+        }
+
+    if ( fourthField.Find( KDlnaFilter ) == KErrNotFound )
+        {
+        aTransaction.FilterHeaders().RemoveHeaderL( UpnpDLNA::KHdrTransferMode );
+        return KErrNone;
+        }
+
+    TUpnpDlnaCorelation dlnaCorelation;
+    dlnaCorelation.iFourthField.Set( fourthField );
+
+    TInt corelationError = CheckCorelationL( aTransaction, dlnaCorelation );
+    if ( corelationError != KErrNone )
+        {
+        return corelationError;
+        }
+    corelationError = CheckTransferModeL( aTransaction, dlnaCorelation );
+    if ( corelationError != KErrNone )
+        {
+        return corelationError;
+        }    
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpHttpServer::CheckCorelationL
+// -----------------------------------------------------------------------------
+//    
+TInt CUpnpDlnaFilter::CheckCorelationL(  CUpnpHttpFileServeTransaction& aTransaction,
+                                         TUpnpDlnaCorelation& aDlnaCorelation )
+    {
+    //-------------Checking DLNA correlations, response with HTTPerror if some problem occurs
+    // DLNA v0.75, 7.3.31.1 checking Operations Parameter    
+    if (
+    // We don't support timeSeek and playSpeed at the moment, so according to point 7.4.71.1 (ver 1.5 rev 0.96)
+    ((aTransaction.QueryRequestHeader( UpnpDLNA::KHdrTimeSeekRange ) != KNullDesC8()
+            || aTransaction.QueryRequestHeader( UpnpDLNA::KHdrPlaySpeed )
+                    != KNullDesC8()) &&
+    // 7.4.71.2 - range takes precedence
+                    aTransaction.QueryRequestHeader( UpnpHTTP::KHdrRange ) == KNullDesC8())
+            ||
+            //
+            // or if request mode is Streaming and
+            (aTransaction.QueryRequestHeader( UpnpDLNA::KHdrTransferMode ). CompareC(
+                UpnpDLNA::KTransferModeStreaming ) == 0 && (
+            // if we have no protocolInfo (because for example there is no cdDataFinder )
+                    !iProtocolInfo ||
+                    // Streaming is not supported for this content type
+                            iProtocolInfo -> DlnaFlag(
+                                UpnpDlnaProtocolInfo::TM_S_FLAG ) == EFalse)) )
+        {
+        // we respond with 406 error code - Not Acceptable.
+        return -EHttpNotAcceptable;
+        }
+
+    aDlnaCorelation.iStreamingSupport = EFalse;
+    aDlnaCorelation.iInteractiveSupport = EFalse;
+    aDlnaCorelation.iBackgrondSupport = EFalse;
+    aDlnaCorelation.iGetContentFeaturesExist = EFalse;
+    aDlnaCorelation.iGetContentFeaturesIsOK = ETrue;
+    
+    // We can only check for getcontentFeaturesExist if we have cdDataFinder ( protocolInfo is not null )
+    if ( iProtocolInfo )
+        {
+        aDlnaCorelation.iBackgrondSupport = 1;
+        aDlnaCorelation.iStreamingSupport = iProtocolInfo->DlnaFlag(
+            UpnpDlnaProtocolInfo::TM_S_FLAG );
+        aDlnaCorelation.iInteractiveSupport = iProtocolInfo->DlnaFlag(
+            UpnpDlnaProtocolInfo::TM_I_FLAG );
+        if( aTransaction.QueryRequestHeader( UpnpDLNA::KHdrGetcontentFeatures() ) != KNullDesC8() )
+            {
+            aDlnaCorelation.iGetContentFeaturesExist = ETrue;
+            }
+        if( aDlnaCorelation.iGetContentFeaturesExist )
+            {
+            TDesC8& cntHeaderValue = aTransaction.QueryRequestHeader(
+                                 UpnpDLNA::KHdrGetcontentFeatures() );
+            if ( cntHeaderValue != UpnpDLNA::KHdrGetcontentFeaturesValue() )
+                {
+                aDlnaCorelation.iGetContentFeaturesIsOK = EFalse;
+                }
+            }
+        }
+    
+    // Append contentFeatures.dlna.org
+    if ( aDlnaCorelation.iGetContentFeaturesExist )
+        {
+        if ( aDlnaCorelation.iFourthField.Length() > 0 )
+            {
+            aTransaction.FilterHeaders().AddHeaderL( UpnpDLNA::KHdrContentFeatures,
+                                                     aDlnaCorelation.iFourthField );
+            }
+        }
+    return KErrNone;    
+    }        
+        
+// -----------------------------------------------------------------------------
+// CUpnpHttpServer::CheckTransferMode
+// -----------------------------------------------------------------------------
+//        
+TInt CUpnpDlnaFilter::CheckTransferModeL( CUpnpHttpFileServeTransaction& aTransaction,
+                                         TUpnpDlnaCorelation& aDlnaCorelation )
+    {
+     TDesC8& transferMode = aTransaction.QueryRequestHeader( UpnpDLNA::KHdrTransferMode );
+    // Check if requested transfer mode is handled
+    if (
+    // if client requested for transfer is not empty
+    (transferMode.Length() > 0 && (
+    // and if client requested for transfer is different than Background, Streaming or Interactive mode, reply with 400 error
+            (transferMode.CompareC( UpnpDLNA::KTransferModeStreaming ) != 0
+                    && transferMode.CompareC(
+                        UpnpDLNA::KTransferModeInteractive ) != 0
+                    && transferMode.CompareC(
+                        UpnpDLNA::KTransferModeBackground ) != 0) ||
+            // If Background or Interactive mode was requested, check if request doesn;t contain forbidden headers
+                    ((transferMode.CompareC(
+                        UpnpDLNA::KTransferModeBackground ) == 0
+                            || transferMode.CompareC(
+                                UpnpDLNA::KTransferModeInteractive ) == 0)
+                            && (aTransaction.QueryRequestHeader(
+                                UpnpDLNA::KHdrTimeSeekRange ) != KNullDesC8()
+                                    || aTransaction.QueryRequestHeader(
+                                        UpnpDLNA::KHdrPlaySpeed )
+                                            != KNullDesC8()
+                                    || aTransaction.QueryRequestHeader(
+                                        UpnpDLNA::KHdrRealTimeInfo )
+                                            != KNullDesC8())))) || (
+    
+        aTransaction.QueryRequestHeader( UpnpHTTP::KHdrRange ) == KNullDesC8()
+                && transferMode.Length() == 0 && (aTransaction.QueryRequestHeader(
+            UpnpDLNA::KHdrTimeSeekRange ) != KNullDesC8()
+                || aTransaction.QueryRequestHeader( UpnpDLNA::KHdrPlaySpeed )
+                        != KNullDesC8() || aTransaction.QueryRequestHeader(
+            UpnpDLNA::KHdrRealTimeInfo ) != KNullDesC8()))
+                || !aDlnaCorelation.iGetContentFeaturesIsOK
+    
+        )
+            {
+            return -EHttpBadRequest ;
+            }
+    
+    return AppendCorelationHeadersL( aTransaction, aDlnaCorelation, transferMode );    
+    }    
+
+// -----------------------------------------------------------------------------
+// CUpnpHttpServer::AppendCorelationHeaders
+// -----------------------------------------------------------------------------
+//        
+TInt CUpnpDlnaFilter::AppendCorelationHeadersL( CUpnpHttpFileServeTransaction& aTransaction,
+                             TUpnpDlnaCorelation& aDlnaCorelation, TDesC8& aTransferMode )
+    {
+    if ( aTransferMode.Length() > 0 && ((aTransferMode.CompareC(
+        UpnpDLNA::KTransferModeStreaming ) == 0 && !aDlnaCorelation.iStreamingSupport)
+            || (aTransferMode.CompareC( UpnpDLNA::KTransferModeInteractive )
+                    == 0 && !aDlnaCorelation.iInteractiveSupport)) )
+        {
+        return -EHttpNotAcceptable ;
+        }
+    else if ( aTransferMode.Length() <= 0 )
+        {
+        if ( aDlnaCorelation.iStreamingSupport )
+            {
+            aTransaction.FilterHeaders().AddHeaderL( UpnpDLNA::KHdrTransferMode,
+                    UpnpDLNA::KTransferModeStreaming );
+            }
+        else if ( aDlnaCorelation.iInteractiveSupport )
+            {
+            aTransaction.FilterHeaders().AddHeaderL( UpnpDLNA::KHdrTransferMode,
+                UpnpDLNA::KTransferModeInteractive );
+            }
+        else if ( aDlnaCorelation.iBackgrondSupport )
+            {
+            aTransaction.FilterHeaders().AddHeaderL( UpnpDLNA::KHdrTransferMode,
+                UpnpDLNA::KTransferModeBackground );
+            }
+        }
+     return KErrNone;   
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpHttpSession::FormatPathL
+//
+// -----------------------------------------------------------------------------
+//
+void CUpnpDlnaFilter::FormatPathL( CUpnpHttpFileServeTransaction *aTransaction, TDes &aPath )
+    {
+    LOGS( "%i, CUpnpHttpSession::FormatPathL " );
+
+    TPtrC8 contentURI = aTransaction->SenderUri();
+
+    HBufC8* decodedContentURI = HBufC8::NewL( contentURI.Length() );
+    TPtr8 ptrDecodedContentURI = decodedContentURI->Des();
+    ptrDecodedContentURI.Copy( contentURI );
+    UpnpString::ReplaceHttpCharacters( ptrDecodedContentURI );
+    CleanupStack::PushL( decodedContentURI );
+
+    //extracting URLpath (so removing IP, port )
+    TPtrC8 fileName;
+    TInt parseError( KErrNone );
+    TPtrC8 urlPath = UpnpFileUtil::ExtractUrlPath( ptrDecodedContentURI,
+        fileName, parseError );
+    if ( parseError )
+        {
+        User::Leave( -EHttpBadRequest );
+        }
+
+    HBufC8* sharedFolder = NULL;
+    TInt error = FindSharedFolderDBL( urlPath, fileName, sharedFolder );
+    CleanupStack::PushL( sharedFolder );            
+    if ( error == KErrNotFound || !sharedFolder )
+        {
+        User::Leave( -EHttpNotFound );
+        }
+    
+    //sharedFolder includes file name  
+    ASSERT( (*sharedFolder).Mid( (*sharedFolder).Length()
+            - UpnpString::KDoubleBackSlash().Length() )
+            != UpnpString::KDoubleBackSlash() );
+
+    HBufC* path16 = UpnpString::ToUnicodeL( *sharedFolder );
+    aPath.Copy( *path16 );
+    delete path16;
+    
+    CleanupStack::PopAndDestroy( sharedFolder );
+    CleanupStack::PopAndDestroy( decodedContentURI );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::GetContentTypeL()
+// Retrieves a mime type from the third field of the protocol info read from CD
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpDlnaFilter::GetContentTypeL( CUpnpHttpFileServeTransaction &aTransaction,
+    HBufC8*& aMime, const TDesC16& aFilename )
+    {
+    TInt error = KErrNone;
+
+    TParse parse;
+    parse.Set( aFilename, NULL, NULL );
+    TBufC16<KMaxName> ext( parse.Ext() );
+    //XML mime type has to be set seperately
+    if ( ext.FindC( KXml16 ) == 0 && ext.Length() == KXml16().Length() )
+        {
+        // Extension says that's XML but we check content to be sure and get encoding
+        _LIT8( KXmlUtf8, "text/xml; charset=\"utf-8\"" );
+        aMime = HBufC8::NewL( KXmlUtf8().Length() );
+        aMime->Des().Zero();
+        aMime->Des().Append( KXmlUtf8() );
+        return error;
+        }
+
+    //decoding content URI
+    TPtrC8 contentURI = aTransaction.SenderUri();
+    HBufC8* decodedContentURI = HBufC8::NewL( contentURI.Length() );
+    TPtr8 ptrDecodedContentURI = decodedContentURI->Des();
+    ptrDecodedContentURI.Copy( contentURI );
+    UpnpString::ReplaceHttpCharacters( ptrDecodedContentURI );
+    CleanupStack::PushL( decodedContentURI );
+
+    //getting 3rd field
+    aMime = ThirdFieldFromCdL( *decodedContentURI );
+    CleanupStack::PopAndDestroy( decodedContentURI );
+    // asterick as mime type is not good - so error is KErrNotFound
+    _LIT8( KAseriskType, "*" );
+    if ( (NULL == aMime) || ((*aMime) == KAseriskType()) )
+        {
+        delete aMime;
+        aMime = NULL;
+        error = KErrNotFound;
+        }
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::DetermineDownloadPathL
+//
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpDlnaFilter::DetermineDownloadPathL(
+    CUpnpHttpFileReceiveTransaction& aTransaction )
+    {
+    TPtrC8 path = aTransaction.SenderUri();
+    TInt parseError( KErrNone );
+    TPtrC8 urlPath = UpnpFileUtil::ExtractUrlPath( path, parseError );
+    if ( parseError )
+        {
+        User::Leave( EHttpBadRequest );
+        }
+
+    // if importURI is bad then doesn't check shared folder just return error.
+    TInt result = CheckImportUriL( path );
+    if ( KErrNone == result )
+        {
+        return KNullDesC().AllocL();
+        }
+    if ( result < KErrNone && result != KErrGeneral )
+        {
+        return NULL;
+        }
+    HBufC* fileName = HBufC::NewLC( KMaxFileName );
+    TPtr fileNamePtr( fileName->Des() );
+    GetMediaFileNameL( result, fileNamePtr );
+    
+    HBufC8* sharedFolder = NULL;
+    FindSharedFolderDBL( urlPath, KNullDesC8, sharedFolder );
+    CleanupStack::PushL( sharedFolder );
+    
+    HBufC* folder = UpnpString::ToUnicodeL( *sharedFolder );
+    CleanupStack::PushL( folder );
+
+    if ( fileName->Length() == 0)
+       {
+       _LIT(KNoDcTitle, "no_dc_title");
+       fileName->Des().Copy(KNoDcTitle);
+       }
+    
+    HBufC* resultFileName = HBufC::NewL( folder->Length() + fileName->Length() );   
+    resultFileName->Des().Zero();
+    resultFileName->Des().Append( *folder );
+    resultFileName->Des().Append( *fileName );
+    
+    CleanupStack::PopAndDestroy( folder );
+    CleanupStack::PopAndDestroy( sharedFolder );
+    CleanupStack::PopAndDestroy( fileName );
+    
+    CleanupStack::PushL( resultFileName );        
+    HBufC* uniqueFileName = MakeFileNameUniqueL(*resultFileName, iFs );
+    CleanupStack::PopAndDestroy( resultFileName );
+        
+    return uniqueFileName;
+    }
+        
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::PrepareHeaderL
+//
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpDlnaFilter::PrepareHeaderL( CUpnpHttpFileServeTransaction& aTransaction )
+    {    
+    HBufC8* mimetype = NULL;
+    HBufC16* fileName = aTransaction.PathWithNewMethodL();
+    CleanupStack::PushL( fileName );
+    
+    if ( GetContentTypeL( aTransaction, mimetype, *fileName ) != KErrNone )
+        {
+        //getting mime type from Symbian or by the extension
+        mimetype = UpnpFileUtil::GetMimeTypeForFileL( *fileName );
+        }
+    CleanupStack::PushL( mimetype );
+    aTransaction.AddResponseHeaderL( UpnpGENA::KContentType(), *mimetype );
+    CleanupStack::PopAndDestroy( mimetype );
+    
+    // Checks if all DLNA correlations are ok and adds proper headers
+    // only for GET response
+
+    TInt dlnaCorrelationsError = CheckDLNACorrelationsL( aTransaction );
+    if ( dlnaCorrelationsError < KErrNone )
+        {
+        CleanupStack::PopAndDestroy( fileName );
+        return dlnaCorrelationsError;
+        }
+
+    
+    AddHeaderIfNotEmptyL( UpnpDLNA::KHdrContentFeatures(), aTransaction );
+    
+        // 7.4.42.2 HTTP Server Endpoints that transfer Non-Cacheable Content using · HTTP/1.0, and· GET responses.
+        // These devices must prevent intermediate caching by including among the HTTP response headers
+        // the directive:· Pragma:  no-cache
+    aTransaction.AddResponseHeaderL( UpnpHTTP::KHdrPragma(),
+                                     UpnpHTTP::KNoCache() );   
+    aTransaction.AddResponseHeaderL( UpnpHTTP::KHdrCacheControl(),
+                                     UpnpHTTP::KNoCache() );        
+
+
+    // If Accept-Language header is present
+    if ( aTransaction.QueryRequestHeader( UpnpHTTP::KHdrAcceptLanguage() ).Length() > 0 )
+        {
+        aTransaction.AddResponseHeaderL( UpnpHTTP::KHdrContentLanguage(),
+                                         UpnpHTTP::KLanguageEn() );        
+        }
+
+    // Transfer Mode
+    // If Transfer Mode header is present
+    AddHeaderIfNotEmptyL( UpnpDLNA::KHdrTransferMode, aTransaction );
+
+    CleanupStack::PopAndDestroy( fileName );
+    return KErrNone;
+    }
+    
+// -----------------------------------------------------------------------------
+//  CUpnpDlnaFilter::AddHeaderIfNotEmptyL
+//
+// -----------------------------------------------------------------------------
+//
+void CUpnpDlnaFilter::AddHeaderIfNotEmptyL( const TDesC8& aHeaderName, 
+    CUpnpHttpFileServeTransaction& aTransaction )
+    {
+    if ( aTransaction.FilterHeaders().QueryHeader( aHeaderName ).Length() > 0 )
+        {
+        aTransaction.AddResponseHeaderL( aHeaderName,
+            aTransaction.FilterHeaders().QueryHeader( aHeaderName ) );            
+        }
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpDlnaFilter::NewTransactionL
+//
+// -----------------------------------------------------------------------------
+//
+void CUpnpDlnaFilter::NewTransactionL( const TDesC8& aMethod, const TDesC8& aUri, 
+    const TInetAddr& aSender, CUpnpHttpServerTransaction*& aResultTrans )
+    {
+    if ( aMethod == KHttpPost() )
+        {
+        aResultTrans = CUpnpHttpFileReceiveTransaction::NewL( *this, aSender, aUri );
+        }
+    else
+        {
+        aResultTrans = CUpnpHttpFileServeTransaction::NewL( *this, aSender, aUri );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpDlnaFilter::AuthorizeRequestL
+//
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpDlnaFilter::AuthorizeRequestL(
+    const TDesC& aFileName, const TInetAddr& aSender )
+    {
+    TInt result( KErrNone );
+    CUpnpHttpMessage* tempMessage = CUpnpHttpMessage::NewL( aSender );
+    CleanupStack::PushL( tempMessage );
+    if ( SecurityManager()
+            && SecurityManager()->AuthorizeMessage( tempMessage,
+                    (TFileName&) aFileName  ) != KErrNone )
+        { //not showing why resource is refused
+        result = -EHttpNotFound;
+        }
+    CleanupStack::PopAndDestroy( tempMessage );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::FileSession
+// -----------------------------------------------------------------------------
+//
+RFs& CUpnpDlnaFilter::FileSession()
+    {
+    return iFs;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::PreparePostfixToMakeFileUniqueL
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpDlnaFilter::PreparePostfixToMakeFileUniqueL( const TDesC& aFilename, RFs& aFs )
+    {
+    _LIT( KUnderScore, "_" );
+    const TInt KDotLength = 1;  // when aFileName is without extension
+
+    HBufC16* newFile = HBufC16::NewLC( aFilename.Length() + KUnderScore().Length() 
+                                       + UpnpString::KMaxTUintLength + KDotLength );
+
+    TParse parse;
+    parse.Set( aFilename, NULL, NULL );
+    TPtrC fileName = parse.Name();
+    TPtrC fileExt = parse.Ext();
+    TPtrC filePath = parse.DriveAndPath();
+
+    TUint64 postfixNumber = 1;
+
+    do
+        {
+        TBuf<UpnpString::KMaxTUintLength + 1> buf;
+        buf.AppendNum( postfixNumber++ );
+        if ( buf.Length() > UpnpString::KMaxTUintLength )
+            {
+            User::Leave( KErrOverflow );
+            }
+        newFile->Des().Copy( filePath );
+        newFile->Des().Append( fileName );
+        newFile->Des().Append( KUnderScore() );
+        newFile->Des().Append( buf );
+        newFile->Des().Append( fileExt );
+        }
+    while ( BaflUtils::FileExists( aFs, newFile->Des() ) );
+
+    CleanupStack::Pop( newFile );
+    return newFile;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::PrepareBaseFileNameL
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpDlnaFilter::PrepareBaseFileNameL( const TDesC& aFilename, RFs& aFs )
+    {
+    HBufC* fileToServe;
+    if ( aFilename.LocateReverse( '\\' ) == aFilename.Length() - 1 )
+        {
+        _LIT( KNoName0, "noName_0" );
+        const TInt KZeroPostfixLen = 2;  //_0
+        
+        fileToServe = HBufC::NewL( aFilename.Length() + KNoName0().Length() );
+        fileToServe->Des().Copy( aFilename );
+        fileToServe->Des().Append( KNoName0() );
+        
+        if ( BaflUtils::FileExists( aFs, *fileToServe ) )
+            {
+            fileToServe->Des().Delete( fileToServe->Length() - KZeroPostfixLen, KZeroPostfixLen );
+            }
+        }
+    else
+        {
+        fileToServe = HBufC::NewL( aFilename.Length() );
+        fileToServe->Des().Copy( aFilename );
+        }
+
+    if ( BaflUtils::FileExists( aFs, *fileToServe ) )
+        {
+        CleanupStack::PushL( fileToServe );
+        HBufC* newFileName = PreparePostfixToMakeFileUniqueL( *fileToServe, aFs );
+        CleanupStack::PopAndDestroy( fileToServe );
+        fileToServe = newFileName;
+        }
+    return fileToServe;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilter::MakeFileNameUniqueL
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpDlnaFilter::MakeFileNameUniqueL( const TDesC& aFilename, RFs& aFs )
+    {
+    HBufC* fileToServe = PrepareBaseFileNameL( aFilename, aFs );
+    
+    TPtrC questionmark;
+    questionmark.Set( *fileToServe );
+    TInt lastSlash = questionmark.LocateReverse( '\\' );
+    TInt lastQuestionMark = questionmark.LocateReverse( '?' );
+    if ( lastQuestionMark != KErrNotFound && lastSlash < lastQuestionMark )
+        {
+        CleanupStack::PushL( fileToServe );
+        questionmark.Set( questionmark.Left( lastQuestionMark ) );
+
+        // now setting new name for file        
+        HBufC* newFileName; //necessary not to loose current fileToServe
+        newFileName = HBufC::NewL( questionmark.Length() );
+        newFileName->Des().Copy( questionmark  );
+        CleanupStack::PopAndDestroy( fileToServe );
+        fileToServe = newFileName;
+        }
+    
+    TPtrC path;
+    path.Set( *fileToServe );
+    TInt lastPosOfSlash = 0;
+    TInt posOfBackSlash = path.Find( KDoubleBackSlash );
+    
+    while ( posOfBackSlash != KErrNotFound )
+        {
+        path.Set( path.Mid( posOfBackSlash + 1 ) );
+        lastPosOfSlash = lastPosOfSlash + posOfBackSlash + 1;
+        posOfBackSlash = path.Find( KDoubleBackSlash );
+        }
+    
+    if ( lastPosOfSlash > 0 )
+        {
+        path.Set( *fileToServe );
+        path.Set( path.Left( lastPosOfSlash ) );
+        }
+        
+    return fileToServe;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/dlna/upnpdlnafilterheaders.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,99 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpDlnaFilterHeaders implementation.
+ *
+ */
+// INCLUDES
+
+#include "upnpdlnafilterheaders.h"
+#include "upnphttpmessage.h"
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilterHeaders::NewL()
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaFilterHeaders* CUpnpDlnaFilterHeaders::NewL()
+    {
+    CUpnpDlnaFilterHeaders* self = new (ELeave) CUpnpDlnaFilterHeaders();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilterHeaders::CUpnpDlnaFilterHeaders()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaFilterHeaders::CUpnpDlnaFilterHeaders()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilterHeaders::~CUpnpDlnaFilterHeaders()
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaFilterHeaders::~CUpnpDlnaFilterHeaders()
+    {
+    delete iHeaderContainer;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilterHeaders::AddHeaderL
+// -----------------------------------------------------------------------------
+//
+void CUpnpDlnaFilterHeaders::AddHeaderL( const TDesC8 &aName,
+    const TDesC8 &aValue )
+    {
+    iHeaderContainer->AddPairL( aName, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilterHeaders::RemoveHeaderL
+// -----------------------------------------------------------------------------
+//
+void CUpnpDlnaFilterHeaders::RemoveHeaderL( const TDesC8 &aName )
+    {
+    iHeaderContainer->RemovePairL( aName );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilterHeaders::QueryHeader
+// -----------------------------------------------------------------------------
+//
+TDesC8& CUpnpDlnaFilterHeaders::QueryHeader( const TDesC8& aHeaderName )
+    {
+    return iHeaderContainer->GetHeaderValue( aHeaderName );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilterHeaders::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CUpnpDlnaFilterHeaders::ConstructL()
+    {
+    iHeaderContainer = CUpnpHttpMessage::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDlnaFilterHeaders::Sender
+// -----------------------------------------------------------------------------
+//
+TInetAddr& CUpnpDlnaFilterHeaders::Sender()
+    {
+    return iHeaderContainer->Sender();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/dlna/upnphttpfilereceivetransaction.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,186 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpHttpFileReceiveTransaction implementation.
+ *
+ */     
+
+#include <bautils.h> 
+#include "upnphttpfilereceivetransaction.h"
+#include "upnpdlnafilter.h"
+#include "upnpdlnafilterheaders.h"
+#include "upnperrors.h"
+#include "upnpcons.h"
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileReceiveTransaction::NewL
+// 
+// ---------------------------------------------------------------------------
+//
+CUpnpHttpFileReceiveTransaction* CUpnpHttpFileReceiveTransaction::NewL( 
+        CUpnpDlnaFilter& aClientContext, const TInetAddr& aSender, const TDesC8& aUri )
+    {
+    CUpnpHttpFileReceiveTransaction* self = 
+        new (ELeave) CUpnpHttpFileReceiveTransaction( aClientContext );
+    CleanupStack::PushL( self );
+    self->ConstructL( aSender, aUri );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::ConstructL
+// 
+// ---------------------------------------------------------------------------
+//
+void CUpnpHttpFileReceiveTransaction::ConstructL( 
+    const TInetAddr& aSender, const TDesC8& aSenderUri )
+    {
+    iFilterHeaders = CUpnpDlnaFilterHeaders::NewL( );
+    iSender = aSender;
+    iSenderUri = aSenderUri.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileReceiveTransaction::CUpnpHttpFileReceiveTransaction
+// 
+// ---------------------------------------------------------------------------
+//
+CUpnpHttpFileReceiveTransaction::CUpnpHttpFileReceiveTransaction(
+        CUpnpDlnaFilter& aClientContext ) :
+    iClientContext(aClientContext)
+    {
+    }
+        
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileReceiveTransaction::~CUpnpHttpFileReceiveTransaction
+// 
+// ---------------------------------------------------------------------------
+//
+CUpnpHttpFileReceiveTransaction::~CUpnpHttpFileReceiveTransaction()
+    {
+    delete iFilterHeaders;
+    delete iSenderUri;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileReceiveTransaction::OnCallbackL
+// 
+// ---------------------------------------------------------------------------
+//    
+const TDesC8& CUpnpHttpFileReceiveTransaction::SenderUri()
+    {
+    return *iSenderUri;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileReceiveTransaction::FilterHeaders
+// 
+// ---------------------------------------------------------------------------
+//
+CUpnpDlnaFilterHeaders& CUpnpHttpFileReceiveTransaction::FilterHeaders()
+    {
+    return *iFilterHeaders;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileReceiveTransaction::OnCallbackL
+// 
+// ---------------------------------------------------------------------------
+//
+void CUpnpHttpFileReceiveTransaction::OnCallbackL( TUpnpHttpServerEvent aEvent )
+    {
+    TRAPD( err, DoCallbackL( aEvent ) );
+    if ( err )
+        {
+        SetHttpCode( err );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileReceiveTransaction::DoCallbackL
+// 
+// ---------------------------------------------------------------------------
+//
+void CUpnpHttpFileReceiveTransaction::DoCallbackL( TUpnpHttpServerEvent aEvent )
+    {
+    switch ( aEvent )
+        {
+        case EOnRequestStart:
+            {
+            iFileName.Zero();
+            InitializeFilterHeadersL();
+            User::LeaveIfError(  iClientContext.CheckDLNAPostCorrelationsL(
+                                          *this ) );
+            
+            HBufC* fileNameBuf = iClientContext.DetermineDownloadPathL( *this );           
+            if ( fileNameBuf )
+                { 
+                CleanupStack::PushL( fileNameBuf );
+                
+                RFile file;
+                if ( file.Open( iClientContext.FileSession(),
+                                *fileNameBuf,
+                                EFileWrite ) == KErrNone ) 
+                    {
+                    SetDataSinkL( file );
+                    SetHttpCode( iClientContext.AuthorizeRequestL( *fileNameBuf, iSender ) );
+                    }
+                else
+                    {
+                    BaflUtils::EnsurePathExistsL( iClientContext.FileSession(),
+                                                   fileNameBuf->Des() );
+                    if ( file.Create( iClientContext.FileSession(),
+                                                    *fileNameBuf ,
+                                                    EFileWrite ) != KErrNone ) 
+                        {
+                        SetHttpCode( -EHttpNotFound );
+                        }
+                    else
+                        {
+                        SetDataSinkL( file );
+                        SetHttpCode( iClientContext.AuthorizeRequestL( *fileNameBuf, iSender ) );
+                        iFileName.Copy( *fileNameBuf );
+                        }
+                    }
+                CleanupStack::PopAndDestroy( fileNameBuf );
+                } 
+            else
+                {
+                SetHttpCode( -EHttpNotFound );
+                }
+            
+            break;
+            }
+        case EOnComplete:
+            break;    
+        default:
+            break;
+        }            
+    }
+
+void CUpnpHttpFileReceiveTransaction::InitializeFilterHeadersL()
+    {
+    //Copy current KHdrContentFeatures and KHdrTransferMode to filterHeaders
+    if ( QueryRequestHeader( UpnpDLNA::KHdrContentFeatures ).Length() > 0 )
+        {
+        iFilterHeaders->AddHeaderL( UpnpDLNA::KHdrContentFeatures,
+                QueryRequestHeader( UpnpDLNA::KHdrContentFeatures ) );            
+        }
+    if ( QueryRequestHeader( UpnpDLNA::KHdrTransferMode ).Length() > 0 )
+        {
+        iFilterHeaders->AddHeaderL( UpnpDLNA::KHdrTransferMode,
+                QueryRequestHeader( UpnpDLNA::KHdrTransferMode ) );            
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/dlna/upnphttpfileservetransaction.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,191 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpHttpFileServeTransaction implementation.
+ *
+ */
+#include "upnphttpfileservetransaction.h"
+#include "upnpdlnafilter.h"
+#include "upnpdlnafilterheaders.h"
+#include "upnperrors.h"
+#include "upnpcons.h"
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::NewL
+// 
+// ---------------------------------------------------------------------------
+//
+CUpnpHttpFileServeTransaction* CUpnpHttpFileServeTransaction::NewL( 
+        CUpnpDlnaFilter& aClientContext, const TInetAddr& aSender, const TDesC8& aUri )
+    {
+    CUpnpHttpFileServeTransaction* self = 
+        new (ELeave) CUpnpHttpFileServeTransaction( aClientContext );
+    CleanupStack::PushL( self );
+    self->ConstructL( aSender, aUri );
+    CleanupStack::Pop( self );
+    return self;
+    }    
+    
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::ConstructL
+// 
+// ---------------------------------------------------------------------------
+//
+void CUpnpHttpFileServeTransaction::ConstructL( 
+    const TInetAddr& aSender, const TDesC8& aSenderUri )
+    {
+    iFilterHeaders = CUpnpDlnaFilterHeaders::NewL( );
+    iSender = aSender;
+    iSenderUri = aSenderUri.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::FilterHeaders
+// 
+// ---------------------------------------------------------------------------
+//
+CUpnpDlnaFilterHeaders& CUpnpHttpFileServeTransaction::FilterHeaders()
+    {
+    return *iFilterHeaders;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::CUpnpHttpFileServeTransaction
+// 
+// ---------------------------------------------------------------------------
+//
+CUpnpHttpFileServeTransaction::CUpnpHttpFileServeTransaction( CUpnpDlnaFilter& aClientContext )
+    : iClientContext( aClientContext )
+    {        }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::~CUpnpHttpFileServeTransaction
+// 
+// ---------------------------------------------------------------------------
+//    
+CUpnpHttpFileServeTransaction::~CUpnpHttpFileServeTransaction()
+    {
+    delete iFilterHeaders;
+    delete iSenderUri;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::OnCallbackL
+// 
+// ---------------------------------------------------------------------------
+//    
+void CUpnpHttpFileServeTransaction::OnCallbackL( TUpnpHttpServerEvent aEvent )
+    {
+    TRAPD( err, DoCallbackL( aEvent ) );
+    if ( err )
+        {
+        SetHttpCode( err );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::SenderUri
+// 
+// ---------------------------------------------------------------------------
+//    
+const TDesC8& CUpnpHttpFileServeTransaction::SenderUri()
+    {
+    return *iSenderUri;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::PathWithNewMethodL
+// 
+// ---------------------------------------------------------------------------
+//  
+HBufC16*  CUpnpHttpFileServeTransaction::PathWithNewMethodL()
+    {
+    return iPathWithNewMethod.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpHttpFileServeTransaction::DoCallbackL
+// 
+// ---------------------------------------------------------------------------
+//  
+void CUpnpHttpFileServeTransaction::DoCallbackL( TUpnpHttpServerEvent aEvent )
+    {
+    switch ( aEvent )
+        {
+        case EOnRequestStart:
+            {
+            // 1. Format request file path
+            //  
+            
+            TRAPD( error, iClientContext.FormatPathL( this, iPathWithNewMethod ) );
+            
+           
+            if ( error != KErrNone )
+                {
+                SetHttpCode( error );
+                }
+            else if ( iPathWithNewMethod.Length() == 0 )
+                {
+                SetHttpCode( -EHttpNotFound );
+                // Bad name, so such file doesn't exist and cannot be returned.
+                }
+            else
+                {
+                error = iClientContext.AuthorizeRequestL( iPathWithNewMethod, iSender );
+                if ( error == KErrNone )
+                    {
+                    RFile file;
+                    if ( file.Open( iClientContext.FileSession(),
+                                    iPathWithNewMethod,
+                                    EFileShareReadersOnly | EFileRead ) == KErrNone ) 
+                        {
+                        SetDataSourceL( file );
+                        }
+                    else
+                        {
+                        SetHttpCode( -EHttpNotFound );
+                        }
+                    }
+                else
+                    {
+                    SetHttpCode( error );
+                    }
+                }                
+            break;
+            }
+        case EOnComplete:
+            break;  
+        case EOnResponseStart:
+            InitializeFilterHeadersL();
+            SetHttpCode( iClientContext.PrepareHeaderL( *this ) );
+            break;
+        default:
+            break;
+        }            
+    }
+
+void CUpnpHttpFileServeTransaction::InitializeFilterHeadersL()
+    {
+    //Copy current KHdrContentFeatures and KHdrTransferMode to filterHeaders
+    if ( QueryRequestHeader( UpnpDLNA::KHdrContentFeatures ).Length() > 0 )
+        {
+        iFilterHeaders->AddHeaderL( UpnpDLNA::KHdrContentFeatures,
+                QueryRequestHeader( UpnpDLNA::KHdrContentFeatures ) );            
+        }
+    if ( QueryRequestHeader( UpnpDLNA::KHdrTransferMode ).Length() > 0 )
+        {
+        iFilterHeaders->AddHeaderL( UpnpDLNA::KHdrTransferMode,
+                QueryRequestHeader( UpnpDLNA::KHdrTransferMode ) );            
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpattributebean.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,183 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Attribute table data handler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <xmlengdom.h>
+#include "upnpattributebean.h"
+#include "upnpcontentdirectoryglobals.h"
+#include <upnpattribute.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::CUpnpAttributeBean
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpAttributeBean::CUpnpAttributeBean()
+{
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttributeBean::ConstructL()
+{
+	iAtrValue = KNullString8().AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAttributeBean* CUpnpAttributeBean::NewLC()
+{
+    CUpnpAttributeBean* self = new( ELeave ) CUpnpAttributeBean;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAttributeBean* CUpnpAttributeBean::NewLC(const RDbRowSet& aRowSet)
+{
+    CUpnpAttributeBean* self = NewLC();
+    self->SetL(aRowSet);
+    return self;
+}    
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::~CUpnpAttributeBean
+// Destructor
+// -----------------------------------------------------------------------------
+// 
+CUpnpAttributeBean::~CUpnpAttributeBean()
+{
+    delete iAtrName;
+    delete iAtrValue;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::SetL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttributeBean::SetL(const RDbRowSet& aRowSet)
+{
+    // get cols' ids
+    CDbColSet* colSet = aRowSet.ColSetL();
+    CleanupStack::PushL(colSet);
+    const TInt  idColNo         = colSet->ColNo(KAtrIdColName);
+    const TInt  nameColNo       = colSet->ColNo(KAtrNameColName);
+    const TInt  elmIdColNo      = colSet->ColNo(KAtrElmIdColName);
+    const TInt  isRequiredColNo = colSet->ColNo(KAtrIsRequiredColName);
+    const TInt  valueColNo      = colSet->ColNo(KAtrValueColName);
+    CleanupStack::PopAndDestroy(colSet);
+    
+    // for each column call setter
+    if( idColNo != KDbNullColNo )
+    {
+        SetAtrId( aRowSet.ColInt(idColNo) );
+    }
+    if( nameColNo != KDbNullColNo )
+    {
+        SetAtrNameL( aRowSet.ColDes8(nameColNo) );
+    }
+    if( elmIdColNo != KDbNullColNo )
+    {
+        SetAtrElmId( aRowSet.ColInt(elmIdColNo) );
+    }
+    if( isRequiredColNo != KDbNullColNo )
+    {
+        SetAtrIsRequired( aRowSet.ColUint8(isRequiredColNo) );
+    }
+    if( valueColNo != KDbNullColNo )
+    {
+        SetAtrValueL( aRowSet, valueColNo );
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::SetAtrValueL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttributeBean::SetAtrValueL(const RDbRowSet& aRowSet, const TInt aColNo)
+{
+    delete iAtrValue;
+    iAtrValue = 0;
+    iAtrValue = ReadLongTextColL(aRowSet, aColNo);
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::SetAtrValueL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttributeBean::SetAtrValueL(const TDesC8& aVal)
+{
+	delete iAtrValue;
+	iAtrValue = 0;
+	iAtrValue = aVal.AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::SetAtrNameL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttributeBean::SetAtrNameL(const TDesC8& aAtrName)
+{
+    delete iAtrName;
+    iAtrName = NULL;
+    iAtrName = aAtrName.AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::AttachToXmlElL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TXmlEngAttr CUpnpAttributeBean::AttachAttrL(TXmlEngElement aElement)
+{
+    // add attribute
+    TXmlEngAttr ret = aElement.AddNewAttributeL( AtrName(), AtrValue() );
+
+     return ret;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAttributeBean::CopyToUpnpElementL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpAttributeBean::AttachAttrL(CUpnpElement* aElm)
+{
+    // create element
+    CUpnpAttribute* atr = CUpnpAttribute::NewLC(*iAtrName);
+	
+	// copy values
+	atr->SetValueL(*iAtrValue);
+	
+	// attach
+	aElm->AddAttributeL(atr);
+	
+	// clean up
+	CleanupStack::Pop(atr);
+}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpautodestroyobject.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,155 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "upnpautodestroyobject.h"
+#include "upnpcontentdirectory.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::CUpnpAutoDestroyObject
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpAutoDestroyObject::CUpnpAutoDestroyObject(CUpnpContentDirectory* aCd, 
+                                               TInt aObjId, TInt aResId)
+{
+    iResId = aResId;
+    iCd = aCd;
+    iObjectId = aObjId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAutoDestroyObject::ConstructL()
+{
+    iEventTimer = CUpnpNotifyTimer::NewL( this );
+    iEventTimer->After( KAutoDestroyTimeLimit, EFalse );
+}
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAutoDestroyObject* CUpnpAutoDestroyObject::NewLC(
+                                            CUpnpContentDirectory* aCd, 
+                                            TInt aObjId, TInt aResId )
+{
+    CUpnpAutoDestroyObject* self = 
+                    new( ELeave ) CUpnpAutoDestroyObject(aCd, aObjId, aResId);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAutoDestroyObject* CUpnpAutoDestroyObject::NewL(
+                                            CUpnpContentDirectory* aCd, 
+                                            TInt aObjId, TInt aResId )
+{
+    CUpnpAutoDestroyObject* self = NewLC(aCd, aObjId, aResId);
+    CleanupStack::Pop(self);
+    return self;
+}    
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::~CUpnpAutoDestroyObject
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpAutoDestroyObject::~CUpnpAutoDestroyObject()
+{
+    if(iEventTimer)
+    {
+        iEventTimer->Cancel();
+        delete iEventTimer;
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::TimerEventL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpAutoDestroyObject::TimerEventL(CUpnpNotifyTimer* aTimer)
+{
+    if ( aTimer == iEventTimer )
+    {
+        iTimeElapsed = ETrue;
+        if( !iTransferStarted )
+        {
+            iCd->AutoDestroyEventL( iObjectId, ETrue );
+        }
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::GetResId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAutoDestroyObject::GetResId()
+{
+    return iResId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::GetObjId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAutoDestroyObject::GetObjId()
+{
+    return iObjectId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::SetTransferStartedL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpAutoDestroyObject::SetTransferStartedL(TBool aVal)
+{
+    iTransferStarted = aVal;
+    
+    if( iTimeElapsed && !iTransferStarted )
+    {
+        iCd->AutoDestroyEventL( iObjectId, ETrue );
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObject::RenewTimerL
+// Renews timer instead of recreating it
+// -----------------------------------------------------------------------------
+//
+void CUpnpAutoDestroyObject::RenewTimerL()
+{
+    iTimeElapsed = EFalse;
+    
+    if(iEventTimer)
+    {
+        iEventTimer->Cancel();                        
+        iEventTimer->After( KAutoDestroyTimeLimit, EFalse );
+    }
+}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpautodestroyobjectlist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,170 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpautodestroyobjectlist.h"
+#include "upnpautodestroyobject.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::CUpnpAutoDestroyObjectList
+// -----------------------------------------------------------------------------
+//
+CUpnpAutoDestroyObjectList::CUpnpAutoDestroyObjectList()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CUpnpAutoDestroyObjectList::ConstructL()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::NewLC
+// -----------------------------------------------------------------------------
+//
+CUpnpAutoDestroyObjectList* CUpnpAutoDestroyObjectList::NewLC()
+    {
+    CUpnpAutoDestroyObjectList* self = new( ELeave ) CUpnpAutoDestroyObjectList;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::NewLC
+// -----------------------------------------------------------------------------
+//
+CUpnpAutoDestroyObjectList* CUpnpAutoDestroyObjectList::NewL()
+    {
+    CUpnpAutoDestroyObjectList* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }    
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::~CUpnpAutoDestroyObjectList
+// -----------------------------------------------------------------------------
+//
+CUpnpAutoDestroyObjectList::~CUpnpAutoDestroyObjectList()
+    {
+    iArray.ResetAndDestroy();
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::AppendL
+// -----------------------------------------------------------------------------
+//
+void CUpnpAutoDestroyObjectList::AppendL(const CUpnpAutoDestroyObject* aObj)
+    {
+    iArray.AppendL(aObj);
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::RemoveAndDestroyL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+void CUpnpAutoDestroyObjectList::RemoveAndDestroyL(TInt aIndex)
+    {
+    if( aIndex < 0 || aIndex >= iArray.Count() )
+        {   
+        User::Leave(KErrNotFound);
+        }    
+    delete iArray[aIndex];
+    iArray.Remove(aIndex);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::FindObjIndex
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAutoDestroyObjectList::FindObjIndexByObjId(TInt aObjId)
+    {
+    TInt i;
+    for( i = iArray.Count()-1; i >= 0; i-- )
+        {
+        if( iArray[i]->GetObjId() == aObjId )
+            {
+            break;
+            }
+        }
+    return i;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::FindObjIndex
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAutoDestroyObjectList::FindObjIndexByResId(TInt aResId)
+    {
+    TInt i;
+    for( i = iArray.Count()-1; i >= 0 ; i-- )
+        {
+        if( iArray[i]->GetResId() == aResId )
+            {
+            break;
+            }
+        }
+    return i;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpAutoDestroyObjectList::operator[]
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpAutoDestroyObject* CUpnpAutoDestroyObjectList::operator[](TInt aIndex)
+    {
+    return iArray[aIndex];
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::TransferFailL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpAutoDestroyObjectList::TransferFailL( TInt aResId )
+    {
+    TInt index = FindObjIndexByResId( aResId );
+    if(index != KErrNotFound)
+        {
+        CUpnpAutoDestroyObject* currADObj = iArray[index];
+                                 
+        /* If transfer to newly created object [without resource] is timed out [408] due to
+        *  many stoppages of transfer, the object is still accessible until auto-destroy deletes it.
+        *  So AutoDestroyObject time should be extended by another KAutoDestroyTimeLimit
+        */       
+        currADObj->RenewTimerL();  
+        
+        // Setting failed transfer as finished              
+        currADObj->SetTransferStartedL(EFalse);                                        
+        }
+    }
+
+TInt CUpnpAutoDestroyObjectList::Count( )
+{
+    return iArray.Count();
+}
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpcddbfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,505 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Database for MediaServer
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "upnpcddbfactory.h"
+#include "upnplocalstorage.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpmetadatastorage.h"
+#define KLogFile _L("ContentDirectoryDb.log")
+#include "upnpcustomlog.h"
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CUpnpCdDbFactory
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpCdDbFactory::CUpnpCdDbFactory()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::ConstructL() 
+{
+    User::LeaveIfError( iFs.Connect() );
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCdDbFactory* CUpnpCdDbFactory::NewLC()
+{
+    CUpnpCdDbFactory* self = new ( ELeave ) CUpnpCdDbFactory();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCdDbFactory* CUpnpCdDbFactory::NewL()
+{
+    CUpnpCdDbFactory* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::~CUpnpCdDbFactory
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpCdDbFactory::~CUpnpCdDbFactory( )
+{
+    iStoreDb.Close();
+    delete iFileStore;
+    iFs.Close();
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateDatabaseFileL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::CreateDatabaseFileL(const TDesC& aDbFileName)
+{
+    TRAPD(err,DoCreateDatabaseFileL(aDbFileName));
+    // close db
+    iStoreDb.Close();
+    delete iFileStore;
+    iFileStore = NULL;
+    // remove file if error
+    if(err)
+    {
+        iFs.Delete(aDbFileName);
+        User::Leave(err);
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateDatabaseFileL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::DoCreateDatabaseFileL(const TDesC& aDbFileName)
+{
+    // db
+    CreateEmptyDbL(aDbFileName);
+    
+    // tables
+    CreateObjectTableL();
+    CreateElementTableL();
+    CreateAttributeTableL();
+    CreateResourceTableL();
+    CreateSequenceTableL();
+    
+    // insert initial records
+    InsertInitialDataL();   
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateObjectTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::CreateObjectTableL()
+{
+    CDbColSet* colSet = CreateObjectTableColumnSequenceLC();
+
+    // create the table
+    User::LeaveIfError(iStoreDb.CreateTable(KObjectTableName, *colSet));
+    
+    // index
+    CDbKey* key = CDbKey::NewLC();
+    TDbKeyCol idKeyCol(KObjIdColName);
+    key->AddL(idKeyCol);
+    key->MakeUnique();
+    User::LeaveIfError( iStoreDb.CreateIndex(KObjIdIndexName, 
+    KObjectTableName, *key) );
+    
+    // index
+    CDbKey* key2 = CDbKey::NewLC();
+    TDbKeyCol idKeyCol2(KObjRefIdColName);
+    key2->AddL(idKeyCol2);
+    User::LeaveIfError( iStoreDb.CreateIndex(KRefIdIndexName, 
+    	KObjectTableName, *key2) );
+    	
+    // clean up
+    CleanupStack::PopAndDestroy(key2);
+    CleanupStack::PopAndDestroy(key);
+    CleanupStack::PopAndDestroy(colSet);
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateElementTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::CreateElementTableL()
+{
+    CDbColSet* colSet = CreateElementTableColumnSequenceLC();
+
+    // create the table
+    User::LeaveIfError(iStoreDb.CreateTable(KElementTableName, *colSet));
+    
+    // index
+    CDbKey* key = CDbKey::NewLC();
+    TDbKeyCol idKeyCol(KElmIdColName);
+    key->AddL(idKeyCol);
+    key->MakeUnique();
+    
+    // index
+    CDbKey* key2 = CDbKey::NewLC();
+    TDbKeyCol idKeyCol2(KElmObjIdColName);
+    key2->AddL(idKeyCol2);
+    User::LeaveIfError( iStoreDb.CreateIndex(KElmObjIdIndexName, 
+    	KElementTableName, *key2) );
+    
+    // clean up
+    CleanupStack::PopAndDestroy(key2);
+    CleanupStack::PopAndDestroy(key);
+    CleanupStack::PopAndDestroy(colSet);
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateAttributeTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::CreateAttributeTableL()
+{
+    CDbColSet* colSet = CreateAttributeTableColumnSequenceLC();
+
+    // create the table
+    User::LeaveIfError(iStoreDb.CreateTable(KAttributeTableName, *colSet));
+    
+    // index
+    CDbKey* key = CDbKey::NewLC();
+    TDbKeyCol idKeyCol(KAtrIdColName);
+    key->AddL(idKeyCol);
+    key->MakeUnique();
+
+    // index
+    CDbKey* key2 = CDbKey::NewLC();
+    TDbKeyCol idKeyCol2(KAtrIdObjColName);
+    key2->AddL(idKeyCol2);
+    User::LeaveIfError( iStoreDb.CreateIndex(KAtrElmIdIndexName, 
+        KAttributeTableName, *key2) );
+    
+    // clean up
+    CleanupStack::PopAndDestroy(key2);
+    CleanupStack::PopAndDestroy(key);
+    CleanupStack::PopAndDestroy(colSet);
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateResourceTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::CreateResourceTableL()
+{
+    CDbColSet* colSet = CreateResourceTableColumnSequenceLC();
+
+    // create the table
+    User::LeaveIfError(iStoreDb.CreateTable(KResourcesTableName, *colSet));
+    
+    // index
+    CDbKey* key = CDbKey::NewLC();
+    TDbKeyCol idKeyCol(KRscIdObjColName);
+    key->AddL(idKeyCol);    
+    User::LeaveIfError( iStoreDb.CreateIndex(KRscIdObjIndexName, 
+    KResourcesTableName, *key) );
+    
+    // index
+    CDbKey* key2 = CDbKey::NewLC();
+    TDbKeyCol idKeyCol2(KRscIdColName);
+    key2->AddL(idKeyCol2);
+    key2->MakeUnique();
+    User::LeaveIfError( iStoreDb.CreateIndex(KRscIdIndexName, 
+        KResourcesTableName, *key2) );
+    
+    // clean up
+    CleanupStack::PopAndDestroy(key2);    
+    CleanupStack::PopAndDestroy(key);
+    CleanupStack::PopAndDestroy(colSet);
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateResourceTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::CreateSequenceTableL()
+{
+    CDbColSet* colSet = CreateSequenceTableColumnSequenceLC();
+
+    // create the table
+    User::LeaveIfError(iStoreDb.CreateTable(KSequencesTableName, *colSet));
+    
+    // index
+    CDbKey* key = CDbKey::NewLC();
+    TDbKeyCol idKeyCol(KSeqColNameColName);
+    key->AddL(idKeyCol);
+    key->MakeUnique();
+    User::LeaveIfError( iStoreDb.CreateIndex(KSeqColNameIndexName, 
+    KSequencesTableName, *key) );
+    
+    // clean up
+    CleanupStack::PopAndDestroy(key);
+    CleanupStack::PopAndDestroy(colSet);
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateEmptyDbL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::CreateEmptyDbL(const TDesC& aDbFileName)
+{
+    // Create empty database file.
+    iFileStore = CPermanentFileStore::ReplaceL(iFs,
+    aDbFileName, EFileRead|EFileWrite);
+    iFileStore->SetTypeL(iFileStore->Layout()); 
+    TStreamId id = iStoreDb.CreateL(iFileStore);
+    iFileStore->SetRootL(id); 
+    iFileStore->CommitL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::InsertInitialDataL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdDbFactory::InsertInitialDataL()
+{
+    // command table
+    const TDesC* sqlCmds[] =    { &KInit1(),
+                                  &KInit2(),
+                                  &KInit3(),
+                                  &KInit4(),
+                                  &KInit5(),
+                                  &KInit6()
+                                };
+    // for each command
+    TInt count = sizeof(sqlCmds) / sizeof(TDesC*);
+    for(TInt i = 0; i < count; i++)
+    {
+        // execute
+        TInt dbErr = iStoreDb.Execute(*sqlCmds[i]);
+        User::LeaveIfError(dbErr);  
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateObjectTableColumnSequenceLC
+// -----------------------------------------------------------------------------
+//
+CDbColSet* CUpnpCdDbFactory::CreateObjectTableColumnSequenceLC()
+{
+    // specify columns
+    TDbCol idCol        (   KObjIdColName,          EDbColInt32 );
+    TDbCol parentIdCol  (   KObjParentIdColName,    EDbColInt32 );
+    TDbCol titleCol     (   KObjTiltleColName,      EDbColText8 , KMaxUpnpStringLen);
+    TDbCol classCol     (   KObjClassColName,       EDbColText8 , KMaxUpnpStringLen);
+    TDbCol restrictedCol(   KObjRestrictedColName,  EDbColBit   );
+    TDbCol searchableCol(   KObjSearchableColName,  EDbColBit   );
+    TDbCol refIdCol     (   KObjRefIdColName,       EDbColInt32 );
+    TDbCol pathCol      (   KObjPathColName,        EDbColText8 , KMaxUpnpStringLen);
+
+	pathCol.iAttributes			= TDbCol::ENotNull;
+    // attributes
+    idCol.iAttributes           = TDbCol::ENotNull;
+    parentIdCol.iAttributes     = TDbCol::ENotNull;
+    titleCol.iAttributes        = TDbCol::ENotNull;
+    classCol.iAttributes        = TDbCol::ENotNull;
+    restrictedCol.iAttributes   = TDbCol::ENotNull;
+	pathCol.iAttributes			= TDbCol::ENotNull;
+    
+    // create column set
+    CDbColSet* colSet = CDbColSet::NewLC();
+
+    // add the columns to column set
+    colSet->AddL( idCol             );
+    colSet->AddL( parentIdCol       );
+    colSet->AddL( titleCol          );
+    colSet->AddL( classCol          );
+    colSet->AddL( restrictedCol     );
+    colSet->AddL( searchableCol     );
+    colSet->AddL( refIdCol          );
+    colSet->AddL( pathCol           );
+    
+    return colSet;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateElementTableColumnSequenceLC
+// -----------------------------------------------------------------------------
+//
+CDbColSet* CUpnpCdDbFactory::CreateElementTableColumnSequenceLC()
+{
+    // specify columns
+    TDbCol idCol     (   KElmIdColName,          EDbColInt32     );
+    TDbCol nameCol   (   KElmNameColName,        EDbColText8     , KMaxUpnpStringLen);
+    TDbCol valCol    (   KElmValueColName,       EDbColLongText8     , KMaxUpnpLongStringLen);
+    TDbCol hasAttrCol(   KElmHasAttrColName,     EDbColBit       );
+    TDbCol objIdCol  (   KElmObjIdColName,       EDbColInt32     );
+    TDbCol isReqCol  (   KElmIsRequiredColName,  EDbColBit       );
+
+    // attributes
+    idCol.iAttributes       = TDbCol::ENotNull;
+    nameCol.iAttributes     = TDbCol::ENotNull;
+    hasAttrCol.iAttributes  = TDbCol::ENotNull;
+    objIdCol.iAttributes    = TDbCol::ENotNull;
+    isReqCol.iAttributes    = TDbCol::ENotNull;
+    
+    // create column set
+    CDbColSet* colSet = CDbColSet::NewLC();
+
+    // add the columns to column set
+    colSet->AddL( idCol         );
+    colSet->AddL( nameCol       );
+    colSet->AddL( valCol        );
+    colSet->AddL( hasAttrCol    );
+    colSet->AddL( objIdCol      );
+    colSet->AddL( isReqCol      );
+    
+    return colSet;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateAttributeTableColumnSequenceLC
+// -----------------------------------------------------------------------------
+//
+CDbColSet* CUpnpCdDbFactory::CreateAttributeTableColumnSequenceLC()
+{
+    // specify columns
+    TDbCol idCol        (   KAtrIdColName,          EDbColInt32     );
+    TDbCol nameCol      (   KAtrNameColName,        EDbColText8     );
+    TDbCol valCol       (   KAtrValueColName,       EDbColLongText8 , KMaxUpnpLongStringLen);
+    TDbCol elmIdCol     (   KAtrElmIdColName,       EDbColInt32     );
+    TDbCol isReqCol     (   KAtrIsRequiredColName,      EDbColBit   );
+    TDbCol idObjCol     (   KAtrIdObjColName,          EDbColInt32 );
+
+    // attributes
+    idCol.iAttributes       = TDbCol::ENotNull;
+    nameCol.iAttributes     = TDbCol::ENotNull;
+    elmIdCol.iAttributes    = TDbCol::ENotNull;
+    isReqCol.iAttributes    = TDbCol::ENotNull;
+    idObjCol.iAttributes    = TDbCol::ENotNull;
+    
+    // create column set
+    CDbColSet* colSet = CDbColSet::NewLC();
+
+    // add the columns to column set
+    colSet->AddL( idCol     );
+    colSet->AddL( nameCol   );
+    colSet->AddL( valCol    );
+    colSet->AddL( elmIdCol  );
+    colSet->AddL( isReqCol  );
+    colSet->AddL( idObjCol  );
+
+    return colSet;    
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateResourceTableColumnSequenceLC
+// -----------------------------------------------------------------------------
+//
+CDbColSet* CUpnpCdDbFactory::CreateResourceTableColumnSequenceLC()
+{
+    // specify columns
+    TDbCol idCol        (   KRscIdColName,          EDbColInt64 );
+    TDbCol pathCol      (   KRscPathColName,        EDbColText  , KMaxUpnpStringLen);
+    TDbCol readOnlyCol  (   KRscReadonlyColName,    EDbColBit   );
+    TDbCol thumbnailCol (   KRscThumbnailColName,   EDbColBit   );
+    TDbCol idObjCol     (   KRscIdObjColName,       EDbColInt32 );
+
+    // attributes
+    idCol.iAttributes   = TDbCol::ENotNull;
+    pathCol.iAttributes = TDbCol::ENotNull;
+    readOnlyCol.iAttributes = TDbCol::ENotNull;
+    thumbnailCol.iAttributes = TDbCol::ENotNull;
+    idObjCol.iAttributes = TDbCol::ENotNull;
+    
+    // create column set
+    CDbColSet* colSet = CDbColSet::NewLC();
+
+    // add the columns to column set
+    colSet->AddL( idCol         );
+    colSet->AddL( pathCol       );
+    colSet->AddL( readOnlyCol       );
+    colSet->AddL( thumbnailCol       );
+    colSet->AddL( idObjCol  );
+
+    return colSet;    
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateSequenceTableColumnSequenceLC
+// -----------------------------------------------------------------------------
+//
+CDbColSet* CUpnpCdDbFactory::CreateSequenceTableColumnSequenceLC()
+{
+    // specify columns
+    TDbCol colNameCol       ( KSeqColNameColName, EDbColText8   );
+    TDbCol nextKeyCol       ( KSeqNextKeyColName, EDbColInt32   );
+
+    // attributes
+    colNameCol.iAttributes      = TDbCol::ENotNull;
+    nextKeyCol.iAttributes      = TDbCol::ENotNull;
+    
+    // create column set
+    CDbColSet* colSet = CDbColSet::NewLC();
+
+    // add the columns to column set
+    colSet->AddL( colNameCol    );
+    colSet->AddL( nextKeyCol    );
+
+    return colSet;    
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdDbFactory::CreateMetadataStorageL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpMetadataStorage* CUpnpCdDbFactory::CreateMetadataStorageL(const TDesC& aDatabaseFileName)
+{
+    CUpnpMetadataStorage* metadataStorage = NULL;
+	TInt err;
+    TRAP(err, metadataStorage = CUpnpMetadataStorage::NewL(aDatabaseFileName));
+    if(err != KErrNone)
+    { // dbfile does not exist or dbfile corrupt, create new db and try again
+        CreateDatabaseFileL(aDatabaseFileName);
+        LOGCD("CUpnpCdDbFactory::CreateMetadataStorageL","CreateDatabaseFileL",0,"New database created successfully");
+        
+        metadataStorage = CUpnpMetadataStorage::NewL(aDatabaseFileName);
+    }
+
+    LOGCD("CUpnpCdDbFactory::CreateMetadataStorageL","CUpnpMetadataStorage::NewL",err,"Database opened successfully");    
+    
+    return metadataStorage;
+}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpcdutils.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1037 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ContentDirectory utils
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <uri8.h>
+#include "upnpcdutils.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpdominterface.h"
+#include "upnperror.h"
+#include "upnpcommonupnplits.h"
+#include "upnpstring.h"
+#include "upnpcons.h"
+#include <utf.h>
+#include <xmlengdocument.h>
+#include <e32math.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::RemoveWhiteSpacesL
+// -----------------------------------------------------------------------------
+//
+void UpnpCdUtils::RemoveWhiteSpacesL(TDes8& aString)
+{
+    for(TInt i=0; i<aString.Length(); i++)
+    {
+        if(    aString[i] == ' '
+           ||  aString[i] == '\r'
+           ||  aString[i] == '\n'
+           ||  aString[i] == '\t')
+        {
+            aString.Replace(i,1,_L8(""));
+            i--;
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::IsWhiteString
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool UpnpCdUtils::IsWhiteString(const TDesC8& aString)
+{
+    TBool ret = ETrue;
+    for(TInt i = 0; i < aString.Length(); i++)
+    {
+        if( !(  aString[i] == '\n' ||
+                aString[i] == '\r' ||
+                aString[i] == ' '  ||
+                aString[i] == '\t' )  ) 
+        {
+            ret = EFalse;
+            break;
+        }
+    }
+    return ret;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::GetObjectElementL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TXmlEngElement UpnpCdUtils::GetObjectElementL(RXmlEngDocument& aFragment)
+{
+    TXmlEngElement element;
+    // try to get container
+    UpnpDomInterface::GetElementL( aFragment.DocumentElement(), element, KContainer );
+    if(element.IsNull())
+    { // this is not a container
+        // try to get an item
+        UpnpDomInterface::GetElementL( aFragment.DocumentElement(), element, KItem );
+        if(element.IsNull())
+        { // this is neither an item - error
+            User::Leave(EInvalidArgs);
+        }
+    }
+    return element;
+}
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::HasRefIdL
+// -----------------------------------------------------------------------------
+//
+TBool UpnpCdUtils::HasRefIdL( RXmlEngDocument& aFragment )
+    {
+    TXmlEngElement object = UpnpCdUtils::GetObjectElementL( aFragment );
+    //reference id value
+    TPtrC8 refID = UpnpDomInterface::GetAttrValueL( object, KRefID );
+    return !refID.CompareF( KNullDesC8 ) ? EFalse : ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::EncodeXmlStringL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* UpnpCdUtils::EncodeXmlStringL(const TDesC8& aString)
+{
+    // new buffer size 
+    TInt extensionSize = 0;
+    for(TInt i = 0; i < aString.Length(); i++)
+    {
+        if(aString[i] == '&')       extensionSize += KEtAmp().Length() - 1;
+        else if(aString[i] == '<')  extensionSize += KEtlt().Length() - 1;
+        else if(aString[i] == '>')  extensionSize += KEtgt().Length() - 1;
+        else if(aString[i] == '\"') extensionSize += KEtQuot().Length() - 1;
+        else if(aString[i] == '\'') extensionSize += KEtApos().Length() - 1;
+    }
+    
+    // alloc new buffer
+    HBufC8* ret = HBufC8::NewLC(aString.Length() + extensionSize);
+    TPtr8 retPtr(ret->Des());
+    retPtr.Copy(aString);
+    
+    // replace
+    for(TInt i = 0; i < retPtr.Length(); i++)
+    {
+        if(retPtr[i] == '&')        retPtr.Replace(i, 1, KEtAmp);
+        else if(retPtr[i] == '<')   retPtr.Replace(i, 1, KEtlt);
+        else if(retPtr[i] == '>')   retPtr.Replace(i, 1, KEtgt);
+        else if(retPtr[i] == '\"')  retPtr.Replace(i, 1, KEtQuot);
+        else if(retPtr[i] == '\'')  retPtr.Replace(i, 1, KEtApos);
+    }
+    
+    // clean up
+    CleanupStack::Pop(ret);
+    
+    return ret; 
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::ReplaceTrueFalse
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void UpnpCdUtils::ReplaceTrueFalse(HBufC8* aBuf)
+{
+    TPtr8 ptr(aBuf->Des());
+    TInt pos;
+    // false -> 0
+    pos = ptr.FindC(KFalseString8);
+    if (pos != KErrNotFound)
+    {
+        ptr.Replace(pos, KFalseString8().Length(), KFalseValue8);
+    }
+    // true -> 1
+    pos = ptr.FindC(KTrueString8);
+    if (pos != KErrNotFound)
+    {
+        ptr.Replace(pos, KTrueString8().Length(), KTrueValue8);
+    }
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::GetElmNameWithNsL
+// -----------------------------------------------------------------------------
+//
+HBufC8* UpnpCdUtils::GetElmNameWithNsL(TXmlEngElement aElement)
+{
+    TPtrC8 elmName( aElement.Name() );
+    HBufC8* ret = NULL;
+    if( aElement.NamespaceDeclaration().Prefix().Length() )
+    {
+        TPtrC8 prefix( aElement.NamespaceDeclaration().Prefix() );
+        ret = HBufC8::NewL(elmName.Length() + prefix.Length() + 1);
+        TPtr8 ptr(ret->Des());
+        
+        // concatenate prefix and name
+        ptr.Copy(prefix);
+        ptr.Append(KCol);
+        ptr.Append(elmName);
+    }
+    else
+    {
+        ret = elmName.AllocL();
+    }
+    
+    return ret; // the caller should delete it
+}
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::Des8ToDesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC* UpnpCdUtils::Des8ToDesL(const TDesC8& aString)
+{
+    HBufC* ret = Des8ToDesLC(aString);
+    CleanupStack::Pop(ret);
+    return ret;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::Des8ToDesLC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC* UpnpCdUtils::Des8ToDesLC(const TDesC8& aString)
+{    
+    HBufC* ret = UpnpString::ToUnicodeL(aString);
+    CleanupStack::PushL(ret);
+    return ret;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::DesToDes8LC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* UpnpCdUtils::DesToDes8LC(const TDesC& aString)
+{
+    HBufC8* ret = UpnpString::FromUnicodeL(aString);
+    CleanupStack::PushL(ret);
+    return ret;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::ResIdFromUriL
+// -----------------------------------------------------------------------------
+//
+TInt64 UpnpCdUtils::ResIdFromUriL(const TDesC8& aUri)
+{
+    TUriParser8 up;
+    User::LeaveIfError(up.Parse(aUri));
+    TPtrC8 path(up.Extract(EUriPath));
+    if (path.Length() == 0)
+    {
+    User::Leave(KErrNotFound);
+    }
+    
+    if(path[0] == '/')
+    {
+        path.Set(path.Mid(1));
+    }
+    TInt index = path.Locate(TChar('/'));
+    
+    if ((index>0)&&(index != KMaxIDResLength))
+    {
+    	User::Leave(KErrNotFound);    
+    }
+    TLex8 lexer(path);
+    TInt64 ret;
+    User::LeaveIfError(lexer.Val(ret));
+    return ret;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::ResIdFromUriL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC8 UpnpCdUtils::ResIdFromUriDesL(const TDesC8& aUri)
+{
+    TUriParser8 up;
+    User::LeaveIfError(up.Parse(aUri));
+    TPtrC8 path(up.Extract(EUriPath));
+    if (path.Length() == 0)
+    {
+    User::Leave(KErrNotFound);
+    }
+    
+    if(path[0] == '/')
+    {
+        path.Set(path.Mid(1));
+    }
+    
+    TInt index = path.Locate(TChar('/'));
+    
+    if (index > 0)       
+    {
+        path.Set(path.Left(index));        
+    }
+    
+    return path;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::SetObjectIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void UpnpCdUtils::SetObjectIdL(TXmlEngElement aElement, TInt aId)
+{
+    TXmlEngAttr idAttr = aElement.AttributeNodeL(KIdAttrName());
+    TBuf8<KMaxIntegerLen> idVal;
+    idVal.Num(aId);
+    if(idAttr.NotNull())
+    {
+        idAttr.SetValueL(idVal);
+    }
+    else
+    {
+        aElement.AddNewAttributeL(KIdAttrName(), idVal);
+    }
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::SetObjectRefIdL
+// -----------------------------------------------------------------------------
+//
+void UpnpCdUtils::SetObjectRefIdL(TXmlEngElement aElement, TInt aRefId)
+{
+    TXmlEngAttr refIdAttr = aElement.AttributeNodeL( KRefID() );
+    TBuf8<KMaxIntegerLen> refIdVal;
+    refIdVal.Num( aRefId );
+    if( refIdAttr.NotNull() )
+        {
+        refIdAttr.SetValueL( refIdVal );
+        }
+    else
+        {
+        aElement.AddNewAttributeL( KRefID(), refIdVal );
+        }
+}
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::SetObjectParentIdL
+// -----------------------------------------------------------------------------
+//
+void UpnpCdUtils::SetObjectParentIdL(TXmlEngElement aElement, TInt aParentId)
+{
+    TXmlEngAttr parentIdAttr = aElement.AttributeNodeL( KParentID() );
+    TBuf8<KMaxIntegerLen> parentIdVal;
+    parentIdVal.Num( aParentId );
+    if( parentIdAttr.NotNull() )
+        {
+        parentIdAttr.SetValueL( parentIdVal );
+        }
+    else
+        {
+        aElement.AddNewAttributeL( KParentID(), parentIdVal );
+        }
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::SetRestrictedFieldL
+// -----------------------------------------------------------------------------
+//
+void UpnpCdUtils::SetRestrictedFieldL(TXmlEngElement aElement, TBool aRestrictedFlag)
+{
+    TXmlEngAttr restrictedField = aElement.AttributeNodeL( KRestricted() );    
+    TBuf8<KMaxIntegerLen> restrictedVal;
+    
+    if( aRestrictedFlag )
+        {
+        restrictedVal.Copy( KTrueValue8 );
+        }    
+    else
+        {
+        restrictedVal.Copy( KFalseValue8 );
+        }    
+
+    if( restrictedField.NotNull() )
+        {
+        restrictedField.SetValueL( restrictedVal );
+        }
+    else
+        {
+        aElement.AddNewAttributeL( KRestricted(), restrictedVal );
+        }
+}
+
+// UpnpCdUtils::SetObjectIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void UpnpCdUtils::SetContainerIdL(TXmlEngElement aElement, TInt aParentId)
+{
+    TXmlEngAttr idAttr = aElement.AttributeNodeL(KParentID());
+    TBuf8<KMaxIntegerLen> idVal;
+    idVal.Num(aParentId);
+    if(idAttr.NotNull())
+    {
+        idAttr.SetValueL(idVal);
+    }
+    else
+    {
+        aElement.AddNewAttributeL(KParentID(), idVal);
+    }
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::IsElementRequiredL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool UpnpCdUtils::IsElementRequiredL(TXmlEngElement aElement)
+{
+    TBool ret = EFalse;
+    TXmlEngAttr reqAttr = aElement.AttributeNodeL( KRequiredAtrName() );
+    if(reqAttr.NotNull())
+    { // element required
+        ret = ETrue;
+        reqAttr.Remove();
+    }   
+    return ret;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::BuildImportUriL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+HBufC8* UpnpCdUtils::BuildImportUriLC(TInt aResId)
+{
+	// get next resId
+	TBuf8<KMaxIntegerLen + KRandomRangeLength> num;
+	TBuf8<KMaxIntegerLen + KRandomRangeLength> uriId;
+	num.Num(aResId);
+	uriId.Justify(num, KMaxIntegerLen + KRandomRangeLength, ERight, '0');
+
+	// build uri
+	HBufC8* impUri = HBufC8::NewLC(
+						  KHttpTag().Length()
+						+ KIpPortPlaceholder8().Length()						
+						+ KSlash8().Length()						
+						+ KMaxLongIntegerLen
+						+ KRandomRangeLength );
+	TPtr8 impUriPtr(impUri->Des());
+	impUriPtr.Append(KHttpTag);
+	impUriPtr.Append(KIpPortPlaceholder8);
+	impUriPtr.Append(KSlash8);		
+	impUriPtr.Append(uriId);
+	
+	
+	return impUri;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::BuildImportUriL
+// -----------------------------------------------------------------------------
+HBufC8* UpnpCdUtils::BuildImportUriShorterLC(TInt64 aResId)
+{
+	// get next resId
+	TBuf8<KMaxIntegerLen > num;
+	TBuf8<KMaxIntegerLen > uriId;
+	num.Num(aResId);
+	uriId.Justify(num, KMaxIntegerLen , ERight, '0');
+
+	// build uri
+	HBufC8* impUri = HBufC8::NewLC(
+						  KHttpTag().Length()
+						+ KIpPortPlaceholder8().Length()						
+						+ KSlash8().Length()						
+						+ KMaxLongIntegerLen
+						 );
+	TPtr8 impUriPtr(impUri->Des());
+	impUriPtr.Append(KHttpTag);
+	impUriPtr.Append(KIpPortPlaceholder8);
+	impUriPtr.Append(KSlash8);		
+	impUriPtr.Append(uriId);
+	
+	
+	return impUri;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::BuildContentUriL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+HBufC8* UpnpCdUtils::BuildContentUriL(TInt aResId, const TDesC& aFileExten,
+                                           TDesC8& aObjectId)
+{
+    HBufC8* number = UpnpCdUtils::RandomizeL(KRandomMax);
+    CleanupStack::PushL(number);
+    HBufC8* number2 = UpnpCdUtils::RandomizeL(KRandomMax);
+    CleanupStack::PushL(number2);
+    
+	HBufC8* impUri = BuildImportUriShorterLC(aResId);	
+	
+    HBufC8* fileExten8 = UpnpCdUtils::DesToDes8LC(aFileExten);
+	HBufC8* contUri = HBufC8::NewLC(
+								impUri->Length() 
+								+ number->Des().Length()
+								+ number2->Des().Length()
+								+ KSlash().Length()
+                                + aObjectId.Length()                                
+                                + fileExten8->Length());
+	TPtr8 contUriPtr(contUri->Des());
+	contUriPtr.Copy(*impUri);
+	contUriPtr.Append(*number);	
+	contUriPtr.Append(*number2);
+	contUriPtr.Append(KSlash);
+    contUriPtr.Append(aObjectId);    
+    contUriPtr.Append(*fileExten8);
+
+    // clean up
+	CleanupStack::Pop(contUri);
+    CleanupStack::PopAndDestroy(fileExten8);
+	CleanupStack::PopAndDestroy(impUri);
+	CleanupStack::PopAndDestroy(number2);
+	CleanupStack::PopAndDestroy(number);
+	return contUri;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::RandomizeL
+// -----------------------------------------------------------------------------
+HBufC8* UpnpCdUtils::RandomizeL(TInt aRange)
+{
+    TUint number = Math::Random();
+    number = number % aRange;    
+    HBufC8* numberDes = HBufC8::NewL(KRandomRangeLength);               
+   	TBuf8<KRandomRangeLength> num;	
+	num.Num(number);
+    numberDes->Des().Justify(num, KRandomRangeLength, ERight, '0');    
+
+    return numberDes;
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::ValidateFilePath
+// -----------------------------------------------------------------------------
+void UpnpCdUtils::ValidateFilePath(TDes8& aPath)
+{
+    // replace
+    for(TInt i = 0; i < aPath.Length(); i++)
+    {
+        if( aPath[i] == ':' && i!=1 || 
+            aPath[i] == '<'         ||
+            aPath[i] == '>'         ||
+            aPath[i] == '\"'        ||
+            aPath[i] == '/'         ||    
+            aPath[i] == '|'         ||
+            aPath[i] == '*'       ||
+            aPath[i] == '?'
+          )
+        {
+            aPath[i] = '_';
+        }
+    }
+}
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::ValidateFilePath
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void UpnpCdUtils::ValidateFilePath(TDes& aPath)
+{
+    // replace
+    for(TInt i = 0; i < aPath.Length(); i++)
+    {
+        if( aPath[i] == ':' && i!=1 || 
+            aPath[i] == '<'         ||
+            aPath[i] == '>'         ||
+            aPath[i] == '\"'        ||
+            aPath[i] == '/'         ||    
+            aPath[i] == '|'         ||
+            aPath[i] == '*'       ||
+            aPath[i] == '?'
+          )
+        {
+            aPath[i] = '_';
+        }
+    }
+}
+
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::ValidateSrcUriL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void UpnpCdUtils::ValidateSrcUriL(TDesC8& aPath,TDesC8& aIp )
+{
+    // Check if parsing is correct
+    TUriParser8 srcParser;
+    if (!(srcParser.Parse(aPath) == KErrNone))
+    {
+        User::Leave( ENoSourceResource );                        
+    }
+    
+    // check if source uri is correct one
+    TInt pos = aPath.Find(aIp);
+    if(pos != UpnpHTTP::KHTTPUrl().Length())
+        {
+        User::Leave( ENoSourceResource ); 
+        }
+
+    if (!(aPath.Find( UpnpHTTP::KHTTPUrl ) == 0))
+    {
+        User::Leave( ENoSourceResource );                        
+    }
+    TInt len = UpnpHTTP::KHTTPUrl().Length() + aIp.Length();
+    if ( aPath.Length() <= len || aPath[ len ] != '/' )
+        {
+        User::Leave( ENoSourceResource );
+        }
+}
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::EscapeAposL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+HBufC* UpnpCdUtils::EscapeAposL(const TDesC&  aValue)
+{
+    if (aValue.Length())
+    {            
+        HBufC8* value8 = DesToDes8LC(aValue);
+        HBufC8* valueReplaced8 = UpnpString::StringReplaceL(*value8,_L8("'"),_L8("\'\'"));
+        CleanupStack::Pop(value8);
+        HBufC* valueReplaced16 = UpnpCdUtils::Des8ToDesL(*valueReplaced8);
+        delete valueReplaced8;
+        delete value8;        
+        return valueReplaced16;
+    }
+    else
+    {
+        HBufC* valueReplaced16 = aValue.AllocL();
+        return valueReplaced16;
+    }   
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateDateL()
+// Only Those date string is validate
+// YYYY-MM-DD
+// YYYY-MM-DDTHH:MM:SS
+// YYYY-MM-DDTHH:MM:SSZ
+// YYYY-MM-DDTHH:MM:SS.xxx
+// YYYY-MM-DDTHH:MM:SS.xxxZ
+// YYYY-MM-DDTHH:MM:SS+HH:MM
+// YYYY-MM-DDTHH:MM:SS.xxx+HH:MM
+// -----------------------------------------------------------------------------
+//
+TBool UpnpCdUtils::ValidateDateL( TPtrC8 aValue )
+    {         
+    TBool wrong = 0;
+
+    TInt dateLength = aValue.Length();                                         
+
+    if ((dateLength!=EDay)&&(dateLength!=ESecond)&&
+        (dateLength!=ETimeOffset1)&&(dateLength!=EMiliSecond)&&
+        (dateLength!=ETimeOffset2)&&(dateLength!=EZone1)&&
+        (dateLength!=EZone2))                                     
+        {
+        return EFalse;                
+        }
+    else
+        {
+        const TChar KColo = ':';
+        const TChar KMinus = '-';
+        const TChar KPlus = '+';
+        const TChar KDot = '.';       
+        const TChar KT = 'T';
+        const TChar KZ = 'Z'; 
+
+        TChar ch;
+        TLex8 input(aValue);         
+        for (TInt i =0; i<aValue.Length();i++)
+            {
+            ch = input.Get();         
+            if ((i!=EYear)&&(i!=EMonth)&&(i!=EDay)&&(i!=EHour)&&(i!=EMinute)&&(i!=ESecond)&&(i!=EHourOffset1)&&(i!=EMiliSecond)&&(i!=EHourOffset2))
+                {                
+                if (!ch.IsDigit())          
+                    {
+                    wrong = ETrue;
+                    break;  
+                    }
+                }
+            else if (((i==EYear)||(i==EMonth))&&(ch!=KMinus))
+                {
+                wrong = ETrue;
+                break;  
+                }    
+            else if ((i==EDay)&&(ch!= KT))
+                {
+                wrong = ETrue;
+                break;  
+                }     
+            else if (((i==EHour)||(i==EMinute)||(i==EHourOffset2))&&(ch!=KColo))
+                {
+                wrong = ETrue;
+                break;  
+                }     
+            else if (((i==ESecond)&&(dateLength==ETimeOffset1))&&((ch!=KPlus)&&(ch!=KMinus)))
+                {
+                wrong = ETrue;
+                break;  
+                }    
+            else if (((i==ESecond)&&(dateLength==EZone1))&&(ch!=KZ))
+                {
+                wrong = ETrue;
+                break;  
+                }
+            else if (((i==ESecond)&&((dateLength==ETimeOffset2)||(dateLength==EZone2)||(dateLength==EMiliSecond)))&&(ch!=KDot))
+                {
+                wrong = ETrue;
+                break;  
+                }              
+            else if (((i==EHourOffset1)&&(dateLength==ETimeOffset1))&&(ch!=KColo))
+                {
+                wrong = ETrue;
+                break;  
+                }   
+                                
+            else if ((i==EHourOffset1)&&((dateLength==ETimeOffset2)||(dateLength==EZone2)||(dateLength==EMiliSecond)))
+                {                    
+                if (!ch.IsDigit())          
+                    {
+                    wrong = ETrue;
+                    break;  
+                    }
+                }
+            else if (((i==EMiliSecond)&&(dateLength==ETimeOffset2))&&((ch!=KPlus)&&(ch!=KMinus)))
+                {
+                wrong = ETrue;
+                break;  
+                }            
+            else if (((i==EMiliSecond)&&(dateLength==EZone2))&&(ch!=KZ))
+                {
+                wrong = ETrue;
+                break;  
+                }      
+            else if ((i==EMiliSecond)&&(dateLength==ETimeOffset1))
+                {                
+                if (!ch.IsDigit())          
+                    {
+                    wrong = ETrue;
+                    break;  
+                    }                               
+                }
+            }
+        }
+            
+        TInt yearInt=0;
+        TInt monthInt=0;
+        TInt dayInt=0;
+        TInt hourInt=0;
+        TInt minuteInt=0;
+        TInt secondInt=0;
+        TInt milisecondInt=0;
+        TInt hhInt=0;
+        TInt mmInt=0;
+        TDateTime a;
+
+        TPtrC8 yearPtrC = aValue.Left(4);
+        TPtrC8 tmp = aValue.Mid(5);
+        TPtrC8 monthPtrC = tmp.Left(2);
+        tmp.Set(aValue.Mid(8));
+        TPtrC8 dayPtrC = tmp.Left(2);
+
+        TLex8 lexer(yearPtrC);	
+        lexer.Val(yearInt);
+        lexer.Assign(monthPtrC);
+        lexer.Val(monthInt);
+        monthInt--;
+        TMonth monthEnum = (TMonth)monthInt;
+        lexer.Assign(dayPtrC);
+        lexer.Val(dayInt);
+
+        if (dateLength>EDay)                
+            {
+            tmp.Set(aValue.Mid(11));
+            TPtrC8 hourPtrC = tmp.Left(2);
+            tmp.Set(aValue.Mid(14));
+            TPtrC8 minutePtrC = tmp.Left(2);
+            tmp.Set(aValue.Mid(17));
+            TPtrC8 secondPtrC = tmp.Left(2);  
+            lexer.Assign(hourPtrC);
+            lexer.Val(hourInt);
+            lexer.Assign(minutePtrC);
+            lexer.Val(minuteInt);
+            lexer.Assign(secondPtrC);
+            lexer.Val(secondInt);  
+            }                
+        if ((dateLength==ETimeOffset2)||(dateLength==EZone2)||(dateLength==EMiliSecond))
+            {
+            tmp.Set(aValue.Mid(20)); 
+            TPtrC8 milisecondPtrC = tmp.Left(3);  
+            lexer.Assign(milisecondPtrC);
+            lexer.Val(milisecondInt);
+            }
+        if (dateLength==ETimeOffset1)
+            {
+            tmp.Set(aValue.Mid(20)); 
+            TPtrC8 hhOffset = tmp.Left(2);
+            tmp.Set(aValue.Mid(23)); 
+            TPtrC8 mmOffset = tmp.Left(2);      
+            lexer.Assign(hhOffset);
+            lexer.Val(hhInt);
+            
+            if (hhInt>12) 
+                {
+                wrong = ETrue;                
+                }
+            
+            lexer.Assign(mmOffset);
+            lexer.Val(mmInt);     
+            
+            if (mmInt>59) 
+                {
+                wrong = ETrue;   
+                }
+            }
+            
+        if (dateLength==ETimeOffset2)
+            {
+            tmp.Set(aValue.Mid(24)); 
+            TPtrC8 hhOffset = tmp.Left(2);
+            tmp.Set(aValue.Mid(27)); 
+            TPtrC8 mmOffset = tmp.Left(2);     
+            lexer.Assign(hhOffset);
+            lexer.Val(hhInt);
+            if (hhInt>12) 
+                {
+                wrong = ETrue;                
+                }
+            lexer.Assign(mmOffset);
+            lexer.Val(mmInt); 
+                
+            if (mmInt>59) 
+                {
+                wrong = ETrue;                
+                }
+            }
+            
+        TInt err = a.Set(yearInt,monthEnum,dayInt,hourInt,minuteInt,secondInt,milisecondInt);
+        if (err<0) 
+            {
+            wrong = ETrue;    
+            }
+
+    if (wrong)
+        {                        
+        return EFalse;      
+        }
+
+    return ETrue;
+    }
+    
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::StringToUint
+// -----------------------------------------------------------------------------
+    TInt UpnpCdUtils::StringToTUint(const TDesC8& aStr, TUint* aInt)
+	{
+	if( 0 == aStr.Length() || aInt == NULL)
+		{
+		return KErrArgument;
+		}
+	TLex8 lex( aStr );
+	return lex.Val( *aInt );
+	}                   
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::SplitStringByDelimeter
+// -----------------------------------------------------------------------------
+void UpnpCdUtils::SplitStringByDelimeter(TLex8& aLexeme, TChar aDelimeter)
+{
+	aLexeme.Mark(); 
+	while( (aLexeme.Peek() != aDelimeter) && (!aLexeme.Eos()) )
+	{
+		aLexeme.Inc();		
+	}
+}
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::Skip
+// -----------------------------------------------------------------------------
+void UpnpCdUtils::Skip(TLex8& aLexer, TInt aValue)
+{
+    if(!aLexer.Eos())
+	{
+	    aLexer.Inc(aValue);
+	}
+}	
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::AreDigitsInSpecificRange
+// -----------------------------------------------------------------------------    
+TBool UpnpCdUtils::AreDigitsInSpecificRange(const TDesC8& aInput, TInt aNumber, TBool aExactDigitsNumber, TUint32 aRange)
+{
+    // checking length
+    TInt length = aInput.Length();
+    
+    if(aExactDigitsNumber)
+    {
+        // if exact number of digits = real number of digits -> ok
+        if(length != aNumber) 
+            return EFalse;
+    }
+    else
+    {
+        // if real number of digits fit into specific range -> ok
+        if(length > aNumber || length < 1)
+            return EFalse;
+    }
+    
+    // checking digits
+    for(TInt i=0; i < length; i++)
+    {
+        // if input characters are all digits -> ok
+        TChar tmp( aInput[i] );       
+        if( !tmp.IsDigit() )
+            return EFalse;            
+    }
+    
+    // checking range
+    TLex8 field(aInput);	        
+    TUint32 value;
+    
+    // if e.g minutes fit into range: 00-59 -> ok
+    TInt err = field.BoundedVal(value, EDecimal, aRange);
+    
+    if(err != KErrNone)
+        return EFalse;
+    
+    return ETrue;
+}    
+
+// -----------------------------------------------------------------------------
+// UpnpCdUtils::ValidateDurationValueL
+// -----------------------------------------------------------------------------
+TBool UpnpCdUtils::ValidateDurationValue(const TDesC8& aInput)
+{
+	/*
+	* 7.3.22 MM DIDL-Lite res@duration Format
+	* Requirement [7.3.22.1]: The syntax of the res@duration must be compliant to the following definition:
+	*    - duration = hours ":" minutes ":" seconds
+	*    - hours = 1*5 DIGIT; 0-99999
+	*    - minutes = 2 DIGIT ; 00-59
+	*    - seconds = 2 DIGIT ["." 3 DIGIT] ; 00-59 (.000-.999)
+	*/
+    TChar KColon(':');
+    TChar KDot('.');
+
+    TInt fieldNum = 1;        
+    TLex8 input(aInput);
+		
+	while( !input.Eos() )
+	{		
+	    // extract subsequent field
+		SplitStringByDelimeter( input, KColon );
+		TPtrC8 field( input.MarkedToken() );
+		
+		// if its length != 0 ...
+		if( field != KNullDesC8() )
+		{		
+		    if(fieldNum == 1)
+		    {	
+		        // if 1st field = 1-5 digits in range: 0-99999 -> ok
+		        if( !AreDigitsInSpecificRange(field, 5, EFalse, 99999) )
+		            return EFalse;
+		            
+		        ++fieldNum;
+		    }
+		    else if(fieldNum == 2)
+		    {
+		        // if 2nd field = exactly 2 digits in range: 0-59 -> ok
+		        if( !AreDigitsInSpecificRange(field, 2, ETrue, 59) )
+		            return EFalse;
+		        
+		        ++fieldNum;
+		    }		    
+		    else if(fieldNum == 3)
+		    {
+		        TInt length = field.Length();
+		    
+		        TLex8 fourth(field);		        		        
+		        SplitStringByDelimeter( fourth, KDot );
+		        
+		        // if 3rd field = exactly 2 digits in range: 0-59 -> ok
+		        TPtrC8 leftPart( fourth.MarkedToken() );
+		        if( !AreDigitsInSpecificRange(leftPart, 2, ETrue, 59) )
+		            return EFalse;
+		        
+		        Skip(fourth, 1);
+		        TPtrC8 rightPart( fourth.Remainder() );
+		        
+		        // if 3rd field is divided by dot and right part is exactly 3 digits in range: 000-999 -> ok
+		        if( rightPart != KNullDesC8() )
+		        {		        
+		            if( !AreDigitsInSpecificRange(rightPart, 3, ETrue, 999) )
+		                return EFalse;
+		        }
+		        else if( field[length-1] == '.' )
+		            return EFalse;
+		        
+		        ++fieldNum;
+		    }
+		    else
+		        return EFalse;
+		}
+		else
+		{
+		    return EFalse;
+		}
+				
+		Skip(input,1);	
+	}
+	
+	// if while loop is completed successfully -> ok
+	if(fieldNum == 4)
+	    return ETrue;
+	else
+	    return EFalse;	    
+}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::StringToInteger
+// -----------------------------------------------------------------------------
+//
+TInt UpnpCdUtils::StringToInteger(const TDesC8& aStr, TInt* aInt)
+    {
+    if( aStr.Length() == 0 || aInt == NULL)
+        {
+        return KErrArgument;
+        }
+    
+    TLex8 lex(aStr);    
+    lex.Mark();
+    TBool isFirst = ETrue;
+    
+    while( !lex.Eos() )
+        {   
+        TChar tmp = lex.Get();
+        
+        if( tmp.IsDigit() )
+            {
+            if(isFirst && tmp == '0' && aStr.Length() > 1)
+                {
+                return KErrArgument;
+                }                        
+            }
+        else
+            {
+            return KErrArgument;
+            }
+        
+        isFirst = EFalse;        
+        }
+               
+    lex.UnGetToMark();                    
+    return lex.Val( *aInt );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpcontainerupdateid.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,32 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Container Update Ids
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpcontainerupdateid.h"
+
+// -----------------------------------------------------------------------------
+// TUpnpContainerUpdateId::TUpnpContainerUpdateId
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+TUpnpContainerUpdateId::TUpnpContainerUpdateId()
+{
+}
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpcontentdirectory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,3726 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Directory
+ *
+*/
+
+
+// INCLUDE FILES
+#include <fbs.h>
+#include <uri8.h>
+#include <pathinfo.h>
+#include <xmlengdom.h>
+#include <xmlengserializationoptions.h>
+#include <xmlengdomparser.h>
+#include <sysutil.h>
+#include <bautils.h>
+#include <caf/caf.h>
+
+#include "upnpsender.h"
+#include "upnpcontentdirectory.h"
+#include "upnperrors.h"
+#include "upnpdominterface.h"
+#include "upnpstring.h"
+#include "upnpargument.h" 
+#include "upnphttpmessagefactory.h" 
+#include "upnpcons.h"
+#include "upnpdevice.h"
+#include "upnpfileutils.h"
+#include "upnpcommonupnplits.h"
+#include "upnpcontainerupdateid.h"
+#include "upnpcontentdirectorydb.h"
+#include "upnpfiletransfertimerobserver.h"
+#include "upnperror.h"
+#include "upnpcustomlog.h"
+#include "upnpprotocolinfo.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpresourcesbean.h"
+#include "upnpcdutils.h"
+#include "upnpmetadatastorage.h"
+#include "upnpautodestroyobjectlist.h"
+#include "upnpautodestroyobject.h"
+#include "upnpcontentdirectoryeventobserver.h"
+#include "upnpfiletransferevent.h"
+#include "upnpfiletransfer.h"
+#include "upnpprotocolinfolocal.h"
+#include "upnpxmlcontentfilter.h"
+#include "upnpstatehandler.h"
+#include "upnptransferuploader.h"
+#include "upnpmimemapper.h"
+#include "upnptransfercontroller.h"
+#include "upnptransferinterface.h"
+#include "upnpdlnafilter.h"
+#include "upnphttpserversession.h"
+#include "upnphttpserverruntime.h"
+#include "upnpsettings.h"
+#include "upnpdeviceimplementationbase.h"
+#include "upnpsecuritymanager.h"
+#include "upnpmediaserversettings.h"
+
+// Constant definitions
+using namespace UpnpPaths;
+using namespace UpnpDlnaProtocolInfo;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// DestroyRPointerArray
+// Defined in upnpelementfactory.cpp
+// -----------------------------------------------------------------------------
+//
+void DestroyRArray( TAny* aArray );
+void RPointerArrayTPtrC8( TAny* aArray )
+    {
+    RPointerArray<TPtrC8>* array =
+            reinterpret_cast<RPointerArray<TPtrC8>*>(aArray);
+    array->ResetAndDestroy( );
+    }
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CUpnpContentDirectory
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectory::CUpnpContentDirectory( CUpnpDevice& aDevice,
+    MUpnpThumbnailCreatorObserver* aThmbObs, MUpnpTransferInterface* aTransfer ) :
+
+    CUpnpServiceImplementation(aDevice), iThmbObs(aThmbObs),
+            iTransferHandler(aTransfer)
+
+    {
+    SetExecutedAction( EUndefinedAction );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::~CUpnpContentDirectory
+// C++ default destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectory::~CUpnpContentDirectory()
+    {
+    delete iDownloadDir;
+    delete iThumbDir;
+    delete iElementdb;
+
+    delete iTransferController;
+    delete iMimeToExtMap;
+
+    delete iContentDirectoryDb;
+
+    iThObjectIds.Close( );
+
+    iThumbnailCreators.ResetAndDestroy( );
+
+    iDOMImpl.Close( );
+    if ( iBitmapServerConnection == KErrNone )
+        RFbsSession::Disconnect( );
+    iFs.Close( );
+    if ( iEcomUsed )
+        {
+        REComSession::FinalClose( );
+        }
+    delete iAutoDestroyObjects;
+    delete iStateHandler;
+    if ( iHttpServerSession )
+        {
+        iHttpServerSession->Stop();
+        }
+    delete iHttpServerSession;
+    delete iDlnaFilter;
+    delete iSecurityManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ConstructL
+// Two-phased constructor.
+// Initialize variables, set parent service and create XML reader.
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::ConstructL( TUpnpCdSettings aSettings,
+    CUpnpMetadataStorage* aMetadataStorage )
+    {
+    iDOMImpl.OpenL( );
+
+    iTransferController = CUpnpTransferController::NewL( this );
+
+    iMimeToExtMap = CUpnpMimeMapper::NewL( );
+
+    BaseConstructL( aSettings.iDescriptionPath, KContentDirectoryType( ) );
+
+    User::LeaveIfNull( aSettings.iDevice );
+    
+    CUpnpSecurityManager* secMan = CUpnpSecurityManager::NewInstanceFromUpnpSettingsL();
+    
+    iSecurityManager = secMan;
+    iDlnaFilter = CUpnpDlnaFilter::NewL( this, secMan );
+    
+    iElementdb = CUpnpElementFactory::NewL( aSettings.iObjectsXmlPath );
+    iElementdb->GetContentDirectoryReference( this );
+
+    SetStateVariableL( KSystemUpdateID( ), KZero( ) );
+    SetStateVariableL( KContainerUpdateIDs( ), UpnpCD::KEmptyString( ) );
+    SetStateVariableL( KTransferIDs( ), UpnpCD::KEmptyString( ) , EFalse );
+    SetStateVariableL( KSortCapsVariableName( ), KSortCapabilities( ) );
+    SetStateVariableL( KSearchCapsVariableName( ), KSearchCapabilities( ) );
+
+    // file session 
+    User::LeaveIfError( iFs.Connect( ) );
+
+    iBitmapServerConnection = RFbsSession::Connect( );
+    iDownloadDir = aSettings.iDownloadDir.AllocL( );
+    iThumbDir = aSettings.iThumbnailDir.AllocL( );
+    iContentDirectoryDb = CUpnpContentDirectoryDb::NewL( aMetadataStorage );
+    iAutoDestroyObjects = CUpnpAutoDestroyObjectList::NewL( );
+    iCreateThumbnails = aSettings.iCreateThumbnail;
+    iMaxRequestCount = aSettings.iMaxRequestCount;
+    iEventObserver = aSettings.iEventObserver;
+    iStateHandler = CUpnpStateHandler::NewL( this );
+    
+    ConstructHttpL();
+    }
+
+void CUpnpContentDirectory::ConstructHttpL()
+    {
+    TInt iapId = CUpnpSettings::GetIapL();
+    iHttpServerSession = CUpnpHttpServerSession::NewL( iapId, *this );
+    iHttpServerSession->DefaultRuntime().SetCreator( *this );
+    iHttpServerSession->StartL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectory* CUpnpContentDirectory::NewL(
+    TUpnpCdSettings aSettings, CUpnpMetadataStorage* aMetadataStorage,
+    MUpnpTransferInterface* aTransfer )
+    {
+    CUpnpContentDirectory* cd = new (ELeave) CUpnpContentDirectory( *aSettings.iDevice,
+            aSettings.iThmbObs,
+            aTransfer
+    );
+    CleanupStack::PushL( cd );
+    cd->ConstructL( aSettings, aMetadataStorage );
+    CleanupStack::Pop( cd );
+    return cd;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ActionReceivedLD
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::ActionReceivedLD( CUpnpAction* aAction )
+    {
+    CleanupStack::PushL( aAction );
+    //check security
+    if ( iSecurityManager &&
+            KErrNone != iSecurityManager->AuthorizeAction( aAction ) )
+        {
+        //server returns upnp error action failed when not authorized
+        User::Leave(EActionFailed);
+        }
+    // in case of low disk space
+    if ( !IsDbOrDiskProblemL( aAction ) )
+        {
+        // handle event
+        TInt ret = EUpnpUndefined;
+        TRAPD( err, ret = DoActionReceivedL( aAction ) );
+        if ( DataBaseHasBeenRecoveredL( err ) )
+            {
+            TRAP( err, ret = DoActionReceivedL( aAction ) );
+            if ( err == KErrCorrupt )
+                {
+                err = iContentDirectoryDb->RecreateDatabaseFile();
+                }
+            }
+        else if ( err == KErrNone )
+            {
+            err = ret;
+            }
+        LOGS( "ContentDirectory ActionReceivedLD sending soon." );
+        DoSendActionL( aAction, TUpnpError( err ) );
+        }
+    CleanupStack::PopAndDestroy( aAction );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DoActionReceivedL
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::DoActionReceivedL( CUpnpAction* aAction )
+    {
+    // sendAndDestroy defines that after processing action must be 
+    // sent and destroyed
+    TUpnpErrorCode err = EUndefined;
+
+    // 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( KBrowse ) == 0 )
+        {
+        err = BrowseL( aAction );
+        }
+    else if ( name.Compare( KCreateReference ) == 0 )
+        {
+        err = CreateReferenceL( aAction );
+        }
+    else if ( name.Compare( KCreateObject ) == 0 )
+        {
+        LOGS( "ContentDirectory: Creating a new object" );
+        err = CreateObjectL( aAction );
+        }
+    else if ( name.Compare( KDeleteResource ) == 0 )
+        {
+        err = DeleteResourceL( aAction );
+        }
+    else if ( name.Compare( KDestroyObject ) == 0 )
+        {
+        err = DestroyObjectL( aAction );
+        }
+    else if ( name.Compare( KExportResource ) == 0 )
+        {
+        err = ExportResourceL( aAction );
+        }
+    else if ( name.Compare( KGetSearchCapabilities ) == 0 )
+        {
+        err = GetSearchCapabilitiesL( aAction );
+        }
+    else if ( name.Compare( KGetSortCapabilities ) == 0 )
+        {
+        err = GetSortCapabilitiesL( aAction );
+        }
+    else if ( name.Compare( KGetSystemUpdateID ) == 0 )
+        {
+        err = GetSystemUpdateIdL( aAction );
+        }
+    else if ( name.Compare( KGetTransferProgress ) == 0 )
+        {
+        err = GetTransferProgressL( aAction );
+        }
+    else if ( name.Compare( KImportResource ) == 0 )
+        {
+        err = ImportResourceL( aAction );
+        }
+    else if ( name.Compare( KStopTransferResource ) == 0 )
+        {
+        err = StopTransferResourceL( aAction );
+        }
+    else
+        {
+        err = EInvalidAction;
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DoActionReceivedCDL
+// -----------------------------------------------------------------------------
+//    
+void CUpnpContentDirectory::HttpGetStartedSoapNotifyL( TInt /*aSessionId*/)
+    {
+    // not needed upnp response returned by ActionReceivedCDL
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DoActionReceivedCDL
+// -----------------------------------------------------------------------------
+//    
+void CUpnpContentDirectory::HttpPostStartedL( TInt /*aSessionId*/)
+    {
+    // not needed upnp response returned by ActionReceivedCDL
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::UnknownHttpEventReceivedL 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectory::UnknownHttpEventReceivedL( CUpnpHttpMessage& aHttpMsg )
+    {
+    CUpnpFileTransferEvent* transferEvent =
+            iTransferController->TransferL( aHttpMsg.SessionId( ) );
+    if ( !transferEvent )
+        {
+        return;
+        }
+
+    TInt err = aHttpMsg.Error( );
+    if ( err != EHttpRequestTimeout && err != EHttpInsufficientStorage )
+        {
+        err = EHttpOk;
+        }
+
+    HBufC* fileName16 = UpnpString::ToUnicodeL( aHttpMsg.InFilename( ) );
+    CleanupStack::PushL( fileName16 );
+    transferEvent->SetFilePathL( *fileName16 );
+    CleanupStack::PopAndDestroy( fileName16 );
+
+    iTransferController->HttpResponseReceivedL( aHttpMsg.SessionId( ), err );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::IsDrmFileL 
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectory::IsDrmFileL( const TDesC8& aFileName )
+    {
+    HBufC* tmp = UpnpCdUtils::Des8ToDesLC( aFileName );
+    TBool ret = IsDrmFileL( *tmp );
+    CleanupStack::PopAndDestroy( tmp );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::IsDrmFileL 
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectory::IsDrmFileL( const TDesC& aFileName )
+    {
+    if ( !BaflUtils::FileExists( iFs, aFileName ) )
+        {
+        return EFalse;
+        }
+    TBool ret = EFalse;
+    TInt value=0, err;
+
+    ContentAccess::CManager *manager = ContentAccess::CManager::NewL( );
+    CleanupStack::PushL( manager );
+
+    ContentAccess::CVirtualPath *path =
+            ContentAccess::CVirtualPath::NewL( aFileName );
+    CleanupStack::PushL( path );
+
+    ContentAccess::TVirtualPathPtr virtualPath = *path;
+
+    err = manager->GetAttribute( ContentAccess::EIsProtected, value,
+        virtualPath );
+    if ( err == KErrNone )
+        {
+        if ( value )
+            {
+            // delete file
+            iFs.Delete( aFileName );
+            ret = ETrue;
+            }
+        }
+    CleanupStack::PopAndDestroy( 2, manager );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateReferenceL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::CreateReferenceL( CUpnpAction*& aAction )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+
+    // Get IDs from action 
+    TInt conId( KErrNotFound );
+    TInt objId( KErrNotFound );
+
+    TInt err = UpnpCdUtils::StringToInteger(
+        aAction->ArgumentValue( KContainerID ), &conId );
+    if ( err!=KErrNone )
+        {
+        err=ENoContainer;
+        User::Leave( ENoContainer );
+        }
+
+    err = UpnpCdUtils::StringToInteger(
+        aAction->ArgumentValue( UpnpCD::KObjectID ), &objId );
+    if ( err!=KErrNone )
+        {
+        err=ENoContainer;
+        User::Leave( ENoSuchObject );
+        }
+
+    objId = iContentDirectoryDb->ReferedObjectIdL( objId );
+
+    RXmlEngDocument conDidl;
+    RXmlEngDocument objDidl;
+    CleanupClosePushL( conDidl );
+    CleanupClosePushL( objDidl );
+
+    ret = iContentDirectoryDb->GetObjectL( conId, conDidl, KAsterisk8 );
+    if ( ret != EUpnpOk )
+        User::Leave( ENoContainer );
+
+    ret = iContentDirectoryDb->GetObjectL( objId, objDidl, KAsterisk8 );
+    if ( ret != EUpnpOk )
+        User::Leave( ENoSuchObject );
+
+    TXmlEngElement con = conDidl.DocumentElement().FirstChild().AsElement( );
+    TXmlEngElement obj = objDidl.DocumentElement().FirstChild().AsElement( );
+
+    if ( obj.Name().Compare( KItem ) != 0 )
+        {
+        User::Leave( ENoSuchObject );
+        }
+    if ( con.Name().Compare( KContainer ) != 0 )
+        {
+        User::Leave( ENoContainer );
+        }
+    if ( iContentDirectoryDb->CheckObjectRestrictionL( conId ) != EUpnpOk )
+        {
+        User::Leave( ERestrictedParentObject );
+        }
+
+    TInt refId;
+    RXmlEngDocument refDidl = iContentDirectoryDb->PrepareDidlDocumentL( );
+    CleanupClosePushL( refDidl );
+
+    TXmlEngElement refEl = refDidl.DocumentElement().AddNewElementSameNsL( KItem( ) );
+
+    refEl.AddNewAttributeL( KRefID( ),
+        aAction->ArgumentValue( UpnpCD::KObjectID ) );
+
+    refEl.AddNewAttributeL( KParentID( ),
+        aAction->ArgumentValue( KContainerID ) );
+
+    refEl.AddNewAttributeL( KRestricted( ), KFalseValue8( ) );
+
+    // title
+    TXmlEngElement objTitle;
+    UpnpDomInterface::GetElementL( obj, objTitle, KObjTiltleColName8( ) );
+    refEl.AppendChildL( objTitle.Unlink().AsElement( ) );
+
+    // class
+    TXmlEngElement objClass;
+    UpnpDomInterface::GetElementL( obj, objClass, KObjClassColName8( ) );
+    refEl.AppendChildL( objClass.Unlink().AsElement( ) );
+
+    iContentDirectoryDb->InsertObjectL( refDidl, conId, &refId );
+
+    //increase system update ID
+    iStateHandler->IncreaseSystemUpdateIdL( );
+    iStateHandler->IncreaseContainerUpdateIdL( (TDesC8&)aAction->ArgumentValue( KContainerID ) );
+
+    TBuf8<KMaxIntegerLen> newid;
+    newid.Num( refId );
+    aAction->SetArgumentL( (TDesC8&)KNewID, newid );
+
+    CleanupStack::PopAndDestroy( &refDidl );
+    CleanupStack::PopAndDestroy( &objDidl );
+    CleanupStack::PopAndDestroy( &conDidl );
+
+    return EHttpOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::BrowseL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::BrowseL( CUpnpAction*& aAction )
+    {
+    RDebug::Print( _L( "CUpnpContentDirectory::BrowseL start" ) );
+    TInt err( KErrGeneral );
+
+    //Check ObjectID
+    TInt objectID( KErrNotFound );
+    err = UpnpCdUtils::StringToInteger(
+        (TDesC8&)aAction->ArgumentValue( UpnpCD::KObjectID( ) ), &objectID );
+    if ( err != KErrNone )
+        {
+        User::Leave( ENoSuchObject );
+        }
+    //Check SortCriteria
+    if ( aAction->ArgumentValue( (TDesC8&) KSortCriteria ).Compare( (TDesC8&)KSortCapabilities )
+            != 0 )
+        {
+        User::Leave( EInvalidSort ); //wrong sort flag
+        }
+
+    //Check BrowseFlag
+    TDesC8& browseFlag =
+            (TDesC8&)aAction->ArgumentValue( (TDesC8&)KBrowseFlag );
+    if ( browseFlag.Compare( KBrowseMeta ) != 0
+            && browseFlag.Compare( KBrowseChilds ) != 0 )
+        {
+        User::Leave( EInvalidArgs ); //wrong browse flag    
+        }
+
+    //Check StartIndex
+    TInt startIndex( KErrNotFound );
+    err = UpnpString::StringToInt(
+        (TDesC8&)aAction->ArgumentValue( (TDesC8&)KStartingIndex ),
+        &startIndex );
+    if ( KErrNone != err )
+        {
+        User::Leave( EInvalidArgs );
+        }
+
+    //Additional check of StartIndex, see documentation
+    if ( browseFlag.Compare( KBrowseMeta ) == 0 && startIndex != 0 )
+        {
+        User::Leave( EInvalidArgs );
+        }
+
+    //Check RequestedCount
+    TInt reqCount( KErrNotFound );
+    err = UpnpString::StringToInt(
+        (TDesC8&)aAction->ArgumentValue( (TDesC8&)KRequestedCount ),
+        &reqCount );
+    if ( KErrNone != err )
+        {
+        User::Leave( EInvalidArgs );
+        }
+
+    //Filter
+    HBufC8* filter = aAction->ArgumentValue( KFilter() ).AllocLC( );
+    filter->Des().TrimAll( );
+
+    // Metadata browse
+    if ( browseFlag.Compare( KBrowseMeta ) == 0 )
+        {
+
+        RXmlEngDocument objectDoc;
+        CleanupClosePushL( objectDoc );
+        // Try to get original object not a reference 
+        TInt id = iContentDirectoryDb->ReferedObjectIdL( objectID );
+        CleanupStack::Check( &objectDoc );
+        TUpnpErrorCode err = EUndefined;
+        err = iContentDirectoryDb->GetObjectL( id, objectDoc, *filter );
+        if ( err != EUpnpOk )
+            User::Leave( err );
+        CleanupStack::Check( &objectDoc );
+        //--------- new solution for references --------
+
+        // if id != objectID it means that we have a reference, so now id = 'real object id' and objectID = 'reference object id' 
+        if ( id != objectID )
+            {
+            TInt refParentID = iContentDirectoryDb->GetParentIdL( objectID );
+            User::LeaveIfError( refParentID );
+
+            UpnpCdUtils::SetObjectIdL(
+                UpnpCdUtils::GetObjectElementL( objectDoc ), objectID );
+            UpnpCdUtils::SetObjectRefIdL(
+                UpnpCdUtils::GetObjectElementL( objectDoc ), id );
+            UpnpCdUtils::SetObjectParentIdL(
+                UpnpCdUtils::GetObjectElementL( objectDoc ), refParentID );
+            UpnpCdUtils::SetRestrictedFieldL(
+                UpnpCdUtils::GetObjectElementL( objectDoc ), EFalse );
+            }
+        //---------------------------------------------
+
+        // Serialize object to descriptor - without DIDL-Lite element
+        RBuf8 buf;
+        TXmlEngSerializationOptions
+                options(TXmlEngSerializationOptions::KOptionOmitXMLDeclaration
+                        | TXmlEngSerializationOptions::KOptionIncludeNsPrefixes);
+        objectDoc.SaveL( buf, iElementdb->ActiveElementL( objectDoc ),
+            options );
+        CleanupStack::Check( &objectDoc );
+        CleanupClosePushL( buf );
+        HBufC8* subResponse = buf.AllocLC( );
+
+        CBufFlat* response = CBufFlat::NewL( KRespBufGranularity );
+        CleanupStack::PushL( response );
+        UpnpString::AppendStringL( *response, KDidlTag );
+        UpnpString::AppendStringL( *response, *subResponse );
+        UpnpString::AppendStringL( *response, (TDesC8&) KDidlEnd( ) );
+
+        HBufC8* resultTmp =
+                UpnpCdUtils::EncodeXmlStringL( response->Ptr( 0 ) );
+        CleanupStack::PushL( resultTmp );
+        TPtr8 resultTmpPtr(resultTmp->Des( ));
+        InsertRealIpAndPortL( resultTmpPtr );
+
+        // Set action's OUT arguments       
+        TBuf8<KMaxIntegerLen> num;
+
+        //Result
+        aAction->SetArgumentL( KResult, *resultTmp );
+
+        //NumberReturned
+        num.Num( 1 );
+        aAction->SetArgumentL( KNumberReturned, num );
+
+        //TotalMatches
+        //num.Num(1);
+        aAction->SetArgumentL( KTotalMatches, num );
+
+        //UpadateID 
+        num.Format(
+            UpnpCD::KOneNumber,
+            ContainerUpdateId( (TDesC8&)aAction->ArgumentValue( (TDesC8&)UpnpCD::KObjectID ) ) );
+        aAction->SetArgumentL( KUpdateID, num );
+
+        // clean up
+        CleanupStack::PopAndDestroy( resultTmp );
+        CleanupStack::PopAndDestroy( response );
+        CleanupStack::PopAndDestroy( subResponse );
+        CleanupStack::PopAndDestroy( &buf );
+        CleanupStack::PopAndDestroy( &objectDoc );
+
+        }
+    //Children browse
+    else if ( browseFlag.Compare( KBrowseChilds ) == 0 )
+        {
+        //array contains pointers to direct childrens.
+        RArray<TInt> listOfAllObjects;
+        CleanupClosePushL( listOfAllObjects );
+
+        TUpnpErrorCode err = iContentDirectoryDb->GetObjectListL( objectID,
+            listOfAllObjects );
+
+        if ( err == ENoSuchObject )
+            {
+            User::Leave( err );
+            }
+
+        // if requestedCount==0 then return all matched objects
+        if ( !reqCount )
+            {
+            reqCount = listOfAllObjects.Count( );
+            }
+
+        // if requestedCount cannot be greater than iMaxRequestCount
+        if ( iMaxRequestCount > 0 && reqCount > iMaxRequestCount )
+            {
+            reqCount = iMaxRequestCount;
+            }
+
+        // get upnp objects
+        RArray<RXmlEngDocument> objs;
+        CleanupStack::PushL(TCleanupItem( DestroyRArray, &objs ));
+
+        if ( startIndex < listOfAllObjects.Count( ) )
+            { // prepare list of objects which are to be returned
+            if ( startIndex + reqCount > listOfAllObjects.Count( ) )
+                reqCount = listOfAllObjects.Count( ) - startIndex;
+            RArray<TInt> alistOfWantedObjs( &listOfAllObjects[startIndex],
+                reqCount);
+
+            iContentDirectoryDb->GetObjectListL( alistOfWantedObjs, *filter,
+                objs );
+            }
+
+        // prepare response
+        // Result
+        HBufC8* resp = SerializeObjectsListL( objs );
+        CleanupStack::PushL( resp );
+        TPtr8 respPtr(resp->Des( ));
+        InsertRealIpAndPortL( respPtr );
+        aAction->SetArgumentL( KResult, *resp );
+        // NumberReturned
+        TBuf8<KMaxIntegerLen> num;
+        num.Num( objs.Count( ) );
+        aAction->SetArgumentL( KNumberReturned, num );
+        // TotalMatches
+        num.Num( listOfAllObjects.Count( ) );
+        aAction->SetArgumentL( KTotalMatches, num );
+        // UpdateID
+        num.Format(
+            UpnpCD::KOneNumber,
+            ContainerUpdateId( (TDesC8&)aAction->ArgumentValue( (TDesC8&)UpnpCD::KObjectID ) ) );
+        aAction->SetArgumentL( KUpdateID, num );
+
+        // clean up
+        CleanupStack::PopAndDestroy( resp );
+        CleanupStack::PopAndDestroy( &objs );
+        CleanupStack::PopAndDestroy( &listOfAllObjects );
+        }
+    else //no valid browseflag
+        {
+        User::Leave( EInvalidArgs );
+        }
+
+    RDebug::Print( _L( "CUpnpContentDirectory::BrowseL Result got OK" ) );
+
+    CleanupStack::PopAndDestroy( filter );
+
+    return EHttpOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::SerializeObjectsListL
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpContentDirectory::SerializeObjectsListL(
+    const RArray<RXmlEngDocument>& aObjs )
+    {
+    CBufFlat* buff = CBufFlat::NewL( KRespBufGranularity );
+    CleanupStack::PushL( buff );
+
+    // Didl start
+    UpnpString::AppendStringL( *buff, KDidlTag );
+
+    // content
+    for ( TInt i = 0; i < aObjs.Count( ); i++ )
+        {
+        RBuf8 tmp;
+        TXmlEngSerializationOptions
+                options(TXmlEngSerializationOptions::KOptionOmitXMLDeclaration
+                        | TXmlEngSerializationOptions::KOptionIncludeNsPrefixes);
+        aObjs[i].SaveL( tmp, iElementdb->ActiveElementL( aObjs[i] ), options );
+        CleanupClosePushL( tmp );
+        UpnpString::AppendStringL( *buff, tmp );
+        UpnpString::AppendStringL( *buff, KLF8 );
+        CleanupStack::PopAndDestroy( &tmp );
+        }
+
+    // Didl end
+    UpnpString::AppendStringL( *buff, KDidlEnd );
+
+    // prepare to return
+    HBufC8* ret = UpnpCdUtils::EncodeXmlStringL( buff->Ptr( 0 ) );
+
+    // clean up
+    CleanupStack::PopAndDestroy( buff );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DestroyObjectL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::DestroyObjectL( CUpnpAction*& aAction )
+    {
+    TInt objId( KErrNotFound );
+
+    TInt error(0);
+    error = UpnpCdUtils::StringToInteger(
+        (TDesC8&)aAction->ArgumentValue( UpnpCD::KObjectID( ) ), &objId );
+    if ( (error == KErrArgument)||(error == KErrOverflow) )
+        {
+        User::Leave( ENoSuchObject );
+        }
+    else if ( error<0 )
+        {
+        User::Leave( error );
+        }
+    // check object restriction
+    TUpnpErrorCode err = iContentDirectoryDb->CheckObjectRestrictionL( objId ); // if returned ENoContainer it is OK because first of all the restriction is checked
+    if ( err == ERestrictedObject || err == ENoSuchObject )
+        {
+        User::Leave( err );
+        }
+
+    // check parent restriction
+    err = iContentDirectoryDb->CheckObjectRestrictionL( objId );
+    if ( err == ERestrictedObject )
+        {
+        User::Leave( ERestrictedParentObject );
+        }
+
+    // root and download containers must not be deleted
+    if ( objId <= KDownloadContId )
+        {
+        /*
+         Designing a UPnP AV MediaServer (3.2.4): 
+         "If a CDS implementation exposes a CDS object that is not restricted but cannot fulfill a
+         CDS:DestroyObject(), CDS:CreateObject(), or CDS:UpdateObject() request, then the MediaServer should
+         return error code 720 to indicate the request could not be processed."
+         */
+        User::Leave( ECannotProcess );
+        }
+
+    RArray<TInt> refList;
+    CleanupClosePushL( refList );
+
+    TBuf8<KMaxIntegerLen> containerID;
+    containerID.Num( iContentDirectoryDb->GetParentIdL( objId ) );
+
+    iContentDirectoryDb->DeleteObjectL( objId, refList, ETrue );
+
+    iStateHandler->IncreaseSystemUpdateIdL( );
+    iStateHandler->IncreaseContainerUpdateIdL( containerID );
+
+    for ( TInt i(0); i<refList.Count( ); i++ )
+        {
+        if ( objId!=refList[i] )
+            {
+            containerID.Num( refList[i] );
+            iStateHandler->IncreaseSystemUpdateIdL( );
+            iStateHandler->IncreaseContainerUpdateIdL( containerID );
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &refList );
+    return EHttpOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::AddToMetaDbL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::AddToMetaDbL(
+    RXmlEngDocument& aFragment, TInt aContainer, TInt* aId, TBool aIsLocal )
+    {
+    // res list
+    RArray<TXmlEngElement> resList;
+    CleanupClosePushL( resList );
+    UpnpDomInterface::GetElementListL( aFragment.DocumentElement( ), resList,
+        KRes );
+
+    // a source file for thumbnail
+    HBufC* thumbSrcFile = NULL;
+
+    if ( aIsLocal )
+        { // local action
+        // create thumbnail if there is only one res in the object
+        if ( resList.Count( ) == 1 )
+            {
+            // get resource file name
+            TPtrC8 val(resList[0].Text( ));
+            // ignore if empty string
+            if ( val.Length( ) && (!UpnpCdUtils::IsWhiteString( val )) )
+                {
+                TUriParser8 up;
+                User::LeaveIfError( up.Parse( val ) );
+                if ( up.Extract( EUriScheme ) == UpnpHTTP::KSchemeFile8 )
+                    {
+                    thumbSrcFile = up.GetFileNameL( ); // thumbnail will be created at the end of this function
+                    CleanupStack::PushL( thumbSrcFile );// and the pointer will be poped 
+                    }
+                }
+            }
+        TInt nextId = iContentDirectoryDb->GetObjectIdL( );
+        // handle resources
+        for ( TInt i = 0; i < resList.Count( ); i++ )
+            {
+            HandleLocalResourcesL( resList[i], nextId );
+            }
+        }
+
+    // if only one empty res add importUri
+    if ( resList.Count( ) )
+        {
+        TPtrC8 resValue(resList[0].Text( ));
+        if ( !resValue.Length( ) || UpnpCdUtils::IsWhiteString( resValue ) )
+            {
+            AddImportUriToElL( resList[0] );
+            }
+        }
+    if ( !resList.Count( ) )
+        {
+        AddNewResTagL( aFragment.DocumentElement( ) );
+        }
+    // add to database
+    TUpnpErrorCode ret = iContentDirectoryDb->InsertObjectL( aFragment,
+        aContainer, aId );
+    if ( ret == EUpnpOk )
+        {
+        PrepareAutoDestroyObjectL( aFragment.DocumentElement( ), *aId );
+        ret = EHttpOk;
+        }
+
+    if ( thumbSrcFile )
+        {
+        CreateThumbnailL( *thumbSrcFile, *aId );
+        CleanupStack::PopAndDestroy( thumbSrcFile );
+        }
+    CleanupStack::PopAndDestroy( &resList );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateThumbnailForResourceL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::PrepareAutoDestroyObjectL(
+    TXmlEngElement aObject, TInt aObjId )
+    {
+    // check res
+    RArray<TXmlEngElement> resList;
+    CleanupClosePushL( resList );
+    UpnpDomInterface::GetElementListL( aObject, resList, KRes );
+    if ( resList.Count( ) > 0 )
+        {
+        // only first res is important
+        TPtrC8 resValue(resList[0].Text( ));
+        if ( !resValue.Length( ) || UpnpCdUtils::IsWhiteString( resValue ) )
+            {
+            TXmlEngAttr impUri = resList[0].AttributeNodeL( KImportUri( ) );
+            // auto destroy
+            CUpnpAutoDestroyObject* ado = CUpnpAutoDestroyObject::NewLC(
+                this, aObjId, UpnpCdUtils::ResIdFromUriL( impUri.Value( ) ) );
+            iAutoDestroyObjects->AppendL( ado );
+            CleanupStack::Pop( ado );
+            }
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( &resList );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateThumbnailForResourceL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::CreateThumbnailL( const TDesC& aSrcFile,
+    TInt aObjId )
+    {
+    if ( iCreateThumbnails && IsThumbnailAvailableL( aSrcFile ) )
+        {
+        // thumbnail name
+        HBufC* thumbName = CreateNameForThumbnailL( aSrcFile );
+        CleanupStack::PushL( thumbName );
+
+        // create thumbnail creator
+        CUpnpThumbnailCreator* thCreator = CreateThumbnailCreatorL( aObjId ); // do not push it onto CleanupStack
+        // ThumbnailCreator is created and added to iThumbnailCreators
+        // but the creation process is not yet started,
+        // therefore, not leaving code should be performed until the thCreator->CreateL method is called
+        if ( thCreator )
+            {
+            // start creation process
+            TRAPD( err, thCreator->CreateL( aSrcFile, *thumbName ) );
+            if ( err )
+                {
+                RDebug::Print( _L( "Error while creating thumbnail, it won't be created. Removing from creator list." ) );
+                RemoveThCreatorAndObjectIdLD( thCreator );
+                }
+            iEcomUsed = ETrue;
+            }
+        // clean up
+        CleanupStack::PopAndDestroy( thumbName );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::IsThumbnailAvailableL
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectory::IsThumbnailAvailableL( const TDesC& aFile )
+    {
+    HBufC8* tmp = HBufC8::NewLC( aFile.Length( ) );
+    tmp->Des().Copy( aFile );
+    TBool ret = IsThumbnailAvailableL( *tmp );
+    CleanupStack::PopAndDestroy( tmp );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::IsThumbnailAvailableL
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectory::IsThumbnailAvailableL( const TDesC8& aFile )
+    {
+    TBool result = EFalse;
+
+    // get mime type for file
+    HBufC8* mt = GetMimeTypeLC( aFile );
+    TPtr8 mimeType(mt->Des( ));
+    mimeType.LowerCase( );
+
+    if ( !mimeType.Compare( KMT_IMAGE_JPEG( ) ) )
+        {
+        result = ETrue;
+        }
+    else if ( !mimeType.Compare( KMT_IMAGE_PNG( ) ) )
+        {
+        result = ETrue;
+        }
+    else if ( !mimeType.Compare( KMT_IMAGE_GIF( ) ) )
+        {
+        result = ETrue;
+        }
+    else if ( !mimeType.Compare( KMT_IMAGE_BMP( ) ) )
+        {
+        result = ETrue;
+        }
+    CleanupStack::PopAndDestroy( mt );
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::AddImportUriToElL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::AddImportUriToElL( TXmlEngElement aElement )
+    {
+    HBufC8* impUriVal = BuildImportUriShorterLC( );
+    HBufC8* impUriValRandomize = HBufC8::NewLC( impUriVal->Des().Length( )+ KRandomRangeLength );
+    HBufC8* number = UpnpCdUtils::RandomizeL( KRandomMax );
+    CleanupStack::PushL( number );
+    impUriValRandomize->Des().Copy( *impUriVal );
+    impUriValRandomize->Des().Append( *number );
+    aElement.AddNewAttributeL( KImportUri( ), *impUriValRandomize );
+    // clean up
+    CleanupStack::PopAndDestroy( number );
+    CleanupStack::PopAndDestroy( impUriValRandomize );
+    CleanupStack::PopAndDestroy( impUriVal );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::AddNewResTagL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::AddNewResTagL( TXmlEngElement aObjEl )
+    {
+    TXmlEngElement item;
+    UpnpDomInterface::GetElementL( aObjEl, item, KItem );
+
+    // ignore if null
+    if ( item.NotNull( ) )
+        {
+        TXmlEngElement newEl = item.AddNewElementL( KRes( ) );
+        newEl.AddNewAttributeL( KprotocolInfo( ), KEmptyProtocolInfoVal8( ) );
+        newEl.AddNewAttributeL( KProtInfoReqAtrSufPattern( ), KTrueValue8( ) );
+        // add importUri
+        AddImportUriToElL( newEl );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::BuildContentUriL
+// -----------------------------------------------------------------------------
+HBufC8* CUpnpContentDirectory::BuildContentUriL( const TDesC& aFileExt,
+    TInt aObjectId )
+    {
+    TBuf8<KMaxIntegerLen> objectId;
+    objectId.Num( aObjectId );
+    return UpnpCdUtils::BuildContentUriL(
+        iContentDirectoryDb->GetKeyForUriL( ), aFileExt, objectId );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::BuildImportUriL
+// -----------------------------------------------------------------------------
+HBufC8* CUpnpContentDirectory::BuildImportUriLC()
+    {
+    return UpnpCdUtils::BuildImportUriLC( iContentDirectoryDb->GetKeyForUriL( ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::BuildImportUriShorterLC
+// -----------------------------------------------------------------------------
+HBufC8* CUpnpContentDirectory::BuildImportUriShorterLC()
+    {
+    return UpnpCdUtils::BuildImportUriShorterLC( iContentDirectoryDb->GetKeyForUriL( ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::InsertRealIpAndPortL
+// -----------------------------------------------------------------------------
+void CUpnpContentDirectory::InsertRealIpAndPortL( TDes8& aString )
+    {
+    // prepare pettern
+    HBufC8* pattern = HBufC8::NewLC( KHttpTag().Length( ) + KIpPortPlaceholder8().Length( ) );
+    TPtr8 patternPtr(pattern->Des( ));
+    patternPtr.Append( KHttpTag );
+    patternPtr.Append( KIpPortPlaceholder8 );
+
+    // repare address
+    HBufC8* address = GetIpAndPortDes8L( );
+    CleanupStack::PushL( address );
+
+    TInt pos = aString.Find( patternPtr );
+
+    while ( pos != KErrNotFound )
+        {
+        aString.Replace( pos + KHttpTag().Length( ), KIpPortPlaceholder8().Length( ), *address );
+        pos = aString.Find( patternPtr );
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( address );
+    CleanupStack::PopAndDestroy( pattern );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::InsertIpAndPortPlaceholderL
+// -----------------------------------------------------------------------------
+HBufC8* CUpnpContentDirectory::InsertIpAndPortPlaceholderL(
+    const TDesC8& aString )
+    {
+    HBufC8* ipAndPort = GetIpAndPortDes8L( );
+    CleanupStack::PushL( ipAndPort );
+
+    HBufC8* ret = aString.AllocLC( );
+
+    TInt pos = KErrNotFound;
+    while ( (pos = ret->Find( *ipAndPort )) != KErrNotFound )
+        {
+        // realloc if too small
+        if ( ipAndPort->Length( ) < KIpPortPlaceholder8().Length( ) )
+            {
+            HBufC8* tmp = ret->ReAllocL( ret->Length( )
+                    + KIpPortPlaceholder8().Length( ) - ipAndPort->Length( ) );
+            CleanupStack::Pop( ret );
+            ret = tmp;
+            CleanupStack::PushL( ret );
+            }
+        ret->Des().Replace( pos, ipAndPort->Length( ), KIpPortPlaceholder8 );
+        }
+    // clean up
+    CleanupStack::Pop( ret );
+    CleanupStack::PopAndDestroy( ipAndPort );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetAddress
+// -----------------------------------------------------------------------------
+TInetAddr CUpnpContentDirectory::GetAddress()
+    {
+    TInetAddr resourceServerAddress;    
+    iHttpServerSession->GetAddress( resourceServerAddress );
+    return resourceServerAddress;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::AutoDestroyObjectList
+// -----------------------------------------------------------------------------
+CUpnpAutoDestroyObjectList* CUpnpContentDirectory::GetAutoDestroyObjectList()
+    {
+    return iAutoDestroyObjects;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetIpAndPortDes8L
+// -----------------------------------------------------------------------------
+HBufC8* CUpnpContentDirectory::GetIpAndPortDes8L()
+    {
+    TInetAddr resourceServerAddress = GetAddress();        
+    
+    TBuf<KMaxName> addrTmp;
+    resourceServerAddress.Output( addrTmp );
+    HBufC8* addr = UpnpString::FromUnicodeL( addrTmp );
+    CleanupStack::PushL( addr );
+    
+    TInt portNo = resourceServerAddress.Port();
+    TBuf8<KMaxName> port;
+    port.Num( portNo );
+    
+    HBufC8* temp = HBufC8::NewLC( addr->Length( ) + KColon8().Length( ) + port.Length( ) );
+    TPtr8 tempPtr( temp->Des() );
+    tempPtr.Copy( *addr );
+    tempPtr.Append( KColon8 );
+    tempPtr.Append( port );
+
+    CleanupStack::Pop( temp );
+    CleanupStack::PopAndDestroy( addr );
+
+    return temp;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetSearchCapabilitiesL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::GetSearchCapabilitiesL(
+    CUpnpAction*& aAction )
+    {
+    aAction->SetArgumentL( KSearchCaps,
+        StateVariableValue( KSearchCapsVariableName ) );
+    return EHttpOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetSortCapabilitiesL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::GetSortCapabilitiesL(
+    CUpnpAction*& aAction )
+    {
+    aAction->SetArgumentL( KSortCaps,
+        StateVariableValue( KSortCapsVariableName ) );
+    return EHttpOk;
+    } 
+ 
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetSystemUpdateIdL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::GetSystemUpdateIdL(
+    CUpnpAction*& aAction )
+    {
+    const TPtrC8 idValue = StateVariableValue( (TDesC8&)KSystemUpdateID );
+    aAction->SetArgumentL( KId, idValue );
+    return EHttpOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ImportResourceL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::ImportResourceL( CUpnpAction*& aAction )
+    {
+    if ( iTransferController->IsMaxImportExportTransfers( ) )
+        {
+        return ETransferBusy;
+        }
+
+    TPtrC8 src = aAction->ArgumentValue( (TDesC8&) KSourceURI );
+    TPtrC8 dest = aAction->ArgumentValue( (TDesC8&) KDestinationURI );
+    TUriParser8 srcParser;
+    TUriParser8 dstParser;
+
+    if ( !(dstParser.Parse( dest ) == 
+          KErrNone && dstParser.Extract( EUriScheme ).CompareF( UpnpHTTP::KSchemeHTTP8 ) == 0 ) )
+        {
+        User::Leave( ENoDestinationResource );
+        }
+
+    // there are placeholders instead the real values in the database
+    HBufC8* destBuf = InsertIpAndPortPlaceholderL( dest );
+    CleanupStack::PushL( destBuf );
+
+    TInt objId;
+    // object existence
+    if ( (objId
+            = iContentDirectoryDb->GetObjIdByAttrL( KImportUri8, *destBuf ) )
+            == KErrNotFound )
+        {
+        User::Leave( ENoDestinationResource );
+        }
+    // object restrictions
+    if ( iContentDirectoryDb->CheckObjectRestrictionL( objId )
+            == ERestrictedObject )
+        {
+        User::Leave( ERestrictedObject );
+        }
+    // parent restricions
+    if ( iContentDirectoryDb->CheckParentRestrictionL( objId ) != EUpnpOk )
+        {
+        User::Leave( ERestrictedParentObject );
+        }
+
+    TInt destinationCut = dest.LocateReverse( '/' );
+    if ( destinationCut < KErrNone )
+        {
+        User::Leave( EInvalidArgs );
+        }
+
+    HBufC* name = GetFileNameL( objId );
+    CleanupStack::PushL( name );
+    if ( !name )
+        {
+        User::Leave( ENoDestinationResource );
+        }
+
+    for ( TInt i( 0); i < iTransferController->iFileTransfers.Count( ) ; i++ )
+        {
+        if ( iTransferController->iFileTransfers[i]->ObjectId( ) == objId
+                && iTransferController->iFileTransfers[i]->TransferState( )
+                        == ETransferInProgress )
+            {
+            User::Leave( EDestinationAccess );
+            }
+        }
+
+    HBufC8* name8 = UpnpString::FromUnicodeL( *name );
+    CleanupStack::PushL( name8 );
+
+    TPtr8 fileNamePtr(name8->Des( ) );
+
+    HBufC16* fileNamePtr16 = UpnpString::ToUnicodeL( fileNamePtr );
+    CleanupStack::PushL( fileNamePtr16 );
+    TParse parseFilename;
+    parseFilename.Set( fileNamePtr16->Des( ), NULL, NULL );
+    HBufC16* diskNameTemp=parseFilename.Drive().Alloc( );
+    HBufC16* diskName = diskNameTemp->ReAlloc( diskNameTemp->Des().Length( ) +
+                                               KDiskPathElSep().Length( ) );
+    CleanupStack::PushL( diskName );
+    TPtr16 diskNamePtr = diskName->Des( );
+    diskNamePtr.Append( KDiskPathElSep );
+    if ( !BaflUtils::PathExists( iFs, diskNamePtr ) )
+        {
+        User::Leave( ENoDestinationResource );
+        }
+
+    UpnpString::ReplaceHttpCharacters( fileNamePtr );
+
+    // forbidden chars
+    UpnpCdUtils::ValidateFilePath( fileNamePtr );
+
+    HBufC* targetPath = HBufC::NewMaxLC( fileNamePtr.Length( ) );
+    TPtr targetPtr = targetPath->Des( );
+    targetPtr.Copy( fileNamePtr );
+
+    TInt transferid = CUpnpHttpMessage::NewSessionIdL( );
+    iTransferHandler->DownloadFileL( transferid, src, targetPtr );
+
+    CleanupStack::PopAndDestroy( targetPath );
+
+    TransferStartL( dest );
+
+    TBuf8<KMaxIntegerLen> tid;
+    tid.Num( transferid );
+    aAction->SetArgumentL( (TDesC8&)KTransferID, tid );
+
+    CUpnpFileTransfer* transfer = CUpnpFileTransfer::NewLC( transferid,
+        objId, CUpnpFileTransfer::EImport );
+
+    transfer->SetTransferState(:: ETransferInProgress );
+
+    // starting to get the number if import
+    TPtrC8 dest1 = aAction->ArgumentValue( (TDesC8&) KDestinationURI );
+    TInt posOfLastSlash = dest1.LocateReverse( '/' );
+    if( posOfLastSlash != KErrNotFound )
+        {
+        dest1.Set( dest1.Mid( posOfLastSlash + 1 ) );
+        // converting value
+        TLex8 string( dest1 );
+        TInt value( 0 );
+        TInt error = string.Val( value );
+        // conversion ok, we can add this to 
+        if( error == KErrNone )
+            {
+            transfer->SetImportNumber( value );
+            }
+        }
+    //add transfer to transfers list
+    CleanupStack::Pop( transfer );
+    iTransferController->iFileTransfers.Append( transfer );
+
+    HBufC* fileName16 = UpnpString::ToUnicodeL( *name8 );
+    CleanupStack::PushL( fileName16 );
+
+    CUpnpFileTransferEvent* event = CUpnpFileTransferEvent::NewLC();
+    event->SetProgressState( CUpnpFileTransferEvent::ECompleted );
+    event->SetDirection( CUpnpFileTransferEvent::EIncoming );
+    event->SetFilePathL( *fileName16 );
+    event->SetContentDirectoryObjectId( objId );
+    event->SetTransferId( transferid );
+    CleanupStack::Pop( event );
+    transfer->SetEvent( event );
+
+    AddFileTransferToTransferIDsStateVariableL( transferid );
+    // clean up
+    CleanupStack::PopAndDestroy( fileName16 );
+    CleanupStack::PopAndDestroy( diskName );
+    CleanupStack::PopAndDestroy( fileNamePtr16 );
+    CleanupStack::PopAndDestroy( name8 );
+    CleanupStack::PopAndDestroy( name );
+    CleanupStack::PopAndDestroy( destBuf );
+
+    return EHttpOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ExportResourceL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::ExportResourceL( CUpnpAction*& aAction )
+    {
+    if ( iTransferController->IsMaxImportExportTransfers( ) )
+        {
+        return ETransferBusy;
+        }
+    HBufC8* srcBuf = aAction->ArgumentValue( KSourceURI ).AllocLC( );
+    TPtr8 src(srcBuf->Des( ));
+    UpnpString::ReplaceHttpCharacters( src );
+
+    HBufC8* ipAndPort = GetIpAndPortDes8L( );
+    CleanupStack::PushL( ipAndPort );
+    UpnpCdUtils::ValidateSrcUriL( src, *ipAndPort );
+    CleanupStack::PopAndDestroy( ipAndPort );
+
+    TPtrC8 dest = aAction->ArgumentValue( KDestinationURI );
+
+    // check src existence -----------------------------
+    CUpnpResourcesBean* rscBean = NULL;
+    TRAPD(
+        error,
+        rscBean
+                = iContentDirectoryDb->GetResourceL( UpnpCdUtils::ResIdFromUriL( src ) ) );
+    if ( error < 0 || !rscBean )
+        {
+        User::Leave( ENoSourceResource );
+        }
+    CleanupStack::PushL( rscBean );
+    // check whether resource and src uri file names matches
+    TPtrC rscPath(rscBean->Path( ) );
+
+    if ( !BaflUtils::FileExists( iFs, rscPath ) )
+        {
+        User::Leave( ENoSourceResource );
+        }
+
+    TParse rscParse;
+    rscParse.Set( rscPath, NULL, NULL );
+    TPtrC rscFileName = rscParse.NameAndExt( );
+
+    TBuf8<KMaxIntegerLen> objId;
+    objId.Num( rscBean->ObjectId( ) );
+
+    TPtrC rscFileExt = rscParse.Ext( );
+    HBufC8* srcNoEsc = src.AllocLC( );
+    TPtr8 srcNoEscPtr(srcNoEsc->Des( ));
+
+    HBufC* srcPath = UpnpCdUtils::Des8ToDesLC( srcNoEscPtr );
+    TPtr srcPathPtr(srcPath->Des( ) );
+
+    TInt position = srcPathPtr.LocateReverse( '/' );
+    HBufC* newFileName = HBufC::NewLC( KMaxIntegerLen + rscFileExt.Length( ) );
+    newFileName->Des().Copy( objId );
+    newFileName->Des().Append( rscFileExt );
+    if ( position )
+        {
+        position = srcPathPtr.Length( )-position-1;
+        TPtrC srcFilePtr = srcPathPtr.Right( position );
+        if ( srcFilePtr.Compare( *newFileName ) )
+            {
+            User::Leave( ENoSourceResource );
+            }
+        }
+    if ( srcPathPtr.Find( *newFileName ) == KErrNotFound )
+        {
+        User::Leave( ENoSourceResource );
+        }
+    // get mimeType = Content-Type in the header
+    HBufC8* contentType = UpnpFileUtil::GetMimeTypeForFileL( *newFileName );
+    TPtrC8 contentTypePtr(contentType->Des( ) );
+
+    CleanupStack::PopAndDestroy( newFileName );
+    CleanupStack::PushL( contentType );
+
+    //checking number of slash in sourceURI 
+    TInt numberOfSlash(0);
+    position = srcPathPtr.LocateReverse( '/' );
+    while ( position>0 )
+        {
+        numberOfSlash++;
+        if ( numberOfSlash>KMaxSlashAmount )
+            {
+            User::Leave( ENoSourceResource );
+            }
+        srcPathPtr = srcPathPtr.Left( position );
+        position = srcPathPtr.LocateReverse( '/' );
+        }
+
+    TInt transferid = CUpnpHttpMessage::NewSessionIdL( );
+    iTransferHandler->UploadFileL( transferid, dest, rscPath, contentTypePtr );
+
+    TBuf8<KMaxIntegerLen> tid;
+    tid.Num( transferid );
+    aAction->SetArgumentL( (TDesC8&)KTransferID, tid );
+
+    TPtrC8 pert = UpnpCdUtils::ResIdFromUriDesL( src );
+
+    TInt objectId = rscBean->ObjectId( );
+    CUpnpFileTransfer* transfer = CUpnpFileTransfer::NewL( transferid,
+        objectId, CUpnpFileTransfer::EExport );
+    transfer->SetTransferState(:: ETransferInProgress);
+
+    iTransferController->iFileTransfers.Append( transfer );
+
+    CUpnpFileTransferEvent* event = CUpnpFileTransferEvent::NewLC();
+    event->SetProgressState( CUpnpFileTransferEvent::ECompleted );
+    event->SetDirection( CUpnpFileTransferEvent::EOutgoing );
+    event->SetFilePathL( rscPath);
+    event->SetContentDirectoryObjectId( objectId );
+    event->SetTransferId( transferid );
+    CleanupStack::Pop( event );
+    transfer->SetEvent(event);
+
+    AddFileTransferToTransferIDsStateVariableL( transferid );
+    CleanupStack::PopAndDestroy( contentType );
+    CleanupStack::PopAndDestroy( srcPath );
+    CleanupStack::PopAndDestroy( srcNoEsc );
+    CleanupStack::PopAndDestroy( rscBean );
+    CleanupStack::PopAndDestroy( srcBuf );
+
+    return EHttpOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::StopTransferResourceL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::StopTransferResourceL(
+    CUpnpAction*& aAction )
+    {
+    TInt transferId;
+    TInt err =
+            UpnpString::StringToInt(
+                (TDesC8&) aAction->ArgumentValue( (TDesC8&)KTransferID ),
+                &transferId );
+    if ( KErrNone != err )
+        {
+        User::Leave( ENoFileTransfer );
+        }
+    TUpnpErrorCode
+            upnpErr(iTransferController->StopTransferResourceL( transferId ) );
+    TransferCompletedL( transferId, KErrCancel );
+    return upnpErr;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetTransferProgressL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::GetTransferProgressL(
+    CUpnpAction*& aAction )
+    {
+    TUint transferId;
+    TInt length( KErrNone );
+    TInt totalLength( KErrNone );
+    // TInt lenght is max 15 digits, KMaxInfoName is 16
+    TBuf8<KMaxInfoName> res;
+
+    TInt err = UpnpCdUtils::StringToTUint(
+        (TDesC8&)aAction->ArgumentValue( (TDesC8&)KTransferID ), &transferId );
+
+    if ( KErrNone != err )
+        {
+        User::Leave( EInvalidArgs );
+        }
+    if ( transferId > KMaxTInt )
+        {
+        User::Leave( ENoFileTransfer );
+        }
+    TInt transferFound = iTransferController->Transfer( transferId );
+    if ( KErrNotFound == transferFound )
+        {
+        User::Leave( ENoFileTransfer );
+        }
+
+    switch ( (iTransferController->iFileTransfers[ transferFound ])->TransferState( ) )
+        {
+        case:: ETransferInProgress:
+            {
+            aAction->SetArgumentL( (TDesC8&)KTransferStatus, KInProgress );
+            break;
+            }
+        case EStopped:
+            {
+            aAction->SetArgumentL( (TDesC8&)KTransferStatus, KStopped );
+            break;
+            }
+        case EError:
+            {
+            aAction->SetArgumentL( (TDesC8&)KTransferStatus, KError );
+            break;
+            }
+        case ECompleted:
+            {
+            aAction->SetArgumentL( (TDesC8&)KTransferStatus, KCompleted );
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    length = (iTransferController->iFileTransfers[ transferFound ])->TransferLength();
+    totalLength = (iTransferController->iFileTransfers[ transferFound ])->TransferTotal();
+
+    res.Num( length );
+    aAction->SetArgumentL( (TDesC8&)KTransferLength, res );
+    res.Num( totalLength );
+    aAction->SetArgumentL( (TDesC8&)KTransferTotal, res );
+    return EHttpOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DeleteResourceL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::DeleteResourceL( CUpnpAction*& aAction )
+    {
+    TPtrC8 uri8(aAction->ArgumentValue( KResourceURI( ) ));
+
+    if ( !uri8.Length( ) )
+        User::Leave( ENoSourceResource );
+
+    // replace http characters
+    HBufC8* uri = uri8.AllocLC( );
+    TPtr8 uriPtr(uri->Des( ));
+
+    // ip placeholder
+    HBufC8* internalUri = InsertIpAndPortPlaceholderL( uriPtr );
+    CleanupStack::PushL( internalUri );
+    // delete resource
+    RArray<TInt> contIds;
+    CleanupClosePushL( contIds );
+    iContentDirectoryDb->DeleteResourceL( *internalUri, contIds );
+
+    // updateIDs
+    for ( TInt i = 0; i < contIds.Count( ); i++ )
+        {
+        TBuf8<KMaxIntegerLen> num;
+        num.Num( contIds[i] );
+        iStateHandler->IncreaseContainerUpdateIdL( num );
+        }
+
+    // systemUpdateId
+    iStateHandler->IncreaseSystemUpdateIdL( );
+
+    // clean up
+    CleanupStack::PopAndDestroy( &contIds );
+    CleanupStack::PopAndDestroy( internalUri );
+    CleanupStack::PopAndDestroy( uri );
+
+    return EHttpOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::AddFileTransferL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::AddFileTransferToTransferIDsStateVariableL(
+    TInt aTransferID )
+    {
+    TBuf8<KMaxIntegerLen> tid;
+    tid.Format( UpnpCD::KOneNumber, aTransferID );
+    TPtrC8 tmp = StateVariableValue( KTransferIDs( ) );
+    HBufC8* buf = UpnpString::AddValueToCsvL( tmp, tid );
+    CleanupStack::PushL( buf );
+    SetStateVariableL( KTransferIDs( ), *buf, EFalse );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::RemoveFileTransferL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::RemoveFileTransferFromTransferIDsStateVariableL(
+    TInt aTransferID )
+    {
+    TBuf8<KMaxIntegerLen> tid;
+    tid.Format( UpnpCD::KOneNumber, aTransferID );
+    TPtrC8 tmp = StateVariableValue( KTransferIDs( ) );
+    HBufC8* buf = UpnpString::RemoveFromCsvLC( tmp, tid );
+    SetStateVariableL( KTransferIDs( ), *buf, EFalse );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ContainerUpdateId
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::ContainerUpdateId( const TDesC8& aContainerID )
+    {
+    return iStateHandler->ContainerUpdateId( aContainerID );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateObjectL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectory::CreateObjectL( CUpnpAction*& aAction )
+    {
+    SetExecutedAction( ECreateObjectAction );
+
+    HBufC8* objNoDes(aAction->ArgumentValue(KContainerID()).AllocLC( ) );
+    TPtr8 objNoPtr(objNoDes->Des( ));
+    objNoPtr.TrimAll( );
+
+    TInt objNo = KErrNotFound; // container id
+    TInt error( KErrGeneral );
+
+    // any container support
+    if ( !objNoPtr.Compare( KAnyContainerIndicator8 ) )
+        {
+        objNo = KAnyContainerId;
+        }
+    else
+        {
+        // checking whether containerID has proper decimal value
+        error = UpnpCdUtils::StringToInteger( objNoPtr, &objNo );
+        if ( error != KErrNone )
+            {
+            User::Leave( ENoContainer );
+            }
+
+        TUpnpErrorCode err =
+                iContentDirectoryDb->CheckObjectRestrictionL( objNo );
+        if ( err != EUpnpOk )
+            {
+            CleanupStack::PopAndDestroy( objNoDes );
+            if ( err == ENoSuchObject )
+                err = ENoContainer;
+            if ( err == ERestrictedObject )
+                err = ERestrictedParentObject;
+            return err;
+            }
+        }
+    CleanupStack::PopAndDestroy( objNoDes );
+
+    // now we have found the unrestricted parent container
+    // let's inspect the element that should be added
+    // decode "elements" argument of the create action
+    const TDesC8& elem = (TDesC8&)aAction->ArgumentValue( KElements( ) );
+
+    // check that we've got correctly formed xml
+    if ( elem.FindF( KXmlNsDc( ) ) == KErrNotFound )
+        {
+        User::Leave( EBadMetadata );
+        }
+
+    HBufC8* trimmed = UpnpString::TrimLC( elem, EFalse );
+
+    HBufC8* trimmedlf8 = UpnpString::StringReplaceL( *trimmed, KLF8,
+        KNullString8 );
+    CleanupStack::PushL( trimmedlf8 );
+    // parse decoded buffer
+    RXmlEngDocument fragment;
+    TRAPD( xmlerr, fragment = XmlFragmentL( *trimmedlf8 ) );
+    if ( xmlerr )
+        {
+        RDebug::Print( _L( "CUpnpContentDirectory::CreateObjectL ERROR IN XML" ) );
+        User::Leave( xmlerr );
+        }
+    CleanupClosePushL( fragment );
+
+    // if container, check the number of nested levels
+    TXmlEngElement container;
+    UpnpDomInterface::GetElementL( fragment.DocumentElement( ), container,
+        KContainer );
+    if ( container.NotNull( ) && !iContentDirectoryDb->CanBeNestedL( objNo ) )
+        {
+        User::Leave( ECannotProcess );
+        }
+
+    RArray<TXmlEngAttr> importUris;
+    CleanupClosePushL( importUris );
+    RArray<TXmlEngElement> ress;
+    CleanupClosePushL( ress );
+
+    TBool isLocal = aAction->Local( );
+
+    // to avoid errors in validation process
+    UpnpCdUtils::SetObjectIdL( UpnpCdUtils::GetObjectElementL( fragment ),
+        objNo ); // value does not matter - it will be changed later
+    UpnpCdUtils::SetContainerIdL( UpnpCdUtils::GetObjectElementL( fragment ),
+        objNo );
+
+    //created new object shouldn't have refID value
+    if ( UpnpCdUtils::HasRefIdL( fragment ) )
+        {
+        User::Leave( EParameterMismatch );
+        }
+
+    // validate the new element
+    iElementdb->ValidateNewObjectL( fragment.DocumentElement( ), ETrue,
+        isLocal );
+
+    // now we have fragment, lets add this to CD metadata
+    TInt id( KErrNotFound );
+    TUpnpErrorCode err = AddToMetaDbL( fragment, objNo, &id, isLocal );
+
+    CleanupStack::PopAndDestroy( &ress );
+    CleanupStack::PopAndDestroy( &importUris );
+
+    ConstructCreateResultsetL( aAction, fragment, id );
+
+    CleanupStack::PopAndDestroy( &fragment );
+    CleanupStack::PopAndDestroy( trimmedlf8 );
+    CleanupStack::PopAndDestroy( trimmed );
+
+    if ( err == EHttpOk )
+        {
+        iStateHandler->IncreaseSystemUpdateIdL( );
+        iStateHandler->IncreaseContainerUpdateIdL( 
+                             ( TDesC8& )aAction->ArgumentValue( KContainerID ) );
+
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::HandleLocalResourcesL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::HandleLocalResourcesL( TXmlEngElement aRes,
+    TInt aObjectId )
+    {
+    // contentUri, contentPath          
+    TUriParser8 up;
+    TPtrC8 resVal = aRes.Text( );
+    if ( resVal.Length( ) )
+        {
+        TPtrC8 resValCandidatePtr(resVal);
+
+        // There should be no slash at the end of URI, if so -> leave occurs
+        if ( resValCandidatePtr.Length( ) > 0 )
+            {
+            if ( !resValCandidatePtr.Right(1).Compare( KSlash8( ) ) )
+                {
+                User::Leave( EBadMetadata );
+                }
+            }
+
+        User::LeaveIfError( up.Parse( resValCandidatePtr ) );
+
+        // get schema
+        TPtrC8 scheme(up.Extract( EUriScheme ));
+
+        // only local sharing
+        if ( !scheme.Compare( UpnpHTTP::KSchemeFile8 ) )
+            {
+            HBufC* fn = UpnpString::ToUnicodeL( resValCandidatePtr );
+            CleanupStack::PushL( fn );
+
+            TInt extPosition = fn->Des().LocateReverse( '.' );
+            TPtrC ext;
+            if ( extPosition>0 )
+                ext.Set( fn->Des().Mid( extPosition ) );
+            else
+                ext.Set( KNullString );
+
+            HBufC8* contentUri = BuildContentUriL( ext, aObjectId );
+            CleanupStack::PushL( contentUri );
+
+            HBufC* contentPath = up.GetFileNameL( );
+            CleanupStack::PushL( contentPath );
+
+            // update res tag
+            aRes.SetTextL( *contentUri );
+
+            // add resource to the database
+            CUpnpResourcesBean* resBn = CUpnpResourcesBean::NewLC( );
+            resBn->SetId( UpnpCdUtils::ResIdFromUriL( *contentUri ) );
+            resBn->SetPathL( *contentPath );
+            resBn->SetIsReadonly( ETrue );
+            resBn->SetIsThumbnail( EFalse );
+
+            iContentDirectoryDb->AddResourceL( resBn, aObjectId );
+
+            // clean up
+            CleanupStack::PopAndDestroy( resBn );
+            CleanupStack::PopAndDestroy( contentPath );
+            CleanupStack::PopAndDestroy( contentUri );
+            CleanupStack::PopAndDestroy( fn );
+            }
+        // else -> ignore
+        }
+    // else -> ignore
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ConstructCreateResultsetL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::ConstructCreateResultsetL( CUpnpAction*& aAction,
+    RXmlEngDocument aDocument, TInt aId )
+    {
+    TBuf8<KMaxIntegerLen> num;
+    num.Num( aId );
+
+    aAction->SetArgumentL( KObjectID, num );
+    TXmlEngElement elem = aDocument.DocumentElement( );
+
+    HBufC8* buf = CUpnpXmlContentFilter::SerializeLC( aDocument, elem );
+
+    TPtr8 bufPtr(buf->Des( ));
+    InsertRealIpAndPortL( bufPtr );
+    HBufC8* encoded = UpnpCdUtils::EncodeXmlStringL( bufPtr );
+    CleanupStack::PushL( encoded );
+
+    aAction->SetArgumentL( KResult, *encoded );
+
+    CleanupStack::PopAndDestroy( encoded );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::XmlFragmentL
+// -----------------------------------------------------------------------------
+//
+RXmlEngDocument CUpnpContentDirectory::XmlFragmentL( const TDesC8 &aBuffer )
+    {
+    //Create a parser
+    RXmlEngDOMParser parser;
+    User::LeaveIfError( parser.Open( iDOMImpl ) );
+    CleanupClosePushL( parser );
+    // DOM document
+    RXmlEngDocument docTree;
+
+    if ( aBuffer.FindF( KXmlNsDc( ) ) == KErrNotFound )
+        {
+        HBufC8* withDidl = HBufC8::NewLC( KDidlTag().Length( ) + aBuffer.Length( ) +
+                                          KDidlEnd().Length( ) );
+        withDidl->Des().Append( KDidlTag( ) );
+        withDidl->Des().Append( aBuffer );
+        withDidl->Des().Append( KDidlEnd( ) );
+
+        docTree = parser.ParseL( *withDidl );
+        CleanupStack::PopAndDestroy( withDidl );
+        }
+    else
+        {
+        docTree = parser.ParseL( aBuffer );
+        }
+    CleanupStack::PopAndDestroy( &parser );
+    return docTree;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetMimeTypeLC
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpContentDirectory::GetMimeTypeLC( const TDesC8& aFilename )
+    {
+    HBufC16* filename16 = UpnpString::ToUnicodeL( aFilename );
+    CleanupStack::PushL( filename16 );
+    HBufC8* mimetype = UpnpFileUtil::GetMimeTypeForFileL( *filename16 );
+    if ( !mimetype )
+        {
+        mimetype = KNullString8().AllocL( );
+        }
+    CleanupStack::PopAndDestroy( filename16 );
+    CleanupStack::PushL( mimetype );
+    return mimetype;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ChangeFileNameWithExtensionL
+// -----------------------------------------------------------------------------
+HBufC8* CUpnpContentDirectory::ChangeFileNameWithExtensionL(
+    TDesC8& aFilePath, const TDesC8& aMimeType )
+    {
+
+    HBufC8* temp = NULL;
+    TInt position = aFilePath.LocateReverse( '.' );
+    if ( position != KErrNotFound )
+        {
+        return temp;
+        }
+    if ( aMimeType == KNullDesC8 )
+        {
+        return temp;
+        }
+
+    HBufC8* ext = iMimeToExtMap->GetExtensionL( aMimeType );
+    if ( ext == NULL )
+        {
+        return temp;
+        }
+    CleanupStack::PushL( ext );
+    HBufC8* newFilename = HBufC8::NewLC( ext->Length( ) + 1
+            + aFilePath.Length( ) );
+    TPtr8 fileNamePtr(newFilename->Des( ) );
+    fileNamePtr.Append( aFilePath );
+    //fileNamePtr.Append( KDot8());
+    fileNamePtr.Append( *ext );
+
+    HBufC* oldFilename16 = HBufC::NewLC( aFilePath.Length( ) );
+    TPtr oldFilename16Ptr(oldFilename16->Des( ));
+    oldFilename16Ptr.Copy( aFilePath );
+
+    HBufC* newFilename16 = HBufC::NewLC( newFilename->Length( ) );
+    TPtr newFilename16Ptr(newFilename16->Des( ));
+    newFilename16Ptr.Copy( *newFilename );
+
+    TBool exists = BaflUtils::FileExists( iFs, *newFilename16 );
+    if ( exists )
+        {
+        TInt error( KErrNone );
+        TInt count( 0);
+        _LIT( KUnderline, "_" );
+
+        CleanupStack::PopAndDestroy( newFilename16 );
+        newFilename16 = NULL;
+
+        HBufC16* ext16 = HBufC16::NewLC( ext->Length( ) );
+        ext16->Des().Copy( *ext );
+
+        TBuf<KMaxIntegerLen> value;
+        newFilename16 = HBufC16::NewLC( aFilePath.Length( ) + KMaxIntegerLen
+                + ext16->Length( ) + KUnderline().Length( ) + KDot().Length( ) );
+        for ( ;; )
+            {
+            // name_xxxxx.ext
+            value.Num( count );
+
+            newFilename16->Des().Copy( aFilePath );
+            newFilename16->Des().Append( KUnderline );
+            newFilename16->Des().Append( value );
+            //adding dot is not not needed anymore
+            newFilename16->Des().Append( *ext16 );
+
+            RFile file;
+            error = file.Open( iFs, *newFilename16, EFileShareExclusive );
+            file.Close( );
+
+            if ( error == KErrNotFound )
+                {
+                break;
+                }
+            else
+                {
+                count++;
+                }
+            }
+        CleanupStack::Pop( newFilename16 );
+        CleanupStack::PopAndDestroy( ext16 );
+        CleanupStack::PushL( newFilename16 );
+        }
+
+    TInt result = iFs.Rename( *oldFilename16, *newFilename16 );
+    if ( result == KErrNone )
+        {
+        temp = HBufC8::NewL( newFilename16->Length( ) );
+        temp->Des().Copy( *newFilename16 );
+
+        }
+    CleanupStack::PopAndDestroy( newFilename16 );
+    CleanupStack::PopAndDestroy( oldFilename16 );
+    CleanupStack::PopAndDestroy( newFilename );
+    CleanupStack::PopAndDestroy( ext );
+
+    return temp;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateResTagWithDBRecoveyrL
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::CreateResTagInternalWithDBRecoveryL(
+    TInt aSessionId, TDesC8& aFilePath, HBufC8* aImportUri,
+    TBool aOnlyThumbnail )
+    {
+    TInt result = 0;
+    TRAPD( err, result = CreateResTagInternalL( aSessionId, aFilePath,
+        aImportUri, aOnlyThumbnail ) );
+    if ( err )
+        {
+        if ( DataBaseHasBeenRecoveredL( err ) )
+            {
+            TRAP( err, iContentDirectoryDb->CheckDatabaseL( ) );
+            if ( err == KErrCorrupt )
+                {
+                err = iContentDirectoryDb->RecreateDatabaseFile( );
+                User::LeaveIfError( err );
+                }
+            TRAP( err, result = CreateResTagInternalL( aSessionId, aFilePath,
+                aImportUri, aOnlyThumbnail ) );
+            if ( err == KErrCorrupt )
+                {
+                err = iContentDirectoryDb->RecreateDatabaseFile( );
+                }
+            }
+        User::LeaveIfError( err );
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateResTagInternalL
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::CreateResTagInternalL( TInt aSessionId,
+    TDesC8& aFilePath, HBufC8* aImportUri, TBool aOnlyThumbnail )
+    {
+    TInt ret = KErrGeneral;
+    HBufC8* number = UpnpCdUtils::RandomizeL( KRandomMax );
+    CleanupStack::PushL( number );
+    HBufC8* number2 = UpnpCdUtils::RandomizeL( KRandomMax );
+    CleanupStack::PushL( number2 );
+    HBufC8* importRandomize = HBufC8::NewLC( aImportUri->Des().Length( )+number->Des().Length( ) );
+    importRandomize->Des().Copy( *aImportUri );
+    importRandomize->Des().Replace( importRandomize->Length( ) - 4, 4, *number2 );
+    importRandomize->Des().Append( *number );
+
+    RXmlEngDocument obj;
+    TInt objId = KErrNotFound;
+    iContentDirectoryDb->GetObjectByAttrL( obj, &objId, KImportUri8,
+        *aImportUri );
+    CleanupClosePushL( obj );
+
+    if ( !obj.NotNull( ) )
+        {
+        CleanupStack::PopAndDestroy( &obj );
+        CleanupStack::PopAndDestroy( importRandomize );
+        CleanupStack::PopAndDestroy( number2 );
+        CleanupStack::PopAndDestroy( number );
+        return ret;
+        }
+
+    HBufC8* mimeType = GetMimeTypeLC( aFilePath );
+    // CheckFileName 
+    HBufC8* newName = ChangeFileNameWithExtensionL( aFilePath, *mimeType );
+    if ( !newName )
+        {
+        // renaming file failed, set the old  name
+        newName = HBufC8::NewL( aFilePath.Length( ) );
+        newName->Des().Copy( aFilePath );
+        }
+    CleanupStack::PushL( newName );
+
+    TSize objectSize( 0, 0);
+
+    //GetFileName
+    HBufC16* filename16 = UpnpString::ToUnicodeL( *newName );
+    CleanupStack::PushL( filename16 );
+
+    if ( obj.NotNull( ) && !aOnlyThumbnail )
+        {
+        // if there is already a file related to this importUri delete it
+        DeleteOldResourcesL( obj, *aImportUri, *filename16 );
+
+        // set new contentUri
+        TXmlEngElement objEl = obj.DocumentElement( );
+
+        TPtrC8 fileNamePtr =
+                newName->Mid( newName->LocateReverse( '\\' ) + 1 );
+
+        TInt extPosition = fileNamePtr.LocateReverse( '.' );
+        TPtrC8 ext;
+        if ( extPosition>0 )
+            ext.Set( fileNamePtr.Mid( extPosition ) );
+        else
+            ext.Set( KNullString8 );
+        HBufC8* contUri = HBufC8::NewLC( importRandomize->Length( ) + KSlash().Length( ) +
+                                         KMaxLongIntegerLen + ext.Length( ) );
+        TPtr8 contUriPtr(contUri->Des( ));
+        contUriPtr.Copy( *importRandomize );
+        contUriPtr.Append( KSlash );
+
+        TBuf8<KMaxLongIntegerLen> num;
+        num.Num( objId );
+        contUriPtr.Append( num );
+        contUriPtr.Append( ext );
+
+        TXmlEngElement resEl;
+        UpnpDomInterface::GetDirectoryElementL( objEl, resEl, KRes( ),
+            KImportUri8( ), aImportUri->Des( ) );
+        resEl.SetTextL( contUriPtr );
+
+        CleanupStack::PopAndDestroy( contUri );
+
+        // set res@size  
+        TXmlEngAttr size = resEl.AttributeNodeL( KSize( ) );
+        if ( size.NotNull( ) )
+            {
+            SetResSizeL( size, *filename16 );
+            }
+
+        // set res@protocolInfo
+        HBufC8* protocolInfo =
+                ProtocolInfoFromMimeL( mimeType->Des( ), resEl );
+        CleanupStack::PushL( protocolInfo );
+
+        TXmlEngAttr protInf = resEl.AttributeNodeL( KprotocolInfo( ) );
+        protInf.SetValueL( *protocolInfo );
+
+        CleanupStack::PopAndDestroy( protocolInfo );
+
+        CheckItemTypeForObjectL( obj, *mimeType );
+
+        RemoveFileTransferFromTransferIDsStateVariableL( aSessionId );
+
+        // update database
+        iElementdb->ValidateNewObjectL( obj.DocumentElement( ), EFalse );
+        iContentDirectoryDb->UpdateObjectL( objId, obj );
+
+        // add resource
+        CUpnpResourcesBean* resBn = CUpnpResourcesBean::NewLC( );
+        resBn->SetId( UpnpCdUtils::ResIdFromUriL( *importRandomize ) );
+        resBn->SetPathL( *newName );
+        resBn->SetIsReadonly( EFalse );
+        resBn->SetIsThumbnail( EFalse );
+        iContentDirectoryDb->AddResourceL( resBn, objId );
+        // clean up
+        CleanupStack::PopAndDestroy( resBn );
+        ret = KErrNone;
+        }
+
+    //send event to Media server      
+
+
+    CUpnpFileTransferEvent* event =
+            iTransferController->TransferL( aSessionId );
+
+    if ( event )
+        {
+        event->SetFilePathL( *filename16 );
+        //CleanupStack::Pop( event);
+        //iEventObserver->FileTransferEvent( event );
+        }
+
+    // create thumbnail
+    CreateThumbnailL( *filename16, objId );
+
+    // clean up
+    CleanupStack::PopAndDestroy( filename16 );
+    CleanupStack::PopAndDestroy( newName );
+    CleanupStack::PopAndDestroy( mimeType );
+    CleanupStack::PopAndDestroy( &obj );
+    CleanupStack::PopAndDestroy( importRandomize );
+    CleanupStack::PopAndDestroy( number2 );
+    CleanupStack::PopAndDestroy( number );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::SetResSizeL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::SetResSizeL( TXmlEngAttr aSize,
+    const TDesC& aFilePath )
+    {
+    // get file size
+    RFile file;
+    CleanupClosePushL( file );
+    User::LeaveIfError( file.Open( iFs, aFilePath, EFileRead|EFileShareAny ) );
+    TInt size;
+    User::LeaveIfError( file.Size( size ) );
+
+    // set size
+    TBuf8<KMaxLongIntegerLen> num;
+    num.Num( size );
+    aSize.SetValueL( num );
+
+    CleanupStack::PopAndDestroy( &file );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DeleteOldResourcesL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::DeleteOldResourcesL( RXmlEngDocument& aObj,
+    const TDesC8& aImportUri, const TDesC& aNewFile )
+    {
+    // for main res tag delete only corresponding record in the resources table
+    TXmlEngElement el;
+    UpnpDomInterface::GetDirectoryElementL( aObj.DocumentElement( ), el,
+        KImportUri8( ), aImportUri );
+    if ( el.NotNull( ) ) //  should always be true
+        {
+        TPtrC8 resVal(UpnpDomInterface::GetElementValueL( el ));
+        if ( resVal.Length( ) )
+            {
+            TInt64 resId = UpnpCdUtils::ResIdFromUriL( resVal ) ;
+            // check src existence -----------------------------
+            CUpnpResourcesBean* rscBean = NULL;
+            rscBean = iContentDirectoryDb->GetResourceL( resId );
+            TBool deletefile = ETrue;
+            //checking if a new file is the same as the old one
+            //if so, it means the old one was by chance deleted from the file system
+            if ( rscBean )
+                {
+                TPtrC rscPath(rscBean->Path( ) );
+                if ( !rscPath.Compare( aNewFile ) )
+                    deletefile = EFalse;
+                delete rscBean;
+                }
+            iContentDirectoryDb->DeleteResourceByResIdL( resId, deletefile );
+            }
+
+        }
+
+    // destroy all other res tags   
+    RArray<TXmlEngElement> elms;
+    CleanupClosePushL( elms );
+    UpnpDomInterface::GetElementListL( aObj.DocumentElement( ), elms, KRes );
+    // for each element
+    for ( TInt i=0; i < elms.Count( ); i++ )
+        {
+        TXmlEngAttr impUri(elms[i].AttributeNodeL( KImportUri( ) ) );
+        if ( impUri.IsNull( ) && !el.IsSameNode( elms[i] ) )
+            {
+            TPtrC8 resVal(UpnpDomInterface::GetElementValueL( elms[i] ));
+            if ( resVal.Length( ) )
+                {
+                iContentDirectoryDb->DeleteResourceByResIdL( 
+                                                        UpnpCdUtils::ResIdFromUriL( resVal ) );
+                }
+            elms[i].Remove( );
+            }
+        }
+    CleanupStack::PopAndDestroy( &elms );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateThumbnailCreatorL
+// -----------------------------------------------------------------------------
+//
+CUpnpThumbnailCreator* CUpnpContentDirectory::CreateThumbnailCreatorL(
+    TInt aObjectId )
+    {
+    CUpnpThumbnailCreator* thumbCreator = NULL;
+
+    if ( iBitmapServerConnection == KErrNone )
+        {
+        //check if from the file THUMB can be created. 
+        //create thumbnail 
+        // in thumbnail save the information. 
+        thumbCreator = CUpnpThumbnailCreator::NewLC( this );
+        iThumbnailCreators.AppendL( thumbCreator );
+        TInt index = iThumbnailCreators.Find( thumbCreator );
+        User::LeaveIfError( index );
+        iThObjectIds.Insert( aObjectId, index );
+        CleanupStack::Pop( thumbCreator );
+        }
+    return thumbCreator;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::RemoveThCreatorAndObjectIdLD
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::RemoveThCreatorAndObjectIdLD(
+    CUpnpThumbnailCreator* aThCreator )
+    {
+    TInt index = iThumbnailCreators.Find( aThCreator );
+    if ( index == KErrNotFound )
+        {
+        RDebug::Print( _L( "There is no corresponding thCreator in list. Error situation." ) );
+        delete aThCreator;
+        return;
+        }
+    else
+        {
+        iThumbnailCreators.Remove( index );
+        }
+    if ( index < iThObjectIds.Count( ) )
+        {
+        iThObjectIds.Remove( index );
+        }
+    delete aThCreator;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetObjectIdFromThCreator
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::GetObjectIdFromThCreator(
+    CUpnpThumbnailCreator* aThCreator )
+    {
+    TInt result = KErrNotFound;
+    TInt index = iThumbnailCreators.Find( aThCreator );
+    RDebug::Print( _L( "Whole number of objects. %d" ) ,
+        iThObjectIds.Count( ) );
+    if ( index < iThObjectIds.Count( ) )
+        {
+        result = iThObjectIds[index];
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::NotifyThumbnailResultL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::NotifyThumbnailResultL(
+    CUpnpThumbnailCreator* aThCreator, TInt aResult )
+    {
+    TInt result = aResult;
+    RDebug::Print( _L( "Thumbnail has been created with result: %d" ),
+        aResult );
+    if ( aResult == KErrNone )
+        {
+        RXmlEngDocument obj;
+        CleanupClosePushL( obj );
+        TInt objectId = GetObjectIdFromThCreator( aThCreator );
+        TInt err =
+                iContentDirectoryDb->GetObjectL( objectId, obj, KAsterisk8 );
+        if ( err == EUpnpOk )
+            {
+            // get item element
+            TXmlEngElement objElement;
+            UpnpDomInterface::GetElementL( obj.DocumentElement( ),
+                objElement, KItem );
+
+            // add new res tag
+            TXmlEngElement thumbRes(objElement.AddNewElementL( KRes( ) ) );
+
+            // add protocolInfo
+            HBufC8* protocolInfo = ProtocolInfoFromMimeL( KThumbMimeType( ),
+                JPEG_TN, ETrue, ETrue );
+            CleanupStack::PushL( protocolInfo );
+            thumbRes.AddNewAttributeL( KprotocolInfo( ), *protocolInfo );
+            CleanupStack::PopAndDestroy( protocolInfo );
+
+            // add contentUri
+            HBufC8* contUri = BuildContentUriL( aThCreator->GetFileExt( ),
+                objectId );
+            CleanupStack::PushL( contUri );
+            thumbRes.SetTextL( *contUri );
+
+            // add new resource
+            CUpnpResourcesBean* resBean = CUpnpResourcesBean::NewLC( );
+            resBean->SetId( UpnpCdUtils::ResIdFromUriL( *contUri ) );
+            resBean->SetPathL( aThCreator->GetPath( ) );
+            resBean->SetIsReadonly( EFalse );
+            resBean->SetIsThumbnail( ETrue );
+            iContentDirectoryDb->AddResourceL( resBean, objectId );
+
+            // update
+            iElementdb->ValidateNewObjectL( obj.DocumentElement( ), EFalse );
+            iContentDirectoryDb->UpdateObjectL( objectId, obj );
+            RemoveThCreatorAndObjectIdLD( aThCreator );
+
+            // clean up
+            CleanupStack::PopAndDestroy( resBean );
+            CleanupStack::PopAndDestroy( contUri );
+            }
+        else
+            {
+            // delete thumbnail file if exists
+            iFs.Delete( aThCreator->GetPath( ) ); // ignore errors
+            // remove thCreator and objectID from list 
+            RemoveThCreatorAndObjectIdLD( aThCreator );
+            result = err;
+            }
+        CleanupStack::PopAndDestroy( &obj );
+        }
+    else
+        {
+        // delete thumbnail file if exists
+        iFs.Delete( aThCreator->GetPath( ) ); // ignore errors
+        // remove thCreator and objectID from list 
+        RemoveThCreatorAndObjectIdLD( aThCreator );
+        }
+
+    // notify
+    if ( iThmbObs )
+        {
+        iThmbObs->NotifyThumbnailResultL( 0, result );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateResTagL
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::CreateResTagL( TInt aSessionId,
+    TDesC8& aFilePath, TInt aImportNumber, TBool aOnlyThumbnail )
+    {
+    HBufC8* importUri = UpnpCdUtils::BuildImportUriLC( aImportNumber );
+    TInt ret = CreateResTagInternalWithDBRecoveryL( aSessionId, aFilePath,
+        importUri, aOnlyThumbnail );
+    CleanupStack::PopAndDestroy( importUri );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ProtocolInfoFromMimeLC
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaProtocolInfo* CUpnpContentDirectory::CreateProtocolInfoFromMimeL(
+    const TDesC8& aMimeType, TInt aAddInfo )
+    {
+    CUpnpProtocolInfoLocal* protInfo = CUpnpProtocolInfoLocal::NewL(
+        aMimeType, aAddInfo );
+    CleanupStack::PushL( protInfo );
+    protInfo->SetThirdFieldL( aMimeType );
+    CleanupStack::Pop( protInfo );
+    return protInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ProtocolInfoFromMimeL
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpContentDirectory::ProtocolInfoFromMimeL(
+    const TDesC8& aMimeType, TInt aAddInfo, TBool aOpRangeParam,
+    TBool aCiParam /*= EFalse*/)
+    {
+    CUpnpDlnaProtocolInfo* protInfo = CreateProtocolInfoFromMimeL( aMimeType,
+        aAddInfo );
+    if ( aCiParam )
+        {
+        protInfo->SetCiParameter( ETrue );
+        }
+    if ( aOpRangeParam )
+        {
+        protInfo->SetOpParameterL( B_VAL, ETrue );
+        }
+
+    CleanupStack::PushL( protInfo );
+    TPtrC8 protocolInfo = protInfo->ProtocolInfoL( );
+    HBufC8* protocolInfoDes = protocolInfo.Alloc( );
+    CleanupStack::PopAndDestroy( protInfo );
+    return protocolInfoDes;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ProtocolInfoFromMimeL
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpContentDirectory::ProtocolInfoFromMimeL(
+    const TDesC8& aMimeType, TXmlEngElement& aResEl )
+    {
+    HBufC8* result = NULL;
+    const TDesC8& value = UpnpDomInterface::GetAttrValueL( aResEl,
+        KprotocolInfo );
+    if ( aMimeType.Length( ) > 0 )
+        {
+        if ( value.Length( ) )
+            {
+            CUpnpDlnaProtocolInfo* protocolInfo =
+                    CUpnpDlnaProtocolInfo::NewL( (TDesC8&) value );
+            CleanupStack::PushL( protocolInfo );
+            TPtrC8 third = protocolInfo->ThirdField( );
+            if ( !(aMimeType == third ) )
+                {
+                protocolInfo->SetThirdFieldL( (TDesC8&)aMimeType );
+                protocolInfo->SetFourthFieldL( KAsterisk8( ) );
+                }
+            TPtrC8 protInfo = protocolInfo->ProtocolInfoL( );
+            result = protInfo.Alloc( );
+            CleanupStack::PopAndDestroy( protocolInfo );
+            }
+        }
+    else
+        {
+        result = value.AllocL( );
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetFileNameL
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpContentDirectory::GetFileNameL( TInt aObjId )
+    {
+    TInt objId = aObjId;
+    HBufC* result = NULL;
+    RXmlEngDocument objDidl;
+    iContentDirectoryDb->GetObjectL( objId, objDidl, KAsterisk8( ) );
+    CleanupClosePushL( objDidl );
+    TXmlEngElement obj = objDidl.DocumentElement().FirstChild().AsElement( );
+    if ( obj.IsNull( ) )
+        {
+        CleanupStack::PopAndDestroy( &objDidl );
+        return NULL;
+        }
+
+    // file name
+    TXmlEngElement objTitle;
+    UpnpDomInterface::GetElementL( obj, objTitle, KObjTiltleColName8( ) );
+    if ( objTitle.IsNull( ) )
+        {
+        CleanupStack::PopAndDestroy( &objDidl );
+        return NULL;
+        }
+
+    // mime type
+    RArray<TXmlEngElement> reses;
+    CleanupClosePushL( reses );
+    UpnpDomInterface::GetElementListL( obj, reses, KRes );
+    HBufC8* mimeType = NULL;
+    for ( TInt i = 0; i < reses.Count( ); i++ )
+        { // should be only one importUri
+        TXmlEngAttr impUri;
+        impUri = reses[i].AttributeNodeL( KImportUri );
+        if ( impUri.NotNull( ) )
+            {
+            TXmlEngAttr prInfoAttr = reses[i].AttributeNodeL( KprotocolInfo );
+            CUpnpDlnaProtocolInfo* prInfo =
+                    CUpnpDlnaProtocolInfo::NewL( prInfoAttr.Value( ) );
+            CleanupStack::PushL( prInfo );
+            mimeType = prInfo->ThirdField().AllocL( );
+            CleanupStack::PopAndDestroy( prInfo );
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy( &reses );
+
+    TPtrC ext;
+    if ( mimeType )
+        {
+        TPtrC8 mimeTypeCut( *mimeType);
+        TInt position = mimeType->Des().Find( KSemicolon8 );
+        if ( position != KErrNotFound )
+            {
+            mimeTypeCut.Set( mimeType->Des().Left( position ) );
+            }
+
+        const HBufC* tmp = iMimeToExtMap->Get( mimeTypeCut );
+        if ( tmp )
+            {
+            ext.Set( tmp->Ptr( ), tmp->Length( ) ); // do not delete
+            }
+        delete mimeType;
+        }
+
+    result = HBufC::NewLC( objTitle.Value().Length( ) + ext.Length( ) );
+    TPtr resPtr(result->Des( ) );
+    HBufC* title = UpnpCdUtils::Des8ToDesLC( objTitle.Value( ) );
+
+    resPtr.Copy( *title );
+
+    TInt wholeNameLength = title->Des().LocateReverse( '.' );
+    TInt extenLength = title->Length( )-wholeNameLength;
+    TPtrC exten;
+    if ( extenLength )
+        {
+        exten.Set( title->Right( extenLength ) );
+        }
+
+    if ( ext.CompareF( exten ) != 0 )
+        {
+        resPtr.Append( ext );
+        }
+
+    // forbidden chars
+    UpnpCdUtils::ValidateFilePath( resPtr );
+
+    HBufC* basePath = HBufC::NewL( iDownloadDir->Des().Length( ) + result->Des().Length( ) );
+    basePath -> Des().Append( iDownloadDir->Des( ) );
+    basePath -> Des().Append( result->Des( ) );
+
+    CleanupStack::PopAndDestroy( title );
+    CleanupStack::PopAndDestroy( result );
+    CleanupStack::PopAndDestroy( &objDidl );
+
+    if ( BaflUtils::FileExists( iFs, *basePath ) )
+        {
+        CleanupStack::PushL( basePath );
+        HBufC* fileName = CreateFileNameL( basePath->Des( ) );
+        CleanupStack::PopAndDestroy( basePath );
+        return fileName;
+        }
+
+    return basePath;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetFileNameWithoutPathL
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpContentDirectory::GetFileNameWithoutPathL( TInt aObjId )
+    {
+    TInt objId = aObjId;
+    HBufC* result = NULL;
+    RXmlEngDocument objDidl;
+    iContentDirectoryDb->GetObjectL( objId, objDidl, KAsterisk8( ) );
+    CleanupClosePushL( objDidl );
+    TXmlEngElement obj = objDidl.DocumentElement().FirstChild().AsElement( );
+    if ( obj.IsNull( ) )
+        {
+        CleanupStack::PopAndDestroy( &objDidl );
+        return NULL;
+        }
+
+    // file name
+    TXmlEngElement objTitle;
+    UpnpDomInterface::GetElementL( obj, objTitle, KObjTiltleColName8( ) );
+    if ( objTitle.IsNull( ) )
+        {
+        CleanupStack::PopAndDestroy( &objDidl );
+        return NULL;
+        }
+
+    // mime type
+    RArray<TXmlEngElement> reses;
+    CleanupClosePushL( reses );
+    UpnpDomInterface::GetElementListL( obj, reses, KRes );
+    HBufC8* mimeType = NULL;
+    for ( TInt i = 0; i < reses.Count( ); i++ )
+        { // should be only one importUri
+        TXmlEngAttr impUri;
+        impUri = reses[i].AttributeNodeL( KImportUri );
+        if ( impUri.NotNull( ) )
+            {
+            TXmlEngAttr prInfoAttr = reses[i].AttributeNodeL( KprotocolInfo );
+            CUpnpDlnaProtocolInfo* prInfo =
+                    CUpnpDlnaProtocolInfo::NewL( prInfoAttr.Value( ) );
+            CleanupStack::PushL( prInfo );
+            mimeType = prInfo->ThirdField().AllocL( );
+            CleanupStack::PopAndDestroy( prInfo );
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy( &reses );
+
+    TPtrC ext;
+    if ( mimeType )
+        {
+        TPtrC8 mimeTypeCut(*mimeType);
+        TInt position = mimeType->Des().Find( KSemicolon8 );
+        if ( position != KErrNotFound )
+            {
+            mimeTypeCut.Set( mimeType->Des().Left( position ) );
+            }
+
+        const HBufC* tmp = iMimeToExtMap->Get( mimeTypeCut );
+        if ( tmp )
+            {
+            ext.Set( tmp->Ptr( ), tmp->Length( ) ); // do not delete
+            }
+        delete mimeType;
+        }
+
+    result = HBufC::NewLC( objTitle.Value().Length( ) + ext.Length( ) );
+    TPtr resPtr(result->Des( ));
+    HBufC* title = UpnpCdUtils::Des8ToDesLC( objTitle.Value( ) );
+
+    resPtr.Copy( *title );
+
+    TInt wholeNameLength = title->Des().LocateReverse( '.' );
+    TInt extenLength = title->Length( )-wholeNameLength;
+    TPtrC exten;
+    if ( extenLength )
+        {
+        exten.Set( title->Right( extenLength ) );
+        }
+
+    if ( ext.CompareF( exten )!=0 )
+        resPtr.Append( ext );
+
+    // forbidden chars
+    UpnpCdUtils::ValidateFilePath( resPtr );
+
+    // clean up
+    CleanupStack::PopAndDestroy( title );
+    CleanupStack::Pop( result );
+    CleanupStack::PopAndDestroy( &objDidl );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateFileNameL
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpContentDirectory::CreateFileNameL( const TDesC16& aFileName )
+    {
+    const TInt KMaxSameFileNames = 10000;
+    TParse parseFilename;
+    parseFilename.Set( aFileName, NULL, NULL );
+
+    // orginal file + underscore + number 
+    HBufC* name = HBufC::NewLC( aFileName.Length( ) + KMaxIntegerLen );
+    TPtr namePtr(name->Des( ) );
+
+    for ( TInt count = 1; count < KMaxSameFileNames; count++ )
+        {
+        TBuf<KMaxIntegerLen> value;
+        value.Num( count );
+
+        namePtr.Append( parseFilename.DriveAndPath( ) );
+        namePtr.Append( parseFilename.Name( ) );
+        namePtr.Append( KUndersc( ) );
+        namePtr.Append( value );
+        namePtr.Append( parseFilename.Ext( ) );
+
+        if ( !BaflUtils::FileExists( iFs, namePtr ) )
+            {
+            break;
+            }
+        namePtr.Zero( );
+        }
+
+    CleanupStack::Pop( name );
+    return name;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetTitleForUriL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::GetTitleForUriL( TInt aObjectId, TPtr& aValue )
+    {
+    HBufC* result = GetFileNameWithoutPathL( aObjectId );
+    TPtr des = result->Des( );
+    UpnpCdUtils::ValidateFilePath( des );
+    if ( result == NULL )
+        {
+        return;
+        }
+    aValue.Copy( *result );
+    delete result;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CheckImportUriL
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::CheckImportUriL( const TDesC8& aImportUri )
+    {
+    TInt objId = KErrNotFound;
+
+    // http characters  
+    HBufC8* dest8 = HBufC8::NewLC( aImportUri.Length( ) );
+    TPtr8 dest8Ptr(dest8->Des( ));
+    dest8Ptr.Copy( aImportUri );
+
+    UpnpString::ReplaceHttpCharacters( dest8Ptr );
+
+    // ip and port placeholder
+    HBufC8* dest = InsertIpAndPortPlaceholderL( dest8Ptr );
+    CleanupStack::PushL( dest );
+
+    objId = iContentDirectoryDb->GetObjIdByAttrLikeL( KImportUri8, *dest );
+
+    // clean up
+    CleanupStack::PopAndDestroy( dest );
+    CleanupStack::PopAndDestroy( dest8 );
+
+    return objId;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateAddressValueLC
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpContentDirectory::CreateAddressValueLC()
+    {
+
+    HBufC8* result = NULL;
+
+    CBufFlat* resBuf = CBufFlat::NewL( KMaxName );
+    CleanupStack::PushL( resBuf );
+
+    UpnpString::AppendStringL( *resBuf, KHttpTag( ) );
+    UpnpString::AppendStringL( *resBuf, KIpPortPlaceholder8( ) );
+
+    result = HBufC8::NewL( resBuf->Size( ) );
+    TPtr8 resultPtr(result->Des( ));
+    resultPtr.Copy( resBuf->Ptr( 0 ) );
+    CleanupStack::PopAndDestroy( resBuf );
+    CleanupStack::PushL( result );
+    return result;
+    // path 
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetImportUriLC
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpContentDirectory::GetImportUriLC( CUpnpHttpMessage* aMessage )
+    {
+    TPtrC8 path = aMessage->SenderPathFromHeader( );
+    if ( path.Find( KHttpTag ) == KErrNotFound )
+        {
+        HBufC8* serverAddr = CreateAddressValueLC( );
+        HBufC8* result =
+                HBufC8::NewL( serverAddr->Length( ) + path.Length( ) );
+        TPtr8 resultPtr(result->Des( ) );
+        resultPtr.Append( *serverAddr );
+        resultPtr.Append( path );
+        CleanupStack::PopAndDestroy( serverAddr );
+        CleanupStack::PushL( result );
+        return result;
+        }
+    else
+        {
+        HBufC8* pathHBuf = InsertIpAndPortPlaceholderL( path );
+        CleanupStack::PushL( pathHBuf );
+        return pathHBuf;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetProtocolInfoByImportUriL
+// -----------------------------------------------------------------------------
+//
+CUpnpDlnaProtocolInfo* CUpnpContentDirectory::GetProtocolInfoByImportUriL(
+    const TDesC8& aImportUri )
+    {
+    TPtrC8 importUri;
+    importUri.Set( UpdateImportUriL( aImportUri ) );
+
+    CUpnpDlnaProtocolInfo* protocolInfo = NULL;
+    // check restriction - cannot export to the restricted object
+    TInt objId = iContentDirectoryDb->
+    GetObjIdByAttrLikeL( KImportUri8, importUri );
+
+    if ( objId < 0 )
+        {
+        User::Leave( ENoSuchObject );
+        }
+
+    if ( iContentDirectoryDb->
+    CheckObjectRestrictionL( objId ) == ERestrictedObject )
+        {
+        User::Leave( ERestrictedObject );
+        }
+    // parent restricions
+    if ( iContentDirectoryDb->CheckParentRestrictionL( objId ) != EUpnpOk )
+        {
+        User::Leave( ERestrictedParentObject );
+        }
+    else
+        {
+        HBufC8* protInfoBuf = iContentDirectoryDb->
+        GetProtocolInfoByImportUriL( importUri );
+
+        if ( protInfoBuf )
+            {
+            CleanupStack::PushL( protInfoBuf );
+            protocolInfo = CUpnpDlnaProtocolInfo::NewL( protInfoBuf->Des( ) );
+            CleanupStack::PopAndDestroy( protInfoBuf );
+            }
+        }
+    return protocolInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::UpdateImportUriL
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CUpnpContentDirectory::UpdateImportUriL( const TDesC8& aImportUri )
+    {
+    HBufC8* portAndIp =  GetIpAndPortDes8L();
+    CleanupStack::PushL( portAndIp );
+
+    TPtrC8 importUri;
+    importUri.Set( aImportUri );
+    
+    TInt index = aImportUri.Find( *portAndIp );
+    if ( index > 0 )
+        {
+        importUri.Set( aImportUri.Mid( index + portAndIp->Des().Length() ) );
+        }
+                
+    CleanupStack::PopAndDestroy( portAndIp );
+    
+    //--- replaceing e.g '/0000000004' -> '0000000004'   
+    index = importUri.Find( KSlash8() );
+	// importUri must begins with '/'
+    if ( !index )
+        {
+        importUri.Set( importUri.Mid( index + 1 ) );        
+        }
+     else
+        {
+        User::Leave( ENoSuchObject );         
+        }   
+    //----------------------------------------
+    
+    if ( importUri.Length() < KMaxIntegerLen )
+        {
+        User::Leave(ENoSuchObject);        
+        }
+    
+    // Check if all signs in uri are digits
+    TLex8 lex( importUri );
+    for( TInt i( 0 ); i < importUri.Length(); i++ )
+        {
+        if ( !( lex.Get() ).IsDigit() ) 
+            {
+            User::Leave( ENoSuchObject ); 
+            }
+        }    
+    return importUri; 
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetProtocolInfoL
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::GetProtocolInfoL( const TDesC8& aContentUri,
+    CUpnpDlnaProtocolInfo*& aProtocolInfo )
+    {
+    HBufC8 *buf = InsertIpAndPortPlaceholderL( aContentUri );
+    CleanupStack::PushL( buf );
+    TInt err = iContentDirectoryDb->GetProtocolInfoL( buf->Des( ),
+        aProtocolInfo );
+    CleanupStack::PopAndDestroy( buf );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::FindSharedFolderL
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::FindSharedFolderL( const TDesC& aUrlPath,
+    const TDesC& aFileName, HBufC*& aSystemPath )
+    {
+    TInt ret = KErrNotFound;
+    aSystemPath = NULL;
+    if ( aUrlPath.Length( ) )
+        {
+        // validate the path string
+        if ( IsValidUrlPath( aUrlPath ) )
+            {
+            // get resource id
+            TLex lexer(aUrlPath);
+            TInt64 resId;
+            if ( !lexer.Val( resId ) )
+                {
+                // get resource
+                CUpnpResourcesBean* resBn = iContentDirectoryDb->
+                GetResourceL( resId );
+                if ( resBn )
+                    {
+                    CleanupStack::PushL( resBn );
+                    aSystemPath = resBn->Path().AllocL( );
+                    TInt objectId = resBn->ObjectId( );
+                    CleanupStack::PopAndDestroy( resBn );
+
+                    // make sure that systam path points to the wanted file
+                    TParse fp;
+                    fp.Set( *aSystemPath, 0, 0 );
+                    HBufC* tmp = aFileName.AllocLC( );
+                    TPtr tmpPtr(tmp->Des( ));
+                    UpnpString::ReplaceHttpCharactersL( tmpPtr );
+                    TPtrC ext = fp.Ext( );
+                    HBufC* file = HBufC::NewLC( KMaxIntegerLen
+                            + ext.Length( ) );
+                    TBuf<KMaxIntegerLen> num;
+                    num.Num( objectId );
+                    file->Des().Append( num );
+                    file->Des().Append( ext );
+
+                    if ( file->Des( ) == tmpPtr )
+                        {
+                        ret = KErrNone;
+                        }
+                    CleanupStack::PopAndDestroy( file );
+                    CleanupStack::PopAndDestroy( tmp );
+                    }
+                }
+            }
+        }
+    else
+        { // default download dir
+        aSystemPath = iDownloadDir->AllocL( );
+        }
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::IsValidUrlPathL
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectory::IsValidUrlPath( const TDesC& aUrlPath )
+    {
+    TInt ret = ETrue;
+    if ( (aUrlPath.Length( ) != KMaxIntegerLen + KRandomRangeLength)
+            && (aUrlPath.Length( ) != KMaxIntegerLen + KRandomRangeLength
+                    + KRandomRangeLength) )
+        {
+        ret = EFalse;
+        }
+    else
+        {
+        for ( TInt i = 0; i < aUrlPath.Length( ); i++ )
+            if ( aUrlPath[i] < '0' || aUrlPath[i] > '9' )
+                {
+                ret = EFalse;
+                break;
+                }
+        }
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetItemTypeFromMimeTypeLC
+// -----------------------------------------------------------------------------
+HBufC8* CUpnpContentDirectory::GetItemTypeFromMimeTypeLC(
+    const TDesC8& aMimeType )
+    {
+    HBufC8* result = NULL;
+    if ( aMimeType.Compare( KNullDesC8( ) ) == 0 )
+        {
+        return result;
+        }
+    TInt indexOfSlash = aMimeType.Find( KSlash8( ) );
+    if ( indexOfSlash < KErrNone )
+        {
+        return result;
+        }
+    TPtrC8 firstValue = aMimeType.Left( indexOfSlash );
+    if ( firstValue.Compare( KImageMime( ) ) == 0 )
+        {
+        result = KObjectClassImageItem().AllocLC( );
+        }
+    else if ( firstValue.Compare( KTextMime( ) ) == 0 )
+        {
+        result = KObjectClassTextItem().AllocLC( );
+        }
+    else if ( firstValue.Compare( KVideoMime( ) ) == 0 )
+        {
+        result = KObjectClassVideoItem().AllocLC( );
+        }
+    else if ( firstValue.Compare( KAudioMime( ) ) == 0 )
+        {
+        result = KObjectClassAudioItem().AllocLC( );
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::GetItemTypeFromMimeTypeLC
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::CheckItemTypeForObjectL( RXmlEngDocument& aObj,
+    const TDesC8& aMimeType )
+    {
+    //  temporary disable because of mime-type recognition problem 
+    HBufC8* itemType = GetItemTypeFromMimeTypeLC( aMimeType );
+    if ( !itemType )
+        {
+        return;
+        }
+    TXmlEngElement obj = aObj.DocumentElement( );
+    TXmlEngElement objClass;
+    UpnpDomInterface::GetElementL( obj, objClass, KObjClassColName8 );
+    TPtrC8 classValue(UpnpDomInterface::GetElementValueL( objClass ));
+    if ( classValue.Compare( itemType->Des( ) ) < 0 )
+        {
+        objClass.SetTextL( *itemType );
+        }
+    CleanupStack::PopAndDestroy( itemType );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::SetDownloadDirectoryL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::SetDownloadDirectoryL( const TDesC& aDownloadDir )
+    {
+    // perform necessary changes in database
+    iContentDirectoryDb->NewMediaDirectoryL( *iDownloadDir );
+
+    // alloc new string
+    delete iDownloadDir;
+    iDownloadDir = NULL;
+    TPtrC last = aDownloadDir.Right( 1 );
+    if ( last.Compare( KDiskPathElSep )!=0 )
+        {
+        iDownloadDir = HBufC::NewL( aDownloadDir.Length( )+ KDiskPathElSep().Length( ) );
+        iDownloadDir->Des().Copy( aDownloadDir );
+        iDownloadDir->Des().Append( KDiskPathElSep );
+        }
+    else
+        {
+        iDownloadDir = HBufC::NewL( aDownloadDir.Length( ) );
+        iDownloadDir->Des().Copy( aDownloadDir );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::SetThumbnailDirectoryL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::SetThumbnailDirectoryL( const TDesC& aDownloadDir )
+    {
+    // perform necessary changes in database
+    iContentDirectoryDb->NewMediaDirectoryL( *iThumbDir );
+
+    // alloc new string
+    delete iThumbDir;
+    iThumbDir = NULL;
+    iThumbDir = aDownloadDir.AllocL( );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::HandleDbError
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectory::HandleDbError( TInt aError )
+    {
+    return iContentDirectoryDb->HandleDbError( aError );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DataBaseHasBeenRecoveredL
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectory::DataBaseHasBeenRecoveredL( TInt aError )
+    {
+    TInt err = aError;
+    if ( err == KErrCorrupt )
+        {
+        err = HandleDbError( err );
+        }
+    return (err == KErrNone && aError == KErrCorrupt ) ? ETrue : EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::IsDbOrDiskProblemL
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectory::IsDbOrDiskProblemL( CUpnpAction* aAction )
+    {
+    TBool noSpace = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs,
+        KMinDiskSpace, EDriveC );
+    TInt error( KErrNone );
+    if ( !noSpace )
+        {
+        if ( !IsDbCreated() )
+            {
+            error = HandleDbError( KErrCorrupt );
+            }
+        }
+    if ( noSpace || error != KErrNone )
+        {
+        DoSendActionL( aAction, ECannotProcess );
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::IsDbCreated
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectory::IsDbCreated()
+    {
+    return iContentDirectoryDb->IsDbCreated( );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::CreateNameForThumbnailL
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpContentDirectory::CreateNameForThumbnailL( const TDesC& aFileName )
+    {
+    // only name
+    TParse fp;
+    User::LeaveIfError( fp.Set( aFileName, 0, 0 ) );
+    TFileName bareName = fp.Name( );
+    // full name
+    User::LeaveIfError( fp.Set( bareName, iThumbDir, &KDefaultThumbExtension ) );
+    TFileName fullName = fp.FullName( );
+
+    //check if exists
+    TUint ignored;
+    TInt q = 0;
+    while ( iFs.Att( fullName, ignored ) == KErrNone )
+        {
+        q++;
+        TBuf<KMaxIntegerLen> num;
+        num.Num( q );
+        TFileName tmpName;
+        tmpName.Copy( bareName );
+        tmpName.Append( KUndersc );
+        tmpName.Append( num );
+        fp.Set( tmpName, iThumbDir, &KDefaultThumbExtension );
+        fullName = fp.FullName( );
+        }
+
+    return fullName.AllocL( );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::AutoDestroyEventL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::AutoDestroyEventL( TInt aObjId, TBool aDeleteObj )
+    {
+    if ( !ValidateObjectL( aObjId ) )
+        {
+        return;
+        }
+
+    if ( aDeleteObj )
+        {
+        TBuf8<KMaxIntegerLen> containerID;
+        containerID.Num( iContentDirectoryDb->GetParentIdL( aObjId ) );
+        RArray<TInt> refList;
+        CleanupClosePushL( refList );
+        iContentDirectoryDb->DeleteObjectL( aObjId, refList, ETrue );
+
+        // supporting ContainerUpdateIDs behaviour
+        iStateHandler->IncreaseSystemUpdateIdL( );
+        iStateHandler->IncreaseContainerUpdateIdL( containerID );
+        for ( TInt i(0); i<refList.Count( ); i++ )
+            {
+            iStateHandler->IncreaseSystemUpdateIdL( );
+            containerID.Num( refList[i] );
+            iStateHandler->IncreaseContainerUpdateIdL( containerID );
+            }
+
+        // clean up
+        CleanupStack::PopAndDestroy( &refList );
+        }
+    iAutoDestroyObjects->RemoveAndDestroyL( iAutoDestroyObjects->FindObjIndexByObjId( aObjId ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::HttpTransferEventReceivedL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectory::HttpTransferEventReceivedL( CUpnpHttpMessage& aHttpMsg )
+    {
+    switch ( aHttpMsg.Type( ) )
+        {
+        case ETransferStart:
+            {
+            TransferStartL( aHttpMsg.SenderPathFromHeader( ) );
+
+            CUpnpFileTransfer::TTransferType type;
+            TInt objectid(0);
+
+            if ( aHttpMsg.Method().Find( KHttpGet ) == 0 )
+                {
+                objectid = iContentDirectoryDb->GetObjIdByAttrL( KImportUri8,
+                    aHttpMsg.SenderPathFromHeader( ) );
+                type = CUpnpFileTransfer::EImport;
+                }
+            else
+                {
+                objectid = iContentDirectoryDb->GetObjIdByAttrLikeL(
+                    KImportUri8, aHttpMsg.SenderPathFromHeader( ) );
+                type = CUpnpFileTransfer::EUpload;
+
+                }
+            CUpnpFileTransfer* transfer = CUpnpFileTransfer::NewLC(
+                aHttpMsg.SessionId( ), objectid, type );
+
+            transfer->SetTransferState(:: ETransferInProgress);
+            transfer->SetImportNumber(UpnpCdUtils::ResIdFromUriL(
+                    aHttpMsg.SenderPathFromHeader()));
+
+            iTransferController->iFileTransfers.Append(transfer);
+            CleanupStack::Pop( transfer );
+
+            iTransferController->AddIncomingTransferInternalL(&aHttpMsg);
+            break;
+            }
+        case ETransferError:
+            {
+            iTransferController->TransferFailL( &aHttpMsg );
+            break;
+            }
+        default:
+        break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ImportComplete
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::TransferProgress( TInt aId, TInt aBytes,
+    TInt aTotalBytes )
+    {
+    TInt transferId = iTransferController->Transfer( aId );
+    if ( transferId != KErrNotFound )
+        {
+        (iTransferController->iFileTransfers[ transferId ])->SetTransferLength( aBytes );
+        (iTransferController->iFileTransfers[ transferId ])->SetTransferTotal( aTotalBytes );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::TransferStartL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::TransferStartL( const TDesC8& aImpUri )
+    {
+    TInt index = iAutoDestroyObjects->FindObjIndexByResId( UpnpCdUtils::ResIdFromUriL( aImpUri ) );
+    if ( index != KErrNotFound )
+        {
+        (*iAutoDestroyObjects)[index]->SetTransferStartedL( ETrue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::TransferCompleteL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::TransferCompleteL( TInt aResId, TInt aObjId )
+    {
+    TInt index = iAutoDestroyObjects->FindObjIndexByResId( aResId );
+    if ( index != KErrNotFound )
+        {
+        iAutoDestroyObjects->RemoveAndDestroyL( index );
+        }
+
+    if ( (aObjId>=0)&&(aResId>=0)
+            &&(iContentDirectoryDb->GetParentIdL( aObjId )>=0) )
+        {
+        TBuf8<KMaxIntegerLen> containerID;
+        containerID.Num( iContentDirectoryDb->GetParentIdL( aObjId ) );
+        iStateHandler->IncreaseSystemUpdateIdL( );
+        iStateHandler->IncreaseContainerUpdateIdL( containerID );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::NotifyTransferFailL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::NotifyTransferFailL( TInt aSessionId,
+    TInt aStatusCode )
+    {
+    CUpnpFileTransferEvent* event =
+            iTransferController->RemoveTransferLC( aSessionId );
+    if ( event )
+        {
+        event->SetProgressState( CUpnpFileTransferEvent::EFailed );
+        event->SetErrorCode( aStatusCode );
+        CleanupStack::Pop( event );
+        iEventObserver->FileTransferEvent( event );
+        }
+
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::NotifyTransferStoppedL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::NotifyTransferStoppedL( TInt aSessionId,
+    CUpnpFileTransfer::TTransferType aType )
+    {
+    CUpnpFileTransferEvent* event =
+            iTransferController->RemoveTransferLC( aSessionId );
+    if ( event )
+        {
+        event->SetProgressState( CUpnpFileTransferEvent::EStopped );
+        if ( aType == CUpnpFileTransfer::EImport )
+            {
+            event->SetDirection( CUpnpFileTransferEvent::EIncoming );
+            }
+        else
+            {
+            event->SetDirection( CUpnpFileTransferEvent::EOutgoing );
+            }
+
+        CleanupStack::Pop( event );
+        iEventObserver->FileTransferEvent( event );
+        }
+
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::NotifyOutgoingTransferL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::NotifyOutgoingTransferL( TInt aSessionId )
+    {
+    CUpnpFileTransferEvent* event =
+            iTransferController->RemoveTransferLC( aSessionId );
+    if ( event )
+        {
+        CleanupStack::Pop( event );
+        //send event to Media Server        
+        iEventObserver->FileTransferEvent( event );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::SetSender
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectory::SetSender( MUpnpCdsSender* aSender )
+    {
+    iSender = aSender;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DoSendActionL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::DoSendActionL( CUpnpAction* aAction,
+    TUpnpErrorCode aError )
+    {
+    iSender->SendL( aAction, aError );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DoSendActionL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::DoSendMessageL( CUpnpHttpMessage* aMessage )
+    {
+    iSender->SendL( aMessage );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::SendActionL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectory::SendActionL( CUpnpAction* aAction,
+    TUpnpErrorCode aError )
+    {
+    SendL( aAction, aError );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::DoSendActionL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectory::SendMessageL( CUpnpHttpMessage* aMessage )
+    {
+    SendL( aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::StateVariableEvented
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::StateVariableEvented( const TDesC8& aVariableName )
+    {
+    iStateHandler->StateVariableEvented( aVariableName );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::StateHandler
+// -----------------------------------------------------------------------------
+//
+CUpnpStateHandler* CUpnpContentDirectory::StateHandler()
+    {
+    return iStateHandler;
+    }
+
+// helper functions
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ExecutedAction
+// -----------------------------------------------------------------------------
+//
+TCurrentAction CUpnpContentDirectory::ExecutedAction()
+    {
+    return iCurrentAction;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::SetExecutedAction
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::SetExecutedAction( TCurrentAction aAction )
+    {
+    iCurrentAction = aAction;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::HttpResponseReceivedL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::HttpResponseReceivedL( TInt aSessionId,
+    TInt aStatusCode )
+    {
+    iTransferController->HttpResponseReceivedL( aSessionId, aStatusCode );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::EventObserver
+// -----------------------------------------------------------------------------
+//
+MUpnpContentDirectoryEventObserver* CUpnpContentDirectory::EventObserver()
+    {
+    return iEventObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ContentDirectoryDb
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectoryDb* CUpnpContentDirectory::ContentDirectoryDb()
+    {
+    return iContentDirectoryDb;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::IsObjectExistL
+// -----------------------------------------------------------------------------
+//    
+TBool CUpnpContentDirectory::IsObjectExistL( TInt aObjectId )
+    {
+    if ( iContentDirectoryDb->CheckObjectRestrictionL( aObjectId )
+            == ENoSuchObject )
+        {
+        return EFalse;
+        }
+    else
+        {
+        return ETrue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::ValidateObjectL
+// -----------------------------------------------------------------------------
+//   
+TBool CUpnpContentDirectory::ValidateObjectL( TInt aObjectId )
+    {
+    //removes from autodestroy array orphaned objects
+    TInt i(0);
+    TInt index(0);
+    while ( i < iAutoDestroyObjects->Count( ) )
+        {
+        TInt parentID( iContentDirectoryDb->GetParentIdL(
+                        ( *iAutoDestroyObjects )[ i ]->GetObjId( ) ) );
+        if ( parentID < 0 )
+            {
+            index = iAutoDestroyObjects->FindObjIndexByObjId( (
+                                             *iAutoDestroyObjects )[ i ]->GetObjId( ) );
+            iAutoDestroyObjects->RemoveAndDestroyL( index );
+            continue;
+            }
+        i++;
+        }
+
+    //checks if given object exists
+    if ( !IsObjectExistL( aObjectId ) )
+        {
+        index = iAutoDestroyObjects->FindObjIndexByObjId( aObjectId );
+        if ( index != KErrNotFound )
+            {
+            iAutoDestroyObjects->RemoveAndDestroyL( index );
+            }
+        }
+
+    //cheks if given object exists in autodestroy array
+    index = iAutoDestroyObjects->FindObjIndexByObjId( aObjectId );
+    if ( index != KErrNotFound )
+        {
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::TransferHandler
+// -----------------------------------------------------------------------------
+//
+MUpnpTransferInterface* CUpnpContentDirectory::TransferHandler()
+    {
+    return iTransferHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::TransferCompletedL
+// -----------------------------------------------------------------------------
+//    
+void CUpnpContentDirectory::TransferCompletedL( TInt aKey, TInt aResultCode )
+    {
+    HttpResponseReceivedL( aKey, aResultCode );
+    if ( aResultCode == EHttpOk )
+        {
+        TInt transferid = iTransferController->Transfer( aKey );
+        if ( transferid > KErrNotFound )
+            {
+            TInt
+                    len =
+                            iTransferController->iFileTransfers[transferid]->TransferTotal( );
+            iTransferController->iFileTransfers[transferid]->SetTransferLength( len );
+            }
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::NewTransactionL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectory::NewTransactionL(
+        const TDesC8& aMethod, const TDesC8& aUri, 
+        const TInetAddr& aSender, CUpnpHttpServerTransaction*& aResultTrans )
+    {
+    iDlnaFilter->NewTransactionL( aMethod, aUri, aSender, aResultTrans );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::HttpEventLD
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::HttpEventLD( CUpnpHttpMessage* aMessage )
+    {
+    if ( aMessage )
+        {
+        CleanupStack::PushL( aMessage );
+        if( aMessage->Type() >= ETransferStart )
+            {
+            HttpTransferEventReceivedL( *aMessage );
+            }
+        else
+            {
+            UnknownHttpEventReceivedL( *aMessage );
+            }
+        CleanupStack::PopAndDestroy( aMessage );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::AddressChangeL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectory::AddressChangeL()
+    {
+    iHttpServerSession->Stop();
+    iHttpServerSession->StartL();        
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpcontentdirectorydb.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1418 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Database for MediaServer
+ *
+*/
+
+
+// INCLUDE FILES
+#include <barsread.h>
+#include <barsc.h>   
+#include <f32file.h>
+#include <xmlengdom.h>
+#include <sysutil.h>
+#include <upnpdominterface.h>
+#include <upnpstring.h>
+#include "upnpprotocolinfo.h"
+
+#include "upnpfileutils.h"
+#include "upnpcontentdirectorydb.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpelementfactory.h"
+#include "upnpelementbean.h"
+#include "upnpobjectbean.h"
+#include "upnpattributebean.h"
+#include "upnpfilterelement.h"
+#include "upnpresourcesbean.h"
+#include "upnpcdutils.h"
+#include "upnpcddbfactory.h"
+#include "upnpmetadatastorage.h"
+
+#define KLogFile _L("ContentDirectoryDb.log")
+#include "upnpcustomlog.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CleanupFilterElementPointerArray
+// Used by TCleanupItem to clean a RPointerArray<CUpnpFilterElement>
+// -----------------------------------------------------------------------------
+//
+void CleanupFilterElementPointerArray( TAny* aArray )
+    {
+    (reinterpret_cast<RPointerArray<CUpnpFilterElement>*> (aArray))->ResetAndDestroy( );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::CUpnpContentDirectoryDb
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectoryDb::CUpnpContentDirectoryDb(
+    CUpnpMetadataStorage* aMetadataStorage )
+    {
+    iMetadataStorage =aMetadataStorage;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::ConstructL()
+    {
+    iDOMImpl.OpenL( );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectoryDb* CUpnpContentDirectoryDb::NewLC(
+    CUpnpMetadataStorage* aMetadataStorage )
+    {
+    CUpnpContentDirectoryDb* self = new ( ELeave ) CUpnpContentDirectoryDb(aMetadataStorage);
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectoryDb* CUpnpContentDirectoryDb::NewL(
+    CUpnpMetadataStorage* aMetadataStorage )
+    {
+    CUpnpContentDirectoryDb* self = NewLC( aMetadataStorage );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::~~CUpnpContentDirectoryDb
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectoryDb::~CUpnpContentDirectoryDb()
+    {
+    iDOMImpl.Close( );
+    LOGCD( "CUpnpContentDirectoryDb::~CUpnpContentDirectoryDb", "", 0,
+        "DataBase closed" );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::InsertObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::InsertObjectL(
+    RXmlEngDocument& aFragment, TInt aContainerId, TInt* aId )
+    {
+    TUpnpErrorCode ret( EUpnpUndefined );
+    // get object element
+    TXmlEngElement element = UpnpCdUtils::GetObjectElementL( aFragment );
+
+    // start transaction
+    iMetadataStorage->BeginTransactionL( );
+
+    TRAPD( err, ret = DoInsertObjectL( element, aContainerId, aId ) );
+    if ( err )
+        { // rollback if error
+        iMetadataStorage->RollbackTransactionL( );
+        User::Leave( err );
+        }
+    iMetadataStorage->CommitTransactionL( );
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjectListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::GetObjectListL( TInt aParentId,
+    RArray<TInt>& aList )
+    {
+    return iMetadataStorage->GetObjectListL( aParentId, aList );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjectListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::GetObjectListL( const RArray<TInt>& aIds,
+    const TDesC8& aFilter, RArray<RXmlEngDocument>& aObjs )
+    {
+    for ( TInt i = 0; i < aIds.Count( ); i++ )
+        {
+        RXmlEngDocument obj;
+        CleanupClosePushL( obj );
+        GetObjectL( aIds[i], obj, aFilter );
+        aObjs.AppendL( obj );
+        CleanupStack::Pop( &obj );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::DeleteObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::DeleteObjectL( TInt aObjId,
+    RArray<TInt>& aRefList, TBool aDeleteResource )
+    {
+    return iMetadataStorage->DeleteObjectL( aObjId, aRefList, aDeleteResource );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::UpdateObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::UpdateObjectL( TInt aObjId,
+    RXmlEngDocument& aFragment )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+
+    // // get object element
+    TXmlEngElement element = UpnpCdUtils::GetObjectElementL( aFragment );
+
+    // start transaction
+    iMetadataStorage->BeginTransactionL( );
+
+    TRAPD( err, ret = DoUpdateObjectL( aObjId, element ) );
+    if ( err )
+        { // rollback - error
+        iMetadataStorage->RollbackTransactionL( );
+        User::Leave( err );
+        }
+    // commit if success
+    iMetadataStorage->CommitTransactionL( );
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::DoUpdateObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::DoUpdateObjectL( TInt aObjId,
+    TXmlEngElement aFragment )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+
+    // delete object
+    ret = iMetadataStorage->DoDeleteObjectL( aObjId, EFalse, EFalse );
+    TXmlEngElement el = aFragment;
+    ret = InsertUpdatedL( aObjId, el );
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::InsertUpdatedL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::InsertUpdatedL( TInt aObjId,
+    TXmlEngElement& aElement )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+    iMetadataStorage->InsertObjectIntoObjectTableL( aElement );
+    ret = EUpnpOk;
+    RXmlEngNodeList<TXmlEngElement> elements;
+    CleanupClosePushL( elements );
+    aElement.GetChildElements( elements );
+
+    while ( elements.HasNext( ) )
+        {
+        TXmlEngElement el = elements.Next( );
+        if ( el.Name().CompareF( KClassTagName ) && el.Name().CompareF( KTitleTagName ) )
+            {
+            ret = InsertElementL( el, aObjId );
+            }
+        else
+            {
+            UpnpCdUtils::IsElementRequiredL( el ); // just remove the marker attr
+            }
+        }
+    CleanupStack::PopAndDestroy( &elements );
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::InsertElementL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::InsertElementL(
+    const TXmlEngElement& aElement, TInt aObjId )
+    {
+    return InsertAttributesL( aElement, iMetadataStorage->InsertElementL(
+        aElement, aObjId ), aObjId );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::PrepareDidlDocumentL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RXmlEngDocument CUpnpContentDirectoryDb::PrepareDidlDocumentL()
+    {
+    RXmlEngDocument doc;
+    doc.OpenL( iDOMImpl );
+    TXmlEngElement el = doc.CreateDocumentElementL( KDidlLite( ) );
+    el.AddNamespaceDeclarationL( KXmlnsNsUri( ), KCmlnsNsPref( ) );
+    el.AddNamespaceDeclarationL( KDcNsUri( ), KDcNsPref( ) );
+    el.AddNamespaceDeclarationL( KUpnpNsUri( ), KUpnpNsPref( ) );
+    return doc;
+
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::CheckObjectRestrictionL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::CheckObjectRestrictionL( TInt aObjId )
+    {
+    return iMetadataStorage->CheckObjectRestrictionL( aObjId );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TUpnpErrorCode CUpnpContentDirectoryDb::GetObjectL( TInt aObjectID,
+    RXmlEngDocument& aDoc, const TDesC8& aFilterString )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+
+    if ( aFilterString == KAsterisk8 )
+        { // get the whole object
+        ret = DoGetObjectL( aObjectID, aDoc, ETrue );
+        }
+    else if ( !aFilterString.Length( ) )
+        { // get only required properties
+        ret = DoGetObjectL( aObjectID, aDoc, EFalse );
+        }
+    else
+        {
+        RXmlEngDocument doc; // before the whole obj is created do not change the given reference,
+        CleanupClosePushL( doc ); // it prevents from returning not completed object if something goes wrong 
+        // during construction of response object
+        // get required properties
+        ret = DoGetObjectL( aObjectID, doc, EFalse );
+        if ( ret == EUpnpOk ) // do not not continue if something went wrong
+            {
+            // prepare a list of filter elements
+            RPointerArray<CUpnpFilterElement> filterElements;
+            TCleanupItem cleanupItem( CleanupFilterElementPointerArray,
+                &filterElements );
+            CleanupStack::PushL( cleanupItem );
+            // parse filter string
+            ParseFilterStringL( aFilterString, filterElements );
+            // add requested elements
+            AddRequestedPropertiesL( aObjectID,
+                UpnpCdUtils::GetObjectElementL( doc ), filterElements ); // ignore if error
+            //clean up
+            CleanupStack::PopAndDestroy( &filterElements );
+            }
+        if ( ret == EUpnpOk )
+            { // object is completed
+            aDoc = doc;
+            CleanupStack::Pop( &doc );
+            }
+        else
+            { // something went wrong
+            CleanupStack::PopAndDestroy( &doc );
+            }
+
+        }
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TUpnpErrorCode CUpnpContentDirectoryDb::AddRequestedPropertiesL(
+    TInt aObjectID, TXmlEngElement aElement,
+    const RPointerArray<CUpnpFilterElement>& aFilterElements )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+    // aFilterElements must be sorted
+    for ( TInt i = 0; i < aFilterElements.Count( ); i++ )
+        {
+        const CUpnpFilterElement* filter = aFilterElements[i];
+        if ( filter->ElementName().Length( ) )
+            { // element part defined
+            AddElementL( aElement, aObjectID, filter );
+            }
+        else
+            { // element part not defined - it is attribute of main element tag
+            for ( TInt j = 0; j < filter->Count( ); j++ )
+                {
+                if ( (*filter)[j] == KChildCount )
+                    {
+                    SetChildCountL( aElement, aObjectID );
+                    ret = EUpnpOk;
+                    }
+                else
+                    {
+                    ret = iMetadataStorage->AddMainTagAttrL( aElement,
+                        aObjectID, (*filter)[j] );
+                    }
+                }
+            }
+        }
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::SetChildCountL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CUpnpContentDirectoryDb::SetChildCountL( TXmlEngElement aElement,
+    TInt aId )
+    {
+    if ( aElement.Name( ) == KContainer )
+        {
+        // value
+        TInt childCount = iMetadataStorage->GetChildCountL( aId );
+        TBuf8<KMaxIntegerLen> num;
+        num.Num( childCount );
+
+        // is it already exist?
+        TXmlEngAttr childAttr = aElement.AttributeNodeL( KChildCount( ) );
+        if ( childAttr.IsNull( ) )
+            { // not exist - add 
+            aElement.AddNewAttributeL( KChildCount( ), num );
+            }
+        else
+            { // already exists - update
+            childAttr.SetValueL( num );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::AddElementL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CUpnpContentDirectoryDb::AddElementL( TXmlEngElement aElement,
+    TInt aObjectID, const CUpnpFilterElement* aReqElement )
+    {
+    // get elements from database
+    RDbView view = iMetadataStorage->GetElementViewL( aObjectID,
+        aReqElement->ElementName( ) );
+    CleanupClosePushL( view );
+
+    // for each element found
+    while ( view.NextL( ) )
+        {
+        view.GetL( );
+        CUpnpElementBean* elBean = CUpnpElementBean::NewLC( view );
+
+        // add element
+        TXmlEngElement newElement = elBean->AttachElmL( aElement );
+
+        // add required attributes
+        AddAttributesL( elBean->ElmId( ), aObjectID, newElement, EFalse );
+
+        // for each requested attribute
+        for ( TInt i = 0; i < aReqElement->Count( ); i++ )
+            {
+            TPtrC8 attrNamePtr((*aReqElement)[i]);
+
+            TXmlEngAttr attr = newElement.AttributeNodeL( attrNamePtr );
+            // add if not present
+            // ignore if element has not any attribute
+            if ( attr.IsNull( ) && elBean->ElmHasAttribute( ) )
+                {
+                AddAttributeL( newElement, attrNamePtr, elBean->ElmId( ),
+                    aObjectID );
+                }
+            }
+        // clean up
+        CleanupStack::PopAndDestroy( elBean );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::ParseFilterStringL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::ParseFilterStringL( const TDesC8& aFilter,
+    RPointerArray<CUpnpFilterElement>& aList )
+    {
+    // separate filter's parts
+    CDesC8ArrayFlat* list = new(ELeave) CDesC8ArrayFlat(KDefaultGranularity);
+    CleanupStack::PushL( list );
+    TInt commaPos;
+    TPtrC8 filter(aFilter);
+    while ( (commaPos = filter.Find( KCommaStr8( ) ) ) != KErrNotFound )
+        {
+        HBufC8* buf = filter.Left(commaPos).AllocLC( );
+        buf->Des().TrimAll( );
+        list->AppendL( *buf );
+        filter.Set( filter.Mid( commaPos+1 ) );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    // add last
+    HBufC8* buf = filter.AllocLC( );
+    buf->Des().TrimAll( );
+    list->AppendL( *buf );
+    filter.Set( filter.Mid( commaPos+1 ) );
+    CleanupStack::PopAndDestroy( buf );
+
+    // sort to simplify
+    list->Sort( );
+
+    TPtrC8 curr( KMinusOne8 );
+    for ( TInt i = 0; i< list->Count( ); i++ ) // for each filter property
+        {
+        // split filter string - element@attribute
+        TInt atPos = (*list)[i].Find( KAtStr8 );
+        TPtrC8 attr;
+        if ( atPos == KErrNotFound ) // is it element name
+            { // it is element
+            attr.Set( KNullDesC8 );
+            atPos = (*list)[i].Length( );
+            }
+        else
+            {
+            attr.Set( (*list)[i].Mid( atPos+1 ) );
+            }
+        TPtrC8 element((*list)[i].Left( atPos ) );
+
+        // do not add "class" and "title" elements - required by default
+        if ( element.CompareF( KClassTagNameWithNs8 )
+                && element.CompareF( KTitleTagNameWithNs8 ) )
+            { // it is neither a class nor title element
+            if ( element == curr )
+                { // already exists, add next attribute
+                if ( attr.Length( ) ) // ignore empty attr
+                    aList[aList.Count()-1]->AppendAttributeL( attr );
+                }
+            else
+                { // create new filter element
+                CUpnpFilterElement* tmp = CUpnpFilterElement::NewLC( );
+                tmp->SetElementNameL( element );
+                if ( attr.Length( ) ) // ignore epmty attr
+                    tmp->AppendAttributeL( attr );
+                aList.AppendL( tmp );
+                CleanupStack::Pop( tmp );
+                curr.Set( element );
+                }
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( list );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::DoGetObjectL
+// Function returns DIDL-Lite XML fragment with metadata for requested object.
+// IMPORTANT: 1. Caller takes responsibility for returned document and is 
+//              obliged to close it.
+//           2. The root element of the document is <DIDL-Lite> element and
+//              the object's element is its direct, onluy child.
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::DoGetObjectL( TInt aObjectID,
+    RXmlEngDocument& aDoc, TBool aAll )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+    RDbView view = iMetadataStorage->GetObjViewL( aObjectID );
+    CleanupClosePushL( view );
+
+    // Get result
+    if ( view.FirstL( ) )
+        {
+        // get row
+        view.GetL( );
+
+        // prepare DIDL-Lite
+        RXmlEngDocument doc;
+        CleanupClosePushL( doc );
+        doc = PrepareDidlDocumentL( );
+
+        // object bean      
+        CUpnpObjectBean* objBean = CUpnpObjectBean::NewLC( view );
+        TXmlEngElement objElement;
+
+        if ( aAll )
+            { // all object's properties
+            objElement
+                    = objBean->AttachWholeObjectElL( doc.DocumentElement( ) );
+            // childCount
+            SetChildCountL( UpnpCdUtils::GetObjectElementL( doc ),
+                objBean->ObjId( ) );
+            }
+        else
+            { // only required
+            objElement = objBean->AttachObjectElL( doc.DocumentElement( ) );
+            }
+
+        // clean up
+        CleanupStack::PopAndDestroy( objBean );
+
+        // aObjectID might be a reference object, so trying to get real object id        
+        TInt realObjectId = ReferedObjectIdL( aObjectID );
+
+        // add elements to the tree
+        AddElementsL( realObjectId, objElement, aAll );
+
+        // assign to the given reference
+        aDoc = doc;
+        // everything went right
+        ret = EUpnpOk;
+        // do not remove doc
+        CleanupStack::Pop( &doc );
+        }
+    else
+        { // the is no such object
+        ret = ENoSuchObject;
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::AddElementsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::AddElementsL( TInt aObjectID,
+    TXmlEngElement aObjectElement, TBool aAll )
+    {
+    RDbView view = iMetadataStorage->GetElementsViewL( aObjectID, aAll );
+    CleanupClosePushL( view );
+    // Iterate through elements
+    while ( view.NextL( ) )
+        {
+        view.GetL( );
+        CUpnpElementBean* elBean = CUpnpElementBean::NewLC( view );
+
+        // add new element
+        TXmlEngElement newElement = elBean->AttachElmL( aObjectElement );
+
+        // add attributes
+        AddAttributesL( elBean->ElmId( ), aObjectID, newElement, aAll );
+
+        // clean up
+        CleanupStack::PopAndDestroy( elBean );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::AddAttributesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CUpnpContentDirectoryDb::AddAttributesL( TInt aElementId,
+    TInt aObjectID, TXmlEngElement& aElement, TBool aAll )
+    {
+    RDbView view = iMetadataStorage->GetAttributesViewByObjectIdL( aObjectID,
+        aAll );
+    CleanupClosePushL( view );
+
+    CDbColSet* colSet = view.ColSetL( );
+    const TInt elmIdColNo = colSet->ColNo( KAtrElmIdColName );
+    delete colSet;
+
+    // Iterate through attributes
+    while ( view.NextL( ) )
+        {
+        view.GetL( );
+
+        if ( view.ColInt( elmIdColNo ) == aElementId )
+            {
+            CUpnpAttributeBean* atr = CUpnpAttributeBean::NewLC( view );
+            atr->AttachAttrL( aElement );
+            CleanupStack::PopAndDestroy( atr );
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::DoInsertObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::DoInsertObjectL(
+    TXmlEngElement& aElement, TInt aContainerId, TInt* aId )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+
+    *aId = SetObjectIdL( aElement );
+    UpnpCdUtils::SetContainerIdL( aElement, aContainerId );
+    iMetadataStorage->InsertObjectIntoObjectTableL( aElement );
+    ret = EUpnpOk;
+    RXmlEngNodeList<TXmlEngElement> elements;
+    CleanupClosePushL( elements );
+    aElement.GetChildElements( elements );
+
+    while ( elements.HasNext( ) )
+        {
+        TXmlEngElement el = elements.Next( );
+        if ( el.Name().CompareF( KClassTagName ) && el.Name().CompareF( KTitleTagName ) )
+            {
+            ret = InsertElementL( el, *aId );
+            }
+        else
+            {
+            UpnpCdUtils::IsElementRequiredL( el ); // just remove the marker attr
+            }
+        }
+    // set object childCount
+    SetChildCountL( aElement, *aId );
+
+    CleanupStack::PopAndDestroy( &elements );
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::InsertAttributesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::InsertAttributesL(
+    const TXmlEngElement aElement, TInt aElmId, TInt aObjId )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+    RXmlEngNodeList<TXmlEngAttr> list;
+    CleanupClosePushL( list );
+    aElement.GetAttributes( list );
+    if ( list.Count( ) )
+        {
+        RArray<TXmlEngAttr> attributes; // to store real attr
+        CleanupClosePushL( attributes );
+        RArray<TXmlEngAttr> markers; // to store marker attr
+        CleanupClosePushL( markers );
+        // separate markers from attr
+        while ( list.HasNext( ) )
+            {
+            TXmlEngAttr attr = list.Next( );
+            if ( attr.Name().Match( KRequiredAtrSufPattern ) == KErrNotFound )
+                {
+                attributes.AppendL( attr );
+                }
+            else
+                {
+                markers.AppendL( attr );
+                }
+            }
+
+        // insert attributes
+        for ( TInt i = 0; i < attributes.Count( ); i++ )
+            {
+            iMetadataStorage->InsertAttributeL( attributes[i], aElmId,
+                IsAttrRequiredL( attributes[i], markers ), aObjId );
+            ret = EUpnpOk;
+            }
+        // remove markers from DOM tree
+        for ( TInt i = 0; i < markers.Count( ); i++ )
+            {
+            markers[i].Remove( );
+            }
+        // clean up
+        CleanupStack::PopAndDestroy( &markers );
+        CleanupStack::PopAndDestroy( &attributes );
+        }
+    else
+        {
+        ret = EUpnpOk;
+        }
+
+    CleanupStack::PopAndDestroy( &list );
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::IsAttrRequiredL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectoryDb::IsAttrRequiredL( const TXmlEngAttr& aAttr,
+    RArray<TXmlEngAttr>& aMarkers )
+    {
+    TBool ret = EFalse;
+
+    for ( TInt i = 0; i< aMarkers.Count( ); i++ )
+        {
+        if ( aMarkers[i].Name().Find( aAttr.Name( ) ) == 0 )
+            { // attr required
+            ret = ETrue;
+            break;
+            }
+        }
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::SetObjectIdL
+// Sets the id val in the objected to be created
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::SetObjectIdL( TXmlEngElement& aElement )
+    {
+    TInt ret = iMetadataStorage->GetNextKeyL( KObjectTableName8 );
+    UpnpCdUtils::SetObjectIdL( aElement, ret );
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjectIdL
+// Gets the id val in the objected to be created
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::GetObjectIdL()
+    {
+    TInt ret = iMetadataStorage->NextKeyL( KObjectTableName8 );
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjectIdL
+// Gets the id val in the objected to be created
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpContentDirectoryDb::GetObjectTitleL( TInt aId )
+    {
+    return iMetadataStorage->GetObjectTitleL( aId );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::ReferedObjectIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::ReferedObjectIdL( TInt aObjectId )
+    {
+    TInt ret = KErrNotFound;
+
+    TInt refId = iMetadataStorage->ReferedObjectIdL( aObjectId );
+
+    if ( refId != KErrNotFound )
+        {
+        ret = ReferedObjectIdL( refId );
+        }
+    else
+        {
+        ret = aObjectId;
+        }
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetElIdByAttrL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::GetObjIdByAttrL( const TDesC8& aAttrName,
+    const TDesC8& aAttrVal )
+    {
+    TInt objId = KErrNotFound;
+
+    TInt elmId = iMetadataStorage->GetElmIdForAttrL( aAttrName, aAttrVal );
+    if ( elmId != KErrNotFound )
+        {
+        objId = iMetadataStorage->GetObjIdForElmIdL( elmId );
+        }
+
+    return objId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjIdByAttrLikeL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::GetObjIdByAttrLikeL( const TDesC8& aAttrName,
+    const TDesC8& aAttrVal )
+    {
+    TInt objId = KErrNotFound;
+
+    TInt elmId = iMetadataStorage->GetElmIdForAttrLikeL( aAttrName, aAttrVal );
+    if ( elmId != KErrNotFound )
+        {
+        objId = iMetadataStorage->GetObjIdForElmIdL( elmId );
+        }
+
+    return objId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjectByAttrL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::GetObjectByAttrL(
+    RXmlEngDocument& aDoc, TInt* aObjId, const TDesC8& aAttrName,
+    const TDesC8& aAttrVal )
+    {
+    TUpnpErrorCode ret = EUndefined;
+
+    *aObjId = GetObjIdByAttrL( aAttrName, aAttrVal );
+    if ( *aObjId >= 0 )
+        {
+        ret = GetObjectL( *aObjId, aDoc, KAsterisk8 );
+        }
+    else
+        { // something went wrong
+        ret = ENoSuchObject;
+        }
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::CheckParentRestrictionL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpContentDirectoryDb::CheckParentRestrictionL( TInt aObjId )
+    {
+    return iMetadataStorage->CheckParentRestrictionL( aObjId );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::DeleteResourceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::DeleteResourceL( const TDesC8& aResVal,
+    RArray<TInt>& aContIds )
+    {
+    // start transaction
+    iMetadataStorage->BeginTransactionL( );
+
+    TRAPD( err, DoDeleteResourceL( aResVal, aContIds ) );
+    if ( err != KErrNone )
+        { // rollback - error
+        iMetadataStorage->RollbackTransactionL( );
+        User::Leave( err );
+        }
+    // commit if success
+    iMetadataStorage->CommitTransactionL( );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::DoDeleteResourceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::DoDeleteResourceL( const TDesC8& aResVal,
+    RArray<TInt>& aContIds )
+    {
+    HBufC* resVal = HBufC::NewLC( aResVal.Length( ) );
+    resVal->Des().Copy( aResVal );
+
+    HBufC* resValReplaced16 = UpnpCdUtils::EscapeAposL( *resVal );
+    CleanupStack::PushL( resValReplaced16 );
+    HBufC8* resValReplaced8 = UpnpCdUtils::DesToDes8LC( *resValReplaced16 );
+    RArray<TInt> objs;
+    CleanupClosePushL( objs );
+    GetObjectsByResourceL( objs, *resValReplaced16 );
+
+    // not any obj?
+    if ( !objs.Count( ) )
+        {
+        User::Leave( ENoSourceResource );
+        }
+
+    TUpnpErrorCode err = EUpnpOk;
+
+    // for each object
+    for ( TInt i = 0; i < objs.Count( ); i++ )
+        {
+        CUpnpObjectBean* objBn = GetObjBeanLC( objs[i] );
+        if ( !objBn->ObjRestricted( ) )
+            {
+            if ( CheckObjectRestrictionL( objBn->ObjParentId( ) ) == EUpnpOk )
+                {
+                iMetadataStorage->DeleteResElL( *resValReplaced16,
+                    objBn->ObjId( ) );
+                aContIds.AppendL( objBn->ObjParentId( ) );
+                }
+            else
+                {
+                err = ERestrictedParentObject;
+                }
+            }
+        else
+            {
+            err = ERestrictedObject;
+            }
+        CleanupStack::PopAndDestroy( objBn );
+        }
+
+    // was any deleted
+    if ( !aContIds.Count( ) )
+        {
+        User::Leave( err );
+        }
+
+    // if each deleted?
+    if ( aContIds.Count( ) == objs.Count( ) )
+        {
+        // try to fetch resource id
+        TRAPD( err, UpnpCdUtils::ResIdFromUriL( *resValReplaced8 ) );
+        // ignore if error - resource id could not be fetched
+        if ( !err )
+            { // OK
+            // delete resource
+            DeleteResourceByResIdL( UpnpCdUtils::ResIdFromUriL( *resValReplaced8 ) );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &objs );
+    CleanupStack::PopAndDestroy( resValReplaced8 );
+    CleanupStack::PopAndDestroy( resValReplaced16 );
+    CleanupStack::PopAndDestroy( resVal );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjBeanLC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpObjectBean* CUpnpContentDirectoryDb::GetObjBeanLC( TInt aObjId )
+    {
+    CUpnpObjectBean* objBn = 0;
+
+    RDbView view = iMetadataStorage->GetObjViewL( aObjId );
+    CleanupClosePushL( view );
+
+    if ( view.FirstL( ) )
+        {
+        // get values
+        view.GetL( );
+        objBn = CUpnpObjectBean::NewL( view );
+        }
+
+    // clean up 
+    CleanupStack::PopAndDestroy( &view );
+
+    CleanupStack::PushL( objBn );
+    return objBn;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjectIdsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::GetObjectsByResourceL( RArray<TInt>& aIds,
+    const TDesC& aResVal )
+    {
+
+    RDbView view = iMetadataStorage->GetViewOfObjectListForResL( aResVal );
+    CleanupClosePushL( view );
+
+    CDbColSet* colSet = view.ColSetL( );
+    const TInt colNo = colSet->ColNo( KElmObjIdColName );
+    delete colSet;
+
+    // for each row
+    while ( view.NextL( ) )
+        {
+        view.GetL( );
+        TInt no = view.ColInt( colNo );
+        aIds.AppendL( no );
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetProtocolInfoL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::GetProtocolInfoL( const TDesC8& aContentUri,
+    CUpnpDlnaProtocolInfo*& aProtocolInfo )
+    {
+    HBufC* uri = HBufC::NewLC( aContentUri.Length( ) );
+    TPtr uriPtr(uri->Des( ));
+    uriPtr.Copy( aContentUri );
+    TInt ret = GetElmIdByNameAndValL( KRes16, uriPtr );
+    if ( ret >= 0 )
+        {
+        HBufC8* attrVal;
+        GetAttrValueByNameL( ret, KprotocolInfo, attrVal );
+        CleanupStack::PushL( attrVal );
+        aProtocolInfo = CUpnpDlnaProtocolInfo::NewL( *attrVal );
+        CleanupStack::PopAndDestroy( attrVal );
+        }
+    CleanupStack::PopAndDestroy( uri );
+
+    if ( ret >= 0 ) //item ID number is't meaningfull for function caller
+        {
+        ret = KErrNone;
+        }
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetElmIdByNameAndValL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::GetElmIdByNameAndValL( const TDesC& aElmName,
+    const TDesC& aElmValue )
+    {
+    TInt ret = KErrNotFound;
+
+    RDbView view = iMetadataStorage->GetViewOfElmIdByNameAndValL( aElmName,
+        aElmValue );
+    CleanupClosePushL( view );
+
+    // col id
+    CDbColSet* colSet = view.ColSetL( );
+    const TInt colNo = colSet->ColNo( KElmIdColName );
+    delete colSet;
+
+    while ( view.NextL( ) )
+        {
+        view.GetL( );
+        ret = view.ColInt( colNo );
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetAttrValueByNameL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+HBufC8* CUpnpContentDirectoryDb::GetProtocolInfoByImportUriL(
+    const TDesC8& aImportUri )
+    {
+    CUpnpAttributeBean* attBean =
+            GetAttrByValueL( KImportUri8( ), aImportUri );
+    CleanupStack::PushL( attBean );
+
+    HBufC8* attValBuf = NULL;
+    if ( attBean )
+        {
+        //KprotocolInfo
+        CUpnpAttributeBean* att = GetAttrByNameL( attBean->AtrElmId( ),
+            KprotocolInfo( ), attValBuf );
+        delete att;
+        }
+    CleanupStack::PopAndDestroy( attBean );
+    return attValBuf;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetAttrValueByNameL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::GetAttrValueByNameL( TInt aElmId,
+    const TDesC8& aAttrName, HBufC8*& aAttrVal )
+    {
+    CUpnpAttributeBean* atrBean =
+            GetAttrByNameL( aElmId, aAttrName, aAttrVal );
+    delete atrBean;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetAttrByValueL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpAttributeBean* CUpnpContentDirectoryDb::GetAttrByValueL(
+    const TDesC8& aAttrName, const TDesC8& aAttrVal )
+    {
+    RDbView view = iMetadataStorage->GetAttrViewL( aAttrName, aAttrVal );
+    CleanupClosePushL( view );
+
+    TInt number = view.CountL( );
+
+    CDbColSet* colSet = view.ColSetL( );
+    const TInt colNo = colSet->ColNo( KAtrValueColName );
+    delete colSet;
+
+    CUpnpAttributeBean* atrBean = NULL;
+    if ( view.FirstL( ) )
+        {
+        view.GetL( );
+        atrBean = CUpnpAttributeBean::NewLC( view );
+        CleanupStack::Pop( atrBean );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    return atrBean;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetAttrByNameL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpAttributeBean* CUpnpContentDirectoryDb::GetAttrByNameL( TInt aElmId,
+    const TDesC8& aAttrName, HBufC8*& aAttrVal )
+    {
+    RDbView view = iMetadataStorage->GetAttrViewL( aElmId, aAttrName );
+    CleanupClosePushL( view );
+
+    CDbColSet* colSet = view.ColSetL( );
+    const TInt colNo = colSet->ColNo( KAtrValueColName );
+    delete colSet;
+
+    CUpnpAttributeBean* atrBean = NULL;
+    if ( view.FirstL( ) )
+        {
+        view.GetL( );
+        atrBean = CUpnpAttributeBean::NewLC( view );
+        aAttrVal = atrBean->AtrValue().AllocL( );
+        CleanupStack::Pop( atrBean );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    return atrBean;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetObjectIdByElementValueLikeL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::GetObjectIdByElementValueLikeL(
+    const TDesC8& aElmName, const TDesC8& aElmValue )
+    {
+    // convert to unicode
+    HBufC* elmName = UpnpCdUtils::Des8ToDesLC( aElmName );
+    HBufC* elmValue = UpnpCdUtils::Des8ToDesLC( aElmValue );
+
+    // prepare query buf
+    HBufC* query = HBufC::NewLC( KSelectFromSqlCmd().Length( ) + KElmObjIdColName().Length( ) + KElementTableName().Length( ) + KElmNameColName().Length( ) + elmName->Length( ) + KAndLikeConditionSqlCmd().Length( ) + KElmValueColName().Length( ) + elmValue->Length( ) );
+
+    TPtr queryPtr(query->Des( ));
+
+    // format query
+    queryPtr.Format( KSelectFromSqlCmd, &KElmObjIdColName,
+        &KElementTableName, &KElmNameColName, elmName );
+    queryPtr.AppendFormat( KAndLikeConditionSqlCmd, &KElmValueColName,
+        elmValue );
+
+    // prepare
+    RDbView view = iMetadataStorage->GetEvaluatedViewL( queryPtr );
+    CleanupClosePushL( view );
+
+    // col no
+    CDbColSet* colSet = view.ColSetL( );
+    const TInt colNo = colSet->ColNo( KElmObjIdColName );
+    delete colSet;
+
+    TInt ret = KErrNotFound;
+
+    // for one row
+    if ( view.NextL( ) )
+        {
+        view.GetL( );
+        if ( !view.IsColNull( colNo ) )
+            {
+            ret = view.ColInt( colNo );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( query );
+
+    CleanupStack::PopAndDestroy( elmValue );
+    CleanupStack::PopAndDestroy( elmName );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetParentIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::GetParentIdL( TInt aObjectId )
+    {
+    return iMetadataStorage->GetParentIdL( aObjectId );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::AddAttributeL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+void CUpnpContentDirectoryDb::AddAttributeL( TXmlEngElement aElement,
+    const TDesC8& aAttrName, TInt aElementId, TInt aObjectId )
+    {
+    RDbView view = iMetadataStorage->GetAttrViewByObjectIdL( aObjectId,
+        aAttrName );
+    CleanupClosePushL( view );
+
+    CDbColSet* colSet = view.ColSetL( );
+    const TInt elmIdColNo = colSet->ColNo( KAtrElmIdColName );
+    delete colSet;
+
+    // Iterate through attributes - usually there is only one
+    while ( view.NextL( ) )
+        {
+        view.GetL( );
+
+        if ( view.ColInt( elmIdColNo ) == aElementId )
+            {
+            CUpnpAttributeBean* atr = CUpnpAttributeBean::NewLC( view );
+            atr->AttachAttrL( aElement );
+            CleanupStack::PopAndDestroy( atr );
+            }
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    }
+// -----------------------------------------------------------------------------
+// CContentDirectoryDb::CanBeNestedL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectoryDb::CanBeNestedL( TInt aObjId )
+    {
+    // get path
+    HBufC8* path = iMetadataStorage->GetObjectPathL( aObjId );
+    CleanupStack::PushL( path );
+
+    // count levels
+    TPtrC8 rest(path->Des( ));
+    TInt levelNo(1); // root level
+    TInt pos( KErrNotFound );
+    while ( (pos = rest.Find( KPathSeparator8 )) != KErrNotFound )
+        {
+        rest.Set( rest.Mid( pos + KPathSeparator8().Length( ) ) );
+        levelNo++;
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( path );
+    return (levelNo < KAvailableNestedLevels);
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::AddResourceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::AddResourceL( CUpnpResourcesBean* aResBean,
+    TInt aObjId )
+    {
+    iMetadataStorage->AddResourceL( aResBean, aObjId );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::DeleteResourceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::DeleteResourceByResIdL( TInt64 aResId,
+    TBool aDeleteFile )
+    {
+    iMetadataStorage->DeleteResourceByResIdL( aResId, aDeleteFile );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::DeleteResourceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::DeleteResourceByObjIdL( TInt aObjId,
+    TBool aDeleteFile )
+    {
+    iMetadataStorage->DeleteResourceByObjIdL( aObjId, aDeleteFile );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetResourceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpResourcesBean* CUpnpContentDirectoryDb::GetResourceL( TInt64 aResId )
+    {
+    return iMetadataStorage->GetResourceL( aResId );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::ResNewDownloadDirectoryL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::NewMediaDirectoryL( const TDesC& aOldDir )
+    {
+    //UPDATE resources SET rsc_readonly=1 WHERE KRscPathColName LIKE $aOldDir* AND KRscReadonlyColName=0
+    // prepare command
+    HBufC* query = HBufC::NewLC( KNewMediaDirSqlCmd().Length( ) + aOldDir.Length( ) );
+    TPtr SqlCmd(query->Des( ));
+    SqlCmd.Format( KNewMediaDirSqlCmd, &aOldDir );
+
+    // execute
+    iMetadataStorage->ExecuteL( SqlCmd );
+
+    CleanupStack::PopAndDestroy( query );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetKeyForUriL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::GetKeyForUriL()
+    {
+    return iMetadataStorage->GetNextKeyL( KImportUriId8 );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::CheckDatabaseL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryDb::CheckDatabaseL()
+    {
+    iMetadataStorage->CheckDatabaseL( );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::RecreateDatabaseFile
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::RecreateDatabaseFile()
+    {
+    TRAPD( err, iMetadataStorage->RecreateDatabaseFileL( ) );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::HandleDbError
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpContentDirectoryDb::HandleDbError( TInt aError )
+    {
+    return iMetadataStorage->HandleDbError( aError );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::IsDbCreated
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpContentDirectoryDb::IsDbCreated()
+    {
+    return iMetadataStorage->IsDbCreated( );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpcontentdirectoryservice.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,489 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Directory factory class
+ *
+*/
+
+
+// INCLUDE FILES
+#include "upnpcontentdirectoryservice.h"
+#include "upnpcontentdirectory.h"   
+#include "upnpcddbfactory.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnplocalstorage.h"
+#include "upnpmetadatastorage.h"
+#include "upnpitem.h"
+#include "upnpelement.h"
+#include "upnpattribute.h"
+#include "upnpcontentdirectoryeventobserver.h"
+#include "upnpsender.h"
+#include "upnpfiletransfer.h"
+#include "upnptransferhandler.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CContentDirectoryService::CContentDirectoryService
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectoryService::CUpnpContentDirectoryService()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryService::ConstructL( TUpnpCdSettings aSettings )
+    {
+    // create offline part
+    ConstructL( );
+
+    if ( !aSettings.iTransfer ) //create default transfer handler
+        {
+        iTransferHandler = CUpnpTransferHandler::NewL( );
+
+        // create content directory 
+        iCd = CUpnpContentDirectory::NewL( aSettings, iMetadataStorage,
+            iTransferHandler );
+        iTransferHandler->SetObserver( iCd );
+        }
+    else //use external transfer handler  
+        {
+        iCd = CUpnpContentDirectory::NewL( aSettings, iMetadataStorage,
+            aSettings.iTransfer );
+        }
+
+    iLocalStorage->SetStateHandler( iCd->StateHandler( ) );
+    // sender    
+    iSender = CUpnpCdsSender::NewL( iCd );
+    iCd->SetSender( iSender );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryService::ConstructL()
+    {
+    CUpnpCdDbFactory* cdf = CUpnpCdDbFactory::NewLC( );
+
+    // database file name
+    RFs fs;
+    CleanupClosePushL( fs );
+    User::LeaveIfError( fs.Connect( ) );
+
+    TFileName path;
+    User::LeaveIfError( fs.PrivatePath( path ) );
+    TParse fp;
+    fp.Set( KDatabaseFileName( ), &path, 0 );
+    path = fp.FullName( );
+
+    // create metastorage
+    iMetadataStorage = cdf->CreateMetadataStorageL( path );
+
+    // create localstorage
+    iLocalStorage = CUpnpLocalStorage::NewL( iMetadataStorage );
+
+    CleanupStack::PopAndDestroy( &fs );
+    CleanupStack::PopAndDestroy( cdf );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpContentDirectoryService*
+CUpnpContentDirectoryService::NewL( TUpnpCdSettings aSettings )
+    {
+    CUpnpContentDirectoryService* self =
+    CUpnpContentDirectoryService::NewLC( aSettings );
+
+    CleanupStack::Pop(self);
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpContentDirectoryService*
+CUpnpContentDirectoryService::NewLC( TUpnpCdSettings aSettings )
+    {
+    CUpnpContentDirectoryService* self = new( ELeave ) CUpnpContentDirectoryService();
+
+    CleanupStack::PushL( self );
+    self->ConstructL(aSettings);
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpContentDirectoryService* CUpnpContentDirectoryService::NewL()
+    {
+    CUpnpContentDirectoryService* self = CUpnpContentDirectoryService::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpContentDirectoryService* CUpnpContentDirectoryService::NewLC()
+    {
+    CUpnpContentDirectoryService* self =
+    new( ELeave ) CUpnpContentDirectoryService();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::~CUpnpContentDirectoryService
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpContentDirectoryService::~CUpnpContentDirectoryService()
+    {
+    delete iTransferHandler;
+    delete iLocalStorage;
+    delete iCd;
+    delete iMetadataStorage;
+    delete iSender;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::SetDownloadDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::SetDownloadDirectoryL(
+    const TDesC& aDownloadDir )
+    {
+    if ( IsOnlineMode() )
+        {
+        iCd->SetDownloadDirectoryL( aDownloadDir );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::SetThumbnailDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::SetThumbnailDirectoryL(
+    const TDesC& aDownloadDir )
+    {
+    if ( IsOnlineMode() )
+        {
+        iCd->SetThumbnailDirectoryL( aDownloadDir );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::SetThumbnailDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::ShareObjectL( CUpnpObject* aItem )
+    {
+    CheckDbL( );
+    TRAPD( error, iLocalStorage->ShareObjectL( aItem ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, iLocalStorage->ShareObjectL( aItem ) );
+        RecreateDbL( error );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::ShareReferenceL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::ShareReferenceL( CUpnpItem* aItem )
+    {
+    CheckDbL( );
+    TRAPD( error, iLocalStorage->ShareReferenceL( aItem ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, iLocalStorage->ShareReferenceL( aItem ) );
+        RecreateDbL( error );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::ShareReferenceListL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::ShareReferenceListL(
+    CUpnpItemList* aItemList, TInt* aExecutionStatus )
+    {
+    CheckDbL( );
+    TRAPD( error, iLocalStorage->ShareReferenceListL( aItemList,
+        aExecutionStatus ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, iLocalStorage->ShareReferenceListL( aItemList,
+            aExecutionStatus ) );
+        RecreateDbL( error );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::UnshareItemL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::UnshareItemL( TInt aItemId )
+    {
+    CheckDbL( );
+    TRAPD( error, iLocalStorage->UnshareItemL( aItemId ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, iLocalStorage->UnshareItemL( aItemId ) );
+        RecreateDbL( error );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::UnshareContainerL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::UnshareContainerL(
+    TInt aContainerId )
+    {
+    CheckDbL( );
+    TRAPD( error, iLocalStorage->UnshareContainerL( aContainerId ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, iLocalStorage->UnshareContainerL( aContainerId ) );
+        RecreateDbL( error );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::SetThumbnailDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpItem* CUpnpContentDirectoryService::GetSharedItemL( TInt aItemId )
+    {
+    CheckDbL();
+    CUpnpItem* item = NULL;
+    TRAPD( error, item = iLocalStorage->GetSharedItemL( aItemId ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, item = iLocalStorage->GetSharedItemL( aItemId ) );
+        RecreateDbL( error );
+        }
+    return item;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::SetThumbnailDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::ShareItemListL(
+    CUpnpItemList* aItemList, TInt* aExecutionStatus )
+    {
+    CheckDbL( );
+    TRAPD( error, iLocalStorage->ShareItemListL( aItemList, aExecutionStatus ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, iLocalStorage->ShareItemListL( aItemList,
+            aExecutionStatus ) );
+        RecreateDbL( error );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::SetThumbnailDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::UnshareItemListL(
+    RArray<TInt>& aItemList, TInt* aExecutionStatus )
+    {
+    CheckDbL( );
+    TRAPD( error, iLocalStorage->UnshareItemListL( aItemList,
+        aExecutionStatus ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, iLocalStorage->UnshareItemListL( aItemList,
+            aExecutionStatus ) );
+        RecreateDbL( error );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::SetThumbnailDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::GetItemListL( TInt aContainerId,
+    CUpnpBrowseCriteria* aBrowseCriteria, TInt* aTotalMatches,
+    CUpnpItemList* aItemList )
+    {
+    CheckDbL( );
+    TRAPD( error, iLocalStorage->GetItemListL( aContainerId, aBrowseCriteria,
+        aTotalMatches, aItemList ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, iLocalStorage->GetItemListL( aContainerId,
+            aBrowseCriteria, aTotalMatches, aItemList ) );
+        RecreateDbL( error );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::GetContainerListL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::GetContainerListL(
+    TInt aContainerId, CUpnpBrowseCriteria* aBrowseCriteria,
+    TInt* aTotalMatches, CUpnpContainerList* aContainerList )
+    {
+    CheckDbL( );
+    TRAPD( error, iLocalStorage->GetContainerListL( aContainerId,
+        aBrowseCriteria, aTotalMatches, aContainerList ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, iLocalStorage->GetContainerListL( aContainerId,
+            aBrowseCriteria, aTotalMatches, aContainerList ) );
+        RecreateDbL( error );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::SetThumbnailDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpContainer* CUpnpContentDirectoryService::GetSingleContainerL(
+        TInt aContainerId)
+    {
+    CheckDbL();
+    CUpnpContainer* container = NULL;
+    TRAPD( error, container = iLocalStorage->GetSingleContainerL( aContainerId ) );
+    HandleDbErrorL( error );
+    if ( error )
+        {
+        TRAP( error, container = iLocalStorage->GetSingleContainerL( aContainerId ) );
+        RecreateDbL( error );
+        }
+    return container;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::GetAddress
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInetAddr CUpnpContentDirectoryService::GetAddress()
+    {
+    if ( IsOnlineMode() )
+        {
+        return iCd->GetAddress();
+        }
+    else
+        {
+        // no address available in offline mode
+        return TInetAddr( INET_ADDR(0,0,0,0) );
+        }
+    }    
+    
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::GetContentDirectory
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpContentDirectory* CUpnpContentDirectoryService::GetContentDirectory()
+    {
+    return iCd;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::HandleDbErrorL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryService::HandleDbErrorL( TInt aError )
+    {
+    TInt error = iMetadataStorage->HandleDbError( aError );
+    if ( error != KErrNone )
+        {
+        User::Leave( error );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::RecreateDbL
+// -----------------------------------------------------------------------------
+//
+void CUpnpContentDirectoryService::RecreateDbL( TInt aError )
+    {
+    if ( aError == KErrCorrupt )
+        {
+        iMetadataStorage->RecreateDatabaseFileL( );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::CheckDbL
+// -----------------------------------------------------------------------------
+//            
+void CUpnpContentDirectoryService::CheckDbL()
+    {
+    if ( !iMetadataStorage->IsDbCreated( ) )
+        {
+        HandleDbErrorL( KErrCorrupt );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::IsOnlineMode
+// -----------------------------------------------------------------------------
+//            
+TBool CUpnpContentDirectoryService::IsOnlineMode()
+    {
+    return reinterpret_cast<TBool>( iCd );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryService::AddressChangeL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpContentDirectoryService::AddressChangeL()
+    {
+    if ( IsOnlineMode() )
+        {
+        iCd->AddressChangeL();
+        }
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpelementbean.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,249 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <xmlengdom.h>
+#include "upnpelementbean.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpcdutils.h"
+#include <upnpelement.h>
+#include <upnpobject.h>
+#include <uriutils.h>
+#include "upnpstring.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::CUpnpElementBean
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpElementBean::CUpnpElementBean()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementBean::ConstructL()
+{
+	iElmValue = KNullString8().AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpElementBean* CUpnpElementBean::NewLC()
+{
+    CUpnpElementBean* self = new( ELeave ) CUpnpElementBean;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpElementBean* CUpnpElementBean::NewLC(const RDbRowSet& aRowSet)
+{
+    CUpnpElementBean* self = NewLC();
+    self->SetL(aRowSet);
+    return self;
+}    
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::~CUpnpElementBean
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpElementBean::~CUpnpElementBean()
+{
+    delete iElmName;
+    delete iElmValue;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::SetL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementBean::SetL(const RDbRowSet& aRowSet)
+{
+    // get cols' ids
+    CDbColSet* colSet = aRowSet.ColSetL();
+    CleanupStack::PushL(colSet);
+    const TInt  idColNo         = colSet->ColNo(KElmIdColName);
+    const TInt  nameColNo       = colSet->ColNo(KElmNameColName);
+    const TInt  hasAttrColNo    = colSet->ColNo(KElmHasAttrColName);
+    const TInt  objIdColNo      = colSet->ColNo(KElmObjIdColName);
+    const TInt  isRequiredColNo = colSet->ColNo(KElmIsRequiredColName);
+    const TInt  valueColNo      = colSet->ColNo(KElmValueColName);
+    CleanupStack::PopAndDestroy(colSet);
+    
+    // for each column call setter
+    if( idColNo != KDbNullColNo )
+    {
+        SetElmId( aRowSet.ColInt(idColNo) );
+    }
+    if( nameColNo != KDbNullColNo )
+    {
+        SetElmNameL( aRowSet.ColDes8(nameColNo) );
+    }
+    if( hasAttrColNo != KDbNullColNo )
+    {
+        SetElmHasAttribute( aRowSet.ColUint8(hasAttrColNo) );
+    }
+    if( objIdColNo != KDbNullColNo )
+    {
+        SetElmObjId( aRowSet.ColInt(objIdColNo) );
+    }
+    if( isRequiredColNo != KDbNullColNo )
+    {
+        SetElmIsRequired( aRowSet.ColUint8(isRequiredColNo) );
+    }
+    if( valueColNo != KDbNullColNo )
+    {
+        SetElmValueL(aRowSet, valueColNo);
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::SetElmNameL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementBean::SetElmNameL(const TDesC8& aElmName)
+{
+    delete iElmName;
+    iElmName = NULL;
+    iElmName = aElmName.AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::SetElmValueL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementBean::SetElmValueL(const RDbRowSet& aRowSet, const TInt aColNo)
+{
+    delete iElmValue;
+    iElmValue = NULL;
+    iElmValue = ReadLongTextColL(aRowSet, aColNo);
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::SetElmValueL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementBean::SetElmValueL(const TDesC8& aVal)
+{
+	delete iElmValue;
+	iElmValue = NULL;
+	iElmValue = aVal.AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::ElmName
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TDesC8& CUpnpElementBean::ElmName() const
+{
+    return *iElmName;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::AttachToXmlElmL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TXmlEngElement CUpnpElementBean::AttachElmL(TXmlEngElement aElement) const
+{
+    // new element
+    TXmlEngElement element;
+    
+    // Check if it's local name or if it has a namespace prefix also
+    TInt pos = iElmName->Find( KColon8 );
+    if( pos == KErrNotFound )
+    { //local name
+        element = aElement.AddNewElementL( *iElmName );
+    }
+    else    
+    { //local name with prefix
+        element = aElement.AddNewElementUsePrefixL( 
+                    iElmName->Right( iElmName->Length() - pos - 1 ), // name
+                    iElmName->Left( pos ) ); // prefix
+    }
+
+    // value     
+    element.SetValueL( *iElmValue );
+
+    return element;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::ValAsUriL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpElementBean::ValAsUriL() const 
+{    
+    // uris have to be properly escaped
+    HBufC* tmp = UpnpCdUtils::Des8ToDesLC(*iElmValue);        
+    TUriParser uripar;
+    uripar.Parse(*tmp);
+    CUri8* uri = uri = UriUtils::ConvertToInternetFormL(uripar);
+    CleanupStack::PopAndDestroy(tmp);        
+    if (uri->Uri().UriDes().Length())
+    {                
+        HBufC8* tmp2 = UpnpString::StringReplaceL(uri->Uri().UriDes(),KHash8,KHashASCII8);        
+        delete uri;
+        return tmp2;                         
+    }
+    HBufC8* uriDes = uri->Uri().UriDes().Alloc();
+    delete uri;
+    return uriDes;
+        
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::AttachElmL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpElement* CUpnpElementBean::AttachElmL(CUpnpObject* aObj)
+{
+    // create element
+    CUpnpElement* elm = CUpnpElement::NewLC(*iElmName);
+	
+	// copy values
+    elm->SetValueL(*iElmValue);
+
+	// is required
+	elm->SetIsRequired( ElmIsRequired() );
+	// attach
+	aObj->AddElementL(elm);
+	
+	// clean up
+	CleanupStack::Pop(elm);
+	
+	return elm;
+}
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpelementfactory.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1473 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element Factory.
+*
+*/
+ 
+
+// INCLUDE FILES
+#include <sysutil.h>
+#include <uri8.h>
+#include <xmlengdomparser.h>
+
+#include "upnpelementfactory.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpstring.h"
+#include "upnpprotocolinfo.h"
+#include "upnpcommonupnplits.h"
+#include "upnpcdutils.h"
+#include "upnpprotocolinfolocal.h"
+
+using namespace UpnpDlnaProtocolInfo;
+
+// ============================= LOCAL FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// DestroyRPointerArray
+// Used by TCleanupItem to destroy array
+// -----------------------------------------------------------------------------
+//
+void DestroyRArray(TAny* aArray)
+{
+    RArray<RXmlEngDocument>* array = (RArray<RXmlEngDocument>*) aArray;
+    for(TInt i = 0; i < array->Count(); i++ )
+            (*array)[i].Close();
+    (*array).Close();
+}
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::~CUpnpElementFactory()
+// C++ default destructor. (virtual destructor)
+// -----------------------------------------------------------------------------
+//
+CUpnpElementFactory::~CUpnpElementFactory()
+{
+    //Close XML document
+    iDocument.Close();
+    
+    iDOMImpl.Close(); 
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::NewL()
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+//
+CUpnpElementFactory* CUpnpElementFactory::NewL( const TDesC& aObjectsXmlPath )
+{
+    CUpnpElementFactory* self = CUpnpElementFactory::NewLC( aObjectsXmlPath );
+    CleanupStack::Pop( self );
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::NewLC()
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+//
+CUpnpElementFactory* CUpnpElementFactory::NewLC( const TDesC& aObjectsXmlPath )
+{
+    CUpnpElementFactory* self = new (ELeave) CUpnpElementFactory();
+    CleanupStack::PushL( self );
+    self->ConstructL( aObjectsXmlPath );
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ConstructL()
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementFactory::ConstructL(const TDesC& aObjectsXmlPath)
+{
+
+    iDOMImpl.OpenL();
+
+    RXmlEngDOMParser parser;
+    User::LeaveIfError( parser.Open(iDOMImpl) );
+    CleanupClosePushL(parser);
+    
+    if ( aObjectsXmlPath == KNullDesC() )
+        {
+        RFs fs;
+        User::LeaveIfError(fs.Connect());
+        CleanupClosePushL(fs);
+
+        TFileName path;
+        User::LeaveIfError(fs.PrivatePath(path));
+
+        TParse fp;
+        fp.Set(KObjectsXmlFileName(),&path, 0);
+        path = fp.FullName();
+
+        iDocument = parser.ParseFileL( path );        
+        CleanupStack::PopAndDestroy(&fs);
+        }
+    else
+        {
+        iDocument = parser.ParseFileL( aObjectsXmlPath );                
+        }
+        
+    
+
+    CleanupStack::PopAndDestroy(&parser);
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::CUpnpElementFactory()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CUpnpElementFactory::CUpnpElementFactory()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateNewObjectL()
+// Function to validate a new object given by Control Point, especially 
+// upnp:class element field eg. object.item.musictrack
+// IMPORTANT: If objects's description is invalid due to missing elements
+// it tries to repair it by adding those missing elements.
+// -----------------------------------------------------------------------------
+//
+
+TUpnpErrorCode CUpnpElementFactory::ValidateNewObjectL( const TXmlEngElement& aNewElement, TBool aNew, TBool aLocalSharing)
+{
+    TInt i;    
+    TPtrC8 objectType = KItem();
+
+    RXmlEngNodeList<TXmlEngElement> elements;
+    CleanupClosePushL(elements);
+    aNewElement.GetChildElements( elements );
+    
+    // invalid element if the count of the objects is less than 1 (=0)
+    if ( elements.Count() != 1 )
+    {
+        User::Leave( EInvalidArgs );
+    }
+    CleanupStack::PopAndDestroy(&elements);
+    // try to find the new item from the xml
+    TXmlEngElement object;
+    UpnpDomInterface::GetElementL( aNewElement, object, KItem() );
+    if ( object.IsNull() ) 
+    {   
+        
+        // if it's not an item, it's a container
+        UpnpDomInterface::GetElementL( aNewElement, object, KContainer() );
+        if ( object.IsNull() )
+        {
+            // not even a container, leave!
+            User::Leave ( EInvalidArgs );
+        }
+        objectType.Set( KContainer() );
+    }
+                           
+    // restriced value
+    TPtrC8 restrVal = UpnpDomInterface::GetAttrValueL( object,  KRestricted );
+    if ( 
+    (UpnpCD::Kfalse().Compare( restrVal ) != 0) &&
+    (UpnpCD::KZero().Compare( restrVal ) != 0) &&
+    (UpnpCD::Ktrue().Compare( restrVal ) != 0) &&
+    (UpnpCD::KOne().Compare( restrVal ) != 0)
+    )
+    {
+        User::Leave( EBadMetadata );
+    }
+    
+    // for convenience later, take now a reference to the children of the object
+    RXmlEngNodeList<TXmlEngElement> children;
+    CleanupClosePushL(children);
+    object.GetChildElements( children );
+            
+    // an exception: we can't have <res importUri=".. element in 
+    // a new object (set by control point)
+    while ( children.HasNext() )
+    {
+        TXmlEngElement child = children.Next();
+        
+        if ( IsNotEmptyImportUriL( child ) && aNew ) 
+        {
+            User::Leave ( EBadMetadata );
+        }
+        
+        //---- check res@duration, 7.3.22 MM DIDL-Lite res@duration Format        
+        CheckDurationOfResElementL(child);
+        CheckSizeOfResElementL(child);
+                    
+        RXmlEngNodeList<TXmlEngElement> forbiddenChildren;
+        CleanupClosePushL(forbiddenChildren);
+        child.GetChildElements( forbiddenChildren );
+
+        if ( forbiddenChildren.HasNext() 
+            && child.Name() != KVendorDescriptor ) // ignore <desc></desc>
+        {
+            User::Leave ( EBadMetadata );
+        }
+        CleanupStack::PopAndDestroy(&forbiddenChildren);
+        if ( child.Name() == KDate8() )
+        {
+            if (!UpnpCdUtils::ValidateDateL(child.Value())) 
+             child.Remove();
+        }
+        
+    }
+
+    // if survived here, we have the new element of type item or container
+    // let's analyze its type
+
+    // let's inspect each of types
+    // at first, collect object type descriptions from objects xml    
+    // to a pointer array
+    RArray<TXmlEngElement> objectDescrs;
+    CleanupClosePushL( objectDescrs );
+    // store class descriptor elements in this array
+    ClassesL( object, objectDescrs, objectType );
+    
+    // validate each separately
+    
+    ValidatePropertiesL(object, objectDescrs);
+    if(aNew)
+    {
+        ValidateBigImageL(object);
+    }
+    
+    // for each type, check that 
+    // this new object has all the required fields
+        
+    for (i=0; i<objectDescrs.Count(); i++)
+    {
+        // now we have to go through all the fields of the new item
+        // first, for convenience take a pointer to <ps>(properties) element
+        
+        RXmlEngNodeList<TXmlEngElement> propElems;
+        CleanupClosePushL(propElems);
+        objectDescrs[i].GetChildElements( propElems );
+    
+
+        while ( propElems.HasNext() )
+        {
+            
+            TXmlEngElement ps = propElems.Next(); // ps stands for properties
+            if ( ps.Name() == KProperties() )
+            {
+
+                // take the properties
+                RXmlEngNodeList<TXmlEngElement> properties;
+                CleanupClosePushL(properties);
+                ps.GetChildElements( properties );
+        
+                const TDesC8& propertyType = UpnpDomInterface::GetAttrValueL( ps, KType() );
+
+                TBool elementFound;
+                
+
+                // check each property
+                while ( properties.HasNext() )
+                {
+                    
+                    TXmlEngElement el = properties.Next();
+
+                    // Validate element
+                    if ( propertyType == KElement() )
+                    {
+                        elementFound = EFalse;
+                        
+                        // Check if this element is requiered
+                        const TDesC8& required = UpnpDomInterface::GetAttrValueL( el, KRequiredObject() );
+
+                        TPtrC8 elementName = UpnpDomInterface::GetAttrValueL( el, KName() );
+
+                        // If it's required then check it's existence
+
+                        if ( required == UpnpCD::KOne() || elementName == KRes()  ||  elementName == KAlbumArtURI() )
+                        {
+                        if( !KRes().Compare(elementName) ||  !KAlbumArtURI().Compare(elementName))
+                        {
+                            elementFound = ETrue;
+                        }
+                            // get children once more, because this kind of list does not have any reset function
+                            object.GetChildElements( children );
+                            while ( children.HasNext() )
+                            {
+                                
+                                TXmlEngElement child = children.Next();
+                                
+                                HBufC8* nameWithNs = NameWithNsLC( child );
+
+                                if ( *nameWithNs == elementName )
+                                {
+                                    // local sharing
+                                    if(aNew && *nameWithNs == KRes)
+                                    {
+                                        TUriParser8 up;
+                                        TPtrC8 rv(child.Text());
+                                        if(rv.Length())
+                                        {
+                                            User::LeaveIfError( up.Parse(child.Text()) );
+                                            TPtrC8 path( up.Extract(EUriPath) );
+                                            TPtrC8 scheme( up.Extract(EUriScheme) );
+
+                                            if(aLocalSharing)
+                                            { // local action
+                                                if( scheme == UpnpHTTP::KSchemeFile8())
+                                                {
+                                                    // The path can be: /c:/....
+                                                    // or /c/... - without colon.
+                                                    // Both situation are correct but 
+                                                    // in further operations we assume 
+                                                    // there is not any colon next to the drive letter.
+                                                    // Therefore, remove it if second element of path table equals ':'
+                                                    if(path[2] == KColon8()[0])
+                                                    { // There IS a colon next to the drive letter.
+                                                        // Here is an example uri:
+                                                        // file:///c:/...
+                                                        // As you can see the second colon must be removed
+                                                        HBufC8* uri = child.Text().AllocLC();
+                                                        TPtr8 uriPtr(uri->Des());
+                                                        TPtrC8 tmp(uri->Des());
+                                                        TInt second = 2;
+                                                        TInt colonPos = 0;
+                                                        for(TInt i = 0; i < second; i++)
+                                                        {
+                                                            colonPos += tmp.Find(KColon8) + 1;
+                                                            tmp.Set( uriPtr.Mid(colonPos) );                                                    
+                                                        }
+                                                        // remove the colon
+                                                        uriPtr.Replace(colonPos - 1, KColon8().Length(), KNullString8);
+                                                        // set TXmlEngElement value
+                                                        child.SetTextL(uriPtr);
+                                                        
+                                                        // clean up             
+                                                        CleanupStack::PopAndDestroy(uri);                                               
+                                                    }
+                        
+                                                    // check other  restrictions
+                                                    TUriParser8 up;
+                                                    User::LeaveIfError( up.Parse(child.Text()) );
+                                                    TPtrC8 path( up.Extract(EUriPath) );
+
+                                                    // sharing from Z: drive is forbidden
+                                                    // second character is a drive letter
+                                                    if(path[1] == KForbiddenDrivez()[0] || path[1] == KForbiddenDriveZ()[0])
+                                                    {
+                                                        User::Leave(EArgumentValue);
+                                                    }
+                                                    
+                                                    // cannot share from private directory
+                                                    if(!path.Match(KForbiddenPrivatePattern))
+                                                    {
+                                                        User::Leave(EArgumentValue);
+                                                    }
+                                                    
+                                                }
+                                            }
+                                            else
+                                            { // not local action
+                                                // "file" schema is forbidden here
+                                                if(scheme == UpnpHTTP::KSchemeFile8())
+                                                {
+                                                    User::Leave(EArgumentValue);
+                                                }
+                                            }
+                                        }
+                                    }
+
+
+                                    if ( elementFound ) 
+                                    {
+                                        // multiple values for one element!
+                                        const TDesC8& multiple = UpnpDomInterface::GetAttrValueL( el, KMultiple() );
+                                        
+                                        // if it's not allowed for this element, leave!
+                                        if ( !multiple.Length() )
+                                        {
+                                            User::Leave( EInvalidArgs );
+                                        }
+                                    }
+                                    elementFound = ETrue;
+                                    // mark the element required - if not res
+                                    if( KRes().Compare(elementName) && KAlbumArtURI().Compare(elementName))
+                                    {
+                                        child.AddNewAttributeL(KRequiredAtrName,KTrueValue8);
+                                    }
+                                    
+                                    // nested validation 
+                                    RXmlEngNodeList<TXmlEngElement> nestEls;
+                                    CleanupClosePushL(nestEls);
+                                    el.GetChildElements(nestEls);
+                                    while(nestEls.HasNext())
+                                    {
+                                        TXmlEngElement nestPs = nestEls.Next();
+
+                                        // take the properties
+                                        RXmlEngNodeList<TXmlEngElement> nestProperties;
+                                        nestPs.GetChildElements( nestProperties );
+                                        const TDesC8& nestPropertyType = UpnpDomInterface::GetAttrValueL( nestPs, KType() );
+                                        // Validate attribute   
+                                        if ( nestPropertyType == KAttribute() )
+                                        {
+                                            while(nestProperties.HasNext())
+                                            {   
+                                                TXmlEngElement nestEl = nestProperties.Next();
+                                                //TBool nestElementFound;
+
+                                                //nestElementFound = EFalse;
+                                                
+                                                const TDesC8& nestRequired = UpnpDomInterface::GetAttrValueL( nestEl, KRequiredObject() );
+                                                TPtrC8 nestElementName = UpnpDomInterface::GetAttrValueL( nestEl, KName() );
+                                                if ( nestRequired == UpnpCD::KOne() || nestElementName == KDlnaProfileID)
+                                                {
+                                                    TPtrC8 nestCurrentValue = UpnpDomInterface::GetAttrValueL( child, nestElementName );
+                                                    
+                                                    TPtrC8 nameOfAttr;
+                                                    TPtrC8 valOfAttr;
+                                                    nameOfAttr.Set( nestElementName );
+                                                    
+                                                    // Start of 'dlna:profileID' attribute case                                                 
+                                                    if( nameWithNs->Des() == KAlbumArtURI && nestElementName == KDlnaProfileID) // ---------------- 1 ------------
+                                                    {   
+                                                        TXmlEngAttr profId = child.AttributeNodeL(KProfileID, KXmlnsDlna);
+                                                        if(profId.NotNull())
+                                                        {
+                                                            if (profId.Value().Compare(KDefaultProfileID))
+                                                            {
+                                                                User::Leave( EBadMetadata );
+                                                            }
+                                                            // setting real name of attribute -> localName
+                                                            nestElementName.Set(KProfileID); // descriptor  
+                                                            nameOfAttr.Set( nestElementName ); // related TString
+                                                                                                                                                                                                                                                                                            
+                                                            // generating a new value of 'dlna:profileID'
+                                                            HBufC8* albumArtURIelemValue = UpnpDomInterface::GetElementValueL(child).AllocLC();
+                                                            TPtr8 albumArtURIelemValuePtr( albumArtURIelemValue->Des() );                                                       
+                                                            
+                                                            albumArtURIelemValuePtr.Trim(); // deletes leading and trailing whitespace characters                                                   
+                                                            child.SetValueL(albumArtURIelemValuePtr); // sets new trimmed value to albumArtURI
+                                                                                                                                                        
+                                                            CUpnpDlnaProtocolInfo* tempProtocolInfo = NULL;
+                                                            TInt error = iContentDirectory->GetProtocolInfoL( albumArtURIelemValuePtr, tempProtocolInfo );
+                                                            TPtrC8 tempPnParam;
+                                                            if( error >=0 )
+                                                            {
+                                                                tempPnParam.Set( tempProtocolInfo->PnParameter() );
+                                                                    
+                                                                nestCurrentValue.Set(tempPnParam); // descriptor
+                                                                valOfAttr.Set(tempPnParam); // related TString                                                         
+                                                            }
+                                                            else 
+                                                            {
+                                                                User::Leave( EBadMetadata );
+                                                            }                                                       
+                                                            CleanupStack::PopAndDestroy(albumArtURIelemValue);
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
+                                                            // if albumArtURI doesn't contain profileID -> it creates one and also related namespace
+                                                            // if albumArtURI contains profileID -> it modifies profileID's value
+                                                            child.SetAttributeL( nameOfAttr, valOfAttr, KXmlnsDlna(), KDlnaPrefix() );
+                                                                                                                    
+                                                            delete tempProtocolInfo;
+                                                            tempProtocolInfo = NULL;    
+                                                        }
+                                                        
+                                                    } // End of 'dlna:profileID' attribute case
+                                                    else                    
+                                                    {
+                                                        if ( !nestCurrentValue.Length() )  
+                                                        {
+                                                            
+                                                            if(nestElementName == KprotocolInfo)
+                                                            {
+                                                                if( ! aLocalSharing )
+                                                                {
+                                                                    valOfAttr.Set( KEmptyProtocolInfoVal8() );
+                                                                }
+                                                                else 
+                                                                {
+                                                                    User::Leave( EBadMetadata );
+                                                                }
+                                                            }                                                                                                   //------- 2 -----                                                                                    //------- 2 -----                  
+                                                            else
+                                                            {
+                                                                valOfAttr.Set( KNullDesC8() );
+                                                            }
+                                
+                                                            child.AddNewAttributeL( nameOfAttr, valOfAttr );                                                            
+                                                        }
+                                                        else 
+                                                        {
+                                                            if(nestElementName == KprotocolInfo) 
+                                                            {
+                                                                HBufC8* protInfoValue = NULL;
+                                                                TRAPD(err, protInfoValue = ValidateProtocolInfoInResL( nestCurrentValue, aLocalSharing ));
+                                                                if(err)
+                                                                {
+                                                                    User::Leave(EBadMetadata);
+                                                                }
+                                                                CleanupStack::PushL( protInfoValue );
+                                                                valOfAttr.Set( *protInfoValue );
+                                                                child.SetAttributeL( nameOfAttr, valOfAttr );
+                                                                CleanupStack::PopAndDestroy( protInfoValue );                                                           
+                                                            }                                                                                                 //------- 3 -----                                                                                         //------- 3 -----
+                                                        }
+                                                    }                                                                                                                                                                                                                                                                                                                                                                                       
+                                                                                                        
+
+                                                    // if not main tag mark the attr is required
+                                                    if( !IsMainObjectTagL(child) && nestElementName != KDlnaProfileID)
+                                                    {
+                                                       
+                                                        HBufC8* attrReq = HBufC8::NewLC(
+                                                            nestElementName.Length()
+                                                            +KRequiredAtrSuf().Length() );
+                                                        TPtr8 attrReqPtr(attrReq->Des());
+                                                        attrReqPtr = nestElementName;
+                                                        attrReqPtr.Append(KRequiredAtrSuf);
+                                                        child.AddNewAttributeL( attrReqPtr, KTrueValue8 );
+                                                        CleanupStack::PopAndDestroy(attrReq);
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    
+                                    }
+                                    CleanupStack::PopAndDestroy(&nestEls);
+                                }
+                                CleanupStack::PopAndDestroy( nameWithNs );
+                                
+                            }
+                                
+                            // If not found, add it
+                            if ( !elementFound )
+                            {
+                                User::Leave(EBadMetadata);
+                            }
+                        } 
+                    }
+                        
+                    // Validate attribute   
+                    if ( propertyType == KAttribute() )
+                    {
+                        elementFound = EFalse;
+                        
+                        const TDesC8& required = UpnpDomInterface::GetAttrValueL( el, KRequiredObject() );
+                        if ( required == UpnpCD::KOne() )
+                        {
+
+                            const TDesC8& elementName = UpnpDomInterface::GetAttrValueL( el, KName() );
+
+                            const TDesC8& currentValue = UpnpDomInterface::GetAttrValueL( object, elementName );
+                            
+                            if ( !currentValue.Length() )  
+                            {
+                                TXmlEngAttr attr = object.AttributeNodeL( elementName );
+
+                                if(attr.NotNull())
+                                {
+                                    attr.SetValueL(KNullDesC8);
+                                }
+                                else
+                                {
+                                    object.AddNewAttributeL( elementName, KNullDesC8 );
+                                }                               
+                            }
+                            // if not main tag mark the attr is required
+                            if(!IsMainObjectTagL(object))
+                            {
+                                HBufC8* attrReq = HBufC8::NewLC(
+                                    elementName.Length()+KRequiredAtrSuf().Length() );
+                                TPtr8 attrReqPtr(attrReq->Des());
+                                attrReqPtr = elementName;
+                                attrReqPtr.Append(KRequiredAtrSuf);
+                                object.AddNewAttributeL( attrReqPtr, KTrueValue8 );
+                                CleanupStack::PopAndDestroy(attrReq);
+                            }
+                        }
+                    }
+                }
+                CleanupStack::PopAndDestroy(&properties);
+            }
+        }
+        CleanupStack::PopAndDestroy(&propElems);
+    }
+    CleanupStack::PopAndDestroy(); //objectDescrs.Close();
+    CleanupStack::PopAndDestroy(&children);
+    
+    // now the object 
+    // * has the all required fields (if some were missing, they are added)
+    // * had a proper xml structure (_not_ using UpnpDomInterface:: functions that do not care)
+    // * has for sure a mostly proper object structure 
+
+    return EUndefined;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidatePropertiesL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementFactory::ValidatePropertiesL( TXmlEngElement aObj,
+                                               RArray<TXmlEngElement>& aClassList)
+{
+    // validate main object's attributes
+    ValidateMainAttributesL(aObj, aClassList);
+    
+    // validate elements
+    RXmlEngNodeList<TXmlEngElement> elements;
+    CleanupClosePushL(elements);
+    aObj.GetChildElements (elements);
+    
+    // for each element
+    while(elements.HasNext())
+    {
+        TXmlEngElement el = elements.Next();
+        ValidateElementL(el, aClassList);
+    }
+    CleanupStack::PopAndDestroy(&elements);
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateBigImageL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementFactory::ValidateBigImageL( TXmlEngElement aObj)
+{
+    RArray<TXmlEngElement> elms;
+    CleanupClosePushL(elms);
+    
+    if( UpnpDomInterface::GetElementListL(aObj, elms, KRes) )
+    {
+        for(TInt i = 0; i < elms.Count(); i++)
+        {
+                
+            TXmlEngAttr prInfAttr = elms[i].AttributeNodeL(KprotocolInfo());
+            if(prInfAttr.NotNull())
+            {
+                CUpnpProtocolInfoLocal* protInf = CUpnpProtocolInfoLocal::NewL(
+                        UpnpDomInterface::GetAttrValueL(elms[i], KprotocolInfo) );
+                CleanupStack::PushL(protInf);
+                                                                                   
+                /* Only support for DLNA pn-params:
+                *  1) JPEG_SM
+                *  2) MP3 
+                *  3) AAC_ISO_320
+                *  4) AVC_MP4_BL_CIF15_AAC_520
+                */
+                if( protInf->PnParameter() != KDLNA_PN_JPEG_SM &&
+                    protInf->PnParameter() != KDLNA_PN_MP3 &&
+                    protInf->PnParameter() != KDLNA_PN_AAC_ISO_320 &&
+                    protInf->PnParameter() != KDLNA_PN_AVC_MP4_BL_CIF15_AAC_520                     
+                  )
+                {           
+                    // set 4th parameter to "*"
+                    protInf->SetFourthFieldL(KAsterisk8);
+                    TPtrC8 prInfo = protInf->ProtocolInfoL();
+                    HBufC8* prInfTmp = prInfo.Alloc();
+                    CleanupStack::PushL(prInfTmp);
+                    prInfAttr.SetValueL( *prInfTmp );
+                    CleanupStack::PopAndDestroy(prInfTmp);
+                }
+                // clean up
+                CleanupStack::PopAndDestroy(protInf);
+            }
+        }
+    }
+    
+    // clean up
+    CleanupStack::PopAndDestroy(&elms);
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateElementL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementFactory::ValidateElementL( TXmlEngElement aElement,
+                                            RArray<TXmlEngElement>& aClassList)
+{
+    if(aElement.Name() == KRes)
+    {
+        ValidateResElL(aElement, aClassList);
+    }
+    else
+    {
+        //  get pattern 
+        HBufC8* name = UpnpCdUtils::GetElmNameWithNsL(aElement);
+        CleanupStack::PushL(name);
+        TXmlEngElement pattern = GetPatternL(*name, aClassList, KElement);
+        if(pattern.NotNull())
+        {
+            ValidateElWithPatternL(aElement, pattern); // leaves on error
+        }
+        else
+        { // attr is not supported - remove
+            aElement.Remove();
+        }
+        // clean up
+        CleanupStack::PopAndDestroy(name);
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateMainAttributesL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementFactory::ValidateMainAttributesL( TXmlEngElement aObj, 
+                                                   RArray<TXmlEngElement>& aClassList)
+{
+    // list of attributes
+    RXmlEngNodeList<TXmlEngAttr> attrList;
+    CleanupClosePushL(attrList);
+    aObj.GetAttributes(attrList);
+    
+    // for each attr
+    while(attrList.HasNext())
+    {
+        // get attr
+        TXmlEngAttr attr = attrList.Next();
+        
+        //  get pattern 
+        TXmlEngElement pattern = GetPatternL(attr.Name(), aClassList, KAttribute);
+        if(pattern.NotNull())
+        {
+            ValidateAttrWithPatternL(attr, pattern); // leaves on error
+        }
+        else
+        { // attr is not supported - remove
+            attr.Remove();
+        }
+    }
+    CleanupStack::PopAndDestroy(&attrList);
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateElWithPatternL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementFactory::ValidateResElL( TXmlEngElement aElement, 
+                                         RArray<TXmlEngElement>& aClassList)
+{
+    // list of attributes
+    RXmlEngNodeList<TXmlEngAttr> attrList;
+    CleanupClosePushL(attrList);
+    aElement.GetAttributes(attrList);
+    
+    // for each attr
+    while(attrList.HasNext())
+    {
+        // get attr
+        TXmlEngAttr attr = attrList.Next();
+        
+        //  get pattern 
+        TXmlEngElement pattern = GetPatternForResAttrL(attr.Name(), aClassList);
+        if(pattern.NotNull())
+        {
+            ValidateAttrWithPatternL(attr, pattern); // leaves on error
+        }
+        else
+        { // attr is not supported - remove
+            attr.Remove();
+        }
+    }
+    CleanupStack::PopAndDestroy(&attrList);
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateElWithPatternL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementFactory::ValidateElWithPatternL(   TXmlEngElement aElement, 
+                                                    TXmlEngElement aPattern )
+{
+    // is required?
+    if(IsRequiredL(aPattern) )
+    { // cannot be empty
+        if( !aElement.Value().Length() || 
+            UpnpCdUtils::IsWhiteString( aElement.Value() ) )
+        {
+            User::Leave(EBadMetadata);
+        }
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateAttrWithPatternL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementFactory::ValidateAttrWithPatternL( TXmlEngAttr aAttr, 
+                                                    TXmlEngElement aPattern )
+{
+    // is required?
+    if(IsRequiredL(aPattern) )
+    { // cannot be empty
+        if( !aAttr.Value().Length() || 
+            UpnpCdUtils::IsWhiteString( aAttr.Value() ) )
+        {
+            User::Leave(EBadMetadata);
+        }
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateAttrWithPatternL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpElementFactory::IsRequiredL(TXmlEngElement aPattern) 
+{
+    TXmlEngAttr reqAttr = aPattern.AttributeNodeL(KRequiredObject());
+    TBool ret = EFalse;
+    if( reqAttr.NotNull() &&
+        reqAttr.Value().Length() && 
+        reqAttr.Value() == KTrueValue8() )
+    {
+        ret = ETrue;
+    }
+    return ret;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::GetPatternForElL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+TXmlEngElement CUpnpElementFactory::GetPatternL( const TDesC8& aPropertyName,
+                                                RArray<TXmlEngElement>& aClassList,
+                                                const TDesC8& aType )
+{
+    TXmlEngElement retEl;
+    
+    // for each class
+    for(TInt i = 0; i < aClassList.Count(); i++)
+    {
+        TXmlEngElement elPattEl;      
+        UpnpDomInterface::GetDirectoryElementL(aClassList[i], elPattEl, KProperties, KType, aType);
+        if(elPattEl.NotNull())
+        {   
+            UpnpDomInterface::GetDirectoryElementL(elPattEl, retEl, KObjectProperty, KObjectName, aPropertyName);
+            
+            // break if found
+            if(retEl.NotNull())
+            {
+                break;
+            }
+        }
+    }
+    
+    return retEl;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::GetPatternForResAttrL()
+// Function leaves on error.
+// -----------------------------------------------------------------------------
+//
+TXmlEngElement CUpnpElementFactory::GetPatternForResAttrL(const TDesC8& aPropertyName,
+                                                    RArray<TXmlEngElement>& aClassList )
+{
+    TXmlEngElement retEl;
+    
+    // for each class
+    for(TInt i = 0; i < aClassList.Count(); i++)
+    {
+        TXmlEngElement resAttrPattEl;     
+        UpnpDomInterface::GetDirectoryElementL(aClassList[i], resAttrPattEl, KProperties, KType, KResAttr);
+        if(resAttrPattEl.NotNull())
+        {   
+            UpnpDomInterface::GetDirectoryElementL(resAttrPattEl, retEl, KObjectProperty, KObjectName, aPropertyName);
+            
+            // break if found
+            if(retEl.NotNull())
+            {
+                break;
+            }
+        }
+    }
+    
+    return retEl;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::IsMainObjectTagL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpElementFactory::IsMainObjectTagL(TXmlEngElement aElement)
+{
+    TXmlEngElement notNeeded;
+    return UpnpDomInterface::GetElementL(aElement, notNeeded, KClassTagName);
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ActiveElementL()
+// Gets active element from XML document. An active element
+// is a first element different from <DIDL-Lite> element.
+// -----------------------------------------------------------------------------
+//
+TXmlEngElement CUpnpElementFactory::ActiveElementL( const RXmlEngDocument& aDocument )
+{
+    if( aDocument.IsNull() || aDocument.DocumentElement().IsNull() )
+    {
+        User::Leave( KErrNotFound );            
+    }
+        
+    if ( aDocument.DocumentElement().Name().CompareF( KDidlLite() ) != 0 )
+    {
+        return aDocument.DocumentElement();
+    }
+    else
+    {
+        TXmlEngElement root = aDocument.DocumentElement();
+        RXmlEngNodeList<TXmlEngElement> children;
+        CleanupClosePushL(children);
+        root.GetChildElements( children );
+        children.HasNext();
+        CleanupStack::PopAndDestroy(&children);
+        return children.Next();
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ExtractActiveElementL()
+// Extracts active element from XML document. 
+// An active element is a first element different from <DIDL-Lite> element.
+// IMPORTANT: Caller takes responsibility for returned element. 
+// -----------------------------------------------------------------------------
+//
+RXmlEngDocument CUpnpElementFactory::ExtractActiveElementL( const RXmlEngDocument& aDocument )
+{
+    TXmlEngElement active;
+    RXmlEngDocument ret;
+    ret.OpenL(iDOMImpl);
+    CleanupClosePushL(ret);
+
+    if( aDocument.IsNull() || aDocument.DocumentElement().IsNull() )
+    {
+        User::Leave( KErrNotFound );            
+    }
+        
+    if ( aDocument.DocumentElement().Name().CompareF( KDidlLite() ) != 0 )
+    {
+        active = aDocument.DocumentElement().Unlink().AsElement();
+    }
+    else
+    {
+        TXmlEngElement root = aDocument.DocumentElement();
+        RXmlEngNodeList<TXmlEngElement> children;
+        CleanupClosePushL(children);
+        root.GetChildElements( children );
+        children.HasNext();
+        active = children.Next().Unlink().AsElement();
+        CleanupStack::PopAndDestroy(&children);
+    }
+    ret.SetDocumentElement(active);
+    
+    CleanupStack::Pop(&ret);
+    
+    return ret;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ElementsMatchL()
+// Checks if two elements are equal and have exactly the same subtrees.
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpElementFactory::ElementsMatchL( TXmlEngElement aFirst, TXmlEngElement aSecond )
+{
+    // this function checks following things:
+    // 1. element names
+    // 2. contents of the elements
+    // 3. attributes of the elements
+    // 4. child elements of the elements
+    
+    if ( aFirst.Name().Compare(aSecond.Name()) == 0 )
+    {
+        // aFirst names match. next: check namespace
+        if ( aFirst.Prefix().Compare( aSecond.Prefix()) == 0 )
+        {
+            if (!aFirst.Text().Compare(aSecond.Text()))
+            {
+                
+                // namespacess match, next: check attributes
+                RXmlEngNodeList<TXmlEngAttr> elemAttrs;
+                CleanupClosePushL(elemAttrs);
+                RXmlEngNodeList<TXmlEngAttr> currAttrs;
+                CleanupClosePushL(currAttrs);
+                
+                aFirst.GetAttributes( elemAttrs );
+                aSecond.GetAttributes( currAttrs );
+                
+                if ( elemAttrs.Count() == currAttrs.Count() )
+                {
+                    // first step in comparing attributes ready (counts match!)
+                    // next, check names and values (for each attribute)
+
+                    while( elemAttrs.HasNext() && currAttrs.HasNext() )
+                    {
+                        TXmlEngAttr elemAttr = elemAttrs.Next();
+                        TXmlEngAttr currAttr = currAttrs.Next();
+                        
+                        // compare names and values
+                        if ( elemAttr.Name().Compare( currAttr.Name() ) )
+                        {
+                            CleanupStack::PopAndDestroy(&currAttrs);
+                            CleanupStack::PopAndDestroy(&elemAttrs);
+                            return EFalse;
+                        }
+                        if ( elemAttr.Value().Compare( currAttr.Value() ) )
+                        {
+                            CleanupStack::PopAndDestroy(&currAttrs);
+                            CleanupStack::PopAndDestroy(&elemAttrs);
+                            return EFalse;
+                        }
+                        
+                    }
+                    
+                    // compare child elements (recursive function call)
+                    RXmlEngNodeList<TXmlEngElement> fChildren;
+                    CleanupClosePushL(fChildren);
+                    RXmlEngNodeList<TXmlEngElement> sChildren;
+                    CleanupClosePushL(sChildren);
+                                        
+                    aFirst.GetChildElements( fChildren );
+                    aSecond.GetChildElements( sChildren );
+                
+                    
+                    if ( fChildren.Count() == sChildren.Count() )
+                    {
+                            while ( fChildren.HasNext() && sChildren.HasNext() )
+                            {
+                            // call this function again for children
+                                TBool matching = ElementsMatchL( fChildren.Next(), sChildren.Next() );
+
+                            // if some of the elements do not match, return false!
+                                if (matching == EFalse)
+                                {
+                                    CleanupStack::PopAndDestroy(&sChildren);
+                                    CleanupStack::PopAndDestroy(&fChildren);
+                                    CleanupStack::PopAndDestroy(&currAttrs);
+                                    CleanupStack::PopAndDestroy(&elemAttrs);
+                                    return EFalse;
+                                }
+                            }
+                        // only place to return ETrue
+                        // all the checks are made; if survived here, elements match!
+                        CleanupStack::PopAndDestroy(&sChildren);
+                        CleanupStack::PopAndDestroy(&fChildren);
+                        CleanupStack::PopAndDestroy(&currAttrs);
+                        CleanupStack::PopAndDestroy(&elemAttrs);
+                        return ETrue;
+                    }
+                    CleanupStack::PopAndDestroy(&sChildren);
+                    CleanupStack::PopAndDestroy(&fChildren);
+                }
+                CleanupStack::PopAndDestroy(&currAttrs);
+                CleanupStack::PopAndDestroy(&elemAttrs);
+            }
+        }
+    }
+    
+    return EFalse;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::CountElementsL()
+// Prepares corresponding RArray<TXmlEngElements> and calls 
+// CountElementsL( const TDesC8& aName, RArray<TXmlEngElement>& aArray )
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpElementFactory::CountElementsL( const TDesC8& aName, RArray<RXmlEngDocument>& aArray )
+{
+    TInt count(0);
+        
+    for(TInt i = 0; i < aArray.Count(); i++)
+    {            
+        if ( aArray[i].DocumentElement().NotNull() )
+        {
+            if ( aArray[i].DocumentElement().Name() == aName )
+            {
+                count++;
+            }
+        }
+            
+    }
+    return count;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::CountElementsL()
+// Counts elements in array that have the same name.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpElementFactory::CountElementsL( const TDesC8& aName, RArray<TXmlEngElement>& aArray )
+{
+    TInt count(0);
+    
+    for (TInt v(0); v<aArray.Count(); v++)
+    {
+        if ( aArray[v].NotNull() )
+        {
+            if ( aArray[v].Name() == aName )
+            {
+                count++;
+            }
+        }
+    }
+    
+    return count;
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::NameWithNsLC()
+// Constructs descriptor with element's name and namespace prefix separated with colon.
+// IMPORTANT: As the function name indicates, it leaves pointer to heap descriptor on 
+// cleanup stack.
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpElementFactory::NameWithNsLC(const TXmlEngElement& aElement)
+{
+    const TDesC8& localName = aElement.Name();
+    TPtrC8 prefix = aElement.Prefix();
+
+    if ( prefix.Length() > 0)
+    {
+
+        HBufC8* nameWithNs = HBufC8::NewLC( 
+            localName.Length() + 
+            UpnpString::KColon().Length() +
+            prefix.Length() );
+
+        nameWithNs->Des().Append( prefix );
+        nameWithNs->Des().Append( UpnpString::KColon() );
+        nameWithNs->Des().Append( localName );
+
+        return nameWithNs;
+    }
+    else
+    {
+        return localName.AllocLC();
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ClassesL()
+// Gets classes descriptions for given object.
+// -----------------------------------------------------------------------------
+//
+void CUpnpElementFactory::ClassesL( const TXmlEngElement& aObject, RArray<TXmlEngElement>& aArray, const TDesC8& aObjType )
+{
+    TInt i(0);
+    
+    // if survived here, we have the new element of type item or container
+    // let's analyze its type
+    TXmlEngElement type;
+    UpnpDomInterface::GetElementL ( aObject, type, KClass() );
+
+    if ( type.IsNull() ) 
+    {
+        // no <class> element! leave
+        User::Leave( EBadMetadata );
+    }
+
+    // check that does the new element have all the required fields for its type
+    // and also check that it does not have whatever fields (only optional allowed)
+    RPointerArray<TPtrC8> objectFields;
+    
+    TPtrC8 content = type.Text();
+    if( !content.Length() )
+    {
+        User::Leave( EBadMetadata );
+    }
+    //--- removing white spaces ------------------      
+    HBufC8* tempBuffer = type.Text().AllocLC(); 
+    TPtr8 tmpPtr(tempBuffer->Des());
+    UpnpCdUtils::RemoveWhiteSpacesL(tmpPtr);        
+    CleanupStack::Check(tempBuffer);
+    type.SetTextL(tmpPtr);  
+    //--------------------------------------------
+    
+    UpnpString::CutToPiecesL(tmpPtr, TChar('.'), objectFields );    
+    CleanupStack::Check(tempBuffer);
+    // let's inspect each of types
+    // at first, collect object type descriptions from objects xml    
+    // to a pointer array
+    
+    TInt NumberOfObjectFields = objectFields.Count();
+    
+    for ( i=0; i < NumberOfObjectFields; i++ ) 
+    {
+        // seek for such object type
+        TXmlEngElement objectDescription;
+
+        UpnpDomInterface::GetDirectoryElementL( 
+                iDocument.DocumentElement(), 
+                objectDescription, 
+                KElement, 
+                KType, 
+                *objectFields[i] );
+        CleanupStack::Check(tempBuffer);
+        // if such type found
+        if ( objectDescription.NotNull() ) 
+        {
+            aArray.Append( objectDescription );
+        }
+        /* This case is valid for any numeric value of containerID used in CreateObject() action
+        *  We do some checking starting from 3rd string of <upnp:class> element, if the string isn't
+        *  recognizable, instead of leaving, we trims the value of <upnp:class> element, e.g:
+        *  'object.item.imageItem.abcd' -> is trimmed into -> 'object.item.imageItem'
+        *  DLNA 7.3.120.4 requirement
+        */
+        else if( i >= 2 )
+        {            
+            for( TInt j = NumberOfObjectFields - 1; j >= i; j-- )
+            {                            
+                TInt pos = tmpPtr.LocateReverse( TChar('.') );                    
+                if( pos > KErrNotFound )
+                {
+                    tmpPtr.Copy( tmpPtr.Left(pos) );                   
+                                                
+                    delete objectFields[j];
+                    objectFields.Remove(j);   
+                }                    
+            }                                                
+            type.SetTextL(tmpPtr); // changing xml                        
+            
+            break;
+        }
+        else 
+        {
+            objectFields.ResetAndDestroy();
+            objectFields.Close();
+            User::Leave( EBadMetadata );
+        }
+    }
+    CleanupStack::Check(tempBuffer);
+    /*  for each type, check that: 
+    *   1. it is referenced to its current parent type (e.g. audioItem -> item)
+    *   2. this new object has all the required fields
+    *   3. relations between object types and values of 'upnp:class':
+    *      <item> -> 'object.item' or <container> -> 'object.container'
+    */
+       
+    // we count the number of elements once again, because size of the array might change
+    NumberOfObjectFields = objectFields.Count(); 
+
+    for ( i=0; i < NumberOfObjectFields; i++ )
+    {
+        const TDesC8& field = *objectFields[i];
+
+        // 1. first, check the parent relation 
+        // first type must be "object"!
+        if ( i==0 ) 
+        {
+            /* Leave if:
+            *  1. first type isn't the 'object' OR
+            *  2. 'upnp:class' contains only 'object' type [which in matter of fact isn't instantiable]
+            */
+            if ( field != KObject() || 
+                 field == KObject() && NumberOfObjectFields == 1
+            ) 
+            {
+                // if not "item", leave!
+                objectFields.ResetAndDestroy();
+                objectFields.Close();
+                User::Leave( EBadMetadata );
+            }
+        }
+        // for later types, check the relation really
+        else 
+        {   
+            // checking relations between object types and values of 'upnp:class'
+            if( i == 1 && aObjType.Length() > 0 )
+            {
+                if(  !field.Compare(KItem) && aObjType.Compare(KItem) ||
+                     !field.Compare(KContainer) && aObjType.Compare(KContainer)
+                )
+                {          
+                    objectFields.ResetAndDestroy();
+                    objectFields.Close();                              
+                    User::Leave( EBadMetadata );
+                }
+            }            
+            //----------------------------------------    
+            const TDesC8& parent = *objectFields[i-1];
+            
+            // if we've survived to this point, this parent string
+            // should match with the one in the previous object description xml element
+            TXmlEngElement iparent;
+            UpnpDomInterface::GetElementL ( aArray[i], iparent, KIParent() );
+            CleanupStack::Check(tempBuffer);
+            TPtrC8 cont = iparent.Text();
+        
+            // now check the actual relation. leave if strings do not match!
+            if ( cont.Length() && parent != cont )
+            {
+                objectFields.ResetAndDestroy();
+                objectFields.Close();
+                User::Leave( EBadMetadata );
+            }
+        }
+    }
+    CleanupStack::PopAndDestroy(tempBuffer);
+    objectFields.ResetAndDestroy();
+    objectFields.Close();
+    return;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::IsNotEmptyImportUriL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpElementFactory::IsNotEmptyImportUriL( const TXmlEngElement& aElement )
+{
+    TXmlEngAttr importUri;
+    
+    if ( aElement.Name() == KRes() )
+    {
+        importUri = aElement.AttributeNodeL( KImportUri8() );
+        
+        // remove if empty importUri: DLNA Requirement [7.3.134.5]
+        TPtrC8 val( importUri.Value() );
+        if( UpnpCdUtils::IsWhiteString( val ) )
+        {
+            importUri.Remove();
+        }
+    }
+
+    return importUri.NotNull();
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::IsClassElement()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpElementFactory::IsClassElement( const TXmlEngElement& aElement )
+{
+    if ( aElement.Name() == KClass() )
+    {
+        return ETrue;
+    }
+    else
+    {
+        return EFalse;
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::ValidateProtocolInfoInResL
+//  Allocates string, which is object type for this object. 
+// -----------------------------------------------------------------------------
+HBufC8* CUpnpElementFactory::ValidateProtocolInfoInResL( const TDesC8& aProtocolInfo, TBool aLocalSharing )
+{
+    HBufC8* result = NULL; 
+   // CUpnpDlnaProtocolInfo* protocolInfo = CUpnpDlnaProtocolInfo::NewL( (TDesC8&)aProtocolInfo );
+    CUpnpProtocolInfoLocal* protocolInfo = CUpnpProtocolInfoLocal::NewL( (TDesC8&)aProtocolInfo );
+    CleanupStack::PushL( protocolInfo ); 
+    _LIT8(KProtocolInfoHttpGet, "http-get"); 
+    protocolInfo->SetFirstFieldL( (TDesC8&)KProtocolInfoHttpGet() ); 
+    protocolInfo->SetSecondFieldL( (TDesC8&)KAsterisk8() ); 
+    TPtrC8 third = protocolInfo->ThirdField(); 
+    if(( third.Find( KSlash8()) == KErrNotFound) && 
+      ( third.Compare( KAsterisk8()) != KErrNone))
+    {
+        if( aLocalSharing)
+        {
+        User::Leave( EBadMetadata );
+        }
+        protocolInfo->SetThirdFieldL( (TDesC8&) KAsterisk8());                                  
+    }
+   // if( protocolInfo->IsDlnaInformationIncluded() ) // Check it !!!
+    {
+        protocolInfo->SetOpParameterL( UpnpDlnaProtocolInfo::B_VAL , ETrue );
+        protocolInfo->SetOpParameterL( UpnpDlnaProtocolInfo::A_VAL , EFalse ); 
+    }
+    TPtrC8 prInfo = protocolInfo->ProtocolInfoL();
+    result =  prInfo.Alloc();
+    CleanupStack::PopAndDestroy( protocolInfo ); 
+    return result; 
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::GetContentDirectoryReference
+// Function gets pointer to CUpnpContentDirectory and puts it into CUpnpElementFactory object  
+// -----------------------------------------------------------------------------
+void CUpnpElementFactory::GetContentDirectoryReference(CUpnpContentDirectory* aCD)
+{
+    iContentDirectory = aCD;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::CheckDurationOfResElement
+// If res@duration attribute exists, the method checks whether it has valid format
+// -----------------------------------------------------------------------------
+
+void CUpnpElementFactory::CheckDurationOfResElementL(const TXmlEngElement& aElement)
+{
+    TXmlEngAttr duration;
+    
+    // if this is the 'res' element            
+    if( aElement.Name() == KRes() )
+    {
+        // and it has res@duration attribute
+        duration = aElement.AttributeNodeL( KDuration8() );                                        
+        if( duration.NotNull() )
+        {
+            TCurrentAction action = iContentDirectory->ExecutedAction();                                         
+            TPtrC8 val( duration.Value() );
+            
+            // if res@duration atrribute value is invalid [has improper format]
+            if( !UpnpCdUtils::ValidateDurationValue(val) )
+            {            
+                // remove it from 'res' element if it is CreateObject()
+                if( action == ECreateObjectAction )
+                {
+                    duration.Remove();
+                }                
+            }
+        }
+    }   
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpElementFactory::CheckSizeOfResElement
+// If res@size attribute exists, the method checks whether it has valid format
+// size should be unsigned int.
+// -----------------------------------------------------------------------------
+void CUpnpElementFactory::CheckSizeOfResElementL(
+    const TXmlEngElement& aElement )
+    {
+    TXmlEngAttr sizeAttr;
+
+    // if this is the 'res' element            
+    if ( aElement.Name() == KRes() )
+        {
+        // and it has res@size attribute
+        sizeAttr = aElement.AttributeNodeL( KSize() );
+        if ( sizeAttr.NotNull() )
+            {
+            TCurrentAction action = iContentDirectory->ExecutedAction();
+            TPtrC8 val( sizeAttr.Value() );
+
+            // if res@size atrribute value is invalid [is not an unsigned long]
+            TUint32 unsignedLong = 0;
+
+            TLex8 lexULong(val);
+            TInt error = lexULong.Val( unsignedLong, EDecimal );
+                         
+            TInt remainder = lexULong.Remainder().Length();
+
+            if ( error != KErrNone || remainder )
+                {
+                // remove it from 'res' element if it is CreateObject()
+                if ( action == ECreateObjectAction )
+                    {
+                    sizeAttr.Remove();
+                    }
+                }
+            }
+        }
+
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnperror.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,90 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UPnP Error - this is internal class that converts 
+*                TInt to TUpnpErrorCode it helps to avoid excessive casting                    
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "upnperror.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TUpnpError::TUpnpError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpError::TUpnpError(TInt aErrCode)
+{
+        if(aErrCode == EUpnpOk)                     iUpnpErrCode = EHttpOk;
+        else if(aErrCode == EHttpOk)                iUpnpErrCode = EHttpOk;
+        else if(aErrCode == EBadRequest)            iUpnpErrCode = EBadRequest;
+        else if(aErrCode == EInvalidAction)         iUpnpErrCode = EInvalidAction;
+        else if(aErrCode == EInvalidArgs)           iUpnpErrCode = EInvalidArgs;
+        else if(aErrCode == EInvalidVar)            iUpnpErrCode = EInvalidVar;
+        else if(aErrCode == EPreconditionFailed)    iUpnpErrCode = EPreconditionFailed;
+        else if(aErrCode == EInternalServerError)   iUpnpErrCode = EInternalServerError;
+        else if(aErrCode == EActionFailed)          iUpnpErrCode = EActionFailed;
+        else if(aErrCode == EArgumentValue)         iUpnpErrCode = EArgumentValue;
+        else if(aErrCode == EArgumentRange)         iUpnpErrCode = EArgumentRange;
+        else if(aErrCode == ENotImplemented)        iUpnpErrCode = ENotImplemented;
+        else if(aErrCode == EOutOfMemory)           iUpnpErrCode = EOutOfMemory;
+        else if(aErrCode == EHumanIntervention)     iUpnpErrCode = EHumanIntervention;
+        else if(aErrCode == EStringTooLong)         iUpnpErrCode = EStringTooLong;
+        else if(aErrCode == ENotAuthorized)         iUpnpErrCode = ENotAuthorized;
+        else if(aErrCode == ESignatureFailure)      iUpnpErrCode = ESignatureFailure;
+        else if(aErrCode == ESignatureMissing)      iUpnpErrCode = ESignatureMissing;
+        else if(aErrCode == ENotEncrypted)          iUpnpErrCode = ENotEncrypted;
+        else if(aErrCode == EInvalidSequence)       iUpnpErrCode = EInvalidSequence;
+        else if(aErrCode == EInvalidUrl)            iUpnpErrCode = EInvalidUrl;
+        else if(aErrCode == ENoSession)             iUpnpErrCode = ENoSession;
+        else if(aErrCode == ENoSuchObject)          iUpnpErrCode = ENoSuchObject;
+        else if(aErrCode == EInvalidCurrentTag)     iUpnpErrCode = EInvalidCurrentTag;
+        else if(aErrCode == EInvalidNewTag)         iUpnpErrCode = EInvalidNewTag;
+        else if(aErrCode == ERequiredTag)           iUpnpErrCode = ERequiredTag;
+        else if(aErrCode == EReadOnlyTag)           iUpnpErrCode = EReadOnlyTag;
+        else if(aErrCode == EParameterMismatch)     iUpnpErrCode = EParameterMismatch;
+        else if(aErrCode == EInvalidSearch)         iUpnpErrCode = EInvalidSearch;
+        else if(aErrCode == EInvalidSort)           iUpnpErrCode = EInvalidSort;
+        else if(aErrCode == ENoContainer)           iUpnpErrCode = ENoContainer;
+        else if(aErrCode == ERestrictedObject)      iUpnpErrCode = ERestrictedObject;
+        else if(aErrCode == EBadMetadata)           iUpnpErrCode = EBadMetadata;
+        else if(aErrCode == ERestrictedParentObject)iUpnpErrCode = ERestrictedParentObject;
+        else if(aErrCode == ENoSourceResource)      iUpnpErrCode = ENoSourceResource;
+        else if(aErrCode == ESourceAccess)          iUpnpErrCode = ESourceAccess;
+        else if(aErrCode == ETransferBusy)          iUpnpErrCode = ETransferBusy;
+        else if(aErrCode == ENoFileTransfer)        iUpnpErrCode = ENoFileTransfer;
+        else if(aErrCode == ENoDestinationResource) iUpnpErrCode = ENoDestinationResource;
+        else if(aErrCode == EDestinationAccess)     iUpnpErrCode = EDestinationAccess;
+        else if(aErrCode == ECannotProcess)         iUpnpErrCode = ECannotProcess;
+        else if(aErrCode == EUndefined)             iUpnpErrCode = EUndefined;
+        // all other
+        else iUpnpErrCode = EActionFailed;
+}
+
+// -----------------------------------------------------------------------------
+// TUpnpError::TUpnpErrorCode
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpError::operator TUpnpErrorCode()
+{
+    return iUpnpErrCode;
+}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpfiletransfer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,218 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File transfer
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpfiletransfer.h"
+#include "upnpfiletransferevent.h"
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::CUpnpFileTransfer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransfer::CUpnpFileTransfer( TInt aTransferId, 
+                                      TInt aObjectId, 
+                                      TTransferType aType):
+        iTransferId(aTransferId),
+        iType(aType),
+        iTransferLength(0),
+        iTransferTotal(0),
+        iObjectId(aObjectId)
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpFileTransfer::ConstructL( )
+    {   
+    }
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransfer::~CUpnpFileTransfer()
+    {   
+    delete iEvent;
+    }    
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransfer* CUpnpFileTransfer::NewL(TInt aTransferId, TInt aObjectId, TTransferType aType)
+    {
+    CUpnpFileTransfer* self = new (ELeave) CUpnpFileTransfer( aTransferId, aObjectId, aType);
+    CleanupStack::PushL( self );
+    self->ConstructL(  );
+    CleanupStack::Pop( self );
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransfer* CUpnpFileTransfer::NewLC(TInt aTransferId, TInt aObjectId, TTransferType aType)
+    {
+    CUpnpFileTransfer* self = new (ELeave) CUpnpFileTransfer( aTransferId, aObjectId, aType);
+    CleanupStack::PushL( self );
+    self->ConstructL(  );    
+    return self;
+    }    
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::TransferState
+// 
+// -----------------------------------------------------------------------------
+//
+TTransferStatus CUpnpFileTransfer::TransferState( )
+    {   
+    return iTransferState;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::SetTransferState
+// 
+// -----------------------------------------------------------------------------
+//
+void CUpnpFileTransfer::SetTransferState(TTransferStatus aState )
+    {   
+    iTransferState = aState;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::ImportNumber
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpFileTransfer::ImportNumber( )
+    {   
+    return iImportNumber;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::SetImportNumber
+// 
+// -----------------------------------------------------------------------------
+//
+void CUpnpFileTransfer::SetImportNumber(TInt aNum )
+    {   
+    iImportNumber = aNum;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::TransferLength
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpFileTransfer::TransferLength( )
+    {   
+    return iTransferLength;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::TransferLength
+// 
+// -----------------------------------------------------------------------------
+//
+void CUpnpFileTransfer::SetTransferLength(TInt aLen)
+    {   
+    iTransferLength = aLen;
+    }           
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::TransferLength
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpFileTransfer::TransferTotal( )
+    {   
+    return iTransferTotal;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::TransferLength
+// 
+// -----------------------------------------------------------------------------
+//
+void CUpnpFileTransfer::SetTransferTotal(TInt aTotal)
+    {   
+    iTransferTotal = aTotal;
+    }  
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::TransferType
+// 
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransfer::TTransferType CUpnpFileTransfer::TransferType()
+    {   
+    return iType;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::ObjectId
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpFileTransfer::ObjectId()
+    {   
+    return iObjectId;
+    } 
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::TransferID
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpFileTransfer::TransferId()
+    {   
+    return iTransferId;
+    }     
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::Event
+// 
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransferEvent* CUpnpFileTransfer::Event()
+    {   
+    return iEvent;
+    }                     
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::SetEvent
+// 
+// -----------------------------------------------------------------------------
+//
+void CUpnpFileTransfer::SetEvent(CUpnpFileTransferEvent* aEvent)
+    {   
+    if(iEvent)
+        {
+        delete iEvent;
+        }
+    iEvent = aEvent;
+    }      
+// -----------------------------------------------------------------------------
+// CUpnpFileTransfer::RemoveEvent
+// 
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransferEvent* CUpnpFileTransfer::RemoveEvent()
+    {   
+    CUpnpFileTransferEvent* event = iEvent;    
+    iEvent = NULL;
+    
+    return event;
+    }      
+    
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpfiletransfertimerobserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,98 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File transfer observer
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpfiletransfertimerobserver.h"
+
+// -----------------------------------------------------------------------------
+// CFileTransferTimer::CUpnpFileTransferTimerObserver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransferTimerObserver::CUpnpFileTransferTimerObserver (
+                            MUpnpFileTransferTimerObserver* aCd,
+                            TInt aTransferId)
+    {
+    iCd = aCd;
+    iTransferId = aTransferId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferTimerObserver::ConstructL
+// Two-phased constructor.
+// Initialize variables, set parent service and create XML reader.
+// -----------------------------------------------------------------------------
+//
+void CUpnpFileTransferTimerObserver::ConstructL()
+{
+    iEventTimer = CUpnpNotifyTimer::NewL( this );
+    iEventTimer->After( KFileTransferStorageTime, EFalse );
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferTimerObserver::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransferTimerObserver* CUpnpFileTransferTimerObserver::NewLC(
+                                MUpnpFileTransferTimerObserver* aCd, TInt aTransferId )
+{
+    CUpnpFileTransferTimerObserver* self = 
+    new (ELeave) CUpnpFileTransferTimerObserver( aCd, aTransferId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferTimerObserver destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransferTimerObserver::~CUpnpFileTransferTimerObserver()
+{
+    if ( iEventTimer )
+    {
+        iEventTimer->Cancel();
+    }
+    delete iEventTimer;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferTimerObserver::TimerEventL
+//  implements MUpnpNotifyTimerObserver interface.
+// -----------------------------------------------------------------------------
+//
+void CUpnpFileTransferTimerObserver::TimerEventL( 
+                              CUpnpNotifyTimer* aTimer
+                              )
+{
+    if (aTimer == iEventTimer )
+    {
+       iCd->TransferEvent(this);
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpFileTransferTimerObserver::TransferId
+//  implements MUpnpNotifyTimerObserver interface.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpFileTransferTimerObserver::TransferId()
+{
+    return iTransferId;
+}
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpfilterelement.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,121 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpfilterelement.h"
+#include "upnpcontentdirectoryglobals.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpFilterElement::CUpnpFilterElement
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpFilterElement::CUpnpFilterElement()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpFilterElement::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpFilterElement::ConstructL()
+{
+    iAttributes = new (ELeave) CDesC8ArrayFlat(KDefaultGranularity);
+}
+// -----------------------------------------------------------------------------
+// CUpnpFilterElement::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpFilterElement* CUpnpFilterElement::NewLC()
+{
+    CUpnpFilterElement* self = new( ELeave ) CUpnpFilterElement;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpFilterElement::~CUpnpFilterElement
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpFilterElement::~CUpnpFilterElement()
+{
+    delete iAttributes;
+    delete iElementName;
+}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpFilterElement::Element
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CUpnpFilterElement::ElementName() const
+{
+    return *iElementName;
+}
+// -----------------------------------------------------------------------------
+// CUpnpFilterElement::AppendAttributeL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpFilterElement::AppendAttributeL( const TDesC8& aAttrName )
+{
+    iAttributes->AppendL(aAttrName);
+}
+// -----------------------------------------------------------------------------
+// CUpnpFilterElement::operator[]
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CUpnpFilterElement::operator[](TInt aPos) const
+{
+    return (*iAttributes)[aPos];
+}
+// -----------------------------------------------------------------------------
+// CUpnpFilterElement::Count
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpFilterElement::Count() const
+{
+    return iAttributes->Count();
+}
+// -----------------------------------------------------------------------------
+// CUpnpFilterElement::SetElementNameL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpFilterElement::SetElementNameL( const TDesC8& aElName )
+{
+    delete iElementName;
+    iElementName = NULL;
+    iElementName = aElName.AllocL();
+}
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnplocalstorage.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1060 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Local interface
+ *
+*/
+
+
+// INCLUDE FILES
+#include "upnpcontainer.h"
+#include "upnpitem.h"
+#include "upnpelement.h"
+#include "upnpattribute.h"
+#include "upnpitemlist.h"
+#include "upnpcontainerlist.h"
+#include "upnpbrowsecriteria.h"
+#include "upnplocalstorage.h"
+#include "upnpobjectbean.h"
+#include "upnpelementbean.h"
+#include "upnpattributebean.h"
+#include "upnpelementbean.h"
+#include "upnpmetadatastorage.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpresourcesbean.h"
+#include "upnpcdutils.h"
+#include "upnpstatehandler.h"
+#include "upnpstring.h"
+#include "upnpcontentdirectory.h"
+#include "upnpautodestroyobjectlist.h"
+#include "upnpautodestroyobject.h"
+#include <uriutils.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::CUpnpLocalStorage
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpLocalStorage::CUpnpLocalStorage( CUpnpMetadataStorage* aMetadataStorage )
+    {
+    iMetadataStorage = aMetadataStorage; 
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpLocalStorage* CUpnpLocalStorage::NewLC(
+        CUpnpMetadataStorage* aMetadataStorage )
+    {
+    CUpnpLocalStorage* self = new ( ELeave ) CUpnpLocalStorage( aMetadataStorage );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+    }
+
+CUpnpLocalStorage* CUpnpLocalStorage::NewL(
+        CUpnpMetadataStorage* aMetadataStorage )
+    {
+    CUpnpLocalStorage* self = CUpnpLocalStorage::NewLC( aMetadataStorage );
+    
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+void CUpnpLocalStorage::SetStateHandler( CUpnpStateHandler* aStateHandler )
+    {
+    iStateHandler = aStateHandler;
+    }
+
+// Destructor
+CUpnpLocalStorage::~CUpnpLocalStorage()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::ShareObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::ShareObjectL( CUpnpObject* aObj )
+    {
+    TLex8 lexer( aObj->ParentId() );
+    TPtrC8 parentId = aObj->ParentId();
+    TInt containerId;
+    User::LeaveIfError( lexer.Val( containerId ) );
+    // check parent
+    ValidateContainerL( containerId );
+
+    // start transaction
+    iMetadataStorage->BeginTransactionL();
+
+    TRAPD(err, DoShareObjectL( containerId, aObj ) );
+    if ( err )
+        { // rollback if error
+        iMetadataStorage->RollbackTransactionL();    
+        User::Leave( err );
+        }
+    iMetadataStorage->CommitTransactionL();
+    
+    // eventing
+    if (iStateHandler)
+        {
+        iStateHandler->IncreaseSystemUpdateIdL();     
+        iStateHandler->IncreaseContainerUpdateIdL( parentId );   
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::ShareReferenceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::ShareReferenceL( CUpnpItem* aItem )
+    {	    
+	// check whether container exists and is not restricted
+    TLex8 lexer( aItem->ParentId() );
+    TPtrC8 parentId = aItem->ParentId();
+    TInt containerId;
+    User::LeaveIfError( lexer.Val( containerId ) );
+    
+    ValidateContainerL( containerId );    
+   
+    // if everything is OK -> start transaction
+    iMetadataStorage->BeginTransactionL();
+        
+    TRAPD(err, DoShareReferenceL( containerId, aItem ) );
+    if ( err )
+        { // rollback if error
+        iMetadataStorage->RollbackTransactionL();    
+        User::Leave( err );
+        }
+    iMetadataStorage->CommitTransactionL();
+    
+    // eventing
+    if (iStateHandler)
+        {
+        iStateHandler->IncreaseSystemUpdateIdL();                
+        iStateHandler->IncreaseContainerUpdateIdL( parentId );   
+        }               
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::ShareReferenceListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::ShareReferenceListL( CUpnpItemList* aItemList, 
+											TInt* aExecutionStatus )
+	{
+	//----- firstly - validate all containers upon which references are to be created.
+	for ( TInt i = 0; i < aItemList->ObjectCount(); i++ )
+	    {	    
+	    TLex8 lex((*aItemList)[i]->ParentId());
+	    TInt containerId;
+	    User::LeaveIfError( lex.Val(containerId) );
+	    
+	    ValidateContainerL(containerId);	    
+	    }
+	
+	//----- if containers are OK, do the following ...
+	
+	// varaible used to do the rest of eventing
+	TInt itemCommited=0; 
+	    
+    // start transaction
+    iMetadataStorage->BeginTransactionL();
+    
+    // reset status
+    *aExecutionStatus = 0;
+
+    // for each item in the list ...
+    for ( TInt i = 0; i < aItemList->ObjectCount(); i++ )
+        {               
+        // get parentId field value [upon which 'reference item' will be created]
+        TLex8 lexer((*aItemList)[i]->ParentId());
+        TInt parentId = -1;
+        User::LeaveIfError( lexer.Val(parentId) );            
+                     
+        // commit every KCommitEveryNum inserts 
+        if ( !(i%KCommitEveryNum) ) 
+            {
+            // ignore if i == 0;
+            if ( i )
+                {
+                itemCommited=0;
+                // commit last transaction
+                iMetadataStorage->CommitTransactionL();
+               
+                // success - update status
+                *aExecutionStatus = i;
+                if ( iStateHandler )
+                    {                                          
+                    for ( TInt j = 0; j < KCommitEveryNum; j++ )
+                        {
+                        iStateHandler->IncreaseSystemUpdateIdL();    
+                        iStateHandler->IncreaseContainerUpdateIdL( ( (*aItemList)[j]->ParentId() ) );    
+                        }                       
+                    }
+                   // begin new transaction
+                   iMetadataStorage->BeginTransactionL();                   
+                }
+            }
+        
+        // insert object
+        CUpnpObject* object = ( *aItemList )[i];
+        CUpnpItem* item = dynamic_cast<CUpnpItem*>( object );
+        
+        TRAPD( err, DoShareReferenceL( parentId, item ) );
+        if ( err )
+            { // rollback if error
+            iMetadataStorage->RollbackTransactionL();    
+            User::Leave(err);
+            }
+        itemCommited++;
+        }
+    
+        // commit
+        iMetadataStorage->CommitTransactionL();
+        
+        // success - update status
+        *aExecutionStatus = aItemList->ObjectCount();
+       
+        //eventing
+        if ( iStateHandler )
+            {
+            // do the rest of eventing if number of items were greater than KCommitEveryNum
+            for ( TInt j = 0; j < itemCommited; j++ ) 
+                {
+                iStateHandler->IncreaseSystemUpdateIdL();     
+                iStateHandler->IncreaseContainerUpdateIdL( ( ( *aItemList )[j]->ParentId() ) );    
+                }            
+            }			
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::UnshareItemL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::UnshareItemL( TInt aId )
+    {
+    // check id
+    ValidateItemL( aId );
+    HBufC8* containerId = HBufC8::NewLC( KMaxIntegerLen );
+    TInt containerIdInt = iMetadataStorage->GetParentIdL( aId );
+    if ( containerIdInt == KErrGeneral )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    containerId->Des().Num( containerIdInt );
+        
+    if (aId <= KDownloadContId)
+        {
+        User::Leave( KErrArgument );
+        }
+    RArray<TInt> refList;
+    CleanupClosePushL(refList);
+    if ( iMetadataStorage->DeleteObjectL( aId, refList, ETrue, ETrue ) == ENoSuchObject )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // eventing
+    if ( iStateHandler )
+        {
+        TBuf8<KMaxIntegerLen> parentRefID;
+        iStateHandler->IncreaseSystemUpdateIdL();     
+        iStateHandler->IncreaseContainerUpdateIdL( *containerId );
+        for (TInt i(0);i<refList.Count();i++)
+            {
+            iStateHandler->IncreaseSystemUpdateIdL();                
+            parentRefID.Num( refList[i] );     
+            iStateHandler->IncreaseContainerUpdateIdL( parentRefID );
+            }
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( &refList );
+    CleanupStack::PopAndDestroy( containerId );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::UnshareContainerL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::UnshareContainerL( TInt aId )
+    {
+    // check id
+    ValidateContainerL( aId );
+    HBufC8* containerId = HBufC8::NewLC( KMaxIntegerLen );
+    containerId->Des().Num(iMetadataStorage->GetParentIdL( aId ) );
+        
+    if ( aId <= KDownloadContId )
+        {
+        User::Leave( KErrArgument );
+        }
+    RArray<TInt> refList;
+    CleanupClosePushL(refList);    
+    if ( iMetadataStorage->DeleteObjectL( aId,refList, ETrue, ETrue ) == ENoSuchObject )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    // eventing
+    if ( iStateHandler )
+        {            
+        iStateHandler->IncreaseSystemUpdateIdL();     
+        iStateHandler->IncreaseContainerUpdateIdL( *containerId );
+        TBuf8<KMaxIntegerLen> parentRefID;    
+        for (TInt i(0);i<refList.Count();i++)
+            {
+            parentRefID.Num( refList[i] );                 
+            if ( containerId->Compare( parentRefID ) )
+                {
+                iStateHandler->IncreaseSystemUpdateIdL();                           
+                iStateHandler->IncreaseContainerUpdateIdL( parentRefID );   
+                }            
+            }
+        refList.Reset();
+        }
+    CleanupStack::PopAndDestroy( &refList );
+    CleanupStack::PopAndDestroy( containerId );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::GetSharedItemL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpItem* CUpnpLocalStorage::GetSharedItemL( TInt aItemId )
+    {
+    // new item
+    CUpnpItem* item = CUpnpItem::NewL();
+    CleanupStack::PushL( item );
+    
+    // get object
+    GetObjectL( aItemId, item );
+    
+    // clean up
+    CleanupStack::Pop( item );
+    
+    return item;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::ShareItemListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::ShareItemListL(CUpnpItemList* aItemList,
+        TInt* aExecutionStatus )
+    {
+    TInt itemCommited=0;
+    // check parent    
+    TLex8 lexer((*aItemList)[0]->ParentId());
+    TInt parentId;
+    User::LeaveIfError( lexer.Val(parentId) );
+    ValidateContainerL(parentId);
+    
+      // start transaction
+       iMetadataStorage->BeginTransactionL();
+       // reset status
+       *aExecutionStatus = 0;
+
+    // for each item
+    for ( TInt i = 0; i < aItemList->ObjectCount(); i++ )
+        {
+        // commit every KCommitEveryNum inserts
+        if ( !(i%KCommitEveryNum) ) 
+            {
+            // ignore if i == 0;
+            if ( i )
+                {
+                itemCommited=0;
+                // commit last transaction
+                iMetadataStorage->CommitTransactionL();
+               
+                // success - update status
+                *aExecutionStatus = i;
+                if ( iStateHandler )
+                    {                                          
+                    for ( TInt j =0; j<KCommitEveryNum; j++ )
+                        {
+                        iStateHandler->IncreaseSystemUpdateIdL();    
+                        iStateHandler->IncreaseContainerUpdateIdL( ( (*aItemList)[0]->ParentId() ) );    
+                        }                       
+                    }
+                   // begin new transaction
+                   iMetadataStorage->BeginTransactionL();                   
+                }
+            }
+        
+        // insert object
+        TRAPD( err, DoShareObjectL( parentId, ( *aItemList )[i]) );
+        if ( err )
+            { // rollback if error
+            iMetadataStorage->RollbackTransactionL();    
+            User::Leave(err);
+            }
+        itemCommited++;
+        }
+    
+        // commit
+        iMetadataStorage->CommitTransactionL();
+        // success - update status
+        *aExecutionStatus = aItemList->ObjectCount();
+       
+        //eventing
+        if ( iStateHandler )
+            {
+            for ( TInt j =0; j<itemCommited; j++ )
+                {
+                iStateHandler->IncreaseSystemUpdateIdL();     
+                iStateHandler->IncreaseContainerUpdateIdL( ( ( *aItemList )[0]->ParentId() ) );    
+                }            
+            }                       
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::ValidateContainerL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::ValidateContainerL( TInt aContainerId )
+    {
+    if ( !iMetadataStorage->IsContainerL( aContainerId ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::ValidateItemL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::ValidateItemL( TInt aItemId )
+    {
+    if ( iMetadataStorage->IsContainerL( aItemId ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::UnshareItemListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::UnshareItemListL( RArray<TInt>& aObjList, 
+                                          TInt* aExecutionStatus )
+    {
+    // list of resources
+    RArray<TInt> refList;
+    RArray<TInt> resList;
+    RArray<TInt> objCommitedList;
+    CleanupClosePushL(objCommitedList);
+    CleanupClosePushL(resList);
+    CleanupClosePushL(refList);
+    TInt parentId(0);
+    // start transaction
+    iMetadataStorage->BeginTransactionL();
+    // reset status
+    *aExecutionStatus = 0;
+
+    // for each item
+    for (TInt i = 0; i < aObjList.Count(); i++ )
+        {
+        parentId = iMetadataStorage->GetParentIdL( aObjList[i] );
+        if ( parentId>=0 )
+            {
+            objCommitedList.Append(parentId);
+            // commit every KCommitEveryNum inserts
+            if( !( i%KCommitEveryNum ) ) 
+                {
+                // ignore if i == 0;
+                if ( i )
+                    {                
+                    // commit last transaction
+                    iMetadataStorage->CommitTransactionL();
+
+                    // everything went OK, delete files
+                    iMetadataStorage->DeleteResourcesL(resList);
+                    resList.Reset();
+                   
+                    // success - update status
+                    *aExecutionStatus = i;
+                   
+                    // eventing
+                    if (iStateHandler)
+                        {                   
+                        for (TInt j =0;j<objCommitedList.Count();j++)
+                            {
+                            iStateHandler->IncreaseSystemUpdateIdL();
+                             TBuf8<KMaxIntegerLen> containerId;                       
+                            containerId.Num( objCommitedList[j] );
+                            iStateHandler->IncreaseContainerUpdateIdL( containerId );                    
+                            }
+                        objCommitedList.Reset();
+                        TBuf8<KMaxIntegerLen> parentRefID;    
+                           for ( TInt i(0); i<refList.Count(); i++ )
+                            {   
+                            iStateHandler->IncreaseSystemUpdateIdL();                
+                            parentRefID.Num( refList[i] );     
+                            iStateHandler->IncreaseContainerUpdateIdL( parentRefID );
+                            }
+                        refList.Reset();
+                        }                                    
+                
+                    // begin new transaction
+                    iMetadataStorage->BeginTransactionL();
+                    }
+                }
+        
+        // insert object
+        TRAPD( err, iMetadataStorage->DoDeleteObjectL( aObjList[i],refList, resList,
+                                                       ETrue, ETrue) );
+        if ( err )
+            { // rollback if error
+            iMetadataStorage->RollbackTransactionL();    
+            User::Leave(err);
+                }
+            }
+        }
+
+    // commit
+    iMetadataStorage->CommitTransactionL();
+
+    // everything went OK, delete files
+    iMetadataStorage->DeleteResourcesL( resList );
+
+    // success - update status
+    *aExecutionStatus = objCommitedList.Count();
+
+    // eventing       
+    if ( iStateHandler )
+       {
+       for ( TInt j =0; j<objCommitedList.Count(); j++ )
+            {
+            if ( objCommitedList[j]>=0 )
+                {                    
+                TBuf8<KMaxIntegerLen> containerId;      
+                containerId.Num(objCommitedList[j]);
+                iStateHandler->IncreaseSystemUpdateIdL();
+                iStateHandler->IncreaseContainerUpdateIdL( containerId );               
+                }  
+            }   
+        objCommitedList.Reset(); 
+        TBuf8<KMaxIntegerLen> parentRefID;    
+        for ( TInt i(0); i<refList.Count(); i++ )
+            {
+            iStateHandler->IncreaseSystemUpdateIdL();                
+            parentRefID.Num( refList[i] );     
+            iStateHandler->IncreaseContainerUpdateIdL( parentRefID );
+            }
+        refList.Reset();
+       }
+                                                               
+    // clean up
+    CleanupStack::PopAndDestroy( &refList );
+    CleanupStack::PopAndDestroy( &resList );
+    CleanupStack::PopAndDestroy( &objCommitedList );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::GetItemListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::GetItemListL(TInt aContainerId,
+        CUpnpBrowseCriteria* aBrowseCriteria, TInt* aTotalMatches,
+        CUpnpItemList* aItemList )
+    {
+    // filter
+    TBool all = aBrowseCriteria->Filter().Length();
+
+    // get children ids
+    RArray<TInt> items;
+    CleanupClosePushL( items );
+    if ( iMetadataStorage->GetItemListL( aContainerId, items ) == ENoSuchObject || !items.Count() )
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    // total matches
+    *aTotalMatches = items.Count();
+
+    // add wanted children
+    for ( TInt i = aBrowseCriteria->StartingIndex();
+          i < *aTotalMatches  && 
+          i < aBrowseCriteria->StartingIndex() 
+          + aBrowseCriteria->RequestedCount() ; 
+          i++ 
+        )
+        {
+        // new item
+        CUpnpItem* item = CUpnpItem::NewL();
+        CleanupStack::PushL(item);
+
+        // get object
+        GetObjectL(items[i], item, all);
+        aItemList->AppendObjectL(*item);
+
+        // pop item
+        CleanupStack::Pop(item);
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy(&items);
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::GetContainerListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::GetContainerListL(TInt aContainerId,
+        CUpnpBrowseCriteria* aBrowseCriteria, TInt* aTotalMatches,
+        CUpnpContainerList* aList )
+    {
+    // filter
+    TBool all = aBrowseCriteria->Filter().Length();
+
+    // get children ids
+    RArray<TInt> contrs;
+    CleanupClosePushL( contrs );
+    if( iMetadataStorage->GetContainerListL( aContainerId, contrs ) == ENoSuchObject )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // total matches
+    *aTotalMatches = contrs.Count();
+
+    // add wanted children
+    for ( TInt i = aBrowseCriteria->StartingIndex();
+          i < *aTotalMatches  && 
+          i < aBrowseCriteria->StartingIndex() 
+          + aBrowseCriteria->RequestedCount() ; 
+          i++ 
+        )
+        {
+        // new item
+        CUpnpContainer* contr = CUpnpContainer::NewL();
+        CleanupStack::PushL( contr );
+
+        // get object
+        GetObjectL( contrs[i], contr, all );
+        aList->AppendObjectL( *contr );
+
+        // pop item
+        CleanupStack::Pop( contr );
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( &contrs );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::GetSingleContainerL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpContainer* CUpnpLocalStorage::GetSingleContainerL(TInt aContainerId )
+    {
+    // new item
+    CUpnpContainer* cont = CUpnpContainer::NewL();
+    CleanupStack::PushL(cont);
+
+    // get object
+    GetObjectL( aContainerId, cont );
+
+    // clean up
+    CleanupStack::Pop( cont );
+
+    return cont;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::CreateObjectBeanLC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpObjectBean* CUpnpLocalStorage::CreateObjectBeanLC(CUpnpObject* aItem )
+    {
+    CUpnpObjectBean* objBn = CUpnpObjectBean::NewLC();
+
+    // restricted
+    objBn->SetObjRestricted( aItem->Restricted() );
+
+    // searchable
+    objBn->SetObjSearchable( ETrue );
+
+    // class
+    objBn->SetObjClassL( aItem->ObjectClass() );
+
+    // title
+    objBn->SetObjTitleL( aItem->Title() );
+
+    return objBn;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::CreateElementBeanLC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpElementBean* CUpnpLocalStorage::CreateElementBeanLC(CUpnpElement& aElement )
+    {
+    CUpnpElementBean* elmBn = CUpnpElementBean::NewLC();
+
+    // name
+    elmBn->SetElmNameL( aElement.Name() );
+
+    // value
+    elmBn->SetElmValueL( aElement.Value() );
+
+    // is required
+    elmBn->SetElmIsRequired( aElement.IsRequired() );
+
+    TBool hasAttribute = aElement.GetAttributes().Count() > 0;
+    elmBn->SetElmHasAttribute( hasAttribute );
+    return elmBn;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::CreateAttributeBeanLC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpAttributeBean* CUpnpLocalStorage::CreateAttributeBeanLC(
+        CUpnpAttribute& aAttr )
+    {
+    CUpnpAttributeBean* atrBn = CUpnpAttributeBean::NewLC();
+    
+    // name
+    atrBn->SetAtrNameL( aAttr.Name() );
+    
+    // value
+    atrBn->SetAtrValueL( aAttr.Value() );
+    
+    // set required
+    if ( aAttr.Name() == KprotocolInfo )
+        {
+        atrBn->SetAtrIsRequired( ETrue );
+        }
+    
+    return atrBn;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::DoShareItemL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::DoShareObjectL(TInt aContainer, CUpnpObject* aObject )
+    {
+
+    // object table
+    CUpnpObjectBean* objBn = CreateObjectBeanLC( aObject );
+    TInt objId = iMetadataStorage->InsertIntoObjectTableL( aContainer, objBn );
+    CleanupStack::PopAndDestroy( objBn );
+
+    // set id
+    HBufC8* id = HBufC8::NewLC( KMaxIntegerLen );
+    id->Des().Num( objId );    
+    aObject->SetIdL( *id );
+    CleanupStack::PopAndDestroy( id ); 
+
+    // add resources
+    HandleResourcesL( aObject );
+
+    // elements
+    const RUPnPElementsArray& elms = aObject->GetElements ( );
+    TInt elmId = iMetadataStorage->GetNextKeyL(KElementTableName8,elms.Count());
+    for (TInt i = 0; i < elms.Count ( ); i++ )
+        {
+        CUpnpElementBean* elm = CreateElementBeanLC( *elms[i] );
+        iMetadataStorage->InsertIntoElementTableL( objId, elm, elmId );
+        CleanupStack::PopAndDestroy( elm );
+
+        // attributes
+        const RUPnPAttributesArray& attrs = elms[i]->GetAttributes ( );
+        TInt atrId = iMetadataStorage->GetNextKeyL( KAttributeTableName8, attrs.Count() );
+        for( TInt j = 0; j < attrs.Count(); j++ )
+            {
+            CUpnpAttributeBean* attr = CreateAttributeBeanLC (*attrs[j] );
+            iMetadataStorage->InsertIntoAttributeTableL(elmId, attr, objId,atrId);
+            atrId++;
+            CleanupStack::PopAndDestroy (attr );
+            }
+        elmId++;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::DoShareReferenceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::DoShareReferenceL( TInt aContainerId, CUpnpItem* aRefItem ) 
+	{    			
+    // prepare for a while main object to get some data from it
+    CUpnpItem* mainObj = CUpnpItem::NewL();
+    CleanupStack::PushL( mainObj );
+    
+	TLex8 lexer( aRefItem->RefId() );
+	TInt mainObjId;
+	User::LeaveIfError(lexer.Val(mainObjId));
+
+	// try to get 'real object', not e.g reference to reference
+	mainObjId = ReferedObjectIdL( mainObjId );
+	
+	// set new refID, pointing onto real object
+	TBuf8<KMaxIntegerLen> newRefIdBuf;
+    newRefIdBuf.Num( mainObjId );               
+    aRefItem->SetRefIdL( newRefIdBuf );
+	// get all data from main object
+    GetObjectL( mainObjId, mainObj ); 
+    
+    // setting: title and class in reference object, basing on info from main object 
+    aRefItem->SetTitleL( mainObj->Title() );
+    aRefItem->SetObjectClassL( mainObj->ObjectClass() );
+    
+    CleanupStack::PopAndDestroy( mainObj );
+                                 
+    // setting 'restricted' field
+    aRefItem->SetRestricted(EFalse);    
+                  
+    // creating new 'object bean' basing on 'reference object' 
+    CUpnpObjectBean* refBn = CreateObjectBeanLC( aRefItem );        
+    refBn->SetObjRefId( mainObjId ); 
+    refBn->SetObjParentId( aContainerId );
+    
+    // inserting newly created reference object onto 'object table'
+    TInt id = iMetadataStorage->InsertIntoObjectTableL( aContainerId, refBn );
+    CleanupStack::PopAndDestroy( refBn );                   
+    
+    // setting new id in created reference object     
+	TBuf8<KMaxIntegerLen> idBuf;
+    idBuf.Num( id );               
+    aRefItem->SetIdL( idBuf );
+    }	    
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::HandleResourcesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::HandleResourcesL(CUpnpObject* aItem )
+    {
+    //
+    const RUPnPElementsArray& elms = aItem->GetElements();
+    for ( TInt i = 0; i < elms.Count(); i++ )
+        {
+        if ( elms[i]->Name() == KRes )
+            {
+
+            // get file name
+            TParse fp;
+            fp.Set( elms[i]->FilePath(), 0, 0 );
+
+            TPtrC8 itemId = aItem->Id();
+            HBufC8* contUri = UpnpCdUtils::BuildContentUriL(
+                    iMetadataStorage->GetNextKeyL( KImportUriId8 ), fp.Ext(), 
+                    itemId );
+            CleanupStack::PushL(contUri);
+
+            // add resource to the database
+            CUpnpResourcesBean* resBn = CUpnpResourcesBean::NewLC();
+            resBn->SetId( UpnpCdUtils::ResIdFromUriL( *contUri ) );
+            resBn->SetPathL( elms[i]->FilePath() );
+            resBn->SetIsReadonly( ETrue );
+            resBn->SetIsThumbnail( EFalse );
+
+            TInt objectId;
+            TLex8 lexer( aItem->Id() );
+            User::LeaveIfError( lexer.Val( objectId ) );
+            iMetadataStorage->AddResourceL( resBn, objectId );
+
+            // update object
+            HBufC8* uri = ValAsUriL( *contUri );
+            CleanupStack::PushL( uri );
+            elms[i]->SetValueL( *uri );
+            CleanupStack::PopAndDestroy( uri );
+            CleanupStack::PopAndDestroy( resBn );
+            CleanupStack::PopAndDestroy( contUri );
+            }
+
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::GetObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::GetObjectL( TInt aObjId, CUpnpObject* aObj, TBool aAll )
+    {
+    // get view
+    RDbView view = iMetadataStorage->GetObjViewL( aObjId );
+    CleanupClosePushL( view );
+    
+    if ( view.FirstL() )
+        {
+        // get row
+        view.GetL(); 
+
+        // create bean
+        CUpnpObjectBean* objBn = CUpnpObjectBean::NewLC( view );
+        
+        // add values
+        objBn->CopyToUpnpObjectL( aObj );
+        
+        if ( aAll )
+            { // add elements
+            AddElementsL( aObjId, aObj );
+            }
+        
+        CleanupStack::PopAndDestroy( objBn );
+        } 
+    else
+        { // no such object
+        User::Leave( KErrNotFound );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::AddElementsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpLocalStorage::AddElementsL( TInt aObjectID, CUpnpObject* aObj )
+    {
+    RDbView view = iMetadataStorage->GetElementsViewL( aObjectID, ETrue );
+    CleanupClosePushL( view );
+    // Iterate through elements
+    while( view.NextL() )
+        {
+        view.GetL();
+        CUpnpElementBean* elBean = CUpnpElementBean::NewLC( view );
+        
+        // add new element
+        CUpnpElement* elm = elBean->AttachElmL( aObj );
+        
+        // add attributes
+        AddAttributesL( elBean->ElmId(), elm );
+        
+        if( elBean->ElmName() == KRes && 
+            elBean->ElmValue().Length() ) // ignore if empty res
+            { // add file path
+            CUpnpResourcesBean* resBn =     
+                iMetadataStorage->GetResourceL(
+                    UpnpCdUtils::ResIdFromUriL( elBean->ElmValue() ) );
+            CleanupStack::PushL(resBn);
+            
+            // set file path
+            elm->SetFilePathL( resBn->Path() );
+            
+            CleanupStack::PopAndDestroy( resBn );
+            }
+        
+        // clean up
+        CleanupStack::PopAndDestroy( elBean );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpElementBean::ValAsUriL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpLocalStorage::ValAsUriL( const TDesC8& aElmValue ) const 
+    {    
+    // uris have to be properly escaped
+    HBufC8* uriDes = NULL;
+    HBufC* tmp = UpnpCdUtils::Des8ToDesLC( aElmValue );        
+    TUriParser uripar;
+    uripar.Parse( *tmp );
+    CUri8* uri = uri = UriUtils::ConvertToInternetFormL( uripar );             
+    CleanupStack::PopAndDestroy( tmp );          
+    CleanupStack::PushL(uri); 
+    if ( uri->Uri().UriDes().Length() )
+        {                
+        uriDes = UpnpString::StringReplaceL( uri->Uri().UriDes(), KHash8, KHashASCII8 );                                                       
+        }
+    else
+        {
+        uriDes = uri->Uri().UriDes().AllocL();    
+        }    
+    CleanupStack::PopAndDestroy( uri );                
+    return uriDes;        
+    }
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::AddAttributesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+void CUpnpLocalStorage::AddAttributesL( TInt aElmId, CUpnpElement* aElm )
+    {
+    RDbView view = iMetadataStorage->GetAttributesViewL( aElmId, ETrue );
+    CleanupClosePushL(view);
+
+    // Iterate through attributes
+    while ( view.NextL() )
+        {
+        view.GetL();
+        CUpnpAttributeBean* atr = CUpnpAttributeBean::NewLC( view );
+        atr->AttachAttrL( aElm );
+        CleanupStack::PopAndDestroy( atr );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpLocalStorage::ReferedObjectIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpLocalStorage::ReferedObjectIdL(TInt aObjectId)
+{
+    TInt ret = KErrNotFound;
+    
+    TInt refId = iMetadataStorage->ReferedObjectIdL(aObjectId);
+    
+    if( refId != KErrNotFound )
+    {
+        ret = ReferedObjectIdL( refId );
+    }
+    else
+    {
+        ret = aObjectId;
+    }
+
+    return ret;
+}
+
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpmapbase.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,117 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content Directory
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "upnpmapbase.h"
+
+// -----------------------------------------------------------------------------
+// CUpnpMapBase::CUpnpMapBase
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpMapBase::CUpnpMapBase()
+{      
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapBase::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMapBase::ConstructL()
+{
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapBase::Get
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TAny* CUpnpMapBase::Get(const TDesC8& aKey)
+{
+    CUpnpMapElement* mapElement = iFirst;
+    TAny* buf = NULL;
+    while(mapElement != 0)
+    {
+        if(mapElement->Key() == aKey)
+        {
+            buf = mapElement->Value();
+            break;
+        }
+        mapElement = mapElement->Next();
+    }
+    return buf;
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapBase::PutL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMapBase::PutL(const TDesC8& aKey, TAny* aValue)
+{
+    CUpnpMapElement* newEl = CUpnpMapElement::NewL(aKey, aValue);
+    newEl->SetNext(iFirst);
+    iFirst = newEl;
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapBase::Remove
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TAny* CUpnpMapBase::Remove(const TDesC8& aKey)
+{
+    if( !iFirst ) // empty map
+    {
+        return NULL;
+    }
+
+    TAny* removed = NULL;
+
+    // if first element to be removed
+    if( iFirst->Key() == aKey )
+    {
+        // remove first element
+        removed = iFirst->Value();
+        CUpnpMapElement* next = iFirst->Next();
+        delete iFirst;
+        iFirst = next;
+    }
+    else
+    {   
+        CUpnpMapElement* prevElement = iFirst;
+        CUpnpMapElement* element = iFirst->Next();
+        while(element != 0)
+        {
+            if( element->Key() == aKey )
+            {
+                prevElement->SetNext( element->Next() );
+                removed = element->Value();
+                delete element;
+                break;
+            }
+            else
+            {
+                prevElement = element;
+                element = element->Next();
+            }
+        }
+    }
+    return removed;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpmapelement.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,114 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include"upnpmapelement.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpMapElement::CUpnpMapElement
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpMapElement::CUpnpMapElement(TAny* aValue)
+{
+    iValue = aValue;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpMapElement::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMapElement::ConstructL(const TDesC8& aKey)
+{
+    iKey = aKey.AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapElement::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMapElement* CUpnpMapElement::NewLC(const TDesC8& aKey, TAny* iItem)
+{
+    CUpnpMapElement* self = new( ELeave ) CUpnpMapElement(iItem);
+    CleanupStack::PushL( self );
+    self->ConstructL(aKey);
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapElement::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMapElement* CUpnpMapElement::NewL(const TDesC8& aKey, TAny* iItem)
+{
+    CUpnpMapElement* self = CUpnpMapElement::NewLC(aKey, iItem);
+    CleanupStack::Pop(self);
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapElement::~CUpnpMapElement
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpMapElement::~CUpnpMapElement()
+{
+    delete iKey; 
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapElement::Key
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CUpnpMapElement::Key()
+{
+    return *iKey;
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapElement::Item
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TAny* CUpnpMapElement::Value()
+{
+    return iValue;
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapElement::Next
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpMapElement* CUpnpMapElement::Next()
+{
+    return iNext;
+}
+// -----------------------------------------------------------------------------
+// CUpnpMapElement::SetNext
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMapElement::SetNext(CUpnpMapElement* aNext)
+{
+    iNext = aNext;
+}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpmetadatastorage.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,2353 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Metadata storage
+ *
+*/
+
+
+// INCLUDE FILES
+#include <upnpdominterface.h>
+#include "upnpmetadatastorage.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpobjectbean.h"
+#include "upnpelementbean.h"
+#include "upnpcdutils.h"
+#include "upnpresourcesbean.h"
+#include "upnpitem.h"
+#include "upnpelement.h"
+#include "upnpattributebean.h"
+#include "upnpcddbfactory.h"
+
+#define KLogFile _L("ContentDirectoryDb.log")
+#include "upnpcustomlog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::CUpnpMetadataStorage
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpMetadataStorage::CUpnpMetadataStorage()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::ConstructL( const TDesC& aDatabaseFileName )
+    {
+    User::LeaveIfError( iFsSession.Connect( ) );
+    OpenDbL( aDatabaseFileName );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMetadataStorage* CUpnpMetadataStorage::NewLC(
+    const TDesC& aDatabaseFileName )
+    {
+    CUpnpMetadataStorage* self = new( ELeave ) CUpnpMetadataStorage();
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aDatabaseFileName );
+
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMetadataStorage* CUpnpMetadataStorage::NewL(
+    const TDesC& aDatabaseFileName )
+    {
+    CUpnpMetadataStorage* self =
+            CUpnpMetadataStorage::NewLC( aDatabaseFileName );
+
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::~CUpnpMetadataStorage
+// Destructor
+// -----------------------------------------------------------------------------
+//    
+CUpnpMetadataStorage::~CUpnpMetadataStorage()
+    {
+    if ( iIsOpen )
+        {
+        iDatabase.Compact( );
+        }
+    iDatabase.Close( );
+    delete iFileStore;
+    iFsSession.Close( );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::OpenDbL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::OpenDbL( const TFileName& aDatabaseFileName )
+    {
+    iFileStore = CPermanentFileStore::OpenL( iFsSession, aDatabaseFileName,
+        EFileRead|EFileWrite );
+    iFileStore->SetTypeL( iFileStore->Layout( ) );
+    iDatabase.OpenL( iFileStore, iFileStore->Root( ) );
+    CheckDatabaseL( );
+    iIsOpen = ETrue;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DbChangedL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::DbChangedL( TInt aWeight )
+    {
+    iCompactCounter += aWeight;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DbChangedL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::CompactDbL()
+    {
+    if ( iCompactCounter >= KCompactWeight )
+        {
+        iCompactCounter = 0;
+        User::LeaveIfError( iDatabase.Compact( ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::BeginTransactionL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::BeginTransactionL()
+    {
+    iDatabase.Begin( );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::CommitTransactionL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::CommitTransactionL()
+    {
+    TInt err = iDatabase.Commit( );
+    if ( err != KErrNone )
+        {
+        iDatabase.Rollback( );
+        User::LeaveIfError( iDatabase.Recover( ) );
+        User::Leave( err );
+        }
+    CompactDbL( );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::RollbackTransactionL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::RollbackTransactionL()
+    {
+    iDatabase.Rollback( );
+    User::LeaveIfError( iDatabase.Recover( ) );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetObjectListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpMetadataStorage::GetObjectListL( TInt aParentId,
+    RArray<TInt>& aList )
+    {
+    TUpnpErrorCode ret = CheckObjectRestrictionL( aParentId ); // make sure the parent exists
+    if ( ret != ENoSuchObject && ret != ENoContainer )
+        {
+        // prepare query
+        TBuf<sizeof(KGetObjectListSqlCmd)/KCharSize + KMaxIntegerLen> query;
+        query.Format( KGetObjectListSqlCmd, aParentId );
+        // prepare view
+        RDbView view;
+        User::LeaveIfError( view.Prepare( iDatabase, TDbQuery( query ),
+            view.EReadOnly ) );
+        CleanupClosePushL( view );
+        // evaluate
+        User::LeaveIfError( view.EvaluateAll( ) );
+        // for each object
+        const TInt KIdColNo=1;
+
+        while ( view.NextL( ) )
+            {
+            view.GetL( );
+            // get object
+            TInt childId = view.ColInt( KIdColNo );
+            aList.AppendL( childId );
+            }
+        //clean up
+        CleanupStack::PopAndDestroy( &view );
+        ret = EUpnpOk;
+        }
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetObjectListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpMetadataStorage::GetItemListL( TInt aParentId,
+    RArray<TInt>& aList )
+    {
+    TUpnpErrorCode ret = CheckObjectRestrictionL( aParentId ); // make sure the parent exists
+    if ( ret != ENoSuchObject )
+        {
+        // prepare query
+        TBuf<sizeof(KGetItemListSqlCmd)/KCharSize + KMaxIntegerLen> query;
+        query.Format( KGetItemListSqlCmd, aParentId );
+        // prepare view
+        RDbView view;
+        User::LeaveIfError( view.Prepare( iDatabase, TDbQuery( query ),
+            view.EReadOnly ) );
+        CleanupClosePushL( view );
+        // evaluate
+        User::LeaveIfError( view.EvaluateAll( ) );
+        // for each object
+        const TInt KIdColNo=1;
+        while ( view.NextL( ) )
+            {
+            view.GetL( );
+            // get object
+            TInt childId = view.ColInt( KIdColNo );
+            aList.AppendL( childId );
+            }
+        //clean up
+        CleanupStack::PopAndDestroy( &view );
+        ret = EUpnpOk;
+        }
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetContainerListL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpMetadataStorage::GetContainerListL( TInt aParentId,
+    RArray<TInt>& aList )
+    {
+    TUpnpErrorCode ret = CheckObjectRestrictionL( aParentId ); // make sure the parent exists
+    if ( ret != ENoSuchObject )
+        {
+        // prepare query
+        TBuf<sizeof(KGetContainerListSqlCmd)/KCharSize + KMaxIntegerLen> query;
+        query.Format( KGetContainerListSqlCmd, aParentId );
+        // prepare view
+        RDbView view;
+        User::LeaveIfError( view.Prepare( iDatabase, TDbQuery( query ),
+            view.EReadOnly ) );
+        CleanupClosePushL( view );
+        // evaluate
+        User::LeaveIfError( view.EvaluateAll( ) );
+        // for each object
+        const TInt KIdColNo=1;
+        while ( view.NextL( ) )
+            {
+            view.GetL( );
+            // get object
+            TInt childId = view.ColInt( KIdColNo );
+            aList.AppendL( childId );
+            }
+        //clean up
+        CleanupStack::PopAndDestroy( &view );
+        ret = EUpnpOk;
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::CheckObjectRestrictionL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpMetadataStorage::CheckObjectRestrictionL( TInt aObjId )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aObjId);
+    User::LeaveIfError( table.Open( iDatabase, KObjectTableName,
+        table.EReadOnly ) );
+    User::LeaveIfError( table.SetIndex( KObjIdIndexName ) ); // use index
+    if ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+
+        CDbColSet* colSet = table.ColSetL( );
+        TDbColNo colNo(colSet->ColNo( KObjRestrictedColName ) );
+        if ( !table.ColUint8( colNo ) ) // is restricted?
+            { // OK
+            TDbColNo colNo(colSet->ColNo( KObjClassColName ) );
+            if ( table.ColDes8(colNo).Find( KContainerClass8 ) == 0 ) // check whether the object is a container
+                { // this is a container
+                ret = EUpnpOk;
+                }
+            else
+                { // there is such object but this is not a container
+                ret = ENoContainer;
+                }
+            }
+        else
+            {
+            ret = ERestrictedObject;
+            }
+        delete colSet;
+        }
+    else
+        { // no such object
+        ret = ENoSuchObject;
+        }
+
+    CleanupStack::PopAndDestroy( &table );
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::CheckObjectRestrictionL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpMetadataStorage::IsContainerL( TInt aObjId )
+    {
+    TBool ret = EFalse;
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aObjId);
+    User::LeaveIfError( table.Open( iDatabase, KObjectTableName,
+        table.EReadOnly ) );
+    User::LeaveIfError( table.SetIndex( KObjIdIndexName ) ); // use index
+
+    if ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+
+        CDbColSet* colSet = table.ColSetL( );
+        TDbColNo colNo(colSet->ColNo( KObjClassColName ) );
+        if ( table.ColDes8(colNo).Find( KContainerClass8 ) == 0 ) // check whether the object is a container
+            { // this is a container
+            ret = ETrue;
+            }
+        delete colSet;
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &table );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::AddMainTagAttrL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TUpnpErrorCode CUpnpMetadataStorage::AddMainTagAttrL(
+    TXmlEngElement aElement, TInt aId, const TDesC8& aName )
+    {
+    TUpnpErrorCode ret = EUpnpUndefined;
+    // xml string of name
+
+    // is the attr exist?
+    TXmlEngAttr atr = aElement.AttributeNodeL( aName );
+    if ( atr.IsNull( ) )
+        { // attr does not exist - add
+        TBuf<sizeof(KSelectFromObjectSqlCmd)/KCharSize +
+        KMaxIntegerLen + KColNameMaxLenth> query;
+        query.Format( KSelectFromObjectSqlCmd, &aName, aId );
+
+        // Execute command
+        RDbView view;
+        CleanupClosePushL( view );
+        TInt dbErr = view.Prepare( iDatabase, TDbQuery( query ),
+            view.EReadOnly );
+        LOGSQL( "CUpnpContentDirectoryDb::AddMainTagAttrL",
+            "RDbView::Prepare", dbErr, &query );
+        if ( dbErr == KErrNone )
+            {
+            CleanupClosePushL( view );
+            User::LeaveIfError( view.EvaluateAll( ) );
+
+            // if there is a row, add attribute
+            if ( view.FirstL( ) )
+                {
+                // get row
+                view.GetL( );
+                // col's val as Des
+                HBufC8* buff = GetColDesValFromRowSetL( view, 1 );
+                CleanupStack::PushL( buff );
+                // prepare xml string of value
+                // add attributes
+                aElement.AddNewAttributeL( aName, *buff );
+                ret = EUpnpOk;
+                // clean up
+                CleanupStack::PopAndDestroy( buff );
+                }
+            else
+                { // no such object in the database
+                ret = ENoSuchObject;
+                }
+            }
+        else
+            { // probably the name of the attr was wrong - ignore
+            ret = ENoSuchObject;
+            }
+        // clean up
+        CleanupStack::PopAndDestroy( &view );
+        }
+    else // if(!atr.IsNull())
+        { // already exists - it is OK, do not need to do anything
+        ret = EUpnpOk;
+        }
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetElementViewL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+RDbView CUpnpMetadataStorage::GetElementViewL( TInt aObjId,
+    const TDesC8& aElName )
+    {
+    // convert to TDesC
+    HBufC* elName = HBufC::NewLC( aElName.Length( ) );
+    elName->Des().Copy( aElName );
+
+    // Prepare SQL command
+    HBufC* query = HBufC::NewLC( KSelectElmFromElmSqlCmd().Length( ) 
+                                + KNamedElFromElement().Length( ) 
+                                + KMaxIntegerLen 
+                                + elName->Length( ) );
+    TPtr queryPtr(query->Des( ));
+    queryPtr.Format( KSelectElmFromElmSqlCmd, aObjId );
+    queryPtr.AppendFormat( KNamedElFromElement, elName );
+    
+
+    // Execute command
+    RDbView view = GetEvaluatedViewL( queryPtr );
+    LOGSQL( "CUpnpContentDirectoryDb::GetElementViewL", "RDbView::Prepare",
+        0, &queryPtr );
+    CleanupStack::PopAndDestroy( query );
+    CleanupStack::PopAndDestroy( elName );
+
+    return view;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::AddAttributeL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+RDbView CUpnpMetadataStorage::GetObjViewL( TInt aObjId )
+    {
+    // Get data from object table
+    // Prepare SQL command
+    TBuf<sizeof(KSelectObjectFromObjSqlCmd)/KCharSize
+    + KMaxIntegerLen> query;
+    query.Format( KSelectObjectFromObjSqlCmd, aObjId );
+
+    LOGSQL( "CUpnpContentDirectoryDb::GetObjectL", "", 0, &query );
+
+    return GetEvaluatedViewL( query );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::AddAttributeL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::GetElementsViewL( TInt aObjectID, TBool aAll )
+    {
+    // Get data from element table
+    // Prepare SQL command
+    TBuf<sizeof(KSelectElmFromElmSqlCmd)/KCharSize
+    + sizeof(KOnlyRequiredFromElement)/KCharSize + KMaxIntegerLen> query;
+    query.Format( KSelectElmFromElmSqlCmd, aObjectID );
+
+    query.Format( KSelectElmFromElmSqlCmd, aObjectID );
+    if ( !aAll )
+        { // only required properties
+        query.Append( KOnlyRequiredFromElement );
+        }
+
+    LOGSQL( "CUpnpContentDirectoryDb::GetElementsViewL", "", 0, &query );
+
+    return GetEvaluatedViewL( query );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::AddAttributeL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::GetAttributesViewL( TInt aElementID, TBool aAll )
+    {
+    // Get data from element table
+    // Prepare SQL command
+    TBuf<sizeof(KSelectAtrFromAttrSqlCmd)/KCharSize
+    + sizeof(KOnlyRequiredFromAtr)/KCharSize + KMaxIntegerLen> query;
+    query.Format( KSelectAtrFromAttrSqlCmd, aElementID );
+    if ( !aAll )
+        { // only required attr are wanted
+        query.Append( KOnlyRequiredFromAtr );
+        }
+
+    LOGSQL( "CUpnpContentDirectoryDb::GetAttributesViewL", "", 0, &query );
+
+    return GetEvaluatedViewL( query );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetAttributesViewByObjectIdL
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::GetAttributesViewByObjectIdL( TInt aObjectID,
+    TBool aAll )
+    {
+    // Get data from element table
+    // Prepare SQL command
+    TBuf<sizeof(KSelectAtrFromAttrByObjSqlCmd)/KCharSize
+    + sizeof(KOnlyRequiredFromAtr)/KCharSize + KMaxIntegerLen> query;
+    query.Format( KSelectAtrFromAttrByObjSqlCmd, aObjectID );
+    if ( !aAll )
+        { // only required attr are wanted
+        query.Append( KOnlyRequiredFromAtr );
+        }
+
+    LOGSQL( "CUpnpContentDirectoryDb::GetAttributesViewByObjectIdL", "", 0,
+        &query );
+
+    return GetEvaluatedViewL( query );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::InsertElementL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::InsertElementL( const TXmlEngElement& aElement,
+    TInt aObjId )
+    {
+    // open table
+    RDbTable table;
+    User::LeaveIfError( table.Open( iDatabase, KElementTableName,
+        table.EUpdatable ) );
+    CleanupClosePushL( table );
+
+    // CdbColSet
+    CDbColSet* objColSet = table.ColSetL( );
+    CleanupStack::PushL( objColSet );
+
+    // rowset cursor to the beginning position
+    table.Reset( );
+
+    // insert empty row
+    table.InsertL( );
+
+    // elm_id
+    TInt elmId = GetNextKeyL( KElementTableName8 );
+    table.SetColL( objColSet->ColNo( KElmIdColName ), elmId );
+
+    // elm_name
+    HBufC8 * elmName = UpnpCdUtils::GetElmNameWithNsL( aElement );
+    CleanupStack::PushL( elmName );
+    table.SetColL( objColSet->ColNo( KElmNameColName ), *elmName );
+    CleanupStack::PopAndDestroy( elmName );
+
+    // elm_value
+    if ( aElement.Value().Length( ) )
+        {
+        TPtrC8 elmValue(aElement.Value( ) );
+        if ( elmValue.Length( ) > KMaxUpnpLongStringLen )
+            { // too long
+            User::Leave( EActionFailed );
+            }
+        // use write stream
+        RDbColWriteStream ws;
+        ws.OpenLC( table, objColSet->ColNo( KElmValueColName ) );
+        ws.WriteL( elmValue ); // write value
+        ws.CommitL( );
+        CleanupStack::PopAndDestroy( &ws );
+        }
+
+    // elm_has_attribute
+    table.SetColL( objColSet->ColNo( KElmHasAttrColName ),
+        aElement.HasAttributes( ) );
+
+    // elm_obj_id
+    table.SetColL( objColSet->ColNo( KElmObjIdColName ), aObjId );
+
+    // elm_is_required
+    table.SetColL( objColSet->ColNo( KElmIsRequiredColName ),
+        UpnpCdUtils::IsElementRequiredL( aElement ) );
+
+    // complete insertion
+    table.PutL( );
+
+    DbChangedL( KExecuteWeight );
+
+    // clean up
+    CleanupStack::PopAndDestroy( objColSet );
+    CleanupStack::PopAndDestroy( &table );
+
+    return elmId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::CreatePathValL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpMetadataStorage::CreatePathValL( const TXmlEngElement& aElement )
+    {
+    TPtrC8
+            parentIdPtr(UpnpDomInterface::GetAttrValueL( aElement, KParentID ));
+    TLex8 lexer(parentIdPtr);
+    TInt parentId;
+    User::LeaveIfError( lexer.Val( parentId ) );
+
+    return CreatePathValL( parentId );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::CreatePathValL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpMetadataStorage::CreatePathValL( TInt aParentId )
+    {
+    HBufC8* path = NULL;
+    User::LeaveIfNull( path = GetObjectPathL( aParentId ) );
+
+    CleanupStack::PushL( path );
+
+    HBufC8* tmp = HBufC8::NewL( path->Length( ) 
+                                + KPathSeparator().Length( ) 
+                                + KMaxIntegerLen );
+    TPtr8 tmpPtr(tmp->Des( ));
+    tmpPtr.Copy( *path );
+    tmpPtr.Append( KPathSeparator );
+
+    TBuf<KMaxIntegerLen> num;
+    num.Num( aParentId );
+    tmpPtr.Append( num );
+
+    CleanupStack::PopAndDestroy( path );
+
+    return tmp;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::InsertAttributeL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::InsertAttributeL( const TXmlEngAttr aAttr,
+    TInt aElmId, TBool aIsRequired, TInt aObjId )
+    {
+
+    // open table
+    RDbTable table;
+    User::LeaveIfError( table.Open( iDatabase, KAttributeTableName,
+        table.EUpdatable ) );
+    CleanupClosePushL( table );
+
+    // CdbColSet
+    CDbColSet* objColSet = table.ColSetL( );
+    CleanupStack::PushL( objColSet );
+
+    // rowset cursor to the beginning position
+    table.Reset( );
+
+    // insert empty row
+    table.InsertL( );
+
+    // atr_id
+    table.SetColL( objColSet->ColNo( KAtrIdColName ),
+        GetNextKeyL( KAttributeTableName8 ) ); // leaves if error
+
+    // atr_name
+    table.SetColL( objColSet->ColNo( KAtrNameColName ), aAttr.Name( ) ); // name cannot be null
+
+    // atr_value
+    if ( aAttr.Value().Length( ) )
+        {
+        TPtrC8 atrValue(aAttr.Value( ) );
+        if ( atrValue.Length( ) > KMaxUpnpLongStringLen )
+            { // too long
+            User::Leave( EActionFailed );
+            }
+        // use write stream
+        RDbColWriteStream ws;
+        ws.OpenLC( table, objColSet->ColNo( KAtrValueColName ) );
+        ws.WriteL( atrValue ); // write value
+        ws.CommitL( );
+        CleanupStack::PopAndDestroy( &ws );
+        }
+
+    // atr_elm_id
+    table.SetColL( objColSet->ColNo( KAtrElmIdColName ), aElmId );
+
+    // atr_is_required
+    table.SetColL( objColSet->ColNo( KAtrIsRequiredColName ), aIsRequired );
+
+    // atr_obj_id
+    table.SetColL( objColSet->ColNo( KAtrIdObjColName ), aObjId );
+
+    // complete insertion
+    table.PutL( );
+
+    DbChangedL( KExecuteWeight );
+
+    // clean up
+    CleanupStack::PopAndDestroy( objColSet );
+    CleanupStack::PopAndDestroy( &table );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::InsertObjectIntoObjectTableL
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::InsertObjectIntoObjectTableL(
+    const TXmlEngElement& aElement )
+    {
+    // open table
+    RDbTable table;
+    User::LeaveIfError( table.Open( iDatabase, KObjectTableName,
+        table.EUpdatable ) );
+    CleanupClosePushL( table );
+
+    // CdbColSet
+    CDbColSet* objColSet = table.ColSetL( );
+    CleanupStack::PushL( objColSet );
+
+    // rowset cursor to the beginning position
+    table.Reset( );
+
+    // insert empty row
+    table.InsertL( );
+
+    // set attributes
+    RXmlEngNodeList<TXmlEngAttr> attrList;
+    CleanupClosePushL( attrList );
+    aElement.GetAttributes( attrList );
+    while ( attrList.HasNext( ) )
+        {
+        // get next
+        TXmlEngAttr attr = attrList.Next( );
+
+        // col ordinal
+        HBufC* colName = HBufC::NewLC( attr.Name().Length( ) );
+        colName->Des().Copy( attr.Name( ) );
+        TDbColNo colNo = objColSet->ColNo( *colName );
+        CleanupStack::PopAndDestroy( colName );
+
+        // insert if exists
+        if ( colNo != KDbNullColNo )
+            { // (not any string attribute in the main element)
+            HBufC8* tmp = attr.Value().AllocLC( );
+            UpnpCdUtils::ReplaceTrueFalse( tmp );// true -> 1, false -> 0
+            TLex8 lexer(*tmp);
+            TInt num;
+            User::LeaveIfError( lexer.Val( num ) ); // string -> integer
+            // set value
+            table.SetColL( colNo, num );
+            CleanupStack::PopAndDestroy( tmp );
+            }
+        }
+    CleanupStack::Check( &attrList );
+
+    // set title
+    TXmlEngElement objTitle;
+    UpnpDomInterface::GetElementL( aElement, objTitle, KObjTiltleColName8( ) );
+    table.SetColL( objColSet->ColNo( KObjTiltleColName ), objTitle.Value( ) );
+    CleanupStack::Check( &attrList );
+
+    // set class
+    TXmlEngElement objClass;
+    UpnpDomInterface::GetElementL( aElement, objClass, KObjClassColName8( ) );
+    table.SetColL( objColSet->ColNo( KObjClassColName ), objClass.Value( ) );
+    CleanupStack::Check( &attrList );
+
+    // set path
+    HBufC8* path = CreatePathValL( aElement );
+    CleanupStack::PushL( path );
+    table.SetColL( objColSet->ColNo( KObjPathColName ), *path );
+    CleanupStack::PopAndDestroy( path );
+    CleanupStack::Check( &attrList );
+
+    // complete insertion
+    table.PutL( );
+
+    DbChangedL( KExecuteWeight );
+
+    // clean up
+    CleanupStack::PopAndDestroy( &attrList );
+    CleanupStack::PopAndDestroy( objColSet );
+    CleanupStack::PopAndDestroy( &table );
+
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetNextKeyForTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::GetNextKeyL( const TDesC8& aName )
+    {
+    TInt ret = KErrNotFound;
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aName);
+    User::LeaveIfError( table.Open( iDatabase, KSequencesTableName,
+        table.EUpdatable ) );
+    User::LeaveIfError( table.SetIndex( KSeqColNameIndexName ) ); // use index
+    if ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+        CDbColSet* colSet = table.ColSetL( );
+        CleanupStack::PushL( colSet );
+        TDbColNo colNo(colSet->ColNo( KSeqNextKeyColName ) );
+        ret = table.ColInt( colNo );
+        table.UpdateL( );
+        table.SetColL( colNo, ret + 1 );
+        table.PutL( );
+
+        DbChangedL( KExecuteWeight );
+
+        CleanupStack::PopAndDestroy( colSet );
+        }
+    else
+        { // no such object
+        User::Leave( KErrCorrupt );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &table );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetNextKeyForTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::GetNextKeyL( const TDesC8& aName, TInt aAmount )
+    {
+    TInt ret = KErrNotFound;
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aName);
+    User::LeaveIfError( table.Open( iDatabase, KSequencesTableName,
+        table.EUpdatable ) );
+    User::LeaveIfError( table.SetIndex( KSeqColNameIndexName ) ); // use index
+    if ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+        CDbColSet* colSet = table.ColSetL( );
+        CleanupStack::PushL( colSet );
+        TDbColNo colNo(colSet->ColNo( KSeqNextKeyColName ) );
+        ret = table.ColInt( colNo );
+        table.UpdateL( );
+        table.SetColL( colNo, ret + aAmount );
+        table.PutL( );
+
+        DbChangedL( KExecuteWeight );
+
+        CleanupStack::PopAndDestroy( colSet );
+        }
+    else
+        { // no such object
+        User::Leave( KErrCorrupt );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &table );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::NextKeyL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::NextKeyL( const TDesC8& aName )
+    {
+    TInt ret = KErrNotFound;
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aName);
+    User::LeaveIfError( table.Open( iDatabase, KSequencesTableName,
+        table.EReadOnly ) );
+    User::LeaveIfError( table.SetIndex( KSeqColNameIndexName ) ); // use index
+    if ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+        CDbColSet* colSet = table.ColSetL( );
+        CleanupStack::PushL( colSet );
+        TDbColNo colNo(colSet->ColNo( KSeqNextKeyColName ) );
+        ret = table.ColInt( colNo );
+
+        CleanupStack::PopAndDestroy( colSet );
+        }
+    else
+        { // no such object
+        User::Leave( KErrCorrupt );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &table );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::ReferedObjectIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::ReferedObjectIdL( TInt aObjectId )
+    {
+    TInt ret = KErrNotFound;
+    TBuf<sizeof(KSelectFromObjectSqlCmd)/KCharSize
+    + KMaxIntegerLen + KColNameMaxLenth> query;
+    query.Format( KSelectFromObjectSqlCmd, &KObjRefIdColName, aObjectId );
+
+    // Execute command
+    RDbView view;
+    CleanupClosePushL( view );
+    TInt dbErr = view.Prepare( iDatabase, TDbQuery( query ), view.EReadOnly );
+    LOGSQL( "CUpnpContentDirectoryDb::ReferedObjectIdL", "RDbView::Prepare",
+        dbErr, &query );
+    if ( dbErr == KErrNone )
+        {
+        User::LeaveIfError( view.Evaluate( ) );
+        if ( view.FirstL( ) )
+            {
+            // get col number -  there can by only one column but just in case get by name
+            CDbColSet* colSet = view.ColSetL( );
+            const TInt colNo = colSet->ColNo( KObjRefIdColName );
+            delete colSet;
+
+            view.GetL( );
+            if ( !view.IsColNull( colNo ) )
+                {
+                ret = view.ColInt( colNo );
+                }
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetElmIdForAttrL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::GetElmIdForAttrL( const TDesC8& aAttrName,
+    const TDesC8& aAttrVal )
+    {
+    // convert to unicode
+    HBufC* attrName = UpnpCdUtils::Des8ToDesLC( aAttrName );
+    HBufC* attrVal = UpnpCdUtils::Des8ToDesLC( aAttrVal );
+
+    TInt elmId = KErrNotFound;
+    HBufC* query = HBufC::NewLC( aAttrVal.Length( ) 
+                                 + KSelectFromSqlCmd().Length( ) 
+                                 + KAtrElmIdColName().Length( ) 
+                                 + KAttributeTableName().Length( ) 
+                                 + KAtrValueColName().Length( ) 
+                                 + KAndConditionSqlCmd().Length( ) 
+                                 + KAtrNameColName().Length( ) 
+                                 + aAttrName.Length( ) );
+    TPtr queryPtr(query->Des( ));
+    // prepare format string
+    HBufC* fmt = HBufC::NewLC( KSelectFromSqlCmd().Length( ) + KAndConditionSqlCmd().Length( ) );
+    TPtr fmtPtr(fmt->Des( ));
+    fmtPtr.Copy( KSelectFromSqlCmd );
+    fmtPtr.Append( KAndConditionSqlCmd );
+    // format query
+    queryPtr.Format( fmtPtr, &KAtrElmIdColName, &KAttributeTableName,
+        &KAtrNameColName, attrName, &KAtrValueColName, attrVal );
+    // clean up format string
+    CleanupStack::PopAndDestroy( fmt );
+
+    RDbView view;
+    CleanupClosePushL( view );
+    TInt dbErr = view.Prepare( iDatabase, TDbQuery( queryPtr ),
+        view.EReadOnly );
+    if ( dbErr == KErrNone )
+        {
+        User::LeaveIfError( view.Evaluate( ) );
+        if ( view.FirstL( ) )
+            {
+            // get col number -  there can by only one column but just in case get by name
+            CDbColSet* colSet = view.ColSetL( );
+            const TInt colNo = colSet->ColNo( KAtrElmIdColName );
+            delete colSet;
+
+            view.GetL( );
+            if ( !view.IsColNull( colNo ) )
+                {
+                elmId = view.ColInt( colNo );
+                }
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( query );
+    CleanupStack::PopAndDestroy( attrVal );
+    CleanupStack::PopAndDestroy( attrName );
+    return elmId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetObjIdForElmIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::GetObjIdForElmIdL( TInt aId )
+    {
+    TInt objId = KErrNotFound;
+    HBufC* query = HBufC::NewLC( KMaxIntegerLen + KSelectFromNumSqlCmd().Length( ) 
+                                + KElementTableName().Length( ) 
+                                + KElmObjIdColName().Length( ) 
+                                + KElmIdColName().Length( ) );
+    TPtr queryPtr(query->Des( ));
+    queryPtr.Format( KSelectFromNumSqlCmd, &KElmObjIdColName,
+        &KElementTableName, &KElmIdColName, aId );
+
+    RDbView view;
+    CleanupClosePushL( view );
+    TInt dbErr = view.Prepare( iDatabase, TDbQuery( queryPtr ),
+        view.EReadOnly );
+    if ( dbErr == KErrNone )
+        {
+        User::LeaveIfError( view.Evaluate( ) );
+        if ( view.FirstL( ) )
+            {
+            // get col number -  there can by only one column but just in case get by name
+            CDbColSet* colSet = view.ColSetL( );
+            const TInt colNo = colSet->ColNo( KElmObjIdColName );
+            delete colSet;
+
+            view.GetL( );
+            if ( !view.IsColNull( colNo ) )
+                {
+                objId = view.ColInt( colNo );
+                }
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( query );
+    return objId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetObjIdByAttrLikeL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::GetElmIdForAttrLikeL( const TDesC8& aAttrName,
+    const TDesC8& aAttrVal )
+    {
+    //convert to unicode 
+    HBufC* attrVal = UpnpCdUtils::Des8ToDesLC( aAttrVal );
+    HBufC* attrName = UpnpCdUtils::Des8ToDesLC( aAttrName );
+
+    // query buf
+    TInt elmId = KErrNotFound;
+    HBufC* query = HBufC::NewLC( attrVal->Length( ) 
+                                + KSelectFromSqlCmd().Length( ) 
+                                + KAtrElmIdColName().Length( ) 
+                                + KAttributeTableName().Length( ) 
+                                + KAtrValueColName().Length( ) 
+                                + KAndLikeConditionSqlCmd().Length( ) 
+                                + KAtrNameColName().Length( ) 
+                                + attrName->Length( ) );
+    TPtr queryPtr(query->Des( ));
+    // prepare format string
+    HBufC* fmt = HBufC::NewLC( KSelectFromSqlCmd().Length( ) + KAndLikeConditionSqlCmd().Length( ) );
+    TPtr fmtPtr(fmt->Des( ));
+    fmtPtr.Copy( KSelectFromSqlCmd );
+    fmtPtr.Append( KAndLikeConditionSqlCmd );
+    // format query
+    queryPtr.Format( fmtPtr, &KAtrElmIdColName, &KAttributeTableName,
+        &KAtrNameColName, attrName, &KAtrValueColName, attrVal );
+    // clean up format string
+    CleanupStack::PopAndDestroy( fmt );
+
+    RDbView view;
+    CleanupClosePushL( view );
+    TInt dbErr = view.Prepare( iDatabase, TDbQuery( queryPtr ),
+        view.EReadOnly );
+    if ( dbErr == KErrNone )
+        {
+        User::LeaveIfError( view.Evaluate( ) );
+        if ( view.FirstL( ) )
+            {
+            // get col number -  there can by only one column but just in case get by name
+            CDbColSet* colSet = view.ColSetL( );
+            const TInt colNo = colSet->ColNo( KAtrElmIdColName );
+            delete colSet;
+
+            view.GetL( );
+            if ( !view.IsColNull( colNo ) )
+                {
+                elmId = view.ColInt( colNo );
+                }
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( query );
+    CleanupStack::PopAndDestroy( attrName );
+    CleanupStack::PopAndDestroy( attrVal );
+    return elmId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetParentIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::GetParentIdL( TInt aObjId )
+    {
+    TInt objId=KErrGeneral;
+    HBufC* query = HBufC::NewLC( KSelectFromNumSqlCmd().Length( ) 
+                                + KObjParentIdColName().Length( ) 
+                                + KObjectTableName().Length( ) 
+                                + KObjIdColName().Length( ) 
+                                + KMaxIntegerLen );
+    TPtr queryPtr(query->Des( ));
+    queryPtr.Format( KSelectFromNumSqlCmd, &KObjParentIdColName,
+        &KObjectTableName, &KObjIdColName, aObjId );
+
+    RDbView view;
+    CleanupClosePushL( view );
+    TInt dbErr = view.Prepare( iDatabase, TDbQuery( queryPtr ),
+        view.EReadOnly );
+    if ( dbErr == KErrNone )
+        {
+        User::LeaveIfError( view.Evaluate( ) );
+        if ( view.FirstL( ) )
+            {
+            CDbColSet* colSet = view.ColSetL( );
+            const TInt colNo = colSet->ColNo( KObjParentIdColName );
+            delete colSet;
+
+            view.GetL( );
+            if ( !view.IsColNull( colNo ) )
+                {
+                objId = view.ColInt( colNo );
+                }
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( query );
+    return objId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetChildCountL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::GetChildCountL( TInt aObjId )
+    {
+    TInt childCount = KErrGeneral;
+
+    HBufC* query = HBufC::NewLC( KSelectFromNumSqlCmd().Length( ) 
+                                 + KObjIdColName().Length( ) 
+                                 + KObjectTableName().Length( ) 
+                                 + KObjParentIdColName().Length( ) 
+                                 + KMaxIntegerLen );
+    TPtr queryPtr(query->Des( ));
+    queryPtr.Format( KSelectFromNumSqlCmd, &KObjIdColName, &KObjectTableName,
+        &KObjParentIdColName, aObjId );
+
+    RDbView view;
+    CleanupClosePushL( view );
+    TInt dbErr = view.Prepare( iDatabase, TDbQuery( queryPtr ),
+        view.EReadOnly );
+    if ( dbErr == KErrNone )
+        {
+        User::LeaveIfError( view.EvaluateAll( ) );
+        childCount = view.CountL( );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( query );
+    return childCount;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteResElL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::DeleteResElL( const TDesC& aResVal, TInt ObjId )
+    {
+    HBufC* query = HBufC::NewLC( KDeleteResElSqlCmd().Length( ) + aResVal.Length( ) + KMaxIntegerLen );
+    TPtr SqlCmd(query->Des( ));
+    SqlCmd.Format( KDeleteResElSqlCmd, &aResVal, ObjId );
+
+    // execute
+    ExecuteL( SqlCmd );
+
+    // clean up
+    CleanupStack::PopAndDestroy( query );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteResElL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::ExecuteL( const TDesC& aSqlCmd )
+    {
+    // execute
+    TInt err = iDatabase.Execute( aSqlCmd );
+    LOGSQL( "CUpnpContentDirectoryDb::DeleteResElL", "iDataBase.Execute",
+        err, &aSqlCmd );
+    User::LeaveIfError( err );
+
+    // db compact
+    DbChangedL( KExecuteWeight );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteResElL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::GetViewOfObjectListForResL( const TDesC& aResVal )
+    {
+    HBufC* query = HBufC::NewLC( KSelectFromSqlCmd().Length( ) 
+                                + KElmObjIdColName().Length( ) 
+                                + KElementTableName().Length( ) 
+                                + KElmValueColName().Length( ) 
+                                + aResVal.Length( )
+                                + KNamedElFromElement().Length()
+                                + KRes16().Length());
+    TPtr queryPtr(query->Des( ));
+    queryPtr.Format( KSelectFromSqlCmd, &KElmObjIdColName,
+        &KElementTableName, &KElmValueColName, &aResVal );
+    queryPtr.AppendFormat( KNamedElFromElement, &KRes16 );
+
+    RDbView view = GetEvaluatedViewL( queryPtr );
+
+    CleanupStack::PopAndDestroy( query );
+
+    return view;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetViewOfElmIdByNameAndValLC
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::GetViewOfElmIdByNameAndValL(
+    const TDesC& aElmName, const TDesC& aElmValue )
+    {
+    HBufC* resValReplaced16 = UpnpCdUtils::EscapeAposL( aElmValue );
+    HBufC* query = HBufC::NewLC( KSelectFromSqlCmd().Length( ) 
+                                + KElmIdColName().Length( ) 
+                                + KElementTableName().Length( ) 
+                                + KElmNameColName().Length( ) 
+                                + aElmName.Length( ) 
+                                + KAndConditionSqlCmd().Length( ) 
+                                + KElmValueColName().Length( ) 
+                                + resValReplaced16->Des().Length( ) );
+    TPtr queryPtr(query->Des( ));
+
+    // format query
+    queryPtr.Format( KSelectFromSqlCmd, &KElmIdColName, &KElementTableName,
+        &KElmNameColName, &aElmName );
+    queryPtr.AppendFormat( KAndConditionSqlCmd, &KElmValueColName,
+        resValReplaced16 );
+
+    RDbView view = GetEvaluatedViewL( queryPtr );
+
+    CleanupStack::PopAndDestroy( query );
+
+    delete resValReplaced16;
+    return view;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetAttrViewL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::GetAttrViewL( const TDesC8& aAttrName,
+    const TDesC8& aAttrVal )
+    {
+    HBufC* attrNameBuf = UpnpCdUtils::Des8ToDesLC( aAttrName );
+    HBufC* attrValueBuf = UpnpCdUtils::Des8ToDesLC( aAttrVal );
+
+    HBufC* query = HBufC::NewLC( KSelectAttributeByValueSqlCmd().Length( ) + aAttrName.Length( ) + aAttrVal.Length( )
+
+    );
+    TPtr queryPtr(query->Des( ));
+
+    // format query
+    queryPtr.Format( KSelectAttributeByValueSqlCmd( ), attrValueBuf,
+        attrNameBuf );
+
+    RDbView view = GetEvaluatedViewL( queryPtr );
+
+    CleanupStack::PopAndDestroy( query );
+    CleanupStack::PopAndDestroy( attrValueBuf );
+    CleanupStack::PopAndDestroy( attrNameBuf );
+
+    return view;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetAttrViewL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::GetAttrViewL( TInt aElmId,
+    const TDesC8& aAttrName )
+    {
+    // convert ot unicode
+    HBufC* attrNameBuf = UpnpCdUtils::Des8ToDesLC( aAttrName );
+
+    HBufC* query = HBufC::NewLC( KSelectFromNumSqlCmd().Length( ) 
+                                 + KAtrValueColName().Length( ) 
+                                 + KAttributeTableName().Length( ) 
+                                 + KAtrElmIdColName().Length( ) 
+                                 + KMaxIntegerLen 
+                                 + KAndConditionSqlCmd().Length( ) 
+                                 + KAtrNameColName().Length( ) 
+                                 + aAttrName.Length( ) );
+    TPtr queryPtr(query->Des( ));
+    // prepare format string
+    HBufC* fmt = HBufC::NewLC( KSelectFromNumSqlCmd().Length( ) + KAndConditionSqlCmd().Length( ) );
+    TPtr fmtPtr(fmt->Des( ));
+    fmtPtr.Copy( KSelectFromNumSqlCmd );
+    fmtPtr.Append( KAndConditionSqlCmd );
+    // format query
+    queryPtr.Format( fmtPtr, &KAsterisk, &KAttributeTableName,
+        &KAtrElmIdColName, aElmId, &KAtrNameColName, attrNameBuf );
+
+    CleanupStack::PopAndDestroy( fmt );
+
+    RDbView view = GetEvaluatedViewL( queryPtr );
+
+    CleanupStack::PopAndDestroy( query );
+    CleanupStack::PopAndDestroy( attrNameBuf );
+
+    return view;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetAttrViewByObjectIdL
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::GetAttrViewByObjectIdL( TInt aObjectId,
+    const TDesC8& aAttrName )
+    {
+    // convert ot unicode
+    HBufC* attrNameBuf = UpnpCdUtils::Des8ToDesLC( aAttrName );
+
+    HBufC* query = HBufC::NewLC( KSelectFromNumSqlCmd().Length( ) 
+                                 + KAtrValueColName().Length( ) 
+                                 + KAttributeTableName().Length( ) 
+                                 + KAtrIdObjColName().Length( ) 
+                                 + KMaxIntegerLen 
+                                 + KAndConditionSqlCmd().Length( ) 
+                                 + KAtrNameColName().Length( ) 
+                                 + aAttrName.Length( ) );
+    TPtr queryPtr(query->Des( ));
+    // prepare format string
+    HBufC* fmt = HBufC::NewLC( KSelectFromNumSqlCmd().Length( ) + KAndConditionSqlCmd().Length( ) );
+    TPtr fmtPtr(fmt->Des( ));
+    fmtPtr.Copy( KSelectFromNumSqlCmd );
+    fmtPtr.Append( KAndConditionSqlCmd );
+    // format query
+    queryPtr.Format( fmtPtr, &KAsterisk, &KAttributeTableName,
+        &KAtrIdObjColName, aObjectId, &KAtrNameColName, attrNameBuf );
+
+    CleanupStack::PopAndDestroy( fmt );
+
+    RDbView view = GetEvaluatedViewL( queryPtr );
+
+    CleanupStack::PopAndDestroy( query );
+    CleanupStack::PopAndDestroy( attrNameBuf );
+
+    return view;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::PrepareViewL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::PrepareViewL( const TDesC& aSqlQuery )
+    {
+    RDbView view;
+    TInt dbErr = view.Prepare( iDatabase, TDbQuery( aSqlQuery ),
+        view.EReadOnly );
+    LOGSQL( "CUpnpMetadataStorage::GetViewL", "RDbView::Prepare", dbErr,
+        &aSqlQuery );
+    User::LeaveIfError( dbErr );
+
+    return view;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectoryDb::GetEvaluatedViewL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RDbView CUpnpMetadataStorage::GetEvaluatedViewL( const TDesC& aSqlQuery )
+    {
+    RDbView view = PrepareViewL( aSqlQuery );
+
+    // evaluate
+    TInt dbErr = view.EvaluateAll( );
+    LOGCD( "CUpnpMetadataStorage::GetViewLC", "RDbView::EvaluateAll", dbErr,
+        "" );
+    User::LeaveIfError( dbErr );
+
+    return view;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetObjectPathL 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpMetadataStorage::GetObjectPathL( TInt aObjId )
+    {
+    HBufC8* ret = NULL;
+    HBufC* query = HBufC::NewLC( KSelectFromNumSqlCmd().Length( ) 
+                                + KObjPathColName().Length( ) 
+                                + KObjectTableName().Length( ) 
+                                + KObjIdColName().Length( ) 
+                                + KMaxIntegerLen );
+    TPtr queryPtr(query->Des( ));
+    // format query
+    queryPtr.Format( KSelectFromNumSqlCmd, &KObjPathColName,
+        &KObjectTableName, &KObjIdColName, aObjId );
+
+    RDbView view;
+    CleanupClosePushL( view );
+    TInt dbErr = view.Prepare( iDatabase, TDbQuery( queryPtr ),
+        view.EReadOnly );
+    if ( dbErr == KErrNone )
+        {
+        User::LeaveIfError( view.EvaluateAll( ) );
+
+        CDbColSet* colSet = view.ColSetL( );
+        const TInt colNo = colSet->ColNo( KObjPathColName );
+        delete colSet;
+
+        if ( view.FirstL( ) )
+            {
+            view.GetL( );
+            if ( !view.IsColNull( colNo ) )
+                {
+                ret = view.ColDes8( colNo ).AllocL( );
+                }
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( query );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetObjectTitleL 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpMetadataStorage::GetObjectTitleL( TInt aObjId )
+    {
+    HBufC8* ret = NULL;
+    HBufC* query = HBufC::NewLC( KSelectFromNumSqlCmd().Length( ) 
+                                + KObjTiltleColName().Length( ) 
+                                + KObjectTableName().Length( ) 
+                                + KObjIdColName().Length( ) 
+                                + KMaxIntegerLen );
+    TPtr queryPtr(query->Des( ));
+    // format query
+    queryPtr.Format( KSelectFromNumSqlCmd, &KObjTiltleColName,
+        &KObjectTableName, &KObjIdColName, aObjId );
+
+    RDbView view;
+    CleanupClosePushL( view );
+    TInt dbErr = view.Prepare( iDatabase, TDbQuery( queryPtr ),
+        view.EReadOnly );
+    if ( dbErr == KErrNone )
+        {
+        User::LeaveIfError( view.EvaluateAll( ) );
+
+        CDbColSet* colSet = view.ColSetL( );
+        const TInt colNo = colSet->ColNo( KObjTiltleColName );
+        delete colSet;
+
+        if ( view.FirstL( ) )
+            {
+            view.GetL( );
+            if ( !view.IsColNull( colNo ) )
+                {
+                ret = view.ColDes8( colNo ).AllocL( );
+                }
+            }
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( query );
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetResourceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CUpnpResourcesBean* CUpnpMetadataStorage::GetResourceL( TInt64 aResId )
+    {
+    CUpnpResourcesBean* resBn = NULL;
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aResId);
+    User::LeaveIfError( table.Open( iDatabase, KResourcesTableName,
+        table.EUpdatable ) );
+    User::LeaveIfError( table.SetIndex( KRscIdIndexName ) ); // use index
+    if ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+        // table bean
+        resBn = CUpnpResourcesBean::NewL( table );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &table );
+    return resBn;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteResourceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::DeleteResourceByObjIdL( TInt aObjId,
+    TBool aDeleteFile )
+    {
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aObjId);
+    User::LeaveIfError( table.Open( iDatabase, KResourcesTableName,
+        table.EUpdatable ) );
+    User::LeaveIfError( table.SetIndex( KRscIdObjIndexName ) ); // use index
+    while ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+
+        // table bean
+        CUpnpResourcesBean* resBn = CUpnpResourcesBean::NewLC( table );
+
+        if ( aDeleteFile && !resBn->IsReadonly( ) && resBn->IsThumbnail( ) )
+            { // delete the file
+            DeleteFileL( resBn->Path( ) );
+            }
+
+        // clean up 
+        CleanupStack::PopAndDestroy( resBn );
+
+        // delete the row
+        table.DeleteL( );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &table );
+
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteResourceByResIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::DeleteResourceByResIdL( TInt64 aResId,
+    TBool aDeleteFile )
+    {
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aResId);
+    User::LeaveIfError( table.Open( iDatabase, KResourcesTableName,
+        table.EUpdatable ) );
+    User::LeaveIfError( table.SetIndex( KRscIdIndexName ) ); // use index
+    while ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+
+        // table bean
+        CUpnpResourcesBean* resBn = CUpnpResourcesBean::NewLC( table );
+
+        if ( aDeleteFile && !resBn->IsReadonly( ) && resBn->IsThumbnail( ) )
+            { // delete the file
+            DeleteFileL( resBn->Path( ) );
+            }
+
+        // clean up 
+        CleanupStack::PopAndDestroy( resBn );
+
+        // delete the row
+        table.DeleteL( );
+        }
+    // clean up
+    CleanupStack::PopAndDestroy( &table );
+
+    }
+//
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteObjectsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CUpnpMetadataStorage::DeleteObjectsL( TInt aObjId )
+    {
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aObjId);
+    User::LeaveIfError( table.Open( iDatabase, KObjectTableName,
+        table.EUpdatable ) );
+    User::LeaveIfError( table.SetIndex( KObjIdIndexName ) ); // use index
+    if ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+
+        // delete the row
+        table.DeleteL( );
+        }
+    CleanupStack::PopAndDestroy( &table );
+    }
+//
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteReferencesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CUpnpMetadataStorage::DeleteReferencesL( TInt aObjId,
+    RArray<TInt>& aRefList )
+    {
+    RDbTable table;
+    TInt ret( KErrNotFound );
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aObjId);
+    User::LeaveIfError( table.Open( iDatabase, KObjectTableName,
+        table.EUpdatable ) );
+    User::LeaveIfError( table.SetIndex( KRefIdIndexName ) ); // use index
+    while ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+        CDbColSet* colSet = table.ColSetL( );
+        CleanupStack::PushL( colSet );
+        TDbColNo colNo(colSet->ColNo( KObjParentIdColName ) );
+        ret = table.ColInt( colNo );
+        aRefList.Append( ret );
+        CleanupStack::PopAndDestroy( colSet );
+        // delete the row
+        table.DeleteL( );
+        }
+    CleanupStack::PopAndDestroy( &table );
+    }
+//
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteElementsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CUpnpMetadataStorage::DeleteElementsL( TInt aObjId )
+    {
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aObjId);
+    User::LeaveIfError( table.Open( iDatabase, KElementTableName,
+        table.EUpdatable ) );
+    User::LeaveIfError( table.SetIndex( KElmObjIdIndexName ) ); // use index
+    while ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+
+        // delete the row
+        table.DeleteL( );
+        }
+    CleanupStack::PopAndDestroy( &table );
+    }
+//
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteAttributesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CUpnpMetadataStorage::DeleteAttributesL( TInt aObjId )
+    {
+    RDbTable table;
+    CleanupClosePushL( table );
+    TDbSeekKey seekKey(aObjId);
+    User::LeaveIfError( table.Open( iDatabase, KAttributeTableName,
+        table.EUpdatable ) );
+    User::LeaveIfError( table.SetIndex( KAtrElmIdIndexName ) ); // use index
+    while ( table.SeekL( seekKey ) ) // find object
+        { // object found
+        table.GetL( );
+
+        // delete the row
+        table.DeleteL( );
+        }
+    CleanupStack::PopAndDestroy( &table );
+    }
+//
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::GetColDesValFromRowSetL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+HBufC8* CUpnpMetadataStorage::GetColDesValFromRowSetL( RDbRowSet aRowset,
+    TDbColNo aColNo )
+    {
+    TDbColType colType = aRowset.ColType( aColNo );
+    TBuf8<KMaxIntegerLen> val;
+    switch ( colType )
+        // so far only 2 types are possible
+        {
+        case EDbColBit:
+            val.Num( aRowset.ColUint8( aColNo ) );
+            break;
+        case EDbColInt32:
+        case EDbColInt16:
+        case EDbColInt8:
+            val.Num( aRowset.ColInt( aColNo ) );
+            break;
+        default:
+            User::Leave( KErrGeneral );
+        }
+    return val.AllocL( );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteFileL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::DeleteFileL( const TDesC& aPath )
+    {
+    iFsSession.Delete( aPath );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::InsertIntoObjectTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::InsertIntoObjectTableL( TInt aContainerId,
+    CUpnpObjectBean* aObjBn )
+    {
+    // open table
+    RDbTable table;
+    User::LeaveIfError( table.Open( iDatabase, KObjectTableName,
+        table.EUpdatable ) );
+    CleanupClosePushL( table );
+
+    // CdbColSet
+    CDbColSet* objColSet = table.ColSetL( );
+    CleanupStack::PushL( objColSet );
+
+    // rowset cursor to the beginning position
+    table.Reset( );
+
+    // insert empty row
+    table.InsertL( );
+
+    // object id
+    TInt objId = GetNextKeyL( KObjectTableName8 );
+    table.SetColL( objColSet->ColNo( KObjIdColName ), objId );
+
+    // parent id
+    table.SetColL( objColSet->ColNo( KObjParentIdColName ), aContainerId );
+
+    // restricted
+    table.SetColL( objColSet->ColNo( KObjRestrictedColName ),
+        aObjBn->ObjRestricted( ) );
+
+    // set title
+    table.SetColL( objColSet->ColNo( KObjTiltleColName ), aObjBn->ObjTitle( ) );
+
+    // set class
+    table.SetColL( objColSet->ColNo( KObjClassColName ), aObjBn->ObjClass( ) );
+
+    table.SetColL( objColSet->ColNo( KObjRefIdColName ), aObjBn->ObjRefId( ) );
+    // set path
+    HBufC8* path = CreatePathValL( aContainerId );
+    CleanupStack::PushL( path );
+    table.SetColL( objColSet->ColNo( KObjPathColName ), *path );
+
+    // complete insertion
+    table.PutL( );
+
+    DbChangedL( KExecuteWeight );
+
+    // clean up
+    CleanupStack::PopAndDestroy( path );
+    CleanupStack::PopAndDestroy( objColSet );
+    CleanupStack::PopAndDestroy( &table );
+
+    return objId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::InsertIntoElementTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::InsertIntoElementTableL( TInt aObjId,
+    CUpnpElementBean* aElmBn, TInt aElmId )
+    {
+    // open table
+    RDbTable table;
+    User::LeaveIfError( table.Open( iDatabase, KElementTableName,
+        table.EUpdatable ) );
+    CleanupClosePushL( table );
+
+    // CdbColSet
+    CDbColSet* objColSet = table.ColSetL( );
+    CleanupStack::PushL( objColSet );
+
+    // rowset cursor to the beginning position
+    table.Reset( );
+
+    // insert empty row
+    table.InsertL( );
+
+    // elm_id
+    table.SetColL( objColSet->ColNo( KElmIdColName ), aElmId );
+
+    // elm_name
+    table.SetColL( objColSet->ColNo( KElmNameColName ), aElmBn->ElmName( ) );
+
+    // elm_value
+    if ( aElmBn->ElmValue().Length( ) )
+        {
+        // use write stream
+        RDbColWriteStream ws;
+        ws.OpenLC( table, objColSet->ColNo( KElmValueColName ) );
+        ws.WriteL( aElmBn->ElmValue( ) ); // write value
+        ws.CommitL( );
+        CleanupStack::PopAndDestroy( &ws );
+        }
+
+    // elm_has_attribute
+    table.SetColL( objColSet->ColNo( KElmHasAttrColName ),
+        aElmBn->ElmHasAttribute( ) );
+
+    // elm_obj_id
+    table.SetColL( objColSet->ColNo( KElmObjIdColName ), aObjId );
+
+    // elm_is_required
+    table.SetColL( objColSet->ColNo( KElmIsRequiredColName ),
+        aElmBn->ElmIsRequired( ) );
+
+    // complete insertion
+    table.PutL( );
+
+    DbChangedL( KExecuteWeight );
+
+    // clean up
+    CleanupStack::PopAndDestroy( objColSet );
+    CleanupStack::PopAndDestroy( &table );
+
+    return aElmId;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::InsertIntoAttributeTableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::InsertIntoAttributeTableL( TInt aElmId,
+    CUpnpAttributeBean* aAtrBn, TInt aObjId, TInt aAtrId )
+    {
+    // open table
+    RDbTable table;
+    User::LeaveIfError( table.Open( iDatabase, KAttributeTableName,
+        table.EUpdatable ) );
+    CleanupClosePushL( table );
+
+    // CdbColSet
+    CDbColSet* objColSet = table.ColSetL( );
+    CleanupStack::PushL( objColSet );
+
+    // rowset cursor to the beginning position
+    table.Reset( );
+
+    // insert empty row
+    table.InsertL( );
+
+    // atr_id
+    table.SetColL( objColSet->ColNo( KAtrIdColName ), aAtrId ); // leaves if error
+
+    // atr_name
+    table.SetColL( objColSet->ColNo( KAtrNameColName ), aAtrBn->AtrName( ) ); // name cannot be null
+
+    // atr_value
+    if ( aAtrBn->AtrValue().Length( ) )
+        {
+        // use write stream
+        RDbColWriteStream ws;
+        ws.OpenLC( table, objColSet->ColNo( KAtrValueColName ) );
+        ws.WriteL( aAtrBn->AtrValue( ) ); // write value
+        ws.CommitL( );
+        CleanupStack::PopAndDestroy( &ws );
+        }
+
+    // atr_elm_id
+    table.SetColL( objColSet->ColNo( KAtrElmIdColName ), aElmId );
+
+    // atr_is_required
+    table.SetColL( objColSet->ColNo( KAtrIsRequiredColName ),
+        aAtrBn->AtrIsRequired( ) );
+
+    // atr_obj_id
+    table.SetColL( objColSet->ColNo( KAtrIdObjColName ), aObjId );
+
+    // complete insertion
+    table.PutL( );
+
+    DbChangedL( KExecuteWeight );
+
+    // clean up
+    CleanupStack::PopAndDestroy( objColSet );
+    CleanupStack::PopAndDestroy( &table );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpMetadataStorage::DeleteObjectL( TInt aObjId,
+    RArray<TInt>& aRefList, TBool aDeleteResource, TBool aLocal,
+    TBool aDeleteRef )
+    {
+    TUpnpErrorCode ret = ENoSuchObject;
+
+    // start transaction
+    BeginTransactionL( );
+
+    RArray<TInt> resList;
+    CleanupClosePushL( resList );
+    TInt delNumber = NULL;
+    TRAPD( err, delNumber = DoDeleteObjectL( aObjId, aRefList, resList,
+        aDeleteResource, aLocal, aDeleteRef ) );
+    if ( err )
+        { // rollback - error
+        RollbackTransactionL( );
+        User::Leave( err );
+        }
+    // commit if success
+    CommitTransactionL( );
+
+    // everything went OK, delete files
+    DeleteResourcesL( resList );
+
+    // clean up
+    CleanupStack::PopAndDestroy( &resList );
+
+    if ( delNumber )
+        {
+        ret = EUpnpOk;
+        }
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DoDeleteObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpMetadataStorage::DoDeleteObjectL( TInt aObjId,
+    TBool aDeleteResource, TBool aDeleteRef )
+    {
+    TUpnpErrorCode ret = ENoSuchObject;
+    RArray<TInt> ignore;
+    CleanupClosePushL( ignore );
+    if ( DoDeleteObjectL( aObjId, ignore, ignore, aDeleteResource, EFalse,
+        aDeleteRef ) )
+        {
+        ret = EUpnpOk;
+        }
+    CleanupStack::PopAndDestroy( &ignore );
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DoDeleteObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::DoDeleteObjectL( TInt aObjId,
+    RArray<TInt>& aRefList, RArray<TInt>& aResList, TBool aDeleteResource,
+    TBool aLocal, TBool aDeleteRef )
+    {
+    TInt numberDeleted = NULL;
+    RArray<TInt> objList;
+    CleanupClosePushL( objList );
+
+    // prepare list of object and resources in the object to be deleted
+    if ( aDeleteResource )
+        {
+        AddSubObjectsL( aObjId, objList, aResList, aLocal );
+        }
+    else
+        {
+        objList.AppendL( aObjId );
+        }
+
+    // error if nothing can be deleted
+    if ( !objList.Count( ) )
+        {
+        User::Leave( ERestrictedObject );
+        }
+
+    // delete each object
+    for ( TInt i = 0; i < objList.Count( ); i++ )
+        {
+        DeleteObjectsL( objList[i] );
+        DeleteElementsL( objList[i] );
+        DeleteAttributesL( objList[i] );
+        if ( aDeleteRef )
+            {
+            DeleteReferencesL( objList[i], aRefList );
+            }
+
+        numberDeleted++;
+        }
+    CleanupStack::PopAndDestroy( &objList );
+
+    return numberDeleted;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::DeleteResourcesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::DeleteResourcesL( RArray<TInt>& aObjList )
+    {
+    for ( TInt i = 0; i < aObjList.Count( ); i++ )
+        {
+        DeleteResourceByObjIdL( aObjList[i] );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::AddSubObjectsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::AddSubObjectsL( TInt aObjId,
+    RArray<TInt>& aObjList, RArray<TInt>& aResList, TBool aLocal )
+    {
+    // number of restricted objects in the subtree 
+    TInt mustRemain = 0;
+
+    // direct children
+    RArray<TInt> children;
+    CleanupClosePushL( children );
+    GetObjectListL( aObjId, children );
+
+    // for each children
+    for ( TInt i = 0; i < children.Count( ); i++ )
+        {
+        // next level
+        mustRemain
+                += AddSubObjectsL( children[i], aObjList, aResList, aLocal );
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy( &children );
+
+    if ( !aLocal ) // local api can delete even restricted objects
+        {
+        // restricted?
+        if ( CheckObjectRestrictionL( aObjId ) == ERestrictedObject )
+            {
+            mustRemain++;
+            }
+
+        // restricted parent?
+        if ( CheckParentRestrictionL( aObjId ) == ERestrictedObject )
+            {
+            mustRemain++;
+            }
+        }
+
+    // can be deleted?
+    if ( !mustRemain )
+        { // delete the object
+        // add currrent object
+        aObjList.AppendL( aObjId );
+        aResList.AppendL( aObjId );
+        }
+    return mustRemain;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::CheckParentRestrictionL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpMetadataStorage::CheckParentRestrictionL( TInt aObjId )
+    {
+    TInt parentId = GetParentIdL( aObjId );
+    return CheckObjectRestrictionL( parentId );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::AddResourceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::AddResourceL( CUpnpResourcesBean* aResBean,
+    TInt aObjId )
+    {
+    HBufC* resValReplaced16 = UpnpCdUtils::EscapeAposL( aResBean->Path( ) );
+
+    // prepare command
+    HBufC* sqlCommand = HBufC::NewLC( KInsertInto().Length( ) 
+                                      + KResourcesTableName().Length( ) 
+                                      + KOpenParant().Length( ) 
+                                      + KRscIdColName().Length( ) 
+                                      + KRscPathColName().Length( ) 
+                                      + KRscReadonlyColName().Length( ) 
+                                      + KRscThumbnailColName().Length( ) 
+                                      + KRscIdObjColName().Length( ) 
+                                      + KCloseParant().Length( ) 
+                                      + KValuesOpen().Length( ) 
+                                      + KMaxIntegerLen 
+                                      + resValReplaced16->Des().Length( ) 
+                                      + KMaxBoolLen 
+                                      + KMaxBoolLen 
+                                      + KMaxLongIntegerLen
+                                      + KCloseParant().Length( )  
+                                      + 2 * KQuot().Length( ) 
+                                      + 8 * KCommaStr().Length( ) ); // we need 4 commas and 2 quotation-marks
+
+    TPtr sqlCmdPtr(sqlCommand->Des( ));
+
+    TBuf<KMaxIntegerLen> num;
+    TBuf<KMaxLongIntegerLen> numLong;
+
+    sqlCmdPtr.Append( KInsertInto );
+    sqlCmdPtr.Append( KResourcesTableName );
+    sqlCmdPtr.Append( KOpenParant );
+    sqlCmdPtr.Append( KRscIdColName );
+    sqlCmdPtr.Append( KCommaStr );
+    sqlCmdPtr.Append( KRscPathColName );
+    sqlCmdPtr.Append( KCommaStr );
+    sqlCmdPtr.Append( KRscReadonlyColName );
+    sqlCmdPtr.Append( KCommaStr );
+    sqlCmdPtr.Append( KRscThumbnailColName );
+    sqlCmdPtr.Append( KCommaStr );
+    sqlCmdPtr.Append( KRscIdObjColName );
+    sqlCmdPtr.Append( KCloseParant );
+    sqlCmdPtr.Append( KValuesOpen );
+    numLong.Num( aResBean->Id( ) );
+    sqlCmdPtr.Append( numLong );
+    sqlCmdPtr.Append( KCommaStr );
+    sqlCmdPtr.Append( KQuot );
+    sqlCmdPtr.Append( *resValReplaced16 );
+    sqlCmdPtr.Append( KQuot );
+    sqlCmdPtr.Append( KCommaStr );
+    num.Num( aResBean->IsReadonly( ) );
+    sqlCmdPtr.Append( num );
+    sqlCmdPtr.Append( KCommaStr );
+    num.Num( aResBean->IsThumbnail( ) );
+    sqlCmdPtr.Append( num );
+    sqlCmdPtr.Append( KCommaStr );
+    num.Num( aObjId );
+    sqlCmdPtr.Append( num );
+    sqlCmdPtr.Append( KCloseParant );
+
+    delete resValReplaced16;
+    // execute
+    ExecuteL( sqlCmdPtr );
+    // clean up
+    CleanupStack::PopAndDestroy( sqlCommand );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::RecoverDatabase
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::RecoverDatabase()
+    {
+    return iDatabase.Recover( );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::RecreateDatabaseFileL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::RecreateDatabaseFileL()
+    {
+    iDatabase.Close( );
+    iIsOpen = EFalse;
+
+    delete iFileStore;
+    iFileStore = NULL;
+
+    CUpnpCdDbFactory* cdf = CUpnpCdDbFactory::NewLC( );
+
+    // database file name
+    RFs fs;
+    CleanupClosePushL( fs );
+    User::LeaveIfError( fs.Connect( ) );
+
+    TFileName path;
+    User::LeaveIfError( fs.PrivatePath( path ) );
+    TParse fp;
+    fp.Set( KDatabaseFileName( ), &path, 0 );
+    path = fp.FullName( );
+
+    // recreate database file
+    cdf->CreateDatabaseFileL( path );
+
+    CleanupStack::PopAndDestroy( &fs );
+    CleanupStack::PopAndDestroy( cdf );
+
+    OpenDbL( path );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::CompareDbColSetsL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::CompareDbColSetsL( CDbColSet *aColSet1,
+    CDbColSet *aColSet2 )
+    {
+    if ( !aColSet1 || !aColSet1 )
+        User::Leave( KErrCorrupt );
+    if ( aColSet1->Count( ) != aColSet1->Count( ) )
+        User::Leave( KErrCorrupt );
+
+    for ( TInt i=1; i<=aColSet1->Count( ); i++ )
+        {
+        TBool foundColumn = EFalse;
+        const TDbCol& col1 = (*aColSet1)[i];
+
+        for ( TInt j=1; j<=aColSet2->Count( ); j++ )
+            {
+            const TDbCol& col2 = (*aColSet2)[j];
+            TInt cmpResult = col1.iName.Compare( col2.iName );
+
+            if ( cmpResult == 0 && !foundColumn )
+                {
+                foundColumn = ETrue;
+                if ( col1.iType != col2.iType )
+                    User::Leave( KErrCorrupt );
+                if ( !col1.IsLong( col1.iType ) && col1.iMaxLength
+                        != col2.iMaxLength )
+                    User::Leave( KErrCorrupt );
+                if ( col1.iAttributes != col2.iAttributes )
+                    User::Leave( KErrCorrupt );
+                }
+            else if ( cmpResult == 0 && foundColumn )
+                User::Leave( KErrCorrupt );
+            }
+        if ( !foundColumn )
+            User::Leave( KErrCorrupt );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::CheckDatabaseL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMetadataStorage::CheckDatabaseL()
+    {
+    CDbTableNames *tableNames = iDatabase.TableNamesL( );
+    CleanupStack::PushL( tableNames );
+
+    if ( !tableNames )
+        User::Leave( KErrCorrupt );
+    CUpnpCdDbFactory* cdf = CUpnpCdDbFactory::NewLC( );
+
+    for ( TInt i=0; i<tableNames->Count( ); i++ )
+        {
+        CDbColSet *colSetRef = NULL;
+
+        if ( (*tableNames)[i].Compare( KObjectTableName ) == 0 )
+            {
+            colSetRef = cdf->CreateObjectTableColumnSequenceLC( );
+            }
+        else if ( (*tableNames)[i].Compare( KElementTableName ) == 0 )
+            {
+            colSetRef = cdf->CreateElementTableColumnSequenceLC( );
+            }
+        else if ( (*tableNames)[i].Compare( KAttributeTableName ) == 0 )
+            {
+            colSetRef = cdf->CreateAttributeTableColumnSequenceLC( );
+            }
+        else if ( (*tableNames)[i].Compare( KResourcesTableName ) == 0 )
+            {
+            colSetRef = cdf->CreateResourceTableColumnSequenceLC( );
+            }
+        else if ( (*tableNames)[i].Compare( KSequencesTableName ) == 0 )
+            {
+            colSetRef = cdf->CreateSequenceTableColumnSequenceLC( );
+            }
+        else
+            User::Leave( KErrCorrupt );
+
+        CDbColSet *colSet = iDatabase.ColSetL( (*tableNames)[i] );
+        CleanupStack::PushL( colSet );
+
+        CompareDbColSetsL( colSet, colSetRef );
+
+        CleanupStack::PopAndDestroy( colSet );
+        CleanupStack::PopAndDestroy( colSetRef );
+        }
+
+    CleanupStack::PopAndDestroy( cdf );
+    CleanupStack::PopAndDestroy( tableNames );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::HandleDbError
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMetadataStorage::HandleDbError( TInt aError )
+    {
+    TInt err = aError;
+    if ( err == KErrCorrupt )
+        {
+        if ( iIsOpen )
+            {
+            err = RecoverDatabase( );
+            }
+        if ( err!=KErrNone && err!=KErrDiskFull && err!=KErrNoMemory )
+            {
+            TRAP( err, RecreateDatabaseFileL( ) );
+            if ( err )
+                {
+                iIsOpen = EFalse;
+                err = KErrCorrupt;
+                }
+            else
+                {
+                iIsOpen = ETrue;
+                }
+            }
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMetadataStorage::IsDbCreated
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpMetadataStorage::IsDbCreated()
+    {
+    return iIsOpen;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpmimemapper.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,218 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpmimemapper.h"
+#include "upnpstring.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpMimeMapper::CUpnpMimeMapper
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpMimeMapper::CUpnpMimeMapper()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMimeMapper::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMimeMapper::ConstructL()
+    {
+    InitMimeToExtensionMapL();
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMimeMapper::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMimeMapper* CUpnpMimeMapper::NewL()
+    {
+    CUpnpMimeMapper* self = new( ELeave ) CUpnpMimeMapper();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMimeMapper::~CUpnpMimeMapper
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpMimeMapper::~CUpnpMimeMapper()
+    {
+    delete iMimeToExtMap;    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMimeMapper::InitMimeToExtensionMapL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMimeMapper::InitMimeToExtensionMapL()
+    {
+    iMimeToExtMap = new (ELeave) CUpnpMap<HBufC>();
+    
+    AddMimeMapElL(KXHtmlMime(),KXHtmlExt());
+    AddMimeMapElL(KHtmlMime, KHtmlExt );
+    AddMimeMapElL(KXmlMime1, KXmlExt  );
+    AddMimeMapElL(KXmlMime2, KXmlExt  );
+    AddMimeMapElL(KXmlMime3, KXmlExt  );  // 2)
+    AddMimeMapElL(KTxtMime,  KTxtExt  );
+    AddMimeMapElL(KTxtMime2, KTxtExt );  //  3)
+    AddMimeMapElL(KTxtMime3, KTxtExt );  //  4)
+    AddMimeMapElL(KTxtMime4, KTxtExt );  //  5)
+    AddMimeMapElL(KTxtMime5, KTxtExt );  //  6)
+    AddMimeMapElL(KTxtMime6, KTxtExt );  //  7)
+    AddMimeMapElL(KJpegMime, KJpegExt );
+    AddMimeMapElL(KJpegMime2, KJpegExt ); 
+    AddMimeMapElL(KJpegMime3, KJpegExt );  
+    AddMimeMapElL(KJpegMime4, KJpegExt );  
+    AddMimeMapElL(KJpegMime5, KJpegExt ); 
+    
+    AddMimeMapElL(KJpgMime,  KJpgExt  );
+    AddMimeMapElL(KJpgMime2, KJpgExt ); 
+    AddMimeMapElL(KJpgMime3, KJpgExt );  
+    AddMimeMapElL(KJpgMime4, KJpgExt );  
+    AddMimeMapElL(KJpgMime5, KJpgExt ); 
+    
+    AddMimeMapElL(KGifMime,  KGifExt  );
+    AddMimeMapElL(KGifMime2, KGifExt );   
+     AddMimeMapElL(KGifMime3, KGifExt );   
+    
+    AddMimeMapElL(KPngMime,  KPngExt  );
+    AddMimeMapElL(KPngMime2, KPngExt );  
+    AddMimeMapElL(KPngMime3, KPngExt ); 
+    
+    AddMimeMapElL(KMpgMime1, KMpgExt1 );
+    AddMimeMapElL(KMpgMime2, KMpgExt1 ); 
+    AddMimeMapElL(KMpgMime3, KMpgExt1 );  
+    AddMimeMapElL(KMpgMime4, KMpgExt1 );  
+    AddMimeMapElL(KMpgMime5, KMpgExt1 );  
+    AddMimeMapElL(KMpgMime6, KMpgExt1 );  
+    AddMimeMapElL(KMpgMime7, KMpgExt1 );  
+    AddMimeMapElL(KMpgMime8, KMpgExt1 );  
+    AddMimeMapElL(KMpgMime9, KMpgExt1 );  
+    AddMimeMapElL(KMpgMime10, KMpgExt1); 
+    
+    AddMimeMapElL(KMpeg4Mime,KMpeg4Ext);
+    
+    AddMimeMapElL(KMp4Mime,  KMp4Ext  );
+    AddMimeMapElL(KMp4Mime2, KMp4Ext );  
+    AddMimeMapElL(KMp4Mime3, KMp4Ext );  
+    
+    AddMimeMapElL(KAviMime1, KAviExt  );
+    AddMimeMapElL(KAviMime2, KAviExt  );
+    AddMimeMapElL(KAviMime3, KAviExt  );
+    AddMimeMapElL(KAviMime4, KAviExt  );    
+    AddMimeMapElL(KAviMime5, KAviExt  );    
+    AddMimeMapElL(KAviMime6, KAviExt  );    
+    AddMimeMapElL(KAviMime7, KAviExt  );    
+    AddMimeMapElL(KAviMime8, KAviExt  );    
+    
+    AddMimeMapElL(KMp3Mime1, KMp3Ext  );
+    AddMimeMapElL(KMp3Mime2, KMp3Ext  );
+    AddMimeMapElL(KMp3Mime3, KMp3Ext );   // 1) AddMimeMapElL(KMpgMime2, KMpgExt2 );
+    AddMimeMapElL(KMp3Mime4, KMp3Ext );   
+    AddMimeMapElL(KMp3Mime5, KMp3Ext );   
+    AddMimeMapElL(KMp3Mime6, KMp3Ext );   
+    AddMimeMapElL(KMp3Mime7, KMp3Ext );   
+    AddMimeMapElL(KMp3Mime8, KMp3Ext );    
+    AddMimeMapElL(KMp3Mime9, KMp3Ext );    
+    AddMimeMapElL(KMp3Mime10, KMp3Ext );   
+    
+    AddMimeMapElL(KAacMime,  KAacExt  );
+    
+    AddMimeMapElL(KWmaMime,  KWmaExt  );
+    AddMimeMapElL(KWmaMime2, KWmaExt );   
+    
+    AddMimeMapElL(KBmpMime,  KBmpExt  );
+    AddMimeMapElL(KBmpMime2, KBmpExt );   
+    AddMimeMapElL(KBmpMime3, KBmpExt );   
+    AddMimeMapElL(KBmpMime4, KBmpExt );   
+    AddMimeMapElL(KBmpMime5, KBmpExt );   
+    AddMimeMapElL(KBmpMime6, KBmpExt );    
+    AddMimeMapElL(KBmpMime7, KBmpExt );    
+    AddMimeMapElL(KBmpMime8, KBmpExt );    
+    AddMimeMapElL(KBmpMime9, KBmpExt );    
+    
+    AddMimeMapElL(KAudioL16, KExtensionWav );    // .wav for audio/L16
+    AddMimeMapElL(KAudioWav, KExtensionWav );    // .wav for audio/wav
+    AddMimeMapElL(KAudioVnd, KExtensionAac );    // .aac for audio/vnd.dlna.adts
+    AddMimeMapElL(KAudio3gpp, K3gpExt );   //audio/3gpp -> .3gp
+    AddMimeMapElL(KVideo3gpp, K3gpExt );   //video/3gpp -> .3gp
+    AddMimeMapElL(KAudioAMR, KAmrExt );   //audio/AMR -> .amr
+    
+    AddMimeMapElL(KVideoWmv, KWmvExt); //video/x-ms-wmv -> .wmv
+    AddMimeMapElL(KVideoAvi, KAviExt); //video/x-ms-wmv -> .avi
+
+    AddMimeMapElL(KRealMedia, KRmExt); //application/vnd.rn-realmedia -> .rm
+    AddMimeMapElL(KRealAudio, KRealAudioExt); //audio/vnd.rn-realaudio -> .ra
+    AddMimeMapElL(KPmRealAudioPlugin, KPmRealAudioPluginExt); //audio/x-pn-realaudio-plugin -> .rpm
+    AddMimeMapElL(KPmRealAudio, KPmRealAudioExt); //audio/x-pn-realaudio -> .ra
+    AddMimeMapElL(KRealVideo, KRealVideoExt); //video/vnd.rn-realvideo -> .rv
+    
+    }    
+
+// -----------------------------------------------------------------------------
+// CUpnpMimeMapper::AddMimeMapElL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMimeMapper::AddMimeMapElL( const TDesC8& aKey, const TDesC& aVal )
+    {
+    HBufC* val = aVal.AllocLC();
+    iMimeToExtMap->PutL(aKey, val);
+    CleanupStack::Pop(val);        
+    }   
+    
+// -----------------------------------------------------------------------------
+// CUpnpMimeMapper::GetExtensionL
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpMimeMapper::GetExtensionL( const TDesC8& aMimeType )
+    {
+    HBufC8* result = NULL;
+    const HBufC16* result16 = NULL;
+    HBufC8* mimeTypeH = aMimeType.AllocLC();
+    TPtr8 mimeType( mimeTypeH->Des() );
+    mimeType.LowerCase();
+    result16 = iMimeToExtMap->Get( mimeType );
+    if(result16)
+        {
+    	result = UpnpString::FromUnicodeL( *result16);	
+        }
+    CleanupStack::PopAndDestroy( mimeTypeH );
+    return result; 
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMimeMapper::Get
+// -----------------------------------------------------------------------------
+//
+const HBufC* CUpnpMimeMapper::Get( const TDesC8& aMimeType )
+    {
+    return iMimeToExtMap->Get( aMimeType );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpmspathutility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,457 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+*
+* Description:  Utility class to get path related info for the media files
+*/
+
+// INCLUDE FILES
+#include <bautils.h>    
+#include <upnpstring.h>
+#include <upnpdlnaprotocolinfo.h>
+#include <pathinfo.h>
+#include <centralrepository.h>
+
+#include "upnpmspathutility.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpcdutils.h"
+#include "upnpdominterface.h"
+
+// CONSTANTS
+_LIT( KYearMonthDayFormat,        "%04d\\%02d\\%02d\\");
+_LIT( KArtistFormat,              "%S\\");
+_LIT( KAlbumFormat,               "%S\\");
+_LIT( KBackSlash,                 "\\");
+_LIT( KSlashData,                 "\\Data\\");
+_LIT( KUnknown,                   "Unknown");
+
+_LIT( KSeparator,                 ":" );
+_LIT( KNullTime,                  "000000" );
+
+_LIT8( KMimeAudio,                "audio" );
+_LIT8( KMimeVideo,                "video" );
+_LIT8( KMimeImage,                "image" );
+_LIT8( KMimePlaylist,             "audio/mpegurl" );
+
+
+const TUid KCRUidMediaServer   = { 0x101F978F };
+const TInt KDateStringLength        = 10;
+const TInt KDateTimeStringLength    = 19;
+const TInt KMaxDateStringLength     = 30;
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// ---------------------------------------------------------------------------
+// CUPnPMSPathUtility::CUPnPMSPathUtility
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CUPnPMSPathUtility::CUPnPMSPathUtility()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPMSPathUtility::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CUPnPMSPathUtility* CUPnPMSPathUtility::NewL()
+    {
+    CUPnPMSPathUtility* self = CUPnPMSPathUtility::NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPMSPathUtility::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CUPnPMSPathUtility* CUPnPMSPathUtility::NewLC()
+    {
+    CUPnPMSPathUtility* self = new( ELeave ) CUPnPMSPathUtility;
+    CleanupStack::PushL( self );
+    self->ConstructL( KCRUidMediaServer );
+       return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CUPnPMSPathUtility::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CUPnPMSPathUtility::ConstructL(TUid aRepositoryUid)
+    {
+    iRepository = CRepository::NewL(aRepositoryUid);
+    }
+    
+// ---------------------------------------------------------------------------
+// CUPnPMSPathUtility::~CUPnPMSPathUtility()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CUPnPMSPathUtility::~CUPnPMSPathUtility()
+    {
+    delete iRepository;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::GetCopyPathDriveL
+// Gets the drive for the copy operation
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+void CUPnPMSPathUtility::GetCopyPathDriveL( 
+             TDriveNumber& aDrive ) const
+    {
+    HBufC* location = HBufC::NewL(KMaxFileName);
+    CleanupStack::PushL( location );
+
+    TPtr locPtr = location->Des();
+    
+    // Get the location setting from ServerSettings
+    iRepository->Get( EUploadDirectory, locPtr );
+
+    // Check to see if drive is ready.
+    TVolumeInfo volInfo;
+    TDriveUnit driveUnit = TDriveUnit( locPtr );
+    
+    RFs fileServer;
+    User::LeaveIfError( fileServer.Connect() );
+    CleanupClosePushL( fileServer );
+    User::LeaveIfError( fileServer.Volume( volInfo, driveUnit ) );
+    CleanupStack::PopAndDestroy( &fileServer );
+
+    aDrive = (TDriveNumber)((TInt)driveUnit);
+
+    CleanupStack::PopAndDestroy( location );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::GetCopyPathL
+// Returns the path of the upnp item to be copied
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+HBufC* CUPnPMSPathUtility::GetCopyPathL(
+                        const TXmlEngElement& aItem,
+                        CUpnpDlnaProtocolInfo& aProInfo ) const
+    {
+    TDriveNumber drive;
+    GetCopyPathDriveL( drive );   
+    return GetCreateCopyPathL( aItem, 
+                               aProInfo, 
+                               EFalse,
+                               drive );
+    }   
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::CreateCopyPathL
+// Returns the path of the upnp item to be copied
+// Creates the path if necessary and appends the filename and extension if
+// required
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+HBufC* CUPnPMSPathUtility::CreateCopyPathL(
+                const TXmlEngElement& aItem,
+                CUpnpDlnaProtocolInfo& aProInfo ) const
+    {
+    TDriveNumber drive;
+    GetCopyPathDriveL( drive );
+    return GetCreateCopyPathL( aItem, 
+                               aProInfo, 
+                               ETrue,
+                               drive );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::GetCreateCopyPathL
+// Returns the path of the upnp item to be copied
+// Creates the path if necessary and appends the filename and extension if
+// required
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+HBufC* CUPnPMSPathUtility::GetCreateCopyPathL(
+               const TXmlEngElement& aItem,
+               CUpnpDlnaProtocolInfo& aProInfo,
+               TBool aCreatePath,
+               TDriveNumber aDriveNumber ) const
+    {
+       
+    HBufC* path = HBufC::NewLC( KMaxPath );
+    TPtr refPath = path->Des();
+    
+    TDriveUnit driveUnit = TDriveUnit( aDriveNumber );
+    AppendDataL( refPath, driveUnit.Name() );
+    if ( EDriveC == driveUnit )
+        {
+        //C:\\Data\\(Images/Videos/Sounds)....
+        AppendDataL( refPath, KSlashData );
+        }
+    else
+        {
+        //\\(Images/Videos/Sounds)....
+        AppendDataL( refPath, KBackSlash );
+        }
+    
+    // Get the protocolinfo-attribute
+    TUPnPItemType fileType = FileTypeByMimeTypeL( 
+            aProInfo.ThirdField() );
+    
+    switch( fileType )
+        {
+        case ETypeAudio:
+            {
+            AppendDataL( refPath, PathInfo::SoundsPath() );
+            AppendArtistAlbumL( refPath, aItem );
+            break;
+            }
+        case ETypeVideo:
+            {
+            AppendDataL( refPath, PathInfo::VideosPath() );
+            AppendYearMonthDayL( refPath, aItem );
+            break;
+            }
+        case ETypeImage:
+            {
+            AppendDataL( refPath, PathInfo::ImagesPath() );
+            AppendYearMonthDayL( refPath, aItem );
+            break;
+            }
+        case ETypePlaylist:
+        case ETypeOther:
+        default:
+            {
+            AppendDataL( refPath, PathInfo::OthersPath() );
+            }                
+        }
+    if( aCreatePath )
+        {
+        RFs fs;
+        User::LeaveIfError( fs.Connect() );
+        CleanupClosePushL(fs);
+        BaflUtils::EnsurePathExistsL( fs, refPath );
+        CleanupStack::PopAndDestroy(&fs);
+        }
+    CleanupStack::Pop( path );
+    
+    return path;
+    }   
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::FileTypeByMimeTypeL
+// Get the file type based on MIME type of the file. Leaves in error cases.
+// --------------------------------------------------------------------------
+CUPnPMSPathUtility::TUPnPItemType CUPnPMSPathUtility::FileTypeByMimeTypeL(
+        const TDesC8& aMimeType ) const
+    {
+    TUPnPItemType returnValue = ETypeOther;
+
+    if( aMimeType != KNullDesC8 )
+        {
+        if( aMimeType.Find( KMimeImage() ) >= 0 )
+            {
+            returnValue = ETypeImage;
+            }
+        else if( aMimeType.Find( KMimePlaylist() ) >= 0 )
+            {
+            returnValue = ETypePlaylist;
+            }
+        else if( aMimeType.Find( KMimeAudio() ) >= 0 )
+            {
+            returnValue = ETypeAudio;
+            }
+        else if( aMimeType.Find( KMimeVideo() ) >= 0 )
+            {
+            returnValue = ETypeVideo;
+            }
+        else
+            {
+            returnValue = ETypeOther;
+            }
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::AppendYearMonthDayL
+// Appends year, month and day to the path.
+// --------------------------------------------------------------------------
+//
+void CUPnPMSPathUtility::AppendYearMonthDayL( 
+        TDes& aPath, const TXmlEngElement& aItem ) const
+    {  
+    // Get the date-element
+    TXmlEngElement dateElem;
+    UpnpDomInterface::GetElementL( aItem, dateElem, KDate8 );
+    TTime date; date.HomeTime();
+    if ( !dateElem.IsNull( ) )
+        {
+        UPnPDateAsTTimeL( dateElem.Value(), date );
+        }     
+    
+    TDateTime ymd = date.DateTime();
+    CheckBufferSpaceL( aPath, 11 ); //4(year)+2(month)+2(day)+3(\)
+    
+    aPath.AppendFormat( KYearMonthDayFormat(), 
+            ymd.Year(), ymd.Month()+1, ymd.Day()+1 );
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::AppendArtistAlbumL
+// Appends artist and album to the path.
+// --------------------------------------------------------------------------
+//
+void CUPnPMSPathUtility::AppendArtistAlbumL( 
+        TDes& aPath, const TXmlEngElement& aItem ) const
+    {
+    
+    // Get the artist-element
+    TXmlEngElement artistElem;
+    UpnpDomInterface::GetElementL( aItem, artistElem, KArtist );
+    if ( !artistElem.IsNull( )  )
+        {
+        HBufC* artist = UpnpString::ToUnicodeL( artistElem.Value() );
+        CleanupStack::PushL( artist );
+        
+        TPtr ptrArtist = artist->Des();
+        UpnpCdUtils::ValidateFilePath( ptrArtist );
+        
+        CheckBufferSpaceL( aPath, artist->Length()+1 );// 1 for '\'          
+        aPath.AppendFormat( KArtistFormat(), artist );
+        
+        CleanupStack::PopAndDestroy( artist );
+        }
+    else
+        {
+        CheckBufferSpaceL( aPath, KUnknown().Length()+1 );  // 1 for '\'       
+        aPath.AppendFormat( KArtistFormat(), &KUnknown() );
+        }
+    
+    // Get the album-element
+    TXmlEngElement albumElem;
+    UpnpDomInterface::GetElementL( aItem, albumElem, KAlbum );
+    if ( !albumElem.IsNull( ) )
+        {
+        HBufC* album = UpnpString::ToUnicodeL( albumElem.Value() );
+        CleanupStack::PushL( album );
+        
+        TPtr ptrAlbum = album->Des();
+        UpnpCdUtils::ValidateFilePath( ptrAlbum );
+        
+        CheckBufferSpaceL( aPath, album->Length()+1 );// 1 for '\'
+        aPath.AppendFormat( KAlbumFormat(), album );
+        CleanupStack::PopAndDestroy( album );
+        }
+    else
+        {
+        CheckBufferSpaceL( aPath, KUnknown().Length()+1 );  // 1 for '\'       
+        aPath.AppendFormat( KAlbumFormat(), &KUnknown() );
+        }
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::AppendDataL
+// Appends data to the path's buffer.
+// --------------------------------------------------------------------------
+//
+void CUPnPMSPathUtility::AppendDataL( 
+        TDes& aPath, const TDesC& aData ) const
+    {  
+    CheckBufferSpaceL( aPath, aData );
+    aPath.Append( aData );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::CheckBufferSpaceL
+// Checks whether the data can be appended to buffer or not.
+// --------------------------------------------------------------------------
+//
+void CUPnPMSPathUtility::CheckBufferSpaceL( 
+        const TDes& aPath, const TDesC& aData ) const
+    {
+    CheckBufferSpaceL( aPath, aData.Length() );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::CheckBufferSpaceL
+// Checks whether the data of the specified length
+// can be appended to buffer or not.
+// --------------------------------------------------------------------------
+//
+void CUPnPMSPathUtility::CheckBufferSpaceL( 
+        const TDes& aPath, const TInt& aLength ) const
+    {  
+    if ( (aPath.Length() + aLength) > aPath.MaxLength() )
+        {
+        User::Leave( KErrOverflow );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMSPathUtility::UPnPDateAsTTimeL
+// Converts upnp date to TTime object.
+//---------------------------------------------------------------------------
+void CUPnPMSPathUtility::UPnPDateAsTTimeL( const TDesC8& aUpnpDate,
+    TTime& aTime ) const
+    {
+    // This method is capable of handling the most common dc:date formats:
+    // CCYY-MM-DD and CCYY-MM-DDThh:mm:ss
+    // Rest of the dc:date formats are handled as well, but they might not
+    // be converted precisely
+    
+    TBuf<KMaxDateStringLength> formatDateString;
+    HBufC* dateString = HBufC::NewL( aUpnpDate.Length() );
+    dateString->Des().Copy( aUpnpDate );
+
+    if( aUpnpDate.Length() >= KDateStringLength )
+        {
+        // CCYY-MM-DD --> CCYYMMDD
+        formatDateString.Copy( dateString->Des().Left( 4 ) ); // Year
+        formatDateString.Append( dateString->Des().Mid( 5,2 ) ); // Month
+        formatDateString.Append( dateString->Des().Mid( 8,2 ) ); // Day        
+
+        if( aUpnpDate.Length() >= KDateTimeStringLength )
+            {
+            // hh:mm:ss --> hhmmss
+            formatDateString.Append( KSeparator );
+            // Hours
+            formatDateString.Append( dateString->Des().Mid( 11, 2 ) ); 
+            // Minutes
+            formatDateString.Append( dateString->Des().Mid( 14, 2 ) );
+            // Seconds 
+            formatDateString.Append( dateString->Des().Mid( 17, 2 ) ); 
+            }
+        else
+            {
+            // hh:mm:ss --> 000000
+            formatDateString.Append( KSeparator );
+            formatDateString.Append( KNullTime );
+            }
+        }
+    delete dateString;
+    
+    User::LeaveIfError( aTime.Set( formatDateString ) );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpobjectbean.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,351 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "upnpobjectbean.h"
+#include "upnpcontentdirectoryglobals.h"
+#include <upnpobject.h>
+#include <upnpitem.h>
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::CUpnpObjectBean
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpObjectBean::CUpnpObjectBean()
+{
+    iObjRefId = KUndef;
+
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::ConstructL()
+{
+
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpObjectBean* CUpnpObjectBean::NewLC()
+{
+    CUpnpObjectBean* self = new( ELeave ) CUpnpObjectBean;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpObjectBean* CUpnpObjectBean::NewLC(const RDbRowSet& aRowSet)
+{
+    CUpnpObjectBean* self = NewLC();
+    self->SetL(aRowSet);
+    return self;
+}    
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpObjectBean* CUpnpObjectBean::NewL(const RDbRowSet& aRowSet)
+{
+    CUpnpObjectBean* self = NewLC(aRowSet);
+    CleanupStack::Pop();
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::~CUpnpObjectBean
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpObjectBean::~CUpnpObjectBean()
+{
+    delete iObjTitle;
+    delete iObjClass;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::SetL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::SetL(const RDbRowSet& aRowSet)
+{
+    // get cols ids
+    CDbColSet* colSet = aRowSet.ColSetL();
+    CleanupStack::PushL(colSet);
+    const TInt idColNo          = colSet->ColNo(KObjIdColName);
+    const TInt parentIDColNo    = colSet->ColNo(KObjParentIdColName);
+    const TInt titleColNo       = colSet->ColNo(KObjTiltleColName);
+    const TInt classColNo       = colSet->ColNo(KObjClassColName);
+    const TInt restrictedColNo  = colSet->ColNo(KObjRestrictedColName);
+    const TInt searchableColNo  = colSet->ColNo(KObjSearchableColName);
+    const TInt refIDColNo       = colSet->ColNo(KObjRefIdColName);  
+    CleanupStack::PopAndDestroy(colSet);
+    
+    // for each column call setter
+    if( idColNo != KDbNullColNo )
+    {
+        SetObjId( aRowSet.ColInt(idColNo) );
+    }
+    if( parentIDColNo != KDbNullColNo )
+    {
+        SetObjParentId( aRowSet.ColInt(parentIDColNo) );
+    }
+    if( titleColNo != KDbNullColNo )
+    {
+        SetObjTitleL( aRowSet.ColDes8(titleColNo) );
+    }
+    if( classColNo != KDbNullColNo )
+    {
+        SetObjClassL( aRowSet.ColDes8(classColNo) );
+    }
+    if( restrictedColNo != KDbNullColNo )
+    {
+        SetObjRestricted( aRowSet.ColUint8(restrictedColNo) );
+    }
+    if( searchableColNo != KDbNullColNo && !aRowSet.IsColNull(searchableColNo) )
+    {
+        SetObjSearchable( aRowSet.ColUint8(searchableColNo) );
+    }
+    else
+    {
+        SetObjSearchable( KUndef);
+    }
+    if( refIDColNo != KDbNullColNo && !aRowSet.IsColNull(refIDColNo) )
+    {
+        SetObjRefId( aRowSet.ColInt(refIDColNo) );
+    }
+    else
+    {
+        SetObjRefId(KUndef);
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::SetObjTitleL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::SetObjTitleL(const TDesC8& aObjTitle)
+{
+    delete iObjTitle;
+    iObjTitle = NULL;
+    iObjTitle = aObjTitle.AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::SetObjClassL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::SetObjClassL(const TDesC8& aObjClass)
+{
+    delete iObjClass;
+    iObjClass = NULL;
+    iObjClass = aObjClass.AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachObjectElL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TXmlEngElement CUpnpObjectBean::AttachObjectElL(TXmlEngElement aElement)
+{
+    TXmlEngElement object;
+    
+    // check if the object is a container
+    if( ObjClass().Find( KContainerClass8 ) == 0 ) 
+    { // container
+        object = aElement.AddNewElementSameNsL( KContainer() );
+    }
+    else
+    { // item
+        object = aElement.AddNewElementSameNsL( KItem() );
+    }
+    
+    // add required properties
+    AttachRequiredPropertiesL(object);
+    
+    return object;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachRequiredPropertiesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::AttachRequiredPropertiesL(TXmlEngElement aElement)
+{
+    // id
+    AttachIdL(aElement);
+    // parentId
+    AttachParentIdL(aElement);
+    // restricted
+    AttachRestrictedL(aElement);
+    // title
+    AttachTitleL(aElement);
+    // class
+    AttachClassL(aElement);
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachWholeObjectElL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TXmlEngElement CUpnpObjectBean::AttachWholeObjectElL(TXmlEngElement aElement)
+{
+    // object with required properties
+    TXmlEngElement object = AttachObjectElL(aElement);
+    
+    // optional properties:
+    // refId
+    AttachRefIdL(object);
+    // searchable
+    AttachSearchableL(object);
+    
+    return object;
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachRefIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::AttachRefIdL(TXmlEngElement aElement)
+{
+    if(ObjRefId() != CUpnpObjectBean::KUndef)
+    {
+        TBuf8<KMaxIntegerLen> num;
+        num.Num(ObjRefId()); 
+        aElement.AddNewAttributeL( KRefID(), num ); 
+    }       
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachSearchableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::AttachSearchableL(TXmlEngElement aElement)
+{
+    if(ObjSearchable() != CUpnpObjectBean::KUndef)
+    {
+        if( ObjSearchable() )
+        { // true
+            aElement.AddNewAttributeL( KSearchable(), KTrueValue8() );
+        }
+        else
+        { // false
+            aElement.AddNewAttributeL( KSearchable(), KFalseValue8() );
+        }
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::AttachIdL(TXmlEngElement aElement)
+{
+    TBuf8<KMaxIntegerLen> num;
+    num.Num(ObjId()); 
+    aElement.AddNewAttributeL( KIdAttrName(), num );
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachParentIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::AttachParentIdL(TXmlEngElement aElement)
+{
+    TBuf8<KMaxIntegerLen> num;
+    num.Num(ObjParentId()); 
+    aElement.AddNewAttributeL( KParentID(), num );
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachRestrictedL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::AttachRestrictedL(TXmlEngElement aElement)
+{
+    if( ObjRestricted() )
+    { // true
+        aElement.AddNewAttributeL( KRestricted(), KTrueValue8() );
+    }
+    else
+    { // false
+        aElement.AddNewAttributeL( KRestricted(), KFalseValue8() );
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachTitleL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::AttachTitleL(TXmlEngElement aElement)
+{
+    aElement.AddNewElementUsePrefixL( KTitle(), KDcNsPrefix() ).SetValueL( ObjTitle() );
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::AttachClassL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::AttachClassL(TXmlEngElement aElement)
+{
+    aElement.AddNewElementUsePrefixL( KClassTagName(), KUpnpNsPrefix() ).SetValueL( ObjClass() );
+}
+// -----------------------------------------------------------------------------
+// CUpnpObjectBean::CopyToUpnpObjectL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpObjectBean::CopyToUpnpObjectL(CUpnpObject* aObj)
+{	
+	HBufC8* id = HBufC8::NewLC(KMaxIntegerLen);
+    id->Des().Num(iObjId);    
+	aObj->SetIdL(*id);
+	CleanupStack::PopAndDestroy(id); 
+	
+	HBufC8* parentId = HBufC8::NewLC(KMaxIntegerLen);
+    parentId->Des().Num(iObjParentId);    		
+	aObj->SetParentIdL(*parentId);
+	CleanupStack::PopAndDestroy(parentId); 
+	
+	aObj->SetTitleL(*iObjTitle);
+	aObj->SetRestricted(iObjRestricted);
+	aObj->SetObjectClassL(*iObjClass);
+	if( iObjRefId != KUndef && aObj->ObjectType() == EUPnPItem)
+	{
+	    CUpnpItem* item = dynamic_cast<CUpnpItem*>(aObj);
+	    HBufC8* iObjRefIdString = HBufC8::NewLC(KMaxIntegerLen);
+    	iObjRefIdString->Des().Num(iObjRefId);
+	    item->SetRefIdL(*iObjRefIdString);
+	    CleanupStack::PopAndDestroy(iObjRefIdString); 
+	}
+}
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpresourcesbean.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,154 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpresourcesbean.h"
+#include "upnpcontentdirectoryglobals.h"
+#include <upnpelement.h>
+#include "upnpcdutils.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::CUpnpResourcesBean
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpResourcesBean::CUpnpResourcesBean()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpResourcesBean::ConstructL()
+{
+
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpResourcesBean* CUpnpResourcesBean::NewLC()
+{
+    CUpnpResourcesBean* self = new( ELeave ) CUpnpResourcesBean;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpResourcesBean* CUpnpResourcesBean::NewLC(const RDbRowSet& aRowSet)
+{
+    CUpnpResourcesBean* self = NewLC();
+    self->SetL(aRowSet);
+    return self;
+}    
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpResourcesBean* CUpnpResourcesBean::NewL(const RDbRowSet& aRowSet)
+{
+    CUpnpResourcesBean* self = NewLC(aRowSet);
+    CleanupStack::Pop();
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::~CUpnpResourcesBean
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpResourcesBean::~CUpnpResourcesBean()
+{
+    delete iPath;
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::SetL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpResourcesBean::SetL(const RDbRowSet& aRowSet)
+{
+    // get cols ids
+    CDbColSet* colSet = aRowSet.ColSetL();
+    CleanupStack::PushL(colSet);
+    const TInt idColNo          =    colSet->ColNo( KRscIdColName       );
+    const TInt pathColNo        =    colSet->ColNo( KRscPathColName     );
+    const TInt isReadonlyColNo  =    colSet->ColNo( KRscReadonlyColName );
+    const TInt isThumbnailColNo  =   colSet->ColNo( KRscThumbnailColName );
+    const TInt idObjColNo       =    colSet->ColNo( KRscIdObjColName );
+    
+    CleanupStack::PopAndDestroy(colSet);
+    
+    // for each column call setter
+    if( idColNo != KDbNullColNo )
+    {
+        SetId(aRowSet.ColInt64(idColNo));
+    }
+    if( pathColNo != KDbNullColNo )
+    {
+        SetPathL(aRowSet.ColDes(pathColNo));
+    }
+    if( isReadonlyColNo != KDbNullColNo )
+    {
+        SetIsReadonly(aRowSet.ColUint8(isReadonlyColNo));
+    }
+    if( isThumbnailColNo != KDbNullColNo )
+    {
+        SetIsThumbnail(aRowSet.ColUint8(isThumbnailColNo));
+    }
+    if( idObjColNo != KDbNullColNo )
+    {
+        SetObjectId(aRowSet.ColInt(idObjColNo));
+    }
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::SetPathL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpResourcesBean::SetPathL(const TDesC& aPath)
+{
+    delete iPath;
+    iPath = NULL;
+    iPath = aPath.AllocL();
+}
+// -----------------------------------------------------------------------------
+// CUpnpResourcesBean::SetPathL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpResourcesBean::SetPathL(const TDesC8& aPath)
+{
+	delete iPath;
+	iPath = NULL;
+	iPath = UpnpCdUtils::Des8ToDesL(aPath);
+}
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpsender.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,95 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "upnpsender.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpcontentdirectory.h"
+#include <upnpobject.h>
+#include <upnpitem.h>
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpCdsSender::CUpnpCdsSender
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpCdsSender::CUpnpCdsSender(CUpnpContentDirectory* aCd)
+{
+    iCd = aCd;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpCdsSender::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdsSender::ConstructL()
+{
+
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdsSender::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCdsSender* CUpnpCdsSender::NewLC(CUpnpContentDirectory* aCd)
+{
+    CUpnpCdsSender* self = new (ELeave) CUpnpCdsSender(aCd);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}    
+// -----------------------------------------------------------------------------
+// CUpnpCdsSender::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpCdsSender* CUpnpCdsSender::NewL(CUpnpContentDirectory* aCd)
+{
+    CUpnpCdsSender* self = NewLC(aCd);
+    CleanupStack::Pop();
+    return self;
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdsSender::~CUpnpCdsSender
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpCdsSender::~CUpnpCdsSender()
+{
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdsSender::SendL
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdsSender::SendL(CUpnpAction* aAction, TUpnpErrorCode aError)
+{
+    iCd->SendActionL(aAction, aError);
+}
+// -----------------------------------------------------------------------------
+// CUpnpCdsSender::SendL
+// -----------------------------------------------------------------------------
+//
+void CUpnpCdsSender::SendL( CUpnpHttpMessage* aMessage )
+{
+    iCd->SendMessageL(aMessage);
+}
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpstatehandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,305 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  State handler
+*
+*/
+
+
+//  INCLUDES
+#include "upnpstatehandler.h"
+#include "upnpstring.h"
+#include "upnpcontainerupdateid.h"
+#include "upnpcontentdirectory.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpcommonupnplits.h"
+
+
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::CUpnpStateHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpStateHandler::CUpnpStateHandler(  )
+{
+    iContainerUpdateIdsEvented = EFalse;          
+}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpStateHandler::ConstructL( CUpnpContentDirectory* aCd )
+{    
+    iContainerUpdateIds.Reset();
+    iCurrentContainerUpdateIds.Reset();
+    iCd=aCd;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpStateHandler* CUpnpStateHandler::NewL( CUpnpContentDirectory* aCd )
+{
+    CUpnpStateHandler* self = new (ELeave) CUpnpStateHandler(  );
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aCd );
+    CleanupStack::Pop( self );
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::~CUpnpStateHandler
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpStateHandler::~CUpnpStateHandler()
+{   
+    // clear tables related to ContainerUpdateIds state variable
+    for( TInt i( 0 ); i < iContainerUpdateIds.Count(); i++ )
+    {
+        delete iContainerUpdateIds[i].iContainerId;
+    }
+    iContainerUpdateIds.Close(); 
+    //--------------------------
+    for( TInt i( 0 ); i < iCurrentContainerUpdateIds.Count(); i++ )
+    {
+        delete iCurrentContainerUpdateIds[i].iContainerId;
+    }
+    iCurrentContainerUpdateIds.Close();
+    //-------------------------- 
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::ContainerUpdateIds
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpStateHandler::ContainerUpdateId( const TDesC8& aContainerID ) 
+{
+    if( aContainerID.Compare( KZero ) == 0 )
+    {
+        return iSystemUpdateId;
+    }
+
+    for(TInt i( 0 ); i < iContainerUpdateIds.Count(); i++ )
+    {
+        if( aContainerID.Compare(*(iContainerUpdateIds[i].iContainerId))==0)
+        {
+            return iContainerUpdateIds[i].iUpdateId;
+        }
+    }
+    return 0; //container not found so it is unmodified and updateId is zero.
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::ContainerUpdateIds
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+RArray<TUpnpContainerUpdateId>& CUpnpStateHandler::ContainerUpdateIds( )
+{    
+    return iContainerUpdateIds;
+}
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::IsEnableL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpStateHandler::IsEnable()
+{
+    if (iCd->SubcribersAmount() > 0) return ETrue;       
+    else return EFalse;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::IncreaseSystemUpdateIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpStateHandler::IncreaseSystemUpdateIdL()
+{
+    if( iSystemUpdateId < KMaxTUint )
+    {
+        iSystemUpdateId++;
+    }
+    else
+    {
+        iSystemUpdateId = 1;
+    }
+    TBuf8<UpnpString::KMaxIntLength> suid;
+    suid.Num( iSystemUpdateId );
+    iCd->SetStateVariableL( KSystemUpdateID, suid );
+    return iSystemUpdateId;
+}
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::IncreaseContainerUpdateIdL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpStateHandler::IncreaseContainerUpdateIdL( const TDesC8& aContainerID )
+{
+    // DLNA.ORG_AnyContainer support - 'any container' 
+    //mapped into container with id=1 
+    HBufC8* properContainerID;
+    
+    if( !aContainerID.Compare(KAnyContainerIndicator8) )    
+        properContainerID = KOne().AllocLC();    
+    else    
+        properContainerID = aContainerID.AllocLC();
+    
+    // iContainerUpdateIds table serving ---------------           
+    TInt updateId( KErrNotFound );
+    TInt i( 0 );
+    for( ; i < iContainerUpdateIds.Count(); i++ )
+    {
+        if( properContainerID->Des().Compare(
+                         *(iContainerUpdateIds[i].iContainerId) ) == 0 )
+        {
+            updateId = iContainerUpdateIds[i].iUpdateId;
+            break;
+        }
+    }
+
+    if( KErrNotFound == updateId ) //first touch to this con´tainer
+    {
+        TUpnpContainerUpdateId cui;
+        
+        cui.iContainerId = properContainerID->AllocL();                                                                           
+        //First time of modification, thus ID is 1.
+        // No magic (white nor black) used here.
+        cui.iUpdateId = 1;
+        iContainerUpdateIds.Append( cui );
+        updateId = cui.iUpdateId;
+    }
+    else
+    {
+        if( iContainerUpdateIds[i].iUpdateId == KMaxTInt )
+        {
+            iContainerUpdateIds[i].iUpdateId = 1;
+        }
+        else
+        {
+            iContainerUpdateIds[i].iUpdateId++;
+        }
+        updateId = iContainerUpdateIds[i].iUpdateId;
+    }
+    
+    // iCurrentContainerUpdateIds table serving ---------------           
+    if (IsEnable())     //if any CP subscribed   
+    {
+    if(iContainerUpdateIdsEvented)
+    {
+        // clearing iCurrentContainerUpdateIds table after:
+        // 1. sending NOTIFY events, and
+        // 2. 'ContainerUpdateIds' state variable change
+        for( TInt i(0); i < iCurrentContainerUpdateIds.Count(); i++ )
+        {
+            delete iCurrentContainerUpdateIds[i].iContainerId;
+        }
+        iCurrentContainerUpdateIds.Reset();
+         
+       iContainerUpdateIdsEvented = EFalse; 
+    }
+    
+    // finding out whether element should be updated or added                                       
+    TBool isEelementFound = EFalse;
+    TInt j( 0 );
+    
+    for( ; j < iCurrentContainerUpdateIds.Count(); j++ )
+    {
+        if( properContainerID->Des().Compare(
+                         *(iCurrentContainerUpdateIds[j].iContainerId) ) == 0 )
+        {            
+            isEelementFound = ETrue;
+            break;
+        }
+    }
+    
+    if(isEelementFound)
+    {
+        iCurrentContainerUpdateIds[j].iUpdateId = updateId;                              
+    }
+    else
+    {
+        TUpnpContainerUpdateId newEl;
+        
+        newEl.iContainerId = properContainerID->AllocL();                                                                                   
+        newEl.iUpdateId = updateId;
+        
+        iCurrentContainerUpdateIds.Append(newEl);
+    }
+                            
+    // preparing new value of 'ContainerUpdateIds' state variable ----   
+                                
+    TInt elCount = iCurrentContainerUpdateIds.Count();
+    TInt totalDescLength = 0;
+        
+    for( TInt k = 0; k < elCount; k++ )
+    {
+        totalDescLength = totalDescLength + 
+                (iCurrentContainerUpdateIds[k].iContainerId)->Des().Length();
+    }    
+    
+    totalDescLength = totalDescLength + elCount*(UpnpString::KMaxIntLength)
+            + elCount - 1;// 'elCount-1'-> quantity of commas in the descriptor
+    
+    HBufC8* variableValue  = HBufC8::NewLC(totalDescLength);                        
+    TPtr8 pVar = variableValue->Des();
+    pVar.Zero();
+        
+    for( TInt k = 0; k < elCount; k++ )
+    {
+        pVar.Append( *(iCurrentContainerUpdateIds[k].iContainerId) );
+        pVar.Append(',');
+        if ((iCurrentContainerUpdateIds[k].iContainerId)->Compare(KZero) == 0)
+            pVar.AppendNum( iSystemUpdateId );
+        else        
+            pVar.AppendNum( iCurrentContainerUpdateIds[k].iUpdateId );    
+        
+        if( k != elCount - 1 ) // last comma not appended
+            pVar.Append(',');
+    }
+                    
+    //Set new value to be evented
+    iCd->SetStateVariableL( KContainerUpdateIDs, *variableValue );
+                            
+    CleanupStack::PopAndDestroy( variableValue );
+    }
+    CleanupStack::PopAndDestroy( properContainerID );   
+         
+ }
+
+// -----------------------------------------------------------------------------
+// CUpnpStateHandler::StateVariableEvented
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpStateHandler::StateVariableEvented(const TDesC8& aVariableName)
+{
+   /* if( aVariableName.Compare(KContainerUpdateIDs) == 0 
+                        && (iCd->SubcribersAmount() > 0 )) */
+    if( aVariableName.Compare(KContainerUpdateIDs) == 0)                         
+    {        
+        iContainerUpdateIdsEvented = ETrue;                                                
+        return;
+    }
+}
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnptablebean.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,71 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Element table data handler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "upnptablebean.h"
+#include <d32dbms.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpTableBean::CUpnpTableBean
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpTableBean::CUpnpTableBean()
+{
+
+}
+// -----------------------------------------------------------------------------
+// CUpnpTableBean::~CUpnpTableBean
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpTableBean::~CUpnpTableBean()
+{
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CUpnpTableBean::ReadLongTextColL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpTableBean::ReadLongTextColL(const RDbRowSet& aRowSet, const TInt aColNo)
+{
+    // prepare buffer
+    TInt colLen = aRowSet.ColLength(aColNo);
+    HBufC8* tmp = HBufC8::NewLC(colLen);
+    TPtr8 tmpPtr(tmp->Des());
+    
+    // read 
+    RDbColReadStream colReadStream;
+    colReadStream.OpenLC(aRowSet, aColNo);
+    colReadStream.ReadL(tmpPtr, colLen); // as the length of the HBufC can be grater than requested
+    
+    // clean up 
+    CleanupStack::PopAndDestroy(&colReadStream);
+    CleanupStack::Pop(tmp);
+    
+    return tmp;
+}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpthumbnailcreator.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,321 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Thumbnail Creator.
+*
+*/
+ 
+
+#include <e32svr.h>
+#include <imageconversion.h>
+#include <bitmaptransforms.h>
+#include <eikfutil.h>
+#include <gulicon.h> 
+
+#include "upnpthumbnailcreator.h"
+#include "upnpthumbnailcreator.h"
+#include "upnpcontentdirectoryglobals.h"
+
+#ifdef _DEBUG
+#define KLogFile _L("UPnPMediaServer.txt")
+#endif
+#include "upnpcustomlog.h"
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpThumbnailCreator* CUpnpThumbnailCreator::NewLC(MUpnpThumbnailCreatorObserver* aObserver)
+{
+    CUpnpThumbnailCreator* self = new (ELeave) CUpnpThumbnailCreator(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::ConstructL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CUpnpThumbnailCreator::ConstructL()
+{
+    User::LeaveIfError(iFs.Connect());
+    iScaler = CBitmapScaler::NewL();
+    iSize.SetSize( KThumbnailWidth, KThumbnailHeight );
+    iPhase = ESleep;
+    CActiveScheduler::Add(this);
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::CUpnpThumbnailCreator
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CUpnpThumbnailCreator::CUpnpThumbnailCreator( MUpnpThumbnailCreatorObserver* aObserver )
+    :CActive(EPriorityStandard), iOldSize(0,0)
+{
+    iObserver = aObserver;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::~CUpnpThumbnailCreator
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpThumbnailCreator::~CUpnpThumbnailCreator()
+{
+    Cancel();
+    delete iScaler;
+    delete iEncoder;
+    delete iDecoder;
+    delete iBitmap;
+    iFs.Close();
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::RunError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpThumbnailCreator::RunError(TInt aErr)
+{
+	LOGS1("CUpnpThumbnailCreator::RunError(%d)", aErr);
+    return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::RunL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpThumbnailCreator::RunL()
+{
+    if( iStatus == KErrNone )
+    {
+        if( EDecodeObject == iPhase )
+        {
+            iScaler->Scale(&iStatus, *iBitmap, iSize, ETrue);
+            iPhase = EDecode;
+            SetActive();
+        }
+        else if( EDecode == iPhase )
+        {
+            EncodeAndConvertL();
+            iPhase = EEncode;
+            SetActive();
+        }
+        else if( EEncode == iPhase )
+        {
+            iPhase = ESleep;
+            iObserver->NotifyThumbnailResultL(this, iStatus.Int());
+        }
+    }
+    else
+    {
+        iObserver->NotifyThumbnailResultL(this, iStatus.Int());
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::DoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpThumbnailCreator::DoCancel()
+{
+    if( EDecode == iPhase )
+    {
+        iDecoder->Cancel();
+    }
+    if( EEncode == iPhase )
+    {
+        iEncoder->Cancel();
+    }
+    if( EDecodeObject == iPhase )
+    {
+        iDecoder->Cancel();
+    }
+}
+
+
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::RunError
+// Requester function
+// -----------------------------------------------------------------------------
+//
+void CUpnpThumbnailCreator::EncodeAndConvertL()
+{
+    if( IsActive() )
+    {
+        Cancel();
+    }
+
+    delete iEncoder;
+    iEncoder = 0;
+
+    iPath.Append(iFileName);
+
+
+    iEncoder = CImageEncoder::FileNewL( iFs,
+                                        iPath,
+                                        KThumbMimeType,
+                                        CImageEncoder::EOptionAlwaysThread);
+
+    iEncoder->Convert( &iStatus, *iBitmap, 0 );
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::CreateL
+// Requester function
+// -----------------------------------------------------------------------------
+//
+void CUpnpThumbnailCreator::CreateL(const TDesC& aSourceFile, const TDesC& aThumbName)
+{
+
+
+    if( IsActive() )
+    {
+        Cancel();
+    }
+
+    iParse.Set( aSourceFile, NULL, NULL);
+    TParse fp;
+    User::LeaveIfError( fp.Set(aThumbName, 0 , 0) );
+    iFileName = fp.NameAndExt();
+    iExtension = fp.Ext();
+    iPath = fp.DriveAndPath();
+
+    TUint temp;
+    if( iFs.Att( iPath, temp ) != KErrNone )
+    {
+        User::LeaveIfError( iFs.MkDirAll( iPath ) );
+    }
+
+    delete iDecoder;
+    iDecoder = NULL;
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    iBitmap = new (ELeave) CFbsBitmap();
+
+    TSize size = GetSize(aSourceFile);
+    size.SetSize( size.iWidth, size.iHeight );
+    iOldSize = size; 
+    CalculateSize( size );
+    User::LeaveIfError(iBitmap->Create( size, iInfo.iFrameDisplayMode ));
+
+    //Decode to the bitmap
+    //RunL will be called when decoding is complete
+    iPhase = EDecodeObject;
+    iDecoder->Convert( &iStatus, *iBitmap );
+    SetActive();
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::CalculateSize
+// Requester function
+// -----------------------------------------------------------------------------
+//
+void CUpnpThumbnailCreator::CalculateSize( TSize& aLoadSize )
+{
+    if( ( aLoadSize.iWidth <= KThumbnailWidth ) ||
+        ( aLoadSize.iHeight <= KThumbnailHeight ) )
+    {
+        return;
+    }
+
+    TUint i( 8 ); // for 8 bits
+
+    for( ; i > 0; i >>= 1 )
+    {
+        if( DivisionCeil( aLoadSize.iWidth,  i ) > KThumbnailWidth &&
+        DivisionCeil( aLoadSize.iHeight, i ) > KThumbnailHeight )
+        {
+            break;
+        }
+    }
+
+    aLoadSize.SetSize( DivisionCeil( aLoadSize.iWidth, i ),
+                       DivisionCeil( aLoadSize.iHeight, i ) );
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::DivisionCeil
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpThumbnailCreator::DivisionCeil( const TInt aVal, const TInt aDiv )
+{
+    if( ( aVal % aDiv ) > 0 )
+    {
+        return (TInt)( ( aVal / aDiv ) + 1 );
+    }
+    else
+    {
+        return (TInt)( aVal / aDiv );
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::GetFileName
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+TFileName CUpnpThumbnailCreator::GetFileName()
+{
+    return iFileName;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::GetFileExt
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+TPtrC CUpnpThumbnailCreator::GetFileExt()
+{
+    return iExtension;
+}
+// CUpnpThumbnailCreator::GetPath
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TFileName CUpnpThumbnailCreator::GetPath()
+{
+    return iPath;
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpThumbnailCreator::GetSize
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TSize CUpnpThumbnailCreator::GetSize(const TDesC& aSourceFile)
+{
+    TRAPD(sizeErr, iDecoder = CImageDecoder::FileNewL( iFs, aSourceFile ));
+    if (sizeErr)
+    {
+        return TSize();
+    }
+    else
+    {
+        iInfo = iDecoder->FrameInfo();
+        TSize size = iInfo.iOverallSizeInPixels;
+        return size;    
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnptransferbase.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,110 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  class for sending HTTP request using Symbian HTTP client 
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnptransferbase.h"
+#include "upnpcontentdirectory.h"
+#include "httptransferbase.h"
+#include "upnptransferobserver.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferBase::CUpnpTransferBase
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferBase::CUpnpTransferBase( MUpnpTransferObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferBase::~CUpnpTransferBase
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferBase::~CUpnpTransferBase()
+    {
+    if ( iHttpTransferBase ) 
+        {
+        delete iHttpTransferBase;
+        }
+    }
+
+TInt CUpnpTransferBase::MapStatus( TInt aStatus )
+    {   
+    switch ( aStatus ) 
+        {
+        case KErrNone:
+            return EHttpOk;
+        }
+    // default
+    return aStatus;        
+    }
+    
+void CUpnpTransferBase::CreateAndQueueHttpFileL( const TDesC8& aUri,
+                                                 const TDesC& aTargetPath, 
+                                                 TInt aKey )
+    {
+    iHttpTransferBase->InsertFileIntoWaitQueueL( ( TAny* ) aKey, 
+                                                 aTargetPath,
+                                                 aUri );
+    }
+    
+void CUpnpTransferBase::SetHeaderL( TInt aKey,
+                                    const TDesC8& aFieldName, 
+                                    const TDesC8& aFieldValue )
+    {
+    iHttpTransferBase->SetHeaderL( ( TAny * )aKey, aFieldName, aFieldValue );
+    }
+
+
+void CUpnpTransferBase::TransferCompleted( TAny* aKey, TInt aStatus )
+    {   
+    TInt contentDirStatus = MapStatus( aStatus );        
+    TRAP_IGNORE( iObserver->TransferCompletedL( (TInt) aKey, contentDirStatus ) );
+    }
+void CUpnpTransferBase::TrackProgess(TInt aKey, TBool aSwitchOn)
+    {
+    iHttpTransferBase->TrackProgress( (TAny*)aKey, aSwitchOn);
+    }
+    
+void CUpnpTransferBase::TransferProgress( TAny* aKey, 
+                                           TInt aBytes,
+                                           TInt aTotalBytes )
+    {   
+    iObserver->TransferProgress( (TInt)aKey, aBytes, aTotalBytes);    
+    }    
+
+void CUpnpTransferBase::ReadyForTransferL(TAny* aKey)
+    {
+    TRAPD(err, iHttpTransferBase->StartTransferL( aKey ) );
+    if (err != KErrNone)
+        {
+        TransferCompleted(aKey, err);
+        }
+    }
+void CUpnpTransferBase::CancelTransfer(TInt aKey)
+    {
+    iHttpTransferBase->CancelTransfer( (TAny*) aKey ) ;
+    }
+ 
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnptransfercontroller.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,423 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnptransfercontroller.h"
+#include "upnpcontentdirectory.h"
+#include "upnpcontentdirectorydb.h"
+#include "upnpfiletransfertimerobserver.h"
+#include "upnpfiletransferevent.h"
+#include "upnpcontentdirectoryeventobserver.h"
+#include "upnpfiletransfer.h"
+#include "upnphttpmessage.h"
+#include "upnpautodestroyobjectlist.h"
+#include "upnpcdutils.h"
+#include "upnptransferinterface.h"
+#include "upnpstring.h"
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferController::CUpnpTransferController
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferController::CUpnpTransferController( CUpnpContentDirectory* aCd ):
+    iContentDirectory(aCd)
+    {
+    
+    }
+// -----------------------------------------------------------------------------
+// CUpnpTransferController::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferController::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferController::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferController* CUpnpTransferController::NewL( CUpnpContentDirectory* aCd )
+    {
+    CUpnpTransferController* self = 
+    new (ELeave) CUpnpTransferController( aCd );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpTransferController destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferController::~CUpnpTransferController()
+    {
+    iFileTransfers.ResetAndDestroy();
+        // clear timers
+    iStatusTimers.ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferController::HttpResponseReceivedL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferController::HttpResponseReceivedL(  TInt aSessionId,
+                                                    TInt aStatusCode ) 
+    {
+    TInt transferId = Transfer( aSessionId);
+     
+    if ( transferId == KErrNotFound )
+        {
+        return; 
+        }
+
+    if( aStatusCode < 0)     
+        {   
+        if( iFileTransfers[ transferId ]->TransferState() != ECompleted )
+            {
+            //stopped transfer
+            if(aStatusCode == KErrCancel)
+                {   
+                 iFileTransfers[ transferId ]->SetTransferState( EStopped);
+                }
+            //error in transfer
+            else
+                {
+                 iFileTransfers[ transferId ]->SetTransferState( EError); 
+                }                
+                            
+            iContentDirectory->GetAutoDestroyObjectList()->TransferFailL( iFileTransfers[ transferId ]->ImportNumber() );
+            iContentDirectory->RemoveFileTransferFromTransferIDsStateVariableL( aSessionId );
+            // remove the transfer after 30s
+            CUpnpFileTransferTimerObserver* timer = 
+                        CUpnpFileTransferTimerObserver::NewLC( 
+                        this, aSessionId );
+            iStatusTimers.AppendL(timer); 
+            CleanupStack::Pop(timer);
+            
+            // send event to MS
+            if( aStatusCode == KErrCancel)
+                {
+                CUpnpFileTransfer::TTransferType type =
+                        iFileTransfers[ transferId ]->TransferType();
+                    
+                    
+                iContentDirectory->NotifyTransferStoppedL( aSessionId, type); 
+                }
+             else
+                {
+                //transfer with error
+                iContentDirectory->NotifyTransferFailL( aSessionId, aStatusCode );     
+                }
+            
+            }                        
+        }   
+    else if( aStatusCode == EHttpOk )
+        {
+        CUpnpFileTransferEvent* transferEvent = iFileTransfers[ transferId ]->Event();
+        if( iContentDirectory->IsDrmFileL( transferEvent->FilePath() ))
+            {
+            iFileTransfers[ transferId ]->SetTransferState(EError);
+            iContentDirectory->GetAutoDestroyObjectList()->TransferFailL( iFileTransfers[ transferId ]->ImportNumber() );
+            
+            // send event to MS - AM -???
+            iContentDirectory->NotifyTransferFailL( aSessionId, aStatusCode ); 
+            }
+        else
+            {
+            iFileTransfers[ transferId ]->SetTransferState(ECompleted);
+            
+            // checking if transfer was GET. In that case we have to 
+            // create res tag for that file to CDS
+            if ( iFileTransfers[ transferId ]->TransferType() != CUpnpFileTransfer::EExport )
+                {
+                // 16-bit -> 8-bit conversion
+                HBufC8* filenameBuffer = UpnpString::FromUnicodeL( transferEvent->FilePath() );
+                CleanupStack::PushL( filenameBuffer );               
+                TPtr8 buffPtr = filenameBuffer->Des();
+            
+                TInt ret = iContentDirectory->CreateResTagL( aSessionId, 
+                                                            buffPtr , 
+                                                            iFileTransfers[ transferId ]->ImportNumber() );
+                User::LeaveIfError( ret );                                                                
+                CleanupStack::PopAndDestroy(filenameBuffer);               
+                iContentDirectory->TransferCompleteL( iFileTransfers[ transferId ]->ImportNumber() ,
+                                        iFileTransfers[ transferId ]->ObjectId() );
+			    }
+            
+            //send event to MS
+            iContentDirectory->NotifyOutgoingTransferL( aSessionId );
+            }
+             
+       
+        // remove the transfer after 30s
+        CUpnpFileTransferTimerObserver* timer = 
+                        CUpnpFileTransferTimerObserver::NewLC( 
+                        this, aSessionId );
+        iStatusTimers.AppendL(timer); 
+        CleanupStack::Pop(timer);
+        
+        iContentDirectory->RemoveFileTransferFromTransferIDsStateVariableL( aSessionId );       
+        }
+     else
+        {
+        //needed?
+        //
+        }                        
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferController::StopTransferResourceL
+// -----------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpTransferController::StopTransferResourceL(  TInt aId  )
+    {
+    TInt transferIndex = Transfer( aId ); 
+    if( KErrNotFound == transferIndex )
+        {
+        User::Leave( ENoFileTransfer );
+        }
+    
+    if(iFileTransfers[ transferIndex ]->TransferState() == ::ETransferInProgress)
+        {
+        CUpnpFileTransfer::TTransferType type = 
+                            iFileTransfers[ transferIndex ]->TransferType();
+        if(type == CUpnpFileTransfer::EImport)
+            {
+            iContentDirectory->TransferHandler()->CancelDownload(aId);    
+            }
+        else
+            {
+            iContentDirectory->TransferHandler()->CancelUpload(aId);
+            }                    
+        }
+    return EHttpOk;
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferController::Transfer
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpTransferController::Transfer( TInt aTransferId )
+    {
+    for( TInt transferIndex(0); 
+        transferIndex < iFileTransfers.Count(); 
+        transferIndex++ )
+        {
+        if( iFileTransfers[transferIndex]->TransferId() == aTransferId )
+            {
+            return transferIndex;
+            }
+        }
+    return KErrNotFound;
+    }
+             
+// -----------------------------------------------------------------------------
+// CUpnpTransferController::IsMaxImportExportTransfers
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpTransferController::IsMaxImportExportTransfers()
+    {  
+    /*
+    * This function limits total number of import/export transfers, according to
+    * current number of transfers, which are in progress state and pending import/export transfers
+    * Note: Any better algorithm can be used as well
+    */
+    
+    TInt numberOfInProgressTransfers = 0;
+    
+    for( TInt i = 0; i < iFileTransfers.Count(); i++ )
+        {
+        if( iFileTransfers[i]->TransferState() == ::ETransferInProgress )
+            {
+            ++numberOfInProgressTransfers;
+            }
+        }
+       
+    // Note: "+ 1" because e.g future 4th transfer discovers only 3 previous transfers, 
+    // and if KMaxImportExportTransfers = 3, 4th transfer should be forbidden now.        
+    
+    return ( ( numberOfInProgressTransfers + 1 ) > KMaxImportExportTransfers );   
+    }
+    
+    
+    
+// -----------------------------------------------------------------------------
+// CUpnpTransferController::TransferInternal
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransferEvent* CUpnpTransferController::RemoveTransferLC( TInt aTransferId )
+    {
+    for( TInt i = 0; i < iFileTransfers.Count(); i++ )
+        {
+        if( iFileTransfers[i]->TransferId() == aTransferId )
+            {
+
+            CUpnpFileTransferEvent* event = iFileTransfers[i]->RemoveEvent();
+            if(event)
+                {
+                CleanupStack::PushL( event );
+                return event;    
+                }
+            else
+                {
+                return NULL;
+                }
+            
+            }
+        }
+     return NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferController::TransferInternal
+// -----------------------------------------------------------------------------
+//
+CUpnpFileTransferEvent* CUpnpTransferController::TransferL( TInt aTransferId )
+    {
+    for( TInt i = 0; i < iFileTransfers.Count(); i++ )
+        {
+        if( iFileTransfers[i]->TransferId() == aTransferId )
+            {
+            CUpnpFileTransferEvent* event = iFileTransfers[i]->Event(); 
+            return event;
+            }
+        }
+     return NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::TransferEvent
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferController::TransferEvent(
+                                    CUpnpFileTransferTimerObserver* aTimer)
+
+    {
+    // remove transfer
+    for( TInt i = 0; i < iFileTransfers.Count(); i++ )
+        {
+        if( iFileTransfers[i]->TransferId() == aTimer->TransferId() )
+            {
+            delete iFileTransfers[i];
+            iFileTransfers.Remove(i);
+            break;
+            }
+        }
+    
+    // remove timer
+    for( TInt i = 0; i < iStatusTimers.Count(); i++ )
+        {
+        if( iStatusTimers[i] == aTimer )
+            {
+            delete  iStatusTimers[i];
+            iStatusTimers.Remove(i);
+            break;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::AddIncomingTransferInternalL
+// -----------------------------------------------------------------------------
+//   
+void CUpnpTransferController::AddIncomingTransferInternalL( CUpnpHttpMessage* aHttpMsg )
+    {    
+  
+    TInt objId = iContentDirectory->ContentDirectoryDb()->GetObjIdByAttrLikeL(KImportUri8,  aHttpMsg->SenderPathFromHeader());    
+  
+    CUpnpFileTransferEvent* event = CUpnpFileTransferEvent::NewLC();
+    event->SetProgressState( CUpnpFileTransferEvent::ECompleted );        
+    event->SetDirection( CUpnpFileTransferEvent::EIncoming );        
+    event->SetContentDirectoryObjectId( objId );
+    event->SetTransferId( aHttpMsg->SessionId() );
+    CleanupStack::Pop( event );         
+    TInt transferid = Transfer(aHttpMsg->SessionId());          
+    if( transferid == KErrNotFound)
+        User::Leave(KErrNotFound);
+    iFileTransfers[transferid]->SetEvent(event);
+    
+  
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::TransferFailL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferController::TransferFailL(CUpnpHttpMessage* aHttpMsg)
+    {
+    TPtrC8 path( aHttpMsg->DestinationPath() );
+
+    if( path.Length() )
+        {
+        iContentDirectory->GetAutoDestroyObjectList()->TransferFailL( UpnpCdUtils::ResIdFromUriL( path ) );
+        }
+    TInt transferId = Transfer( aHttpMsg->SessionId() );
+    if ( transferId != KErrNotFound )
+         {
+         if ( !path.Length() )
+             {
+             iContentDirectory->GetAutoDestroyObjectList()->TransferFailL( iFileTransfers[ transferId ]->ImportNumber() );    
+             }
+            
+         iContentDirectory->RemoveFileTransferFromTransferIDsStateVariableL( aHttpMsg->SessionId() );
+         if(iFileTransfers[ transferId ]->TransferState () ==::ETransferInProgress  )
+             {
+             iFileTransfers[ transferId ]->SetTransferState( EError );
+             }
+            
+            CUpnpFileTransferTimerObserver* timer = 
+                        CUpnpFileTransferTimerObserver::NewLC( 
+                                            this, aHttpMsg->SessionId() );
+            iStatusTimers.AppendL( timer ); 
+            CleanupStack::Pop( timer );
+        }
+    
+    // send event to MS
+    NotifyTransferFailL( aHttpMsg );    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpContentDirectory::NotifyTransferFailL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferController::NotifyTransferFailL( CUpnpHttpMessage* aHttpMsg )
+    {    
+    CUpnpFileTransferEvent* event = RemoveTransferLC( aHttpMsg->SessionId() );
+    if( event )
+        {
+        event->SetProgressState( CUpnpFileTransferEvent::EFailed );                   
+        event->SetErrorCode( aHttpMsg->Error() );
+        CleanupStack::Pop( event);
+        iContentDirectory->EventObserver()->FileTransferEvent( event );
+        }
+
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnptransferdownloader.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,111 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  class for sending HTTP request using Symbian HTTP client 
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnptransferdownloader.h"
+#include "httpdownloader.h"
+#include "upnpcontentdirectory.h"
+#include "upnpsettings.h"
+#include "upnptransferobserver.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferDownloader::CUpnpTransferDownloader
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferDownloader::CUpnpTransferDownloader( 
+                                   MUpnpTransferObserver* aObserver )
+    : CUpnpTransferBase( aObserver )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferDownloader::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferDownloader::ConstructL()
+    {
+    iHttpTransferBase = CHttpDownloader::NewL( *this, 
+                                               CUpnpSettings::GetIapL(), 
+                                               KDefaultBuffer, 
+                                               KNumOfConcurrentTransactions );  
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferDownloader::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferDownloader* CUpnpTransferDownloader::NewLC( MUpnpTransferObserver* aCd )
+    {
+    CUpnpTransferDownloader* self = new (ELeave) CUpnpTransferDownloader( aCd );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }    
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferDownloader::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferDownloader* CUpnpTransferDownloader::NewL( MUpnpTransferObserver* aCd )
+    {
+    CUpnpTransferDownloader* self = NewLC( aCd );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferDownloader::~CUpnpTransferDownloader
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferDownloader::~CUpnpTransferDownloader()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferDownloader::DownloadFileL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferDownloader::DownloadFileL( const TDesC8& aUri,
+                                             const TDesC& aTargetPath, 
+                                             TInt aKey )
+    {
+    CreateAndQueueHttpFileL( aUri, aTargetPath,aKey);  
+    SetHeaderL( aKey, UpnpHTTP::KConnection(), UpnpHTTP::KClose() );
+    DownloadFileL( aKey );    
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpTransferDownloader::DownloadFileL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferDownloader::DownloadFileL( TInt aKey )
+    {
+    iHttpTransferBase->MoveToTransferQueueL( ( TAny * )aKey );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnptransferhandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,170 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnptransferhandler.h"
+#include "upnpcontentdirectory.h"
+#include "upnpfiletransfer.h"
+#include "upnptransferdownloader.h"
+#include "upnptransferuploader.h"
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::CUpnpTransferHandler
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferHandler::CUpnpTransferHandler( )
+    {
+
+    }
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::ConstructL()
+    {
+    iDownloader = CUpnpTransferDownloader::NewL( this );
+    iUploader = CUpnpTransferUploader::NewL( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferHandler* CUpnpTransferHandler::NewL( )
+    {
+    CUpnpTransferHandler* self =
+            new (ELeave) CUpnpTransferHandler( );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferHandler::~CUpnpTransferHandler()
+    {
+    delete iDownloader;
+    delete iUploader;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::UploadFileL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::UploadFileL( TInt aKey, const TDesC8& aUri, const TDesC& aTargetPath,
+                                        const TDesC8& aContentType )
+    {
+    if( iUploader )
+        {
+        iUploader->UploadFileL(aUri, aTargetPath, aContentType, aKey);
+        TrackUploadProgress(aKey, ETrue);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::DownloadFileL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::DownloadFileL(TInt aKey, const TDesC8& aUri,const TDesC& aTargetPath)
+    {
+    if( iDownloader )
+        {
+        iDownloader->DownloadFileL(aUri, aTargetPath, aKey);
+        TrackDownloadProgress(aKey, ETrue);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::CancelUpload
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::CancelUpload( TInt aKey )
+    {
+    if( iUploader )
+        {
+        iUploader->CancelTransfer( aKey);
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::CancelDownload
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::CancelDownload( TInt aKey )
+    {
+    if( iDownloader )
+        {
+        iDownloader->CancelTransfer( aKey);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::HandleUploadL
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::TransferCompletedL(  TInt aKey, TInt aResultCode  )
+    {
+    iObserver->TransferCompletedL( aKey, aResultCode );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::SetObserver
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::SetObserver( MUpnpTransferObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::TrackUploadProgress
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::TrackUploadProgress( TInt aKey, TBool aSwitchOn )
+    {
+    if( iUploader)
+        {
+        iUploader->TrackProgess(aKey, aSwitchOn);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::TrackDownloadProgress
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::TrackDownloadProgress( TInt aKey, TBool aSwitchOn )
+    {
+    if( iDownloader)
+        {
+        iDownloader->TrackProgess(aKey, aSwitchOn);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferHandler::TransferProgress
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferHandler::TransferProgress( TInt aKey, TInt aBytes, TInt aTotalBytes)
+    {
+    iObserver->TransferProgress(aKey, aBytes, aTotalBytes);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnptransferuploader.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,107 @@
+/** @file
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  class for sending HTTP request using Symbian HTTP client 
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnptransferuploader.h"
+#include "httpuploader.h"
+#include "upnpcontentdirectory.h"
+#include "upnpsettings.h"
+#include "upnptransferobserver.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferUploader::CUpnpTransferUploader
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferUploader::CUpnpTransferUploader( MUpnpTransferObserver* aObserver )
+    :CUpnpTransferBase( aObserver )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTransferUploader::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpTransferUploader::ConstructL()
+    {
+    iHttpTransferBase = CHttpUploader::NewL( *this, 
+                                             CUpnpSettings::GetIapL(), 
+                                             KDefaultBuffer, 
+                                             KNumOfConcurrentTransactions );  
+    }
+// -----------------------------------------------------------------------------
+// CUpnpTransferUploader::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferUploader* CUpnpTransferUploader::NewLC( 
+                                    MUpnpTransferObserver* aObserver )
+    {
+    CUpnpTransferUploader* self = 
+            new (ELeave) CUpnpTransferUploader( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }    
+// -----------------------------------------------------------------------------
+// CUpnpTransferUploader::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferUploader* CUpnpTransferUploader::NewL( 
+                                    MUpnpTransferObserver* aObserver )
+    {
+    CUpnpTransferUploader* self = NewLC( aObserver );
+    CleanupStack::Pop();
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpTransferUploader::~CUpnpTransferUploader
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpTransferUploader::~CUpnpTransferUploader()
+    {
+    }
+
+  
+void CUpnpTransferUploader::UploadFileL( const TDesC8& aUri,const TDesC& aTargetPath,const TDesC8& aContentType, TInt aKey)
+    {
+    _LIT8(KContentFeatures, "DLNA.ORG_PN=");
+    CreateAndQueueHttpFileL( aUri, aTargetPath,aKey);  
+    SetHeaderL( aKey, UpnpHTTP::KConnection(), UpnpHTTP::KClose() );
+    SetHeaderL( aKey, UpnpHTTP::KHdrExpect(), UpnpHTTP::K100Continue() );
+    SetHeaderL( aKey, UpnpDLNA::KHdrContentFeatures(), KContentFeatures() );
+    SetHeaderL( aKey, UpnpHTTP::KHdrPragma(), UpnpHTTP::KNoCache() );
+    SetHeaderL( aKey, UpnpHTTP::KHdrCacheControl(), UpnpHTTP::KNoCache() );        
+    SetHeaderL( aKey, UpnpHTTP::KHdrContentType(), aContentType );       
+    UploadFileL( aKey );
+    }
+    
+void CUpnpTransferUploader::UploadFileL( TInt aKey )
+    {
+    iHttpTransferBase->MoveToTransferQueueL( ( TAny * )aKey );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/contentdirectoryservice/src/upnpxmlcontentfilter.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,74 @@
+/** @file
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Xml responses serialization filter
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpxmlcontentfilter.h"
+
+#include <e32svr.h>
+
+#include <xml/parser.h>
+#include <xml/parserfeature.h>
+#include <xmlengnodefilter.h>
+#include <xmlengdomparser.h>
+
+#include <charconv.h>
+#include <utf.h>
+
+using namespace Xml;
+              
+               
+// -----------------------------------------------------------------------------
+// CUpnpXmlContentFilter::AcceptNode
+// -----------------------------------------------------------------------------
+//               
+TXmlEngNodeFilterResult CUpnpXmlContentFilter::AcceptNode( TXmlEngNode aNode )
+    {
+    if ( aNode.NodeType() == TXmlEngNode::ECDATASection ||
+         aNode.NodeType() == TXmlEngNode::EComment )
+        {
+        return EReject;
+        }
+    return EAccept;
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpXmlContentFilter::SerializeLC
+// -----------------------------------------------------------------------------
+//     
+HBufC8* CUpnpXmlContentFilter::SerializeLC(RXmlEngDocument& aDoc, TXmlEngElement& aElement )
+    {
+    CUpnpXmlContentFilter* nodefilter = new (ELeave) CUpnpXmlContentFilter();
+    CleanupStack::PushL(nodefilter);
+    
+    RBuf8 buf;
+	    CleanupClosePushL( buf );               
+
+    TXmlEngSerializationOptions options(  TXmlEngSerializationOptions::KOptionOmitXMLDeclaration
+                          | TXmlEngSerializationOptions::KOptionIncludeNsPrefixes);	        			  
+	options.SetNodeFilter(nodefilter);	    	  
+    aDoc.SaveL( buf, aElement, options );
+    
+    HBufC8* res = buf.AllocL();
+    CleanupStack::PopAndDestroy( &buf );
+    CleanupStack::PopAndDestroy( nodefilter );
+    CleanupStack::PushL(res);
+    
+    return res;        
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,38 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for the UPnP Stack subsystem
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+WINSCW ARMV5
+//DEFAULT
+
+PRJ_EXPORTS
+../rom/upnpmediaserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpmediaserver.iby)
+../conf/upnpmediaserver.confml MW_LAYER_CONFML(upnpmediaserver.confml)
+../conf/upnpmediaserver_101F978F.crml MW_LAYER_CRML(upnpmediaserver_101F978F.crml)
+
+PRJ_MMPFILES
+
+#include "../avobjects/group/bld.inf"
+#include "../mediaserverclient/group/bld.inf"
+#include "../connectionmanagerservice/group/bld.inf"
+#include "../contentdirectoryservice/group/bld.inf"
+#include "../mediaserverengine/group/bld.inf"
+
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/BWINS/AVMediaServerClientU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,51 @@
+EXPORTS
+	?GetAddressL@RUpnpMediaServerClient@@QAEXAAVTInetAddr@@AAVTRequestStatus@@@Z @ 1 NONAME ; void RUpnpMediaServerClient::GetAddressL(class TInetAddr &, class TRequestStatus &)
+	?GetSharedItemL@CUpnpFileSharing@@QAEXHAAVCUpnpItem@@AAVTRequestStatus@@@Z @ 2 NONAME ; void CUpnpFileSharing::GetSharedItemL(int, class CUpnpItem &, class TRequestStatus &)
+	?Subscribe@CUpnpMediaServerSettings@@QAEHIPAVMUpnpSettingObserver@@@Z @ 3 NONAME ; int CUpnpMediaServerSettings::Subscribe(unsigned int, class MUpnpSettingObserver *)
+	?AddIcon@RUpnpMediaServerClient@@QAEXPAVCUpnpIcon@@AAVTRequestStatus@@@Z @ 4 NONAME ; void RUpnpMediaServerClient::AddIcon(class CUpnpIcon *, class TRequestStatus &)
+	?GetAddress@RUpnpMediaServerClient@@QAEHAAVTInetAddr@@@Z @ 5 NONAME ; int RUpnpMediaServerClient::GetAddress(class TInetAddr &)
+	?Status@RUpnpMediaServerClient@@QAEHAAH@Z @ 6 NONAME ; int RUpnpMediaServerClient::Status(int &)
+	?ShareReferenceL@CUpnpFileSharing@@QAEXHHAAVCUpnpItem@@AAVTRequestStatus@@@Z @ 7 NONAME ; void CUpnpFileSharing::ShareReferenceL(int, int, class CUpnpItem &, class TRequestStatus &)
+	??1CUpnpSecurityManager@@UAE@XZ @ 8 NONAME ; CUpnpSecurityManager::~CUpnpSecurityManager(void)
+	?Stop@RUpnpMediaServerClient@@QAEHXZ @ 9 NONAME ; int RUpnpMediaServerClient::Stop(void)
+	?NewL@CUpnpMediaServerSettings@@SAPAV1@XZ @ 10 NONAME ; class CUpnpMediaServerSettings * CUpnpMediaServerSettings::NewL(void)
+	?UpdateIcon@RUpnpMediaServerClient@@QAEXAAVTDes8@@PAVCUpnpIcon@@AAVTRequestStatus@@@Z @ 11 NONAME ; void RUpnpMediaServerClient::UpdateIcon(class TDes8 &, class CUpnpIcon *, class TRequestStatus &)
+	?ShareItemListL@CUpnpFileSharing@@QAEXABVTDesC8@@AAVCUpnpItemList@@AAHAAVTRequestStatus@@@Z @ 12 NONAME ; void CUpnpFileSharing::ShareItemListL(class TDesC8 const &, class CUpnpItemList &, int &, class TRequestStatus &)
+	??0RUpnpMediaServerClient@@QAE@XZ @ 13 NONAME ; RUpnpMediaServerClient::RUpnpMediaServerClient(void)
+	?UnshareContainerL@CUpnpFileSharing@@QAEXHAAVTRequestStatus@@@Z @ 14 NONAME ; void CUpnpFileSharing::UnshareContainerL(int, class TRequestStatus &)
+	?GetSharedContainerListL@CUpnpFileSharing@@QAEXHAAVCUpnpBrowseCriteria@@AAVCUpnpContainerList@@AAHAAVTRequestStatus@@@Z @ 15 NONAME ; void CUpnpFileSharing::GetSharedContainerListL(int, class CUpnpBrowseCriteria &, class CUpnpContainerList &, int &, class TRequestStatus &)
+	?Start@RUpnpMediaServerClient@@QAEHXZ @ 16 NONAME ; int RUpnpMediaServerClient::Start(void)
+	?ShareReferenceListL@CUpnpFileSharing@@QAEXAAVCUpnpItemList@@AAHAAVTRequestStatus@@@Z @ 17 NONAME ; void CUpnpFileSharing::ShareReferenceListL(class CUpnpItemList &, int &, class TRequestStatus &)
+	?Stop@RUpnpMediaServerClient@@QAEHW4TServerStopMode@1@@Z @ 18 NONAME ; int RUpnpMediaServerClient::Stop(enum RUpnpMediaServerClient::TServerStopMode)
+	?RemoveIcon@RUpnpMediaServerClient@@QAEXAAVTDes8@@AAVTRequestStatus@@@Z @ 19 NONAME ; void RUpnpMediaServerClient::RemoveIcon(class TDes8 &, class TRequestStatus &)
+	?GetL@CUpnpMediaServerSettings@@QAEPAVHBufC8@@I@Z @ 20 NONAME ; class HBufC8 * CUpnpMediaServerSettings::GetL(unsigned int)
+	?SetUploadDirectoryL@RUpnpMediaServerClient@@QAEXABVTDesC16@@AAVTRequestStatus@@@Z @ 21 NONAME ; void RUpnpMediaServerClient::SetUploadDirectoryL(class TDesC16 const &, class TRequestStatus &)
+	?Set@CUpnpMediaServerSettings@@QAEHIABVTDesC16@@@Z @ 22 NONAME ; int CUpnpMediaServerSettings::Set(unsigned int, class TDesC16 const &)
+	?Close@RUpnpMediaServerClient@@QAEXXZ @ 23 NONAME ; void RUpnpMediaServerClient::Close(void)
+	?Start@RUpnpMediaServerClient@@QAEXAAVTRequestStatus@@@Z @ 24 NONAME ; void RUpnpMediaServerClient::Start(class TRequestStatus &)
+	?RemoveIcons@RUpnpMediaServerClient@@QAEXAAVTRequestStatus@@@Z @ 25 NONAME ; void RUpnpMediaServerClient::RemoveIcons(class TRequestStatus &)
+	?Restart@RUpnpMediaServerClient@@QAEHXZ @ 26 NONAME ; int RUpnpMediaServerClient::Restart(void)
+	?UnshareItemListL@CUpnpFileSharing@@QAEXAAVCUpnpItemList@@AAHAAVTRequestStatus@@@Z @ 27 NONAME ; void CUpnpFileSharing::UnshareItemListL(class CUpnpItemList &, int &, class TRequestStatus &)
+	?ShareItemL@CUpnpFileSharing@@QAEXABVTDesC8@@AAVCUpnpItem@@AAVTRequestStatus@@@Z @ 28 NONAME ; void CUpnpFileSharing::ShareItemL(class TDesC8 const &, class CUpnpItem &, class TRequestStatus &)
+	?NewInstanceFromUpnpSettingsL@CUpnpSecurityManager@@SAPAV1@XZ @ 29 NONAME ; class CUpnpSecurityManager * CUpnpSecurityManager::NewInstanceFromUpnpSettingsL(void)
+	?NewL@CUpnpSecurityManager@@SAPAV1@ABVTDesC8@@@Z @ 30 NONAME ; class CUpnpSecurityManager * CUpnpSecurityManager::NewL(class TDesC8 const &)
+	?NewLC@CUpnpMediaServerNotifier@@SAPAV1@PAVMUpnpMediaServerObserver@@@Z @ 31 NONAME ; class CUpnpMediaServerNotifier * CUpnpMediaServerNotifier::NewLC(class MUpnpMediaServerObserver *)
+	?SetL@CUpnpMediaServerSettings@@QAEHIABVTDesC8@@@Z @ 32 NONAME ; int CUpnpMediaServerSettings::SetL(unsigned int, class TDesC8 const &)
+	?Set@CUpnpMediaServerSettings@@QAEHIABH@Z @ 33 NONAME ; int CUpnpMediaServerSettings::Set(unsigned int, int const &)
+	?NewL@CUpnpMediaServerStatusWatcher@@SAPAV1@AAVRUpnpMediaServerClient@@AAVMUpnpMediaServerStatusObserver@@@Z @ 34 NONAME ; class CUpnpMediaServerStatusWatcher * CUpnpMediaServerStatusWatcher::NewL(class RUpnpMediaServerClient &, class MUpnpMediaServerStatusObserver &)
+	?MediaServerClient@CUpnpFileSharing@@QAEAAVRUpnpMediaServerClient@@XZ @ 35 NONAME ; class RUpnpMediaServerClient & CUpnpFileSharing::MediaServerClient(void)
+	?NewL@CUpnpMediaServerNotifier@@SAPAV1@PAVMUpnpMediaServerObserver@@@Z @ 36 NONAME ; class CUpnpMediaServerNotifier * CUpnpMediaServerNotifier::NewL(class MUpnpMediaServerObserver *)
+	?Subscribe@CUpnpMediaServerStatusWatcher@@QAEXXZ @ 37 NONAME ; void CUpnpMediaServerStatusWatcher::Subscribe(void)
+	?Get@CUpnpMediaServerSettings@@QAEHIAAH@Z @ 38 NONAME ; int CUpnpMediaServerSettings::Get(unsigned int, int &)
+	?Connect@RUpnpMediaServerClient@@QAEHXZ @ 39 NONAME ; int RUpnpMediaServerClient::Connect(void)
+	?GetSharedContainerL@CUpnpFileSharing@@QAEXHAAVCUpnpContainer@@AAVTRequestStatus@@@Z @ 40 NONAME ; void CUpnpFileSharing::GetSharedContainerL(int, class CUpnpContainer &, class TRequestStatus &)
+	?Get@CUpnpMediaServerSettings@@QAEHIAAVTDes16@@@Z @ 41 NONAME ; int CUpnpMediaServerSettings::Get(unsigned int, class TDes16 &)
+	?UnshareItemL@CUpnpFileSharing@@QAEXHAAVTRequestStatus@@@Z @ 42 NONAME ; void CUpnpFileSharing::UnshareItemL(int, class TRequestStatus &)
+	?StartOffline@RUpnpMediaServerClient@@QAEHXZ @ 43 NONAME ; int RUpnpMediaServerClient::StartOffline(void)
+	?DropAllContentL@CUpnpFileSharing@@QAEXAAVTRequestStatus@@@Z @ 44 NONAME ; void CUpnpFileSharing::DropAllContentL(class TRequestStatus &)
+	?NewL@CUpnpFileSharing@@SAPAV1@XZ @ 45 NONAME ; class CUpnpFileSharing * CUpnpFileSharing::NewL(void)
+	?GetSharedItemListL@CUpnpFileSharing@@QAEXHAAVCUpnpBrowseCriteria@@AAVCUpnpItemList@@AAHAAVTRequestStatus@@@Z @ 46 NONAME ; void CUpnpFileSharing::GetSharedItemListL(int, class CUpnpBrowseCriteria &, class CUpnpItemList &, int &, class TRequestStatus &)
+	?ShareContainerL@CUpnpFileSharing@@QAEXABVTDesC8@@AAVCUpnpContainer@@AAVTRequestStatus@@@Z @ 47 NONAME ; void CUpnpFileSharing::ShareContainerL(class TDesC8 const &, class CUpnpContainer &, class TRequestStatus &)
+	?NewL@CUpnpMediaServerStatusWatcher@@SAPAV1@AAVMUpnpMediaServerStatusObserver@@@Z @ 48 NONAME ; class CUpnpMediaServerStatusWatcher * CUpnpMediaServerStatusWatcher::NewL(class MUpnpMediaServerStatusObserver &)
+	?NewL@CUpnpFileSharingBody@@SAPAV1@XZ @ 49 NONAME ; class CUpnpFileSharingBody * CUpnpFileSharingBody::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/EABI/AVMediaServerClientU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,64 @@
+EXPORTS
+	_ZN16CUpnpFileSharing10ShareItemLERK6TDesC8R9CUpnpItemR14TRequestStatus @ 1 NONAME
+	_ZN16CUpnpFileSharing12UnshareItemLEiR14TRequestStatus @ 2 NONAME
+	_ZN16CUpnpFileSharing14GetSharedItemLEiR9CUpnpItemR14TRequestStatus @ 3 NONAME
+	_ZN16CUpnpFileSharing14ShareItemListLERK6TDesC8R13CUpnpItemListRiR14TRequestStatus @ 4 NONAME
+	_ZN16CUpnpFileSharing15DropAllContentLER14TRequestStatus @ 5 NONAME
+	_ZN16CUpnpFileSharing15ShareContainerLERK6TDesC8R14CUpnpContainerR14TRequestStatus @ 6 NONAME
+	_ZN16CUpnpFileSharing15ShareReferenceLEiiR9CUpnpItemR14TRequestStatus @ 7 NONAME
+	_ZN16CUpnpFileSharing16UnshareItemListLER13CUpnpItemListRiR14TRequestStatus @ 8 NONAME
+	_ZN16CUpnpFileSharing17MediaServerClientEv @ 9 NONAME
+	_ZN16CUpnpFileSharing17UnshareContainerLEiR14TRequestStatus @ 10 NONAME
+	_ZN16CUpnpFileSharing18GetSharedItemListLEiR19CUpnpBrowseCriteriaR13CUpnpItemListRiR14TRequestStatus @ 11 NONAME
+	_ZN16CUpnpFileSharing19GetSharedContainerLEiR14CUpnpContainerR14TRequestStatus @ 12 NONAME
+	_ZN16CUpnpFileSharing19ShareReferenceListLER13CUpnpItemListRiR14TRequestStatus @ 13 NONAME
+	_ZN16CUpnpFileSharing23GetSharedContainerListLEiR19CUpnpBrowseCriteriaR18CUpnpContainerListRiR14TRequestStatus @ 14 NONAME
+	_ZN16CUpnpFileSharing4NewLEv @ 15 NONAME
+	_ZN20CUpnpFileSharingBody4NewLEv @ 16 NONAME
+	_ZN20CUpnpSecurityManager28NewInstanceFromUpnpSettingsLEv @ 17 NONAME
+	_ZN20CUpnpSecurityManager4NewLERK6TDesC8 @ 18 NONAME
+	_ZN20CUpnpSecurityManagerD0Ev @ 19 NONAME
+	_ZN20CUpnpSecurityManagerD1Ev @ 20 NONAME
+	_ZN20CUpnpSecurityManagerD2Ev @ 21 NONAME
+	_ZN22RUpnpMediaServerClient10GetAddressER9TInetAddr @ 22 NONAME
+	_ZN22RUpnpMediaServerClient10RemoveIconER5TDes8R14TRequestStatus @ 23 NONAME
+	_ZN22RUpnpMediaServerClient10UpdateIconER5TDes8P9CUpnpIconR14TRequestStatus @ 24 NONAME
+	_ZN22RUpnpMediaServerClient11GetAddressLER9TInetAddrR14TRequestStatus @ 25 NONAME
+	_ZN22RUpnpMediaServerClient11RemoveIconsER14TRequestStatus @ 26 NONAME
+	_ZN22RUpnpMediaServerClient12StartOfflineEv @ 27 NONAME
+	_ZN22RUpnpMediaServerClient19SetUploadDirectoryLERK7TDesC16R14TRequestStatus @ 28 NONAME
+	_ZN22RUpnpMediaServerClient4StopENS_15TServerStopModeE @ 29 NONAME
+	_ZN22RUpnpMediaServerClient4StopEv @ 30 NONAME
+	_ZN22RUpnpMediaServerClient5CloseEv @ 31 NONAME
+	_ZN22RUpnpMediaServerClient5StartER14TRequestStatus @ 32 NONAME
+	_ZN22RUpnpMediaServerClient5StartEv @ 33 NONAME
+	_ZN22RUpnpMediaServerClient6StatusERi @ 34 NONAME
+	_ZN22RUpnpMediaServerClient7AddIconEP9CUpnpIconR14TRequestStatus @ 35 NONAME
+	_ZN22RUpnpMediaServerClient7ConnectEv @ 36 NONAME
+	_ZN22RUpnpMediaServerClient7RestartEv @ 37 NONAME
+	_ZN22RUpnpMediaServerClientC1Ev @ 38 NONAME
+	_ZN22RUpnpMediaServerClientC2Ev @ 39 NONAME
+	_ZN24CUpnpMediaServerNotifier4NewLEP24MUpnpMediaServerObserver @ 40 NONAME
+	_ZN24CUpnpMediaServerNotifier5NewLCEP24MUpnpMediaServerObserver @ 41 NONAME
+	_ZN24CUpnpMediaServerSettings3GetEjR6TDes16 @ 42 NONAME
+	_ZN24CUpnpMediaServerSettings3GetEjRi @ 43 NONAME
+	_ZN24CUpnpMediaServerSettings3SetEjRK7TDesC16 @ 44 NONAME
+	_ZN24CUpnpMediaServerSettings3SetEjRKi @ 45 NONAME
+	_ZN24CUpnpMediaServerSettings4GetLEj @ 46 NONAME
+	_ZN24CUpnpMediaServerSettings4NewLEv @ 47 NONAME
+	_ZN24CUpnpMediaServerSettings4SetLEjRK6TDesC8 @ 48 NONAME
+	_ZN24CUpnpMediaServerSettings9SubscribeEjP20MUpnpSettingObserver @ 49 NONAME
+	_ZN29CUpnpMediaServerStatusWatcher4NewLER22RUpnpMediaServerClientR30MUpnpMediaServerStatusObserver @ 50 NONAME
+	_ZN29CUpnpMediaServerStatusWatcher4NewLER30MUpnpMediaServerStatusObserver @ 51 NONAME
+	_ZN29CUpnpMediaServerStatusWatcher9SubscribeEv @ 52 NONAME
+	_ZTI16CUpnpFileSharing @ 53 NONAME ; #<TI>#
+	_ZTI20CUpnpFileSharingBody @ 54 NONAME ; #<TI>#
+	_ZTI20CUpnpSecurityManager @ 55 NONAME ; #<TI>#
+	_ZTI24CUpnpMediaServerNotifier @ 56 NONAME ; #<TI>#
+	_ZTI24CUpnpMediaServerSettings @ 57 NONAME ; #<TI>#
+	_ZTV16CUpnpFileSharing @ 58 NONAME ; #<VT>#
+	_ZTV20CUpnpFileSharingBody @ 59 NONAME ; #<VT>#
+	_ZTV20CUpnpSecurityManager @ 60 NONAME ; #<VT>#
+	_ZTV24CUpnpMediaServerNotifier @ 61 NONAME ; #<VT>#
+	_ZTV24CUpnpMediaServerSettings @ 62 NONAME ; #<VT>#
+
Binary file upnpmediaserver/mediaserverclient/data/2000f87f.cre has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/data/backup_registration.xml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,4 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+    <proxy_data_manager SID="0x10202BE9" />
+</backup_registration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,35 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for UPnP Media Server
+*
+*/
+
+    
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+
+PRJ_EXPORTS
+../data/backup_registration.xml  /epoc32/data/z/private/101f977d/backup_registration.xml
+../data/backup_registration.xml  /epoc32/release/winscw/udeb/z/private/101f977d/backup_registration.xml
+../data/backup_registration.xml  /epoc32/release/winscw/urel/z/private/101f977d/backup_registration.xml
+
+
+PRJ_MMPFILES
+mediaserverclient.mmp
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/group/mediaserverclient.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,60 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+#include <platform_paths.hrh>
+   
+
+TARGETTYPE      DLL
+
+TARGET          avmediaserverclient.dll
+UID             0x1000008D 0x101F977D
+
+
+VERSION 10.1
+paged
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          upnpmediaserverclient.cpp
+SOURCE          upnpmediaserversettings.cpp
+SOURCE          upnpsecuritymanager.cpp
+SOURCE          upnpfilesharing.cpp
+SOURCE          upnpfilesharingbody.cpp
+SOURCE          upnpmediaservernotifier.cpp
+SOURCE          upnpmediaserverstatuswatcher.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+//central repository
+LIBRARY         centralrepository.lib
+LIBRARY         ecom.lib
+// UPnP
+LIBRARY         upnpipserversutils.lib
+LIBRARY         upnpavobjects.lib
+LIBRARY         upnpserviceframework.lib
+
+DEBUGLIBRARY    flogger.lib
+DEFFILE         AVMediaServerClient
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/inc/upnpfilesharingbody.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,328 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation class for UPnP File Sharing class
+*
+*/
+
+
+#ifndef C_CUPNPFILESHARINGBODY_H
+#define C_CUPNPFILESHARINGBODY_H
+
+#include <e32base.h>
+#include "upnpmediaserverclient.h"
+
+// FORWARD DECLARATIONS
+class CUpnpItem;
+class CUpnpContainer;
+class CUpnpItemList;
+class CUpnpBrowseCriteria;
+class CUpnpContainerList;
+
+/**
+ *  Implementation class for UPnP File Sharing class
+ *
+ *  @lib MediaServerClient.lib
+ *  @since S60 v3.1
+ */
+class CUpnpFileSharingBody : public CActive
+    {
+
+public:
+    
+    enum TFileSharingAction
+        {
+        ENoAction = 1,
+        EShareItem,
+        EShareItemResult,
+        EShareContainer,
+        EShareContainerResult,
+        EShareItemList,
+        EShareItemListResult,
+        EUnshareContainer,
+        EUnshareItem,
+        EGetSharedItem,
+        EGetSharedItemResult,
+        EGetSharedItemList,
+        EGetSharedItemListResult,
+        EGetSharedContainer,
+        EGetSharedContainerResult,
+        EGetSharedContainerList,
+        EGetSharedContainerListResult,
+        EUnshareItemList,
+        EUnshareRoot,
+        EShareReference,
+        EShareReferenceList
+        };
+
+    /**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CUpnpFileSharingBody* NewL();
+
+    /** 
+    * Destructor.
+    */
+    virtual ~CUpnpFileSharingBody();
+
+public:     // Interface methods
+    
+    void UnshareRootL(TRequestStatus& aStatus );
+    
+    /**
+    * Unshares existing item list from the MediaServer
+    *
+    * @since S60 3.1
+    * @param aItemList reference to item list which are to be shared.
+    * @param aExecStatus reference pointing to the index of item list
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    void UnshareItemListL(CUpnpItemList& aItemList, TInt& aExecStatus, TRequestStatus& aStatus);
+    
+    
+    /**
+    * Shares item list to the MediaServer
+    *
+    * @since S60 3.1
+    * @param aParentId information to which container the item is shared.
+    * @param aItemList reference to item list which are to be shared.
+    * @param aExecStatus reference pointing to the index of item list
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    void ShareItemListL( const TDesC8& aParentId, CUpnpItemList& aItemList,
+                          TInt& aExecStatus, TRequestStatus& aStatus );
+    
+    /**
+    * Gets shared items information from MediaServer. Information is 
+    * returned to item list reference
+    *
+    * @since S60 3.1
+    * @param aContainerId id of the container of which items are to be returned
+    * @param aBrowseCriteria specifies request details, such as requestCount, startingIndes, filter
+    * @param aItemList reference to item list where information is updated.
+    * @param aTotalMatches number of matched items
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    void GetSharedItemListL( TInt aContainerId,
+                                    CUpnpBrowseCriteria& aBrowseCriteria,
+                                    CUpnpItemList& aItemList,
+                                    TInt& aTotalMatches,
+                                    TRequestStatus& aStatus );   
+                                    
+                                    
+    /**
+    * Gets shared container information from MediaServer. Information is 
+    * returned to item list reference
+    *
+    * @since S60 3.1
+    * @param aContainerId id of the container of which items are to be returned
+    * @param aBrowseCriteria specifies request details, such as requestCount, startingIndes, filter
+    * @param aContainerList reference to container list where information is updated.
+    * @param aTotalMatches number of matched containers
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */    
+    void GetSharedContainerListL( TInt aContainerId,
+                                    CUpnpBrowseCriteria& aBrowseCriteria,
+                                    CUpnpContainerList& aContainerList,
+                                    TInt& aTotalMatches,
+                                    TRequestStatus& aStatus );   
+    
+    /**
+    * Shares a single item asynchronously to MediaServer.
+    * Metadata is fetched for the item within the interface.
+    * When API call returns, item contains updated information.
+    *
+    * @since S60 3.1
+    * @param aContainerId information to which container the item is shared.
+    * @param aItem reference to item which is shared.
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    void ShareItemL( const TDesC8& aParentId, CUpnpItem& aItem,
+                     TRequestStatus& aStatus ); 
+
+
+    /**
+    * Shares a container asynchronously to MediaServer.
+    * One container can contain items and other containers.
+    * Metadata is fetched for the items within the interface.
+    * When API call returns, container hierarchy contains updated information.
+    *
+    * @since S60 3.1
+    * @param aContainerId information to which container the item is shared.
+    * @param aContainer reference to container which is shared.
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    void ShareContainerL( const TDesC8& aParentId, CUpnpContainer& aContainer,
+                          TRequestStatus& aStatus ); 
+                                    
+    /**
+    * Unshares existing item from the MediaServer
+    *
+    * @since S60 3.1
+    * @param aItemId reference to item which is unshared
+    */
+    void UnshareItemL( TInt aItemId, TRequestStatus& aStatus );
+       
+     
+    /**
+    * Unshares existing container from the MediaServer
+    *
+    * @since S60 3.1
+    * @param aContainerId reference to container which is unshared
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    void UnshareContainerL( TInt aContainerId,
+                            TRequestStatus& aStatus );
+     
+
+    /**
+    * Gets shared item information from MediaServer. Information is 
+    * returned to item reference
+    *
+    * @since S60 3.1
+    * @param aItemId reference to item id
+    * @param aItem reference to item where information is updated.
+    */
+    void GetSharedItemL( TInt aItemId,
+                         CUpnpItem& aItem,
+                         TRequestStatus& aStatus );
+    
+    
+    /**
+    * Gets shared container information from MediaServer. Information is 
+    * returned to container reference. Returns the complete item/container
+    * branch below the specified container id. Container id "0" (root) 
+    * returns the complete CDS hierarchy.
+    *
+    * @since S60 3.1
+    * @param aContainerId reference to container id
+    * @param aContaier reference to container where information is updated.
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    void GetSharedContainerL( TInt aContainerId,
+                              CUpnpContainer& aContainer,
+                              TRequestStatus& aStatus );
+
+
+    /**
+    * Creates a single reference to passed item asynchronously in Media Server.    
+    *
+    * @since S60 5.0 HN
+    * @param aContainerId - container id upon which the reference will be located.
+    * @param aObjectId - the reference is created on the basis of passed object id
+    * @param aItem reference item to be filled
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    void ShareReferenceL( TInt aContainerId, 
+                            TInt aObjectId,
+                            CUpnpItem& aItem,
+                            TRequestStatus& aStatus );
+
+    /**
+    * Creates reference items, located at specific container, pointing specific objects
+    *
+    * @since S60 5.0 HN
+    * @param aItemList 'reference item' list which are to be shared
+    * @param aExecStatus reference pointing to the index of item list
+    * @param aStatus reference to TRequestStatus which is completed when procedure is over
+    */
+    void ShareReferenceListL( CUpnpItemList& aItemList,
+                                  TInt& aExecStatus,
+                                  TRequestStatus& aStatus ); 
+                                  
+    /**
+    * Returns reference to media server client
+    *
+    * @since S60 5.0 HN
+    * @return media server client refernce
+    */
+    RUpnpMediaServerClient& MediaServerClient( );                                   
+
+public: // From CActive
+    
+    /**
+    * Cancellation of ongoing asynchronous operation
+    */
+    void DoCancel();
+
+    /**
+    * RunL
+    */
+    void RunL();
+
+    /**
+    * RunError
+    */
+    TInt RunError( TInt aErr );
+    
+private:
+    void LeaveIfBusyL();
+    void Reset();
+    void GetShareItemResultL();
+    void FinishShareItemL();
+    void GetShareContainerResultL();
+    void FinishShareContainerL();
+    void GetShareItemListResultL();
+    void FinishShareItemListL();
+    void FinishUnshareObject();
+    void FinishUnshareRoot();
+    void FinishGetSharedItemL();
+    void GetGetSharedItemResultL();
+    void FinishGetSharedContainerL();
+    void GetGetSharedContainerResultL();
+    void FinishUnshareItemList();
+    void FinishGetSharedItemListL();
+    void GetGetSharedItemListResultL();
+    void FinishGetSharedContainerListL();
+    void GetGetSharedContainerListResultL();
+    void HandleError();
+private:
+
+    CUpnpFileSharingBody();
+
+    void ConstructL();
+
+
+private: // data
+    
+    // Ongoing action
+    TFileSharingAction  iPendingAction;
+    
+    // Handle to MediaServer
+    RUpnpMediaServerClient  iMediaServer;
+    
+    // Client's request status pointer (not own)
+    TRequestStatus* iClientStatus;
+    
+    // Buffer to pass data to server
+    HBufC8*         iSendBuffer;            // owned
+    TPtr8           iSendBufferPtr;         
+
+    
+    // Buffer to receive data from server
+    HBufC8*         iReceiveBuffer;         // owned
+    TPtr8           iReceiveBufferPtr;          
+    TInt            iRespBufSize;           
+    TPckg<TInt>     iRespBufSizePkg;   
+    
+    // Pointers to client data structures 
+    CUpnpContainer*     iClientContainer;       // not owned
+    CUpnpItem*          iClientItem;            // not owned
+    CUpnpItemList*      iClientItemList;        // not owned
+    CUpnpContainerList* iClientContainerList;   // not owned
+    TPckg<TInt>*        iClientExecStatusPkg;   // owned
+    
+    };
+
+
+#endif // C_CUPNPFILESHARINGBODY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/src/upnpfilesharing.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,221 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File sharing interface class
+*
+*/
+
+
+#include <e32base.h>
+
+#include "upnpfilesharing.h"
+#include "upnpfilesharingbody.h"
+#include "upnpitemlist.h"
+
+
+// ========================== MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CUpnpFileSharing::CUpnpFileSharing()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharing::ConstructL()
+    {
+    iBody = CUpnpFileSharingBody::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CUpnpFileSharing* CUpnpFileSharing::NewL()
+    {
+    CUpnpFileSharing* self = new (ELeave) CUpnpFileSharing;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CUpnpFileSharing::~CUpnpFileSharing()
+    {
+    delete iBody;
+    }
+    
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::UnshareRootL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::DropAllContentL(TRequestStatus& aStatus)
+    {
+    iBody->UnshareRootL(aStatus);
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareItemL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::ShareItemL( const TDesC8& aParentId, CUpnpItem& aItem,
+                                            TRequestStatus& aStatus )
+    {
+    iBody->ShareItemL( aParentId, aItem, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareItemL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::ShareContainerL( const TDesC8& aParentId, 
+                      CUpnpContainer& aContainer, TRequestStatus& aStatus )
+    {
+    iBody->ShareContainerL( aParentId, aContainer, aStatus );
+    }
+                                
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareItemL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::ShareItemListL( const TDesC8& aParentId, 
+        CUpnpItemList& aItemList, TInt& aExecStatus, TRequestStatus& aStatus )
+    {
+    iBody->ShareItemListL(aParentId, aItemList, aExecStatus, aStatus);
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareItemL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::UnshareItemL( TInt aItemId,
+                                TRequestStatus& aStatus)
+    {
+    iBody->UnshareItemL( aItemId, aStatus );
+    }
+   
+ 
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareItemL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::UnshareContainerL( TInt aContainerId,
+                                                   TRequestStatus& aStatus )
+    {
+    iBody->UnshareContainerL( aContainerId, aStatus );
+    }
+ 
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareItemL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::GetSharedItemL( TInt aItemId,
+                                                CUpnpItem& aItem,
+                                                TRequestStatus& aStatus )
+    {
+    iBody->GetSharedItemL( aItemId, aItem, aStatus );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareItemL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::GetSharedContainerL( TInt aContainerId,
+                                                 CUpnpContainer& aContainer,
+                                                 TRequestStatus& aStatus )
+    {
+    iBody->GetSharedContainerL( aContainerId, aContainer, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareItemL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::UnshareItemListL( CUpnpItemList& aObjectList,
+                                TInt& aExecStatus,
+                                TRequestStatus& aStatus)
+    {
+    iBody->UnshareItemListL(aObjectList, aExecStatus, aStatus);
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::GetSharedItemListL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::GetSharedItemListL( TInt aContainerId,
+                                CUpnpBrowseCriteria& aBrowseCriteria,
+                                CUpnpItemList& aItemList,
+                                TInt& aTotalMatches,
+                                TRequestStatus& aStatus )
+    {
+    iBody->GetSharedItemListL(aContainerId, aBrowseCriteria, aItemList, 
+                                                    aTotalMatches, aStatus);
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::GetSharedContainerListL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::GetSharedContainerListL( TInt aContainerId,
+                                CUpnpBrowseCriteria& aBrowseCriteria,
+                                CUpnpContainerList& aItem,
+                                TInt& aTotalMatches,
+                                TRequestStatus& aStatus )
+    {
+    iBody->GetSharedContainerListL(aContainerId, aBrowseCriteria, aItem, 
+                                                    aTotalMatches, aStatus);
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareReferenceL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::ShareReferenceL( TInt aContainerId, 
+                                            TInt aObjectId, 
+                                            CUpnpItem& aItem,
+                                            TRequestStatus& aStatus )
+    {
+    iBody->ShareReferenceL( aContainerId, aObjectId, aItem, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::ShareReferenceListL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpFileSharing::ShareReferenceListL( CUpnpItemList& aItemList,
+                                                TInt& aExecStatus,
+                                                TRequestStatus& aStatus )
+    {
+    iBody->ShareReferenceListL(aItemList, aExecStatus, aStatus);    
+    }    
+                                                
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::MediaServerClient
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C RUpnpMediaServerClient& CUpnpFileSharing::MediaServerClient( )
+    {
+    return iBody->MediaServerClient();
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/src/upnpfilesharingbody.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,899 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation class for UPnP File Sharing class
+*
+*/
+
+
+#include <e32base.h>
+#include "upnpcontainer.h"
+#include "upnpitem.h"
+#include "upnpitemlist.h"
+#include "upnpcontainerlist.h"
+#include "upnpbrowsecriteria.h"
+#include "upnpmediaserverglobals.h"
+#include "upnpfilesharingbody.h"
+
+#ifdef _DEBUG
+#define KLogFile _L("UPnPMediaServer.txt")
+#endif
+#include "upnpcustomlog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CUpnpFileSharingBody::CUpnpFileSharingBody()
+    : CActive( EPriorityStandard ), iSendBufferPtr(0,0), 
+      iReceiveBufferPtr(0,0), iRespBufSizePkg(iRespBufSize)
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    User::LeaveIfError( iMediaServer.Connect() );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CUpnpFileSharingBody* CUpnpFileSharingBody::NewL()
+    {
+    CUpnpFileSharingBody* self = new (ELeave) CUpnpFileSharingBody;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CUpnpFileSharingBody::~CUpnpFileSharingBody()
+    {
+    Cancel();
+    iMediaServer.Close();
+    delete iSendBuffer;
+    delete iReceiveBuffer;
+    delete iClientExecStatusPkg;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::LeaveIfBusyL()
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::LeaveIfBusyL()
+    {
+    // leave if the active object has a request outstanding
+    if(IsActive())
+        {
+        User::Leave( KErrInUse );
+        }
+    // not active, reset buffers
+    Reset();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::Reset()
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::Reset()
+    {
+    if(iSendBuffer)
+        {
+        delete iSendBuffer; 
+        iSendBuffer = NULL;
+        }
+    if(iReceiveBuffer)
+        {
+        delete iReceiveBuffer;
+        iReceiveBuffer = NULL;
+        }
+     if(iClientExecStatusPkg)
+        {
+        delete iClientExecStatusPkg;
+        iClientExecStatusPkg = NULL;
+        }
+     iClientStatus = NULL;
+     iRespBufSize = 0;
+     iPendingAction = ENoAction;
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::UnshareRootL
+// ---------------------------------------------------------------------------
+//    
+void CUpnpFileSharingBody::UnshareRootL(TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EUnshareRoot;
+
+    // issue the request 
+    iMediaServer.UnshareRoot( iStatus );
+    SetActive();
+    }    
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::ShareItemL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::ShareItemL( const TDesC8& aParentId, 
+                        CUpnpItem& aItem, TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+    
+    // set parent id
+    aItem.SetParentIdL(aParentId);
+       
+    // serialize object
+    iSendBuffer = aItem.ToDes8L();
+    iSendBufferPtr.Set(iSendBuffer->Des());
+    
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EShareItem;
+    iClientItem = &aItem;
+    
+    // issue the request 
+    iMediaServer.ShareItem( iSendBufferPtr,
+                            iRespBufSizePkg, 
+                            iStatus );
+                            
+    // set active
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::ShareContainerL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::ShareContainerL( const TDesC8& aParentId, 
+                    CUpnpContainer& aContainer, TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+       
+    // set parent id
+    aContainer.SetParentIdL(aParentId);
+
+    // serialize object
+    iSendBuffer = aContainer.ToDes8L();
+    iSendBufferPtr.Set(iSendBuffer->Des());
+    
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EShareContainer;
+    iClientContainer = &aContainer;
+    
+    // issue the request 
+    iMediaServer.ShareContainer( iSendBufferPtr,
+                            iRespBufSizePkg, 
+                            iStatus );
+                            
+    // set active
+    SetActive();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::ShareItemListL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::ShareItemListL(const TDesC8& aParentId, 
+        CUpnpItemList& aItemList, TInt& aExecStatus, TRequestStatus& aStatus)
+{
+    // check if active and reset variables
+    LeaveIfBusyL();
+    
+    // set parent id
+    if( !aItemList.ObjectCount() )
+        { // nothing to share
+        User::Leave( KErrNotFound );
+        }
+    aItemList[0]->SetParentIdL(aParentId);
+
+    // serialize object
+    iSendBuffer = aItemList.ToDes8L();
+    iSendBufferPtr.Set(iSendBuffer->Des());
+    iClientExecStatusPkg = new(ELeave)TPckg<TInt>(aExecStatus);
+
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EShareItemList;
+    iClientItemList = &aItemList;
+    
+    // Issue the request 
+    iMediaServer.ShareItemList( iSendBufferPtr,
+                            iRespBufSizePkg,
+                            iStatus );
+    SetActive();
+}
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::UnshareItemL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::UnshareItemL( TInt aItemId,
+                                TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EUnshareItem;
+
+    // issue the request 
+    iMediaServer.UnshareItem( aItemId, iStatus );
+    SetActive();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::UnshareContainer
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::UnshareContainerL( TInt aContainerId, 
+                                TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EUnshareContainer;
+
+    // issue the request 
+    iMediaServer.UnshareContainer( aContainerId, iStatus );
+    SetActive();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetShareItemResultL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::UnshareItemListL(CUpnpItemList& aItemList, 
+                                TInt& aExecStatus, TRequestStatus& aStatus)
+{
+    // check if active and reset variables
+    LeaveIfBusyL();
+    
+    // serialize object
+    iSendBuffer = aItemList.IdsToDes8L();
+    iSendBufferPtr.Set(iSendBuffer->Des());
+    iClientExecStatusPkg = new(ELeave)TPckg<TInt>(aExecStatus);
+
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EUnshareItemList;
+    iClientItemList = &aItemList;
+    
+    // Issue the request 
+    iMediaServer.UnshareItemListL(  iSendBufferPtr,
+                                    *iClientExecStatusPkg,
+                                    iStatus );
+    SetActive();
+}
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::GetSharedItemL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetSharedItemL( TInt aItemId,
+                                           CUpnpItem& aItem,
+                                           TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+       
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EGetSharedItem;
+    iClientItem = &aItem;
+    
+    // issue the request 
+    iMediaServer.GetSharedItem( aItemId,
+                                iRespBufSizePkg, 
+                                iStatus );
+                            
+    // set active
+    SetActive();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharing::GetSharedContainerL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetSharedContainerL( TInt aItemId,
+                                           CUpnpContainer& aContainer,
+                                           TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+       
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EGetSharedContainer;
+    iClientContainer = &aContainer;
+    
+    // issue the request 
+    iMediaServer.GetSharedContainer( aItemId,
+                                iRespBufSizePkg, 
+                                iStatus );
+                            
+    // set active
+    SetActive();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetSharedItemListL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetSharedItemListL( TInt aContainerId,
+                                    CUpnpBrowseCriteria& aBrowseCriteria,
+                                    CUpnpItemList& aItemList,
+                                    TInt& aTotalMatches,
+                                    TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+    
+    // serialize object
+    iSendBuffer = aBrowseCriteria.ToDes8L();
+    iSendBufferPtr.Set(iSendBuffer->Des());
+    iClientExecStatusPkg = new(ELeave)TPckg<TInt>(aTotalMatches);
+
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EGetSharedItemList;
+    iClientItemList = &aItemList;
+    
+    // Issue the request 
+    iMediaServer.GetSharedItemList( aContainerId, iSendBufferPtr, 
+                                    iRespBufSizePkg, iStatus );
+    SetActive();
+    }    
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetSharedContainerListL
+// ---------------------------------------------------------------------------
+//
+ void CUpnpFileSharingBody::GetSharedContainerListL( TInt aContainerId,
+                                    CUpnpBrowseCriteria& aBrowseCriteria,
+                                    CUpnpContainerList& aContainerList,
+                                    TInt& aTotalMatches,
+                                    TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+    
+    // serialize object
+    iSendBuffer = aBrowseCriteria.ToDes8L();
+    iSendBufferPtr.Set(iSendBuffer->Des());
+    iClientExecStatusPkg = new(ELeave)TPckg<TInt>(aTotalMatches);
+
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EGetSharedContainerList;
+    iClientContainerList = &aContainerList;
+    
+    // Issue the request 
+    iMediaServer.GetSharedContainerList( aContainerId, iSendBufferPtr, 
+                                    iRespBufSizePkg, iStatus );
+    SetActive();
+    }    
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::RunL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::RunL()
+    {
+    if ( iStatus.Int() != KErrNone )
+        {
+        HandleError();
+        return;
+        }
+    switch ( iPendingAction )
+        {
+        case EShareItem:
+        case EShareReference:
+            {
+            GetShareItemResultL();
+            break;
+            }
+        case EShareItemResult:
+            {
+            FinishShareItemL();
+            break;
+            }
+        case EShareReferenceList:
+        case EShareItemList:
+            {
+            GetShareItemListResultL();
+            break;
+            }
+        case EShareItemListResult:
+            {
+            FinishShareItemListL();
+            break;
+            }
+        case EShareContainer:
+            {
+            GetShareContainerResultL();
+            break;
+            }
+        case EShareContainerResult:
+            {
+            FinishShareContainerL();
+            break;
+            }
+        case EUnshareContainer:
+        case EUnshareItem:
+            {
+            FinishUnshareObject();
+            break;
+            }
+        case EUnshareRoot:
+            {
+            FinishUnshareRoot();
+            break;
+            }            
+        case EUnshareItemList:
+            FinishUnshareItemList();
+            break;
+        case EGetSharedContainer:
+            {
+            GetGetSharedContainerResultL();
+            break;
+            }
+        case EGetSharedContainerResult:
+            {
+            FinishGetSharedContainerL();
+            break;
+            }
+        case EGetSharedItemResult:
+            {
+            FinishGetSharedItemL();
+            break;
+            }
+        case EGetSharedItem:
+            {
+            GetGetSharedItemResultL();
+            break;
+            }
+        case EGetSharedItemList:
+            {
+            GetGetSharedItemListResultL();
+            break;
+            }
+        case EGetSharedItemListResult:
+            {
+            FinishGetSharedItemListL();
+            break;
+            }
+        case EGetSharedContainerList:
+            {
+            GetGetSharedContainerListResultL();
+            break;
+            }
+        case EGetSharedContainerListResult:
+            {
+            FinishGetSharedContainerListL();
+            break;
+            }
+        
+        case ENoAction: // Fall through
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CUpnpFileSharingBody::RunError( TInt aErr )
+    {
+    LOGS1("CUpnpFileSharingBody::RunError(%d)", aErr);
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::DoCancel( )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::HandleError
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::HandleError()
+    {
+    User::RequestComplete( iClientStatus, iStatus.Int() );
+    Reset();
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::FinishShareItemL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishShareItemL()
+    {         
+    // internalize data
+    RDesReadStream stream( iReceiveBufferPtr );
+    CleanupClosePushL( stream );
+    stream >> *iClientItem;
+    CleanupStack::PopAndDestroy( &stream ); 
+ 
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+    // idle state
+    Reset();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetShareItemResultL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetShareItemResultL()
+    {
+    // get result
+    iReceiveBuffer = HBufC8::NewL( iRespBufSize );
+    iReceiveBufferPtr.Set( iReceiveBuffer->Des() );
+    iMediaServer.ShareItemResult(iReceiveBufferPtr, iStatus);
+    iPendingAction = EShareItemResult;
+
+    // set active
+    SetActive();
+    }
+           
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::FinishShareItemL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishShareContainerL()
+    {
+    // internalize data
+    RDesReadStream stream( iReceiveBufferPtr );
+    CleanupClosePushL( stream );
+    stream >> *iClientContainer;
+    CleanupStack::PopAndDestroy( &stream ); 
+ 
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+    // idle state
+    Reset();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetShareItemResultL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetShareContainerResultL()
+    {
+    // get result
+    iReceiveBuffer = HBufC8::NewL( iRespBufSize );
+    iReceiveBufferPtr.Set( iReceiveBuffer->Des() );
+    iMediaServer.ShareContainerResult(iReceiveBufferPtr, iStatus);
+    iPendingAction = EShareContainerResult;
+
+    // set active
+    SetActive();
+    }
+    
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::FinishUnshareObject
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishUnshareObject()
+    {
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+    Reset();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::FinishUnshareRoot
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishUnshareRoot()
+    {
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+    Reset();
+    }    
+// CUpnpFileSharingBody::FinishUnshareObject
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishUnshareItemList()
+    {
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+    Reset();
+    }
+    
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::FinishShareItemL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishShareItemListL()
+    {
+    // internalize data
+    RDesReadStream stream( iReceiveBufferPtr );
+    CleanupClosePushL( stream );
+    stream >> *iClientItemList;
+    CleanupStack::PopAndDestroy( &stream ); 
+ 
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+
+    // idle state
+    Reset();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetShareItemListResultL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetShareItemListResultL()
+    {
+    // get result
+    iReceiveBuffer = HBufC8::NewL( iRespBufSize );
+    iReceiveBufferPtr.Set( iReceiveBuffer->Des() );
+    iMediaServer.ShareItemListResult(iReceiveBufferPtr, *iClientExecStatusPkg, iStatus);
+    iPendingAction = EShareItemListResult;
+
+    // set active
+    SetActive();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::FinishGetSharedItemListL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishGetSharedItemListL()
+    {
+    // internalize data
+    RDesReadStream stream( iReceiveBufferPtr );
+    CleanupClosePushL( stream );
+    stream >> *iClientItemList;
+    CleanupStack::PopAndDestroy( &stream ); 
+ 
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+    // idle state
+    Reset();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetShareItemResultL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetGetSharedItemListResultL()
+    {
+    // get result
+    iReceiveBuffer = HBufC8::NewL( iRespBufSize );
+    iReceiveBufferPtr.Set( iReceiveBuffer->Des() );
+    iMediaServer.GetSharedItemListResult( iReceiveBufferPtr, 
+                                       *iClientExecStatusPkg, iStatus );
+    iPendingAction = EGetSharedItemListResult;
+
+    // set active
+    SetActive();
+    }
+    
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::FinishGetSharedContainerListL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishGetSharedContainerListL()
+    {
+    // internalize data
+    RDesReadStream stream( iReceiveBufferPtr );
+    CleanupClosePushL( stream );
+    stream >> *iClientContainerList;
+    CleanupStack::PopAndDestroy( &stream ); 
+ 
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+
+    // idle state
+    Reset();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetShareContainerResultL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetGetSharedContainerListResultL()
+    {
+    // get result
+    iReceiveBuffer = HBufC8::NewL( iRespBufSize );
+    iReceiveBufferPtr.Set( iReceiveBuffer->Des() );
+    iMediaServer.GetSharedContainerListResult( iReceiveBufferPtr, 
+                                        *iClientExecStatusPkg, iStatus );
+    iPendingAction = EGetSharedContainerListResult;
+
+    // set active
+    SetActive();
+    }
+    
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::FinishShareItemL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishGetSharedItemL()
+    {
+    // internalize data
+    RDesReadStream stream( iReceiveBufferPtr );
+    CleanupClosePushL( stream );
+    stream >> *iClientItem;
+    CleanupStack::PopAndDestroy( &stream ); 
+ 
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+
+    // idle state
+    Reset();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetShareItemResultL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetGetSharedItemResultL()
+    {
+    // get result
+    iReceiveBuffer = HBufC8::NewL( iRespBufSize );
+    iReceiveBufferPtr.Set( iReceiveBuffer->Des() );
+    iMediaServer.GetSharedItemResult(iReceiveBufferPtr, iStatus);
+    iPendingAction = EGetSharedItemResult;
+
+    // set active
+    SetActive();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::FinishShareItemL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::FinishGetSharedContainerL()
+    {
+    // internalize data
+    RDesReadStream stream( iReceiveBufferPtr );
+    CleanupClosePushL( stream );
+    stream >> *iClientContainer;
+    CleanupStack::PopAndDestroy( &stream ); 
+ 
+    // complete client request
+    User::RequestComplete(iClientStatus, KErrNone);
+    
+    // idle state
+    Reset();
+    }
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::GetShareItemResultL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::GetGetSharedContainerResultL()
+    {
+    // get result
+    iReceiveBuffer = HBufC8::NewL( iRespBufSize );
+    iReceiveBufferPtr.Set( iReceiveBuffer->Des() );
+    iMediaServer.GetSharedContainerResult(iReceiveBufferPtr, iStatus);
+    iPendingAction = EGetSharedContainerResult;
+
+    // set active
+    SetActive();
+    }
+    
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::ShareReferenceL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::ShareReferenceL( TInt aContainerId, 
+                                    TInt aObjectId,
+                                    CUpnpItem& aItem,
+                                    TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+    
+    // setting 'container id' upon which reference object will be placed
+    TBuf8<20> parentIdBuf;
+    parentIdBuf.Num( aContainerId );               
+    aItem.SetParentIdL( parentIdBuf );    
+        
+    // setting 'refID' pointing at main object
+    TBuf8<20> refIdBuf;
+    refIdBuf.Num( aObjectId );               
+    aItem.SetRefIdL( refIdBuf );
+
+    // serialize object
+    iSendBuffer = aItem.ToDes8L();
+    iSendBufferPtr.Set(iSendBuffer->Des());
+
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EShareReference;
+    iClientItem = &aItem;
+
+    // issue the request 
+    iMediaServer.ShareReference( iSendBufferPtr,
+                                iRespBufSizePkg, 
+                                iStatus );
+                            
+    // set active
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::ShareReferenceListL
+// ---------------------------------------------------------------------------
+//
+void CUpnpFileSharingBody::ShareReferenceListL( CUpnpItemList& aItemList,
+                                                TInt& aExecStatus,
+                                                TRequestStatus& aStatus )
+    {
+    // check if active and reset variables
+    LeaveIfBusyL();
+    
+    // set parent id
+    if( !aItemList.ObjectCount() )
+        {    
+        // nothing to share
+        User::Leave( KErrNotFound );
+        }
+
+    // serialize object
+    iSendBuffer = aItemList.ToDes8L();
+    iSendBufferPtr.Set( iSendBuffer->Des() );
+    iClientExecStatusPkg = new( ELeave )TPckg<TInt>( aExecStatus );
+    
+    // object state
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iPendingAction = EShareReferenceList;
+    iClientItemList = &aItemList;
+    
+    // Issue the request 
+    iMediaServer.ShareReferenceList( iSendBufferPtr,
+                            iRespBufSizePkg,
+                            iStatus );
+    SetActive();
+    }    
+
+// ---------------------------------------------------------------------------
+// CUpnpFileSharingBody::MediaServerClient
+// ---------------------------------------------------------------------------
+//    
+RUpnpMediaServerClient& CUpnpFileSharingBody::MediaServerClient()
+    {
+    return iMediaServer;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/src/upnpmediaserverclient.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,509 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server Client
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpmediaserverclient.h"
+#include "upnpmediaserverglobals.h"
+#include "upnpmediaserversettings.h"
+#include "upnpicon.h"
+
+// Number of message slots to reserve for this client server session.
+const TUint KMediaServerMessageSlots = 10;
+const TInt KMediaServerRetryCount = 2;
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::RUpnpMediaServerClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RUpnpMediaServerClient::RUpnpMediaServerClient()
+    :RUpnpSessionBase()
+    {
+    iAddressPkg = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::RUpnpMediaServerClient
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpMediaServerClient::Close()
+    {
+    delete iAddressPkg;
+    iAddressPkg = NULL;
+    RSessionBase::Close();
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Connect
+// Connect to Media Server session.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpMediaServerClient::Connect()
+    {
+    return RUpnpSessionBase::Connect( KMediaServerName,
+             TVersion( KMediaServerMajorVersionNumber,
+                       KMediaServerMinorVersionNumber,
+                       KMediaServerBuildVersionNumber ),
+             KMediaServerMessageSlots,
+             KMediaServerRetryCount,
+             KMediaServerFilename,
+             KServerUid3 );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Status
+// Gets media server operational status
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpMediaServerClient::Status(TInt& aStat)
+    {
+    TPckgBuf<TInt> statusBuf(aStat);
+    TIpcArgs args(&statusBuf);
+    TInt error = SendReceive(EMediaServerStatus, args);
+    aStat = statusBuf();
+    return error;
+    }
+    
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Start
+// Client requests server to terminate its process
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpMediaServerClient::Start()
+    {
+    return SendReceive( EMediaServerStart );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Start
+// Client requests server to terminate its process (asynchonous version)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpMediaServerClient::Start(TRequestStatus& aStatus)
+    {
+    SendReceive( EMediaServerStart,aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Start
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpMediaServerClient::StartOffline()
+    {
+    return SendReceive( EMediaServerStartOffline);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Stop
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpMediaServerClient::Stop()
+    {
+    return SendReceive( EMediaServerStop );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Stop
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpMediaServerClient::Stop( TServerStopMode aMode )
+    {
+    TInt error = 0;
+    if ( aMode == EStopSilent)
+        {
+        error = SendReceive( EMediaServerStopSilent );
+        }
+    else if ( aMode == EStopNormal)
+        {
+        error = SendReceive( EMediaServerStop );
+        }
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Stop
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpMediaServerClient::Restart()
+    {
+    return SendReceive( EMediaServerRestart );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Stop
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpMediaServerClient::GetAddress(TInetAddr& aAddr)
+    {
+    TPckg<TInetAddr> pkg(aAddr);
+    TIpcArgs args(&pkg);
+    return SendReceive( EMediaServerGetIpAndPort, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Stop
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpMediaServerClient::GetAddressL(TInetAddr& aAddr,
+                                                    TRequestStatus& aStatus)
+    {
+    delete iAddressPkg;
+    iAddressPkg = NULL;
+    iAddressPkg = new (ELeave) TPckg<TInetAddr>(aAddr);
+    TIpcArgs args(iAddressPkg);
+    SendReceive( EMediaServerGetIpAndPort, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::SetUploadDirectoryL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpMediaServerClient::SetUploadDirectoryL( const TDesC& aPath,
+    TRequestStatus& aStatus )
+    {
+    CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( settings );
+    User::LeaveIfError( settings->Set(UpnpMediaServerSettings::EUploadDirectory, aPath) );
+    CleanupStack::PopAndDestroy( settings );
+
+    TIpcArgs args;
+    args.Set(0, &aPath);
+    SendReceive( EMediaServerSetUploadDirectory, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareItem
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::GetSharedItem( TInt aItemId,
+                                            TDes8& aRcvdBufSize,
+                                            TRequestStatus& aStatus )
+    {
+    TIpcArgs args(aItemId, &aRcvdBufSize);
+    SendReceive(EMediaServerGetSharedItem, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareItemL
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::GetSharedItemResult(TDes8& aResult,
+                                                    TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aResult);
+    SendReceive(EMediaServerGetSharedItemResult, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareContainer
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::GetSharedContainer( TInt aContainerId,
+                                            TDes8& aRcvdBufSize,
+                                            TRequestStatus& aStatus )
+    {
+    TIpcArgs args(aContainerId, &aRcvdBufSize);
+    SendReceive(EMediaServerGetSharedContainer, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareContainer
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::GetSharedContainerResult(TDes8& aResult,
+                                                    TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aResult);
+    SendReceive(EMediaServerGetSharedContainerResult, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareItem
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::ShareItem( TDes8& aSend,
+                                        TDes8& aRcvdBufSize,
+                                        TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aSend, &aRcvdBufSize);
+    SendReceive(EMediaServerShareItem, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::AddIcon
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpMediaServerClient::AddIcon( CUpnpIcon* aIcon, TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aIcon->GetIconBufferPtr());
+    SendReceive(EMediaServerAddIcon, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::UpdateIcon
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpMediaServerClient::UpdateIcon( TDes8& aSend, CUpnpIcon* aIcon,
+    TRequestStatus& aStatus )
+    {
+    TIpcArgs args(&aIcon->GetIconBufferPtr(), &aSend);
+    SendReceive(EMediaServerUpdateIcon, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::RemoveIcon
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpMediaServerClient::RemoveIcon( TDes8& aSend, TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aSend);
+    SendReceive(EMediaServerRemoveIcon, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::RemoveIcons
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpMediaServerClient::RemoveIcons( TRequestStatus& aStatus)
+    {
+    TIpcArgs args(NULL);
+    SendReceive(EMediaServerRemoveIcons, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareItemResult
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::ShareItemResult( TDes8& aResult,
+                                        TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aResult);
+    SendReceive(EMediaServerShareItemResult, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareContainer
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::ShareContainer( TDes8& aSend,
+                                        TDes8& aRcvdBufSize,
+                                        TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aSend, &aRcvdBufSize);
+    SendReceive(EMediaServerShareContainer, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareContainerResult
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::ShareContainerResult( TDes8& aResult,
+                                        TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aResult);
+    SendReceive(EMediaServerShareContainerResult, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareItemL
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::ShareItemList( TDes8& aSend,
+                                        TDes8& aRcvdBufSize,
+                                        TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aSend, &aRcvdBufSize);
+    SendReceive(EMediaServerShareItemList, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareItemListResult
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::ShareItemListResult( TDes8& aResult,
+                                        TDes8& aExecStatus,
+                                        TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aResult, &aExecStatus);
+    SendReceive(EMediaServerShareItemListResult, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::UnShareRoot
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::UnshareRoot(TRequestStatus& aStatus)
+    {
+    SendReceive(EMediaServerUnshareRoot,  aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::UnShareItemL
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::UnshareItem(TInt aItemId, TRequestStatus& aStatus)
+    {
+    TIpcArgs args(aItemId);
+    SendReceive(EMediaServerUnshareItem, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::UnShareContainerL
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::UnshareContainer(TInt aItemId, TRequestStatus& aStatus)
+    {
+    TIpcArgs args(aItemId);
+    SendReceive(EMediaServerUnshareContainer, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::UnshareItemListL
+// -----------------------------------------------------------------------------
+void RUpnpMediaServerClient::UnshareItemListL(TDes8& aSend, TDes8& aExecStatus,
+                                                    TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aSend, &aExecStatus);
+    SendReceive(EMediaServerUnshareItemList, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::GetSharedItemList
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::GetSharedItemList(TInt aContainerId, TDes8& aSend,
+                                TDes8& aRcvdBufSize, TRequestStatus& aStatus)
+    {
+    TIpcArgs args(aContainerId, &aSend, &aRcvdBufSize);
+    SendReceive(EMediaServerGetSharedItemList, args, aStatus);
+    }
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::GetSharedItemList
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::GetSharedContainerList(TInt aContainerId, TDes8& aSend,
+                                TDes8& aRcvdBufSize, TRequestStatus& aStatus)
+    {
+    TIpcArgs args(aContainerId, &aSend, &aRcvdBufSize);
+    SendReceive(EMediaServerGetSharedContainerList, args, aStatus);
+    }
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::GetSharedItemList
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::GetSharedItemListResult(TDes8& aResult, TDes8& aTotalMatches,
+                                                    TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aResult, &aTotalMatches);
+    SendReceive(EMediaServerGetSharedItemListResult, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::GetSharedContainerList
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::GetSharedContainerListResult(TDes8& aResult, TDes8& aTotalMatches,
+                                                    TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aResult, &aTotalMatches);
+    SendReceive(EMediaServerGetSharedContainerListResult, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareReference
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::ShareReference( TDes8& aSend,
+                                            TDes8& aRcvdBufSize,
+                                            TRequestStatus& aStatus )
+    {
+    TIpcArgs args(&aSend, &aRcvdBufSize);
+    SendReceive(EMediaServerShareReference, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ShareReferenceList
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::ShareReferenceList( TDes8& aSend,
+                                                TDes8& aRcvdBufSize,
+                                                TRequestStatus& aStatus )
+    {
+    TIpcArgs args(&aSend, &aRcvdBufSize);
+    SendReceive(EMediaServerShareReferenceList, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::SubscribeEvents
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::SubscribeEvents(TRequestStatus& aStatus)
+    {
+    SendReceive(EMediaServerSubscribeEvents, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::UnsubscribeEvents
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::UnsubscribeEvents()
+    {
+    SendReceive(EMediaServerUnsubscribeEvents);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::ListenTransferEvent
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::ListenTransferEvent(TDes8& aEventSize, TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aEventSize);
+    SendReceive(EMediaServerListenTransferEvent, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::GetTransferEventBody
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::GetTransferEventBody(TDes8& aResult, TRequestStatus& aStatus)
+    {
+    TIpcArgs args(&aResult);
+    SendReceive(EMediaServerGetTransferEventBody, args, aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::Status
+// Notify about media server operational status
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::StatusChangeNotify( TRequestStatus& aStatus )
+    {
+    SendReceive( EMediaServerStatusChange, TIpcArgs(), aStatus );
+    }
+    
+// -----------------------------------------------------------------------------
+// RUpnpMediaServerClient::CancelStatusChanged
+// Cancel notification to ms status
+// -----------------------------------------------------------------------------
+//
+void RUpnpMediaServerClient::CancelStatusChangeNotify()
+    {
+    SendReceive( EMediaServerStatusChangeCancel );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/src/upnpmediaservernotifier.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,187 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server notification handler
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpmediaservernotifier.h"
+#include "upnpfiletransferevent.h"
+#include "upnpfiletransfereventlist.h"
+#include "upnpmediaserverobserver.h"
+
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerNotifier::CUpnpMediaServerNotifier
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CUpnpMediaServerNotifier::CUpnpMediaServerNotifier( MUpnpMediaServerObserver* aObserver) :
+                          CActive(EPriorityStandard),
+                          iObserver(aObserver),
+                          iRespBufSizePkg(iRespBufSize),
+                          iReceiveBufferPtr(0,0)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerNotifier::~CUpnpMediaServerNotifier()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CUpnpMediaServerNotifier::~CUpnpMediaServerNotifier()
+    {
+    iMediaServerClient.UnsubscribeEvents();
+    Cancel();
+    iMediaServerClient.Close();
+    delete iReceiveBuffer;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerNotifier::ConstructL
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CUpnpMediaServerNotifier::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    User::LeaveIfError(iMediaServerClient.Connect());
+    iMediaServerClient.SubscribeEvents( iStatus );
+    iPendingAction = ESubscribe;
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerNotifier::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpMediaServerNotifier* CUpnpMediaServerNotifier::NewLC(
+                                        MUpnpMediaServerObserver* aObserver )
+    {
+    CUpnpMediaServerNotifier* self = new( ELeave ) CUpnpMediaServerNotifier( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerNotifier::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpMediaServerNotifier* CUpnpMediaServerNotifier::NewL(
+                                        MUpnpMediaServerObserver* aObserver  )
+    {
+    CUpnpMediaServerNotifier* self = NewLC( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerNotifier::RunL
+// ---------------------------------------------------------------------------
+//
+void CUpnpMediaServerNotifier::RunL()
+    {
+    if (iStatus.Int() < 0)
+        {
+        iObserver->NotifierError(iStatus.Int());
+        return;
+        }
+
+    switch ( iPendingAction )
+        {
+        case ESubscribe:
+            {
+            //starts listening for single events list,
+            //this request may wait for response for a long time
+            iMediaServerClient.ListenTransferEvent(iRespBufSizePkg, iStatus);
+            SetActive();
+            iPendingAction = EListenEvent;
+            break;
+            }
+        case EListenEvent:
+            {
+            //alocates buffer using size returned by ListenTransferEvent()
+            delete iReceiveBuffer;
+            iReceiveBuffer = NULL;
+            iReceiveBuffer = HBufC8::NewL( iRespBufSize );
+            iReceiveBufferPtr.Set( iReceiveBuffer->Des() );
+
+            //requests events list body
+            iMediaServerClient.GetTransferEventBody(iReceiveBufferPtr, iStatus);
+            SetActive();
+            iPendingAction = EGetEventBody;
+            break;
+            }
+        case EGetEventBody:
+            {
+            //internalizes events list from buffer
+            CUpnpFileTransferEventList* eventList = CUpnpFileTransferEventList::NewLC();
+            RDesReadStream stream( iReceiveBufferPtr );
+            CleanupClosePushL( stream );
+            stream >> *eventList;
+            CleanupStack::PopAndDestroy( &stream );
+
+            //listens next events
+            iMediaServerClient.ListenTransferEvent(iRespBufSizePkg, iStatus);
+            SetActive();
+            iPendingAction = EListenEvent;
+
+            //notifies observer
+            TInt count = eventList->GetPointerArray().Count();    
+            for (TInt i=0; i<count; i++ )
+                {            
+                iObserver->FileTransferEvent( 
+                    ( CUpnpFileTransferEvent* ) eventList->GetPointerArray()[0] );
+                eventList->GetPointerArray().Remove(0);
+                }
+                
+            CleanupStack::PopAndDestroy(eventList);
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerNotifier::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CUpnpMediaServerNotifier::DoCancel( )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerNotifier::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CUpnpMediaServerNotifier::RunError(TInt aError)
+    {
+    iObserver->NotifierError(aError);
+    return KErrNone;
+    }
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/src/upnpmediaserversettings.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,202 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server Settings
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include <centralrepository.h>
+#include "upnpstring.h"
+#include <platform_paths.hrh>
+#include <bldvariant.hrh>
+
+#include "upnpmediaserversettings.h"
+
+#ifdef _DEBUG
+#define KLogFile _L("UPnPMediaServer.txt")
+#endif
+#include "upnpcustomlog.h"
+
+const TInt KBufferGranularity = 256;
+
+// =========================== MEMBER FUNCTIONS ===============================
+// ----------------------------------------------------------------------------
+// CUpnpMediaServerSettings::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSettings::ConstructL(TUid aRepositoryUid)
+    {
+    iRepository = CRepository::NewL(aRepositoryUid);
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerSettings::CUpnpMediaServerSettings
+// ---------------------------------------------------------------------------
+//
+CUpnpMediaServerSettings::CUpnpMediaServerSettings() :CActive(EPriorityStandard)
+    {
+    CActiveScheduler::Add(this);
+    }
+	
+// ----------------------------------------------------------------------------
+// CUpnpMediaServerSettings::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpMediaServerSettings* CUpnpMediaServerSettings::NewL()
+    {
+    CUpnpMediaServerSettings* self = new ( ELeave ) CUpnpMediaServerSettings();
+    CleanupStack::PushL( self );
+    self->ConstructL( KCRUidMediaServer );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CUpnpMediaServerSettings::~CUpnpMediaServerSettings()
+    {
+    Cancel();
+    delete iRepository;
+    }
+    
+// ----------------------------------------------------------------------------
+// CUpnpMediaServerSettings::Set
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpMediaServerSettings::SetL(TUint aId, const TDesC8& aValue)
+    {
+    HBufC* data = UpnpString::ToUnicodeL(aValue);
+    TPtr dataPtr(data->Des());
+    TInt err = iRepository->Set(aId, dataPtr);
+    delete data;
+    return err;
+    }    
+
+// ----------------------------------------------------------------------------
+// CUpnpMediaServerSettings::Set
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpMediaServerSettings::Set(TUint aId, const TDesC& aValue)
+    {
+    return iRepository->Set(aId, aValue);
+    }
+
+// ----------------------------------------------------------------------------
+// CUpnpMediaServerSettings::Set
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpMediaServerSettings::Set(TUint aId, const TInt& aValue)
+    {
+    return iRepository->Set(aId, aValue);
+    }
+// ----------------------------------------------------------------------------
+// CUpnpMediaServerSettings::Get
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpMediaServerSettings::Get(TUint aId, TInt& aValue)
+    {
+    return iRepository->Get(aId, aValue);
+    }    
+// ----------------------------------------------------------------------------
+// CUpnpMediaServerSettings::Get
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpMediaServerSettings::Get(TUint aId, TDes& aValue)
+    {
+    return iRepository->Get(aId, aValue);
+    }    
+// ----------------------------------------------------------------------------
+// CUpnpMediaServerSettings::Get
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CUpnpMediaServerSettings::GetL(TUint aId)
+    {
+    TInt len(0);
+    HBufC* buf(0);
+    TInt err(KErrNotFound);
+
+    do //until the buffer is large enough
+        {
+        len += KBufferGranularity;
+        delete buf; // first time it is Null
+        buf = HBufC::NewL(len);
+        TPtr bufPtr(buf->Des());
+        err = iRepository->Get(aId, bufPtr);
+        }
+    while(err == KErrOverflow );
+	
+    // handle error
+    if(err)
+        {
+        delete buf;
+        User::Leave(err);
+        }
+
+    // convert to UTF-8
+    CleanupStack::PushL(buf);	
+    HBufC8* buf8 = UpnpString::FromUnicodeL(*buf);
+    CleanupStack::PopAndDestroy(buf);
+    return buf8;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerSettings::DoCancel
+// ---------------------------------------------------------------------------
+//	
+void CUpnpMediaServerSettings::DoCancel()
+    {
+    iRepository->NotifyCancelAll();
+    }
+	
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerSettings::Subscribe
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpMediaServerSettings::Subscribe(TUint aId, MUpnpSettingObserver* aObserver)
+    {
+    iObserver = aObserver;
+
+    Cancel();
+
+    TInt err = iRepository->NotifyRequest(aId, iStatus);
+    if( !err )
+        {
+        SetActive();    
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerSettings::RunL
+// ---------------------------------------------------------------------------
+//	
+void CUpnpMediaServerSettings::RunL()
+    {
+    iObserver->SettingChangedL();
+    }	
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerSettings::RunError
+// ---------------------------------------------------------------------------
+//  
+TInt CUpnpMediaServerSettings::RunError( TInt aErr )
+    {
+    LOGS1("CUpnpMediaServerSettings::RunError(%d)", aErr);
+    return KErrNone;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/src/upnpmediaserverstatuswatcher.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,171 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation class for UPnP File Sharing class
+*
+*/
+#include "upnpmediaserverstatuswatcher.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CUpnpMediaServerStatusWatcher* CUpnpMediaServerStatusWatcher::NewL( 
+        MUpnpMediaServerStatusObserver& aObserver )
+    {
+    CUpnpMediaServerStatusWatcher *self = new ( ELeave ) 
+                                     CUpnpMediaServerStatusWatcher( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CUpnpMediaServerStatusWatcher* CUpnpMediaServerStatusWatcher::NewL( 
+        RUpnpMediaServerClient& aClient, MUpnpMediaServerStatusObserver& aObserver )
+    {
+    CUpnpMediaServerStatusWatcher *self = new ( ELeave )
+                                     CUpnpMediaServerStatusWatcher( aClient, aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//                                 
+CUpnpMediaServerStatusWatcher::~CUpnpMediaServerStatusWatcher()   
+    {
+    Cancel();
+    if ( iSessionOwner )
+        {
+        iMediaServerClient.Close();
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CUpnpMediaServerStatusWatcher::CUpnpMediaServerStatusWatcher( 
+    RUpnpMediaServerClient& aClient, MUpnpMediaServerStatusObserver& aObserver )
+    : CActive( CActive::EPriorityStandard ), iMediaServerClient( aClient ),
+      iStatusEventObserver( aObserver )
+    {    
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CUpnpMediaServerStatusWatcher::CUpnpMediaServerStatusWatcher( 
+    MUpnpMediaServerStatusObserver& aObserver )
+    : CActive( CActive::EPriorityStandard ), iSessionOwner( ETrue ),
+      iStatusEventObserver( aObserver )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CUpnpMediaServerStatusWatcher::ConstructL()
+    {
+    if ( iSessionOwner )
+        {
+        User::LeaveIfError( iMediaServerClient.Connect() );
+        }
+    User::LeaveIfError( iMediaServerClient.Status( iMediaServerStatus ) ); 
+    CActiveScheduler::Add( this );
+    Subscribe();
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerStatusWatcher::Subscribe
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpMediaServerStatusWatcher::Subscribe()
+    {
+    if ( !IsActive() )
+        {
+        iMediaServerClient.StatusChangeNotify( iStatus );
+        SetActive();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerStatusWatcher::DispatchResponseStatusEvent
+// ---------------------------------------------------------------------------
+//
+void CUpnpMediaServerStatusWatcher::DispatchResponseStatusEvent( TInt aStatus )
+    {
+    if ( iMediaServerStatus != aStatus )
+        {
+        iMediaServerStatus = aStatus;
+        iStatusEventObserver.StatusChanged( 
+            static_cast<MUpnpMediaServerStatusObserver::TServerState>( iMediaServerStatus ) );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerStatusWatcher::RunL
+// ---------------------------------------------------------------------------
+//
+void CUpnpMediaServerStatusWatcher::RunL()
+    {
+    if ( iStatus >= KErrNone )
+        {
+        Subscribe();
+        TInt newStatus;
+        TInt error  = iMediaServerClient.Status( newStatus );
+        if ( error != KErrNone )
+            {
+            iStatusEventObserver.SubscribeError( error );
+            return;
+            }
+        DispatchResponseStatusEvent( newStatus );        
+        }
+    else
+        {
+        iStatusEventObserver.SubscribeError( iStatus.Int() );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerStatusWatcher::RunError
+// ---------------------------------------------------------------------------
+//    
+TInt CUpnpMediaServerStatusWatcher::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpMediaServerStatusWatcher::DoCancel
+// ---------------------------------------------------------------------------
+//        
+void CUpnpMediaServerStatusWatcher::DoCancel()
+    {
+    iMediaServerClient.CancelStatusChangeNotify();
+    }    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverclient/src/upnpsecuritymanager.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,98 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements the CUpnpService class
+ *
+*/
+
+
+// INCLUDES
+#include "upnpsecuritymanager.h"
+#include <ecom/ecom.h>
+#include "upnpmediaserversettings.h"
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManager::~CUpnpSecurityManager
+//
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpSecurityManager::~CUpnpSecurityManager()
+{
+    // Inform the framework that this specific 
+    // instance of the interface has been destroyed.
+    REComSession::DestroyedImplementation(iDtor_ID_Key);
+}
+    
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManager::NewL
+// Two-phased constructor.
+//
+// Create plugin using for identification field default_data in resource file
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C CUpnpSecurityManager* CUpnpSecurityManager::NewL(const TDesC8& aType)
+{
+    TEComResolverParams resolverParams;
+    resolverParams.SetDataType(aType);
+    // Disable wildcard matching
+    resolverParams.SetWildcardMatch(EFalse);
+
+		const TUid interfaceuidRemote = {0x2001137B};
+		
+		RImplInfoPtrArray implArray;
+		
+		// check if remote access branch security plugin is found
+		REComSession::ListImplementationsL(interfaceuidRemote, implArray);
+		if (implArray.Count() > 0) 
+		    return REINTERPRET_CAST(CUpnpSecurityManager*,
+                          REComSession::CreateImplementationL(
+                                              KCUpnpSecurityManagerUidRemote,
+                                              _FOFF(CUpnpSecurityManager, iDtor_ID_Key),
+                                              resolverParams));
+ 		
+ 		// if not, use the standard security plugin
+		return REINTERPRET_CAST(CUpnpSecurityManager*,
+                          REComSession::CreateImplementationL(
+                                              KCUpnpSecurityManagerUid,
+                                              _FOFF(CUpnpSecurityManager, iDtor_ID_Key),
+                                              resolverParams));
+                                              
+                                              
+}
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManager::NewInstanceFromUpnpSettingsL
+// 
+// Creates new instance of CUpnpSecurityManager based on upnp settings,
+// and NULL if there is no, or empty setting.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpSecurityManager* CUpnpSecurityManager::NewInstanceFromUpnpSettingsL()
+    {
+    CUpnpSecurityManager* newInstance = NULL;
+    CUpnpMediaServerSettings* msSettings = CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( msSettings );
+    HBufC8* secman = msSettings->GetL( UpnpMediaServerSettings::ESecurityManager );
+    CleanupStack::PushL( secman );
+    if ( secman && *secman != KNullDesC8() )
+        {
+        newInstance = CUpnpSecurityManager::NewL( *secman );
+        }
+    CleanupStack::PopAndDestroy( secman );
+    CleanupStack::PopAndDestroy( msSettings );
+    return newInstance;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/data/MediaServer1/ConnectionManager1.xml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,132 @@
+<?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>GetProtocolInfo</name>
+<argumentList>
+<argument>
+<name>Source</name>
+<direction>out</direction>
+<relatedStateVariable>SourceProtocolInfo</relatedStateVariable>
+</argument>
+<argument>
+<name>Sink</name>
+<direction>out</direction>
+<relatedStateVariable>SinkProtocolInfo</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>GetCurrentConnectionIDs</name>
+<argumentList>
+<argument>
+<name>ConnectionIDs</name>
+<direction>out</direction>
+<relatedStateVariable>CurrentConnectionIDs</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>GetCurrentConnectionInfo</name>
+<argumentList>
+<argument>
+<name>ConnectionID</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_ConnectionID</relatedStateVariable>
+</argument>
+<argument>
+<name>RcsID</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_RcsID</relatedStateVariable>
+</argument>
+<argument>
+<name>AVTransportID</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_AVTransportID</relatedStateVariable>
+</argument>
+<argument>
+<name>ProtocolInfo</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_ProtocolInfo</relatedStateVariable>
+</argument>
+<argument>
+<name>PeerConnectionManager</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_ConnectionManager</relatedStateVariable>
+</argument>
+<argument>
+<name>PeerConnectionID</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_ConnectionID</relatedStateVariable>
+</argument>
+<argument>
+<name>Direction</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_Direction</relatedStateVariable>
+</argument>
+<argument>
+<name>Status</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_ConnectionStatus</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+</actionList>
+<serviceStateTable>
+<stateVariable sendEvents="yes">
+<name>SourceProtocolInfo</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="yes">
+<name>SinkProtocolInfo</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="yes">
+<name>CurrentConnectionIDs</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_ConnectionStatus</name>
+<dataType>string</dataType>
+<allowedValueList>
+<allowedValue>OK</allowedValue>
+<allowedValue>ContentFormatMismatch</allowedValue>
+<allowedValue>InsufficientBandwidth</allowedValue>
+<allowedValue>UnreliableChannel</allowedValue>
+<allowedValue>Unknown</allowedValue>
+</allowedValueList>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_ConnectionManager</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_Direction</name>
+<dataType>string</dataType>
+<allowedValueList>
+<allowedValue>Input</allowedValue>
+<allowedValue>Output</allowedValue>
+</allowedValueList>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_ProtocolInfo</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_ConnectionID</name>
+<dataType>i4</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_AVTransportID</name>
+<dataType>i4</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_RcsID</name>
+<dataType>i4</dataType>
+</stateVariable>
+</serviceStateTable>
+</scpd>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/data/MediaServer1/ContentDirectory1.xml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,318 @@
+<?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>GetSearchCapabilities</name>
+<argumentList>
+<argument>
+<name>SearchCaps</name>
+<direction>out</direction>
+<relatedStateVariable>SearchCapabilities</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>GetSortCapabilities</name>
+<argumentList>
+<argument>
+<name>SortCaps</name>
+<direction>out</direction>
+<relatedStateVariable>SortCapabilities</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>GetSystemUpdateID</name>
+<argumentList>
+<argument>
+<name>Id</name>
+<direction>out</direction>
+<relatedStateVariable>SystemUpdateID</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>Browse</name>
+<argumentList>
+<argument>
+<name>ObjectID</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
+</argument>
+<argument>
+<name>BrowseFlag</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_BrowseFlag</relatedStateVariable>
+</argument>
+<argument>
+<name>Filter</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_Filter</relatedStateVariable>
+</argument>
+<argument>
+<name>StartingIndex</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_Index</relatedStateVariable>
+</argument>
+<argument>
+<name>RequestedCount</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
+</argument>
+<argument>
+<name>SortCriteria</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_SortCriteria</relatedStateVariable>
+</argument>
+<argument>
+<name>Result</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
+</argument>
+<argument>
+<name>NumberReturned</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
+</argument>
+<argument>
+<name>TotalMatches</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
+</argument>
+<argument>
+<name>UpdateID</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_UpdateID</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>CreateObject</name>
+<argumentList>
+<argument>
+<name>ContainerID</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
+</argument>
+<argument>
+<name>Elements</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
+</argument>
+<argument>
+<name>ObjectID</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
+</argument>
+<argument>
+<name>Result</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>DestroyObject</name>
+<argumentList>
+<argument>
+<name>ObjectID</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>ImportResource</name>
+<argumentList>
+<argument>
+<name>SourceURI</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
+</argument>
+<argument>
+<name>DestinationURI</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
+</argument>
+<argument>
+<name>TransferID</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>ExportResource</name>
+<argumentList>
+<argument>
+<name>SourceURI</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
+</argument>
+<argument>
+<name>DestinationURI</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
+</argument>
+<argument>
+<name>TransferID</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>StopTransferResource</name>
+<argumentList>
+<argument>
+<name>TransferID</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>GetTransferProgress</name>
+<argumentList>
+<argument>
+<name>TransferID</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable>
+</argument>
+<argument>
+<name>TransferStatus</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_TransferStatus</relatedStateVariable>
+</argument>
+<argument>
+<name>TransferLength</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_TransferLength</relatedStateVariable>
+</argument>
+<argument>
+<name>TransferTotal</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_TransferTotal</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>DeleteResource</name>
+<argumentList>
+<argument>
+<name>ResourceURI</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+<action>
+<name>CreateReference</name>
+<argumentList>
+<argument>
+<name>ContainerID</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
+</argument>
+<argument>
+<name>ObjectID</name>
+<direction>in</direction>
+<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
+</argument>
+<argument>
+<name>NewID</name>
+<direction>out</direction>
+<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
+</argument>
+</argumentList>
+</action>
+</actionList>
+<serviceStateTable>
+<stateVariable sendEvents="yes">
+<name>SystemUpdateID</name>
+<dataType>ui4</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>SortCapabilities</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="yes">
+<name>ContainerUpdateIDs</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="yes">
+<name>TransferIDs</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>SearchCapabilities</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_SortCriteria</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_Result</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_ObjectID</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_BrowseFlag</name>
+<dataType>string</dataType>
+<allowedValueList>
+<allowedValue>BrowseMetadata</allowedValue>
+<allowedValue>BrowseDirectChildren</allowedValue>
+</allowedValueList>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_Filter</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_Index</name>
+<dataType>ui4</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_Count</name>
+<dataType>ui4</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_UpdateID</name>
+<dataType>ui4</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_TransferID</name>
+<dataType>ui4</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_TransferStatus</name>
+<dataType>string</dataType>
+<allowedValueList>
+<allowedValue>COMPLETED</allowedValue>
+<allowedValue>ERROR</allowedValue>
+<allowedValue>IN_PROGRESS</allowedValue>
+<allowedValue>STOPPED</allowedValue>
+</allowedValueList>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_TransferLength</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_TransferTotal</name>
+<dataType>string</dataType>
+</stateVariable>
+<stateVariable sendEvents="no">
+<name>A_ARG_TYPE_URI</name>
+<dataType>uri</dataType>
+</stateVariable>
+</serviceStateTable>
+</scpd>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/data/MediaServer1/MediaServer1.xml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root xmlns="urn:schemas-upnp-org:device-1-0" xmlns:dlna="urn:schemas-dlna-org:device-1-0">
+   <specVersion>
+      <major>1</major>
+      <minor>0</minor>
+   </specVersion>
+<device>
+    <dlna:X_DLNADOC>M-DMS-1.50</dlna:X_DLNADOC>
+    <dlna:X_DLNACAP>audio-upload,av-upload,image-upload</dlna:X_DLNACAP> 
+    <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
+    <friendlyName>The Correct Name, UDN is generated automaticly</friendlyName>
+    <manufacturer></manufacturer>
+    <modelName></modelName>
+    <UDN></UDN>
+    <serviceList>
+        <service>
+            <serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>
+            <serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>
+            <SCPDURL>/mediaserver1/contentdirectory1.xml</SCPDURL>
+            <controlURL>/mediaserver1/contentdirectory1/control</controlURL>
+            <eventSubURL>/mediaserver1/contentdirectory1/eventing</eventSubURL>
+        </service>
+        <service>
+            <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
+            <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
+            <SCPDURL>/mediaserver1/connectionmanager1.xml</SCPDURL>
+            <controlURL>/mediaserver1/connectionmanager1/control</controlURL>
+            <eventSubURL>/mediaserver1/connectionmanager1/eventing</eventSubURL>
+        </service>
+    </serviceList>
+</device>
+</root>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/data/backup_registration.xml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+    <passive_backup>
+      <include_directory name = "\"/>
+    </passive_backup>
+    <restore requires_reboot = "no"/>
+</backup_registration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/data/objects.xml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,307 @@
+<es>
+  	<e type="object">       
+		<i></i>
+		<ps type = "Attribute">
+			<p n="id" r="1" t="ui"/>
+			<p n="parentID" r="0" t="ui"/>
+			<p n="restricted" r="1" t="b"/>
+		</ps>
+		<ps type = "e">
+			<p n="dc:title" r="1" t="ls"/>
+			<p n="dc:creator" r="0" t="ls"/>
+			<p n="res" r="0" m="1" t="ls">
+				<ps type="Attribute">
+				<p n="protocolInfo" r="1" m="0" t="ls"/>
+				</ps>
+			</p>
+			<p n="upnp:class" r="1" t="ls"/>
+		</ps>
+		<ps type="res">
+                     <p n="importUri" t="ls"/>
+                     <p n="protocolInfo" t="ls"/>
+                     <p n="size" t="ul"/>
+					 <p n="duration" t="ls"/>
+                </ps>
+	</e>
+
+	<e type="container">
+		<i>object</i>
+		<ps type = "Attribute">
+			<p n="childCount" r="0"/>
+			<p n="searchable" r="0"/>
+			<p n="createClass" r="0" m="1"/>
+			<p n="searchClass" r="0" m="1"/>
+		</ps>
+	</e>
+
+	 <e type="item">
+		<i>object</i>
+		<ps type = "Attribute">
+			<p n="refID" r="0"/>
+		</ps>
+	</e>
+
+	<e type="audioItem">
+		<i>item</i>
+		<ps type = "e">
+			<p n="upnp:genre" r="0" m="1"/>
+			<p n="dc:description" r="0"/>
+			<p n="upnp:longDescription" r="0"/>
+			<p n="dc:publisher" r="0" m="1"/>
+			<p n="dc:language" r="0"/>
+			<p n="dc:relation" r="0" m="1"/>
+			<p n="dc:rights" r="0"/>
+			<p n="upnp:albumArtURI" r="0" m="1" t="ls">
+				<ps type="Attribute">
+				<p n="dlna:profileID" r="1" m="0" t="ls"/>				
+				</ps>			
+			</p>
+		</ps>
+	</e>
+
+	<e type="videoItem">
+		<i>item</i>
+		<ps type = "e">
+			<p n="upnp:genre" r="0" m="1"/>
+			<p n="upnp:longdescription" r="0"/>
+			<p n="upnp:producer" r="0" m="1"/>
+			<p n="upnp:rating" r="0"/>
+			<p n="upnp:actor" r="0" m="1"/>
+			<p n="upnp:director" r="0" m="1"/>
+			<p n="dc:description" r="0"/>
+			<p n="dc:publisher" r="0" m="1"/>
+			<p n="dc:language" r="0"/>
+			<p n="dc:relation" r="0" m="1"/>
+			<p n="dc:date" r="0"/>
+		</ps>
+	</e>
+
+	<e type="imageItem">
+		<i>item</i>
+		<ps type = "e">
+			<p n="upnp:longdescription" r="0"/>
+			<p n="upnp:storageMedium" r="0"/>
+			<p n="upnp:rating" r="0"/>
+			<p n="dc:description" r="0"/>
+			<p n="dc:publisher" r="0" m="1"/>
+			<p n="dc:date" r="0"/>
+			<p n="dc:rights" r="0"/>
+		</ps>
+	</e>
+
+	<e type="playlistItem">
+		<i>item</i>
+		<ps type = "e">
+			<p n="upnp:artist" r="0" m="1"/>
+			<p n="upnp:genre" r="0" m="1"/>
+			<p n="upnp:longDescription" r="0"/>
+			<p n="upnp:storageMedium" r="0"/>
+			<p n="dc:description" r="0"/>
+			<p n="dc:date" r="0"/>
+			<p n="dc:language" r="0"/>
+		</ps>
+	</e>
+
+	<e type="textItem">
+		<i>item</i>
+		<ps type = "e">
+			<p n="upnp:author" r="0" m="1"/>
+			<p n="upnp:protection" r="0"/>
+			<p n="upnp:longDescription" r="0"/>
+			<p n="upnp:storageMedium" r="0"/>
+			<p n="upnp:rating" r="0"/>
+			<p n="dc:description" r="0"/>
+			<p n="dc:publisher" r="0" m="1"/>
+			<p n="dc:contributor" r="0" m="1"/>
+			<p n="dc:date" r="0"/>
+			<p n="dc:relation" r="0" m="1"/>
+			<p n="dc:language" r="0"/>
+			<p n="dc:rights" r="0"/>
+		</ps>
+	</e>
+
+	<e type="musicTrack">
+		<i>audioItem</i>
+		<ps type = "e">
+			<p n="upnp:artist" r="0" m="1"/>
+			<p n="upnp:album" r="0" m="1"/>
+			<p n="upnp:originalTrackNumber" r="0"/>
+			<p n="upnp:playlist" r="0" m="1"/>
+			<p n="upnp:storageMedium" r="0"/>
+			<p n="dc:contributor" m="1" r="0"/>
+			<p n="dc:date" r="0"/>
+		</ps>
+	</e>
+
+	<e type="audioBroadcast">
+		<i>audioItem</i>
+		<ps type = "e">
+			<p n="upnp:region" r="0"/>
+			<p n="upnp:radioCallSign" r="0"/>
+			<p n="upnp:radioStationID" r="0"/>
+			<p n="upnp:radioBand" r="0"/>
+			<p n="upnp:channelNr" r="0"/>
+		</ps>
+	</e>
+
+	<e type="audioBook">
+		<i>audioItem</i>
+		<ps type = "e">
+			<p n="upnp:storageMedium" r="0"/>
+			<p n="upnp:producer" r="0" m="1"/>
+			<p n="upnp:contributor" r="0" m="1"/>
+			<p n="upnp:date" r="0"/>
+		</ps>
+	</e>
+
+	<e type="movie">
+		<i>videoItem</i>
+		<ps type = "e">
+			<p n="upnp:storageMedium" r="0"/>
+			<p n="upnp:DVDRegionCode" r="0"/>
+			<p n="upnp:channelName" r="0"/>
+			<p n="upnp:scheduledStartTime" r="0"/>
+			<p n="upnp:scheduledEndTime" r="0"/>
+			<p n="dc:date" r="0"/>
+		</ps>
+	</e>
+
+	<e type="photo">
+		<i>imageItem</i>
+		<ps type = "e">
+			<p n="upnp:album" r="0" m="1"/>
+		</ps>
+	</e>
+
+	<e type="videoBroadcast">
+		<i>videoItem</i>
+		<ps type = "e">
+			<p n="upnp:icon" r="0"/>
+			<p n="upnp:region" r="0"/>
+			<p n="upnp:channelNr" r="0"/>
+		</ps>
+	</e>
+
+	<e type="musicVideoClip">
+		<i>videoItem</i>
+		<ps type = "e">
+			<p n="upnp:artist" r="0" m="1"/>
+			<p n="upnp:storageMedium" r="0"/>
+			<p n="upnp:album" r="0" m="1"/>
+			<p n="upnp:scheduledStartTime" r="0"/>
+			<p n="upnp:scheduledStopTime" r="0"/>
+			<p n="upnp:director" r="0" m="1"/>
+			<p n="dc:contributor" r="0" m="1"/>
+			<p n="dc:date" r="0"/>
+		</ps>
+	</e>
+
+	<e type="album">
+		<i>container</i>
+		<ps type = "e">
+			<p n="upnp:storageMedium" r="0"/>
+			<p n="dc:longDescription" r="0"/>
+			<p n="dc:description" r="0"/>
+			<p n="dc:publisher" r="0" m="1"/>
+			<p n="dc:contributor" r="0" m="1"/>
+			<p n="dc:date" r="0"/>
+			<p n="dc:relation" r="0" m="1"/>
+			<p n="dc:rights" r="0"/>
+		</ps>
+	</e>
+
+	<e type="genre">
+		<i>container</i>
+		<ps type = "e">
+			<p n="upnp:longDescription" r="0"/>
+			<p n="dc:description" r="0"/>
+		</ps>
+	</e>
+
+	<e type="storageSystem">
+		<i>container</i>
+		<ps type = "e">
+			<p n="upnp:storageTotal" r="1"/>
+			<p n="upnp:storageUsed" r="1"/>
+			<p n="upnp:storageFree" r="1"/>
+			<p n="upnp:storageMaxPartition" r="1"/>
+			<p n="upnp:storageMedium" r="1"/>
+		</ps>
+	</e>
+
+	<e type="storageVolume">
+		<i>container</i>
+		<ps type = "e">
+			<p n="upnp:storageTotal" r="1"/>
+			<p n="upnp:storageUsed" r="1"/>
+			<p n="upnp:storageFree" r="1"/>
+			<p n="upnp:storageMedium" r="1"/>
+		</ps>
+	</e>
+
+	<e type="playlistContainer">
+		<i>container</i>
+		<ps type = "e">
+			<p n="upnp:artist" r="0" m="1"/>
+			<p n="upnp:genre" r="0" m="1"/>
+			<p n="upnp:longDescription" r="0"/>
+			<p n="upnp:producer" r="0" m="1"/>
+			<p n="upnp:storageMedium" r="0"/>
+			<p n="dc:description" r="0"/>
+			<p n="dc:contributor" r="0" m="1"/>
+			<p n="dc:date" r="0"/>
+			<p n="dc:language" r="0"/>
+			<p n="dc:rights" r="0"/>
+		</ps>
+	</e>
+
+	<e type="person">
+		<i>container</i>
+		<ps type = "e">
+			<p n="dc:language" r="0"/>
+		</ps>
+	</e>
+
+	<e type="storageFolder">
+		<i>container</i>
+		<ps type = "e">
+			<p n="upnp:storageUsed" r="1"/>
+		</ps>
+	</e>
+
+	<e type="musicAlbum">
+		<i>album</i>
+		<ps type = "e">
+			<p n="upnp:artist" r="0" m="1"/>
+			<p n="upnp:genre" r="0" m="1"/>
+			<p n="upnp:producer" r="0" m="1"/>
+			<p n="upnp:albumArtURI" r="0" m="1" t="ls">
+				<ps type="Attribute">
+				<p n="dlna:profileID" r="1" m="0" t="ls"/>				
+				</ps>			
+			</p>
+			<p n="upnp:toc" r="0"/>
+		</ps>
+	</e>
+
+	<e type="photoAlbum">
+		<i>album</i>
+	</e>
+
+	<e type="musicGenre">
+		<i>genre</i>
+	</e>
+
+	<e type="movieGenre">
+		<i>genre</i>
+	</e>
+
+	<e type="musicArtist">
+		<i>person</i>
+		<p n="upnp:genre" r="0" m="1"/>
+		<p n="upnp:artistDiscographyURI" r="0"/>
+	</e>
+
+
+
+</es>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,52 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for UPnP Media Server Engine
+*
+*/
+
+
+PRJ_PLATFORMS
+    
+DEFAULT
+PRJ_EXPORTS
+../inc/upnpmediaserverglobals.h |../../inc/upnpmediaserverglobals.h
+
+
+../data/objects.xml /epoc32/release/winscw/udeb/z/private/101f977c/objects.xml
+../data/objects.xml /epoc32/release/winscw/urel/z/private/101f977c/objects.xml
+../data/objects.xml /epoc32/data/z/private/101f977c/objects.xml
+
+../data/MediaServer1/ConnectionManager1.xml /epoc32/release/winscw/urel/z/private/101f977c/public/MediaServer1/ConnectionManager1.xml 
+../data/MediaServer1/ConnectionManager1.xml /epoc32/release/winscw/udeb/z/private/101f977c/public/MediaServer1/ConnectionManager1.xml 
+../data/MediaServer1/ConnectionManager1.xml /epoc32/data/z/private/101f977c/public/MediaServer1/ConnectionManager1.xml 
+
+../data/MediaServer1/ContentDirectory1.xml  /epoc32/release/winscw/udeb/z/private/101f977c/public/MediaServer1/ContentDirectory1.xml 
+../data/MediaServer1/ContentDirectory1.xml  /epoc32/release/winscw/urel/z/private/101f977c/public/MediaServer1/ContentDirectory1.xml 
+../data/MediaServer1/ContentDirectory1.xml  /epoc32/data/z/private/101f977c/public/MediaServer1/ContentDirectory1.xml 
+
+../data/MediaServer1/MediaServer1.xml       /epoc32/release/winscw/udeb/z/private/101f977c/public/MediaServer1/MediaServer1.xml
+../data/MediaServer1/MediaServer1.xml       /epoc32/release/winscw/urel/z/private/101f977c/public/MediaServer1/MediaServer1.xml
+../data/MediaServer1/MediaServer1.xml       /epoc32/data/z/private/101f977c/public/MediaServer1/MediaServer1.xml
+
+../data/backup_registration.xml  /epoc32/data/z/private/101f977c/backup_registration.xml
+../data/backup_registration.xml  /epoc32/release/winscw/udeb/z/private/101f977c/backup_registration.xml
+../data/backup_registration.xml  /epoc32/release/winscw/urel/z/private/101f977c/backup_registration.xml
+
+
+
+
+PRJ_MMPFILES
+mediaserverengine.mmp
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/group/mediaserverengine.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,66 @@
+/** @file
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGETTYPE      EXE
+
+
+TARGET          avmediaserver.exe
+UID             0x1000008d 0x101F977C
+
+CAPABILITY      CAP_SERVER
+VENDORID        VID_DEFAULT
+
+VERSION 10.1
+paged
+
+SOURCEPATH      ../src
+SOURCE          upnpmediaserver.cpp
+SOURCE          upnpmediaserversession.cpp
+SOURCE          upnpmediaservereventhandler.cpp
+SOURCE          upnpiconmanager.cpp
+SOURCE          upnpdiskremovedetector.cpp 
+SOURCE          upnpmediaserverdescriptionprovider.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+LIBRARY         euser.lib 
+LIBRARY         efsrv.lib
+// UPnP
+LIBRARY         upnpserviceframework.lib
+LIBRARY         avcontentdirectory.lib
+LIBRARY         avconnectionmanager.lib
+LIBRARY         avmediaserverclient.lib
+LIBRARY         upnpavobjects.lib
+LIBRARY         upnpipserversutils.lib
+LIBRARY         upnpconnectionmanagersession.lib
+LIBRARY         xmlenginedom.lib
+LIBRARY         xmlengineutils.lib
+LIBRARY         inetprotutil.lib
+LIBRARY         estor.lib 
+LIBRARY         sysutil.lib
+LIBRARY         insock.lib
+LIBRARY         connmon.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/inc/upnpdiskremovedetector.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,111 @@
+/** @file
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Detects remove disk event.
+*
+*/
+
+
+#ifndef C_CUPNPDISKREMOVEDETECTOR_H
+#define C_CUPNPDISKREMOVEDETECTOR_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <f32file.h>
+
+// FORWARD DECLARATIONS
+class CUpnpMediaServer;
+
+
+// CLASS DECLARATION
+/**
+ *  Class is responsible for detecting removal/unmounting of a disk from file system
+ *  @since S60 v3.2
+ */
+class CUpnpDiskRemoveDetector : public CActive
+    {
+public: // New methods
+
+    /**
+    * Two-phased constructor.
+    * @param aObserver callback interface
+    */
+    static CUpnpDiskRemoveDetector* NewLC( CUpnpMediaServer* aObserver );
+
+    /**
+    * Two-phased constructor.
+    * @param aObserver callback interface
+    */
+    static CUpnpDiskRemoveDetector* NewL( CUpnpMediaServer* aObserver );
+
+    /**
+    * Destructor.
+    */
+    ~CUpnpDiskRemoveDetector();
+
+    /**
+     * Start watching for events - asynchronous method
+     */	
+    void StartL();
+
+protected: // From CActive
+
+    /**
+     * From CActive, called when event occur.
+     */
+    void RunL();
+
+    /**
+     * From CActive, cancel watching for incoming events.
+     */
+    void DoCancel();
+
+    /**
+     * From CActive, called when RunL leaves.
+     * @param aError error code
+     */
+    TInt RunError( TInt aError );
+
+private: // New methods
+    /**
+    * C++ default constructor.
+    * @param aObserver callback interface
+    */
+    CUpnpDiskRemoveDetector( CUpnpMediaServer* aObserver );
+
+    /**
+     * Second phase constructor
+     */
+    void ConstructL();
+
+    /**
+     * Check if the upload direcotory is valid
+     */
+    void CheckUploadDirectoryL();
+    
+    /**
+     * Subscribe this object for file system disk event
+     */
+    void SubscribeForDiskEvent();
+
+private: // Data
+
+    // Interface monitor
+    RFs iFs;
+
+    //Callback interface
+    CUpnpMediaServer* iObserver;
+
+    };
+
+#endif // C_CUPNPDISKREMOVEDETECTOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/inc/upnpiconmanager.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,182 @@
+/** @file
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares CUpnpIconManager class
+*
+*/
+
+
+
+#ifndef C_CUPNPICONMANAGER_H
+#define C_CUPNPICONMANAGER_H
+
+// INCLUDES
+#include <f32file.h>
+
+// FORWARD DECLARATIONS
+class CUpnpIcon;
+class CUpnpDeviceImplementation;
+class CUpnpDevice;
+class CUpnpMediaServerDescriptionProvider;
+class CUpnpDeviceDescriptionStore;
+
+// CLASS DECLARATION
+
+/**
+ *  Class is responsible for MS icon managing
+ *  Handles all request releated to icons
+ *  Such as: Adding, Updating and Removing icons to/from MS description
+ *  @since S60 v3.2
+ */
+class CUpnpIconManager: public CBase
+    {
+public:
+    /**
+     * Two-phased constructor.
+     * @param aDescriptionFile file with device description xml
+     * @param aDescriptionProvider description provider
+     */
+    static CUpnpIconManager* NewL( CUpnpDeviceDescriptionStore& iDescriptionStore,
+                                   CUpnpMediaServerDescriptionProvider& aDescriptionProvider );
+
+    /**
+     * Two-phased constructor.
+     * @param aDescriptionFile file with device description xml
+     * @param aDescriptionProvider description provider
+     */
+    static CUpnpIconManager* NewLC( CUpnpDeviceDescriptionStore& iDescriptionStore,
+                                    CUpnpMediaServerDescriptionProvider& aDescriptionProvider );
+
+    /**
+     * Destructor
+     */
+    ~CUpnpIconManager();
+    
+    /**
+    * Adds icon
+    * @param aIconDes icon description( serialized icon )
+    */
+    void AddIconL( const TDesC8& aIconDes );
+
+    /**
+    * Updates icon
+    * @param aNewIconDes new icon description( serialized icon )
+    * @param aUrl url of icon which will be updated
+    */
+    void UpdateIconL( const TDesC8& aNewIconDes, const TDesC8& aUrl );
+
+    /**
+    * Removes icon
+    * @param url of icon which will be deleted
+    */
+    void RemoveIconL( const TDesC8& aUrl );
+
+    /**
+    * Removes all icons
+    */
+    void RemoveIconsL();
+
+private:
+    /**
+    * Creates icon path
+    * @return icon path
+    */
+    HBufC* GetIconPathLC();
+
+    /**
+    * Returns icon name
+    * @param aPath
+    * @return icon name
+    */
+    HBufC* GetIconNameLC( const TDesC8& aPath );
+
+    /**
+    * Copy icon to MS private directory
+    * @param aIcon icon which will be copied
+    * @param aDestinationPath icon's destination directory
+    */
+    void CopyIconToPrivateL( const CUpnpIcon* icon , const TDesC& destinationPath );
+
+    /**
+    * Prepare beckup copy of icon which is going to be updated
+    * @param aPath path to icon which going to be beckuped
+    * return pointer to beckup filename, used in rollback operation
+    */
+    HBufC* PrepareIconToRollbackLC( const TDesC& aPath );
+
+    /**
+    * Updates icon
+    * @param aIcon new icon
+    * @param aDestinationPath old icon path
+    */
+    void DoUpdateIconL( CUpnpIcon* aIcon, const TDesC& aDestinationPath );
+
+    /**
+    * Deletes icon from FS
+    * @param aPath path to icon which is delete
+    * @returns KErrNone if succesfull or other error code of failed
+    */
+    TInt DeleteIconFile( const TDesC& aPath );
+
+    /**
+    * Makes an attempt to restore icon from it's original path
+    * @param aUrl icons URL
+    */
+    void RestoreFromOrginalPathL( const TDesC8& aUrl );
+
+    /**
+    * Checks if icon already exist in device iconList
+    * Leaves with KErrNotFound if icon doesn't exist
+    * @param aUrl an icon's URL to be checked
+    */
+    TInt FindIcon( const TDesC8& aUrl );
+
+    /**
+     * Adds all icons to the description property map.
+     * 
+     * @since S60 5.1
+     */
+    void AddIconsToDescriptionPropertyMapL();
+    
+private:
+
+    /**
+     * Two-phased constructor.
+     * @param aDescriptionFile file with device description xml
+     */
+    void ConstructL();
+
+    /**
+     * Constructor.
+     * @param aDescriptionProvider description provider
+     */
+    CUpnpIconManager( CUpnpDeviceDescriptionStore& iDescriptionStore,
+                      CUpnpMediaServerDescriptionProvider& aDescriptionProvider );
+
+private:
+    
+    /** File session handler - owned */
+    RFs iFileSession;
+    
+    /** Icon list used for icon operation when device is not started */
+    RPointerArray< CUpnpIcon > iIconList;
+    
+    /** Description provider - not owned */
+    CUpnpMediaServerDescriptionProvider& iDescriptionProvider;
+    
+    /** Description store */
+    CUpnpDeviceDescriptionStore& iDescriptionStore; 
+    };
+
+
+#endif//C_CUPNPICONMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/inc/upnpmediaserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,437 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media server device
+ *
+*/
+
+
+#ifndef C_CUPNPMEDIASERVER_H
+#define C_CUPNPMEDIASERVER_H
+
+// INCLUDES
+#include <in_sock.h>
+#include <upnpnetworkeventobserver.h>
+#include "upnpmediaserver.pan"
+#include "upnpmediaserversettings.h"
+#include "upnpmediaservereventhandler.h"
+#include "upnpnotifytimer.h"
+#include "upnpsymbianserverbase.h"
+#include "upnpmediaserverclient.h"
+
+
+// CONSTANTS
+_LIT(KMSPublicAccessedDir,"public");
+_LIT(KMSMediaDir,"Media");
+_LIT(KMSDeviceXmlDescDir,"MediaServer1");
+_LIT(KMSDeviceXmlDescFile,"MediaServer1.xml");
+_LIT(KCDXmlDescFile,"ContentDirectory1.xml");
+_LIT(KCMXmlDescFile,"ConnectionManager1.xml");
+_LIT(KIconDirectory, "icon");
+_LIT(KBackupSuffix,".bak");
+_LIT(KDescTemplateDrive,"Z:");
+//
+const TUint KMSDescriptionMaxSize = 204800;
+
+//note that this value should be less than upnp server process shutdown timeout value
+const TInt KStopAVMediaServerDelay = 1500000;
+
+// FORWARD DECLARATIONS
+class CUpnpContentDirectoryService;
+class CUpnpContainerList;
+class CUpnpItem;
+class CUpnpContainer;
+class CUpnpCM;
+class CUpnpSecurityManager;
+class CUpnpDeviceImplementation;
+class CUpnpIconManager;
+class CUpnpDiskRemoveDetector;
+class CUpnpDeviceDescriptionStore;
+
+class CUpnpConnectionManagerNetworkEventProvider;
+class CUpnpMediaServerDescriptionProvider;
+
+
+
+// CLASS DECLARATION
+
+/**
+ *  UPnP Media Server container.
+ *  Provides interface for Media Server maintanace purposes.
+ *
+ *  @since Series 60 3.1
+ */
+class CUpnpMediaServer : public CUpnpSymbianServerBase, MUpnpSettingObserver,
+        MUpnpContentDirectoryEventObserver, MUpnpNetworkEventObserver
+    {
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUpnpSymbianServerBase* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpMediaServer();
+
+public:
+    // New functions
+    void GetSharedItemListL( TInt aContId,
+        CUpnpBrowseCriteria* aBrowseCriteria, TInt* TotalMatches,
+        CUpnpItemList* aItemList );
+    void GetSharedContainerListL( TInt aContId,
+        CUpnpBrowseCriteria* aBrowseCriteria, TInt* TotalMatches,
+        CUpnpContainerList* aContainerList );
+    void UnshareItemListL( RArray<TInt>& aItemList, TInt* aExecutionStatus );
+    CUpnpItem* GetSharedItemL( TInt aItem );
+    CUpnpContainer* GetSingleContainerL( TInt aContainerId );
+    void UnshareRootL();
+    void UnshareItemL( TInt aId );
+    void UnshareContainerL( TInt aId );
+
+    /**
+     * Shares new item
+     */
+    void ShareObjectL( CUpnpObject* aItem );
+
+    /**
+     * Shares new items
+     */
+    void ShareItemListL( CUpnpItemList* aItemList, TInt* aStatus );
+
+    /**
+     * Creates a new reference
+     */
+    void ShareReferenceL( CUpnpItem* aItem );
+
+    /**
+     * Shares new 'reference item' list
+     */
+    void ShareReferenceListL( CUpnpItemList* aItemList, TInt* aStatus );
+
+    /**
+     * Starts AV Media Server - Device, Service, ContentDirecory, ConnectionManager
+     */
+    void StartAVMediaServerL();
+
+    /**
+     * Starts AV Media Server in offline mode
+     */
+    void StartAVMediaServerOfflineL();
+
+    /**
+     * Stops AV Media Server - Device, ContentDirecory, ConnectionManager
+     * Starts timeout timer
+     */
+    void StopAVMediaServer( TBool aSilent );
+
+    /**
+     * Restarts AV Media Server - Device, ContentDirecory, ConnectionManager
+     */
+    void RestartAVMediaServerL();
+
+    /**
+     * Check status of AV Media Server
+     */
+    RUpnpMediaServerClient::TServerStatus Status() const;
+
+    /**
+     * Sets description properties for device, changes are available after restarting
+     * the server.
+     * Values are read from Central Repository
+     * @param aDevice device to change
+     */
+    void SetDescriptionSettingsL( CUpnpDeviceImplementation* aDevice );
+
+    /**
+     * Adds icon to public\MediaServer1\icon and adds icon element
+     * to device description xml
+     * @param aProperty device to change
+     */
+    void AddIconL( const TDesC8& aProperty );
+
+    /**
+     * Updates icon in public\MediaServer1\icon and updates icon element
+     * in device description xml
+     * @param aProperty
+     * @param aUrl icon url
+     */
+    void UpdateIconL( const TDesC8& aProperty, const TDesC8& aUrl );
+
+    /**
+     * Removes icon from public\MediaServer1\icon and removes icon element
+     * from device description xml
+     * @param aUrl icon url
+     */
+    void RemoveIconL( const TDesC8& aUrl );
+
+    /**
+     * Removes all icons from public\MediaServer1\icon and removes icon elements
+     * from device description xml
+     */
+    void RemoveIconsL();
+
+    /**
+     * Sets description property for device, changes are available after restarting
+     * the server.
+     * Value is read from Central Repository
+     * @param aDevice device to change
+     * @param aKey Central Repository property key
+     * @param aName property name (XML)
+     */
+    void SetDescriptionPropertyL( CUpnpDeviceImplementation* aDevice,
+        TInt aKey, const TDesC8& aName );
+
+    /**
+     * Sets description required property for device, changes are available after restarting
+     * the server.
+     * Value is read from Central Repository
+     * @param aDevice device to change
+     * @param aKey Central Repository required property key
+     * @param aName property name (XML)
+     */
+    void SetDescriptionRequiredPropertyL( CUpnpDeviceImplementation* aDevice,
+        TInt aKey, const TDesC8& aName );
+
+    /**
+     * Removes white characters from input descriptor
+     * @param aString to change
+     */
+    void RemoveWhiteSpaces( TDes8& aString );
+
+    /**
+     * Initialize Media Server files in private directory.
+     * @param aOverwrite indicate whether files should be overwrite if exist
+     */
+    void InitializeL( TBool aOverwrite );
+
+    /**
+     * Reset Content Directory DB
+     * It means that it rename original file adding suffix KBackupSuffix,
+     * s during next running Content Directory will create new DB file.
+     */
+    void ResetDbL();
+
+    /**
+     * Delete Content Directory DB
+     * It means that it deletes database file
+     */
+    void DeleteDbL();
+
+    /**
+     * Subscribe events, adds observer to the list
+     * @param aObserver event observer
+     */
+    void SubscribeEvents( MUpnpContentDirectoryEventObserver* aObserver );
+
+    /**
+     * Unsubscribe events, removes observer from list
+     * @param aObserver event observer
+     */
+    void UnsubscribeEvents( MUpnpContentDirectoryEventObserver* aObserver );
+
+    TInetAddr GetAddress();
+
+    /**
+     * Set the download and thumbnail path in CD according to the value of the upload directory.
+     * @param aContentDirectory
+     * @return full name of description file
+     */
+    void SetUploadDirToCDL( const TDesC& aPath );
+
+    /**
+     * Cancels scheduled shutdown of MS
+     */
+    void CancelAVMediaServerStop();
+
+    /**
+    * Set the upload and thumbnail path in CD and in central repository.
+    * @param aPath new path
+    */
+    void SetUploadDirL( const TDesC& aPath );
+
+public:
+    // From MUpnpContentDirectoryEventObserver
+    /**
+     * Called when transfer event happens
+     * @param aTransferEvent transfer event
+     */
+    virtual void FileTransferEvent( CUpnpFileTransferEvent *aTransferEvent );
+
+    /**
+    * Checks if interface is up
+    * @result return ETrue if started in online mode
+    */
+    TBool IsInterfaceUp();
+
+    // From MUpnpSettingObserver
+    /**
+     * Function notify when setting will change
+     */
+    virtual void SettingChangedL();
+
+private:
+    // New methods
+
+    /**
+     * Constructor
+     */
+    CUpnpMediaServer();
+
+    /**
+     * Perform the second phase construction of a CUpnpMessageHandler object
+     */
+    void ConstructL();
+
+    /**
+     * Init Media Server directory structure in private directory.
+     * @param aFs handle to RFs
+     * @return a updateId of container
+     */
+    void InitPrivateDirL( RFs &aFs );
+
+    /**
+     * Checks is description file exists. If not creates it from teplate stored on Z:
+     * If parameter aOverwrite
+     * @param aFs handle to RFs
+     * @param aTempleteDescFile xml description file name
+     * @param aOverwrite indicate whether file should be overwrite if exists
+     * @return full name of description file
+     */
+    HBufC* InitDescFileL( RFs &aFs, const TDesC& aTempleteDescFile,
+        TBool aOverwrite );
+
+    /**
+     * Create full name using drive MS directory structure and file name.
+     * @param aFs handle to RFs
+     * @param aDrive drive
+     * @param aName file name
+     * @return full name of description file
+     */
+    HBufC* CreateFullNameL( RFs &aFs, const TDesC& aDrive,
+                const TDesC& aName );
+
+private:
+    /**
+     * Stops MS immediatly
+     */
+    void StopAVMediaServerImmediately( TBool aSilent, TBool aWlanLost );
+
+private://from CUpnpSymbianServerBase
+
+    /**
+     * Create a time server session, and return a pointer to the created object
+     * @param aMessage client message
+     * @result pointer to new session
+     */
+    CSession2* NewSessionL( const RMessage2& aMessage ) const;
+
+    /**
+     * @return ETrue when media server is in state that it can be stopped
+     */
+    TBool CanBeStopped() const;
+
+    /**
+     * Returns version that is supported by this server.
+     */
+    TVersion SupportedVersion() const;
+
+    /**
+     * Returns server name
+     */
+    const TDesC& ServerName() const;
+    
+    /**
+     * Change media server status
+     */
+    void SetStatus( RUpnpMediaServerClient::TServerStatus aStatus );
+    
+    /**
+     * Method should be invoked to notify all subscribed clients about
+     * media server change. It is invoked if after RunL method status
+     * is changed, and in every case that server change its status
+     * without user request (eq. wlan lost) 
+     */
+    void NotifyStatusChanged();
+
+private:    // from MUpnpNetworkEventObserver
+
+    /**
+     * It is called from bottom layer when network event occurs [callback method]     
+     * @result None
+     */
+    void NetworkEvent( CUpnpNetworkEventBase* aEvent );
+
+private:    // from CUpnpSymbianServerBase
+    virtual void RunL();
+    
+private:
+    /**
+     * Callback if timer expires
+     */
+    void TimerEventL( CUpnpNotifyTimer* aTimer );
+
+private:
+
+    /*! @var iDevice Media Server Device */
+    CUpnpDeviceImplementation* iDevice;
+    /*! @var iContentDirecory Content Directory */
+    CUpnpContentDirectoryService* iContentDirecory;
+    /*! @var iCm Connection Manager  */
+    CUpnpCM* iCm;
+    /*! @var iIconManager Icon Manager  */
+    CUpnpIconManager* iIconManager;
+
+    /*! @var iMsName Media Server Device description file full name */
+    HBufC* iMsName;
+    /*! @var iCdName Content Directory Service description file full name */
+    HBufC* iCdName;
+    /*! @var iCmName Connection Manager Service description file full name */
+    HBufC* iCmName;
+
+    /*! @var iMsStatus Media Server operational status - started/started offline/stopped */
+    RUpnpMediaServerClient::TServerStatus iMsStatus;
+
+    /*! @var interface for reading and setting Media Server settings */
+    CUpnpMediaServerSettings* iSettings;
+
+    /*! @var security manager pointer */
+    CUpnpSecurityManager* iManager;
+
+    /*! @var list of event observers (subscribed sessions) */
+    RPointerArray<MUpnpContentDirectoryEventObserver> iObserverList;
+
+    // memory card remove watcher
+    CUpnpDiskRemoveDetector* iDiskDetector;
+
+    // flag that stores shut down type
+    TBool iIsSilentShutdown;
+
+    //please note that it only stops media server as UPnP entity (sends bye bye etc.)
+    //not symbian server object
+    CUpnpNotifyTimer* iStopAVMediaServerTimer;
+    
+    // Network events provider used for WLAN lost and address change
+    CUpnpConnectionManagerNetworkEventProvider* iConnectionManagerNetworkEventProvider;
+    
+    // Provides files for description part
+    CUpnpMediaServerDescriptionProvider* iDescriptionProvider;
+    
+    // Services device description
+    CUpnpDeviceDescriptionStore* iDescriptionStore;
+    };
+
+#endif // C_CUPNPMEDIASERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/inc/upnpmediaserver.pan	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,36 @@
+/** @file
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __MEDIASERVER_PAN__
+#define __MEDIASERVER_PAN__
+
+/** Panic Category */
+
+/** MessageHandler panic codes */
+enum TMediaServerPanic
+    {
+    EMediaServerBadRequest = 1,
+    EMediaServerBadDescriptor = 2,
+    EMediaServerSrvCreateServer = 3,
+    EMediaServerMainSchedulerError = 4,
+    EMediaServerCreateTrapCleanup = 5,
+    EMediaServerSrvSessCreateTimer = 6,
+	EMediaServerReqAlreadyPending = 7,		//	A request is already pending
+	EMediaServerDifferencesInIap = 8
+    };
+
+#endif // __MEDIASERVER_PAN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/inc/upnpmediaserverdescriptionprovider.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,158 @@
+/** @file
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpMediaServerDescriptionProvider declaration
+*
+*/
+
+#ifndef CUPNPMEDIASERVERDESCRIPTIONPROVIDER_H
+#define CUPNPMEDIASERVERDESCRIPTIONPROVIDER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <e32hashtab.h> 
+#include "upnpdevicedescriptionprovider.h"
+
+// FORWARD DECLARATION
+
+class CUpnpSecurityManager;
+class TInetAddr;
+
+const TInt KMaxUriLength = 256;
+
+// CLASS DECLARATION
+
+/**
+ * CUpnpMediaServerDescriptionProvider
+ * Provides description of device and its services, and icons. 
+ *
+ * @lib avmediaserver.exe
+ * @since S60 MCL 
+ */
+class CUpnpMediaServerDescriptionProvider : public CBase,
+        public MUpnpDeviceDescriptionProvider
+    {
+public:
+
+    /**
+     * Destructor.
+     */
+    ~CUpnpMediaServerDescriptionProvider();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUpnpMediaServerDescriptionProvider* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUpnpMediaServerDescriptionProvider* NewLC();
+    
+    /**
+     * Adds new map uri to file.
+     * 
+     * @since S60 MCL
+     * @param aUri uri
+     * @param aFile file for aUri
+     */    
+    void AddUriToFileMapL( const TDesC8& aUri, const TDesC16& aFile );
+    
+    /**
+     * Removes map uri to file.
+     * 
+     * @since S60 MCL
+     * @param aUri uri
+     */    
+    void RemoveUriToFileMapL( const TDesC8& aUri );
+    
+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
+     */
+    CUpnpMediaServerDescriptionProvider();
+
+    /**
+     * EPOC default constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+
+    /**
+     * Main function to service requests.
+     * 
+     * @since S60 MCL
+     * @param aRequest request to service
+     * @return error code
+     */
+    TInt OnRequest( CUpnpDeviceDescriptionRequest& aRequest );
+
+    /**
+     * Check if resource is accessible.
+     * Leaves with -EHttpNotFound when filename 
+     * is not authorized for specific IP.
+     * May leave with other system error code. 
+     * 
+     * @since S60 MCL
+     * @param aFileName data source file name
+     * @param aSender sender IP address
+     */
+    void AuthorizeRequestL( const TDesC& aFileName, const TInetAddr& aSender );
+   
+    /**
+     * Gets a folder with device description.
+     * Leave with KErrNotFound when aUri is not found.
+     * 
+     * @since S60 MCL
+     * @param aUri uri to get file for
+     * @param aPath on return contains path of file related to aUri
+     */
+    void GetFileFromUriL( const TDesC8& aUri, TDes& aPath );
+
+    /**
+     * Gets a path from uri. Removed IP and port.
+     *  
+     * @since S60 MCL
+     * @param aUri uri to extract
+     * @return allocated buffer with extracted uri lower case
+     */
+    HBufC8* ExtractPathAndFileFromUriL( const TDesC8& aUri );
+
+private:
+    
+    // Security manager
+    // Own
+    CUpnpSecurityManager* iSecurityManager;
+    
+    // File server session used to open file
+    RFs iFs;
+
+    // Hash map uri to file
+    RHashMap< TBufC8<KMaxUriLength>, TFileName > iUriMap;
+    
+    // Used for file name to aviod use this type on stack
+    TFileName iFileName;
+    };
+
+#endif // CUPNPMEDIASERVERDESCRIPTIONPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/inc/upnpmediaservereventhandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,122 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defines CUpnpMediaServerEventHandler class
+*
+*/
+
+
+#ifndef C_CUPNPMEDIASERVEREVENTHANDLER_H
+#define C_CUPNPMEDIASERVEREVENTHANDLER_H
+
+// INCLUDES
+#include "upnpmediaserverobserver.h"
+#include "upnpcontentdirectoryeventobserver.h"
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CUpnpObject;
+class CUpnpItemList;
+class CUpnpBrowseCriteria;
+class CUpnpMediaServerEventHandler;
+class CUpnpMediaServer;
+class CUpnpFileTransferEventList;
+class MUpnpContentDirectoryEventObserver;
+
+// CLASS DECLARATION
+class CUpnpMediaServerEventHandler: public CBase, MUpnpContentDirectoryEventObserver
+{
+
+public:    
+    /*
+    * Create a CUpnpMediaServerSession object using two phase construction,
+    * and return a pointer to the created object
+    * @result pointer to new session
+    */
+    static CUpnpMediaServerEventHandler* NewL(CUpnpMediaServer* aServer);
+
+    /**
+    * Create a CUpnpMediaServerSession object using two phase construction,
+    * and return a pointer to the created object
+    * @result pointer to new session
+    */
+    static CUpnpMediaServerEventHandler* NewLC(CUpnpMediaServer* aServer);
+
+    /**
+    * Perform the second phase construction of a CUpnpMediaServerSession object
+    */
+    void ConstructL() ;
+    
+    /**
+    * Destroy the object and release all memory objects
+    */
+    virtual ~CUpnpMediaServerEventHandler();
+       
+    /**
+    * Destroy the object and release all memory objects
+    */
+    void EventMediaServerSubscribeEvents( const RMessage2& aMessage );
+    /**
+    * Destroy the object and release all memory objects
+    */
+    
+    void EventMediaServerUnsubscribeEvents( const RMessage2& aMessage );
+    /**
+    * Destroy the object and release all memory objects
+    */
+    void EventMediaServerServerListenTransferEventL( const RMessage2& aMessage );
+
+    /**
+    * Destroy the object and release all memory objects
+    */
+    void EventMediaServerGetTransferEventBodyL( const RMessage2& aMessage );
+    
+    /**
+    * Destroy the object and release all memory objects
+    */
+    virtual void FileTransferEvent(CUpnpFileTransferEvent *aEvent);
+
+private:
+    /**
+    * Destroy the object and release all memory objects
+    */
+    void ServeEventL(CUpnpFileTransferEvent *aEvent); 
+
+    /**
+    * Serialize events queue and sends buffer length to client
+    */
+    void ListenTransferEventCompleteL();
+
+    /**
+    * Destroy the object and release all memory objects
+    */
+    CUpnpMediaServerEventHandler(CUpnpMediaServer* aServer);
+
+private:
+    //Media server
+    CUpnpMediaServer*   iMediaServer;
+    //reponse length 
+    TInt                iRespLength;
+    //package for reponse length 
+    TPckg<TInt>         iRespLengthPkg; 
+    //buffer for response 
+    HBufC8*             iResponseBuffer;
+    //last asynchronous message handle
+    RMessage2 iCurrentMessage;
+    //event queue 
+    CUpnpFileTransferEventList* iFileTransferEventList;
+    //indicates that there is listen request was issued  
+    TBool iListenRequestPending;        
+};
+
+#endif // C_CUPNPMEDIASERVEREVENTHANDLER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/inc/upnpmediaserverglobals.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,85 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media server device
+*
+*/
+
+
+
+#ifndef C_UPNPMEDIASERVERGLOBALS_H
+#define C_UPNPMEDIASERVERGLOBALS_H
+
+#include <e32base.h>
+#include <platform_paths.hrh>
+#include <bldvariant.hrh>
+
+// CONSTANTS
+const TUint KMediaServerMajorVersionNumber = 0;
+const TUint KMediaServerMinorVersionNumber = 1;
+const TUint KMediaServerBuildVersionNumber = 1;
+
+
+_LIT( KIconDest,  "public\\MediaServer1\\icon\\" );
+_LIT( KMediaServerFilename,  "AVMediaServer" );
+const TUid KServerUid3 = {0x101F977C};
+_LIT( KMediaServerThreadName,    "MediaServer_MainThread" );
+_LIT( KMediaServerName,  "AVMediaServer" );
+
+// ENUMERATIONS
+// Opcodes used in message passing between client and server
+enum TMediaServerRqst
+    {
+    EMediaServerStop = 100,
+    EMediaServerStart,
+    EMediaServerStopSilent,
+    EMediaServerStartOffline,
+    EMediaServerRestart,
+    EMediaServerStatus,
+    EMediaServerShareItem,
+    EMediaServerShareItemResult,
+    EMediaServerShareContainer,
+    EMediaServerShareContainerResult,
+    EMediaServerShareItemList,
+    EMediaServerShareItemListResult,
+    EMediaServerUnshareItem,
+    EMediaServerUnshareContainer,
+    EMediaServerUnshareItemList,
+    EMediaServerUnshareRoot,
+    EMediaServerGetSharedItem,
+    EMediaServerGetSharedItemResult,
+    EMediaServerGetSharedItemList,
+    EMediaServerGetSharedItemListResult,
+    EMediaServerGetSharedContainer,
+    EMediaServerGetSharedContainerResult,
+    EMediaServerGetSharedContainerList,
+    EMediaServerGetSharedContainerListResult,
+    EMediaServerShareReference,    
+    EMediaServerShareReferenceList,
+    EMediaServerSubscribeEvents,
+    EMediaServerUnsubscribeEvents,
+    EMediaServerListenTransferEvent,
+    EMediaServerGetTransferEventBody,
+    EMediaServerGetIpAndPort,
+    EMediaServerSetUploadDirectory,
+    EMediaServerAddIcon,
+    EMediaServerRemoveIcon,
+    EMediaServerRemoveIcons,
+    EMediaServerUpdateIcon,
+    EMediaServerStatusChange,
+    EMediaServerStatusChangeCancel
+    };
+    
+#endif      // C_UPNPMEDIASERVERGLOBALS_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/inc/upnpmediaserversession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,155 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server session
+*
+*/
+
+
+
+#ifndef C_CUPNPMEDIASERVERSESSION_H
+#define C_CUPNPMEDIASERVERSESSION_H
+
+
+
+// INCLUDES
+#include "upnpmediaserver.h"
+#include "upnpmediaserverglobals.h"
+#include "upnpmediaserverobserver.h"
+
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class CUpnpObject;
+class CUpnpItemList;
+class CUpnpBrowseCriteria;
+class CUpnpMediaServerEventHandler;
+// CLASS DECLARATION
+
+/**
+  An instance of class CUpnpMediaServerSession is created for each client
+  */
+class CUpnpMediaServerSession : public CSession2
+    {
+public: // New methods
+    /**
+    * Create a CUpnpMediaServerSession object using two phase construction,
+    * and return a pointer to the created object
+    * @result pointer to new session
+    */
+    static CUpnpMediaServerSession* NewL(CUpnpMediaServer* aServer);
+
+    /**
+    * Create a CUpnpMediaServerSession object using two phase construction,
+    * and return a pointer to the created object
+    * @result pointer to new session
+    */
+    static CUpnpMediaServerSession* NewLC(CUpnpMediaServer* aServer);
+
+    /**
+    * Destroy the object and release all memory objects
+    */
+    virtual ~CUpnpMediaServerSession();
+
+    /**
+    * Notify client about status change
+    */
+    void StatusChanged();
+
+public: // From CSession
+    /**
+    * Called after a service request from client; from class CSession
+    * @param aMessage message from client (containing requested operation and any data)
+    */
+    void ServiceL( const RMessage2& aMessage );
+
+private: // New methods
+
+    /**
+    * Perform the first phase of two phase construction
+    */
+    CUpnpMediaServerSession(CUpnpMediaServer* aServer);
+
+    /**
+    * Perform the second phase construction of a CUpnpMediaServerSession object
+    */
+    void ConstructL() ;
+
+    /**
+    * Causes the client thread to panic
+    * @param panic code
+    */
+    void PanicClient( const RMessage2& aMessage, TInt aPanic ) const;
+
+private:
+    void ReadObjFromMessageL( const RMessage2& aMessage, TInt aSlot, CUpnpObject* aObj );
+    void ReadItemFromMessageL( const RMessage2& aMessage, TInt aSlot, CUpnpItem* aItem );
+    void ReadObjFromMessageL( const RMessage2& aMessage, TInt aSlot, CUpnpItemList* aItemList ) ;
+    void ReadObjFromMessageL( const RMessage2& aMessage, TInt aSlot,
+        CUpnpBrowseCriteria* aBrowseCriteria );
+
+    // functions for various events from client
+    void EventMediaServerStatusL( const RMessage2& aMessage );
+    void EventMediaServerStartL( const RMessage2& aMessage );
+    void EventMediaServerStop( const RMessage2& aMessage );
+    void EventMediaServerStopSilent( const RMessage2& aMessage );
+    void EventMediaServerSetFriendlyNameL( const RMessage2& aMessage );
+    void EventMediaServerRestartL( const RMessage2& aMessage );
+    void EventMediaServerShareItemL( const RMessage2& aMessage ) ;
+    void EventMediaServerShareContainerL( const RMessage2& aMessage ) ;
+    void EventMediaServerShareItemListL( const RMessage2& aMessage );
+    void EventMediaServerGetShareItemResultL( const RMessage2& aMessage );
+    void EventMediaServerGetShareContainerResultL( const RMessage2& aMessage );
+    void EventMediaServerGetShareItemListResultL( const RMessage2& aMessage );
+    void EventMediaServerUnshareRootL( const RMessage2& aMessage );
+    void EventMediaServerUnshareItemL( const RMessage2& aMessage );
+    void EventMediaServerUnshareContainerL( const RMessage2& aMessage );
+    void EventMediaServerGetSharedItemL( const RMessage2& aMessage );
+    void EventMediaServerGetGetSharedItemResultL( const RMessage2& aMessage );
+    void EventMediaServerGetSharedContainerL( const RMessage2& aMessage );
+    void EventMediaServerGetGetSharedContainerResultL( const RMessage2& aMessage );
+    void ReadIdsFromMessageL( const RMessage2& aMessage, TInt aSlot, RArray<TInt>& aObjIds );
+    void EventMediaServerUnshareItemListL( const RMessage2& aMessage );
+    void EventMediaServerGetSharedItemListL( const RMessage2& aMessage );
+    void EventMediaServerGetGetSharedItemListResultL( const RMessage2& aMessage );
+    void EventMediaServerGetSharedContainerListL( const RMessage2& aMessage );
+    void EventMediaServerGetGetSharedContainerListResultL( const RMessage2& aMessage );
+    void EventMediaServerStartOfflineL( const RMessage2& aMessage );
+    void EventMediaServerGetIpAndPortL( const RMessage2& aMessage );
+    void EventSetUploadDirectoryL(const RMessage2& aMessage );
+    void EventAddIconL( const RMessage2& aMessage );
+    void EventUpdateIconL( const RMessage2& aMessage );
+    void EventRemoveIconL( const RMessage2& aMessage );
+    void EventRemoveIconsL( const RMessage2& aMessage );
+
+    void EventMediaServerShareReferenceL( const RMessage2& aMessage );
+    void EventMediaServerShareReferenceListL( const RMessage2& aMessage );
+    void EventMediaServerStatusChange( const RMessage2& aMessage );
+    void EventMediaServerStatusChangeCancel( const RMessage2& aMessage );
+
+private:
+
+    /** @var iMediaServer pointer to Media Server */
+    CUpnpMediaServer*   iMediaServer;
+    HBufC8*             iResponseBuffer;
+    TInt                iRespLength;
+    TPckg<TInt>         iRespLengthPkg;
+    TInt                iRespExecStatus;
+    TPckg<TInt>         iRespExecStatusPkg;
+
+    CUpnpMediaServerEventHandler* iEventHandler;
+    RMessage2           iStatusMessage;
+    };
+
+#endif // C_CUPNPMEDIASERVERSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/src/upnpdiskremovedetector.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,213 @@
+/** @file
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Detects remove disk event.
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpdiskremovedetector.h"
+#include "upnpmediaserver.h"
+#include "upnpcontentdirectoryglobals.h"
+#include <f32file.h>
+
+#ifdef _DEBUG
+#define KLogFile _L("UPnPMediaServer.txt")
+#endif
+#include "upnpcustomlog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::CUpnpDiskRemoveDetector
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpDiskRemoveDetector::CUpnpDiskRemoveDetector( CUpnpMediaServer* aObserver ) :
+    CActive( CActive::EPriorityStandard ), iObserver( aObserver )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpDiskRemoveDetector::ConstructL()
+    {
+    User::LeaveIfError( iFs.Connect() );
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpDiskRemoveDetector* CUpnpDiskRemoveDetector::NewLC(
+    CUpnpMediaServer* aObserver )
+    {
+    CUpnpDiskRemoveDetector* self =
+    	new (ELeave) CUpnpDiskRemoveDetector( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpDiskRemoveDetector* CUpnpDiskRemoveDetector::NewL(
+    CUpnpMediaServer* aObserver )
+    {
+    CUpnpDiskRemoveDetector* self =
+            CUpnpDiskRemoveDetector::NewLC( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::~CUpnpDiskRemoveDetector
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpDiskRemoveDetector::~CUpnpDiskRemoveDetector()
+    {
+    Cancel();
+    iFs.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::Start
+// Enable object to watch for incoming events.
+// ---------------------------------------------------------------------------
+//
+void CUpnpDiskRemoveDetector::StartL()
+    {
+    if ( !IsActive() )
+        {
+        // we want to check the validity of upload directory on MS startup
+        CheckUploadDirectoryL();
+        SubscribeForDiskEvent();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::CheckUploadDirectoryL
+// Check if the upload direcotory is valid.
+// ---------------------------------------------------------------------------
+//
+void CUpnpDiskRemoveDetector::CheckUploadDirectoryL()
+    {
+    // Getting current upload directory from cenrep
+    CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( settings );
+
+    HBufC8* uploadtmp = settings->GetL( UpnpMediaServerSettings::EUploadDirectory );
+    CleanupStack::PushL( uploadtmp );
+
+    HBufC* uploaddir = HBufC::NewLC( uploadtmp->Length() );
+    uploaddir->Des().Copy( *uploadtmp );
+
+    // retrieving drive info
+    TParse path;
+    path.Set( uploaddir->Des(), NULL, NULL );
+    TDriveUnit driveUnit( path.Drive() );
+
+    TVolumeInfo volumeInfo;
+    volumeInfo.iDrive.iType = EMediaNotPresent;
+    TInt err = iFs.Volume( volumeInfo, static_cast<TInt>( driveUnit ) );
+
+    if ( err != KErrNone )
+        {
+        TChar systemDriveLetter;
+        TInt error = RFs::DriveToChar( RFs::GetSystemDrive(), systemDriveLetter );
+
+        RBuf tmpUploadDir;
+        tmpUploadDir.CleanupClosePushL();
+        tmpUploadDir.CreateL( KCharLen
+                            + KCol().Length()
+                            + KDiskPathElSep().Length()
+                            + KDefaultUploadDir().Length() );
+
+        tmpUploadDir.Append( systemDriveLetter );
+        tmpUploadDir.Append( KCol() );
+        tmpUploadDir.Append( KDiskPathElSep() );
+        tmpUploadDir.Append( KDefaultUploadDir() );
+        iObserver->SetUploadDirL( tmpUploadDir );
+        CleanupStack::PopAndDestroy( &tmpUploadDir );
+        }
+    else
+        {
+        LOGS( "CUpnpDiskRemoveDetector - some disk was dismounted, but it's not interesting in that context" );
+        }
+
+    CleanupStack::PopAndDestroy( uploaddir );
+    CleanupStack::PopAndDestroy( uploadtmp );
+    CleanupStack::PopAndDestroy( settings );
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::SubscribeForDiskEvent
+// Subscribe this object for file system disk event
+// ---------------------------------------------------------------------------
+//
+void CUpnpDiskRemoveDetector::SubscribeForDiskEvent()
+    {
+    // wait for FileSystem disk event (like MMC card removal)
+    if ( !IsActive() )
+        {
+        iFs.NotifyChange( ENotifyDisk, iStatus );
+        SetActive();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::RunL
+// Called after event occurs or on media server startup
+// ---------------------------------------------------------------------------
+//
+void CUpnpDiskRemoveDetector::RunL()
+    {
+    User::LeaveIfError( iStatus.Int() );
+    CheckUploadDirectoryL();
+    SubscribeForDiskEvent();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::RunError
+// RunError is called when RunL leaves.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpDiskRemoveDetector::RunError( TInt aError )
+    {
+    LOGS1( "CUpnpDiskRemoveDetector::RunError(%d)", aError );
+    SubscribeForDiskEvent();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpDiskRemoveDetector::DoCancel
+// Cancel watching for incoming events.
+// -----------------------------------------------------------------------------
+//
+void CUpnpDiskRemoveDetector::DoCancel()
+    {
+    iFs.NotifyChangeCancel();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/src/upnpiconmanager.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,531 @@
+/** @file
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server icon's manager
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "upnpiconmanager.h"
+#include "upnpicon.h"
+#include "upnpmediaserverglobals.h"
+#include "upnpcons.h"
+#include "upnpdeviceimplementation.h"
+#include "upnpstring.h"
+#include "upnpmediaserverdescriptionprovider.h"
+#include <upnpdevicedescriptionstore.h>
+
+_LIT8( KIconDir, "/mediaserver1/icon/") ;
+
+_LIT( KPathC, "C:" );
+_LIT( KFileSpec,"*" );
+
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpIconManager* CUpnpIconManager::NewL( CUpnpDeviceDescriptionStore& aDescriptionStore,
+                              CUpnpMediaServerDescriptionProvider& aDescriptionProvider )
+    {
+    CUpnpIconManager* self = CUpnpIconManager::NewLC( aDescriptionStore, 
+                                                      aDescriptionProvider );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpIconManager* CUpnpIconManager::NewLC( CUpnpDeviceDescriptionStore& aDescriptionStore,
+                               CUpnpMediaServerDescriptionProvider& aDescriptionProvider )
+    {
+    CUpnpIconManager* self= new (ELeave) CUpnpIconManager( aDescriptionStore, 
+                                                           aDescriptionProvider );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::~CUpnpIconManager
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUpnpIconManager::~CUpnpIconManager()
+    {
+    iFileSession.Close();
+    iIconList.ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::AddIconL
+// -----------------------------------------------------------------------------
+//
+void CUpnpIconManager::AddIconL( const TDesC8& aIconDes )
+    {
+    CUpnpIcon* icon = CUpnpIcon::NewL();
+    CleanupStack::PushL( icon );
+    
+    RDesReadStream stream( aIconDes );
+    CleanupClosePushL( stream );
+    stream >> *icon;
+    
+    TPtrC8 iconUrl;
+    TPtrC8 iconName8;
+    TInt iconNameTemp;
+    TInt iconNameInt(0);
+    
+    if ( iIconList.Count() != 0 )
+        {
+        for ( TInt i(0); i < iIconList.Count(); i++ )
+            {
+            iconUrl.Set( iIconList[ i ]->Url() );
+            iconName8.Set( iconUrl.Mid( KIconDir().Length() ) );
+
+            TLex8 lexer( iconName8 );
+            lexer.Val( iconNameTemp );
+
+            if ( iconNameInt < iconNameTemp )
+                iconNameInt = iconNameTemp;
+            }
+        iconNameInt++;
+        }
+    
+    TBufC<UpnpString::KMaxTUintLength> iconNameBuff;
+    iconNameBuff.Des().Num( iconNameInt );
+    
+    HBufC8* iconUrl8 = HBufC8::NewLC( KIconDir().Length() + iconNameBuff.Length() );
+    iconUrl8->Des().Append( KIconDir() );
+    iconUrl8->Des().Append( iconNameBuff );
+
+    icon->SetUrlL( *iconUrl8 );
+
+    HBufC* iconPath = GetIconPathLC();
+
+    HBufC16* destinationPath = HBufC16::NewLC( iconPath->Length() + UpnpString::KMaxTUintLength );
+    destinationPath->Des().Append( *iconPath );
+    destinationPath->Des().Append( iconNameBuff );
+ 
+    CopyIconToPrivateL( icon , *destinationPath );
+    iDescriptionStore.AddIconL( *icon );
+    iIconList.AppendL( icon );
+
+    iDescriptionProvider.AddUriToFileMapL( *iconUrl8, *destinationPath );
+        
+    CleanupStack::PopAndDestroy( destinationPath );
+    CleanupStack::PopAndDestroy( iconPath );
+    CleanupStack::PopAndDestroy( iconUrl8 );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::Pop( icon );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::UpdateIconL
+// -----------------------------------------------------------------------------
+//    
+void CUpnpIconManager::UpdateIconL( const TDesC8& aNewIconDes, const TDesC8& aUrl )
+    {
+    HBufC16* url = UpnpString::ToUnicodeL( aUrl );
+    CleanupStack::PushL( url );
+
+    HBufC16* iconName = GetIconNameLC( aUrl );
+
+    HBufC8* iconUrl = HBufC8::NewLC( KIconDir().Length() + iconName->Length() );
+    iconUrl->Des().Append( KIconDir() );
+    iconUrl->Des().Append( *iconName );
+
+    CUpnpIcon* icon = CUpnpIcon::NewL();
+    CleanupStack::PushL( icon );
+
+    RDesReadStream stream( aNewIconDes );
+    CleanupClosePushL( stream );
+    stream >> *icon;
+    icon->SetUrlL( *iconUrl );
+    
+    User::LeaveIfError( FindIcon( *iconUrl ) );
+
+    HBufC* iconPath = GetIconPathLC();
+
+    HBufC16* destinationPath = HBufC16::NewLC( iconPath->Length() + 
+                                               iconName->Length() );
+    destinationPath->Des().Append( *iconPath );
+    destinationPath->Des().Append( *iconName );
+   
+    HBufC* backupName = PrepareIconToRollbackLC( *destinationPath );
+    
+    TRAPD( err , DoUpdateIconL( icon , *destinationPath ) );
+    if ( err )
+        {
+        TUint att;
+        if( ! iFileSession.Att( *backupName , att ) )
+            {
+            iFileSession.Delete( *destinationPath );
+            iFileSession.Rename( *backupName , *destinationPath );         
+            }
+        else
+            {
+            RestoreFromOrginalPathL( aUrl );
+            }
+        DeleteIconFile( *backupName );
+        User::Leave( err );
+        }
+    
+    DeleteIconFile( *backupName );
+    
+    CleanupStack::PopAndDestroy( backupName );
+    CleanupStack::PopAndDestroy( destinationPath );
+    CleanupStack::PopAndDestroy( iconPath );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::Pop( icon );
+    CleanupStack::PopAndDestroy( iconUrl );
+    CleanupStack::PopAndDestroy( iconName );
+    CleanupStack::PopAndDestroy( url );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::RemoveIconL
+// -----------------------------------------------------------------------------
+//  
+void CUpnpIconManager::RemoveIconL( const TDesC8& aUrl )
+    {
+    HBufC16* url = UpnpString::ToUnicodeL( aUrl );
+    CleanupStack::PushL( url );
+
+    HBufC16* iconName16 = GetIconNameLC( aUrl );    
+
+    HBufC8* iconName8 = UpnpString::FromUnicodeL( *iconName16 );
+    CleanupStack::PushL( iconName8 );
+
+    HBufC8* iconUrl = HBufC8::NewLC( KIconDir().Length() 
+                                    + iconName8->Length() );  
+    iconUrl->Des().Append( KIconDir() );
+    iconUrl->Des().Append( *iconName8 );
+
+    HBufC* iconDirectory = GetIconPathLC();
+    HBufC* iconFullPath = HBufC::NewLC( iconDirectory->Length() 
+                                        + iconName16->Length() );
+    iconFullPath->Des().Append( *iconDirectory );
+    iconFullPath->Des().Append( *iconName16 );
+      
+    TInt iconIdx = FindIcon( *iconUrl );
+    User::LeaveIfError( iconIdx );
+    
+    User::LeaveIfError( DeleteIconFile( *iconFullPath ) );
+    
+    TRAPD( error, iDescriptionStore.RemoveIconL( *iconUrl ) );
+    if ( error != KErrNotFound )
+        {
+        User::LeaveIfError( error );  
+        }
+    delete iIconList[ iconIdx ];
+    iIconList.Remove( iconIdx );
+    
+    iDescriptionProvider.RemoveUriToFileMapL( *iconUrl );
+    
+    CleanupStack::PopAndDestroy( iconFullPath );
+    CleanupStack::PopAndDestroy( iconDirectory );
+    CleanupStack::PopAndDestroy( iconUrl ); 
+    CleanupStack::PopAndDestroy( iconName8 );
+    CleanupStack::PopAndDestroy( iconName16 );    
+    CleanupStack::PopAndDestroy( url );      
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::RemoveIconsL
+// -----------------------------------------------------------------------------
+//      
+void CUpnpIconManager::RemoveIconsL()
+    {
+    for ( TInt i = 0; i < iIconList.Count(); i++ )
+        {
+        iDescriptionProvider.RemoveUriToFileMapL( iIconList[ i ]->Url() );
+        }
+
+    TRAPD( error, iDescriptionStore.RemoveIconsL() );
+    if ( error != KErrNotFound )
+        {
+        User::LeaveIfError( error );  
+        }
+    iIconList.ResetAndDestroy();
+
+    HBufC* iconPath = GetIconPathLC();
+    
+    HBufC* fileSpec = HBufC::NewLC( iconPath->Length() + KFileSpec().Length() );
+    fileSpec->Des().Append( *iconPath );
+    fileSpec->Des().Append( KFileSpec() );
+
+    CDir* dirList;
+    User::LeaveIfError( iFileSession.GetDir( *fileSpec , 
+                                             KEntryAttMaskSupported, 
+                                             ESortByName, dirList) );
+    CleanupStack::PushL( dirList );    
+
+    TBuf<UpnpString::KMaxTUintLength> fileName;
+    for ( TInt i(0); i < dirList->Count(); i++)
+        {
+        fileName = (*dirList)[i].iName;
+
+        HBufC* totalPath = HBufC::NewLC( iconPath->Length() + fileName.Length() );
+        totalPath->Des().Append( *iconPath );
+        totalPath->Des().Append( fileName );
+
+        DeleteIconFile( *totalPath );
+
+        CleanupStack::PopAndDestroy( totalPath );
+        }
+
+    CleanupStack::PopAndDestroy( dirList );
+    CleanupStack::PopAndDestroy( fileSpec );
+    CleanupStack::PopAndDestroy( iconPath );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::GetIconPathLC
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpIconManager::GetIconPathLC()
+    {
+    TFileName privatePath;
+    iFileSession.PrivatePath( privatePath );
+
+    HBufC* iconPath = HBufC::NewLC( KPathC().Length() + privatePath.Length() 
+                                  + KIconDest().Length());
+    iconPath->Des().Append( KPathC() );
+    iconPath->Des().Append( privatePath );
+    iconPath->Des().Append( KIconDest() );
+
+    return iconPath;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::GetIconNameLC
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpIconManager::GetIconNameLC( const TDesC8& aPath )
+    {
+    _LIT16( KIcon, "icon" );
+    const TInt KSlashesOffset( 1 );
+    
+    HBufC* iconPath = HBufC::NewLC( aPath.Length() );
+    iconPath->Des().Copy( aPath );
+    
+    iconPath->Des() = iconPath->Mid( 
+                   User::LeaveIfError( iconPath->FindF( KIcon() ) ) 
+                                     + KIcon().Length()
+                                     + KSlashesOffset );
+    
+    HBufC* iconName = HBufC::NewL( iconPath->Length() );
+    iconName->Des().Append( *iconPath );
+
+    CleanupStack::PopAndDestroy( iconPath );
+    CleanupStack::PushL( iconName );
+    
+    TLex iconLex( *iconName );
+    TInt iconNum;
+    TInt err( iconLex.Val( iconNum ) );
+    if ( err )
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    return iconName;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::CopyIconToPrivateL
+// -----------------------------------------------------------------------------
+//
+void CUpnpIconManager::CopyIconToPrivateL( const CUpnpIcon* aIcon , 
+                                           const TDesC& aDestinationPath 
+                                         )
+    {   
+    CFileMan* fM = CFileMan::NewL( iFileSession );
+    CleanupStack::PushL( fM );
+
+    TInt err( fM->Copy( aIcon->BitmapFilename(), aDestinationPath ) );
+    if( err == KErrAccessDenied )
+        {
+        fM->Attribs( aDestinationPath ,KEntryAttNormal , KEntryAttReadOnly|
+                                                         KEntryAttHidden|
+                                                         KEntryAttSystem , 0 );
+        User::LeaveIfError( fM->Copy( aIcon->BitmapFilename(), aDestinationPath ) );
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+    User::LeaveIfError( fM->Attribs( aDestinationPath , 
+                                     KEntryAttNormal , KEntryAttReadOnly|
+                                                       KEntryAttHidden|
+                                                       KEntryAttSystem , 0 ) );
+       
+    CleanupStack::PopAndDestroy( fM );    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::PrepareIconToRollbackLC
+// -----------------------------------------------------------------------------
+//   
+HBufC* CUpnpIconManager::PrepareIconToRollbackLC( const TDesC& aPath )
+    {
+    _LIT( KBeckupExt, ".beckup" );
+    HBufC* beckupName = HBufC::NewLC( aPath.Length() + KBeckupExt().Length() );//on cleanupstack
+    beckupName->Des().Append( aPath );
+    beckupName->Des().Append( KBeckupExt() );
+    
+    iFileSession.Delete( *beckupName );
+    
+    iFileSession.Rename( aPath , *beckupName );
+    
+    return beckupName;
+    }
+      
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::DoUpdateIconL
+// -----------------------------------------------------------------------------
+//      
+void CUpnpIconManager::DoUpdateIconL( CUpnpIcon* aIcon, const TDesC& aDestinationPath )
+    {
+    CopyIconToPrivateL( aIcon , aDestinationPath );
+
+    iDescriptionStore.UpdateIconL( *aIcon );
+    TInt idx = FindIcon( aIcon->Url() );
+    if ( idx > KErrNotFound )
+        {
+        delete iIconList[ idx ];
+        iIconList.Remove( idx );
+        iIconList.AppendL( aIcon );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::DeleteIconFile
+// -----------------------------------------------------------------------------
+//  
+TInt CUpnpIconManager::DeleteIconFile( const TDesC& aPath )
+    {
+    TInt err( iFileSession.Delete( aPath ) );  
+    if( err == KErrAccessDenied )
+        {
+        iFileSession.SetAtt( aPath ,KEntryAttNormal , KEntryAttReadOnly|
+                                                     KEntryAttHidden|
+                                                     KEntryAttSystem );
+        err = iFileSession.Delete( aPath );
+        }
+    else if ( err == KErrNotFound )
+        {
+        err = KErrNone;
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::RestoreFromOrginalPathL
+// -----------------------------------------------------------------------------
+//  
+void CUpnpIconManager::RestoreFromOrginalPathL( const TDesC8& aUrl )
+    {
+    for ( TInt i(0) ; i< iIconList.Count() ; i++ )
+        {
+        if ( !iIconList[ i ]->Url().CompareF( aUrl ) )
+            {
+            HBufC* iconPath = GetIconPathLC();
+            HBufC* iconName = GetIconNameLC( aUrl );
+            HBufC* destinationPath = HBufC16::NewLC( iconPath->Length() +
+                                                     UpnpString::KMaxTUintLength );
+            destinationPath->Des().Append( *iconPath );
+            destinationPath->Des().Append( *iconName );
+            
+            CopyIconToPrivateL( iIconList[ i ] , *destinationPath );
+            
+            CleanupStack::PopAndDestroy( destinationPath );
+            CleanupStack::PopAndDestroy( iconName );
+            CleanupStack::PopAndDestroy( iconPath );
+            return;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::FindIcon
+// -----------------------------------------------------------------------------
+// 
+TInt CUpnpIconManager::FindIcon( const TDesC8& aUrl )
+    {
+    for ( TInt i(0) ; i< iIconList.Count() ; i++ )
+        {
+        if ( !iIconList[i]->Url().CompareF( aUrl ) )
+            {
+            return i;
+            }
+        }
+
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::AddIconsToDescriptionPropoertyMapL
+// -----------------------------------------------------------------------------
+//
+void CUpnpIconManager::AddIconsToDescriptionPropertyMapL()
+    {
+    HBufC* iconPath = GetIconPathLC();
+    for ( TInt i = 0; i < iIconList.Count(); i++ )
+        {
+        TPtrC8 url = iIconList[ i ]->Url();
+        HBufC* iconName = GetIconNameLC( url );
+        HBufC* path = HBufC::NewLC( iconPath->Length() + iconName->Length() );
+        
+        path->Des().Copy( iconPath->Des() );
+        path->Des().Append( iconName->Des() );
+        
+        iDescriptionProvider.AddUriToFileMapL( url, path->Des() );
+        
+        CleanupStack::PopAndDestroy( path );
+        CleanupStack::PopAndDestroy( iconName );
+        }
+    CleanupStack::PopAndDestroy( iconPath );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::ConstructL
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+void CUpnpIconManager::ConstructL()
+    {
+    User::LeaveIfError( iFileSession.Connect() );
+    
+    iIconList = iDescriptionStore.IconListL();
+
+    AddIconsToDescriptionPropertyMapL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpIconManager::CUpnpIconManager
+// Constructor
+// -----------------------------------------------------------------------------
+//    
+CUpnpIconManager::CUpnpIconManager( CUpnpDeviceDescriptionStore& aDescriptionStore,
+                                    CUpnpMediaServerDescriptionProvider& aDescriptionProvider )
+     : iDescriptionProvider( aDescriptionProvider ), iDescriptionStore( aDescriptionStore )
+    {
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/src/upnpmediaserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1049 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpmediaserver.h"
+#include "upnpcontentdirectoryservice.h"
+#include "upnpmediaserversession.h"
+#include "upnpmediaserverglobals.h"
+#include "upnpcontentdirectoryglobals.h"
+#include "upnpmediaserverclient.h"
+#include "upnpsecuritymanager.h"
+#include "upnpfiletransferevent.h"
+#include <upnpdevicedescriptionstore.h>
+
+#include "upnpdeviceimplementation.h"
+#include "upnpcm.h"
+#include "upnpiconmanager.h"
+#include "upnpdiskremovedetector.h"
+#include <sysutil.h>
+#define KLogFile _L("upnpmediaserver.txt")
+#include "upnpcustomlog.h"
+#include <upnpconnectionmanagernetworkeventprovider.h>
+#include "upnpmediaserverdescriptionprovider.h"
+
+const TVersion KServerSupportedVersion(
+    KMediaServerMajorVersionNumber,
+    KMediaServerMinorVersionNumber,
+    KMediaServerBuildVersionNumber );
+
+using namespace UpnpMediaServerSettings;
+
+_LIT8( KUriMediaServer, "/mediaserver1/mediaserver1.xml" );
+_LIT8( KUriContentDirectory, "/mediaserver1/contentdirectory1.xml" );
+_LIT8( KUriConnectionManager, "/mediaserver1/connectionmanager1.xml" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::CUpnpMediaServer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServer::CUpnpMediaServer():
+    iMsStatus( RUpnpMediaServerClient::EStopped )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::ConstructL()
+    {
+    BaseConstructL();
+    iSettings = CUpnpMediaServerSettings::NewL();
+    iDiskDetector = CUpnpDiskRemoveDetector::NewL( this );
+    iStopAVMediaServerTimer = CUpnpNotifyTimer::NewL( this );
+    iConnectionManagerNetworkEventProvider = 
+        CUpnpConnectionManagerNetworkEventProvider::NewL( *this );
+    iDescriptionProvider = CUpnpMediaServerDescriptionProvider::NewL();
+    
+    InitializeL( EFalse );
+    
+    iDescriptionStore = CUpnpDeviceDescriptionStore::NewL( *iMsName );
+    iIconManager = CUpnpIconManager::NewL( *iDescriptionStore, *iDescriptionProvider );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSymbianServerBase* CUpnpMediaServer::NewLC()
+    {
+    CUpnpMediaServer* self = new( ELeave ) CUpnpMediaServer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CUpnpMediaServer::~CUpnpMediaServer()
+    {
+    if ( iDescriptionStore )
+        {
+        TRAP_IGNORE( iDescriptionStore->SaveL() );
+        }
+
+    ASSERT( CanBeStopped() );//check if we are in correct state
+    delete iStopAVMediaServerTimer;
+    delete iMsName;
+    delete iCdName;
+    delete iCmName;
+
+    delete iConnectionManagerNetworkEventProvider;
+    
+    iObserverList.ResetAndDestroy();
+
+    delete iSettings;
+    delete iManager;
+    delete iIconManager;
+
+    delete iDevice;
+    delete iDescriptionStore;
+    delete iContentDirecory;
+    delete iCm;
+    delete iDiskDetector;
+    delete iDescriptionProvider;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::StopAVMediaServer
+//
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::StopAVMediaServer( TBool aSilent )
+    {
+    LOGS( "CUpnpMediaServer::StopAVMediaServer begin" );
+    iIsSilentShutdown = aSilent;
+    //ms will be stopped in KStopAVMediaServerDelay unless he gets start request
+    iStopAVMediaServerTimer->Start( KStopAVMediaServerDelay );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::StopAVMediaServerImmediately
+// Immediately stops media server ( no delay )
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::StopAVMediaServerImmediately( TBool aSilent, TBool aWlanLost )
+    {
+    iStopAVMediaServerTimer->Cancel();
+    iDiskDetector->Cancel();
+
+    delete iManager;
+    iManager = NULL;
+
+    // we do not want any stop devices in case of WLAN lost
+    if ( !aWlanLost )
+        {
+        if ( iDevice )
+            {
+            if ( !aSilent )
+                {
+                TRAP_IGNORE( iDevice->StopL() );
+                }
+            else
+                {
+                TRAP_IGNORE( iDevice->StopL( CUpnpDeviceImplementation::EStopSilent ) );
+                }
+            }
+        }
+
+    delete iContentDirecory;
+    iContentDirecory = NULL;
+
+    delete iCm;
+    iCm = NULL;
+
+    delete iDevice;
+    iDevice = NULL;
+
+    SetStatus( RUpnpMediaServerClient::EStopped );
+
+    SuggestShutdown();
+    LOGS( "CUpnpMediaServer::StopAVMediaServer end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::NewSessionL
+// Create new session.
+// -----------------------------------------------------------------------------
+//
+CSession2* CUpnpMediaServer::NewSessionL( const RMessage2& /*aMessage*/ ) const
+    {
+    return CUpnpMediaServerSession::NewL( (CUpnpMediaServer*) this );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::Status
+// Check status of the server.
+// -----------------------------------------------------------------------------
+//
+RUpnpMediaServerClient::TServerStatus CUpnpMediaServer::Status() const
+    {
+    if ( iStopAVMediaServerTimer && iStopAVMediaServerTimer->IsActive() )
+        {
+        return RUpnpMediaServerClient::EStopped;
+        }
+    return iMsStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::StartAVMediaServerL
+// Create and start the AV Media Server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::StartAVMediaServerL()
+    {
+    LOGS( "CUpnpMediaServer::StartAVMediaServerL begin" );
+
+    // cleanup because previous start could fail
+    StopAVMediaServerImmediately( EFalse, EFalse );
+    
+    // save description
+    iDescriptionStore->SaveL();
+
+    // create device
+    iDevice = CUpnpDeviceImplementation::NewL( KUriMediaServer, 
+                                               *iDescriptionStore, 
+                                               *iDescriptionProvider );
+
+    // create security manager
+    iManager = CUpnpSecurityManager::NewInstanceFromUpnpSettingsL();
+    //iDevice->SetSecurityManager( iManager );
+
+    // create content direcory service
+    HBufC8* uploadtmp = iSettings->GetL( EUploadDirectory );
+    CleanupStack::PushL( uploadtmp );
+    if ( uploadtmp->Length() == 0 )
+        {
+        User::Leave( KErrNotReady );
+        }
+    HBufC* uploaddir = HBufC::NewL( uploadtmp->Length() );
+    CleanupStack::PushL( uploaddir );
+    uploaddir->Des().Copy( uploadtmp->Des() );
+    HBufC* thumbnaildir = HBufC::NewL( uploaddir->Length()
+            + KThumbnailDirLen );
+    CleanupStack::PushL( thumbnaildir );
+    thumbnaildir->Des().Copy( uploaddir->Des() );
+    thumbnaildir->Des().Append( KThumbnailSubDir );
+
+    TInt createThumbnails;
+    User::LeaveIfError( iSettings->Get( EUpnpMediaServerThumbnails,
+        createThumbnails ) );
+
+    TInt maxReqCount;
+    User::LeaveIfError( iSettings->Get( KUpnpMediaServerBrowseLimit,
+        maxReqCount ) );
+
+    TUpnpCdSettings cdset =
+        {
+        iDevice, *uploaddir, *thumbnaildir, *iCdName, NULL, createThumbnails,
+                maxReqCount, this, KNullDesC(), NULL
+        };
+
+    iContentDirecory = CUpnpContentDirectoryService::NewL( cdset );
+
+    // create connection manager service
+    HBufC8* media = iSettings->GetL( ESupportedMedia );
+    CleanupStack::PushL( media );
+    if ( media->Length() == 0 )
+        {
+        User::Leave( KErrNotReady );
+        }
+    iCm = CUpnpCM::NewL( *iDevice, *media, *iCmName );
+    CleanupStack::PopAndDestroy( media );
+
+    CleanupStack::PopAndDestroy( thumbnaildir );
+    CleanupStack::PopAndDestroy( uploaddir );
+    CleanupStack::PopAndDestroy( uploadtmp );
+
+    SetDescriptionSettingsL( iDevice );
+
+    // start media server
+    iDevice->StartL();
+    iDiskDetector->StartL();
+
+    SetStatus( RUpnpMediaServerClient::EStartedOnline );
+    LOGS( "CUpnpMediaServer::StartAVMediaServerL end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::StartAVMediaServerOfflineL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::StartAVMediaServerOfflineL()
+    {
+    LOGS( "StartAVMediaServerOfflineL begin" );
+
+    // cleanup because previous start could fail
+    StopAVMediaServerImmediately( EFalse, EFalse );
+
+    // create content directory
+    iContentDirecory = CUpnpContentDirectoryService::NewL();
+    SetStatus( RUpnpMediaServerClient::EStartedOffline );
+    LOGS( "StartAVMediaServerOfflineL end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::RestartAVMediaServerL
+// Start and stop the AV Media Server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::RestartAVMediaServerL()
+    {
+    if ( iDevice )
+        {
+        iDevice->StopL();
+        SetDescriptionSettingsL( iDevice );
+        iDevice->StartL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::SetFriendlyNameL
+// Sets friendly name for device, changes are available after restarting
+// the server
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::SetDescriptionSettingsL(
+    CUpnpDeviceImplementation* aDevice )
+    {
+    SetDescriptionRequiredPropertyL( aDevice, EFriendlyName, KFriendlyName );
+    SetDescriptionRequiredPropertyL( aDevice, EModelName, KModelName );
+    SetDescriptionRequiredPropertyL( aDevice, EManufacturer, KManufacturer );
+
+    SetDescriptionPropertyL( aDevice, EModelUrl, KModelUrl );
+    SetDescriptionPropertyL( aDevice, EModelDescription, KModelDescription );
+    SetDescriptionPropertyL( aDevice, EModelNumber, KModelNumber );
+    SetDescriptionPropertyL( aDevice, ESerialNumber, KSerialNumber );
+    SetDescriptionPropertyL( aDevice, EPresentationUrl, KPresentationUrl );
+    SetDescriptionPropertyL( aDevice, EManufacturerUrl, KManufacturerUrl );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::RemoveIconL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::RemoveIconL( const TDesC8& aUrl )
+    {
+    iIconManager->RemoveIconL( aUrl );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::RemoveIconsL
+// ------------------------------------------------------------------------------
+//
+void CUpnpMediaServer::RemoveIconsL()
+    {
+    iIconManager->RemoveIconsL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::AddIconL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::AddIconL( const TDesC8& aProperty )
+    {
+    iIconManager->AddIconL( aProperty );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::UpdateIconL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::UpdateIconL( const TDesC8& aProperty,
+    const TDesC8& aUrl )
+    {
+    iIconManager->UpdateIconL( aProperty, aUrl );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::SetUploadDirToCDL
+// Set the download and thumbnail in CD according to the value
+// of the upload directory
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::SetUploadDirToCDL( const TDesC& aPath )
+    {
+    if ( iContentDirecory )
+        {
+        HBufC* uploaddir= NULL;
+
+        if ( aPath != KNullDesC() )
+            {
+            uploaddir = aPath.AllocLC();
+            }
+        else
+            {
+            HBufC8* uploadtmp = iSettings->GetL( EUploadDirectory );
+            CleanupStack::PushL( uploadtmp );
+
+            uploaddir = HBufC::NewL( uploadtmp->Length() );
+            uploaddir->Des().Copy( uploadtmp->Des() );
+            CleanupStack::PopAndDestroy( uploadtmp );
+            CleanupStack::PushL( uploaddir );
+            }
+
+        HBufC* thumbnaildir = HBufC::NewL( uploaddir->Length()
+                + KThumbnailDirLen );
+        CleanupStack::PushL( thumbnaildir );
+        thumbnaildir->Des().Copy( uploaddir->Des() );
+        thumbnaildir->Des().Append( KThumbnailSubDir );
+
+        iContentDirecory->SetDownloadDirectoryL( uploaddir->Des() );
+        iContentDirecory->SetThumbnailDirectoryL( thumbnaildir->Des() );
+
+        CleanupStack::PopAndDestroy( thumbnaildir );
+        CleanupStack::PopAndDestroy( uploaddir );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::SetUploadDirL
+// Set the upload and thumbnail path in CD and central repository.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::SetUploadDirL( const TDesC& aPath )
+    {
+    User::LeaveIfError( iSettings->Set(
+        UpnpMediaServerSettings::EUploadDirectory, aPath ) ) ;
+
+    SetUploadDirToCDL( KNullDesC( )); // empty descriptor -> it means, value will be taken directly from cenrep
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::SetDescriptionPropertyL
+// Sets description property for device
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::SetDescriptionPropertyL(
+    CUpnpDeviceImplementation* aDevice, TInt aKey, const TDesC8& aName )
+    {
+    HBufC8* value = iSettings->GetL( aKey );
+    CleanupStack::PushL( value );
+    if ( value->Size() )
+        {
+        aDevice->SetDescriptionPropertyL( aName, *value );
+        }
+    else
+        {
+        aDevice->RemoveDescriptionPropertyL( aName );
+        }
+
+    CleanupStack::PopAndDestroy( value );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::SetDescriptionRequiredPropertyL
+// Sets description required property for device
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::SetDescriptionRequiredPropertyL(
+    CUpnpDeviceImplementation* aDevice, TInt aKey, const TDesC8& aName )
+    {
+    HBufC8* value = iSettings->GetL( aKey );
+
+    if ( !value )
+        {
+        User::Leave( KErrNotFound );
+        }
+    else
+        {
+        CleanupStack::PushL( value );
+
+        HBufC8* tmpBuf = (*value).AllocLC();
+        TPtr8 tmpPtr(tmpBuf->Des() );
+
+        RemoveWhiteSpaces( tmpPtr );
+        if ( tmpPtr.Length() == 0 )
+            {
+            User::Leave( KErrNotFound );
+            }
+        CleanupStack::PopAndDestroy( tmpBuf );
+        }
+
+    TRAPD( error, aDevice->SetDescriptionPropertyL( aName, *value ) )
+    if ( error != KErrNotFound )
+        {
+        User::LeaveIfError( error );
+        }
+
+    CleanupStack::PopAndDestroy( value );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::RemoveWhiteSpaces
+// Removes white characters from input descriptor
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::RemoveWhiteSpaces( TDes8& aString )
+    {
+    for ( TInt i=0; i<aString.Length(); i++ )
+        {
+        if ( aString[i] == ' ' || aString[i] == '\r' || aString[i] == '\n'
+                || aString[i] == '\t' )
+            {
+            aString.Replace( i, 1, KNullDesC8() );
+            i--;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::InitPrivateDir
+// Init Media Server directory structure in private directory
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::InitPrivateDirL( RFs &aFs )
+    {
+    TParse fp;
+    TFileName path;
+    aFs.PrivatePath( path );
+    fp.Set( KDefaultMediaDrive(), &path, 0 );
+    User::LeaveIfError( fp.AddDir( KMSPublicAccessedDir() ) );
+    User::LeaveIfError( fp.AddDir( KMSDeviceXmlDescDir() ) );
+    User::LeaveIfError( fp.AddDir( KIconDirectory() ) );
+    path = fp.DriveAndPath();
+
+    aFs.MkDirAll( path ) ;
+    fp.PopDir();
+    User::LeaveIfError( fp.AddDir( KMSMediaDir ) );
+    path = fp.DriveAndPath();
+    aFs.MkDirAll( path );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::InitDescFileL
+// Checks is description file exists. If not creates it from teplate stored on Z:
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpMediaServer::InitDescFileL( RFs &aFs,
+    const TDesC& aTempleteDescFile, TBool aOverwrite )
+    {
+    TUint temp;
+    HBufC* descName = CreateFullNameL( aFs, KDefaultMediaDrive(),
+        aTempleteDescFile );
+    CleanupStack::PushL( descName );
+
+    if ( aFs.Att( *descName, temp ) != KErrNone || aOverwrite )
+        {
+
+        HBufC* templName = CreateFullNameL( aFs, KDescTemplateDrive(),
+            aTempleteDescFile );
+        CleanupStack::PushL( templName );
+        CFileMan* fileMan = CFileMan::NewL( aFs );
+        CleanupStack::PushL( fileMan );
+        User::LeaveIfError( fileMan->Copy( *templName, *descName ) );
+        User::LeaveIfError( fileMan->Attribs( *descName, KEntryAttNormal,
+            KEntryAttReadOnly, TTime( 0 ) ) );
+        CleanupStack::PopAndDestroy( fileMan );
+        CleanupStack::PopAndDestroy( templName );
+        }
+    CleanupStack::Pop( descName );
+    return descName;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::InitializeL
+// Initialize Media Server using files from drive z:
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::InitializeL( TBool aOverwrite )
+    {
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+
+    if ( SysUtil::DiskSpaceBelowCriticalLevelL( &fs, KMSDescriptionMaxSize,
+        EDriveC ) )
+        {
+        User::Leave( KErrDiskFull );
+        }
+
+    InitPrivateDirL( fs );
+
+    delete iMsName;
+    iMsName= NULL;
+    iMsName = InitDescFileL( fs, KMSDeviceXmlDescFile(), aOverwrite );
+    iDescriptionProvider->AddUriToFileMapL( KUriMediaServer(), iMsName->Des() );
+    delete iCdName;
+    iCdName = NULL;
+    iCdName = InitDescFileL( fs, KCDXmlDescFile(), aOverwrite );
+    iDescriptionProvider->AddUriToFileMapL( KUriContentDirectory(), iCdName->Des() );
+    delete iCmName;
+    iCmName = NULL;
+    iCmName = InitDescFileL( fs, KCMXmlDescFile(), aOverwrite );
+    iDescriptionProvider->AddUriToFileMapL( KUriConnectionManager(), iCmName->Des() );
+
+    CleanupStack::PopAndDestroy( &fs );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::ResetDbL
+// Reset database, renaming name of original DB
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::ResetDbL()
+    {
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+
+    TFileName orgPath;
+
+    User::LeaveIfError( fs.PrivatePath( orgPath ) );
+
+    TParse fp;
+    fp.Set( KDatabaseFileName(), &orgPath, 0 );
+    orgPath = fp.FullName();
+
+    TFileName newPath;
+    newPath = orgPath;
+    newPath.Append( KBackupSuffix );
+
+    CFileMan* fileMan = CFileMan::NewL( fs );
+    CleanupStack::PushL( fileMan );
+    User::LeaveIfError( fileMan->Rename( orgPath, newPath ) );
+    CleanupStack::PopAndDestroy( fileMan );
+
+    CleanupStack::PopAndDestroy( &fs );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::DeleteDbL
+// Delete database
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::DeleteDbL()
+    {
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+
+    TFileName orgPath;
+
+    User::LeaveIfError( fs.PrivatePath( orgPath ) );
+
+    TParse fp;
+    fp.Set( KDatabaseFileName(), &orgPath, 0 );
+    orgPath = fp.FullName();
+
+    CFileMan* fileMan = CFileMan::NewL( fs );
+    CleanupStack::PushL( fileMan );
+    User::LeaveIfError( fileMan->Delete( orgPath ) );
+    CleanupStack::PopAndDestroy( fileMan );
+
+    CleanupStack::PopAndDestroy( &fs );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::SettingChangedL
+// Function notify when setting will change
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::SettingChangedL()
+    {
+    //no actions needed
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::CreateFullNameL
+// Create full name using drive MS directory structure and file name.
+// -----------------------------------------------------------------------------
+//
+HBufC* CUpnpMediaServer::CreateFullNameL( RFs &aFs, const TDesC& aDrive,
+    const TDesC& aName )
+    {
+    TParse fp;
+    TFileName path;
+    User::LeaveIfError( aFs.PrivatePath( path ) );
+    fp.Set( aDrive, &path, &aName );
+    User::LeaveIfError( fp.AddDir( KMSPublicAccessedDir() ) );
+    User::LeaveIfError( fp.AddDir( KMSDeviceXmlDescDir() ) );
+    return fp.FullName().AllocL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::ShareItemL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::ShareObjectL( CUpnpObject* aItem )
+    {
+    iContentDirecory->ShareObjectL( aItem );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::ShareReferenceL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::ShareReferenceL( CUpnpItem* aItem )
+    {
+    iContentDirecory->ShareReferenceL( aItem );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::ShareReferenceListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::ShareReferenceListL( CUpnpItemList* aItemList,
+    TInt* aStatus )
+    {
+    iContentDirecory->ShareReferenceListL( aItemList, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::ShareItemListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::ShareItemListL( CUpnpItemList* aItemList, TInt* aStatus )
+    {
+    iContentDirecory->ShareItemListL( aItemList, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::UnshareRootL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::UnshareRootL()
+    {
+    TBool online = ETrue;
+
+    if ( Status()==RUpnpMediaServerClient::EStartedOnline )
+        {
+        online = ETrue;
+        }
+    else if ( Status()==RUpnpMediaServerClient::EStartedOffline )
+        {
+        online = EFalse;
+        }
+
+    StopAVMediaServerImmediately( EFalse, EFalse );
+
+    DeleteDbL();
+
+    if ( online )
+        {
+        StartAVMediaServerL();
+        }
+    else
+        {
+        StartAVMediaServerOfflineL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::UnshareItemL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::UnshareItemL( TInt aId )
+    {
+    iContentDirecory->UnshareItemL( aId );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::UnshareContainerL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::UnshareContainerL( TInt aId )
+    {
+    iContentDirecory->UnshareContainerL( aId );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::GetSharedItemL
+// -----------------------------------------------------------------------------
+//
+CUpnpItem* CUpnpMediaServer::GetSharedItemL( TInt aItem )
+    {
+    return iContentDirecory->GetSharedItemL( aItem );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::GetSingleContainerL
+// -----------------------------------------------------------------------------
+//
+CUpnpContainer* CUpnpMediaServer::GetSingleContainerL( TInt aContainerId )
+    {
+    return iContentDirecory->GetSingleContainerL( aContainerId );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::UnshareItemListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::UnshareItemListL( RArray<TInt>& aItemList,
+    TInt* aExecutionStatus )
+    {
+    iContentDirecory->UnshareItemListL( aItemList, aExecutionStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::GetSharedItemListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::GetSharedItemListL( TInt aContId,
+    CUpnpBrowseCriteria* aBrowseCriteria, TInt* TotalMatches,
+    CUpnpItemList* aItemList )
+    {
+    iContentDirecory->GetItemListL( aContId, aBrowseCriteria, TotalMatches,
+        aItemList );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::GetSharedContainerListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::GetSharedContainerListL( TInt aContId,
+    CUpnpBrowseCriteria* aBrowseCriteria, TInt* TotalMatches,
+    CUpnpContainerList* aContainerList )
+    {
+    iContentDirecory->GetContainerListL( aContId, aBrowseCriteria,
+        TotalMatches, aContainerList );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::GetIpAndPortL
+// -----------------------------------------------------------------------------
+//
+TInetAddr CUpnpMediaServer::GetAddress()
+    {
+    return iContentDirecory->GetAddress();
+    }
+
+// ============================= EVENT FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::SubscribeEvents
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::SubscribeEvents(
+    MUpnpContentDirectoryEventObserver* aObserver )
+    {
+    iObserverList.Append( aObserver );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::UnsubscribeEvents
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::UnsubscribeEvents(
+    MUpnpContentDirectoryEventObserver* aObserver )
+    {
+    TInt index = iObserverList.Find( aObserver );
+    if ( index != KErrNotFound )
+        {
+        iObserverList.Remove( index );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::FileTransferEvent
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::FileTransferEvent( CUpnpFileTransferEvent* aMessage )
+    {
+    for ( TInt i=0; i<iObserverList.Count(); i++ )
+        {
+        iObserverList[i]->FileTransferEvent( aMessage );
+        }
+    delete aMessage;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::IsInterfaceUp
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpMediaServer::IsInterfaceUp()
+    {
+    return ( iMsStatus == RUpnpMediaServerClient::EStartedOnline );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::CancelAVMediaServerStop
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::CancelAVMediaServerStop()
+    {
+    iStopAVMediaServerTimer->Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::CanBeStopped
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpMediaServer::CanBeStopped() const
+    {
+    return RUpnpMediaServerClient::EStopped == Status(); //note: Status(),not iMsStatus
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::TimerEventL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::TimerEventL( CUpnpNotifyTimer* aTimer )
+    {
+    if ( aTimer == iStopAVMediaServerTimer )
+        {
+        StopAVMediaServerImmediately( iIsSilentShutdown, EFalse );
+        }
+    else
+        {
+        CUpnpSymbianServerBase::TimerEventL( aTimer );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::SupportedVersion
+// -----------------------------------------------------------------------------
+//
+TVersion CUpnpMediaServer::SupportedVersion() const
+    {
+    return KServerSupportedVersion;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::ServerName
+// -----------------------------------------------------------------------------
+//
+const TDesC& CUpnpMediaServer::ServerName() const
+    {
+    return KMediaServerName;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::NetworkEvent
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::NetworkEvent( CUpnpNetworkEventBase* aEvent )
+    {
+    LOG_FUNC_NAME;
+
+    if ( aEvent->SubscriberError() < KErrNone && aEvent->Type() == EUnknownEvent )
+        {
+        LOGS( "CUpnpMediaServer::NetworkEvent error" );
+        return;
+        }
+        
+    switch ( aEvent->Type() )
+        {
+        case EWlanLostEvent:
+            {
+            if ( IsInterfaceUp() )
+                {
+                StopAVMediaServerImmediately( ETrue, ETrue );
+                NotifyStatusChanged();
+                }
+            }
+            break;
+
+        case EAddressChangeEvent:
+            {
+            if ( iMsStatus == RUpnpMediaServerClient::EStartedOnline )
+                {
+                TRAPD( error, RestartAVMediaServerL() );
+                if ( error != KErrNone )
+                    {
+                    if ( iStopAVMediaServerTimer->IsActive() )
+                        {
+                        StopAVMediaServerImmediately( EFalse, EFalse );
+                        }
+                    TRAP( error, StartAVMediaServerL() );
+                    if ( error != KErrNone )
+                         {
+                         StopAVMediaServerImmediately( EFalse, EFalse );
+                         NotifyStatusChanged();
+                         }
+                     }
+                else if ( iContentDirecory )
+                    {
+                    TRAP( error, iContentDirecory->AddressChangeL() );
+                    if ( error != KErrNone )
+                         {
+                         StopAVMediaServerImmediately( EFalse, EFalse );
+                         NotifyStatusChanged();
+                         } 
+                    }                     
+                }
+            }
+            break; 
+        
+        case EConnectionClosedEvent:
+            {
+            ASSERT( iMsStatus != RUpnpMediaServerClient::EStartedOnline );
+            }
+            break;
+        }
+    }                
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::SetStatus
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::SetStatus( RUpnpMediaServerClient::TServerStatus aStatus )
+    {
+    iMsStatus = aStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::NotifyStatusChanged
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::NotifyStatusChanged()
+    {
+    CUpnpMediaServerSession* ses = NULL;
+    iSessionIter.SetToFirst();
+    CSession2* cses = iSessionIter++;
+    ses = reinterpret_cast<CUpnpMediaServerSession*>( cses );
+    while ( ses )
+        {
+        ses->StatusChanged();
+        ses = reinterpret_cast<CUpnpMediaServerSession*>( iSessionIter++ );    
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServer::RunL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServer::RunL()
+    {
+    const RUpnpMediaServerClient::TServerStatus beforeStatus = Status();
+    CUpnpSymbianServerBase::RunL();
+    if ( Status() != beforeStatus )
+        {
+        NotifyStatusChanged();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// E32Main entry point.
+// Returns: KErrNone
+// -----------------------------------------------------------------------------
+//
+TInt E32Main()
+    {
+    return CUpnpMediaServer::StartServer(
+        KMediaServerThreadName, CUpnpMediaServer::NewLC );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/src/upnpmediaserverdescriptionprovider.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,281 @@
+/** @file
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CUpnpMediaServerDescriptionProvider implementation
+*
+*/
+
+#include "upnpmediaserverdescriptionprovider.h"
+#include "upnpsecuritymanager.h"
+#include "upnpfileutils.h"
+#include "upnpstring.h"
+#include "upnpcons.h"
+#include "upnphttpmessage.h"
+#include "upnpdevicedescriptionrequest.h"
+
+// CONSTANTS
+
+// -----------------------------------------------------------------------------
+//  TBufC8Hash
+//  Hash function for RHashMap.
+// -----------------------------------------------------------------------------
+TUint32 TBufC8Hash( const TBufC8<KMaxUriLength>& aPtr )
+    {
+    return DefaultHash::Des8( aPtr );
+    }
+
+// -----------------------------------------------------------------------------
+//  TBufC8Ident
+//  Identity function for RHashMap.
+// -----------------------------------------------------------------------------
+TBool TBufC8Ident( const TBufC8<KMaxUriLength>& aFirst, 
+                   const TBufC8<KMaxUriLength>& aSecond )
+    {
+    return DefaultIdentity::Des8( aFirst, aSecond );
+    }
+
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::CUpnpMediaServerDescriptionProvider
+//
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerDescriptionProvider::CUpnpMediaServerDescriptionProvider()
+    : iUriMap( &TBufC8Hash, &TBufC8Ident )
+    {
+    // No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::~CUpnpMediaServerDescriptionProvider
+//
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerDescriptionProvider::~CUpnpMediaServerDescriptionProvider()
+    {
+    iFs.Close();
+    delete iSecurityManager;
+    iUriMap.Close();
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::NewLC
+//
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerDescriptionProvider* CUpnpMediaServerDescriptionProvider::NewLC()
+    {
+    CUpnpMediaServerDescriptionProvider* self =
+            new (ELeave) CUpnpMediaServerDescriptionProvider();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::NewL
+//
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerDescriptionProvider* CUpnpMediaServerDescriptionProvider::NewL()
+    {
+    CUpnpMediaServerDescriptionProvider* self =
+            CUpnpMediaServerDescriptionProvider::NewLC();
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerDescriptionProvider::ConstructL()
+    {
+    User::LeaveIfError( iFs.Connect() );        
+    iSecurityManager = CUpnpSecurityManager::NewInstanceFromUpnpSettingsL();
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::AddUriToFileMapL
+//
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerDescriptionProvider::AddUriToFileMapL( const TDesC8& aUri, 
+                                                            const TDesC16& aFile )
+    {
+    HBufC8* buf = HBufC8::NewLC( aUri.Length() );
+    buf->Des().CopyLC( aUri ); // change to lower characters
+
+    iUriMap.InsertL( buf->Des().Left( KMaxUriLength ), aFile );
+    
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::RemoveUriToFileMapL
+//
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerDescriptionProvider::RemoveUriToFileMapL( const TDesC8& aUri )
+    {
+    HBufC8* buf = HBufC8::NewLC( aUri.Length() );
+    buf->Des().CopyLC( aUri ); // change to lower characters
+
+    iUriMap.Remove( buf->Des() );
+    
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::OnDeviceDescription
+//
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMediaServerDescriptionProvider::OnDeviceDescription( 
+                                           CUpnpDeviceDescriptionRequest& aRequest )
+    {
+    return OnRequest( aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::OnServiceDescription
+//
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMediaServerDescriptionProvider::OnServiceDescription( 
+                                           CUpnpDeviceDescriptionRequest& aRequest )
+    {
+    return OnRequest( aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::OnIcon
+//
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMediaServerDescriptionProvider::OnIcon( CUpnpDeviceDescriptionRequest& aRequest )
+    {
+    return OnRequest( aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::GetFile
+//
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMediaServerDescriptionProvider::GetFile( const TDesC8& aUri, RFile& aFile )
+    {    
+    TRAPD( error, GetFileFromUriL( aUri, iFileName ) );
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+    
+    return aFile.Open( iFs, iFileName, EFileShareReadersOnly | EFileRead );  
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::OnRequestL
+//
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpMediaServerDescriptionProvider::OnRequest( CUpnpDeviceDescriptionRequest& aRequest )
+    {
+    TInetAddr addr;
+    aRequest.InetAddress( addr );
+
+    TRAPD( error, GetFileFromUriL( aRequest.Uri(), iFileName ) );
+    
+    if ( KErrNone == error )
+        {
+        if ( 0 == iFileName.Length() )
+            {
+            return KErrNotFound;
+            }
+        else
+            {
+            TRAP( error, AuthorizeRequestL( iFileName, addr ) );
+            }
+        }
+    
+    return error;            
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::ExtractPathAndFileFromUriL
+//
+// -----------------------------------------------------------------------------
+//
+HBufC8* CUpnpMediaServerDescriptionProvider::ExtractPathAndFileFromUriL( const TDesC8& aUri )
+    {
+    TPtrC8 fileName;
+    TInt parseError;
+    TPtrC8 urlPath = UpnpFileUtil::ExtractUrlPath( aUri, fileName, parseError);
+    User::LeaveIfError( parseError );
+    
+    HBufC8* buf = HBufC8::NewLC( urlPath.Length() + fileName.Length() + 
+                                 2 * UpnpString::KSlash().Length() );
+    buf->Des().Copy( UpnpString::KSlash() );
+    buf->Des().Append( urlPath );
+    buf->Des().Append( UpnpString::KSlash() );
+    buf->Des().Append( fileName );
+    
+    HBufC8* buf2 = HBufC8::NewL( buf->Length() );
+    buf2->Des().CopyLC( buf->Des() );   // convert to lower characters
+    CleanupStack::PopAndDestroy( buf );
+    
+    return buf2;
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::GetFileFromUriL
+//
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerDescriptionProvider::GetFileFromUriL( const TDesC8& aUri, TDes& aPath )
+    {
+    HBufC8* pathAndFile = ExtractPathAndFileFromUriL( aUri );
+    
+    TFileName* file = iUriMap.Find( pathAndFile->Des() );
+    
+    delete pathAndFile;
+    pathAndFile = NULL;
+    
+    if ( !file )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    aPath.Copy( *file );
+    }
+
+// -----------------------------------------------------------------------------
+//  CUpnpMediaServerDescriptionProvider::AuthorizeRequestL
+//
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerDescriptionProvider::AuthorizeRequestL(
+    const TDesC& aFileName, const TInetAddr& aSender )
+    {
+    CUpnpHttpMessage* tempMessage = CUpnpHttpMessage::NewL( aSender );
+    CleanupStack::PushL( tempMessage );
+    if ( iSecurityManager
+            && iSecurityManager->AuthorizeMessage( tempMessage,
+                    (TFileName&) aFileName  ) != KErrNone )
+        { //not showing why resource is refused
+        User::Leave( -EHttpNotFound );
+        }
+    CleanupStack::PopAndDestroy( tempMessage );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/src/upnpmediaservereventhandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,189 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server event handler
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpmediaservereventhandler.h"
+#include "upnpmediaserversession.h"
+#include "upnpfiletransfereventlist.h"
+#include "upnpfiletransferevent.h"
+#include "upnpmediaserver.pan"
+#include <s32mem.h>
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerEventHandler* CUpnpMediaServerEventHandler::NewL(CUpnpMediaServer* aServer)
+    {
+    CUpnpMediaServerEventHandler* self = CUpnpMediaServerEventHandler::NewLC(aServer); 
+    CleanupStack::Pop( self ) ;
+    return self ;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerEventHandler* CUpnpMediaServerEventHandler::NewLC(CUpnpMediaServer* aServer)
+    {
+    CUpnpMediaServerEventHandler* self = new (ELeave) CUpnpMediaServerEventHandler(aServer);
+    CleanupStack::PushL( self );
+    self->ConstructL() ;
+    return self ;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::EventMediaServerSubscribeEventsL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerEventHandler::EventMediaServerSubscribeEvents( const RMessage2& aMessage )
+    {    
+    iMediaServer->SubscribeEvents(this);
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::EventMediaServerUnsubscribeEventsL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerEventHandler::EventMediaServerUnsubscribeEvents( const RMessage2& aMessage )
+    {        
+    if ( iListenRequestPending )
+        {
+        iCurrentMessage.Complete( KErrNone );
+        }
+    iMediaServer->UnsubscribeEvents(this);    
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::EventMediaServerServerListenTransferEventL
+// Serves event listening request
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerEventHandler::EventMediaServerServerListenTransferEventL( const RMessage2& aMessage )
+    {    
+    iCurrentMessage = aMessage;
+    
+    if ( iFileTransferEventList->GetPointerArray().Count() > 0 )
+        {   
+        ListenTransferEventCompleteL();
+        }
+    else
+        {
+        iListenRequestPending = ETrue;
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::EventMediaServerGetTransferEventBodyL
+// Sends event list body to client
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerEventHandler::EventMediaServerGetTransferEventBodyL( const RMessage2& aMessage )
+    {
+    aMessage.WriteL(0, *iResponseBuffer);
+    aMessage.Complete( KErrNone );
+    delete iResponseBuffer;
+    iResponseBuffer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::CUpnpMediaServerEventHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerEventHandler::CUpnpMediaServerEventHandler(CUpnpMediaServer* aServer)
+    :iMediaServer(aServer), iRespLengthPkg(iRespLength)
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::~CUpnpMediaServerEventHandler()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerEventHandler::~CUpnpMediaServerEventHandler()
+    {
+    if(iMediaServer)
+        {        
+        iMediaServer->UnsubscribeEvents(this);
+        }
+    delete iResponseBuffer;
+    delete iFileTransferEventList;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerEventHandler::ConstructL()
+    {
+    iFileTransferEventList = CUpnpFileTransferEventList::NewL();
+	}
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::FileTransferEvent
+// File transfer event callback method.(from MUpnpContentDirectoryObserver)
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerEventHandler::FileTransferEvent( CUpnpFileTransferEvent *aEvent )
+    {
+    TRAP_IGNORE( ServeEventL( aEvent ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::ServeEventL
+// Serves incoming transfer event
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerEventHandler::ServeEventL(CUpnpFileTransferEvent *aEvent) 
+    {
+    iFileTransferEventList->GetPointerArray().AppendL( aEvent->CloneL() );
+    if (iListenRequestPending)
+        {
+        ListenTransferEventCompleteL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerEventHandler::ListenTransferEventCompleteL
+// Serialize events queue and sends buffer length to client
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerEventHandler::ListenTransferEventCompleteL()
+    {
+    iResponseBuffer = iFileTransferEventList->ToDes8L(); 
+    iFileTransferEventList->GetPointerArray().ResetAndDestroy();
+    iRespLength = iResponseBuffer->Des().Size();
+    iCurrentMessage.WriteL(0, iRespLengthPkg);
+    iCurrentMessage.Complete( KErrNone );
+    iListenRequestPending = EFalse;
+    }
+
+
+  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/mediaserverengine/src/upnpmediaserversession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1055 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Server Session
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpmediaserversession.h"
+#include "upnpmediaservereventhandler.h"
+#include "upnpmediaserver.pan"
+#include "upnpitem.h"
+#include "upnpicon.h"
+#include "upnpcontainer.h"
+#include "upnpitemlist.h"
+#include "upnpcontainerlist.h"
+#include "upnpbrowsecriteria.h"
+#include "upnpmediaserverclient.h"
+#include <xml/xmlparsererrors.h>
+#include <s32mem.h>
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::CUpnpMediaServerSession
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerSession::CUpnpMediaServerSession(CUpnpMediaServer* aServer)
+    : CSession2(), iRespLengthPkg(iRespLength), iRespExecStatusPkg(iRespExecStatus)
+    {
+    iMediaServer = aServer;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::ConstructL()
+    {
+    iEventHandler = CUpnpMediaServerEventHandler::NewL(this->iMediaServer);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::~CUpnpMediaServerSession
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerSession::~CUpnpMediaServerSession()
+    {
+    delete iResponseBuffer;
+    delete iEventHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::ServiceL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::ServiceL( const RMessage2& aMessage )
+    {
+    // first of all server must be started
+    if( iMediaServer->Status() == RUpnpMediaServerClient::EStopped &&
+        aMessage.Function() != EMediaServerStatus &&
+        aMessage.Function() != EMediaServerStart &&
+        aMessage.Function() != EMediaServerStartOffline &&
+        aMessage.Function() != EMediaServerSubscribeEvents &&
+        aMessage.Function() != EMediaServerUnsubscribeEvents &&
+        aMessage.Function() != EMediaServerListenTransferEvent &&
+        aMessage.Function() != EMediaServerGetTransferEventBody &&
+        aMessage.Function() != EMediaServerStatusChange &&
+        aMessage.Function() != EMediaServerStatusChangeCancel &&
+        aMessage.Function() != EMediaServerAddIcon &&
+        aMessage.Function() != EMediaServerRemoveIcon &&
+        aMessage.Function() != EMediaServerRemoveIcons &&
+        aMessage.Function() != EMediaServerUpdateIcon
+        )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    switch ( aMessage.Function() )
+        {
+        case EMediaServerStatus:
+            EventMediaServerStatusL( aMessage );
+            break;
+        case EMediaServerStartOffline:
+            EventMediaServerStartOfflineL(aMessage);
+            break;
+        case EMediaServerStart:
+            EventMediaServerStartL( aMessage );
+            break;
+        case EMediaServerStop:
+            EventMediaServerStop( aMessage );
+            break;
+        case EMediaServerStopSilent:
+            EventMediaServerStopSilent( aMessage );
+            break;
+        case EMediaServerRestart:
+            EventMediaServerRestartL( aMessage );
+            break;
+        case EMediaServerShareItem:
+            EventMediaServerShareItemL( aMessage );
+            break;
+        case EMediaServerShareItemResult:
+            EventMediaServerGetShareItemResultL( aMessage );
+            break;
+        case EMediaServerShareContainer:
+            EventMediaServerShareContainerL( aMessage );
+            break;
+        case EMediaServerShareContainerResult:
+            EventMediaServerGetShareContainerResultL(aMessage);
+            break;
+        case EMediaServerShareItemList:
+            EventMediaServerShareItemListL( aMessage );
+            break;
+        case EMediaServerShareItemListResult:
+            EventMediaServerGetShareItemListResultL( aMessage );
+            break;
+        case EMediaServerUnshareItem:
+            EventMediaServerUnshareItemL( aMessage );
+            break;
+        case EMediaServerUnshareRoot:
+            EventMediaServerUnshareRootL( aMessage );
+            break;
+        case EMediaServerUnshareContainer:
+            EventMediaServerUnshareContainerL( aMessage );
+            break;
+        case EMediaServerGetSharedItem:
+            EventMediaServerGetSharedItemL( aMessage );
+            break;
+        case EMediaServerGetSharedItemResult:
+            EventMediaServerGetGetSharedItemResultL( aMessage );
+            break;
+        case EMediaServerGetSharedContainer:
+            EventMediaServerGetSharedContainerL( aMessage );
+            break;
+        case EMediaServerGetSharedContainerResult:
+            EventMediaServerGetGetSharedContainerResultL( aMessage );
+            break;
+        case EMediaServerUnshareItemList:
+            EventMediaServerUnshareItemListL( aMessage );
+            break;
+        case EMediaServerGetSharedItemList:
+            EventMediaServerGetSharedItemListL(aMessage);
+            break;
+        case EMediaServerGetSharedItemListResult:
+            EventMediaServerGetGetSharedItemListResultL(aMessage);
+            break;
+        case EMediaServerGetSharedContainerList:
+            EventMediaServerGetSharedContainerListL(aMessage);
+            break;
+        case EMediaServerGetSharedContainerListResult:
+            EventMediaServerGetGetSharedContainerListResultL(aMessage);
+            break;
+        case EMediaServerSubscribeEvents:
+            iEventHandler->EventMediaServerSubscribeEvents(aMessage);
+            break;
+        case EMediaServerUnsubscribeEvents:
+            iEventHandler->EventMediaServerUnsubscribeEvents(aMessage);
+            break;
+        case EMediaServerListenTransferEvent:
+            iEventHandler->EventMediaServerServerListenTransferEventL(aMessage);
+            break;
+        case EMediaServerGetTransferEventBody:
+            iEventHandler->EventMediaServerGetTransferEventBodyL(aMessage);
+            break;
+        case EMediaServerGetIpAndPort:
+            EventMediaServerGetIpAndPortL(aMessage);
+            break;
+        case EMediaServerSetUploadDirectory:
+            EventSetUploadDirectoryL( aMessage );
+            break;
+        case EMediaServerAddIcon:
+            EventAddIconL( aMessage );
+            break;
+        case EMediaServerRemoveIcon:
+            EventRemoveIconL( aMessage );
+            break;
+        case EMediaServerRemoveIcons:
+            EventRemoveIconsL( aMessage );
+            break;
+        case EMediaServerUpdateIcon:
+            EventUpdateIconL( aMessage );
+            break;
+        case EMediaServerShareReference:
+            EventMediaServerShareReferenceL( aMessage );
+            break;
+        case EMediaServerShareReferenceList:
+            EventMediaServerShareReferenceListL( aMessage );
+            break;
+        case EMediaServerStatusChange:
+            EventMediaServerStatusChange( aMessage );
+            break;   
+        case EMediaServerStatusChangeCancel:
+            EventMediaServerStatusChangeCancel( aMessage );
+            break;    
+        default :
+            PanicClient( aMessage, EMediaServerBadRequest );
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::PanicClient
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::PanicClient( const RMessage2 &aMessage, TInt aPanic ) const
+    {
+    static_cast<const CUpnpSymbianServerBase*>(  Server() )->PanicClient( aMessage, aPanic );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::NewL
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerSession* CUpnpMediaServerSession::NewL(CUpnpMediaServer* aServer)
+    {
+    CUpnpMediaServerSession* self = CUpnpMediaServerSession::NewLC(aServer);
+    CleanupStack::Pop( self ) ;
+    return self ;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::NewLC
+// -----------------------------------------------------------------------------
+//
+CUpnpMediaServerSession* CUpnpMediaServerSession::NewLC(CUpnpMediaServer* aServer)
+    {
+    CUpnpMediaServerSession* self = new (ELeave) CUpnpMediaServerSession(aServer);
+    CleanupStack::PushL( self );
+    self->ConstructL() ;
+    return self ;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerStartL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerStatusL( const RMessage2& aMessage )
+    {
+    TPckgBuf<TInt> status( iMediaServer->Status() );
+    aMessage.WriteL( 0, status );
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerStartL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerStartL( const RMessage2& aMessage )
+    {
+    iMediaServer->CancelAVMediaServerStop();//if stop was scheduled - cancel it
+
+    if ( iMediaServer->Status() != RUpnpMediaServerClient::EStartedOnline )
+        {
+        TRAPD( err, iMediaServer->StartAVMediaServerL() );
+
+        if ( err == KErrNotFound // files not found
+            || err == KErrArgument // empty or improper one of description files
+            || (err >= EXmlParserError && err <= EXmlFeatureLockedWhileParsing) // description malformed
+            || err == KErrNoMemory // problem with start because of memory usage
+            )
+            {
+            iMediaServer->InitializeL( ETrue );
+            iMediaServer->RestartAVMediaServerL();
+            iMediaServer->StartAVMediaServerL();
+            }
+        else if (err == KErrCorrupt || err == KErrEof || err == KErrNotSupported)
+            {
+            iMediaServer->ResetDbL();
+            iMediaServer->StartAVMediaServerL();
+            }
+        else
+            {
+            User::LeaveIfError(err);
+            }
+        }
+
+    if ( !aMessage.IsNull() )
+        {
+        aMessage.Complete( KErrNone );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerStartOfflineL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerStartOfflineL( const RMessage2& aMessage )
+    {
+    iMediaServer->CancelAVMediaServerStop();//if stop was scheduled cancel it
+    if( iMediaServer->Status() != RUpnpMediaServerClient::EStartedOffline )
+        {
+        TRAPD(err, iMediaServer->StartAVMediaServerOfflineL());
+         if ( err == KErrNotFound // files not found
+            || err == KErrArgument // empty or improper one of description files
+            || (err >= EXmlParserError && err <= EXmlFeatureLockedWhileParsing) // description malformed
+            || err == KErrNoMemory // problem with start because of memory usage
+            )
+            {
+            iMediaServer->InitializeL( ETrue );
+            iMediaServer->StartAVMediaServerOfflineL();
+            }
+        else if (err == KErrCorrupt || err == KErrEof)
+            {
+            iMediaServer->ResetDbL();
+            iMediaServer->StartAVMediaServerOfflineL();
+            }
+        else
+            {
+            User::LeaveIfError(err);
+            }
+
+        }
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerStop
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerStop( const RMessage2& aMessage )
+    {
+    if ( iMediaServer->Status() != RUpnpMediaServerClient::EStopped )
+        {
+        iMediaServer->StopAVMediaServer(EFalse);
+        }
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerStopSilent
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerStopSilent( const RMessage2& aMessage )
+    {
+    if ( iMediaServer->Status() != RUpnpMediaServerClient::EStopped )
+        {
+        iMediaServer->StopAVMediaServer(ETrue);
+        }
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerRestartL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerRestartL( const RMessage2& aMessage )
+    {
+    iMediaServer->RestartAVMediaServerL();
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetShareItemResultL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetShareItemResultL( const RMessage2& aMessage )
+    {
+    ASSERT(aMessage.GetDesMaxLength(0) >= iRespLength);
+
+    // Write result back to client
+    aMessage.WriteL( 0, *iResponseBuffer );
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    delete iResponseBuffer;
+    iResponseBuffer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetShareContainerResultL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetShareContainerResultL( const RMessage2& aMessage )
+    {
+    ASSERT(aMessage.GetDesMaxLength(0) >= iRespLength);
+
+    // Write result back to client
+    aMessage.WriteL( 0, *iResponseBuffer );
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    delete iResponseBuffer;
+    iResponseBuffer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerShareItemL
+// Stops the server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerShareItemL( const RMessage2& aMessage )
+    {
+    // get object from message
+    CUpnpItem* item = CUpnpItem::NewL();
+    CleanupStack::PushL(item);
+    ReadObjFromMessageL(aMessage, 0, item);
+
+    // perform action
+    iMediaServer->ShareObjectL(item);
+
+    // prepare response
+    iResponseBuffer = item->ToDes8L();
+    iRespLength = iResponseBuffer->Length();
+    aMessage.WriteL(1, iRespLengthPkg);
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(item);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetSharedItemL
+// Stops the server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetSharedItemL(
+                                                    const RMessage2& aMessage )
+    {
+    // perform action
+    CUpnpItem* item = iMediaServer->GetSharedItemL(aMessage.Int0());
+    CleanupStack::PushL(item);
+
+    // prepare response
+    iResponseBuffer = item->ToDes8L();
+    iRespLength = iResponseBuffer->Length();
+    aMessage.WriteL(1, iRespLengthPkg);
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(item);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetGetSharedItemResultL
+// Stops the server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetGetSharedItemResultL(
+                                                    const RMessage2& aMessage )
+    {
+    ASSERT(aMessage.GetDesMaxLength(0) >= iRespLength);
+
+    // Write result back to client
+    aMessage.WriteL( 0, *iResponseBuffer );
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    delete iResponseBuffer;
+    iResponseBuffer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetSharedContainerL
+// Stops the server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetSharedContainerL(
+                                                    const RMessage2& aMessage )
+    {
+    // perform action
+    CUpnpContainer* cont = iMediaServer->GetSingleContainerL(aMessage.Int0());
+    CleanupStack::PushL(cont);
+
+    // prepare response
+    iResponseBuffer = cont->ToDes8L();
+    iRespLength = iResponseBuffer->Length();
+    aMessage.WriteL(1, iRespLengthPkg);
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(cont);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetShareContainerListResultL
+// Stops the server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetGetSharedContainerResultL(
+                                                    const RMessage2& aMessage )
+    {
+    ASSERT(aMessage.GetDesMaxLength(0) >= iRespLength);
+
+    // Write result back to client
+    aMessage.WriteL( 0, *iResponseBuffer );
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    delete iResponseBuffer;
+    iResponseBuffer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerShareContainerL
+// Stops the server.
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerShareContainerL(
+                                                    const RMessage2& aMessage )
+    {
+    // get object from message
+    CUpnpContainer* cont = CUpnpContainer::NewL();
+    CleanupStack::PushL(cont);
+    ReadObjFromMessageL(aMessage, 0, cont);
+
+    // perform action
+    iMediaServer->ShareObjectL(cont);
+
+    // prepare response
+    iResponseBuffer = cont->ToDes8L();
+    iRespLength = iResponseBuffer->Length();
+    aMessage.WriteL(1, iRespLengthPkg);
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(cont);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetShareItemListResultL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetGetSharedItemListResultL(
+                                                    const RMessage2& aMessage )
+    {
+    ASSERT(aMessage.GetDesMaxLength(0) >= iRespLength);
+
+    // Write result back to client
+    aMessage.WriteL( 0, *iResponseBuffer );
+    aMessage.WriteL( 1, iRespExecStatusPkg );
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    delete iResponseBuffer;
+    iResponseBuffer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetGetSharedContainerListResultL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetGetSharedContainerListResultL(
+                                                    const RMessage2& aMessage )
+    {
+    ASSERT(aMessage.GetDesMaxLength(0) >= iRespLength);
+
+    // Write result back to client
+    aMessage.WriteL( 0, *iResponseBuffer );
+    aMessage.WriteL( 1, iRespExecStatusPkg );
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    delete iResponseBuffer;
+    iResponseBuffer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetShareItemListResultL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetShareItemListResultL( const RMessage2& aMessage )
+    {
+    ASSERT(aMessage.GetDesMaxLength(0) >= iRespLength);
+
+    // Write result back to client
+    aMessage.WriteL( 0, *iResponseBuffer );
+    aMessage.WriteL( 1, iRespExecStatusPkg );
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    delete iResponseBuffer;
+    iResponseBuffer = NULL;
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerUnshareRootL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerUnshareRootL(
+                                                    const RMessage2& aMessage )
+    {
+    iMediaServer->UnshareRootL();
+    aMessage.Complete( KErrNone );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerUnshareItemL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerUnshareItemL(
+                                                    const RMessage2& aMessage )
+    {
+    iMediaServer->UnshareItemL(aMessage.Int0());
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerUnshareContainerL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerUnshareContainerL(
+                                                    const RMessage2& aMessage )
+    {
+    iMediaServer->UnshareContainerL(aMessage.Int0());
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetSharedItemListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetSharedItemListL(
+                                                    const RMessage2& aMessage )
+    {
+    // get object from message
+    CUpnpBrowseCriteria* bc = CUpnpBrowseCriteria::NewL();
+    CleanupStack::PushL(bc);
+    ReadObjFromMessageL(aMessage, 1, bc);
+
+    // item list
+    CUpnpItemList* il = CUpnpItemList::NewL();
+    CleanupStack::PushL(il);
+
+    // perform action
+    iMediaServer->GetSharedItemListL(aMessage.Int0(), bc, &iRespExecStatus, il);
+
+    // prepare response
+    iResponseBuffer = il->ToDes8L();
+    iRespLength = iResponseBuffer->Length();
+    aMessage.WriteL(2, iRespLengthPkg);
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(il);
+    CleanupStack::PopAndDestroy(bc);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetSharedContainerListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetSharedContainerListL(
+                                                    const RMessage2& aMessage )
+    {
+    // get object from message
+    CUpnpBrowseCriteria* bc = CUpnpBrowseCriteria::NewL();
+    CleanupStack::PushL(bc);
+    ReadObjFromMessageL(aMessage, 1, bc);
+
+    // item list
+    CUpnpContainerList* cl = CUpnpContainerList::NewL();
+    CleanupStack::PushL(cl);
+
+    // perform action
+    iMediaServer->GetSharedContainerListL(aMessage.Int0(),
+                                            bc, &iRespExecStatus, cl);
+
+    // prepare response
+    iResponseBuffer = cl->ToDes8L();
+    iRespLength = iResponseBuffer->Length();
+    aMessage.WriteL(2, iRespLengthPkg);
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(cl);
+    CleanupStack::PopAndDestroy(bc);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerShareItemListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerShareItemListL(
+                                                    const RMessage2& aMessage )
+    {
+    // get object from message
+    CUpnpItemList* il = CUpnpItemList::NewL();
+    CleanupStack::PushL(il);
+    ReadObjFromMessageL(aMessage, 0, il);
+
+    // perform action
+    iMediaServer->ShareItemListL(il, &iRespExecStatus);
+
+    // prepare response
+    iResponseBuffer = il->ToDes8L();
+    iRespLength = iResponseBuffer->Length();
+    aMessage.WriteL(1, iRespLengthPkg);
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(il);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerUnshareItemListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerUnshareItemListL(
+                                                    const RMessage2& aMessage )
+    {
+    // get ids from message
+    RArray<TInt> il;
+    CleanupClosePushL(il);
+    ReadIdsFromMessageL(aMessage, 0, il);
+
+    // perform action
+    iMediaServer->UnshareItemListL(il, &iRespExecStatus);
+
+    // prepare response
+    aMessage.WriteL( 1, iRespExecStatusPkg );
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(&il);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerGetIpAndPortL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerGetIpAndPortL(
+                                                    const RMessage2& aMessage )
+    {
+    // response
+    TInetAddr address = iMediaServer->GetAddress();
+    if (address.Match(TInetAddr(INET_ADDR(0, 0, 0, 0))))
+        {
+        User::Leave( KErrNotReady );
+        }
+    aMessage.WriteL( 0, TPckgBuf<TInetAddr>( address ) );
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventSetUploadDirectoryL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventSetUploadDirectoryL( const RMessage2& aMessage )
+    {
+    HBufC* buf = HBufC::NewLC( aMessage.GetDesLength( 0 ) );
+    TPtr ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( 0, ptr ) );
+    iMediaServer->SetUploadDirToCDL( ptr );
+    CleanupStack::PopAndDestroy(buf);
+    aMessage.Complete( KErrNone );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventAddIcon
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventAddIconL( const RMessage2& aMessage)
+    {
+    HBufC8* buf = HBufC8::NewLC( aMessage.GetDesLength( 0 ) );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( 0, ptr ) );
+
+    iMediaServer->AddIconL(ptr);
+    CleanupStack::PopAndDestroy(buf);
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventUpdateIcon
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventUpdateIconL( const RMessage2& aMessage)
+    {
+    HBufC8* buf0 = HBufC8::NewLC( aMessage.GetDesLength( 0 ) );
+    TPtr8 ptr0( buf0->Des() );
+    User::LeaveIfError( aMessage.Read( 0, ptr0 ) );
+
+    HBufC8* buf1 = HBufC8::NewLC( aMessage.GetDesLength( 1 ) );
+    TPtr8 ptr1( buf1->Des() );
+    User::LeaveIfError( aMessage.Read( 1, ptr1 ) );
+
+    iMediaServer->UpdateIconL(ptr0, ptr1);
+
+    CleanupStack::PopAndDestroy(buf1);
+    CleanupStack::PopAndDestroy(buf0);
+
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventRemoveIcon
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventRemoveIconL( const RMessage2& aMessage)
+    {
+    //Remove icon
+    HBufC8* buf = HBufC8::NewLC( aMessage.GetDesLength( 0 ) );
+    TPtr8 ptr( buf->Des() );
+    User::LeaveIfError( aMessage.Read( 0, ptr ) );
+
+    iMediaServer->RemoveIconL(ptr);
+    CleanupStack::PopAndDestroy(buf);
+
+    aMessage.Complete( KErrNone );
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventRemoveIcons
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventRemoveIconsL( const RMessage2& aMessage )
+    {
+    iMediaServer->RemoveIconsL();
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::ObjFromMessageL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::ReadIdsFromMessageL( const RMessage2& aMessage,
+                                        TInt aSlot, RArray<TInt>& aObjIds )
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength(aSlot);
+    HBufC8* buf = HBufC8::NewLC(len);
+    TPtr8 ptr(buf->Des());
+    User::LeaveIfError(aMessage.Read(aSlot, ptr));
+
+    // read stream
+    RDesReadStream stream(*buf);
+    CleanupClosePushL(stream);
+
+    // number of elements
+    TInt n = stream.ReadInt32L();
+
+    // variables used to retrieve integers
+    HBufC8* tmpId;
+    TLex8 lex;
+    TInt tmpIdNum;
+    // read elements
+    while( n-- )
+        {
+        tmpId = HBufC8::NewLC(stream, KMaxUpnpObjStringLen);
+        if ( tmpId->Des() == KNullDesC8() )
+            {
+            User::Leave( KErrNotFound );
+            }
+        lex.Assign(tmpId->Des());
+        if( lex.Val( tmpIdNum ) < KErrNone )
+            {
+            User::Leave( KErrNotFound );
+            }
+        aObjIds.AppendL( tmpIdNum);
+        CleanupStack::PopAndDestroy(tmpId);
+        }
+
+    // clean up
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    }
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::ObjFromMessageL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::ReadObjFromMessageL( const RMessage2& aMessage,
+                                                TInt aSlot, CUpnpObject* aObj )
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength(aSlot);
+    HBufC8* buf = HBufC8::NewLC(len);
+    TPtr8 ptr(buf->Des());
+    User::LeaveIfError(aMessage.Read(aSlot, ptr));
+
+    // read stream
+    RDesReadStream stream(*buf);
+    CleanupClosePushL(stream);
+
+    // internalize object
+    stream >> *aObj;
+
+    // clean up
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::ReadItemFromMessageL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::ReadItemFromMessageL( const RMessage2& aMessage,
+                                                TInt aSlot, CUpnpItem* aItem )
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength(aSlot);
+    HBufC8* buf = HBufC8::NewLC(len);
+    TPtr8 ptr(buf->Des());
+    User::LeaveIfError(aMessage.Read(aSlot, ptr));
+
+    // read stream
+    RDesReadStream stream(*buf);
+    CleanupClosePushL(stream);
+
+    // internalize object
+    stream >> *aItem;
+
+    // clean up
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::ReadObjFromMessageL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::ReadObjFromMessageL( const RMessage2& aMessage,
+                                        TInt aSlot, CUpnpItemList* aItemList )
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength(aSlot);
+    HBufC8* buf = HBufC8::NewLC(len);
+    TPtr8 ptr(buf->Des());
+    User::LeaveIfError(aMessage.Read(aSlot, ptr));
+
+    // read stream
+    RDesReadStream stream(*buf);
+    CleanupClosePushL(stream);
+
+    // internalize object
+    stream >> *aItemList;
+
+    // clean up
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::ReadObjFromMessageL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::ReadObjFromMessageL( const RMessage2& aMessage,
+                            TInt aSlot, CUpnpBrowseCriteria* aBrowseCriteria )
+    {
+    // create buffer
+    TInt len = aMessage.GetDesMaxLength(aSlot);
+    HBufC8* buf = HBufC8::NewLC(len);
+    TPtr8 ptr(buf->Des());
+    User::LeaveIfError(aMessage.Read(aSlot, ptr));
+
+    // read stream
+    RDesReadStream stream(*buf);
+    CleanupClosePushL(stream);
+
+    // internalize object
+    stream >> *aBrowseCriteria;
+
+    // clean up
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(buf);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerShareReferenceL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerShareReferenceL( const RMessage2& aMessage )
+    {
+    // get 'reference object' from message
+    CUpnpItem* ref = CUpnpItem::NewL();
+    CleanupStack::PushL(ref);
+    ReadItemFromMessageL(aMessage, 0, ref);
+
+    // perform sharing
+    iMediaServer->ShareReferenceL(ref);
+
+    // prepare response
+    iResponseBuffer = ref->ToDes8L();
+    iRespLength = iResponseBuffer->Length();
+    aMessage.WriteL(1, iRespLengthPkg);
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(ref);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerShareReferenceListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerShareReferenceListL( const RMessage2& aMessage )
+    {
+    // get 'reference item' list from message
+    CUpnpItemList* refList = CUpnpItemList::NewL();
+    CleanupStack::PushL(refList);
+    ReadObjFromMessageL(aMessage, 0, refList);
+
+    // perform sharing
+    iMediaServer->ShareReferenceListL(refList, &iRespExecStatus);
+
+    // prepare response
+    iResponseBuffer = refList->ToDes8L();
+    iRespLength = iResponseBuffer->Length();
+    aMessage.WriteL(1, iRespLengthPkg);
+    aMessage.Complete( KErrNone );
+
+    // clean up
+    CleanupStack::PopAndDestroy(refList);
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerStatusChangeL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerStatusChange( const RMessage2& aMessage )
+    {
+    if ( !iStatusMessage.IsNull() )
+        {
+        aMessage.Complete( KErrInUse );
+        }
+    else
+        {
+        iStatusMessage = aMessage;
+        }    
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::EventMediaServerStatusChangeCancelL
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::EventMediaServerStatusChangeCancel( const RMessage2& aMessage )
+    {
+    if ( !iStatusMessage.IsNull() )
+        {
+        iStatusMessage.Complete( KErrCancel );
+        }
+    aMessage.Complete( KErrNone );
+    }
+    
+// -----------------------------------------------------------------------------
+// CUpnpMediaServerSession::StatusChanged
+// -----------------------------------------------------------------------------
+//
+void CUpnpMediaServerSession::StatusChanged()
+    {
+    if ( !iStatusMessage.IsNull() )
+        {
+        iStatusMessage.Complete( KErrNone );
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmediaserver/rom/upnpmediaserver.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,46 @@
+/** @file
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available 
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the UPnP Media Server subsystem
+*
+*/
+
+
+#ifndef __UPNPMEDIASERVER_IBY__
+#define __UPNPMEDIASERVER_IBY__
+
+#ifdef __UPNP_STACK
+
+#ifdef __UPNP_MEDIASERVER
+file=ABI_DIR\BUILD_DIR\avconnectionmanager.dll \sys\bin\avconnectionmanager.dll 
+file=ABI_DIR\BUILD_DIR\avcontentdirectory.dll \sys\bin\avcontentdirectory.dll
+file=ABI_DIR\BUILD_DIR\avmediaserverclient.dll \sys\bin\avmediaserverclient.dll
+file=ABI_DIR\BUILD_DIR\upnpavobjects.dll \sys\bin\upnpavobjects.dll
+file=ABI_DIR\BUILD_DIR\avmediaserver.exe \sys\bin\avmediaserver.exe
+
+data=DATAZ_\private\101f977c\objects.xml  \private\101f977c\objects.xml 
+data=DATAZ_\private\101f977c\public\MediaServer1\ConnectionManager1.xml  \private\101f977c\public\MediaServer1\ConnectionManager1.xml
+data=DATAZ_\private\101f977c\public\MediaServer1\ContentDirectory1.xml \private\101f977c\public\MediaServer1\ContentDirectory1.xml 
+data=DATAZ_\private\101f977c\public\MediaServer1\MediaServer1.xml \private\101f977c\public\MediaServer1\MediaServer1.xml
+
+
+//Backup registartion
+data=DATAZ_\private\101f977c\backup_registration.xml \private\101f977c\backup_registration.xml
+data=DATAZ_\private\101f977d\backup_registration.xml \private\101f977d\backup_registration.xml
+#endif // __UPNP_MEDIASERVER
+
+#endif // __UPNP_STACK
+
+#endif // __UPNPMEDIASERVER_IBY__
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for upnpmpxplugins
+*
+*/
+
+
+
+
+
+
+#include "../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+// ROM build
+../rom/upnpmpxplugins.iby               CORE_MW_LAYER_IBY_EXPORT_PATH(upnpmpxplugins.iby)
+
+PRJ_MMPFILES
+// none
+
+    // playback plugins
+    #include "../upnpplaybackplugins/group/bld.inf"
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/rom/upnpmpxplugins.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnpmpxplugins subsystem ROM include file
+*
+*/
+
+
+
+
+
+#ifndef __UPNPMPXPLUGINS_IBY__
+#define __UPNPMPXPLUGINS_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    //UpnpPlaybackplugins
+    ECOM_PLUGIN(upnpplaybackplugins.dll,upnpplaybackplugins.rsc)    
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __UPNPMPXPLUGINS_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for UpnpPlaybackPlugins
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+
+PRJ_MMPFILES
+
+    // MPX upnp music plugins
+    upnpplaybackplugins.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/group/upnpplaybackplugins.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for upnpplaybackplugins
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET upnpplaybackplugins.dll
+
+TARGETTYPE PLUGIN
+
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+EPOCALLOWDLLDATA
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID                 0x10009D8D 0x20007568 
+
+SOURCEPATH          ../src
+SOURCE              upnpmusicplayer.cpp
+SOURCE              upnpmusicpluginsproxy.cpp
+SOURCE              upnpmusicperiodizer.cpp
+SOURCE              upnpsingleton.cpp
+SOURCE              upnptrack.cpp
+SOURCE              upnpplaybackstatemachine.cpp
+SOURCE              upnpvaluestatemachine.cpp
+SOURCE              upnpaudiopolicy.cpp
+SOURCE              upnppluginserrortranslation.cpp
+SOURCE              upnpmusicdownloadproxy.cpp
+
+USERINCLUDE         ../inc
+USERINCLUDE         ../../../inc
+
+// include paths (system)
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE       /epoc32/include/mmf/common		 //before SF header reloaction, to avoid build breaks
+SYSTEMINCLUDE  			/epoc32/include/mw/mmf/common  //after SF header relocation
+
+START RESOURCE      20007568.rss
+TARGET              upnpplaybackplugins.rsg
+END
+
+// SYSTEM
+LIBRARY             euser.lib ecom.lib
+LIBRARY             bafl.lib
+LIBRARY             efsrv.lib
+LIBRARY             inetprotutil.lib // EscapeUtils / string conversion
+LIBRARY             estor.lib // some MPX inline methods
+
+// UPNP STACK
+LIBRARY             upnpavobjects.lib
+LIBRARY             upnpipserversutils.lib
+
+// UPNP FRAMEWORK
+LIBRARY             upnpavcontrollerclient.lib
+LIBRARY             upnpavcontrollerhelper.lib
+LIBRARY             upnpsettingsengine.lib
+
+// XML
+LIBRARY             upnpxmlparser.lib
+
+// MPX FRAMEWORK
+LIBRARY             mpxcommon.lib
+
+// MMF
+LIBRARY             mmfdevsound.lib // for audio policy feature
+
+// DEBUG
+DEBUGLIBRARY        flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnpaudiopolicy.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Audio policy implementation for upnp remote plugin
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAUDIOPOLICY_H
+#define C_UPNPAUDIOPOLICY_H
+
+
+#include <mmf/server/sounddevice.h> // for MDevSoundObserver
+
+// FORWARD DECLARATIONS
+class MUPnPAudioPolicyObserver;
+class CMMFBuffer;
+class CMMFDevSound;
+
+/**
+ * A class that implements audio policy for upnp playback plugin.
+ * It registers for DevSound for a vrtual playback handle and is
+ * able to receive notifications from MMF. The purpose for this
+ * is to pause upnp playback when <br>
+ *  - local playback begins <br>
+ *  - there is an incoming call <br>
+ *
+ * @lib upnpmusicplugins.lib
+ * @since S60 v3.1
+ */
+class CUPnPAudioPolicy
+    : public CBase,
+      public MDevSoundObserver
+    {
+    
+private:
+
+    /**
+     * State of audiopolicy
+     *
+     * @since Series 60 3.1
+     */   
+    enum TAudioPolicyState
+        {
+        EStateUninitialised, // waiting initialise devSound, can not be used
+        EStatePlaying,       // audiopolicy initialized and playback started
+        EStateStopped,       // playback stopped
+        };
+
+public: // public services
+
+    /**
+     * constructor
+     * @param aPlaybackMachine the playback states engine
+     */
+    static CUPnPAudioPolicy* NewL(
+        MUPnPAudioPolicyObserver& aObserver );
+
+    /**
+     * destructor
+     */
+    CUPnPAudioPolicy::~CUPnPAudioPolicy();
+
+    /**
+     * request for start playback
+     */
+    void PlayL();
+
+    /**
+     * indicate playback stops
+     */
+    void Stop();
+
+protected: // MDevSoundObserver
+
+    /**
+     * see MDevSoundObserver
+     */
+    void InitializeComplete( TInt aError );
+
+    /**
+     * see MDevSoundObserver
+     */
+    void ToneFinished( TInt aError );
+
+    /**
+     * see MDevSoundObserver
+     */
+    void BufferToBeFilled( CMMFBuffer* aBuffer );
+
+    /**
+     * see MDevSoundObserver
+     */
+    void PlayError( TInt aError );
+
+    /**
+     * see MDevSoundObserver
+     */
+    void BufferToBeEmptied( CMMFBuffer* aBuffer );
+
+    /**
+     * see MDevSoundObserver
+     */
+    void RecordError( TInt aError );
+
+    /**
+     * see MDevSoundObserver
+     */
+    void ConvertError( TInt aError );
+
+    /**
+     * see MDevSoundObserver
+     */
+    void DeviceMessage( TUid aMessageType, const TDesC8& aMsg );
+
+    /**
+     * see MDevSoundObserver
+     */
+    void SendEventToClient( const TMMFEvent& aEvent );
+
+private: // private methods
+
+    /**
+     * default constructor
+     * @param aPlaybackMachine the playback states engine
+     */
+    CUPnPAudioPolicy(
+        MUPnPAudioPolicyObserver& aObserver );
+
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+
+private: // data
+
+    /**
+     * the playback states engine
+     */
+    MUPnPAudioPolicyObserver& iObserver;
+
+    /**
+     * DevSound component for MMF access
+     */
+    CMMFDevSound* iDevSound;
+    
+    /**
+     * Current AudioPolicy state
+     */
+    TAudioPolicyState iAudioPolicyState;
+
+    };
+
+/**
+ * Callback interface for audio policy class
+ */
+class MUPnPAudioPolicyObserver
+    {
+
+public:
+
+    /**
+     * A conflict was found between simultaneously playing audio
+     * resources. This means that this instance is active and
+     * meanwhile another party starts using audio resources in
+     * a way that has been defined to be illegal. The observer
+     * is expected to take apropriate actions after receiving
+     * this event - notifying the playback framework, which will
+     * then clear all resources and inform user.
+     *
+     * @param aError error to be issued to playback framework
+     */
+    virtual void AudioConflict( TInt aError ) = 0;
+
+    };
+
+#endif // C_UPNPAUDIOPOLICY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicdownloadproxy.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Proxy for downloading upnp files and playing locally
+*
+*/
+
+
+
+
+
+
+#ifndef __CUPNPMUSICDOWNLOADPROXY_H__
+#define __CUPNPMUSICDOWNLOADPROXY_H__
+
+// INCLUDES
+#include <badesca.h>
+#include <mpxplaybackplugin.h>
+#include <mpxplaybackpluginobserver.h>
+#include "upnptrackobserver.h"
+
+// FORWARD DECLARATIONS
+class CUPnPSingleton;
+class CUPnPTrack;
+class MDesCArray; // for MPX compatibility - actually this is NOT a class
+
+
+/**
+ * UPnP Proxy class for Local Player.
+ *
+ * Provides additional UPnP download functionality: first
+ * downloads the file and then uses the underlying plugin to
+ * execute commands (play,stop,pause) on the local copy of the
+ * song
+ *
+ * @lib upnpmusicplugins.lib
+ * @since S60 v3.1
+ */
+class CUPnPMusicDownloadProxy : public CMPXPlaybackPlugin,
+                                public MMPXPlaybackPluginObserver,
+                                public MUPnPTrackObserver
+    {
+
+private:
+
+    /**
+     * Defines internal player state
+     *
+     * EStateUninitialised          - Initial and terminal state
+     * EStatePreparing              - Preparatory phases before download
+     * EStateDownloading            - Downloading the temporary file
+     * EStateInitialisingLocally    - Download is complete, starting to
+     *                                initialize proxied local plugin
+     * EStateActive                 - Init complete, now acting as a proxy for
+     *                                the local plugin to play the temp file
+     * @since Series 60 3.1
+     */  
+    enum TProxyState
+        {
+        EStateUninitialised = 0, // initial state
+        EStatePreparing, // preparatory phases
+        EStateDownloading, // download phase
+        EStateInitialisingLocally, // local init
+        EStateActive, // normal
+        EStateClosing // used if error during initialise
+        }; 
+public:
+
+    /**
+     * Static 1st phase constructor.
+     * 
+     * @since Series 60 3.1
+     * @param aObs reference to call back interface
+     * @return A new player instance
+     */   
+    static CUPnPMusicDownloadProxy* NewL( MMPXPlaybackPluginObserver& aObs );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */ 
+    ~CUPnPMusicDownloadProxy();
+    
+    
+private:
+
+    /**
+     * Private default constructor
+     *
+     * @since Series 60 3.1
+     * @param aObs reference to call back interface
+     */
+    CUPnPMusicDownloadProxy( MMPXPlaybackPluginObserver& aObs );
+
+    /**
+     * 2nd phase constructor
+     *
+     * @since Series 60 3.1
+     */   
+    void ConstructL();    
+
+public: // From CMPXPlaybackPlugin
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void InitialiseL( const TDesC& aSong );
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void InitialiseL( RFile& aSong );
+
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void CommandL( TMPXPlaybackCommand aCmd, TInt aData );
+
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void SetL( TMPXPlaybackProperty aProperty, TInt aValue ); 
+
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void ValueL( TMPXPlaybackProperty aProperty ) const;
+
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void SubPlayerNamesL();
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void SelectSubPlayerL(TInt aIndex);
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    const TDesC& SubPlayerName();
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    TInt SubPlayerIndex() const;
+
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void MediaL( const TArray<TMPXAttribute>& aAttrs );
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void CancelRequest();
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void SetObserver(MMPXPlaybackPluginObserver& aObs);
+
+protected: // From MMPXPlaybackPluginObserver
+
+    /**
+     * See MMPXPlaybackPluginObserver
+     */
+    void HandlePluginEvent( TEvent aEvent, TInt aData, TInt aError );
+
+    /**
+     * see MMPXPlaybackPluginObserver's base class MMPXPlaybackCallback
+     */
+    void HandleProperty( TMPXPlaybackProperty aProperty, TInt aValue,
+                          TInt aError );
+
+    /**
+     * see MMPXPlaybackPluginObserver's base class MMPXPlaybackCallback
+     */
+    void HandleSubPlayerNames( TUid aPlayer, const MDesCArray* aSubPlayers,
+        TBool aComplete, TInt aError );
+
+    /**
+     * see MMPXPlaybackPluginObserver's base class MMPXPlaybackCallback
+     */
+    void HandleMedia( const CMPXMedia& aProperties, TInt aError );
+
+protected: // From MUPnPTrackObserver
+
+    /**
+     * See MUPnPTrackObserver
+     */
+    void ResolveURIComplete( TInt aError );
+    
+private:
+
+    /**
+     * cleanup when going in uninitialised state
+     */
+    void Cleanup();
+
+private: // Data
+    
+    /**
+     * Local plugin instance
+     * Own.
+     */   
+    CMPXPlaybackPlugin*                     iLocalPlayer;
+    
+    /**
+     * The UPnP services singleton
+     * Own.
+     */
+     CUPnPSingleton*                        iSingleton;
+        
+    /**
+     * Player state
+     */
+    mutable TProxyState                     iProxyState;
+    
+    /**
+     * UPnP track
+     * Own.
+     */            
+    CUPnPTrack*                             iTrack;
+    };
+
+#endif // __CUPNPMUSICDOWNLOADPROXY_H__
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicperiodizer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Periodic timer support resource
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPMUSICPERIODIZER_H__
+#define __UPNPMUSICPERIODIZER_H__
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpmusicperiodizer.h"
+
+// FORWARD DECLARATIONS
+class MUPnPMusicPeriodizerObserver;
+
+/**
+ * A class that provides periodic notifications.
+ *
+ * Once started, notifies an abstract interface periodically
+ * but only when Continue is called. This avoids situation
+ * where previous operation is still in progress when the next
+ * notification arrives.
+ *
+ * @lib upnpmusicplugins.lib
+ * @since S60 v3.1
+ */
+class CUPnPMusicPeriodizer : public CTimer
+    {
+
+public:
+
+   /**
+    * Static constructor
+    *
+    * @since Series 60 3.1
+    * @param aObserver the party to be notified on timer trigger
+    * @param aTimerWavelength the timer delay in microseconds
+    */
+    static CUPnPMusicPeriodizer* NewL(
+        MUPnPMusicPeriodizerObserver& aObserver,
+        TInt32 aTimerWavelength );
+    
+   /**
+    * Static constructor
+    *
+    * @since Series 60 3.1
+    * @param aObserver the party to be notified on timer trigger
+    * @param aTimerWavelength the timer delay in microseconds
+    */
+    static CUPnPMusicPeriodizer* NewLC(
+        MUPnPMusicPeriodizerObserver& aObserver,
+        TInt32 aTimerWavelength );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */ 
+    virtual ~CUPnPMusicPeriodizer();
+
+private:
+
+   /**
+    * Constructor
+    *
+    * @since Series 60 3.1
+    * @param aObserver the party to be notified on timer trigger
+    * @param aTimerWavelength the timer delay in microseconds
+    */
+    CUPnPMusicPeriodizer(
+        MUPnPMusicPeriodizerObserver& aObserver,
+        TInt32 aTimerWavelength );
+
+    /**
+     * 2nd phase constructor
+     *
+     * @since Series 60 3.1
+     */   
+    void ConstructL();
+
+public:
+
+    /**
+     * Starts the periodizer
+     *
+     * @since Series 60 3.1
+     */
+    void Start();
+
+    /**
+     * Continues a next step for the periodizer
+     *
+     * @since Series 60 3.1
+     */
+    void Continue();
+
+    /**
+     * Stops periodizer
+     *
+     * @since Series 60 3.1
+     */
+    void Stop();
+
+protected: // personal method
+
+    /**
+     * Receives the timer triggering
+     *
+     * @since Series 60 3.1
+     */
+    void RunL();
+
+
+private: // data
+
+    /**
+     * Observer of the timer
+     */
+    MUPnPMusicPeriodizerObserver& iObserver;
+
+    /**
+     * Timer wavelength as milliseconds to wait between notifications
+     */
+    TInt32 iTimerWavelength;
+
+    };
+
+/**
+ * The interface to receive timer notifications
+ */
+class MUPnPMusicPeriodizerObserver
+    {
+
+public:
+
+   /**
+    * Timer has triggered
+    *
+    * @since Series 60 3.1
+    */
+    virtual void HandlePeriod() = 0;
+    
+   /**
+    * Timer has triggered
+    *
+    * @since Series 60 3.2.3
+    */
+    virtual void HandlePeriodForEnd(){}
+
+    };
+
+
+#endif // __UPNPMUSICPERIODIZER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicplayer.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,454 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Plugin for playing files in a remote upnp renderer
+*
+*/
+
+
+
+
+
+
+#ifndef __CUPNPMUSICPLAYER_H__
+#define __CUPNPMUSICPLAYER_H__
+
+// INCLUDES
+#include <badesca.h>
+#include <mpxplaybackplugin.h> // base class
+#include "upnpavrenderingsessionobserver.h" // Avcontrol callback
+#include "upnprendererselectorobserver.h" // for r.s.observer
+#include "upnptrackobserver.h" // for track observer
+#include "upnpaudiopolicy.h" // for audio policy observer
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class CUPnPSingleton;
+class MUPnPAVRenderingSession;
+class CUpnpAVDevice;
+class CUPnPTrack;
+class CUPnPPlaybackStateMachine;
+class CUPnPValueStateMachine;
+
+// CONSTANTS
+const TInt KMaxDeviceFriendlyName = 256; // from DLNA
+
+/**
+ * Plugin for playing files in a remote upnp renderer.
+ *
+ * This class implements a CPlayerPlugin that plays
+ * both local and remote files in a remote UPnP
+ * renderer. The class uses UPnP framework's AVControl
+ * resource to execute UPnP commands to achieve this.
+ *
+ * @lib upnpmusicplugins.lib
+ * @since S60 v3.1
+ */
+class CUPnPMusicPlayer : public CMPXPlaybackPlugin,
+                         public MUPnPAVRenderingSessionObserver,
+                         public MUPnPRendererSelectorObserver,
+                         public MUPnPTrackObserver,
+                         public MUPnPAudioPolicyObserver
+    {
+
+public:
+    
+    /**
+     * Static 1st phase constructor.
+     * 
+     * @since Series 60 3.1
+     * @param aObs reference to call back interface
+     * @return A new player instance
+     */   
+    static CUPnPMusicPlayer* NewL( MMPXPlaybackPluginObserver& aObs );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */   
+    ~CUPnPMusicPlayer();
+    
+    /**
+     * Compares renderers names
+     *
+     * @since Series 60 3.1
+     * @param aRenderer current renderer to be compared
+     * @return TBool ETrue if match EFalse if not
+     */ 
+    TBool MatchRenderer( const CUpnpAVDevice* aRenderer ) const;
+    
+    /**
+     * Returns currently used renderer device
+     *
+     * @since Series 60 3.1
+     * @return CUpnpAVDevice currently used device
+     */ 
+    CUpnpAVDevice& UsedRendererDevice() const;
+    
+    /**
+     * Set Plugin state to active
+     *
+     * @param aForceInitialise
+     * @since Series 60 3.1
+     */
+    void SetActive( TBool aForceInitialise );
+
+    /**
+     * Public access to the plugin's observer
+     */
+    MMPXPlaybackPluginObserver& Observer() const;
+
+    /**
+     * Public access to the playback state machine
+     */
+    const CUPnPPlaybackStateMachine& PlaybackStateMachine() const;
+
+    /**
+     * Public access to the value state machine
+     */
+    const CUPnPValueStateMachine& ValueStateMachine() const;
+
+    /**
+     * Public access to the track
+     */
+    CUPnPTrack& Track() const;
+
+    /**
+     * State handling when playback has started.
+     * Initiates song duration query.
+     */
+    void HandlePlayStarted();
+
+    /**
+     * State handling when playback is complete.
+     * If there is another instance of plugin waiting, activates it.
+     */
+    void HandlePlayComplete();
+
+
+public: // datatypes
+
+    /**
+     * Defines internal player state
+     * 
+     * EStateUninitialised          - The plugin is in initial state and
+     *                                can not be used
+     * EStateUninitialising         - Uninitialise called.
+     * EStateInitializing           - Initialise for track is called
+     * EStateActive                 - Initialise is complete, plugin is
+     *                                readyto play
+     * EStatePreInitializing        - Plugin is doing initialisation to 
+     *                                the renderer by using
+     *                                SetNextAVTransportURI command.
+     * EStatePreInitialized         - The plugin pre-initialisation phase
+     *                                iscomplete, but plugin is not yet 
+     *                                ready to play
+     * EStateWaiting                - Another instance of the plugin is
+     *                                active. This plugin is just waiting
+     *                                for activation
+     * EStateActiveForceInitialise  - An instance that was waiting is
+     *                                activated, and is indicating that
+     *                                is in working state. However when
+     *                                it receives Play command, it will
+     *                                do normal initialisation
+     *
+     * EStatePauseInActiveForceInitialise
+     *                              - Plugin is on
+     *                                EStateActiveForceInitialise state
+     *                                and pause is called. This case 
+     *                                happens when user skip to the next
+     *                                track when playback is paused.
+     *
+     * EStateError                  - connection failure. In this state
+     *                                the plugin has resources freed and
+     *                                does not accept any requests or
+     *                                notifications. It will ignore all
+     *                                other commands except close
+     *                                
+     * @since Series 60 3.1
+     */   
+    enum TPlayerState
+        {
+        EStateNone = 0,
+        EStateUninitialised,
+        EStateUninitialising,
+        EStateInitializing,
+        EStateActive,
+        EStatePreInitializing,
+        EStatePreInitialized,
+        EStateWaiting,
+        EStateActiveForceInitialise,
+        EStatePauseInActiveForceInitialise,
+        EStateError
+        };
+        
+private:
+
+    /**
+     * Private default constructor
+     *
+     * @since Series 60 3.1
+     * @param aObs reference to call back interface
+     */   
+    CUPnPMusicPlayer( MMPXPlaybackPluginObserver& aObs );
+
+    /**
+     * 2nd phase constructor
+     *
+     * @since Series 60 3.1
+     */   
+    void ConstructL();
+    
+    /**
+     * Initializes a remote or local song for playback. 
+     *
+     * @since Series 60 3.1
+     * @param aSong URI of initialised song
+     */ 
+    void InitialiseTrackL( const TDesC& aSong );
+
+    /**
+     * Uninitialises all local resources
+     * @param aToState the target player state
+     *        (either EStateUninitialised or EStateError)
+     */
+    void UninitialiseTrack( TPlayerState aToState = EStateUninitialised );
+
+    /**
+     * Set URI of track to be playing
+     *
+     * @since Series 60 3.1
+     */
+    void SetURIL();  
+    
+    /**
+     * Changes state internally
+     * @param aNewState a new plugin state
+     *
+     * @since Series 60 3.1
+     */
+    void ChangeState( TPlayerState aNewState );
+
+    /**
+     * A string representing the plugin state
+     * @param aState a state
+     * @return a descriptive string
+     */
+    const TDesC* State( TPlayerState aState ) const;
+
+public: // From CMPXPlaybackPlugin
+
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void InitialiseL( const TDesC& aSong );
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void InitialiseL( RFile& aSong );
+
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void CommandL( TMPXPlaybackCommand aCmd, TInt aData );
+
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void SetL( TMPXPlaybackProperty aProperty, TInt aValue ); 
+
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void ValueL( TMPXPlaybackProperty aProperty ) const;
+            
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void SubPlayerNamesL();
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void SelectSubPlayerL(TInt aIndex) ;
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    const TDesC& SubPlayerName();
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    TInt SubPlayerIndex() const;
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void MediaL( const TArray<TMPXAttribute>& aAttrs );
+    
+    /**
+     * See CMPXPlaybackPlugin
+     */
+    void CancelRequest();
+
+protected: // From MUPnPAVRenderingSessionObserver
+
+    /**
+     * See MUPnPAVRenderingSessionObserver
+     */
+    void VolumeResult( TInt aError, TInt aVolumeLevel,
+        TBool aActionResponse );
+
+    /**
+     * See MUPnPAVRenderingSessionObserver
+     */
+    void MuteResult( TInt aError, TBool aMute, TBool aActionResponse );
+
+    /**
+     * See MUPnPAVRenderingSessionObserver
+     */
+    void InteractOperationComplete( TInt aErrorCode, 
+        TUPnPAVInteractOperation aOperation );
+
+    /**
+     * See MUPnPAVRenderingSessionObserver
+     */
+    void PositionInfoResult( TInt aStatus, const TDesC8& aTrackPosition,
+        const TDesC8& aTrackLength ); 
+    
+    /**
+     * See MUPnPAVRenderingSessionObserver
+     */ 
+    void SetURIResult( TInt aError );
+    
+    /**
+     * See MUPnPAVRenderingSessionObserver
+     */
+    void SetNextURIResult( TInt aError );
+    
+    /**
+     * See MUPnPAVRenderingSessionObserver
+     */
+    void MediaRendererDisappeared( TUPnPDeviceDisconnectedReason aReason );
+    
+protected: // From MUPnPAVSessionObserverBase
+
+    /**
+     * See MUPnPAVSessionObserverBase
+     */    
+    void ReserveLocalMSServicesCompleted( TInt aError );
+
+protected: // From MUPnPRendererSelectorObserver
+
+    /**
+     * See MUPnPRendererSelectorObserver
+     */
+    void HandleSubPlayerNames( const MDesCArray* aSubPlayers, 
+        TBool aComplete, TInt aError );
+    
+    /**
+     * See MUPnPRendererSelectorObserver
+     */
+    void RendererListChanged();
+
+protected: // From MUPnPTrackObserver
+
+    /**
+     * See MUPnPTrackObserver
+     */
+    void ResolveURIComplete( TInt aError );
+
+protected: // From MUPnPAudioPolicyObserver
+
+    /**
+     * See MUPnPAudioPolicyObserver
+     */
+    void AudioConflict( TInt aError );
+
+private:
+    
+    /**
+     * Pointer to the plugin that is 
+     * active at the time
+     */
+    static CUPnPMusicPlayer*            iActivePlugIn;
+    
+    /**
+     * Pointer to the plugini that is
+     * waiting to activate (pre-initialized)
+     */
+    static CUPnPMusicPlayer*            iNextPlugIn;
+         
+    /**
+     * The singleton for AVController resources
+     */    
+    CUPnPSingleton*                     iSingleton;
+    
+    /**
+     * Pointer to renderer session
+     */
+    MUPnPAVRenderingSession*            iRendererSession;
+     
+    /**
+     * Pointer to playback state machine
+     */
+    CUPnPPlaybackStateMachine*          iPlaybackStateMachine;
+
+    /**
+     * Pointer to value state machine
+     */
+    CUPnPValueStateMachine*             iValueStateMachine;
+                      
+    /**
+     * UPnP track
+     */            
+    CUPnPTrack*                         iTrack;
+
+    /**
+     * UPnP Audio policy handler
+     */
+    CUPnPAudioPolicy*                   iAudioPolicy;
+
+    /**
+     * The currently active device. OWNED
+     */
+    CUpnpAVDevice*                      iSelectedRenderer;
+
+    /**
+     * The currently active device
+     */
+    TBuf<KMaxDeviceFriendlyName>        iSelectedRendererName;
+
+    /**
+     * The currently active device index
+     */
+    TInt                                iSelectedRendererIndex;
+
+    /**
+     * Current player state
+     */
+    TPlayerState                        iPlayerState;
+    
+    /**
+     * Tells is remote device ready to give playback information
+     * (volume, duration and position).
+     */
+    TBool                               iIsReady;
+
+    };
+
+#endif // __CUPNPMUSICPLAYER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnpplaybackstatemachine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,317 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Class for retrieving and selecting media renderers
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPPLAYBACKSTATEMACHINE_H
+#define C_UPNPPLAYBACKSTATEMACHINE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpmusicperiodizer.h"
+
+// FORWARD DECLARATIONS
+class CUPnPMusicPlayer;
+class MUPnPPlayBackObserver;
+class MUPnPAVRenderingSession;
+
+/**
+ * Class for handling playback state machine functionality
+ *
+ * @lib upnpmusicplugins.lib
+ * @since S60 v3.1
+ */
+class CUPnPPlaybackStateMachine : public CBase, 
+                                  public MUPnPMusicPeriodizerObserver
+    {
+
+public:
+
+    /**
+     * Static 1st phase constructor
+     *
+     * @since Series 60 3.1
+     * @param aParent the parent plugin instance
+     * @param aRenderingSession for playback commands
+     */
+    static CUPnPPlaybackStateMachine* NewL( 
+        CUPnPMusicPlayer& aParent,
+        MUPnPAVRenderingSession& aRenderingSession );
+
+    
+    /**
+     * 2nd phase constructor
+     *
+     * @since Series 60 3.1
+     */   
+    void ConstructL();
+    
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */
+    virtual ~CUPnPPlaybackStateMachine();
+
+    /** 
+     * Executes a command on the selected song
+     *
+     * @param aCmd a command
+     * @since Series 60 3.1
+     */
+    void CommandL( TMPXPlaybackCommand aCmd );
+
+    /**
+     * Sets the playback position within the current track
+     * @param aPosition position in milliseconds
+     */
+    void PositionL( TInt aPosition );
+
+    /**
+     * Stops playback, does not provide any ACK event
+     */
+    void SilentStopL();
+
+    /**
+     * Cancels any ongoing operation
+     * (actually it just resets the state so the result will be ignored
+     * and not reported)
+     */
+    void Cancel();
+
+    /**
+     * Indicates that the requested interaction operation (play, stop, etc.)
+     * is complete.
+     *
+     * @since Series 60 3.1
+     * @param aErrorCode TInt error code
+     * @param aOperation TInt operation (TAVInteractOperation)
+     * @return None
+     */
+    void InteractOperationComplete( TInt aErrorCode, 
+        TUPnPAVInteractOperation aOperation );
+
+    /**
+     * End any ongoing operation
+     * (actually it just resets the state so the result will play next song
+     */
+    void PlayOvertimeEnd(); 
+
+private:
+
+    /**
+     * Private default constructor
+     *
+     * @since Series 60 3.1
+     * @param aParent the parent plugin instance
+     * @param aRenderingSession for playback commands
+     */
+    CUPnPPlaybackStateMachine(
+        CUPnPMusicPlayer& aParent,
+        MUPnPAVRenderingSession& aRenderingSession );
+
+public: // datatypes used in this class
+
+    /**
+     * Defines internal state
+     *
+     * @since Series 60 3.1
+     */   
+    enum TState
+        {
+        EStateStopped,
+        EStatePlaying,
+        EStatePaused,
+        EStateUnknown,  // this state entered if a command fails.
+                        // every state transition is accepted.
+        };
+
+    /**
+     * current type of operation
+     */
+    enum TOperationType
+        {
+        EOperationNone, // no pending operations
+        EOperationCommand, // executing a command
+        EOperationPositionToZero, // adjusting position to zero
+        EOperationPositionToZeroDuringPause, // ...during pause state
+        EOperationSilentStop // stop without ack
+        };
+
+    /**
+     * An internal operation class
+     */
+    class TOperation
+        {
+        public:
+        /** construction */
+        TOperation( TOperationType aType )
+            : iType( aType ) {}
+        TOperation( TMPXPlaybackCommand aCmd )
+            : iType( EOperationCommand ), iCmd( aCmd ) {}
+        /** setters */
+        void operator=( TOperationType aType )
+            {
+            iType = aType;
+            }
+        void operator=( TMPXPlaybackCommand aCmd )
+            {
+            iType = EOperationCommand; iCmd = aCmd;
+            }
+        void Reset()
+            {
+            iType = EOperationNone;
+            }
+        /** comparision */
+        TBool operator==( TOperationType aType )
+            {
+            return ( iType == aType );
+            }
+        TBool operator==( TMPXPlaybackCommand aCmd )
+            {
+            return ( iType == EOperationCommand && iCmd == aCmd );
+            }
+        TBool None()
+            {
+            return ( iType == EOperationNone );
+            }
+        /** identifies the operation type */
+        TOperationType iType;
+        /** in case the operation is a command, the command */
+        TMPXPlaybackCommand iCmd;
+        };
+
+protected: // internal methods
+
+    /**
+     * Handles the close command internally
+     */
+    void HandleCloseL();
+
+    /**
+     * Checks if operations are in the queue, and executes
+     */
+    void CheckOperationInQueueL();
+
+    /**
+     * Handle timers when playback start
+     */
+    void TimePlay();
+
+    /**
+     * Handle timers when pause
+     */
+    void TimePause();
+
+    /**
+     * Handle timers when continuing from pause
+     */
+    void TimeContinue();
+
+    /**
+     * Handle timers when stopped
+     * Guesses if playback was completed or stopped by user.
+     * This is estimated by comparing track play time and track duration.
+     * @return ETrue if we guess the track playback was completed
+     */
+    TBool TimeStop();
+
+    /**
+     * Changes the internal state
+     * @param aNewState the state to enter
+     */
+    void ChangeState( TState aNewState );
+
+    /**
+     * textual representation of a state
+     */
+    const TDesC* State( TState aState );
+
+protected: // From MUPnPPeriodizerObserver
+
+    /**
+     * See MUPnPMusicPeriodizerObserver
+     */
+    void HandlePeriod();
+    
+   /**
+     * See MUPnPMusicPeriodizerObserver
+     */ 
+    void HandlePeriodForEnd();  
+
+private: // data
+
+    /**
+     * Parent plugin instance
+     */ 
+    CUPnPMusicPlayer&           iParent;
+
+    /**
+     * Rendering session
+     */ 
+    MUPnPAVRenderingSession&    iRendererSession;
+
+    /**
+     * Playback state
+     */ 
+    TState                      iState;
+
+    /**
+     * currently ongoing operation
+     */
+    TOperation                  iCurrentOperation;
+
+    /**
+     * queue of operations pending
+     */
+    RArray<TOperation>          iOperationQueue;
+
+    /**
+     * time when playback started
+     */
+    TTime                       iPlayMark;
+
+    /**
+     * time when pause started
+     */
+    TTime                       iPauseMark;
+
+    /**
+     * total time spent in pause (in milliseconds)
+     */
+    TInt                        iPausetime;
+    
+    /**
+     * Timer support
+     * Own.
+     */
+    CUPnPMusicPeriodizer*       iPeriodizer;
+
+     /**
+     * Timer support
+     * Own.
+     */
+    CUPnPMusicPeriodizer*       iPeriodizerEnd;
+
+    };
+
+
+#endif // C_UPNPPLAYBACKSTATEMACHINE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnppluginserrortranslation.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      translate all plugins error code for music player
+*
+*/
+
+
+
+
+
+#ifndef T_UPNPPLUGINSERRORTRANSLATION_H
+#define T_UPNPPLUGINSERRORTRANSLATION_H
+
+// INCLUDES
+#include <e32std.h>
+/**
+ * Class for translate all plugins error code for music player
+ *
+ * @since S60 v3.1
+ */
+class TUpnpPluginsErrorTranslation
+{
+public:
+
+    /**
+     * Static function for translate error
+     *
+     * @since Series 60 3.1
+     * @param aError the upnp plugins error code
+     * @return a valid error code
+     */
+    static TInt ErrorTranslate( TInt aError );
+};
+
+#endif /*UPNPPLUGINSERRORTRANSLATION_H*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnprendererselectorobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Observer interface used in CUPnPSingleton
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPRENDERERSELECTOROBSERVER_H
+#define M_UPNPRENDERERSELECTOROBSERVER_H
+
+/**
+ * Observer interface for receiving a notification when the renderer 
+ * list has changed
+ *
+ * @lib upnpmusicplugins.lib
+ * @since S60 v3.1
+ */
+class MUPnPRendererSelectorObserver
+    {
+
+public:
+
+    /**
+     * Notification for the sub player list is available
+     *
+     * @since Series 60 3.1
+     * @param aSubPlayers a list of sub players
+     * @param aComplete ETrue no more sub players. EFalse more subplayer 
+     *                  expected
+     * @param aError Error code
+     */
+     virtual void HandleSubPlayerNames( const MDesCArray* aSubPlayers,
+         TBool aComplete, TInt aError ) = 0;
+        
+    /**
+     * Notification for the sub player list has changed
+     *
+     * @since Series 60 3.1
+     */
+     virtual void RendererListChanged() = 0;
+     
+    };
+
+
+#endif // M_UPNPRENDERERSELECTOROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnpsingleton.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,250 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Singleton class for main upnp related services
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPSINGLETON_H
+#define C_UPNPSINGLETON_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpavdeviceobserver.h"
+#include "upnpmusicperiodizer.h"
+
+// FORWARD DECLARATIONS
+class MUPnPAVController;
+class MUPnPRendererSelectorObserver;
+class CUpnpAVDevice;
+class CUpnpAVDeviceList;
+class MUPnPAVRenderingSession;
+
+/**
+ * A singleton class that provides main upnp services
+ *
+ * The class owns the AVController client session. Plugins that
+ * use this singleton class may then share the same session, or
+ * start rendering sessions in it.
+ *
+ * The class also provides device discovery routines.
+ *
+ * @lib upnpmusicplugins.lib
+ * @since S60 v3.1
+ */
+class CUPnPSingleton : public CBase,
+                       public MUPnPAVDeviceObserver,
+                       public MUPnPMusicPeriodizerObserver
+    {
+
+private:
+
+    /**
+     * State of renderer selection subprocess
+     *
+     * @since Series 60 3.1
+     */   
+    enum TSelectorState
+        {
+        EStateWaiting, // waiting in device discovery phase
+        EStateComplete, // device discovery complete, still updating list
+        EStateReady, // steady state - list is untouched
+        EStateError, // WLAN connection lost
+        };
+    
+public:
+
+    /**
+     * Singleton constructor
+     *
+     * @since Series 60 3.1
+     * @return a new instance
+     */
+    static CUPnPSingleton* GetInstanceL();
+
+    /**
+     * Singleton destructor
+     *
+     * @since Series 60 3.1
+     * @param aInstance the instance pointer to lose
+     */
+    static void LoseInstance( CUPnPSingleton* aInstance );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */
+    ~CUPnPSingleton();
+
+    /**
+     * Get list of renderers from AVController. Returns names (async)
+     *
+     * @param aObserver the observer to receive the response
+     * @since Series 60 3.1
+     */
+    void GetRendererNamesL( MUPnPRendererSelectorObserver& aObserver );
+
+    /**
+     * Cancels an asynchronous query if it is pending
+     */
+    void CancelGetRendererNames();
+
+    /**
+     * Selects renderer by index
+     *
+     * @since Series 60 3.1
+     * @param aIndex Index of renderer to be selected
+     */
+    const CUpnpAVDevice* SelectRendererByIndexL( TInt aIndex );
+
+    /**
+     * Return used renderer device
+     *
+     * @since Series 60 3.1
+     * @return CUpnpAVDevice used renderer device
+     */
+    const CUpnpAVDevice* DefaultDevice();
+
+    /**
+     * Provides reference to the AVController resource
+     */
+    MUPnPAVController& AVC();
+
+    
+protected: // From MUPnPAVDeviceObserver
+
+    /**
+     * See MUPnPAVDeviceObserver
+     */
+     void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
+
+    /**
+     * See MUPnPAVDeviceObserver
+     */
+     void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
+     
+    /**
+     * See MUPnPAVDeviceObserver
+     */
+     void WLANConnectionLost();
+
+protected: // From MUPnPMusicPeriodizerObserver 
+
+    /**
+     * See MUPnPMusicPeriodizerObserver
+     */
+    void HandlePeriod();
+    
+private:
+
+    /**
+     * Clears the current device cache and copies the renderer list again
+     * from AVController
+     */
+    void CacheRendererListL();
+
+    /**
+     * Sends an asynchronous response for subplayer names to observer.
+     * Uses the class members as parameters.
+     * @param aComplete the complete parameter to use in callback
+     * @param aError the error code to be transmitted
+     */
+    void DeliverNamesToObserverL( TBool aComplete, TInt aError = KErrNone );
+
+    /**
+     * Checks if the device is available. If a device is not available, it
+     * has been disappeared. The method uses a proprietary flag.
+     * @param aDevice the device to check
+     * @return EFalse if the device has disappeared.
+     */
+    TBool IsAvailable( const CUpnpAVDevice& aDevice ) const;
+
+    /**
+     * Sets a device availability flag. If a device is not available, it
+     * has been disappeared. The method uses a proprietary flag.
+     * @param aDevice the device to set
+     * @param aAvailable if false, the device has disappeared.
+     */
+    void SetAvailable( CUpnpAVDevice& aDevice, TBool aAvailable ) const;
+
+    /**
+     * Private default constructor
+     *
+     * @since Series 60 3.1
+     */
+    CUPnPSingleton();
+
+    /**
+     * 2nd phase constructor
+     *
+     * @since Series 60 3.1
+     */
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Reference count
+     */
+    static TInt                         iInstanceCount;
+
+    /**
+     * The singleton
+     */
+    static CUPnPSingleton*              iInstance;
+
+    /**
+     * Pointer to AVController
+     */
+    MUPnPAVController*                  iAVController;
+
+    /**
+     * Temporary pointer to renderer selector observer 
+     */
+    MUPnPRendererSelectorObserver*      iRendererselectorObserver;
+
+    /**
+     * default device index
+     */
+    static TInt                         iDefaultRendererIndex;
+    
+    /**
+     * Timer support
+     */
+    CUPnPMusicPeriodizer*               iPeriodizer;
+                       
+    /**
+     * Array of renderer
+     */        
+    RPointerArray<CUpnpAVDevice>        iMediaRenderers;
+
+    /**
+     * Current selector state
+     */
+    TSelectorState                      iSelectorState;
+
+    /**
+     * Indicator for activity during next call to GetSubplayerNames
+     */
+    TSelectorState                      iStateChangeDuringNextCall;
+
+    };
+
+
+#endif // C_UPNPSINGLETON_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnptrack.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,372 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      class for containing and obtaining music track-specific
+*                data from media server
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPTRACK_H
+#define C_UPNPTRACK_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpitemresolverobserver.h"
+#include "upnpresourceselector.h"
+
+// FORWARD DECLARATIONS
+class TMPXAttribute;
+class TMPXAttributeData;
+class MUPnPAVController;
+class MUPnPAVBrowsingSession;
+class MUPnPTrackObserver;
+class MMPXPlaybackPluginObserver;
+class CUpnpItem;
+class MUPnPItemResolver;
+
+// CONSTANTS
+const TInt KMaxElementSize = 256;
+
+
+/**
+ *  A helper class for containing and obtaining music track-specific data
+ *  from media server
+ *
+ *  @lib upnpmusicplugins.lib
+ *  @since S60 v3.1
+ */
+class CUPnPTrack
+    : public CBase
+    , public MUPnPItemResolverObserver
+    {
+
+public: // datatypes 
+
+    /**
+     * Defines direction of playback
+     *
+     * EDirectionRemote  - Used in local to remote and remote to remote
+     *                     playback cases 
+     * EDirectionLocal   - Used only in remote to local case.
+     * 
+     */
+    enum TPlaybackDirection
+        {
+        EDirectionRemote = 0,
+        EDirectionLocal
+        };
+public:
+
+    /**
+     * static constructor
+     *
+     * @param aAvController AVController
+     * @return a new CUPnPTrack instance
+     * @since Series 60 3.1
+     */
+    static CUPnPTrack* NewL( MUPnPAVController& aAvController );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */
+    virtual ~CUPnPTrack();
+
+    /**
+     * Parse and saves the song path from given descriptor
+     *
+     * @param aCodedTrackUri track URI that may be coded
+     * @param atrackObserver observer to notify when resolve is complete
+     * @param aPlaybackDirection direction of playback
+     * @since Series 60 3.1
+     */
+    void ResolveURIL( const TDesC& aCodedTrackUri,
+        MUPnPTrackObserver& aTrackObserver, 
+        TPlaybackDirection aPlaybackDirection );
+
+    /**
+     * Returns the original URI given in initialisation
+     *
+     * @return TDesC URI
+     * @since Series 60 3.1
+     */
+    const TDesC& URI() const;
+
+    /**
+     * Returns the true UPNP URI of a remote track
+     *
+     * @return TDesC8 URI
+     * @since Series 60 3.1
+     */
+    const TDesC8& UpnpURI() const;
+
+    /**
+     * Returns the remote upnp item that represents the track
+     *
+     * @return CUpnpItem the item reference
+     * @since Series 60 3.1
+     */
+    const CUpnpItem& UpnpItem() const;
+    
+    /**
+     * Returns the file path of local item 
+     *
+     * @return TDesC file path
+     * @since Series 60 3.1
+     */
+    const TDesC& FilePath() const;
+
+    /**
+     * Return location of track. ETrue = remote. EFalse = local
+     *
+     * @return TBool location of track
+     * @since Series 60 3.1
+     */
+    TBool IsRemote() const;
+
+    /**
+     * Get metadata information for track from media server
+     * 
+     * @param aAttrs list of wanted media propeties
+     * @param aObs the plugin observer that will receive the metadata
+     * @since Series 60 3.1
+     */
+    void GetMetaDataL( const TArray<TMPXAttribute>& aAttrs,
+        MMPXPlaybackPluginObserver& aObs );
+
+    /**
+     * Delivers media changed event to playback framework
+     * @param aObs the plugin observer
+     */
+    void SendMediaChangedEventL(
+        MMPXPlaybackPluginObserver& aObs );
+
+    /**
+     * current track duration
+     * @return track duration in milliseconds
+     */
+    TInt TrackDuration();
+
+    /**
+     * overrides current track duration. Normally a track can provide
+     * duration information for current remote track. However sometimes
+     * the data is missing. In this case it can be set using this method.
+     * @param aMilliseconds the duration in milliseconds
+     */
+    void SetTrackDuration( TInt aMilliseconds );
+
+    /**
+     * 
+     */
+    void Delete();
+    
+protected: // MUPnPItemResolverObserver
+
+    /**
+     * See MUPnPItemResolverObserver
+     */
+    void ResolveComplete( const MUPnPItemResolver& aResolver, TInt aError );
+
+private:
+
+    /**
+     * Default constructor
+     *
+     * @param aAvController AVController
+     * @since Series 60 3.1
+     */
+    CUPnPTrack( MUPnPAVController& aAvController );
+
+    /**
+     * 2nd phase constructor
+     *
+     * @since Series 60 3.1
+     */
+    void ConstructL();
+    
+    /**
+     * Parse and save HttpURI, media server id and object id from 
+     * given descriptor
+     *
+     * @since Series 60 3.1
+     * @param aSong descriptor to be parsed
+     */
+    void ParsePiecesL( const TDesC& aSong );
+    
+    /**
+     * See MUPnPAVBrowsingSessionObserver
+     *
+     * @since Series 60 3.1
+     */
+    void BrowseResponseL( const TDesC8& aBrowseResponse, TInt aError );
+
+    /**
+     * Starts a browsing session within the object
+     */
+    void StartBrowsingSessionL();
+
+    /**
+     * Stops a browsing session within the object
+     */
+    void StopBrowsingSession();
+
+    /**
+     * Delivers metadata to observer
+     * @param aAttrs list of wanted media propeties
+     * @param aObs the plugin observer that will receive the metadata
+     * @param aError error code to be delivered to client
+     */
+    void DeliverMedataL( const TArray<TMPXAttribute>& aAttrs,
+        MMPXPlaybackPluginObserver& aObs, TInt aError = KErrNone );
+
+    /**
+     * Fills item metadata into given MediaL object
+     * @param aMedia the MPX media object to fill metadata into
+     * @param aAttrs list of metadata elements to fill
+     */
+    void FillMediaFromItemL( CMPXMedia& aMedia,
+        const TArray<TMPXAttribute>& aAttrs );
+
+    /**
+     * Tests if given attribute exists in the attribute array
+     * returns true if it is found.
+     * @param aAttrs the attribute array
+     * @param aAttrData the attribute to look for
+     * @return ETrue if it was found, EFalse otherwise
+     */
+    TBool Exists( const TArray<TMPXAttribute>& aAttrs,
+        const TMPXAttributeData& aAttrData ) const;
+
+    /**
+     * A helper method that converts text from 8-bit to 16-bit.
+     * Note that a member buffer is used that has static length.
+     */
+    const HBufC16* CUPnPTrack::To16LC( const TDesC8& aText );
+
+private: // data
+
+    /**
+     * Defines location of track
+     *
+     * @since Series 60 3.1
+     */   
+    enum TTrackLocation
+        {
+        ETrackLocationLocal = 0,
+        ETrackLocationRemote
+        };
+    
+    /**
+     * Defines track state
+     *
+     * @since Series 60 3.2
+     */  
+    enum TTrackState
+        {
+        EStateIdle,
+        EStateResolving,
+        EStateSelfDestruct,
+        EStateReady
+        };
+        
+
+    /**
+     * Location of track
+     */
+    TTrackLocation                      iTrackLocation;
+
+    /**
+     * URI for local track
+     */
+    HBufC*                              iOriginalURI;
+
+    /**
+     * Media server name 
+     */
+    HBufC8*                             iMediaServer;
+
+    /**
+     * Object id
+     */
+    HBufC8*                             iObjectId;
+
+    /**
+     * The AV Controller resource
+     */
+    MUPnPAVController&                  iAvController;
+
+    /**
+     * The rendering session
+     */
+    MUPnPAVBrowsingSession*             iBrowsingSession;
+
+    /**
+     * Track observer during resolving phase
+     */
+    MUPnPTrackObserver*                 iTrackObserver;
+
+    /**
+     * Observer for metadata queries
+     * Stored in case metadata is not ready yet when queried
+     */
+    MMPXPlaybackPluginObserver*         iMetadataObserver;
+
+    /**
+     * Attributes in metadata query
+     */
+    RArray<TMPXAttribute>               iQueriedAttributes;
+
+    /**
+     * temp buffer used in 8->16 -bit conversion
+     */
+    TBuf16<KMaxElementSize>             iTempBuf;
+
+    /**
+     * track duration in milliseconds (from some other source)
+     */
+    TInt                                iTrackDuration;
+
+    /**
+     * Resolver for remote or local item (Owned).  
+     */
+    MUPnPItemResolver*                  iItemResolver;
+    
+    /**
+     * Selectors for remote item.
+     */
+    TUPnPSelectDefaultResource          iDefaultSelector;
+    
+    /**
+     * Selectors for local item.
+     */
+    TUPnPSelectFirstResource            iFirstSelector;
+    
+    /**
+     * Tells is resolve item completed.
+     */
+    TBool                               iIsItemSolved;
+    
+    /**
+     * Current track state
+     */
+    TTrackState                         iState;
+    };
+
+
+#endif // C_UPNPTRACK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnptrackobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      announces notifications from helper class
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPTRACKOBSERVER_H
+#define M_UPNPTRACKOBSERVER_H
+
+/**
+ * An interface for observing changes in the track state. 
+ * The class announces notifications through this interface
+ * to the plugin classes that use it.
+ *
+ * @lib upnpmusicplugins.lib
+ * @since S60 v3.1
+ */
+class MUPnPTrackObserver
+    {
+
+public:
+
+    /**
+     * URI resolving is complete
+     *
+     * @since Series 60 3.1
+     * @param aError error code
+     */
+    virtual void ResolveURIComplete( TInt aError ) = 0;
+
+    };
+
+
+#endif // M_UPNPTRACKOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/inc/upnpvaluestatemachine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Class for retrieving and selecting media renderers
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPVALUESTATEMACHINE_H
+#define C_UPNPVALUESTATEMACHINE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxplaybackframeworkdefs.h>
+
+// FORWARD DECLARATIONS
+class CUPnPMusicPlayer;
+class MUPnPAVRenderingSession;
+
+
+
+/**
+ * Class for handling playback state machine functionality
+ *
+ * @lib upnpmusicplugins.lib
+ * @since S60 v3.1
+ */
+class CUPnPValueStateMachine : public CBase
+    {
+
+public: // construction / destruction
+
+    /**
+     * Static 1st phase constructor
+     *
+     * @since Series 60 3.1
+     * @param aParent the parent plugin instance
+     * @param aRenderingSession for playback commands
+     */
+    static CUPnPValueStateMachine* NewL( 
+        CUPnPMusicPlayer& aParent,
+        MUPnPAVRenderingSession& aRenderingSession );
+
+    /**
+     * Destructor
+     *
+     * @since Series 60 3.1
+     */
+    virtual ~CUPnPValueStateMachine();
+
+public: // datatypes used in this class
+   
+    /**
+     * current type of operation
+     */
+    enum TOperationType
+        {
+        EOperationNone,     // no operation going on
+        EOperationValue,    // value get
+        EOperationSet,      // value set
+        EOperationDurationQuery, // internal duration query
+        EOperationPositionQuery, // internal position query
+        EOperationVolumeQuery, // internal volume query
+        EOperationMute // internal mute
+        };
+
+    /**
+     * An internal operation class
+     */
+    class TOperation
+        {
+        public:
+        /** construction */
+        TOperation( TOperationType aType )
+            : iType( aType ) {}
+        TOperation( TOperationType aType, TInt aValue )
+            : iType( aType )
+            , iValue( aValue ) {}
+        TOperation( TMPXPlaybackProperty aProperty, TInt aValue )
+            : iType( EOperationSet )
+            , iProperty( aProperty )
+            , iValue( aValue ) {}
+        TOperation( TMPXPlaybackProperty aProperty )
+            : iType( EOperationValue )
+            , iProperty( aProperty ) {}
+
+        /** setters */
+        void operator=( TOperationType aType )
+            {
+            iType = aType;
+            }
+        void Set( TMPXPlaybackProperty aProperty, TInt aValue )
+            {
+            iType = EOperationSet;
+            iProperty = aProperty;
+            iValue = aValue;
+            }
+        void Set( TMPXPlaybackProperty aProperty )
+            {
+            iType = EOperationValue;
+            iProperty = aProperty;
+            }
+        void Reset()
+            {
+            iType = EOperationNone;
+            }
+        /** comparision */
+        TBool operator==( TOperationType aType )
+            {
+            return ( iType == aType );
+            }
+        TBool Compare( TOperationType aType, TMPXPlaybackProperty aProperty )
+            {
+            return ( iType == aType && iProperty == aProperty );
+            }
+        TBool None()
+            {
+            return ( iType == EOperationNone );
+            }
+        /** identifies the operation type */
+        TOperationType iType;
+        /** playback property, if op == Value or Set */
+        TMPXPlaybackProperty iProperty;
+        /** playback property value, if op == Set */
+        TInt iValue;
+        };
+
+    /**
+     * A result of validation query.
+     * Indicates what to do with a Value- or a Set- call
+     */
+    enum TValidationResult
+        {
+        EHandle, // handle the call in value state machine
+        EHandleStatic, // handle the call statically in v.s.m.
+        EErrorNotReady, // async error (KErrNotReady)
+        EErrorNotSupported, // async error (KErrNotSupported)
+        EIgnore // do absolutely nothing
+        };
+
+public: // services
+    
+   /**
+    * A method to copy some static renderer-specific values from
+    * another instance of a state machine. Note that one instance is
+    * track specific, so track specific cached values are NOT copied,
+    * (track duration etc.) but renderer specific values are copied
+    * (volume etc)
+    * @param aOther another instance to copy values from
+    */
+    void CopyValues( const CUPnPValueStateMachine& aOther );
+
+   /**
+    * See CMPXPlaybackPlugin
+    */
+    void SetL( TMPXPlaybackProperty aProperty, TInt aValue );
+
+   /**
+    * See CMPXPlaybackPlugin
+    */
+    void ValueL( TMPXPlaybackProperty aProperty );
+    
+   /**
+    * See MUPnPRenderiongSessionObserver
+    */
+    void VolumeResult( TInt aError, TInt aVolumeLevel,
+        TBool aActionResponse );
+    
+   /**
+    * See MUPnPRenderiongSessionObserver
+    */
+    void MuteResult( TInt aError, TBool aMute, TBool aActionResponse );
+    
+   /**
+    * See MUPnPRenderiongSessionObserver
+    */
+    void PositionInfoResult( TInt aStatus, const TDesC8& aTrackPosition,
+        const TDesC8& aTrackLength );
+
+    /**
+     * Initiates a duration request, which will be reported to
+     * the plugin observer as a change event
+     */
+    void DurationQueryL();
+    
+    /**
+     * Initiates a position request
+     */
+    void PositionQueryL();
+
+    /**
+     * Initiates a volume request, which will be reported to
+     * the plugin observer as a change event
+     */
+    void VolumeQueryL();
+
+    /**
+     * Initiates an internal mute request, which will not be reported.
+     * @param aMute if other than zero, mute will be activated
+     */
+    void MuteRequestL( TInt aMute );
+
+    /**
+     * Validates a Value- or Set- call with given property in given
+     * player state. There will be a result indicating what to do with
+     * the call.
+     * @param aProperty the property to be either get or set
+     * @param aSetting true if setting the value, false if getting
+     * @param aPlayerState state of the player plugin
+     * @param aIsReady is remote device to gíve playback information
+     * @return result of validation
+     */
+    static TValidationResult ValidatePropertyInState(
+        TMPXPlaybackProperty aProperty,
+        TBool aSetting,
+        TInt aPlayerState,
+        TBool aIsReady );
+
+    /**
+     * A static version of Value query - this one is capable of handling
+     * some fixed Value queries that do not need network resources
+     */
+    static void ValueStatic(
+         TMPXPlaybackProperty aProperty,
+         MMPXPlaybackPluginObserver& aPlaybackObs );
+
+    /**
+     * Cancels any ongoing operation
+     * (actually it just resets the state so the result will be ignored
+     * and not reported)
+     */
+    void Cancel();
+
+private:
+
+    /**
+     * Private default constructor
+     *
+     * @since Series 60 3.1
+     * @param aParent the parent plugin instance
+     * @param aRenderingSession for playback commands
+     */
+    CUPnPValueStateMachine( 
+        CUPnPMusicPlayer& aParent,
+        MUPnPAVRenderingSession& aRenderingSession );
+
+    /**
+     * Checks if operations are in the queue, and executes
+     */
+    void CheckOperationInQueueL();
+    
+    /**
+     * Check if given property are in queue
+     * @param aProperty property to be searched
+     * @return Etrue if found
+     */
+    TBool FoundFromQueue( TMPXPlaybackProperty aProperty );
+
+private: // data
+        
+    /**
+     * Parent plugin instance
+     */ 
+    CUPnPMusicPlayer&                   iParent;
+    
+    /**
+     * Rendering session
+     */ 
+    MUPnPAVRenderingSession&            iRendererSession;
+    
+    /**
+     * currently ongoing operation
+     */
+    TOperation                          iCurrentOperation;
+
+    /**
+     * queue of operations pending
+     */
+    RArray<TOperation>                  iOperationQueue;
+
+    /**
+     * current renderer volume level.
+     * cached internally to avoid unnecessary message traffic.
+     */
+    TInt                                iRendererVolume;
+
+    /**
+     * current renderer muted state (1 = muted, 0 = normal)
+     * cached internally to avoid unnecessary message traffic.
+     */
+    TInt                                iRendererMuted;
+
+    };
+
+
+#endif // C_UPNPVALUESTATEMACHINE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/20007568.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resource definitions for UPnP Plugin
+*
+*/
+
+
+
+
+
+
+#include <ecom/registryinfo.rh>
+#include <mpxplaybackplugin.hrh>
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = 0x20007568;
+    // Declare array of interface info
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = KMPXPlaybackPluginInterfaceUid;
+            implementations = 
+                {
+                // Info for UPnP Browser
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x200075D8;
+                    version_no = 2;
+                    display_name       = "Remote UPnP Player";
+                    default_data       = "UPnP";
+                    opaque_data        = "<s>*<e>.mp3;.aac;.3gp"
+                                         "<t>"EPbRemote"</t>";
+                    }       
+                };
+            },
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = KMPXPlaybackPluginInterfaceUid;
+            implementations = 
+                {
+                // Info for UPnP Browser
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x200075D9;
+                    version_no = 2;
+                    display_name       = "Download proxy";
+                    default_data       = "UPnP";
+                    opaque_data        = "<s>upnp<e>.mp3;.aac;.3gp"
+                                         "<t>"EPbLocal"</t>";
+                    }       
+                };
+            }                                   
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnpaudiopolicy.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Audio policy implementation for upnp remote plugin
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <mmf/common/mmfbase.h> // MMF base classes
+
+#include <S60FourCC.h>
+#include <AudioPreference.h>
+#include "upnpaudiopolicy.h" // myself
+
+_LIT( KComponentLogfile, "musicplugins.txt");
+#include "upnplog.h"
+// CONSTANTS
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPAudioPolicy::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAudioPolicy* CUPnPAudioPolicy::NewL(
+    MUPnPAudioPolicyObserver& aObserver )
+    {
+    __LOG( "CUPnPAudioPolicy::NewL 1" );
+    CUPnPAudioPolicy* self =
+        new(ELeave) CUPnPAudioPolicy( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAudioPolicy::CUPnPAudioPolicy
+// Default constructor.
+// --------------------------------------------------------------------------
+// 
+CUPnPAudioPolicy::CUPnPAudioPolicy(
+    MUPnPAudioPolicyObserver& aObserver )
+    : iObserver( aObserver )
+    , iAudioPolicyState( EStateUninitialised )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::ConstructL
+// --------------------------------------------------------------------------
+//  
+void CUPnPAudioPolicy::ConstructL()
+    {
+    __LOG( "CUPnPAudioPolicy::ConstructL" );
+    iDevSound = CMMFDevSound::NewL();
+    __LOG( "CUPnPAudioPolicy::ConstructL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAudioPolicy::CUPnPAudioPolicy
+// destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAudioPolicy::~CUPnPAudioPolicy()
+    {
+    __LOG( "CUPnPAudioPolicy destructor" );
+    delete iDevSound;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAudioPolicy::PlayL
+// requests for playback start
+// --------------------------------------------------------------------------
+//
+void CUPnPAudioPolicy::PlayL()
+    {
+    __LOG( "CUPnPAudioPolicy::PlayL()" );
+    __LOG1( "CUPnPAudioPolicy::PlayL in state(%d)", TInt(iAudioPolicyState) );
+
+    // Ignore if already on playing state
+    if( iAudioPolicyState != EStatePlaying )
+        {
+        __LOG( "CUPnPAudioPolicy: initialising devsound" );
+        TRAPD( err, iDevSound->InitializeL(
+            *this, KFourCCCodeNokiaUPnP, EMMFStatePlaying ) );
+        if( err != KErrNone )
+            {
+            __LOG1( "CUPnPAudioPolicy: DevSound initialize err:(%d)",err );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAudioPolicy::Stop
+// indicates playback will stop
+// --------------------------------------------------------------------------
+//
+void CUPnPAudioPolicy::Stop()
+    {
+    __LOG( "CUPnPAudioPolicy::Stop()" );
+    __LOG1( "CUPnPAudioPolicy::Stop in state(%d)", TInt(iAudioPolicyState) );
+
+    // Ignore if already on stopped state
+    if( iAudioPolicyState == EStatePlaying )
+        {
+        iAudioPolicyState = EStateStopped;
+        iDevSound->Stop();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAudioPolicy::InitializeComplete
+// from MDevSoundObserver
+// --------------------------------------------------------------------------
+//
+void CUPnPAudioPolicy::InitializeComplete( TInt aError )
+    {
+    __LOG1( "CUPnPAudioPolicy::InitializeComplete(%d)", aError );
+    __LOG1( "CUPnPAudioPolicy::InitializeCompl in state(%d)",
+        TInt(iAudioPolicyState) );
+    if( aError == KErrNone && iAudioPolicyState != EStatePlaying )
+        {
+        __LOG( "CUPnPAudioPolicy: priority settings" );
+        TMMFPrioritySettings mmfPrioSettings;
+        mmfPrioSettings.iPriority = KAudioPriorityUPnPRemotePlayback;
+        mmfPrioSettings.iPref =
+            (TMdaPriorityPreference)KAudioPrefUPnPPlayback;
+        mmfPrioSettings.iState = EMMFStatePlaying;
+        iDevSound->SetPrioritySettings(mmfPrioSettings);
+        
+        __LOG( "CUPnPAudioPolicy::InitializeComple calling PlayInitL.." );
+        TRAPD( err, iDevSound->PlayInitL() );
+        if( err == KErrNone )
+            {
+            iAudioPolicyState = EStatePlaying;
+            }
+        else
+            {
+            __LOG1( "CUPnPAudioPolicy: PlayInitL err:(%d)", err );
+            }
+        __LOG( "CUPnPAudioPolicy::InitializeComplete - end" );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAudioPolicy::PlayError
+// from MDevSoundObserver
+// --------------------------------------------------------------------------
+//
+void CUPnPAudioPolicy::PlayError( TInt aError )
+    {
+    __LOG1( "CUPnPAudioPolicy::PlayError(%d)", aError );
+    __LOG1( "CUPnPAudioPolicylicy::PlayError in state(%d)",
+        TInt(iAudioPolicyState) );
+    if ( aError == KErrDied || aError == KErrInUse )
+        {
+        iAudioPolicyState = EStateStopped;
+        iObserver.AudioConflict( aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Unused callbacks from MDevSoundObserver
+// --------------------------------------------------------------------------
+void CUPnPAudioPolicy::ToneFinished( TInt /*aError*/ )
+    {
+    __LOG( "CUPnPAudioPolicy::ToneFinished()" );
+    }
+void CUPnPAudioPolicy::BufferToBeFilled( CMMFBuffer* /*aBuffer*/ )
+    {
+    __LOG( "CUPnPAudioPolicy::BufferToBeFilled()" );
+    }
+void CUPnPAudioPolicy::DeviceMessage( TUid /*aMessageType*/,
+    const TDesC8& /*aMsg*/ )
+    {
+    __LOG( "CUPnPAudioPolicy::DeviceMessage()" );
+    }
+void CUPnPAudioPolicy::SendEventToClient( const TMMFEvent& /*aEvent*/ )
+    {
+    __LOG( "CUPnPAudioPolicy::SendEventToClient()" );
+    }
+void CUPnPAudioPolicy::RecordError( TInt /*aError*/ )
+    {
+    __LOG( "CUPnPAudioPolicy::RecordError()" );
+    }
+void CUPnPAudioPolicy::ConvertError( TInt /*aError*/ )
+    {
+    __LOG( "CUPnPAudioPolicy::ConvertError()" );
+    }
+void CUPnPAudioPolicy::BufferToBeEmptied( CMMFBuffer* /*aBuffer*/ )
+    {
+    __LOG( "CUPnPAudioPolicy::BufferToBeEmptied()" );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnpmusicdownloadproxy.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,535 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Proxy for downloading upnp files and playing locally
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <upnpitem.h>
+#include "upnpitemutility.h" // for ResourceFromItemL
+#include "upnpavcontroller.h"
+#include "upnpmusicdownloadproxy.h"
+#include "upnpsingleton.h"
+#include "upnptrack.h"
+
+_LIT( KComponentLogfile, "musicplugins.txt");
+#include "upnplog.h"
+
+#include "upnppluginserrortranslation.h"
+
+// CONSTANTS
+// ** a message to music player to complete an immediate exit
+const TInt KMusicPluginMessageExit = 3001;
+const TUid KLocalPlayerDefinitionUid = { 0x101FFC06 };
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMusicDownloadProxy* CUPnPMusicDownloadProxy::NewL( 
+    MMPXPlaybackPluginObserver& aObs )
+    {
+    CUPnPMusicDownloadProxy* p = new ( ELeave )
+        CUPnPMusicDownloadProxy( aObs );
+    __LOG1( "DownloadProxy: NewL this=%d", p );
+    CleanupStack::PushL( p );
+    p->ConstructL();
+    CleanupStack::Pop();
+    return p;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::CUPnPMusicDownloadProxy
+// Default constructor.
+// --------------------------------------------------------------------------
+// 
+CUPnPMusicDownloadProxy::CUPnPMusicDownloadProxy(
+    MMPXPlaybackPluginObserver& aObs )
+    : iProxyState( EStateUninitialised )
+    {
+    iObs = &aObs;
+    iLocalPlayer = NULL;
+    iSingleton = NULL;
+    iTrack = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::ConstructL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicDownloadProxy::ConstructL()
+    {
+    __LOG( "DownloadProxy: ConstructL" );
+
+    // Construct the underlying local plugin
+    iLocalPlayer = CMPXPlaybackPlugin::NewL(
+        KLocalPlayerDefinitionUid );
+
+    // Create handle to singleton
+    iSingleton = CUPnPSingleton::GetInstanceL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::~CUPnPMusicDownloadProxy
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMusicDownloadProxy::~CUPnPMusicDownloadProxy()
+    {
+    __LOG1( "DownloadProxy: destructor [%d]",
+       this );
+    Cleanup();
+
+    // Free memory of owned members
+    delete iLocalPlayer;
+    CUPnPSingleton::LoseInstance( iSingleton );
+    }
+    
+
+// --------------------------------------------------------------------------
+// Methods from CMPXPlaybackPlugin
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::InitialiseL
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicDownloadProxy::InitialiseL( const TDesC& aSong )
+    {
+    __LOG2( "DownloadProxy::InitialiseL(%S) [%d]",
+        &aSong, this );
+
+    __ASSERTD( iProxyState == EStateUninitialised,__FILE__, __LINE__ );
+
+    iProxyState = EStatePreparing;
+
+    // Create local track object to resolving URI
+    delete iTrack;
+    iTrack = 0;
+    iTrack = CUPnPTrack::NewL( iSingleton->AVC() );
+    iTrack->ResolveURIL( aSong, *this, CUPnPTrack::EDirectionLocal );
+    iProxyState = EStateDownloading;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::InitialiseL
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicDownloadProxy::InitialiseL( RFile& /*aSong*/ )
+    {
+    // Not used. Only remote file is supported
+    __PANICD( __FILE__, __LINE__ );
+    User::Leave( KErrNotSupported );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::HandleMetaData
+// from MUPnPTrackMetaDataObserver
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicDownloadProxy::ResolveURIComplete( TInt aError )
+    {
+    __LOG1( "DownloadProxy::ResolveURIComplete [%d]", this );
+    __ASSERTD( iProxyState == EStateDownloading,__FILE__, __LINE__ );
+
+    if ( aError == KErrNone )
+        {                        
+        TRAPD( initerror, iLocalPlayer->InitialiseL( 
+            iTrack->FilePath() ) );
+
+        if ( initerror != KErrNone )
+            {
+            __LOG1( "DownloadProxy:local player init leaves: %d",
+                initerror );
+            Cleanup();
+            iProxyState = EStateUninitialised;
+            //translate error
+            initerror = TUpnpPluginsErrorTranslation::ErrorTranslate( 
+                initerror );
+            iObs->HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPInitialised, 0, initerror );
+            }
+        else
+            {
+            iProxyState = EStateInitialisingLocally;
+            }
+        }
+    else
+        {
+        __LOG1("DownloadProxy::ResolveURIComplete: error %d",
+            aError );
+        Cleanup();
+        iProxyState = EStateUninitialised;
+        aError = TUpnpPluginsErrorTranslation::ErrorTranslate( 
+                aError );
+        iObs->HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPInitialised,
+            0, aError );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::CommandL
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicDownloadProxy::CommandL( TMPXPlaybackCommand aCmd, 
+    TInt aData )
+    {
+    __LOG2( "DownloadProxy::CommandL(%d) [%d]", aCmd, this );
+    
+    if( iProxyState == EStateActive )
+        {
+        // ACTIVE state: all commands are forwarded to local plugin
+        __LOG( "DownloadProxy: command in active state" );
+        iLocalPlayer->CommandL( aCmd, aData );
+        }
+    else if ( iProxyState == EStatePreparing && aCmd == EPbCmdClose )
+        {
+        __LOG( "DownloadProxy: Close during prepare" );
+        Cleanup();
+        iProxyState = EStateUninitialised;
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPClosed,
+            0, KErrNone );
+        }
+    else if( iProxyState == EStateDownloading && aCmd == EPbCmdClose )
+        {
+        __LOG( "DownloadProxy: Close during download" );
+        Cleanup(); // this will cancel ongoing copy
+        iProxyState = EStateUninitialised;
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPClosed,
+            0, KErrNone );
+        }
+    else if( iProxyState == EStateInitialisingLocally && 
+        aCmd == EPbCmdClose )
+        {
+        __LOG( "DownloadProxy: Close when initialising locally" );
+        iLocalPlayer->CommandL( aCmd, aData );
+        }
+    else if( iProxyState == EStateUninitialised && aCmd == EPbCmdClose )
+        {
+        __LOG( "DownloadProxy: Close when uninitialized" );
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPClosed,
+            0, KErrNone );
+        }
+    else if( ( iProxyState == EStatePreparing ||
+        iProxyState == EStateDownloading ||
+        iProxyState == EStateInitialisingLocally ||
+        iProxyState == EStateUninitialised ) && aCmd == EPbCmdStop )
+        {
+        __LOG( "DownloadProxy: Stop during any state" );
+        iLocalPlayer->CommandL( aCmd, aData );
+        }
+    else // Not initialized
+        {
+        __LOG1( "DownloadProxy: Command not supported in this state: %d",
+            iProxyState );
+        User::Leave( KErrNotReady );    
+        }
+
+    // check for messages from upnp framework (aData param)
+    if ( aCmd == EPbCmdClose &&
+        aData == KMusicPluginMessageExit )
+        {
+        __LOG( "CommandL(Close, exit) -> cleanup and terminate" );
+
+        // cancel things that are ongoing
+        Cleanup();
+        iLocalPlayer->CancelRequest();
+        iProxyState = EStateUninitialised;
+
+        // Create event to user
+        
+        iObs->HandlePluginEvent(
+            MMPXPlaybackPluginObserver::EPPlayerUnavailable,
+            0, KErrDisconnected);
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::SetL
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicDownloadProxy::SetL( TMPXPlaybackProperty aProperty,
+    TInt aValue )
+    {
+    __LOG1( "DownloadProxy::SetL [%d]", this );
+    __LOG1( "Property=%d", (TInt)aProperty );
+    iLocalPlayer->SetL( aProperty, aValue );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::ValueL
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicDownloadProxy::ValueL( TMPXPlaybackProperty aProperty ) const
+    {
+    __LOG1( "DownloadProxy::ValueL [%d]", this );
+    iLocalPlayer->ValueL( aProperty );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::SubPlayerNamesL
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicDownloadProxy::SubPlayerNamesL()
+    {
+    iLocalPlayer->SubPlayerNamesL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::SelectSubPlayerL
+// --------------------------------------------------------------------------
+//   
+void CUPnPMusicDownloadProxy::SelectSubPlayerL( TInt aIndex )
+    {
+    iLocalPlayer->SelectSubPlayerL( aIndex );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::SubPlayerName
+// Returns current sub player name
+// --------------------------------------------------------------------------
+// 
+const TDesC& CUPnPMusicDownloadProxy::SubPlayerName()
+    {
+    return iLocalPlayer->SubPlayerName();
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::SubPlayerIndex
+// --------------------------------------------------------------------------
+//  
+TInt CUPnPMusicDownloadProxy::SubPlayerIndex() const
+    {
+    return iLocalPlayer->SubPlayerIndex();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::MediaL
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicDownloadProxy::MediaL( const TArray<TMPXAttribute>& aAttrs )
+    {
+    // Get metadata from media server
+    if( iTrack )
+        {
+        __LOG1( "DownloadProxy: Get metadata [%d]", this );
+        iTrack->GetMetaDataL( aAttrs, *iObs );
+        }
+    else
+        {
+        __LOG( "DownloadProxy: Get metadata - no track!" );
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::CancelRequest
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicDownloadProxy::CancelRequest()
+    {
+    __LOG( "CUPnPMusicDownloadProxy::CancelRequest" );
+    if( iProxyState == EStateDownloading )
+        {
+        Cleanup(); // this will cancel ongoing copy
+        iProxyState = EStateUninitialised;
+        // Send "downloading cancelled" event to the user 
+        iObs->HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPDownloadingCanceled,
+            0, KErrGeneral );
+        }
+    iLocalPlayer->CancelRequest();
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::SetObserver
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicDownloadProxy::SetObserver(MMPXPlaybackPluginObserver& aObs)
+    {
+    CMPXPlaybackPlugin::SetObserver( aObs );
+    
+    iLocalPlayer->SetObserver( *this ); 
+    }
+
+// --------------------------------------------------------------------------
+// Methods from MMPXPlaybackPluginObserver
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::HandlePluginEvent
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicDownloadProxy::HandlePluginEvent( TEvent aEvent,
+    TInt aData, TInt aError )
+    {
+    __LOG1( "DownloadProxy::HandlePluginEvent [%d]", this );
+
+    switch( aEvent )
+        {
+        case EPInitialised:
+            {
+            __ASSERTD( iProxyState == EStateInitialisingLocally,__FILE__, 
+                __LINE__ );
+            __LOG1( "DownloadProxy: initialised event, err=%d",
+                aError );
+
+            // Proxied local plugin initialized
+            if ( aError == KErrNone )
+                {
+                iProxyState = EStateActive;
+             
+                iObs->HandlePluginEvent( aEvent, aData, aError );
+                }
+            else
+                {
+                iProxyState = EStateClosing;
+                TRAP_IGNORE (
+                    iLocalPlayer->CommandL( EPbCmdClose, 0 ) );
+                }
+            
+            if ( iProxyState == EStateActive )
+                {
+                TRAP_IGNORE(
+                    iTrack->SendMediaChangedEventL( *iObs );
+                    );
+                }
+            break;
+            }
+        case EPPlaying:             // fall through
+        case EPPlayComplete:        // fall through
+        case EPPaused:              // fall through
+        case EPStopped:             // fall through
+        case EPDownloadStarted:     // fall through
+        case EPDownloadingComplete: // fall through
+        case EPSubPlayersChanged:   // fall through
+        case EPVolumeChanged:       // fall through
+        case EPSetComplete:
+            {
+            __LOG2( "DownloadProxy plugin event=%d err=%d",
+                (TInt)aEvent, aError );
+
+            // Just forward event to the user.
+            aError = TUpnpPluginsErrorTranslation::ErrorTranslate( 
+                    aError );
+            iObs->HandlePluginEvent( aEvent, aData, aError );
+            break;
+            }
+        case EPClosed:
+            {
+            __LOG( "DownloadProxy: closed event" );
+
+            // a Stop command has changed. It will send back a Stopped event 
+            // and then a Closed event. Following Pause command will not be 
+            // accepted in Uninitialized state and CommandL() will leave. 
+            // This change in MPX was necessary to let engine know the file 
+            // was closed. One additional aData parameter is passed in 
+            // iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPClosed, 
+            //    EPbCmdStop, KErrNone); to know the difference between a 
+            // real Close and a Stop/Close. When this happens, EPClosed event
+            // should be ignored.
+            if( aData == EPbCmdStop )
+                {
+                break;
+                }
+
+            Cleanup();
+
+            // If iProxyState is EStateClosing, initialise of 
+            // localplaybackplugin is failed -> send initialised event with
+            // an error code to the user.
+            // Otherwise forward event to the user normally.
+            if( iProxyState == EStateClosing )
+                {
+                iObs->HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPInitialised,
+                    0, KErrNotSupported );
+                }
+            else
+                {
+                aError = TUpnpPluginsErrorTranslation::ErrorTranslate( 
+                        aError );
+                iObs->HandlePluginEvent( aEvent, aData, aError );
+                }
+            iProxyState = EStateUninitialised;
+            break;
+            }
+        default:
+            {
+            __LOG( "DownloadProxy: Default event?" );
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::HandleProperty
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicDownloadProxy::HandleProperty( TMPXPlaybackProperty aProperty,
+    TInt aValue, TInt aError )
+    {
+    __LOG1( "DownloadProxy::HandleProperty [%d]", this );
+        
+    iObs->HandleProperty( aProperty, aValue, aError );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::HandleSubPlayerNames
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicDownloadProxy::HandleSubPlayerNames( TUid aPlayer, 
+    const MDesCArray* aSubPlayers, TBool aComplete, TInt aError )
+    {
+    iObs->HandleSubPlayerNames( aPlayer, aSubPlayers, aComplete, aError );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::HandleMedia
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicDownloadProxy::HandleMedia( const CMPXMedia& aProperties,
+    TInt aError )
+    {
+    __LOG1( "DownloadProxy::HandleMedia [%d]", this );
+        
+    iObs->HandleMedia( aProperties, aError );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicDownloadProxy::CleanUpSession
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicDownloadProxy::Cleanup()
+    {
+    __LOG1( "DownloadProxy::Cleanup [%d]", this );
+    if( iTrack )
+        {
+        delete iTrack;
+        iTrack = 0;
+        }
+    __LOG( "DownloadProxy::Cleanup - End");
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnpmusicperiodizer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Periodic timer support resource
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include "upnpmusicperiodizer.h"
+
+const TInt KPlaybackInfoTimeOutEnd = 2000000; // 2s wait check whether 
+    //the playing is ended
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPeriodizer::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMusicPeriodizer* CUPnPMusicPeriodizer::NewL(
+    MUPnPMusicPeriodizerObserver& aObserver,
+    TInt32 aTimerWavelength )
+    {
+    CUPnPMusicPeriodizer* p = CUPnPMusicPeriodizer::NewLC(
+        aObserver, aTimerWavelength );
+    CleanupStack::Pop();
+    return p;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPeriodizer::NewLC
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//  
+CUPnPMusicPeriodizer* CUPnPMusicPeriodizer::NewLC(
+    MUPnPMusicPeriodizerObserver& aObserver,
+    TInt32 aTimerWavelength )
+    {
+    
+    CUPnPMusicPeriodizer* p = new(ELeave) CUPnPMusicPeriodizer( aObserver,
+        aTimerWavelength );
+    CleanupStack::PushL( p );
+    p->ConstructL();
+    return p;    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPeriodizer::~CUPnPMusicPeriodizer
+// Desctructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMusicPeriodizer::~CUPnPMusicPeriodizer()
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPeriodizer::CUPnPMusicPeriodizer
+// Default constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMusicPeriodizer::CUPnPMusicPeriodizer(
+    MUPnPMusicPeriodizerObserver& aObserver,
+    TInt32 aTimerWavelength )
+    :CTimer( EPriorityStandard ),
+    iObserver( aObserver ),
+    iTimerWavelength( aTimerWavelength )
+    {
+    // No implementation required
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPeriodizer::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPeriodizer::ConstructL()
+    {
+    CTimer::ConstructL();
+    CActiveScheduler::Add(this);
+    }
+ 
+// --------------------------------------------------------------------------
+// Periodizer services
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPeriodizer::Start
+// Starts the periodizer.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPeriodizer::Start()
+    {
+    if ( !IsActive() )
+        {
+        After( TTimeIntervalMicroSeconds32( iTimerWavelength ) );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPeriodizer::Continue
+// Continues a next step for the periodizer.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPeriodizer::Continue()
+    {
+    After( TTimeIntervalMicroSeconds32( iTimerWavelength ) );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPeriodizer::RunL
+// Receives the timer triggering.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPeriodizer::RunL()
+    {
+    // deliver the periodic event to the observer
+    if ( iTimerWavelength == KPlaybackInfoTimeOutEnd )
+        {
+        iObserver.HandlePeriodForEnd();
+        }
+    else
+        {
+        iObserver.HandlePeriod();
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPMusicPeriodizer::Stop
+// Stops periodizer.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPeriodizer::Stop()
+    {
+    Cancel();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnpmusicplayer.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1466 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Plugin for playing files in a remote upnp renderer
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include "upnpavcontrollerfactory.h"
+#include "upnpavcontroller.h"
+#include "upnpfileutility.h"
+#include "upnpavrenderingsession.h"
+#include "upnpavdevice.h"
+#include <mpxplaybackpluginobserver.h>
+
+#include "upnpmusicplayer.h"
+#include "upnpsingleton.h"
+#include "upnptrack.h"
+#include "upnpplaybackstatemachine.h"
+#include "upnpvaluestatemachine.h"
+#include "upnppluginserrortranslation.h"
+
+
+// CONSTANTS
+// ** a message to music player to complete an immediate exit
+const TInt KMusicPluginMessageExit = 3001;
+const TUid KMusicPlayerUid = { 0x200075D8 };
+
+_LIT( KStateUninitialized, "Uninitialised" );
+_LIT( KStateUninitialising, "Uninitialising" );
+_LIT( KStateInitializing, "Initializing" );
+_LIT( KStateActive, "Active" );
+_LIT( KStatePreInitializing, "PreInitializing" );
+_LIT( KStatePreInitialized, "PreInitialized" );
+_LIT( KStateWaiting, "Waiting" );
+_LIT( KStateActiveForceInit, "ActiveForceInit" );
+_LIT( KStateError, "Error" );
+_LIT( KStateUnknown, "Unknown" );
+
+
+_LIT( KComponentLogfile, "musicplugins.txt");
+#include "upnplog.h"
+
+// LOCAL FUNCTIONS
+
+    /*
+     * a template helper function to safely delete a pointer
+     * (make sure pointer becomes NULL before delete is called)
+     * 1. first copy the given pointer to a local temp variable
+     * 2. then allocate a local member, then nullify the given pointer
+     * 3. last, delete the temporary pointer
+     */
+    template <class T>
+    inline void SafeDelete( T*& aPointer )
+        {
+        // first, store the given object into a local temp variable
+        T* tempPointer = aPointer;
+        // nullify the given pointer
+        aPointer = 0;
+        // last, delete the given object
+        delete tempPointer;
+        }
+
+// --------------------------------------------------------------------------
+// Static members of CUPnPMusicPlayer
+// --------------------------------------------------------------------------
+//
+
+// Pointer to the plugin that is active at the time
+CUPnPMusicPlayer* CUPnPMusicPlayer::iActivePlugIn;
+
+// Pointer to the plugini that is waiting to activate (pre-initialized)
+CUPnPMusicPlayer* CUPnPMusicPlayer::iNextPlugIn;
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMusicPlayer* CUPnPMusicPlayer::NewL( MMPXPlaybackPluginObserver& aObs )
+    {
+    CUPnPMusicPlayer* p = new(ELeave) CUPnPMusicPlayer( aObs );
+    CleanupStack::PushL( p );
+    __LOG1( "CUPnPMusicPlayer::NewL [%d]", p );
+    p->ConstructL();
+    CleanupStack::Pop( p );
+    return p;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::CUPnPMusicPlayer
+// Default constructor.
+// --------------------------------------------------------------------------
+// 
+CUPnPMusicPlayer::CUPnPMusicPlayer( MMPXPlaybackPluginObserver& aObs ) :
+    iSelectedRendererIndex( KErrNotFound ),
+    iPlayerState( EStateUninitialised ),
+    iIsReady( EFalse )
+    {   
+    iObs = &aObs;
+    iTrack = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::ConstructL()
+    {
+    __LOG( "CUPnPMusicPlayer::ConstructL" );
+
+    // get a handle to the shared singleton
+    iSingleton = CUPnPSingleton::GetInstanceL();
+    
+    // audio policy
+    iAudioPolicy = CUPnPAudioPolicy::NewL( *this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::~CUPnPMusicPlayer
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPMusicPlayer::~CUPnPMusicPlayer()
+    {
+    __LOG( "CUPnPMusicPlayer::~CUPnPMusicPlayer()" );
+    UninitialiseTrack( EStateNone );
+            
+    if( iSingleton != NULL )
+        {
+        CUPnPSingleton::LoseInstance( iSingleton );
+        iSingleton = NULL;
+        }
+
+    delete iAudioPolicy;
+    iAudioPolicy = 0;
+    delete iSelectedRenderer;
+    } 
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::MatchRenderer
+// Compares renderers names
+// --------------------------------------------------------------------------
+//
+TBool CUPnPMusicPlayer::MatchRenderer(
+    const CUpnpAVDevice* aRenderer ) const
+    {
+    if( aRenderer == NULL  )
+        {
+        // no renderer - using default renderer, which is always
+        // the same as previously selected renderer -> ALWAYS MATCH.
+        return ETrue;
+        }
+
+    if( iSelectedRenderer == NULL  )
+        {
+        // Current renderer does not exist - this should never happen.
+        __PANICD( __FILE__, __LINE__ );
+        return ETrue;
+        }
+
+    // compare renderer pointer
+    if ( iSelectedRenderer == aRenderer )
+        {
+        return ETrue;
+        }
+
+    // Compare renderer UUID
+    if ( iSelectedRenderer->Uuid().Compare( aRenderer->Uuid() ) == 0 )
+        {
+        return ETrue;
+        }
+    
+    return EFalse;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::UsedRendererDevice
+// Returns currently used renderer device
+// --------------------------------------------------------------------------
+//
+CUpnpAVDevice& CUPnPMusicPlayer::UsedRendererDevice() const
+    {
+    return *iSelectedRenderer;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::SetActive
+// Set Plugin state to active.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::SetActive( TBool aForceInitialise )
+    {
+    __LOG( "CUPnPMusicPlayer::SetActive" );
+
+    if ( iActivePlugIn != 0 &&
+        iActivePlugIn->MatchRenderer( iSelectedRenderer ) )
+        {
+        // Continuing playback on the same renderer.
+        // copy some cached values
+        // 
+        iValueStateMachine->CopyValues(
+            iActivePlugIn->ValueStateMachine() );
+        }
+
+    if( iPlayerState == EStatePreInitialized ) 
+        {
+        // Preinitialize is ready. Clear pointer from iNextPlugin and 
+        // sets it to iActivePlugIn.
+        iActivePlugIn = this;
+        iNextPlugIn = NULL;
+        if( aForceInitialise )
+            {
+            ChangeState( EStateActiveForceInitialise );
+            TRAP_IGNORE( iAudioPolicy->PlayL() );
+            }
+        else
+            {
+            ChangeState( EStateActive );
+            TRAP_IGNORE( iAudioPolicy->PlayL() );
+            }
+        }
+    else if( iPlayerState == EStateWaiting )
+        {
+        // Used renderer does not support SetNextURI feature. Initialise
+        // track by SetURI after play command.
+        iActivePlugIn = this;
+        iNextPlugIn = NULL;
+        ChangeState( EStateActiveForceInitialise );
+        }
+    else if( iPlayerState == EStateActive )
+        {
+        // do nothing
+        iActivePlugIn = this;
+        iNextPlugIn = NULL;
+        ChangeState( EStateActive );
+        TRAP_IGNORE( iAudioPolicy->PlayL() );
+        }
+    else if( iPlayerState == EStatePreInitializing )
+        {
+        // Do nothing.
+        }
+    else
+        {
+        __LOG1( "CUPnPMusicPlayer::SetActive in wrong state %S",
+            State( iPlayerState ) );
+        __PANICD( __FILE__, __LINE__ );
+        }   
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::Observer
+// --------------------------------------------------------------------------
+//
+MMPXPlaybackPluginObserver& CUPnPMusicPlayer::Observer() const
+    {
+    __ASSERTD( iObs != 0, __FILE__, __LINE__ );
+    return *iObs;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::PlaybackStateMachine
+// --------------------------------------------------------------------------
+//
+const CUPnPPlaybackStateMachine&
+    CUPnPMusicPlayer::PlaybackStateMachine() const
+    {
+    __ASSERTD( iPlaybackStateMachine != 0, __FILE__, __LINE__ );
+    return *iPlaybackStateMachine;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::ValueStateMachine
+// --------------------------------------------------------------------------
+//
+const CUPnPValueStateMachine&
+    CUPnPMusicPlayer::ValueStateMachine() const
+    {
+    __ASSERTD( iValueStateMachine != 0, __FILE__, __LINE__ );
+    return *iValueStateMachine;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::Track
+// --------------------------------------------------------------------------
+//
+CUPnPTrack& CUPnPMusicPlayer::Track() const
+    {
+    __ASSERTD( iTrack != 0, __FILE__, __LINE__ );
+    return *iTrack;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::HandlePlayStarted
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::HandlePlayStarted()
+    {
+    __LOG( "CUPnPMusicPlayer::HandlePlayStarted" );
+
+    // Remote device is ready for give playback information 
+    // (duration, position..)
+    iIsReady = ETrue;
+
+    // Inform user that playback is started
+    iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlaying, 0,
+        KErrNone );
+
+    if( iValueStateMachine && iTrack )
+        {
+        // always query volume. Duration if not already exist or in 
+        // case of remote track.
+        TRAP_IGNORE(
+            iValueStateMachine->VolumeQueryL();
+            if( iTrack->TrackDuration() == 0 || iTrack->IsRemote() )
+                {
+                iValueStateMachine->DurationQueryL();
+                }
+            )
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::HandlePlayComplete
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::HandlePlayComplete()
+    {
+    __LOG( "CUPnPMusicPlayer::HandlePlayComplete" );
+
+    iAudioPolicy->Stop();
+
+    // If there is a next initialized plugin then active it
+    if( iActivePlugIn == this && iNextPlugIn != 0 )
+        {
+        // Set iActivePlugIn to null.
+        iNextPlugIn->SetActive( EFalse );   
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// Methods from CMPXPlaybackPlugin
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::InitialiseL( const TDesC& aSong )
+// Initializes a song for playback.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::InitialiseL( const TDesC& aSong )
+    {    
+    // Initialise song for play back.
+    InitialiseTrackL( aSong );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::InitialiseL(  RFile& aSong )
+// Initializes a song for playback.
+// --------------------------------------------------------------------------
+//   
+void CUPnPMusicPlayer::InitialiseL( RFile& aSong )
+    {
+    // At first get the song path from given resource file
+    HBufC* tempBuf = HBufC::NewL( KMaxFileName );
+    CleanupStack::PushL( tempBuf );
+    TPtr ptr = tempBuf->Des();
+    TInt err = aSong.FullName( ptr );
+
+    // Leave if any error
+    if( err != KErrNone )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Initialise song for play back.
+    InitialiseTrackL( *tempBuf );
+    CleanupStack::PopAndDestroy( tempBuf );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::InitialiseTrackL
+// Initializes a remote or local song for playback
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::InitialiseTrackL( const TDesC& aSong )
+    {
+    __LOG1( "CUPnPMusicPlayer::InitialiseTrackL [%d]", this );
+    __ASSERTD( iPlayerState == EStateUninitialised, __FILE__, __LINE__ );
+
+    // some state checks
+    if ( iPlayerState != EStateUninitialised )
+        {
+        __LOG( "CUPnPMusicPlayer::InitialiseTrackL: In wrong state! " );
+        User::Leave( KErrNotReady );
+        }
+    if( ( iActivePlugIn != NULL ) && ( iNextPlugIn != NULL ) )
+        {
+        __LOG( "CUPnPMusicPlayer::InitialiseTrackL - \
+        More than two plugin initialisezed at the same time! " );
+        User::Leave( KErrNotReady );
+        }
+    if( iSelectedRenderer == 0 )
+        {
+        __LOG( "CUPnPMusicPlayer::InitialiseTrackL - \
+        Subplayer not selected " );
+        User::Leave( KErrNotReady );
+        }
+    
+    if( aSong.Length() == 0 )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    
+    __LOG( "CUPnPMusicPlayer::InitialiseTrackL: Start rendering session" );
+    MUPnPAVRenderingSession* tempSession =
+        &iSingleton->AVC().StartRenderingSessionL( *iSelectedRenderer );
+        
+    __LOG( "CUPnPMusicPlayer::InitialiseTrackL - \
+        Set Rendering session observer" );
+    // Set media observer
+    tempSession->SetObserver( *this );
+
+    // stop existing rendering session if exists
+    if( iRendererSession )
+        {
+        __LOG( "CUPnPMusicPlayer::InitialiseTrackL: Stop old session" );
+        // releasing local MS services is left to AVController
+        iSingleton->AVC().StopRenderingSession( *iRendererSession );
+        iRendererSession = 0;
+        }
+
+    iRendererSession = tempSession;
+             
+    // Set plugin to active and call SetURI if there is no track
+    // playing currently or the track playing currently is in 
+    // different renderer
+    if( iActivePlugIn == NULL ) 
+        {
+        // There is no track playing currently
+        iActivePlugIn = this; // Set Plugin to the active.
+        ChangeState( EStateInitializing );
+        }
+    else // Track is currently playing.
+        {
+        // Check if track is playing in different renderer
+        if( iActivePlugIn->MatchRenderer( iSelectedRenderer ) )
+            {
+            iNextPlugIn = this; // Set plugin to the next
+            ChangeState( EStatePreInitializing );
+            }
+        else
+            {
+            // Track is playing but different renderer
+            ChangeState( EStateInitializing );
+            }
+        } 
+
+    // Create state machines
+    iPlaybackStateMachine = CUPnPPlaybackStateMachine::NewL(
+        *this, *iRendererSession );
+
+    iValueStateMachine = CUPnPValueStateMachine::NewL(
+        *this, *iRendererSession );
+
+    // Create track object to resolving URI
+    iTrack = CUPnPTrack::NewL( iSingleton->AVC() );
+    iTrack->ResolveURIL( aSong, *this, CUPnPTrack::EDirectionRemote );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::UninitialiseTrack
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicPlayer::UninitialiseTrack( TPlayerState aToState )
+    {
+    __LOG1( "CUPnPMusicPlayer::UninitialiseTrack(%S)",
+        State( aToState ) );
+    ChangeState( EStateUninitialising );
+
+    if ( iAudioPolicy )
+        {
+        iAudioPolicy->Stop();
+        }
+    
+    if ( iActivePlugIn == this )
+        {
+        iActivePlugIn = 0;
+        }
+    if ( iNextPlugIn == this )
+        {
+        iNextPlugIn = 0;
+        }
+
+    if( iPlaybackStateMachine )
+        {
+        delete iPlaybackStateMachine;
+        iPlaybackStateMachine = 0;
+        }
+
+    if( iValueStateMachine )
+        {
+        delete iValueStateMachine;
+        iValueStateMachine = 0;
+        }
+
+    // Rendering session is not cleared until destructor.
+    if( iRendererSession && aToState == EStateNone )
+        {
+        // releasing local MS services is left to AVController
+        iSingleton->AVC().StopRenderingSession( *iRendererSession );
+        iRendererSession = 0;
+        }
+
+    iSelectedRendererIndex = KErrNotFound;
+    iIsReady = EFalse;
+
+    if ( iTrack )
+        {
+        // request track to delete itself
+        CUPnPTrack* tempTrack = iTrack;
+        iTrack = NULL;
+        tempTrack->Delete();
+        }
+
+    ChangeState( aToState );
+    __LOG( "CUPnPMusicPlayer::UninitialiseTrack - End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::ResolveURIComplete
+// from MUPnPTrackObserver
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicPlayer::ResolveURIComplete( TInt aError )
+    {
+    __LOG2( "CUPnPMusicPlayer::ResolveURIComplete in state %S [%d]",
+        State( iPlayerState ), this );
+
+    if ( aError == KErrNone )
+        {
+        // Check is local or remote
+        TRAPD( error, SetURIL() );
+        if ( error != KErrNone )
+            {
+            __LOG1("CUPnPMusicPlayer::ResolveURIComplete: leaves with %d",
+                error );
+            UninitialiseTrack();
+            error = TUpnpPluginsErrorTranslation::ErrorTranslate( 
+                    error );
+            iObs->HandlePluginEvent( 
+                MMPXPlaybackPluginObserver::EPInitialised,
+                0, error );
+            }
+        }
+    else
+        {
+        __LOG1("CUPnPMusicPlayer::ResolveURIComplete: error %d",
+            aError );
+        UninitialiseTrack();
+        aError = TUpnpPluginsErrorTranslation::ErrorTranslate( 
+                aError );
+        iObs->HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPInitialised,
+            0, aError );
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::SetURIL
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicPlayer::SetURIL()
+    {
+    __LOG( "CUPnPMusicPlayer::SetURIL" );
+
+    switch( iPlayerState )
+        {
+        case EStateInitializing: // flow through
+        case EStateActiveForceInitialise:
+            {
+            iRendererSession->SetURIL(
+                iTrack->UpnpURI(), iTrack->UpnpItem() );
+            }
+            break;
+        case EStatePreInitializing:
+            {
+            // Set NextUri if action is supported by used device
+            if( iSelectedRenderer->NextAVTransportUri() )
+                {
+                __LOG( "CUPnPMusicPlayer::SetURIL - \
+                Remote:SetNextURI" );
+                
+                iRendererSession->SetNextURIL( 
+                    iTrack->UpnpURI(), iTrack->UpnpItem() );
+                }
+            else
+                {
+                __LOG( "CUPnPMusicPlayer::SetURI - \
+                SetNextURI is not supported by used device" );
+
+                // Used renderer does not support SetNextURI feature. 
+                // Initialise track by SetURI after play is called.
+                ChangeState( EStateWaiting );
+                iObs->HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPInitialised,
+                    iTrack->TrackDuration(), KErrNone );
+                if ( iPlayerState == EStateWaiting )
+                    {
+                    if( iTrack->IsRemote() )
+                        {
+                        iTrack->SendMediaChangedEventL( *iObs );
+                        }
+                    }
+                }
+            }
+            break;
+        case EStatePauseInActiveForceInitialise:
+            {
+            // This case happens when active plugin is paused and user 
+            // skips to the next track from UI.
+            __LOG( "SetURI during EStatePauseInActiveForceInitialise" );
+            iRendererSession->SetURIL(
+                iTrack->UpnpURI(), iTrack->UpnpItem() );
+            }
+            break;
+        default:
+            {
+            __PANICD( __FILE__, __LINE__ );
+            }
+            break;
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::CommandL
+// Executes a command on the selected song.
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicPlayer::CommandL( TMPXPlaybackCommand aCmd, TInt aData )
+    {
+    __LOG3( "CUPnPMusicPlayer::CommandL(%d) in state %S [%d]",
+       aCmd, State( iPlayerState ), this );
+        
+    switch( iPlayerState )
+        {
+        case EStateUninitialised:   // fall through
+        case EStateUninitialising:  // fall through
+            {
+            // ignore everything
+            }
+        case EStateError:
+            {
+            // Only Stop and Close will be handled.
+            // All other commands ignored.
+            if ( aCmd == EPbCmdStop )
+                {
+                iObs->HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPStopped,
+                    KErrNone, KErrNone );
+                }
+            if ( aCmd == EPbCmdClose )
+                {
+                iObs->HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPClosed,
+                    KErrNone, KErrNone );
+                }
+            break;
+            }
+        case EStateInitializing:    // fall through
+        case EStatePreInitializing: // fall through
+        case EStatePreInitialized:  // fall through
+        case EStateWaiting:         // fall through
+        case EStateActiveForceInitialise:
+            {
+            if( aCmd == EPbCmdStop )
+                {
+                // answer directly to stopped message
+                iObs->HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPStopped,
+                    KErrNone, KErrNone );
+                }
+            if( aCmd == EPbCmdPlay &&
+                ( iPlayerState == EStateActiveForceInitialise ) )
+                {
+                __LOG( "CUPnPMusicPlayer::Command(play)->SetURI" );
+                SetURIL();
+                }
+            if( aCmd == EPbCmdPlay && iPlayerState == EStateWaiting )
+                {                
+                // This plugin has to be set active because track has forced
+                // to be skipped by user.
+                SetActive( ETrue );
+                SetURIL();
+                }
+            if( aCmd == EPbCmdPlay && iPlayerState == EStatePreInitialized )
+                {
+                // This plugin has to be set active because track has forced
+                // to be skipped by user.
+                SetActive( ETrue );
+                SetURIL();            
+                }
+            if( aCmd == EPbCmdPause && 
+                ( iPlayerState == EStateActiveForceInitialise || 
+                  iPlayerState == EStateWaiting ) )
+                {
+                // This case happens when active plugin is paused and user 
+                // skips to the next track from UI -> next track must be 
+                // switched to paused state.
+                __LOG( "Pause command during EStateActiveForceInitialise" );
+                iPlayerState = EStatePauseInActiveForceInitialise;
+                SetURIL();
+                }
+                
+            if ( aCmd == EPbCmdClose )
+                {
+                UninitialiseTrack();
+                iObs->HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPClosed,
+                    KErrNone, KErrNone );
+                }
+            break;
+            }
+        case EStateActive:
+            {
+            iPlaybackStateMachine->CommandL( aCmd );
+            if( aCmd == EPbCmdStop )
+                {
+                if ( this == iActivePlugIn && iNextPlugIn != 0 )
+                    {
+                    __LOG( "CommandL(stop)->SetActive()" );
+                    iNextPlugIn->SetActive( ETrue );
+                    }
+                }
+            if( aCmd == EPbCmdPause )
+                {
+                if ( this == iActivePlugIn && iNextPlugIn != 0 )
+                    {
+                    __LOG( "CommandL(pause)->SetActive()" );
+                    iNextPlugIn->SetActive( EFalse );
+                    }
+                }
+            if( aCmd == EPbCmdClose )
+                {
+                if ( this == iActivePlugIn && iNextPlugIn != 0 )
+                    {
+                    __LOG( "CommandL(close)->SetActive()" );
+                    iNextPlugIn->SetActive( ETrue );
+                    }
+                UninitialiseTrack();
+                }
+            break;
+            }
+        default:
+            {
+            __LOG( "CUPnPMusicPlayer::CommandL - Default" );
+            break;
+            } 
+        }
+
+    // check for messages from upnp framework (aData param)
+    if ( aCmd == EPbCmdClose &&
+        aData == KMusicPluginMessageExit )
+        {
+        __LOG( "CommandL(Close, exit) -> cleanup and terminate" );
+
+        // cancel things that are ongoing
+        CancelRequest();
+        // clear resources
+        UninitialiseTrack( EStateError );
+
+        // Create event to user
+        iObs->HandlePluginEvent(
+            MMPXPlaybackPluginObserver::EPPlayerUnavailable,
+            0, KErrDisconnected );
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::SetL
+// Sets a property of the plugin.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::SetL( TMPXPlaybackProperty aProperty, TInt aValue )
+    {
+    __LOG2( "CUPnPMusicPlayer::SetL in state %S [%d]",
+        State( iPlayerState ), this );
+
+    CUPnPValueStateMachine::TValidationResult result =
+        CUPnPValueStateMachine::ValidatePropertyInState(
+        aProperty, ETrue, iPlayerState, iIsReady );
+
+    if ( result == CUPnPValueStateMachine::EHandle )
+        {
+        if ( aProperty == EPbPropertyPosition )
+            {
+            // Position changes are handled in playback s.m.
+            iPlaybackStateMachine->PositionL( aValue );
+            }
+        else
+            {
+            // all other values in value s.m.
+            iValueStateMachine->SetL( aProperty, aValue );
+            }
+        }
+    else if ( result == CUPnPValueStateMachine::EHandleStatic )
+        {
+        iObs->HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPSetComplete,
+            (TInt)aProperty, KErrNone );
+        }
+    else if ( result == CUPnPValueStateMachine::EErrorNotReady )
+        {
+        iObs->HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPSetComplete,
+            (TInt)aProperty, KErrNotReady );
+        }
+    else if ( result == CUPnPValueStateMachine::EErrorNotSupported )
+        {
+        iObs->HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPSetComplete,
+            (TInt)aProperty, KErrNotSupported );
+        }
+    else if ( result == CUPnPValueStateMachine::EIgnore )
+        {
+        // do nothing
+        }
+    else 
+        {
+        __PANICD( __FILE__, __LINE__ );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::ValueL
+// Gets a property of the plugin (async).
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::ValueL( TMPXPlaybackProperty aProperty ) const
+    {
+    __LOG2( "CUPnPMusicPlayer::ValueL in state %S [%d]",
+        State( iPlayerState ), this );
+
+    CUPnPValueStateMachine::TValidationResult result =
+        CUPnPValueStateMachine::ValidatePropertyInState(
+        aProperty, EFalse, iPlayerState, iIsReady );
+
+    if ( result == CUPnPValueStateMachine::EHandle )
+        {
+        iValueStateMachine->ValueL( aProperty );
+        }
+    else if ( result == CUPnPValueStateMachine::EHandleStatic )
+        {
+        CUPnPValueStateMachine::ValueStatic( aProperty, *iObs );
+        }
+    else if ( result == CUPnPValueStateMachine::EErrorNotReady )
+        {
+        iObs->HandleProperty( aProperty,
+            0, KErrNotReady );
+        }
+    else if ( result == CUPnPValueStateMachine::EErrorNotSupported )
+        {
+        iObs->HandleProperty( aProperty,
+            0, KErrNotSupported );
+        }
+    else if ( result == CUPnPValueStateMachine::EIgnore )
+        {
+        // do nothing
+        }
+    else 
+        {
+        __PANICD( __FILE__, __LINE__ );
+        }
+      
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::SubPlayerNamesL
+// Gets a list of sub players (async).
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::SubPlayerNamesL()
+    {
+    __LOG1( "CUPnPMusicPlayer::SubPlayerNamesL [%d]", this );
+   
+    // Get media renderers from renderer selector
+    iSingleton->GetRendererNamesL( *this );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::SelectSubPlayerL
+// Select a sub player.
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicPlayer::SelectSubPlayerL( TInt aIndex )
+    {
+    __LOG1( "CUPnPMusicPlayer::SelectSubPlayerL [%d]", this );
+            
+    // this method can only be called in uninitialized state
+    __ASSERTD( iPlayerState == EStateUninitialised ||
+    aIndex == iSelectedRendererIndex, __FILE__, __LINE__ );
+ 
+    // Select media renderer. Ignore if already selected.
+    if ( iSelectedRendererIndex != aIndex )
+        {
+        iSelectedRendererIndex = aIndex;
+        CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL( 
+            *iSingleton->SelectRendererByIndexL( aIndex ) );
+        delete iSelectedRenderer;
+        iSelectedRenderer = tempDev;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::SubPlayerName
+// Returns current sub player name
+// --------------------------------------------------------------------------
+// 
+const TDesC& CUPnPMusicPlayer::SubPlayerName()
+    {
+    __LOG1( "CUPnPMusicPlayer::SubPlayerName [%d]", this );
+    if ( iSelectedRenderer )
+        {
+        iSelectedRendererName.Copy(
+            iSelectedRenderer->FriendlyName() );
+        }
+    else if ( iSingleton->DefaultDevice() )
+        {
+        iSelectedRendererName.Copy(
+            iSingleton->DefaultDevice()->FriendlyName() );
+        }
+    else
+        {
+        iSelectedRendererName.Copy( KNullDesC );
+        }
+    return iSelectedRendererName;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::SubPlayerIndex
+// Return current sub player index.
+// --------------------------------------------------------------------------
+//    
+TInt CUPnPMusicPlayer::SubPlayerIndex() const
+    {
+    __LOG1( "CUPnPMusicPlayer::SubPlayerIndex [%d]", this );
+
+    // Get current sub player index
+    return iSelectedRendererIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::MediaL
+// Extended properties of the current file (async).
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::MediaL( const TArray<TMPXAttribute>& aAttrs )
+    {
+    __LOG2( "CUPnPMusicPlayer::MediaL in state %S [%d]",
+        State( iPlayerState ), this );
+
+    // Get media if track is initialised
+    if( iTrack )
+        {
+        iTrack->GetMetaDataL( aAttrs, *iObs );
+        }
+    else
+        {
+        __LOG( "CUPnPMusicPlayer::MediaL - Wrong state!" );
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::CancelRequest
+// Cancel outstanding request.
+// --------------------------------------------------------------------------
+//   
+void CUPnPMusicPlayer::CancelRequest()
+    {
+    __LOG2( "CUPnPMusicPlayer::CancelRequest in state %S [%d]",
+        State( iPlayerState ), this );
+
+    // If cancel is called during initialise
+    if( iPlayerState == EStateInitializing || 
+        iPlayerState == EStatePreInitializing || 
+        iPlayerState == EStateActiveForceInitialise ||
+        iPlayerState == EStateActive )
+        {
+        // Stop rendering session -> SetURI operation will be cancelled
+        UninitialiseTrack( EStateNone );
+        iPlayerState = EStateUninitialised;
+        }
+    else if( iPlayerState == EStateUninitialising )
+        {
+        // Ignore. Do not call state machines.
+        return;
+        }
+
+    if ( iSingleton != 0 )
+        {
+        iSingleton->CancelGetRendererNames();
+        }
+    if ( iPlaybackStateMachine )
+        {
+        iPlaybackStateMachine->Cancel();
+        }
+    if ( iValueStateMachine )
+        {
+        iValueStateMachine->Cancel();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Methods of MUPnPAVRenderingSessionObserver
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::VolumeResult
+// Response for get/set volume property commands.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::VolumeResult( TInt aError, TInt aVolumeLevel,
+    TBool aActionResponse )
+    {
+    __LOG2( "CUPnPMusicPlayer::VolumeResult in state %S [%d]",
+        State( iPlayerState ), this );
+
+    if( iValueStateMachine )
+        {
+        iValueStateMachine->VolumeResult( aError, aVolumeLevel,
+            aActionResponse );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::MuteResult
+// Response for get/set mute property commands.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::MuteResult( TInt aError, TBool aMute,
+    TBool aActionResponse )
+    {
+    __LOG2( "CUPnPMusicPlayer::MuteResult in state %S [%d]",
+        State( iPlayerState ), this );
+
+    if( iValueStateMachine )
+        {
+        iValueStateMachine->MuteResult( aError, aMute, aActionResponse );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::InteractOperationComplete
+// Response for interaction operation (play, stop, etc.).
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::InteractOperationComplete( TInt aErrorCode, 
+    TUPnPAVInteractOperation aOperation )
+    {
+    __LOG3( "CUPnPMusicPlayer::InteractOp.Comp(%d) in state %S [%d]",
+        aOperation, State( iPlayerState ), this );
+
+    if( iPlayerState == EStateActive )
+        {
+        if( iPlaybackStateMachine )
+            {
+            iPlaybackStateMachine->InteractOperationComplete( aErrorCode,
+                aOperation );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::PositionInfoResult
+// Response for position/duration requests.
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::PositionInfoResult( TInt aStatus,
+    const TDesC8& aTrackPosition, const TDesC8& aTrackLength )
+    {
+    __LOG2( "CUPnPMusicPlayer::PositionInfoResult in state %S [%d]",
+        State( iPlayerState ), this );
+    
+    if( iValueStateMachine )
+        {
+        iValueStateMachine->PositionInfoResult( aStatus, aTrackPosition, 
+            aTrackLength );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::SetURIResult
+// Response for SetURI.
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicPlayer::SetURIResult( TInt aError )
+    {
+    __LOG3( "CUPnPMusicPlayer::SetURIResult in state %S err=%d [%d]",
+        State( iPlayerState ), aError, this );
+
+    if( iPlayerState == EStateInitializing )
+        {
+        // "Normal" response for SetURI
+        TInt duration(0);
+        if( aError == KErrNone )
+            {
+            // Set player state to active
+            ChangeState( EStateActive );
+            TRAP_IGNORE( iAudioPolicy->PlayL() );
+            duration = iTrack->TrackDuration();
+            }
+        else
+            {
+            UninitialiseTrack();
+            }
+        // if aError is KErrGeneral, the music player doesn't skip to
+        //the next song .  translate to KErrCorrupt.
+        if( aError == KErrGeneral)
+            {
+            aError = KErrCorrupt;
+            }
+        else
+            {
+            aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError );
+            }
+        iObs->HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPInitialised, duration, aError );
+        if ( iPlayerState == EStateActive )
+            {
+            TRAP_IGNORE(
+                if( iTrack->IsRemote() )
+                    {
+                    iTrack->SendMediaChangedEventL( *iObs );
+                    }
+                );
+            }
+        }
+    else if( iPlayerState == EStateActiveForceInitialise )
+        {
+        // Response for preinitialise that is failed because of
+        // used device does not support SetNextUri functionality.
+        if( aError == KErrNone )
+            {            
+            __LOG( "SetURIResult,ActiveForceInitialise->Play" );
+            // Set player state to active
+            iPlayerState = EStateActive;
+            TRAP_IGNORE( iAudioPolicy->PlayL() );
+                            
+            // Play 
+            TRAPD( error, CommandL( EPbCmdPlay, TInt(0) ) );
+            if ( error != KErrNone )
+                {
+                UninitialiseTrack();
+                // Send play event with error to user. Note play event
+                // because we are actually performing play command.
+                error = TUpnpPluginsErrorTranslation::ErrorTranslate( error );
+                iObs->HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPPlaying,
+                    0, error );
+                // Send event that device is not available.
+                iObs->HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPPlayerUnavailable,
+                    0, KErrNotFound );
+                }
+            }
+        else
+            {
+            UninitialiseTrack();
+            // Send play event with error to user. Note play event
+            // because weare actually performing play command.
+            aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError );
+            iObs->HandlePluginEvent(
+                MMPXPlaybackPluginObserver::EPPlaying,
+                0, aError );
+            }
+        }
+    else if( iPlayerState == EStatePauseInActiveForceInitialise )
+        {
+        // This case happens when active plugin is paused and user 
+        // skips to the next track from UI.
+        __LOG( "SetUriResult during EStatePauseInActiveForceInitialise" );
+
+        iPlayerState = EStateActive;
+        if( aError == KErrNone )
+            {
+            // Pause
+            TRAPD( error, CommandL( EPbCmdPause, TInt(0) ) );
+            if ( error != KErrNone )
+                {
+                UninitialiseTrack();
+                // Send pause event with error to user. Note pause event
+                // because we are actually performing pause command.
+                error = TUpnpPluginsErrorTranslation::ErrorTranslate( error );
+                iObs->HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPPaused,
+                    0, error );
+                }
+            }
+        else
+            {
+            UninitialiseTrack();
+            // Send pause event with error to user. Note pause event
+            // because we are actually performing pause command.
+            aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError );
+            iObs->HandlePluginEvent(
+                MMPXPlaybackPluginObserver::EPPaused, 0, aError );
+            }
+        }
+    else // Covers also if Cancel request is called during SetURI
+        {
+        __LOG( "CUPnPMusicPlayer::SetURIResult - Unknown state " );
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::SetNextURIResult
+// Response for SetNextURI.
+// --------------------------------------------------------------------------
+//  
+void CUPnPMusicPlayer::SetNextURIResult( TInt aError )
+    {
+    __LOG2( "CUPnPMusicPlayer::SetNextURIResult err=%d [%d]",
+        aError, this );
+
+    aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError );
+    if( iPlayerState == EStatePreInitializing )
+        {
+        TInt duration(0);
+        // Check if any error during SetNextURI call
+        if( aError == KErrNone )
+            {
+            // Set palyer state to preinitialized
+            ChangeState( EStatePreInitialized );
+            duration = iTrack->TrackDuration();
+            }
+        else 
+            {
+            // Used renderer does not support SetNextURI feature. 
+            // Initialise track by SetURI after play is called.
+            ChangeState( EStateWaiting );
+            }
+        iObs->HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPInitialised, duration, aError );
+        if ( iPlayerState == EStatePreInitialized )
+            {
+            TRAP_IGNORE(
+                if( iTrack->IsRemote() )
+                    {
+                    iTrack->SendMediaChangedEventL( *iObs );
+                    }
+                );
+            }
+        }
+    else
+        {
+        __LOG( "CUPnPMusicPlayer::SetNextURIResult - Wrong state! " );
+        __PANICD( __FILE__, __LINE__ );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::MediaRendererDisappeared
+// Indication in case of renderer disappear
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicPlayer::MediaRendererDisappeared( 
+    TUPnPDeviceDisconnectedReason aReason )
+    {
+    __LOG1( "CUPnPMusicPlayer::MediaRendererDisappeared [%d]",
+        this );
+    
+    if ( aReason == MUPnPAVSessionObserverBase::EWLANLost )
+        {
+        if( iTrack )
+            {
+            if ( iTrack->IsRemote() )
+                {
+                __LOG( "CUPnPMusicPlayer::MediaRendererDisappeared - \
+                WLAN disappeared while playing a REMOTE track " );
+                // WLAN disappeared while playing a REMOTE track
+                // stop rendering session and inform player             
+                // Fixes ESLX-7KQERV
+                CancelRequest();
+                UninitialiseTrack( EStateError );
+                iObs->HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPPlayerUnavailable,
+                    0, KErrDisconnected );
+                }
+            else
+                {
+                __LOG( "CUPnPMusicPlayer::MediaRendererDisappeared - \
+                WLAN disappeared while playing a LOCAL track " );
+                // WLAN disappeared while playing a LOCAL track
+                // signal not available.
+                UninitialiseTrack( EStateError );
+                iObs->HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPPlayerUnavailable,
+                    0, KErrNone );
+                }
+            }
+        else // Track does not exist -> state is already uninitialised
+            {
+            iObs->HandlePluginEvent(
+                MMPXPlaybackPluginObserver::EPPlayerUnavailable,
+                0, KErrNone );
+            }
+        }
+    else
+        {
+        // renderer disappeared
+        UninitialiseTrack( EStateUninitialised );
+        iObs->HandlePluginEvent(
+            MMPXPlaybackPluginObserver::EPPlayerUnavailable,
+            0, KErrNotFound );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::ReserveLocalMSServicesCompleted
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicPlayer::ReserveLocalMSServicesCompleted( TInt /*aError*/ )
+    {
+    __LOG1( "CUPnPMusicPlayer::ReserveMSCompleted!? [%d]", this );
+    // Implementation no needed.
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::HandleSubPlayerNames
+// Response for GetSubplayerNames request.
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicPlayer::HandleSubPlayerNames( const MDesCArray* aSubPlayers, 
+    TBool aComplete, TInt aError )
+    {
+    __LOG2( "CUPnPMusicPlayer::HandleSubPlayerNames in state %S [%d]",
+        State( iPlayerState ), this );
+    
+    aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError );
+    // Return subplayer names
+    iObs->HandleSubPlayerNames( KMusicPlayerUid, aSubPlayers,
+        aComplete, aError );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::RendererListChanged
+// Call back if reanderer list has changed.
+// --------------------------------------------------------------------------
+// 
+void CUPnPMusicPlayer::RendererListChanged()
+    {
+    __LOG2( "CUPnPMusicPlayer::RendererListChanged in state %S [%d]",
+        State( iPlayerState ), this );
+    
+    // Create EPSubPlayersChanged event
+    iObs->HandlePluginEvent(
+        MMPXPlaybackPluginObserver::EPSubPlayersChanged,
+        KErrNone, KErrNone );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::AudioConflict
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::AudioConflict( TInt /*aError*/ )
+    {
+
+    // stop playing
+    TRAP_IGNORE( iPlaybackStateMachine->SilentStopL() );
+
+    // notify framework        
+    iObs->HandlePluginEvent(
+        MMPXPlaybackPluginObserver::EPStopped,
+        0, KErrNone );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::ChangeState
+// --------------------------------------------------------------------------
+//
+void CUPnPMusicPlayer::ChangeState( TPlayerState aNewState )
+    {   
+    __LOG3( "CUPnPMusicPlayer: STATE %S -> %S [%d]",
+        State( iPlayerState ), State( aNewState ), this );
+
+    iPlayerState = aNewState;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPMusicPlayer::State
+// --------------------------------------------------------------------------
+//
+const TDesC* CUPnPMusicPlayer::State( TPlayerState aState ) const
+    {
+    switch( aState )
+        {
+        case EStateUninitialised:
+            {
+            return &KStateUninitialized;
+            }
+        case EStateInitializing:
+            {
+            return &KStateInitializing;
+            }
+        case EStateUninitialising:
+            {
+            return &KStateUninitialising;
+            }
+         case EStateActive:
+            {
+            return &KStateActive;
+            }
+         case EStatePreInitializing:
+            {
+            return &KStatePreInitializing;
+            }
+         case EStatePreInitialized:
+            {
+            return &KStatePreInitialized;
+            }
+        case EStateWaiting:
+            {
+            return &KStateWaiting;
+            }
+        case EStateActiveForceInitialise:
+            {
+            return &KStateActiveForceInit;
+            }
+        case EStateError:
+            {
+            return &KStateError;
+            }
+        default:
+            {
+            return &KStateUnknown;
+            }
+        }
+    }
+
+ 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnpmusicpluginsproxy.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Defines ecom interface table
+*
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "upnpmusicplayer.h"
+
+#include "upnpmusicdownloadproxy.h"
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x200075D8, CUPnPMusicPlayer::NewL ),
+    IMPLEMENTATION_PROXY_ENTRY( 0x200075D9, CUPnPMusicDownloadProxy::NewL )
+    };
+
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+    TInt& aTableCount )
+    {
+    aTableCount = sizeof(ImplementationTable) /
+        sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnpplaybackstatemachine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,796 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Class for retrieving and selecting media renderers
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <mpxplaybackplugin.h>
+#include <mpxplaybackpluginobserver.h>
+#include "upnpavrenderingsession.h"
+#include "upnpavrenderingsessionobserver.h"
+#include "upnpavdevice.h"
+
+#include "upnpmusicplayer.h" // for parent.Observer()
+#include "upnptrack.h" // for TrackDuration
+#include "upnpvaluestatemachine.h" //
+#include "upnpplaybackstatemachine.h" // myself
+#include "upnppluginserrortranslation.h"
+
+_LIT( KComponentLogfile, "musicplugins.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KStateStoppedText, "Stopped" );
+_LIT( KStatePlayingText, "Playing" );
+_LIT( KStatePausedText, "Paused" );
+_LIT( KStateUnknownText, "Unknown" );
+
+const TInt KDurationErrorMargin = 500; // 0.5 seconds
+const TInt KPlaybackInfoTimeOut = 1000000; // 1s wait until device is ready
+const TInt KPlaybackInfoTimeOutEnd = 2000000; // 2s wait check whether
+    //the playing is ended
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPPlaybackStateMachine* CUPnPPlaybackStateMachine::NewL( 
+    CUPnPMusicPlayer& aParent,
+    MUPnPAVRenderingSession& aRenderingSession )
+    {
+    __LOG( "PlaybackStateMachine::NewL" );
+    CUPnPPlaybackStateMachine* self =
+        new(ELeave) CUPnPPlaybackStateMachine(
+            aParent, aRenderingSession );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::CUPnPPlaybackStateMachine
+// Default constructor.
+// --------------------------------------------------------------------------
+// 
+CUPnPPlaybackStateMachine::CUPnPPlaybackStateMachine( 
+    CUPnPMusicPlayer& aParent,
+    MUPnPAVRenderingSession& aRenderingSession )
+    :iParent( aParent )
+    ,iRendererSession( aRenderingSession )
+    ,iState( EStateStopped )
+    ,iCurrentOperation( EOperationNone )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::ConstructL()
+    {
+    __LOG( "CUPnPPlaybackStateMachine::ConstructL" );
+
+    // Create timer for observing duration query time out.
+    TInt64 iTime = 0;
+    iPlayMark = TTime( iTime );
+    iPauseMark = TTime( iTime );
+    iPeriodizer = CUPnPMusicPeriodizer::NewL( *this, KPlaybackInfoTimeOut );
+    iPeriodizerEnd = CUPnPMusicPeriodizer::NewL( *this, 
+        KPlaybackInfoTimeOutEnd );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::~CUPnPPlaybackStateMachine
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPPlaybackStateMachine::~CUPnPPlaybackStateMachine()
+    {
+    __LOG( "PlaybackStateMachine destructor" );
+    iOperationQueue.Close();
+    delete iPeriodizer;
+    delete iPeriodizerEnd;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::CommandL
+// Executes a command on the selected song.
+// --------------------------------------------------------------------------
+// 
+void CUPnPPlaybackStateMachine::CommandL( TMPXPlaybackCommand aCmd )
+    {
+    if ( aCmd == EPbCmdClose )
+        {
+        // close can be handled parallel to other commands
+        HandleCloseL();
+        return;
+        }
+
+    if ( !iCurrentOperation.None() )
+        {
+        __LOG( "PlaybackStateMachine::CommandL - Append to queue" );
+        iOperationQueue.AppendL( aCmd );
+        return;
+        }
+
+    switch( aCmd )
+        {
+        case EPbCmdPlay:
+            {            
+            if( iState == EStatePlaying )
+                {
+                // already playing - ignore
+                CheckOperationInQueueL();
+                }
+            else
+                {
+                __LOG( "PlaybackStateMachine: command play" );
+                iCurrentOperation = aCmd;
+                iRendererSession.PlayL();
+                } 
+            }
+            break;
+        case EPbCmdPause:
+            {
+            // Check if pause is supported by device
+            if( iParent.UsedRendererDevice().PauseCapability() )
+                {
+                if( iState == EStatePaused )
+                    {
+                    // already paused - ignore
+                    CheckOperationInQueueL();
+                    }
+                else
+                    {
+                    __LOG( "PlaybackStateMachine: command pause" );
+                    iCurrentOperation = aCmd;
+                    iRendererSession.PauseL();
+                    }
+                }
+            else
+                {
+                __LOG( "PlaybackStateMachine: Pause is not supported by \
+                device!" );
+                iParent.Observer().HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPPaused, 0,
+                    KErrNotSupported );
+                }
+            }
+            break;
+        case EPbCmdStop:
+            {
+            if( iState == EStateStopped )
+                {
+                // already stopped - ignore
+                CheckOperationInQueueL();
+                }
+            else
+                {
+                __LOG( "PlaybackStateMachine: command stop" );
+                iCurrentOperation = aCmd;
+                iRendererSession.StopL();
+                }
+            }
+            break;
+        case EPbCmdReplay:
+            {
+            iCurrentOperation = aCmd;
+                __LOG( "PlaybackStateMachine: command replay" );
+            if( iState == EStatePlaying || iState == EStatePaused )
+                {
+                // playing -must stop first
+                iRendererSession.StopL();
+                }
+            else
+                {
+                // just play
+                iRendererSession.PlayL();
+                }
+            }
+            break;
+        default: // Given command is not supported
+            {
+            __LOG( "PlaybackStateMachine: command default?" );
+            CheckOperationInQueueL();
+            User::Leave( KErrNotSupported );
+            break;
+            } 
+        } 
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::PositionL
+// Changes the position within the currently playing track
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::PositionL( TInt aPosition )
+    {
+    
+    // Ignore if already called.
+    if( iCurrentOperation == EOperationPositionToZero )
+        {
+        __LOG( "PlaybackStateMachine::PositionL - \
+        EOperationPositionToZero called twice -> ignored" );
+        return;
+        }
+    
+    if ( !iCurrentOperation.None() )
+        {
+        __LOG( "PlaybackStateMachine::PositionL - Append to queue" );
+        iOperationQueue.AppendL( EOperationPositionToZero );
+        return;
+        }
+    if ( aPosition != 0 )
+        {
+        CheckOperationInQueueL();
+        User::Leave( KErrNotSupported );
+        }
+
+    // handle Position(0)
+    if ( iState == EStatePlaying )
+        {
+        __LOG( "PlaybackStateMachine: position(0) while playing" );
+        iCurrentOperation = EOperationPositionToZero;
+        iRendererSession.StopL();
+        }
+    else if ( iState == EStatePaused )
+        {
+        __LOG( "PlaybackStateMachine: PositionL(0) while paused" );
+        iCurrentOperation = EOperationPositionToZeroDuringPause;
+        iRendererSession.StopL();
+        }
+    else if ( iState == EStateStopped )
+        {
+        __LOG( "PlaybackStateMachine: PositionL(0) while stopped" );
+        CheckOperationInQueueL();
+        
+        // immediate response !        
+        iParent.Observer().HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPSetComplete,
+            EPbPropertyPosition, KErrNone );
+        
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::SilentStopL
+// Stops playback, does not provide any ACK event
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::SilentStopL()
+    {
+    if ( !iCurrentOperation.None() )
+        {
+        __LOG( "PlaybackStateMachine::SilentStopL - Append to queue" );
+        iOperationQueue.AppendL( EOperationSilentStop );
+        return;
+        }
+
+    // handle stop
+    __LOG( "PlaybackStateMachine: SilentStopL" );
+    if( iState == EStateStopped )
+        {
+        // already stopped - ignore
+        CheckOperationInQueueL();
+        }
+    else
+        {
+        iCurrentOperation = EOperationSilentStop;
+        iRendererSession.StopL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::Cancel
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::Cancel()
+    {
+    // reset current operation and empty the queue -> no callbacks.
+    iCurrentOperation.Reset();
+    iOperationQueue.Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::HandleCloseL
+// Handles the close command
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::HandleCloseL()
+    {
+    if ( iCurrentOperation == EPbCmdStop )
+        {
+        // Stop pending - it can't be completed -> fake callback.
+        iParent.Observer().HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPStopped,
+            KErrNone, KErrNone );
+        }
+
+    iParent.Observer().HandlePluginEvent(
+        MMPXPlaybackPluginObserver::EPClosed,
+        KErrNone, KErrNone );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::InteractOperationComplete
+// Response for interaction operation (play, stop, etc.).
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::InteractOperationComplete( TInt aErrorCode, 
+    TUPnPAVInteractOperation aOperation )
+    {
+    __LOG1( "CUPnPPlaybackStateMachine::InteractOperationComplete: err:[%d]",
+        aErrorCode );
+    aErrorCode = TUpnpPluginsErrorTranslation::ErrorTranslate( aErrorCode );
+    switch( aOperation )
+        {
+        case EUPnPAVPlayUser:
+            {                
+            __LOG1( "PlaybackStateMachine: event play user, state[%d]",iState );
+
+            if ( aErrorCode == KErrNone )
+                {
+                if ( iState == EStatePaused )
+                    {
+                    TimeContinue();
+                    ChangeState( EStatePlaying );
+                    iParent.Observer().HandlePluginEvent( 
+                        MMPXPlaybackPluginObserver::EPPlaying, KErrNone,
+                        aErrorCode );
+                    if( iCurrentOperation == EPbCmdPlay )
+                        {
+                        iCurrentOperation.Reset();
+                        TRAP_IGNORE( CheckOperationInQueueL() );
+                        }
+                    }
+                else if ( iState == EStatePlaying )
+                    {
+                    iPeriodizer->Stop();
+                    iParent.HandlePlayStarted();
+                    }
+                else if ( iState == EStateStopped )
+                    {
+                    if ( iCurrentOperation == EPbCmdPlay ||
+                        iCurrentOperation == EPbCmdReplay )
+                        {
+                        TimePlay();
+                        iParent.HandlePlayStarted();
+                        ChangeState( EStatePlaying );
+                        iCurrentOperation.Reset();
+                        TRAP_IGNORE( CheckOperationInQueueL() );
+                        iParent.Observer().HandlePluginEvent( 
+                            MMPXPlaybackPluginObserver::EPPlaying, KErrNone,
+                            aErrorCode );
+                        }
+                    else
+                        {
+                        // spontaneous change to PLAYING state -> ignore
+                        }
+                    }
+                    
+                }
+            else
+                {
+                ChangeState( EStateUnknown );
+                }
+            break;
+            }
+        case EUPnPAVPlay: 
+            {
+            if ( iState == EStatePlaying )
+                {
+                __LOG( "PlaybackStateMachine: event play ignored" );
+                break;
+                }
+
+            __LOG( "PlaybackStateMachine: event play" );
+
+            if ( aErrorCode == KErrNone )
+                {
+                if ( iState == EStateStopped )
+                    {
+                    TimePlay();
+                    iPeriodizer->Start();
+                    iPeriodizerEnd->Start();           
+                    }
+                else if ( iState == EStatePaused )
+                    {
+                    TimeContinue();
+                    iPeriodizer->Stop();       
+                    iPeriodizer->Start();    
+                    iPeriodizerEnd->Stop();
+                    iPeriodizerEnd->Start();
+                    }
+                ChangeState( EStatePlaying );
+                }
+            else
+                {
+                ChangeState( EStateUnknown );
+                }
+
+                iCurrentOperation.Reset();
+                TRAP_IGNORE( CheckOperationInQueueL() );
+            break;
+            }
+        case EUPnPAVPauseUser:
+            {            
+            if ( !iCurrentOperation.None() ||
+                iState == EStatePaused )
+                {
+                __LOG( "PlaybackStateMachine: event pause user ignored" );
+                break;
+                }
+            __LOG( "PlaybackStateMachine: event pause user" );
+            
+            if( aErrorCode == KErrNone )
+                {
+                TimePause();
+                ChangeState( EStatePaused );
+                iPeriodizerEnd->Stop();
+                }
+            else
+                {
+                ChangeState( EStateUnknown );
+                }
+
+            // Call callback
+            iParent.Observer().HandlePluginEvent( 
+                MMPXPlaybackPluginObserver::EPPaused, KErrNone,
+                aErrorCode );
+            break;
+            }
+
+        case EUPnPAVPause:
+            {            
+            __LOG( "PlaybackStateMachine: event pause" );
+
+            TInt err = aErrorCode;
+            if( aErrorCode == KErrNone )
+                {
+                TimePause();
+                ChangeState( EStatePaused );
+                iPeriodizerEnd->Stop();
+                }
+            else if( aErrorCode == KErrNotSupported )
+                {
+                // Pause is supported (pause capability checked in CommandL )
+                // but device is not ready.
+                err = KErrNotReady;
+                }
+            else
+                {
+                ChangeState( EStateUnknown );
+                }
+
+            if ( iCurrentOperation == EPbCmdPause )
+                {
+                iCurrentOperation.Reset();
+                TRAP_IGNORE( CheckOperationInQueueL() );
+                iParent.Observer().HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPPaused, KErrNone,
+                    err );
+                }
+            else
+                {
+                iCurrentOperation.Reset();
+                TRAP_IGNORE( CheckOperationInQueueL() );
+                }
+            break;
+            }
+        case EUPnPAVStopUser:
+            {
+            iPeriodizerEnd->Stop();
+            if ( !iCurrentOperation.None() ||
+                iState == EStateStopped )
+                {
+                __LOG( "PlaybackStateMachine: event stop user ignored" );
+                break;
+                }
+            __LOG( "PlaybackStateMachine: event stop user" );
+
+            TBool trackComplete = TimeStop();
+            if ( aErrorCode == KErrNone )
+                {
+                ChangeState( EStateStopped );
+                iParent.HandlePlayComplete();
+                }
+            else
+                {
+                ChangeState( EStateUnknown );
+                }
+
+            // Call callback
+            if ( trackComplete )
+                {
+                __LOG( "PlaybackStateMachine: play complete event to user" );
+                iParent.Observer().HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPPlayComplete, KErrNone,
+                    aErrorCode );
+                }
+            else
+                {
+                __LOG( "PlaybackStateMachine: play stopped event to user" );
+                iParent.Observer().HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPStopped, KErrNone,
+                    aErrorCode );
+                }
+            break;
+            }       
+        case EUPnPAVStop:
+            {
+            iPeriodizerEnd->Stop();
+            if ( iState == EStateStopped )
+                {
+                // already in this state - ignore
+                break;
+                }
+            __LOG( "PlaybackStateMachine: event stop" );
+
+            if ( aErrorCode == KErrNone )
+                {                 
+                ChangeState( EStateStopped );
+                }
+            else
+                {
+                ChangeState( EStateUnknown );
+                }
+
+            if ( iCurrentOperation == EPbCmdStop )
+                {
+                iCurrentOperation.Reset();
+                TRAP_IGNORE( CheckOperationInQueueL() );
+                 // Call callback
+                iParent.Observer().HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPStopped, KErrNone,
+                    aErrorCode );
+                }
+            else if ( iCurrentOperation == EPbCmdReplay ||
+                iCurrentOperation == EOperationPositionToZero )
+                {
+                // continue with play
+                TRAP_IGNORE( iRendererSession.PlayL() );
+                }
+            else if ( iCurrentOperation ==
+                EOperationPositionToZeroDuringPause )
+                {
+                // position zero complete
+                iCurrentOperation.Reset();
+                TRAP_IGNORE( CheckOperationInQueueL() );
+               
+                iParent.Observer().HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPSetComplete,
+                    EPbPropertyPosition, aErrorCode );
+                }
+            else
+                {
+                // Note: covers also EOperationSilentStop
+                iCurrentOperation.Reset();
+                TRAP_IGNORE( CheckOperationInQueueL() );
+                }
+            break;
+            }
+        default:
+            {
+            __LOG( "PlaybackStateMachine: event default?" );
+            __PANICD( __FILE__, __LINE__ );
+            break;
+            }    
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::CheckOperationInQueueL
+// Checks if operations are in the queue, and executes
+// --------------------------------------------------------------------------
+//   
+void CUPnPPlaybackStateMachine::CheckOperationInQueueL()
+    {
+    if ( !iCurrentOperation.None() )
+        {
+        // check operation though a current operation exists!
+        __PANICD( __FILE__, __LINE__ );
+        return;
+        }
+
+    if ( iOperationQueue.Count() > 0 )
+        {
+        TOperation op = iOperationQueue[0];
+        iOperationQueue.Remove(0);
+        if ( op == EOperationCommand )
+            {
+            CommandL( op.iCmd );
+            }
+        else if ( op == EOperationPositionToZero )
+            {
+            PositionL( 0 );
+            }
+        else
+            {
+            __PANICD( __FILE__, __LINE__ );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::TimePlay
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::TimePlay()
+    {
+    iPlayMark.UniversalTime();
+    iPausetime = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::TimePause
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::TimePause()
+    {
+    iPauseMark.UniversalTime();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::TimeContinue
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::TimeContinue()
+    {
+    TTime continueMark;
+    continueMark.UniversalTime();
+    TTimeIntervalMicroSeconds paused =
+        continueMark.MicroSecondsFrom( iPauseMark );
+    iPausetime += ( paused.Int64() / 1000 );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::TimeStop
+// --------------------------------------------------------------------------
+//
+TBool CUPnPPlaybackStateMachine::TimeStop()
+    {
+    TBool isCompleted = ETrue;
+    if ( !iPlayMark.Int64() )
+        {
+        isCompleted = EFalse; 
+        return isCompleted;  
+        }
+    TTime stopMark;
+    stopMark.UniversalTime();
+    TTimeIntervalMicroSeconds played =
+        stopMark.MicroSecondsFrom( iPlayMark );
+
+    TInt duration = iParent.Track().TrackDuration();
+    TInt playtime = ( played.Int64() / 1000 ) - iPausetime;
+    __LOG3("PlaybackStateMachine: playtime=%d duration=%d (pausetime=%d)",
+        playtime/1000, duration/1000, iPausetime/1000 );
+
+    if ( playtime >= 0 &&
+        playtime < duration - KDurationErrorMargin )
+        {
+        // [0 - duration-margin]
+        isCompleted= EFalse;
+        }
+    else if ( playtime >= duration - KDurationErrorMargin &&
+        playtime <= duration + KDurationErrorMargin )
+        {
+        // [duration-margin - duration+margin]
+        isCompleted= ETrue;
+        }
+    else
+        {
+        // position either negative or greater than duration ??
+        __LOG2("Time ERROR: play=%d duration=%d ?", playtime, duration );
+        isCompleted= ETrue;
+        }
+
+    return isCompleted;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::ChangeState
+// Changes the class state
+// --------------------------------------------------------------------------
+//
+void CUPnPPlaybackStateMachine::ChangeState( TState aNewState )
+    {
+    __LOG2( "PlaybackStateMachine: STATE %S -> %S",
+        State( iState ), State( aNewState ) );
+    iState = aNewState;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::State
+// --------------------------------------------------------------------------
+//
+const TDesC* CUPnPPlaybackStateMachine::State( TState aState )
+    {
+    switch( aState )
+        {
+        case EStateStopped:
+            return &KStateStoppedText;
+        case EStatePlaying:
+            return &KStatePlayingText;
+        case EStatePaused:
+            return &KStatePausedText;
+        default:
+            return &KStateUnknownText;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::HandlePeriod
+// Action when timer has expired.
+// --------------------------------------------------------------------------
+// 
+void CUPnPPlaybackStateMachine::HandlePeriod()
+    {
+    __LOG( "CUPnPPlaybackStateMachine::HandlePeriod" );
+
+    // Remote device is ready for give playback information.
+    iPeriodizer->Stop();
+    iParent.HandlePlayStarted();
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::HandlePeriodForEnd
+// Action when timer has expired.
+// --------------------------------------------------------------------------
+// 
+void CUPnPPlaybackStateMachine::HandlePeriodForEnd()
+    {
+    TBool trackComplete = TimeStop();
+    if ( trackComplete )
+        {
+        iPeriodizerEnd->Stop();
+        PlayOvertimeEnd();    
+        }
+    else
+        {      
+        iPeriodizerEnd->Start(); 
+        }           
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPPlaybackStateMachine::PlayOvertimeEnd
+// Stoping the playing song.
+// --------------------------------------------------------------------------
+// 
+ void CUPnPPlaybackStateMachine::PlayOvertimeEnd()
+     {
+     if ( !iCurrentOperation.None() ||
+         iState == EStateStopped || iState == EStateUnknown)
+        {
+        return;
+        }
+     ChangeState( EStateStopped );  
+     iParent.HandlePlayComplete();       
+     iParent.Observer().HandlePluginEvent( 
+          MMPXPlaybackPluginObserver::EPPlayComplete, KErrNone,
+          KErrNone ); 
+     }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnppluginserrortranslation.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      translate all plugins error code for music player
+ *
+*/
+
+
+
+
+
+
+// INCLUDES
+
+// debug
+#include <e32std.h>
+#include "upnppluginserrortranslation.h"
+_LIT( KComponentLogfile, "musicplugins.txt");
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// TUpnpPluginsErrorTranslation::ErrorTranslate
+// translate function
+// --------------------------------------------------------------------------
+//
+TInt TUpnpPluginsErrorTranslation::ErrorTranslate( TInt aError)
+    {
+    TInt newError = KErrNone;
+    if ( aError != KErrNone)
+        {
+        __LOG1( "TUpnpPluginsErrorTranslation  err=%d", aError );
+        }
+    switch ( aError)
+        {
+        // if aError is valid, we don't need translate
+        case KErrNone:
+            newError = KErrNone;
+            break;
+        case KErrNotFound:
+            newError = KErrGeneral;
+            break;
+        case KErrNotSupported:
+            newError = KErrNotSupported;
+            break;
+        case KErrCorrupt:
+            newError = KErrCorrupt;
+            break;
+        case KErrCompletion:
+            newError = KErrCompletion;
+            break;
+        case KErrDied:
+            newError = KErrDied;
+            break;
+        case KErrGeneral:
+            newError = KErrGeneral;
+            break;
+        case KErrAccessDenied:
+            newError = KErrAccessDenied;
+            break;
+        case KErrArgument:
+            newError = KErrArgument;
+            break;
+        case KErrDisconnected:
+            newError = KErrDisconnected;
+            break;
+        case KErrDiskFull: //consume current disk full
+            newError = KErrDiskFull;
+            break;
+        case KErrNoMemory://consume memory entirely
+            newError = KErrNoMemory;
+            break;
+        case KErrOverflow:
+            newError = KErrGeneral;
+            break;    
+       	case KErrServerBusy://if Server has no memory
+            newError = KErrServerBusy;
+            break;
+            // if aError is not valid, we need translate
+        case KErrCancel: //fall through
+        case KErrTotalLossOfPrecision: ////fall through
+        case KErrBadHandle: //fall through
+        case KErrUnderflow: //fall through
+        case KErrAlreadyExists: //fall through
+        case KErrPathNotFound: //fall through
+        case KErrInUse: //fall through
+        case KErrServerTerminated: //fall through
+        case KErrNotReady: //fall through
+        case KErrUnknown: //fall through
+        case KErrLocked: //fall through
+        case KErrWrite: //fall through
+        case KErrDisMounted: //fall through
+        case KErrEof: //fall through
+        case KErrBadDriver: //fall through
+        case KErrBadName: //fall through
+        case KErrCommsLineFail: //fall through
+        case KErrCommsFrame: //fall through
+        case KErrCommsOverrun: //fall through
+        case KErrCommsParity: //fall through
+        case KErrTimedOut: //fall through
+        case KErrCouldNotConnect: //fall through
+        case KErrCouldNotDisconnect: //fall through
+        case KErrBadLibraryEntryPoint: //fall through
+        case KErrBadDescriptor: //fall through
+        case KErrAbort: //fall through
+        case KErrTooBig: //fall through
+        case KErrDivideByZero: //fall through
+        case KErrBadPower: //fall through
+        case KErrDirFull: //fall through
+        case KErrHardwareNotAvailable: //fall through
+        case KErrSessionClosed: //fall through
+        case KErrPermissionDenied: //fall through
+        case KErrExtensionNotSupported: //fall through
+        case KErrCommsBreak:
+            newError = KErrDisconnected;
+            break;
+        default:
+            newError = KErrDisconnected;
+            break;
+        }
+
+    return newError;
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnpsingleton.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,548 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Singleton class for main upnp related services
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <badesca.h>
+#include "upnpavcontrollerfactory.h"
+#include "upnpavcontroller.h"
+#include "upnpavdevice.h"
+#include "upnpavdevicelist.h"
+#include "upnprendererselectorobserver.h"
+#include "upnpsingleton.h"
+
+// CONSTANTS
+const TInt KDefaultGranularity = 5;
+const TInt32 KRendererRequestTimeOut = 5000000;
+
+_LIT( KComponentLogfile, "musicplugins.txt");
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// Static members of CUPnPSingleton
+// --------------------------------------------------------------------------
+//
+
+// reference count
+TInt CUPnPSingleton::iInstanceCount = 0;
+
+// reference count
+CUPnPSingleton* CUPnPSingleton::iInstance = 0;
+
+// default device index
+TInt CUPnPSingleton::iDefaultRendererIndex;
+
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::GetInstanceL
+// singleton constructor
+// --------------------------------------------------------------------------
+//
+CUPnPSingleton* CUPnPSingleton::GetInstanceL()
+    {
+    if( iInstanceCount == 0 )
+        {
+        CUPnPSingleton* self = new(ELeave) CUPnPSingleton();
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        CleanupStack::Pop( self );
+        iInstance = self;
+        }
+
+    ++iInstanceCount;
+    return iInstance;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::CUPnPSingleton
+// Default constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPSingleton::CUPnPSingleton()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::ConstructL
+// ConstructL.
+// --------------------------------------------------------------------------
+//
+void CUPnPSingleton::ConstructL()
+    {
+    // Create timer for observing play time out.
+    iPeriodizer = CUPnPMusicPeriodizer::NewL( *this,
+        KRendererRequestTimeOut );
+
+    // Create handle to AVController
+    iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL();
+    iAVController->SetDeviceObserver( *this );
+    CacheRendererListL();
+    if ( iMediaRenderers.Count() > 0 )
+        {
+        iSelectorState = EStateReady;
+        }
+    else
+        {
+        iSelectorState = EStateWaiting;
+        iPeriodizer->Start();
+        }
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::LoseInstance
+// singleton desctuctor
+// --------------------------------------------------------------------------
+//
+void CUPnPSingleton::LoseInstance( CUPnPSingleton* aInstance )
+    {
+    if( aInstance != 0 )
+        {
+        __ASSERTD( aInstance == iInstance,__FILE__, __LINE__ );
+        __ASSERTD( iInstanceCount > 0,__FILE__, __LINE__ );
+        --iInstanceCount;
+        if( iInstanceCount == 0 )
+            {
+            delete iInstance;
+            iInstance = 0;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::~CUPnPSingleton
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPSingleton::~CUPnPSingleton()
+    {
+    __LOG("CUPnPSingleton::~CUPnPSingleton()");
+    iMediaRenderers.ResetAndDestroy();
+    delete iPeriodizer;
+    if( iAVController )
+        {
+        iAVController->Release();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::GetRendererNamesL
+// Get renderes from AVController and return the renderer names.
+// --------------------------------------------------------------------------
+//  
+void CUPnPSingleton::GetRendererNamesL(
+    MUPnPRendererSelectorObserver& aObserver )
+    {
+    __ASSERTD( iRendererselectorObserver == 0,__FILE__, __LINE__ );
+    iRendererselectorObserver = &aObserver;
+
+    switch( iSelectorState )
+        {
+        case EStateWaiting:
+            {
+            __LOG("GetRendererNames: waiting");
+            // wait for something to happen
+            }
+            break;
+        case EStateComplete:
+            {
+            __LOG("GetRendererNames: complete->ready");
+            DeliverNamesToObserverL( ETrue );
+            iSelectorState = EStateReady;
+            }
+            break;
+        case EStateReady:
+            {
+            CacheRendererListL();
+            if ( iMediaRenderers.Count() > 0 )
+                {
+                __LOG("GetRendererNames: ready");
+                DeliverNamesToObserverL( ETrue );
+                }
+            else
+                {
+                __LOG("GetRendererNames: ready->waiting");
+                iSelectorState = EStateWaiting;
+                iPeriodizer->Start();
+                }
+            }
+            break;
+        case EStateError:
+            {
+            __LOG("GetRendererNames: error");
+            DeliverNamesToObserverL( ETrue, KErrDisconnected );
+            }
+            break;
+        default:
+            {
+            __PANICD(__FILE__, __LINE__ );
+            }
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::CancelGetRendererNames
+// --------------------------------------------------------------------------
+//
+void CUPnPSingleton::CancelGetRendererNames()
+    {
+    // just clear the observer -> no callbacks will occur.
+    iRendererselectorObserver = 0;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::SelectRendererByIndexL
+// Select renderer by given index.
+// --------------------------------------------------------------------------
+//
+const CUpnpAVDevice* CUPnPSingleton::SelectRendererByIndexL( TInt aIndex )
+    {
+     if( iMediaRenderers.Count() <= aIndex || aIndex < 0 )
+        {        
+        __LOG("CUPnPSingl::SelectRendererByIndexL error: Wrong index");
+        User::Leave( KErrArgument );
+        }
+        
+    if ( iRendererselectorObserver != 0 )
+        {
+        DeliverNamesToObserverL( ETrue );
+        }
+
+    if ( !IsAvailable( *iMediaRenderers[aIndex] ) )
+        {
+        __LOG("CUPnPSingl::SelectRendererByIndexL error: disconnected");
+        User::Leave( KErrDisconnected );
+        }
+
+    iDefaultRendererIndex = aIndex;
+
+    return iMediaRenderers[aIndex];
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::DefaultDevice
+// Return return pointer of current renderer
+// --------------------------------------------------------------------------
+//
+const CUpnpAVDevice* CUPnPSingleton::DefaultDevice()
+    {
+    if ( iDefaultRendererIndex >= 0 )
+        {
+        return iMediaRenderers[iDefaultRendererIndex];
+        }
+    else
+        {
+        return 0;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::AVC
+// Provides reference to the AVController resource
+// --------------------------------------------------------------------------
+//
+MUPnPAVController& CUPnPSingleton::AVC()
+    {
+    return *iAVController;
+    }
+
+    
+// --------------------------------------------------------------------------
+// Method from MUPnPAVMediaObserver
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::UPnPDeviceDiscovered
+// Inform that new renderer device has discovered.
+// --------------------------------------------------------------------------
+//
+void CUPnPSingleton::UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice  )
+    {
+    // Check if device is media renderer
+    if( aDevice.DeviceType() == CUpnpAVDevice::EMediaRenderer 
+        && aDevice.AudioCapability() )
+        {
+        if ( iSelectorState == EStateWaiting ||
+             iSelectorState == EStateComplete )
+            {
+            CUpnpAVDevice* dev = 0;
+            TRAP_IGNORE( dev = CUpnpAVDevice::NewL( aDevice ) );
+            if( dev )
+                {
+                iMediaRenderers.Append( dev );
+                if ( iRendererselectorObserver != 0 )
+                    {
+                    TRAP_IGNORE( DeliverNamesToObserverL( EFalse ) );
+                    }
+                }
+            }
+        }
+    else
+        {
+        // Do nothing with media servers
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::UPnPDeviceDisappeared
+// Inform that renderer device has disappeared.
+// --------------------------------------------------------------------------
+//   
+void CUPnPSingleton::UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice )
+    {
+    // Check if device is media renderer
+    if( aDevice.DeviceType() == CUpnpAVDevice::EMediaRenderer 
+        && aDevice.AudioCapability() )
+        {
+        if ( iSelectorState == EStateWaiting ||
+             iSelectorState == EStateComplete )
+            {
+            // In monitoring state. Remove the renderer from cache.
+            TInt count = iMediaRenderers.Count();
+            for( TInt i = 0; i < count; i++ )
+                {
+                if( aDevice.Uuid().Compare(
+                    iMediaRenderers[i]->Uuid() ) == 0 )
+                    {
+                    iMediaRenderers.Remove(i);
+                    // we removed an renderer from the list so we want to 
+                    // continue the loop with the same i.
+                    // Could break here if absolutely sure that there are 
+                    // no duplicates in iMediaRenderers.
+                    count--;
+                    i--; 
+                    }
+                }
+            if ( iRendererselectorObserver != 0 )
+                {
+                TRAP_IGNORE( DeliverNamesToObserverL( EFalse ) );
+                }
+            }
+        else if ( iSelectorState == EStateReady )
+            {
+            // Device disappears in ready state. Can't remove from cache
+            // (because we use indexing to select to renderers)
+            // instead mark the renderer unusable.
+            __LOG( "Singleton: renderer disappeared in Ready state" );
+            TInt count = iMediaRenderers.Count();
+            TBool done = EFalse;
+            for( TInt i = 0; i < count && !done; i++ )
+                {
+                if( aDevice.Uuid().Compare(
+                    iMediaRenderers[i]->Uuid() ) == 0 )
+                    {
+                    SetAvailable( *iMediaRenderers[i], EFalse );
+                    done = ETrue;
+                    }
+                }
+            }
+        }
+    else
+        {
+        // Do nothing with media servers
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::WLANConnectionLost
+// Inform that renderer device has disappeared.
+// --------------------------------------------------------------------------
+// 
+void CUPnPSingleton::WLANConnectionLost()
+    {
+    iMediaRenderers.ResetAndDestroy();
+    if ( iSelectorState == EStateWaiting )
+        {
+        iPeriodizer->Stop();
+        }
+
+    iSelectorState = EStateError;
+
+    if ( iRendererselectorObserver != 0 )
+        {
+        TRAP_IGNORE( DeliverNamesToObserverL( ETrue, KErrDisconnected ) );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Methods of MUPnPMusicPeriodizerObserver
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::HandlePeriod
+// Action when timer has expired.
+// --------------------------------------------------------------------------
+// 
+void CUPnPSingleton::HandlePeriod()
+    {
+    __ASSERTD( iSelectorState == EStateWaiting,__FILE__, __LINE__ );
+
+    if ( iMediaRenderers.Count() > 0 )
+        {
+        __LOG("GetRendererNames: timeout->complete");
+        iSelectorState = EStateComplete;
+        if ( iRendererselectorObserver != 0 )
+            {
+            __LOG("GetRendererNames: complete->ready");
+            iSelectorState = EStateReady;
+            TRAP_IGNORE( DeliverNamesToObserverL( ETrue ) );
+            }
+        }
+    else
+        {
+        __LOG("GetRendererNames: timeout->continue timer");
+        iPeriodizer->Continue();
+        if ( iRendererselectorObserver != 0 )
+            {
+            TRAP_IGNORE( DeliverNamesToObserverL( ETrue ) );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Private methods of CUPnPRendererSelector
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::CacheRendererListL
+// Refreshes the renderer cache from AVController
+// --------------------------------------------------------------------------
+// 
+void CUPnPSingleton::CacheRendererListL()
+    {
+    // Clean old devices array and device names
+    iDefaultRendererIndex = KErrNotFound;
+
+    // Get media renderers
+    CUpnpAVDeviceList* devices = iAVController->GetMediaRenderersL();
+    CleanupStack::PushL( devices );
+
+    // go through current renderer list
+    for ( TInt i = 0; i < iMediaRenderers.Count(); ++i )
+        {
+        CUpnpAVDevice* renderer = iMediaRenderers[ i ];
+        TBool exists = EFalse;
+        for ( TInt j = 0; j < devices->Count() && !exists; ++j )
+            {
+            CUpnpAVDevice* device = (*devices)[j];
+            if ( renderer->Uuid() == device->Uuid())
+                {
+                // renderer still exists.
+                delete device;
+                devices->Remove( j );
+                SetAvailable( *renderer, ETrue );
+                --j;
+                exists = ETrue;
+                }
+            }
+        if ( !exists )
+            {
+            // renderer has disappeared
+            delete renderer;
+            iMediaRenderers.Remove( i );
+            --i;
+            }
+        }
+
+    // Remaining devices are all new. Add them to end of the list.
+    while ( devices->Count() > 0 )
+        {
+         __LOG("CacheRendererListL::Remaining devices are all new.");
+        CUpnpAVDevice* device = (*devices)[ 0 ];
+        if( device->AudioCapability() )
+            {
+            iMediaRenderers.Append( device );
+            }
+        devices->Remove( 0 );
+        }
+
+    CleanupStack::PopAndDestroy( devices ); 
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::DeliverNamesToObserverL
+// Delivers current names in cached list to observer
+// --------------------------------------------------------------------------
+// 
+void CUPnPSingleton::DeliverNamesToObserverL( TBool aCompleted,
+    TInt aError )
+    {
+    __ASSERTD( iRendererselectorObserver != 0,__FILE__, __LINE__ );
+
+    // Create an array for names
+    CDesCArrayFlat* deviceNames = new(ELeave) CDesCArrayFlat( 
+        KDefaultGranularity );
+    CleanupStack::PushL( deviceNames );
+
+    TInt count = iMediaRenderers.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        HBufC* buf = HBufC::NewL(
+            iMediaRenderers[i]->FriendlyName().Length() );
+        CleanupStack::PushL( buf );
+        buf->Des().Copy( iMediaRenderers[i]->FriendlyName() );
+        deviceNames->AppendL( *buf ); // Transfer ownership
+        CleanupStack::PopAndDestroy( buf );
+        }
+
+    // Call back current renderer names
+    __LOG1( "DeliverNamesToObserver: count=%d", count );
+    MUPnPRendererSelectorObserver& obs = *iRendererselectorObserver;
+    iRendererselectorObserver = 0;
+    obs.HandleSubPlayerNames( deviceNames, aCompleted, aError );
+
+    CleanupStack::PopAndDestroy( deviceNames );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::IsAvailable
+// checks if the device type is renderer
+// --------------------------------------------------------------------------
+// 
+TBool CUPnPSingleton::IsAvailable( const CUpnpAVDevice& aDevice ) const
+    {
+    return aDevice.DeviceType() == CUpnpAVDevice::EMediaRenderer;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSingleton::SetAvailable
+// sets the device type to an illegal unrecognized type
+// --------------------------------------------------------------------------
+// 
+void CUPnPSingleton::SetAvailable(
+    CUpnpAVDevice& aDevice, TBool aAvailable ) const
+    {
+    if ( aAvailable && !IsAvailable( aDevice ) )
+        {
+        __LOG1( "CUPnPSingleton: renderer available: %S",
+            &aDevice.FriendlyName() );
+        aDevice.SetDeviceType(
+            CUpnpAVDevice::EMediaRenderer );
+        }
+    else if ( !aAvailable && IsAvailable ( aDevice ) )
+        {
+        __LOG1( "CUPnPSingleton: renderer not available: %S",
+            &aDevice.FriendlyName() );
+        aDevice.SetDeviceType(
+            (CUpnpAVDevice::TUpnpAVDeviceType)KErrUnknown );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnptrack.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,754 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Class for containing and obtaining music track-specific data
+*                from media server
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmedia.h>
+#include <mpxattribute.h>
+#include <mpxplaybackpluginobserver.h>
+#include <mpxmessagegeneraldefs.h> // for messaging
+#include <mpxplaybackmessagedefs.h> // for messaging
+
+#include <escapeutils.h> // for unicode conversion
+
+#include <upnpitem.h>
+#include <upnpobject.h>
+#include "upnpitemutility.h" // for FindElementByName & ResourceFromItemL
+#include "upnpfileutility.h" // for IsFileProtectedL
+#include "upnpconstantdefs.h" // browse filtering and item element names
+#include <upnpdlnaprotocolinfo.h> // for resolving object mimetype
+#include "upnpavcontroller.h"
+#include "upnpavbrowsingsession.h"
+#include "upnpavdevice.h"
+#include "upnpavdevicelist.h"
+
+#include "upnpitemresolverobserver.h" // MUPnPItemResolverObserver
+#include "upnpitemresolverfactory.h" // factory class
+#include "upnpitemresolver.h" // MUPnPItemResolver
+
+#include "upnptrackobserver.h"
+#include "upnptrack.h"
+
+_LIT( KComponentLogfile, "musicplugins.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT16( KUPnPPrefix, "upnp:" );   // Prefix for separate local/remote song
+const TInt KUPnPPrefixLength = 5;
+const TInt KCharCodeColon = 58;
+const TInt KCharCodeSeparate = 42;
+const TInt InitialTrackDuration = 1;
+_LIT( KTimeFormatYearOnly, "%F%Y" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPTrack* CUPnPTrack::NewL( MUPnPAVController& aAvController )
+    {
+    __LOG( "CUPnPTrack::NewL" );
+    CUPnPTrack* self = new( ELeave ) CUPnPTrack( aAvController );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::Delete
+// deletor
+// --------------------------------------------------------------------------
+//
+void CUPnPTrack::Delete()
+    {
+    __LOG1( "CUPnPTrack::Delete, state=%d", iState );
+    if ( iState == EStateResolving )
+        {
+        // asynchronous delete - will be deleted after
+        // asynchronous operation is complete. This is because the
+        // S60 command can not be cancelled
+        iState = EStateSelfDestruct;
+        }
+    else
+        {
+        delete this;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::CUPnPTrack
+// Default constructor.
+// --------------------------------------------------------------------------
+// 
+CUPnPTrack::CUPnPTrack( MUPnPAVController& aAvController )
+    : iAvController( aAvController )
+    , iQueriedAttributes()
+    {
+    iBrowsingSession = NULL;
+    iOriginalURI = NULL;
+    iMediaServer = NULL;
+    iObjectId = NULL;
+    iTrackObserver = NULL;
+    // Use initial duration value (1). It will guarantee that in
+    // case were remote device does not support duration query and playback
+    // is unpaused, SetPosition is called with real value even
+    // if remote player does not return real value for getposition
+    // call. Note that SetPosition(0) is used when user really wants
+    // to move to track beginning.
+    iTrackDuration = InitialTrackDuration;
+    iIsItemSolved = EFalse;
+    iState = EStateIdle;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::~CUPnPTrack
+// destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPTrack::~CUPnPTrack()
+    {
+    __LOG( "CUPnPTrack::~CUPnPTrack()" );
+    StopBrowsingSession();
+
+    // Free memory of owned members
+    delete iOriginalURI;
+    delete iMediaServer;        
+    delete iObjectId;
+    delete iItemResolver;
+    iItemResolver = 0;
+    __LOG( "CUPnPTrack::~CUPnPTrack End" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::ResolveURIL
+// Resolve local / remote URI.
+// --------------------------------------------------------------------------
+//
+void CUPnPTrack::ResolveURIL( const TDesC& aCodedTrackUri,
+    MUPnPTrackObserver& aTrackObserver,
+    TPlaybackDirection aPlaybackDirection )
+    {  
+    __LOG( "CUPnPTrack::ResolveURI" );
+
+    delete iOriginalURI;
+    iOriginalURI = 0;
+    delete iMediaServer;
+    iMediaServer = 0;
+    delete iObjectId;
+    iObjectId = 0;
+    iTrackObserver = &aTrackObserver;
+
+    // Either local to remote or remote to remote
+    if( aPlaybackDirection == EDirectionRemote )
+        {
+        if( aCodedTrackUri.Find( KUPnPPrefix ) == 0 )
+            {
+            // track is located in remote
+            iTrackLocation = ETrackLocationRemote;
+            // parse and save media server id and object id
+            ParsePiecesL( aCodedTrackUri );
+            // start a browsing session
+            StartBrowsingSessionL();
+            // create resolver 
+            iItemResolver =
+                UPnPItemResolverFactory::NewRemoteItemResolverL(
+                *iObjectId, *iBrowsingSession, 
+                iDefaultSelector, KFilterCommon );
+            }
+        else // Local stored. Save URI to local member
+            {
+            // track is located in local file system
+            iTrackLocation = ETrackLocationLocal;
+            // store original URI
+            iOriginalURI = HBufC::NewL( aCodedTrackUri.Length() );
+            iOriginalURI->Des().Copy( aCodedTrackUri );
+			// check for DRM protection
+			if ( UPnPFileUtility::IsFileProtectedL( iOriginalURI->Des() ) )
+				{
+				// call back directly with an error code
+				iTrackObserver->ResolveURIComplete( KErrNotSupported );
+				return;
+				}
+			else
+				{
+	            // create resolver.
+	            iItemResolver =
+	                UPnPItemResolverFactory::NewLocalItemResolverL(
+						*iOriginalURI, iAvController, iFirstSelector,
+						UPnPItemResolverFactory::EOmitDrmCheck );
+				}
+            }
+        }
+    else // Remote to local direction
+        {
+        // track is located in remote
+        iTrackLocation = ETrackLocationRemote;
+        // parse and save media server id and object id
+        ParsePiecesL( aCodedTrackUri );
+        // start a browsing session
+        StartBrowsingSessionL();
+        // create resolver
+        iItemResolver =
+            UPnPItemResolverFactory::NewDownloadItemResolverL(
+            *iObjectId, iAvController, *iBrowsingSession, 
+            iFirstSelector, KFilterCommon );
+        }
+
+    // Resolve remote item. Calls back to ResolveComplete
+    iState = EStateResolving;
+    TRAPD( e, iItemResolver->ResolveL( *this ); )
+    if ( e != KErrNone )
+        {
+        if ( iState == EStateSelfDestruct )
+            {
+            __LOG( "CUPnPTrack: self-destructing" );
+            delete this;
+            }
+        else
+            {
+            iState = EStateIdle;
+            User::Leave( e );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::StartBrowsingSessionL
+// Finds the apropriate mediaserver and starts a browsing session
+// --------------------------------------------------------------------------
+//
+void CUPnPTrack::StartBrowsingSessionL()
+    {
+    // Get list of media servers                 
+    CUpnpAVDeviceList* devices = iAvController.GetMediaServersL();
+    CleanupStack::PushL( devices );
+
+    // Find out index of wanted media server from media server list 
+    TInt index = KErrNotFound; 
+    TInt count = devices->Count();
+
+    for( TInt i = 0; i < count; i++ )
+        {                                              
+        // If media server id match.
+        if( !iMediaServer->Compare( (*devices)[ i ]->Uuid() ) )
+            {
+            index = i;
+            break;      
+            }
+        }
+
+    // Leave if media server does not find by id 
+    if( index == KErrNotFound )
+        {
+        __LOG1( "CUPnPTrack: Media server not found: %S",
+            iMediaServer );
+        User::Leave( KErrNotFound );    
+        }
+
+    // start a browsing session
+    iBrowsingSession = &iAvController.StartBrowsingSessionL(
+        *(*devices)[ index ] );
+    CleanupStack::PopAndDestroy( devices );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::StopBrowsingSession
+// Finds the apropriate mediaserver and starts a browsing session
+// --------------------------------------------------------------------------
+//
+void CUPnPTrack::StopBrowsingSession()
+    {
+    // Stop browsing session if exist.
+    if( iBrowsingSession )
+        {
+        __LOG( "Stop browsing session" );
+        iAvController.StopBrowsingSession( *iBrowsingSession );
+        iBrowsingSession = 0;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::URI
+// Return original URI of track.
+// --------------------------------------------------------------------------
+//  
+const TDesC& CUPnPTrack::URI() const
+    {
+    __ASSERTD( iOriginalURI != 0,__FILE__, __LINE__ );
+    return *iOriginalURI;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::UpnpURI
+// Return True UPNP URI of track.
+// --------------------------------------------------------------------------
+//  
+const TDesC8& CUPnPTrack::UpnpURI() const
+    {
+    __ASSERTD( iIsItemSolved,__FILE__, __LINE__ );
+    return iItemResolver->Resource().Value();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::UpnpItem
+// Return True UPNP item representing the track
+// --------------------------------------------------------------------------
+//  
+const CUpnpItem& CUPnPTrack::UpnpItem() const
+    {
+    __ASSERTD( iIsItemSolved,__FILE__, __LINE__ );
+    return iItemResolver->Item();
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPTrack::FilePath
+// Returns the file path of local item 
+// --------------------------------------------------------------------------
+//  
+const TDesC& CUPnPTrack::FilePath() const
+    {
+    __ASSERTD( iTrackLocation == ETrackLocationRemote, __FILE__, __LINE__ );
+    __ASSERTD( iIsItemSolved,__FILE__, __LINE__ );
+    return iItemResolver->Resource().FilePath();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::IsRemote
+// Return location of track. ETrue = remote. EFalse = local
+// --------------------------------------------------------------------------
+//  
+TBool CUPnPTrack::IsRemote() const
+    {
+    return iTrackLocation == ETrackLocationRemote;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::TrackDuration
+// returns duration of the track
+// --------------------------------------------------------------------------
+// 
+TInt CUPnPTrack::TrackDuration()
+    {
+    __LOG1( "CUPnPTrack::TrackDuration duration: %d", iTrackDuration );
+    TInt ms = InitialTrackDuration;
+    if ( iTrackDuration > InitialTrackDuration )
+        {
+        ms = iTrackDuration;
+        }
+    else if ( iIsItemSolved )
+        {
+        const CUpnpAttribute* attr = UPnPItemUtility
+            ::FindAttributeByName( iItemResolver->Resource(),
+             KAttributeDuration );
+        if ( attr != 0 )
+            {
+            if ( UPnPItemUtility::UPnPDurationAsMilliseconds(
+                attr->Value(), ms ) == KErrNone )
+                {
+                // store duration for quicker future queries
+                iTrackDuration = ms;
+                __LOG1( "store duration: %d", iTrackDuration );
+                }
+            }
+        }
+    return ms;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::SetTrackDuration
+// overrides duration of the track
+// --------------------------------------------------------------------------
+// 
+void CUPnPTrack::SetTrackDuration( TInt aMilliseconds )
+    {
+    iTrackDuration = aMilliseconds;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::GetMetaDataL
+// Get metadata information for track from media server
+// --------------------------------------------------------------------------
+//  
+void CUPnPTrack::GetMetaDataL( const TArray<TMPXAttribute>& aAttrs, 
+    MMPXPlaybackPluginObserver& aObs )
+    {
+    // Check if remote track
+    if( iTrackLocation == ETrackLocationLocal )
+        {
+        __LOG( "CUPnPTrack::GetMetaData - No metadata for local track!" );
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iIsItemSolved )
+        {
+        __LOG( "CUPnPTrack::GetMetaDataL" );
+        DeliverMedataL( aAttrs, aObs );
+        }
+    else
+        {
+        __LOG( "CUPnPTrack::GetMetaDataL - pending" );
+        iMetadataObserver = &aObs;
+        for( TInt i = 0; i < aAttrs.Count(); ++i )
+            {
+            iQueriedAttributes.Append( aAttrs[i] );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::SendMediaChangedEventL
+// --------------------------------------------------------------------------
+// 
+void CUPnPTrack::SendMediaChangedEventL(
+    MMPXPlaybackPluginObserver& aObs )
+    {
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.AppendL( KMPXMediaGeneralTitle );
+    attrs.AppendL( KMPXMediaMusicArtist );
+    attrs.AppendL( KMPXMediaMusicAlbum );
+    attrs.AppendL( KMPXMediaMusicGenre );
+    attrs.AppendL( KMPXMediaGeneralDate );
+    attrs.AppendL( KMPXMediaMusicYear );
+    attrs.AppendL( KMPXMediaGeneralComment );
+    attrs.AppendL( KMPXMediaGeneralMimeType );
+
+    // Create and fill CMPXMedia class 
+    RArray<TInt> suppIds;
+    CleanupClosePushL( suppIds );
+    suppIds.AppendL( KMPXMediaIdMusic );
+    suppIds.AppendL( KMPXMediaIdGeneral );
+    suppIds.AppendL( KMPXMediaIdAudio );
+    CMPXMedia* media = CMPXMedia::NewL( suppIds.Array() );
+    CleanupStack::PopAndDestroy( &suppIds );
+    CleanupStack::PushL( media );
+    FillMediaFromItemL( *media, attrs.Array() );
+    
+    // create an MPX message
+    CMPXMessage* msg = CMPXMessage::NewL();
+    CleanupStack::PushL( msg );
+    msg->SetTObjectValueL<TMPXMessageId>(
+        KMPXMessageGeneralId, KMPXMessagePbMediaChanged );
+    msg->SetCObjectValueL<CMPXMedia>(
+        KMPXMessagePbMedia, media );
+
+    // send message
+    aObs.HandlePlaybackMessage( *msg );
+
+    CleanupStack::PopAndDestroy( msg );
+    CleanupStack::PopAndDestroy( media );
+    CleanupStack::PopAndDestroy( &attrs );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::DeliverMedatataL
+// --------------------------------------------------------------------------
+// 
+void CUPnPTrack::DeliverMedataL( const TArray<TMPXAttribute>& aAttrs, 
+    MMPXPlaybackPluginObserver& aObs, TInt aError )
+    {
+    __LOG( "CUPnPTrack::DeliverMedatata");
+
+    // Create and fill CMPXMedia class 
+    RArray<TInt> suppIds;
+    CleanupClosePushL( suppIds );
+    suppIds.AppendL( KMPXMediaIdMusic );
+    suppIds.AppendL( KMPXMediaIdGeneral );
+    suppIds.AppendL( KMPXMediaIdAudio );
+    CMPXMedia* media = CMPXMedia::NewL( suppIds.Array() );
+    CleanupStack::PopAndDestroy( &suppIds );        
+    CleanupStack::PushL( media );
+
+    if ( aError == KErrNone )
+        {
+        FillMediaFromItemL( *media, aAttrs );
+        }
+
+    // Return metadata
+    aObs.HandleMedia( *media, aError );
+    CleanupStack::PopAndDestroy( media );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::FillMediaFromItemL
+// --------------------------------------------------------------------------
+// 
+void CUPnPTrack::FillMediaFromItemL( CMPXMedia& aMedia,
+    const TArray<TMPXAttribute>& aAttrs )
+    {
+    __ASSERTD( iIsItemSolved,__FILE__, __LINE__ );
+
+    // Fill metadata 
+    const CUpnpElement* elem;
+    // Song title
+    if( Exists( aAttrs, KMPXMediaGeneralTitle ) )
+        {
+        __LOG( "CUPnPTrack: Metadata: Title");
+        aMedia.SetTextValueL(
+            KMPXMediaGeneralTitle, *To16LC( 
+            iItemResolver->Item().Title() ) );
+        CleanupStack::PopAndDestroy();
+        }
+    // Artist
+    if( Exists( aAttrs, KMPXMediaMusicArtist ) )
+        {
+        if ( ( elem = UPnPItemUtility::FindElementByName(
+            iItemResolver->Item(), KElementArtist ) ) != 0 )
+            {
+            __LOG( "CUPnPTrack: Metadata: Artist" );
+            aMedia.SetTextValueL(
+                KMPXMediaMusicArtist, *To16LC( elem->Value() ) );
+            CleanupStack::PopAndDestroy();
+            }
+        else if ( ( elem = UPnPItemUtility::FindElementByName(
+            iItemResolver->Item(), KElementCreator ) ) != 0 )
+            {
+            __LOG( "CUPnPTrack: Metadata Creator" );
+            aMedia.SetTextValueL(
+                KMPXMediaMusicArtist, *To16LC( elem->Value() ) );
+            CleanupStack::PopAndDestroy();
+            }
+        }
+    // Album
+    if( Exists( aAttrs, KMPXMediaMusicAlbum ) )
+        {
+        if ( ( elem = UPnPItemUtility::FindElementByName(
+            iItemResolver->Item(), KElementAlbum ) ) != 0 )
+            {
+            __LOG( "CUPnPTrack: Metadata: Album");
+            aMedia.SetTextValueL(
+                KMPXMediaMusicAlbum, *To16LC( elem->Value() ) );
+            CleanupStack::PopAndDestroy();
+            }
+        }
+    // Genre
+    if( Exists( aAttrs, KMPXMediaMusicGenre ) )
+        {
+        if ( ( elem = UPnPItemUtility::FindElementByName(
+            iItemResolver->Item(), KElementGenre ) ) != 0 )
+            {
+            __LOG( "CUPnPTrack: Metadata: Genre" );
+            aMedia.SetTextValueL(
+                KMPXMediaMusicGenre, *To16LC( elem->Value() ) );
+            CleanupStack::PopAndDestroy();
+            }
+        }
+    // Date / Year
+    if( ( elem = UPnPItemUtility::FindElementByName(
+          iItemResolver->Item(), KElementDate ) ) != 0 )
+        {
+        TTime timestamp;
+        TInt conversionError =
+            UPnPItemUtility::UPnPDateAsTTime( elem->Value(), timestamp );
+        if ( conversionError == KErrNone )
+            {
+            if ( Exists( aAttrs, KMPXMediaGeneralDate ) )
+                {
+                __LOG( "CUPnPTrack: Metadata: Date" );
+                aMedia.SetTextValueL(
+                    KMPXMediaGeneralDate, iTempBuf );
+                }
+            if ( Exists( aAttrs, KMPXMediaMusicYear ) )
+                {
+                __LOG( "CUPnPTrack: Metadata: Year" );
+                timestamp.FormatL( iTempBuf, KTimeFormatYearOnly );
+                aMedia.SetTextValueL(
+                    KMPXMediaMusicYear, iTempBuf );
+                }
+            }
+        }
+    // Duration
+    if( Exists( aAttrs, KMPXMediaGeneralDuration ) )
+        {
+        TInt duration = TrackDuration();
+        if ( duration >= 0 )
+            {
+            aMedia.SetTObjectValueL<TInt>(
+                KMPXMediaGeneralDuration, duration );
+            }
+        }
+    // Size
+    if( Exists( aAttrs, KMPXMediaGeneralSize ) )
+        {
+        const CUpnpAttribute* attr = UPnPItemUtility
+            ::FindAttributeByName( iItemResolver->Resource(),
+             KAttributeSize );
+        if ( attr != 0 )
+            {
+            __LOG( "CUPnPTrack: Metadata: Size" );
+            TInt size;
+            TLex8 sizeconvert( attr->Value() );
+            if ( sizeconvert.Val( size ) == KErrNone )
+                {
+                aMedia.SetTObjectValueL<TInt>(
+                    KMPXMediaGeneralSize, size );
+                }
+            }
+        }
+    // Mimetype
+    if( Exists( aAttrs, KMPXMediaGeneralMimeType ) )
+        {        
+        const CUpnpAttribute* attr = UPnPItemUtility
+            ::FindAttributeByName( iItemResolver->Resource(),
+             KAttributeProtocolInfo );
+        if ( attr != 0 )
+            {
+            __LOG( "CUPnPTrack: Metadata: MimeType" );
+            CUpnpDlnaProtocolInfo* pInfo =
+                CUpnpDlnaProtocolInfo::NewL( attr->Value() );
+            CleanupStack::PushL( pInfo );
+            aMedia.SetTextValueL(
+                KMPXMediaGeneralMimeType, *To16LC( pInfo->ThirdField() ) );
+            CleanupStack::PopAndDestroy();
+            CleanupStack::PopAndDestroy( pInfo );
+            pInfo = NULL;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::Exists
+// --------------------------------------------------------------------------
+// 
+TBool CUPnPTrack::Exists( const TArray<TMPXAttribute>& aAttrs,
+    const TMPXAttributeData& aAttrData ) const
+    {
+    TBool found = EFalse;
+    for( TInt i = 0; i < aAttrs.Count() && !found; ++i )
+        {
+        if ( aAttrs[i].ContentId() == aAttrData.iContentId &&
+            aAttrs[i].AttributeId() & aAttrData.iAttributeId )
+            {
+            found = ETrue;
+            }
+        }
+    return found;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::To16LC
+// --------------------------------------------------------------------------
+// 
+const HBufC16* CUPnPTrack::To16LC( const TDesC8& aText )
+    {
+    HBufC16* result = 0;
+    result = EscapeUtils::ConvertToUnicodeFromUtf8L( aText );
+    CleanupStack::PushL( result );
+    return result;
+    }
+
+// --------------------------------------------------------------------------
+// callbacks from MUPnPItemResolverObserver
+// --------------------------------------------------------------------------
+//  
+void CUPnPTrack::ResolveComplete( const MUPnPItemResolver& /*aResolver*/,
+    TInt aError )
+    {
+    __LOG1( "CUPnPTrack::ResolveComplete err: %d", aError );
+    iIsItemSolved = ETrue;
+    if ( iState == EStateResolving )
+        {
+        iState = EStateReady;
+
+        // handle pending metadata query
+        if ( iTrackLocation == ETrackLocationRemote && iMetadataObserver )
+            {
+            __LOG( "Handle pending metadata query");
+             TRAP_IGNORE( 
+                DeliverMedataL( iQueriedAttributes.Array(), *iMetadataObserver,
+                aError ) );
+             iMetadataObserver = 0;
+             iQueriedAttributes.Reset();
+            }
+
+        // call back
+        MUPnPTrackObserver& observer = *iTrackObserver;
+        iTrackObserver = 0;
+        observer.ResolveURIComplete( aError );
+        }
+    else if ( iState == EStateSelfDestruct )
+        {
+        __LOG( "CUPnPTrack: self-destructing" );
+        delete this;
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// Private methods of CUPnPTrack
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// CUPnPTrack::ParsePiecesL
+// Parse and save media server id and object id from given descriptor
+// --------------------------------------------------------------------------
+//    
+void CUPnPTrack::ParsePiecesL( const TDesC& aSong )
+    {    
+    // Delete if already exist
+    if( iMediaServer )
+        {
+        delete iMediaServer;
+        iMediaServer = 0;
+        }
+    if( iObjectId )
+        {
+        delete iObjectId;
+        iObjectId = 0;
+        }
+    
+    // Leave if argument is not valid
+    if( aSong.Length() < KUPnPPrefixLength )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    TInt lenght = aSong.Length();
+    TInt position = 0;
+    TChar colon( KCharCodeColon );
+    TChar separate( KCharCodeSeparate );
+        
+    // At first separe "upnp:" prefix from descriptor 
+    position = aSong.Locate( colon );   
+    TPtrC tmp = aSong.Mid( position + 1, (lenght - KUPnPPrefixLength ) );
+    
+    // Get media server id
+    position = tmp.Locate( separate );
+    // Leave if separator character not found
+    if( position == KErrNotFound )
+        {
+        User::Leave( KErrNotFound );
+        }
+    TPtrC mediaserverId = tmp.Left( position );
+    iMediaServer = HBufC8::NewL( mediaserverId.Length() );
+    iMediaServer->Des().Copy( mediaserverId );
+        
+    // Get object id
+    TPtrC objId = tmp.Mid( position + 1, ( (tmp.Length() 
+        - mediaserverId.Length() ) - 1 ) ); 
+    iObjectId = HBufC8::NewL( objId.Length() );
+    iObjectId->Des().Copy( objId );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpmpxplugins/upnpplaybackplugins/src/upnpvaluestatemachine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,966 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Class for retrieving and selecting media renderers
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <mpxplaybackplugin.h>
+#include <mpxplaybackpluginobserver.h>
+#include "upnpavrenderingsession.h"
+#include "upnpavdevice.h"
+#include "upnpitemutility.h" // for UPnPDurationToMilliseconds
+#include "upnpmusicplayer.h"
+#include "upnptrack.h" // for TrackDuration
+#include "upnpvaluestatemachine.h"
+#include "upnppluginserrortranslation.h"
+
+_LIT( KComponentLogfile, "musicplugins.txt");
+#include "upnplog.h"
+
+// CONSTANT
+const TInt KDefaultMaxVolume = 100;
+const TInt KDefaultMinVolume = 0;
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::NewL
+// 1st phase constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPValueStateMachine* CUPnPValueStateMachine::NewL(
+    CUPnPMusicPlayer& aParent,
+    MUPnPAVRenderingSession& aRenderingSession )
+    {
+    __LOG( "ValueStateMachine: NewL" );
+    CUPnPValueStateMachine* self = new(ELeave)
+        CUPnPValueStateMachine( aParent, aRenderingSession );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::CUPnPValueStateMachine
+// Default constructor.
+// --------------------------------------------------------------------------
+// 
+CUPnPValueStateMachine::CUPnPValueStateMachine( 
+    CUPnPMusicPlayer& aParent,
+    MUPnPAVRenderingSession& aRenderingSession ) :
+        iParent( aParent ),
+        iRendererSession( aRenderingSession ),
+        iCurrentOperation( EOperationNone ),
+        iRendererVolume( KErrNotFound ),
+        iRendererMuted( KErrNotFound )
+    {
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::~CUPnPValueStateMachine
+// Destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPValueStateMachine::~CUPnPValueStateMachine()
+    {
+    __LOG( "ValueStateMachine: destructor" );
+    iOperationQueue.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::CopyValues
+// copies renderer-specific cached values from another instance
+// --------------------------------------------------------------------------
+//
+void CUPnPValueStateMachine::CopyValues(
+    const CUPnPValueStateMachine& aOther )
+    {
+    iRendererVolume = aOther.iRendererVolume;
+    iRendererMuted = aOther.iRendererMuted;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::ValidatePropertyInState
+// defines the rules of getting / setting in different states
+// --------------------------------------------------------------------------
+//
+CUPnPValueStateMachine::TValidationResult
+    CUPnPValueStateMachine::ValidatePropertyInState(
+        TMPXPlaybackProperty aProperty,
+        TBool aSetting,
+        TInt aPlayerState,
+        TBool aIsReady )
+    {
+    switch( aProperty )
+        {
+        case EPbPropertyMaxVolume: // fall through
+        case EPbPropertyRemote: // fall through
+        case EPbPropertySupportedFeatures:
+            {
+            // allow getting in all states,
+            // trying to set will result to error
+            if ( !aSetting )
+                {
+                return EHandleStatic;
+                }
+            else
+                {
+                return EErrorNotSupported;
+                }
+            }
+        case EPbPropertyVolume: // fall through
+        case EPbPropertyMute:
+            {            
+            // allow volume get/set after initialisation when remote device
+            // is ready. In other states respond with error
+            if ( aPlayerState ==
+                CUPnPMusicPlayer::EStateActive )
+                {
+                if( !aIsReady )
+                    {
+                    return EErrorNotReady;
+                    }
+                else
+                    {
+                    return EHandle;
+                    }
+                }
+            else if ( aPlayerState ==
+                CUPnPMusicPlayer::EStatePreInitialized ||
+                aPlayerState ==
+                CUPnPMusicPlayer::EStateWaiting ||
+                aPlayerState ==
+                CUPnPMusicPlayer::EStateActiveForceInitialise )
+                {
+                return EHandle;
+                }
+            else
+                {
+                return EErrorNotReady;
+                }
+            }
+        case EPbPropertyDuration:
+            {
+            // duration setting is not allowed
+            // getting is allowed after initialised, but will result
+            // to returning plain zero in other states except active
+            // when it is actually asked from the device
+            if ( aSetting )
+                {
+                return EErrorNotSupported;
+                }
+            else if ( aPlayerState ==
+                CUPnPMusicPlayer::EStateActive )
+                {
+                if( aIsReady )
+                    {
+                    return EHandle;
+                    }
+                else
+                    {
+                    // On active state but device is not ready ->
+                    // Use initial values.
+                    return EHandleStatic;
+                    }
+                }
+            else if ( aPlayerState ==
+                CUPnPMusicPlayer::EStatePreInitialized ||
+                aPlayerState ==
+                CUPnPMusicPlayer::EStateWaiting ||
+                aPlayerState ==
+                CUPnPMusicPlayer::EStateActiveForceInitialise )
+                {
+                return EHandleStatic;
+                }
+            else
+                {
+                return EErrorNotReady;
+                }
+            }
+        case EPbPropertyPosition:
+            {
+            // position get/set is allowed after init when remote device 
+            // is ready. Only active state it will result to real action
+            if ( aPlayerState ==
+                CUPnPMusicPlayer::EStateActive )
+                {
+                if( aIsReady )
+                    {
+                    return EHandle;
+                    }
+                else
+                    {
+                    // On active state but device is not ready ->
+                    // Use initial values.
+                    return EHandleStatic;
+                    }
+                }
+            else if ( aPlayerState ==
+                CUPnPMusicPlayer::EStatePreInitialized ||
+                aPlayerState ==
+                CUPnPMusicPlayer::EStateWaiting ||
+                aPlayerState ==
+                CUPnPMusicPlayer::EStateActiveForceInitialise )
+                {
+                return EHandleStatic;
+                }
+            else
+                {
+                return EErrorNotReady;
+                }
+            }
+        default:
+            {
+            // unsupported property
+            return EErrorNotSupported;
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::SetL
+// --------------------------------------------------------------------------
+//
+void CUPnPValueStateMachine::SetL( TMPXPlaybackProperty aProperty,
+    TInt aValue )
+    {
+    // Check if volume or mute is supported by device
+    if( ( aProperty == EPbPropertyVolume && 
+          !iParent.UsedRendererDevice().VolumeCapability() ) ||
+        ( aProperty == EPbPropertyMute && 
+          !iParent.UsedRendererDevice().MuteCapability() )      
+      ) 
+        {
+        __LOG( "ValueStateMachine::SetL - \
+        Request is not supported by device" );
+        iParent.Observer().HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPSetComplete,
+           (TInt)aProperty, KErrNotSupported );
+            
+        return;
+        }
+
+    // Check from queue if alredy requested.
+    if( FoundFromQueue( aProperty ) )
+        {
+        __LOG( "ValueStateMachine::SetL: Volume query Ignored!" );
+        // Ignore
+        return;
+        }
+    
+    if ( !iCurrentOperation.None() )
+        {
+        __LOG( "ValueStateMachine::SetL - Append to queue" );
+        iOperationQueue.AppendL( TOperation( aProperty, aValue ) );
+        return;
+        }
+
+    switch( aProperty )
+        {
+        case EPbPropertyVolume:
+            {               
+            __LOG1( "ValueStateMachine: SetVolume(%d)",
+                aValue );
+            // Set the volume, do a sanity check
+            if( aValue < KDefaultMinVolume || aValue > KDefaultMaxVolume )
+                {
+                // Given value out of range
+                CheckOperationInQueueL();
+                iParent.Observer().HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPSetComplete,
+                    aProperty, KErrArgument );
+                }
+            else if ( aValue == iRendererVolume )
+                {
+                // re-setting the same volume
+                if ( iRendererMuted )
+                    {
+                    MuteRequestL( 0 );
+                    }
+                iParent.Observer().HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPSetComplete,
+                    aProperty, KErrNone );
+                }
+            else
+                {
+                iCurrentOperation.Set( aProperty, aValue );
+                iRendererSession.SetVolumeL( aValue );
+                if ( iRendererMuted )
+                    {
+                    // unmute after volume has been adjusted
+                    MuteRequestL( 0 );
+                    }
+                }        
+            break;
+            }
+        case EPbPropertyMute:
+            {
+            __LOG1( "ValueStateMachine: SetMute(%d)",
+                aValue );
+            if( aValue != 0 && iRendererMuted != 1 )
+                {
+                // set mute on
+                iCurrentOperation.Set( aProperty, 1 );
+                iRendererSession.SetMuteL( ETrue );
+                }
+            else if ( aValue == 0 && iRendererMuted != 0 )
+                {
+                // set mute off
+                iCurrentOperation.Set( aProperty, 0 );
+                iRendererSession.SetMuteL( EFalse );
+                }
+            else
+                {
+                // mute is already in requested state
+                CheckOperationInQueueL();
+                iParent.Observer().HandlePluginEvent( 
+                    MMPXPlaybackPluginObserver::EPSetComplete,
+                    aProperty, KErrNone );
+                }
+            break;
+            }
+        default: // Given property is not supported
+            {
+            __LOG( "ValueStateMachine: Set - default" );
+            CheckOperationInQueueL();
+            iParent.Observer().HandlePluginEvent( 
+                MMPXPlaybackPluginObserver::EPSetComplete,
+                aProperty, KErrNotSupported );
+            break;
+            }    
+        }
+ 
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::ValueL
+// --------------------------------------------------------------------------
+//
+void CUPnPValueStateMachine::ValueL( TMPXPlaybackProperty aProperty )
+    {
+    // Check if volume or mute is supported by device
+    if( ( aProperty == EPbPropertyVolume && 
+          !iParent.UsedRendererDevice().VolumeCapability() ) ||
+        ( aProperty == EPbPropertyMute && 
+          !iParent.UsedRendererDevice().MuteCapability() )      
+      ) 
+        {
+        __LOG( "ValueStateMachine::ValueL - \
+        Request is not supported by device" );
+        iParent.Observer().HandlePluginEvent( 
+            MMPXPlaybackPluginObserver::EPSetComplete,
+           (TInt)aProperty, KErrNotSupported );
+            
+        return;
+        }
+    
+    if ( !iCurrentOperation.None() )
+        {
+        __LOG( "ValueStateMachine::ValueL - Append to queue" );
+        iOperationQueue.AppendL( TOperation( aProperty ) );
+        return;
+        }
+
+    switch( aProperty )
+        {
+        case EPbPropertyVolume:
+            {
+            __LOG( "ValueStateMachine: Value(volume)" );
+            iRendererSession.GetVolumeL();
+            iCurrentOperation.Set( aProperty );
+            break;
+            }
+        case EPbPropertyMute:
+            {
+            __LOG( "ValueStateMachine: Value(mute)" );
+            iRendererSession.GetMuteL();
+            iCurrentOperation.Set( aProperty );
+            break;
+            }
+        case EPbPropertyDuration:
+            {
+            __LOG( "ValueStateMachine: Value(duration)" );
+            if ( iParent.Track().TrackDuration() > 0 )
+                {
+                // duration found in cache
+                CheckOperationInQueueL();
+                iParent.Observer().HandleProperty( aProperty,
+                    iParent.Track().TrackDuration(), KErrNone );
+                }
+            else
+                {
+                iRendererSession.GetPositionInfoL();
+                iCurrentOperation.Set( aProperty );
+                }
+            break;
+            }
+        case EPbPropertyPosition:
+            {
+            __LOG( "ValueStateMachine: Value(position)" );
+            iRendererSession.GetPositionInfoL();
+            iCurrentOperation.Set( aProperty );
+            break;
+            }
+        default:
+            {
+            __PANICD( __FILE__, __LINE__ );
+            break;
+            }    
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::ValueStatic
+// --------------------------------------------------------------------------
+//
+void CUPnPValueStateMachine::ValueStatic(
+    TMPXPlaybackProperty aProperty,
+    MMPXPlaybackPluginObserver& aPlaybackObs )
+    {
+    switch( aProperty )
+        {
+        case EPbPropertyMaxVolume:
+            {
+            __LOG( "ValueStateMachine: ValueStatic(max volume)" );
+            aPlaybackObs.HandleProperty( aProperty,
+                KDefaultMaxVolume, KErrNone );
+            break;
+            }
+         case EPbPropertyRemote:
+            {
+            __LOG( "ValueStateMachine: ValueStatic(remote)" );
+            aPlaybackObs.HandleProperty( aProperty,
+                (TInt)EFalse, KErrNone );
+            break;
+            }
+        case EPbPropertySupportedFeatures:
+            {
+            __LOG( "ValueStateMachine: ValueStatic(features)" );
+            // No support for any features
+            TInt supportedFeatures = 0;              
+            aPlaybackObs.HandleProperty( aProperty,
+                supportedFeatures, KErrNone );
+            break;
+            }
+        case EPbPropertyDuration:
+            {
+            __LOG( "ValueStateMachine: ValueStatic(duration)" );
+            TInt initialDuration = 0;
+            aPlaybackObs.HandleProperty( aProperty,
+                initialDuration, KErrNone );
+            break;
+            }
+        case EPbPropertyPosition:
+            {
+            __LOG( "ValueStateMachine: ValueStatic(position)" );
+            TInt initialPosition = 1;
+            aPlaybackObs.HandleProperty( aProperty,
+                initialPosition, KErrNone );
+            break;
+            }
+        default:
+            {
+            __PANICD( __FILE__, __LINE__ );
+            break;
+            }    
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::DurationQueryL
+// --------------------------------------------------------------------------
+//    
+void CUPnPValueStateMachine::DurationQueryL()
+    {
+    // here we could check if the duration is already present in
+    // iParent.track() however it was decided that we check the duration
+    // from renderer anyway and trust the renderer's duration more.
+    if ( !iCurrentOperation.None() )
+        {
+        __LOG( "ValueStateMachine::DurationQueryL - Append to queue" );
+        iOperationQueue.AppendL( EOperationDurationQuery );
+        return;
+        }
+
+    __LOG( "ValueStateMachine::DurationQueryL" );
+    iRendererSession.GetPositionInfoL();
+    iCurrentOperation = EOperationDurationQuery;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::PositionQueryL
+// --------------------------------------------------------------------------
+//    
+void CUPnPValueStateMachine::PositionQueryL()
+    {
+    __LOG( "ValueStateMachine::PositionQueryL" );
+    
+    if ( !iCurrentOperation.None() )
+        {
+        __LOG( "ValueStateMachine::PositionQueryL - Append to queue" );
+        iOperationQueue.AppendL( EOperationPositionQuery );
+        return;
+        }
+    iRendererSession.GetPositionInfoL();
+    iCurrentOperation = EOperationPositionQuery;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::VolumeQueryL
+// --------------------------------------------------------------------------
+//    
+void CUPnPValueStateMachine::VolumeQueryL()
+    {
+    // Check if volume feature is supported by device.
+    if( iParent.UsedRendererDevice().VolumeCapability() )
+        {
+        if ( iRendererVolume != KErrNotFound )
+            {
+            // Volume query not required - already cached.
+            return;
+            }
+
+        if ( !iCurrentOperation.None() )
+            {
+            __LOG( "ValueStateMachine::VolumeQueryL - Append to queue" );
+            iOperationQueue.AppendL( EOperationVolumeQuery );
+            return;
+        }
+
+        __LOG( "ValueStateMachine::VolumeQueryL" );
+        iRendererSession.GetVolumeL();
+        iCurrentOperation = EOperationVolumeQuery;
+        }
+    else
+        {
+        // Get volume is not supported. Do nothing.
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::MuteRequestL
+// --------------------------------------------------------------------------
+//    
+void CUPnPValueStateMachine::MuteRequestL( TInt aMute )
+    {
+    if ( !iCurrentOperation.None() )
+        {
+        __LOG( "ValueStateMachine::MuteRequestL - Append to queue" );
+        iOperationQueue.AppendL( TOperation( EOperationMute, aMute ) );
+        return;
+        }
+
+    __LOG1( "ValueStateMachine: MuteRequest(%d)", aMute );
+    if( aMute != 0 && iRendererMuted != 1 )
+        {
+        // set mute on
+        iCurrentOperation = EOperationMute;
+        iRendererSession.SetMuteL( ETrue );
+        }
+    else if ( aMute == 0 && iRendererMuted != 0 )
+        {
+        // set mute off
+        iCurrentOperation = EOperationMute;
+        iRendererSession.SetMuteL( EFalse );
+        }
+    else
+        {
+        // mute is already in requested state
+        CheckOperationInQueueL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::VolumeResult
+// --------------------------------------------------------------------------
+//
+void CUPnPValueStateMachine::VolumeResult( TInt aError, TInt aVolumeLevel,
+    TBool aActionResponse )
+    {
+    aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError );
+    // If response for get volume
+    
+    if( aActionResponse )
+        {
+        if (aError == KErrNone)
+            {
+            iRendererVolume = aVolumeLevel;
+            }
+        
+        if( iCurrentOperation.Compare( EOperationValue, EPbPropertyVolume ) )
+            {
+            __LOG( "ValueStateMachine::VolumeResult: Value resp." );
+            
+            iCurrentOperation.Reset();
+            TRAP_IGNORE( CheckOperationInQueueL() );
+            iParent.Observer().HandleProperty( EPbPropertyVolume,
+                iRendererVolume, aError );
+            }
+        else if( iCurrentOperation.Compare( EOperationSet, 
+            EPbPropertyVolume ) )
+            {
+            __LOG( "ValueStateMachine::VolumeResult: Set resp." );
+            iCurrentOperation.Reset();
+            TRAP_IGNORE( CheckOperationInQueueL() );
+            iParent.Observer().HandlePluginEvent( 
+                MMPXPlaybackPluginObserver::EPSetComplete,
+                (TInt)EPbPropertyVolume, aError );
+            }
+        else if ( iCurrentOperation == EOperationVolumeQuery )
+            {
+            __LOG1("VolumeQueryResult: Volume query resp err=%d", aError );
+            
+            if ( aError == KErrNone )
+                {
+                iParent.Observer().HandlePluginEvent(
+                    MMPXPlaybackPluginObserver::EPVolumeChanged,
+                    iRendererVolume, aError );
+                }
+            
+            iCurrentOperation.Reset();
+            TRAP_IGNORE( CheckOperationInQueueL() );
+            }
+        else
+            {         
+            iCurrentOperation.Reset();
+            __LOG( "ValueStateMachine::VolumeResult: no request?" );
+            }
+        }
+    else // Volume changed from device
+        {
+        // Ignore volume events from device if volume control 
+        // is ongoing on handset.
+        if( iCurrentOperation.Compare( EOperationSet, EPbPropertyVolume ) )
+            {
+            return;
+            }
+        
+        if (aError == KErrNone)
+            {
+            iRendererVolume = aVolumeLevel;
+            }
+        
+        if ( !iRendererMuted )
+            {
+            __LOG1( "ValueStateMachine::VolumeResult: from device: (%d)",
+                aVolumeLevel );
+            iParent.Observer().HandlePluginEvent( 
+                MMPXPlaybackPluginObserver::EPVolumeChanged,
+                iRendererVolume, aError );
+            }
+        else
+            {
+            __LOG( "ValueStateMachine::VolumeResult: from device (muted)" );
+            }
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::MuteResult
+// --------------------------------------------------------------------------
+//    
+void CUPnPValueStateMachine::MuteResult( TInt aError, TBool aMute, 
+    TBool aActionResponse )
+    {
+    aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError );
+    // Response for set mute
+    if( aActionResponse )
+        {
+        if( iCurrentOperation.Compare( EOperationValue, EPbPropertyMute ) )
+            {
+            __LOG( "ValueStateMachine::MuteResult: Value resp." );
+            iRendererMuted = aMute;
+            iCurrentOperation.Reset();
+            TRAP_IGNORE( CheckOperationInQueueL() );
+            iParent.Observer().HandleProperty( EPbPropertyMute,
+                (TInt)aMute, aError );
+            }
+        else if ( iCurrentOperation.Compare( EOperationSet,
+            EPbPropertyMute ) )
+            {
+            __LOG( "ValueStateMachine::MuteResult: Set resp." );
+            iRendererMuted = aMute;
+            iCurrentOperation.Reset();
+            TRAP_IGNORE( CheckOperationInQueueL() );
+            iParent.Observer().HandlePluginEvent( 
+                MMPXPlaybackPluginObserver::EPSetComplete,
+                (TInt)EPbPropertyMute, aError );
+            }
+        else if ( iCurrentOperation == EOperationMute )
+            {
+            // internal operation, no event.
+            iRendererMuted = aMute;
+            iCurrentOperation.Reset();
+            TRAP_IGNORE( CheckOperationInQueueL() );
+            }
+        else
+            {
+            iRendererMuted = aMute;
+            iCurrentOperation.Reset();
+            __LOG( "ValueStateMachine::MuteResult: no request?" );
+            }
+        }
+    else // Mute changed from device
+        {
+        __LOG( "ValueStateMachine::MuteResult: Mute changed from device" );
+        
+        if( aMute )
+            {
+            iRendererMuted = ETrue;
+            iParent.Observer().HandlePluginEvent(
+                MMPXPlaybackPluginObserver::EPVolumeChanged,
+                0, aError );
+            }
+        else
+            {
+            iRendererMuted = EFalse;
+            iParent.Observer().HandlePluginEvent(
+                MMPXPlaybackPluginObserver::EPVolumeChanged,
+                iRendererVolume, aError );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::PositionInfoResult
+// --------------------------------------------------------------------------
+//
+void CUPnPValueStateMachine::PositionInfoResult( TInt aStatus,
+    const TDesC8& aTrackPosition, const TDesC8& aTrackLength )
+    {                      
+    // Check if position info was asked
+    if( iCurrentOperation.Compare( EOperationValue, EPbPropertyPosition ) )
+        {
+        __LOG1( "Position response err=%d", aStatus );
+        TInt ms = 0;
+        if( aStatus == KErrNone )
+            {
+            // Convert the descriptor to integer value
+            aStatus = UPnPItemUtility::UPnPDurationAsMilliseconds(
+                aTrackPosition, ms );
+            __LOG2( "ValueStateMachine::PositionInfoResult position=%d err=%d",
+                ms, aStatus );
+            }
+        iCurrentOperation.Reset();
+        TRAP_IGNORE( CheckOperationInQueueL() );
+        
+        // Use initial position value in case of errors or position 0.
+        // This will guarantee that in case of unpause, SetPosition 
+        // is called with real value even if remote player does not
+        // return real value for getposition call. Note that 
+        // SetPosition(0) is used when user really wants to move to
+        // track beginning.
+        if( aStatus != KErrNone )
+            {
+            // GetPositionInfo is not supported by used device.
+            iParent.Observer().HandleProperty( EPbPropertyPosition, 1,
+                KErrNotSupported );
+            }
+        else
+            {
+            if( ms == 0 )
+                {
+                ms = 1;
+                }
+            iParent.Observer().HandleProperty( EPbPropertyPosition, ms,
+                aStatus );
+            }
+        }
+    else if ( iCurrentOperation == EOperationPositionQuery )
+        {
+        __LOG1( "PositionQuery response err=%d", aStatus );
+        TInt ms = 0;
+        if( aStatus == KErrNone )
+            {
+            // Convert the descriptor to integer value
+            aStatus = UPnPItemUtility::UPnPDurationAsMilliseconds(
+                aTrackPosition, ms );
+            __LOG2( "ValueStateMachine::PositionInfoResult position=%d err=%d",
+                ms, aStatus );
+            }
+        iCurrentOperation.Reset();
+        TRAP_IGNORE( CheckOperationInQueueL() );
+        
+        if( aStatus == KErrNone )
+            {
+            if( ms == 0 )
+                {
+                ms = 1;
+                }
+            //iParent.Observer().HandlePluginEvent( 
+            //MMPXPlaybackPluginObserver::EPPositionChanged, ms, KErrNone );
+            }
+        }
+    // Check if duration info was asked    
+    else if( iCurrentOperation.Compare( EOperationValue, 
+        EPbPropertyDuration ) )
+        {
+        __LOG1( "Duration response err=%d", aStatus );
+        TInt ms = 0;
+        if( aStatus == KErrNone )
+            {
+            aStatus = UPnPItemUtility::UPnPDurationAsMilliseconds(
+                aTrackLength, ms );
+            __LOG2( "ValueStateMachine::PositionInfoResult -\
+            duration=%d err=%d", ms, aStatus );
+
+            if ( aStatus == KErrNone )
+                {
+                iParent.Track().SetTrackDuration( ms );
+                }
+            }
+        iCurrentOperation.Reset();
+        TRAP_IGNORE( CheckOperationInQueueL() );
+        
+        if( aStatus == KErrNotSupported )
+            {
+            // GetDuration is not supported by used device.
+            // Use initial duration value (1). It will guarantee that in
+            // case of unpause, SetPosition is called with real value even
+            // if remote player does not return real value for getposition
+            // call. Note that SetPosition(0) is used when user really wants
+            // to move to track beginning.
+            iParent.Observer().HandleProperty( EPbPropertyDuration, 1,
+                KErrNone );
+            }
+        else
+            {
+            iParent.Observer().HandleProperty( EPbPropertyDuration,
+                ms, aStatus );
+            }
+        }
+    else if ( iCurrentOperation == EOperationDurationQuery )
+        {
+        __LOG1( "DurationQuery response err=%d", aStatus );
+        TInt ms = 0;
+        if( aStatus == KErrNone )
+            {
+            aStatus = UPnPItemUtility::UPnPDurationAsMilliseconds(
+                aTrackLength, ms );
+            __LOG2( "ValueStateMachine::PositionInfoResult - \
+            duration=%d err=%d",
+                ms, aStatus );
+            if ( aStatus == KErrNone )
+                {
+                iParent.Track().SetTrackDuration( ms );
+                }
+            }
+        iCurrentOperation.Reset();
+        TRAP_IGNORE( CheckOperationInQueueL() );
+
+        if ( iParent.Track().TrackDuration() > 0 && aStatus == KErrNone )
+            {
+            iParent.Observer().HandlePluginEvent( 
+                MMPXPlaybackPluginObserver::EPDurationChanged,
+                iParent.Track().TrackDuration(), KErrNone );
+            }
+        }
+    else
+        {
+        __LOG( "ValueStateMachine::PositionInfoResult: no request?" );
+        }
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::Cancel
+// --------------------------------------------------------------------------
+//
+void CUPnPValueStateMachine::Cancel()
+    {
+    // reset current operation and empty the queue -> no callbacks.
+    iCurrentOperation.Reset();
+    iOperationQueue.Reset();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::CheckOperationInQueueL
+// Checks if operations are in the queue, and executes
+// --------------------------------------------------------------------------
+//   
+void CUPnPValueStateMachine::CheckOperationInQueueL()
+    {
+    if ( !iCurrentOperation.None() )
+        {
+        // check operation though a current operation exists!
+        __PANICD( __FILE__, __LINE__ );
+        return;
+        }
+
+    if ( iOperationQueue.Count() > 0 )
+        {
+        TOperation op = iOperationQueue[0];
+        iOperationQueue.Remove(0);
+        if ( op == EOperationValue )
+            {
+            ValueL( op.iProperty );
+            }
+        else if ( op == EOperationSet )
+            {
+            SetL( op.iProperty, op.iValue );
+            }
+        else if ( op == EOperationDurationQuery )
+            {
+            DurationQueryL();
+            }
+        else if ( op == EOperationVolumeQuery )
+            {
+            VolumeQueryL();
+            }
+        else if ( op == EOperationPositionQuery )
+            {
+            PositionQueryL();
+            }            
+        else if ( op == EOperationMute )
+            {
+            MuteRequestL( op.iValue );
+            }
+        else
+            {
+            __PANICD( __FILE__, __LINE__ );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPValueStateMachine::FoundFromQueue
+// Checks if operations are in the queue
+// --------------------------------------------------------------------------
+//   
+TBool CUPnPValueStateMachine::FoundFromQueue(TMPXPlaybackProperty aProperty)
+    {    
+    TBool found = EFalse;
+    TInt count = iOperationQueue.Count();
+
+    for( TInt i = 0; i < count; i++ )
+        {
+        TOperation op = iOperationQueue[i];
+        if( op.iProperty == aProperty )
+            {
+            found = ETrue;
+            break;
+            }
+        }
+    return found;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/appwizard/BWINS/upnpappwizardU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	?NewL@CUPnPAppWizard@@SAPAV1@ABVTDesC16@@PAVCUPnPFileSharingEngine@@@Z @ 1 NONAME ; class CUPnPAppWizard * CUPnPAppWizard::NewL(class TDesC16 const &, class CUPnPFileSharingEngine *)
+	?StartL@CUPnPAppWizard@@QAEHXZ @ 2 NONAME ; int CUPnPAppWizard::StartL(void)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/appwizard/EABI/upnpappwizardU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN14CUPnPAppWizard4NewLERK7TDesC16P22CUPnPFileSharingEngine @ 1 NONAME
+	_ZN14CUPnPAppWizard6StartLEv @ 2 NONAME
+	_ZTI14CUPnPAppWizard @ 3 NONAME ; #<TI>#
+	_ZTV14CUPnPAppWizard @ 4 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/appwizard/data/cupnpappwizard.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,589 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnp setup wizard resource description file
+*
+*/
+
+
+
+
+
+
+
+//  RESOURCE IDENTIFIER
+NAME    HORO // 4 letter ID
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <data_caging_paths_strings.hrh>
+#include <appinfo.rh>
+#include <upnpsettings.loc>
+
+
+//  RESOURCE DEFINITIONS
+
+// --------------------------------------------------------------------------
+//    RSS_SIGNATURE
+// --------------------------------------------------------------------------
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+// --------------------------------------------------------------------------
+// TBUF
+// --------------------------------------------------------------------------
+RESOURCE TBUF
+    {
+    buf = "";
+    }
+
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNP_WIZARD_SOFTKEYS_NEXT_CANCEL__SELECT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnp_wizard_softkeys_next_cancel__select 
+    { 
+    buttons = 
+	{
+        CBA_BUTTON {id = EAknSoftkeyOk; txt = qtn_iupnp_softkey_next;},
+        CBA_BUTTON {id = EAknSoftkeyCancel; txt = text_softkey_cancel;},
+        CBA_BUTTON {id = EAknSoftkeyOk;}
+        }; 
+    }
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNP_WIZARD_SOFTKEYS_NEXT_BACK__SELECT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnp_wizard_softkeys_next_back__select 
+    { 
+    buttons = 
+	{
+        CBA_BUTTON {id = EAknSoftkeyOk; txt = qtn_iupnp_softkey_next;},
+        CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;},
+        CBA_BUTTON {id = EAknSoftkeyOk;}
+        }; 
+    }
+
+
+// --------------------------------------------------------------------------
+//
+// R_UPNP_WIZARD_SOFTKEYS_DONE_BACK__SELECT
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE CBA r_upnp_wizard_softkeys_done_back__select 
+    { 
+    buttons = 
+	{
+        CBA_BUTTON {id = EAknSoftkeyOk; txt = text_softkey_done;},
+        CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;},
+        CBA_BUTTON {id = EAknSoftkeyOk;}
+        }; 
+    }
+// --------------------------------------------------------------------------
+//    r_wizard_popup_dialog_1
+//    resource for wizard step 1
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_upnp_wizard_popup_dialog_1
+    {
+    flags = EGeneralQueryFlags |
+        EEikDialogFlagNoTitleBar |
+        EEikDialogFlagNoBorder |
+        EEikDialogFlagNoShadow;
+    buttons = r_upnp_wizard_softkeys_next_cancel__select;
+
+
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                bmpfile = "";
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                };
+            }
+        };
+    }
+
+RESOURCE TBUF r_upnp_wizard_head_1_text
+    {
+    buf = qtn_iupnp_wizard_head_1;
+    }
+
+RESOURCE TBUF r_upnp_wizard_1_text
+    {
+    buf = qtn_iupnp_wizard_1;
+    }
+    
+// --------------------------------------------------------------------------
+//    r_wizard_popup_dialog_2
+//    resource for wizard step 2
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_upnp_wizard_popup_dialog_2
+    {
+    flags = EGeneralQueryFlags |
+        EEikDialogFlagNoTitleBar |
+        EEikDialogFlagNoBorder |
+        EEikDialogFlagNoShadow;
+    buttons = r_upnp_wizard_softkeys_next_back__select;
+
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {   
+                bmpfile = "";
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                };
+            }
+        };
+    }
+
+RESOURCE TBUF r_upnp_wizard_head_2_text
+    {
+    buf = qtn_iupnp_wizard_head_2;
+    }
+
+RESOURCE TBUF r_upnp_wizard_2_text
+    {
+    buf = qtn_iupnp_wizard_2;
+    }
+    
+// --------------------------------------------------------------------------
+//    r_wizard_popup_dialog_3
+//    resource for wizard step 3
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_upnp_wizard_popup_dialog_3
+    {
+    flags = EGeneralQueryFlags;
+    buttons = r_upnp_wizard_softkeys_next_back__select;
+
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_DATA_QUERY
+                {
+                layout = EDataLayout;
+                label = " ";
+                control = EDWIN
+                    {
+                    width = 5;
+                    lines = 1;
+                    maxlength = 64;
+                    };
+                };
+            }
+        };
+    }
+
+RESOURCE TBUF r_upnp_wizard_head_3_text
+    {
+    buf = qtn_iupnp_wizard_head_3;
+    }
+    
+// --------------------------------------------------------------------------
+//    r_wizard_popup_dialog_4
+//    resource for wizard step 4
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_upnp_wizard_popup_dialog_4
+    {
+    flags = EGeneralQueryFlags |
+        EEikDialogFlagNoTitleBar |
+        EEikDialogFlagNoBorder |
+        EEikDialogFlagNoShadow;
+    buttons = r_upnp_wizard_softkeys_next_back__select;
+
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                bmpfile = "";
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                };
+            }
+        };
+    }
+
+RESOURCE TBUF r_upnp_wizard_head_4_text
+    {
+    buf = qtn_iupnp_wizard_head_4;
+    }
+
+// --------------------------------------------------------------------------
+//    r_wizard_popup_dialog_5
+//    resource for wizard step 5
+// --------------------------------------------------------------------------
+RESOURCE AVKON_LIST_QUERY r_upnp_wizard_popup_dialog_5
+    {
+    flags = EGeneralQueryFlags;
+    softkeys = r_upnp_wizard_softkeys_next_back__select;
+
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    };
+                heading = " ";    
+                };
+            }
+        };
+    }
+
+RESOURCE TBUF r_upnp_wizard_head_5_text
+    {
+    buf = qtn_iupnp_wizard_head_5;
+    }
+
+// --------------------------------------------------------------------------
+//    r_wizard_popup_dialog_6
+//    resource for wizard step 6
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_upnp_wizard_popup_dialog_6
+    {
+    flags = EGeneralQueryFlags |
+        EEikDialogFlagNoTitleBar |
+        EEikDialogFlagNoBorder |
+        EEikDialogFlagNoShadow;
+    buttons = r_upnp_wizard_softkeys_next_back__select;
+
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                bmpfile = "";
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                };
+            }
+        };
+    }
+
+RESOURCE TBUF r_upnp_wizard_head_6_text
+    {
+    buf = qtn_iupnp_wizard_head_6;
+    }
+
+//----------------------------------------------------------------------------
+//    r_upnp_wizard_6_2_text
+//    text for r_upnp_wizard_popup_dialog_6
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_6_2_text
+    {
+    buf = qtn_iupnp_wizard_6_2;
+    }
+
+
+RESOURCE TBUF r_upnp_wizard_head_7_text
+    {
+    buf = qtn_iupnp_wizard_head_7;
+    }
+    
+
+RESOURCE TBUF r_upnp_wizard_head_8_text
+    {
+    buf = qtn_iupnp_wizard_head_8;
+    }
+    
+//----------------------------------------------------------------------------
+//    r_upnp_wizard_9a_text
+//    text for r_upnp_wizard_popup_dialog_9a
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_9a_text
+    {
+    buf = qtn_iupnp_wizard_9a_2;
+    }
+
+//----------------------------------------------------------------------------
+//    r_upnp_wizard_9b_text
+//    text for r_upnp_wizard_popup_dialog_9b
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_9b_text
+{
+    buf = qtn_iupnp_wizard_9b_2;
+}
+
+
+// --------------------------------------------------------------------------
+//    r_wizard_popup_dialog_9a
+//    resource for wizard step 9a
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_upnp_wizard_popup_dialog_9a
+    {
+    flags = EGeneralQueryFlags |
+        EEikDialogFlagNoTitleBar |
+        EEikDialogFlagNoBorder |
+        EEikDialogFlagNoShadow;
+
+    buttons = r_upnp_wizard_softkeys_done_back__select;
+
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                bmpfile = "";
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                };
+            }
+        };
+    }
+
+RESOURCE TBUF r_upnp_wizard_head_9_text
+    {
+    buf = qtn_iupnp_wizard_head_9;
+    }
+    
+// --------------------------------------------------------------------------
+//    r_wizard_popup_dialog_9b
+//    resource for wizard step 9b
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_upnp_wizard_popup_dialog_9b
+    {
+    flags = EGeneralQueryFlags |
+        EEikDialogFlagNoTitleBar |
+        EEikDialogFlagNoBorder |
+        EEikDialogFlagNoShadow;
+
+    buttons = r_upnp_wizard_softkeys_done_back__select;
+
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                bmpfile = "";
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                };
+            }
+        };
+    }
+
+//---------------------------------------------------------------------------
+//    r_upnp_wizard_starting_file_sharing_note
+//    text included from homeconnect.loc
+//    resource for starting filesharing wait note
+//---------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_upnp_wizard_starting_file_sharing_note
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                singular_label = qtn_iupnp_wait_sharing;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//---------------------------------------------------------------------------
+//    r_upnp_wizard_always_ask_text
+//    text for always ask item in iap selection
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_always_ask_text
+    {
+    buf = qtn_iupnp_always_ask;
+    }
+
+//---------------------------------------------------------------------------
+//    r_upnp_wizard_create_new_text
+//    text for create new item in iap selection
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_create_new_text
+    {
+    buf = qtn_iupnp_create_new;
+    }
+
+//---------------------------------------------------------------------------
+//    r_settings_start_sharing_error_text
+//    included from homeconnect.loc
+//    text to infrom used that sharing activation failed
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_start_sharing_error_text
+    {
+    buf = qtn_iupnp_start_sharing_error;
+    }
+
+//---------------------------------------------------------------------------
+//    r_upnp_wizard_4_text
+//    Text for wizard step 4
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_4_text
+    {
+    buf = qtn_iupnp_wizard_4;
+    }
+
+//---------------------------------------------------------------------------
+//    r_upnp_wizard_iap_turn_sharing_off
+//    note to show if sharing is on when trying to change iap or device name
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_iap_turn_sharing_off
+    {
+    buf = qtn_iupnp_ibu_gallery_connectionactive_note;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_upnp_wizard_updating_content_note_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_updating_content_note_text 
+    { 
+    buf = qtn_iupnp_wait_updating_content;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_upnp_wizard_updating_content_header
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_wizard_updating_content_header
+    { 
+    buf = qtn_iupnp_updating_content_header;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_upnp_wizard_info_query
+//
+//----------------------------------------------------------------------------
+//        
+RESOURCE DIALOG r_upnp_wizard_info_query
+{
+   flags = EGeneralQueryFlags | EEikDialogFlagNoTitleBar | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+   buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+   items=
+   {
+       DLG_LINE
+       {
+          type = EAknCtPopupHeadingPane;
+          id = EAknMessageQueryHeaderId;
+          control = AVKON_HEADING
+          {
+          };
+       },
+       DLG_LINE
+       {
+          type = EAknCtMessageQuery;
+          id = EAknMessageQueryContentId;
+          control = AVKON_MESSAGE_QUERY
+          {
+          };
+        }
+   };
+}
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/appwizard/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for upnp setup wizard
+*
+*/
+
+
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// ADO internal interface
+../inc/cupnpappwizard.h     |../../../inc/cupnpappwizard.h
+
+PRJ_MMPFILES
+cupnpappwizard.mmp
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/appwizard/group/cupnpappwizard.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project file for upnp settings wizard
+*
+*/
+
+
+
+
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+
+TARGET          upnpappwizard.dll
+TARGETTYPE      dll
+UID             0x100000D8 0x200009E7
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+// Include paths
+MW_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+START RESOURCE  ../data/cupnpappwizard.rss
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+SOURCEPATH      ../src
+
+SOURCE          cupnpappwizard.cpp
+
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         avkon.lib
+LIBRARY         aknlayout.lib
+LIBRARY         AKNSKINS.lib
+LIBRARY         AknIcon.lib
+LIBRARY         AknLayout2Scalable.lib
+LIBRARY         eikctl.lib
+LIBRARY         eikdlg.lib
+LIBRARY         featmgr.lib
+LIBRARY         egul.lib
+LIBRARY         CommonEngine.lib
+LIBRARY         fbscli.lib
+LIBRARY         efsrv.lib
+LIBRARY         hlplch.lib
+LIBRARY         gdi.lib
+LIBRARY         commdb.lib
+LIBRARY         apengine.lib
+LIBRARY         ecom.lib
+LIBRARY         bafl.lib
+LIBRARY         esock.lib
+
+// upnp stack
+LIBRARY         upnpipserversutils.lib
+
+// upnp framework
+LIBRARY         upnpapplicationengine.lib
+LIBRARY         upnpsettingsengine.lib
+LIBRARY         upnpmultiselectionui.lib
+
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/appwizard/inc/cupnpappwizard.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,517 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Header file for the Setup wizard class
+*
+*/
+
+
+
+
+
+
+#ifndef CUPNPAPPWIZARD
+#define CUPNPAPPWIZARD
+
+// INCLUDES
+#include <e32base.h>
+#include <AknWaitNoteWrapper.h>  // base class MAknBackgroundProcess
+
+#include "upnpfilesharingengine.h" //CUPnPFileSharingEngine & THomeConnectMediaType
+#include "upnpfilesharingengineobserver.h" //MUPnPFileSharingEngineObserver
+
+
+
+// CONSTANTS
+const TInt KUPnPAlwaysAskInd = 0;
+const TInt KUPnPCreateNewInd = 1;
+
+
+// FORWARD DECLARATIONS
+class CAknViewAppUi;
+class CUPnPSettingsEngine;
+class CEikonEnv;
+class CUPnPMultiselectionUi;
+// CLASS DECLARATION
+
+/**
+ * CUPnPAppWizard class
+ *
+ * Class implementing the functionality of the setup wizard
+ * @since S60 v3.1
+ * @lib upnpappwizard.lib
+ */
+class CUPnPAppWizard : public CBase,
+                       private MUPnPFileSharingEngineObserver,
+                       MAknBackgroundProcess
+    {
+public:     // Constructors and destructor
+
+    enum TSharingStarting
+        {
+        ENotActive,
+        EStartingSharing,
+        ESharingStarted
+        };
+
+    enum TShareArrayState
+        {
+        ESetMarked,
+        EResetArray,
+        EAddToArray
+        };
+    
+    /**
+     * Two-phased constructor.
+     * @since S60 v3.1
+     * @param aFirstStepText, Text for the first wizard step, owned by \
+client. If length of the aFirstStepText is 0 default text is used
+     * @param aEng, Pointer to filesharing engine instance
+     */
+    IMPORT_C static CUPnPAppWizard* NewL( const TDesC& aFirstStepText,
+                                          CUPnPFileSharingEngine* aEng );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPAppWizard();
+
+public:     // New functions
+
+    /**
+     * Starts wizard
+     *
+     * @since S60 v3.1
+     * @return TInt, Error code
+     */
+    IMPORT_C TInt StartL();
+
+    /**
+	 * Modifies iShareImgAndVideoArray and iShareMusicArray arrays
+	 *
+	 * @param aArrayState
+	 * @param aValue
+	 * @param aUiDlg
+	 */
+    void ModifyMarkedArrayL( TShareArrayState aArrayState 
+    		               , TInt aValue = 0
+    		               , CUPnPMultiselectionUi* aUiDlg = NULL );
+
+private:
+    /**
+     * CSelectionStorage class
+     *
+     * Private class for user selections and handling their 
+     * storage and retrieval
+     * @since S60 v3.1
+     */
+    NONSHARABLE_CLASS( CSelectionStorage ) : public CBase
+        {
+        public :
+
+        enum TSharingStartResult
+            {
+            ESharingStarted,
+            ENothingToShare,
+            ESharingStartFailed
+            };
+        /**
+        * C++ default constructor
+        * @param aSetEng. Pointer to CUPnPSettingsEngine, not owned
+        * @param aFileEng. Pointer to CUPnPFileSharingEngine, not owned
+        */
+        CSelectionStorage( CUPnPSettingsEngine* aSetEng,
+                       CUPnPFileSharingEngine* aFileEng );
+        /**
+        * Destructor.
+        */
+        virtual ~CSelectionStorage();
+
+        /**
+        * Store locally users selected device name
+        * @since S60 v3.1
+        * @param aDeviceName. The new name
+        */
+        void SetDeviceNameL( TDes& aDeviceName );
+
+        /**
+        * Get device name from local store of from cenrep
+        * @since S60 v3.1
+        * @param aDeviceName. Descriptor to store the name
+        * @return success of the operation
+        */
+        TInt GetDeviceNameL( TDes& aDeviceName );
+
+        /**
+        * Sets the IAP id of the user selected IAP
+        * @since S60 v3.1
+        * @param aIapId. Iap id of the selected IAP
+        * @param aIndexForUi, Index of the iap in UI list
+        */
+        void SetIapId( const TInt aIapId,
+                   const TInt aIndexForUi );
+        /**
+        * Function for getting the iapid from local storage or from cenrep
+        * @since S60 v3.1
+        * @param aIapId. Iap id of the selected IAP
+        * @return success of the operation
+        */
+        TInt GetIapId( TInt& aIapId );
+
+        /**
+        * Initialize Iap name and iap id arrays with some fixed texts
+        * @since S60 v3.1
+        * @param aIapNameArr. Array pointer for the names
+        * @param aIApIdArr. Array pointer for iap IDs
+        */
+        void InitializeIapArraysL( CDesCArray* aIapNameArr,
+                               RArray<TInt64>& aIapIdArr ) const;
+
+        /**
+        * Stores the user selections from filesharing popus to local storage
+        * @since S60 v3.1
+        * @param aMedia. Type of media
+        * @param aSelections. Array of the selections user has made.
+        * Stored only locally
+        */
+        void SetSharedContent( THomeConnectMediaType aMedia,
+                               CArrayFix<TInt>* aSelections );
+
+        /**
+        * Stores the devicename and IAP from local store to cenrep
+        * @since S60 v3.1
+        * @return success of the operation
+        */
+        TInt StoreSettingsL();
+        
+        /**
+        * Stores the selected image and video albums from local store to 
+        * cenrep
+        * @since S60 v3.2
+        * @return error code
+        */
+        TInt ImageStoreSharedFilesL();       
+
+        /**
+        * Gets the users sharing selections as indexes from local storage
+        * @since S60 v3.1
+        * @param aMedia. The kind of selections to get
+        * @param aSelections. Array for selections
+        */
+        void GetSelectionsL( 
+        THomeConnectMediaType aMedia,
+        CArrayFix<TInt>* aSelections );
+
+        /**
+        * Determines if the is need to start sharing
+        * @since S60 v3.1
+        * @return ETrue if sharing needs to be activated.
+        */
+        TBool HasSomethingToShare() const;
+
+        /** 
+        * Gets the currently selected IAP index for the listbox UI
+        * @since S60 v3.1
+        * @param aCurrentSelection. The new current selection
+        * @param aIapIdArr. Array of IAP ids of the IAPs shown in listbox
+
+        */
+        void GetCurrentSelection( TInt& aCurrentSelection,
+                              RArray<TInt64>& aIapIdArr );
+
+        /** 
+        * Gets the WAP iap associated to given IAPid
+        * @since S60 v3.1
+        * @param aIAPId. Id to match
+        * @return. The id of the corresponding WAP record
+        */
+        TInt ConvertIAPIdL( TInt aIAPId );
+                       
+    private :
+        /**
+        * Pointer to UPnP settings engine
+        * Not owned
+        */
+        CUPnPSettingsEngine* iSetEng;
+
+        /**
+        * Pointer to UPnP File sharing engine
+        * Not owned
+        */
+        CUPnPFileSharingEngine* iFileEng;
+
+        /**
+        * Pointer to UPnP device name
+        * Not owned
+        */
+        HBufC* iDeviceName;
+        
+        /**
+        * Users selected IAP id
+        *
+        */
+        TInt iIapId;
+
+        /**
+        * Index for home network UI, to show the correct item as selected 
+        *
+        */
+        TInt iIndexForUi;
+        
+        /**
+        * The selection of Image& video sharing for Home Network UI
+        */
+        TBool iVisualImageSelection;
+        
+        /**
+        * The selection of music sharing for Home Network UI
+        */
+        TBool iVisualMusicSelection;
+        
+        /**
+        * The Array of the selected indexes user has made for sharing images 
+        * and videos
+        * owned
+        */
+        CArrayFix<TInt>* iImageSelectionArray;
+        /**
+        * The Array of the selected indexes user has made for sharing music 
+        * owned
+        */
+        CArrayFix<TInt>* iMusicSelectionArray;       
+        
+        };
+
+
+    /**
+     * Internal states of wizard 
+     */
+    enum TWizardStep
+        {
+        EInfo1 = 0,
+        EInfo2,
+        EDeviceName,
+        EInfo4,
+        EAccessPoint,
+        EInfo6,
+        EShareImages,
+        EShareMusic,
+        EInfo9,
+        EStoreSettings,
+        EFinished
+        };
+
+    /**
+     * C++ default constructor
+     */
+    CUPnPAppWizard();
+
+    /**
+     * Show the information note with OK BACK buttons
+     * @since S60 v3.1
+     * @param TInt, resource ID
+     * @return keycode of the button user has pressed.
+     */
+    TInt ShowInfoStepL( TInt aMain ) const;
+
+    /**
+     * Show the first step. The text is given in constructor
+     * @param TInt, resource ID
+     * @return keycode of the button user has pressed.
+     */
+    TInt ShowFirstStepL( TInt aMain ) const;
+    /**
+     * Shows popup with text and header and edit box
+     * @since S60 v3.1
+     * @param TInt, resource ID
+     * @return keycode of the button user has pressed.
+     */
+    TInt ShowTextStepL( TInt aMain );
+
+    /**
+     * Show the information note without buttons
+     * @since S60 v3.1
+     * @param TInt, resource ID
+
+     */
+    void ShowInfoNoteL( TInt aMain ) const;
+
+    /**
+     * Show the UI dialog with selection list
+     * @since S60 v3.1
+     * @param TInt, resource ID
+     * @return keycode of the button user has pressed.
+     */
+    TInt ShowListStepL( TInt aMain );
+
+
+    /**
+     * Determines the next wizard step
+     * @since S60 v3.1
+     * @param TInt& The keycode of the users selection from previous dialog
+
+     */
+    void SetNextStep( const TInt& aSelection );
+
+    /**
+     * Shows the step for setting shared content
+     * @since S60 v3.1
+     * @param TInt, resource ID
+     * @return keycode of the button user has pressed.
+     */
+    TInt ShowMultiselectionStepL( TInt aText );
+
+    /**
+     * Show error note with given resource id
+     * @since S60 v3.1
+     * @param TInt, resource ID
+     */
+    void ShowErrorNoteL( TInt aMain ) const;
+
+    /**
+     * Show wait note with given resource id
+     * @since S60 v3.1
+     * @param TInt, resource ID
+     */
+    void ShowWaitNoteL( TInt aMain );
+
+private: //From MUPnPFileSharingEngineObserver
+    /**
+     * Function informs when file sharing was enabled or disabled
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     * @param aError, error code
+     * @param aPhase ETrue if current phase is sharing activation,
+     * otherwise EFalse
+     */
+    void HandleSharingStatus( 
+        CUPnPFileSharingEngine& aEngine, 
+        TInt aError,
+        TBool aPhase );
+
+    /**
+     * Callback to inform if connection has been lost
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     */ 
+    void HandleSharingConnectionLost( 
+        CUPnPFileSharingEngine& aEngine );
+
+private:
+    /** 
+     * Shows progress note to indicate progress of sharing files
+     * @since S60 v3.1
+     * @param TInt, The number of objects
+     */
+    void  ShowProgressNoteL( TInt aObjectCount );
+
+    /**
+     * Called when waitnote wrapper is finished
+     * From MProgressDialogCallback
+     */
+    void DialogDismissedL( TInt aButtonId );
+
+    /**
+     * EPOC default constructor.
+     */
+    void ConstructL( const TDesC& aFirstStepText, 
+                     CUPnPFileSharingEngine* aEng );
+
+    void StepL();
+
+    TBool IsProcessDone() const;
+
+    /**
+     * Display info note after starting sharing content
+     * @since S60 v3.1
+     * @param TInt, Id of note header resource
+     * @param TInt, Id of note message resource
+     * @param TInt, Id of note resource
+     */
+    void DisplayInfoL(
+        TInt aHeaderResourceId,
+        TInt aMessageResourceId,
+        TInt aDialogResourceId );
+
+
+private:    // Data
+
+    CAknViewAppUi* iAppUi;  // Not owned
+    TInt iResFileOffset;   // Resource file offset
+    CEikonEnv* iCoeEnv; // Not owned
+    /**
+     * The position of the wizard
+     */
+    TInt iStep;
+    /**
+     * The class for retrieving and setting shared items
+     */
+    CUPnPFileSharingEngine* iFileEng;
+    /**
+     * The class for setting  the IAP id and deviceName
+     */
+    CUPnPSettingsEngine* iSetEng;
+    /**
+     * The storage for the user selections
+     */
+    CSelectionStorage* iSelections;
+    
+    /**
+     * Wait used in asynchronous operations
+     * Started when there is operation ongoing in filesharingengine
+     */
+    CActiveSchedulerWait iWait;
+
+    /** 
+     * Array for IAP names
+     */
+    CDesCArray* iIapNameArr;
+    
+    /**
+     * Status of the sharing when starting wizard
+     * ETrue = Sharing on
+     */
+    TBool iSharingState;
+   
+    /**
+     * Text for the first wizard step 
+     *
+     */
+    HBufC* iFirstStepText;
+
+    /** 
+     * Indicator if starting sharing is ongoing
+     */
+    TInt iStartingSharing;
+
+    TBool iDialogDismissed;
+    
+    /**
+     * stores indexes if img and/or video is shared marked 
+     */
+    CArrayFix<TInt>* iShareImgAndVideoArray;
+    
+    /**
+     * stores indexes if music is shared marked 
+     */
+    CArrayFix<TInt>* iShareMusicArray;
+    
+    /**
+     * Flag the FeatureManager is initialized or not
+     */
+    TBool iFeatureManagerInitialized;    
+    };
+
+#endif  // CUPNPAPPWIZARD
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/appwizard/src/cupnpappwizard.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1314 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implementation of setup Wizard
+ *
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <AknUtils.h>
+#include <featmgr.h>
+#include <bautils.h>
+#include <StringLoader.h>
+#include <eikspmod.h>
+#include <eikclb.h>
+#include <aknview.h>
+#include <aknViewAppUi.h>
+#include <eikprogi.h>
+#include <aknmessagequerydialog.h>  //CAknMessageQueryDialog
+#include <aknlistquerydialog.h>     //CAknListQueryDialog
+#include <es_sock.h> //RSocketServ
+#include <commdb.h>
+#include <cdbcols.h>
+#include <WlanCdbCols.h>
+#include <wlanmgmtinterface.h>
+#include <aknnotewrappers.h> //CAknWaitDialog
+#include <AknWaitDialog.h>
+#include <cupnpappwizard.rsg>
+#include <commdb.h> // COMMS DB - for checking AP validity
+
+// upnp stack
+#include "upnpstring.h" //String::ToUnicodeL
+
+// ADO internal interfaces
+#include "upnpsettingsengine.h" //Friendly name, AP
+#include "upnpsettingsengine.hrh" //AP
+#include "cupnpmultiselectionui.h" //CUPnPMultiSelectionUi
+
+// this component
+#include "cupnpappwizard.h"
+
+// logging facility
+_LIT( KComponentLogfile, "upnpsetupwizard.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+// Filename of rsc file
+_LIT( KUPnPSetupWizardRscFile, "\\resource\\cupnpappwizard.rsc" );
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::CUPnPAppWizard
+// --------------------------------------------------------------------------
+//
+CUPnPAppWizard::CUPnPAppWizard()
+    {
+    __LOG("CUPnPAppWizard::CUPnPAppWizard");
+    iDialogDismissed = ETrue;
+    iFeatureManagerInitialized = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::ConstructL( const TDesC& aFirstStepText,
+                                 CUPnPFileSharingEngine* aEng )
+    {
+    __LOG("CUPnPAppWizard::ConstructL begin");
+
+    iShareImgAndVideoArray = new (ELeave) CArrayFixFlat<TInt>(3);
+    iShareMusicArray = new (ELeave) CArrayFixFlat<TInt>(3);
+    
+    iCoeEnv = CEikonEnv::Static();
+    RFs& fileSession = iCoeEnv->FsSession();
+
+
+    // Load resource file
+    TFileName rscFileName( KUPnPSetupWizardRscFile );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive );
+    
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( fileSession, rscFileName ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+    TInt err( KErrNone );
+    TRAP( err, iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ) );
+
+    FeatureManager::InitializeLibL();
+    iFeatureManagerInitialized = ETrue;
+
+    // Get AppUI pointer
+    iAppUi = static_cast<CAknViewAppUi*>( iCoeEnv->EikAppUi() );
+
+    iSetEng = CUPnPSettingsEngine::NewL();
+    if ( aEng )
+        {
+        iFileEng = aEng;
+        }
+    else
+        {
+        User::Leave( KErrArgument);
+        }
+    iFileEng->SetObserver( this );
+    iFirstStepText = aFirstStepText.AllocL();
+
+    iSharingState = iFileEng->SharingStateL();
+    iSelections = new (ELeave) CSelectionStorage( iSetEng, iFileEng );
+    __LOG("CUPnPAppWizard::ConstructL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::NewL()
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPAppWizard* CUPnPAppWizard::NewL( const TDesC& aFirstStepText,
+                                               CUPnPFileSharingEngine* aEng )
+    {
+    __LOG("CUPnPAppWizard::NewL begin");
+
+    CUPnPAppWizard* self = new ( ELeave) CUPnPAppWizard();
+    CleanupStack::PushL( self );
+
+    self->ConstructL( aFirstStepText, aEng );
+
+    CleanupStack::Pop();
+    __LOG("CUPnPAppWizard::NewL end");
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPAppWizard::~CUPnPAppWizard()
+    {
+    __LOG("CUPnPAppWizard::~CUPnPAppWizard begin");
+
+    if ( iFeatureManagerInitialized )
+        {
+        FeatureManager::UnInitializeLib();
+        }
+
+    // Un-Load resource file
+    if ( iResFileOffset )
+        {
+        CEikonEnv::Static()->DeleteResourceFile( iResFileOffset );
+        iResFileOffset = 0;
+        }
+
+    delete iSetEng;
+
+    delete iSelections;
+    delete iIapNameArr;
+    delete iFirstStepText;
+
+    if ( iWait.IsStarted() )
+        {
+        if ( iWait.CanStopNow() )
+            {
+            iWait.AsyncStop();
+            }
+        else
+            {
+            __LOG("CUPnPAppWizard: \
+Error cant stop iWait");
+            }
+        }
+
+    if ( iFileEng )
+        {
+        iFileEng->SetObserver( NULL );
+        }
+
+    delete iShareImgAndVideoArray;
+    delete iShareMusicArray;
+    
+    __LOG("CUPnPAppWizard::~CUPnPAppWizard end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::StartL
+// The main loop of setup wizard
+// --------------------------------------------------------------------------
+//
+
+EXPORT_C TInt CUPnPAppWizard::StartL( )
+    {
+    __LOG("CUPnPAppWizard::StartL begin");
+    TInt ret(KErrNone);
+    do
+        {
+        switch ( iStep )
+            {
+        case EInfo1:
+            {
+            ret = ShowFirstStepL( R_UPNP_WIZARD_POPUP_DIALOG_1 );
+            }
+            break;
+        case EInfo2:
+            {
+            ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_2 );
+            }
+            break;
+        case EDeviceName:
+            {
+            ret = ShowTextStepL( R_UPNP_WIZARD_POPUP_DIALOG_3 );
+            }
+            break;
+        case EInfo4:
+            {
+            ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_4 );
+            }
+            break;
+        case EAccessPoint:
+            {
+            ret = ShowListStepL( R_UPNP_WIZARD_POPUP_DIALOG_5 );
+            }
+            break;
+        case EInfo6:
+            {
+            ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_6 );
+            }
+            break;
+        case EShareImages:
+            {
+            ret = ShowMultiselectionStepL( R_UPNP_WIZARD_HEAD_7_TEXT );
+            }
+            break;
+        case EShareMusic:
+            {
+            ret = ShowMultiselectionStepL(R_UPNP_WIZARD_HEAD_8_TEXT );
+            }
+            break;
+        case EInfo9:
+            {
+            if ( iSelections->HasSomethingToShare() )
+                {
+                ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_9A );
+                }
+            else
+                {
+				iFileEng->SetObserver( this );
+                ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_9B );
+                }
+            }
+            break;
+        case EStoreSettings:
+            {
+            iSelections->StoreSettingsL();
+            if ( !iSharingState && iSelections->HasSomethingToShare() )
+                {
+                __LOG("CUPnPAppWizard::StartL: \
+Staring sharing..");
+                // need to wait for DialogDismissed()
+                iDialogDismissed = EFalse;
+                ShowWaitNoteL( R_UPNP_WIZARD_STARTING_FILE_SHARING_NOTE );
+                DisplayInfoL( R_UPNP_WIZARD_UPDATING_CONTENT_HEADER,
+                              R_UPNP_WIZARD_UPDATING_CONTENT_NOTE_TEXT,
+                              R_UPNP_WIZARD_INFO_QUERY );
+                }
+            else if ( iSharingState && !iSelections->HasSomethingToShare() )
+                {
+                __LOG("CUPnPAppWizard::StartL: \
+Stopping sharing..");
+                iFileEng->SetSharingStateL( EFalse );
+                iWait.Start();
+                }
+
+            // Stores also videofiles
+            iSelections->ImageStoreSharedFilesL();
+
+
+            }
+            break;
+        default :
+            {
+            __LOG("CUPnPAppWizard::StartL: default!");
+            _LIT(KUser, "USER");
+            User::Panic(KUser, 0);
+            }
+            break;
+            }
+        SetNextStep( ret );
+        }
+    while ( iStep != EFinished );
+    __LOG("CUPnPAppWizard::StartL end");
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::ShowListStepL
+// Show the UI dialog with selection list
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAppWizard::ShowListStepL( TInt aMain )
+    {
+    __LOG("CUPnPAppWizard::ShowListStepL begin");
+    TInt returnValue(KErrNone);
+    TInt currentSel(0);
+    TInt selectedIap(1);
+    TInt oldIap;
+    iSelections->GetIapId( oldIap );
+    TBool sharingCheck;
+    RArray<TInt64> iapIdArr;
+    TInt oldIapCount(0);
+
+    if ( !iIapNameArr )
+        {
+        iIapNameArr = new (ELeave) CDesCArrayFlat(3);
+        }
+
+    do
+        {
+        sharingCheck = ETrue;// ok to exit
+        currentSel = 0;
+        iSelections->InitializeIapArraysL( iIapNameArr, iapIdArr );
+        CUPnPSettingsEngine::GetWLANAccessPointsL( iIapNameArr, iapIdArr );
+        
+        // Set correct initial selection for ui
+        if ( currentSel != KUPnPCreateNewInd )
+            {
+            iSelections->GetCurrentSelection( currentSel, iapIdArr );
+            }
+        else
+            {
+            // ..in case user has selected "Create new"
+            if ( !iSharingState &&
+                 returnValue &&
+                 oldIapCount )
+                {
+                if ( oldIapCount != iapIdArr.Count() )
+                    {
+                    currentSel = iapIdArr.Count() - 1;
+                    }
+                }
+            }
+        CAknListQueryDialog* dlg = new
+            ( ELeave ) CAknListQueryDialog( &currentSel );
+
+        if ( !dlg )
+            {
+            User::Leave( KErrNoMemory );
+            }
+        dlg->PrepareLC( aMain );
+        
+        HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_5_TEXT );
+        dlg->SetHeaderTextL( *head );
+        CleanupStack::PopAndDestroy( head );
+    
+        dlg->SetItemTextArray( iIapNameArr );
+        dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+        CListBoxView* listBoxView = dlg->ListBox()->View();
+        listBoxView->SetCurrentItemIndex( currentSel );
+
+        returnValue = dlg->RunLD();
+
+        TInt c( iapIdArr.Count() );
+
+        if ( currentSel == KUPnPCreateNewInd )
+            {
+            /* call to Wlan creator API */
+            
+            __LOG("CUPnPAppWizard::ShowListStepL:\
+Create new IAP..");
+            CUPnPSettingsEngine::CreateAccessPointL();
+            oldIapCount = iapIdArr.Count();
+            }
+        else if ( currentSel-1 < c )
+            {
+            // set last iap as selected if user succesfully created new iap
+            selectedIap = iapIdArr[ currentSel ];
+            }
+        if ( iSharingState &&
+             ( selectedIap != oldIap ) &&
+             returnValue )
+            {
+            // show info note if sharing is on and user pressed ok
+            sharingCheck = EFalse;
+            ShowInfoNoteL( R_UPNP_WIZARD_IAP_TURN_SHARING_OFF );
+            }
+        iapIdArr.Reset();
+        iIapNameArr->Reset();
+        }
+    while ( currentSel == KUPnPCreateNewInd ||
+            ! sharingCheck );
+
+    iSelections->SetIapId( selectedIap, currentSel );
+
+    iapIdArr.Reset();
+    __LOG("CUPnPAppWizard::ShowListStepL end");
+    return returnValue;
+    }
+
+// ---------------------------------------------------------
+// CUPnPAppWizard::ShowTextStepL( TInt aMain )
+// Shows popup with text and header
+// ---------------------------------------------------------
+//
+TInt CUPnPAppWizard::ShowTextStepL( TInt aMain )
+    {
+    __LOG("CUPnPAppWizard::ShowTextStepL");
+    TInt returnValue(KErrNone);
+
+    TBuf<64> data;
+    TBool sharingCheck( ETrue );
+    iSelections->GetDeviceNameL( data );
+    HBufC16* oldName16 = HBufC16::NewL( data.Size() );
+    CleanupStack::PushL( oldName16 );
+    *oldName16 = data;
+
+    do
+        {
+        sharingCheck = ETrue;
+        CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( data );
+
+        dlg->PrepareLC( aMain );
+        
+        HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_3_TEXT );
+        dlg->SetPromptL( *head );
+        CleanupStack::PopAndDestroy( head );    
+    
+        returnValue = dlg->RunLD();
+
+        if ( iSharingState &&
+             returnValue )
+            {
+            TInt compRes = oldName16->CompareF( data );
+            if ( compRes )
+                {
+                // show info note if sharing is on
+                sharingCheck = EFalse;
+                ShowInfoNoteL( R_UPNP_WIZARD_IAP_TURN_SHARING_OFF );
+                data = *oldName16;
+                }
+            }
+        }
+    while ( !sharingCheck );
+    CleanupStack::PopAndDestroy( oldName16 );
+    if ( returnValue )
+        {
+        iSelections->SetDeviceNameL( data );
+        }
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::ShowInfoNoteL
+// Show the information note without buttons
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::ShowInfoNoteL( TInt aMain ) const
+    {
+    __LOG("CUPnPAppWizard::ShowInfoNoteL");
+
+    CAknInformationNote* note = new (ELeave) CAknInformationNote(ETrue);
+    HBufC* noteText = CCoeEnv::Static()->AllocReadResourceLC(
+        aMain);
+    note->ExecuteLD(*noteText);
+    CleanupStack::PopAndDestroy(noteText);
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::ShowInfoStepL
+// Show the information note with OK BACK buttons
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAppWizard::ShowInfoStepL( TInt aMain ) const
+    {
+    __LOG("CUPnPAppWizard::ShowInfoStepL");
+    TInt returnValue(KErrNone);
+    HBufC* messageText;
+
+    CAknMessageQueryDialog* dlg = new (ELeave)
+        CAknMessageQueryDialog( CAknQueryDialog::ENoTone );
+
+    dlg->PrepareLC( aMain );
+
+    switch( aMain )
+        {
+    case R_UPNP_WIZARD_POPUP_DIALOG_2:
+        {
+        HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_2_TEXT );
+        dlg->SetHeaderTextL( *head );
+        CleanupStack::PopAndDestroy( head );
+        
+        HBufC* body = StringLoader::LoadLC( R_UPNP_WIZARD_2_TEXT );
+        dlg->SetMessageTextL( *body );
+        CleanupStack::PopAndDestroy( body );
+        
+        break;
+        }
+    case R_UPNP_WIZARD_POPUP_DIALOG_5:
+        {
+        HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_5_TEXT );
+        dlg->SetHeaderTextL( *head );
+        CleanupStack::PopAndDestroy( head );
+        break;
+        }    
+    case R_UPNP_WIZARD_POPUP_DIALOG_6:
+        {
+        HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_6_TEXT );
+        dlg->SetHeaderTextL( *head );
+        CleanupStack::PopAndDestroy( head );
+    
+        messageText = StringLoader::LoadLC( R_UPNP_WIZARD_6_2_TEXT );
+        dlg->SetMessageTextL( messageText->Des() );
+        CleanupStack::PopAndDestroy( );
+        break;
+        }
+    case R_UPNP_WIZARD_POPUP_DIALOG_9A:
+        {
+        HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_9_TEXT );
+        dlg->SetHeaderTextL( *head );
+        CleanupStack::PopAndDestroy( head );
+        
+        messageText = StringLoader::LoadLC( R_UPNP_WIZARD_9A_TEXT );
+        dlg->SetMessageTextL( messageText->Des() );
+        CleanupStack::PopAndDestroy( );
+        break;
+        }
+    case R_UPNP_WIZARD_POPUP_DIALOG_9B:
+        {
+        HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_9_TEXT );
+        dlg->SetHeaderTextL( *head );
+        CleanupStack::PopAndDestroy( head );
+        
+        messageText = StringLoader::LoadLC( R_UPNP_WIZARD_9B_TEXT );
+        dlg->SetMessageTextL( messageText->Des() );
+        CleanupStack::PopAndDestroy( );
+        break;
+        }
+    default:
+        break;
+        }
+
+    if ( iStep == EInfo4 )
+        {
+        HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_4_TEXT );
+        dlg->SetHeaderTextL( *head );
+        CleanupStack::PopAndDestroy( head );
+        
+        HBufC* itemText2 = StringLoader::LoadLC( R_UPNP_WIZARD_ALWAYS_ASK_TEXT );
+        HBufC* itemText1 = StringLoader::LoadLC( R_UPNP_WIZARD_4_TEXT,
+                                                 *itemText2 );
+
+        dlg->SetMessageTextL( itemText1->Des() );
+        CleanupStack::PopAndDestroy( 2 ); //itemText 1 & 2
+        }
+    returnValue = dlg->RunLD();
+
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::ShowFirstStepL
+// Show the first information note with OK BACK buttons and given text
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAppWizard::ShowFirstStepL( TInt aMain ) const
+    {
+    __LOG("CUPnPAppWizard::ShowFirstStepL");
+    TInt returnValue( KErrNone );
+
+    CAknMessageQueryDialog* dlg = new (ELeave)
+        CAknMessageQueryDialog( CAknQueryDialog::ENoTone );
+
+    dlg->PrepareLC( aMain );
+    HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_1_TEXT );
+    dlg->SetHeaderTextL( *head );
+    CleanupStack::PopAndDestroy( head );
+    
+    if ( iFirstStepText->Length() )
+        {
+        // if the text for first step is given use it insted of default
+        __LOG( "Setting text" );
+        dlg->SetMessageTextL( *iFirstStepText );
+        }       
+    else
+        {
+        __LOG( " StringLoader::LoadLC" );
+        HBufC* body = StringLoader::LoadLC(R_UPNP_WIZARD_1_TEXT);
+        __LOG( "SetMessageTextL" );
+        dlg->SetMessageTextL( *body );
+        __LOG( "PopAndDestroy" );
+        CleanupStack::PopAndDestroy();
+        }
+    returnValue = dlg->RunLD();
+
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::ShowInfoStepL
+// Show the multiselection popup dialog for setting content to share
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAppWizard::ShowMultiselectionStepL( TInt aText )
+    {
+    __LOG("CUPnPAppWizard::ShowMultiselectionStepL");
+
+    TInt returnValue(KErrNone);
+
+    THomeConnectMediaType mediaType( EImageAndVideo );
+
+    CArrayFix<TInt>* resArr = new (ELeave) CArrayFixFlat<TInt>(5);
+    CleanupStack::PushL( resArr );
+
+    if ( iStep == EShareMusic )
+        {
+        mediaType = EPlaylist;
+        }
+    TInt visualSharingState;
+    HBufC* head = StringLoader::LoadLC( aText );
+    
+    // no ownership transfers
+    CUPnPMultiselectionUi* uiDlg = CUPnPMultiselectionUi::
+        NewL(mediaType,
+             iFileEng,
+             visualSharingState,
+             resArr,
+             CUPnPMultiselectionUi::EPopup,
+             head );
+    CleanupStack::PushL( uiDlg );
+
+    ModifyMarkedArrayL(ESetMarked,NULL,uiDlg);
+    
+    returnValue = uiDlg->ExecutePopupLD();
+
+    CleanupStack::PopAndDestroy( uiDlg );
+    
+    CleanupStack::PopAndDestroy( head );    
+
+    if ( returnValue )
+        {
+        ModifyMarkedArrayL(EResetArray);
+        for( TInt i = 0 ; i < resArr->Count() ; ++i )
+            {
+            TInt tmp = resArr->At(i);
+            ModifyMarkedArrayL(EAddToArray,tmp);
+            }
+        // Transfer ownership of all dynamic variables( resARr )
+        iSelections->SetSharedContent( mediaType,
+                                       resArr );
+        iFileEng->SetSelectionIndexesL( mediaType, *resArr );
+        }
+
+    CleanupStack::PopAndDestroy( resArr );
+    return returnValue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::ModifyMarkedArrayL
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::ModifyMarkedArrayL( TShareArrayState aArrayState 
+                                       , TInt aValue 
+                                       , CUPnPMultiselectionUi* aUiDlg )
+    {
+    CArrayFix<TInt>* array = NULL;
+    if( iStep == EShareMusic )
+        {
+        array = iShareMusicArray;
+        }
+    else if( EShareImages == iStep )
+        {
+        array = iShareImgAndVideoArray;
+        }
+    if( array )
+        {
+        switch(aArrayState)
+            {
+            case ESetMarked:
+                {
+                if( aUiDlg )
+                    {
+                    aUiDlg->SetMarkedItemsL( *array );
+                    }
+                break;
+                }
+            case EResetArray:
+                {
+                array->Reset();
+                break;
+                }
+            case EAddToArray:
+                {
+                array->AppendL(aValue);
+                break;
+                }
+            default:
+            	break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::SetNextStep
+// Calculates the next step in wizard
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::SetNextStep( const TInt& aSelection )
+    {
+    __LOG("CUPnPAppWizard::SetNextStep");
+
+    switch ( iStep )
+        {
+    case EInfo1:
+        {
+        if ( aSelection )
+            {
+            iStep++;
+            }
+        else
+            {
+            iStep = EFinished;
+            }
+        }
+        break;
+    case EInfo2:
+        // fall through
+    case EDeviceName:
+        // fall through
+    case EInfo4:
+        // fall through
+    case EAccessPoint:
+        // fall through
+    case EInfo6:
+        // fall through
+    case EShareImages:
+        // fall through
+    case EShareMusic:
+        // fall through
+    case EInfo9:
+        // fall through
+    case EStoreSettings:
+        {
+        if ( aSelection )
+            {
+            iStep++;
+            }
+        else
+            {
+            iStep--;
+            }
+        }
+        break;
+    default :
+        {
+        __LOG("CUPnPAppWizard::SetNextStep: default!");
+        _LIT(KUser, "USER");
+        User::Panic(KUser, 0);
+        }
+        break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::ShowErrorNoteL
+// Shows note with error message
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::ShowErrorNoteL( TInt aMain ) const
+    {
+    __LOG("CUPnPAppWizard::ShowErrorNoteL begin");
+
+    // show error note
+    HBufC* errorNote = StringLoader::LoadLC( aMain );
+    CAknErrorNote* note = new (ELeave) CAknErrorNote(ETrue);
+    note->ExecuteLD(*errorNote);
+    CleanupStack::PopAndDestroy(); //errorNote
+    __LOG("CUPnPAppWizard::ShowErrorNoteL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::ShowWaitNoteL
+// Shows standard wait note
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::ShowWaitNoteL( TInt aMain )
+    {
+    __LOG("CUPnPAppWizard::ShowWaitNoteL begin");
+
+    CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL();
+    CleanupStack::PushL(reinterpret_cast<CBase*>(waitNoteWrapper));
+    waitNoteWrapper->ExecuteL(
+        aMain,      // TInt aResId,
+        *this,            // MAknBackgroundProcess& aBackgroundProcess
+        ETrue);
+    CleanupStack::PopAndDestroy();
+    __LOG("CUPnPAppWizard::ShowWaitNoteL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::StepL
+// Step done during wait note
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::StepL(void)
+    {
+    if ( iStartingSharing == ENotActive )
+        {
+        iStartingSharing = EStartingSharing;
+        }
+
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::IsProcessDone
+// Returns ETrue if process finished
+// --------------------------------------------------------------------------
+//
+TBool CUPnPAppWizard::IsProcessDone(void) const
+    {
+
+    TBool ret(EFalse);
+    if ( iStartingSharing == ENotActive )
+        {
+        TRAPD( err, iFileEng->SetSharingStateL( ETrue ) );
+        if( err != KErrNone )
+            {
+            return ETrue;
+            }
+        }
+    else if ( iStartingSharing == ESharingStarted )
+        {
+        ret = ETrue;
+        }
+    else
+        {
+        __LOG( "CUPnPAppWizard::IsProcessDone: else branch");
+        }
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::HandleSharingStatus
+// Function informs when file sharing was enabled or disabled
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::HandleSharingStatus( 
+        CUPnPFileSharingEngine& /*aEngine*/, 
+        TInt aError, 
+        TBool aPhase )
+    {
+    __LOG("CUPnPAppWizard::HandleSharingStatus begin");
+
+    if ( aPhase )
+        {
+        __LOG("CUPnPAppWizard::HandleSharingStatus:\
+ activating sharing");
+        iStartingSharing = ESharingStarted;
+        if ( aError )
+            {
+            // If there domtree wasn't able to be written due to disk full
+            // situation, send leave to kernel to inform user
+            if( aError == KErrDiskFull ||
+                aError == KErrNoMemory ||
+                aError == KErrInUse )
+                {
+                //show some critical errors using
+                //default symbian error notes
+                CActiveScheduler::Current()->Error( aError );
+                }
+            else
+                {
+                if ( !iDialogDismissed )
+                    {
+                    // must ensure that wait note is gone, see DialogDismissed
+                    iWait.Start();
+                    }
+                TRAP_IGNORE( 
+                    ShowErrorNoteL( 
+                        R_UPNP_WIZARD_START_SHARING_ERROR_TEXT ) );
+                }
+            }
+        if ( iWait.IsStarted() )
+            {
+            if ( iWait.CanStopNow() )
+                {
+                iWait.AsyncStop();
+                }
+            else
+                {
+                __LOG("CUPnPAppWizard: \
+Error cant stop iWait");
+                }
+            }
+        }
+    else
+        {
+        __LOG("CUPnPAppWizard::HandleSharingStatus:\
+ deactivating sharing");
+        // stop showing wait note
+        if ( iWait.IsStarted() )
+            {
+            iWait.AsyncStop();
+            }
+        }
+
+    __LOG("CUPnPAppWizard::HandleSharingStatus end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::HandleSharingConnectionLost
+// Callback to inform if connection has been lost
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::HandleSharingConnectionLost( 
+    CUPnPFileSharingEngine& /*aEngine*/ )
+    {
+    __LOG( "[CUPnPAppWizard]\t CUPnPAppWizard::HandleSharingConnectionLost\
+ begin" );
+
+    iSharingState = EFalse;
+
+    __LOG( "[CUPnPAppWizard]\t CUPnPAppWizard::HandleSharingConnectionLost\
+ end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::DialogDismissedL
+// Callback for dialog disappearing
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::DialogDismissedL( TInt /*aButtonId*/ )
+    {
+    __LOG( "[CUPnPAppWizard]\t DialogDismissedL begin" );
+
+    iDialogDismissed = ETrue;
+    if ( iWait.IsStarted())
+        {
+        iWait.AsyncStop();
+        }
+
+    __LOG( "[CUPnPAppWizard]\t DialogDismissedL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::DisplayInfoL()
+// Shows message query to user
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::DisplayInfoL(
+    TInt aHeaderResourceId,
+    TInt aMessageResourceId,
+    TInt aDialogResourceId )
+    {
+    __LOG("CUPnPAppWizard::DisplayInfoL begin");
+    HBufC* noteHeader = StringLoader::LoadL(
+        aHeaderResourceId);
+    CleanupStack::PushL(noteHeader);
+    HBufC* noteMsg = StringLoader::LoadL(
+        aMessageResourceId);
+    CleanupStack::PushL(noteMsg);
+
+    CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*noteMsg);
+
+
+    dlg->PrepareLC(aDialogResourceId);
+    dlg->QueryHeading()->SetTextL(*noteHeader);
+    dlg->RunLD();
+
+
+    CleanupStack::PopAndDestroy(noteMsg);
+    CleanupStack::PopAndDestroy(noteHeader);
+    __LOG("CUPnPAppWizard::DisplayInfoL end");
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppWizard::CSelectionStorage functions
+//
+// --------------------------------------------------------------------------
+//
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::CSelectionStorage
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPAppWizard::CSelectionStorage::~CSelectionStorage()
+    {
+    __LOG("[UPnPAppWizard]\tCSelectionStorage::~CSelectionStorage() begin");
+    delete iDeviceName;
+    delete iMusicSelectionArray;
+    delete iImageSelectionArray;
+    __LOG("CSelectionStorage::~CSelectionStorage() end");
+    }
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::CSelectionStorage
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUPnPAppWizard::CSelectionStorage::CSelectionStorage(
+    CUPnPSettingsEngine* aSetEng,
+    CUPnPFileSharingEngine* aFileEng )
+    {
+    __LOG("CSelectionStorage::CSelectionStorage() begin");
+    iSetEng = aSetEng;
+    iFileEng = aFileEng;
+    __LOG("CSelectionStorage::CSelectionStorage() end");
+    }
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::SetDeviceNameL
+// Function for setting the device name to local storage
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::CSelectionStorage::SetDeviceNameL( TDes& aDeviceName )
+    {
+    __LOG("CSelectionStorage::SetDeviceNameL begin");
+    delete iDeviceName;
+    iDeviceName = NULL;
+    iDeviceName = HBufC::NewL(aDeviceName.Length());
+
+    *iDeviceName = aDeviceName;
+    __LOG("CSelectionStorage::SetDeviceNameL end");
+    }
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::GetDeviceNameL
+// Function for getting the device name from local storage or from cenrep
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAppWizard::CSelectionStorage::GetDeviceNameL( TDes& aDeviceName )
+    {
+    __LOG("CSelectionStorage::GetDeviceNameL begin");
+    TInt err(0);
+    if ( iDeviceName )
+        {
+        aDeviceName = iDeviceName->Des();
+        }
+    else
+        {
+        THostName data;
+        TBuf8<65> deviceName8;
+        err = iSetEng->GetLocalFriendlyName( deviceName8 );
+
+        HBufC* deviceName16 = UpnpString::ToUnicodeL( deviceName8 );
+        CleanupStack::PushL( deviceName16 );
+        aDeviceName = deviceName16->Des();
+        CleanupStack::PopAndDestroy( deviceName16 );
+        }
+    __LOG("CSelectionStorage::GetDeviceNameL end");
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::GetIapId
+// Function for getting the iapid from local storage or from cenrep
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAppWizard::CSelectionStorage::GetIapId( TInt& aIapId )
+    {
+    __LOG("CSelectionStorage::GetIapId begin");
+    TInt err( KErrNone );
+    if ( iIapId )
+        {
+        aIapId = iIapId;
+        }
+    else
+        {
+        err = iSetEng->GetAccessPoint( iIapId );
+        aIapId = iIapId;
+        }
+    __LOG("CSelectionStorage::GetIapId end");
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::SetIapId
+// Function for setting the iapid to local storage
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::CSelectionStorage::SetIapId( const TInt aIapId,
+                                                  const TInt aIndexForUi )
+    {
+    __LOG("CSelectionStorage::SetIapId begin");
+
+    iIapId = aIapId;
+    iIndexForUi = aIndexForUi;
+
+    __LOG("CSelectionStorage::SetIapId end");
+    }
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::StoreSettingsL
+// Function for storing devicename and iapid to cenrep
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAppWizard::CSelectionStorage::StoreSettingsL()
+    {
+    __LOG("CSelectionStorage::StoreSettingsL begin");
+    TInt err(0);
+    if ( iDeviceName )
+        {
+        HBufC8* name8 = UpnpString::FromUnicodeL( iDeviceName->Des() );
+        CleanupStack::PushL( name8 );
+        err = iSetEng->SetLocalFriendlyName( name8->Des() );
+        CleanupStack::PopAndDestroy( name8 );
+        }
+    if ( iIapId >= EUPnPSettingsEngineIAPIdAlwaysAsk )
+        {
+        // Stores iap id.
+        iSetEng->SetAccessPoint( iIapId );
+        
+        // Stores iap selection type.
+        TInt iapForHomeNetworkUi( EUPnPSettingsEngineIAPItemUserDefined );
+        if ( iIapId == EUPnPSettingsEngineIAPIdAlwaysAsk )
+            {
+            iapForHomeNetworkUi = EUPnPSettingsEngineIAPItemAlwaysAsk;
+            }
+        iSetEng->SetAccessPointSetting( iapForHomeNetworkUi );
+        
+        // index for HN ui?
+        iSetEng->SetWapId( iIndexForUi+1 );
+        }
+
+    __LOG("CSelectionStorage::StoreSettingsL end");
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::ImageStoreSharedFilesL
+// Function for storing image and video
+// --------------------------------------------------------------------------
+//
+TInt CUPnPAppWizard::CSelectionStorage::ImageStoreSharedFilesL( )
+    {
+    /* Save Images and Videos */
+    __LOG( "CSelectionStorage::Sharing image and video .." );
+    if ( iFileEng )
+        {
+        iFileEng->ShareMediaL( EImageAndVideo );
+        iFileEng->ShareMediaL( EPlaylist );
+        }   
+    __LOG( "CSelectionStorage::ImageStoreSharedFilesL end" );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::InitializeIapArraysL
+// Add default items to iap name array
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::CSelectionStorage::InitializeIapArraysL(
+    CDesCArray* aIapNameArr,
+    RArray<TInt64>& aIapIdArr ) const
+    {
+    __LOG("[UPnPAppWizard]\tCSelectionStorage::InitializeIapArraysL begin");
+
+    HBufC* itemText1 = StringLoader::LoadLC( R_UPNP_WIZARD_ALWAYS_ASK_TEXT );
+    HBufC* itemText2 = StringLoader::LoadLC( R_UPNP_WIZARD_CREATE_NEW_TEXT );
+
+    aIapNameArr->AppendL( itemText1->Des() );
+    aIapIdArr.AppendL( EUPnPSettingsEngineIAPIdAlwaysAsk );
+    aIapNameArr->AppendL( itemText2->Des() );
+    aIapIdArr.AppendL( EUPnPSettingsEngineIAPIdCreateNew );
+
+    //aIapNameArr does not own the items
+    CleanupStack::PopAndDestroy(2);
+
+    __LOG("[UPnPAppWizard]\tCSelectionStorage::InitializeIapArraysL end");
+    }
+
+// -------------------------------------------------------------
+// CSelectionStorage::SetSharedContent()
+// Sets the users sharing selections to local storage
+// -------------------------------------------------------------
+//
+void CUPnPAppWizard::CSelectionStorage::SetSharedContent(
+    THomeConnectMediaType aMedia,
+    CArrayFix<TInt>* aSelections )
+    {
+    __LOG("CSelectionStorage::SetSharedContent begin");
+
+    if ( aMedia == EImageAndVideo )
+        {
+        // determine the users selections from UI
+        // if there is only one item selected and its value is not 0
+        // -> Share all is selected
+        if ( ! (aSelections->Count() == 1 && aSelections->At(0) == 0 ) )
+            {
+            iVisualImageSelection = ETrue;
+            }
+        }
+    else
+        {
+
+        if ( ! (aSelections->Count() == 1 && aSelections->At(0) == 0 ) )
+            {
+            // no difference between EShareAll and EShareMany
+            iVisualMusicSelection = ETrue;
+            }
+
+        }
+
+    __LOG("CSelectionStorage::SetSharedContent end");
+    }
+
+
+// -------------------------------------------------------------
+// CSelectionStorage::SetSharedContent()
+// Gets the users sharing selections from local storage
+// -------------------------------------------------------------
+//
+void CUPnPAppWizard::CSelectionStorage::GetSelectionsL(
+    THomeConnectMediaType aMedia,
+    CArrayFix<TInt>* aSelections )
+    {
+    __LOG("CSelectionStorage::GetSelectionsL begin");
+
+    if ( aMedia == EImageAndVideo )
+        {
+        if ( iImageSelectionArray )
+            {
+            for ( TInt i = 0; i < iImageSelectionArray->Count(); i++ )
+                {
+                TInt tmp = iImageSelectionArray->At( i );
+                aSelections->AppendL( tmp );
+                }
+            }
+        }
+    else
+        {
+        if ( iMusicSelectionArray )
+            {
+            for ( TInt i = 0; i < iMusicSelectionArray->Count(); i++ )
+                {
+                TInt tmp = iMusicSelectionArray->At( i );
+                aSelections->AppendL( tmp );
+                }
+            }
+        }
+    __LOG("CSelectionStorage::GetSelectionsL end");
+    }
+
+// -------------------------------------------------------------
+// CSelectionStorage::HasSomethingToShare()
+// Determines if the user has selected content to share
+// -------------------------------------------------------------
+//
+TBool CUPnPAppWizard::CSelectionStorage::HasSomethingToShare() const
+    {
+    __LOG("CSelectionStorage::HasSomethingToShare begin");
+    TBool retVal( EFalse );
+    if ( iVisualImageSelection || iVisualMusicSelection )
+        {
+        retVal = ETrue;
+        }
+    __LOG("CSelectionStorage::HasSomethingToShare end");
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CSelectionStorage::GetCurrentSelection
+// Gets the user selected iapid or iapid from cenrep
+// --------------------------------------------------------------------------
+//
+void CUPnPAppWizard::CSelectionStorage::GetCurrentSelection(
+    TInt& aCurrentSelection, RArray<TInt64>& aIapIdArr )
+    {
+    __LOG("CSelectionStorage::GetCurrentSelection begin");
+    // Get the current selection
+    TInt userIapId( 0 );
+    GetIapId( userIapId );
+
+    if ( userIapId < 1 ||
+         userIapId == aIapIdArr[ KUPnPAlwaysAskInd ] )
+        {
+        aCurrentSelection = 0;
+        }
+    else
+        {
+        aCurrentSelection = aIapIdArr.Find( userIapId );
+
+        if ( aCurrentSelection <= KUPnPCreateNewInd )
+            {
+            /* Current iap is not in the list or it is Always Ask */
+            aCurrentSelection = 0;
+            }
+        }
+    __LOG("CSelectionStorage::GetCurrentSelection end");
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for upnpsettings
+*
+*/
+
+
+
+
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+// ROM build
+../rom/upnpsettings.iby               CORE_MW_LAYER_IBY_EXPORT_PATH(upnpsettings.iby)
+../rom/upnpsettingsresources.iby      CORE_MW_LAYER_IBY_EXPORT_PATH(upnpsettingsresources.iby)
+// LOC files
+UPNP_LOC_EXPORT(upnpsettings.loc)
+
+PRJ_MMPFILES
+// none
+
+    // settings engine
+    #include "../upnpsettingsengine/group/bld.inf"
+#ifdef FF_UPNP_FRAMEWORK_2_0  // UPnP feature flag
+    // multiselectionui
+    #include "../multiselectionui/group/bld.inf"
+
+    // upnp setup wizard
+    #include "../appwizard/group/bld.inf"
+
+    // Sharing ui
+    #include "../upnpsharingui/group/bld.inf"
+#endif // FF_UPNP_FRAMEWORK_2_0
+    // GS plugin
+    #include "../upnpgsplugin/group/bld.inf"
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/loc/upnpsettings.loc	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,489 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnpsettings localisable strings
+*
+*/
+
+
+
+
+
+
+// LOCALISATION STRINGS
+
+/***************************************************
+ *
+ *                  upnpappwizard 
+ *
+ ***************************************************
+*/ 
+
+
+//d:Text for the wait dialog when file sharing is in progress
+//l:popup_note_wait_window
+//r:1.0
+//
+#define qtn_iupnp_wait_sharing              "Turning sharing on"
+
+//d:Text for the wait dialog shown while sharing is turned off
+//l:popup_note_wait_window
+//r:wk50/2008
+//
+#define qtn_iupnp_wait_sharing_off          "Turning sharing off"
+
+//d:Message when starting sharing
+//d:Purpose is to describe that this is a background operation
+//l:popup_info_list_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_wait_updating_content     "Updating shared content on the background. This may take several minutes. The application can be closed meanwhile."
+
+//d:Message title when starting background sharing
+//l:heading_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_updating_content_header   "Updating shared content"
+
+//d:Error message when file sharing activation fails
+//l:popup_note_window/opt2
+//r:1.0
+//
+#define qtn_iupnp_start_sharing_error       "Sharing activation failed"
+
+//d:Header for wizard step 1
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_head_1             "Setup wizard 1/9"
+
+//d:Message for wizard step 1. 
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_1                  "This wizard sets up Home Media for browsing and sharing files. Please run the wizard within range of your WLAN."
+
+//d:Header for wizard step 2
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_head_2             "Device name 2/9"
+
+//d:Message for wizard step 2
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_2                  "Enter a device name you want to show on your network"
+
+//d:Header for wizard step 3
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_head_3             "My device name 3/9"
+
+//d:Header for wizard step 4
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_head_4             "Access point 4/9"
+
+//d:Message for wizard step 4
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_4                  "Define your Home access point or choose %U to select it manually each time"
+
+//d:Header for wizard step 5
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_head_5             "Home access point 5/9"
+
+//d:Static list item in wizard iap selection list. 
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_iupnp_always_ask                "Always ask"
+
+//d:Static list item in wizard iap selection list.
+//d:The user can create and edit iap items.
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_iupnp_create_new                "Create / edit"
+
+//d:Header for wizard step 6
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_head_6             "File sharing 6/9"
+
+//d:Message for wizard step 6.
+//l:popup_info_list_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_wizard_6_2                "Select the content that is shown on the Home Network when sharing is on. You can select to share individual albums and playlists or all the files of a media type."
+
+//d:Header for wizard step 7
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_head_7             "Share images & video 7/9"
+
+//d:Header for wizard step 8
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_head_8             "Share music 8/9"
+
+//d:Header for wizard step 9
+//l:heading_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_head_9             "Setup wizard 9/9"
+
+//d:Message for wizard step 9a.
+//l:popup_info_list_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_wizard_9a_2               "The Home Media options are available in media applications and sharing is turned on."
+
+//d:Message for wizard step 9b.
+//l:popup_info_list_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_wizard_9b_2               "The Home Media options are available in media applications but sharing is turned off."
+
+//d:Middle soft key
+//d:for wizard dialogs
+//l:control_pane_t1/opt7
+//r:wk50/2008
+//
+#define qtn_iupnp_softkey_next              "Next"
+
+
+/***************************************************
+ *
+ *                  upnpmultiselectionui 
+ *
+ ***************************************************
+*/
+
+
+//d:Title text for the multiselection dialog when
+//d:image and video albums are shown
+//d:This is visible in the title pane
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_iupnp_title_visual              "Images & videos"
+
+//d:Title text for the multiselection dialog when
+//d:playlists are shown
+//d:This is visible in the title pane
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_iupnp_title_music               "Music"
+
+//d:Text for the second item of the multiselection listbox
+//d:With this selection all files from specific folders
+//d:will be shared
+//l:list_single_graphic_pane_t1_cp2
+//r:1.0
+//
+#define qtn_iupnp_set_share_all             "Share all files"
+
+//d:Text for wait note
+//d:Indicates that phone is collecting files to share
+//l:popup_note_wait_window
+//r:1.0
+//
+#define qtn_iupnp_saving_changes_note       "Saving changes"
+
+//d:Text for wait note
+//d:Indicates that phone is searching files to display to user
+//l:popup_note_wait_window
+//r:1.0
+//
+#define qtn_iupnp_searching_files_note      "Searching files"
+
+//d:Text for the first item of the multiselection listbox
+//d:With this selection all files from specific folders
+//d:will be shared
+//l:list_single_graphic_pane_t1_cp2
+//r:1.0
+//
+#define qtn_iupnp_set_do_not_share          "Do not share"
+
+//d:Middle soft key
+//d:for unselecting the playlists & albums
+//l:control_pane_t3/opt7
+//r:wk50/2008
+//
+#define qtn_iupnp_msk_unselect              "Unselect"
+
+
+/***************************************************
+ *
+ *                  upnpgsplugin
+ *
+ ***************************************************
+*/
+
+//d:line text for the Home Media -listbox item of
+//d:Settings
+//l:list_single_large_graphic_pane_t1
+//r:wk50/2008
+//
+#define qtn_iupnp_gs_caption                "Home Media"
+
+//d:upnp gs settings view title
+//d:This is visible in the title pane
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_iupnp_title_sharing             "Settings"
+
+
+//d:First line text for the access point -listbox item of
+//d:settings dialog
+//d:Through "home access point" phone can communicate with
+//d:other devices in the network
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_home_ap                   "Home access point"
+
+//d:First line text for the device name -listbox item of
+//d:settings dialog
+//d:User can set the device name that other devices can see
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_device_name               "Device name"
+
+//d:Warning text when "all networks" selected from the allowed connections
+//d:of settings dialog
+//l:popup_note_window/opt1
+//r:1.0
+//
+#define qtn_iupnp_conf_unsecure             "Unsecured wireless LAN connections involve security hazards. Continue anyway?"
+
+//d:Left softkey text for the error dialog of sharing activation
+//l:control_pane_t1/opt7
+//r:1.0
+//
+#define qtn_iupnp_conf_continue             "Continue"
+
+//d:Text for information note 
+//d:Indicates that setting could not be set yet because connection active 
+//l:popup_note_window/opt1
+//r:1.0
+//
+#define qtn_iupnp_ibu_gallery_connectionactive_note     "Cannot change setting while connection to home media is active"
+
+//d:Heading of the IAP setting page
+//l:list_setting_pane_t1
+//r:wk51/2008
+//
+#define qtn_iupnp_ap_head_set               "Home access point"
+
+//d:Heading of the Device Name setting page
+//l:list_setting_pane_t1
+//r:wk51/2008
+//
+#define qtn_iupnp_head_set_device_name      "Device name"
+
+//d:Home Network IAP option text "User defined" in setting item
+//l:set_value_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_ap_user_defined           "User Defined"
+
+//d:Home Network IAP option text "Always ask" in setting page
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_ap_ask_set                "Always ask"
+
+//d:Home Network IAP option text "Create / edit" in setting page
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_ap_new_set                "Create / edit"
+
+//d:Home Network IAP option text "None" in setting page
+//l:list_set_graphic_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_ap_none_set               "None"
+
+//d:Text for information note 
+//d:Indicates that Gallery UI has been changed
+//l:heading_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_ibu_gallery_update_note_title_2   "Availability changed"
+
+//d:Text for information note
+//d:Indicates that Home Network features are available in media gallery
+//l:popup_info_list_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_ibu_gallery_update_note_2         "Home Media features are now available. Use \"Sharing\" to select what content you want to share."
+
+//d:Text for information note 
+//d:Indicates that Home Network features are removed from media gallery
+//l:popup_info_list_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_ibu_gallery_notavail_note_2       "Home Media features removed from the device."
+
+//d:Supported memory setting title in settings page
+//l:list_setting_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_copy_location                     "Copy location"
+
+
+/***************************************************
+ *
+ *                  upnpsharingui
+ *
+ ***************************************************
+*/
+
+//d:Text for the title of share content -dialog
+//d:This is visible in the title pane
+//d:Collection of shared files
+//l:title_pane_t2/opt9
+//r:1.0
+//
+#define qtn_iupnp_title_share               "Share content"
+
+//d:Menu text for manual refresh
+//l:list_single_pane_t1_cp2
+//r:1.0
+//
+#define qtn_iupnp_options_update_content    "Refresh collection"
+
+//d:First line text for the settings listbox item of
+//d:share content dialog
+//l:list_setting_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_set_sharing               "Sharing"
+
+//d:Second line text for the share content listbox item
+//d:Indicates that file sharing is active
+//l:set_value_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_set_sharing_on            "On"
+
+//d:Second line text for the shard content listbox
+//d:Indicates that file sharing is disabled
+//l:set_value_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_set_sharing_off           "Off"
+
+//d:Information note text when sharing has been turned off.
+//d:Indicates that phone can not be seen through wlan network.
+//l:popup_note_window/opt2
+//r:wk51/2008
+//
+#define qtn_iupnp_phone_hidden              "Phone is now hidden from Home network"
+
+//d:Information note text when sharing has been turned on.
+//d:Indicates that phone can be seen through wlan network.
+//l:popup_note_window/opt2
+//r:wk51/2008
+//
+#define qtn_iupnp_phone_visible             "Phone is now visible to Home network"
+
+//d:First line text for the share content -listbox item
+//d:With this option user can select image and video files
+//d:and albums for sharing
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_visual_albums             "Images & videos"
+
+//d:First line text for the music listbox item of share content -dialog
+//d:With this option user can select music files
+//d:and playlists for sharing
+//l:list_setting_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_music_pl                  "Music"
+
+//d:Alternative second line text for the images & videos -listbox item of 
+//d:share content -dialog
+//d:Indicates that sharing is in progress and displays the progress in percents
+//l:set_value_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_updating_progress         "Updating %N%"
+
+//d:Alternative second line text for the images & videos -listbox item of 
+//d:share content -dialog
+//d:Indicates that nothing (images & videos) is shared
+//l:set_value_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_visual_nothing            "Nothing selected"
+
+//d:Alternative second line text for the images & videos -listbox item of 
+//d:share content -dialog
+//d:Indicates that some files
+//l:set_value_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_visual_one                "Selected files"
+
+//d:Alternative second line text for the images & videos -listbox item of 
+//d:share content -dialog
+//d:Indicates that all files are shared
+//l:set_value_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_visual_many               "All files"
+
+//d:Alternative second line text for the music listbox item of
+//d:share content -dialog
+//d:Indicates that nothing (music) is shared
+//l:set_value_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_music_nothing             "Nothing selected"
+
+//d:Alternative second line text for the music listbox item of 
+//d:share content -dialog
+//d:Indicates that some playlists are shared
+//l:set_value_pane_t1
+//r:2.0
+//
+#define qtn_iupnp_music_one                 "Selected playlists"
+
+//d:Alternative second line text for the music listbox item of 
+//d:share content -dialog
+//d:Indicates that all music files are shared
+//l:set_value_pane_t1
+//r:1.0
+//
+#define qtn_iupnp_music_many                "All files"
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/BWINS/UPnPMultiselectionUiU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	?ExecuteDlgLD@CUPnPMultiselectionUi@@QAEHXZ @ 1 NONAME ; int CUPnPMultiselectionUi::ExecuteDlgLD(void)
+	?ExecutePopupLD@CUPnPMultiselectionUi@@QAEHXZ @ 2 NONAME ; int CUPnPMultiselectionUi::ExecutePopupLD(void)
+	?NewL@CUPnPMultiselectionUi@@SAPAV1@W4THomeConnectMediaType@@PAVCUPnPFileSharingEngine@@AAHPAV?$CArrayFix@H@@W4TUiStyle@1@PBVHBufC16@@@Z @ 3 NONAME ; class CUPnPMultiselectionUi * CUPnPMultiselectionUi::NewL(enum THomeConnectMediaType, class CUPnPFileSharingEngine *, int &, class CArrayFix<int> *, enum CUPnPMultiselectionUi::TUiStyle, class HBufC16 const *)
+	?SetMarkedItemsL@CUPnPMultiselectionUi@@QAEXAAV?$CArrayFix@H@@@Z @ 4 NONAME ; void CUPnPMultiselectionUi::SetMarkedItemsL(class CArrayFix<int> &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/EABI/UPnPMultiselectionUiU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,8 @@
+EXPORTS
+	_ZN21CUPnPMultiselectionUi12ExecuteDlgLDEv @ 1 NONAME
+	_ZN21CUPnPMultiselectionUi14ExecutePopupLDEv @ 2 NONAME
+	_ZN21CUPnPMultiselectionUi15SetMarkedItemsLER9CArrayFixIiE @ 3 NONAME
+	_ZN21CUPnPMultiselectionUi4NewLE21THomeConnectMediaTypeP22CUPnPFileSharingEngineRiP9CArrayFixIiENS_8TUiStyleEPK7HBufC16 @ 4 NONAME
+	_ZTI21CUPnPMultiselectionUi @ 5 NONAME ; #<TI>#
+	_ZTV21CUPnPMultiselectionUi @ 6 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/data/cupnpmultiselectionui.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      multiselectionui resource description
+*
+*/
+
+
+
+
+
+
+
+//  RESOURCE IDENTIFIER
+NAME    VORO // 4 letter ID
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <data_caging_paths_strings.hrh>
+#include <appinfo.rh>
+#include <upnpsettings.loc>
+
+#include "cupnpmultiselectionui.hrh"
+
+//  RESOURCE DEFINITIONS 
+
+// --------------------------------------------------------------------------
+//    RSS_SIGNATURE
+// --------------------------------------------------------------------------
+RESOURCE RSS_SIGNATURE 
+    {
+    }
+
+// --------------------------------------------------------------------------
+// TBUF
+// --------------------------------------------------------------------------
+RESOURCE TBUF 
+    { 
+    buf = "";
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_upnp_softkeys_ok_back__ok
+//
+//----------------------------------------------------------------------------
+//   
+RESOURCE CBA r_upnp_softkeys_ok_back__ok
+    {
+    flags = 0;
+    buttons =
+        {
+        CBA_BUTTON {id = EAknSoftkeyOk; txt = qtn_iupnp_softkey_next;},
+        CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;},
+        CBA_BUTTON {id = EAknSoftkeyForwardKeyEvent;}
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_upnp_softkeys_ok_back__ok_dialog
+//
+//----------------------------------------------------------------------------
+//  
+RESOURCE CBA r_upnp_softkeys_ok_back__ok_dialog
+    {
+    flags = 0;
+    buttons =
+        {
+        CBA_BUTTON {id = EAknSoftkeyOk; txt = text_softkey_ok;},
+        CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;},
+        CBA_BUTTON {id = EAknSoftkeySelect;}
+        };
+    }
+
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_dialog
+//
+//---------------------------------------------------------------------------
+RESOURCE DIALOG r_upnp_multiselection_dialog
+    {
+    flags = EAknDialogMultiselectionList;
+    buttons = r_upnp_softkeys_ok_back__ok_dialog;
+    items =
+        {
+        DLG_LINE
+            {            
+            type = EAknCtSingleGraphicListBox;
+            id = EMultiSelectionListBoxId; 
+            control = LISTBOX
+                {
+                flags = EAknListBoxMultiselectionList;
+                };
+            },
+        DLG_LINE
+            {
+            itemflags = EEikDlgItemNonFocusing;
+            id = EFindControl;
+            type = EAknCtSelectionListPopupFind;
+            }
+        };
+    }
+
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_popup
+// 
+//---------------------------------------------------------------------------
+RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_upnp_multiselection_popup
+    {
+    flags = EGeneralQueryFlags;
+    softkeys = r_upnp_softkeys_ok_back__ok;
+    items =
+        {
+        AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSingleGraphicPopupMenuListBox;
+                listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST
+                    {
+                    };
+                heading = "Select items:";
+                };
+            },
+        DLG_LINE
+            {
+            itemflags = EEikDlgItemNonFocusing;
+            id = EFindControl;
+            type = EAknCtListQuerySearchControl;
+            }
+        };
+    }
+ 
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_collecting_files_note
+//
+//---------------------------------------------------------------------------
+//    
+RESOURCE DIALOG r_upnp_multiselection_collecting_files_note
+    { 
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EProgressLayout;
+                singular_label = qtn_iupnp_saving_changes_note;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_searching_files_note
+//
+//---------------------------------------------------------------------------
+//    
+RESOURCE DIALOG r_upnp_multiselection_searching_files_note
+    { 
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EProgressLayout;
+                singular_label = qtn_iupnp_searching_files_note;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_sharing_visual_title_text
+//
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_multiselection_sharing_visual_title_text 
+    { 
+    buf = qtn_iupnp_title_visual;
+    }
+
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_sharing_music_title_text
+//
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_multiselection_sharing_music_title_text 
+    { 
+    buf = qtn_iupnp_title_music;
+    }
+
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_share_all_text
+//
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_multiselection_share_all_text 
+    { 
+    buf = qtn_iupnp_set_share_all;
+    }
+
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_do_not_share_text
+//
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_multiselection_do_not_share_text 
+    { 
+    buf = qtn_iupnp_set_do_not_share;
+    }
+
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_select_text
+//
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_multiselection_select_text 
+    { 
+    buf = qtn_msk_select;
+    }
+
+//---------------------------------------------------------------------------
+//   
+//    r_upnp_multiselection_unselect_text
+//
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_multiselection_unselect_text 
+    { 
+    buf = qtn_iupnp_msk_unselect;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for multiselection UI component
+*
+*/
+
+
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// ADO internal interfaces
+../inc/cupnpmultiselectionui.h        |../../../inc/cupnpmultiselectionui.h
+
+PRJ_MMPFILES
+cupnpmultiselectionui.mmp
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/group/cupnpmultiselectionui.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      multiselectionui project definition file
+*
+*/
+
+
+
+
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+
+TARGET          upnpmultiselectionui.dll
+TARGETTYPE      dll
+UID             0x100000D8 0x200009E8
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+// Include paths
+MW_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+START RESOURCE  ../data/cupnpmultiselectionui.rss
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+SOURCEPATH      ../src
+
+SOURCE          upnpmultiselectionutility.cpp
+SOURCE          cupnpmultiselectionui.cpp
+SOURCE          upnpappmultiselectiondialog.cpp
+SOURCE          upnpappmultiselectionpopup.cpp
+
+LIBRARY         AknIcon.lib
+LIBRARY         aknlayout.lib
+LIBRARY         AknLayout2Scalable.lib
+LIBRARY         AKNSKINS.lib
+LIBRARY         apparc.lib
+LIBRARY         avkon.lib
+LIBRARY         charconv.lib
+LIBRARY         CommonEngine.lib
+LIBRARY         cone.lib
+LIBRARY         efsrv.lib
+LIBRARY         egul.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         eikcore.lib
+LIBRARY         eikctl.lib
+LIBRARY         eikdlg.lib
+LIBRARY         euser.lib
+LIBRARY         fbscli.lib 
+LIBRARY         featmgr.lib
+LIBRARY         gdi.lib
+LIBRARY         hlplch.lib
+LIBRARY         ws32.lib 
+
+// ecom
+LIBRARY         ecom.lib
+
+// string.h
+LIBRARY         upnpipserversutils.lib
+
+// rpointerarray tdesc16
+LIBRARY         bafl.lib
+
+// esock
+LIBRARY         esock.lib
+
+// filesharingengine
+LIBRARY upnpapplicationengine.lib
+
+// pathinfo::
+LIBRARY PlatformEnv.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/inc/cupnpmultiselectionui.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Multiselection UI class definition
+*
+*/
+
+
+
+
+
+
+
+#ifndef CUPNPMULTISELECTIONUI
+#define CUPNPMULTISELECTIONUI
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpfilesharingengine.h" // included to know THomeConnectMediaType
+#include <eiklbv.h> // for CListBoxView::CSelectionIndexArray
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CAknViewAppUi;
+class CEikonEnv;
+class CUPnPAppMultiselectionDialog;
+class CUPnPAppMultiselectionPopup;
+
+
+// CLASS DECLARATION
+
+/**
+ * CUPnPMultiselectionUi class
+ *
+ * UI for showing the filesharing window either in popup or dialog style
+ *
+ * @lib upnpmultiselectionui.lib
+ */
+class CUPnPMultiselectionUi : public CBase
+    {
+
+public:     // Constructors and destructor
+
+    enum TUiStyle
+        {
+        EDialog,
+        EPopup
+        };
+
+    /**
+     * Two-phased constructor.
+     * @since S60 3.1
+     * @param aMediaType. Media type for UI. Either Images&videos or music.
+     * @param aFileSharingEngine. Pointer to filesharingengine.
+     * @param aAlbumContainer. Container for the items user has selected.
+     * @param aVisualSharingState. State of the sharing for the home.
+     * network UI
+     * @param aSelectionIndexArray. Array for initial selection.
+     * @param aUiStyle. Describes if popup or dialog style ui is used.
+     */
+    IMPORT_C static CUPnPMultiselectionUi* NewL(
+        THomeConnectMediaType aMediaType,
+        CUPnPFileSharingEngine* aFileSharingEngine,
+        TInt& aVisualSharingState,
+        CListBoxView::CSelectionIndexArray* aSelectionIndexArray = NULL,
+        TUiStyle aUiStyle = EDialog,
+        const HBufC* aHeading = NULL
+        );
+ 
+    /**
+     * Sets marked items to popup dialog
+     * 
+     * @param aMarkedItems
+     */
+    IMPORT_C void SetMarkedItemsL( CArrayFix<TInt>& aMarkedItems );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPMultiselectionUi();
+
+public:
+
+    /**
+     * Executes the file sharing UI as a dialog style
+     *
+     * @since S60 3.1
+     * @return TInt, Error code
+     */
+    IMPORT_C TInt ExecuteDlgLD();
+
+    /**
+     * Executes the file sharing UI as a popup style
+     *
+     * @since S60 3.1
+     * @return TInt, Error code
+     */
+    IMPORT_C TInt ExecutePopupLD();
+
+private:
+
+    /**
+     * C++ default constructor
+     */
+    CUPnPMultiselectionUi();
+
+
+    /**
+     * Symbian default constructor.
+     */
+    void ConstructL(
+        THomeConnectMediaType aMediaType,
+        CUPnPFileSharingEngine* aFileSharingEngine,
+        TInt& aVisualSharingState,
+        CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+        TUiStyle aStyle,
+        const HBufC* aHeading
+        );
+
+
+private:    // Data
+    /**
+     * Resource file offse
+     */
+    TInt                        iResFileOffset;   // Resource file offset
+    /**
+     * Pointer to CEikonEnv
+     */
+    CEikonEnv*                  iCoeEnv;
+    /**
+     * Pointer to multiselection dialog
+     */
+    CUPnPAppMultiselectionDialog* iDlg;
+    /**
+     * Pointer to multiselection dialog
+     */
+    CUPnPAppMultiselectionPopup* iPopup;
+    
+    /**
+     * Flag the FeatureManager is initialized or not
+     */
+    TBool                       iFeatureManagerInitialized;  
+    };
+
+#endif  // CUPNPMULTISELECTIONUI
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/inc/cupnpmultiselectionui.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resource headers for project Multiselection UI
+*
+*/
+
+
+
+
+
+
+
+#ifndef MULTISELECTIONUI_HRH
+#define MULTISELECTIONUI_HRH
+
+
+// DATA TYPES
+enum TMultiSelectionUiCommandIds
+    {
+    EHomeConnectCmdAppChange = 1
+    };
+
+
+
+enum TMultiSelectionUiFileSharingDlgItems
+    {
+    EVisibilitySettingItem = 0,
+    EVisualAlbumsSettingItem,
+    EPlaylistSettingItem
+    };
+
+enum TMultiSelectionUiDlgLineIds
+    {
+    EListBoxId = 1,
+    ESettingsListBoxId,
+    EFileSharingListBoxId
+    };
+    
+enum TMultiSelectionUiDlgLineId
+    {
+    EMultiSelectionListBoxId = 1
+    };
+
+enum TMultiSelectionUiCbaButtons
+    {
+    EAknSoftkeyContinue = 1        
+    };
+
+#endif      // MULTISELECTIONUI
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/inc/upnpappmultiselectiondialog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUPnPAppMultiselectionDialog class definition
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPAPPMULTISELECTIONDIALOG_H
+#define UPNPAPPMULTISELECTIONDIALOG_H
+
+// INCLUDES
+#include <AknDialog.h>
+#include <aknselectionlist.h>
+#include <aknsfld.h>
+#include <aknnavide.h>
+#include <akntitle.h> //for status pane
+#include <AknIconArray.h>
+#include <AknWaitNoteWrapper.h>
+
+#include "upnpfilesharingengine.h" // included to know THomeConnectMediaType
+#include "upnpmultiselectionutility.h"
+
+
+
+// FORWARD DECLARATIONS
+class CAknColumnListBox;
+
+// CLASS DECLARATION
+
+/**
+* CUPnPAppMultiselectionDialog dialog class
+* @since S60 3.1
+*/
+NONSHARABLE_CLASS( CUPnPAppMultiselectionDialog ) : 
+    public CAknSelectionListDialog,
+    MAknBackgroundProcess
+    {
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        * @since S60 3.1
+        * @param aMediaType. Media type for UI. Either Images Or videos or \
+music.
+        * @param aFileSharingEngine. Pointer to filesharingengine.
+        * @param aSelectionIndexArray. Array for initial selection.
+        */
+        static CUPnPAppMultiselectionDialog* NewL(
+                            THomeConnectMediaType aMediaType,
+                            CUPnPFileSharingEngine* aFileSharingEngine,
+                            CArrayFix<TInt>* aSelectionIndexArray );
+
+        /**
+        * Destructor.
+        */
+       virtual ~CUPnPAppMultiselectionDialog();
+
+
+    protected:  // New functions
+        void ConstructL(THomeConnectMediaType aMediaType,
+                        CUPnPFileSharingEngine* aFileSharingEngine,
+                        CArrayFix<TInt>* aSelectionIndexArray );
+
+    protected:  // Functions from base classes
+        /**
+        * From MAknBackgroundProcess, handles backround processing
+        * @since S60 3.1
+        */
+        virtual void StepL();
+
+        /**
+        * From MAknBackgroundProcess, handles backround processing
+        * @since S60 3.1
+        * @return TBool, ETrue when the process is done
+        */
+        virtual TBool IsProcessDone() const;
+
+        /**
+        * From CAknSelectionListDialog, handles layout initialization
+        * @since S60 3.1
+        */
+        void PreLayoutDynInitL();
+
+        /**
+        * From CAknSelectionListDialog, handles initialization
+        * that doesn't affect layout
+        * @since S60 3.1
+        */
+        void PostLayoutDynInitL();
+
+        /**
+        * From CAknSelectionListDialog, handles key events.
+        * @since S60 3.1
+        * @param TKeyEvent, Event to handled.
+        * @param TEventCode, Type of the key event.
+        * @return TKeyResponse, response code 
+        * (EKeyWasConsumed, EKeyWasNotConsumed).
+        */
+        TKeyResponse OfferKeyEventL (const TKeyEvent &aKeyEvent,
+                                     TEventCode aType);
+
+        /**
+        * From CAknSelectionListDialog, handles focus changes of the dialog
+        * @since S60 3.1
+        * @param TInt, pressed button id
+        * @return TBool, ETrue if ready to close dialog, EFalse otherwise
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CUPnPAppMultiselectionDialog();
+
+    private: //data
+        // dialog control item
+        CAknColumnListBox*              iListBox; // not owned
+        // Mediatype selected from listbox
+        THomeConnectMediaType           iMediaType;
+        // File sharing engine member
+        CUPnPFileSharingEngine*         iFileSharingEngine; //not owned
+        // title pane
+        CAknTitlePane*                  iTitlePane;
+        // selected item - needed for creation of CAknSelectionListDialog
+        TInt                            iSelectedItem;
+
+        CAknWaitNoteWrapper*            iWaitNoteWrapper;
+        // array of marked (shared) items.
+        CArrayFix<TInt>*           iMarkedItems; //not owned
+
+        CUpnpMultiselectionUtility*      iUtility; //owned
+        
+        CAknFilteredTextListBoxModel* iModel; //not owned
+
+        CDesCArray* iSettingsTextArray; //not owned
+
+        // Variable to transfer information about wait note end
+        TBool iDone;
+
+        /**
+         * Msk's label. (Owned)
+         */
+        HBufC* iMskSelectText;
+
+        /**
+         * Msk's label. (Owned)
+         */
+        HBufC* iMskUnselectText;
+
+        /**
+         * Internal state
+         */
+        enum TState
+            {
+            ELoadNone = 0,
+            ELoadContent,
+            ELoadIndexes,
+            ELoadDone
+            };
+        TState iState;
+    };
+
+#endif // UPNPAPPMULTISELECTIONDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/inc/upnpappmultiselectionpopup.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUPnPAppMultiselectionPopup class definition
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPAPPMULTISELECTIONPOPUP_H
+#define UPNPAPPMULTISELECTIONPOPUP_H
+
+// INCLUDES
+#include <AknDialog.h>
+#include <aknselectionlist.h>
+#include <aknsfld.h>
+#include <aknnavide.h>
+#include <akntitle.h> //for status pane
+#include <AknIconArray.h>
+#include <AknWaitNoteWrapper.h>
+#include <aknlistquerydialog.h> //caknlistquerydialog
+#include <aknsfld.h> //caknsearchfield
+
+#include "upnpfilesharingengine.h" // included to know THomeConnectMediaType
+#include "upnpmultiselectionutility.h"
+
+
+// FORWARD DECLARATIONS
+class CUPnPFileSharingEngine;
+
+// CLASS DECLARATION
+
+/**
+ * CUPnPAppMultiselectionPopup dialog class
+ * @since S60 3.1
+ */
+NONSHARABLE_CLASS( CUPnPAppMultiselectionPopup ) : public CAknListQueryDialog,
+                                    MAknBackgroundProcess
+    {
+public: // Constructors and destructor
+        /**
+         * Two-phased constructor.
+         * @since S60 3.1
+         * @param aMediaType. Media type for UI. Either Images Or videos or \
+music.
+         * @param aFileSharingEngine. Pointer to filesharingengine.
+         * @param aSelectionIndexArray. Array for initial selection.
+         */
+    static CUPnPAppMultiselectionPopup* NewL(
+        THomeConnectMediaType aMediaType,
+        CUPnPFileSharingEngine* aFileSharingEngine,
+        CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+        const HBufC* aHeading);
+
+    /**
+     * stores marked items to iUiMarked
+     * 
+     * @param aMarkedItems
+     */
+    void SetMarkedItemsL(CArrayFix<TInt>& aMarkedItems);
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPAppMultiselectionPopup();
+
+
+protected:
+
+    // New functions
+    void ConstructL(THomeConnectMediaType aMediaType,
+                    CUPnPFileSharingEngine* aFileSharingEngine,
+                    CListBoxView::CSelectionIndexArray* aSelectionIndexArray);
+
+
+
+protected:  // Functions from base classes
+    /**
+     * From MAknBackgroundProcess, handles backround processing
+     * @since S60 3.1
+     */
+    virtual void  StepL ();
+
+    /**
+     * From MAknBackgroundProcess, handles backround processing
+     * @since S60 3.1
+     * @return TBool, ETrue when the process is done
+     */
+    virtual TBool  IsProcessDone () const;
+
+    /**
+     * From CAknSelectionListDialog, handles layout initialization
+     * @since S60 3.1
+     */
+    void PreLayoutDynInitL();
+
+    /**
+     * From CAknSelectionListDialog, handles initialization
+     * that doesn't affect layout
+     * @since S60 3.1
+     */
+    void  PostLayoutDynInitL ();
+
+    /**
+     * From CAknSelectionListDialog, handles key events.
+     * @since S60 3.1
+     * @param TKeyEvent, Event to handled.
+     * @param TEventCode, Type of the key event.
+     * @return TKeyResponse, response code
+     * (EKeyWasConsumed, EKeyWasNotConsumed).
+     */
+    TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent,
+                                  TEventCode aType);
+    /**
+     * From CAknSelectionListDialog, handles focus changes of the dialog
+     * @since S60 3.1
+     * @param TInt, pressed button id
+     * @return TBool, ETrue if ready to close dialog, EFalse otherwise
+     */
+    TBool OkToExitL( TInt aButtonId );
+
+
+private:
+    /**
+     * C++ default constructor.
+     */
+    CUPnPAppMultiselectionPopup(
+        CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+        const HBufC* aHeading );
+
+private: //data
+    // dialog control item
+
+    CEikListBox*              iListBox; //not owned
+
+    CAknFilteredTextListBoxModel* iModel; //not owned
+    
+    
+
+    // Mediatype selected from listbox
+    THomeConnectMediaType           iMediaType;
+    // File sharing engine member
+    CUPnPFileSharingEngine*         iFileSharingEngine; //not owned
+    // Share all selection
+    TInt*                            iShareAllSelection;
+    // selected album indexes
+    CArrayFixFlat<TInt>*            iSelectedAlbums;
+    // title pane
+    CAknTitlePane*                  iTitlePane;
+    // selected item - needed for creation of CAknSelectionListDialog
+    TInt                            iSelectedItem;
+    // array for playlists
+    CDesCArrayFlat*                 iFileArray;
+    // wait note
+    CAknWaitNoteWrapper*            iWaitNoteWrapper;
+    // array of marked (shared) items.
+    CArrayFix<TInt>*           iMarkedItems;
+    // If this is not NULL it is used instead of "normal" calculation of
+    // selections
+    CArrayFix<TInt>* iPreviousSelection;
+    
+    // get marked items from appwizard
+    CArrayFix<TInt>* iUiMarked;
+    
+    // The pointer to multiselectiondialog
+    CUpnpMultiselectionUtility* iUtility;
+    
+    CDesCArray* iSettingsTextArray; //not owned
+
+    // Variable to transfer information about wait note end
+    TBool iDone;
+
+    /**
+     * Msk's label. (Owned)
+     */
+    HBufC* iMskSelectText;
+
+    /**
+     * Msk's label. (Owned)
+     */
+    HBufC* iMskUnselectText;
+
+    /**
+     * Internal state
+     */
+    enum TState
+        {
+        ELoadNone = 0,
+        ELoadContent,
+        ELoadIndexes,
+        ELoadDone
+        };
+    TState iState;
+
+    // Heading text
+    const HBufC*                             iHeading; //not owned
+    };
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/inc/upnpmultiselectionutility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpMultiselectionUtility class definition
+ *
+*/
+
+
+
+
+
+
+#ifndef UPNPMULTISELECTIONUTILITY_H
+#define UPNPMULTISELECTIONUTILITY_H
+
+// INCLUDES
+#include <AknDialog.h>
+#include <aknselectionlist.h>
+#include <aknsfld.h>
+#include <aknnavide.h>
+#include <akntitle.h> //for status pane
+#include <AknIconArray.h>
+#include <aknlists.h> //cakncolumnlistbox
+#include <AknWaitNoteWrapper.h>
+#include <eiklbx.h>
+
+// FORWARD DECLARATIONS
+// NONE
+
+// CLASS DECLARATION
+enum TShareSelectionState 
+    {
+    EUndefined = 0, 
+    EItemsSelected,
+    EShareNoneSelected, 
+    EShareAllSelected, 
+    EShareNoneAndShareAllSelected,
+    ENoShareNoneOrShareAllSelected
+    };
+/**
+ * CUpnpMultiselectionUtility utility class
+ * @since S60 3.1
+ */
+NONSHARABLE_CLASS( CUpnpMultiselectionUtility ): public CBase
+    {
+public: // Constructors and destructor
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpMultiselectionUtility();
+
+    /**
+     * C++ default constructor.
+     */
+    CUpnpMultiselectionUtility();
+
+    /**
+     * Collect selected items to a listbox
+     * @since S60 3.1
+     */
+    void CollectSelectedItemsL( CEikListBox* aListBox, 
+                                TBool aFirstRun = EFalse );
+
+    /**
+     * Do internal decisions based on user's selections on the UI
+     */
+    void DoSelectionLogicL( CEikListBox* aListBox,
+        TBool aFirstRun,
+        const CArrayFix<TInt>* aIndexes,
+        CAknListBoxFilterItems* aFilter,
+        TShareSelectionState aSelectionState );
+
+    /**
+     * Loads a possibly skinned icon and adds it to icon array
+     * @since S60 3.1
+     * @param CAknIconArray, array of icons
+     * @param MAknsSkinInstance, skin instance
+     * @param TDesC, reference to icon file
+     * @param TAknsItemID, skinned icon id
+     * @param TInt, bitmap id
+     * @param TInt, bitmap mask id
+     */
+    void AppendIconToArrayL( CAknIconArray* aArray,
+                             MAknsSkinInstance* aSkin,
+                             const TDesC& aMbmFile,
+                             const TAknsItemID& aID,
+                             TInt aBitmapId,
+                             TInt aMaskId ) const;
+
+    /**
+     * Appends first item ("share all files") to the listbox
+     * @since S60 3.1
+     * @param CDesCArray, listbox array
+     */
+    void AppendShareAllSelectionL( CDesCArray* aListBoxArray ) const;
+
+    /** 
+     * Convert selections from UI to engine as "old style" selections
+     * Effect only in case Share All is selected
+     * @since S60 3.1
+     * @param CArrayFix<TInt>& The selection indexes to modify
+     */
+    void ConvertSelectionsForEngineL( CArrayFix<TInt>& aSelections ) const;
+
+    /** 
+     * Sets iShareNoneSelected and iShareAllSelected member variables.
+     * @since S60 3.1
+     * @param TShareSelectionState share all and do not share selection state
+     */
+    void SetShareSelectionState( TShareSelectionState aSelectionState );
+
+    /** 
+     * Returns ShareSelectionState from the array.
+     * @since S60 3.1
+     * @param const CArrayFix<TInt>& array of selection indexes.
+     */
+    TShareSelectionState ShareSelectionStateFromArray( 
+        const CArrayFix<TInt>& aIndexes ) const;
+     
+private:
+    TBool iShareNoneSelected;
+    TBool iShareAllSelected;
+    };
+
+#endif //UPNPMULTISELECTIONUTILITY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/src/cupnpmultiselectionui.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Multiselection UI implementation
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <AknUtils.h>
+#include <aknview.h>
+#include <aknViewAppUi.h>
+#include <eikspmod.h>
+#include <eikclb.h>
+#include <featmgr.h>
+#include <bautils.h>
+#include <StringLoader.h>
+#include <aknmessagequerydialog.h> //caknmessagequerydialog
+#include <aknlistquerydialog.h>  //caknlistquerydialog
+#include <es_sock.h> //rsocketserv
+
+#include "upnpfilesharingengine.h"
+
+#include "upnpappmultiselectiondialog.h"
+#include "upnpappmultiselectionpopup.h"
+#include <cupnpmultiselectionui.rsg>
+#include "cupnpmultiselectionui.h"
+
+_LIT( KComponentLogfile, "multiselectionui.txt");
+#include "upnplog.h"
+
+
+// Filename of rsc file
+_LIT( KUPnPMultiSelectionRscFile, "\\resource\\CUPnPMultiselectionUi.rsc" );
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPMultiselectionUi::CUPnPMultiselectionUi
+// --------------------------------------------------------------------------
+//
+CUPnPMultiselectionUi::CUPnPMultiselectionUi()
+    {
+    __LOG("CUPnPMultiselectionUi::CUPnPMultiselectionUi");
+    iFeatureManagerInitialized = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMultiselectionUi::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPMultiselectionUi::ConstructL( 
+    THomeConnectMediaType aMediaType,
+    CUPnPFileSharingEngine* aFileSharingEngine,
+    TInt& /*aVisualSharingState*/,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+    TUiStyle aStyle,
+    const HBufC* aHeading )
+    {  
+    __LOG("CUPnPMultiselectionUi::ConstructL");
+    
+    iCoeEnv = CEikonEnv::Static();
+    RFs& fileSession = iCoeEnv->FsSession();
+
+    
+    // Load common ui resource file    
+    TFileName rscFileName( KUPnPMultiSelectionRscFile );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive );
+    
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( fileSession, rscFileName ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+    iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName );
+
+    FeatureManager::InitializeLibL();
+    iFeatureManagerInitialized = ETrue;
+
+    if ( aStyle == EDialog )
+        {
+
+        iDlg = CUPnPAppMultiselectionDialog::NewL( aMediaType, 
+                                                   aFileSharingEngine,
+                                                   aSelectionIndexArray );
+        }
+    else
+        {
+        iPopup = CUPnPAppMultiselectionPopup::NewL( aMediaType, 
+                                                    aFileSharingEngine,
+                                                    aSelectionIndexArray,
+                                                    aHeading );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMultiselectionUi::NewL()
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPMultiselectionUi* CUPnPMultiselectionUi::NewL(    
+    THomeConnectMediaType aMediaType,
+    CUPnPFileSharingEngine* aFileSharingEngine,
+    TInt& aVisualSharingState,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+    TUiStyle aStyle,
+    const HBufC* aHeading )
+    {
+    __LOG("CUPnPMultiselectionUi::NewL begin");
+    
+    CUPnPMultiselectionUi* self = new ( ELeave) CUPnPMultiselectionUi();
+    CleanupStack::PushL( self );
+
+    self->ConstructL( aMediaType,
+                      aFileSharingEngine, 
+                      aVisualSharingState,
+                      aSelectionIndexArray,
+                      aStyle,
+                      aHeading );
+        
+    CleanupStack::Pop();
+    __LOG("CUPnPMultiselectionUi::NewL end");
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPMultiselectionUi::~CUPnPMultiselectionUi()
+    {
+    __LOG("CUPnPMultiselectionUi::~CUPnPMultiselectionUi begin");
+    
+    if ( iFeatureManagerInitialized )
+        {
+        FeatureManager::UnInitializeLib();
+        }
+    
+    // Un-Load resource file
+    if ( iResFileOffset )
+        {
+        iCoeEnv->DeleteResourceFile( iResFileOffset );
+        iResFileOffset = 0;
+        }
+ 
+    __LOG("CUPnPMultiselectionUi::~CUPnPMultiselectionUi end");
+    }
+   
+// --------------------------------------------------------------------------
+// CUPnPMultiselectionUi::ExecuteDlgLD
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPMultiselectionUi::ExecuteDlgLD()
+    {
+    __LOG("CUPnPMultiselectionUi::ExecuteDlgLD");
+
+    TInt ret(KErrNone);
+    ret = iDlg->ExecuteLD( R_UPNP_MULTISELECTION_DIALOG );
+    iDlg = NULL;             
+    return ret;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPMultiselectionUi::ExecutePopupLD
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPMultiselectionUi::ExecutePopupLD()
+    {
+    __LOG("CUPnPMultiselectionUi::ExecutePopupLD");
+
+    TInt ret(KErrNone);
+    ret = iPopup->ExecuteLD( R_UPNP_MULTISELECTION_POPUP );
+    iPopup = NULL;
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPMultiselectionUi::SetMarkedItems
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPMultiselectionUi::SetMarkedItemsL( CArrayFix<TInt>& 
+		                                                       aMarkedItems )
+    {
+    if( iPopup )
+        {
+        iPopup->SetMarkedItemsL(aMarkedItems);
+        }
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/src/upnpappmultiselectiondialog.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,466 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Multiselection dialog implementation
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <avkon.mbg>
+#include <eikclbd.h>
+#include <aknlists.h>
+#include <AknsUtils.h>
+#include <eikcmbut.h>
+#include "upnpappmultiselectiondialog.h"
+#include "upnpfilesharingengine.h"
+
+#include "cupnpmultiselectionui.hrh"
+#include <cupnpmultiselectionui.rsg>
+
+_LIT( KComponentLogfile, "multiselectionui.txt");
+#include "upnplog.h"
+
+
+//CONSTANTS
+const TInt KOkSoftkeyCode = 63585;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAppMultiselectionDialog* CUPnPAppMultiselectionDialog::NewL(
+                        THomeConnectMediaType aMediaType,
+                        CUPnPFileSharingEngine* aFileSharingEngine,
+                        CArrayFix<TInt>* aSelectionIndexArray )
+    {
+    __LOG("CUPnPAppMultiselectionDialog::NewL begin");
+
+    CUPnPAppMultiselectionDialog* self =
+                        new(ELeave) CUPnPAppMultiselectionDialog();
+
+    CleanupStack::PushL(self);
+    self->ConstructL( aMediaType, aFileSharingEngine, aSelectionIndexArray );
+    CleanupStack::Pop(self);
+    __LOG("CUPnPAppMultiselectionDialog::NewL end");
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPAppMultiselectionDialog::ConstructL(
+                        THomeConnectMediaType aMediaType,
+                        CUPnPFileSharingEngine* aFileSharingEngine,
+                        CArrayFix<TInt>* aSelectionIndexArray )
+    {
+    __LOG("CUPnPAppMultiselectionDialog::ConstructL begin");
+    CAknSelectionListDialog::ConstructL( R_AVKON_SOFTKEYS_EMPTY );
+    iMediaType = aMediaType;
+    iFileSharingEngine = aFileSharingEngine;
+
+    iMarkedItems = aSelectionIndexArray;
+    iUtility = new (ELeave) CUpnpMultiselectionUtility();
+
+    iMskSelectText = 
+        StringLoader::LoadL( R_UPNP_MULTISELECTION_SELECT_TEXT );
+    iMskUnselectText = 
+        StringLoader::LoadL( R_UPNP_MULTISELECTION_UNSELECT_TEXT );
+
+    __LOG("CUPnPAppMultiselectionDialog::ConstructL end");
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::CUPnPAppMultiselectionDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPAppMultiselectionDialog::CUPnPAppMultiselectionDialog()
+: CAknSelectionListDialog(iSelectedItem, NULL, NULL), iSelectedItem(0)
+    {
+    __LOG("CUPnPAppMultiselectionDialog::CUPnPAppMultiselectionDialog");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::CUPnPAppMultiselectionDialog
+// C++ default destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAppMultiselectionDialog::~CUPnPAppMultiselectionDialog()
+    {
+    __LOG("CUPnPAppMultiselectionDialog::~CUPnPAppMultiselectionDialog");
+
+    iFileSharingEngine = NULL;
+
+    delete iUtility;
+    delete iMskSelectText;
+    delete iMskUnselectText;
+
+    __LOG("CUPnPAppMultiselectionDialog::~CUPnPAppMultiselectionDialog end");
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::OkToExitL(TInt aButtonId)
+// called by framework when the softkey is pressed
+// --------------------------------------------------------------------------
+//
+TBool CUPnPAppMultiselectionDialog::OkToExitL(TInt aButtonId)
+    {
+    __LOG("CUPnPAppMultiselectionDialog::OkToExitL begin");
+    TBool ret( EFalse );
+    if ( aButtonId == EAknSoftkeyOk )
+        {
+        TBool showWaitNote( ETrue );
+
+        const CArrayFix<TInt>* selected;
+
+        //get the true indexes of marked items
+        CAknListBoxFilterItems* filter 
+                = static_cast < CAknFilteredTextListBoxModel* >     
+                                ( iListBox->Model() )->Filter();
+        if ( filter )
+            {
+            // Filter knows all.
+            filter->UpdateSelectionIndexesL();
+            selected = filter->SelectionIndexes();
+            }
+        else
+            {
+            // No filter.
+            selected = ListBox()->View()->SelectionIndexes();
+            }
+            
+        // Show wait note if needed.
+        CAknWaitNoteWrapper* waitNoteWrapper( NULL );
+        if ( selected->Count() == 1 && selected->At( 0 ) == 0 )
+            {
+            showWaitNote = EFalse;
+            }
+        if ( showWaitNote )
+            {
+            waitNoteWrapper = CAknWaitNoteWrapper::NewL();
+            CleanupStack::PushL(reinterpret_cast<CBase*>(waitNoteWrapper));
+            waitNoteWrapper->ExecuteL(
+                R_UPNP_MULTISELECTION_COLLECTING_FILES_NOTE,      // TInt aResId,
+                *this,            // MAknBackgroundProcess& aBackgroundProcess
+                ETrue);
+            }
+
+        // give the selection indexes to filesharing engine
+        iMarkedItems->Reset();
+        for( TInt i(0); i<selected->Count(); i++ )
+            {
+            iMarkedItems->AppendL( selected->At( i ) );
+            }
+        iUtility->ConvertSelectionsForEngineL( *iMarkedItems );
+
+        if ( showWaitNote )
+            {
+            CleanupStack::PopAndDestroy(waitNoteWrapper);
+            }
+        ret = ETrue;
+        }
+
+   else if ( aButtonId == EAknSoftkeySelect )
+       {
+       // msk event    
+       __LOG("CUPnPAppMultiselectionDialog::msk event");
+       TKeyEvent tmpEvent;
+       tmpEvent.iCode = EKeyOK;
+       tmpEvent.iModifiers = 0;
+       tmpEvent.iRepeats = 0;
+       tmpEvent.iScanCode = 0;
+       TEventCode eventType = EEventKey;
+       OfferKeyEventL( tmpEvent, eventType );
+       
+       }
+   else if ( aButtonId == EAknSoftkeyBack )
+        {
+        ret = ETrue;
+        }
+
+    __LOG("CUPnPAppMultiselectionDialog::OkToExitL end");
+    return ret;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// --------------------------------------------------------------------------
+//
+void CUPnPAppMultiselectionDialog::PreLayoutDynInitL()
+    {
+    __LOG("CUPnPAppMultiselectionDialog::PreLayoutDynInitL begin");
+
+    iListBox = static_cast<CAknSingleGraphicStyleListBox*>
+        (Control(EMultiSelectionListBoxId));
+
+    // display find box
+    SetupFind( CAknSelectionListDialog::EAdaptiveFind );
+
+    // get pointer to listbox data array
+    iModel = STATIC_CAST(
+        CAknFilteredTextListBoxModel*, iListBox->Model() );
+    iSettingsTextArray = static_cast<CDesCArray*>(
+        iModel->ItemTextArray() );
+
+    iUtility->AppendShareAllSelectionL( iSettingsTextArray );
+
+ 
+    iFileSharingEngine->RequestSelectionContentL( iMediaType );
+    iState = ELoadContent;
+
+    CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL();
+    CleanupStack::PushL(reinterpret_cast<CBase*>(waitNoteWrapper));
+    waitNoteWrapper->ExecuteL(
+        R_UPNP_MULTISELECTION_SEARCHING_FILES_NOTE,      // TInt aResId,
+        *this,           // MAknBackgroundProcess& aBackgroundProcess
+        EFalse);   // ETrue = Show immediately
+
+    CleanupStack::PopAndDestroy(waitNoteWrapper);
+
+    CAknIconArray* icons = new (ELeave) CAknIconArray(2);
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) );
+
+    iUtility->AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOn,
+                        EMbmAvkonQgn_prop_checkbox_on,
+                        EMbmAvkonQgn_prop_checkbox_on_mask );
+
+    iUtility->AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOff,
+                        EMbmAvkonQgn_prop_checkbox_off,
+                        EMbmAvkonQgn_prop_checkbox_off_mask );
+
+
+    iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
+    CleanupStack::Pop( icons );
+
+    iListBox->ActivateL();
+
+
+    // set dialog title
+    CEikStatusPane* statusPane =
+                    (( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane();
+    iTitlePane = (CAknTitlePane*)statusPane->ControlL(
+                    TUid::Uid(EEikStatusPaneUidTitle));
+
+    if ( iMediaType == EImageAndVideo )
+        {
+        iTitlePane->SetTextL( *StringLoader::LoadLC(
+                                R_UPNP_MULTISELECTION_SHARING_VISUAL_TITLE_TEXT) );
+        }
+    else
+        {
+        iTitlePane->SetTextL( *StringLoader::LoadLC(
+                                R_UPNP_MULTISELECTION_SHARING_MUSIC_TITLE_TEXT) );
+        }
+    CleanupStack::PopAndDestroy();
+
+    CAknSelectionListDialog::PreLayoutDynInitL();
+    __LOG("CUPnPAppMultiselectionDialog::PreLayoutDynInitL end");
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::PostLayoutDynInitL()
+// Called by framework before dialog is shown.
+// Needed because filter is not active until PreLayoutDynInitL().
+// --------------------------------------------------------------------------
+//
+void  CUPnPAppMultiselectionDialog::PostLayoutDynInitL()
+    {
+    __LOG("CUPnPAppMultiselectionDialog::PostLayoutDynInitL begin");
+
+    // Get state of do not share and share all selections and set them 
+    // to utility.
+    TShareSelectionState selectionState = 
+        iUtility->ShareSelectionStateFromArray( *iMarkedItems );
+    iUtility->SetShareSelectionState( selectionState );
+    
+    // filter out the first character of the search string
+    FindBox()->SetListColumnFilterFlags(0xFFFFFFFE);
+    
+    //mark selected albums
+    if ( iMarkedItems )
+        {
+        if ( iMarkedItems->Count() )
+            {
+            //
+            iListBox->SetSelectionIndexesL( iMarkedItems );
+            }
+        }
+    iUtility->CollectSelectedItemsL( iListBox, ETrue );
+
+    //set msk's label depending on is item selected or not
+    HBufC* mskLabel( iMskSelectText );
+    if( iListBox->View()->ItemIsSelected( iListBox->CurrentItemIndex() ) )
+        {
+        mskLabel = iMskUnselectText;
+        }
+    ButtonGroupContainer().SetCommandL( EAknSoftkeySelect, *mskLabel );
+
+    __LOG("CUPnPAppMultiselectionDialog::PostLayoutDynInitL end");
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::OfferKeyEventL();
+// called by framework when key is pressed
+// --------------------------------------------------------------------------
+//
+TKeyResponse CUPnPAppMultiselectionDialog::OfferKeyEventL(
+            const TKeyEvent &aKeyEvent,
+            TEventCode aType)
+    {
+    __LOG("CUPnPAppMultiselectionDialog::OfferKeyEventL begin"); 
+    
+    TKeyResponse status( EKeyWasNotConsumed );
+    if ( aType == EEventKey ) // Is not key event
+        {
+        if (aKeyEvent.iCode == EKeyOK)
+            {
+            status = iListBox->OfferKeyEventL( aKeyEvent, aType );
+            iUtility->CollectSelectedItemsL( iListBox );
+            }
+        else if (aKeyEvent.iCode == KOkSoftkeyCode)
+            {
+            // disable draw
+            iListBox->View()->SetDisableRedraw(ETrue);
+            status = CAknSelectionListDialog::OfferKeyEventL(aKeyEvent,aType);
+            }
+        else
+            {
+            // Let the Akn dialog handle the key event.
+            // EKeyEscape key event deletes this dialog.
+            status = CAknSelectionListDialog::OfferKeyEventL(aKeyEvent,aType);
+            }
+        }
+
+    //
+    // Set msk's label depending on is item selected or not.
+    //
+    // In case of EKeyEscape we cannot access objects in heap any more.
+    // Only local variables in stack. This is because CAknSelectionListDialog
+    // ::OfferKeyEventL deletes this dialog. When call returns heap memory is cleared
+    // and we cannot rely on values of member variables.
+    //
+    if ( status == EKeyWasConsumed &&
+         aKeyEvent.iCode != EKeyEscape )
+        {
+        HBufC* mskLabel(iMskSelectText);
+        if( iListBox->View()->ItemIsSelected( 
+                iListBox->CurrentItemIndex() ) )
+            {
+            mskLabel = iMskUnselectText;
+            }
+        ButtonGroupContainer().SetCommandL( EAknSoftkeySelect, *mskLabel );
+        ButtonGroupContainer().DrawDeferred();
+        }
+
+    __LOG("CUPnPAppMultiselectionDialog::OfferKeyEventL end");
+    return status;
+    }
+
+    
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::StepL
+// Step done during wait note
+// --------------------------------------------------------------------------
+//
+void CUPnPAppMultiselectionDialog::StepL(void)
+    {
+    switch ( iState )
+        {
+        case ELoadContent:
+            {
+            TRAPD( err, iFileSharingEngine->GetSelectionContentL( 
+                *iSettingsTextArray ) );
+            if ( err == KErrNone )
+                {
+                iState = ELoadIndexes;
+                iFileSharingEngine->RequestSelectionIndexesL( iMediaType );
+                }
+            else if ( err == KErrInUse )
+                {
+                //do nothing, request is being proceeded
+                }
+            else
+                {
+                User::Leave( err );
+                }
+            break;
+            }
+        case ELoadIndexes:
+            {
+            TRAPD( err, iFileSharingEngine->GetSelectionIndexesL( 
+                *iMarkedItems ) );
+            if ( err == KErrNone )
+                {
+                iState = ELoadDone;
+                iDone = ETrue;
+                }
+            else if ( err == KErrInUse )
+                {
+                //do nothing, request is being proceeded
+                }
+            else
+                {
+                User::Leave( err );
+                }
+            break;
+            }
+        case ELoadDone:
+            {
+            break;
+            }
+        default:
+            {
+            __PANICD( __FILE__, __LINE__ );
+            break;
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionDialog::IsProcessDone
+// Returns ETrue if process finished
+// --------------------------------------------------------------------------
+//
+TBool CUPnPAppMultiselectionDialog::IsProcessDone(void) const
+    {
+    return iDone;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/src/upnpappmultiselectionpopup.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,441 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Multiselection popup implementation
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <avkon.mbg>
+#include <eikclbd.h>
+#include <eiklbv.h> //clistboxview
+#include <aknlists.h>
+#include <AknsUtils.h>
+#include <eikcmbut.h>
+#include <badesca.h>
+
+#include "upnpappmultiselectionpopup.h"
+#include "upnpmultiselectionutility.h"
+#include "upnpfilesharingengine.h"
+
+#include "cupnpmultiselectionui.hrh"
+#include <cupnpmultiselectionui.rsg>
+
+_LIT( KComponentLogfile, "multiselectionui.txt");
+#include "upnplog.h"
+
+
+//CONSTANTS
+const TInt KOkSoftkeyCode = 63585;
+
+//FORWARD DECLARATIONS
+class CUPnPAppMultiselectionDialog;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAppMultiselectionPopup* CUPnPAppMultiselectionPopup::NewL(
+    THomeConnectMediaType aMediaType,
+    CUPnPFileSharingEngine* aFileSharingEngine,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray,
+    const HBufC* aHeading )
+    {
+    __LOG( "CUPnPAppMultiselectionPopup::NewL begin" );
+
+    CUPnPAppMultiselectionPopup* self =
+                   new(ELeave) CUPnPAppMultiselectionPopup( NULL, aHeading );
+
+    self->ConstructL( aMediaType, aFileSharingEngine,aSelectionIndexArray );
+
+    __LOG("CUPnPAppMultiselectionPopup::NewL end");
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPAppMultiselectionPopup::ConstructL(
+    THomeConnectMediaType aMediaType,
+    CUPnPFileSharingEngine* aFileSharingEngine,
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray )
+    {
+    __LOG("CUPnPAppMultiselectionPopup::ConstructL begin");
+
+    iMediaType = aMediaType;
+    iFileSharingEngine = aFileSharingEngine;
+    iPreviousSelection = aSelectionIndexArray;
+    iUiMarked = new(ELeave) CArrayFixFlat<TInt>(3);
+    iMarkedItems = new(ELeave) CArrayFixFlat<TInt>(3);
+    iUtility = new (ELeave) CUpnpMultiselectionUtility();
+    iMskSelectText = 
+        StringLoader::LoadL( R_UPNP_MULTISELECTION_SELECT_TEXT );
+    iMskUnselectText = 
+        StringLoader::LoadL( R_UPNP_MULTISELECTION_UNSELECT_TEXT );
+    
+    __LOG("CUPnPAppMultiselectionPopup::ConstructL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::CUPnPAppMultiselectionPopup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPAppMultiselectionPopup::CUPnPAppMultiselectionPopup(
+    CListBoxView::CSelectionIndexArray* aSelectionIndexArray, 
+    const HBufC* aHeading )
+    : CAknListQueryDialog( aSelectionIndexArray )
+
+    {
+    iHeading = aHeading;
+    __LOG("CUPnPAppMultiselectionPopup::CUPnPAppMultiselectionPopup");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::~CUPnPAppMultiselectionPopup
+// C++ default destructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAppMultiselectionPopup::~CUPnPAppMultiselectionPopup()
+    {
+    __LOG("CUPnPAppMultiselectionPopup::~CUPnPAppMultiselectionPopup");
+
+    iFileSharingEngine = NULL;
+
+    delete iUiMarked;
+    delete iMarkedItems;
+    delete iUtility;
+    delete iMskSelectText;
+    delete iMskUnselectText;
+
+    __LOG("CUPnPAppMultiselectionPopup::~CUPnPAppMultiselectionPopup end");
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::OkToExitL(TInt aButtonId)
+// called by framework when the softkey is pressed
+// --------------------------------------------------------------------------
+//
+TBool CUPnPAppMultiselectionPopup::OkToExitL( TInt aButtonId )
+    {
+    __LOG("CUPnPAppMultiselectionPopup::OkToExitL begin");
+
+    if ( aButtonId == EAknSoftkeyOk )
+        {
+        __LOG("CUPnPAppMultiselectionPopup::OkToExitL: OK");
+
+        const CArrayFix<TInt>* selected;
+
+        //get the true indexes of marked items
+        CAknListBoxFilterItems* filter 
+                = static_cast < CAknFilteredTextListBoxModel* >     
+                                ( iListBox->Model() )->Filter();
+        if ( filter )
+            {
+            // Filter knows all.
+            filter->UpdateSelectionIndexesL();
+            selected = filter->SelectionIndexes();
+            }
+        else
+            {
+            // No filter.
+            selected = ListBox()->View()->SelectionIndexes();
+            }
+            
+        if ( iPreviousSelection )
+            {
+            iPreviousSelection->Reset();
+            for ( TInt i = 0; i < selected->Count(); i++ )
+                {
+                TInt tmp = selected->At( i );
+                iPreviousSelection->AppendL( tmp );
+                }
+            iUtility->ConvertSelectionsForEngineL( *iPreviousSelection );
+            }
+        }
+
+
+    __LOG("CUPnPAppMultiselectionPopup::OkToExitL end");
+    return ETrue;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// --------------------------------------------------------------------------
+//
+void CUPnPAppMultiselectionPopup::PreLayoutDynInitL()
+    {
+    __LOG("CUPnPAppMultiselectionPopup::PreLayoutDynInitL begin");
+
+    //mark selected albums
+
+    iListBox = ListBox();
+    iModel = STATIC_CAST(
+        CAknFilteredTextListBoxModel*, iListBox->Model());
+
+    iSettingsTextArray = static_cast<CDesCArray*>(
+        iModel->ItemTextArray());
+
+    iUtility->AppendShareAllSelectionL( iSettingsTextArray );
+
+    iFileSharingEngine->RequestSelectionContentL( iMediaType );
+    iState = ELoadContent;
+
+    CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL();
+    CleanupStack::PushL(reinterpret_cast<CBase*>(waitNoteWrapper));
+    waitNoteWrapper->ExecuteL(
+        R_UPNP_MULTISELECTION_SEARCHING_FILES_NOTE,      // TInt aResId,
+        *this,           // MAknBackgroundProcess& aBackgroundProcess
+        EFalse);   // ETrue = Show immediately
+
+    CleanupStack::PopAndDestroy(waitNoteWrapper);
+
+    CAknIconArray* icons = new (ELeave) CAknIconArray(2);
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) );
+
+    iUtility->AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOn,
+                        EMbmAvkonQgn_prop_checkbox_on,
+                        EMbmAvkonQgn_prop_checkbox_on_mask );
+
+    iUtility->AppendIconToArrayL( icons, skin,
+                        iconsPath,
+                        KAknsIIDQgnPropCheckboxOff,
+                        EMbmAvkonQgn_prop_checkbox_off,
+                        EMbmAvkonQgn_prop_checkbox_off_mask );
+
+
+    CAknListQueryDialog::SetIconArrayL(icons);
+
+    CleanupStack::Pop(icons);
+    
+    SetHeaderTextL( *iHeading );
+    
+    ListBox()->ActivateL();
+
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    __LOG("CUPnPAppMultiselectionPopup::PreLayoutDynInitL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::PostLayoutDynInitL()
+// Called by framework before dialog is shown.
+// Needed because filter is not active until PreLayoutDynInitL().
+// --------------------------------------------------------------------------
+//
+void  CUPnPAppMultiselectionPopup::PostLayoutDynInitL()
+    {
+    __LOG("CUPnPAppMultiselectionPopup::PostLayoutDynInitL begin");
+
+    // Get state of do not share and share all selections and set them 
+    // to utility.
+    TShareSelectionState selectionState = 
+        iUtility->ShareSelectionStateFromArray( *iMarkedItems );
+    iUtility->SetShareSelectionState( selectionState );
+        
+    TBool useMarked = EFalse;
+    //mark selected albums
+    if ( iMarkedItems && iMarkedItems->Count() )
+        {
+        if( iMarkedItems->At(0) != 0 )
+            {
+            __LOG("CUPnPAppMultiselectionPopup::PostLayoutDynInitL using iMarkedItems");
+            // if got selections stored in content server use that
+            iListBox->SetSelectionIndexesL( iMarkedItems );
+            useMarked = ETrue;
+            }
+        }
+    if( !useMarked && iUiMarked->Count() )
+        {
+        __LOG("CUPnPAppMultiselectionPopup::PostLayoutDynInitL using iUiMarked");
+        iListBox->SetSelectionIndexesL( iUiMarked );
+        }
+
+    iUtility->CollectSelectedItemsL( iListBox, ETrue );
+
+    //set msk's label depending on is item selected or not
+    HBufC* mskLabel( iMskSelectText );
+    if( iListBox->View()->ItemIsSelected( iListBox->CurrentItemIndex() ) )
+        {
+        mskLabel = iMskUnselectText;
+        }
+    ButtonGroupContainer().SetCommandL( 
+        EAknSoftkeyForwardKeyEvent, *mskLabel );
+
+    __LOG("CUPnPAppMultiselectionPopup::PostLayoutDynInitL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::OfferKeyEventL();
+// called by framework when key is pressed
+// --------------------------------------------------------------------------
+//
+TKeyResponse CUPnPAppMultiselectionPopup::OfferKeyEventL (
+            const TKeyEvent &aKeyEvent,
+            TEventCode aType)
+    {
+    __LOG("CUPnPAppMultiselectionPopup::OfferKeyEventL begin");
+
+    TKeyResponse status( EKeyWasNotConsumed );
+    if ( aType == EEventKey ) // Is not key event
+        {
+        if (aKeyEvent.iCode == EKeyOK)
+            {
+            status = ListBox()->OfferKeyEventL( aKeyEvent, aType );
+            iUtility->CollectSelectedItemsL( iListBox );
+            }
+        else if (aKeyEvent.iCode == KOkSoftkeyCode)
+            {
+            // disable draw
+            status = CAknListQueryDialog::OfferKeyEventL( aKeyEvent, aType );
+            }
+        else
+            {
+            // Let the Akn dialog handle the key event.
+            // EKeyEscape key event deletes this dialog.
+            status = CAknListQueryDialog::OfferKeyEventL( aKeyEvent, aType );
+            }
+        }
+
+    //
+    // Set msk's label depending on is item selected or not.
+    //
+    // In case of EKeyEscape we cannot access objects in heap any more.
+    // Only local variables in stack. This is because CAknSelectionListDialog
+    // ::OfferKeyEventL deletes this dialog. When call returns heap memory is cleared
+    // and we cannot rely on values of member variables.
+    //
+    if ( status == EKeyWasConsumed &&
+         aKeyEvent.iCode != EKeyEscape )
+        {
+        HBufC* mskLabel(iMskSelectText);
+        if( iListBox->View()->ItemIsSelected( 
+                iListBox->CurrentItemIndex() ) )
+            {
+            mskLabel = iMskUnselectText;
+            }
+        ButtonGroupContainer().SetCommandL( 
+            EAknSoftkeyForwardKeyEvent, *mskLabel );
+        ButtonGroupContainer().DrawDeferred();
+        }
+
+    __LOG("CUPnPAppMultiselectionPopup::OfferKeyEventL end");
+    return status;
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::StepL
+// Step done during wait note
+// --------------------------------------------------------------------------
+//
+void CUPnPAppMultiselectionPopup::StepL(void)
+    {
+    switch ( iState )
+        {
+        case ELoadContent:
+            {
+            TRAPD( err, iFileSharingEngine->GetSelectionContentL( 
+                *iSettingsTextArray ) );
+            if ( err == KErrNone )
+                {
+                iState = ELoadIndexes;
+                iFileSharingEngine->RequestSelectionIndexesL( iMediaType );
+                }
+            else if ( err == KErrInUse )
+                {
+                //do nothing, request is being proceeded
+                }
+            else
+                {
+                User::Leave( err );
+                }
+            break;
+            }
+        case ELoadIndexes:
+            {
+            TRAPD( err, iFileSharingEngine->GetSelectionIndexesL( 
+                *iMarkedItems ) );
+            if ( err == KErrNone )
+                {
+                iState = ELoadDone;
+                iDone = ETrue;
+                }
+            else if ( err == KErrInUse )
+                {
+                //do nothing, request is being proceeded
+                }
+            else
+                {
+                User::Leave( err );
+                }
+            break;
+            }
+        case ELoadDone:
+            {
+            break;
+            }
+        default:
+            {
+            __PANICD( __FILE__, __LINE__ );
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::IsProcessDone
+// Returns ETrue if process finished
+// --------------------------------------------------------------------------
+//
+TBool CUPnPAppMultiselectionPopup::IsProcessDone(void) const
+    {
+    return iDone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppMultiselectionPopup::SetMarkedItemsL
+// --------------------------------------------------------------------------
+//
+void CUPnPAppMultiselectionPopup::SetMarkedItemsL(CArrayFix<TInt>& aMarkedItems)
+    {
+    iUiMarked->Reset();
+    for( TInt i=0 ; i < aMarkedItems.Count() ; ++i )
+        {
+        iUiMarked->AppendL( aMarkedItems.At(i) );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/multiselectionui/src/upnpmultiselectionutility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,503 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Multiselection dialog implementation
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <avkon.mbg>
+#include <eikclbd.h>
+#include <aknlists.h>
+#include <AknsUtils.h>
+
+#include <cupnpmultiselectionui.rsg>
+#include "upnpmultiselectionutility.h"
+#include "upnpfilesharingengine.h"
+
+_LIT( KComponentLogfile, "multiselectionui.txt");
+#include "upnplog.h"
+
+
+//CONSTANTS
+
+// Format string for listbox items
+_LIT( KItemFormatString, "1\t%S" );
+
+const TInt KShareNoneIndex = 0; // listbox index of "do not share"
+const TInt KShareAllIndex = 1;  // listbox index of "share all"
+const TInt KPredefinedSelections = 2; // Share none and share all
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CUpnpMultiselectionUtility::CUpnpMultiselectionUtility
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpMultiselectionUtility::CUpnpMultiselectionUtility()
+    {
+    __LOG("CUpnpMultiselectionUtility::CUpnpMultiselectionUtility");
+    iShareNoneSelected = EFalse;
+    iShareAllSelected = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMultiselectionUtility::CUpnpMultiselectionUtility
+// C++ default destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpMultiselectionUtility::~CUpnpMultiselectionUtility()
+    {
+    __LOG("CUpnpMultiselectionUtility::~CUpnpMultiselectionUtility");
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMultiselectionUtility::CollectSelectedItemsL()
+// Collects selected items to member variable for later use
+// --------------------------------------------------------------------------
+//
+void CUpnpMultiselectionUtility::CollectSelectedItemsL( 
+    CEikListBox* aListBox, TBool aFirstRun )
+    {
+    __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL begin");
+
+    const CArrayFix<TInt>* indexes = NULL;
+
+    //get the true indexes of marked items
+    CAknListBoxFilterItems* filter 
+            = static_cast < CAknFilteredTextListBoxModel* >     
+                            ( aListBox->Model() )->Filter();
+    if ( filter )
+        {
+        // Filter knows all.
+        filter->UpdateSelectionIndexesL();
+        indexes = filter->SelectionIndexes();
+        }
+    else
+        {
+        // No filter.
+        indexes = aListBox->View()->SelectionIndexes();
+        }
+    
+    if ( indexes->Count() > 0 )
+        {
+        // obtain selection state  
+        TShareSelectionState selectionState = 
+            ShareSelectionStateFromArray( *indexes );
+
+        // make some decisions based on the tabs selected
+        DoSelectionLogicL( aListBox, aFirstRun,
+            indexes, filter, selectionState );
+
+        }
+    else // no items selected
+        {
+        __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \
+No items selected");
+
+        filter->ResetFilteringL();
+        aListBox->View()->SelectItemL( KShareNoneIndex );
+        }
+
+    // update iShareNoneSelected and iShareAllSelected member variables
+    iShareNoneSelected = EFalse;
+    iShareAllSelected = EFalse;
+
+    const CArrayFix<TInt>* indexesAfter = NULL;
+
+    if ( filter )
+        {
+        // Filter knows all.
+        filter->UpdateSelectionIndexesL();
+        indexesAfter = filter->SelectionIndexes();
+        }
+    else
+        {
+        // No filter.
+        indexesAfter = aListBox->View()->SelectionIndexes();
+        }
+
+    for ( TInt i = 0 ; i < indexesAfter->Count() ; i++ ) 
+        {
+        if ( indexesAfter->At( i ) == KShareNoneIndex ) 
+            {
+            iShareNoneSelected = ETrue;
+            }
+        else if ( indexesAfter->At( i ) == KShareAllIndex ) 
+            {
+            iShareAllSelected = ETrue;
+            }
+        }
+
+    __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMultiselectionUtility::DoSelectionLogicL
+// Do some decisions based on the selection state
+// --------------------------------------------------------------------------
+//
+void CUpnpMultiselectionUtility::DoSelectionLogicL( 
+    CEikListBox* aListBox,
+    TBool aFirstRun,
+    const CArrayFix<TInt>* aIndexes,
+    CAknListBoxFilterItems* aFilter,
+    TShareSelectionState aSelectionState )
+    {
+    const TInt arrayGranularity( aIndexes->Count() + 1 );
+
+    // If "do not share" was not selected before and it is now, unselect
+    // all except "do not share".
+    if ( ( aSelectionState == EShareNoneSelected ||
+           aSelectionState == EShareNoneAndShareAllSelected ) && 
+         !iShareNoneSelected )
+        {
+        // Create new selectionindexarray with only "do not share" 
+        // selected and assign it to the listbox.
+        __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL:\
+Do not share selected");
+        CListBoxView::CSelectionIndexArray* noneArr = 
+            new (ELeave) CArrayFixFlat<TInt>( arrayGranularity );
+        CleanupStack::PushL( noneArr );
+        noneArr->AppendL( KShareNoneIndex );
+        aListBox->SetSelectionIndexesL( noneArr );
+        CleanupStack::PopAndDestroy( noneArr );
+        }
+    // if "share all" was not selected before and it is now, select all
+    // except "do not share". 
+    // OR if this method is executed first time (from PostLayoutDynInitL)
+    // and share all is selected, then we trust that all items should be 
+    // selected.  
+    else if ( ( ( aSelectionState == EShareAllSelected || 
+                  aSelectionState == EShareNoneAndShareAllSelected ) &&
+                  !iShareAllSelected ) 
+              || aSelectionState == EShareAllSelected && aFirstRun )
+        {
+        // Create new selectionindexarray with "share all" and all other
+        // items except "do not share" selected and assign it to the 
+        // listbox.
+        __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \
+All files selected");
+        TInt itemCount = aFilter->NonFilteredNumberOfItems();
+
+        CListBoxView::CSelectionIndexArray* allArr = 
+            new (ELeave) CArrayFixFlat<TInt>( arrayGranularity );
+        CleanupStack::PushL( allArr );
+        allArr->AppendL( KShareAllIndex );
+        for ( TInt i( KPredefinedSelections ); i < itemCount; i++ )
+            {
+            allArr->AppendL( i );
+            }
+        aFilter->ResetFilteringL();
+        aListBox->SetSelectionIndexesL( allArr );
+        CleanupStack::PopAndDestroy( allArr );
+        }
+    // if share all selection is removed
+    else if ( aSelectionState == EItemsSelected && 
+              iShareAllSelected ) 
+        {
+        // Create new selectionindexarray with only "do not share" 
+        // selected and assign it to the listbox.
+        __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \
+Do not share selected");
+        CListBoxView::CSelectionIndexArray* noneArr = 
+            new (ELeave) CArrayFixFlat<TInt>( arrayGranularity );
+        CleanupStack::PushL( noneArr );
+        noneArr->AppendL( KShareNoneIndex );
+        aListBox->SetSelectionIndexesL( noneArr );
+        CleanupStack::PopAndDestroy( noneArr );
+        }
+    // if only some individual items have been modified
+    else if ( aSelectionState == EItemsSelected && 
+              !iShareAllSelected &&
+              !iShareNoneSelected ) 
+        {
+        // do nothing. selections are kept as they are
+        }
+    // if share none is selected with some individual item, 
+    // unselect share none
+    else if ( aSelectionState == EShareNoneSelected && aIndexes->Count() > 1 ) 
+        {
+        // Create similar selectionindexarray without "do not share" 
+        // selected and assign it to the listbox.
+        __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \
+Do not share selected");
+
+        for( TInt y=0; y < aIndexes->Count(); y++ )
+            {
+            TInt itemIndex = aIndexes->At(y);
+            if ( itemIndex == 0 || itemIndex == 1 )
+                {
+                aListBox->View()->DeselectItem( 
+                    aFilter->VisibleItemIndex(itemIndex) );
+                }
+            }
+        }
+    else if ( aSelectionState == EShareAllSelected &&
+              aIndexes->Count() < aFilter->NonFilteredNumberOfItems() - 1 ) 
+        {
+        if ( aIndexes->Count() > 0 ) 
+            {
+            // all items were selected and some item (not share all) has 
+            // been unselected -> remove selection also from share all.
+            __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \
+Do not share selected");
+
+            for( TInt y=0; y < aIndexes->Count(); y++ )
+                {
+                TInt itemIndex = aIndexes->At(y);
+                if ( itemIndex == KShareAllIndex )
+                    {
+                    aListBox->View()->DeselectItem( 
+                        aFilter->VisibleItemIndex( itemIndex ) );
+                    }
+                }
+            
+            if ( !aListBox->View()->SelectionIndexes()->Count() ) 
+                {
+                // Last individual item has been unselected.
+                // Create new selectionindexarray with only 
+                // "do not share" selected and assign it to the listbox.
+                __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \
+Do not share selected");
+                CListBoxView::CSelectionIndexArray* noneArr = 
+                    new (ELeave) CArrayFixFlat<TInt>( arrayGranularity );
+                CleanupStack::PushL( noneArr );
+                noneArr->AppendL( KShareNoneIndex );
+                aListBox->SetSelectionIndexesL( noneArr );
+                CleanupStack::PopAndDestroy( noneArr );
+                }
+            }
+        else 
+            {
+            // some item unselected and no other items left except 
+            // "share all"
+
+            // Create new selectionindexarray with only "do not share" 
+            // selected and assign it to the listbox.
+            __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \
+Do not share selected");
+            CListBoxView::CSelectionIndexArray* noneArr = 
+                new (ELeave) CArrayFixFlat<TInt>( arrayGranularity );
+            CleanupStack::PushL( noneArr );
+            noneArr->AppendL( KShareNoneIndex );
+            aListBox->SetSelectionIndexesL( noneArr );
+            CleanupStack::PopAndDestroy( noneArr );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMultiselectionUtility::ConvertSelectionsForEngineL
+// Convert the selections from UI to engine as "old style selections"
+// Has effect only if "Share All" is selected
+// --------------------------------------------------------------------------
+//
+void CUpnpMultiselectionUtility::ConvertSelectionsForEngineL( 
+    CArrayFix<TInt>& aSelections ) const
+    {
+    __LOG("CUpnpMultiselectionUtility::ConvertSelectionsForEngineL begin");
+
+    for ( TInt i(0); i < aSelections.Count(); i++ )
+        {
+        if ( aSelections.At( i ) == KShareAllIndex )
+            {
+            aSelections.Reset();
+            aSelections.AppendL( KShareAllIndex );
+            i = aSelections.Count();
+            }
+        }
+    
+    __LOG("CUpnpMultiselectionUtility::ConvertSelectionsForEngineL end");
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpMultiselectionUtility::AppendIconToArray
+// Load a possibly skinned icon (with mask) and append it to an
+// icon array.
+// --------------------------------------------------------------------------
+//
+void CUpnpMultiselectionUtility::AppendIconToArrayL(CAknIconArray* aArray,
+                                               MAknsSkinInstance* aSkin,
+                                               const TDesC& aMbmFile,
+                                               const TAknsItemID& aID,
+                                               TInt aBitmapId,
+                                               TInt aMaskId) const
+    {
+    __LOG("CUpnpMultiselectionUtility::AppendIconToArrayL begin");
+
+    __ASSERT_DEBUG(aArray != NULL, User::Leave(KErrArgument));
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC( aSkin, aID,
+        bitmap, mask, aMbmFile, aBitmapId, aMaskId );
+
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally( EFalse );
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop(2); // mask, bitmap
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL( icon );
+
+    aArray->AppendL( icon );
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop(icon);
+    __LOG("CUpnpMultiselectionUtility::AppendIconToArrayL end");
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMultiselectionUtility::AppendShareAllSelectionL
+// Appends "share all files" item to the listbox
+// --------------------------------------------------------------------------
+//
+void CUpnpMultiselectionUtility::AppendShareAllSelectionL(
+                                    CDesCArray* aListBoxArray ) const
+    {
+    __LOG("CUpnpMultiselectionUtility::AppendShareAllSelectionL begin");
+    HBufC* item = HBufC::NewL( KMaxFileName );
+    CleanupStack::PushL( item );
+    HBufC* item2 = HBufC::NewL( KMaxFileName );
+    CleanupStack::PushL( item2 );
+    HBufC* itemText1 = StringLoader::LoadLC( 
+        R_UPNP_MULTISELECTION_SHARE_ALL_TEXT );
+    HBufC* itemText2 = StringLoader::LoadLC(
+        R_UPNP_MULTISELECTION_DO_NOT_SHARE_TEXT );
+    // create item string for the listbox (icon + album name)
+    item->Des().Format( KItemFormatString, itemText1 );
+    item2->Des().Format( KItemFormatString, itemText2 );
+    // append "share all files" -selection to the listbox
+    aListBoxArray->AppendL( item2->Des() );
+    aListBoxArray->AppendL( item->Des() );
+
+    CleanupStack::PopAndDestroy(2); // stringloader
+    CleanupStack::PopAndDestroy(2); // item item2
+    __LOG( "CUpnpMultiselectionUtility::AppendShareAllSelectionL end" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpMultiselectionUtility::SetShareSelectionState
+// (Commented in the header)
+// --------------------------------------------------------------------------
+//
+void CUpnpMultiselectionUtility::SetShareSelectionState( 
+    TShareSelectionState aSelectionState ) 
+    {
+    switch ( aSelectionState )
+        {
+        case EShareNoneSelected:
+            {
+            iShareNoneSelected = ETrue;
+            iShareAllSelected = EFalse;
+            break;
+            }
+        case EShareAllSelected:
+            {
+            iShareNoneSelected = EFalse;
+            iShareAllSelected = ETrue;
+            break;
+            }
+        case ENoShareNoneOrShareAllSelected:
+            {
+            iShareNoneSelected = EFalse;
+            iShareAllSelected = EFalse;
+            break;
+            }
+        default:
+            {
+            // Should not be reached.
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpMultiselectionUtility::ShareSelectionStateFromArray
+// (Commented in the header)
+// --------------------------------------------------------------------------
+//
+TShareSelectionState 
+    CUpnpMultiselectionUtility::ShareSelectionStateFromArray( 
+    const CArrayFix<TInt>& aIndexes ) const
+    {
+    TShareSelectionState retval = EUndefined;
+    TBool shareNoneFound = EFalse;
+    TBool shareAllFound = EFalse;
+    TBool itemsSelected = EFalse;
+        
+    // Check if the indexes array contains do not share or share all.
+    for ( TInt i = 0 ; i < aIndexes.Count() ; i++ ) 
+        {
+        if ( aIndexes.At( i ) == KShareNoneIndex ) 
+            {
+            shareNoneFound = ETrue;
+            }
+        else if ( aIndexes.At( i ) == KShareAllIndex )  
+            {
+            shareAllFound = ETrue;
+            }
+        }
+
+    // 
+    if ( !shareAllFound && !shareNoneFound ) 
+        {
+        // "do not share" or "share all" are not selected. Check if there are
+        // other items selected.
+        if ( aIndexes.Count() ) 
+            {
+            itemsSelected = ETrue;
+            }
+        }
+
+    // set retval
+    if ( itemsSelected ) 
+        {
+        retval = EItemsSelected;
+        }    
+    else if ( shareNoneFound && !shareAllFound ) 
+        {
+        retval = EShareNoneSelected;
+        }
+    else if ( !shareNoneFound && shareAllFound ) 
+        {
+        retval = EShareAllSelected;
+        }    
+    else if ( shareNoneFound && shareAllFound ) 
+        {
+        retval = EShareNoneAndShareAllSelected;
+        }
+    else if ( !shareNoneFound && !shareAllFound ) 
+        {
+        retval = ENoShareNoneOrShareAllSelected;
+        }
+    
+    return retval;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/rom/upnpsettings.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnpsettings subsystem ROM include file
+*
+*/
+
+
+
+
+
+#ifndef __UPNPSETTINGS_IBY__
+#define __UPNPSETTINGS_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // UPNP settings engine
+    file=ABI_DIR\BUILD_DIR\upnpsettingsengine.dll \sys\bin\upnpsettingsengine.dll
+    data=ABI_DIR\BUILD_DIR\z\private\10202be9\20009cae.txt \private\10202be9\20009cae.txt
+    data=DATAZ_\private\20009CAE\backup_registration.xml   \private\20009CAE\backup_registration.xml
+
+    // setup wizard
+    file=ABI_DIR\BUILD_DIR\upnpappwizard.dll  \sys\bin\upnpappwizard.dll
+
+    // multiselection UI
+    file=ABI_DIR\BUILD_DIR\upnpmultiselectionui.dll \sys\bin\upnpmultiselectionui.dll
+
+    //upnp generic settings plugin
+    ECOM_PLUGIN( upnpgsplugin.dll, upnpgsplugin.rsc )         
+    data=DATAZ_\resource\apps\upnpgspluginrsc.mif \resource\apps\upnpgspluginrsc.mif    
+    
+    // sharing settings UI
+    file=ABI_DIR\BUILD_DIR\upnpsharingui.dll \sys\bin\upnpsharingui.dll
+    
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __UPNPSETTINGS_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/rom/upnpsettingsresources.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnpsettings subsystem resource ROMinclude file
+*
+*/
+
+
+
+
+
+#ifndef __UPNPSETTINGSRESOURCES_IBY__
+#define __UPNPSETTINGSRESOURCES_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // setup wizard
+    data=DATAZ_\resource\cupnpappwizard.rsc \resource\cupnpappwizard.rsc
+
+    // multiselection UI
+    data=DATAZ_\resource\CUPnPMultiselectionUi.RSC \resource\CUPnPMultiselectionUi.RSC
+
+    //upnp generic settings plugin
+    data=DATAZ_\resource\upnpgspluginrsc.rsc \resource\upnpgspluginrsc.rsc
+    
+    // sharing settings UI
+    data=DATAZ_\resource\upnpsharingui.rsc \resource\upnpsharingui.rsc
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __UPNPSETTINGSRESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/bitmaps/qgn_menu_upnp_homemedia.svg	Thu Dec 17 08:52:00 2009 +0200
@@ -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/upnpsettings/upnpgsplugin/data/20009CAF.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      ECOM plugin resource file for Data Call Settings plugin.
+*
+*/
+
+
+
+
+
+
+#include <ecom/registryinfo.rh>
+#include "upnpgsplugin.hrh"
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    //resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    // UID for the DLL
+    dll_uid = KUPnPGSPluginDllUid;
+    // Declare array of interface info
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            //GS ECOM interface UID, don't change!
+            interface_uid = 0x10207236;
+            implementations = 
+                {
+                // Info for UPnP Browser
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUPnPGSPluginImplementationUid;
+                    version_no         = 1;
+                    display_name       = "UPnP Settings";
+                    default_data       = "0x10207239"; // Parent UID;
+                    opaque_data        = "1000"; // Order number
+                    //rom_only = 0;
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/data/upnpgspluginrsc.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,449 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Upnp settings plugin resource file
+*
+*/
+
+
+
+
+
+
+
+//  RESOURCE IDENTIFIER
+NAME    UPGS // 4 letter ID
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <upnpsettings.loc>
+
+// USER INCLUDES
+#include "upnpsettingsengine.hrh"
+#include "upnpgsplugin.hrh"
+
+// CONSTANTS
+
+//  RESOURCE DEFINITIONS
+
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+//----------------------------------------------------
+//  r_gs_datacall_view_caption
+//
+// Data call view caption for plugin
+//----------------------------------------------------
+//
+RESOURCE TBUF r_upnp_gs_settings_view_caption
+    {
+    buf = qtn_iupnp_gs_caption;
+    }
+
+//----------------------------------------------------
+//  r_gs_datacall_view_caption
+//
+// Data call view caption for plugin
+//----------------------------------------------------
+//
+RESOURCE TBUF r_upnp_gs_settings_view_title
+    {
+    buf = qtn_iupnp_title_sharing;
+    }
+
+//----------------------------------------------------
+//
+//    r_gs_dcall_view
+//    Data call view.
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_gs_upnp_view
+    {
+    menubar = r_homeconnect_settings_menubar;
+    cba = r_settingsui_softkeys_options_back__change;
+    }
+  
+//----------------------------------------------------------------------------
+//   
+//    r_homeconnect_settings_menubar
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_homeconnect_settings_menubar
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_homeconnect_settings_menu;}
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homeconnect_settings_menu
+//
+//----------------------------------------------------------------------------
+
+RESOURCE MENU_PANE r_homeconnect_settings_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            { 
+            command = EAknSoftkeyChange; 
+            txt = qtn_options_change;
+            },
+        MENU_ITEM
+            { 
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            { 
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+
+//  RESOURCE DEFINITIONS 
+
+//----------------------------------------------------------------------------
+//   
+//    r_homeconnect_settings_dialog
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_ITEM_LIST r_upnp_gs_settings_list
+    {
+    items =
+        {
+        AVKON_SETTING_ITEM
+            {
+            identifier = EUPnPGSPluginItemIAP;
+            setting_page_resource = r_iap_setting_page;
+            associated_resource = r_iap_selection_page_texts;
+            name = qtn_iupnp_home_ap;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EUPnPGSPluginItemMyDeviceName;
+            setting_page_resource = r_my_device_name_setting_page;
+            name = qtn_iupnp_device_name;
+            },
+        AVKON_SETTING_ITEM
+            {
+            identifier = EUPnPGSPluginItemCopyLocation;
+            name = qtn_iupnp_copy_location;
+            }
+        };
+
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_iap_setting_page
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_iap_setting_page
+    {
+    label = qtn_iupnp_ap_head_set;
+    type = EAknCtPopupSettingList;
+    editor_resource_id = r_iap_selection_page_edit_controls;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_iap_selection_page_edit_controls
+//
+//----------------------------------------------------------------------------
+//    
+RESOURCE POPUP_SETTING_LIST r_iap_selection_page_edit_controls
+    {
+    }
+//----------------------------------------------------------------------------
+//   
+//    r_iap_selection_page_texts
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_iap_selection_page_texts
+
+    {
+    setting_texts_resource = r_iap_selection_item_texts;
+    }
+    
+//----------------------------------------------------------------------------
+//   
+//    r_iap_selection_item_texts
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_iap_selection_item_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT 
+            { 
+            value = EUPnPSettingsEngineIAPItemNone; 
+            text = qtn_iupnp_ap_none_set; 
+            },
+        AVKON_ENUMERATED_TEXT 
+            { 
+            value = EUPnPSettingsEngineIAPItemAlwaysAsk; 
+            text = qtn_iupnp_ap_ask_set; 
+            },
+        AVKON_ENUMERATED_TEXT 
+            { 
+            value = EUPnPSettingsEngineIAPItemUserDefined; 
+            text = qtn_iupnp_ap_user_defined; 
+            }
+        };
+    }
+
+
+
+//----------------------------------------------------------------------------
+//   
+//    r_my_device_name_setting_page
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_my_device_name_setting_page
+    {
+    type = EEikCtEdwin;
+    editor_resource_id = r_my_device_name_edwin;
+    }
+    
+
+//----------------------------------------------------------------------------
+//   
+//    home network IAP selection item texts
+//
+//----------------------------------------------------------------------------
+//    
+RESOURCE TBUF r_qtn_iupnp_item_home_iap_always_ask { buf = qtn_iupnp_ap_ask_set; }
+RESOURCE TBUF r_qtn_iupnp_item_home_iap_user_defined { buf = qtn_iupnp_ap_user_defined; }
+RESOURCE TBUF r_qtn_iupnp_item_home_iap_none { buf = qtn_iupnp_ap_none_set; }
+
+//----------------------------------------------------------------------------
+//   
+//    home network IAP selection setting page texts
+//
+//----------------------------------------------------------------------------
+//    
+RESOURCE TBUF r_qtn_iupnp_home_iap_always_ask { buf = qtn_iupnp_ap_ask_set; }
+RESOURCE TBUF r_qtn_iupnp_home_iap_create_new { buf = qtn_iupnp_ap_new_set; }
+RESOURCE TBUF r_qtn_iupnp_home_iap_none { buf = qtn_iupnp_ap_none_set; }
+
+//----------------------------------------------------------------------------
+//   
+//    r_my_device_name_edwin
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE EDWIN r_my_device_name_edwin
+    {
+    width = 64;
+    lines = 5;
+    maxlength = 64;
+    }
+    
+//----------------------------------------------------------------------------
+//   
+//    r_settingsui_softkeys_options_back__change
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE CBA r_settingsui_softkeys_options_back__change
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; },
+        CBA_BUTTON {id=EAknSoftkeyChange; txt= qtn_msk_change; }
+        };
+    }
+    
+//----------------------------------------------------------------------------
+//   
+//    r_upnp_settings_menubar
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_upnp_settings_menubar
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_upnp_settings_menu;}
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_upnp_settings_menu
+//
+//----------------------------------------------------------------------------
+
+RESOURCE MENU_PANE r_upnp_settings_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            { 
+            command = EAknSoftkeyChange;
+            txt = qtn_options_change;
+            },
+        MENU_ITEM
+            { 
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            { 
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+    
+//----------------------------------------------------------------------------
+//   
+//    r_unsecured_connections_confirmation_query
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_unsecured_connections_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = r_softkeys_continue_cancel;
+    items =
+        {
+        DLG_LINE
+            {   
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationQueryLayout;
+                label = qtn_iupnp_conf_unsecure;
+                };
+            }
+        };
+    }
+ 
+//----------------------------------------------------------------------------
+//   
+//    r_softkeys_continue_cancel
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE CBA r_softkeys_continue_cancel
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EUPnPGSPluginCbaButtonContinue;
+            txt = qtn_iupnp_conf_continue;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;
+            txt = text_softkey_cancel;
+            }
+        };
+    }
+        
+//----------------------------------------------------------------------------
+//   
+//    r_ibu_gallery_update_note_title_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ibu_gallery_update_note_title_text 
+    { 
+    buf = qtn_iupnp_ibu_gallery_update_note_title_2;
+    }    
+    
+//----------------------------------------------------------------------------
+//   
+//    r_ibu_gallery_update_note_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ibu_gallery_update_note_text 
+    {
+    buf = qtn_iupnp_ibu_gallery_update_note_2;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_ibu_gallery_update_notavail_note_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ibu_gallery_update_notavail_note_text 
+    { 
+    buf = qtn_iupnp_ibu_gallery_notavail_note_2;
+    }
+    
+//----------------------------------------------------------------------------
+//   
+//    r_qtn_iupnp_iap_turn_sharing_off
+//
+//----------------------------------------------------------------------------
+//    
+RESOURCE TBUF r_qtn_iupnp_iap_turn_sharing_off 
+    {
+    buf = qtn_iupnp_ibu_gallery_connectionactive_note; 
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_homeconnect_info_query
+//
+//----------------------------------------------------------------------------
+//        
+RESOURCE DIALOG r_homeconnect_info_query
+{
+   flags = EGeneralQueryFlags | EEikDialogFlagNoTitleBar | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+   buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+   items=
+   {
+       DLG_LINE
+       {
+          type = EAknCtPopupHeadingPane;
+          id = EAknMessageQueryHeaderId;
+          control = AVKON_HEADING
+          {
+          };
+       },
+       DLG_LINE
+       {
+          type = EAknCtMessageQuery;
+          id = EAknMessageQueryContentId;
+          control = AVKON_MESSAGE_QUERY
+          {
+          };
+        }
+   };
+}
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for upnp settings plugin
+*
+*/
+
+
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// none
+
+PRJ_MMPFILES
+upnpgsplugin.mmp
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE upnpgspluginrsc.mif
+OPTION HEADERFILE upnpgspluginrsc.mbg
+OPTION SOURCEDIR ../bitmaps
+OPTION SOURCES -c8,8 qgn_menu_upnp_homemedia
+END
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/group/upnpgsplugin.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnp settings plugin project specification file.
+*
+*/
+
+
+
+
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>    // For RESOURCE_FILES_DIR
+
+CAPABILITY          CAP_ECOM_PLUGIN
+TARGET              upnpgsplugin.dll
+TARGETTYPE          PLUGIN
+UID                 0x10009D8D 0x20009CAF
+VENDORID            VID_DEFAULT
+
+// System include paths
+APP_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+//User include paths
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+SOURCEPATH      ../data
+START RESOURCE  20009CAF.rss
+TARGET          upnpgsplugin.rsc
+TARGETPATH      ECOM_RESOURCE_DIR
+END
+
+SOURCEPATH      ../data
+START RESOURCE  upnpgspluginrsc.rss
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+SOURCEPATH      ../src
+SOURCE      upnpappsettingslist.cpp
+SOURCE      upnpappsettingitemhomeiap.cpp
+SOURCE      upnpappsettingitemmydevicename.cpp
+SOURCE      upnpsettingitemmemoryselection.cpp
+SOURCE      upnpgspluginimplementationtable.cpp
+SOURCE      upnpgspluginview.cpp
+
+LIBRARY   euser.lib
+LIBRARY   ecom.lib
+LIBRARY   efsrv.lib
+LIBRARY   avkon.lib
+LIBRARY   bafl.lib
+LIBRARY   cone.lib
+LIBRARY   eikcoctl.lib
+LIBRARY   eikcore.lib
+LIBRARY   egul.lib
+LIBRARY   eikdlg.lib            // eikon dialogs
+LIBRARY   upnpcontentserverclient.lib
+LIBRARY   upnpapplicationengine.lib
+LIBRARY   commondialogs.lib  // CAknMemorySelectionDialog
+
+LIBRARY   upnpavcontrollerclient.lib
+LIBRARY   upnpsettingsengine.lib
+LIBRARY   upnputilities.lib // IsAccesPointValidL
+LIBRARY   upnpipserversutils.lib
+LIBRARY   commdb.lib                  // used in upnpsettingitemhomeiap
+
+LIBRARY   CommonEngine.lib      // For RConeResourceLoader
+LIBRARY   featmgr.lib           // Feature manager
+LIBRARY   aknskinsrv.lib        // for enhanced skinning
+LIBRARY   AKNSKINS.lib          // for enhanced skinning
+LIBRARY   hlplch.lib            // for "Help" options menu
+LIBRARY   GSFramework.lib       // For base classes
+LIBRARY   GSListBox.lib         // For CGSListBoxItemTextArray
+LIBRARY   flogger.lib // For GSLogger
+LIBRARY   GSEcomPlugin.lib
+LIBRARY   PlatformEnv.lib
+LIBRARY   apengine.lib  
+LIBRARY   aknlayout.LIB
+LIBRARY   AknIcon.lib
+LIBRARY   cmmanager.lib
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/inc/upnpappsettingitemhomeiap.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Declares home network IAP setting item class to home network
+*                setting item list
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPAPPSETTINGITEMHOMEIAP_H
+#define UPNPAPPSETTINGITEMHOMEIAP_H
+
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+
+
+// FORWARD DECLARATIONS
+class CUPnPFileSharingEngine;
+
+
+// CLASS DECLARATION
+
+/**
+* UPnPAppSettingItemHomeIAP class. This class is used when
+* creating home network IAP setting item to setting item list
+* of home network application settings dialog.
+*
+* @lib CoverDisplaySettings.app
+*/
+class UPnPAppSettingItemHomeIAP: public CAknEnumeratedTextPopupSettingItem
+    {
+    public: // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static UPnPAppSettingItemHomeIAP* NewL(TInt aIdentifier,
+                                               TInt& aIAPSetting,
+            TInt& aIAPId, TInt& aWAPId, TBool& aSharingState );
+
+        /**
+        * Destructor.
+        */
+        virtual ~UPnPAppSettingItemHomeIAP();
+
+    public: // From CAknEnumeratedTextPopupSettingItem
+
+        /**
+        * Returns setting text according to home network IAP setting.
+        * This text is visible in this setting item.
+        *
+        * @return home network IAP setting/name text
+        */
+        const TDesC& SettingTextL();
+
+        /**
+        * Framework calls this method in order to create
+        * and execute setting page
+        */
+        void CreateAndExecuteSettingPageL();
+
+    private: // From CAknEnumeratedTextPopupSettingItem
+
+        /**
+        * Constructor.
+        */
+        UPnPAppSettingItemHomeIAP(TInt aIdentifier, TInt& aIAPSetting,
+            TInt& aIAPId, TInt& aWAPId, TBool& aSharingState );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // New methods
+
+        /**
+        * Changes iap name according to iap id
+        */
+        void ChangeIAPNameL();
+
+        /**
+        * Checks if access point is unsecured and warns user
+        * @since S60 3.1
+        * @param aAccessPoint, selected access point
+        * @return TInt, security mode
+        */
+        TInt CheckAPSecurityL(TInt aAccessPoint);
+
+        /**
+        * Displays message query
+        * @since S60 3.1
+        * @param aHeaderResourceId, resource id of the title
+        * @param aMessageResourceId, resource id of the message
+        * @param TIaDialogResourceIdnt, resource id of the dialog
+        */
+        void DisplayInfoL(TInt aHeaderResourceId,
+                          TInt aMessageResourceId,
+                          TInt aDialogResourceId);
+
+        
+        /**
+        * Adds static items to the list
+        * @since S60 3.1
+        * @param aArray, list array
+        */
+        void AddStaticItemsL(CDesCArray* aArray);
+        
+        /**
+        * Use previous iap
+        * @since S60 5.1
+        * @param aOldIap, previous iap id
+        */
+        void UsePreviousIapL( TInt aOldIap );
+        
+        /**
+        * Get iap index
+        * @since S60 5.1
+        * @param aStaticCount the number of static items
+        * @return Index of iap
+        */
+        TInt GetIAPIndex( TInt aStaticCount );
+
+    private:
+
+        // pointer to home network IAP text
+        HBufC* iItemText;
+
+        // pointer to home network IAP name
+        HBufC* iIAPName;
+
+        // home network IAP ui selection (always ask, user defined or none)
+        TInt& iIAPSetting;
+
+        // home network IAP id
+        TInt& iIAPId;
+
+        // home network IAP wap id
+        TInt& iWAPId;
+
+        // iap ids
+        RArray<TInt64> iIAPIdArray;
+
+        // Control environment
+        CCoeEnv*    iCoeEnv;
+
+        // sharing status
+        TBool& iSharingState;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/inc/upnpappsettingitemmydevicename.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Declares home network my device name setting item class to
+*                home network setting item list
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPAPPSETTINGITEMMYDEVICENAME_H
+#define UPNPAPPSETTINGITEMMYDEVICENAME_H
+
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+
+
+// FORWARD DECLARATIONS
+class CUPnPFileSharingEngine;
+
+
+// CLASS DECLARATION
+
+/**
+* UPnPAppSettingItemMyDeviceName class. This class is used when
+* creating home network my device name setting item to setting item list
+* of home network application settings dialog.
+*/
+class UPnPAppSettingItemMyDeviceName: public CAknTextSettingItem
+    {
+    public: // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static UPnPAppSettingItemMyDeviceName* NewL(TInt aIdentifier,
+                                                    TDes& aText,
+                                                    TBool& aSharingState );
+
+        /**
+        * Destructor.
+        */
+        virtual ~UPnPAppSettingItemMyDeviceName();
+
+    public: // From CAknTextSettingItem
+
+        /**
+        * Framework calls this method in order to create
+        * and execute setting page
+        */
+        void EditItemL(TBool aCalledFromMenu);
+
+    private: // From CAknTextSettingItem
+
+        /**
+        * Constructor.
+        */
+        UPnPAppSettingItemMyDeviceName(TInt aIdentifier,
+                                       TDes& aText,
+                                       TBool& aSharingState );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:
+
+        // Sharing state
+        TBool& iSharingState;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/inc/upnpappsettingslist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Settings list definition for Settings dialog
+*
+*/
+
+
+
+
+
+
+
+#ifndef UPNPAPPSETTINGSLIST_H
+#define UPNPAPPSETTINGSLIST_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+#include "upnpfilesharingengineobserver.h"
+
+// CLASS DECLARATION
+class CUPnPSettingsEngine;
+class CUPnPFileSharingEngine;
+
+// DATA TYPES
+enum TWLanSecurityMode
+    {
+    EWLanUnsecured = 1
+    };
+
+/**
+ *  Settings list class declaration
+ *  @since S60 3.1
+ */
+class CUPnPAppSettingsList : public CAknSettingItemList
+    {
+public:  // Constructors and destructor
+        
+    /**
+     * Two-phased constructor.
+     */
+    static CUPnPAppSettingsList* NewL( TBool& aSharingState,
+                                       TInt aResourceId );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPAppSettingsList();
+                
+public: // New functions
+
+    /**
+     * Reads data from storage to member variables
+     * @since S60 3.1
+     */
+    void LoadDataFromEngineL();
+
+public: // Functions from base classes
+
+    /**
+     * From CAknSettingItemList, this launches the setting page.
+     * @since S60 3.1
+     * @param aIndex, index of selected list item
+     * @param aCalledFromMenu, indicates if editing is called
+     *        trough menu or from keyboard
+     */
+    void EditItemL ( TInt aIndex, TBool aCalledFromMenu );
+
+protected:
+    
+    /**
+     * From CAknSettingItemList        
+     */
+    void HandleResourceChange( TInt aType );  
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUPnPAppSettingsList( TBool& aSharingState );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL( TInt aResourceId );
+
+    /**
+     * From CAknSettingItemList, Framework method to create a setting item.
+     * @since S60 3.1
+     * @param aIdentifier,  list item id to be created
+     * @return CAknSettingItem, pointer to list item
+     */
+    CAknSettingItem* CreateSettingItemL( TInt aIdentifier );
+        
+
+private:    // Data
+
+    // friendly name of my device
+    TBuf<KMaxFileName>      iFriendlyName;
+    // access point ID
+    TInt                    iIapId;
+    // wap id
+    TInt                    iWapId;
+    // my device name
+    HBufC8*                 iName;
+    // Settings engine for saving and reading data
+    CUPnPSettingsEngine*    iSettingsEngine;
+
+    // IAP ui selection (always ask, user defined or none)
+    TInt                    iIapSetting;
+
+    // The drive to store copied files
+    TDriveNumber            iCopyLocationDrive;
+
+    // The status of the sharing (on/off)
+    TBool&                  iSharingState;
+    };
+
+#endif      // UPNPAPPSETTINGSLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/inc/upnpgsplugin.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resource headers for project Home Network
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPSETTINGS_HRH
+#define UPNPSETTINGS_HRH
+
+// DATA TYPES
+
+#define KUPnPGSPluginDllUid                   0x20009CAF
+#define KUPnPGSPluginImplementationUid        0x20009CB0
+
+/**
+ * List of button ids used by UPnPGSPlugin.
+ */
+enum TUPnPGSPluginCbaButton
+    {
+    EUPnPGSPluginCbaButtonContinue = 1
+    };
+
+/**
+ * List of item ids supported by the UPnPGSPlugin. 
+ */
+enum TUPnPGSPluginItem
+    {
+    EUPnPGSPluginItemIAP = 0,
+    EUPnPGSPluginItemMyDeviceName,
+    EUPnPGSPluginItemCopyLocation
+    };
+    
+#endif      // UPNPSETTINGS_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/inc/upnpgspluginview.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Upnp general settings view.
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPGSPLUGINVIEW_H
+#define UPNPGSPLUGINVIEW_H
+
+#include <gsplugininterface.h>
+#include "upnpfilesharingengineobserver.h"
+class CUPnPAppSettingsList;
+class CAknNavigationDecorator;
+class CAknNavigationControlContainer;
+class CUPnPFileSharingEngine;
+
+/**
+ *  MediaServant settings view.
+ *
+ *  @lib msgsplugin.lib
+ */
+NONSHARABLE_CLASS( CUPnPGSPluginView ) : 
+                                    public CGSPluginInterface,
+                                    private MUPnPFileSharingEngineObserver
+    {
+
+    public:
+
+        /**
+         * Two phased constructor.
+         */
+        static CUPnPGSPluginView* NewL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CUPnPGSPluginView();
+
+    protected:
+    
+    // From base class CAknView
+
+        /**
+         * From CAknView
+         * See base class definition.
+         */
+        TUid Id() const;
+
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void HandleCommandL( TInt aCommand );
+    
+        /**
+         * From CAknView
+         * See base class definition
+         */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage);
+
+        /**
+         * From CAknView
+         * See base class definition
+         */        
+        void DoDeactivate();
+                    
+    // From base class CGSPluginInterface
+    
+        /**
+         * From CGSPluginInterface
+         * See base class definition
+         */
+        void GetCaptionL( TDes& aCaption ) const;
+
+        /**
+         * From CGSPluginInterface
+         * See base class definition
+         */
+        CGulIcon* CreateIconL( const TUid aIconType );   
+    
+    protected: // From MEikMenuObserver
+
+        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+    
+    private:  // From MUPnPFileSharingEngineObserver
+
+        /**
+         * Function informs when file sharing was enabled or disabled
+         * @param aError, error code
+         * @param aEnabled ETrue if sharing was enabled, otherwise EFalse
+         */
+        void OnSharingStatusChanged( TInt aError, TBool aEnabled );
+
+        /**
+         * Function informs when file sharing is ready
+         * @param aError, error code
+         */
+        void OnSharingDone( TInt /*aError*/ ) {}
+
+        /**
+         * Informs about status of the sharing progress
+         * @since S60 3.1
+         * @param aProgressInfo Data type to contain information about \
+                  sharing progress
+        */                                          
+        void OnSharingProgress( 
+            const RArray<TUpnpProgressInfo>& /*aProgress*/ ) {}
+
+        /**
+         * Callback to inform if connection has been lost
+         * @since S60 3.1
+         */ 
+        void OnSharingConnectionLost();
+        
+    private:
+
+        /**
+         * Default constructor.
+         */
+        CUPnPGSPluginView();
+
+        /**
+         * Second phase constructor.
+         */
+        void ConstructL();
+    
+        /**
+         * Sets text by resource ID in title pane.
+         *
+         * @since S60 3.1
+         * @param aResourceId, The ID of outline number to displayed next.
+         */
+        void SetTitlePaneTextL( const TInt aResourceId );    
+
+    private: // data
+
+        /**
+         * Setting list
+         */
+        CUPnPAppSettingsList*               iSettingItemList;   // owned
+
+        /**
+         * Resource file offset
+         */
+        TInt                                iResFileOffset;
+        
+        /**
+         * Control environment for file session
+         */
+        CEikonEnv*                          iCoeEnv;            // not owned
+        
+        CUPnPFileSharingEngine*         iFileSharing; //owned
+         // iap ids
+        TInt                            iSharingState;
+        
+        /**
+         * View's ui to close when plugin is beign closed
+         */
+        TVwsViewId iViewToClose;
+
+    };
+
+#endif // UPNPGSPLUGINVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/inc/upnpsettingitemmemoryselection.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Definition for UPnP memory selection setting item
+*
+*/
+
+
+
+
+
+
+#ifndef C_MSSETTINGITEMMMC_H
+#define C_MSSETTINGITEMMMC_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+#include <CAknMemorySelectionSettingItemMultiDrive.h>
+
+// CLASS DECLARATION
+
+/**
+ * CUPnPSettingItemMemorySelection class.
+ */
+NONSHARABLE_CLASS( CUPnPSettingItemMemorySelection ): 
+    public CAknMemorySelectionSettingItemMultiDrive
+    {
+    public: // Constructor and destructor
+
+       
+
+        /**
+         * NewL
+         * 2-phase constructor.
+         */
+        static CUPnPSettingItemMemorySelection* NewL( TInt aIdentifier,
+                                        TDriveNumber& aSelectedDrive );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUPnPSettingItemMemorySelection();
+
+
+    protected: // From CAknSettingItem
+
+        /**
+        * This method activates the memory selection dialog
+        */
+        void EditItemL( TBool aCalledFromMenu );
+        
+    private:
+
+
+        /**
+         * ConstructL
+         * Second phase constructor.
+         */
+        void ConstructL();
+        
+          /**
+          * Constructor.
+          */
+        CUPnPSettingItemMemorySelection(
+            TInt aIdentifier,
+            TDriveNumber& aSelectedDrive );        
+
+    };
+
+#endif // C_MSSETTINGITEMMMC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/src/upnpappsettingitemhomeiap.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,616 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implements home network IAP setting item class to home
+*                network setting item list.
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <StringLoader.h>           // stringloader
+#include <aknmessagequerydialog.h>  // caknmessagequerydialog
+#include <aknradiobuttonsettingpage.h> // caknradiobuttonsettingpage
+#include <WlanCdbCols.h>            // wlan_service
+#include <wlanmgmtcommon.h>         // twlanssid
+#include <agentdialog.h>            // rgenconagentdialogserver
+#include <aknnotewrappers.h>        // cakninformationnote
+#include <cmmanager.h>
+#include <cmconnectionmethoddef.h>
+#include <commdb.h>                 //CCommsDatabase          
+#include "upnpavcontrollerfactory.h"
+#include "upnpsettingsengine.h"
+#include "upnpsettingsengine.hrh"
+
+// internal
+#include "upnpappsettingitemhomeiap.h"
+#include "upnpappsettingslist.h"    // ewlanunsecured
+#include "upnpfilesharingengine.h"  // cupnpfilesharingengine
+
+#include <upnpgspluginrsc.rsg>
+
+_LIT( KComponentLogfile, "upnpgsplugin.txt");
+#include "upnplog.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::NewL()
+// --------------------------------------------------------------------------
+//
+UPnPAppSettingItemHomeIAP* UPnPAppSettingItemHomeIAP::NewL(
+    TInt aIdentifier,
+    TInt& aIAPSetting,
+    TInt& aIAPId,
+    TInt& aWAPId,
+    TBool& aSharingState )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    UPnPAppSettingItemHomeIAP* self = new (ELeave) UPnPAppSettingItemHomeIAP(
+        aIdentifier,
+        aIAPSetting,
+        aIAPId,
+        aWAPId,
+        aSharingState );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::UPnPAppSettingItemHomeIAP()
+// --------------------------------------------------------------------------
+//
+UPnPAppSettingItemHomeIAP::UPnPAppSettingItemHomeIAP(
+    TInt aIdentifier,
+    TInt& aIAPSetting,
+    TInt& aIAPId,
+    TInt& aWAPId,
+    TBool& aSharingState ) :
+    CAknEnumeratedTextPopupSettingItem(aIdentifier, aIAPSetting),
+    iIAPSetting(aIAPSetting),
+    iIAPId(aIAPId),
+    iWAPId(aWAPId),
+    iSharingState( aSharingState )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::ConstructL()
+// --------------------------------------------------------------------------
+//
+void UPnPAppSettingItemHomeIAP::ConstructL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iCoeEnv = CCoeEnv::Static();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::~UPnPAppSettingItemHomeIAP()
+// --------------------------------------------------------------------------
+//
+UPnPAppSettingItemHomeIAP::~UPnPAppSettingItemHomeIAP()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    delete iItemText;
+    delete iIAPName;
+
+    iIAPIdArray.Close();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingPageHomeIAP::CreateAndExecuteSettingPageL ()
+// --------------------------------------------------------------------------
+//
+void UPnPAppSettingItemHomeIAP::CreateAndExecuteSettingPageL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // if sharing is on, only information note is displayed
+    UPnPAVControllerFactory::TAVControllerServerStatus status;
+    UPnPAVControllerFactory::Status( status );
+    if ( iSharingState || status == UPnPAVControllerFactory::EStatusActive )
+        {
+        CAknInformationNote* note = new (ELeave) CAknInformationNote;
+        HBufC* noteText = iCoeEnv->AllocReadResourceLC(
+            R_QTN_IUPNP_IAP_TURN_SHARING_OFF);
+        note->ExecuteLD(*noteText);
+        CleanupStack::PopAndDestroy(noteText);
+        return;
+        }
+
+    // Resets the member array for iap ids.
+    // Creates new array for iap names.
+    iIAPIdArray.Reset();
+    CDesCArray* array = new (ELeave) CDesCArrayFlat(5);
+    CleanupStack::PushL(array);
+
+    // adds static setting page items from resource
+    // and stores the number of static items.
+    AddStaticItemsL(array);
+    TInt staticItemCount = array->Count();
+    
+    // adds wlan access points, array GETS the ownership
+    CUPnPSettingsEngine::GetWLANAccessPointsL( array, iIAPIdArray );
+    
+    MAknQueryValue* qValue = QueryValue();
+    User::LeaveIfNull(qValue);
+    LoadL();
+    StoreL();
+
+    TInt idx = GetIAPIndex( staticItemCount );
+    if ( idx >= array->MdcaCount() )
+        {
+        idx = array->MdcaCount() - 1;
+        }
+    // setting page is launched
+    CAknSettingPage* dlg = new (ELeave) CAknRadioButtonSettingPage(
+        SettingPageResourceId(),
+        idx,
+        array);
+
+    if (dlg->ExecuteLD())
+        {
+        switch (idx)
+            {
+            case EUPnPSettingsEngineIAPItemNone:
+                {
+                DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
+                             R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT,
+                             R_HOMECONNECT_INFO_QUERY);
+                qValue->SetCurrentValueIndex(EUPnPSettingsEngineIAPItemNone);
+                iIAPId = EUPnPSettingsEngineIAPIdNone;
+                iIAPSetting = EUPnPSettingsEngineIAPItemNone;
+                break;
+                }
+            case EUPnPSettingsEngineIAPItemAlwaysAsk:
+                {
+                qValue->SetCurrentValueIndex(EUPnPSettingsEngineIAPItemAlwaysAsk);
+                iIAPId = EUPnPSettingsEngineIAPIdAlwaysAsk;
+                iIAPSetting = EUPnPSettingsEngineIAPItemAlwaysAsk;
+                DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
+                             R_IBU_GALLERY_UPDATE_NOTE_TEXT,
+                             R_HOMECONNECT_INFO_QUERY);
+                break;
+                }
+            case EUPnPSettingsEngineIAPItemUserDefined: // Create new
+                {
+                // new iap wlan iap creation is started here
+                
+                TInt old_iap = iIAPId;
+                
+                CUPnPSettingsEngine::CreateAccessPointL();
+                
+                //We have to re-get all the wlan iaps again since
+                //user may modify the iap list   
+                RArray<TInt64> newArray;
+                CleanupClosePushL( newArray );
+                
+                //We only are interested in the iap ids
+                CUPnPSettingsEngine::GetWLANAccessPointsL(
+                                                    NULL, 
+                                                    newArray );
+                
+                if( newArray.Count() <= 0 ) //if no iap exisits
+                    {
+                    //if previous iap is not "None" or "Always ask"
+                    if( old_iap > EUPnPSettingsEngineIAPIdAlwaysAsk )
+                        {
+                        DisplayInfoL(
+                            R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
+                            R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT,
+                            R_HOMECONNECT_INFO_QUERY);
+                        iIAPId = EUPnPSettingsEngineIAPIdNone;
+                        
+                        qValue->SetCurrentValueIndex(
+                                            EUPnPSettingsEngineIAPItemNone );
+                        iIAPSetting = EUPnPSettingsEngineIAPItemNone;
+                        }
+                    iIAPIdArray.Reset();
+                    CleanupStack::PopAndDestroy( &newArray );
+                    }
+                else
+                    {
+                    TBool newiap = ETrue;
+                    TInt lastItemIndex = newArray.Count() - 1;
+                    //if the last item on the new iap list 
+                    //is found in the old iap array
+                    //then we think no new iap is created
+                    for( TInt i = 0; i < iIAPIdArray.Count(); i++ )
+                        {                        
+                        if( newArray[lastItemIndex] == iIAPIdArray[i] )
+                            {
+                            newiap = EFalse; 
+                            i = iIAPIdArray.Count();
+                            }
+                        }
+                    
+                    //get the new iap list
+                    iIAPIdArray.Reset();
+                    for( TInt i = 0; i < newArray.Count(); i++ )
+                        {
+                        iIAPIdArray.AppendL( newArray[i] );
+                        }                        
+                    CleanupStack::PopAndDestroy( &newArray );
+                    
+                    if( newiap )
+                        {
+                        iIAPId = iIAPIdArray[lastItemIndex];//get new iap
+                        iIAPSetting = 
+                                EUPnPSettingsEngineIAPItemUserDefined;
+                        // show confirmation note if connection is 
+                        // unsecured, the database store the value of
+                        // the securitymode,such as EOpen,EWep,E802_1x,
+                        // EWpa,if select other securitymode except 
+                        // EOpen, the return value of the 
+                        // CheckAPSecurityL fuction is not EWLanUnsecured
+                        if ( CheckAPSecurityL(iIAPId) == EWLanUnsecured )
+                            {
+                            CAknQueryDialog* dlg = 
+                                                CAknQueryDialog::NewL();
+                            if (!(dlg->ExecuteLD(
+                            R_UNSECURED_CONNECTIONS_CONFIRMATION_QUERY)))
+                                {
+                                //user cancels the dialog
+                                UsePreviousIapL( old_iap ); 
+                                }
+                            }
+                        else
+                            {
+                            // show 'Sharing Changed' note ( None -> sharing)
+                            if(old_iap == EUPnPSettingsEngineIAPIdNone &&
+                               iIAPId != old_iap )
+                                {
+                                DisplayInfoL(
+                                     R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
+                                     R_IBU_GALLERY_UPDATE_NOTE_TEXT,
+                                     R_HOMECONNECT_INFO_QUERY);
+                                }  
+                            }    
+                        }
+                    else 
+                        {
+                        UsePreviousIapL(old_iap);
+                        } //if( newiap )
+                    } //if( newArray.Count() <= 0 )
+                break;
+                }
+            default: // Predefined iap is selected
+                {
+                TInt index;
+                TInt old_iap = iIAPId;
+                TBool iapchange = EFalse;
+                // iap id is set
+                if ( idx - staticItemCount >= 0 )
+                    {
+                    index = idx - staticItemCount;
+                    if (CheckAPSecurityL(iIAPIdArray[index]) ==
+                        EWLanUnsecured)
+                        {
+                        // show confirmation note if connection is unsecured
+                        CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+                        if (dlg->ExecuteLD(
+                            R_UNSECURED_CONNECTIONS_CONFIRMATION_QUERY))
+                            {
+                            //if "Continue"
+                            iapchange = ETrue;
+                            }
+                        }
+                    else
+                        {
+                        iapchange = ETrue;
+                        }
+                   
+                    if( iapchange )
+                        {
+                        iIAPSetting = EUPnPSettingsEngineIAPItemUserDefined;
+                        iIAPId = iIAPIdArray[index];
+                        qValue->SetCurrentValueIndex(
+                            EUPnPSettingsEngineIAPItemUserDefined);
+
+                        // if previous iap was 'None' and current iap
+                        // is not 'None'
+                        if ( old_iap == EUPnPSettingsEngineIAPIdNone &&
+                             iIAPId != old_iap )
+                            {
+                            DisplayInfoL(
+                                R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
+                                R_IBU_GALLERY_UPDATE_NOTE_TEXT,
+                                R_HOMECONNECT_INFO_QUERY);
+                            }
+                        }
+                    }
+                break;
+                }
+            }
+        }
+    LoadL();
+    StoreL();
+
+    CleanupStack::PopAndDestroy(array);
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::ChangeIAPNameL()
+// --------------------------------------------------------------------------
+//
+void UPnPAppSettingItemHomeIAP::ChangeIAPNameL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    delete iIAPName;
+    iIAPName = NULL;
+    
+    iIAPName = CUPnPSettingsEngine::GetCurrentIapNameL( iIAPId );
+    
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::CheckAPSecurity
+// Checks if selected access point is unsecured and shows warning note
+// --------------------------------------------------------------------------
+//
+TInt UPnPAppSettingItemHomeIAP::CheckAPSecurityL(TInt aAccessPoint)
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TUint32 serviceId = 0;
+    TUint32 securityMode = 0;
+
+    CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeIAP );
+    CleanupStack::PushL( db );
+
+    CCommsDbTableView* view = db->OpenViewMatchingUintLC(TPtrC(IAP),
+                              TPtrC(COMMDB_ID), aAccessPoint);
+
+    TInt error = view->GotoFirstRecord();
+
+    if( error == KErrNone )
+        {
+        view->ReadUintL(TPtrC(IAP_SERVICE), serviceId);
+        }
+
+    CCommsDbTableView* wLanServiceTable = NULL;
+
+    TRAPD(err,
+    {// this leaves if the table is empty....
+    wLanServiceTable = db->OpenViewMatchingUintLC(
+        TPtrC( WLAN_SERVICE ),
+        TPtrC( WLAN_SERVICE_ID ),
+        serviceId );
+    CleanupStack::Pop( wLanServiceTable );
+    });
+
+    if ( err == KErrNone )
+        {
+        CleanupStack::PushL( wLanServiceTable );
+
+        TInt errorCode = wLanServiceTable->GotoFirstRecord();
+
+        if ( errorCode == KErrNone )
+            {//read securityMode value
+            wLanServiceTable->ReadUintL(TPtrC( WLAN_SECURITY_MODE ),
+                                        securityMode );
+            }
+
+        CleanupStack::PopAndDestroy(wLanServiceTable);
+        }
+
+    else if (err != KErrNotFound)
+        {
+        User::LeaveIfError(err);
+        }
+
+    CleanupStack::PopAndDestroy(2); // view, db
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+
+    return securityMode;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsList::DisplayInfoL();
+// Shows message query to user
+// --------------------------------------------------------------------------
+//
+void UPnPAppSettingItemHomeIAP::DisplayInfoL(TInt aHeaderResourceId,
+                                             TInt aMessageResourceId,
+                                             TInt aDialogResourceId)
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    HBufC* noteHeader = StringLoader::LoadL(
+        aHeaderResourceId);
+    CleanupStack::PushL(noteHeader);
+    HBufC* noteMsg = StringLoader::LoadL(
+        aMessageResourceId);
+    CleanupStack::PushL(noteMsg);
+
+    CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*noteMsg);
+
+    dlg->PrepareLC(aDialogResourceId);
+    dlg->QueryHeading()->SetTextL(*noteHeader);
+    dlg->RunLD();
+
+    CleanupStack::PopAndDestroy(noteMsg);
+    CleanupStack::PopAndDestroy(noteHeader);
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::SettingTextL()
+// --------------------------------------------------------------------------
+//
+const TDesC& UPnPAppSettingItemHomeIAP::SettingTextL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    delete iItemText;
+    iItemText = NULL;
+    LoadL();
+    StoreL();
+
+    switch ( iIAPSetting )
+        {
+        case EUPnPSettingsEngineIAPItemAlwaysAsk:
+            {
+            iItemText = iCoeEnv->AllocReadResourceL(
+                R_QTN_IUPNP_ITEM_HOME_IAP_ALWAYS_ASK );
+            break;
+            }
+        case EUPnPSettingsEngineIAPItemUserDefined:
+            {
+            // changes iap name according to iap id
+            ChangeIAPNameL();
+
+            if ( !iIAPName )
+                {
+                iItemText = iCoeEnv->AllocReadResourceL(
+                    R_QTN_IUPNP_ITEM_HOME_IAP_USER_DEFINED );
+                }
+            else
+                {
+                iItemText = iIAPName->AllocL();
+                }
+
+            break;
+            }
+        case EUPnPSettingsEngineIAPItemNone:
+            {
+            iItemText = iCoeEnv->AllocReadResourceL(
+                R_QTN_IUPNP_ITEM_HOME_IAP_NONE );
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return *iItemText;
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::AddStaticItemsL()
+// --------------------------------------------------------------------------
+//
+void UPnPAppSettingItemHomeIAP::AddStaticItemsL(CDesCArray* aArray)
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // None
+    HBufC* buf = iCoeEnv->AllocReadResourceLC(
+        R_QTN_IUPNP_HOME_IAP_NONE);
+    aArray->AppendL(*buf);
+    CleanupStack::PopAndDestroy(buf); // buf
+    buf = NULL;
+
+    // Always ask
+    buf = iCoeEnv->AllocReadResourceLC(
+        R_QTN_IUPNP_HOME_IAP_ALWAYS_ASK);
+    aArray->AppendL(*buf);
+    CleanupStack::PopAndDestroy(buf);
+    buf = NULL;
+
+    // Create new
+    buf = iCoeEnv->AllocReadResourceLC(
+        R_QTN_IUPNP_HOME_IAP_CREATE_NEW);
+    aArray->AppendL(*buf);
+    CleanupStack::PopAndDestroy(buf);
+    buf = NULL;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::UsePreviousIapL()
+// --------------------------------------------------------------------------
+//
+void UPnPAppSettingItemHomeIAP::UsePreviousIapL( TInt aOldIap )
+    {
+    // dialog cancelled, using old iap value
+    iIAPId = aOldIap;
+    
+    if( iIAPId == EUPnPSettingsEngineIAPIdNone )
+        {
+        iIAPSetting = EUPnPSettingsEngineIAPItemNone;
+        }
+    else if( iIAPId == EUPnPSettingsEngineIAPIdAlwaysAsk )
+        {
+        iIAPSetting = EUPnPSettingsEngineIAPItemAlwaysAsk;
+        }
+    else //search for the old iap
+        {
+        TBool oldiapthere = EFalse;
+        for( TInt i = 0; i < iIAPIdArray.Count(); i++ )
+            {
+            if( iIAPId == iIAPIdArray[i] )
+                {
+                oldiapthere = ETrue;
+                i = iIAPIdArray.Count();
+                }
+            }
+        if( !oldiapthere )
+            {
+            iIAPId = EUPnPSettingsEngineIAPIdNone;
+            iIAPSetting = EUPnPSettingsEngineIAPItemNone;
+            DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
+                             R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT,
+                             R_HOMECONNECT_INFO_QUERY);
+            }
+        else
+            {
+            iIAPSetting = EUPnPSettingsEngineIAPItemUserDefined;
+            }    
+        }   
+    }
+    
+// --------------------------------------------------------------------------
+// UPnPAppSettingItemHomeIAP::GetIAPIndex()
+// --------------------------------------------------------------------------
+//
+TInt UPnPAppSettingItemHomeIAP::GetIAPIndex( TInt aStaticCount )
+    {
+    __LOG("GetIAPIndex");  
+    TInt iapIndex = KErrNotFound;
+    if( iIAPId == EUPnPSettingsEngineIAPIdNone ) //NONE
+        {
+        iapIndex = EUPnPSettingsEngineIAPItemNone;
+        }
+    else if( iIAPId == EUPnPSettingsEngineIAPIdAlwaysAsk ) //ALWAYS ASK
+        {
+        iapIndex = EUPnPSettingsEngineIAPItemAlwaysAsk;
+        }
+    else //pre-defined iap, index should never be Create New
+        {
+        iapIndex+=aStaticCount;
+        for( TInt i = 0; i < iIAPIdArray.Count(); i++ )
+            {
+            iapIndex++;
+            __LOG1("iap %d", iIAPIdArray[i] );  
+            if( iIAPId == iIAPIdArray[i] )
+                {
+                i = iIAPIdArray.Count();
+                }
+            }
+        }
+        
+    return iapIndex;    
+    }    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/src/upnpappsettingitemmydevicename.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implements home network my device name setting item class to
+*                home network setting item list.
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpappsettingitemmydevicename.h"
+#include <aknnotewrappers.h>                // CAknInformationNote
+#include <upnpgspluginrsc.rsg>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// UPnPAppSettingItemMyDeviceName::NewL()
+// ---------------------------------------------------------
+//
+UPnPAppSettingItemMyDeviceName* UPnPAppSettingItemMyDeviceName::NewL(
+    TInt aIdentifier,
+    TDes& aText,
+    TBool& aSharingState )
+    {
+    UPnPAppSettingItemMyDeviceName* self = new (ELeave)
+        UPnPAppSettingItemMyDeviceName(
+        aIdentifier,
+        aText,
+        aSharingState );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------
+// UPnPAppSettingItemMyDeviceName::UPnPAppSettingItemMyDeviceName()
+// ----------------------------------------------------------------
+//
+UPnPAppSettingItemMyDeviceName::UPnPAppSettingItemMyDeviceName(
+    TInt aIdentifier,
+    TDes& aText,
+    TBool& aSharingState ) :
+    CAknTextSettingItem(aIdentifier, aText),
+    iSharingState( aSharingState )
+    {
+    }
+
+// ---------------------------------------------------------
+// UPnPAppSettingItemMyDeviceName::ConstructL()
+// ---------------------------------------------------------
+//
+void UPnPAppSettingItemMyDeviceName::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------
+// UPnPAppSettingItemMyDeviceName::~UPnPAppSettingItemMyDeviceName()
+// -----------------------------------------------------------------
+//
+UPnPAppSettingItemMyDeviceName::~UPnPAppSettingItemMyDeviceName()
+    {
+    }
+
+// ---------------------------------------------------------
+// UPnPAppSettingItemMyDeviceName::EditItemL()
+// ---------------------------------------------------------
+//
+void UPnPAppSettingItemMyDeviceName::EditItemL(TBool aCalledFromMenu)
+    {
+
+    // if sharing is on, only information note is displayed
+    if ( iSharingState )
+        {
+        CAknInformationNote* note = new (ELeave)
+            CAknInformationNote;
+        HBufC* noteText = CCoeEnv::Static()->AllocReadResourceLC(
+            R_QTN_IUPNP_IAP_TURN_SHARING_OFF);
+        note->ExecuteLD(*noteText);
+        CleanupStack::PopAndDestroy(noteText);
+        }
+    else
+        {
+        // normal behaviour
+        CAknTextSettingItem::EditItemL(aCalledFromMenu);
+        }
+
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/src/upnpappsettingslist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,327 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Setting list implementation for upnp GS plugin
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include <aknnotewrappers.h>       // CAknInformationNote
+#include <pathinfo.h> 
+#include <upnpstring.h>
+
+#include "upnpsettingsengine.h"
+#include "upnpsettingsengine.hrh"
+
+#include "upnpgsplugin.hrh"
+#include "upnpappsettingslist.h"
+#include "upnpappsettingitemhomeiap.h"
+#include "upnpappsettingitemmydevicename.h"
+#include <upnpgspluginrsc.rsg>
+
+#include <AknCommonDialogsDynMem.h>
+#include <CAknMemorySelectionDialogMultiDrive.h>
+#include "upnpsettingitemmemoryselection.h"
+
+_LIT( KComponentLogfile, "upnpgsplugin.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsList::CUPnPAppSettingsList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPAppSettingsList::CUPnPAppSettingsList( TBool& aSharingState )
+    : iSharingState( aSharingState )
+    {
+    __LOG("[gsplugin]\tCUPnPAppSettingsList::CUPnPAppSettingsList");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPAppSettingsList::ConstructL( TInt aResourceId )
+    {
+    __LOG("[gsplugin]\t CUPnPAppSettingsList::ConstructL");
+
+    iName = HBufC8::NewL( KMaxFriendlyNameLength );
+
+    iSettingsEngine = CUPnPSettingsEngine::NewL();
+    
+    if( aResourceId != 0 )
+        {
+        CAknSettingItemList::ConstructFromResourceL( aResourceId );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsList::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAppSettingsList* CUPnPAppSettingsList::NewL( TBool& aSharingState,
+                                                  TInt aResourceId )
+    {
+    __LOG("[gsplugin]\t CUPnPAppSettingsList::NewL");
+
+    CUPnPAppSettingsList* self = new (ELeave) CUPnPAppSettingsList(
+        aSharingState );
+    CleanupStack::PushL(self);
+    self->ConstructL( aResourceId );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsList::~CUPnPAppSettingsList
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPAppSettingsList::~CUPnPAppSettingsList()
+    {
+    __LOG("[gsplugin]\t CUPnPAppSettingsList:: \
+            ~CUPnPAppSettingsList");
+    delete iName;
+    delete iSettingsEngine;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsList::CreateSettingItemL
+// Creates list items
+// --------------------------------------------------------------------------
+//
+CAknSettingItem* CUPnPAppSettingsList::CreateSettingItemL( TInt aIdentifier )
+    {
+    __LOG("[gsplugin]\t CUPnPAppSettingsList::CreateSettingItemL");
+
+    LoadSettingsL();
+
+    CAknSettingItem* settingItem = NULL;
+    switch (aIdentifier)
+        {
+    case EUPnPGSPluginItemIAP:
+        {
+        settingItem = UPnPAppSettingItemHomeIAP::NewL( 
+                aIdentifier,
+                iIapSetting, iIapId, 
+                iWapId, 
+                iSharingState );
+        break;
+        }
+    case EUPnPGSPluginItemMyDeviceName:
+        {
+        settingItem = UPnPAppSettingItemMyDeviceName::NewL(
+            aIdentifier,
+            iFriendlyName,
+            iSharingState );
+        break;
+        }
+    case EUPnPGSPluginItemCopyLocation:
+        {
+        settingItem = CUPnPSettingItemMemorySelection::NewL(
+            aIdentifier, iCopyLocationDrive);
+        }
+        break;
+
+    default:
+        {
+        __LOG("[gsplugin]\t CUPnPAppSettingsList:: \
+                    CreateSettingItemL No such item!");
+        break;
+        }
+        }
+
+    return settingItem;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsList::EditItemL
+// Called when setting list item is modified
+// --------------------------------------------------------------------------
+//
+void  CUPnPAppSettingsList::EditItemL (TInt aIndex, TBool aCalledFromMenu)
+    {
+    __LOG("[gsplugin]\t CUPnPAppSettingsList::EditItemL");
+    
+    // Validates the access point.
+    TBool validiap = EFalse;
+    TRAPD(err, validiap = CUPnPSettingsEngine::IsAccessPointValidL( iIapId ) );
+    if( err || !validiap )
+        {
+        iIapId = EUPnPSettingsEngineIAPIdNone;
+        iIapSetting = EUPnPSettingsEngineIAPItemNone;
+        iWapId = EUPnPSettingsEngineIAPItemNone;
+        }
+
+    if ( aIndex != EUPnPGSPluginItemCopyLocation )
+        {
+        CAknSettingItemList::EditItemL (aIndex, aCalledFromMenu);
+        }
+
+    StoreSettingsL();
+
+    switch (aIndex)
+        {
+    case EUPnPGSPluginItemIAP:
+        {
+        // if sharing is on, nothing is done
+        if ( !iSharingState )
+            {
+            iSettingsEngine->SetAccessPoint(iIapId);
+            iSettingsEngine->SetAccessPointSetting(iIapSetting);
+            iSettingsEngine->SetWapId(iWapId);
+            }
+        break;
+        }
+    case EUPnPGSPluginItemMyDeviceName:
+        {
+        // if sharing is on, nothing is done
+        if ( !iSharingState )
+            {
+            HBufC8* tmpStr = NULL;    
+            tmpStr = UpnpString::FromUnicodeL( iFriendlyName );
+            CleanupStack::PushL( tmpStr );
+
+            User::LeaveIfError(
+                iSettingsEngine->SetLocalFriendlyName( tmpStr->Des() ));
+            CleanupStack::PopAndDestroy( tmpStr );
+            }
+        break;
+        }
+    case EUPnPGSPluginItemCopyLocation:
+        {
+        // if sharing is on, nothing is done
+        if ( !iSharingState )
+            {
+            CAknSettingItemList::EditItemL ( aIndex, aCalledFromMenu );
+            StoreSettingsL();
+            iSettingsEngine->SetCopyLocationL( iCopyLocationDrive );
+            }
+        else
+            {
+            CAknInformationNote* note = new (ELeave)
+                CAknInformationNote;
+            HBufC* noteText = CCoeEnv::Static()->AllocReadResourceLC(
+                R_QTN_IUPNP_IAP_TURN_SHARING_OFF);
+            note->ExecuteLD(*noteText);
+            CleanupStack::PopAndDestroy(noteText);
+            }
+
+        break;
+        }
+    default:
+        {
+        __LOG("[gsplugin]\t CUPnPAppSettingsList::EditItemL \
+                    No such item!");
+        break;
+        }
+        }
+    StoreSettingsL();
+    // load settings to screen
+    CAknSettingItemList::LoadSettingsL ();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsList::LoadDataFromEngineL
+// Loads data from Central Repository to member variables
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+void  CUPnPAppSettingsList::LoadDataFromEngineL()
+    {
+    __LOG("[gsplugin]\t CUPnPAppSettingsList::\
+        LoadDataFromEngineL begin");
+
+    // Get friendly name
+    TPtr8 ptr( iName->Des() );
+    iSettingsEngine->GetLocalFriendlyName( ptr );
+
+    HBufC* unicodeFriendlyName = UpnpString::ToUnicodeL( ptr );
+    CleanupStack::PushL( unicodeFriendlyName );
+    iFriendlyName.Copy( unicodeFriendlyName->Des() );
+    CleanupStack::PopAndDestroy( unicodeFriendlyName );
+
+    iSettingsEngine->GetAccessPoint( iIapId );
+    iSettingsEngine->GetAccessPointSetting(iIapSetting);
+
+    iSettingsEngine->GetWapId(iWapId);
+
+    TInt error( KErrNone );
+
+    TRAP(error, iSettingsEngine->GetCopyLocationDriveL( iCopyLocationDrive ) )
+
+    // Something wrong in getting copy location. It defaults to 
+    // drive C and hopes that setting copy location succeeds
+    if( error != KErrNone )
+        {
+        iCopyLocationDrive = EDriveC;
+        }
+    
+    // check if the IAP id is valid
+    if ( !CUPnPSettingsEngine::IsAccessPointValidL( iIapId ) )
+        {
+        // Resets all variables related to iap.
+        iIapId = EUPnPSettingsEngineIAPIdNone;
+        iIapSetting = EUPnPSettingsEngineIAPItemNone;
+        iWapId = EUPnPSettingsEngineIAPItemNone;
+
+        // set iap id
+        iSettingsEngine->SetAccessPoint( iIapId );
+        // set iap UI setting
+        iSettingsEngine->SetAccessPointSetting( iIapSetting );
+        // set iap wap id (needed for focus in iap selection component)
+        iSettingsEngine->SetWapId( iWapId );
+        }
+
+    //load settings to screen
+    CAknSettingItemList::LoadSettingsL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsList::HandleResourceChange
+// --------------------------------------------------------------------------
+//
+void CUPnPAppSettingsList::HandleResourceChange( TInt aType )
+    {
+    __LOG("[gsplugin]\t CUPnPAppSettingsList::\
+HandleResourceChange");
+
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect mainPaneRect;
+        AknLayoutUtils::LayoutMetricsRect(
+            AknLayoutUtils::EMainPane, mainPaneRect );
+
+        TAknLayoutRect layoutRect;
+        layoutRect.LayoutRect(
+            TRect( TPoint( 0, 0 ), mainPaneRect.Size() ),
+            AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
+
+        ListBox()->SetRect( layoutRect.Rect() );
+        }
+
+    // Base call
+    CAknSettingItemList::HandleResourceChange( aType );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/src/upnpgspluginimplementationtable.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      ECOM proxy table for GSDataCallPlugin
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include "upnpgspluginview.h"
+#include "upnpgsplugin.hrh"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h> 
+
+_LIT( KComponentLogfile, "upnpgsplugin.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TImplementationProxy KUPnPGSPluginImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 
+            KUPnPGSPluginImplementationUid, 
+            CUPnPGSPluginView::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// 
+// Gate/factory function
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+                                                  TInt& aTableCount )
+    {
+    __LOG( "CUPnPGSPluginView::ImplementationGroupProxy" );
+    aTableCount = sizeof( KUPnPGSPluginImplementationTable ) 
+        / sizeof( TImplementationProxy );
+    __LOG( "CUPnPGSPluginView::ImplementationGroupProxy-end" );    
+    return KUPnPGSPluginImplementationTable;
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/src/upnpgspluginview.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,352 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUPnPGSPluginView class implementation
+*
+*/
+
+
+
+
+
+
+
+#include <upnpgspluginrsc.rsg>
+#include <hlplch.h>
+#include <avkon.mbg>
+#include <bautils.h>
+#include <gsfwviewuids.h>
+#include <aknnavide.h>
+#include <StringLoader.h>
+#include <featmgr.h>
+#include <akntitle.h>
+#include <pathinfo.h>
+#include <upnpgspluginrsc.mbg>
+
+#include "upnpappsettingslist.h"
+#include "upnpfilesharingengine.h"
+#include "upnpgsplugin.hrh"
+#include "upnpgspluginview.h"
+#include "upnpsettingsengine.h"
+
+_LIT( KComponentLogfile, "upnpgsplugin.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TUid KUPnPGSPluginImpUid = { KUPnPGSPluginImplementationUid };
+
+_LIT( KUPnPGSPluginRscFile, "\\resource\\upnpgspluginrsc.rsc" );
+_LIT( KAknHomeConnectMbmFileName, "\\resource\\apps\\upnpgspluginrsc.mif" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Two phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPGSPluginView* CUPnPGSPluginView::NewL()
+    {
+    CUPnPGSPluginView* self = new ( ELeave ) CUPnPGSPluginView();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPluginView::CUPnPGSPluginView()
+// --------------------------------------------------------------------------
+//
+CUPnPGSPluginView::CUPnPGSPluginView()
+    {
+    __LOG("CUPnPGSPluginView::CUPnPGSPluginView");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPluginView::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CUPnPGSPluginView::ConstructL()
+    {
+        __LOG( "CUPnPGSPlugin::ConstructL" );
+    // Get the pointer to coe env (owned by Eikon env)
+    iCoeEnv = CEikonEnv::Static();
+    
+    if( !iCoeEnv )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Get the filesession reference from coe env
+    RFs& fileSession = iCoeEnv->FsSession();
+
+    // Load resource file
+    TFileName rscFileName( KUPnPGSPluginRscFile );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive );
+
+    // Get the exact filename of the resource file
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+
+    // Check if the resource file exists or not
+    if ( !BaflUtils::FileExists( fileSession, rscFileName ) )
+        {
+        __LOG( "[UpnpCommand]\t Resource file does not exist!" );
+        User::Leave( KErrNotFound );
+        }
+
+    // Read the resource file offset
+    iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName );
+
+    BaseConstructL( R_GS_UPNP_VIEW );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPluginView::~CUPnPGSPluginView()
+// --------------------------------------------------------------------------
+//
+CUPnPGSPluginView::~CUPnPGSPluginView()
+    {
+    __LOG("CMSMainView::~CUPnPGSPluginView");
+
+    if ( iResFileOffset )
+        {
+        iCoeEnv->DeleteResourceFile( iResFileOffset );
+        }
+
+    DoDeactivate();
+    }
+
+// --------------------------------------------------------------------------
+// TUid CUPnPGSPluginView::Id()
+// --------------------------------------------------------------------------
+//
+TUid CUPnPGSPluginView::Id() const
+    {
+    __LOG("CUPnPGSPluginView::Id");
+
+    return KUPnPGSPluginImpUid;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPluginView::HandleCommandL(TInt aCommand)
+// --------------------------------------------------------------------------
+//
+void CUPnPGSPluginView::HandleCommandL( TInt aCommand )
+    {
+    switch ( aCommand )
+        {
+        
+        case EAknSoftkeyChange:
+            {
+            TInt selectedItem = 
+                iSettingItemList->ListBox()->CurrentItemIndex();
+            iSettingItemList->EditItemL(selectedItem, ETrue);
+            
+            // fix ESLX-7LYLR7
+            iSettingItemList->DrawNow();
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            AppUi()->ActivateLocalViewL( iViewToClose.iViewUid );
+            break;
+            }
+        case EAknCmdHelp :
+            {
+            TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL(
+                        iEikonEnv->WsSession(),
+            iEikonEnv->EikAppUi()->AppHelpContextL() ));
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPluginView::DoActivateL(...)
+// --------------------------------------------------------------------------
+//
+void CUPnPGSPluginView::DoActivateL(
+   const TVwsViewId& aPrevViewId, TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/ )
+    {
+    __LOG("CUPnPGSPluginView::DoActivateL");
+
+    iViewToClose = aPrevViewId;
+
+    // Set title pane text to default
+    SetTitlePaneTextL( R_UPNP_GS_SETTINGS_VIEW_TITLE );
+
+    if( !iFileSharing )
+        {
+        iFileSharing = CUPnPFileSharingEngine::NewL();
+        iFileSharing->SetObserver( this );
+        }
+
+    if ( !iSettingItemList )
+        {
+        iSharingState = static_cast<TInt>( iFileSharing->SharingStateL() );
+        // create settings screen
+        iSettingItemList = 
+                       CUPnPAppSettingsList::NewL( iSharingState,
+                                                   R_UPNP_GS_SETTINGS_LIST );
+        iSettingItemList->SetMopParent( this );
+        iSettingItemList->LoadDataFromEngineL();
+        // now control receives keyboard events
+        AppUi()->AddToStackL( *this, iSettingItemList );
+        iSettingItemList->ActivateL();
+        }
+
+   }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPluginView::DoDeactivate()
+// --------------------------------------------------------------------------
+//
+void CUPnPGSPluginView::DoDeactivate()
+    {
+    __LOG("CUPnPGSPluginView::DoDeactivate");
+
+    if( iFileSharing )
+        {
+        iFileSharing->SetObserver( NULL );
+        }
+    delete iFileSharing;
+    iFileSharing = NULL;
+
+    if ( iSettingItemList )
+        {
+        AppUi()->RemoveFromStack( iSettingItemList );
+        }
+
+    delete iSettingItemList; // Deletes the container class object.
+    iSettingItemList = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// Method for getting caption of this plugin.
+// --------------------------------------------------------------------------
+//
+void CUPnPGSPluginView::GetCaptionL( TDes& aCaption ) const
+    {
+    HBufC* pluginText = StringLoader::LoadLC( 
+                                        R_UPNP_GS_SETTINGS_VIEW_CAPTION );
+    aCaption.Copy( *pluginText );
+    CleanupStack::PopAndDestroy( pluginText );
+    }
+
+// --------------------------------------------------------------------------
+// Creates a new icon of desired type.
+// --------------------------------------------------------------------------
+//
+CGulIcon* CUPnPGSPluginView::CreateIconL( const TUid /*aIconType*/ )
+    {
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName() );
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC( 
+                         skin,
+                         KAknsIIDDefault,
+                         bitmap,
+                         mask,
+                         KAknHomeConnectMbmFileName,
+                         EMbmUpnpgspluginrscQgn_menu_upnp_homemedia,
+                         EMbmUpnpgspluginrscQgn_menu_upnp_homemedia_mask );
+                             
+    CGulIcon* icon = CGulIcon::NewL(bitmap, mask);
+    CleanupStack::Pop(mask);
+    CleanupStack::Pop(bitmap);
+    bitmap = NULL;
+    mask = NULL;
+
+    return icon;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPluginView::SetTitlePaneTextL()
+// Sets text to title pane.
+// --------------------------------------------------------------------------
+void CUPnPGSPluginView::SetTitlePaneTextL( TInt aResourceId )
+    {
+    // Fetches pointer to the default title pane control.
+    CAknTitlePane* titlePane = static_cast<CAknTitlePane*>(
+        StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+
+    TBuf<KMaxFileName> titleText( 0 );
+    iCoeEnv->ReadResourceL( titleText, aResourceId );
+    titlePane->SetTextL( titleText );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPlugin::DynInitMenuPaneL()
+//
+// dynamically handle help item if not supported
+// --------------------------------------------------------------------------
+//
+void CUPnPGSPluginView::DynInitMenuPaneL( TInt aResourceId, 
+                                          CEikMenuPane* aMenuPane )
+    {   
+    if( aResourceId == R_HOMECONNECT_SETTINGS_MENU )
+        {
+        User::LeaveIfNull( aMenuPane );
+        
+        if ( FeatureManager::FeatureSupported( KFeatureIdHelp ))
+            {
+            aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPlugin::OnSharingStatusChanged
+// From MUPnPFileSharingEngineObserver
+// Function informs when file sharing was enabled or disabled
+// --------------------------------------------------------------------------
+//
+void CUPnPGSPluginView::OnSharingStatusChanged( 
+    TInt aError, TBool aEnabled )
+    {
+    __LOG("CUPnPGSPlugin::OnSharingStatusChanged");
+    if ( !aError )
+        {
+        iSharingState = aEnabled;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPGSPluginView::OnSharingConnectionLost
+// From MUPnPFileSharingEngineObserver
+// Callback to inform if connection has been lost
+// --------------------------------------------------------------------------
+//
+void CUPnPGSPluginView::OnSharingConnectionLost()
+    {
+    iSharingState = EFalse;
+    }
+    
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpgsplugin/src/upnpsettingitemmemoryselection.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUPnPSettingItemMemorySelection class implementation
+*
+*/
+
+
+
+
+
+
+#include <upnpgspluginrsc.rsg>
+#include <StringLoader.h>
+#include <akncheckboxsettingpage.h>
+#include <AknCommonDialogsDynMem.h>
+#include <CAknMemorySelectionDialogMultiDrive.h>
+
+#include "upnpsettingitemmemoryselection.h"
+
+_LIT( KComponentLogfile, "upnpgsplugin.txt");
+#include "upnplog.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CUPnPSettingItemMemorySelection::NewL
+// --------------------------------------------------------------------------
+//
+CUPnPSettingItemMemorySelection* CUPnPSettingItemMemorySelection::NewL(
+                                TInt aIdentifier,
+                                TDriveNumber& aSelectedDrive )
+    {
+    __LOG("[gsplugin]\t CUPnPSettingItemMemorySelection::NewL");
+
+    CUPnPSettingItemMemorySelection* self =
+        new (ELeave) CUPnPSettingItemMemorySelection(
+            aIdentifier,
+            aSelectedDrive );
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingItemMemorySelection::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUPnPSettingItemMemorySelection::ConstructL()
+    {
+        __LOG("[gsplugin]\t\
+CUPnPSettingItemMemorySelection::ConstructL");
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingItemMemorySelection::~CUPnPSettingItemMemorySelection()
+// --------------------------------------------------------------------------
+//
+CUPnPSettingItemMemorySelection::~CUPnPSettingItemMemorySelection()
+    {
+        __LOG("[gsplugin]\t\
+CUPnPSettingItemMemorySelection::~CUPnPSettingItemMemorySelection");
+
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingItemMemorySelection::EditItemL( TBool aCalledFromMenu )
+// --------------------------------------------------------------------------
+//
+void CUPnPSettingItemMemorySelection::EditItemL( TBool /*aCalledFromMenu*/ )
+    {
+    __LOG("[gsplugin]\t CUPnPSettingItemMemorySelection::EditItemL");
+    
+    CAknMemorySelectionDialogMultiDrive* dlg =
+        CAknMemorySelectionDialogMultiDrive::NewL(
+            ECFDDialogTypeNormal,
+            0,
+            EFalse,
+            AknCommonDialogsDynMem::EMemoryTypePhone |
+            AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage |
+            AknCommonDialogsDynMem::EMemoryTypeMMCExternal 
+            );
+            
+            CleanupStack::PushL(dlg);
+
+            if (dlg->ExecuteL(iInternalData))
+            {
+                // Call CAknMemorySelectionSettingItemMultiDrive::StoreL()
+                StoreL();
+            }
+
+            CleanupStack::PopAndDestroy(dlg);
+    
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingItemMemorySelection::CUPnPSettingItemMemorySelection
+// --------------------------------------------------------------------------
+//
+CUPnPSettingItemMemorySelection::CUPnPSettingItemMemorySelection(
+    TInt aIdentifier,
+    TDriveNumber& aSelectedDrive//,
+     ) :
+    CAknMemorySelectionSettingItemMultiDrive( aIdentifier, aSelectedDrive )
+    {
+    }
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsettingsengine/bwins/upnpsettingsengineu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,23 @@
+EXPORTS
+	??1CUPnPSettingsEngine@@UAE@XZ @ 1 NONAME ; CUPnPSettingsEngine::~CUPnPSettingsEngine(void)
+	?CreateAccessPointL@CUPnPSettingsEngine@@SAXXZ @ 2 NONAME ; void CUPnPSettingsEngine::CreateAccessPointL(void)
+	?GetAccessPoint@CUPnPSettingsEngine@@QAEHAAH@Z @ 3 NONAME ; int CUPnPSettingsEngine::GetAccessPoint(int &)
+	?GetAccessPointSetting@CUPnPSettingsEngine@@QAEHAAH@Z @ 4 NONAME ; int CUPnPSettingsEngine::GetAccessPointSetting(int &)
+	?GetCopyLocationDriveL@CUPnPSettingsEngine@@QBEXAAW4TDriveNumber@@@Z @ 5 NONAME ; void CUPnPSettingsEngine::GetCopyLocationDriveL(enum TDriveNumber &) const
+	?GetCopyLocationL@CUPnPSettingsEngine@@QBEXAAVTDes16@@AAH@Z @ 6 NONAME ; void CUPnPSettingsEngine::GetCopyLocationL(class TDes16 &, int &) const
+	?GetCurrentIapNameL@CUPnPSettingsEngine@@SAPAVHBufC16@@H@Z @ 7 NONAME ; class HBufC16 * CUPnPSettingsEngine::GetCurrentIapNameL(int)
+	?GetFirstStart@CUPnPSettingsEngine@@QAEHAAH@Z @ 8 NONAME ; int CUPnPSettingsEngine::GetFirstStart(int &)
+	?GetLocalFriendlyName@CUPnPSettingsEngine@@QBEHAAVTDes8@@@Z @ 9 NONAME ; int CUPnPSettingsEngine::GetLocalFriendlyName(class TDes8 &) const
+	?GetWLANAccessPointsL@CUPnPSettingsEngine@@SAXPAVCDesC16Array@@AAV?$RArray@_J@@@Z @ 10 NONAME ; void CUPnPSettingsEngine::GetWLANAccessPointsL(class CDesC16Array *, class RArray<long long> &)
+	?GetWapId@CUPnPSettingsEngine@@QAEHAAH@Z @ 11 NONAME ; int CUPnPSettingsEngine::GetWapId(int &)
+	?IsAccessPointValidL@CUPnPSettingsEngine@@SAHH@Z @ 12 NONAME ; int CUPnPSettingsEngine::IsAccessPointValidL(int)
+	?NewL@CUPnPSettingsEngine@@SAPAV1@XZ @ 13 NONAME ; class CUPnPSettingsEngine * CUPnPSettingsEngine::NewL(void)
+	?NewLC@CUPnPSettingsEngine@@SAPAV1@XZ @ 14 NONAME ; class CUPnPSettingsEngine * CUPnPSettingsEngine::NewLC(void)
+	?SetAccessPoint@CUPnPSettingsEngine@@QAEHH@Z @ 15 NONAME ; int CUPnPSettingsEngine::SetAccessPoint(int)
+	?SetAccessPointSetting@CUPnPSettingsEngine@@QAEHH@Z @ 16 NONAME ; int CUPnPSettingsEngine::SetAccessPointSetting(int)
+	?SetCopyLocationL@CUPnPSettingsEngine@@QBEHW4TDriveNumber@@@Z @ 17 NONAME ; int CUPnPSettingsEngine::SetCopyLocationL(enum TDriveNumber) const
+	?SetFirstStart@CUPnPSettingsEngine@@QAEHH@Z @ 18 NONAME ; int CUPnPSettingsEngine::SetFirstStart(int)
+	?SetLocalFriendlyName@CUPnPSettingsEngine@@QBEHABVTDesC8@@@Z @ 19 NONAME ; int CUPnPSettingsEngine::SetLocalFriendlyName(class TDesC8 const &) const
+	?SetManufacturerParamsL@CUPnPSettingsEngine@@QBEHXZ @ 20 NONAME ; int CUPnPSettingsEngine::SetManufacturerParamsL(void) const
+	?SetWapId@CUPnPSettingsEngine@@QAEHH@Z @ 21 NONAME ; int CUPnPSettingsEngine::SetWapId(int)
+
Binary file upnpsettings/upnpsettingsengine/cenrep/20009CAE.txt has changed
Binary file upnpsettings/upnpsettingsengine/cenrep/keys_upnpsettingsengine.xls has changed
Binary file upnpsettings/upnpsettingsengine/conf/upnpsettingsengine.confml has changed
Binary file upnpsettings/upnpsettingsengine/conf/upnpsettingsengine_20009CAE.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsettingsengine/eabi/upnpsettingsengineu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,27 @@
+EXPORTS
+	_ZN19CUPnPSettingsEngine13GetFirstStartERi @ 1 NONAME
+	_ZN19CUPnPSettingsEngine13SetFirstStartEi @ 2 NONAME
+	_ZN19CUPnPSettingsEngine14GetAccessPointERi @ 3 NONAME
+	_ZN19CUPnPSettingsEngine14SetAccessPointEi @ 4 NONAME
+	_ZN19CUPnPSettingsEngine18CreateAccessPointLEv @ 5 NONAME
+	_ZN19CUPnPSettingsEngine18GetCurrentIapNameLEi @ 6 NONAME
+	_ZN19CUPnPSettingsEngine19IsAccessPointValidLEi @ 7 NONAME
+	_ZN19CUPnPSettingsEngine20GetWLANAccessPointsLEP12CDesC16ArrayR6RArrayIxE @ 8 NONAME
+	_ZN19CUPnPSettingsEngine21GetAccessPointSettingERi @ 9 NONAME
+	_ZN19CUPnPSettingsEngine21SetAccessPointSettingEi @ 10 NONAME
+	_ZN19CUPnPSettingsEngine4NewLEv @ 11 NONAME
+	_ZN19CUPnPSettingsEngine5NewLCEv @ 12 NONAME
+	_ZN19CUPnPSettingsEngine8GetWapIdERi @ 13 NONAME
+	_ZN19CUPnPSettingsEngine8SetWapIdEi @ 14 NONAME
+	_ZN19CUPnPSettingsEngineD0Ev @ 15 NONAME
+	_ZN19CUPnPSettingsEngineD1Ev @ 16 NONAME
+	_ZN19CUPnPSettingsEngineD2Ev @ 17 NONAME
+	_ZNK19CUPnPSettingsEngine16GetCopyLocationLER6TDes16Ri @ 18 NONAME
+	_ZNK19CUPnPSettingsEngine16SetCopyLocationLE12TDriveNumber @ 19 NONAME
+	_ZNK19CUPnPSettingsEngine20GetLocalFriendlyNameER5TDes8 @ 20 NONAME
+	_ZNK19CUPnPSettingsEngine20SetLocalFriendlyNameERK6TDesC8 @ 21 NONAME
+	_ZNK19CUPnPSettingsEngine21GetCopyLocationDriveLER12TDriveNumber @ 22 NONAME
+	_ZNK19CUPnPSettingsEngine22SetManufacturerParamsLEv @ 23 NONAME
+	_ZTI19CUPnPSettingsEngine @ 24 NONAME ; #<TI>#
+	_ZTV19CUPnPSettingsEngine @ 25 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsettingsengine/group/backup_registration.xml	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,4 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+    <proxy_data_manager SID="0x10202BE9" />
+</backup_registration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsettingsengine/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for project SettingsEngine
+*
+*/
+
+
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+// Central repository default keys
+../cenrep/20009CAE.txt    /epoc32/release/winscw/udeb/z/private/10202be9/20009cae.txt
+../cenrep/20009CAE.txt    /epoc32/release/winscw/urel/z/private/10202be9/20009cae.txt
+../cenrep/20009CAE.txt    /epoc32/release/armv5/udeb/z/private/10202be9/20009cae.txt
+../cenrep/20009CAE.txt    /epoc32/release/armv5/urel/z/private/10202be9/20009cae.txt
+../conf/upnpsettingsengine.confml              APP_LAYER_CONFML(upnpsettingsengine.confml)
+../conf/upnpsettingsengine_20009CAE.crml       APP_LAYER_CRML(upnpsettingsengine_20009CAE.crml)
+
+// Backup registration file
+#ifndef __COMMDB_PROTECTION
+backup_registration.xml  /epoc32/data/z/private/20009CAE/backup_registration.xml  
+backup_registration.xml  /epoc32/release/winscw/udeb/z/private/20009CAE/backup_registration.xml 
+backup_registration.xml  /epoc32/release/winscw/urel/z/private/20009CAE/backup_registration.xml
+#endif
+
+
+// ADO internal interfaces
+../inc/upnpsettingsengine.h        |../../../inc/upnpsettingsengine.h
+../inc/upnpsettingsengine.hrh      |../../../inc/upnpsettingsengine.hrh
+../inc/upnpapplicationcrkeys.h     |../../../inc/upnpapplicationcrkeys.h
+
+PRJ_MMPFILES
+upnpsettingsengine.mmp
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsettingsengine/group/upnpsettingsengine.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project SettingsEngine
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET upnpsettingsengine.dll
+TARGETTYPE dll
+UID 0x1000008d 0x20009CAE
+
+// Enable UPnPSecurity
+MACRO ENABLE_UPNP_SECURITY
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+//User include paths
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+
+// System include paths
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH ../src
+SOURCE upnpsettingsengine.cpp
+
+LIBRARY euser.lib
+LIBRARY bafl.lib
+LIBRARY centralrepository.lib
+LIBRARY upnpserviceframework.lib
+LIBRARY avmediaserverclient.lib
+LIBRARY upnpipserversutils.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+
+// PathInfo
+LIBRARY PlatformEnv.lib
+LIBRARY commdb.lib
+
+// Connection Manager, new APIs for getting IAPs, etc.
+LIBRARY cmmanager.lib
+LIBRARY apengine.lib 
+
+DEBUGLIBRARY flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsettingsengine/inc/upnpapplicationcrkeys.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Key definitions used in central repository
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPAPPLICATIONCRKEYS_H
+#define UPNPAPPLICATIONCRKEYS_H
+
+#include <e32std.h>
+
+/**
+ * Software Installer settings
+ *
+ */
+const TUid KCRUidUPnPApplication = {0x20009cae};
+
+/**
+ * KUPnPAppAccessPointSetting
+ * Defines the used access point setting for UPnP.
+ *
+ */
+const TUint32 KUPnPAppAccessPointSetting = 0x00000001;
+
+/**
+ * KUPnPAppWapId
+ * Defines the iap wap id for Home Network application.
+ *
+ */
+const TUint32 KUPnPAppWapId = 0x00000002;
+
+/**
+ * KUPnPAppFirstStart
+ * Defines if this is the first start of the home network
+ */
+const TUint32 KUPnPAppFirstStart = 0x00000003;
+
+/**
+ * KUPnPAppMediaServerIcon
+ * Defines if the icon is set to mediaserver
+ */
+const TUint32 KUPnPAppMediaServerIcon = 0x00000004;
+
+
+#endif  // UPNPAPPLICATIONCRKEYS_H
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsettingsengine/inc/upnpsettingsengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,288 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Settings Engine class definition
+ *
+*/
+
+
+
+
+
+
+#ifndef __UPNPSETTINGSENGINE_H__
+#define __UPNPSETTINGSENGINE_H__
+
+// INCLUDE FILES
+
+#include <e32base.h>    // CBase
+#include <e32std.h>     // TBuf
+
+// CONSTANTS
+const TInt KMaxFriendlyNameLength( 64 );
+
+// FORWARD DECLARATIONS
+class CRepository;
+class CUpnpSettings;
+class CUpnpMediaServerSettings;
+
+// CLASS DECLARATION
+/**
+ *  Settings engine class for UPnP Home Connect Application
+ *  @lib upnpapplicationengine.lib
+ *  @since S60 3.1
+ */
+class CUPnPSettingsEngine : public CBase
+    {
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CUPnPSettingsEngine* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CUPnPSettingsEngine* NewLC();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CUPnPSettingsEngine();
+        
+        
+public: // new functions
+
+    /**
+     * Sets friendly name
+     * @since S60 3.1
+     * @param aFriendlyName, reference containing the new friendly name
+     * @return TInt,  indicates the success of the call
+     */
+    IMPORT_C TInt SetLocalFriendlyName( 
+        const TDesC8& aFriendlyName ) const;
+
+    /**
+     * Gets friendly name
+     * @since S60 3.1
+     * @param aFriendlyName, reference where name is updated
+     * @return TInt, indicates the success of the call
+     */
+    IMPORT_C TInt GetLocalFriendlyName( 
+        TDes8& aFriendlyName ) const;
+
+
+    /**
+     * Sets selected Access point
+     * @since S60 3.1
+     * @param aIAP, the IAP id
+     * @return TInt, TInt indicates the success of the call
+     */
+    IMPORT_C TInt SetAccessPoint( const TInt aIAP );
+        
+        
+    /**
+     * Gets Access Point information
+     * @since S60 3.1
+     * @param aIAP, reference where IAP id is put
+     * @return TInt, indicates the success of the call
+     */
+    IMPORT_C TInt GetAccessPoint( TInt& aIAP );
+        
+        
+    /**
+     * Sets selected Access point setting
+     * @since S60 3.1
+     * @param aIAPSetting, the IAP setting
+     * @return TInt, TInt indicates the success of the call
+     */
+    IMPORT_C TInt SetAccessPointSetting( const TInt aIAPSetting );
+        
+        
+    /**
+     * Gets Access Point setting
+     * @since S60 3.1
+     * @param aIAPSetting, reference to access point setting
+     * @return TInt, indicates the success of the call
+     */
+    IMPORT_C TInt GetAccessPointSetting( TInt& aIAPSetting );
+        
+        
+    /**
+     * Sets selected wap access point id
+     * @since S60 3.1
+     * @param aWapId, the wap access point id
+     * @return TInt, TInt indicates the success of the call
+     */
+    IMPORT_C TInt SetWapId( const TInt aWapId );
+        
+        
+    /**
+     * Gets selected wap access point id
+     * @since S60 3.1
+     * @param aWapId, reference to wap access point id
+     * @return TInt, TInt indicates the success of the call
+     */
+    IMPORT_C TInt GetWapId( TInt& aWapId );
+
+    /**
+     * Gets information if this is the first start of home network
+     * @since S60 3.1
+     * @param aFirstStart, reference to first start information
+     * @return TInt, TInt indicates the success of the call
+     */
+    IMPORT_C TInt GetFirstStart( TInt& aFirstStart );
+
+    /**
+     * Sets information if this is the first start of home network
+     * @since S60 3.1
+     * @param const aFirstStart, the new first start value
+     * @return TInt, TInt indicates the success of the call
+     */
+    IMPORT_C TInt SetFirstStart( const TInt aFirstStart );
+        
+    /**
+     * Sets the mandatory manufacturer settings to media server
+     * @since S60 3.1
+     * @return TInt, TInt indicates the success of the call
+     */
+    IMPORT_C TInt SetManufacturerParamsL() const;
+
+    /**
+     * Gets the drive for the copy operation
+     * @since S60 3.2
+     * @param aDrive, reference to copy location drive
+     */
+    IMPORT_C void GetCopyLocationDriveL( TDriveNumber& aDrive ) const;
+
+    /**
+     * Gets the location for the copy operation
+     * @since S60 3.2
+     * @param aLocation, path for copy location
+     * @param aIsPhoneMemory, tells if used location is internal phone memory
+     */
+    IMPORT_C void GetCopyLocationL( TDes& aLocation, 
+                                    TBool& aIsPhoneMemory ) const;
+
+    /**
+     * Sets the location of the copy operation
+     * @since S60 3.2
+     * @param aDrive The drive number of the new location 
+     * as defined in TDriveNumber.
+     * @return TInt, TInt indicates the success of the call
+     */
+    IMPORT_C TInt SetCopyLocationL( const TDriveNumber aDrive ) const;
+
+    /**
+     * Get the name of the current IAP if it is set and is not always ask
+     * @since S60 5.1
+     * @param aIapId, iap id
+     * @return HBufC, iap name. Ownership is transferred to the caller
+     * if IAP is set to None
+     */
+    IMPORT_C static HBufC* GetCurrentIapNameL( TInt aIapId );
+    
+    /**
+     * Static helper method to validate iap by id.
+     * 
+     * @since S60 5.1
+     * @param aIapId, Id of the iap to be validated.
+     * @return ETrue if given iap id is valid. EFalse otherwise.
+     */
+    IMPORT_C static TBool IsAccessPointValidL( TInt aIapId );
+        
+    /**
+     * Static helper method to retrieve info of access points into given
+     * arrays.
+     * 
+     * @since S60 5.1
+     * @param aNameArray,  array contains the iap names
+     * @param aIapIdArr, Array for iap ids.
+     */
+    IMPORT_C static void GetWLANAccessPointsL( CDesCArray* aNameArray,
+                                               RArray<TInt64>& aIapIdArr );
+    
+    /**
+     * Static helper method to create the iap editing window
+     * arrays.
+     * 
+     * @since S60 5.1
+     * @param none
+     */        
+    IMPORT_C static void CreateAccessPointL();
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUPnPSettingsEngine();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Reads device model, it is in form "Nokia xxxx"
+     * Note: Does not return correct value in subcon R&D builds
+     * @since S60 3.1
+     * @param aModel Device model
+     * @return TInt, TInt indicates the success of the call
+     */
+    TInt ReadDeviceModelL( TDes8& aModel ) const;
+
+    /**
+     * Gets friendly name, internal version
+     * @since S60 3.1
+     * @param aFriendlyName, reference where name is updated
+     * @return TInt, indicates the success of the call
+     */
+    TInt GetLocalFriendlyNameL( 
+        TDes8& aFriendlyName ) const;
+
+    /**
+     * Initializes a property if property has not yet been set
+     * @since S60 3.1
+     * @param aSettings, MediaServer settings 
+     * @param aKey, Propery's id
+     * @param aValue, New propery's value
+     */
+    void InitializePropertyL( 
+        CUpnpMediaServerSettings& aSettings, 
+        TInt aKey, 
+        const TDesC8& aValue ) const;
+    
+    /**
+     * Helper method to validate wlan access points.
+     * 
+     * @since S60 5.1
+     * @param aIapId, Id of the iap to be validated.
+     * @return ETrue if given iap is found from the comms db and
+     * id is valid. EFalse otherwise.
+     */
+    static TBool IsWLANAccessPointValidL( TUint32 aIapId );
+
+private:    // data
+
+    // Central Repository
+    CRepository*                    iRepository;
+    // Repository for upnp settings
+    CUpnpSettings*                  iUpnpRepository;
+    
+    };
+
+#endif  // __UPNPSETTINGSENGINE_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsettingsengine/inc/upnpsettingsengine.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resource headers for project upnpsettingsengine.
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPSETTINGSENGINE_HRH
+#define UPNPSETTINGSENGINE_HRH
+
+/**
+ * List of supported access point items.
+ */
+enum TUPnPSettingsEngineIAPItem
+    {
+    EUPnPSettingsEngineIAPItemNone = 0,
+    EUPnPSettingsEngineIAPItemAlwaysAsk,
+    EUPnPSettingsEngineIAPItemUserDefined
+    };
+
+/**
+ * List of UPnPSettingsEngine specific IAP ids.
+ */
+enum TUPnPSettingsEngineIAPId
+    {
+    EUPnPSettingsEngineIAPIdCreateNew = -2,
+    EUPnPSettingsEngineIAPIdNone = -1,
+    EUPnPSettingsEngineIAPIdAlwaysAsk = 0
+    };
+
+#endif // UPNPSETTINGSENGINE_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsettingsengine/src/upnpsettingsengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,759 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      UPnP settings engine class implementation
+*
+*/
+
+
+
+
+
+
+
+//  Include Files
+
+#include <centralrepository.h>
+#include <s32file.h>
+#include <upnpstring.h>
+#include <pathinfo.h> //PathInfo
+#include <upnpmediaserversettings.h>
+
+#include <cmsettingsui.h> // CCmSettingsUi
+#include <cmmanager.h>   // RCmManager
+#include <cmconnectionmethoddef.h>
+#include <commdb.h> // CCommsDatabase
+#include <cdbcols.h>
+#include <WlanCdbCols.h>  // WLAN_SERVICE
+#include <wlanmgmtcommon.h>
+
+#include "upnpsettingsengine.h"
+#include "upnpsettingsengine.hrh"
+#include "upnpapplicationcrkeys.h"
+
+#include "upnpsettings.h"
+
+_LIT( KComponentLogfile, "upnpsettingsengine.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT8( KManufacturerName, "Nokia");
+_LIT( KDummyIAP, "DummyIAP");
+
+// upload directory
+_LIT( KUploadDirectoryCDrive, "\\data\\Download\\Media\\" );
+_LIT( KUploadDirectory, "\\Download\\Media\\" );
+_LIT( KModelFile, "\\resource\\versions\\model.txt" );
+_LIT8( KModel, "Nokia X" );
+_LIT8( KManufacturerUrl, "http://www.nokia.com");
+_LIT8( KModelUrl, "http://www.nseries.com");
+const TInt KMaxNameLength = 128;
+const TUint KUidWlanBearerType = 0x10281BB1;
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::CUPnPSettingsEngine
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPSettingsEngine::CUPnPSettingsEngine()
+    {
+    __LOG("CUPnPSettingsEngine::CUPnPSettingsEngine()");
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPSettingsEngine* CUPnPSettingsEngine::NewLC()
+    {
+    __LOG("CUPnPSettingsEngine::NewLC()");
+
+    CUPnPSettingsEngine* self = new (ELeave) CUPnPSettingsEngine;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPSettingsEngine* CUPnPSettingsEngine::NewL()
+    {
+    __LOG("CUPnPSettingsEngine::NewL()");
+
+    CUPnPSettingsEngine* self = CUPnPSettingsEngine::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPSettingsEngine::ConstructL()
+    {
+    iRepository = CRepository::NewL( KCRUidUPnPApplication );
+    iUpnpRepository = CUpnpSettings::NewL(KCRUidUPnPStack);
+
+    //set model, ManufacturerUrl, and ModelUrl into UpnpMediaServerSettings
+    SetManufacturerParamsL();
+    }
+
+
+// Destructor
+EXPORT_C CUPnPSettingsEngine::~CUPnPSettingsEngine()
+    {
+    __LOG("CUPnPSettingsEngine::~CUPnPSettingsEngine()");
+
+    delete iRepository;
+    iRepository = NULL;
+    delete iUpnpRepository;
+    iUpnpRepository = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::SetLocalFriendlyName
+// Sets friendly name to Central Repository
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::SetLocalFriendlyName(
+    const TDesC8& aFriendlyName ) const
+    {
+    __LOG("CUPnPSettingsEngine::SetLocalFriendlyName()");
+
+    TBuf8<KMaxNameLength> name;
+    name.Copy(aFriendlyName);
+    TInt err( KErrNone );
+    TRAP_IGNORE(
+        CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
+        CleanupStack::PushL(settings);
+        err = settings->SetL( UpnpMediaServerSettings::EFriendlyName, name);
+        CleanupStack::PopAndDestroy(settings);
+        );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::GetLocalFriendlyName
+// Gets friendly name from Central Repository.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::GetLocalFriendlyName(
+    TDes8& aFriendlyName ) const
+    {
+    __LOG("CUPnPSettingsEngine::GetLocalFriendlyName()");
+    TInt err( KErrNone );
+    TRAP(err, err = GetLocalFriendlyNameL( aFriendlyName ) );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::GetLocalFriendlyNameL
+// Gets friendly name from Central Repository.
+// --------------------------------------------------------------------------
+//
+TInt CUPnPSettingsEngine::GetLocalFriendlyNameL(
+    TDes8& aFriendlyName ) const
+    {
+    __LOG("CUPnPSettingsEngine::GetLocalFriendlyNameL()");
+    
+    CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( settings );
+    HBufC8 *tmp = settings->GetL( UpnpMediaServerSettings::EFriendlyName );
+    
+    //check if there is any name for the device
+    if ( !tmp->Length() )
+        {
+        //no name available, try to get the device model name as the 
+        //device name
+        
+        // Read device model
+        delete tmp; tmp = NULL;
+        
+        //string ownership transferred
+        tmp = settings->GetL( UpnpMediaServerSettings::
+                              EModelName );
+                              
+        if ( tmp->Length() )
+            {
+            //if device model name is available
+            aFriendlyName.Copy( *tmp );
+            }
+        else
+            {
+            // final try if reading model name fails, use manufacturer name
+            // as device name
+            aFriendlyName.Copy( KManufacturerName );
+            }
+        }
+    else
+        {
+        aFriendlyName.Copy( *tmp );
+        }
+    delete tmp; tmp = NULL;
+    CleanupStack::PopAndDestroy( settings );
+    return KErrNone;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::SetAccessPoint
+// Sets IAP to Central Repository
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::SetAccessPoint( const TInt aIAP )
+    {
+    TInt value = aIAP; // remove constness
+    return iUpnpRepository->Set(CUpnpSettings::KUPnPStackIapId, value );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::GetAccessPoint
+// Gets IAP from Central Repository.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::GetAccessPoint( TInt& aIAP )
+    {
+    return iUpnpRepository->Get(CUpnpSettings::KUPnPStackIapId, aIAP );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::SetAccessPointSetting
+// Sets IAP setting to Central Repository
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::SetAccessPointSetting(
+    const TInt aIAPSetting )
+    {
+    return iRepository->Set( KUPnPAppAccessPointSetting, aIAPSetting );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::GetAccessPointSetting
+// Gets IAP setting from Central Repository.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::GetAccessPointSetting( TInt& aIAPSetting )
+    {
+    return iRepository->Get( KUPnPAppAccessPointSetting, aIAPSetting );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::SetWapId
+// Sets iap wap id to Central Repository
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::SetWapId( const TInt aWapId )
+    {
+    return iRepository->Set( KUPnPAppWapId, aWapId );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::GetWapId
+// Gets iap wap id from Central Repository
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::GetWapId( TInt& aWapId )
+    {
+    return iRepository->Get( KUPnPAppWapId, aWapId );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::GetFirstStart
+// Gets information if this is the first start of home network
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::GetFirstStart( TInt& aFirstStart )
+    {
+    TInt err ( iRepository->Get( KUPnPAppFirstStart, aFirstStart ));
+    if ( aFirstStart )
+        {
+        TRAP_IGNORE(
+        RFs fs;
+        err = fs.Connect();
+        CleanupClosePushL( fs );
+        TVolumeInfo volumeInfo;
+        TDriveUnit driveUnit;
+        TInt err = fs.Volume(volumeInfo, EDriveE);
+        if( err == KErrNone && volumeInfo.iFree > 0)
+            {
+            driveUnit = TDriveUnit( PathInfo::MemoryCardRootPath() );
+            }
+        else
+            {
+            driveUnit = TDriveUnit( PathInfo::PhoneMemoryRootPath() );
+            }
+
+        CleanupStack::PopAndDestroy( &fs );
+        SetCopyLocationL( (TDriveNumber)((TInt)driveUnit) ));
+        }
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::SetFirstStart
+// Sets information if this is the first start of home network
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::SetFirstStart( const TInt aFirstStart )
+    {
+    return iRepository->Set( KUPnPAppFirstStart, aFirstStart );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::SetManufacturerParamsL
+// Sets the mandatory manufacturer settings
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::SetManufacturerParamsL() const
+    {
+    __LOG("CUPnPSettingsEngine::SetManufacturerParamsL()");
+    CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( settings );
+
+    // Manufacturer
+    InitializePropertyL( *settings, 
+                         UpnpMediaServerSettings::EManufacturer, 
+                         KManufacturerName );
+
+    // Model name
+    HBufC8* model = HBufC8::NewLC( KMaxFileName );
+    TPtr8 modelPtr( model->Des() );
+    TInt err = ReadDeviceModelL( modelPtr );
+    if( err )
+        {
+        model->Des().Copy( KModel );
+        }
+    InitializePropertyL( *settings, 
+                         UpnpMediaServerSettings::EModelName, 
+                         *model );
+    // Friendly name
+    InitializePropertyL( *settings, 
+                         UpnpMediaServerSettings::EFriendlyName, 
+                         *model );
+    CleanupStack::PopAndDestroy( model );
+
+    // Manufacturer url
+    InitializePropertyL( *settings, 
+                         UpnpMediaServerSettings::EManufacturerUrl, 
+                         KManufacturerUrl );
+
+    // Model url
+    InitializePropertyL( *settings, 
+                         UpnpMediaServerSettings::EModelUrl, 
+                         KModelUrl );
+
+    CleanupStack::PopAndDestroy( settings );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::ReadDeviceModelL
+// Get device model
+// --------------------------------------------------------------------------
+//
+TInt CUPnPSettingsEngine::ReadDeviceModelL( TDes8& aModel ) const
+    {
+    __LOG("CUPnPSettingsEngine::ReadDeviceModel()");
+    RFs fs;
+    RFile file;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+    
+    HBufC*path = HBufC::NewLC( KMaxFileName );
+    TParse parse;
+    parse.Set( PathInfo::RomRootPath(), NULL, NULL );
+    TPtrC romDrive = parse.Drive();
+    
+    path->Des().Append( romDrive );
+    path->Des().Append( KModelFile() );
+    
+    TInt error ( file.Open(fs, *path, EFileRead ));
+    if ( !error )
+        {
+        CleanupClosePushL( file );
+
+        TFileText txtFile;
+        txtFile.Set( file );
+        HBufC* readBuf = HBufC::NewLC( KMaxFileName );
+        txtFile.Seek( ESeekStart );
+        TPtr bufPtr( readBuf->Des() );
+        error = txtFile.Read( bufPtr ); // read one line
+        if ( !error )
+            {
+            HBufC8* bufbuf = UpnpString::FromUnicodeL( *readBuf );
+            CleanupStack::PushL( bufbuf );
+
+            aModel = *bufbuf;
+            CleanupStack::PopAndDestroy( bufbuf );
+            }
+        CleanupStack::PopAndDestroy( readBuf );
+        CleanupStack::PopAndDestroy( &file ); // Close file
+        }
+    CleanupStack::PopAndDestroy( path );    
+    CleanupStack::PopAndDestroy( &fs );
+
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::GetCopyLocationDriveL
+// Gets the drive of the location for copied files
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPSettingsEngine::GetCopyLocationDriveL( 
+    TDriveNumber& aDrive )
+    const
+    {
+    __LOG("CUPnPSettingsEngine::GetCopyLocationDriveL()");
+
+    HBufC* location = HBufC::NewL(KMaxFileName);
+    CleanupStack::PushL( location );
+    TBool isPhoneMem( EFalse );
+    TPtr locationPtr( location->Des() );
+    GetCopyLocationL( locationPtr, isPhoneMem );
+
+    TDriveUnit driveUnit = TDriveUnit( locationPtr );
+
+    aDrive = (TDriveNumber)((TInt)driveUnit);
+
+    CleanupStack::PopAndDestroy( location );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::GetCopyLocationL
+// Gets the location for copied files
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPSettingsEngine::GetCopyLocationL( TDes& aLocation,
+                                                    TBool& aIsPhoneMemory )
+    const
+    {
+    __LOG("CUPnPSettingsEngine::GetCopyLocationL()");
+
+    // Get instance of Server Settings object
+    CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( settings );
+
+    // Get the location setting from ServerSettings
+    settings->Get( UpnpMediaServerSettings::EUploadDirectory, aLocation );
+
+    // Check to see if drive is ready.
+    TVolumeInfo volInfo;
+    TDriveUnit driveUnit = TDriveUnit( aLocation );
+    RFs fileServer;
+
+    User::LeaveIfError( fileServer.Connect() );
+    CleanupClosePushL( fileServer );
+    TInt error = fileServer.Volume( volInfo, driveUnit );
+    CleanupStack::PopAndDestroy( &fileServer );
+
+    // check if memory is present
+    // Revert to phone memory if location is not available
+    // If the location is full no need to change the location. User will be
+    // informed that memory is full and the location should be changed
+    if( error == KErrNone )
+        {
+        TDriveUnit driveUnit = TDriveUnit( aLocation );    
+        if( driveUnit == EDriveC )
+            {
+            aIsPhoneMemory = ETrue;
+            }
+        else
+            {
+            aIsPhoneMemory = EFalse;
+            }
+        }
+    else
+        {
+        SetCopyLocationL( EDriveC );
+        aIsPhoneMemory = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy( settings );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::SetCopyLocationL
+// Sets the location for copied files
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPSettingsEngine::SetCopyLocationL( 
+    const TDriveNumber aDrive )
+    const
+    {
+    __LOG("CUPnPSettingsEngine::SetCopyLocationL()");
+    TInt err( KErrNone );
+
+    HBufC* path = HBufC::NewL( KMaxFileName );
+    CleanupStack::PushL( path );
+
+    CUpnpMediaServerSettings* settings =
+        CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( settings );
+
+    TDriveUnit driveUnit = TDriveUnit( aDrive );
+    path->Des().Append( driveUnit.Name() );
+    if( aDrive == EDriveC )
+        {
+        path->Des().Append( KUploadDirectoryCDrive );
+        }
+    else
+        {
+        path->Des().Append( KUploadDirectory );
+        }
+
+    err = settings->Set( UpnpMediaServerSettings::EUploadDirectory, *path );
+
+    CleanupStack::PopAndDestroy( settings );
+    CleanupStack::PopAndDestroy( path );
+
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::GetCurrentIapNameL
+// Get iap name
+// --------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CUPnPSettingsEngine::GetCurrentIapNameL( TInt aIapId )
+    {
+    __LOG("CUPnPSettingsEngine::GetCurrentIapNameL() begin");
+    __LOG("read iap");
+    
+    HBufC* name = NULL;
+    if( aIapId > EUPnPSettingsEngineIAPIdAlwaysAsk )
+        {
+        name = HBufC::NewLC( KMaxFileName );
+        TPtr namePtr( name->Des() );
+        CCommsDatabase* db = CCommsDatabase::NewL();
+        CleanupStack::PushL( db );
+        CCommsDbTableView* iapView = db->OpenViewMatchingUintLC(
+            TPtrC(IAP),
+            TPtrC(COMMDB_ID),
+            aIapId );
+        if( iapView )
+            {
+            TInt err = KErrNotFound;
+            err = iapView->GotoFirstRecord();
+            if ( !err )
+                {
+                iapView->ReadTextL(TPtrC(COMMDB_NAME), namePtr );
+                }
+            CleanupStack::PopAndDestroy( iapView );
+            }
+        CleanupStack::PopAndDestroy( db );
+        CleanupStack::Pop( name );
+        }
+    
+    if( !name )
+        {
+        User::LeaveIfError( KErrNotFound );
+        }
+    
+    __LOG("CUPnPSettingsEngine::GetCurrentIapNameL() end");
+    return name;
+    }
+
+//---------------------------------------------------------------------------
+// CUPnPSettingsEngine::IsAccessPointValidL
+// Checks if the given access point is valid.
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool CUPnPSettingsEngine::IsAccessPointValidL( TInt aIapId )
+    {
+    if ( aIapId == EUPnPSettingsEngineIAPIdAlwaysAsk )
+        {
+        // IAP is always ask. Returns true automatically.
+        return ETrue;
+        }
+    else if ( aIapId > EUPnPSettingsEngineIAPIdAlwaysAsk )
+        {
+        // Verifies that IAP exists in the comms db and it is valid.
+        return IsWLANAccessPointValidL( aIapId );
+        }
+    else
+        {
+        // IAP is NONE or some bogus value. Not valid.
+        return EFalse;
+        }
+    }
+
+// -------------------------------------------------------------
+// CUPnPSettingsEngine::GetWLANAccessPointsL
+// Get wlan access points from commsdb
+// -------------------------------------------------------------
+//
+EXPORT_C void CUPnPSettingsEngine::GetWLANAccessPointsL(
+                                    CDesCArray* aNameArray,
+                                    RArray<TInt64>& aIapIdArr )
+    {
+    __LOG("CUPnPSettingsEngine::GetWLANAccessPointsL() begin");
+#ifdef __arm
+    TUint32 bearerType;
+#endif
+
+    RCmManager cmm;
+    cmm.OpenL();
+    CleanupClosePushL ( cmm );
+
+    RArray<TUint32> iapIdArr;    
+    CleanupClosePushL ( iapIdArr );
+
+    //get all the connections, exclude easy wlan
+    cmm.ConnectionMethodL( iapIdArr, EFalse, EFalse, EFalse );
+
+    __LOG1(" total %d", iapIdArr.Count() );
+
+    //Get the iap names
+    for(TInt i = 0; i < iapIdArr.Count(); i++ )
+        {
+#ifdef __arm
+
+        bearerType = cmm.GetConnectionMethodInfoIntL(
+                               iapIdArr[i], CMManager::ECmBearerType );
+
+        __LOG1(" bearerType %d", bearerType);
+
+        if( bearerType == KUidWlanBearerType )
+            {
+#endif
+            __LOG1(" i: %d", i);
+            aIapIdArr.AppendL( iapIdArr[i] );
+
+            if( aNameArray )
+                {
+                HBufC* name = NULL;
+                __LOG(" name ");
+
+                // This can leave in WINSCW env, so catch and handle the
+                // exception
+                TRAPD( getConnectionMethodErr,
+                       name = cmm.GetConnectionMethodInfoStringL(
+                                   iapIdArr[i], CMManager::ECmName );
+                );
+
+                if( getConnectionMethodErr == KErrNone )
+                    {
+                    __LOG16( *name );
+                    CleanupStack::PushL( name );
+                    __LOG(" append name ");
+                    aNameArray->AppendL( *name ); //ownership not transferred
+                    CleanupStack::PopAndDestroy( name );
+                    }
+                else
+                    {
+                    // If failed to get the connection method info string,
+                    // use a dummy IAP name
+                    __LOG( " Failed to get IAP name! Using a dummy name. ");
+                    aNameArray->AppendL( KDummyIAP );
+                    }
+                }
+#ifdef __arm
+            }
+#endif
+
+        }
+
+    CleanupStack::PopAndDestroy( &iapIdArr );
+    CleanupStack::PopAndDestroy( &cmm );
+
+    __LOG1(" aIapIdArr count %d", aIapIdArr.Count() );  
+    __LOG("CUPnPSettingsEngine::GetWLANAccessPointsL() end");
+
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::CreateAccessPointL
+// Create AP modifying window
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPSettingsEngine::CreateAccessPointL()
+    {
+    CCmSettingsUi* settings = CCmSettingsUi::NewL();    
+    CleanupStack::PushL( settings );
+    settings->RunSettingsL();
+    CleanupStack::PopAndDestroy( settings );
+    }
+    
+//---------------------------------------------------------------------------
+// CUPnPSettingsEngine::IsWLANAccessPointValidL
+// Checks if the given access point is valid.
+//---------------------------------------------------------------------------
+//
+TBool CUPnPSettingsEngine::IsWLANAccessPointValidL( TUint32 aIapId )
+    {
+    
+    TBool ret = EFalse;
+    
+    RArray<TInt64> newArray;
+    CleanupClosePushL( newArray );
+    
+    GetWLANAccessPointsL( NULL, newArray );
+    
+    for(TInt i = 0; i < newArray.Count(); i++ )
+        {
+        if( aIapId == newArray[i] )
+            {
+            ret = ETrue;
+            i = newArray.Count(); //quit the loop
+            }
+        }
+    CleanupStack::PopAndDestroy( &newArray ); 
+    
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngine::InitializePropertyL
+// Initializes a property if property has not yet been set
+// --------------------------------------------------------------------------
+//
+void CUPnPSettingsEngine::InitializePropertyL( 
+    CUpnpMediaServerSettings& aSettings, 
+    TInt aKey, 
+    const TDesC8& aValue ) const
+    {
+    HBufC8* currentValue( NULL );
+    TRAPD( err, currentValue = aSettings.GetL( aKey ) );
+    if( !err )
+        {
+        TInt currentLength = currentValue->Length();
+        delete currentValue;
+        currentValue = NULL;
+        if( !currentLength )
+            {
+            User::LeaveIfError( aSettings.SetL( aKey, aValue ) );
+            }
+        }
+    else if( err == KErrNotFound )
+        {
+        User::LeaveIfError( aSettings.SetL( aKey, aValue ) );
+        }
+    else
+        {
+        User::Leave( err );
+        }
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/BWINS/upnpsharinguiu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	?ExecuteSharingDialogLD@CUPnPAppFileSharingDialog@@QAEHXZ @ 1 NONAME ; int CUPnPAppFileSharingDialog::ExecuteSharingDialogLD(void)
+	?NewL@CUPnPAppFileSharingDialog@@SAPAV1@HAAVCUPnPFileSharingEngine@@@Z @ 2 NONAME ; class CUPnPAppFileSharingDialog * CUPnPAppFileSharingDialog::NewL(int, class CUPnPFileSharingEngine &)
+	?UpdateFileSharingListL@CUPnPAppFileSharingDialog@@QAEXXZ @ 3 NONAME ; void CUPnPAppFileSharingDialog::UpdateFileSharingListL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/EABI/upnpsharinguiu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+	_ZN25CUPnPAppFileSharingDialog4NewLEiR22CUPnPFileSharingEngine @ 1 NONAME
+	_ZTI25CUPnPAppFileSharingDialog @ 2 NONAME ; #<TI>#
+	_ZTV25CUPnPAppFileSharingDialog @ 3 NONAME ; #<VT>#
+	_ZN25CUPnPAppFileSharingDialog22ExecuteSharingDialogLDEv @ 4 NONAME
+	_ZN25CUPnPAppFileSharingDialog22UpdateFileSharingListLEv @ 5 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/data/upnpsharingui.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,449 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resource definitions for project Home Network
+*
+*/
+
+
+
+
+
+
+
+//  RESOURCE IDENTIFIER
+NAME    SHUI // 4 letter ID
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <data_caging_paths_strings.hrh>
+#include <appinfo.rh>
+#include <CommonDialogs.hrh> // CommonDialogs Enumerations
+#include <CommonDialogs.rh>  // CommonDialogs Resource structures
+#include <upnpsettings.loc>
+
+#include "upnpsharingui.hrh"
+
+
+//  RESOURCE DEFINITIONS 
+
+// --------------------------------------------------------------------------
+// RSS_SIGNATURE
+// Mandatory utility struct in resource file. Used by UIKON internally.
+// --------------------------------------------------------------------------
+RESOURCE RSS_SIGNATURE 
+    {
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_title_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_sharingui_title_text 
+    { 
+    buf = qtn_iupnp_title_share;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_softkeys_options_back__change
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE CBA r_sharingui_softkeys_options_back__change
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; },
+        CBA_BUTTON {id=EAknSoftkeyChange; txt= qtn_msk_change; }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_menubar
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_sharingui_menubar
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_sharingui_menu;}
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_menu
+//
+//----------------------------------------------------------------------------
+
+RESOURCE MENU_PANE r_sharingui_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            { 
+            command = ESharingUiCmdAppChange; 
+            txt = qtn_options_change;
+            },
+        MENU_ITEM
+            { 
+            command = ESharingUiCmdRefresh; 
+            txt = qtn_iupnp_options_update_content;
+            },
+        MENU_ITEM
+            { 
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            { 
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_dialog
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_sharingui_dialog
+    { 
+    title = qtn_iupnp_title_share;
+    flags = EAknDialogSelectionList;
+    buttons = r_sharingui_softkeys_options_back__change;
+    items = 
+        {
+        DLG_LINE
+            {
+            type = KAknCtLastControlId;
+            id = ESharingUiListBoxId;
+            control = AVKON_SETTING_ITEM_LIST
+                {
+                flags = EAknSettingItemIncludeHiddenInOrdinal;
+                initial_number = 1;
+                items =
+                    {
+                    AVKON_SETTING_ITEM
+                        {
+                        identifier = ESharingUiSettingItemVisibility;
+                        associated_resource = r_sharingui_visibility_popup_texts;
+                        name = qtn_iupnp_set_sharing;
+                        },
+                    AVKON_SETTING_ITEM
+                        {
+                        identifier = ESharingUiSettingItemVisual;
+                        name = qtn_iupnp_visual_albums;
+                        },
+                    AVKON_SETTING_ITEM
+                        {
+                        identifier = ESharingUiSettingItemMusic;
+                        name = qtn_iupnp_music_pl;
+                        }
+                    };    
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_visibility_editor
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_sharingui_visibility_editor
+    {
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_visibility_popup_texts
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_sharingui_visibility_popup_texts
+    {
+    setting_texts_resource = r_sharingui_visibility_on_off_texts;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_visibility_on_off_texts
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_sharingui_visibility_on_off_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT 
+            { 
+            value = ESharingUiVisibilityOn; 
+            text = qtn_iupnp_set_sharing_on;
+            },
+        AVKON_ENUMERATED_TEXT 
+            { 
+            value = ESharingUiVisibilityOff; 
+            text = qtn_iupnp_set_sharing_off;
+            }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_starting_file_sharing_note_dialog
+//
+//----------------------------------------------------------------------------
+//    
+RESOURCE DIALOG r_sharingui_starting_file_sharing_note_dialog
+    { 
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                singular_label = qtn_iupnp_wait_sharing;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_stopping_file_sharing_note_dialog
+//
+//----------------------------------------------------------------------------
+//    
+RESOURCE DIALOG r_sharingui_stopping_file_sharing_note_dialog
+    { 
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                singular_label = qtn_iupnp_wait_sharing_off;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_visual_albums_share_nothing_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_visual_albums_share_nothing_text 
+    {
+    buf = qtn_iupnp_visual_nothing;
+    }
+
+
+//----------------------------------------------------------------------------
+//   
+//    r_visual_albums_share_one_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_visual_albums_share_one_text 
+    { 
+    buf = qtn_iupnp_visual_one;
+    }
+
+
+//----------------------------------------------------------------------------
+//   
+//    r_visual_albums_share_many_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_visual_albums_share_many_text 
+    { 
+    buf = qtn_iupnp_visual_many;
+    }
+
+
+//----------------------------------------------------------------------------
+//   
+//    r_music_share_nothing_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_music_share_nothing_text 
+    {
+    buf = qtn_iupnp_music_nothing;
+    }
+
+
+//----------------------------------------------------------------------------
+//   
+//    r_music_share_one_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_music_share_one_text 
+    { 
+    buf = qtn_iupnp_music_one;
+    }
+
+
+//----------------------------------------------------------------------------
+//   
+//    r_music_share_many_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_music_share_many_text 
+    { 
+    buf = qtn_iupnp_music_many;
+    }
+
+//----------------------------------------------------------------------------
+//
+//    r_settings_start_sharing_phone_error_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_settings_start_sharing_phone_error_text
+    {
+    buf = qtn_memlo_not_enough_device_memory;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_settings_start_sharing_error_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_settings_start_sharing_error_text
+    {
+    buf = qtn_iupnp_start_sharing_error;
+    }
+
+// --------------------------------------------------------------------------
+//   
+//    r_upnp_phone_visible_text
+//   
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_upnp_phone_hidden_text
+    { 
+    buf = qtn_iupnp_phone_hidden;
+    }
+    
+// --------------------------------------------------------------------------
+//   
+//    r_upnp_phone_visible_text
+//   
+// --------------------------------------------------------------------------
+RESOURCE TBUF r_upnp_phone_visible_text
+    { 
+    buf = qtn_iupnp_phone_visible;
+    }        
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_info_query
+//
+//----------------------------------------------------------------------------
+//        
+RESOURCE DIALOG r_sharingui_info_query
+{
+   flags = EGeneralQueryFlags | EEikDialogFlagNoTitleBar | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+   buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+   items=
+   {
+       DLG_LINE
+       {
+          type = EAknCtPopupHeadingPane;
+          id = EAknMessageQueryHeaderId;
+          control = AVKON_HEADING
+          {
+          };
+       },
+       DLG_LINE
+       {
+          type = EAknCtMessageQuery;
+          id = EAknMessageQueryContentId;
+          control = AVKON_MESSAGE_QUERY
+          {
+          };
+        }
+   };
+}
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_updating_content_header
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_sharingui_updating_content_header
+    { 
+    buf = qtn_iupnp_updating_content_header;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_updating_content_note_text
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_sharingui_updating_content_note_text 
+    { 
+    buf = qtn_iupnp_wait_updating_content;
+    }
+
+//----------------------------------------------------------------------------
+//   
+//    r_sharingui_secondary_in_progress
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_sharingui_secondary_in_progress
+    { 
+    buf = qtn_iupnp_updating_progress;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for sharing UI component
+*
+*/
+
+
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// ADO internal interfaces
+../inc/upnpappfilesharingdialog.h        |../../../inc/upnpappfilesharingdialog.h
+
+PRJ_MMPFILES
+upnpsharingui.mmp
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/group/upnpsharingui.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for sharing UI component
+*
+*/
+
+
+
+
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+
+TARGET          upnpsharingui.dll
+TARGETTYPE      dll
+UID             0x100000D8 0x20009CAD
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+// Include paths
+APP_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+START RESOURCE  ../data/upnpsharingui.rss
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+SOURCEPATH      ../src
+
+SOURCE          upnpappfilesharingdialog.cpp
+SOURCE          upnpappfilesharinglist.cpp
+
+//system
+LIBRARY         euser.lib // s60 basic
+LIBRARY         eikcore.lib // CEikEnv
+LIBRARY         ws32.lib // RWindowBase
+LIBRARY         cone.lib // CCoeControl
+LIBRARY         avkon.lib // basic ui
+LIBRARY         eikcoctl.lib // basic ui
+LIBRARY         eikctl.lib  // basic ui
+LIBRARY         eikdlg.lib // eikon dialogs
+LIBRARY         eikcdlg.lib // progress dialog
+LIBRARY         CommonEngine.lib // string loader
+LIBRARY         featmgr.lib // FeatureManager
+LIBRARY         hlplch.lib // help launcher
+LIBRARY         CdlEngine.lib // CdlEngine
+LIBRARY         bafl.lib // BaflUtils
+
+// upnp framework
+LIBRARY         upnpsettingsengine.lib // settings engine
+LIBRARY         upnpmultiselectionui.lib // multiselectionui
+LIBRARY         upnpapplicationengine.lib // filesharingengine
+LIBRARY         upnpappwizard.lib // setup wizard
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/inc/upnpappfilesharingdialog.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File sharing dialog class definition
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPAPPFILESHARINGDIALOG_H
+#define UPNPAPPFILESHARINGDIALOG_H
+
+//  INCLUDES
+#include <AknDialog.h> // base class
+#include "upnpfilesharingengineobserver.h" // base class
+
+// FORWARD DECLARATIONS
+class CUPnPFileSharingEngine;
+class CEikMenuPane;
+class CUPnPAppFileSharingList;
+class CAknTitlePane;
+class CEikStatusPane;
+
+// CLASS DECLARATION
+
+/**
+*  File Sharing dialog class.
+*  Declares file sharing dialog
+*  @since S60 3.1
+*/
+class CUPnPAppFileSharingDialog
+    : public CAknDialog
+    , private MUPnPFileSharingEngineObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CUPnPAppFileSharingDialog* NewL(
+            TInt aMenuResource,
+            CUPnPFileSharingEngine& aEng );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUPnPAppFileSharingDialog();
+
+    public: // Services
+
+        /**
+         * Executes the dialog.
+         */
+        IMPORT_C TInt ExecuteSharingDialogLD();
+
+        /**
+         * Get the pointer of iFileSharingList and update list
+         */    
+        IMPORT_C void UpdateFileSharingListL() ;
+     
+    protected: // Functions from base classes
+
+        /**
+        * From CAknDialog, handles menu commands
+        * @since S60 3.1
+        * @param aCommandId, command to be handled
+        */
+        void ProcessCommandL( TInt aCommandId );
+
+        /**
+        * From CAknDialog, handles key events.
+        * @since S60 3.1
+        * @param aKeyEvent, Event to handled.
+        * @param aType, Type of the key event.
+        * @return TKeyResponse, response code
+        *           (EKeyWasConsumed, EKeyWasNotConsumed).
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent,
+                                    TEventCode aType );
+
+        /**
+        * From CoeControl
+        * @since S60 3.1
+        * @param aContext, context of desired help
+        */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+    protected: // for own use
+
+        /**
+        * Opens album selection dialog and starts sharing
+        * @since S60 3.1
+        */
+        void RunMultiselectionDialogL();
+
+    private: //From MUPnPFileSharingEngineObserver
+        /**
+         * Function informs when file sharing was enabled or disabled
+         * @since S60 3.1
+         * @param aEngine File sharing engine
+         * @param aError, error code
+         * @param aPhase ETrue if current phase is sharing activation,
+         * otherwise EFalse
+         */
+        void HandleSharingStatus( 
+            CUPnPFileSharingEngine& aEngine, 
+            TInt aError, 
+            TBool aPhase );
+
+        /**
+         * Informs about status of the sharing progress
+         * @since S60 3.1
+         * @param aEngine File sharing engine
+         * @param aProgress Data information about sharing progress
+         */                                          
+        void HandleSharingProgress(
+            CUPnPFileSharingEngine& aEngine, 
+            const RArray<TUpnpProgressInfo>& aProgress );
+
+        /**
+         * Function informs when file sharing is done
+         * @param aEngine File sharing engine
+         * @param aError, error code
+         */
+        void HandleSharingDone( 
+            CUPnPFileSharingEngine& aEngine, TInt aError );
+
+        /**
+         * Callback to inform if connection has been lost
+         * @since S60 3.1
+         * @param aEngine File sharing engine
+         */ 
+        void HandleSharingConnectionLost( 
+            CUPnPFileSharingEngine& aEngine );
+
+    protected:  // Functions from base classes
+
+        /**
+         * From CAknDialog, This is called in CAknDialog::ExecuteLD()
+         *                  before a form is drawn.
+         * @since S60 3.1
+         */
+        void PreLayoutDynInitL();
+
+        /**
+        * From CAknDialog : This is called by the dialog framework
+        *                   when softkey is pressed, returns true if the
+        * @since S60 3.1
+        * @param aButtonId, ID of the pressed button
+        * @return TBool, returns ETrue if ready to close dialog,
+        *                   EFalse otherwise.
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+        /**
+        * From MEikMenuObserver
+        * @since S60 3.1
+        */
+        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+    private:
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        * @since S60 3.1
+        * @param aMenuResource, menu resource of the dialog
+        */
+        void ConstructL(TInt aMenuResource);
+
+        /**
+        * Creates custom control
+        */
+        SEikControlInfo CreateCustomControlL(TInt aControlType);
+
+        /**
+         * Display information note after starting sharing
+         * @since S60 3.1
+         * @param aMessageResourceId Resource id for message text
+         * @param aDialogResourceId Resource id for the dialog
+         */
+        void DisplayInfoL( TInt aHeaderResourceId,
+                           TInt aMessageResourceId,
+                           TInt aDialogResourceId );
+        /**
+         * Default constructor
+         */
+        CUPnPAppFileSharingDialog( CUPnPFileSharingEngine& aEng );
+
+    private:    // Data
+
+        // File sharing engine pointer
+        CUPnPFileSharingEngine&         iFileSharingEngine; //not owned
+
+        // Pointer to file sharing list for dialog data
+        CUPnPAppFileSharingList*        iFileSharingList;   //owned
+        // pointer to title pane
+        CAknTitlePane*                  iTitlePane;         // not owned
+        // pointer to status pane
+        CEikStatusPane*                 iStatusPane;        // not owned
+
+        // UI environment
+        CEikonEnv*                      iCoeEnv;            //not owned
+        // offset in resource file
+        TInt                            iResFileOffset;
+        /**
+         *Flag to keep in mind has FeatureManager been initialized or not
+         */
+        TBool iFeatureManagerInitialized;
+
+    };
+
+#endif      // UPNPAPPFILESHARINGDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/inc/upnpappfilesharinglist.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File sharing list class definition for Home Network
+ *
+*/
+
+
+
+
+
+
+#ifndef UPNPAPPFILESHARINGLIST_H
+#define UPNPAPPFILESHARINGLIST_H
+
+//  INCLUDES
+#include <aknsettingitemlist.h> // base class
+#include <AknWaitNoteWrapper.h> // base class MAknBackgroundProcess
+
+// FORWARD CLASS DECLARATION
+class CUPnPFileSharingEngine;
+class CUPnPAppWizard;
+
+// CONSTANTS
+const TInt KMaxTextSettingItemLenght = 128;
+
+/**
+ *  Settings list class declaration
+ *  @since S60 3.1
+ */
+NONSHARABLE_CLASS( CUPnPAppFileSharingList )
+    : public CAknSettingItemList
+    , public MAknBackgroundProcess
+    {
+private:
+    /**
+     * The internal phases of wait note when changing sharing state
+     */
+    enum TSharingStarting
+        {
+        EPhaseNotActive,
+        EPhaseProcessing,
+        EPhaseCompleted
+        };
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUPnPAppFileSharingList* NewL(
+        CUPnPFileSharingEngine* aFileSharingEngine );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPAppFileSharingList();
+
+public: // New functions
+    /**
+     * From CAknSettingItemList, this launches the setting page.
+     * @since S60 3.1
+     * @param aIndex, index of selected list item
+     * @param aCalledFromMenu, indicates if editing is called
+     *        trough menu or from keyboard
+     */
+    void  EditItemL (TInt aIndex, TBool aCalledFromMenu);
+
+    /**
+     * Reads data from storage to member variables
+     * @since S60 3.1
+     */
+    void LoadDataFromEngineL();
+
+public: //From MUPnPFileSharingEngineObserver
+
+    /**
+     * Function informs when file sharing was enabled or disabled
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     * @param aError, error code
+     * @param aPhase ETrue if current phase is sharing activation,
+     * otherwise EFalse
+     */
+    void HandleSharingStatus( 
+        CUPnPFileSharingEngine& aEngine, 
+        TInt aError, 
+        TBool aPhase );
+
+    /**
+     * Callback to inform if connection has been lost
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     */ 
+    void HandleSharingConnectionLost( 
+        CUPnPFileSharingEngine& aEngine );
+
+public:
+
+    /**
+     * Processes progress information and sets secondary texts according to
+     * received progress
+     * @since S60 3.1
+     * @param aProgressInfo, Type containg the progress information
+     */
+    void SetFilesharingTextsL(
+        const RArray<TUpnpProgressInfo>& aProgressInfo );
+
+    /**
+     * Sets the default secondary texts if no sharing is ongoing
+     * @since S60 3.1
+     * @param aMediaType, Type of the media
+     * @param aState, State of the selection
+     */
+    void SetDefaultSecondaryTextsL(
+        const TInt& aMediaType,
+        const TInt& aState );
+
+    /**
+     * Sets the secondary texts id there is sharing ongoing
+     * @since S60 3.1
+     * @param aMediaType, Type of the media
+     * @param aProgress, The value of progress in percents
+     */
+    void SetProgressSecondaryTextsL(
+        const TInt& aMediaType,
+        const TInt& aProgress );
+
+    /**
+     * Update the visibity of item ,when the list is switched foregroud.
+     */
+     void UpdateVisibitySettingItemL();
+     
+protected:
+
+    /**
+     * From CAknSettingItemList
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+     * From CoeControl
+     */
+    void FocusChanged(
+        TDrawNow  aDrawNow );
+
+protected:
+    /**
+     * From MAknBackgroundProcess
+     */
+    void  StepL();
+
+    /**
+     * From MAknBackgroundProcess
+     */
+    TBool  IsProcessDone() const;
+
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUPnPAppFileSharingList();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     * @param aFileSharingEngine, engine pointer
+     */
+    void ConstructL( CUPnPFileSharingEngine* aFileSharingEngine );
+
+    /**
+     * From CAknSettingItemList, Framework method to create a setting item.
+     * @since S60 3.1
+     * @param aIdentifier,  list item id to be created
+     * @return CAknSettingItem, pointer to list item
+     */
+    CAknSettingItem* CreateSettingItemL( TInt aIdentifier );
+
+    /**
+     * Create and show the wait note when starting sharing
+     * @since S60 3.1
+     */
+    void ShowWaitNoteL();
+
+
+private: // Data
+
+    /**
+     * list item text for visual albums
+     */
+    TBuf<KMaxTextSettingItemLenght>  iVisualAlbums;
+    /**
+     * list item text for playlists
+     */
+    TBuf<KMaxTextSettingItemLenght>  iPlayLists;
+    /**
+     * visibility setting item value
+     */
+    TInt iVisibility;
+    /**
+     *access point id setting item value
+     */
+    TInt iIapId;
+    /**
+     * engine pointer
+     */
+    CUPnPFileSharingEngine* iFileSharingEngine;
+    /**
+     * Indicator if wizard is run to update UI
+     */
+    TBool iWizardRun;
+    /**
+     * The state of sharing activation for progress note
+     */
+    TInt iStartingSharing;
+    /**
+     * Pointer to wizard
+     */
+    CUPnPAppWizard* iWizard;
+
+    };
+
+#endif      // UPNPAPPFILESHARINGLIST_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/inc/upnpsharingui.hrh	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Resource headers for sharing settings UI
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPSHARINGUI_HRH
+#define UPNPSHARINGUI_HRH
+
+// DATA TYPES
+
+enum TSharingUiDlgLineIds
+    {
+    ESharingUiListBoxId = 1
+    };
+
+enum TSharingUiDlgItems
+    {
+    ESharingUiSettingItemVisibility = 0,
+    ESharingUiSettingItemVisual,
+    ESharingUiSettingItemMusic
+    };
+
+enum TSharingUiVisibilityItem
+    {
+    ESharingUiVisibilityOff = 0,
+    ESharingUiVisibilityOn
+    };
+
+enum TSharingUiCommandIds
+    {
+    ESharingUiCmdAppChange = 1,
+    ESharingUiCmdRefresh
+    };
+
+#endif // UPNPSHARINGUI_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/src/upnpappfilesharingdialog.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,596 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File sharing view of Home Network application
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// system
+#include <aknlists.h>
+#include <akntitle.h>
+#include <AknProgressDialog.h>
+#include <StringLoader.h>
+#include <featmgr.h>
+#include <hlplch.h>
+#include <eikprogi.h>
+#include <aknnotewrappers.h>
+#include <aknmessagequerydialog.h> //displayinfol
+#include <akninputblock.h>          // CAknInputBlock
+#include <bautils.h> // BaflUtils
+
+// internal interfaces
+#include "cupnpmultiselectionui.h"
+#include "upnpfilesharingengine.h"
+#include "upnpfilesharingengineobserver.h"
+
+// this component
+#include <upnpsharingui.rsg>
+#include "upnpsharingui.hrh"
+#include "upnpappfilesharinglist.h"
+#include "upnpappfilesharingdialog.h"
+
+
+_LIT( KComponentLogfile, "upnpsharingui.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KHomeConnectUID3 = 0x10208A0A; // needed for help context
+_LIT( KUPNP_HLP_SHARE_CONTENT, "UPNP_HLP_SHARE_CONTENT" ); 
+// Filename of rsc file
+_LIT( KSharingUiRscFile, "\\resource\\upnpsharingui.rsc" );
+
+
+// ============================ MEMBER FUNCTIONS ============================
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPAppFileSharingDialog* CUPnPAppFileSharingDialog::NewL( 
+    TInt aMenuResource,
+    CUPnPFileSharingEngine& aEng )
+    {
+    __LOG("CUPnPAppFileSharingDialog::NewL");
+
+    CUPnPAppFileSharingDialog* self =
+        new (ELeave) CUPnPAppFileSharingDialog( aEng );
+    CleanupStack::PushL(self);
+    self->ConstructL( aMenuResource );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+CUPnPAppFileSharingDialog::CUPnPAppFileSharingDialog( 
+    CUPnPFileSharingEngine& aEng )
+    : iFileSharingEngine( aEng )
+    , iFeatureManagerInitialized( EFalse )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::ConstructL( TInt aMenuResource )
+    {
+    __LOG("CUPnPAppFileSharingDialog::ConstructL");
+
+    iFileSharingEngine.SetObserver(this);
+
+    if ( aMenuResource == 0 )
+        {
+        aMenuResource = R_SHARINGUI_MENUBAR;
+        }
+
+    // determine resource file location
+    iCoeEnv = CEikonEnv::Static();
+    RFs& fileSession = iCoeEnv->FsSession();
+    TFileName rscFileName( KSharingUiRscFile );
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' 
+    rscFileName.Insert( 0, drive );
+    BaflUtils::NearestLanguageFile( fileSession, rscFileName );
+    if ( !BaflUtils::FileExists( fileSession, rscFileName ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+    // load the resource file
+    iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName );
+    FeatureManager::InitializeLibL();
+    iFeatureManagerInitialized = ETrue;
+
+    CAknDialog::ConstructL( aMenuResource );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPAppFileSharingDialog::~CUPnPAppFileSharingDialog()
+    {
+    __LOG("CUPnPAppFileSharingDialog::~CUPnPAppFileSharingDialog");
+
+    iFileSharingEngine.SetObserver( NULL );
+
+    // unload resource file
+    if ( iResFileOffset )
+        {
+        iCoeEnv->DeleteResourceFile( iResFileOffset );
+        iResFileOffset = 0;
+        }
+
+    if( iFeatureManagerInitialized )
+        {
+        FeatureManager::UnInitializeLib();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::ExecuteSharingDialogLD()
+// Executes the dialog using the component's own resource
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUPnPAppFileSharingDialog::ExecuteSharingDialogLD()
+    {
+    return ExecuteLD( R_SHARINGUI_DIALOG );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::OkToExitL(TInt aButtonId)
+// called by framework when the softkey is pressed
+// --------------------------------------------------------------------------
+//
+TBool CUPnPAppFileSharingDialog::OkToExitL(TInt aButtonId)
+{
+   __LOG("CUPnPAppFileSharingDialog::OkToExitL");
+
+   TBool retval(EFalse);
+   if (aButtonId == EAknSoftkeyOptions)
+       {
+       DisplayMenuL();
+       }
+   else if (aButtonId == EAknSoftkeyBack)
+       {
+       iTitlePane->SetTextToDefaultL();
+       retval = ETrue; //back to previous dialog
+       }
+   else if ( aButtonId == EAknSoftkeyChange )
+       {
+       // msk event
+       TKeyEvent tmpEvent;
+       tmpEvent.iCode = EKeyOK;
+       tmpEvent.iModifiers = 0;
+       tmpEvent.iRepeats = 0;
+       tmpEvent.iScanCode = 0;
+       TEventCode eventType = EEventKey;
+       OfferKeyEventL( tmpEvent, eventType );
+       }
+    return retval;
+}
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::DynInitMenuPaneL
+// Dynamically initalizes menu pane
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::DynInitMenuPaneL( TInt aResourceId,
+                                            CEikMenuPane* aMenuPane )
+    {
+    __LOG("CUPnPAppMainDialog::CUPnPAppFileSharingDialog");
+
+    if (aResourceId == R_SHARINGUI_MENU && 
+        !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+        {
+        aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::PreLayoutDynInitL()
+// called by framework before dialog is shown
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::PreLayoutDynInitL()
+    {
+    __LOG("CUPnPAppFileSharingDialog::PreLayoutDynInitL");
+
+    iFileSharingList->LoadDataFromEngineL();
+
+    // set dialog title
+    iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    iTitlePane = (CAknTitlePane*)iStatusPane->ControlL(
+                    TUid::Uid(EEikStatusPaneUidTitle));
+    iTitlePane->SetTextL(*StringLoader::LoadLC( R_SHARINGUI_TITLE_TEXT ) );
+    CleanupStack::PopAndDestroy();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::ProcessCommandL()
+// called by framework when menu command is selected
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::ProcessCommandL(TInt aCommand)
+    {
+    __LOG("CUPnPAppFileSharingDialog::ProcessCommandL");
+
+    HideMenu();
+
+    switch ( aCommand )
+        {
+        case ESharingUiCmdRefresh: 
+            {
+            TInt selectedItem = iFileSharingList->
+                ListBox()->CurrentItemIndex();
+            iFileSharingEngine.RefreshSharedMediaL( EImageAndVideo );
+            iFileSharingEngine.RefreshSharedMediaL( EPlaylist );
+            DisplayInfoL( R_SHARINGUI_UPDATING_CONTENT_HEADER,
+                          R_SHARINGUI_UPDATING_CONTENT_NOTE_TEXT,
+                          R_SHARINGUI_INFO_QUERY );
+            break;
+            }
+    case ESharingUiCmdAppChange:
+        {
+        TInt selectedItem = iFileSharingList->ListBox()->CurrentItemIndex();
+        if ( selectedItem == ESharingUiSettingItemVisibility )
+            {
+            iFileSharingList->EditItemL(selectedItem, ETrue);
+            }
+        else
+            {
+            RunMultiselectionDialogL();
+            }
+        break;
+        }
+
+    case EAknCmdExit:
+        {
+        User::Exit(KErrNone);
+        break;
+        }
+
+    case EAknCmdHelp:
+        {
+        HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+                     iEikonEnv->EikAppUi()->AppHelpContextL() );
+        break;
+        }
+
+    default:
+        {
+        __LOG("CUPnPAppFileSharingDialog::ProcessCommandL Unknown cmd");
+        }
+        }
+
+    CAknDialog::ProcessCommandL(aCommand);
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppSettingsDialog::OfferKeyEventL()
+// called by framework when key is pressed
+// --------------------------------------------------------------------------
+//
+TKeyResponse CUPnPAppFileSharingDialog::OfferKeyEventL(
+    const TKeyEvent &aKeyEvent, TEventCode aType )
+    {
+    __LOG("CUPnPAppFileSharingDialog::OfferKeyEventL");
+
+    TKeyResponse retval = EKeyWasNotConsumed;
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyDownArrow:
+        case EKeyUpArrow:
+            {
+            if (aType == EEventKey)
+                {
+                retval = iFileSharingList->OfferKeyEventL( aKeyEvent, aType );
+                }
+            break;
+            }
+
+        case EKeyOK:
+            {
+            if ( aType == EEventKey )
+                {
+                TInt selectedItem =
+                    iFileSharingList->ListBox()->CurrentItemIndex();
+                if ( selectedItem == ESharingUiSettingItemVisibility )
+                    {
+                    retval = iFileSharingList->OfferKeyEventL(aKeyEvent, aType);
+                    }
+                else
+                    {
+                    RunMultiselectionDialogL();
+                    retval = EKeyWasConsumed;
+                    }
+                }
+            break;
+            }
+
+        default:
+            {
+            retval = CAknDialog::OfferKeyEventL(aKeyEvent, aType);
+            break;
+            }
+        }
+        
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::HandleSharingStatus
+// Function informs when file sharing was enabled or disabled
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::HandleSharingStatus( 
+        CUPnPFileSharingEngine& aEngine, 
+        TInt aError, 
+        TBool aPhase )
+    {
+    __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\
+HandleSharingStatus begin");
+
+    iFileSharingList->HandleSharingStatus( aEngine, aError, aPhase );
+
+    if( !aError )
+        {
+        TInt strId( R_UPNP_PHONE_HIDDEN_TEXT );
+        if( aPhase )
+            {        
+            strId = R_UPNP_PHONE_VISIBLE_TEXT;
+            }
+
+        TRAP_IGNORE(
+            HBufC* str = StringLoader::LoadLC( strId );
+            CAknInformationNote* note = new ( ELeave ) CAknInformationNote;
+            note->ExecuteLD( *str );
+            CleanupStack::PopAndDestroy( str ) );
+        }
+
+    __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\
+HandleSharingStatus end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::HandleSharingProgress
+// Informs about status of the sharing progress
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::HandleSharingProgress(
+        CUPnPFileSharingEngine& /*aEngine*/, 
+        const RArray<TUpnpProgressInfo>& aProgress )
+    {
+    __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\
+HandleSharingProgress begin");
+
+    TRAPD( err,
+        CAknInputBlock::NewLC();
+        iFileSharingList->SetFilesharingTextsL( aProgress );
+        CleanupStack::PopAndDestroy() );
+    if ( err != KErrNone )
+        {
+        //show some critical errors using
+        //default symbian error notes
+        CActiveScheduler::Current()->Error( err );
+        }
+
+    __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\
+HandleSharingProgress end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::HandleSharingDone
+// Function informs when file sharing is done
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::HandleSharingDone( 
+        CUPnPFileSharingEngine& /*aEngine*/, TInt aError )
+    {
+    __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\
+HandleSharingDone begin");
+
+    //Show information note that sharing is completed
+    if ( aError == KErrInUse ||
+         aError == KErrNoMemory ||
+         aError == KErrDiskFull )
+        {
+        //show some critical errors using
+        //default symbian error notes
+        CActiveScheduler::Current()->Error( aError );
+        }
+
+    __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\
+HandleSharingDone end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::HandleSharingConnectionLost
+// Callback to inform if connection has been lost
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::HandleSharingConnectionLost( 
+        CUPnPFileSharingEngine& aEngine )
+    {
+    __LOG("CUPnPAppFileSharingDialog::HandleSharingConnectionLost");
+
+    TRAPD( err,
+        CAknInputBlock::NewLC();
+        iFileSharingList->HandleSharingConnectionLost( aEngine );
+        CleanupStack::PopAndDestroy() ); //CAknInputBlock
+    if ( err != KErrNone )
+        {
+        //show some critical errors using
+        //default symbian error notes
+        CActiveScheduler::Current()->Error( err );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::RunMultiselectionDialogL();
+// Opens album selection dialog and sends selected albums
+// to engine
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::RunMultiselectionDialogL(void)
+    {
+    __LOG("CUPnPAppFileSharingDialog::RunMultiselectionDialogL");
+
+    CUPnPMultiselectionUi* multiselectionDialog;
+
+    TInt selectedItem = iFileSharingList->ListBox()->CurrentItemIndex();
+
+    TInt visualSharingState;
+
+
+    THomeConnectMediaType mediaType;
+    if ( selectedItem == ESharingUiSettingItemVisual )
+        {
+        mediaType =
+                                EImageAndVideo;
+        }
+
+    else
+        {
+        mediaType =
+                                EPlaylist;
+        }
+    CArrayFix<TInt>* markedItems = new(ELeave) CArrayFixFlat<TInt>(3);
+    CleanupStack::PushL( markedItems );
+    multiselectionDialog = CUPnPMultiselectionUi::NewL(
+                                mediaType,
+                                &iFileSharingEngine,
+                                visualSharingState,
+                                markedItems );  
+    CleanupStack::PushL( multiselectionDialog );
+    TInt ret = multiselectionDialog->ExecuteDlgLD();
+
+    CleanupStack::PopAndDestroy( multiselectionDialog );
+
+    multiselectionDialog = NULL;
+
+    // Set title back
+    iTitlePane->SetTextL(*StringLoader::LoadLC( R_SHARINGUI_TITLE_TEXT ));
+    CleanupStack::PopAndDestroy();
+
+    if ( ret )
+        {
+        __LOG("CUPnPAppFileSharingDialog::RunMultiselectionDialogL: \
+Calling ShareMediaFilesL..");
+        // set selections
+        iFileSharingEngine.SetSelectionIndexesL( mediaType, *markedItems );
+
+        // Share files asynchronously
+        iFileSharingEngine.ShareMediaL( mediaType );
+
+        DisplayInfoL( R_SHARINGUI_UPDATING_CONTENT_HEADER,
+                      R_SHARINGUI_UPDATING_CONTENT_NOTE_TEXT,
+                      R_SHARINGUI_INFO_QUERY );
+        }
+    CleanupStack::PopAndDestroy( markedItems );
+    
+     }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::GetHelpContext
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::GetHelpContext(
+                                TCoeHelpContext& aContext) const
+    {
+    __LOG("CUPnPAppMainDialog::CUPnPAppFileSharingDialog");
+
+    aContext.iMajor = TUid::Uid( KHomeConnectUID3 );
+    aContext.iContext = KUPNP_HLP_SHARE_CONTENT;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::CreateCustomControlL
+// From CAknDialog
+// --------------------------------------------------------------------------
+//
+SEikControlInfo CUPnPAppFileSharingDialog::CreateCustomControlL(
+                                                    TInt aControlType)
+    {
+    __LOG( "[CUPnPAppFileSharingDialog]\t CreateCustomControlL");
+    iFileSharingList = CUPnPAppFileSharingList::NewL( 
+        &iFileSharingEngine );
+
+    SEikControlInfo controlInfo;
+    controlInfo.iControl = NULL;
+    controlInfo.iTrailerTextId = 0;
+    controlInfo.iFlags = 0;
+    
+    if ( aControlType == KAknCtLastControlId )
+        {
+        controlInfo.iControl = iFileSharingList;
+        }
+    iFileSharingEngine.RequestSharingProgressL();
+
+    return controlInfo;
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::DisplayInfoL();
+// Shows message query to user
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingDialog::DisplayInfoL(TInt aHeaderResourceId,
+                                             TInt aMessageResourceId,
+                                             TInt aDialogResourceId)
+    {
+    HBufC* noteHeader = StringLoader::LoadL(
+        aHeaderResourceId);
+    CleanupStack::PushL(noteHeader);
+    HBufC* noteMsg = StringLoader::LoadL(
+        aMessageResourceId);
+    CleanupStack::PushL(noteMsg);
+
+    CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*noteMsg);
+
+    dlg->PrepareLC(aDialogResourceId);
+    dlg->QueryHeading()->SetTextL(*noteHeader);
+    dlg->RunLD();
+
+    CleanupStack::PopAndDestroy(noteMsg);
+    CleanupStack::PopAndDestroy(noteHeader);
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingDialog::UpdateFileSharingListL();
+// Get the pointer of iFileSharingList,update the visibity of item
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPAppFileSharingDialog::UpdateFileSharingListL() 
+    {
+    if( iFileSharingList )
+        {  
+        iFileSharingList->UpdateVisibitySettingItemL();
+        }
+   
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsettings/upnpsharingui/src/upnpappfilesharinglist.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,674 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File sharing list implementation for File sharing view
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// system
+#include <aknlists.h>
+#include <aknPopup.h>
+#include <StringLoader.h>
+#include <upnpsharingui.rsg>
+#include <aknnotewrappers.h>
+#include <AknProgressDialog.h>
+#include <AknWaitDialog.h>
+
+// internal upnpfw interfaces
+#include "upnpsettingsengine.h"
+#include "upnpfilesharingengine.h"
+#include "cupnpappwizard.h"
+#include "upnpcontentserverclient.h" //TUpnpProgressInfo
+
+// this component
+#include "upnpsharingui.hrh"
+#include "upnpappfilesharinglist.h"
+
+_LIT( KComponentLogfile, "upnpsharingui.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KCDrive,  "C" );
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::CUPnPAppFileSharingList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPAppFileSharingList::CUPnPAppFileSharingList()
+    {
+    __LOG("CUPnPAppFileSharingList::CUPnPAppFileSharingList");
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::ConstructL(
+                                CUPnPFileSharingEngine* aFileSharingEngine)
+    {
+    __LOG("CUPnPAppFileSharingList::ConstructL");
+
+    iFileSharingEngine = aFileSharingEngine;
+    User::LeaveIfNull( iFileSharingEngine );
+    iVisibility = 0;
+    if ( iFileSharingEngine->SharingStateL() )
+        {
+        iVisibility = 1;
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUPnPAppFileSharingList* CUPnPAppFileSharingList::NewL(
+    CUPnPFileSharingEngine* aFileSharingEngine )
+    {
+    __LOG("CUPnPAppFileSharingList::NewL");
+
+    CUPnPAppFileSharingList* self = new (ELeave) CUPnPAppFileSharingList( );
+    CleanupStack::PushL(self);
+    self->ConstructL( aFileSharingEngine );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::~CUPnPAppFileSharingList
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPAppFileSharingList::~CUPnPAppFileSharingList()
+    {
+    __LOG("CUPnPAppFileSharingList::~CUPnPAppFileSharingList");
+    // This will kill the possible wait note
+    iStartingSharing = EPhaseCompleted;
+    delete iWizard;
+    iWizard = NULL;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::CreateSettingItemL
+// Creates list items
+// --------------------------------------------------------------------------
+//
+CAknSettingItem* CUPnPAppFileSharingList::CreateSettingItemL(TInt aIdentifier)
+    {
+    __LOG("CUPnPAppFileSharingList::CreateSettingItemL");
+
+    CAknSettingItem* settingItem = NULL;
+    switch (aIdentifier)
+        {
+        case ESharingUiSettingItemVisibility:
+            {
+            settingItem =
+                new (ELeave) CAknBinaryPopupSettingItem(aIdentifier,
+                                                        iVisibility);
+            break;
+            }
+
+        case ESharingUiSettingItemVisual:
+            {
+            settingItem = new (ELeave) CAknTextSettingItem(aIdentifier,
+                                                           iVisualAlbums);
+            break;
+            }
+
+        case ESharingUiSettingItemMusic:
+            {
+            settingItem = new (ELeave) CAknTextSettingItem(aIdentifier,
+                                                           iPlayLists);
+            break;
+            }
+
+        default:
+            {
+            __LOG("CUPnPAppFileSharingList::CreateSettingItemL \
+Unknown setting item!");
+            }
+        }
+
+    return settingItem;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::EditItemL
+// Called when setting list item is modified
+// --------------------------------------------------------------------------
+//
+void  CUPnPAppFileSharingList::EditItemL (TInt aIndex, 
+                                          TBool /*aCalledFromMenu*/)
+    {
+    __LOG("CUPnPAppFileSharingList::EditItemL");
+
+    LoadDataFromEngineL();
+
+    switch ( aIndex )
+        {
+        case ESharingUiSettingItemVisibility:
+            {
+            if ( !iVisibility )
+                {
+                if ( iIapId != KErrNotFound )
+                    {
+                    ShowWaitNoteL();
+                    }
+                else
+                    {
+                    iWizardRun = ETrue;
+
+                    MUPnPFileSharingEngineObserver* observer = 
+                                    iFileSharingEngine->Observer();
+                    
+                    delete iWizard;
+                    iWizard = NULL;
+                    iWizard = CUPnPAppWizard::NewL( 
+                        KNullDesC, iFileSharingEngine );
+                    iWizard->StartL();
+
+
+                    iFileSharingEngine->SetObserver(observer);
+                    iFileSharingEngine->RequestSharingProgressL();
+
+                    LoadDataFromEngineL();
+                    }
+                }
+            else
+                {
+                ShowWaitNoteL();
+                }
+            }
+            break;
+
+        default:
+            {
+            __LOG("CUPnPAppFileSharingList::EditItemL No such item!");
+            }
+        }
+
+    //load settings to screen
+    CAknSettingItemList::LoadSettingsL();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::LoadDataFromEngineL
+// Loads data from Central Repository to member variables
+// (other items were commented in a header).
+// --------------------------------------------------------------------------
+//
+void  CUPnPAppFileSharingList::LoadDataFromEngineL()
+    {
+    __LOG("CUPnPAppFileSharingList::LoadDataFromEngineL");
+
+    CUPnPSettingsEngine* settingsEngine = CUPnPSettingsEngine::NewL();
+    CleanupStack::PushL( settingsEngine );
+
+    // Read file sharing state
+    iVisibility = 0;
+    if ( iFileSharingEngine->SharingStateL() )
+        {
+        iVisibility = 1;
+        }
+
+    // Read iap id
+    settingsEngine->GetAccessPoint( iIapId );
+
+    //load settings to screen
+    CAknSettingItemList::LoadSettingsL ();
+    CleanupStack::PopAndDestroy( settingsEngine );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::HandleSharingStatus
+// Function informs when file sharing was enabled or disabled
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::HandleSharingStatus( 
+        CUPnPFileSharingEngine& /*aEngine*/, 
+        TInt aError, 
+        TBool aPhase )
+    {
+    __LOG("CUPnPAppFileSharingList::HandleSharingStatus begin");
+
+    if ( aPhase )
+        {
+        __LOG("start sharing");
+
+        if ( aError )
+            {
+            // change state back to off
+            iVisibility = EFalse;
+
+            // If there domtree wasn't able to be written due to disk full
+            // situation, send leave to kernel to inform user
+            if( aError == KErrDiskFull ||
+                aError == KErrNoMemory ||
+                aError == KErrInUse )
+                {
+                // stop the wait note
+                iStartingSharing = EPhaseCompleted;
+                //show some critical errors using
+                //default symbian error notes
+                CActiveScheduler::Current()->Error( aError );
+                }
+            else
+                {
+                // show error note
+                TRAP_IGNORE(
+                    HBufC* errorNote = StringLoader::LoadLC(
+                        R_SETTINGS_START_SHARING_ERROR_TEXT);
+                    CAknErrorNote* note = new (ELeave) CAknErrorNote(ETrue);
+                    note->ExecuteLD(*errorNote);
+                    CleanupStack::PopAndDestroy() ); //errorNote
+                }
+
+            }
+        else
+            {
+            // change secondary text
+            iVisibility = ETrue;
+            }
+        }
+    else
+        {
+        __LOG("stop sharing");
+
+        // If the media server lost, aError will be KErrGeneral or
+        // KErrServerTerminated.
+        // If there were other errors, stop sharing fails and visibility 
+        // will remain true.
+        if ( !aError || KErrGeneral == aError || 
+                KErrServerTerminated == aError )
+            {
+            iVisibility = EFalse;
+            }
+
+        // Note user not enough memory to change the phone state.
+        if ( KErrDiskFull == aError ||
+             KErrNoMemory == aError ||
+             KErrInUse == aError )
+            {
+            __LOG1( "Not enough memory to change the \
+                    phone state error:%d ", aError  );
+           
+            //There is nothing to do if leaves
+            TRAP_IGNORE(
+                HBufC* errorNote = StringLoader::LoadLC(
+                    R_SETTINGS_START_SHARING_PHONE_ERROR_TEXT, KCDrive );
+                CAknErrorNote* note = new( ELeave ) CAknErrorNote( ETrue );
+                note->ExecuteLD( *errorNote );
+                CleanupStack::PopAndDestroy( errorNote ) );
+            }  
+        
+        TRAP_IGNORE(
+            CAknSettingItemList::EditItemL(
+                ESharingUiSettingItemVisibility, EFalse ) );
+        }
+
+
+    iStartingSharing = EPhaseCompleted;
+    // Update UI
+    TRAP_IGNORE( CAknSettingItemList::LoadSettingsL() );
+    DrawDeferred();
+
+    __LOG("CUPnPAppFileSharingList::HandleSharingStatus end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::HandleSharingConnectionLost
+// Callback to inform if connection has been lost
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::HandleSharingConnectionLost( 
+        CUPnPFileSharingEngine& /*aEngine*/ )
+    {
+    __LOG("CUPnPAppFileSharingList::HandleSharingConnectionLost begin");
+
+    iVisibility = EFalse;
+    TRAPD( err,
+        CAknSettingItemList::EditItemL (
+            ESharingUiSettingItemVisibility, EFalse);
+        LoadSettingsL();
+        );
+    DrawDeferred();
+    if ( err != KErrNone )
+        {
+        //show some critical errors using
+        //default symbian error notes
+        CActiveScheduler::Current()->Error( err );
+        }
+
+    __LOG("CUPnPAppFileSharingList::HandleSharingConnectionLost end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::HandleResourceChange
+// From CAknDialog
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::HandleResourceChange( TInt aType )
+    {
+    __LOG("CUPnPAppFileSharingList::HandleResourceChange");
+
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect mainPaneRect;
+        AknLayoutUtils::LayoutMetricsRect(
+            AknLayoutUtils::EMainPane, mainPaneRect );
+
+        TAknLayoutRect layoutRect;
+        layoutRect.LayoutRect(
+            TRect( TPoint( 0, 0 ), mainPaneRect.Size() ),
+            AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
+
+        ListBox()->SetRect( layoutRect.Rect() );
+        }
+
+    // Base call
+    CAknSettingItemList::HandleResourceChange( aType );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::SetFilesharingTextsL
+// Update the secondary texts in the dialog
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::SetFilesharingTextsL( 
+    const RArray<TUpnpProgressInfo>& aProgressInfo )
+    {
+    __LOG( "[CUPnPAppFileSharingList]\t SetFilesharingTextsL begin" );
+
+
+    for ( TInt i(0); i < aProgressInfo.Count(); i++ )
+        {
+        if ( aProgressInfo[ i ].iProgressKind == EImageAndVideo )
+            {
+            if ( aProgressInfo[ i ].iProgressType == 
+                 TUpnpProgressInfo::EVisualStatus )
+                {
+                SetDefaultSecondaryTextsL( EImageAndVideo, 
+                                           aProgressInfo[ i ].iProgress );
+                }
+            else
+                {
+                SetProgressSecondaryTextsL( EImageAndVideo, 
+                                            aProgressInfo[ i ].iProgress );
+                }
+            }
+        else
+            {
+            if ( aProgressInfo[ i ].iProgressType == 
+                 TUpnpProgressInfo::EVisualStatus )
+                {
+                SetDefaultSecondaryTextsL( EPlaylist, 
+                                           aProgressInfo[ i ].iProgress );
+                }
+            else
+                {
+                SetProgressSecondaryTextsL( EPlaylist, 
+                                            aProgressInfo[ i ].iProgress );
+                }
+            }
+        }
+    if( ListBox() && ListBox()->BottomItemIndex() > 1 )
+        {
+        CAknSettingItemList::LoadSettingsL();
+        DrawDeferred();
+        }
+    __LOG( "[CUPnPAppFileSharingList]\t SetFilesharingTextsL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::SetDefaultSecondaryTextsL
+// Update the secondary texts in the dialog
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::SetDefaultSecondaryTextsL( 
+    const TInt& aMediaType, 
+    const TInt& aState )
+    {
+    __LOG( "[CUPnPAppFileSharingList]\t \
+SetDefaultSecondaryTextsL begin" );
+    HBufC* secondaryText = NULL;
+    switch ( aMediaType )
+        {
+    case EImageAndVideo :
+        {
+        if ( aState == EShareAll)
+            {
+            secondaryText = StringLoader::LoadLC(
+                R_VISUAL_ALBUMS_SHARE_MANY_TEXT);
+            }
+
+        else if ( aState == EShareNone)
+            {
+            secondaryText = StringLoader::LoadLC(
+                R_VISUAL_ALBUMS_SHARE_NOTHING_TEXT);
+            }
+
+        else // there were shared files
+            {
+            secondaryText = StringLoader::LoadLC(
+                R_VISUAL_ALBUMS_SHARE_ONE_TEXT);
+            }
+
+        iVisualAlbums.Copy( *secondaryText );
+        }
+        break;
+    case EPlaylist :
+        {
+        if ( aState == EShareAll)
+            {
+            secondaryText = StringLoader::LoadLC(R_MUSIC_SHARE_MANY_TEXT);
+            }
+
+        else if ( aState == EShareNone)
+            {
+            secondaryText = StringLoader::LoadLC(
+                R_MUSIC_SHARE_NOTHING_TEXT);
+            }
+
+        else // there were shared files
+            {
+            secondaryText = StringLoader::LoadLC(R_MUSIC_SHARE_ONE_TEXT);
+
+            }
+
+        iPlayLists.Copy( *secondaryText );
+        }
+        break;
+    default:
+        break;
+        }
+    CleanupStack::PopAndDestroy( secondaryText );
+    __LOG( "[CUPnPAppFileSharingList]\t SetDefaultSecondaryTextsL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::SetProgressSecondaryTextsL
+// Update the secondary texts in the dialog
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::SetProgressSecondaryTextsL( 
+    const TInt& aMediaType, 
+    const TInt& aProgress )
+    {
+    __LOG( "[CUPnPAppFileSharingList]\t \
+SetProgressSecondaryTextsL begin" );
+
+    HBufC* secondaryText = StringLoader::LoadLC(
+            R_SHARINGUI_SECONDARY_IN_PROGRESS, aProgress );
+
+    switch ( aMediaType )
+        {
+    case EImageAndVideo :
+        {
+        iVisualAlbums.Copy(*secondaryText);
+        }
+        break;
+    case EPlaylist :
+        {
+        iPlayLists.Copy(*secondaryText);
+        }
+        break;
+    default:
+        break;
+        }
+    CleanupStack::PopAndDestroy( secondaryText );
+    __LOG( "[CUPnPAppFileSharingList]\t SetProgressSecondaryTextsL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::FocusChanged
+// From CAknDialog
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::FocusChanged( 
+    TDrawNow  /*aDrawNow*/ )
+    {
+    __LOG( "[CUPnPAppFileSharingList]\t \
+FocusChanged begin" );
+    if ( iWizardRun )
+        {
+        TRAP_IGNORE( iFileSharingEngine->RequestSharingProgressL());
+        iWizardRun = EFalse;
+        }
+
+    __LOG( "[CUPnPAppFileSharingList]\t FocusChanged end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::ShowWaitNoteL
+// Shows standard wait note
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::ShowWaitNoteL()
+    {
+    __LOG("[CUPnPAppFileSharingList]\t CUPnPAppFileSharingList::\
+ShowWaitNoteL begin");
+    TInt resId( R_SHARINGUI_STOPPING_FILE_SHARING_NOTE_DIALOG );
+    if ( !iVisibility )
+        {
+        resId = R_SHARINGUI_STARTING_FILE_SHARING_NOTE_DIALOG;
+        }
+
+    iStartingSharing = EPhaseNotActive;
+    CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL();
+    CleanupStack::PushL(reinterpret_cast<CBase*>(waitNoteWrapper));
+    waitNoteWrapper->ExecuteL(
+        resId,      // TInt aResId,
+        *this,            // MAknBackgroundProcess& aBackgroundProcess
+        ETrue);
+    CleanupStack::PopAndDestroy();
+    __LOG("[CUPnPAppFileSharingList]\t CUPnPAppFileSharingList::\
+ShowWaitNoteL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::StepL
+// Step done during wait note
+// From MAknBackgroundProcess
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::StepL(void)
+    {
+    if ( iStartingSharing == EPhaseNotActive )
+        {
+        iStartingSharing = EPhaseProcessing;
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::IsProcessDone
+// Returns ETrue if process finished
+// From MAknBackgroundProcess
+// --------------------------------------------------------------------------
+//
+TBool CUPnPAppFileSharingList::IsProcessDone(void) const
+    {
+    
+    TBool ret(EFalse);
+    if ( iStartingSharing == EPhaseNotActive )
+        {
+        if ( !iVisibility )
+            {
+            TRAPD( err, iFileSharingEngine->SetSharingStateL( ETrue ) );
+            if( err != KErrNone )
+                {
+                return ETrue;
+                }
+            }
+        else
+            {
+            TRAPD( err, iFileSharingEngine->SetSharingStateL( EFalse ) );
+            if( err != KErrNone )
+                {
+                return ETrue;
+                }
+            }
+        }
+    else if ( iStartingSharing == EPhaseCompleted )
+        {
+        ret = ETrue;
+        }
+    else
+        {
+        __LOG("CUPnPAppFileSharingList::IsProcessDone: else branch");
+        }
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPAppFileSharingList::UpdateVisibitySettingItemL
+// Update the visibity of item ,when the list is switched foregroud.
+// --------------------------------------------------------------------------
+//
+void CUPnPAppFileSharingList::UpdateVisibitySettingItemL()
+    {
+    CUPnPSettingsEngine* settingsEngine = CUPnPSettingsEngine::NewL();
+    CleanupStack::PushL( settingsEngine );
+
+    // Read file sharing state
+    TInt Visibility = 0;
+    if ( iFileSharingEngine->SharingStateL() )
+         {
+         Visibility = 1;
+         }
+    CleanupStack::PopAndDestroy( settingsEngine );
+    
+    if( Visibility != iVisibility )
+        {
+        iVisibility = Visibility;
+        CAknSettingItemList::LoadSettingsL();
+        DrawDeferred();
+        }
+    
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/bwins/upnpapplicationengineU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,19 @@
+EXPORTS
+	??1CUPnPFileSharingEngine@@UAE@XZ @ 1 NONAME ; CUPnPFileSharingEngine::~CUPnPFileSharingEngine(void)
+	?GetSelectionContentL@CUPnPFileSharingEngine@@QBEXAAVCDesC16Array@@@Z @ 2 NONAME ; void CUPnPFileSharingEngine::GetSelectionContentL(class CDesC16Array &) const
+	?GetSelectionIndexesL@CUPnPFileSharingEngine@@QBEXAAV?$CArrayFix@H@@@Z @ 3 NONAME ; void CUPnPFileSharingEngine::GetSelectionIndexesL(class CArrayFix<int> &) const
+	?NewL@CUPnPFileSharingEngine@@SAPAV1@XZ @ 4 NONAME ; class CUPnPFileSharingEngine * CUPnPFileSharingEngine::NewL(void)
+	?NewLC@CUPnPFileSharingEngine@@SAPAV1@XZ @ 5 NONAME ; class CUPnPFileSharingEngine * CUPnPFileSharingEngine::NewLC(void)
+	?Observer@CUPnPFileSharingEngine@@QAEPAVMUPnPFileSharingEngineObserver@@XZ @ 6 NONAME ; class MUPnPFileSharingEngineObserver * CUPnPFileSharingEngine::Observer(void)
+	?RefreshSharedMediaL@CUPnPFileSharingEngine@@QAEXW4THomeConnectMediaType@@@Z @ 7 NONAME ; void CUPnPFileSharingEngine::RefreshSharedMediaL(enum THomeConnectMediaType)
+	?RequestSelectionContentL@CUPnPFileSharingEngine@@QAEXW4THomeConnectMediaType@@@Z @ 8 NONAME ; void CUPnPFileSharingEngine::RequestSelectionContentL(enum THomeConnectMediaType)
+	?RequestSelectionIndexesL@CUPnPFileSharingEngine@@QBEXW4THomeConnectMediaType@@@Z @ 9 NONAME ; void CUPnPFileSharingEngine::RequestSelectionIndexesL(enum THomeConnectMediaType) const
+	?RequestSharingProgressL@CUPnPFileSharingEngine@@QAEXXZ @ 10 NONAME ; void CUPnPFileSharingEngine::RequestSharingProgressL(void)
+	?SetObserver@CUPnPFileSharingEngine@@QAEXPAVMUPnPFileSharingEngineObserver@@@Z @ 11 NONAME ; void CUPnPFileSharingEngine::SetObserver(class MUPnPFileSharingEngineObserver *)
+	?SetSelectionIndexesL@CUPnPFileSharingEngine@@QAEXW4THomeConnectMediaType@@ABV?$CArrayFix@H@@@Z @ 12 NONAME ; void CUPnPFileSharingEngine::SetSelectionIndexesL(enum THomeConnectMediaType, class CArrayFix<int> const &)
+	?SetSharingStateL@CUPnPFileSharingEngine@@QAEXH@Z @ 13 NONAME ; void CUPnPFileSharingEngine::SetSharingStateL(int)
+	?ShareMediaL@CUPnPFileSharingEngine@@QAEXW4THomeConnectMediaType@@@Z @ 14 NONAME ; void CUPnPFileSharingEngine::ShareMediaL(enum THomeConnectMediaType)
+	?SharingStateL@CUPnPFileSharingEngine@@QAEHXZ @ 15 NONAME ; int CUPnPFileSharingEngine::SharingStateL(void)
+	?StartUploadListenerL@CUPnPFileSharingEngine@@QAEXXZ @ 16 NONAME ; void CUPnPFileSharingEngine::StartUploadListenerL(void)
+	?StopUploadListenerL@CUPnPFileSharingEngine@@QAEXXZ @ 17 NONAME ; void CUPnPFileSharingEngine::StopUploadListenerL(void)
+
Binary file upnpsharing/applicationengine/data/upnp_ms_jpeg_lrg.jpg has changed
Binary file upnpsharing/applicationengine/data/upnp_ms_jpeg_sm.jpg has changed
Binary file upnpsharing/applicationengine/data/upnp_ms_png_lrg.png has changed
Binary file upnpsharing/applicationengine/data/upnp_ms_png_sm.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/eabi/upnpapplicationengineU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,23 @@
+EXPORTS
+	_ZN22CUPnPFileSharingEngine11SetObserverEP30MUPnPFileSharingEngineObserver @ 1 NONAME
+	_ZN22CUPnPFileSharingEngine11ShareMediaLE21THomeConnectMediaType @ 2 NONAME
+	_ZN22CUPnPFileSharingEngine13SharingStateLEv @ 3 NONAME
+	_ZN22CUPnPFileSharingEngine16SetSharingStateLEi @ 4 NONAME
+	_ZN22CUPnPFileSharingEngine19RefreshSharedMediaLE21THomeConnectMediaType @ 5 NONAME
+	_ZN22CUPnPFileSharingEngine19StopUploadListenerLEv @ 6 NONAME
+	_ZN22CUPnPFileSharingEngine20SetSelectionIndexesLE21THomeConnectMediaTypeRK9CArrayFixIiE @ 7 NONAME
+	_ZN22CUPnPFileSharingEngine20StartUploadListenerLEv @ 8 NONAME
+	_ZN22CUPnPFileSharingEngine23RequestSharingProgressLEv @ 9 NONAME
+	_ZN22CUPnPFileSharingEngine24RequestSelectionContentLE21THomeConnectMediaType @ 10 NONAME
+	_ZN22CUPnPFileSharingEngine4NewLEv @ 11 NONAME
+	_ZN22CUPnPFileSharingEngine5NewLCEv @ 12 NONAME
+	_ZN22CUPnPFileSharingEngine8ObserverEv @ 13 NONAME
+	_ZN22CUPnPFileSharingEngineD0Ev @ 14 NONAME
+	_ZN22CUPnPFileSharingEngineD1Ev @ 15 NONAME
+	_ZN22CUPnPFileSharingEngineD2Ev @ 16 NONAME
+	_ZNK22CUPnPFileSharingEngine20GetSelectionContentLER12CDesC16Array @ 17 NONAME
+	_ZNK22CUPnPFileSharingEngine20GetSelectionIndexesLER9CArrayFixIiE @ 18 NONAME
+	_ZNK22CUPnPFileSharingEngine24RequestSelectionIndexesLE21THomeConnectMediaType @ 19 NONAME
+	_ZTI22CUPnPFileSharingEngine @ 20 NONAME ; #<TI>#
+	_ZTV22CUPnPFileSharingEngine @ 21 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for project Application Engine
+*
+*/
+
+
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+// Mediaserver icons
+../data/upnp_ms_jpeg_lrg.jpg /epoc32/release/winscw/udeb/Z/system/apps/upnp/upnp_ms_jpeg_lrg.jpg
+../data/upnp_ms_jpeg_lrg.jpg /epoc32/release/winscw/urel/Z/system/apps/upnp/upnp_ms_jpeg_lrg.jpg
+../data/upnp_ms_jpeg_lrg.jpg /epoc32/release/armv5/udeb/Z/system/apps/upnp/upnp_ms_jpeg_lrg.jpg
+../data/upnp_ms_jpeg_lrg.jpg /epoc32/release/armv5/urel/Z/system/apps/upnp/upnp_ms_jpeg_lrg.jpg
+
+../data/upnp_ms_jpeg_sm.jpg /epoc32/release/winscw/udeb/Z/system/apps/upnp/upnp_ms_jpeg_sm.jpg
+../data/upnp_ms_jpeg_sm.jpg /epoc32/release/winscw/urel/Z/system/apps/upnp/upnp_ms_jpeg_sm.jpg
+../data/upnp_ms_jpeg_sm.jpg /epoc32/release/armv5/udeb/Z/system/apps/upnp/upnp_ms_jpeg_sm.jpg
+../data/upnp_ms_jpeg_sm.jpg /epoc32/release/armv5/urel/Z/system/apps/upnp/upnp_ms_jpeg_sm.jpg
+
+../data/upnp_ms_png_lrg.png /epoc32/release/winscw/udeb/Z/system/apps/upnp/upnp_ms_png_lrg.png
+../data/upnp_ms_png_lrg.png /epoc32/release/winscw/urel/Z/system/apps/upnp/upnp_ms_png_lrg.png
+../data/upnp_ms_png_lrg.png /epoc32/release/armv5/udeb/Z/system/apps/upnp/upnp_ms_png_lrg.png
+../data/upnp_ms_png_lrg.png /epoc32/release/armv5/urel/Z/system/apps/upnp/upnp_ms_png_lrg.png
+
+../data/upnp_ms_png_sm.png /epoc32/release/winscw/udeb/Z/system/apps/upnp/upnp_ms_png_sm.png
+../data/upnp_ms_png_sm.png /epoc32/release/winscw/urel/Z/system/apps/upnp/upnp_ms_png_sm.png
+../data/upnp_ms_png_sm.png /epoc32/release/armv5/udeb/Z/system/apps/upnp/upnp_ms_png_sm.png
+../data/upnp_ms_png_sm.png /epoc32/release/armv5/urel/Z/system/apps/upnp/upnp_ms_png_sm.png
+
+
+../inc/upnpfilesharingengine.h            |../../../inc/upnpfilesharingengine.h
+../inc/upnpfilesharingengineobserver.h    |../../../inc/upnpfilesharingengineobserver.h
+
+PRJ_MMPFILES
+upnpapplicationengine.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/group/upnpapplicationengine.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project Application Engine
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+TARGET upnpapplicationengine.dll
+TARGETTYPE dll
+UID 0x1000008d 0x10208A0B
+
+// Enable UPnPSecurity
+MACRO ENABLE_UPNP_SECURITY
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+USERINCLUDE ../inc 
+USERINCLUDE ../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH ../src
+SOURCE upnpcontentrequestao.cpp
+SOURCE upnpcontentshareao.cpp
+SOURCE upnpfilesharingengine.cpp
+SOURCE upnpfilesharingengineao.cpp
+SOURCE upnpiconconfigurator.cpp
+SOURCE upnpprogresswatcher.cpp
+
+
+LIBRARY euser.lib
+LIBRARY bafl.lib
+LIBRARY centralrepository.lib
+LIBRARY upnpserviceframework.lib
+LIBRARY avmediaserverclient.lib
+LIBRARY upnpipserversutils.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+
+// content server
+LIBRARY upnpcontentserverclient.lib
+// UPnPSecurity
+LIBRARY upnpsecurity.lib
+// PathInfo
+LIBRARY PlatformEnv.lib
+// UpnpCommonUtils
+LIBRARY upnputilities.lib
+// UPnPAVControllerFactory
+LIBRARY upnpavcontrollerclient.lib
+LIBRARY upnpavcontrollerhelper.lib
+LIBRARY upnpsettingsengine.lib
+
+LIBRARY commdb.lib
+
+DEBUGLIBRARY flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/inc/upnpcontentrequestao.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      content fetching engine active object class defition
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPCONTENTREQUESTAO_H__
+#define __UPNPCONTENTREQUESTAO_H__
+
+
+// Include Files
+#include <e32base.h>
+#include <badesca.h>  //for CDesCArray
+#include "upnpcontentserverclient.h"
+
+// FORWARD DECLARATIONS
+class CUPnPFileSharingEngine;
+
+
+// CLASS DECLARATION
+/**
+ *  Active object class for querying shared content from upnpcontentserver
+ *  @lib upnpapplicationengine.lib
+ *  @since S60 3.1
+ */
+NONSHARABLE_CLASS( CUpnpContentRequestAO ): public CActive
+    {
+
+public: // Constructors and destructor
+
+    /**
+     * C++ default constructor.
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     * @param aContentServer Handle to upnpcontentserver
+     */
+    CUpnpContentRequestAO(
+        CUPnPFileSharingEngine& aEngine, 
+        RUpnpContentServerClient& aContentServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpContentRequestAO();
+
+public: // new functions
+
+    /**
+     * Request playlist or album names for UI from server, asynchronous
+     * @since S60 3.1
+     * @param aType Type of selections to request
+     */
+    void RequestSelectionContentL( UpnpContentServer::TUpnpMediaType aType );
+
+    /**
+     * Get playlist or album names for UI after request, synchronous
+     * @since S60 3.1
+     * @param aArray Array for albums / playlist names
+     */
+    void GetSelectionContentL( CDesCArray& aArray );
+
+    /**
+     * Request selected items for UI from server, asynchronous
+     * @since S60 3.1
+     * @param aType Type of selections to request
+     */
+    void RequestSelectionIndexesL(
+        UpnpContentServer::TUpnpMediaType aType );
+
+    /**
+     * Get the selected items for UI after request, synchronous
+     * @since S60 3.1
+     * @param aCurrentSelection Array for selection indexes
+     */
+    void GetSelectionIndexesL( CArrayFix<TInt>& aCurrentSelection );
+
+private: // from CActive
+
+    /**
+     * Function is called when active request is ready
+     * @since S60 3.1
+     */
+    virtual void RunL();
+
+    /**
+     * Cancels active request
+     * @since S60 3.1
+     */
+    virtual void DoCancel();
+
+private: // data
+
+    /**
+     * file sharing engine
+     */
+    CUPnPFileSharingEngine& iEngine;
+
+    /**
+     * Content server session handle
+     */
+    RUpnpContentServerClient& iContentServer;
+
+    /**
+     * Current state
+     */
+    enum TState
+        {
+        ENone = 0,
+        ERequestContent,
+        ERequestIndexes
+        };
+    TState iState;
+
+    };
+
+#endif  // __UPNPCONTENTREQUESTAO_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/inc/upnpcontentshareao.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      file sharing engine class definition               
+*
+*/
+
+
+
+
+
+#ifndef __UPNPCONTENTSHAREAO_H__
+#define __UPNPCONTENTSHAREAO_H__
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpcontentserverclient.h"
+
+// FORWARD DECLARATIONS
+class CUPnPFileSharingEngine;
+
+/**
+ *  A class to send request to content server and get the responce.
+ * *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CUpnpContentShareAO ) : public CActive
+    {
+
+private:
+
+   /**
+    * C++ constructor.
+    * @since S60 3.2
+    * @param aEngine the file sharing engine
+    * @aContentServer the contentserver client
+    */
+    CUpnpContentShareAO( 
+            CUPnPFileSharingEngine& aEngine,
+            RUpnpContentServerClient& aContentServer );
+
+    /**
+     * Perform the second phase construction
+     * @since S60 3.2
+     */
+    void ConstructL(); 
+
+public:
+            
+    /**
+     * Two-phased constructor.
+     * @since S60 3.2
+     * @param aEngine the file sharing engine
+     * @aContentServer the contentserver client
+     */
+     static CUpnpContentShareAO* NewL( 
+             CUPnPFileSharingEngine& aEngine, 
+             RUpnpContentServerClient& aContentServer );
+
+    /**
+     * Two-phased constructor.
+     * @since S60 3.2
+     * @param aEngine the file sharing engine
+     * @aContentServer the contentserver client
+     */
+     static CUpnpContentShareAO* NewLC( 
+             CUPnPFileSharingEngine& aEngine, 
+             RUpnpContentServerClient& aContentServer );
+
+   /**
+    * C++ destructor.
+    */
+    virtual ~CUpnpContentShareAO();   
+    
+    /**
+     * Sends the selected indexes to server and starts sharing
+     * @since S60 3.2
+     * @param aMarkedItems List of selected indexes
+     * @param aType Type of selection
+     */
+    void ChangeSharedContentL(
+        UpnpContentServer::TUpnpMediaType aType,
+        const CArrayFix<TInt>& aMarkedItems );
+
+    /**
+     * Updates shared objects in mediaserver
+     * @since S60 3.2
+     * @param aType Type of media to refresh
+     */
+    void RefreshSharedContentL( 
+        UpnpContentServer::TUpnpMediaType aType );
+    
+protected:
+
+   /**
+    * Function is called when active request is ready
+    * @since S60 3.2
+    */
+   void RunL();
+
+   /**
+    * Cancels active request
+    * @since S60 3.2
+    */
+   void DoCancel();
+
+   /**
+    * Handles a leave occurring in the request completion event handler RunL()
+    * @since S60 3.2
+    */
+   TInt RunError( TInt aError );
+   
+private: // New functions
+    
+    /**
+     * Removes queued objects by given index.
+     * @since S60 5.1
+     * @param aIndex The index of objects to be removed.
+     */
+    void RemoveQueuedObject( TInt aIndex );
+    
+    /**
+     * Removes Queued objects by type.
+     * @since S60 5.1
+     * @param aType The type of objects to be removed.
+     */
+    void RemoveQueuedObjectByType( UpnpContentServer::TUpnpMediaType aType );
+    
+    /**
+     * Appends given Queued objects.
+     * @since S60 5.1
+     * @param aType The type to appended
+     * @param aSelections The selection array to be appended. Can be NULL.
+     */
+    void AppendQueuedObjectL( 
+            UpnpContentServer::TUpnpMediaType aType, 
+            CArrayFix<TInt>* aSelections );
+
+private: // data
+
+    /**
+     * File sharing engine
+     */
+    CUPnPFileSharingEngine& iEngine;
+
+    /**
+     * Content server session handle
+     */
+    RUpnpContentServerClient& iContentServer; 
+
+    /**
+     * Queued selection indexes
+     */
+    typedef CArrayFix<TInt> CSelections;
+    RPointerArray<CSelections> iQueuedSelections;
+
+    /**
+     * Queued selection types
+     */
+    RArray<UpnpContentServer::TUpnpMediaType> iQueuedTypes;
+
+    };
+
+#endif // __UPNPCONTENTSHAREAO_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/inc/upnpfilesharingengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,326 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      file sharing engine class definition
+ *
+*/
+
+
+
+
+
+#ifndef __UPNPFILESHARINGENGINE_H__
+#define __UPNPFILESHARINGENGINE_H__
+
+
+//  Include Files
+#include <e32base.h>    // CBase
+#include <e32std.h>     // TBuf
+#include <badesca.h>    // for CDesCArray
+
+#include "upnpconnectionmonitorobserver.h"
+#include "upnpcontentserverclient.h"
+#include "upnpfilesharingengineobserver.h"
+
+// FORWARD DECLARATIONS
+class CUpnpContentRequestAO;
+class CUPnPFileSharingEngineAO;
+class CUpnpContentShareAO;
+class CUpnpProgressWatcher;
+class CUPnPConnectionMonitor;
+
+
+// CONSTANTS
+
+
+// ENUMERATIONS
+
+enum THomeConnectMediaType
+    {
+    EImageAndVideo = 0,
+    EPlaylist,
+    EPhotoFile,
+    EVideoFile,
+    EMusicFile
+    };
+
+enum THomeConnectSharingStates
+    {
+    ENoChange = -99,
+    EShareNone = 0,
+    EShareMany,
+    EShareAll
+    };    
+
+// CLASS DECLARATION
+
+/**
+ *  File sharing engine class for UPnP Home Connect Application
+ *  @lib upnpapplicationengine.lib
+ *  @since S60 3.1
+ */
+class CUPnPFileSharingEngine : public CBase,
+                               public MUPnPConnectionMonitorObserver
+    {
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUPnPFileSharingEngine();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     * @since S60 3.1
+     */
+    IMPORT_C static CUPnPFileSharingEngine* NewL();
+
+    /**
+     * Two-phased constructor.
+     * @since S60 3.1
+     */
+    IMPORT_C static CUPnPFileSharingEngine* NewLC();
+
+    /**
+     * Destructor.
+     * @since S60 3.1
+     */
+    IMPORT_C virtual ~CUPnPFileSharingEngine();
+
+public:
+
+    /**
+     * Sets observer for active object
+     * @since S60 3.1
+     * @param aObserver, observer class
+     */
+    IMPORT_C void SetObserver( MUPnPFileSharingEngineObserver* aObserver );
+
+    /**
+     * Return handle to MUPnPFileSharingEngineObserver interface
+     * @since S60 3.1
+     */
+    IMPORT_C MUPnPFileSharingEngineObserver* Observer();
+
+    /**
+     * Sets sharing state to on or off
+     * Asynchronous, callback to 
+     * MUPnPFileSharingEngineObserver::HandleSharingStatus
+     * @since S60 3.1
+     * @param aState ETrue to enable sharing, otherwise EFalse
+     */
+    IMPORT_C void SetSharingStateL( TBool aState );
+
+    /**
+     * Gets file sharing state from local MediaServer
+     * @since S60 3.1
+     * @return ETrue if sharing is ON otherwise EFalse
+     */
+    IMPORT_C TBool SharingStateL();
+
+    /**
+     * Starts sharing process
+     * Asynchronous, callback to 
+     * MUPnPFileSharingEngineObserver::HandleSharingDone and
+     * MUPnPFileSharingEngineObserver::HandleSharingProgress
+     * @since S60 3.1
+     * @param aType, Type of media to share
+     */
+    IMPORT_C void ShareMediaL( THomeConnectMediaType aType );
+
+    /**
+     * Updates shared objects
+     * Asynchronous, callback to 
+     * MUPnPFileSharingEngineObserver::HandleSharingDone and
+     * MUPnPFileSharingEngineObserver::HandleSharingProgress
+     * @since S60 3.1
+     * @param aType Type of media to refresh
+     */
+    IMPORT_C void RefreshSharedMediaL( THomeConnectMediaType aType );
+
+    /**
+     * Gets the selected albums/playlist indexes
+     * Asynchronous, callback to 
+     * MUPnPFileSharingEngineObserver::HandleSelectionIndexes
+     * @since S60 3.1
+     * @param aType Type of media selected
+     */
+    IMPORT_C void RequestSelectionIndexesL( 
+        THomeConnectMediaType aType ) const;
+
+    /**
+     * Gets the selected albums/playlist indexes
+     * @since S60 3.1
+     * @param aMarkedItems The indexes of the selections user has made\
+relative to selections received from GetSelectionContentL
+     */
+    IMPORT_C void GetSelectionIndexesL(
+        CArrayFix<TInt>& aMarkedItems ) const;
+
+    /**
+     * Sets the user selections
+     * @since S60 3.1
+     * @param aType Type of media selected
+     * @param aMarkedItems The indexes of the selections user has made\
+relative to selections received from GetSelectionContentL
+     */
+    IMPORT_C void SetSelectionIndexesL( 
+        THomeConnectMediaType aType,
+        const CArrayFix<TInt>& aMarkedItems );
+
+    /**
+     * Requests the album /playlist names
+     * Asynchronous, callback to 
+     * MUPnPFileSharingEngineObserver::HandleSelectionContent
+     * @since S60 3.1
+     * @param aType Type of the media requested
+     */
+    IMPORT_C void RequestSelectionContentL( THomeConnectMediaType aType );
+
+    /**
+     * Gets the album /playlist names from upnpcontentserver once ready
+     * @since S60 3.1
+     * @param aType Container type
+     * @param aArray Array containng the names for the UI
+     */
+    IMPORT_C void GetSelectionContentL( CDesCArray& aArray ) const;
+
+    /**
+     * Request information about sharing statuses / progress from the
+     * contentserver. The information is received via callback
+     * @since S60 3.1
+     */
+    IMPORT_C void RequestSharingProgressL();
+
+    /**
+     * Starts upload listener. Leave in case of error
+     * @since S60 3.1
+     */
+    IMPORT_C void StartUploadListenerL();
+
+    /**
+     * Stops upload listener. Leave in case of error
+     * @since S60 3.1
+     */
+    IMPORT_C void StopUploadListenerL();
+
+    /**
+     * Start or stop connection monitoring
+     * @since S60 3.1
+     * @param aState ETrue = Start, EFalse = Stop
+     * @param aStatus TRequestStatus for async operation
+     */
+    void SetConMonStateL( TBool aState, TRequestStatus& aStatus );
+	
+     /**
+     * Set share file completed flag
+     * @since S60 3.2.3
+     * @param aShareState set ETrue indicate imageandvideo or playlist shared completely, 
+     * perhaps both of them shared completely.
+     * EFalse  indicate imageandvideo or playlist shared incompletely,
+     * perhaps both of them shared completely.
+     */
+    void SetShareFileComplete( TBool aShareState ) ;
+
+private:
+
+    /**
+     * Helper function to copy TInts between arrays of CArrayFix<TInt>&
+     * @since S60 3.1
+     */
+    void CopyTintArrayL( const CArrayFix<TInt>& aSrc,
+                         CArrayFix<TInt>& aDst) const;
+
+    /**
+     * Helper function to copy descriptors between arrays of CDesCArrays
+     * @since S60 3.1
+     */
+    void CopyCdescArrayL( const CDesCArray& aSrc,
+                          CDesCArray& aDst ) const;
+
+private : // From MUPnPConnectionMonitorObserver
+
+    /**
+     * Update the sharing state variable in case WLAN connection is lost
+     * From MUPnPConnectionMonitorObserver
+     * @since S60 3.1
+     */
+    void ConnectionLost();
+
+private: // data
+
+    /**
+     * Active object for asynchronous file sharing
+     */
+    CUPnPFileSharingEngineAO* iAO;
+    
+    /**
+     * Active object for asynchronous get responce from content server
+     * Owned.
+     */
+    CUpnpContentShareAO* iContentSharer;
+
+    /**
+     * Active object class retrieving information about selections and
+     * content from upnpcontentserver
+     */
+    CUpnpContentRequestAO* iContentRequestor;
+
+    /**
+     * Cached image selections
+     */
+    CArrayFixFlat<TInt>* iImageSelections;
+
+    /**
+     * Cached music selections
+     */
+    CArrayFixFlat<TInt>* iMusicSelections;
+
+    /**
+     * Client side handle to upnpcontentserver
+     */
+    RUpnpContentServerClient iContentServer;
+
+    /**
+     * Observer for file sharing state
+     */
+    MUPnPFileSharingEngineObserver* iObserver;
+    
+     /**
+     * Set share file completed flag.      
+     */
+    TBool iShareFileState;
+
+    /**
+     * Connection monitor
+     */
+    CUPnPConnectionMonitor* iConnMon;
+
+    /**
+     * Active object handling querying progress
+     */
+    CUpnpProgressWatcher* iProgress;
+
+    };
+
+#endif  // __UPNPFILESHARINGENGINE_H__
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/inc/upnpfilesharingengineao.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      file sharing engine active object class definition
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPFILESHARINGENGINEAO_H__
+#define __UPNPFILESHARINGENGINEAO_H__
+
+
+// Include Files
+#include <e32base.h>
+#include <badesca.h>  //for CDesCArray
+#include <upnpmediaserverclient.h>
+#include "upnpcontentserverclient.h"
+
+// FORWARD DECLARATIONS
+class CUPnPFileSharingEngine;
+class CUPnPIconConfigurator;
+
+// CLASS DECLARATION
+/**
+ *  Active object class for file sharing
+ *  Handles starting and stopping of filesharing and upload listener
+ *  @lib upnpapplicationengine.lib
+ *  @since S60 3.1
+ */
+NONSHARABLE_CLASS( CUPnPFileSharingEngineAO ): public CActive
+    {
+
+public: // Constructors and destructor
+
+    /**
+     * C++ default constructor.
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     * @param aContentServer Handle to upnpcontentserver
+     */
+    CUPnPFileSharingEngineAO( 
+        CUPnPFileSharingEngine& aEngine, 
+        RUpnpContentServerClient& aContentServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPFileSharingEngineAO();
+
+private: // From CActive
+
+    /**
+     * Function is called when active request is ready
+     * @since S60 3.1
+     */
+    void RunL();
+
+    /**
+     * Handles a leave occurring in the request completion event handler
+     * @since S60 3.1
+     * @param aError The leave code
+     */
+    TInt RunError( TInt aError );
+
+    /**
+     * Cancels active request
+     * @since S60 3.1
+     */
+    void DoCancel();
+
+public: // new functions
+
+    /**
+     * Starts file sharing process
+     * @since S60 3.1
+     * @param aState ETrue to enable sharing, otherwise EFalse
+     */
+    void SetSharingStateL( TBool aState );
+
+    /**
+     * Gets file sharing state from local MediaServer
+     * @since S60 3.1
+     * @return ETrue if sharing is ON otherwise EFalse
+     */
+    TBool SharingStateL();
+
+    /**
+     * Set the internal state of class in case connection is lost
+     * @since S60 3.1
+     */
+    void ConnectionLost();
+
+    /**
+     * Check that there is enough disk space in c drive
+     * @since S60 3.1
+     * @return EFalse if there is no disk space
+     */
+    TBool HasDiskSpace();
+
+    /**
+     * Inform that settings of mediaserver icon is complete
+     * @since S60 3.2
+     * @param aError Error code of the operation
+     */
+    void SetIconComplete( TInt aError );
+
+private:
+
+    /**
+     * Open connection to media server
+     * @since S60 3.1
+     */
+    TInt OpenMediaServer();
+
+    /**
+     *Enables upnp security
+     */
+    void EnableUpnpSecurityL();
+
+    /**
+     * Checks whether mediaserver icons need to be configured
+     */
+    void CheckMediaserverIconsL();
+
+private: // Data
+
+    /**
+     * file sharing engine
+     */
+    CUPnPFileSharingEngine& iEngine;
+
+    /**
+     * Content server session handle
+     */
+    RUpnpContentServerClient& iContentServer;
+
+    /**
+     * mediaserver session handle
+     */
+    RUpnpMediaServerClient iMediaServer;
+
+    /**
+     * Internal state
+     */
+    enum TState
+        {
+        ENotActive,
+        EStartSharing,
+        EStopSharing,
+        ECheckIcon,
+        EWaitSetConMonStateTrue,
+        EWaitSetConMonStateFalse
+        };
+    TState  iState;
+
+    /**
+     * Cached value of sharing state
+     */
+    enum TUpnpVisibility
+        {
+        EUnknown = 0,
+        EOnline,
+        EOffline
+        };
+    TUpnpVisibility iVisibility;
+
+    /**
+     * handle add icons
+     * owned
+     */
+    CUPnPIconConfigurator* iIconConfigurator;
+
+    };
+
+#endif  // __UPNPFILESHARINGENGINEAO_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/inc/upnpfilesharingengineobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File sharing observer class definition
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPAPPSHARINGENGINEOBSERVER_H__
+#define __UPNPAPPSHARINGENGINEOBSERVER_H__
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "upnpcontentserverclient.h"
+
+// FORWARD DECLARATIONS
+class CUPnPFileSharingEngine;
+
+
+// CONSTANTS
+
+
+/**
+ *  File sharing observer definition
+ *  @lib upnpapplicationengine.lib
+ *  @since S60 3.1
+ */
+class MUPnPFileSharingEngineObserver
+    {
+
+public:    
+
+    /**
+     * Virtual destructor
+     */
+    virtual ~MUPnPFileSharingEngineObserver() {};
+
+    /**
+     * Function informs when file sharing was enabled or disabled
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     * @param aError, error code
+     * @param aPhase ETrue if current phase is sharing activation,
+     * otherwise EFalse
+     */
+    virtual void HandleSharingStatus( 
+        CUPnPFileSharingEngine& /*aEngine*/, 
+        TInt /*aError*/, 
+        TBool /*aPhase*/ ) {}
+
+    /**
+     * Informs about status of the sharing progress
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     * @param aProgress Data contains information about sharing\
+ progress
+     */                                          
+    virtual void HandleSharingProgress(
+        CUPnPFileSharingEngine& /*aEngine*/, 
+        const RArray<TUpnpProgressInfo>& /*aProgress*/ ) {} 
+
+    /**
+     * Function informs when file sharing is done
+     * @param aEngine File sharing engine
+     * @param aError, error code
+     */
+    virtual void HandleSharingDone( 
+        CUPnPFileSharingEngine& /*aEngine*/, TInt /*aError*/ ) {}
+
+    /**
+     * callback for CUPnPFileSharingEngine::RequestSelectionIndexesL
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     * @param aError Error code
+     */
+    virtual void HandleSelectionIndexes( 
+        CUPnPFileSharingEngine& /*aEngine*/, TInt /*aError*/ ) {}
+
+    /**
+     * callback for CUPnPFileSharingEngine::RequestSelectionContentL
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     * @param aError Error code
+     */
+    virtual void HandleSelectionContent( 
+        CUPnPFileSharingEngine& /*aEngine*/, TInt /*aError*/ ) {}
+
+    /**
+     * Callback to inform if connection has been lost
+     * @since S60 3.1
+     * @param aEngine File sharing engine
+     */ 
+    virtual void HandleSharingConnectionLost( 
+        CUPnPFileSharingEngine& /*aEngine*/ ) {}
+
+    };
+    
+#endif //__UPNPAPPSHARINGENGINEOBSERVER_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/inc/upnpiconconfigurator.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Configurator class for mediaserver icons
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPICONCONFIGURATOR_H__
+#define __UPNPICONCONFIGURATOR_H__
+
+
+// Include Files
+#include <e32base.h>
+#include <upnpmediaserverclient.h>
+#include "upnpcontentserverclient.h"
+// FORWARD DECLARATIONS
+class RUpnpMediaServerClient;
+class CActiveSchedulerWait;
+class CRepository;
+class CUPnPFileSharingEngineAO;
+
+// CLASS DECLARATION
+/**
+ *  Active object class for add icons
+ *  Handles add icons.
+ *  @lib upnpapplicationengine.lib
+ *  @since S60 3.1
+ */
+NONSHARABLE_CLASS( CUPnPIconConfigurator ): public CActive
+    {
+
+public: // Constructors and destructor
+
+    /**
+     * C++ default constructor.
+     * @since S60 3.1
+     * @param CUPnPFileSharingEngine*, pointer to file sharing engine
+     */
+    CUPnPIconConfigurator( 
+        RUpnpMediaServerClient& aMediaServer, 
+        CUPnPFileSharingEngineAO& aFileShareingAO );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUPnPIconConfigurator();
+
+public: // thre icon configurator interface
+
+    /**
+     * Checks if icons need to be configured.
+     * @return ETrue if icons are not yet configured, EFalse if they are
+     */
+    TBool NeedToConfigureIcons();
+
+    /**
+     * Configure icons for upnp mediaserver
+     * Asynchronous method - wakes up given active object
+     * when operation is completed.
+     * @return error code
+     */
+    void ConfigureIconsL();
+
+protected:
+
+    /**
+     * Function is called when active request is ready
+     * @since S60 3.1
+     */
+    virtual void RunL();
+
+    /**
+     * Cancels active request
+     * @since S60 3.1
+     */
+    virtual void DoCancel();
+
+    /**
+     * RunL error handler
+     * @param aError Error code
+     * return See CActive description
+     * @since S60 3.1
+     */
+    TInt RunError(TInt aError);
+
+private: // own methods
+
+    /**
+     * Removes all icons
+     */
+    void RemoveIcons();
+
+    /**
+     * Sets first icon
+     */
+    void AddIcon1L();
+
+    /**
+     * Sets second icon
+     */
+    void AddIcon2L();
+
+    /**
+     * Sets third icon
+     */
+    void AddIcon3L();
+
+    /**
+     * Sets fourth icon
+     */
+    void AddIcon4L();
+
+    /**
+     * Resolves the absolute icon path. The icon will be searched from
+     * the same drive where this DLL is located.
+     * @param relativePath relative path, without the drive, beginning with \
+     * @param iconPath, output, receives absolute icon path.
+     */
+    void ResolveIconPath( const TDesC& relativePath, TFileName& iconPath );
+
+    /**
+     * Checks if icons are added (from cenrep)
+     * @return true (configured) of false (icons not configured)
+     */
+    TBool CheckIconsAddedL();
+
+public:
+
+    /**
+     * Marks icons configured to cenrep
+     * @param aMark true (configured) or false (not configured)
+     */
+    static void MarkIconsAddedL( TBool aMark );
+
+private: // data
+
+    enum TConfiguratorState
+        {
+        EStateIdle, // ready
+        EStateRemoving, // removing all currently existing icons 
+                        // (only in debug mode)
+        EStateAdding1, // adding first icon
+        EStateAdding2, // adding second icon
+        EStateAdding3, // adding third icon
+        EStateAdding4 // adding fourth icon
+        };
+
+    /**
+     * mediaserver session handle
+     */
+    RUpnpMediaServerClient& iMediaServer;
+
+    /**
+     * Indicates whether the starting sharing or stopping
+     * sharing is ongoing.
+     */
+    TConfiguratorState iState;
+
+    /**
+     * icon
+     */   
+    CUpnpIcon* iIcon1;
+    CUpnpIcon* iIcon2;
+    CUpnpIcon* iIcon3;
+    CUpnpIcon* iIcon4;
+    
+    /**
+     * Sharing engine's active object
+     */
+    CUPnPFileSharingEngineAO& iFileShareEngineAO;
+    
+    };
+
+#endif  // __UPNPICONCONFIGURATOR_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/inc/upnpprogresswatcher.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      file sharing engine active object class defition
+ *
+*/
+
+
+
+
+
+
+
+#ifndef __UPNPPROGRESSWATCHER_H__
+#define __UPNPPROGRESSWATCHER_H__
+
+
+// Include Files
+#include <e32base.h>
+#include <e32property.h>
+#include "upnpcontentserverclient.h"
+#include "upnpfilesharingengineobserver.h"
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+/**
+ * Active object class for observing sharing progress
+ * @since S60 3.1
+ */
+NONSHARABLE_CLASS( CUpnpProgressWatcher ): public CActive
+    {
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     * @param aEngine File sharing engine
+     */
+    static CUpnpProgressWatcher* NewL( CUPnPFileSharingEngine& aEngine );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpProgressWatcher();
+
+public: // New functions
+
+    /**
+     * Starts listening property
+     * @since S60 3.1
+     */
+    void StartL();
+
+    /**
+     * Stops listening property
+     * @since S60 3.1
+     */
+    void Stop();
+
+protected:
+
+    /**
+     * Function is called when active request is ready
+     */
+    virtual void RunL();
+
+    /**
+     * Cancels active request
+     */
+    virtual void DoCancel();
+
+private:
+
+    /**
+     * C++ default constructor.
+     * @param aEngine File sharing engine
+     */
+    CUpnpProgressWatcher( CUPnPFileSharingEngine& aEngine );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Determine if the sharing completed note needs to be shown
+     * @since S60 3.1
+     * @param aProgress Progress information struct
+     */
+    void SetShowCompleteNote( const TUpnpProgress& aProgress );
+
+    /**
+     * Determine if there is sharing ongoing
+     * @since S60 3.1
+     * @param aProgress Progress information struct
+     * @return ETrue if there is sharing ongoing for at least one media type
+     */
+    TBool SharingOngoing( const TUpnpProgress& aProgress );
+
+    /**
+     * Handle Errors
+     * @since S60 3.1
+     * @param aProgress Progress information struct
+     */
+    void HandleErrorL( const TUpnpProgress& aProgress );
+
+private: // data
+
+    /**
+     * file sharing engine
+     */
+    CUPnPFileSharingEngine& iEngine;
+
+    /**
+     * property subscribed
+     */
+    RProperty iProgressInfo;
+
+    /**
+     * Indicates if is is needed to show note about sharing end 
+     */
+    TBool iShowCompleteNote;
+
+    };
+
+
+#endif  // __UPNPPROGRESSWATCHER_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/src/upnpcontentrequestao.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpContentRequestAO class implementation
+ *
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <s32file.h>
+#include <f32file.h>
+
+// upnp stack api
+#include <upnpstring.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontrollerfactory.h"
+
+// homeconnect internal
+#include "upnpcontentrequestao.h"
+#include "upnpfilesharingengine.h"
+
+_LIT( KComponentLogfile, "applicationengine.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpContentRequestAO::CUpnpContentRequestAO
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpContentRequestAO::CUpnpContentRequestAO( 
+    CUPnPFileSharingEngine& aEngine,
+    RUpnpContentServerClient& aContentServer )
+    : CActive( CActive::EPriorityStandard ),
+      iEngine( aEngine ),
+      iContentServer( aContentServer )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentRequestAO::~CUpnpContentRequestAO()
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpContentRequestAO::~CUpnpContentRequestAO()
+    {
+    if ( IsActive() )
+        {
+        __LOG( "CUpnpContentRequestAO destructor: IsActive == TRUE!" );
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, KErrNone );
+        }
+    
+    Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentRequestAO::RequestSelectionContentL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentRequestAO::RequestSelectionContentL( 
+    UpnpContentServer::TUpnpMediaType aType )
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::RequestSelectionContentL\
+ begin");
+
+    // check media server availibility
+    if ( IsActive() ||
+         UPnPAVControllerFactory::MSServicesInUse() )
+        {
+        User::Leave( KErrInUse );
+        }
+    iContentServer.GetSelectionContentL( aType, iStatus );
+    SetActive();
+    iState = ERequestContent;
+ 
+    __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::RequestSelectionContentL\
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentRequestAO::GetSelectionContentL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentRequestAO::GetSelectionContentL( CDesCArray& aArray )
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::GetSelectionContentL\
+ begin");
+    
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    iContentServer.GetSelectionContentResultL( aArray );
+
+    __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::GetSelectionContentL\
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentRequestAO::RequestSelectionIndexesL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentRequestAO::RequestSelectionIndexesL(
+    UpnpContentServer::TUpnpMediaType aType )
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::RequestSelectionIndexesL\
+ begin");
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    iContentServer.GetSelectionIndexesL( aType, iStatus );
+    SetActive();
+    iState = ERequestIndexes;
+
+    __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::RequestSelectionIndexesL\
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentRequestAO::GetSelectionIndexesL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentRequestAO::GetSelectionIndexesL(
+    CArrayFix<TInt>& aCurrentSelection )
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::GetSelectionIndexesL\
+ begin");
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    iContentServer.GetSelectionIndexesResultL( aCurrentSelection );
+
+    __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::GetSelectionIndexesL\
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentRequestAO::RunL
+// Called when asyncronous request is ready
+// --------------------------------------------------------------------------
+//
+void CUpnpContentRequestAO::RunL()
+    {
+    __LOG1("[UPNP_ENGINE]\t CUpnpContentRequestAO::RunL, error=%d", 
+        iStatus.Int());
+
+    TState state( iState );
+    iState = ENone;
+
+    if ( iStatus.Int() )
+        {
+        __LOG1("CUpnpContentRequestAO::RunL: Error %d in iStatus",
+            iStatus.Int() );
+        }
+
+    if ( iEngine.Observer() )
+        {
+        if ( state == ERequestContent )
+            {
+            iEngine.Observer()->HandleSelectionContent( 
+                iEngine, iStatus.Int() );
+            }
+        else if ( state == ERequestIndexes )
+            {
+            iEngine.Observer()->HandleSelectionIndexes( 
+                iEngine, iStatus.Int() ); 
+            }
+        else
+            {
+            __PANICD( __FILE__, __LINE__ );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentRequestAO::DoCancel
+// Cancels the active request
+// --------------------------------------------------------------------------
+//
+void CUpnpContentRequestAO::DoCancel()
+    {
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/src/upnpcontentshareao.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,321 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpContentShareAO class implementation
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include "upnpcontentshareao.h"
+#include "upnpfilesharingengine.h"
+
+_LIT( KComponentLogfile, "applicationengine.txt");
+#include "upnplog.h"
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::CUpnpContentShareAO
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpContentShareAO::CUpnpContentShareAO( 
+    CUPnPFileSharingEngine& aEngine,
+    RUpnpContentServerClient& aContentServer ):
+    CActive( CActive::EPriorityStandard ),
+    iEngine( aEngine ),
+    iContentServer( aContentServer )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CUpnpContentShareAO::ConstructL()
+    {    
+    __LOG( "CUpnpContentShareAO::ConstructL" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::NewL
+// --------------------------------------------------------------------------
+//
+CUpnpContentShareAO* CUpnpContentShareAO::NewL( 
+        CUPnPFileSharingEngine& aEngine, 
+        RUpnpContentServerClient& aContentServer )
+    {   
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::NewL begin" );
+    CUpnpContentShareAO* self = CUpnpContentShareAO::NewLC(
+            aEngine, aContentServer );
+    CleanupStack::Pop( self );
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::NewL end" );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::NewLC
+// --------------------------------------------------------------------------
+//
+CUpnpContentShareAO* CUpnpContentShareAO::NewLC( 
+        CUPnPFileSharingEngine& aEngine, 
+        RUpnpContentServerClient& aContentServer )
+    {    
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::NewLC begin" );
+    CUpnpContentShareAO* self = new( ELeave )
+        CUpnpContentShareAO( aEngine, aContentServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::NewLC end" );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::~CUpnpContentShareAO()
+// Destructor
+// --------------------------------------------------------------------------
+//    
+CUpnpContentShareAO::~CUpnpContentShareAO()
+    {
+    __LOG( "CUpnpContentShareAO::~CUpnpContentShareAO " );
+
+    iQueuedSelections.ResetAndDestroy();
+    iQueuedSelections.Close();
+    iQueuedTypes.Close();
+
+    Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::ChangeSharedContentL()
+// Sends the selected indexes to server and starts sharing
+// --------------------------------------------------------------------------
+//
+void CUpnpContentShareAO::ChangeSharedContentL(
+    UpnpContentServer::TUpnpMediaType aType,
+    const CArrayFix<TInt>& aMarkedItems )
+    {   
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::\
+ChangeSharedContentL begin" );
+
+    if ( !IsActive() )
+        {
+        __ASSERTD( iQueuedTypes.Count() == 0, __FILE__, __LINE__ );
+        iContentServer.ChangeSharedContentL( aType, aMarkedItems, iStatus );
+        iStatus = KRequestPending;
+        SetActive();       
+        }
+    else
+        {
+        //remove all queued requests with this type
+        RemoveQueuedObjectByType( aType );
+        
+        //queue this request
+        CArrayFix<TInt>* selections = 
+            new ( ELeave ) CArrayFixFlat<TInt>( aMarkedItems.Count() );
+        CleanupStack::PushL( selections );
+        for ( TInt i ( 0 ); i < aMarkedItems.Count(); i++ )
+            {
+            selections->AppendL( aMarkedItems.At(i) );
+            }
+        
+        AppendQueuedObjectL( aType, selections );
+        CleanupStack::Pop( selections );
+        __ASSERTD( iQueuedSelections.Count() == iQueuedTypes.Count(),
+                __FILE__, __LINE__ );
+        }
+
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::\
+ChangeSharedContentL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::RefreshSharedContentL()
+// Updates shared objects in mediaserver
+// --------------------------------------------------------------------------
+//
+void CUpnpContentShareAO::RefreshSharedContentL( 
+    UpnpContentServer::TUpnpMediaType aType )
+    {
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::\
+RefreshSharedContentL begin" );
+    if ( !IsActive() )
+        {
+        __ASSERTD( iQueuedTypes.Count() == 0, __FILE__, __LINE__ );
+        iContentServer.RefreshSharedContentL( aType, iStatus );       
+        iStatus = KRequestPending;
+        SetActive();       
+        }
+    else
+        {
+        //remove all queued requests with this type
+        RemoveQueuedObjectByType( aType );
+
+        //queue this request
+        CArrayFix<TInt>* selections( NULL );
+        AppendQueuedObjectL( aType, selections );
+        __ASSERTD( iQueuedSelections.Count() == iQueuedTypes.Count(),
+                __FILE__, __LINE__ );
+        }
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::\
+RefreshSharedContentL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::DoCancel
+// Cancel the operation
+// --------------------------------------------------------------------------
+//
+void CUpnpContentShareAO::DoCancel()
+    {    
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::DoCancel" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::RunL
+// Function is called when active request is ready
+// --------------------------------------------------------------------------
+//
+void CUpnpContentShareAO::RunL()
+    {      
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::RunL begin" );
+    __LOG1( "[UPNP_ENGINE]\t\t status: %d", iStatus.Int() );
+
+    TInt err = iStatus.Int();
+    if ( err && 
+         err != KErrServerBusy )
+        {
+        // KErrServerBusy is a response to the 
+        // CUpnpContentServer::RefreshSharedContentL call. Therefore we must 
+        // not leave without cleaning queued objects. 
+        // Otherwise next call to CUpnpContentShareAO::RefreshSharedContentL 
+        // will panic (in UDEB builds only!!!!). 
+        
+        // Clears queued objects and leaves.
+        iQueuedSelections.ResetAndDestroy();
+        iQueuedTypes.Reset();
+        User::Leave( err );
+        }
+
+    //When get the responce from the content server then change the UI    
+    iEngine.RequestSharingProgressL();
+
+    if ( iQueuedTypes.Count() )
+        {
+        // Get next queued objects
+        UpnpContentServer::TUpnpMediaType type = iQueuedTypes[ 0 ];
+        CArrayFix<TInt>* selections = iQueuedSelections[ 0 ];
+        
+        // Clear arrays.
+        iQueuedSelections.Remove( 0 );
+        iQueuedTypes.Remove( 0 );
+        
+        if ( selections )
+            {
+            //share request
+            CleanupStack::PushL( selections );
+            iContentServer.ChangeSharedContentL( type, *selections, iStatus );
+            CleanupStack::PopAndDestroy( selections );
+            }
+        else
+            {
+            //refresh request
+            iContentServer.RefreshSharedContentL( type, iStatus );       
+            }
+        
+        iStatus = KRequestPending;
+        SetActive();       
+        }
+    __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::RunL end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::RunError
+// Handles a leave occurring in the request completion
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentShareAO::RunError( TInt aError )
+    {    
+    __LOG( "CUpnpContentShareAO::RunError" );
+    if ( iEngine.Observer() )
+        {
+        iEngine.Observer()->HandleSharingDone( iEngine, aError );
+        }
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::RemoveQueuedObjects
+// Removed queued objects by index.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentShareAO::RemoveQueuedObject( TInt aIndex )
+    {
+    // Checks argument in udeb build.
+    // USER 130 panic will occure in urel builds if argument is
+    // incorrent.
+    TInt count = iQueuedTypes.Count();
+    __ASSERTD( aIndex >= 0 && aIndex < iQueuedTypes.Count(),
+            __FILE__, __LINE__ );
+    
+    iQueuedTypes.Remove( aIndex );
+    if ( iQueuedSelections[ aIndex ] )
+        {
+        delete iQueuedSelections[ aIndex ];
+        }
+    iQueuedSelections.Remove( aIndex );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::RemoveQueuedObjectByType
+// Removed queued objects by type.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentShareAO::RemoveQueuedObjectByType( 
+        UpnpContentServer::TUpnpMediaType aType )
+    {
+    //remove all queued requests with this type
+    for ( TInt i( iQueuedTypes.Count() - 1 ); i >= 0; i-- )
+        {
+        if ( iQueuedTypes[ i ] == aType )
+            {
+            RemoveQueuedObject( i );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentShareAO::AppendQueuedObjectL
+// Appends given objects.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentShareAO::AppendQueuedObjectL( 
+        UpnpContentServer::TUpnpMediaType aType, 
+        CArrayFix<TInt>* aSelections )
+    {
+    iQueuedTypes.AppendL( aType );
+    TRAPD( err, iQueuedSelections.AppendL( aSelections ) );
+    if ( err )
+        {
+        // Couldn't append array to the iQueuedSelections array.
+        // Removes the type and leaves.
+        iQueuedTypes.Remove( iQueuedTypes.Count() - 1 );
+        User::Leave( err );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/src/upnpfilesharingengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,522 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUPnPFileSharingEngine class implementation
+ *
+*/
+
+
+
+
+
+
+//  Include Files
+#include <upnpcontainer.h>
+#include <f32file.h>
+#include <upnpstring.h>
+#include <s32file.h>
+
+#include <upnpmediaserverclient.h>
+#include "upnpfilesharingengine.h"
+#include "upnpfilesharingengineao.h"
+#include "upnpcontentrequestao.h"
+#include "upnpcontentshareao.h"
+#include "upnpcontentserverclient.h"
+#include "upnpsettingsengine.h"
+#include "upnpprogresswatcher.h"
+#include "upnpcommonutils.h"
+#include "upnpdownloaditemresolver.h"
+#include "upnpcontentshareao.h"
+#include "upnpconnectionmonitor.h"
+#include "upnpiconconfigurator.h"
+
+_LIT( KComponentLogfile, "applicationengine.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::CUPnPFileSharingEngine
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPFileSharingEngine::CUPnPFileSharingEngine()
+    {
+    iShareFileState = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngine::ConstructL()
+    {
+    iContentServer.OpenL();
+    iAO = new (ELeave) CUPnPFileSharingEngineAO( *this, iContentServer );
+    iContentSharer = CUpnpContentShareAO::NewL( *this, iContentServer );    
+    UPnPCommonUtils::DeleteTempFilesL();
+    CUPnPDownloadItemResolver::DeleteTempDownloadFilesL();
+    iContentRequestor = new (ELeave) CUpnpContentRequestAO( 
+        *this, iContentServer );
+
+    // create connection monitor, so we can receive wlan lost notifications
+    // immideatly and observe connection if application was restarted 
+    CUPnPSettingsEngine* settings = CUPnPSettingsEngine::NewLC();
+    TInt iap( 0 );
+    User::LeaveIfError( settings->GetAccessPoint( iap ) );
+    CleanupStack::PopAndDestroy( settings );
+    iConnMon = CUPnPConnectionMonitor::NewL( *this, iap );
+
+    //set flag that icons hasn't been set
+    CUPnPIconConfigurator::MarkIconsAddedL( EFalse );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPFileSharingEngine* CUPnPFileSharingEngine::NewL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::NewL begin");
+    CUPnPFileSharingEngine* self = CUPnPFileSharingEngine::NewLC();
+    CleanupStack::Pop( self );
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::NewL end");
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::NewLC
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPFileSharingEngine* CUPnPFileSharingEngine::NewLC()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::NewLC begin");
+    CUPnPFileSharingEngine* self = new (ELeave) CUPnPFileSharingEngine;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::NewLC end");
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::~CUPnPFileSharingEngine
+// Destructor
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUPnPFileSharingEngine::~CUPnPFileSharingEngine()
+    {
+    __LOG("[UPNP_ENGINE]\tCUPnPFileSharingEngine::~CUPnPFileSharingEngine\
+ begin");
+
+    delete iConnMon;
+    delete iAO;
+    delete iContentSharer;
+
+    delete iImageSelections;
+    delete iMusicSelections;
+    delete iContentRequestor;
+
+
+    iContentServer.Close();
+    delete iProgress;
+
+    __LOG("[UPNP_ENGINE]\tCUPnPFileSharingEngine::~CUPnPFileSharingEngine\
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::SetObserver
+// Set observer
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::SetObserver(
+    MUPnPFileSharingEngineObserver* aObserver )
+    {
+    iObserver = aObserver;
+    if ( !iObserver )
+        {
+        if ( iProgress )
+            {
+            iProgress->Stop();
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::Observer
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+EXPORT_C MUPnPFileSharingEngineObserver* CUPnPFileSharingEngine::Observer()
+    {
+    return iObserver;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::SetSharingState
+// Starts/Stops file sharing using UPnP Media server API
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::SetSharingStateL( TBool aState )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SetSharingState \
+begin");
+    if ( iProgress && iShareFileState )
+        {
+        iProgress->Stop();
+        }
+    iAO->SetSharingStateL( aState );
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SetSharingState \
+end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::SharingState
+// Gets file sharing status.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUPnPFileSharingEngine::SharingStateL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SharingState \
+begin");
+
+    TBool status( EFalse );
+    if ( iAO )
+        {
+        status = iAO->SharingStateL();
+        }
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SharingState \
+end");
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::ShareMediaL
+// Starts sharing process
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::ShareMediaL(
+    THomeConnectMediaType aType )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::ShareMediaL begin");
+
+    switch ( aType )
+        {
+    case EImageAndVideo :
+        {
+        iContentSharer->ChangeSharedContentL( 
+            UpnpContentServer::TUpnpMediaType( aType ),
+            *iImageSelections );
+        }
+        break;
+    case EPlaylist:
+        {
+        iContentSharer->ChangeSharedContentL( 
+            UpnpContentServer::TUpnpMediaType( aType ),
+            *iMusicSelections );
+        }
+        break;
+    default :
+        User::Leave( KErrArgument );
+        break;
+        }
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::ShareMediaL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::RefreshSharedMediaL
+// Updates shared objects
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::RefreshSharedMediaL( 
+    THomeConnectMediaType aType )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RefreshSharedMediaL\
+ begin");
+
+    // clear UI cache
+    delete iImageSelections;
+    iImageSelections = NULL;
+    delete iMusicSelections;
+    iMusicSelections = NULL;
+
+
+    iContentSharer->RefreshSharedContentL( 
+        UpnpContentServer::TUpnpMediaType( aType ) );
+    RequestSharingProgressL();
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RefreshSharedMediaL\
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::RequestSelectionIndexesL
+// Gets the selected albums/playlist indexes
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::RequestSelectionIndexesL(
+    THomeConnectMediaType aType ) const
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RequestSelectionIndexesL\
+ begin");
+
+    iContentRequestor->RequestSelectionIndexesL( 
+        UpnpContentServer::TUpnpMediaType( aType ) );
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RequestSelectionIndexesL\
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::GetSelectionIndexes
+// Gets the selected albums/playlist indexes
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::GetSelectionIndexesL(
+    CArrayFix<TInt>& aMarkedItems ) const
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::GetSelectionIndexesL\
+ begin");
+
+    iContentRequestor->GetSelectionIndexesL( aMarkedItems );
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::GetSelectionIndexesL\
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::SetSelectionIndexes
+// Sets the user selections
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::SetSelectionIndexesL(
+    THomeConnectMediaType aType,
+    const CArrayFix<TInt>& aMarkedItems )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SetSelectionIndexesL\
+ begin");
+
+    switch ( aType )
+        {
+    case EImageAndVideo:
+        {
+        delete iImageSelections;
+        iImageSelections = NULL;
+        iImageSelections = new (ELeave) CArrayFixFlat<TInt>
+            (aMarkedItems.Count());
+        CopyTintArrayL( aMarkedItems, *iImageSelections );
+        }
+        break;
+    case EPlaylist:
+        {
+        delete iMusicSelections;
+        iMusicSelections = NULL;
+        iMusicSelections = new (ELeave) CArrayFixFlat<TInt>
+            (aMarkedItems.Count());
+        CopyTintArrayL( aMarkedItems, *iMusicSelections );
+
+        }
+        break;
+    default:
+        User::Leave( KErrArgument );
+        break;
+        }
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SetSelectionIndexesL\
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::RequestSelectionContentL
+// Requests the album /playlist names
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::RequestSelectionContentL(
+    THomeConnectMediaType aType )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RequestSelectionContentL\
+ begin");
+
+    iContentRequestor->RequestSelectionContentL( 
+        UpnpContentServer::TUpnpMediaType( aType ) );
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RequestSelectionContentL\
+ begin");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::GetSelectionContentL
+// Get all albums/playlists identifiers from Media gallery
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::GetSelectionContentL(
+    CDesCArray& aArray ) const
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine:: \
+GetSelectionContentL begin");
+
+    iContentRequestor->GetSelectionContentL( aArray );
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine:: \
+GetSelectionContentL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::RequestSharingProgressL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::RequestSharingProgressL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+RequestSharingProgressL begin");
+    if( !iProgress )
+        {
+        iProgress = CUpnpProgressWatcher::NewL( *this );
+        }
+    iProgress->StartL();
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+RequestSharingProgressL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::StartUploadListenerL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::StartUploadListenerL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+StartUploadListenerL begin");
+    iContentServer.StartUploadListenerL();
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+StartUploadListenerL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::StopUploadListenerL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CUPnPFileSharingEngine::StopUploadListenerL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+StopUploadListenerL begin");
+    iContentServer.StopUploadListenerL();
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+StopUploadListenerL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::SetConMonState
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngine::SetConMonStateL( 
+    TBool aState, TRequestStatus& aStatus )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+SetConMonState begin");
+
+    delete iConnMon;
+    iConnMon = NULL;
+
+    if ( aState )
+        {
+        // (Re)Start
+        CUPnPSettingsEngine* settings = CUPnPSettingsEngine::NewLC();
+        TInt iap( KErrNotFound );
+        User::LeaveIfError( settings->GetAccessPoint( iap ) );
+        iConnMon = CUPnPConnectionMonitor::NewL( *this, iap );
+        CleanupStack::PopAndDestroy( settings );
+        iContentServer.StartConnectionMonitorL( iap, aStatus );
+        }
+    else
+        {
+        iContentServer.StopConnectionMonitorL( aStatus );
+        }
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+SetConMonState end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::ConnectionLost
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngine::ConnectionLost()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+ConnectionLost begin");
+    if( iAO->SharingStateL() )
+        {
+        iAO->ConnectionLost();
+        if ( iObserver )
+            {
+            iObserver->HandleSharingConnectionLost( *this );
+            }
+        }
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\
+ConnectionLost end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::CopyTintArrayL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngine::CopyTintArrayL( const CArrayFix<TInt>& aSrc,
+    CArrayFix<TInt>& aDst ) const
+    {
+    for ( TInt i(0); i<aSrc.Count();i++ )
+        {
+        aDst.AppendL(aSrc.At(i));
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::CopyCdescArray
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngine::CopyCdescArrayL( 
+    const CDesCArray& aSrc,
+    CDesCArray& aDst ) const
+    {
+    for ( TInt i(0); i<aSrc.Count();i++ )
+        {
+        aDst.AppendL( aSrc[ i ] );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::SetShareFileComplete
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngine::SetShareFileComplete( 
+    TBool aShareState )
+    { 
+    iShareFileState = aShareState; 
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/src/upnpfilesharingengineao.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,645 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUPnPFileSharingEngineAO class implementation
+ *
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <s32file.h>
+#include <f32file.h>
+#include <pathinfo.h>
+#include <e32property.h>
+#include <centralrepository.h>
+
+// upnp stack api
+#include <upnpstring.h>
+#include <upnpmediaserverclient.h>
+
+// upnpframework / avcontroller api
+#include "upnpavcontrollerfactory.h"
+
+// upnpframework / internal api's
+#include "upnpsecaccesscontroller.h"
+
+// homemedia internal
+#include "upnpfilesharingengineao.h"
+#include "upnpfilesharingengine.h"
+#include "upnpapplicationcrkeys.h" //KUPnPAppMediaServerIcon
+#include "upnpfileutilitytypes.h" //KJpegMime2
+#include "upnpiconconfigurator.h"
+
+_LIT( KComponentLogfile, "applicationengine.txt");
+#include "upnplog.h"
+
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::CUPnPFileSharingEngineAO
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUPnPFileSharingEngineAO::CUPnPFileSharingEngineAO(
+    CUPnPFileSharingEngine& aEngine,
+    RUpnpContentServerClient& aContentServer )
+    : CActive(CActive::EPriorityStandard),
+      iEngine( aEngine ),
+      iContentServer( aContentServer )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:: \
+            CUPnPFileSharingEngineAO");
+    CActiveScheduler::Add( this );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::~CUPnPFileSharingEngineAO()
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUPnPFileSharingEngineAO::~CUPnPFileSharingEngineAO()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:: \
+            ~CUPnPFileSharingEngineAO");
+
+    if ( IsActive() )
+        {
+        __LOG( "CUPnPFileSharingEngineAO destructor: IsActive==TRUE!" );
+        iState = ENotActive;
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, KErrNone );
+        }
+
+    Cancel();
+    iMediaServer.Close();
+
+    delete iIconConfigurator;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::RunL
+// Called when asyncronous request is ready
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngineAO::RunL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL begin");
+
+    TInt err( iStatus.Int() );
+    if ( err )
+        {
+        __LOG1( "iStatus err =%d",err );
+        }
+    switch ( iState )
+        {
+        case ENotActive :
+            {
+            if ( err )
+                {
+                // Inform Observer to handle the error.
+                if ( iEngine.Observer() )
+                    {
+                    iEngine.Observer()->
+                        HandleSharingStatus( iEngine, err, EFalse );
+                    }
+                }
+            break;
+            }
+        // Show files outside
+    case ECheckIcon :
+        {
+        if( !err )
+            {
+            __LOG1( "[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::ECheckIcon\
+err=%d", err );
+            iState = EStartSharing;
+            // callback SetIconComplete
+            iIconConfigurator->ConfigureIconsL();
+            }
+        else
+            {
+            iState = ENotActive;
+            if ( iEngine.Observer() )
+                {
+                iEngine.Observer()->
+                    HandleSharingStatus( iEngine, err, ETrue );
+                }
+            }
+        }
+        break;
+    case EStartSharing :
+        {
+        iMediaServer.Close();
+
+        if ( !err )
+            {
+            iVisibility = EOnline;
+            iEngine.SetConMonStateL( ETrue, iStatus );
+            SetActive();
+            iState = EWaitSetConMonStateTrue;
+            }
+        else
+            {
+            iState = ENotActive;
+            if ( iEngine.Observer() )
+                {
+                iEngine.Observer()->
+                    HandleSharingStatus( iEngine, err, ETrue );
+                }
+            }
+        break;
+        }
+    case EWaitSetConMonStateTrue:
+        {
+        iState = ENotActive;
+        if ( iEngine.Observer() )
+            {
+            iEngine.Observer()->
+                HandleSharingStatus( iEngine, err, ETrue );
+            }
+        break;
+        }
+    case EStopSharing :
+        {
+        if ( !err )
+            {
+            iEngine.SetConMonStateL( EFalse, iStatus );
+            SetActive();
+            iState = EWaitSetConMonStateFalse;
+            }
+        else
+            {
+            iState = ENotActive;
+            if ( iEngine.Observer() )
+                {
+                iEngine.Observer()->
+                    HandleSharingStatus( iEngine, err, EFalse );
+                }
+            }
+        }
+        break;
+    case EWaitSetConMonStateFalse:
+        {
+        iState = ENotActive;
+        if ( iEngine.Observer() )
+            {
+            iEngine.Observer()->
+                HandleSharingStatus( iEngine, err, EFalse );
+            }
+        break;
+        }
+    default :
+        {
+        __PANICD( __FILE__, __LINE__ );
+        break;
+        }
+        }
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::RunError
+// Handles a leave occurring in the request completion event handler
+// --------------------------------------------------------------------------
+//
+TInt CUPnPFileSharingEngineAO::RunError( TInt aError )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL begin");
+    TState state ( iState );
+    iState = ENotActive;
+    if ( iEngine.Observer() )
+        {
+        TBool phase( EFalse );
+        if( state == EStartSharing ||
+            state == ECheckIcon ||
+            state == EWaitSetConMonStateTrue )
+            {
+            phase = ETrue;
+            }
+
+        iEngine.Observer()->
+            HandleSharingStatus( iEngine, aError, phase );
+        }
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL end");
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::DoCancel
+// Cancels active object
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngineAO::DoCancel()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::DoCancel begin");
+    if ( iIconConfigurator )
+        {
+        iIconConfigurator->Cancel();
+        }
+
+    if ( iEngine.Observer() &&
+         iState != ENotActive )
+        {
+        TBool phase( EFalse );
+        if( iState == EStartSharing ||
+            iState == ECheckIcon ||
+            iState == EWaitSetConMonStateTrue )
+            {
+            phase = ETrue;
+            }
+
+        iEngine.Observer()->
+            HandleSharingStatus( iEngine, KErrCancel, phase );
+        }
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::DoCancel end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngineAO::SetSharingState
+// Starts or stops file sharing
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngineAO::SetSharingStateL( TBool aState )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SetSharingState \
+ begin");
+
+    if ( IsActive() )
+        {
+        User::Leave ( KErrInUse );
+        }
+
+    // Open file sharing session from mediaserver
+    TBool started = SharingStateL();
+    TInt err = OpenMediaServer();
+
+    if ( aState && !started )
+        {
+        __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+SetSharingState: StartSharing");
+
+        // check media server availibility
+        if ( !err )
+            {
+            EnableUpnpSecurityL();
+
+            CheckMediaserverIconsL();
+
+            if ( !UPnPAVControllerFactory::MSServicesInUse() )
+                {
+                if ( !HasDiskSpace() )
+                    {
+                    err = KErrDiskFull;
+                    }
+                }
+            else
+                {
+                err = KErrInUse;
+                }
+            }
+        if ( !err )
+            {
+            iMediaServer.Start( iStatus );
+            SetActive();
+            }
+        else
+            {
+            SetActive();
+            TRequestStatus* stat = &iStatus;
+            User::RequestComplete( stat, err );
+            }
+        }
+    else if ( !aState && started )
+        {
+        __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+SetSharingState: StopSharing");
+        iState = EStopSharing;
+        // Ask current state of content server
+        TUpnpProgress totalProgress;
+        TPckgBuf<TUpnpProgress> progressBuf( totalProgress );
+        TInt pubErr = RProperty::Get( KUpnpContentServerCat,
+                                      ESharingProgress, progressBuf );
+        TBool sharingOngoing( EFalse );
+        if ( !pubErr )
+            {
+            Mem::Copy( &totalProgress,
+                       progressBuf.Ptr(), sizeof( TUpnpProgress ) );
+            if( totalProgress.iImageVideoProgress.iProgressType !=
+                TUpnpProgressInfo::EVisualStatus ||
+                totalProgress.iMusicProgress.iProgressType !=
+                TUpnpProgressInfo::EVisualStatus )
+                {
+                sharingOngoing = ETrue;
+                }
+            }
+
+        if( !err )
+            {
+            if ( !sharingOngoing )
+                {
+                // no sharing operations ongoing, stop possible
+                err = iMediaServer.Stop();
+                }
+            else
+                {
+                __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+->Offline");
+                err = iMediaServer.StartOffline();
+                }
+
+            if ( err != KErrNone )
+                {
+                __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:: \
+Error: iMediaServer");
+                err = KErrGeneral;
+                // if the MediaServer lost, setting iVisibility = EUnknown 
+                // will insure the function SharingState() to start the
+                // MediaServer session again.
+                iVisibility = EUnknown;
+                }
+            else
+                {
+                iVisibility = EOffline;
+                }
+
+            iMediaServer.Close();
+            }
+        SetActive();
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, err );
+        }
+    else
+        {
+        //do nothing, it's already started
+        iState = EStopSharing;
+        if ( aState )
+            {
+            iState = EStartSharing;
+            }
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SetSharingState \
+ end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::SharingState
+// Gets file sharing status.
+// --------------------------------------------------------------------------
+//
+TBool CUPnPFileSharingEngineAO::SharingStateL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SharingState begin");
+
+    TBool status( EFalse );
+    if ( iVisibility == EUnknown )
+        {
+        // Start media server session
+        TInt err( OpenMediaServer() );
+        if ( err == KErrNoMemory )
+            {
+            User::Leave( KErrNoMemory );
+            }
+        
+        if ( !err )
+            {
+            TInt s( 0 );
+            err = iMediaServer.Status( s );
+            if ( s == RUpnpMediaServerClient::EStartedOnline )
+                {
+                status = ETrue;
+                }
+            iMediaServer.Close();
+            }
+        if ( status && !err )
+            {
+            iVisibility = EOnline;
+            }
+        else
+            {
+            iVisibility = EOffline;
+            }
+        }
+     else if( iVisibility == EOffline ) 
+        {
+        TInt err( OpenMediaServer() );
+        if ( err == KErrNoMemory )
+            User::Leave( KErrNoMemory );  
+        if ( !err )
+            {
+            TInt s( 0 );
+            err = iMediaServer.Status( s );
+            if ( s == RUpnpMediaServerClient::EStartedOnline )
+                {
+                status = ETrue;
+                }
+            iMediaServer.Close();
+            }
+        }     
+    else if ( iVisibility == EOnline )
+        {
+        status = ETrue;
+        }
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SharingState end");
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::ConnectionLost
+// Gets file sharing status.
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngineAO::ConnectionLost()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+ConnectionLost begin");
+    iVisibility = EOffline;
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+ConnectionLost end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::HasDiskSpace
+// Check that there is enough disk space in c drive
+// --------------------------------------------------------------------------
+//
+TBool CUPnPFileSharingEngineAO::HasDiskSpace()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+HasDiskSpace begin");
+    const TInt KDiskSpaceThreshold( 4096 ); //4kB
+    RFs fileServer;
+    TInt error = fileServer.Connect();
+    TBool retVal( EFalse );
+    TVolumeInfo freeVol;
+    if( !error )
+        {
+        error = fileServer.SetSessionPath( PathInfo::PhoneMemoryRootPath() );
+        if( !error )
+            {
+            error = fileServer.Volume( freeVol );
+            }
+        }
+    fileServer.Close();
+
+    if( !error )
+        {
+        if( freeVol.iFree > KDiskSpaceThreshold )
+            {
+            __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:\
+disk space:OK!");
+            retVal = ETrue;
+            }
+        }
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+HasDiskSpace end");
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::SetIconComplete
+// callback from icon configurator
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngineAO::SetIconComplete( TInt aError )
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+SetIconComplete begin");
+    
+    if ( aError != KErrNone )
+        {
+        iMediaServer.Stop();  
+        }
+    
+    // delete iconConfigurator as not needed anymore
+    delete iIconConfigurator;
+    iIconConfigurator = NULL;
+
+    // continue sharing
+    iState = EStartSharing;
+    __ASSERTD( !IsActive(), __FILE__, __LINE__ );
+    SetActive();
+    TRequestStatus* stat = &iStatus;
+    User::RequestComplete( stat, aError );
+
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+SetIconComplete end");
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::OpenMediaServer
+// Creates connection to mediaserver
+// --------------------------------------------------------------------------
+//
+TInt CUPnPFileSharingEngineAO::OpenMediaServer()
+    {
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+OpenMediaServer start");
+
+    TInt error = iMediaServer.Connect();
+    if ( error == KErrNoMemory )
+        {
+        return error;
+        }
+    
+    if ( error != KErrNone )
+        {
+        __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+OpenMediaServer: Connect FAILed");
+
+        // try to reconnect
+        iMediaServer.Close();
+        error = iMediaServer.Connect();
+        if( error )
+            {
+            __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+OpenMediaServer: ReConnect FAILed");
+            }
+
+        }
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+OpenMediaServer end");
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::EnableUpnpSecurityL
+// store the cenrep value
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngineAO::EnableUpnpSecurityL()
+    {
+    // Check if the stack's security is enabled
+    __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+EnableUpnpSecurityL: Checking the state of stack's security manager");
+    TBool upnpSecurityEnabled = EFalse;
+    TRAPD( secCheckError,
+           upnpSecurityEnabled =
+           CUpnpSecAccessController::IsMediaServerSecurityEnabledL());
+
+    // If the security is not enabled, enable it now
+    if( !secCheckError &&
+        !upnpSecurityEnabled )
+        {
+        __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+EnableUpnpSecurityL: Activating stack's security manager");
+        TRAPD( secEnableError,
+               CUpnpSecAccessController::EnableMediaServerSecurityL());
+        if( secEnableError )
+            {
+            __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
+EnableUpnpSecurityL: Failed to activate stack's security manager");
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::CheckMediaserverIconsL
+// Checks whether icons should be configured
+// --------------------------------------------------------------------------
+//
+void CUPnPFileSharingEngineAO::CheckMediaserverIconsL()
+    {
+    // Create the icon configurator and see if icons must be configured.
+    // If they need to, start asynchronous icon configuration process.
+    delete iIconConfigurator;
+    iIconConfigurator = NULL;
+    iIconConfigurator = new (ELeave )
+        CUPnPIconConfigurator( iMediaServer, *this );
+    if ( iIconConfigurator->NeedToConfigureIcons() )
+        {
+        iState = ECheckIcon;
+        }
+    else
+        {
+        // icons already configured, go directly to sharing state
+        delete iIconConfigurator;
+        iIconConfigurator = NULL;
+        iState = EStartSharing;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/src/upnpiconconfigurator.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,376 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Configurator class for mediaserver icons
+ *
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <centralrepository.h>
+
+// upnp stack
+#include <upnpmediaserverclient.h>
+
+// upnp framework internal API's
+#include "upnpfileutilitytypes.h" // utilities / mime type definitions
+
+// app.engine internal
+#include "upnpapplicationcrkeys.h" //KUPnPAppMediaServerIcon
+#include "upnpfilesharingengineao.h"
+#include "upnpiconconfigurator.h"
+
+
+// constants
+_LIT( KIcon1Path, "\\system\\apps\\upnp\\upnp_ms_jpeg_sm.jpg");
+const TInt KIcon1Width( 48 );
+const TInt KIcon1Height( 48 );
+const TInt KIcon1Depth( 24 );
+
+_LIT( KIcon2Path, "\\system\\apps\\upnp\\upnp_ms_jpeg_lrg.jpg");
+const TInt KIcon2Width( 120 );
+const TInt KIcon2Height( 120 );
+const TInt KIcon2Depth( 24 );
+
+_LIT( KIcon3Path, "\\system\\apps\\upnp\\upnp_ms_png_sm.png");
+const TInt KIcon3Width( 48 );
+const TInt KIcon3Height( 48 );
+const TInt KIcon3Depth( 24 );
+
+_LIT( KIcon4Path, "\\system\\apps\\upnp\\upnp_ms_png_lrg.png");
+const TInt KIcon4Width( 120 );
+const TInt KIcon4Height( 120 );
+const TInt KIcon4Depth( 24 );
+
+_LIT(KComponentLogfile, "applicationengine.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::CUPnPIconConfigurator
+// --------------------------------------------------------------------------
+//
+CUPnPIconConfigurator::CUPnPIconConfigurator(
+    RUpnpMediaServerClient& aMediaServer, 
+    CUPnPFileSharingEngineAO& aFileShareingAO )
+    : CActive(CActive::EPriorityStandard),
+      iMediaServer( aMediaServer ),
+      iFileShareEngineAO( aFileShareingAO )
+    {
+    __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::CUPnPIconConfigurator" );
+    CActiveScheduler::Add( this );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::~CUPnPIconConfigurator()
+// --------------------------------------------------------------------------
+//
+CUPnPIconConfigurator::~CUPnPIconConfigurator()
+    {
+
+    if ( IsActive() )
+        {
+        iState = EStateIdle;
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, KErrNone );
+        }
+    Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::NeedToConfigureIcons()
+// --------------------------------------------------------------------------
+//
+TBool CUPnPIconConfigurator::NeedToConfigureIcons()
+    {
+#ifdef _DEBUG
+    // in debug mode ALWAYS add new icons
+    return ETrue;
+#else
+    // in normal mode only add icons if they DO NOT exist
+    TBool iconsExist = EFalse;
+    TRAP_IGNORE( iconsExist = CheckIconsAddedL() );
+    __LOG1( "[UPNP_ENGINE] CUPnPIconConfigurator: iconsExist %d",
+        iconsExist );
+    return !iconsExist;
+#endif
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::ConfigureIconsL()
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::ConfigureIconsL()
+    {
+    RemoveIcons();
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngineAO::RunL
+// Called when asyncronous request is ready
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::RunL()
+    {
+    __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::RunL" );
+
+    TInt err( iStatus.Int() );
+
+    if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+        {       
+        iFileShareEngineAO.SetIconComplete( err );
+        }
+    else
+        {
+        switch ( iState )
+            {
+            case EStateRemoving:
+                {
+                AddIcon1L();
+                iState = EStateAdding1;
+                }
+                break;
+            case EStateAdding1:
+                {
+                delete iIcon1;
+                iIcon1 = NULL;
+                AddIcon2L();
+                iState = EStateAdding2;
+                }
+                break;
+            case EStateAdding2:
+                {
+                delete iIcon2;
+                iIcon2 = NULL;
+                AddIcon3L();
+                iState = EStateAdding3;
+                }
+                break;
+            case EStateAdding3:
+                {
+                delete iIcon3;
+                iIcon3 = NULL;
+                AddIcon4L();
+                iState = EStateAdding4;
+                }
+                break;
+            case EStateAdding4:
+                {
+                delete iIcon4;
+                iIcon4 = NULL;
+                // operation complete.
+                MarkIconsAddedL( ETrue );
+                Cancel();
+                iFileShareEngineAO.SetIconComplete( KErrNone );
+                }
+                break;
+            default:
+                {
+                __PANICD( __FILE__, __LINE__ );
+                }
+                break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::RunError
+// RunL error handler
+// --------------------------------------------------------------------------
+//
+TInt CUPnPIconConfigurator::RunError( TInt aError )
+    {
+    __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::RunError begin" );
+
+    iFileShareEngineAO.SetIconComplete( aError );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::DoCancel
+// Cancels active object
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::DoCancel()
+    {
+    __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::DoCancel" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::RemoveIconsL
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::RemoveIcons()
+    {
+    __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::RemoveIconsL" );
+    iState = EStateRemoving;
+    iMediaServer.RemoveIcons( iStatus );
+    if ( !IsActive() )
+        {
+        SetActive();
+        }
+    else
+        {
+        __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::RemoveIconsL Error :\
+                Already active");
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::AddIcon1
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::AddIcon1L()
+    {
+    __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon1" );
+    TFileName iconPath;
+    ResolveIconPath( KIcon1Path, iconPath );
+    iIcon1 = CUpnpIcon::NewL( iconPath,
+            KIcon1Width, KIcon1Height, KIcon1Depth, KJpegMime );
+    iMediaServer.AddIcon( iIcon1, iStatus );
+    if ( !IsActive() )
+        {
+        SetActive();
+        }
+    else
+        {
+        __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon1L Error :\
+                Already active");
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::AddIcon2
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::AddIcon2L()
+    {
+    __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon2" );
+    TFileName iconPath;
+    ResolveIconPath( KIcon2Path, iconPath );
+    iIcon2 = CUpnpIcon::NewL( iconPath,
+        KIcon2Width, KIcon2Height, KIcon2Depth, KJpegMime );
+    iMediaServer.AddIcon( iIcon2, iStatus );
+    if ( !IsActive() )
+        {
+        SetActive();
+        }
+    else
+        {
+        __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon2L Error :\
+                Already active");
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::AddIcon3
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::AddIcon3L()
+    {
+    __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon3" );
+    TFileName iconPath;
+    ResolveIconPath( KIcon3Path, iconPath );
+    iIcon3 = CUpnpIcon::NewL( iconPath,
+        KIcon3Width, KIcon3Height, KIcon3Depth, KPngMime );
+    iMediaServer.AddIcon( iIcon3, iStatus );
+    if ( !IsActive() )
+        {
+        SetActive();
+        }
+    else
+        {
+        __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon3L Error :\
+                Already active");
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::AddIcon4
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::AddIcon4L()
+    {
+    __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon4" );
+    TFileName iconPath;
+    ResolveIconPath( KIcon4Path, iconPath );
+    iIcon4 = CUpnpIcon::NewL( iconPath,
+        KIcon4Width, KIcon4Height, KIcon4Depth, KPngMime );
+    iMediaServer.AddIcon( iIcon4, iStatus );
+    if ( !IsActive() )
+        {
+        SetActive();
+        }
+    else
+        {
+        __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon4L Error :\
+                Already active");
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::ResolveIconPath
+// Resolves absolute icon path
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::ResolveIconPath(
+    const TDesC& relativePath, TFileName& iconPath )
+    {
+    iconPath = relativePath;
+    TFileName dllName;
+    Dll::FileName( dllName );
+    TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' 
+    iconPath.Insert( 0, drive );
+    }
+        
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::CheckIconsAddedL
+// Set the mediaserver icon if it is needed
+// --------------------------------------------------------------------------
+//
+TBool CUPnPIconConfigurator::CheckIconsAddedL()
+    {
+    __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::CheckIconsAddedL" );
+
+    TInt iconSet ( EFalse );
+    CRepository *repository = CRepository::NewL( KCRUidUPnPApplication );
+    repository->Get( KUPnPAppMediaServerIcon, iconSet );
+    delete repository;
+    repository = NULL;
+    return iconSet;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPIconConfigurator::MarkIconsAddedL
+// store the cenrep value
+// --------------------------------------------------------------------------
+//
+void CUPnPIconConfigurator::MarkIconsAddedL( TBool aMark )
+    {
+    __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::MarkIconsAddedL" );
+    
+    CRepository *repository = CRepository::NewL( KCRUidUPnPApplication );
+    repository->Set( KUPnPAppMediaServerIcon, aMark );
+    delete repository;
+    repository = NULL;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/applicationengine/src/upnpprogresswatcher.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpProgressWatcher class implementation
+ *
+*/
+
+
+
+
+
+
+
+//  Include Files
+#include <e32property.h>
+#include <e32debug.h>
+#include <upnpstring.h>
+#include "upnpprogresswatcher.h"
+#include "upnpfilesharingengine.h"
+
+_LIT( KComponentLogfile, "applicationengine.txt");
+#include "upnplog.h"
+
+
+// CONSTANTS
+// The maximum numbers of sharingrequests that can be currently received
+const TInt KMaxSharingReqs = 2;
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::CUpnpProgressWatcher
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpProgressWatcher::CUpnpProgressWatcher( CUPnPFileSharingEngine& aEngine )
+    : CActive(CActive::EPriorityStandard),
+      iEngine( aEngine )
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::CUpnpProgressWatcher");
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpProgressWatcher* CUpnpProgressWatcher::NewL( 
+    CUPnPFileSharingEngine& aEngine )
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::NewL");
+    CUpnpProgressWatcher* self = 
+        new ( ELeave ) CUpnpProgressWatcher( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUpnpProgressWatcher::ConstructL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::ConstructL");
+
+    User::LeaveIfError( 
+        iProgressInfo.Attach( KUpnpContentServerCat, ESharingProgress ) );
+    CActiveScheduler::Add(this);
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::~CUpnpProgressWatcher
+// Destructor
+// --------------------------------------------------------------------------
+//
+CUpnpProgressWatcher::~CUpnpProgressWatcher()
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::~CUpnpProgressWatcher");
+
+    Cancel();
+    iProgressInfo.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::StartL
+// Starts active object
+// --------------------------------------------------------------------------
+//
+void CUpnpProgressWatcher::StartL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::StartL begin");
+
+    TUpnpProgress totalProgress;
+    TPckgBuf<TUpnpProgress> progressBuf( totalProgress );
+    TInt pubErr = iProgressInfo.Get( progressBuf );
+    iEngine.SetShareFileComplete( EFalse );
+    if ( !pubErr )
+        {
+        Mem::Copy( &totalProgress, 
+                   progressBuf.Ptr(), sizeof( TUpnpProgress ) );
+
+        // update UI
+        SetShowCompleteNote( totalProgress );
+        TProgressInfos progressArr( KMaxSharingReqs );
+        progressArr.Append( totalProgress.iImageVideoProgress );
+        progressArr.Append( totalProgress.iMusicProgress );
+        CleanupClosePushL( progressArr );
+        if ( iEngine.Observer() )
+            {
+            iEngine.Observer()->HandleSharingProgress( 
+                iEngine, progressArr );
+            }
+        CleanupStack::PopAndDestroy( &progressArr );
+        }
+
+    if ( !IsActive() && SharingOngoing( totalProgress ) )
+        {
+        // start periodical reporting of progress
+        RunL();
+        }
+
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::StartL end");
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::Stop
+// Stops active object
+// --------------------------------------------------------------------------
+//
+void CUpnpProgressWatcher::Stop()
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::Stop");
+    Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::RunL
+// Called when asyncronous request is ready
+// --------------------------------------------------------------------------
+//
+void CUpnpProgressWatcher::RunL()
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::RunL");
+
+    // resubscribe before processing new value to prevent missing updates
+    iProgressInfo.Subscribe( iStatus );
+    SetActive();
+
+    TUpnpProgress totalProgress;
+    TPckgBuf< TUpnpProgress > paramspkg( totalProgress );
+
+
+    // get value
+    if ( iProgressInfo.Get(
+             KUpnpContentServerCat, 
+             ESharingProgress, 
+             paramspkg ) == KErrNotFound )
+        {
+        // property deleted, do necessary actions here...
+        }
+    else
+        {
+        Mem::Copy( &totalProgress, paramspkg.Ptr(), sizeof( TUpnpProgress ) );
+
+
+        TProgressInfos progressArr( KMaxSharingReqs );
+
+        progressArr.Append( totalProgress.iImageVideoProgress );
+        progressArr.Append( totalProgress.iMusicProgress );
+
+        CleanupClosePushL( progressArr );
+        if ( totalProgress.iError )
+            {
+            HandleErrorL( totalProgress );
+            }
+        else
+            {
+            if ( iEngine.Observer() )
+                {
+                // update UI
+                iEngine.Observer()->HandleSharingProgress( 
+                    iEngine, progressArr );
+                }
+            if ( progressArr.Count() )
+                {
+                __LOG2( "ProgressCallbackL: cout:%d progress:%d\n",
+                    progressArr.Count(), 
+                    progressArr[0].iProgress );
+                }
+            else
+                {
+                __LOG( "progressArr empty" );
+                }
+
+            SetShowCompleteNote( totalProgress );
+
+            if ( iShowCompleteNote && !SharingOngoing( totalProgress ) )
+                {
+                // no sharing operations ongoing, stop query
+                Cancel();
+                // inform UI to show final note
+                if ( iEngine.Observer() && iShowCompleteNote )
+                    {
+                    iShowCompleteNote = EFalse;
+                    iEngine.Observer()->HandleSharingDone( 
+                        iEngine, KErrNone );
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( &progressArr );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::DoCancel
+// Cancels active object
+// --------------------------------------------------------------------------
+//
+void CUpnpProgressWatcher::DoCancel()
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::DoCancel");
+    iEngine.SetShareFileComplete( ETrue );
+    iProgressInfo.Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::SetShowCompleteNote
+// determine need to show complete note, handle errors
+// --------------------------------------------------------------------------
+//
+void CUpnpProgressWatcher::SetShowCompleteNote( 
+    const TUpnpProgress& aProgress )
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::SetShowCompleteNote");
+
+    if( !iShowCompleteNote )
+        {
+        if( aProgress.iImageVideoProgress.iProgressType != 
+            TUpnpProgressInfo::EVisualStatus ||
+            aProgress.iMusicProgress.iProgressType != 
+            TUpnpProgressInfo::EVisualStatus)
+            {
+            iShowCompleteNote = ETrue;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::SharingOngoing
+// determine need to show complete note, handle errors
+// --------------------------------------------------------------------------
+//
+TBool CUpnpProgressWatcher::SharingOngoing( const TUpnpProgress& aProgress )
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::SharingOngoing");
+    TBool ret( EFalse );
+
+    if( aProgress.iImageVideoProgress.iProgressType != 
+        TUpnpProgressInfo::EVisualStatus ||
+        aProgress.iMusicProgress.iProgressType !=
+        TUpnpProgressInfo::EVisualStatus)
+        {
+        ret = ETrue;
+        }
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpProgressWatcher::HandleErrorL
+// determine need to show complete note, handle errors
+// --------------------------------------------------------------------------
+//
+void CUpnpProgressWatcher::HandleErrorL( const TUpnpProgress& aProgress )
+    {
+    __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::HandleIfErrorL");
+    Cancel();
+    if( aProgress.iError == KErrNoMemory || 
+        aProgress.iError == KErrDiskFull )
+        {
+        // update UI
+        TProgressInfos progressArr( KMaxSharingReqs );
+        CleanupClosePushL( progressArr );
+        progressArr.Append( aProgress.iImageVideoProgress );
+        progressArr.Append( aProgress.iMusicProgress );
+        
+        if ( iEngine.Observer() )
+            {
+            iEngine.Observer()->HandleSharingProgress( 
+                iEngine, progressArr );
+            }
+        CleanupStack::PopAndDestroy( &progressArr );
+        iShowCompleteNote = EFalse;
+        User::Leave( aProgress.iError );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for upnpsharing
+*
+*/
+
+
+
+
+
+
+// For compatibility with S60 3.2 and IAD branch
+#include "../../group/upnpplatformvar.hrh"
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+// ROM build
+../rom/upnpsharing.iby               CORE_MW_LAYER_IBY_EXPORT_PATH(upnpsharing.iby)
+../rom/upnpsharingresources.iby      CORE_MW_LAYER_IBY_EXPORT_PATH(upnpsharingresources.iby)
+// LOC files
+UPNP_LOC_EXPORT(upnpsharing.loc)
+
+PRJ_MMPFILES
+// none
+
+    // The DLNA profiler
+    #include "../upnpdlnaprofiler/group/bld.inf"
+
+    // upnp security
+    #include "../upnpsecurity/group/bld.inf"
+
+    // content server and server client
+    #include "../upnpcontentserver/group/bld.inf"
+
+    // content server API
+    #include "../applicationengine/group/bld.inf"
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/loc/upnpsharing.loc	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Localisation file for upnpsharing subsystem.
+*
+*/
+
+
+
+
+
+
+// LOCALISATION STRINGS
+
+
+//d:Confirmation query when remote Upnp device wants to connect to us.
+//l:popup_note_window/opt2
+//r:2.0
+//
+#define qtn_iupnp_incoming_device   "Accept connection from Home Media?"
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/rom/upnpsharing.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnpsharing subsystem resource ROM include file
+*
+*/
+
+#ifndef __UPNPSHARING_IBY__
+#define __UPNPSHARING_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // UPnP Security
+    file=ABI_DIR\BUILD_DIR\upnpsecuritymanagerserver.exe \sys\bin\upnpsecuritymanagerserver.exe
+    file=ABI_DIR\BUILD_DIR\upnpsecuritymanagerclient.dll \sys\bin\upnpsecuritymanagerclient.dll
+    file=ABI_DIR\BUILD_DIR\upnpsecurity.dll \sys\bin\upnpsecurity.dll
+    ECOM_PLUGIN( upnpsecuritymanagerplugin.dll, upnpsecuritymanagerplugin.rsc )
+
+    // DLNA Profiler
+    file=ABI_DIR\BUILD_DIR\dlnaprofiler.dll \sys\bin\dlnaprofiler.dll
+
+    // sharing engine
+    file=ABI_DIR\BUILD_DIR\upnpapplicationengine.dll \sys\bin\upnpapplicationengine.dll
+
+    // mediaserver icons
+    data=ABI_DIR\BUILD_DIR\z\system\apps\upnp\upnp_ms_jpeg_lrg.jpg  \system\apps\upnp\upnp_ms_jpeg_lrg.jpg
+    data=ABI_DIR\BUILD_DIR\z\system\apps\upnp\upnp_ms_jpeg_sm.jpg  \system\apps\upnp\upnp_ms_jpeg_sm.jpg
+    data=ABI_DIR\BUILD_DIR\z\system\apps\upnp\upnp_ms_png_lrg.png  \system\apps\upnp\upnp_ms_png_lrg.png
+    data=ABI_DIR\BUILD_DIR\z\system\apps\upnp\upnp_ms_png_sm.png  \system\apps\upnp\upnp_ms_png_sm.png
+
+    // content sharing server
+    data=ABI_DIR\BUILD_DIR\z\private\10202be9\20007564.txt \private\10202be9\20007564.txt
+    file=ABI_DIR\BUILD_DIR\upnpcontentserver.exe \sys\bin\upnpcontentserver.exe
+    file=ABI_DIR\BUILD_DIR\upnpcontentserverclient.dll \sys\bin\upnpcontentserverclient.dll
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __UPNPSHARING_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/rom/upnpsharingresources.iby	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      upnpsharing subsystem resource ROM include file
+*
+*/
+
+
+
+
+
+#ifndef __UPNPSHARINGRESOURCES_IBY__
+#define __UPNPSHARINGRESOURCES_IBY__
+
+#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag
+
+    // UPnP Security
+    data=DATAZ_\resource\UPnPNotifier.RSC \resource\UPnPNotifier.RSC
+
+#endif // FF_UPNP_FRAMEWORK_2_0
+
+#endif // __UPNPSHARINGRESOURCES_IBY__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/bwins/upnpcontentserverclientU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,15 @@
+EXPORTS
+	??0RUpnpContentServerClient@@QAE@XZ @ 1 NONAME ; RUpnpContentServerClient::RUpnpContentServerClient(void)
+	?ChangeSharedContentL@RUpnpContentServerClient@@QAEXW4TUpnpMediaType@UpnpContentServer@@ABV?$CArrayFix@H@@AAVTRequestStatus@@@Z @ 2 NONAME ; void RUpnpContentServerClient::ChangeSharedContentL(enum UpnpContentServer::TUpnpMediaType, class CArrayFix<int> const &, class TRequestStatus &)
+	?Close@RUpnpContentServerClient@@QAEXXZ @ 3 NONAME ; void RUpnpContentServerClient::Close(void)
+	?GetSelectionContentL@RUpnpContentServerClient@@QAEXW4TUpnpMediaType@UpnpContentServer@@AAVTRequestStatus@@@Z @ 4 NONAME ; void RUpnpContentServerClient::GetSelectionContentL(enum UpnpContentServer::TUpnpMediaType, class TRequestStatus &)
+	?GetSelectionContentResultL@RUpnpContentServerClient@@QAEXAAVCDesC16Array@@@Z @ 5 NONAME ; void RUpnpContentServerClient::GetSelectionContentResultL(class CDesC16Array &)
+	?GetSelectionIndexesL@RUpnpContentServerClient@@QAEXW4TUpnpMediaType@UpnpContentServer@@AAVTRequestStatus@@@Z @ 6 NONAME ; void RUpnpContentServerClient::GetSelectionIndexesL(enum UpnpContentServer::TUpnpMediaType, class TRequestStatus &)
+	?GetSelectionIndexesResultL@RUpnpContentServerClient@@QAEXAAV?$CArrayFix@H@@@Z @ 7 NONAME ; void RUpnpContentServerClient::GetSelectionIndexesResultL(class CArrayFix<int> &)
+	?OpenL@RUpnpContentServerClient@@QAEXXZ @ 8 NONAME ; void RUpnpContentServerClient::OpenL(void)
+	?RefreshSharedContentL@RUpnpContentServerClient@@QAEXW4TUpnpMediaType@UpnpContentServer@@AAVTRequestStatus@@@Z @ 9 NONAME ; void RUpnpContentServerClient::RefreshSharedContentL(enum UpnpContentServer::TUpnpMediaType, class TRequestStatus &)
+	?StartConnectionMonitorL@RUpnpContentServerClient@@QAEXHAAVTRequestStatus@@@Z @ 10 NONAME ; void RUpnpContentServerClient::StartConnectionMonitorL(int, class TRequestStatus &)
+	?StartUploadListenerL@RUpnpContentServerClient@@QAEXXZ @ 11 NONAME ; void RUpnpContentServerClient::StartUploadListenerL(void)
+	?StopConnectionMonitorL@RUpnpContentServerClient@@QAEXAAVTRequestStatus@@@Z @ 12 NONAME ; void RUpnpContentServerClient::StopConnectionMonitorL(class TRequestStatus &)
+	?StopUploadListenerL@RUpnpContentServerClient@@QAEXXZ @ 13 NONAME ; void RUpnpContentServerClient::StopUploadListenerL(void)
+
Binary file upnpsharing/upnpcontentserver/cenrep/20007564.txt has changed
Binary file upnpsharing/upnpcontentserver/cenrep/keys_upnpcontentserver.xls has changed
Binary file upnpsharing/upnpcontentserver/conf/upnpcontentserver.confml has changed
Binary file upnpsharing/upnpcontentserver/conf/upnpcontentserver_20007564.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/eabi/upnpcontentserverclientU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,16 @@
+EXPORTS
+	_ZN24RUpnpContentServerClient19StopUploadListenerLEv @ 1 NONAME
+	_ZN24RUpnpContentServerClient20ChangeSharedContentLEN17UpnpContentServer14TUpnpMediaTypeERK9CArrayFixIiER14TRequestStatus @ 2 NONAME
+	_ZN24RUpnpContentServerClient20GetSelectionContentLEN17UpnpContentServer14TUpnpMediaTypeER14TRequestStatus @ 3 NONAME
+	_ZN24RUpnpContentServerClient20GetSelectionIndexesLEN17UpnpContentServer14TUpnpMediaTypeER14TRequestStatus @ 4 NONAME
+	_ZN24RUpnpContentServerClient20StartUploadListenerLEv @ 5 NONAME
+	_ZN24RUpnpContentServerClient21RefreshSharedContentLEN17UpnpContentServer14TUpnpMediaTypeER14TRequestStatus @ 6 NONAME
+	_ZN24RUpnpContentServerClient22StopConnectionMonitorLER14TRequestStatus @ 7 NONAME
+	_ZN24RUpnpContentServerClient23StartConnectionMonitorLEiR14TRequestStatus @ 8 NONAME
+	_ZN24RUpnpContentServerClient26GetSelectionContentResultLER12CDesC16Array @ 9 NONAME
+	_ZN24RUpnpContentServerClient26GetSelectionIndexesResultLER9CArrayFixIiE @ 10 NONAME
+	_ZN24RUpnpContentServerClient5CloseEv @ 11 NONAME
+	_ZN24RUpnpContentServerClient5OpenLEv @ 12 NONAME
+	_ZN24RUpnpContentServerClientC1Ev @ 13 NONAME
+	_ZN24RUpnpContentServerClientC2Ev @ 14 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project upnpcontentserver
+*
+*/
+
+
+
+
+
+PRJ_EXPORTS
+
+// Central repository default keys
+../cenrep/20007564.txt  /epoc32/release/winscw/udeb/z/private/10202be9/20007564.txt
+../cenrep/20007564.txt  /epoc32/release/winscw/urel/z/private/10202be9/20007564.txt
+../cenrep/20007564.txt  /epoc32/release/armv5/udeb/z/private/10202be9/20007564.txt
+../cenrep/20007564.txt  /epoc32/release/armv5/urel/z/private/10202be9/20007564.txt
+../conf/upnpcontentserver.confml              APP_LAYER_CONFML(upnpcontentserver.confml)
+../conf/upnpcontentserver_20007564.crml       APP_LAYER_CRML(upnpcontentserver_20007564.crml)
+
+../inc/upnpcontentservercrkeys.h    |../../../inc/upnpcontentservercrkeys.h
+../inc/upnpcontentserverdefs.h      |../../../inc/upnpcontentserverdefs.h
+../inc/upnpcontentserverclient.h    |../../../inc/upnpcontentserverclient.h
+
+PRJ_MMPFILES
+upnpcontentserver.mmp
+upnpcontentserverclient.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/group/upnpcontentserver.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project upnpcontentserver
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+#include "defaultcaps.hrh"
+
+CAPABILITY CAP_SERVER
+VENDORID VID_DEFAULT
+TARGETTYPE exe
+TARGET upnpcontentserver.exe
+
+UID 0x1000008d 0x20007564
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+EPOCSTACKSIZE 0x8000
+EPOCHEAPSIZE   0x20000 0x1000000 // min size 128kB, max size 16mb
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+
+SOURCEPATH ../src
+
+SOURCE upnpcontentserver.cpp
+SOURCE upnpcontentserversession.cpp
+SOURCE upnpcontentserverhandler.cpp
+SOURCE upnpcontentsharingao.cpp
+SOURCE upnpsharingrequest.cpp
+SOURCE upnpcontainercheckerao.cpp
+SOURCE upnpunsharerao.cpp
+
+// From old applicationengine
+SOURCE upnpcontentmetadatautility.cpp
+SOURCE upnpcustomgrouper.cpp
+SOURCE upnppostfilter.cpp
+SOURCE upnpselectionreader.cpp
+SOURCE upnpselectionwriter.cpp
+
+LIBRARY euser.lib 
+LIBRARY bafl.lib 
+LIBRARY estor.lib 
+LIBRARY ws32.lib 
+LIBRARY efsrv.lib 
+LIBRARY PlatformEnv.lib
+LIBRARY centralrepository.lib
+// Content listing framework (metadata)
+LIBRARY contentlistingframework.lib
+// CUpnpElement etc..
+LIBRARY upnpavobjects.lib
+// CUpnpFileSharing
+LIBRARY avmediaserverclient.lib
+LIBRARY upnpserviceframework.lib
+
+// UpnpString..
+LIBRARY upnpipserversutils.lib
+
+// upnputilities
+LIBRARY upnputilities.lib
+LIBRARY upnpavcontrollerhelper.lib
+
+LIBRARY dlnaprofiler.lib
+LIBRARY upnpmusicadapter.lib
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/group/upnpcontentserverclient.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project upnpcontentserverclient
+*
+*/
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+
+#include "defaultcaps.hrh"
+
+TARGET          upnpcontentserverclient.dll
+TARGETTYPE      dll
+
+UID             0x1000008d 0x20007565
+CAPABILITY      CAP_CLIENT_DLL
+VENDORID        VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+SOURCEPATH      ../src
+SOURCE          upnpcontentserverclient.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         bafl.lib //CDesC8Array
+
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontainercheckerao.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,381 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      This module handlers the cleaning and creating of the 
+*                filesystem to mediaserver
+*
+*/
+
+
+
+
+
+#ifndef __UPNPCONTAINERCHECKERAO_H__
+#define __UPNPCONTAINERCHECKERAO_H__
+
+// INCLUDES
+#include <e32base.h>
+
+#include <upnpbrowsecriteria.h>
+#include <upnpcontainerlist.h>
+#include <upnpcontainer.h>
+#include <upnpitem.h>
+#include <upnpitemlist.h>
+#include <upnpfilesharing.h>
+#include <upnpmediaserverclient.h>
+#include "upnpcontentserverdefs.h"
+#include "upnpsharingcallback.h"
+
+/**
+ *  A class to check, create  and clean the default filesystem in Media server
+ *
+ *  @since S60 3.1
+ */
+class CUpnpContainerCheckerAo : public CActive
+    {
+    /**
+     * Indicates the ongoing operation of the CUpnpContainerCheckerAo
+     */
+    enum THandlerOperations
+        {
+        EInitialize,
+        EQueryDefaultContainers,
+        EUnshareItemList,
+        EQueryDefaultContainersResult,
+        EQueryItemFromMediaServer,
+        EQueryItemFromMediaServerResult,
+        
+        EUnshareContainer,
+        EUnshareContainerResult,
+
+        EShareContainer,
+        EShareContainerResult,
+        ENotActive
+        };
+
+    /**
+     * Indicates the current state of the handler
+     */
+    enum THandlerState
+        {
+        EResolveDefaultContainerIds,
+        ECleanFileStructure,
+        EShareDefaultContainers,
+        EEmptyUploadedContainer,
+        EEmptyUploadedContainerItems,
+        EEmptyRootContainerItems,
+        EUnshareExtraContainers,
+        EUnshareExtraItems,
+        EIdle
+        };
+
+    /**
+     * Indicates the current state of the handler
+     */
+    enum TErrorState
+        {
+        ENoError,
+        EDropAllContent,
+        EDropAllContentResult
+        };
+
+    /**
+     * The operating modes
+     */
+    enum TOperationMode
+        {
+        EValidateContainers,
+        ECheckDefaultContainers
+        };
+
+public:
+   /**
+    * The folder checking operations
+    */
+    enum TContainerPosition
+        {
+        EImageAndVideo = 0,
+        EMusic,
+        EUploaded
+        };
+
+    /**
+    * C++ constructor.
+    * @since S60 3.1
+    * @param aWait, the client side wait
+    */
+    CUpnpContainerCheckerAo( MUpnpSharingCallback* aCallback );
+
+    /**
+    * C++ destructor.
+    */
+    virtual ~CUpnpContainerCheckerAo();
+
+    /**
+     * Creates the default containers if they do not exist,
+     * empties root container and cleans uploaded container
+     * @since S60 3.1
+     * @return Errorcode of the operation start
+     */
+    TInt ValidateContainerStructureL( RArray<TInt>* aIds );
+
+    /**
+     * Creates the default containers if they do not exist
+     * Add ids of the default containers to array
+     * @since S60 3.1
+     * @param aIds The container Ids, indexed using TContainerPosition type
+     * @return Errorcode of the operation start
+     */
+    TInt CheckDefaultContainersL( RArray<TInt>* aIds );
+
+    /**
+     * Request this active ocject to stop as soon as is possible
+     * Stop is indicated to client via callback
+     * @since S60 3.1
+     * @param aStopType Type of stop operation
+     */
+    void RequestStop( MUpnpSharingCallback::TSharingStopType aStopType );
+
+
+private:
+
+    /**
+    * 2nd phase constructor.
+    */
+    void ConstructL();
+
+    /**
+     * The active object main loop
+     * @since S60 3.1
+     */
+    void RunL();
+
+    /**
+     * The active object cancel function
+     * @since S60 3.1
+     */
+    void DoCancel();
+
+    /**
+     * Perform cleanup in case RunL leaves
+     * @since S60 3.1
+     * @return error code
+     */
+    TInt RunError( TInt aError );
+
+    /**
+     * Perform allocating of resources needed for processing upload events
+     * @since S60 3.1
+     * @return error code
+     */
+    TInt InitializeL();
+
+    /**
+     * Query default container structure ids from media server
+     * @since S60 3.1
+     */
+    void QueryDefaultContainerIdsL();
+
+    /**
+     * Handle the query result
+     * @since S60 3.1
+     */
+    void QueryDefaultContainerIdsResultL();
+
+    /**
+     * Handle the item query result
+     * @since S60 3.1
+     */
+    void QueryItemFromCdsResultL();
+
+    /**
+     * Unshare the items in iItemList
+     * @since S60 3.1
+     */
+    void UnshareItemListL();
+
+    /**
+     * Share container on basis of ID
+     * @since S60 3.1
+     */
+    void ShareContainerL( TInt aPos );
+
+    /**
+     * Handle the sharing operation result
+     * @since S60 3.1
+     */
+    void ShareContainerResult( );
+
+    /**
+     * Unshares container under processing
+     * @since S60 3.1
+     */
+    void UnshareContainerL();
+
+    /**
+     * Handle result of the unshare container operation
+     * @since S60 3.1
+     */
+    void UnshareContainerResultL();
+
+    /**
+     * Query containers in root level
+     * @since S60 3.1
+     */
+    void QueryContainerItemsL();
+
+    /**
+     * Create browse criteria for media server query
+     * @since S60 3.1
+     * @return pointer to CUpnpBrowseCriteria instance
+     */
+    CUpnpBrowseCriteria* CreateBrowseCriteriaLC() const;
+
+    /**
+     * Clean allocated resources for possible next run
+     * @since S60 3.1
+     */
+    void Cleanup();
+
+    /**
+     * Complete own request
+     * @since S60 3.1
+     * @param aError Errorcode to use in completion
+     */
+    void SelfComplete( TInt aError );
+
+
+
+private:
+
+    /**
+     * Media server API to share files
+     * owned
+     */
+    CUpnpFileSharing* iFileSharing;
+
+    /**
+     * Media server session handle
+     */
+    RUpnpMediaServerClient iMediaServer;
+
+    /**
+     * Used to hold the upper ao
+     * Stopped when this class has nothing to do. Not owned.
+     */
+    MUpnpSharingCallback* iCallback;
+
+    /**
+     * Hanlders current state
+     */
+    TInt iState;
+
+    /**
+     * Handlers current operation
+     */
+    TInt iCurrentOperation;
+
+    /**
+     * Id of the Images& Videos container
+     */
+    TInt iImageVideoContainerId;
+
+    /**
+     * Id of the Music container
+     */
+    TInt iMusicContainerId;
+
+    /**
+     * Id of the Upload container
+     */
+    TInt iUploadContainerId;
+
+    /**
+     * Array of shared container IDs
+     */
+    RArray<TInt> iSharedContainerIds;
+
+    /**
+     * The currently processed container
+     * owned
+     */
+    CUpnpContainer* iTmpContainer;
+
+    /**
+     * Structure used to hold the containers queries from media server
+     * In practice it is used to hold "Images& VIdeos" & "Music" & "Uploaded"
+     * containers.
+     * owned
+     */
+    CUpnpContainerList*  iContainerList;
+    
+    /**
+    * Structure used to hold possbile unwanted items when cleaning 
+    * some folder
+    * owned
+    */
+    CUpnpItemList* iItemList;
+    
+    /**
+     * Holds the position of the container under processing
+     */
+    TInt iContainerPosition;
+
+    /**
+     * The number of items in item query
+     */
+    TInt iTotalMatches;
+
+    /**
+     * The position when unsharing list of items
+     */
+    TInt iExecStatus;
+
+    /**
+     * Operation mode as defined by TOperationMode
+     */
+    TInt iOperationMode;
+
+    /**
+     * Pointer to client structure to contain the container ids
+     * Not owned
+     */
+    RArray<TInt>* iClientIds;
+
+    /**
+     * Indicates if the client has requested stop
+     * Value is the stop type
+     */
+    TInt iStopRequested;
+
+    /**
+     * State variable which informs if there is need to do
+     * error handling
+     */
+    TInt iRecoverError;
+    
+    /**
+     * The number of matches returned by media server
+     * Not used but required by CUpnpFileSharing API
+     */
+     TInt iMatchCount;
+
+    /**
+     * temporary storage for object count when querying items from media
+     * server
+     */
+    TInt iObjectCount;
+    };
+
+
+#endif // __UPNPCONTAINERCHECKERAO_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontentmetadatautility.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Metadata utility class definition
+ *
+*/
+
+
+
+
+
+
+#ifndef __UPNPCONTENTMETADATAUTILITY_H__
+#define __UPNPCONTENTMETADATAUTILITY_H__
+
+
+// INCLUDES
+// System
+#include <e32base.h>
+#include <MCLFOperationObserver.h>
+#include <MCLFChangedItemObserver.h>
+#include <MCLFItem.h>
+#include <badesca.h>
+
+// upnp stack api
+#include <upnpitem.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpconstantdefs.h" // for upnp-specific stuff
+
+// homeconnect internal
+#include "upnpcontentserverdefs.h"
+#include "upnpcontentserverhandler.h"
+
+
+// CONSTANTS
+const TInt KMaxRefreshCount = 3;
+
+// FORWARD DECLARATIONS
+class MCLFContentListingEngine;
+class MCLFItemListModel;
+class CUpnpCustomGrouper;
+class CUpnpPostFilter;
+class MUpnpMetadataObserver;
+class CUPnPMetaDataUtility;
+
+
+// CLASS DECLARATION
+
+/**
+ *  Class to collect files from phone to share.
+ *  This class collects the media files for Upnp content server to share
+ *  The files are obtained using Content Listing Framework.
+ *
+ *  @since S60 3.1
+ */
+class CUpnpContentMetadataUtility : public CBase,
+                                public MCLFOperationObserver
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUpnpContentMetadataUtility* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpContentMetadataUtility();
+
+public: // New functions
+
+    /**
+     * Updates metadata for the item
+     * @since S60 3.1
+     * @param aMediaType Media type of oitem to be updated
+     * @param aItem pointer to item
+     * @param aFileName Reference to item filename
+     * @return ETrue if the item was found from this model
+     */
+    TBool UpdateMetadataL( const TUpnpMediaType& aMediaType,
+                           CUpnpItem* aItem,
+                           const TDesC& aFileName );
+
+    /**
+     * Returns music model
+     * @since S60 3.1
+     * @return MCLFItemListModel reference to model
+     */
+    const MCLFItemListModel& MusicFiles() const;
+
+    /**
+     * Returns image model
+     * @since S60 3.1
+     * @return MCLFItemListModel reference to model
+     */
+    const MCLFItemListModel& ImageFiles() const;
+
+
+    /**
+     * Returns video model
+     * @since S60 3.1
+     * @return MCLFItemListModel reference to model
+     */
+    const MCLFItemListModel& VideoFiles() const;
+
+
+    /**
+     * Returns collection model
+     * @since S60 3.1
+     * @return MCLFItemListModel reference to model
+     */
+    const MCLFItemListModel& Collections() const;
+
+
+    /**
+     * Collects items from selected collection to the model
+     * @since S60 3.1
+     * @param aNameOfCollection, collection name
+     */
+    void CollectionItemsL( const TDesC& aNameOfCollection );
+
+
+    /**
+     * Extract files from descriptor to the array
+     * @since S60 3.1
+     * @param aFileArray, file name array
+     * @param aFiles, file name descriptor
+     */
+    void GetCollectionFileNamesL( CDesCArray& aFileArray,
+                                  const TDesC& aFiles ) const;
+
+    /**
+     * Returns true if refresh is still ongoing
+     * @since S60 3.1
+     * @return Status of the refresh operation
+     */
+    TBool RefreshOngoing() const;
+
+    /**
+     * Clears all postfilters
+     * @since S60 3.1
+     *
+     */
+    void ClearPostFiltersL();
+
+    /**
+     * Creates UPnP item from CLF Item
+     * @since S60 3.1
+     * @param aCLFItem reference to original item
+     * @param aParentId Parent id of the item
+     * @return CUpnpItem new item allocation
+     */
+    CUpnpItem* CreateItemL( const MCLFItem& aCLFItem,
+                            const TDesC8&  aParentId ) const;
+
+    /**
+     * Creates UPnP item from CLF Item
+     * @since S60 3.1
+     * @param aFullFilenme Filename of the item
+     * @param aParentId Parent id of the item
+     * @return CUpnpItem new item allocation
+     */
+    CUpnpItem* CreateItemL(
+        const TDesC& aFullFilename,
+        const TDesC8& aParentId ) const;
+
+    /**
+     * Sets the callback for informing about refresh state
+     * @since S60 3.1
+     * @param aHandler pointer to observer
+     */
+    void SetCallback( MUpnpMetadataObserver* aObserver );
+
+
+protected: // From MCLFOperationObserver
+
+    /**
+     * Abstract method to get list model operation events. This method is
+     * called when an event is received.
+     * @since S60 3.1
+     * @param aOperationEvent Operation event code of the event
+     * @param aError System wide error code if the operation did not
+     *        succeed.
+     */
+    void HandleOperationEventL( TCLFOperationEvent aOperationEvent,
+                                TInt aError );
+
+protected:  // From MCLFChangedItemObserver
+
+    /**
+     * From MCLFChangedItemObserver Method to handle changed item event.
+     * @since S60 3.1
+     * @param aItemIDArray List of changed item IDs
+     */
+    void HandleItemChangeL( const TArray<TCLFItemId>& aItemIDArray );
+
+    /**
+     * From MCLFChangedItemObserver Method is used to handle errors in
+     * changed item event.
+     * @since S60 3.1
+     * @param aError System wide error code.
+     */
+    void HandleError( TInt aError );
+
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUpnpContentMetadataUtility();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private:    // Data
+    // Content listing engine (owned)
+    MCLFContentListingEngine* iEngine;
+
+    // Content listing model for music (owned)
+    MCLFItemListModel* iMusicModel;
+
+    // Content listing model for images (owned)
+    MCLFItemListModel* iImageModel;
+
+    // Content listing model for videos (owned)
+    MCLFItemListModel* iVideoModel;
+
+    // Content listing model for collections (owned)
+    MCLFItemListModel* iCollectionModel;
+
+    // Custom grouper for collection grouping (owned)
+    CUpnpCustomGrouper* iCustomGrouper;
+
+    // Status to indicate if refresh operation is ongoing
+    TBool iRefreshOngoing;
+
+    // Keeps count of refreshed models
+    TInt iRefreshCounter;
+
+    // Post filter for filtering (owned)
+    CUpnpPostFilter* iPostFilter;
+
+    // Callback interface
+    // not owned
+    MUpnpMetadataObserver* iHandler;
+
+    // The index maintained during the multiple CLF operations
+    TInt iClfIndex;
+    
+    // Utility class for CLF
+    CUPnPMetaDataUtility* iMetaDataUtility; // owned
+    };
+
+#endif      // __UPNPCONTENTMETADATAUTILITY_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontentserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Header for upnpcontentserver 
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPCONTENTSERVER_H__
+#define __UPNPCONTENTSERVER_H__
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpconnectionmonitorobserver.h"
+#include "upnpconnectionmonitor.h"
+#include "upnpcontentserverhandler.h"
+#include "upnpcontentserversession.h"
+
+// FORWARD DECLARATIONS
+class CUPnPPeriodic;
+
+// Server shutdown delay in microseconds (2.5s)
+const TInt KShutdownTimeout = 2500000;
+
+// FORWARD DECLARATIONS
+class CUpnpContentServerSession;
+
+/**
+*  A server class to initialize server.
+*
+*  @since S60 3.1
+*/
+class CUpnpContentServer : public CPolicyServer,
+                           public MUPnPConnectionMonitorObserver
+    {
+public:
+    /**
+    * A Method to initialize the CleanupStack and the ActiveScheduler.
+    * Creates an instance of CUpnpContentServer.
+    * @param None.
+    * @return KErrNone, if successful, otherwise one of the other system-wide
+    *         error codes.
+    */
+    static TInt LaunchServerL();
+
+    /**
+    * 2-phased constructor.
+    */
+    static CUpnpContentServer* NewL();
+
+    /**
+    * C++ destructor.
+    */
+    virtual ~CUpnpContentServer();
+
+    /**
+     * Returns pointer CUpnpContentserverHandler instanse
+     * @since S60 3.1
+     */
+    CUpnpContentServerHandler* Handler() const;
+ 
+    /**
+     * Decrements session counter
+     * @since S60 3.1
+     */
+    void RemoveSession();
+
+    /**
+     * Decrements session counter
+     * @since S60 3.1
+     */
+    void AddSession();
+
+    /**
+     * Indicates if server can be stopped
+     * @since S60 3.1
+     * @ return ETrue if there is no other session open
+     */
+    TBool CanStop() const;
+
+    /**
+     * Stop the server with delay
+     * @since S60 3.1
+     */
+    void Stop();
+
+    /**
+     * Perform the shutdown of the server
+     * @return KErrNone
+     */
+    static TInt Shutdown( TAny* aPtr );
+
+    /**
+     * Start the connection monitor if not yet started
+     * Register for connection lost events
+     * @since S60 3.1
+     */
+    TInt RequestConnectionLostL( const TInt aIapId );
+
+    /**
+     * Stop the connection monitor if only session
+     * unregister the session from connection monitoring
+     * @since S60 3.1
+     */
+    void CancelConnectionLostL();
+
+public:
+    /**
+    * From CServer2, creates a new session.
+    */
+    CSession2* NewSessionL( const TVersion& aVersion, 
+                            const RMessage2& aMessage ) const;
+
+protected:
+    /**
+     * From CServer2, handle possible leaves
+     */
+    TInt RunError( TInt aError );
+
+private:
+    /**
+    * C++ constructor.
+    */
+    CUpnpContentServer();
+
+    /**
+    * 2nd phase constructor.
+    */
+    void ConstructL( );
+
+private:
+    /**
+     * From MUPnPConnectionMonitorObserver
+     * Inform all sessions that connection has been lost
+     * @since S60 3.1
+     */
+    void ConnectionLost();
+
+
+private:
+
+    /** 
+     * Server has an object container index which 
+     * creates an object container for each session
+     * owned
+     */
+    CObjectConIx* iContainerIndex;
+
+    /**
+     * Pointer to handler
+     * owned
+     */
+    CUpnpContentServerHandler* iHandler;
+
+    /**
+     * Session count
+     */
+    TInt iSessionCount;
+
+    /**
+     * Connection monitor handle
+     */
+    CUPnPConnectionMonitor* iConMon;
+
+    /**
+     * Id of the active IAP
+     */
+    TInt iActiveIapId;
+
+    /**
+     * Delayer for the server shutdown
+     */
+    CUPnPPeriodic* iIdle;
+
+    };
+
+
+#endif // __UPNPCONTENTSERVER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontentserverclient.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,255 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Header for content server client class
+*
+*/
+
+
+
+
+
+#ifndef __UPNPCONTENTSERVERCLIENT_H__
+#define __UPNPCONTENTSERVERCLIENT_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>  //CDesC8Array
+#include "upnpcontentserverdefs.h"
+
+// CONSTANTS
+// The maximum numbers of sharingrequests that can be currently received
+const TInt KContentServerMaxSharingReqs( 2 );
+const TUid KUpnpContentServerCat={0x20007564};
+enum TUpnpContentServerKeys {ESharingProgress};
+const TInt KMaxProgressLength( 50 );
+
+/**
+ * Helper class to transfer progress information in one struct
+ */
+class TUpnpProgressInfo
+    {
+public:
+
+    /**
+     * Kind of operaiotn this information is related to
+     * images&videos or playlists
+     */
+    UpnpContentServer::TUpnpMediaType iProgressKind;
+
+    /**
+     * Type of progress
+     */
+    enum TProgressType
+        {
+        ESharingProgress = 0, //sharing is ongoing for this kind of media
+        EVisualStatus         //sharing is not ongoing
+        };
+    TProgressType iProgressType;
+
+    /**
+     * If iProgressType = ESharingProgress: the value 
+     * of progress in percents 0-100.
+     * If iProgressType = EVisualStatus: status of the selection 
+     * ( UpnpContentServer::TUpnpSharingSelection )
+     */
+    TInt iProgress;
+    };
+
+typedef RArray<TUpnpProgressInfo> TProgressInfos;
+
+/**
+ * Helper class to contain all progress information
+ */
+class TUpnpProgress
+    {
+public:
+
+    TUpnpProgressInfo iImageVideoProgress;
+
+    TUpnpProgressInfo iMusicProgress;
+
+    /**
+     * Possible errorcode in sharing
+     * 
+     */
+    TInt iError;
+    };
+
+/**
+ *  RUpnpContentServerClient class is used to create session and a connection
+ *  to UpnpContentServer
+ *
+ *  @lib upnpcontentserverclient.lib
+ *  @since S60 3.1
+ */
+class RUpnpContentServerClient : public RSessionBase
+    {
+
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    IMPORT_C RUpnpContentServerClient();
+
+    /**
+     * Creates new session to Upnp Content Server
+     * @since S60 3.1
+     */
+    IMPORT_C void OpenL();
+
+    /**
+     * Closes the connection with Upnp Content Server
+     * @since S60 3.1
+     */
+    IMPORT_C void Close();
+
+    /**
+     * Starts the media server upload listener
+     * Not supported
+     * @since S60 3.1
+     */
+    IMPORT_C void StartUploadListenerL();
+
+    /**
+     * Stops the media server upload listener
+     * Not supported
+     * @since S60 3.1
+     */
+    IMPORT_C void StopUploadListenerL();
+
+    /**
+     * Gets the names of existed albums/playlists
+     * @since S60 3.1
+     * @param aType Type of media
+     * @param aStatus TRequestStatus for async operation
+     */
+    IMPORT_C void GetSelectionContentL(
+        UpnpContentServer::TUpnpMediaType aType,
+        TRequestStatus& aStatus );
+
+    /**
+     * Ask the result of GetSelectionContentL call
+     * Should be used after the GetSelectionContentL has completed.
+     * @since S60 3.1
+     * @param aIDArray Array to add selection items
+     */
+    IMPORT_C void GetSelectionContentResultL( CDesCArray& aIDArray );
+
+    /**
+     * Sends the selected indexes to server and starts sharing
+     * @since S60 3.2
+     * @param aType Type of media
+     * @param aMarkedItems List of selected indexes
+     * @param aStatus TRequestStatus for async operation.
+     */
+    IMPORT_C void ChangeSharedContentL(
+        UpnpContentServer::TUpnpMediaType aType,
+        const CArrayFix<TInt>& aMarkedItems,
+        TRequestStatus& aStatus );
+
+    /**
+     * Refresh the shared content
+     * @since S60 3.1
+     * @param aType Type of media
+     * @param aStatus TRequestStatus for async operation.
+     */
+    IMPORT_C void RefreshSharedContentL(
+        UpnpContentServer::TUpnpMediaType aType,
+        TRequestStatus& aStatus );
+
+    /**
+     * Gets the users previous selections as list of selected indexes
+     * @since S60 3.1
+     * @param aType Type of media
+     * @param aStatus TRequestStatus for async operation.
+     */
+    IMPORT_C void GetSelectionIndexesL(
+        UpnpContentServer::TUpnpMediaType aType,
+        TRequestStatus& aStatus );
+
+    /**
+     * Ask the result of GetSelectionIndexesL call
+     * @since S60 3.1
+     * @param aMarkedItems Array to hold the items
+     */
+    IMPORT_C void GetSelectionIndexesResultL( 
+        CArrayFix<TInt>& aMarkedItems );
+
+    /**
+     * Start connection monitor in content server
+     * Handles stopping of media server in case of WLAN is lost
+     * @since S60 3.1
+     * @param aIapId Access point id
+     * @param aStatus TRequestStatus for async operation
+     */
+    IMPORT_C void StartConnectionMonitorL( 
+        TInt aIapId,
+        TRequestStatus& aStatus );
+
+    /**
+     * Stop connection monitor in content server
+     * @since S60 3.1
+     * @param aStatus TRequestStatus for async operation
+     */
+    IMPORT_C void StopConnectionMonitorL( TRequestStatus& aStatus );
+
+private:
+    /**
+     * Free previous receive buffers and allocate new
+     * @since S60 3.1
+     * @param aSize The size of the buffer
+     */
+    void PrepareReceiveBuffersL( TInt aSize );
+
+private:
+    /**
+     * General buffer for sending data
+     */
+    TPtr8 iSendBufferPtr;
+
+    /**
+     * General buffer for sending data
+     * Owned
+     */
+    CBufFlat* iSendBuffer;
+
+    /**
+     * General buffer for receiving data 
+     */
+    TPtr8 iReceiveBufferPtr;
+
+    /**
+     * General buffer for receiving data 
+     * Owned
+     */
+    HBufC8* iReceiveBuffer;
+
+    /**
+     * Buffer for receiving content for sharing UI
+     * separate buffer because of multiple async requests
+     */
+    TPtr8 iContentBufferPtr;
+
+    /**
+     * Buffer for receiving content for sharing UI
+     * separate buffer because of multiple async requests
+     * Owned
+     */
+    HBufC8* iContentBuffer;
+
+    };
+
+#endif // __UPNPCONTENTSERVERCLIENT_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontentservercrkeys.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Key definitions used in central repository
+*
+*/
+
+
+
+
+
+
+#ifndef UPNPCONTENTSERVERCRKEYS_H
+#define UPNPCONTENTSERVERCRKEYS_H
+
+#include <e32std.h>
+
+/**
+ * Content server settings UID
+ *
+ */
+const TUid KCrUidUpnpContentserver = { 0x20007564 };
+
+/**
+ * KUPnPAppShareAllVisualFiles
+ * Defines sharing state for visual files.
+ */
+const TUint32 KUPnPAppShareAllVisualFiles = 0x00000001;
+
+/**
+ * KUPnPAppShareAllMusicFiles
+ * Defines sharing state for music files
+ */
+const TUint32 KUPnPAppShareAllMusicFiles = 0x00000002;
+
+#endif  // UPNPCONTENTSERVERCRKEYS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontentserverdefs.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Internal definitions of upnp content server and client
+ *
+*/
+
+
+
+
+
+#ifndef __UPNPCONTENTSERVERDEFS_H__
+#define __UPNPCONTENTSERVERDEFS_H__
+#include <e32debug.h>
+
+namespace UpnpContentServer
+    {
+// CONSTANTS
+    _LIT( KUpnpContentServer, "upnpcontentserver" );
+
+    _LIT( KUpnpContentServerNameAndDir, "\\sys\\bin\\upnpcontentserver.exe" );
+
+    _LIT8( KImageItemObjectClass, "object.item.imageItem.photo" );
+    _LIT8( KMusicItemObjectClass, "object.item.audioItem.musicTrack" );
+    _LIT8( KVideoItemObjectClass, "object.item.videoItem.movie" );
+
+// container classes
+    _LIT8( KImageVideoContainerClass, "object.container.storageFolder" );
+    _LIT8( KPlaylistContainerClass, "object.container.playlistContainer" );
+    _LIT8( KStorageFolderContainerClass, "object.container.storageFolder" );
+
+// upload directories
+    _LIT( KUploadDirectory, "Download\\Media\\" );
+
+// default container names
+    _LIT8( KUploadedContainerName, "Uploaded" );
+    _LIT8(KImageContainerName, "Images&Videos");
+    _LIT8(KMusicContainerName, "Music");
+
+    const TInt KRootContainerId = 0;
+    _LIT8( KRootContainerIdDesc8, "0" );
+    const TInt KUpnpContentServerVersionMajor = 1;
+    const TInt KUpnpContentServerVersionMinor = 0;
+    const TInt KDefaultMessageSlots = 4;
+    const TInt KTintSize = sizeof( TInt );
+// There is two paths to store uploads, length of both is <25
+    const TInt KMaxUploadPathLength = 25;
+
+// File names for the selected albums
+    _LIT( KMusicFile, "music.txt" );
+    _LIT( KVisualFile, "visual.txt" );
+
+/**
+ * Enumeration for client server communication
+ */
+    enum TUpnpContentServerCmds
+        {
+        EStartUploadListener,
+        EStopUploadListener,
+        ERequestSelectionContent,
+        EGetSelectionIndexes,
+        EChangeShareContent,
+        ERefreshShareContent,
+        ERequestProgressInfo,
+        ERequestObjectCount,
+        EStartConnectionMonitor,
+        EStopConnectionMonitor
+        };
+
+/**
+ * Type for Upnp media
+ */
+    enum TUpnpMediaType
+        {
+        EImageAndVideo = 0,
+        EPlaylist,
+        EPhotoFile,
+        EVideoFile,
+        EMusicFile
+        };
+
+/**
+ * Type for sharing selection
+ */
+    enum TUpnpSharingSelection
+        {
+        ENoChange = -99,
+        EShareNone = 0,
+        EShareMany,
+        EShareAll
+        };
+
+    } // namespace UpnpContentServer
+
+
+// Temporary solution until clf..extended.hrh is back begin
+//
+/**
+ *  Content Listing Framework list model media types.
+ *  Last default media type is 0x7FFFFFFF,
+ *  Custom media type range 0x80000000 0xFFFFFFFF
+ */
+enum TCLFMediaTypeExtended
+    {
+    /// Gallery collections
+    ECLFMediaTypeCollection     = 0x7
+    };
+
+/**
+ *  S60 internal Content Listing Framework item field IDs.
+ *  Last default field ID is 0x7FFFFFFF,
+ *  Custom field ID range 0x80000000 - 0xFFFFFFFF
+ */
+enum TCLFExtendedFieldId
+    {
+    /// Media gallery collection name:
+    /// descriptor
+    ECLFFieldIdCollectionName       = 0x00002000,
+    /// Media gallery collection ID:
+    /// integer
+    ECLFFieldIdCollectionId         = 0x00002001,
+    /// Media gallery collection type:
+    /// integer
+    ECLFFieldIdCollectionType       = 0x00002002,
+    /// Media gallery collection memory:
+    /// integer
+    ECLFFieldIdCollectionMemory     = 0x00002003,
+    /// Media gallery collection properties:
+    /// integer
+    ECLFFieldIdCollectionProperties = 0x00002004,
+    /// Media gallery collection files:
+    /// descriptor
+    ECLFFieldIdCollectionFiles      = 0x00002005,
+    /// Media gallery item count of the collection:
+    /// integer
+    ECLFFieldIdCollectionItemCount  = 0x00002006
+    };
+
+//temp solution ends
+
+
+// for Debugging
+/*
+#define __*LOGB __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+#define __*LOGE __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+#define __*LOGEr __LOG3( "%s: %s:%d", "Error", __FILE__, __LINE__ );
+#define __*LOGEc(a) if (a) __LOG2( "%s: Error: %d", __PRETTY_FUNCTION__, a );
+*/
+
+
+
+#endif // __UPNPCONTENTSERVERDEFS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontentserverhandler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,379 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      The header of content server main scheduler class
+ *
+*/
+
+
+
+
+
+#ifndef __UPNPCONTENTSERVERHANDLER_H__
+#define __UPNPCONTENTSERVERHANDLER_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+
+#include "upnpcontentserverdefs.h"
+#include "upnpcontentserverclient.h"
+#include "upnpcontentsharingao.h"
+#include "upnpcontentsharingobserver.h"
+#include "upnpsharingcallback.h"
+#include "upnpsharingrequest.h"
+
+#include "upnpmetadataobserver.h"
+#include "upnpcontainercheckerao.h"
+#include "upnpunsharerao.h"
+
+// FORWARD DECLARATIONS
+
+class CUpnpSelectionReader;
+class CUpnpContentMetadataUtility;
+class CUpnpContentSharingAo;
+class CUpnpSharingRequest;
+class CUpnpContentServer;
+class CUPnPPeriodic;
+
+
+/**
+ *  A class to schedule the active objects in server
+ *
+ *  @since S60 3.1
+ */
+class CUpnpContentServerHandler : public CBase,
+                                  public MUpnpSharingCallback,
+                                  public MUpnpMetadataObserver
+    {
+    /**
+     * Indicates internal state of the CUpnpContentServerHandler
+     */
+    enum THandlerState
+        {
+        ESchedulingSharing,
+        EWaitingUploads,
+        EProcessingUploads,
+        ENotActive
+        };
+
+    /**
+     * Indicates which active object is running
+     */
+    enum TSharingPhase
+        {
+        ESharingInActive,
+        ECheckDefaults,
+        EUnshare,
+        EShare
+        };
+
+public:
+
+    /**
+     * 2-phased constructor.
+     */
+    static CUpnpContentServerHandler* NewL( CUpnpContentServer* aServer );
+
+    /**
+     * C++ destructor.
+     */
+    virtual ~CUpnpContentServerHandler();
+
+    /**
+     * Sets the observer to session class
+     * @since S60 3.1
+     * @param aObserver Pointer to observer in session class
+     */
+    void SetContentSharingObserverL( MUpnpContentSharingObserver* aObserver );
+
+    /**
+     * Start the media server upload listener, leave if error
+     * @since S60 3.1
+     */
+    void StartUploadListenerL();
+
+    /**
+     * Stop the media server upload listener, leave if error
+     * @since S60 3.1
+     */
+    void StopUploadListenerL();
+
+    /**
+     * Get the strings for the UI
+     * @since S60 3.1
+     * @param aContainerType Type of the content requested
+     */
+    void GetSelectionContentL( const TInt& aContainerType );
+
+    /**
+     * Get the selected items for the UI
+     * @since S60 3.1
+     * @param aMarkedItems Array of previous sharing selections
+     * @param aType Type of selections to request
+     */
+    void GetSelectionIndexesL( RArray<TInt>& aMarkedItems,
+                               const TInt aType );
+
+    /**
+     * Start sharing
+     * @since S60 3.1
+     * @param aMarkedItems The new sharing selections
+     * @param aType Type of sharing selections
+     */
+    void ChangeShareContentL( const RArray<TInt>& aMarkedItems,
+                              const TInt aType );
+
+    /**
+     * First read the selections then refresh.
+     * Leaves with KErrServerBusy if sharing is ongoing
+     * @since S60 3.1
+     * @param aType Type of refresh requested
+     */
+    void RefreshShareContentL(
+        TInt aType );
+
+    /**
+     * Determines if it is possible to stop the server
+     * @since S60 3.1
+     */
+    TBool CanStop() const;
+
+    /**
+     * Callback from metadatautility to inform that refresh is completed
+     * @since S60 3.1
+     */
+    void RefreshDoneL();
+
+    /**
+     * Switch media server offline, change internal states accordingly
+     * @since S60 3.1
+     */
+    TBool ConnectionLostL();
+
+    // from MUpnpSharingCallback
+    //
+
+    /**
+     * The CUpnpContentSharingAo uses this to indicate it has done sharing
+     * @since S60 3.1
+     * @param aErr Error code
+     * @param aType Type of sharing completed
+     */
+    void CompleteSharingOperationL(
+        const TInt& aErr, const TInt& aType );
+    /**
+     * Cancel the current sharing operation
+     * @since S60 3.1
+     * @param aErr Error code
+     */
+    void CancelSharingOperationL(
+        const TInt& aErr );
+
+    /**
+     * Update the progress PubSub key
+     * @since S60 3.1
+     * @param aProgress Progress to update
+     */
+    void SetProgressL(
+        const TInt& aProgress );
+
+    /**
+     * Cancel the current sharing operation
+     * @since S60 3.1
+     * @param aErr Error code
+     */
+    void ValidateDefaultContainersL();
+
+
+
+
+private:
+    /**
+     * C++ constructor.
+     * @since S60 3.1
+     */
+    CUpnpContentServerHandler( CUpnpContentServer* aServer );
+
+    /**
+     * The main sharing loop
+     * @since S60 3.1
+     */
+    void DoShareL( );
+
+    /**
+     * Cleanup  resources, also state variables are cleaned
+     * @since S60 3.1
+     */
+    void Cleanup();
+
+    /**
+     * 2nd phase constructor.
+     * @since S60 3.1
+     */
+    void ConstructL();
+
+    /**
+     * Get id of the default container determined by aType
+     * @since S60 3.1
+     * @param aType Determines which container id is returned
+     */
+    TInt GetContainerId( const TInt aType ) const;
+
+    /**
+     * Fill the progress info for aType
+     * @since S60 3.1
+     * @param aArr Array to store progress information
+     * @param aType Determines which container id is returned
+     */
+    void FillProgressInfoL(
+        RArray<TUpnpProgressInfo>& aArr,
+        const TInt aType );
+
+    /**
+     * Set the values of the iImageVideoSharingReq or iMusicSharingReq
+     * depending of aType
+     * @since S60 3.1
+     * @param aMarkedItems The new sharing selections
+     * @param aType Type of sharing selections
+     */
+    void SetSharingRequestL(
+        const RArray<TInt>& aMarkedItems,
+        const TInt aType );
+
+    /**
+     * Handle errors from active objects
+     * @since S60 3.1
+     * @param aError Error code
+     */
+    void HandleError( TInt aError );
+
+    /**
+     * Perform CLF refresh in background
+     * @param aPtr Pointer to CUpnpContentServerHandler instance
+     * @return EFalse
+     */
+    static TInt RefreshClfL( TAny* aPtr );
+    
+    
+private:
+    /**
+     * Pointer to server process, used for stopping it
+     * Not owned
+     */
+    CUpnpContentServer* iServer;
+
+    /**
+     * Pointer to CLF interface
+     * owned
+     */
+    CUpnpContentMetadataUtility* iMetadata;
+
+    /**
+     * The sharing engine
+     * owned
+     */
+    CUpnpContentSharingAo* iAo;
+
+    /**
+     * Pointer to corresponding session observer for returning results
+     * not owned
+     */
+    MUpnpContentSharingObserver* iContentSharingObserver;
+
+    /**
+     * Gets the albums/playlists to UI
+     * owned
+     */
+    CUpnpSelectionReader* iReader;
+
+    /**
+     * Used to wait CLF refresh
+     */
+    CActiveSchedulerWait iWait;
+
+    /**
+     * Handlers current state
+     */
+    TInt iHandlerState;
+
+    /**
+     * Currently processed request index
+     */
+    TInt iBufferPosition;
+
+    /**
+     * The buffer for image and video sharing requests
+     * owned
+     */
+    CUpnpSharingRequest* iVisualSharingReq;
+
+    /**
+     * The buffer for music sharing requests
+     * owned
+     */
+    CUpnpSharingRequest* iMusicSharingReq;
+
+    /**
+     * The buffer for any sharing request which is not yet scheduled to run
+     * owned
+     */
+    CUpnpSharingRequest* iPendingSharingReq;
+
+    /**
+     * Ongoing sharing operation. See TSharingPhase
+     */
+    TInt iSharingPhase;
+
+    /**
+     * Active object checking the file structure of the media server
+     */
+    CUpnpContainerCheckerAo* iContainerChecker;
+
+    /**
+     * Active object handling the unsharing of items and containers
+     */
+    CUpnpUnsharerAo* iUnsharer;
+
+    /**
+     * Storage for ids of default containers
+     */
+    RArray<TInt> iDefaultContainerIds;
+
+    /**
+     * MediaServer Handle
+     * Owned
+     */
+    RUpnpMediaServerClient* iMediaServer;
+
+    /**
+     * Error code, reset after transferred to client
+     */
+    TInt iErrorToClient;
+
+    /**
+    * Flag to indicate if the iContainerChecker is created in
+    * staring sharing context
+    */
+    TBool iStartupCleaning;
+
+    /**
+     * The Publish subscribe key to deliver progress infromation about sharing
+     */
+    RProperty iProgressProperty;
+
+    CUPnPPeriodic* iIdle;
+    
+    };
+
+#endif // __UPNPCONTENTSERVERHANDLER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontentserversession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Header of CUpnpContentServerSession class
+ *
+*/
+
+
+
+
+
+
+#ifndef __UPNPCONTENTSERVERSESSION_H__
+#define __UPNPCONTENTSERVERSESSION_H__
+
+#include <e32base.h>
+#include <badesca.h>
+
+#include "upnpcontentserver.h"
+#include "upnpcontentsharingobserver.h"
+
+
+// CLASS FORWARDS
+class CUpnpContentServer;
+
+/**
+ *  A session class which creates an instance of Upnp content server
+ *  when starting,
+ *  and releases used memory when closing.
+ *
+ *  @since S60 3.1
+ */
+class CUpnpContentServerSession : public CSession2,
+                                  public MUpnpContentSharingObserver
+    {
+public:
+    /**
+     * 2-phased constructor.
+     * @since S60 3.1
+     * @param aServer Pointer to server class
+     */
+    static CUpnpContentServerSession* NewL( CUpnpContentServer* aServer );
+
+    /**
+     * From CSession2, passes the request forward to DispatchMessageL.
+     * @since S60 3.1
+     * @param aMessage Reference to processed message
+     */
+    void ServiceL( const RMessage2& aMessage );
+
+    /**
+     * Handles the request from client.
+     * @since S60 3.1
+     * @param aMessage Reference to processed message
+     */
+    void DispatchMessageL( const RMessage2& aMessage );
+
+    /**
+     * Processes the album / playlist query
+     * @since S60 3.1
+     * @param aMessage Reference to processed message
+     */
+    void GetSelectionContentL(
+        const RMessage2& aMessage );
+
+    /**
+     * Processes the old selections query
+     * @since S60 3.1
+     * @param aMessage Reference to processed message
+     */
+    void GetSelectionIndexesL(
+        const RMessage2& aMessage );
+
+    /**
+     * Processes the sharing request
+     * @since S60 3.1
+     * @param aMessage Reference to processed message
+     */
+    void ChangeShareContentL(
+        const RMessage2& aMessage );
+
+    /**
+     * Completes the album / playlist query
+     * @param aMessage Reference to message from client
+     * @since S60 3.1
+     */
+    void CompleteSelectionContentL(
+        const CDesCArray& aMarkedItems );
+
+    /**
+     * Processes the progress query
+     * @since S60 3.1
+     * @param aMessage Reference to processed message
+     */
+    void RequestProgressInfoL(
+        const RMessage2& aMessage );
+
+    /**
+     * Processes the refresh request
+     * @since S60 3.1
+     * @param aMessage Reference to processed message
+     */
+    void RefreshShareContentL(
+        const RMessage2& aMessage );
+
+    /**
+     * Start connection monitor
+     * @since S60 3.1
+     * @param aMessage Reference to processed message
+     */
+    void StartConnectionMonitorL(
+        const RMessage2& aMessage );
+
+
+    /**
+     * Stop connection monitoring
+     * @since S60 3.1
+     */
+    void StopConnectionMonitorL( );
+
+private:
+    /**
+     * 2nd phase constructor.
+     * @since S60 3.1
+     * @param aServer Pointer to server class
+     */
+    void ConstructL( CUpnpContentServer* aServer );
+
+    /**
+     * C++ constructor.
+     * @since S60 3.1
+     */
+    CUpnpContentServerSession();
+
+    /**
+     * C++ destructor.
+     * @since S60 3.1
+     */
+    virtual ~CUpnpContentServerSession();
+
+private:
+    /**
+     * Handle to server
+     * not owned
+     */
+    CUpnpContentServer* iServer;
+
+    /** 
+     * Handle to handler
+     * not owned
+     */
+    CUpnpContentServerHandler* iHandler;
+
+    /**
+     * Result buffer for client messages
+     * not owned
+     */
+    CBufFlat* iResultBuffer;
+
+    /**
+     * Possible pending message about for content selection
+     */
+    RMessage2 iSelectionContentMsg;
+
+    /**
+     * Possible pending message about sharing
+     */
+    RMessage2 iChangeShareContentMsg;
+
+    };
+
+#endif // __UPNPCONTENTSERVERSESSION_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontentsharingao.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,560 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      file sharing engine active object class defition
+ *
+*/
+
+
+
+
+
+
+
+#ifndef __UPNPCONTENTSHARINGAO_H__
+#define __UPNPCONTENTSHARINGAO_H__
+
+
+// Include Files
+#include <e32base.h>
+#include <badesca.h>  //for CDesCArray
+#include <upnpmediaserverclient.h>
+#include <upnpbrowsecriteria.h>
+#include <upnpcontainerlist.h>
+#include "upnpplaylistservices.h"
+#include "upnpalbumservices.h"
+#include "upnpselectionwriter.h"
+#include "upnpsharingcallback.h"
+#include "upnpcontentserverdefs.h"
+#include "upnpcontentmetadatautility.h"
+
+// FORWARD DECLARATIONS
+class CUPnPFileSharingEngine;
+class CUpnpContainer;
+class CUpnpObject;
+class CUpnpFileSharing;
+class CUpnpItemList;
+class CUpnpSelectionWriter;
+class CUpnpContentMetadataUtility;
+class MUpnpSharingCallback;
+
+
+// CLASS DECLARATION
+/**
+
+*  Active object class for file sharing
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CUpnpContentSharingAo ): public CActive
+    {
+    /**
+     * Enumeration for different sharing types
+     */
+    enum TSharingType
+        {
+        ESharing,
+        EUnsharing
+        };
+
+    /**
+     * States of this active object
+     */
+    enum TUPnPSharingState
+        {
+        ENotActive,
+        EShareFiles,
+        EStartSharing,
+        EStopSharing,
+        EUnshareMainContainers,
+        EShareMainContainers,
+        // 2.0
+        EValidateDefaultContainers,
+        EGetSharedContainers,
+        EGetSharedItems,//8
+        EUnshareContainers,
+        EUnshareContainersResult,
+        EUnshareItems,//11
+        EShareDefaultContainers,
+        EShareDefaultContainersResult,
+        EShareContainers,
+        EShareContainersResult,
+        EShareItems, //16
+        EShareItemsResult,
+        EShareAllItems,//18
+        EShareAllItemsResult,
+        ECompleteSharingRequest,
+        EEnumerateSelections
+        };
+
+    /**
+     * Sub states of this active object
+     */
+    enum TUpnpSharingSubState
+        {
+        EIdle,
+        EProfileItemList,
+        EProfileItemListResult,
+        EShareItemList,
+        EShareItemListResult
+        };
+
+ public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     * @since S60 3.1
+     * @param aEngine Callback to handler
+     * @param aMetadata Pointer to CLF API
+     */
+    static CUpnpContentSharingAo* NewL(
+        MUpnpSharingCallback* aEngine,
+        CUpnpContentMetadataUtility* aMetadata );
+
+    /**
+     * Destructor.
+     * @since S60 3.1
+     */
+    virtual ~CUpnpContentSharingAo();
+
+ protected:
+
+    /**
+     * Function is called when active request is ready
+     * @since S60 3.1
+     */
+    virtual void RunL();
+
+    /**
+     * Cancels active request
+     * @since S60 3.1
+     */
+    virtual void DoCancel();
+
+    /**
+     * Handle leaves from RunL
+     * @since S60 3.1
+     */
+    TInt RunError( TInt aError );
+
+ public: // new functions
+
+    /**
+     * Initialize parameters needed in sharing
+     * @since S60 3.2
+     * @param aContainerType Type of sharing ongoing
+     * @param aCurrentSelection Array of album/playlist selections
+     * @param aPlaylistIds Ids of collections
+     * @param aPlaylistNames names of collections
+     * @param aClientStatus Clients TRequestStatus
+     */
+    void InitializeL(
+        TUpnpMediaType aContainerType,
+        const RArray<TInt>& aCurrentSelection,
+        CDesCArray& aPlaylistIds,
+        CDesCArray& aPlaylistNames,
+        const TInt aContainerId );
+
+    /**
+     * Starts file sharing process
+     * @since S60 3.1
+     */
+    void ShareFiles( );
+
+
+    /**
+     * Return the number of shared items in current selection
+     * @since S60 3.1
+     * @param aContainerType Type of selections
+     * @return TInt Object count
+     */
+    TInt SelectionObjectCountL(
+        const TUpnpMediaType aContainerType );
+
+    /**
+     * Return progress of the current sharing operation and type of sharing
+     * Progress is shown as procents
+     * @since S60 3.1
+     * @param aContainerType Type of the sharing requested
+     * @return the progress value
+     */
+    TInt SharingProgress(
+        TUpnpMediaType& aContainerType ) const;
+
+    /**
+     * From CActive
+     * @since S60 3.1
+     */
+    TBool IsActive() const;
+
+    /**
+     * Request this active ocject to stop as soon as is possible
+     * Stop is indicated to client via callback
+     * @since S60 3.1
+     * @param aStopType Type of stop operation
+     */
+    void RequestStop( MUpnpSharingCallback::TSharingStopType aStopType );
+
+
+ private:
+
+    /**
+     * C++ default constructor.
+     * @since S60 3.1
+     * @param aEngine Pointer to handler callback
+     * @param aMetadata Pointer to CLF API
+     */
+    CUpnpContentSharingAo( MUpnpSharingCallback* aEngine,
+                           CUpnpContentMetadataUtility* aMetadata );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     * @since S60 3.1
+     */
+    void ConstructL();
+
+    /**
+     * Opens mediaserver and file sharing session
+     * @since S60 3.1
+     * @return TInt, KErrNone if connection is ok
+     *               error code otherwise
+     */
+    TInt OpenFileSharingSession();
+
+    /**
+     * Closes file sharing and mediaserver session
+     * @since S60 3.1
+     */
+    void CloseFileSharingSession();
+
+    /**
+     * Create container
+     * @since S60 3.1
+     * @param aContainerType Type of container to create
+     * @param aTitle Title of the container
+     */
+    CUpnpContainer* CreateContainerL( TUpnpMediaType aContainerType,
+                                      const TDesC8& aTitle ) const;
+
+    /**
+     * Connects to media server
+     * @since S60 3.1
+     */
+    TInt ConnectMediaServer();
+
+    /**
+     * Processes containers to unshare
+     * @since S60 3.1
+     */
+    void UnshareContainersL();
+
+    /**
+     * Adjust the value iShareAllSelection on basis of user selections
+     * @since S60 3.1
+     * @param aSelections The selections received from UI
+     */
+    void AdjustShareAllSelection(
+        const RArray<TInt>& aSelections );
+
+    /**
+     * Share the current container, iContainer
+     * @since S60 3.1
+     */
+    void ShareContainersL();
+
+    /**
+     * Shares the current set of items, iItemList
+     * @since S60 3.1
+     */
+    void ShareItemsL();
+
+
+    /**
+     * Process the result of the container sharing operation
+     * @since S60 3.1
+     */
+    void ShareContainersResultL();
+
+    /**
+     * Process the result of items sharing operation
+     * @since S60 3.1
+     */
+    void ShareItemsResultL();
+
+    /**
+     * Share individual items, not in any album/playlist
+     * @since S60 3.1
+     */
+    void ShareAllItemsL();
+
+    /**
+     * Process the result of sharing individual items
+     * @since S60 3.1
+     */
+    void AllItemsResultL();
+
+    /**
+     * Calculate correct index for indexing CLF on basis of
+     * iCurrentSelection and iShareAllSelection
+     * Verifies that the container selections user has made are valid against 
+     * current CLF / playlist content
+     * @since S60 3.1
+     * @return Index as TInt, KErrNotFound if the selection is not valid
+     */
+    TInt GetContainerIndexL();
+
+    /**
+     * Complete own request
+     * @since S60 3.1
+     */
+    void SelfComplete( const TInt aError );
+
+    /**
+     * Appends image files to iItemList. Starts from index iImageIndex and 
+     * appends maximum of KContentDirCommitAmount items. Updates iImageIndex.
+     * @since S60 3.1
+     */
+    void AppendImageFilesToListL();
+    
+    /**
+     * Appends video files to iItemList. Starts from index iVideoIndex and 
+     * appends maximum of KContentDirCommitAmount items. Updates iVideoIndex.
+     * @since S60 3.1
+     */
+    void AppendVideoFilesToListL();
+
+    /**
+     * Profiles list of items
+     * @since S60 3.1
+     */
+    void ProfileItemListL();
+
+    /**
+     * Handles the result of profiling single item
+     * @since S60 3.1
+     */
+    void ProfileItemListResult();
+
+    /**
+     * Shares list of UpnpItems
+     * @since S60 3.1
+     */
+    void ShareItemListL( const TInt& aParentId );
+
+    /**
+     * Handles the result of ShareItemListL()
+     * @since S60 3.1
+     */
+    void ShareItemListResultL();
+
+    /**
+     * Determines next state according to iSharingSubState variable
+     * @since S60 3.1
+     */
+    void HandleSharingSubstatesL();
+
+    /**
+     * Find a conatiner name from available containers on basis of id 
+     * @since S60 3.1
+     * @param aId Id to search
+     * @param aPlaylistName Name of playlist pointed by id
+     * @param aContainerType Type of the container
+     */
+    TInt GetContainerNameByIdL( const TDesC& aId, TDes8& aPlaylistName, 
+                                const TInt aContainerType );
+    
+    /**
+     * When delete the iItenList Item pointer,
+     * also delete the CUpnpObject object the pointer pointed. 
+     */
+    void DeleteListUpnpObject();
+    
+ private: // data
+
+    /**
+     * Pointer to calling handler
+     * not owned
+     */
+    MUpnpSharingCallback*         iEngine;
+
+    /**
+     * main level container index
+     */
+    TInt                            iContainerIdx;
+
+    /**
+     * object level container index
+     */
+    TInt                            iObjectIdx;
+
+    /**
+     * mediaserver session handle
+     */
+    RUpnpMediaServerClient            iMediaServer;
+
+    /**
+     * Media server API to share files
+     * owned
+     */
+    CUpnpFileSharing*                 iFileSharing;
+
+    /**
+     * Type of container to be unshared; Music or Images & video
+     */
+    TUpnpMediaType             iContainerType;
+
+    /**
+     * Indicates whether the starting sharing or stopping
+     * sharing is ongoing.
+     */
+    TInt                            iSharingState;
+
+    /**
+     * Container holder to use when sharing containers
+     * owned
+     */
+    CUpnpContainer* iTmpContainer;
+
+    /**
+     * item holder used during sharing items
+     * owned
+     */
+    CUpnpItem*      iTmpItem;
+
+    /**
+     * Structure used to hold multiple items during sharing
+     * owned
+     */
+    CUpnpItemList*                  iItemList;
+
+    /**
+     * Indexes relative to queried content in UI
+     * Received when starting sharing ShareFilesL
+     */
+    RArray<TInt> iCurrentSelections;
+
+    /**
+     * The IDs of the shared containers will appear here
+     * owned
+     */
+    CArrayFix<TInt>*                    iSharedContainerIds;
+
+    /**
+     * Id of the default container to where share
+     * Obtained from handler
+     */
+    TInt iContainerId;
+
+    /**
+     * The type of sharing: EShareNone, EShareAll, EShareMany
+     */
+    TInt iShareAllSelection;
+
+    /**
+     * Utility class for CLF
+     * owned
+     */
+    CUpnpContentMetadataUtility*        iMetadataUtility;
+
+    /**
+     * The number of succesfully shared items( containers not incl.)
+     */
+    TInt iSharedContainersCount;
+
+    /**
+     * Class handling the updating of the shared items
+     * owned
+     */
+    CUpnpSelectionWriter* iWriter;
+
+    /**
+     * Progress of the sharing process
+     */
+    TInt iSharingProgress;
+
+    /**
+     * Are all images already shared?
+     */
+    TBool iAllImagesShared;
+    
+    /**
+     * Are all videos already shared?
+     */
+    TBool iAllVideosShared;
+    
+    /**
+     * iImageIndex indicates up to which index is image sharing done so far.
+     */
+    TInt iImageIndex;
+
+    /**
+     * iVideoIndex indicates up to which index is video sharing done so far.
+     */
+    TInt iVideoIndex;
+
+    /**
+     * Possbile states when processing items. See TUpnpSharingSubState
+     */
+    TInt iSharingSubState;
+
+    /**
+     * Index used during profiling
+     */
+    TInt iProfileInd;
+
+    /**
+     * Array holding filenames of items to be shared
+     */
+    CDesCArray* iFileNameArr;
+
+    /**
+     * Flag indicating if there is profiling ongoing
+     */
+    TBool iProfilerActive;
+
+    /**
+     * Flag indicating if there if the destructor is called
+     */
+    TBool iDeletePending;
+
+    /**
+     * Indicates if the client has requested stop
+     * Value is the stop type
+     */
+    TInt iStopRequested;
+
+    /**
+     * Handle to MPX interface
+     */
+    CUPnPPlaylistServices* iPlaylists;
+
+    /**
+     * Handle to MPX interface
+     */
+    CUPnPAlbumServices* iCollections;
+
+    /**
+     * List of playlist ids
+     * Not owned
+     */
+    CDesCArray* iContainerIds;
+    
+    /**
+     * List of playlist names
+     * Not owned
+     */
+    CDesCArray* iContainerNames;
+    };
+
+#endif  // __UPNPCONTENTSHARINGAO_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcontentsharingobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      File sharing observer class definition
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPCONTENTSHARINGOBSERVER_H__
+#define __UPNPCONTENTSHARINGOBSERVER_H__
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+
+/**
+ *  File sharing observer class definition
+ *  @since S60 3.1
+ */
+class MUpnpContentSharingObserver
+    {
+public:
+
+    /**
+     * Completes the query about content to client
+     * @since S60 3.1
+     * @param aMarkedItems Array of items to select shared content
+     */
+    virtual void CompleteSelectionContentL(
+        const CDesCArray& aMarkedItems ) = 0;
+
+    /**
+     * Virtual destructor
+     */
+    virtual ~MUpnpContentSharingObserver() {};
+    };
+
+#endif //UPNPCONTENTSHARINGOBSERVER
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpcustomgrouper.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Custom grouper class definition
+*
+*/
+
+
+
+
+
+
+
+
+#ifndef __CUPNPAPPCUSTOMGROUPER_H__
+#define __CUPNPAPPCUSTOMGROUPER_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <MCLFCustomGrouper.h>
+#include <CLFContentListing.hrh>
+// this will be included when it back in SDK
+// #include <CLFContentListingExtended.hrh>
+
+#include "upnpcontentserverdefs.h"
+
+// FORWARD DECLARATIONS
+class MCLFItem;
+class MCLFModifiableItem;
+
+// CLASS DECLARATION
+
+/**
+*  CLF Custom Grouper.
+*  Example of Custom Grouper that can be used to group files in the
+*  list model. With Custom Groupers you can create grouping functionality that
+*  is not supported in Content Listing Framework by default. This Custom
+*  Grouper can group items of a list model by any field. In this example
+*  application, this Custom Grouper is used to group music items by artist
+*  name.
+*/
+class CUpnpCustomGrouper
+    : public CBase,
+      public MCLFCustomGrouper
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Creates and returns a new instance of this class.
+        * @param aGroupingCriteria Group items by this criteria
+        * @return Pointer to the CCECustomGrouper object
+        */
+
+        static CUpnpCustomGrouper* NewL(
+                        TCLFExtendedFieldId aGroupingCriteria );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpCustomGrouper();
+
+    private:    // Constructors
+        /**
+        * C++ default constructor.
+        * @param aGroupingCriteria Group list items by this criteria
+        */
+        CUpnpCustomGrouper( TCLFExtendedFieldId aGroupingCriteria );
+
+    protected:     // Functions from base classes
+
+        /**
+        * From MCLFCustomGrouper. Method for grouping Content Listing
+        * Framework items. Will get called when grouping operation is executed
+        * by calling refresh for the list model.
+        * @since S60 3.1
+        * @param aSourceList Source list
+        * @param aGroupedList Grouped/destination list
+        */
+        void GroupItemsL( const TArray<MCLFItem*>& aSourceList,
+                          RPointerArray<MCLFItem>& aGroupedList );
+
+    private:    // New functions
+
+        /**
+        * Checks if group has been added to the destination array already.
+        * @param aGroupName Name of the group to be checked
+        * @return ETrue If group has been added to the model, EFalse if not
+        */
+        TBool GroupAlreadyExists( const TDesC& aGroupName );
+
+    private:    // Data
+
+        // Array for keeping track, which items have been added to the
+        // model. Deletes items when they are no longer needed.
+        RPointerArray<MCLFModifiableItem> iModItems;
+
+        // Criteria for grouping
+        TCLFExtendedFieldId iGroupingCriteria;
+
+    };
+
+#endif // __CUPNPAPPCUSTOMGROUPER_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpmetadataobserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      metadata observer class definition
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPMETADATAOBSERVER_H__
+#define __UPNPMETADATAOBSERVER_H__
+
+// INCLUDE FILES
+#include <e32base.h>
+
+/**
+ *  Callback class for receiving events from CupnpContentMetadataUtility
+ *  @lib upnpcontentserver.lib
+ *  @since S60 3.1
+ */
+class MUpnpMetadataObserver
+    {
+public:
+    /**
+     * Informs that CLF refresh has completed
+     * @since S60 3.1
+     */
+    virtual void RefreshDoneL() = 0;
+
+    /**
+     * Virtual destructor
+     */
+    virtual ~MUpnpMetadataObserver() {};
+    };
+
+#endif //UPNPMETADATAOBSERVER
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnppostfilter.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Post filter class defintion
+*
+*/
+
+
+
+
+
+
+
+#ifndef __CUPNPAPPPOSTFILTER_H__
+#define __CUPNPAPPPOSTFILTER_H__
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <MCLFPostFilter.h>
+#include <CLFContentListing.hrh>
+// this will be included when it back in SDK
+// #include <CLFContentListingExtended.hrh>
+
+
+#include "upnpcontentserverdefs.h"
+
+// FORWARD DECLARATIONS
+class MCLFItem;
+
+// CLASS DECLARATION
+
+/**
+*  CLF Post Filter.
+*  Example of Post Filter that can be used to filter items from the
+*  list model. With post filter your can select, which kind of items are
+*  excluded from the list model. For example, you can include only music
+*  files of some specific artist and remove all other items.
+*/
+class CUpnpPostFilter
+    : public CBase,
+      public MCLFPostFilter
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Creates and returns a new instance of this class.
+        * @param aFilterCriteria Filtering criteria (for example
+        *        ECLFFielIdAlbum or ECLFFieldIdArtist)
+        * @param aFilterParameter Filtering parameter (for example
+        *        name of album or artist)
+        * @return Pointer to the CCEPostFilter object
+        */
+        static CUpnpPostFilter* NewL(
+                                const TCLFExtendedFieldId aFilterCriteria,
+                                const TDesC& aFilterParameter,
+                                TBool aRemoveDuplicates );
+
+        /**
+        * Creates and returns a new instance of this class. Pointer is
+        * left to the CleanupStack.
+        * @param aFilterCriteria Filtering criteria (for example
+        *        ECLFFielIdAlbum or ECLFFieldIdArtist)
+        * @param aFilterParameter Filtering parameter (for example
+        *        name of album or artist)
+        * @return Pointer to the CCEPostFilter object
+        */
+        static CUpnpPostFilter* NewLC(
+                                const TCLFExtendedFieldId aFilterCriteria,
+                                const TDesC& aFilterParameter,
+                                TBool aRemoveDuplicates);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUpnpPostFilter();
+
+    private:    // Constructors
+        /**
+        * C++ default constructor.
+        * @param aFilterCriteria Filtering criteria
+        */
+        CUpnpPostFilter( const TCLFExtendedFieldId aFilterCriteriaconst,
+                         TBool aRemoveDuplicates );
+
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL( const TDesC& aFilterParameter );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From MCLFPostFilter. Method for filtering the source list.
+        * Will get called when post filtering operation is executed by
+        * calling refresh for the list model.
+        * @since S60 3.1
+        * @param aItemList Source item list
+        * @param aFilteredItemList Filtered/destination item list
+        */
+        void FilterItemsL( const TArray<MCLFItem*>& aItemList,
+                           RPointerArray<MCLFItem>& aFilteredItemList );
+
+    /**
+     * Remove duplicate items
+     * @since S60 3.1
+     * @param aFilteredItemList, Already added items
+     * @param aFieldValue, value to search
+     */
+    TBool IsAdded( RPointerArray<MCLFItem>& aFilteredItemList,
+                   TPtrC& aFieldValue );
+
+    private:    // Data
+
+        // Parameter for filtering (owned)
+        HBufC* iFilterParameter;
+
+        // Criteria for filtering
+
+        TCLFExtendedFieldId iFilterCriteria;
+        // remove duplicate items if ETrue
+        TBool iRemoveDuplicates;
+
+    };
+
+#endif // __CUPNPAPPPOSTFILTER_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpselectionreader.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,260 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpSelectionReader class definition
+ *
+*/
+
+
+
+
+
+
+#ifndef UPNPSELECTIONREADER_H
+#define UPNPSELECTIONREADER_H
+
+// INCLUDES
+
+#include "upnpcontentmetadatautility.h"
+#include "upnpcontentserverdefs.h"
+
+// FORWARD DECLARATIONS
+class CUpnpContentMetadataUtility;
+
+// CLASS DECLARATION
+
+/**
+ * CUpnpSelectionReader class
+ * Reads the selections user has made
+ * @since S60 3.1
+ */
+class CUpnpSelectionReader: public CBase
+    {
+public:
+    /**
+     * Two-phased constructor.
+     * @since S60 3.1
+     * @param aUtility Pointer to CLF interface
+     */
+    IMPORT_C static CUpnpSelectionReader* NewL(
+        CUpnpContentMetadataUtility* aUtility );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpSelectionReader();
+
+    /**
+     * Fetch collections from Media Gallery
+     * @param aSettingsTextArray, The array of collection names
+     * @since S60 3.1
+     */
+    IMPORT_C void FetchCollectionsL( CDesCArray* aSettingsTextArray );
+
+    /**
+     * Fetch playlists from Media Gallery
+     * @param aSettingsTextArray, The array of playlist names
+     * @since S60 3.1
+     */
+    IMPORT_C void FetchPlaylistsL( CDesCArray* aSettingsTextArray );
+
+    /**
+     * Checks if item is alredy shared
+     * @param aItemName, Name of the item
+     * @param aIdArray, Array of Ids to search from
+     * @return TBool, True is shared, false otherwise
+     * @since S60 3.1
+     */
+    IMPORT_C TBool IsItemShared(const TDesC& aItemName,
+                                const CDesCArray& aIDArray ) const;
+
+    /**
+     * Gets the indexes of users previous selections relative to the available
+     * playlists or albums
+     * @since S60 3.1
+     * @param aSelections, Array of selections
+     * @param aType, Selections type needed
+     */
+    IMPORT_C void GetSelectionIndexesL(
+        RArray<TInt>& aSelections,
+        const TUpnpMediaType& aType );
+
+    /**
+     * Gets the sharing state of Images and videos
+     * @since S60 3.1
+     * @param aShareAllState, The variable to store the state
+     * @return Status of the operation
+     */
+    TInt GetVisualSharingStateL( TInt& aShareAllState );
+
+    /**
+     * Gets the sharing state of music
+     * @since S60 3.1
+     * @param aShareAllState, The variable to store the state
+     * @return Status of the operation
+     */
+    TInt GetMusicSharingStateL( TInt& aShareAllState );
+
+    /**
+     * Get the number of shared containers
+     * @since S60 3.1
+     * @return number of shared containers
+     */
+    TInt GetContainerCount() const;
+
+    /**
+     * Get the playlist ids
+     * @since S60 3.1
+     * @param aPlaylistIds Array containing the playlist ids
+     * @return error code
+     */
+    TInt PlayListIdsL( CDesCArray& aPlaylistIds,
+        CDesCArray& aPlaylistNames );
+
+    /**
+     * Get the collection ids
+     * @since S60 3.1
+     * @param aCollectionIds Array containing the collection ids
+     * @return error code
+     */
+    TInt CollectionIdsL( CDesCArray& aCollectionIds, 
+        CDesCArray& aCollectionNames );
+
+    /**
+     * Set the metadata utility pointer
+     * @since S60 3.1
+     * @param aMetaData Pointer to CUpnpContentMetadataUtility instance
+     */
+    void SetMetadata( CUpnpContentMetadataUtility*
+                      aMetaData );
+
+protected:  // New functions
+    /**
+     * Two-phased constructor.
+     * @since S60 3.1
+     * @param aUtility Pointer to CLF interface
+     */
+    void ConstructL(
+        CUpnpContentMetadataUtility* aUtility);
+
+    /**
+     * Searches playlist files
+     * @since S60 3.1
+     */
+    TBool SearchPlaylistFilesL();
+
+    /**
+     * Searches collections
+     * @since S60 3.1
+     */
+    TBool SearchCollectionsL();
+
+    /**
+     * Saves sharing state to central repository
+     * @since S60 3.1
+     * @return TInt, error code
+     */
+    TInt SaveSharingState();
+
+
+private:
+    /**
+     * C++ default constructor.
+     */
+    CUpnpSelectionReader();
+
+    /**
+     * Reads container IDs from file
+     * @since S60 3.1
+     * @param aArray, array where desciptors are read
+     * @param aContainerType, type of container
+     * @return TInt, error code
+     */
+    TInt ReadSharedContainerIDsL(
+        CDesCArray* aArray,
+        const TUpnpMediaType& aContainerType ) const;
+
+
+private: //data
+
+    /**
+     *  Mediatype selected from listbox
+     */
+    TUpnpMediaType                            iMediaType;
+
+    /**
+     * Pointer to CLF interface
+     * not owned
+     */
+    CUpnpContentMetadataUtility*         iMetadataUtility;
+
+    /**
+     * Selection value for images and videos
+     */
+    TInt iVisualSharingSelection;
+
+    /**
+     * Selection value for playlists
+     */
+    TInt iMusicSharingSelection;
+
+    /** 
+     * selected image and video indexes
+     * owned
+     */
+    RArray<TInt>*            iSelectedImages;
+
+    /**
+     * selected music indexes
+     * owned
+     */
+    RArray<TInt>*            iSelectedMusic;
+
+    /** 
+     * array for playlists
+     * owned
+     */
+    CDesCArrayFlat*                 iPlIdArray;
+
+    /** 
+     * array for collection Ids
+     * owned
+     */
+    CDesCArrayFlat*                 iCollIdArray;
+
+    /**
+     * array for image and video containers shown in ui
+     * owned
+     */
+    CDesCArrayFlat*                 iImageContainers;
+
+    /**
+     * array for playlists shown in ui
+     * owned
+     */
+    CDesCArrayFlat*                 iPlaylistNames;
+
+    /**
+     * array for collections shown in ui
+     * owned
+     */
+    CDesCArrayFlat* iCollectionNames;
+
+    /**
+     * number of ui items
+     */
+    TInt iContainerCount;
+
+    };
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpselectionwriter.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpSelectionWriter class definition
+ *
+*/
+
+
+
+
+
+
+#ifndef UPNPSELECTIONWRITER_H
+#define UPNPSELECTIONWRITER_H
+
+// INCLUDES
+
+#include <badesca.h>    // for CDesCArray
+#include <centralrepository.h>
+#include "upnpcontentserverdefs.h"
+
+
+using namespace UpnpContentServer;
+
+// CLASS DECLARATION
+
+/**
+ * CUpnpSelectionWriter utility class
+ * @since S60 3.1
+ */
+class CUpnpSelectionWriter: public CBase
+    {
+public: // Constructors and destructor
+    /**
+     * Two-phased constructor.
+     * @since S60 3.1
+     * @param aMediaType Type of selections currently active
+     */
+    static CUpnpSelectionWriter* NewL(
+        TUpnpMediaType aMediaType );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpSelectionWriter();
+
+    /**
+     * Append identifier of the container which is shared next
+     * @since S60 3.1
+     * @param aNewObject, name of the object
+     */
+    void AppendItemL( const TPtrC aNewObject );
+
+    /**
+     * Append index of succesfully shared container
+     * @since S60 3.1
+     * @param aIndex, Index of the container
+     */
+    void AppendStatusL( const TInt aIndex );
+
+    /**
+     * Saves sharing state to central repository and updates shared albums
+     * @since S60 3.1
+     * @param aShareAllSelection, The selections type in UI( Share all \
+/ None / Many )
+     * @return TInt, error code
+     */
+    TInt SaveSharingStateL( TInt aShareAllSelection );
+
+private:  // New functions
+    /**
+     * 2nd phase constructor.
+     * @since S60 3.1
+     * @param aMediaType Type of selections currently active
+     */
+    void ConstructL( TUpnpMediaType aMediaType );
+
+    /**
+     * Save the containers to file
+     * @since S60 3.1
+     */
+    TInt StoreSharedContainerIDsL() const;
+
+    /**
+     * C++ default constructor.
+     * @since S60 3.1
+     */
+    CUpnpSelectionWriter();
+
+private: //data
+    /**
+     * Mediatype selected from listbox
+     */
+    TInt                            iMediaType;
+
+    /**
+     * selection type
+     */
+    TInt                            iShareAllSelection;
+
+    /**
+     * array of succesfully shared containers.
+     */
+    RArray<TInt>           iOkItems;
+
+    /**
+     * array for albums/playlist
+     * owned
+     */
+    CDesCArrayFlat*                 iFileArray;
+
+    /**
+     * Pointer to Central repository
+     * owned
+     */
+    CRepository*                    iRepository;
+    };
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpsharingcallback.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Callback for filesharing related async operations
+*
+*/
+
+
+
+
+
+
+#ifndef __UPNPSHARINGCALLBACK_H__
+#define __UPNPSHARINGCALLBACK_H__
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+
+
+/**
+ * Callback class for informing about completion of unsharing, sharing and
+ * container checking.
+ * @since S60 3.1
+ */
+class MUpnpSharingCallback
+    {
+public:
+    /**
+     * Enumeration for stop type
+     */
+    enum TSharingStopType
+        {
+        ESharingNoStop,
+        ESharingFullStop,
+        ESharingPause
+        };
+
+    /**
+     * Completes the asynchronous sharing / unsharing / container checking
+     * Normal completion
+     * @since S60 3.1
+     */
+    virtual void CompleteSharingOperationL(
+        const TInt& aErr, const TInt& aType ) = 0;
+
+    /**
+     * Completes the asynchronous sharing / unsharing / container checking
+     * Error/cancel situation
+     * @since S60 3.1
+     */
+    virtual void CancelSharingOperationL(
+        const TInt& aErr ) = 0;
+
+    /**
+     * Sets the progress of operation
+     * @since S60 3.1
+     */
+    virtual void SetProgressL(
+        const TInt& aProgress ) = 0;
+
+    /**
+     * Virtual destructor
+     */
+    virtual ~MUpnpSharingCallback() {};
+    };
+
+#endif //__UPNPSHARINGCALLBACK_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpsharingrequest.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpSharingRequest class definition
+ *
+*/
+
+
+
+
+
+#ifndef __UPNPSHARINGREQUEST_H__
+#define __UPNPSHARINGREQUEST_H__
+
+// Include Files
+#include <e32base.h>
+#include <e32def.h> //CArrayFix
+#include <badesca.h> //CDesCArray
+
+
+/**
+ * Helper class to store information about ongoing/pending sharing request
+ * @since S60 3.1
+ */
+class CUpnpSharingRequest : public CBase
+    {
+public :
+
+    /**
+     * 2 phased contructor
+     * @since S60 3.1
+     * @param aKind Type of sharing request( images&videos or music )
+     * @param aArr Indexes of selection relative to albums or playlists
+     * @param aNameArray Names of containers to share
+     */
+    static CUpnpSharingRequest* NewL(
+        TInt aKind,
+        const RArray<TInt>& aArr,
+        CDesCArray* aIdArray = NULL,
+        CDesCArray* aNameArray = NULL );
+
+    /**
+     * 2nd phase constructor.
+     * @since S60 3.1
+     * @param aArr Indexes of selection relative to albums or playlists
+     * @param aNameArray Names of containers to share
+     */
+    void ConstructL( const RArray<TInt>& aArr,
+                    CDesCArray* aIdArray,
+                    CDesCArray* aNameArray );
+
+    /**
+     * Constructor
+     * @since S60 3.1
+     * @param aKind Type of sharing request( images&videos or music )
+     */
+    CUpnpSharingRequest( TInt aKind );
+
+    /**
+     * Destructor
+     */
+    virtual ~CUpnpSharingRequest();
+
+public :
+    /**
+     * Determines the type of sharing:
+     * images&videos or music
+     */
+    TInt iKind;
+
+    /**
+     * The number of items in selection
+     */
+    TInt iItemCount;
+
+    /**
+     * The progress of sharing if it is ongoing
+     */
+    TInt iProgress;
+
+    /**
+     * Selections for the sharing request
+     */
+    RArray<TInt> iSelections;
+
+    /**
+     * Array for object IDs
+     */
+    CDesCArray* iObjectIds;
+    
+    /**
+     * Array for object names
+     */
+    CDesCArray* iObjectNames;
+    };
+
+
+#endif // __UPNPSHARINGREQUEST_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/inc/upnpunsharerao.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,301 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpUnsharerAo class definitions
+*
+*/
+
+
+
+
+
+#ifndef __UPNPUNSHARERAO_H__
+#define __UPNPUNSHARERAO_H__
+
+
+// INCLUDE FILES
+#include <upnpbrowsecriteria.h>
+#include <upnpcontainerlist.h>
+#include <upnpcontainer.h>
+#include <upnpitem.h>
+#include <upnpitemlist.h>
+#include <upnpfilesharing.h>
+#include <upnpmediaserverclient.h>
+#include "upnpcontentserverdefs.h"
+#include "upnpsharingcallback.h"
+
+// CLASS DECLARATION
+/**
+ *  Active object class for unsharing UPnP containers in an incremental way
+ *  @since S60 3.1
+ */
+NONSHARABLE_CLASS( CUpnpUnsharerAo ): public CActive
+    {
+    /**
+     * Indicates the ongoing operation of the CUpnpUnsharerAo
+     */
+    enum THandlerOperations
+        {
+        EInitialize,
+        EQueryContainersFromMediaServer,
+        EQueryContainersFromMediaServerResult,
+        EQueryItemsFromMediaServer,
+        EQueryItemsFromMediaServerResult,
+        EUnshareItemList,
+        EUnshareContainer,
+        EUnshareContainerResult,
+
+        ENotActive
+        };
+
+ public: // Constructors and destructor
+
+    /**
+     * C++ default constructor.
+     * @since S60 3.1
+     * @param aClientWait, reference to client wait, for signalling completion
+     * @param aPriority, Priority value for this active object
+     */
+    CUpnpUnsharerAo( MUpnpSharingCallback* aCallback, TInt aPriority );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpUnsharerAo();
+
+ protected:
+
+    /**
+     * Function is called when active request is ready
+     * @since S60 3.1
+     */
+    virtual void RunL();
+
+    /**
+     * Cancels active request
+     * @since S60 3.1
+     */
+    virtual void DoCancel();
+
+    /**
+     * Handle leaves from RunL function
+     * @since S60 3.1
+     */
+    TInt RunError( TInt aError );
+
+ public: // new functions
+
+    /**
+     * Unshares all items and subcontainers from given container recursively
+     * Leaves the containers with aContainerId
+     * @since S60 3.1
+     * @param aContainerId Id of the container to empty
+     * @return Error code of the operation
+     */
+    TInt EmptyContainer( TInt& aContainerId );
+
+    /**
+     * Request this active ocject to stop as soon as is possible
+     * Stop is indicated to client via callback
+     * @since S60 3.1
+     * @param aStopType Type of stop operation
+     */
+    void RequestStop( MUpnpSharingCallback::TSharingStopType aStopType );
+
+    /**
+     * Return progress of the current unsharing operation 
+     * Progress is shown as procents
+     * @since S60 3.2.3
+     * @return the progress value
+     */
+    TInt UnSharingProgress( ) ;
+
+     /**
+      * Get total items of the all unsharing operation 
+      * @since S60 3.2.3
+      * @return a numbers of the unsharing items 
+      */
+    TInt TotalItemsForUnShare( ) ;
+    
+ private:
+
+    /**
+     * Qyery list of containers from media server
+     * @since S60 3.1
+     * @param aId Id of the container to query containers from
+     */
+    void QueryContainersFromMediaServerL( TInt aId );
+
+    /**
+     * Handle the result of the container query
+     * @since S60 3.1
+     */
+    void QueryContainersFromMediaServerResultL();
+
+    /**
+     * Query items from certain container from media server
+     * @since S60 3.1
+     * @param aId Id of the container to query items from
+     */
+    void QueryContainerItemsL( TInt aId );
+
+    /**
+     * Handle the result of the container query
+     * @since S60 3.1
+     */
+    void QueryContainerItemsResultL();
+
+    /**
+     * Unshare the items in iItemList
+     * @since S60 3.1
+     */
+    void UnshareItemListL();
+
+    /**
+     * Unshare the container pointed by iCurrentContainerId
+     * @since S60 3.1
+     */
+    void UnshareContainerL();
+
+    /**
+     * Handle the result of container unshare
+     * @since S60 3.1
+     */
+    void UnshareContainerResultL();
+
+    /**
+     * Perform allocating of resources needed for processing upload events
+     * @since S60 3.1
+     * @param aContainerId The id of the initial container
+     * @return error code
+     */
+    TInt InitializeL( TInt& aContainerId );
+
+    /**
+     * Creates browse criteria for media server querys
+     * @since S60 3.1
+     */
+    CUpnpBrowseCriteria* CreateBrowseCriteriaLC() const;
+
+    /**
+     * Complete own async request
+     * @since S60 3.1
+     * @param aError Error code to complete request
+     */
+    void SelfComplete( TInt aError );
+
+    /**
+     * Clean the internal variables after error/when finished
+     * @since S60 3.1
+     */
+    void Cleanup();
+
+
+
+ private: // data
+
+    /**
+     * Media server API to share files
+     * owned
+     */
+    CUpnpFileSharing* iFileSharing;
+
+    /**
+     * Media server session handle
+     */
+    RUpnpMediaServerClient iMediaServer;
+
+    /**
+     * Structure used to hold the containers queries from media server
+     * In practice it is used to hold "Images& VIdeos" & "Music" & "Uploaded"
+     * containers.
+     * Ordering from end to beginning
+     * owned
+     */
+    CUpnpContainerList*  iContainerList;
+
+    /**
+     * The id of the current container
+     */
+    TInt iCurrentContainerId;
+
+    /**
+     * Array for all container levels used in processing
+     * Ordering top-down.
+     */
+    RPointerArray<CUpnpContainerList> iContainerLists;
+
+    /**
+    * Structure used to hold possbile unwanted items when cleaning
+    * some folder
+    */
+    CUpnpItemList* iItemList;
+
+    /**
+     * This is started by client if needed. Stopped when profiling is ready
+     * not owned.
+     */
+    MUpnpSharingCallback* iCallback;
+
+    /**
+     * The container to process
+     */
+    TInt iUpContainer;
+
+    /**
+     * Total number of items in all operations to media server
+     */
+    TInt iAllTotalItems;   
+        
+    /**
+     * Total number of items in some operations to media server
+     */
+    TInt iTotalItems;
+
+    /**
+     * Total number of containers received in media server container query
+     */ 
+    TInt iTotalContainers;
+
+    /**
+     * The position when querying containers in segments
+     */ 
+    TInt iContainerBrowsePosition;
+
+    /**
+     * The postion when incrementally processing large number of items
+     */
+    TInt iExecStatus;
+
+    /**
+     * State of the active object used to determine the next operation after
+     * RunL completes
+     */
+    TInt iCurrentOperation;
+
+    /**
+     * Indicates if the client has requested stop
+     * Value is the stop type
+     */
+    TInt iStopRequested;
+
+    /**
+     * Indicates the last successfully unshared item
+     * Not used but required by CUpnpFileSharing API
+     */
+    TInt iUnsharePosition;
+    };
+
+#endif  // __UPNPUNSHARERAO_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpcontainercheckerao.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,838 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      This module handlers the cleaning and creating of the
+ *                filesystem to mediaserver
+ *
+*/
+
+
+
+
+
+#include <e32debug.h>
+#include "upnpcommonutils.h"
+#include "upnpcontentserverdefs.h"
+#include "upnpcontainercheckerao.h"
+#include "upnpunsharerao.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KDefaultBrowseReqCount( 100 );
+const TInt KDefaultBrowseStartingInd( 0 );
+
+using namespace UpnpContentServer;
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::CUpnpContainerCheckerAo()
+// C++ constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContainerCheckerAo::CUpnpContainerCheckerAo(
+    MUpnpSharingCallback* aCallback ) :
+    CActive( CActive::EPriorityIdle ),
+    iCallback( aCallback )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iCurrentOperation = ENotActive;
+    iState = EIdle;
+    iTotalMatches = KErrNotFound;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::~CUpnpContainerCheckerAo()
+// C++ destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContainerCheckerAo::~CUpnpContainerCheckerAo()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    delete iFileSharing;
+    iFileSharing = NULL;
+    iMediaServer.Close();
+
+    if ( IsActive() )
+        {
+        __LOG1("CUpnpContainerCheckerAo destructor IsActive iCurrentOp=%d",
+              iCurrentOperation );
+        iCurrentOperation = ENotActive;
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, KErrNone );
+        }
+
+    Cancel();
+
+    Cleanup();
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::ValidateContainerStructureL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContainerCheckerAo::ValidateContainerStructureL( 
+    RArray<TInt>* aIds )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    CActiveScheduler::Add( this );
+    TInt err( KErrNotFound );
+
+    iClientIds = aIds;
+
+    // First initialize resources
+    iOperationMode = EValidateContainers;
+    iCurrentOperation = EInitialize;
+    SelfComplete( KErrNone );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::GetDefaultContainerIdsL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContainerCheckerAo::CheckDefaultContainersL(
+    RArray<TInt>* aIds )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iOperationMode = ECheckDefaultContainers;
+    TInt err( KErrNone );
+
+    iClientIds = aIds;
+
+    CActiveScheduler::Add( this );
+    iCurrentOperation = EInitialize;
+    SelfComplete( KErrNone );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::RequestStop
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::RequestStop(
+    MUpnpSharingCallback::TSharingStopType aStopType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iStopRequested = aStopType;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::InitializeL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContainerCheckerAo::InitializeL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // First initialize resources
+    iFileSharing = CUpnpFileSharing::NewL();
+    TInt error( iMediaServer.Connect() );
+    if ( error )
+        {
+        __LOG8_1( "iMediaServer.Connect err: %d",error );
+        }
+    User::LeaveIfError( error );
+
+    if ( !error )
+        {
+        // start offline if not started
+        TInt status( RUpnpMediaServerClient::EStopped );
+        error = iMediaServer.Status( status );
+        if ( !error && status == RUpnpMediaServerClient::EStopped )
+            {
+            error = iMediaServer.StartOffline();
+            }
+        }
+
+    SelfComplete( error );
+    iCurrentOperation = EQueryDefaultContainers;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::QueryDefaultContainerIdsL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::QueryDefaultContainerIdsL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iState = EResolveDefaultContainerIds;
+
+    CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC();
+
+    delete iContainerList;
+    iContainerList = NULL;
+
+    iContainerList = CUpnpContainerList::NewL();
+
+    // Get shared containers to iContainerList
+    iFileSharing->GetSharedContainerListL( KRootContainerId,
+                                           *browseCriteria,
+                                           *iContainerList,
+                                           iMatchCount,
+                                           iStatus );
+    iCurrentOperation = EQueryDefaultContainersResult;
+    CleanupStack::PopAndDestroy( browseCriteria );
+    SetActive();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::QueryDefaultContainerIdsResultL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::QueryDefaultContainerIdsResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpContainer* tmpContainer( NULL );
+    if ( !iContainerList )
+        {
+        User::Leave( KErrGeneral );
+        }
+    switch ( iContainerPosition )
+        {
+    case CUpnpContainerCheckerAo::EImageAndVideo :
+        {
+        tmpContainer =
+            UPnPCommonUtils::FindContainerByTitle( *iContainerList,
+                                                   KImageContainerName );
+        if ( tmpContainer )
+            {
+            iImageVideoContainerId = UPnPCommonUtils::DesC8ToInt(
+                tmpContainer->Id() );
+            iContainerList->RemoveAndDestroy( tmpContainer->Id() );
+            tmpContainer = NULL;
+            iContainerPosition++;
+            iCurrentOperation = EQueryDefaultContainersResult;
+            SelfComplete( KErrNone );
+            }
+        else
+            {
+            iCurrentOperation = EShareContainer;
+            ShareContainerL( iContainerPosition );
+            }
+        }
+    break;
+    case CUpnpContainerCheckerAo::EMusic :
+        {
+        tmpContainer =
+            UPnPCommonUtils::FindContainerByTitle( *iContainerList,
+                                                   KMusicContainerName );
+        if ( tmpContainer )
+            {
+            iMusicContainerId = UPnPCommonUtils::DesC8ToInt(
+                tmpContainer->Id() );
+            iContainerList->RemoveAndDestroy( tmpContainer->Id() );
+            tmpContainer = NULL;
+            iContainerPosition++;
+            iCurrentOperation = EQueryDefaultContainersResult;
+            SelfComplete( KErrNone );
+            }
+        else
+            {
+            iCurrentOperation = EShareContainer;
+            ShareContainerL( iContainerPosition );
+            }
+        }
+    break;
+    case CUpnpContainerCheckerAo::EUploaded :
+        {
+        tmpContainer =
+            UPnPCommonUtils::FindContainerByTitle( *iContainerList,
+                                                   KUploadedContainerName );
+        if ( tmpContainer )
+            {
+            iUploadContainerId = UPnPCommonUtils::DesC8ToInt(
+                tmpContainer->Id() );
+            iContainerList->RemoveAndDestroy( tmpContainer->Id() );
+            tmpContainer = NULL;
+            iContainerPosition++;
+            iCurrentOperation = EQueryDefaultContainersResult;
+            SelfComplete( KErrNone );
+            }
+        else
+            {
+            iCurrentOperation = EShareContainer;
+            ShareContainerL( iContainerPosition );
+            }
+        }
+    break;
+    default :
+        {
+        // Store IDs of possible unwanted containers
+        if ( iOperationMode != ECheckDefaultContainers )
+            {
+            for ( TInt i(0); i< iContainerList->ObjectCount(); i++ )
+                {
+                tmpContainer = static_cast< CUpnpContainer* >(
+                    iContainerList->operator[]( i ));
+                iSharedContainerIds.Append(
+                    UPnPCommonUtils::DesC8ToInt( tmpContainer->Id() ) );
+                }
+
+
+            iState = EUnshareExtraContainers;
+            iCurrentOperation = EUnshareContainer;
+            }
+        else
+            {
+            iCurrentOperation = ENotActive;
+            }
+
+        // Just add the Ids to client
+        if ( iClientIds )
+            {
+            iClientIds->Reset();
+            iClientIds->Append( iImageVideoContainerId );
+            iClientIds->Append( iMusicContainerId );
+            iClientIds->Append( iUploadContainerId );
+            iClientIds->Compress();
+            }
+        delete iContainerList;
+        iContainerList = NULL;
+        SelfComplete( KErrNone );
+        }
+        break;
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::RunL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::RunL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( iStatus.Int() )
+        {
+        __LOG1( "Error: %d", iStatus.Int() );
+        }
+    
+    if ( iStatus.Int() == KErrCorrupt )
+        {
+        if ( iRecoverError == ENoError )
+            {
+            iRecoverError = EDropAllContent;
+            }
+        else
+            {
+            iCurrentOperation = ENotActive;
+            iRecoverError = ENoError;
+            }
+        }
+    else if ( iStatus.Int() == KErrNoMemory ||
+              iStatus.Int() == KErrDiskFull ||
+              iStatus.Int() == KErrServerTerminated )
+             {
+             iCurrentOperation = ENotActive;
+             SelfComplete( iStatus.Int() );
+             }
+
+
+    if ( iRecoverError )
+        {
+        switch ( iRecoverError )
+            {
+        case EDropAllContent :
+            {
+            iFileSharing->DropAllContentL( iStatus );
+            iRecoverError = EDropAllContentResult;
+            SetActive();
+            }
+            break; 
+        case EDropAllContentResult :
+            {
+            if ( iStatus.Int() == KErrCorrupt )
+                {
+                iCurrentOperation = ENotActive;
+                SelfComplete( iStatus.Int() );
+                }
+            else
+                {
+                iRecoverError = ENoError;
+                SelfComplete( KErrNone );
+                }
+            }
+            break;    
+        default:
+            __LOG1( "Error: %d", __LINE__ );
+            break;
+            }
+
+        }
+    else
+        {
+
+        if ( iStopRequested == MUpnpSharingCallback::ESharingPause )
+            {
+            delete iFileSharing;
+            iFileSharing = NULL;
+            iFileSharing = CUpnpFileSharing::NewL();
+            TInt e = iMediaServer.Stop( 
+                         RUpnpMediaServerClient::EStopSilent );
+            if ( e )
+                {
+                __LOG1( "Error: %d", e );
+                }
+            e = iMediaServer.StartOffline();
+            if ( e )
+                {
+                __LOG1( "Error: %d", e );
+                }
+            iStopRequested = MUpnpSharingCallback::ESharingNoStop;
+            }
+
+        switch ( iCurrentOperation )
+            {
+        case EInitialize :
+            {
+            InitializeL();
+            }
+            break;
+        case EQueryDefaultContainers :
+            {
+            QueryDefaultContainerIdsL();
+            }
+            break;
+        case EQueryDefaultContainersResult :
+            {
+            QueryDefaultContainerIdsResultL();
+            }
+            break;
+        case EUnshareItemList :
+            {
+            UnshareItemListL();
+            }
+            break;
+        case EQueryItemFromMediaServer :
+            {
+            QueryContainerItemsL();
+            }
+            break;
+        case EQueryItemFromMediaServerResult :
+            {
+            QueryItemFromCdsResultL();
+            }
+            break;
+        case EShareContainer :
+            {
+            __LOG1( "Error: %d", __LINE__ );
+            }
+            break;
+        case EShareContainerResult :
+            {
+            ShareContainerResult();
+            }
+            break;
+        case ENotActive :
+            {
+            Cleanup();
+            if ( iCallback )
+                {
+                iCallback->CompleteSharingOperationL( iStatus.Int(), 0 );
+                }
+            }
+            // all operations requested done
+            break;
+        case EUnshareContainer :
+            {
+            UnshareContainerL();
+            }
+            break;
+        case EUnshareContainerResult :
+            {
+            UnshareContainerResultL();
+            }
+            break;
+        default :
+            {
+            __LOG1( "Error: %d", __LINE__ );
+            break;
+            }
+            }
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::DoCancel
+// Cancels active object
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::DoCancel()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // NOTE: The cancelling of mediaserver request must be made in destructor
+    // because there is no cancel in CUpnpFileSharing
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::RunError
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContainerCheckerAo::RunError( TInt aError )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( aError )
+        {
+        __LOG8_1( "CUpnpContainerCheckerAo::RunError", aError );
+        }
+    TInt ret( KErrNone );
+    if ( aError == KErrNoMemory ||
+         aError == KErrDiskFull ||
+         aError == KErrCorrupt )
+        {
+        iCurrentOperation = ENotActive;
+        SelfComplete( aError );
+        }
+    else 
+        {
+        
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return ret;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::QueryItemFromCdsResultL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::QueryItemFromCdsResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt objCount( iItemList->ObjectCount() );
+    if ( objCount && ( iExecStatus < iTotalMatches ) )
+        {
+        iCurrentOperation = EUnshareItemList;
+        }
+    else
+        {
+        if ( iState == EEmptyRootContainerItems )
+            {
+            iState = EEmptyUploadedContainerItems;
+            iCurrentOperation = EQueryItemFromMediaServer;
+            }
+        else
+            {
+            iState = EIdle;
+            iCurrentOperation = ENotActive;
+            }
+        iExecStatus = 0;
+        iTotalMatches = KErrNotFound;
+
+        }
+
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::UnshareItemListL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::UnshareItemListL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iExecStatus += iItemList->ObjectCount();
+    iFileSharing->UnshareItemListL( *iItemList, iMatchCount, iStatus );
+
+    delete iItemList;
+    iItemList = NULL;
+    iCurrentOperation = EQueryItemFromMediaServer;
+    SetActive();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::ShareContainerL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::ShareContainerL( TInt aPos )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iTmpContainer = CUpnpContainer::NewL();
+    iTmpContainer->SetParentIdL( *UPnPCommonUtils::IntToDesC8LC(
+        KRootContainerId ) );
+    CleanupStack::PopAndDestroy(); //UPnPCommonUtils::IntToDesC8LC
+    iTmpContainer->SetObjectClassL( KStorageFolderContainerClass );
+
+    switch ( aPos )
+        {
+    case CUpnpContainerCheckerAo::EImageAndVideo :
+        {
+        iTmpContainer->SetTitleL( KImageContainerName );
+        }
+        break;
+    case CUpnpContainerCheckerAo::EMusic :
+        {
+        iTmpContainer->SetTitleL( KMusicContainerName );
+        }
+        break;
+    case CUpnpContainerCheckerAo::EUploaded :
+        {
+        iTmpContainer->SetTitleL( KUploadedContainerName );
+        }
+        break;
+    default :
+        break;
+        }
+    if ( iTmpContainer )
+        {
+        iFileSharing->ShareContainerL(
+            *UPnPCommonUtils::IntToDesC8LC( KRootContainerId ),
+            *iTmpContainer,
+            iStatus );
+        iCurrentOperation = EShareContainerResult;
+        CleanupStack::PopAndDestroy(); // UPnPCommonUtils::IntToDesC8LC
+        iCurrentOperation = EShareContainerResult;
+        SetActive();
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::ShareContainerResult
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::ShareContainerResult( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( !iStatus.Int() )
+        {
+        // Store the IDs
+        if ( iContainerPosition == CUpnpContainerCheckerAo::EUploaded )
+            {
+            iUploadContainerId = UPnPCommonUtils::DesC8ToInt(
+                iTmpContainer->Id() );
+            }
+
+        else if ( iContainerPosition ==
+                  CUpnpContainerCheckerAo::EImageAndVideo )
+            {
+            iImageVideoContainerId = UPnPCommonUtils::DesC8ToInt(
+                iTmpContainer->Id() );
+            }
+        else if ( iContainerPosition == CUpnpContainerCheckerAo::EMusic )
+            {
+            iMusicContainerId = UPnPCommonUtils::DesC8ToInt(
+                iTmpContainer->Id() );
+            }
+
+
+        }
+    delete iTmpContainer;
+    iTmpContainer = NULL;
+
+    iCurrentOperation = EQueryDefaultContainersResult;
+    iContainerPosition++;
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::UnshareContainerL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::UnshareContainerL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iCurrentOperation = EUnshareContainerResult;
+    switch ( iState )
+        {
+    case EEmptyUploadedContainer :
+        {
+        __LOG1( "Error: %d", __LINE__ );
+        }
+        break;
+    case EUnshareExtraContainers :
+        {
+        if ( iSharedContainerIds.Count() )
+            {
+            iSharedContainerIds.Compress();
+            iFileSharing->UnshareContainerL( iSharedContainerIds[ 0 ],
+                                             iStatus );
+            iSharedContainerIds.Remove( 0 );
+            SetActive();
+            }
+        else
+            {
+            iState = EEmptyRootContainerItems;
+            QueryContainerItemsL();
+            }
+        }
+        break;
+    default :
+        {
+        __LOG1( "Error: %d", __LINE__ );
+        }
+        break;
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::UnshareContainerResultL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::UnshareContainerResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( iState == EEmptyUploadedContainer )
+        {
+        __LOG1( "Error: %d", __LINE__ );
+        }
+    else if ( iState == EUnshareExtraContainers )
+        {
+        if ( iSharedContainerIds.Count() )
+            {
+            iCurrentOperation = EUnshareContainer;
+            }
+        else
+            {
+            iState = EEmptyRootContainerItems;
+            iCurrentOperation = EQueryItemFromMediaServer;
+            }
+        SelfComplete( KErrNone );
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::QueryContainerItemsL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::QueryContainerItemsL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    delete iItemList;
+    iItemList = NULL;
+    iItemList = CUpnpItemList::NewL();
+    TInt containerId( KRootContainerId );
+    if ( iState == EEmptyUploadedContainerItems )
+        {
+        containerId = iUploadContainerId;
+        }
+    CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC();
+    if ( iTotalMatches == KErrNotFound )
+        {
+        iFileSharing->GetSharedItemListL (
+            containerId, *browseCriteria,
+            *iItemList, iTotalMatches, iStatus );
+        }
+    else
+        {
+        TInt tmp( 0 );
+        iFileSharing->GetSharedItemListL (
+            containerId, *browseCriteria,
+            *iItemList, tmp, iStatus );
+        }
+    iCurrentOperation = EQueryItemFromMediaServerResult;
+    CleanupStack::PopAndDestroy( browseCriteria );
+    SetActive();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::CreateBrowseCriteriaLC
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+CUpnpBrowseCriteria* CUpnpContainerCheckerAo::CreateBrowseCriteriaLC() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpBrowseCriteria* browseCriteria = CUpnpBrowseCriteria::NewLC();
+    browseCriteria->SetRequestedCount( KDefaultBrowseReqCount );
+    browseCriteria->SetStartingIndex( KDefaultBrowseStartingInd );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return browseCriteria;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::Cleanup
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::Cleanup()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iExecStatus = 0;
+    iTotalMatches = KErrNotFound;
+    iImageVideoContainerId = 0;
+    iMusicContainerId = 0;
+    iUploadContainerId = 0;
+    iContainerPosition = 0;
+    iClientIds = NULL;
+    delete iItemList;
+    iItemList = NULL;
+    delete iContainerList;
+    iContainerList = NULL;
+    delete iTmpContainer;
+    iTmpContainer = NULL;
+    iSharedContainerIds.Close();
+    iState = EIdle;
+    iCurrentOperation = ENotActive;
+    if ( IsAdded() )
+        {
+        Deque();
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContainerCheckerAo::SelfComplete
+// Start observing events
+// --------------------------------------------------------------------------
+//
+void CUpnpContainerCheckerAo::SelfComplete( TInt aError )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    SetActive();
+    TRequestStatus* stat = &iStatus;
+    User::RequestComplete( stat, aError );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpcontentmetadatautility.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,727 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpContentMetadataUtility class implementation
+ *
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+// System
+#include <e32base.h>
+#include <MCLFContentListingEngine.h>
+#include <ContentListingFactory.h>
+#include <MCLFItemListModel.h>
+#include <CLFContentListing.hrh>
+#include <MCLFItem.h>
+#include <f32file.h>
+
+// upnp stack api
+#include <upnpitem.h>
+#include <upnpcontainer.h>
+#include <upnpstring.h>
+
+// upnpframework / avcontroller helper api
+#include "upnpfileutility.h"
+
+// upnpframework / internal api's
+#include "upnpcommonutils.h"
+#include "upnpmetadatautility.h"
+
+#include "upnpdlnaprofiler.h"
+#include "upnpcdsreselementutility.h"
+
+// homeconnect internal
+#include "upnpcontentmetadatautility.h"
+#include "upnpcustomgrouper.h"
+#include "upnppostfilter.h"
+
+#include "upnpcontentserverdefs.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KUPnPFileListSeparator, "\t" );
+const TInt KMediaTypeArrGranularity(1);
+
+using namespace UpnpContentServer;
+
+// ============================ MEMBER FUNCTIONS ============================
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::CUpnpContentMetadataUtility()
+// Default constructor
+// --------------------------------------------------------------------------
+//
+CUpnpContentMetadataUtility::CUpnpContentMetadataUtility()
+    : iRefreshOngoing( ETrue )
+    {
+    }
+
+void CUpnpContentMetadataUtility::ConstructL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // Create Content Listing Engine and a list model
+    iEngine = ContentListingFactory::NewContentListingEngineLC();
+    CleanupStack::Pop();   // iEngine
+    iMusicModel = iEngine->CreateListModelLC( *this );
+    CleanupStack::Pop();    // iMusicModel
+
+    iImageModel = iEngine->CreateListModelLC( *this );
+    CleanupStack::Pop();    // iImageModel
+
+    iVideoModel = iEngine->CreateListModelLC( *this );
+    CleanupStack::Pop();    // iVideoModel
+
+    iCollectionModel = iEngine->CreateListModelLC( *this );
+    CleanupStack::Pop();    // iCollectionModel
+    // Set music media type filter to CLF
+    RArray<TInt> musicArray( KMediaTypeArrGranularity );
+
+    CleanupClosePushL( musicArray );
+    musicArray.AppendL( ECLFMediaTypeMusic );
+    iMusicModel->SetWantedMediaTypesL( musicArray.Array() );
+    CleanupStack::PopAndDestroy( &musicArray );
+
+    // Set image media type filter to CLF
+    RArray<TInt> imageArray( KMediaTypeArrGranularity );
+
+    CleanupClosePushL( imageArray );
+    imageArray.AppendL( ECLFMediaTypeImage );
+    iImageModel->SetWantedMediaTypesL( imageArray.Array() );
+    CleanupStack::PopAndDestroy( &imageArray );
+
+    // Set video media type filter to CLF
+    RArray<TInt> videoArray( KMediaTypeArrGranularity );
+    CleanupClosePushL( videoArray );
+    videoArray.AppendL( ECLFMediaTypeVideo );
+    iVideoModel->SetWantedMediaTypesL( videoArray.Array() );
+    CleanupStack::PopAndDestroy( &videoArray );
+
+    // Set Collection media type filter to CLF
+    RArray<TInt> collectionArray( KMediaTypeArrGranularity );
+
+    CleanupClosePushL( collectionArray );
+    collectionArray.AppendL( ECLFMediaTypeCollection );
+    iCollectionModel->SetWantedMediaTypesL( collectionArray.Array() );
+    CleanupStack::PopAndDestroy( &collectionArray );
+
+    // Group items by collection name
+    iCustomGrouper = CUpnpCustomGrouper::NewL( ECLFFieldIdCollectionName );
+    iCollectionModel->SetCustomGrouper( iCustomGrouper );
+
+    // Start to refresh the music files (HandleOperationEventL
+    // callback comes when finished)
+    iMusicModel->RefreshL();
+    
+    // Create metadata utility
+    iMetaDataUtility = CUPnPMetaDataUtility::NewL();
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::NewL()
+// 2 phased constructor
+// --------------------------------------------------------------------------
+//
+CUpnpContentMetadataUtility* CUpnpContentMetadataUtility::NewL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpContentMetadataUtility* self
+        = new( ELeave ) CUpnpContentMetadataUtility;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::~CUpnpContentMetadataUtility()
+// Default destructor
+// --------------------------------------------------------------------------
+//
+CUpnpContentMetadataUtility::~CUpnpContentMetadataUtility()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    delete iMusicModel;
+    delete iImageModel;
+    delete iVideoModel;
+    delete iCollectionModel;
+    delete iPostFilter;
+    delete iCustomGrouper;
+    delete iEngine;
+    delete iMetaDataUtility;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::HandleOperationEventL
+// Callback implementation for MCLFOperationObserver
+// --------------------------------------------------------------------------
+//
+void CUpnpContentMetadataUtility::HandleOperationEventL(
+    TCLFOperationEvent aOperationEvent,
+    TInt /*aError*/ )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // Waiting is stopped when an event for refresh completion is received
+    if( aOperationEvent == ECLFRefreshComplete )
+
+        {
+        switch ( iRefreshCounter )
+            {
+        case 0 :
+            {
+            iVideoModel->RefreshL();
+            break;
+            }
+        case 1 :
+            {
+            iImageModel->RefreshL();
+            break;
+            }
+        case 2 :
+            {
+            iCollectionModel->RefreshL();
+            break;
+            }
+        case 3 :
+            {
+
+            iRefreshOngoing = EFalse;
+            iRefreshCounter = 0;
+            if ( iHandler )
+                {
+                iHandler->RefreshDoneL();
+                }
+            __LOG("CUpnpContentMetadataUtility::HandleOperationEventL: \
+Refresh done");
+            break;
+
+            }
+        default :
+            {
+            __LOG("CUpnpContentMetadataUtility::HandleOperationEventL: \
+default: error");
+            break;
+            }
+
+            }
+        if ( iRefreshOngoing )
+            {
+            iRefreshCounter++;
+            }
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::HandleItemChangeL
+// CLF content is changed --> model needs to be refreshed
+// --------------------------------------------------------------------------
+//
+void CUpnpContentMetadataUtility::HandleItemChangeL(
+    const TArray<TCLFItemId>& /*aItemIDArray*/ )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // Start to refresh the music files (HandleOperationEventL
+    // callback comes when finished)
+    iRefreshOngoing = ETrue;
+    iMusicModel->RefreshL();
+    iImageModel->RefreshL();
+    iVideoModel->RefreshL();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::HandleError
+// Method is used to handle errors in changed item event.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentMetadataUtility::HandleError( TInt /*aError*/ )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::MusicFiles
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+const MCLFItemListModel& CUpnpContentMetadataUtility::MusicFiles() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    return *iMusicModel;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::ImageFiles
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+const MCLFItemListModel& CUpnpContentMetadataUtility::ImageFiles() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    return *iImageModel;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::VideoFiles
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+const MCLFItemListModel& CUpnpContentMetadataUtility::VideoFiles() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    return *iVideoModel;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::Collections
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+const MCLFItemListModel& CUpnpContentMetadataUtility::Collections() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    return *iCollectionModel;
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::GetCollectionFileNamesL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentMetadataUtility::GetCollectionFileNamesL( 
+    CDesCArray& aFileArray,
+    const TDesC& aFiles ) const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt collectionLength( aFiles.Length() );
+    TInt position( 0 );
+    TInt dataPos( 0 );
+    do
+        {
+        // Put filenames from ":" separeted row to aFileArray
+        TPtrC data( aFiles.Right( collectionLength - position ) );
+        dataPos = data.Find( KUPnPFileListSeparator );
+        if( dataPos > 0 )
+            {
+            ++position; // skip KUPnPFileListSeparator
+            position += dataPos;
+            aFileArray.AppendL( data.Left( dataPos ) );
+            }
+        } while ( dataPos > 0 );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::CollectionItemsL()
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentMetadataUtility::CollectionItemsL( 
+    const TDesC& aNameOfCollection )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    __LOG1( "CUpnpContentMetadataUtility: collection: %S",
+                  &aNameOfCollection );
+
+    //clear previous filtering
+    iCollectionModel->SetPostFilter( NULL );
+
+    // Delete old post filter if any
+
+    delete iPostFilter;
+    iPostFilter = NULL;
+
+    // Create and activate a post filter for collection filtering
+    // so that the model will contain only files
+    // from selected collection
+    iPostFilter = CUpnpPostFilter::NewL( ECLFFieldIdCollectionName,
+                                            aNameOfCollection, EFalse );
+    iCollectionModel->SetPostFilter( iPostFilter );
+
+    iCollectionModel->RefreshL( ECLFRefreshPostFilter );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::CreateItemL
+// Create the item with mandatory fields
+// --------------------------------------------------------------------------
+//
+CUpnpItem* CUpnpContentMetadataUtility::CreateItemL(
+    const MCLFItem& aCLFItem,
+    const TDesC8& aParentId ) const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TPtrC fullFileName;
+    TInt err( aCLFItem.GetField( ECLFFieldIdFileNameAndPath,
+                                 fullFileName ));
+    
+    TInt32 filesize( 0 );
+    TInt err1( aCLFItem.GetField( ECLFFieldIdFileSize, filesize ) );    
+ 
+    CUpnpItem* newItem( NULL );
+    
+    if ( !err && !err1 && filesize )
+        {
+        newItem = CreateItemL( fullFileName, aParentId );
+        }
+    else
+        {
+        __LOG8_1( "MCLFItem ECLFFieldIdFileNameAndPath err= %d", err );
+        __LOG8_1( "MCLFItem ECLFFieldIdFileSize err= %d", err1 );
+        }
+    
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return newItem;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::CreateItemL
+// Update the basic fields, based on list of filenames
+// --------------------------------------------------------------------------
+//
+CUpnpItem* CUpnpContentMetadataUtility::CreateItemL(
+    const TDesC& aFullFilename,
+    const TDesC8& aParentId
+    ) const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    CUpnpItem* newItem( NULL );
+    
+    TFileName path( aFullFilename );
+    TBool isProtected( EFalse );
+    TRAPD( err, 
+           isProtected = UPnPFileUtility::IsFileProtectedL( path ) );
+
+    if ( !isProtected && !err )
+        {
+        // title
+        HBufC8* itemName( NULL );
+        iMetaDataUtility->LoadTitleL( path );
+        if( iMetaDataUtility->Title().Length() > 0 )
+            {
+            itemName = UpnpString::FromUnicodeL( 
+                    iMetaDataUtility->Title() );
+            }
+        else
+            {
+            // If does not find the title, using filename instead
+            TParse fileParser;
+            fileParser.Set( path, NULL, NULL );
+            itemName = UpnpString::FromUnicodeL( fileParser.Name() );
+            }
+        
+        if ( itemName )
+            {
+            CleanupStack::PushL( itemName );
+            
+            newItem = CUpnpItem::NewL();
+            CleanupStack::PushL( newItem );            
+            newItem->SetTitleL( *itemName );            
+            newItem->SetObjectClassL( KClassItem );
+            newItem->SetParentIdL( aParentId );
+            CleanupStack::Pop( newItem );
+
+            CleanupStack::PopAndDestroy( itemName );
+            }
+        }
+    else
+        {
+        __LOG8_1( "UPnPFileUtility::IsFileProtectedL err= %d", err );
+        }
+    
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return newItem;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::RefreshOngoing() const
+// Used to check if refresh is ongoing.
+// --------------------------------------------------------------------------
+//
+
+TBool CUpnpContentMetadataUtility::RefreshOngoing() const
+    {
+    return iRefreshOngoing;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::UpdateMetaDataL
+// Updates meta data for the item
+// --------------------------------------------------------------------------
+//
+TBool CUpnpContentMetadataUtility::UpdateMetadataL(
+    const TUpnpMediaType& aMediaType, 
+    CUpnpItem* aItem, 
+    const TDesC& aFileName )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    // 1st use correct model according to item type
+    MCLFItemListModel* model = NULL;
+    switch( aMediaType )
+        {
+    case EMusicFile :
+        {
+        model = iMusicModel;
+        break;
+        }
+    case EVideoFile :
+        {
+        model = iVideoModel;
+        break;
+        }
+    case EPhotoFile :
+        {
+        model = iImageModel;
+        break;
+        }
+    default:
+        {
+        break;
+        }
+        }
+    // Then find the CLF item and update data from it
+    TBool found = EFalse;
+    TBool end = EFalse;
+    TInt beginLoop = iClfIndex;
+
+    // increment. If passed item count, start from beginning.
+        iClfIndex = 0;
+        beginLoop = -1;
+
+    while ( model->ItemCount() && 
+            !found && 
+            !end )
+        {
+        // Get the item
+        const MCLFItem& myItem = model->Item( iClfIndex );
+        TPtrC fileName;
+        TInt error = myItem.GetField( ECLFFieldIdFileNameAndPath,
+                                      fileName );
+
+        // if there was no error and file name matched
+        if ( !error && aFileName.CompareF( fileName ) == 0 )
+            {
+            found = ETrue;
+
+            // Get the mediatype
+            TInt32 mediaType;
+            TInt errorType = myItem.GetField( ECLFFieldIdMediaType,
+                                              mediaType );
+            // If it is music file, fill the meta data for it
+            if ( !errorType && mediaType == ECLFMediaTypeMusic )
+                {
+                // Get title, artist, album & genre tag info of the item
+                // Test update the class as it is in 1.x
+                aItem->SetObjectClassL( 
+                    KClassAudioMusicTrack );
+
+                TPtrC songArtist;
+                TInt errorArtist( myItem.GetField( ECLFFieldIdArtist,
+                                                   songArtist ) );
+                if ( !errorArtist )
+                    {
+                    CUpnpElement* elArtist = CUpnpElement::NewL( 
+                        KElementArtist );
+                    CleanupStack::PushL( elArtist );
+                    HBufC8* artist = UpnpString::FromUnicodeL( 
+                        songArtist );
+                    CleanupStack::PushL( artist );
+                    elArtist->SetValueL( *artist );
+                    // UPnP stack needs filepath
+                    elArtist->SetFilePathL( aFileName );
+                    CleanupStack::PopAndDestroy( artist );
+                    aItem->AddElementL( elArtist ); // transfer own..
+                    CleanupStack::Pop( elArtist );
+                    }
+                TPtrC songAlbum;
+                TInt errorAlbum( myItem.GetField( ECLFFieldIdAlbum,
+                                                  songAlbum ) );
+                if ( !errorAlbum )
+                    {
+                    CUpnpElement* elAlbum = CUpnpElement::NewL( 
+                        KElementAlbum );
+                    CleanupStack::PushL( elAlbum );
+                    HBufC8* album = UpnpString::FromUnicodeL( songAlbum );
+
+                    CleanupStack::PushL( album );
+                    elAlbum->SetValueL( *album );
+                    // UPnP stack needs filepath
+                    elAlbum->SetFilePathL( aFileName );
+                    CleanupStack::PopAndDestroy( album );
+                    aItem->AddElementL( elAlbum ); // transfer own..
+                    CleanupStack::Pop( elAlbum );
+                    }
+                TPtrC songGenre;
+                TInt errorGenre( myItem.GetField( ECLFFieldIdGenre,
+                                                  songGenre ) );
+                if ( !errorGenre )
+                    {
+                    CUpnpElement* elGenre = CUpnpElement::NewL( 
+                        KElementGenre );
+                    CleanupStack::PushL( elGenre );
+                    HBufC8* genre = UpnpString::FromUnicodeL( songGenre );
+
+                    CleanupStack::PushL( genre );
+                    elGenre->SetValueL( *genre );
+                    // UPnP stack needs filepath
+                    elGenre->SetFilePathL( aFileName );
+                    CleanupStack::PopAndDestroy( genre );
+                    aItem->AddElementL( elGenre ); // transfer own..
+                    CleanupStack::Pop( elGenre );
+
+                    }
+                }
+            else if ( !errorType && mediaType == ECLFMediaTypeImage )
+                {
+                // Just set correct object class
+                aItem->SetObjectClassL( KImageItemObjectClass );
+                }
+            else if ( !errorType && mediaType == ECLFMediaTypeVideo )
+                {
+                // Just set correct object class
+                aItem->SetObjectClassL( KVideoItemObjectClass );
+                }
+
+            // Below this happens to ALL media types
+            TTime dateTime;
+            TInt errorDate( myItem.GetField( ECLFFieldIdFileDate,
+                                             dateTime ) );
+
+        if ( !errorDate )
+                {
+                HBufC* date = NULL;
+                TRAP( errorDate, date = 
+                    UPnPCommonUtils::TTimeToUPnPDateL(dateTime));
+                
+                
+                if(date && errorDate == KErrNone)
+                    {
+                    CleanupStack::PushL( date );
+                    
+                    CUpnpElement* elDate = CUpnpElement::NewL( 
+                    KElementDate );
+                    CleanupStack::PushL( elDate );
+                
+                    
+                    HBufC8* date8 = UpnpString::FromUnicodeL( *date );
+                    CleanupStack::PushL( date8 );
+                    elDate->SetValueL( *date8 );
+              
+                    CleanupStack::PopAndDestroy( date8 );
+                    
+                    elDate->SetFilePathL( aFileName );
+                    aItem->AddElementL( elDate ); // transfer own..
+                
+                    CleanupStack::Pop( elDate );
+                    CleanupStack::Pop( date );
+                    }
+                    
+               
+                if(date)
+                    {
+                    delete date; 
+                    date = NULL;
+                    }
+                }
+
+            }
+        else
+            {
+            // The item was not found
+            if ( iClfIndex != beginLoop )
+                {
+                if ( ++iClfIndex >= model->ItemCount() )
+                    {
+                    iClfIndex = 0;
+                    end = ETrue;
+                    }
+                }
+            else
+                {
+                end = ETrue;
+                __LOG("end=ETRue");
+                }
+            }
+        } // while
+    if( found )
+        {
+        __LOG("CUpnpContentMetadataUtility:: item found");
+        }
+    else
+        {
+        __LOG("CUpnpContentMetadataUtility:: item not found");
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return found;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::ClearPostFiltersL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+void CUpnpContentMetadataUtility::ClearPostFiltersL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    //clear previous filtering
+    iCollectionModel->SetPostFilter( NULL );
+
+    // Delete old post filter if any
+
+    delete iPostFilter;
+    iPostFilter = NULL;
+    
+    iCollectionModel->RefreshL( ECLFRefreshPostFilter );
+
+   // Set the default postfilter
+    iPostFilter = CUpnpPostFilter::NewL( ECLFFieldIdCollectionName,
+                                         KNullDesC, ETrue );
+    iCollectionModel->SetPostFilter( iPostFilter );
+
+    iCollectionModel->RefreshL( ECLFRefreshPostFilter );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentMetadataUtility::SetCallback
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+void CUpnpContentMetadataUtility::SetCallback( 
+    MUpnpMetadataObserver* aObserver )
+    {
+    iHandler = aObserver;
+
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpcontentserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,394 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpContentServer class implamentation
+ *
+*/
+
+
+
+
+
+#include <e32debug.h>
+#include <w32std.h>
+
+#include "upnpcontentserver.h"
+#include "upnpcontentserversession.h"
+#include "upnpcontentserverdefs.h"
+#include "upnpcontentserverhandler.h"
+#include "upnpperiodic.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+_LIT( KUpnpContentServerString, "Upnp content server");
+
+using namespace UpnpContentServer;
+
+// --------------------------------------------------------------------------
+// Server's policy
+// --------------------------------------------------------------------------
+
+//Total number of ranges
+static const TUint KContentServerRangeCount = 1;
+
+//Definition of the ranges of IPC numbers
+static const TInt contentServerRanges[KContentServerRangeCount] =
+        {
+        0
+        };
+
+//Policy to implement for each of the above ranges
+static const TUint8 contentServerElementsIndex[KContentServerRangeCount] =
+        {
+        0, //applies to 0th range
+        };
+
+//Specific capability checks
+static const CPolicyServer::TPolicyElement contentServerElements[] =
+        {
+        {_INIT_SECURITY_POLICY_C3(ECapabilityReadUserData,
+                                  ECapabilityWriteUserData,
+                                  ECapabilityNetworkServices),
+                                  CPolicyServer::EFailClient}
+                                  //policy "0",
+                                  //fail call if all capabilities not present
+        };
+
+//Package all the above together into a policy
+static const CPolicyServer::TPolicy KUpnpContentServerPolicy =
+        {
+        CPolicyServer::EAlwaysPass, //all connect attempts should pass
+        KContentServerRangeCount,
+        contentServerRanges,
+        contentServerElementsIndex,
+        contentServerElements
+        };
+
+// --------------------------------------------------------------------------
+// E32Main
+// main function called by E32
+// --------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    TRAPD( ret, CUpnpContentServer::LaunchServerL() );
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::LaunchServer
+// Initializes the process and creates an instance of CUpnpContentServer.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentServer::LaunchServerL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // Check server not already started
+    TFindServer findHostServer( KUpnpContentServer );
+
+    TInt err( KErrNone );
+    TFullName name;
+    if ( findHostServer.Next(name) == KErrNone )
+        { // found server already
+        __LOG1( "Error: %d", __LINE__ );
+        err = KErrGeneral;
+        }
+    if ( !err )
+        {
+        User::RenameThread( KUpnpContentServer );
+
+        // Create cleanup stack.
+        CTrapCleanup* cleanup = CTrapCleanup::New();
+
+        // Construct and install active scheduler.
+        CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+        CActiveScheduler::Install( scheduler );
+
+        // Construct server.
+        CUpnpContentServer* server = NULL;
+        TRAPD( err, server = CUpnpContentServer::NewL() );
+        if ( err )
+            {
+            __LOG1( "Error: %d", err );
+            }
+        RProcess::Rendezvous( err );
+
+        __LOG("CUpnpContentServer::LaunchServer, Start CActiveScheduler");
+        // Start handling requests.
+        CActiveScheduler::Start();
+
+        delete server;
+        __LOG("CUpnpContentServer::LaunchServer, Server deleted.");
+        delete scheduler;
+        delete cleanup;
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::NewL
+// 2-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentServer* CUpnpContentServer::NewL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpContentServer* self = new (ELeave) CUpnpContentServer();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    self->StartL( KUpnpContentServer );
+    CleanupStack::Pop(); // self
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::CUpnpContentServer()
+// C++ constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentServer::CUpnpContentServer()
+    : CPolicyServer( EPriorityStandard, KUpnpContentServerPolicy,
+                     ESharableSessions )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::ConstructL
+// 2nd phase constructor.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServer::ConstructL()
+    {
+    iHandler = CUpnpContentServerHandler::NewL( this );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::~CUpnpContentServer()
+// C++ destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentServer::~CUpnpContentServer()
+    {
+    delete iHandler;
+    delete iContainerIndex;
+    delete iConMon;
+    delete iIdle;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::Handler
+// Returns pointer to CUpnpContentServerHandler
+// --------------------------------------------------------------------------
+//
+CUpnpContentServerHandler* CUpnpContentServer::Handler() const
+    {
+    return iHandler;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::NewContainerL
+// Deletes  objcet container
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServer::RemoveSession( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iSessionCount--;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::NewContainerL
+// Deletes  objcet container
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServer::AddSession()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iSessionCount++;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::CanStop
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TBool CUpnpContentServer::CanStop() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TBool ret( EFalse );
+    if ( iSessionCount < 1 && !iConMon )
+        {
+        ret = ETrue;
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::Stop
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServer::Stop()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( iIdle )
+        {
+        iIdle->Cancel();
+        }
+    else
+        {
+        TRAPD( err, iIdle = CUPnPPeriodic::NewL( CActive::EPriorityIdle ) );
+        __ASSERT( err == KErrNone, __FILE__, __LINE__  );
+        }
+
+    iIdle->Start( KShutdownTimeout, 
+                  KShutdownTimeout, 
+                  TCallBack( Shutdown, this ) );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::Shutdown
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentServer::Shutdown( TAny* aPtr )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpContentServer* server = static_cast<CUpnpContentServer*>(aPtr);
+    delete server->iIdle;
+    server->iIdle = NULL;
+    CActiveScheduler::Stop();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::RequestConnectionLostL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentServer::RequestConnectionLostL(
+    const TInt aIapId )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( iHandler )
+        {
+        iHandler->ValidateDefaultContainersL();
+        }
+    TInt err( KErrNone );
+    if ( !iConMon )
+        {
+        iConMon = CUPnPConnectionMonitor::NewL( *this, aIapId );
+        iActiveIapId = aIapId;
+        }
+    else if ( iActiveIapId != aIapId )
+        {
+        err = KErrInUse;
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::CancelConnectionLostL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServer::CancelConnectionLostL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // Stop connection monitoring
+    delete iConMon;
+    iConMon = NULL;
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::ConnectionLost
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServer::ConnectionLost()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TRAP_IGNORE( iHandler->ConnectionLostL() );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::RunError
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentServer::RunError( TInt aError )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( aError )
+        {
+        __LOG1( "Error: %d", aError );
+        }
+    if ( aError == KErrBadDescriptor )
+        {
+        Message().Panic( KUpnpContentServerString, aError );
+        }
+    else
+        {
+        Message().Complete( aError );
+        }
+    ReStart();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServer::NewSessionL
+// from CServer2, creates a new session.
+// --------------------------------------------------------------------------
+//
+CSession2* CUpnpContentServer::NewSessionL(
+    const TVersion& aVersion,
+    const RMessage2& /*aMessage*/ ) const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    if ( iIdle )
+        {
+        iIdle->Cancel();
+        }
+    
+    TVersion v( KUpnpContentServerVersionMajor,
+                KUpnpContentServerVersionMinor,
+                0 );
+    if( !User::QueryVersionSupported(v,aVersion) )
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return CUpnpContentServerSession::NewL( (CUpnpContentServer*)this );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpcontentserverclient.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,447 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      RUpnpContentServerClient class implementation
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <f32file.h>
+#include <s32mem.h>
+
+#include "upnpcontentserverclient.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+// CONSTANTS 
+const TInt KDefaultBufferSize( 512 ); //default size for any receice buffer
+const TInt KContentBufferSize( 10*1024 ); //size for media content buffer
+
+using namespace UpnpContentServer;
+
+//---------------------------------------------------------------------------
+// LaunchServer
+// Launches the server
+//---------------------------------------------------------------------------
+//
+TInt LaunchServer()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt res = KErrNone;
+
+    // DLL launch
+    RProcess server;
+    res = server.Create( KUpnpContentServerNameAndDir, 
+                         KNullDesC );
+
+    // Loading failed.
+    if ( res == KErrNone )
+        {
+        server.SetPriority( EPriorityLow );
+        TRequestStatus status;
+        server.Rendezvous(status);
+
+        if ( status != KRequestPending)
+            {
+            server.Kill(0);     // abort startup
+            server.Close();
+            res = KErrGeneral;
+            }
+        if( !res )
+            {
+            server.Resume();    // Logon OK - start the server.
+
+            User::WaitForRequest(status);
+            server.Close();
+            res = status.Int();
+            }
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return res;
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::RUpnpContentServerClient
+// C++ Constructor
+// --------------------------------------------------------------------------
+//
+EXPORT_C RUpnpContentServerClient::RUpnpContentServerClient()
+    : iSendBufferPtr( NULL, 0 ),
+      iSendBuffer( NULL ),
+      iReceiveBufferPtr( NULL, 0 ),
+      iReceiveBuffer( NULL ),
+      iContentBufferPtr( NULL, 0 ),
+      iContentBuffer( NULL )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::OpenL
+// Creates connection to server
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::OpenL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TVersion version( KUpnpContentServerVersionMajor,
+                      KUpnpContentServerVersionMinor,
+                      0 );
+
+    TInt res = CreateSession( KUpnpContentServer, version,
+                              KDefaultMessageSlots );
+    if ( res != KErrNone )
+        {
+        __LOG1( "Error: %d", res );
+        res = LaunchServer();
+        if ( res != KErrNone )
+            {
+            __LOG1( "Error: %d", res );
+            }
+        User::LeaveIfError( res );
+        res = CreateSession( KUpnpContentServer, version,
+                             KDefaultMessageSlots );
+        if ( res != KErrNone )
+            {
+            __LOG1( "Error: %d", res );
+            }
+        ShareAuto();
+        }
+    User::LeaveIfError( res );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::Close
+// close connection to server
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::Close()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // close session
+    delete iSendBuffer;
+    iSendBuffer = NULL;
+    delete iReceiveBuffer;
+    iReceiveBuffer = NULL;
+    delete iContentBuffer;
+    iContentBuffer = NULL;
+    RSessionBase::Close();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::StartUploadListenerL
+// Starts the media server upload listener
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::StartUploadListenerL( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    User::Leave( KErrNotSupported );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::StopUploadListenerL
+// Stops the media server upload listener
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::StopUploadListenerL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    User::Leave( KErrNotSupported );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::GetSelectionContentL
+// Gets the names of existed albums/playlists
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::GetSelectionContentL(
+    UpnpContentServer::TUpnpMediaType aType,
+    TRequestStatus& aStatus )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    delete iSendBuffer;
+    iSendBuffer = NULL;
+    iSendBuffer = CBufFlat::NewL( KTintSize );
+
+    // Need to externalize a data to buffer to send it with IPC
+    RBufWriteStream sendstream;
+    sendstream.Open( *iSendBuffer );
+    CleanupClosePushL( sendstream );
+    sendstream.WriteInt32L( aType );
+    iSendBufferPtr.Set( iSendBuffer->Ptr(0) );
+
+    // Prepare receive buffers
+    delete iContentBuffer;
+    iContentBuffer = NULL;
+    iContentBuffer = HBufC8::NewL( KContentBufferSize );
+    iContentBufferPtr.Set( iContentBuffer->Des() );
+
+    SendReceive( ERequestSelectionContent,
+                 TIpcArgs( &iSendBufferPtr, &iContentBufferPtr ), 
+                 aStatus );
+    CleanupStack::PopAndDestroy( &sendstream );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::GetSelectionContentResultL
+// Ask the result of GetSelectionContentL call
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::GetSelectionContentResultL(
+    CDesCArray& aIDArray )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    if ( !iContentBuffer )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    RDesReadStream stream;
+    stream.Open( iContentBufferPtr );
+    CleanupClosePushL( stream );
+    // leaves -25 if empty stream
+    TInt itemCount( 0 );
+    TRAP_IGNORE( itemCount = stream.ReadUint32L() );
+
+    for ( TInt i(0); i < itemCount; i++ )
+        {
+        const TInt desLen( static_cast<TInt>( stream.ReadUint32L() ));
+        TBuf<KMaxFileName> item;
+        stream.ReadL( item, desLen );
+        aIDArray.AppendL( item );
+        }
+
+    CleanupStack::PopAndDestroy( &stream );
+    delete iContentBuffer;
+    iContentBuffer = NULL;
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::ChangeSharedContentL
+// Sends the selected indexes to server and starts sharing
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::ChangeSharedContentL(
+    UpnpContentServer::TUpnpMediaType aType,
+    const CArrayFix<TInt>& aMarkedItems,
+    TRequestStatus& aStatus )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt objectCount( aMarkedItems.Count() );
+    if ( objectCount < 1 )
+        {
+        __LOG1( "Error: %d", __LINE__ );
+        User::Leave( KErrArgument );
+        }
+
+    delete iSendBuffer;
+    iSendBuffer = NULL;
+    // Calculate correct size for send buffer on basis of the amount
+    // of items user has selected
+    iSendBuffer = CBufFlat::NewL( objectCount * KTintSize + 2*KTintSize );
+
+    // Need to externalize a data to buffer to send it with IPC
+    RBufWriteStream stream;
+    stream.Open( *iSendBuffer );
+    CleanupClosePushL( stream );
+    stream.WriteInt32L( aType );
+    stream.WriteInt32L( objectCount );
+    for( TInt i(0); i< objectCount; i++ )
+        {
+        stream.WriteInt32L( aMarkedItems[ i ] );
+        }
+    iSendBufferPtr.Set( iSendBuffer->Ptr(0) );
+
+    SendReceive( EChangeShareContent,
+                 TIpcArgs( &iSendBufferPtr ),
+                 aStatus );   
+    CleanupStack::PopAndDestroy( &stream );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::RefreshSharedContentL
+// Refresh the shared content
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::RefreshSharedContentL(
+    UpnpContentServer::TUpnpMediaType aType,
+    TRequestStatus& aStatus )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    delete iSendBuffer;
+    iSendBuffer = NULL;
+    iSendBuffer = CBufFlat::NewL( KTintSize );
+
+    // Need to externalize a data to buffer to send it with IPC
+    RBufWriteStream stream;
+    stream.Open( *iSendBuffer );
+    CleanupClosePushL( stream );
+    stream.WriteInt32L( aType );
+    iSendBufferPtr.Set( iSendBuffer->Ptr(0) );
+
+    SendReceive( ERefreshShareContent,
+                 TIpcArgs( &iSendBufferPtr ),
+                 aStatus );
+    CleanupStack::PopAndDestroy( &stream );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::GetSelectionIndexesL
+// Gets the users previous selections as list of selected indexes
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::GetSelectionIndexesL(
+    UpnpContentServer::TUpnpMediaType aType,
+    TRequestStatus& aStatus )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    delete iSendBuffer;
+    iSendBuffer = NULL;
+    iSendBuffer = CBufFlat::NewL( KTintSize );
+
+    // Need to externalize a data to buffer to send it with IPC
+    RBufWriteStream sendstream;
+    sendstream.Open( *iSendBuffer );
+    CleanupClosePushL( sendstream );
+    sendstream.WriteInt32L( aType );
+    iSendBufferPtr.Set( iSendBuffer->Ptr(0) );
+
+    // Prepare receive buffers
+    PrepareReceiveBuffersL( KDefaultBufferSize );
+
+    SendReceive( EGetSelectionIndexes,
+                 TIpcArgs( &iSendBufferPtr, &iReceiveBufferPtr ),
+                 aStatus );
+    CleanupStack::PopAndDestroy( &sendstream );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::GetSelectionIndexesResultL
+// Ask the result of GetSelectionIndexesL call
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::GetSelectionIndexesResultL(
+    CArrayFix<TInt>& aMarkedItems )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    if ( !iReceiveBuffer )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    RDesReadStream stream;
+    stream.Open( iReceiveBufferPtr );
+    CleanupClosePushL( stream );
+
+    // leaves -25 if empty stream
+    TInt itemCount( 0 );
+    TRAP_IGNORE( itemCount = stream.ReadUint32L() );
+
+    for ( TInt i(0); i < itemCount; i++ )
+        {
+        const TInt val = static_cast<TInt>( stream.ReadUint32L() );
+        aMarkedItems.AppendL( val );
+        }
+
+    CleanupStack::PopAndDestroy( &stream );
+    delete iReceiveBuffer;
+    iReceiveBuffer = NULL;
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::StartConnectionMonitorL
+// Start connection monitor in content server
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::StartConnectionMonitorL( 
+    TInt aIapId,
+    TRequestStatus& aStatus )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    delete iSendBuffer;
+    iSendBuffer = NULL;
+    iSendBuffer = CBufFlat::NewL( KTintSize );
+
+    // Need to externalize a data to buffer to send it with IPC
+    RBufWriteStream sendstream;
+    sendstream.Open( *iSendBuffer );
+    CleanupClosePushL( sendstream );
+    sendstream.WriteInt32L( aIapId );
+    iSendBufferPtr.Set( iSendBuffer->Ptr(0) );
+
+    SendReceive( EStartConnectionMonitor,
+                 TIpcArgs( &iSendBufferPtr ),
+                 aStatus );
+    CleanupStack::PopAndDestroy( &sendstream );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::StopConnectionMonitorL
+// Stop connection monitor in content server
+// --------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpContentServerClient::StopConnectionMonitorL( 
+    TRequestStatus& aStatus )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    SendReceive( EStopConnectionMonitor, aStatus );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// RUpnpContentServerClient::PrepareReceiveBuffers
+// Prepares the receive buffers
+// --------------------------------------------------------------------------
+//
+void RUpnpContentServerClient::PrepareReceiveBuffersL( TInt aSize )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    delete iReceiveBuffer;
+    iReceiveBuffer = NULL;
+    iReceiveBuffer = HBufC8::NewL( aSize );
+    iReceiveBufferPtr.Set( iReceiveBuffer->Des() );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpcontentserverhandler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1093 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Content sharing servers main scheduler function
+ *
+*/
+
+
+
+
+
+#include <e32debug.h>
+#include <e32property.h>
+#include "upnpcommonutils.h"
+#include "upnpcontentserverdefs.h"
+#include "upnpcontentserverhandler.h"
+#include "upnpselectionreader.h"
+#include "upnpcontentserverclient.h"
+#include "upnpcontainercheckerao.h"
+#include "upnpcontentserver.h"
+#include "upnpperiodic.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KNoProgress = 0;
+const TInt KMaxProgress = 100;
+const TInt KRequestBufferSize = 2;
+
+
+using namespace UpnpContentServer;
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::NewL
+// 2-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentServerHandler* CUpnpContentServerHandler::NewL(
+    CUpnpContentServer* aServer )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpContentServerHandler* self =
+        new (ELeave) CUpnpContentServerHandler( aServer );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::CUpnpContentServerHandler()
+// C++ constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentServerHandler::CUpnpContentServerHandler(
+    CUpnpContentServer* aServer ) :
+    iServer( aServer ),
+    iContentSharingObserver( NULL ),
+    iDefaultContainerIds( 3 )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iHandlerState = ENotActive;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::ConstructL
+// 2nd phase constructor.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::ConstructL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
+    static _LIT_SECURITY_POLICY_S0(KThisProcessPolicy,
+                                   KUpnpContentServerCat.iUid );
+
+    // define progress property to be a byte array, allocating mem
+    TInt err = iProgressProperty.Define( KUpnpContentServerCat,
+                                         ESharingProgress,
+                                         RProperty::EByteArray,
+                                         KAllowAllPolicy,
+                                         KThisProcessPolicy,
+                                         sizeof( TUpnpProgress ) );
+    if ( err != KErrNone )
+        {
+        __LOG1( "Error: %d", err );
+        }
+    if ( err!=KErrAlreadyExists )
+        {
+        User::LeaveIfError( err );
+        }
+
+    iIdle = CUPnPPeriodic::NewL( CActive::EPriorityIdle );
+    TCallBack cb( RefreshClfL, this );
+    const TInt KRefreshDelay( 500000 );
+    iIdle->Start( KRefreshDelay, KRefreshDelay, cb );
+    iReader = CUpnpSelectionReader::NewL( NULL ); // metadata set later
+    SetProgressL( KNoProgress );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::RefreshClfL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentServerHandler::RefreshClfL( TAny* aPtr )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpContentServerHandler* handler( NULL );
+    handler = static_cast<CUpnpContentServerHandler*>( aPtr );
+    handler->iMetadata = CUpnpContentMetadataUtility::NewL();
+    handler->iMetadata->SetCallback( handler );
+    handler->iReader->SetMetadata( handler->iMetadata );
+
+    handler->iIdle->Cancel();
+    delete handler->iIdle;
+    handler->iIdle = NULL;
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::~CUpnpContentServerHandler()
+// C++ destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentServerHandler::~CUpnpContentServerHandler()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    delete iAo;
+    delete iUnsharer;
+    delete iContainerChecker;
+    delete iMetadata;
+    delete iReader;
+    delete iMediaServer;
+
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    iDefaultContainerIds.Close();
+    delete iPendingSharingReq;
+    delete iMusicSharingReq;
+    delete iVisualSharingReq;
+    iProgressProperty.Delete( KUpnpContentServerCat, ESharingProgress );
+    iProgressProperty.Close();
+    iServer = NULL;
+    if ( iIdle )
+        {
+        iIdle->Cancel();
+        delete iIdle;
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::SetContentSharingObserverL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::SetContentSharingObserverL(
+    MUpnpContentSharingObserver* aObserver )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iContentSharingObserver = aObserver; // can be NULL
+    if( iContentSharingObserver )
+        {
+        SetProgressL( KNoProgress );
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::GetSelectionContentL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::GetSelectionContentL(
+    const TInt& aContainerType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // There might be many containers -> 10 is OK for granularity
+    CDesCArray* containers = new ( ELeave ) CDesCArrayFlat( 10 );
+    CleanupStack::PushL( containers );
+    if ( iMetadata->RefreshOngoing() )
+        {
+        if ( !iWait.IsStarted() )
+            {
+            iWait.Start();
+            }
+        else
+            {
+            __LOG1( "Error: %d", __LINE__ );
+            }
+        }
+
+    switch ( aContainerType )
+        {
+    case EImageAndVideo :
+        {
+        iReader->FetchCollectionsL( containers );
+        }
+        break;
+    case EPlaylist :
+        {
+        iReader->FetchPlaylistsL( containers );
+        }
+        break;
+    default :
+        {
+        CleanupStack::PopAndDestroy( containers );
+        __LOG1( "Error: %d", __LINE__ );
+        }
+        break;
+        }
+    if ( iContentSharingObserver )
+        {
+        iContentSharingObserver->CompleteSelectionContentL( *containers );
+        }
+
+    CleanupStack::PopAndDestroy( containers );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::GetSelectionIndexesL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::GetSelectionIndexesL(
+    RArray<TInt>& aMarkedItems,
+    const TInt aType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpSharingRequest* sharingReq( NULL );
+    switch ( aType )
+        {
+    case EImageAndVideo :
+        {
+        if ( iVisualSharingReq )
+            {
+            sharingReq = iVisualSharingReq;
+            }
+        }
+        break;
+    case EPlaylist :
+        {
+        if ( iMusicSharingReq )
+            {
+            sharingReq = iMusicSharingReq;
+            }
+        }
+        break;
+    default :
+        {
+        __LOG1( "Error: %d", __LINE__ );
+        }
+        break;
+        }
+    if ( sharingReq )
+        {
+        // There is sharing ongoing, return the buffered selections
+        for( TInt i(0); i < sharingReq->iSelections.Count(); i++ )
+            {
+            aMarkedItems.Append( sharingReq->iSelections[ i ] );
+            }
+        }
+    else
+        {
+        if ( !iReader )
+            {
+            __LOG1( "Error: %d", __LINE__ );
+            iReader = CUpnpSelectionReader::NewL( iMetadata );
+            }
+        iReader->GetSelectionIndexesL( aMarkedItems, (TUpnpMediaType)aType );
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::ChangeShareContentL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::ChangeShareContentL(
+    const RArray<TInt>& aMarkedItems,
+    const TInt aType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    for( TInt e(0); e<aMarkedItems.Count();e++)
+        {
+        __LOG2("CUpnpContentServerHandler: received index[%d] = %d",
+            e, aMarkedItems[e] );
+        }
+
+    switch ( iHandlerState )
+        {
+    case ESchedulingSharing :
+        {
+        if ( aType == iBufferPosition )
+            {
+            if ( iSharingPhase != EShare )
+                {
+                SetSharingRequestL( aMarkedItems, aType );
+                }
+            else // iSharingPhase == EShare
+                {
+                // sanity checks
+                delete iUnsharer;
+                iUnsharer = NULL;
+                delete iContainerChecker;
+                iContainerChecker = NULL;
+
+                if ( iAo )
+                    {
+                    // iAo cannot be deleted here, request stop instead
+                    iAo->RequestStop(
+                        MUpnpSharingCallback::ESharingFullStop );
+                    }
+                // Get playlist Ids
+                CDesCArray* ids = new (ELeave) CDesCArrayFlat(4);
+                CleanupStack::PushL( ids );
+                CDesCArray* names = new (ELeave) CDesCArrayFlat(4);
+                CleanupStack::PushL( names );
+                if ( aType == EImageAndVideo )
+                    {
+                    iReader->CollectionIdsL( *ids, *names );
+                    }
+                else
+                    {
+                    iReader->PlayListIdsL( *ids, *names );
+                    }
+                // pendingSharingReq will be handled from callback
+                delete iPendingSharingReq;
+                iPendingSharingReq = NULL;
+                iPendingSharingReq = CUpnpSharingRequest::NewL( aType,
+                                                                aMarkedItems,
+                                                                ids,
+                                                                names );
+                CleanupStack::Pop( names ); // ownership transferred
+                CleanupStack::Pop( ids ); // ownership transferred
+                }
+            }
+        else
+            {
+            SetSharingRequestL( aMarkedItems, aType );
+            }
+        }
+        break;
+    case ENotActive :
+        {
+
+        delete iMetadata;
+        iMetadata = NULL;
+        iMetadata = CUpnpContentMetadataUtility::NewL();
+        iMetadata->SetCallback( this );
+        iReader->SetMetadata( iMetadata );
+
+
+        if ( iMetadata->RefreshOngoing() )
+            {
+            __LOG("CUpnpContentServerHandler: Waiting refresh 3");
+            iWait.Start();
+            }
+        SetSharingRequestL( aMarkedItems, aType );
+
+        iBufferPosition = aType;
+        // Start sharing
+        iHandlerState = ESchedulingSharing;
+
+        iSharingPhase = ECheckDefaults;
+        // start the sharing
+        DoShareL();
+
+        }
+        break;
+    default :
+        {
+        __LOG1( "Error: %d", __LINE__ );
+        }
+        break;
+
+        }
+    SetProgressL( KNoProgress );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::RefreshShareContentL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::RefreshShareContentL(
+    TInt aType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    if ( ( aType == EImageAndVideo && iVisualSharingReq ) ||
+         ( aType == EPlaylist && iMusicSharingReq ) )
+        {
+        // no refresh available if sharing is ongoing
+        __LOG1( "Error: %d", __LINE__ );
+        User::Leave( KErrServerBusy );
+        }
+
+    if ( iMetadata->RefreshOngoing() )
+        {
+        __LOG("CUpnpContentServerHandler: Waiting refresh 1");
+        iWait.Start();
+        }
+
+    delete iReader;
+    iReader = NULL;
+    iReader = CUpnpSelectionReader::NewL( iMetadata );
+
+    RArray<TInt> selectedItems;
+    CleanupClosePushL( selectedItems );
+    CDesCArray* containers = new ( ELeave ) CDesCArrayFlat( 10 );
+    CleanupStack::PushL( containers );
+    iReader->FetchCollectionsL( containers );
+    GetSelectionIndexesL( selectedItems, aType );
+    CDesCArray* ids = new (ELeave) CDesCArrayFlat(4);
+    CleanupStack::PushL( ids );
+    CDesCArray* names = new (ELeave) CDesCArrayFlat(4);
+    CleanupStack::PushL( names );
+    iReader->CollectionIdsL( *ids, *names );
+
+    if ( aType == EImageAndVideo )
+        {
+        iVisualSharingReq = CUpnpSharingRequest::NewL( aType,
+                                                       selectedItems,
+                                                       ids,
+                                                       names );
+        }
+    else if ( aType == EPlaylist )
+        {
+        iMusicSharingReq = CUpnpSharingRequest::NewL( aType,
+                                                      selectedItems,
+                                                      ids,
+                                                      names );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CleanupStack::Pop( names ); // ownership transferred
+    CleanupStack::Pop( ids ); // ownership transferred
+    ChangeShareContentL( selectedItems, aType );
+
+    selectedItems.Reset();
+    containers->Reset();
+
+    CleanupStack::PopAndDestroy( containers );
+    CleanupStack::PopAndDestroy( &selectedItems );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::FillProgressInfoL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::FillProgressInfoL(
+    RArray<TUpnpProgressInfo>& aArr,
+    const TInt aType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpSharingRequest* sharingReq( NULL );
+    if( iPendingSharingReq && iPendingSharingReq->iKind == aType )
+        {
+        sharingReq = iPendingSharingReq;
+        }
+    else
+        {
+        if ( aType == EImageAndVideo )
+            {
+            sharingReq = iVisualSharingReq;
+            }
+        else if ( aType == EPlaylist )
+            {
+            sharingReq = iMusicSharingReq;
+            }
+        }
+    TUpnpProgressInfo progress;
+    progress.iProgressKind = UpnpContentServer::TUpnpMediaType( aType );
+    if ( sharingReq )
+        {
+        progress.iProgressType = TUpnpProgressInfo::ESharingProgress;
+        if ( iBufferPosition == aType &&
+             iHandlerState == ESchedulingSharing &&
+             ( iAo || iUnsharer || iContainerChecker ))
+            {
+            // sharing ongoing for images
+            TInt prog ( 0 );
+            TInt progRel( 0 );
+            if ( iAo && iSharingPhase == EShare )
+                {
+                prog = iAo->SharingProgress(
+                    (TUpnpMediaType&)progress.iProgressKind );
+                progRel = ( prog * KMaxProgress ) / sharingReq->iItemCount;      
+                }
+            if ( iUnsharer &&  iSharingPhase == EUnshare  )
+                {
+                prog = iUnsharer->UnSharingProgress();
+                TInt itemNum = iUnsharer->TotalItemsForUnShare();
+                if( itemNum > 0 )
+                    {     
+                    progRel = ( prog * KMaxProgress ) / itemNum;          
+                    }
+                }   
+
+            // check that progress is between 0 and 100 %
+            if ( progRel < 0 )
+                {
+                progRel = KNoProgress;
+                __LOG1( "Error: %d", __LINE__ );
+                }
+            else if ( progRel > KMaxProgress )
+                {
+                progRel = KMaxProgress;
+                __LOG1( "Error: %d", __LINE__ );
+                }
+            progress.iProgress = progRel;
+            }
+        else
+            {
+            // buffer is pending
+            progress.iProgressType = TUpnpProgressInfo::ESharingProgress;
+            progress.iProgress = KNoProgress;
+            }
+        }
+    else
+        {
+        progress.iProgressType = TUpnpProgressInfo::EVisualStatus;
+        TInt state( EShareNone );
+
+        if ( aType == EImageAndVideo )
+            {
+            iReader->GetVisualSharingStateL( state );
+            }
+        else
+            {
+            iReader->GetMusicSharingStateL( state );
+            }
+
+        progress.iProgress = state;
+        }
+    aArr.AppendL( progress );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::CanStop
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TBool CUpnpContentServerHandler::CanStop() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TBool ret( EFalse );
+    if ( !( iVisualSharingReq || iMusicSharingReq  ) )
+        {
+        __LOG("CUpnpContentServerHandler: CanStop(): 1");
+        ret = ETrue;
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::RefreshDoneL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::RefreshDoneL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iMetadata->SetCallback( this );
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::CompleteSharingOperationL
+// This should be called from active objects owned by handler
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::CompleteSharingOperationL(
+    const TInt& aErr, const TInt& aType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( aErr != KErrNone )
+        {
+        __LOG1( "Error: %d", aErr );
+        }
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    else if ( iStartupCleaning )
+        {
+        iStartupCleaning = EFalse;
+        }
+
+    else if ( aErr && aErr != KErrCancel )
+        {
+        // Cancel is handled below
+        HandleError( aErr );
+        }
+    else
+        {
+        if ( iSharingPhase == ECheckDefaults )
+            {
+            iHandlerState = ESchedulingSharing;
+            iSharingPhase = EUnshare;
+            }
+        else if ( iSharingPhase == EUnshare )
+            {
+            iHandlerState = ESchedulingSharing;
+            iSharingPhase = EShare;
+
+            }
+        else if ( iSharingPhase == EShare )
+            {
+            switch ( aType )
+                {
+            case EImageAndVideo :
+                {
+                delete iVisualSharingReq;
+                iVisualSharingReq = NULL;
+                SetProgressL( KNoProgress );
+                }
+                break;
+            case EPlaylist :
+                {
+                delete iMusicSharingReq;
+                iMusicSharingReq = NULL;
+                SetProgressL( KNoProgress );
+                }
+                break;
+            default :
+                {
+                __LOG1( "Error: %d", __LINE__ );
+                }
+                break;
+                }
+            if ( aType != iBufferPosition )
+                {
+                __LOG1( "Error: %d", __LINE__ );
+                }
+
+            if ( aErr == KErrNone )
+                {
+                iErrorToClient = aErr;
+                iBufferPosition = (iBufferPosition + 1)%KRequestBufferSize;
+                SetProgressL( KNoProgress );
+                }
+            else
+                {
+                if ( iPendingSharingReq )
+                    {
+                    if ( iPendingSharingReq->iKind == EImageAndVideo )
+                        {
+                        delete iVisualSharingReq;
+                        iVisualSharingReq = NULL;
+                        iVisualSharingReq = iPendingSharingReq;
+                        }
+                    else
+                        {
+                        delete iMusicSharingReq;
+                        iMusicSharingReq = NULL;
+                        iMusicSharingReq = iPendingSharingReq;
+                        }
+                    iPendingSharingReq = NULL;
+                    }
+                }
+
+            iDefaultContainerIds.Reset();
+            if ( ! ( iVisualSharingReq || iMusicSharingReq ))
+                {
+                iHandlerState = ENotActive;
+                iSharingPhase = ESharingInActive;
+                if ( CanStop() && iServer && !iContentSharingObserver )
+                    {
+                    // client application is exited, no sharing ongoing
+                    // -> stop the server
+                    iServer->Stop();
+                    }
+                }
+            else
+                {
+                iSharingPhase = ECheckDefaults;
+                iHandlerState = ESchedulingSharing;
+                }
+            }
+        else
+            {
+            __LOG1( "Error: %d", __LINE__ );
+            }
+
+        if ( iHandlerState != ENotActive )
+            {
+            DoShareL();
+            }
+
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::CancelSharingOperationL
+// This should be called from active objects owned by handler
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::CancelSharingOperationL(
+    const TInt& /*aErr*/ )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::SetProgressL
+// This should be called from active objects owned by handler
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::SetProgressL(
+    const TInt& aProgress )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpSharingRequest* sharingReq( NULL );
+    if( iPendingSharingReq && iPendingSharingReq->iKind == iBufferPosition )
+        {
+        sharingReq = iPendingSharingReq;
+        }
+    else
+        {
+        if ( iBufferPosition == EPlaylist )
+            {
+            sharingReq = iMusicSharingReq;
+            }
+        else if ( iBufferPosition == EImageAndVideo )
+            {
+            sharingReq = iVisualSharingReq;
+            }
+        }
+
+    if ( sharingReq )
+        {
+        sharingReq->iProgress = aProgress;
+        }
+
+    TProgressInfos progressArr;
+    CleanupClosePushL( progressArr );
+
+    FillProgressInfoL( progressArr, EImageAndVideo );
+    FillProgressInfoL( progressArr, EPlaylist );
+
+    TUpnpProgress finalProg;
+    finalProg.iError = iErrorToClient;
+    iErrorToClient = KErrNone;
+    finalProg.iImageVideoProgress = progressArr[ 0 ];
+    finalProg.iMusicProgress = progressArr[ 1 ];
+
+    TPckgBuf<TUpnpProgress> progressBuf( finalProg );
+
+    TInt err = iProgressProperty.Set( KUpnpContentServerCat,
+                                      ESharingProgress,
+                                      progressBuf  );
+    if ( err != KErrNone )
+        {
+        __LOG1( "Error: %d", err );
+        }
+    CleanupStack::PopAndDestroy( &progressArr );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::DoShareL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::DoShareL( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt err( KErrNone );
+
+    iHandlerState = ESchedulingSharing;
+
+    if ( iSharingPhase == ECheckDefaults )
+        {
+        iDefaultContainerIds.Reset();
+        delete iContainerChecker;
+        iContainerChecker = NULL;
+        iContainerChecker = new (ELeave) CUpnpContainerCheckerAo( this );
+        iContainerChecker->ValidateContainerStructureL(
+            &iDefaultContainerIds );
+        }
+    else if ( iSharingPhase == EUnshare )
+        {
+        delete iContainerChecker;
+        iContainerChecker = NULL;
+        delete iUnsharer;
+        iUnsharer = NULL;
+        iUnsharer = new ( ELeave ) CUpnpUnsharerAo(
+            this,
+            CActive::EPriorityStandard );
+        TInt id = GetContainerId( iBufferPosition );
+        if ( id == KErrNotFound )
+            {
+            User::Leave( KErrCorrupt );
+            }
+        iUnsharer->EmptyContainer( id );
+        }
+    else if ( iSharingPhase == EShare )
+        {
+        delete iUnsharer;
+        iUnsharer = NULL;
+        delete iAo;
+        iAo = NULL;
+        iAo = CUpnpContentSharingAo::NewL( this, iMetadata );
+        TInt id = GetContainerId( iBufferPosition );
+        if ( id == KErrNotFound )
+            {
+            User::Leave( KErrCorrupt );
+            }
+        // iBufferPosition is updated in CompleteSharingOperationL
+        switch( iBufferPosition )
+            {
+        case EImageAndVideo :
+            {
+            TRAP( err, iAo->InitializeL( ( TUpnpMediaType )
+                                         iVisualSharingReq->iKind,
+                                         iVisualSharingReq->iSelections,
+                                         *iVisualSharingReq->iObjectIds,
+                                         *iVisualSharingReq->iObjectNames,
+                                         id ));
+            // always show something in progress dialog -> add 1
+            TRAP( err, iVisualSharingReq->iItemCount =
+                  iAo->SelectionObjectCountL(
+                      ( TUpnpMediaType )iBufferPosition ) +1 );
+            iAo->ShareFiles(); // start sharing
+            }
+            break;
+        case EPlaylist :
+            {
+            TRAP( err, iAo->InitializeL( ( TUpnpMediaType )
+                                         iMusicSharingReq->iKind,
+                                         iMusicSharingReq->iSelections,
+                                         *iMusicSharingReq->iObjectIds,
+                                         *iMusicSharingReq->iObjectNames,
+                                         id ));
+            // always show something in progress dialog -> add 1
+            TRAP( err, iMusicSharingReq->iItemCount =
+                  iAo->SelectionObjectCountL(
+                      ( TUpnpMediaType )iBufferPosition ) +1);
+            iAo->ShareFiles(); // start sharing
+            }
+            break;
+        default:
+            {
+            __LOG1( "Error: %d", __LINE__ );
+            }
+            break;
+            }
+        }
+    else
+        {
+        __LOG1( "Error: %d", __LINE__ );
+        }
+
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::Cleanup
+// Cleanup depending on state
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::Cleanup()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if( iSharingPhase == EShare )
+        {
+        if( iAo )
+            {
+            iAo->RequestStop(
+                MUpnpSharingCallback::ESharingFullStop );
+            }
+        }
+    delete iContainerChecker;
+    iContainerChecker = NULL;
+    delete iUnsharer;
+    iUnsharer = NULL;
+
+    delete iVisualSharingReq;
+    iVisualSharingReq = NULL;
+    delete iMusicSharingReq;
+    iMusicSharingReq = NULL;
+    delete iPendingSharingReq;
+    iPendingSharingReq = NULL;
+
+    // reset state variables
+    iHandlerState = ENotActive;
+    iSharingPhase = ESharingInActive;
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::GetContainerId
+// get id from list
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentServerHandler::GetContainerId( const TInt aType ) const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt id( KErrNotFound );
+    if ( aType == EImageAndVideo )
+        {
+        id = iDefaultContainerIds[
+            CUpnpContainerCheckerAo::EImageAndVideo ];
+        }
+    else if ( aType == EPlaylist )
+        {
+        id = iDefaultContainerIds[ CUpnpContainerCheckerAo::EMusic ];
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return id;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::ConnectionLost
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TBool CUpnpContentServerHandler::ConnectionLostL( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TBool ret( EFalse );
+    if ( iHandlerState != ENotActive )
+        {
+        if ( iSharingPhase == EShare )
+            {
+            __LOG("iSharingPhase == EShare");
+            ret = ETrue;
+            iAo->RequestStop( MUpnpSharingCallback::ESharingPause );
+            }
+        else if ( iSharingPhase == ECheckDefaults )
+            {
+            __LOG("iSharingPhase == ECheckDefaults");
+            iContainerChecker->RequestStop(
+                MUpnpSharingCallback::ESharingPause );
+            }
+        else if ( iSharingPhase == EUnshare )
+            {
+            __LOG("iSharingPhase == EUnshare");
+            iUnsharer->RequestStop( MUpnpSharingCallback::ESharingPause );
+            }
+
+        }
+    else
+        {
+        __LOG("else ");
+        iMediaServer = new (ELeave) RUpnpMediaServerClient();
+        TInt err( iMediaServer->Connect() );
+        TInt stat( RUpnpMediaServerClient::EStopped );
+        if ( !err )
+            {
+            err = iMediaServer->Status( stat );
+            if ( !err && stat == RUpnpMediaServerClient::EStartedOnline )
+                {
+                iMediaServer->Stop( RUpnpMediaServerClient::EStopSilent );
+                iMediaServer->Close();
+                delete iMediaServer;
+                iMediaServer = NULL;
+                }
+            }
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::SetSharingRequestL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::SetSharingRequestL(
+    const RArray<TInt>& aMarkedItems,
+    const TInt aType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CDesCArray* ids = new (ELeave) CDesCArrayFlat(4);
+    CleanupStack::PushL( ids );
+    CDesCArray* names = new (ELeave) CDesCArrayFlat(4);
+    CleanupStack::PushL( names );
+    if ( aType == EImageAndVideo )
+        {
+        iReader->CollectionIdsL( *ids, *names );
+        delete iVisualSharingReq;
+        iVisualSharingReq = NULL;
+        iVisualSharingReq = CUpnpSharingRequest::NewL( aType,
+                                                       aMarkedItems,
+                                                       ids,
+                                                       names );
+        }
+    else
+        {
+        iReader->PlayListIdsL( *ids, *names );
+        delete iMusicSharingReq;
+        iMusicSharingReq = NULL;
+        iMusicSharingReq = CUpnpSharingRequest::NewL( aType,
+                                                      aMarkedItems,
+                                                      ids,
+                                                      names );
+        }
+    CleanupStack::Pop( names ); // ownership transferred
+    CleanupStack::Pop( ids ); // ownership transferred
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::ValidateDefaultContainersL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerHandler::ValidateDefaultContainersL( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( iSharingPhase != ECheckDefaults )
+        {
+        iStartupCleaning = ETrue;
+        delete iContainerChecker;
+        iContainerChecker = NULL;
+        iContainerChecker = new (ELeave) CUpnpContainerCheckerAo( this );
+        iContainerChecker->SetPriority( CActive::EPriorityUserInput );
+        iContainerChecker->ValidateContainerStructureL(
+            NULL );
+
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerHandler::HandleError
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+
+void CUpnpContentServerHandler::HandleError( TInt aError )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if( iHandlerState != ENotActive )
+        {
+        Cleanup();
+        iHandlerState = ENotActive;
+        iSharingPhase = ECheckDefaults;
+        iErrorToClient = aError;
+        TRAP_IGNORE( SetProgressL( KNoProgress ) );
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpcontentserversession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,438 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpContentServerSession class implementation
+*
+*/
+
+
+
+
+
+#include <e32debug.h>
+#include <e32def.h> //CArrayFix
+#include <s32mem.h> //RDesReadStream
+#include "upnpcontentserverdefs.h"
+#include "upnpcontentserversession.h"
+#include "upnpcontentserverclient.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+using namespace UpnpContentServer;
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::NewL
+// 2-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentServerSession* CUpnpContentServerSession::NewL(
+    CUpnpContentServer* aServer )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpContentServerSession* self =
+        new (ELeave) CUpnpContentServerSession();
+    CleanupStack::PushL( self );
+    self->ConstructL( aServer );
+    CleanupStack::Pop( self );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::CUpnpContentServerSession
+// C++ constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentServerSession::CUpnpContentServerSession( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// void CUpnpContentServerSession::ConstructL
+// 2nd phase constructor.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::ConstructL( CUpnpContentServer* aServer )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( !aServer )
+        {
+        User::Leave( KErrArgument );
+        }
+    iServer = aServer;
+    iHandler = iServer->Handler();
+    iServer->AddSession();
+    if ( iHandler )
+        {
+        iHandler->SetContentSharingObserverL( this );
+        }
+    else
+        {
+        User::Leave( KErrBadHandle );
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::~CUpnpContentServerSession
+// C++ destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentServerSession::~CUpnpContentServerSession()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    // Sharing is off, client is disconnected, no sharing operation is ongoing
+    // -> close the server
+    if( iServer && iHandler )
+        {
+        iServer->RemoveSession();
+        if ( iHandler->CanStop() && iServer->CanStop() )
+            {
+            iServer->Stop();
+            __LOG("CUpnpContentServerSession::~CUpnpContentServerSession, \
+CActiveScheduler stopped");
+            }
+        TRAP_IGNORE( iHandler->SetContentSharingObserverL( NULL ) )
+        }
+    delete iResultBuffer;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::ServiceL
+// From CSession2, passes the request forward to DispatchMessageL.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::ServiceL( const RMessage2& aMessage )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TRAPD(err,DispatchMessageL(aMessage));
+    if ( err != KErrNone )
+        {
+        __LOG1( "Error: %d", err );
+        aMessage.Complete( err );
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::DispatchMessageL
+// Handles the request from client.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::DispatchMessageL( const RMessage2& aMessage )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iHandler->SetContentSharingObserverL( this );
+    switch( aMessage.Function() )
+        {
+    case ERequestSelectionContent :
+        {
+        GetSelectionContentL( aMessage );
+        // completed separately
+        }
+        break;
+    case EGetSelectionIndexes :
+        {
+        GetSelectionIndexesL( aMessage );
+        aMessage.Complete( KErrNone );
+        }
+        break;
+    case EChangeShareContent :
+        {
+        ChangeShareContentL( aMessage );
+        aMessage.Complete( KErrNone );
+        }
+        break;
+    case ERefreshShareContent :
+        {
+        RefreshShareContentL( aMessage );
+        aMessage.Complete( KErrNone );
+        }
+        break;
+    case ERequestProgressInfo :
+        {
+        RequestProgressInfoL( aMessage );
+        aMessage.Complete( KErrNone );
+        }
+        break;
+    case EStartConnectionMonitor :
+        {
+        StartConnectionMonitorL( aMessage );
+        aMessage.Complete( KErrNone );
+        }
+        break;
+    case EStopConnectionMonitor :
+        {
+        StopConnectionMonitorL();
+        aMessage.Complete( KErrNone );
+        }
+        break;
+
+    default:
+        {
+        aMessage.Complete( KErrArgument );
+        }
+        break;
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::GetSelectionContentL
+// asynchronous
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::GetSelectionContentL(
+    const RMessage2& aMessage )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt len( aMessage.GetDesLength(0) );
+
+    HBufC8* buffer = HBufC8::NewLC( len );
+    TPtr8 ptr( buffer->Des() );
+    aMessage.ReadL( 0, ptr );
+    RDesReadStream stream;
+    stream.Open( ptr );
+    CleanupClosePushL( stream );
+
+    TInt mediaType( stream.ReadInt32L() );
+    iSelectionContentMsg = aMessage;
+
+    // call to server
+    iHandler->GetSelectionContentL( mediaType );
+
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buffer );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::GetSelectionIndexesL
+// synchronous
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::GetSelectionIndexesL(
+    const RMessage2& aMessage )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt len( aMessage.GetDesLength(0) );
+
+    RArray<TInt>* selections = new ( ELeave )
+        RArray<TInt>( 5 );
+    CleanupClosePushL( *selections );
+    HBufC8* buffer = HBufC8::NewLC( len );
+    TPtr8 ptr( buffer->Des() );
+    aMessage.ReadL( 0, ptr );
+    RDesReadStream stream;
+    stream.Open( ptr );
+    CleanupClosePushL( stream );
+
+    TInt mediaType( stream.ReadInt32L() );
+    // call to server
+    iHandler->GetSelectionIndexesL( *selections, mediaType );
+
+    TInt objectCount( selections->Count() );
+
+    delete iResultBuffer;
+    iResultBuffer = NULL;
+
+    iResultBuffer = CBufFlat::NewL( KTintSize + KTintSize*objectCount );
+    RBufWriteStream wstream;
+    wstream.Open( *iResultBuffer );
+    CleanupClosePushL( wstream );
+
+    // append count and ints
+    wstream.WriteInt32L( objectCount );
+    for( TInt i(0); i < objectCount; i++ )
+        {
+        wstream.WriteInt32L( selections->operator[]( i ) );
+        }
+
+    // Write result back to client
+    aMessage.WriteL( 1, iResultBuffer->Ptr(0) );
+
+    CleanupStack::PopAndDestroy( &wstream );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PopAndDestroy( selections );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::ChangeShareContentL
+// Handles the async request from client.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::ChangeShareContentL(
+    const RMessage2& aMessage )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt len( aMessage.GetDesLength(0) );
+    RArray<TInt> selections( len );
+    CleanupClosePushL( selections );
+    HBufC8* buffer = HBufC8::NewLC( len );
+    TPtr8 ptr( buffer->Des() );
+    aMessage.ReadL( 0, ptr );
+    RDesReadStream stream;
+    stream.Open( ptr );
+    CleanupClosePushL( stream );
+
+    TInt mediaType( stream.ReadInt32L() );
+    TInt objCount( stream.ReadInt32L() );
+
+    // loop the TInt from stream
+    for( TInt i(0); i< objCount; i++)
+        {
+        selections.AppendL( stream.ReadInt32L() );
+        }
+
+    iHandler->ChangeShareContentL( selections,  mediaType );
+    
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PopAndDestroy( &selections );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::RequestProgressInfoL
+// synchronous
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::RequestProgressInfoL(
+    const RMessage2& /*aMessage*/ )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // The progress should be read using pubsub
+    // This call will be removed in upnpfw 2.1
+    User::Leave( KErrNotSupported );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::RefreshShareContentL
+// asynchronous
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::RefreshShareContentL(
+    const RMessage2& aMessage )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt len( aMessage.GetDesLength(0) );
+    HBufC8* buffer = HBufC8::NewLC( len );
+    TPtr8 ptr( buffer->Des() );
+    aMessage.ReadL( 0, ptr );
+    RDesReadStream stream;
+    stream.Open( ptr );
+    CleanupClosePushL( stream );
+
+    TInt mediaType( stream.ReadInt32L() );
+
+    // The sharing and refresh cannot be used simultaneously
+    // Using the same place to store message for completion
+    //
+    iChangeShareContentMsg = aMessage;
+    // call to handler.
+    iHandler->RefreshShareContentL( mediaType );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buffer );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::CompleteSelectionContentL
+// Completes the async GetSelectionContentL call
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::CompleteSelectionContentL(
+    const CDesCArray& aMarkedItems )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt objectCount( aMarkedItems.MdcaCount() );
+
+    delete iResultBuffer;
+    iResultBuffer = NULL;
+
+    iResultBuffer = CBufFlat::NewL( KTintSize + KTintSize*objectCount );
+    RBufWriteStream wstream;
+    wstream.Open( *iResultBuffer );
+    CleanupClosePushL( wstream );
+
+    // append count
+    wstream.WriteInt32L( objectCount );
+    // append descriptors
+    for( TInt i(0); i<objectCount; i++ )
+        {
+        wstream.WriteInt32L( aMarkedItems[ i ].Length() );
+        wstream.WriteL( aMarkedItems[ i ] );
+        }
+
+    // Write result back to client
+    iSelectionContentMsg.WriteL( 1, iResultBuffer->Ptr(0) );
+    iSelectionContentMsg.Complete( KErrNone );
+    CleanupStack::PopAndDestroy( &wstream );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::StartConnectionMonitorL
+// synchronous
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::StartConnectionMonitorL(
+    const RMessage2& aMessage )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt len( aMessage.GetDesLength(0) );
+    HBufC8* buffer = HBufC8::NewLC( len );
+    TPtr8 ptr( buffer->Des() );
+    aMessage.ReadL( 0, ptr );
+    RDesReadStream stream;
+    stream.Open( ptr );
+    CleanupClosePushL( stream );
+
+    TInt iapId( stream.ReadInt32L() );
+
+    // call to server
+    iServer->RequestConnectionLostL( iapId );
+    CleanupStack::PopAndDestroy( &stream );
+    CleanupStack::PopAndDestroy( buffer );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentServerSession::StopConnectionMonitorL
+// cancel connection lost
+// --------------------------------------------------------------------------
+//
+void CUpnpContentServerSession::StopConnectionMonitorL( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iServer->CancelConnectionLostL();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpcontentsharingao.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,1972 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpContentSharingAo class implementation
+ *
+*/
+
+
+
+
+
+
+//  Include Files
+#include <upnpcontainer.h>
+#include <upnpfilesharing.h>
+#include <upnpcontainer.h>
+#include <upnpitem.h>
+#include <upnpitemlist.h>
+#include <upnpobject.h>
+#include <upnpstring.h>
+#include <s32file.h>
+#include <f32file.h>
+#include "upnpcommonutils.h" // FindContainerByTitle
+#include "upnpcdsreselementutility.h"
+// CLF headers
+#include <MCLFContentListingEngine.h>
+#include <ContentListingFactory.h>
+#include <MCLFItemListModel.h>
+#include <CLFContentListing.hrh>
+
+//#include <clfcontentlistingextended.hrh>
+
+#include <MCLFItem.h>
+
+#include "upnpcontentsharingao.h"
+#include "upnpcontentmetadatautility.h"
+#include "upnpselectionwriter.h"
+#include "upnpcontainercheckerao.h"
+#include "upnpcontentserverdefs.h"
+#include "upnpunsharerao.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+// FORWARD DECLARATIONS
+class UPnPCommonUtils;
+
+// CONSTANTS
+
+const TInt KUiSelectionOffset = 2;
+const TInt KDefaultGranularity( 10 );
+
+// KContentDirCommitAmount should be in sync with KCommitEveryNum in
+// upnpcontentdirectoryglobals.h which is not exported
+const TInt KContentDirCommitAmount = 10;
+
+using namespace UpnpContentServer;
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::CUpnpContentSharingAo
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpContentSharingAo::CUpnpContentSharingAo(
+    MUpnpSharingCallback* aEngine,
+    CUpnpContentMetadataUtility* aMetadata )
+    : CActive( CActive::EPriorityStandard )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iEngine = aEngine;
+    iMetadataUtility = aMetadata;
+    iContainerId = KErrNotFound;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpContentSharingAo* CUpnpContentSharingAo::NewL(
+    MUpnpSharingCallback* aEngine,
+    CUpnpContentMetadataUtility* aMetadata )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    CUpnpContentSharingAo* self = new (ELeave)
+        CUpnpContentSharingAo( aEngine, aMetadata );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ConstructL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iContainerIdx = 0;
+    iObjectIdx = 0;
+    iVideoIndex = 0;
+    iImageIndex = 0;
+    iAllVideosShared = EFalse;
+    iAllImagesShared = EFalse;
+
+    CActiveScheduler::Add( this );
+
+    iFileSharing = CUpnpFileSharing::NewL();
+    ConnectMediaServer();
+    iWriter = CUpnpSelectionWriter::NewL( iContainerType );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// Destructor
+CUpnpContentSharingAo::~CUpnpContentSharingAo()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iMediaServer.Close();
+    delete iFileSharing;
+    iFileSharing = NULL;
+
+
+    if ( IsActive() )
+        {
+        __LOG1("CUpnpContentSharingAo destructor IsActive==\
+true iSharingState: %d", iSharingState );
+        iSharingState = ENotActive;
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, KErrNone );
+        }
+
+    Cancel();
+    iEngine = NULL;
+    iContainerIds = NULL;
+
+    delete iTmpContainer;
+    delete iSharedContainerIds;
+    delete iWriter;
+    DeleteListUpnpObject();
+    delete iFileNameArr;   
+    delete iTmpItem;
+    delete iPlaylists;
+    delete iCollections;
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::RunL
+// Called when asyncronous request is ready
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::RunL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    __LOG8_1( "iStatus", iStatus.Int() );
+    if ( iStatus.Int() == KErrCorrupt ||
+        iStatus.Int() == KErrDiskFull ||
+        iStatus.Int() == KErrNoMemory )
+        {
+        iSharingState = ENotActive;
+        }
+    if ( iStopRequested == MUpnpSharingCallback::ESharingPause )
+        {
+        TInt err = iMediaServer.Stop(
+            RUpnpMediaServerClient::EStopSilent );
+        __LOG1( "Error: %d", err );
+        err = iMediaServer.StartOffline();
+        __LOG1( "Error: %d", err );
+        
+        iStopRequested = MUpnpSharingCallback::ESharingNoStop;
+        }
+
+    switch ( iSharingState )
+        {
+    case EUnshareContainers :
+        {
+        // Unshare the container structure
+        UnshareContainersL();
+        }
+        break;
+    case EShareContainers :
+        {
+        // Share the container structure
+        ShareContainersL();
+        }
+        break;
+    case EShareContainersResult :
+        {
+        // advance to next container or share items
+        ShareContainersResultL();
+        }
+        break;
+    case EShareItems :
+        {
+        // coming here after all containers are shared
+        // then at least once per container
+        HandleSharingSubstatesL();
+        }
+        break;
+    case EShareItemsResult :
+        {
+        // advance to next item or end
+        ShareItemsResultL();
+        }
+        break;
+    case EShareAllItems :
+        {
+        //..coming to here once "All files" is selected and
+        // individual albums are already shared
+        HandleSharingSubstatesL();
+        }
+        break;
+    case EShareAllItemsResult :
+        {
+        // advance to next item set or end
+        AllItemsResultL();
+        }
+        break;
+    case ENotActive :
+        // informs handler that we are done
+        {
+        TInt err ( iStatus.Int() );
+        if ( iStopRequested == MUpnpSharingCallback::ESharingFullStop )
+            {
+            // normal case
+            err = KErrCancel;
+            iStopRequested = EFalse;
+            }
+
+        TRAP_IGNORE( 
+            iEngine->CompleteSharingOperationL( err,
+                                                iContainerType ));
+        }
+        break;
+
+    default :
+        {
+        __LOG( "RunL - default" );
+        }
+        break;
+        }
+
+    __LOG( "RunL - end" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::DoCancel
+// Cancels active object
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::DoCancel()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::RunError
+// Cancels active object
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentSharingAo::RunError( TInt aError )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    __LOG8_1( "RunError = ", aError );
+    if ( aError == KErrNoMemory ||
+         aError == KErrDiskFull ||
+         aError == KErrCorrupt )
+        {
+        iSharingState = ENotActive;
+        }
+    if ( iSharingState == EUnshareContainers )
+        {
+        if ( iShareAllSelection == EShareNone )
+            {
+            iSharingState = ENotActive;
+            TRAP_IGNORE( iWriter->SaveSharingStateL( EShareNone ) );
+            }
+        else
+            {
+            iSharingState = EShareContainers;
+            }
+        }
+    else
+        {
+        iSharingState = ENotActive;
+        }
+    if ( iSharingState != EEnumerateSelections )
+        {
+        SelfComplete( aError );
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::IsActive()
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TBool CUpnpContentSharingAo::IsActive() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TBool ret( CActive::IsActive());
+    if ( !ret )
+        {
+        ret = iProfilerActive;
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::HandleSharingSubstatesL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::HandleSharingSubstatesL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( iSharingSubState == EIdle )
+        {
+        if ( iSharingState == EShareItems )
+            {
+            ShareItemsL();
+            }
+        else if ( iSharingState == EShareAllItems )
+            {
+            ShareAllItemsL();
+            }
+        else
+            {
+            }
+        }
+    else if ( iSharingSubState == EProfileItemList )
+        {
+        ProfileItemListL();
+        }
+    else if ( iSharingSubState == EProfileItemListResult )
+        {
+        ProfileItemListResult();
+        }
+    else if ( iSharingSubState == EShareItemList )
+        {
+        TInt parentId( KErrNotFound );
+        if ( iSharingState == EShareItems )
+            {
+            parentId = iSharedContainerIds->operator[]( iContainerIdx );
+            }
+        else if ( iSharingState == EShareAllItems )
+            {
+            parentId = iContainerId;
+            }
+        else
+            {
+            }
+        ShareItemListL( parentId );
+        }
+    else if ( iSharingSubState == EShareItemListResult )
+        {
+        ShareItemListResultL();
+        }
+    else
+        {
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ShareFilesL
+// Starts file sharing
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::InitializeL(
+    TUpnpMediaType aContainerType,
+    const RArray<TInt>& aCurrentSelection,
+    CDesCArray& aPlaylistIds,
+    CDesCArray& aPlaylistNames,    
+    const TInt aContainerId )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    // Initialize values
+    iObjectIdx = 0;
+    iContainerIdx = 0;
+    iVideoIndex = 0;
+    iImageIndex = 0;
+    iAllVideosShared = EFalse;
+    iAllImagesShared = EFalse;
+    iSharingProgress = 0;
+
+    iContainerType = aContainerType;
+
+    delete iWriter;
+    iWriter = NULL;
+    iWriter = CUpnpSelectionWriter::NewL( iContainerType );
+
+    AdjustShareAllSelection( aCurrentSelection );
+    iCurrentSelections = aCurrentSelection;
+    iContainerIds = &aPlaylistIds;
+    iContainerNames = &aPlaylistNames;
+    iContainerId = aContainerId;
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ShareFilesL
+// Starts file sharing
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ShareFiles( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    // Open file sharing session from mediaserver.
+    // Start offline if not started.
+    TInt status( RUpnpMediaServerClient::EStopped );
+    iMediaServer.Status( status );
+    if ( status == RUpnpMediaServerClient::EStopped )
+        {
+        iMediaServer.StartOffline();
+        }
+    iSharingState = EUnshareContainers;
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPSettingsEngineAO::CreateContainerL
+// creates container
+// --------------------------------------------------------------------------
+//
+CUpnpContainer* CUpnpContentSharingAo::CreateContainerL(
+    TUpnpMediaType aContainerType,
+    const TDesC8& aTitle ) const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpContainer* cont= CUpnpContainer::NewL();
+    CleanupStack::PushL( cont );
+    cont->SetParentIdL( KRootContainerIdDesc8 );
+    cont->SetTitleL( aTitle );
+    switch ( aContainerType )
+        {
+    case EImageAndVideo :
+        {
+        cont->SetObjectClassL( KImageVideoContainerClass );
+        }
+        break;
+    case EPlaylist :
+        {
+        cont->SetObjectClassL( KStorageFolderContainerClass );
+        }
+        break;
+    default :
+        {
+        __LOG( "CreateContainerL - default");
+        }
+        break;
+        }
+    CleanupStack::Pop( cont );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return cont;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::CloseFileSharingSession
+// Closes mediaserver and file sharing session
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::CloseFileSharingSession()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iMediaServer.Close();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::UnshareContainersL
+// Unshares objects, this should only be called from RunL
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::UnshareContainersL( )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    // All old containers unshred, move to next state
+    if ( iShareAllSelection == EShareNone )
+        {
+        iSharingState = ENotActive;
+        iWriter->SaveSharingStateL( EShareNone );
+        }
+    else
+        {
+        iSharingState = EShareContainers;
+        }
+
+    // All old containers unshred, move to next state
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ConnectMediaServer
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentSharingAo::ConnectMediaServer()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt error = iMediaServer.Connect();
+    __LOG8_1( "ConnectMediaServer error %d", error );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::AdjustShareAllSelection
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::AdjustShareAllSelection(
+    const RArray<TInt>& aSelections )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( aSelections.Count() == 1 )
+        {
+
+        if ( aSelections[0] == 0 )
+            {
+            __LOG("CUpnpContentSharingAo::AdjustShareAllSelection: \
+EShareNone");
+            iShareAllSelection = EShareNone;
+            }
+        else if ( aSelections[0] == 1 )
+            {
+            __LOG("CUpnpContentSharingAo::AdjustShareAllSelection: \
+EShareAll");
+            iShareAllSelection = EShareAll;
+            }
+        else
+            {
+            __LOG("CUpnpContentSharingAo::AdjustShareAllSelection: \
+EShareMany");
+            iShareAllSelection = EShareMany;
+            }
+        }
+    else
+        {
+        __LOG("CUpnpContentSharingAo::AdjustShareAllSelection: EShareMany");
+        iShareAllSelection = EShareMany;
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ShareContainersL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ShareContainersL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iMetadataUtility->ClearPostFiltersL();
+
+    TInt ind( 0 );
+    // Theres is still containers to share
+    switch ( iContainerType )
+        {
+    case EImageAndVideo :
+        {
+        // get the correct index for CLF
+        ind = GetContainerIndexL();
+        HBufC8* albumName( NULL );
+        if (  ind != KErrNotFound )
+            {
+            albumName = UpnpString::FromUnicodeL( 
+                iContainerNames->MdcaPoint( ind ) );
+            CleanupStack::PushL( albumName );
+
+            TInt plErr( KErrNone );
+
+                
+            if ( !plErr )
+                {
+                iWriter->AppendItemL( iContainerIds->MdcaPoint( ind ) );
+
+                iTmpContainer = CreateContainerL( iContainerType,
+                                                  *albumName );
+
+                iFileSharing->ShareContainerL(
+                    *UPnPCommonUtils::IntToDesC8LC ( iContainerId ),
+                    *iTmpContainer,
+                    iStatus );
+                CleanupStack::PopAndDestroy(); //UPnPCommonUtils::IntToDesC8LC
+                CleanupStack::PopAndDestroy( albumName );
+                SetActive();
+                }
+            else
+                {
+                SelfComplete( KErrNotFound );
+                }
+            }
+        else
+            {
+            SelfComplete( KErrNone );
+            }
+        }
+            break;
+    case EPlaylist :
+        {
+
+        // get the correct index for CLF
+        ind = GetContainerIndexL();
+        if ( ind != KErrNotFound )
+            {
+            HBufC8* playlistName( NULL );
+            playlistName = UpnpString::FromUnicodeL( 
+                iContainerNames->MdcaPoint( ind ) );
+            CleanupStack::PushL( playlistName  );
+
+            TInt plErr( KErrNone );
+            if ( !plErr )
+                {
+                // do the id..
+                iWriter->AppendItemL( iContainerIds->MdcaPoint( ind ) );
+
+                // ..then do the name for the container
+                iTmpContainer = CreateContainerL( iContainerType,
+                                                  *playlistName );
+
+                iFileSharing->ShareContainerL(
+                    *UPnPCommonUtils::IntToDesC8LC( iContainerId ),
+                    *iTmpContainer,
+                    iStatus );
+
+                CleanupStack::PopAndDestroy(); // IntToDesC8LC
+
+                SetActive();
+                }
+            else
+                {
+                SelfComplete( KErrNotFound );
+                }
+            CleanupStack::PopAndDestroy( playlistName );
+            }
+        else
+            {
+            SelfComplete( KErrNone );
+            }
+        }
+        break;
+    default :
+        break;
+        }
+
+    iSharingState = EShareContainersResult;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ShareItemsL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ShareItemsL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    delete iFileNameArr;
+    iFileNameArr = NULL;
+    iFileNameArr = new (ELeave)
+    CDesCArrayFlat( 4 );
+    DeleteListUpnpObject();
+    iItemList = CUpnpItemList::NewL();
+    TInt ind( 0 );
+
+
+    TInt parentId( 0 );
+
+    switch ( iContainerType )
+        {
+    case EImageAndVideo :
+        {
+        if ( !iCollections ) 
+            {
+            iCollections = CUPnPAlbumServices::NewL();
+            }
+
+        // get the correct index for CLF
+        ind  = GetContainerIndexL();
+
+        // ..then do the name for the container
+        CDesCArray* items = new (ELeave) CDesCArrayFlat(4);
+        CleanupStack::PushL( items );
+        TInt itemCount( 0 );
+        if ( ind < iContainerIds->MdcaCount() && ind != KErrNotFound )
+            {
+            TPtrC plId( iContainerIds->MdcaPoint( ind ) );
+            TRAPD( albErr,  iCollections->OpenAlbumL( plId, 
+                                                      *items ));
+            delete iCollections;
+            iCollections = NULL;
+
+            if( !albErr )
+                {
+                itemCount = items->MdcaCount();
+                }
+            }
+
+        if ( itemCount )
+            {
+
+            parentId =
+                iSharedContainerIds->operator[]( iContainerIdx );
+            TInt i = iObjectIdx;
+
+            delete iFileNameArr;
+            iFileNameArr = NULL;
+            iFileNameArr = new (ELeave)
+                CDesCArrayFlat( 4 );
+            TBool canAppend = items->MdcaCount();
+
+            while ( i < itemCount && canAppend )
+                {
+                // process all items in curret collection
+                HBufC8* id = UPnPCommonUtils::IntToDesC8LC( parentId );
+                TPtrC item( items->MdcaPoint( i ) );
+                TRAPD( itemErr,
+                       iTmpItem = iMetadataUtility->CreateItemL(
+                           item,
+                           *id ));
+                if ( !itemErr && iTmpItem )
+                    {
+                    if ( !itemErr )
+                        {
+                        if( !iMetadataUtility->UpdateMetadataL( 
+                            EPhotoFile,
+                            iTmpItem,
+                            item ))
+                            {
+                            // The item was not found from prev model
+                            if( !iMetadataUtility->UpdateMetadataL( 
+                                EVideoFile,
+                                iTmpItem,
+                                item ) )
+                                {
+                                iTmpItem->SetObjectClassL( 
+                                    KImageItemObjectClass );
+                                }
+                            }
+                        iItemList->AppendObjectL( *iTmpItem );
+                        iFileNameArr->AppendL(
+                            item );
+                        // transfer ownership
+                        }
+                    else
+                        {
+                        delete iTmpItem;
+                        }
+                    iTmpItem = NULL;
+                    i++;
+                    if ( iItemList->ObjectCount() >
+                         KContentDirCommitAmount )
+                        {
+                        // the list is full, next share it
+                        canAppend = EFalse;
+                        // save the current position in list for
+                        // next run
+                        iObjectIdx = i;
+                        }
+                    }
+                else
+                    {
+                    i++;
+                    iTmpItem = NULL;
+                    }
+                CleanupStack::PopAndDestroy(); // IntToDesC8LC
+
+                }
+            }
+        CleanupStack::PopAndDestroy( items );     
+
+        if ( iItemList->ObjectCount() <= KContentDirCommitAmount )
+            {
+            // next time start with new album
+            iSharingProgress += iObjectIdx;
+            iObjectIdx = 0;
+            iMetadataUtility->ClearPostFiltersL();
+            }
+
+        if ( iItemList->ObjectCount() )
+            {
+            iSharingSubState = EProfileItemList;
+            SelfComplete( KErrNone );
+            }
+        else
+            {
+            // update indexes
+            iMetadataUtility->ClearPostFiltersL();
+            iSharingSubState = EShareItemListResult;
+            SelfComplete( KErrNone );
+            }
+        }
+        break;
+    case EPlaylist :
+        {
+        if ( !iPlaylists ) 
+            {
+            iPlaylists = CUPnPPlaylistServices::NewL();
+            }
+
+        // get the correct index for CLF
+        ind  = GetContainerIndexL();
+
+        // ..then do the name for the container
+        CDesCArray* items = new (ELeave) CDesCArrayFlat(4);
+        CleanupStack::PushL( items );
+        TInt itemCount( 0 );
+        if ( ind < iContainerIds->MdcaCount() && ind != KErrNotFound )
+            {
+            TPtrC plId( iContainerIds->MdcaPoint( ind ) );
+            TRAPD( plErr, iPlaylists->OpenPlaylistL( plId, 
+                                                     *items ) );
+            delete iPlaylists;
+            iPlaylists = NULL;
+
+            if( !plErr )
+                {
+                itemCount = items->MdcaCount();
+                }
+            }
+
+        if ( itemCount )
+            {
+
+            parentId =
+                iSharedContainerIds->operator[]( iContainerIdx );
+            TInt i = iObjectIdx;
+
+            TBool canAppend = items->MdcaCount();
+
+            while ( i < itemCount && canAppend )
+                {
+                // process all items in curret collection
+                HBufC8* id = UPnPCommonUtils::IntToDesC8LC( parentId );
+                TPtrC item( items->MdcaPoint( i ) );
+                TRAPD( plErr,
+                       iTmpItem = iMetadataUtility->CreateItemL(
+                           item,
+                           *id ));
+                if ( !plErr && iTmpItem )
+                    {
+                    if ( !plErr )
+                        {
+                        iMetadataUtility->UpdateMetadataL( 
+                            EMusicFile,
+                            iTmpItem,
+                            item );
+                        iTmpItem->SetObjectClassL( 
+                            KMusicItemObjectClass );
+                        iItemList->AppendObjectL( *iTmpItem );
+                        iFileNameArr->AppendL(
+                            item );
+                        // transfer ownership
+                        }
+                    else
+                        {
+                        delete iTmpItem;
+                        }
+                    iTmpItem = NULL;
+                    i++;
+                    if ( iItemList->ObjectCount() >
+                         KContentDirCommitAmount )
+                        {
+                        // the list is full, next share it
+                        canAppend = EFalse;
+                        // save the current position in list for
+                        // next run
+                        iObjectIdx = i;
+                        }
+                    }
+                else
+                    {
+                    i++;
+                    iTmpItem = NULL;
+                    }
+                CleanupStack::PopAndDestroy(); // IntToDesC8LC
+
+                }
+            }
+        CleanupStack::PopAndDestroy( items );
+
+        if ( iItemList->ObjectCount() <= KContentDirCommitAmount )
+            {
+            // next time start with new album
+            iSharingProgress += iObjectIdx;
+            iObjectIdx = 0;
+            iMetadataUtility->ClearPostFiltersL();
+            }
+
+
+        if ( iItemList->ObjectCount() )
+            {
+            iSharingSubState = EProfileItemList;
+            SelfComplete( KErrNone );
+            }
+        else
+            {
+            // goto RunL and update indexes
+            iMetadataUtility->ClearPostFiltersL();
+            iSharingSubState = EShareItemListResult;
+            SelfComplete( KErrNone );
+            }
+        }
+        break;
+    default :
+        break;
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ShareAllItemsL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ShareAllItemsL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    delete iFileNameArr;
+    iFileNameArr = NULL;
+    iFileNameArr = new (ELeave)
+        CDesCArrayFlat( 4 );
+
+    DeleteListUpnpObject();
+    iItemList = CUpnpItemList::NewL();
+
+    switch ( iContainerType )
+        {
+    case EImageAndVideo:
+        {
+        if ( !iAllImagesShared )
+            {
+            AppendImageFilesToListL();
+            }
+
+        // do not share videos if the list is already full
+        if ( !iAllVideosShared &&
+             iItemList->ObjectCount() <= KContentDirCommitAmount )
+            {
+            AppendVideoFilesToListL();
+            }
+        }
+        break;
+    case EPlaylist:
+        {
+        const MCLFItemListModel* list(NULL);
+        list = &iMetadataUtility->MusicFiles();
+        if ( !list )
+            {
+            User::Leave( KErrArgument );
+            }
+        TInt musicCount = list->ItemCount();
+
+        if ( iObjectIdx < musicCount )
+            {
+            // sharing images
+            TBool canAppend( list->ItemCount() );
+            TInt i( iObjectIdx );
+
+            while ( i < list->ItemCount() && canAppend )
+                {
+                // process all items in curret collection
+                HBufC8* id = UPnPCommonUtils::IntToDesC8LC(
+                    iContainerId );
+                TRAPD( plErr, iTmpItem = iMetadataUtility->CreateItemL(
+                           list->Item( i ),
+                           *id ));
+                if ( !plErr && iTmpItem )
+                    {
+                    TPtrC fullFileName;
+                    list->Item( i ).GetField( ECLFFieldIdFileNameAndPath,
+                                              fullFileName );
+
+                    if ( !plErr )
+                        {
+                        iMetadataUtility->UpdateMetadataL( 
+                            EMusicFile,
+                            iTmpItem,
+                            fullFileName );
+                        iTmpItem->SetObjectClassL( KMusicItemObjectClass );
+                        iItemList->AppendObjectL( *iTmpItem );
+                        iFileNameArr->AppendL( fullFileName );
+                        }
+                    else
+                        {
+                        delete iTmpItem;
+                        }
+                    iTmpItem = NULL;
+                    i++;
+                    if ( iItemList->ObjectCount() >
+                         KContentDirCommitAmount )
+                        {
+                        // the list is full, next share it
+                        canAppend = EFalse;
+                        }
+                    }
+                else
+                    {
+                    i++;
+                    iTmpItem = NULL;
+                    }
+
+                CleanupStack::PopAndDestroy(); // IntToDesC8LC
+                }
+            // save the current position in list, for next run
+            iObjectIdx = i;
+            }
+
+        }
+        break;
+    default :
+        break;
+        }
+
+    // do not share empty list
+    if ( iItemList->ObjectCount() )
+        {
+        iSharingSubState = EProfileItemList;
+        SelfComplete( KErrNone );
+        }
+    else
+        {
+        // update indexes
+        iSharingSubState = EShareItemListResult;
+        SelfComplete( KErrNone );
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ProfileItemListL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ProfileItemListL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    if ( iProfileInd < iItemList->ObjectCount() )
+        {
+        iProfilerActive = ETrue;
+
+        CUpnpItem*
+            tmpItem = static_cast<CUpnpItem*>(
+                iItemList->operator[]( iProfileInd ));
+
+        TPtrC fileName = iFileNameArr->MdcaPoint( iProfileInd );
+
+        iSharingSubState = EProfileItemListResult;
+
+        TRAPD( err, UpnpCdsResElementUtility::AddResElementL(
+                   *tmpItem,
+                   fileName ));
+        if ( iDeletePending )
+            {
+            DeleteListUpnpObject();
+            delete iFileNameArr;
+            iFileNameArr = NULL;
+            }
+        else
+            {
+            SetActive();
+            TRequestStatus* stat = &iStatus;
+            User::RequestComplete( stat, err );
+            }
+#ifdef _DEBUG
+        HBufC* log = HBufC::NewLC(512);
+        log->Des().Append(_L("CUpnpContentSharingAo: Profiling: "));
+        log->Des().Append( fileName );
+        __LOG16( *log );
+        __LOG2( "CUpnpContentSharingAo: Profile index: (%d of %d)", 
+                       iProfileInd, 
+                       iItemList->ObjectCount());
+        CleanupStack::PopAndDestroy( log );
+#endif
+        iProfilerActive = EFalse;
+        }
+    else
+        {
+        // update indexes
+        iProfileInd = 0;
+        iSharingSubState = EShareItemListResult;
+        SelfComplete( KErrNone );
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ProfileItemListResult
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ProfileItemListResult()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( iStatus.Int() )
+        {
+        CUpnpItem* tmpItem = static_cast<CUpnpItem*>(
+            iItemList->operator[]( iProfileInd ));
+        TPtrC8 id( tmpItem->Id() );
+        iItemList->RemoveAndDestroy( id );
+        
+        iFileNameArr->Delete(iProfileInd);  
+        }
+    else
+        {
+        iProfileInd++; 
+        }
+
+    if ( iProfileInd < iItemList->ObjectCount() )
+        {
+        iSharingSubState = EProfileItemList;
+        }
+    else
+        {
+        iProfileInd = 0;
+        delete iFileNameArr;
+        iFileNameArr = NULL;
+        iSharingSubState = EShareItemList;
+        }
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ShareItemListL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ShareItemListL( const TInt& aParentId )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // do not share empty list
+    if ( iItemList && iItemList->ObjectCount() )
+        {
+        iFileSharing->ShareItemListL(
+            *UPnPCommonUtils::IntToDesC8LC( aParentId ),
+            *iItemList,
+            iSharedContainersCount, iStatus );
+        CleanupStack::PopAndDestroy(); // UPnPCommonUtils::IntToDesC8LC
+        iSharingSubState = EShareItemListResult;
+        SetActive();
+        }
+    else
+        {
+        // update indexes
+        iSharingSubState = EShareItemListResult;
+        SelfComplete( KErrNone );
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ShareItemListResultL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ShareItemListResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iTmpItem = NULL;
+    if ( iSharingState == EShareItems )
+        {
+        ShareItemsResultL();
+        }
+    else if ( iSharingState == EShareAllItems )
+        {
+        AllItemsResultL();
+        }
+    iSharingSubState = EIdle;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::AllItemsResultL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::AllItemsResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt totalItemCount( 0 );
+
+    if ( iItemList )
+        {
+        // This updates the field needed in UI for progress
+        iSharingProgress += iItemList->ObjectCount();
+        iEngine->SetProgressL( iSharingProgress );
+        DeleteListUpnpObject();
+        delete iFileNameArr;
+        iFileNameArr = NULL;
+        }
+    iTmpItem = NULL;
+
+    switch ( iContainerType )
+        {
+    case EImageAndVideo:
+        {
+        totalItemCount = iMetadataUtility->ImageFiles().ItemCount() +
+            iMetadataUtility->VideoFiles().ItemCount();
+        }
+        break;
+    case EPlaylist :
+        {
+        totalItemCount = iMetadataUtility->MusicFiles().ItemCount();
+        }
+        break;
+    default :
+        break;
+        }
+    // Fix EYSN-7CWDZ5 error in UPnP FW2.1  
+    // Have not changed it in UPnP FW2.5 because the FW 2.5 have 
+    // so much change. 
+    if ( iObjectIdx < totalItemCount )
+        {
+        // Continue sharing process since not everything is shared yet.
+        iSharingState = EShareAllItems;
+        }
+    else
+        {
+        if ( !iWriter )
+            {
+            User::Leave( KErrGeneral );
+            }
+        iWriter->SaveSharingStateL( iShareAllSelection );
+        iSharingState = ENotActive;
+
+        }
+
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ShareContainersResultL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::ShareContainersResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+
+    if ( !iStatus.Int() )
+        {
+        // previous container shared OK, save the album name
+        iWriter->AppendStatusL( iContainerIdx );
+        }
+
+    if ( iTmpContainer )
+        {
+        TInt newId = UPnPCommonUtils::DesC8ToInt( iTmpContainer->Id() );
+        __LOG1("CUpnpContentSharingAo::ShareContainersResultL:\
+ id: %d", newId );
+        if ( !iSharedContainerIds )
+            {
+            iSharedContainerIds =
+                new (ELeave) CArrayFixFlat<TInt>( 10 );
+            }
+        iSharedContainerIds->AppendL( newId );
+        delete iTmpContainer;
+        iTmpContainer = NULL;
+        }
+
+    TInt totalContainers( 0 );
+    // determine next state
+    if ( iShareAllSelection == EShareAll )
+        {
+        switch ( iContainerType )
+            {
+            // totalContainers is used as index -> -1
+        case EImageAndVideo :
+            {
+            totalContainers = iContainerIds->MdcaCount() -1;
+            }
+            break;
+        case EPlaylist :
+            {
+            totalContainers = iContainerIds->MdcaCount() -1;
+            }
+            break;
+        default:
+            break;
+            }
+        }
+    else if ( iShareAllSelection == EShareMany )
+        {
+        totalContainers = iCurrentSelections.Count() -1;
+        }
+
+    if ( iContainerIdx < totalContainers )
+        {
+        iContainerIdx++;
+        iSharingState = EShareContainers;
+        }
+    else
+        {
+        // all selected containers shared, next share items
+        iContainerIdx = 0;
+        iSharingState = EShareItems;
+        }
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::ShareItemsResultL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+void CUpnpContentSharingAo::ShareItemsResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( !iMetadataUtility )
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    if ( iItemList )
+        {
+        // This updates the field needed in UI for progress
+        iSharingProgress += iItemList->ObjectCount();
+        iEngine->SetProgressL( iSharingProgress );
+        DeleteListUpnpObject();
+        delete iFileNameArr;
+        iFileNameArr = NULL;
+        }
+    iTmpItem = NULL;
+    iSharingState = EShareItems;
+
+    TInt totalContainers( 0 );
+    // Clear postfilters, they are re-set if needed: ShareItemsL/
+    // ShareAllItemsL
+    iMetadataUtility->ClearPostFiltersL();
+    // determine next state
+    if ( iShareAllSelection == EShareAll )
+        {
+        switch ( iContainerType )
+            {
+        case EImageAndVideo :
+            {
+            totalContainers = iContainerIds->MdcaCount() -1;
+            }
+            break;
+        case EPlaylist :
+            {
+            totalContainers = iContainerIds->MdcaCount() -1;
+                
+            }
+            break;
+        default:
+            break;
+            }
+        }
+    else if ( iShareAllSelection == EShareMany )
+        {
+        if( iSharedContainerIds )
+            {
+            totalContainers = iSharedContainerIds->Count() -1;
+            }
+        else
+            {
+            // sharing of all containers failed or the containers under 
+            // sharing were deleted
+            totalContainers = KErrNotFound;
+            }
+        }
+
+
+    if ( !iObjectIdx )
+        {
+
+        // all files were shared from current container
+        if ( iContainerIdx < totalContainers )
+            {
+            // more items in the selected..
+            iContainerIdx++;
+            }
+        else
+            {
+            // all selected containers shared..
+            if ( iShareAllSelection == EShareAll )
+                {
+                // next share individual files
+                iSharingState = EShareAllItems;
+                }
+            else
+                {
+                // sharing process is done.
+                if ( totalContainers == KErrNotFound )
+                    {
+                    iShareAllSelection = EShareNone;
+                    }
+                iWriter->SaveSharingStateL( iShareAllSelection );
+                iSharingState = ENotActive;
+                }
+            }
+        }
+
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::SelectionObjectCountL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentSharingAo::SelectionObjectCountL(
+    const TUpnpMediaType aContainerType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt totalCount( 0);
+    if ( iShareAllSelection != EShareNone )
+        {
+        switch ( aContainerType )
+            {
+        case EImageAndVideo :
+            {
+            if ( !iCollections ) 
+                {
+                iCollections = CUPnPAlbumServices::NewL();
+                }
+            __LOG("albumserv created");
+            CDesCArray* collIds = new ( ELeave ) CDesCArrayFlat( 
+                KDefaultGranularity );
+            CleanupStack::PushL( collIds );
+            CDesCArray* collNames = new ( ELeave ) CDesCArrayFlat( 
+                KDefaultGranularity );
+            CleanupStack::PushL( collNames );
+            iCollections->ListAlbumsL( *collIds, *collNames );
+            __LOG("albums listed");
+            collNames->Reset();
+
+            if ( iShareAllSelection == EShareAll )
+                {
+                __LOG("EShareAll");
+                for( TInt i(0); i<collIds->MdcaCount(); i++ )
+                    {
+                    TPtrC id( collIds->MdcaPoint( i ) );
+                    RDebug::Print(_L("id: %S"), &id );
+                    TRAPD( lcode, iCollections->OpenAlbumL( id,
+                                                            *collNames ));
+                    if( !lcode )
+                        {
+                        totalCount += collNames->MdcaCount();
+                        }
+                    else
+                        {
+                        }
+                    collNames->Reset();
+                    __LOG("Loop cycle end");
+                    }
+                __LOG("Loop done");
+                // Add individual files count
+                const MCLFItemListModel* imgList =
+                    &iMetadataUtility->ImageFiles();
+                totalCount += imgList->ItemCount();
+                const MCLFItemListModel* vidList =
+                    &iMetadataUtility->VideoFiles();
+                totalCount += vidList->ItemCount();
+                __LOG("EShareAll done");
+                }
+            else if ( iShareAllSelection == EShareMany )
+                {
+                for( iContainerIdx = 0; 
+                     iContainerIdx < iCurrentSelections.Count();
+                     iContainerIdx++ )
+                    {
+                    TInt ind = GetContainerIndexL(); 
+
+                    if ( ind != KErrNotFound )
+                        {
+                        TPtrC id = iContainerIds->MdcaPoint( ind );
+                        TRAPD( openErr, iCollections->OpenAlbumL( 
+                                   id, 
+                                   *collNames ));
+                        if( !openErr )
+                            {
+                            totalCount += collNames->MdcaCount();
+                            collNames->Reset();
+                            }
+                        }
+                    __LOG("end for(..)");
+                    }
+                iContainerIdx = 0;
+                }
+            delete iCollections;
+            iCollections = NULL;
+            __LOG("iCollections deleted");
+            CleanupStack::PopAndDestroy( collNames );
+            CleanupStack::PopAndDestroy( collIds );
+            }
+            break;
+        case EPlaylist :
+            {
+            if ( !iPlaylists ) 
+                {
+                iPlaylists = CUPnPPlaylistServices::NewL();
+                }
+
+            CDesCArray* plIds = new ( ELeave ) CDesCArrayFlat( 
+                KDefaultGranularity );
+            CleanupStack::PushL( plIds );
+            CDesCArray* plNames = new ( ELeave ) CDesCArrayFlat( 
+                KDefaultGranularity );
+            CleanupStack::PushL( plNames );
+            iPlaylists->ListPlaylistsL( *plIds, *plNames );
+            plNames->Reset();
+
+            if ( iShareAllSelection == EShareAll )
+                {
+                for( TInt i(0); i<plIds->MdcaCount(); i++ )
+                    {
+                    TPtrC id( plIds->MdcaPoint( i ) );
+                    iPlaylists->OpenPlaylistL( id,
+                                               *plNames );
+
+                    totalCount += plNames->MdcaCount();
+                    plNames->Reset();
+                    }
+                // Add individual files count
+                const MCLFItemListModel* musicList =
+                    &iMetadataUtility->MusicFiles();
+                totalCount += musicList->ItemCount();
+                }
+            else if ( iShareAllSelection == EShareMany )
+                {
+                for( iContainerIdx = 0; 
+                     iContainerIdx < iCurrentSelections.Count();
+                     iContainerIdx++ )
+                    {
+                    TInt ind = GetContainerIndexL(); 
+
+                    if ( ind != KErrNotFound )
+                        {
+                        TPtrC id = iContainerIds->MdcaPoint( ind );
+                        iPlaylists->OpenPlaylistL( id, 
+                                                   *plNames );
+                        totalCount += plNames->MdcaCount();
+                        plNames->Reset();
+                        }
+                    
+                    }
+                iContainerIdx = 0;
+                }
+            delete iPlaylists;
+            iPlaylists = NULL;
+            CleanupStack::PopAndDestroy( plNames );
+            CleanupStack::PopAndDestroy( plIds );
+            }
+            break;
+        default :
+            {
+            }
+            break;
+            }
+        }
+    __LOG1("CUpnpContentSharingAo::SelectionObjectCountL: totalCount: %d",
+        totalCount );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return totalCount;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::SharingProgress
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentSharingAo::SharingProgress(
+    TUpnpMediaType& aContainerType ) const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    aContainerType = iContainerType;
+    __LOG1("CUpnpContentSharingAo::SharingProgress: iObjectIdx: %d",
+        iSharingProgress );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return iSharingProgress;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::GetContainerIndexL
+// Returns IntValue for aObject
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentSharingAo::GetContainerIndexL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt ind( KErrNone );
+    if ( iShareAllSelection == EShareAll )
+        {
+        if( iContainerIds->MdcaCount() )
+            {
+            ind = iContainerIdx;
+            }
+        else
+            {
+            ind = KErrNotFound;
+            }
+        }
+    else if ( iContainerIdx >= iCurrentSelections.Count() ||
+        ( iCurrentSelections[ iContainerIdx ]- KUiSelectionOffset 
+          >= iContainerIds->MdcaCount() ))
+        {
+        ind = KErrNotFound;
+        }
+    else
+        {
+        if ( iShareAllSelection == EShareMany )
+            {
+            ind = iCurrentSelections[ iContainerIdx ] 
+                - KUiSelectionOffset;
+            
+            }
+        else
+            {
+            User::Leave( KErrArgument );
+            }
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return ind; // correct index or KErrNotFound
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::SelfComplete
+// Complete own request
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::SelfComplete( const TInt aError )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( iStopRequested )
+        {
+        iSharingState = ENotActive;
+        }
+    SetActive();
+    TRequestStatus* stat = &iStatus;
+    User::RequestComplete( stat, aError );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::AppendImageFilesToListL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::AppendImageFilesToListL()
+    {
+    // Obtain list of image files from CLF
+    const MCLFItemListModel* list(NULL);
+    list = &iMetadataUtility->ImageFiles();
+    if ( !list )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // check if the iImageIndex is still less than the number of images
+    //       -> there are still images to be shared
+    TInt imageCount = list->ItemCount();
+    if ( !imageCount )
+        {
+        iAllImagesShared = ETrue;
+        return;
+        }
+
+    if ( iImageIndex < imageCount )
+        {
+
+        // Prepare storage for filenames
+        // Loop until all images are processed or until we have
+        // KContentDirCommitAmount files in the list of objects to be shared.
+        while ( !iAllImagesShared &&
+                iItemList->ObjectCount() <= KContentDirCommitAmount )
+            {
+            // Create an item with parent id of Images&Videos container.
+            HBufC8* id = UPnPCommonUtils::IntToDesC8LC(
+                iContainerId );
+            TRAPD( imgErr, iTmpItem = iMetadataUtility->CreateItemL(
+                       list->Item( iImageIndex ),
+                       *id ) );
+
+            if ( !imgErr && iTmpItem )
+                {
+                TPtrC fullFileName;
+                list->Item( iImageIndex ).GetField( 
+                    ECLFFieldIdFileNameAndPath,
+                    fullFileName );
+
+                if ( !imgErr && iTmpItem )
+                    {
+                    // Update item's metadata and append it to iItemList.
+                    iMetadataUtility->UpdateMetadataL( 
+                        EPhotoFile,
+                        iTmpItem,
+                        fullFileName );
+                    iTmpItem->SetObjectClassL( KImageItemObjectClass );
+                    iItemList->AppendObjectL( *iTmpItem );
+                    iFileNameArr->AppendL( fullFileName );
+                    }
+                else
+                    {
+                    delete iTmpItem;
+                    }
+                }
+            else
+                {
+                }
+
+            // set iTmpItem to NULL
+            iTmpItem = NULL;
+
+            // clean up
+            CleanupStack::PopAndDestroy(); // IntToDesC8LC
+
+            // increment counter to process next image.
+            iImageIndex++;
+
+            if ( iImageIndex >= imageCount )
+                {
+                iAllImagesShared = ETrue;
+                }
+            }
+
+        }
+    // update iObjectIdx to keep the progressbar ok.
+    iObjectIdx = iImageIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::AppendVideoFilesToListL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::AppendVideoFilesToListL()
+    {
+    // Obtain list of video files from CLF
+    const MCLFItemListModel* list(NULL);
+    list = &iMetadataUtility->VideoFiles();
+    if ( !list )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Obtain the number of video file items in the list.
+    TInt videoCount( list->ItemCount() );
+    if ( !videoCount )
+        {
+        iAllVideosShared = ETrue;
+        return;
+        }
+
+    // Check that there are still videos to be shared.
+    if ( iVideoIndex < videoCount )
+        {
+
+        if ( !iFileNameArr )
+            {
+            iFileNameArr = new (ELeave)
+                CDesCArrayFlat( 4 );
+            }
+        // Loop until all videos are processed or until we have
+        // KContentDirCommitAmount files in the list of objects to be shared.
+        while ( !iAllVideosShared &&
+                iItemList->ObjectCount() <= KContentDirCommitAmount )
+            {
+            // Create an item with parent id of Images&Videos container.
+            HBufC8* id = UPnPCommonUtils::IntToDesC8LC(
+                iContainerId );
+            TRAPD( vidErr, iTmpItem = iMetadataUtility->CreateItemL(
+                       list->Item( iVideoIndex ),
+                       *id ) );
+
+            if ( !vidErr && iTmpItem )
+                {
+                TPtrC fullFileName;
+                list->Item( iVideoIndex ).GetField( 
+                    ECLFFieldIdFileNameAndPath,
+                    fullFileName );
+               
+
+                if ( !vidErr && iTmpItem )
+                    {
+                    // Update item's metadata and append it to iItemList.
+                    iMetadataUtility->UpdateMetadataL( 
+                        EVideoFile,
+                        iTmpItem,
+                        fullFileName );
+                    iTmpItem->SetObjectClassL( KVideoItemObjectClass );
+                    iItemList->AppendObjectL( *iTmpItem );
+                    iFileNameArr->AppendL( fullFileName );
+                    }
+                else
+                    {
+                    delete iTmpItem;
+                    iTmpItem = NULL;
+                    }
+                }
+            else
+                {
+                }
+
+            // set iTmpItem to NULL
+            iTmpItem = NULL;
+
+            // clean up
+            CleanupStack::PopAndDestroy(); // IntToDesC8LC
+
+            // increment counter to process next video.
+            iVideoIndex++;
+
+            if ( iVideoIndex >= videoCount )
+                {
+                // all videos are processed.
+                // Set iAllVideosShared -> ETrue to end the while loop.
+                iAllVideosShared = ETrue;
+                }
+            }
+        }
+
+    // update iObjectIdx to keep the progressbar ok.
+    // Remember to add iImageIndex here!
+    iObjectIdx = iImageIndex + iVideoIndex;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::RequestStop
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpContentSharingAo::RequestStop( 
+    MUpnpSharingCallback::TSharingStopType aStopType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iStopRequested = aStopType;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpContentSharingAo::GetPlaylistNameByIdL
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpContentSharingAo::GetContainerNameByIdL( const TDesC& aId,
+                                                   TDes8& aPlaylistName,
+                                                   const TInt aContainerType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt err( KErrNone );
+    CDesCArray* newIds = new ( ELeave )CDesCArrayFlat( 4 );
+    CleanupStack::PushL(newIds);
+    CDesCArray* newNames = new ( ELeave )CDesCArrayFlat( 4 );
+    CleanupStack::PushL(newNames);
+
+    if( aContainerType == EImageAndVideo )
+        {
+        if ( !iCollections ) 
+            {
+            iCollections = CUPnPAlbumServices::NewL();
+            }
+        iCollections->ListAlbumsL( *newIds, *newNames );
+        delete iCollections;
+        iCollections = NULL;
+        }
+    else if ( aContainerType == EPlaylist )
+        {
+        if ( !iPlaylists ) 
+            {
+            iPlaylists = CUPnPPlaylistServices::NewL();
+            }
+        iPlaylists->ListPlaylistsL( *newIds, *newNames );
+        delete iPlaylists;
+        iPlaylists = NULL;
+        }
+
+    if ( !newIds->MdcaCount() )
+        {
+        err = KErrGeneral;
+        }
+    else
+        {
+        for ( TInt i(0); i<newIds->MdcaCount();i++ )
+            {
+            if ( aId.Compare( newIds->MdcaPoint( i ) ) == 0 )
+                {
+                HBufC8* name8 = 
+                    UpnpString::FromUnicodeL( newNames->MdcaPoint( i ) );
+                CleanupStack::PushL( name8 );
+                TPtr8 name8tmp = name8->Des();
+                aPlaylistName = name8tmp;
+                CleanupStack::PopAndDestroy( name8 );
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( newNames );
+    CleanupStack::PopAndDestroy( newIds );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+void CUpnpContentSharingAo::DeleteListUpnpObject()
+    {
+    if ( iItemList )
+        {
+        TInt count = iItemList->ObjectCount();
+        for ( TInt i = count - 1; i >= 0; --i )
+            {
+            CUpnpItem* tmpItem = static_cast<CUpnpItem*>(
+                iItemList->operator[]( i ));
+            TPtrC8 id( tmpItem->Id() );
+            iItemList->RemoveAndDestroy( id ); 
+            } 
+        delete iItemList;
+        iItemList = NULL;
+        }
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpcustomgrouper.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUPnPCustomGrouper class implementation
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+#include <MCLFContentListingEngine.h>
+#include <ContentListingFactory.h>
+#include <MCLFModifiableItem.h>
+#include <CLFContentListing.hrh>
+#include "upnpcustomgrouper.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// CUpnpCustomGrouper::CUpnpCustomGrouper
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpCustomGrouper::CUpnpCustomGrouper(
+                            const TCLFExtendedFieldId aGroupingCriteria )
+    : iGroupingCriteria( aGroupingCriteria )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCustomGrouper::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpCustomGrouper* CUpnpCustomGrouper::NewL(
+                                TCLFExtendedFieldId aGroupingCriteria )
+    {
+    CUpnpCustomGrouper* self =
+        new (ELeave) CUpnpCustomGrouper( aGroupingCriteria );
+    return self;
+    }
+
+// Destructor
+CUpnpCustomGrouper::~CUpnpCustomGrouper()
+    {
+    iModItems.ResetAndDestroy();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCustomGrouper::GroupItemsL
+// Method for grouping Content Listing Framework items.
+// --------------------------------------------------------------------------
+//
+void CUpnpCustomGrouper::GroupItemsL(const TArray<MCLFItem*>& aSourceList,
+                                        RPointerArray<MCLFItem>& aGroupedList)
+    {
+    // Delete old modifiable items (groups) is any
+    iModItems.ResetAndDestroy();
+
+    // Process all items of the source list
+    TInt count( aSourceList.Count() );
+    for( TInt i = 0; i < count; i++ )
+        {
+        // Get value of the field in iGroupingCriteria.
+        // For example, if iFilterCriteria contains ECLFFieldIdArtist,
+        // name of the artist is stored to fieldValue variable.
+        TPtrC fieldValue;
+        MCLFItem* currentItem = aSourceList[i];
+        TInt error( currentItem->GetField(
+            iGroupingCriteria, fieldValue ) );
+
+        if( error == KErrNone )
+            {
+            // Check if the group is already added to the list
+            if( !GroupAlreadyExists( fieldValue ) )
+                {
+                // Create a new modifiable item and add a field
+                // name and value of the field.
+                // For example, if grouping criteria is ECLFFieldIdArtist,
+                // the field is added to the item with name of the artist.
+                MCLFModifiableItem* modItem =
+                    ContentListingFactory::NewModifiableItemLC();
+                modItem->AddFieldL( iGroupingCriteria, fieldValue );
+
+                // Add the item to the iModItems array to keep track,
+                // which groups are already in the list (for example, which
+                // groups are already in the list). The iModItems array
+                // also deletes these items, when they are no longer needed.
+                iModItems.AppendL( modItem ); // ownership transferred
+
+                CleanupStack::Pop(); // modItem
+
+                // Add the item to the model
+                aGroupedList.AppendL( modItem );
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpCustomGrouper::GroupAlreadyExists
+// Checks if group has been added to the model already.
+// --------------------------------------------------------------------------
+//
+TBool CUpnpCustomGrouper::GroupAlreadyExists( const TDesC& aGroupName )
+    {
+    TBool status = EFalse;
+    TInt count( iModItems.Count() );
+    for( TInt i = 0; i < count; i++ )
+        {
+        // Get value of the field in iGroupingCriteria.
+        // For example, if iGroupingCriteria contains ECLFFieldIdArtist,
+        // name of the artist is stored to fieldValue variable.
+        TPtrC fieldValue;
+        MCLFItem* currentItem = iModItems[i];
+        TInt error( currentItem->GetField(
+            iGroupingCriteria, fieldValue ) );
+
+        if( error == KErrNone )
+            {
+            if( fieldValue == aGroupName )
+                {
+                // Group is in the list
+                status = ETrue;
+                }
+            }
+        }
+
+    // Group is not in the list
+    return status;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnppostfilter.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUPnPPostFilter class implementation
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+#include <MCLFContentListingEngine.h>
+#include <ContentListingFactory.h>
+#include <MCLFItem.h>
+#include <CLFContentListing.hrh>
+
+#include "upnppostfilter.h"
+#include "upnpcontentserverdefs.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// CUpnpPostFilter::CUpnpPostFilter
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+
+CUpnpPostFilter::CUpnpPostFilter(
+                            const TCLFExtendedFieldId aFilterCriteria,
+                            TBool aRemoveDuplicates )
+    : iFilterCriteria( aFilterCriteria ),
+      iRemoveDuplicates( aRemoveDuplicates )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CCEPostFilter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUpnpPostFilter::ConstructL( const TDesC& aFilterParameter )
+    {
+    iFilterParameter = aFilterParameter.AllocL();
+    }
+
+// --------------------------------------------------------------------------
+// CCEPostFilter::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+
+CUpnpPostFilter* CUpnpPostFilter::NewL(
+                            const TCLFExtendedFieldId aFilterCriteria,
+                            const TDesC& aFilterParameter,
+                            TBool aRemoveDuplicates )
+    {
+    CUpnpPostFilter* self =
+        CUpnpPostFilter::NewLC( aFilterCriteria, aFilterParameter,
+                                aRemoveDuplicates );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPostFilter::NewLC
+// Two-phased constructor, pointer is left to the CleanupStack.
+// --------------------------------------------------------------------------
+//
+CUpnpPostFilter* CUpnpPostFilter::NewLC(
+                            const TCLFExtendedFieldId aFilterCriteria,
+                            const TDesC& aFilterParameter,
+                            TBool aRemoveDuplicates )
+    {
+    CUpnpPostFilter* self = new (ELeave) CUpnpPostFilter(
+        aFilterCriteria, aRemoveDuplicates );
+    CleanupStack::PushL( self );
+    self->ConstructL( aFilterParameter );
+    return self;
+    }
+
+// Destructor
+CUpnpPostFilter::~CUpnpPostFilter()
+    {
+    delete iFilterParameter;
+    }
+
+// --------------------------------------------------------------------------
+// CCEPostFilter::FilterItemsL
+// Method for filtering the source list.
+// --------------------------------------------------------------------------
+//
+void CUpnpPostFilter::FilterItemsL( const TArray<MCLFItem*>& aItemList,
+                                  RPointerArray<MCLFItem>& aFilteredItemList )
+    {
+    // Process all items in the item list
+    TInt count( aItemList.Count() );
+    for( TInt i = 0; i < count; i++ )
+        {
+        // Get value of the field defined in iFilterCriteria.
+        // For example, if iFilterCriteria contains ECLFFieldIdAlbum,
+        // name of the album is stored to fieldValue variable.
+        TPtrC fieldValue;
+        MCLFItem* currentItem = aItemList[i];
+        TInt error( currentItem->GetField(
+            iFilterCriteria, fieldValue ) );
+
+        // Add the music file to the filtered list,
+        // if value of of the field is same as iFilterParameter.
+        // For example, if it is from the desired album.
+        if( error == KErrNone )
+            {
+            TBool add( EFalse );
+            if ( iRemoveDuplicates )
+                {
+                if ( !IsAdded( aFilteredItemList, fieldValue ) )
+                    {
+                    add = ETrue;
+                    }
+                }
+            else
+                {
+                if( fieldValue == iFilterParameter->Des() )
+                    {
+                    add = ETrue;
+                    }
+                }
+            if( add )
+                {
+                aFilteredItemList.AppendL( currentItem );
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpPostFilter::IsAdded
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TBool CUpnpPostFilter::IsAdded( RPointerArray<MCLFItem>& aFilteredItemList,
+                                TPtrC& aFieldValue )
+    {
+    TBool isAdded( EFalse );
+    for( TInt i(0); i<aFilteredItemList.Count(); i++ )
+        {
+        MCLFItem* currentItem = aFilteredItemList[i];
+
+        TPtrC fieldValue;
+        TInt error( currentItem->GetField(
+            iFilterCriteria, fieldValue ) );
+
+        if( error == KErrNone )
+            {
+            if ( fieldValue == aFieldValue )
+                {
+                isAdded = ETrue;
+                __LOG("found duplicate");
+                }
+            }
+        }
+    return isAdded;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpselectionreader.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,668 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpSelectionReader class implementation
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include <upnpstring.h>
+#include <s32file.h>
+#include <centralrepository.h>
+// #include <clfcontentlistingextended.hrh>
+
+#include <MCLFItemListModel.h>
+#include <MCLFItem.h>
+#include "upnpcontentservercrkeys.h"
+#include "upnpselectionreader.h"
+#include "upnpcontentmetadatautility.h"
+#include "upnpcontentserverdefs.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+//CONSTANTS
+// Format string for listbox items
+_LIT(KItemFormatString, "1\t%S");
+const TInt KDefaultStringArrGranularity( 10 );
+const TInt KDefaultSelectionGranularity( 2 );
+
+const TInt KShareNoneIndex = 0;
+const TInt KShareAllIndex = 1;
+const TInt KPredefinedSelections = 2; // Share none and share all
+
+using namespace UpnpContentServer;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpSelectionReader* CUpnpSelectionReader::NewL(
+                        CUpnpContentMetadataUtility* aUtility )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpSelectionReader* self =
+        new(ELeave) CUpnpSelectionReader();
+
+    CleanupStack::PushL(self);
+    self->ConstructL( aUtility );
+    CleanupStack::Pop(self);
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUpnpSelectionReader::ConstructL(
+                        CUpnpContentMetadataUtility* aUtility  )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iMetadataUtility = aUtility;
+
+    iPlIdArray = new (ELeave) CDesCArrayFlat( KDefaultStringArrGranularity );
+    iCollIdArray = new (ELeave) 
+        CDesCArrayFlat( KDefaultStringArrGranularity );
+
+    iPlaylistNames = new (ELeave) 
+        CDesCArrayFlat( KDefaultStringArrGranularity );
+    iCollectionNames = new (ELeave) 
+        CDesCArrayFlat( KDefaultStringArrGranularity );
+
+    iSelectedImages  = new (ELeave) RArray<TInt>( 
+        KDefaultSelectionGranularity);
+    iSelectedMusic  = new (ELeave) RArray<TInt>( 
+        KDefaultSelectionGranularity);
+
+    GetVisualSharingStateL( iVisualSharingSelection );
+    GetMusicSharingStateL( iMusicSharingSelection );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::CUpnpSelectionReader
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpSelectionReader::CUpnpSelectionReader()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iImageContainers = NULL;
+    iPlaylistNames = NULL;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::~CUpnpSelectionReader
+// C++ default destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpSelectionReader::~CUpnpSelectionReader()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iMetadataUtility = NULL;
+
+    if ( iSelectedImages )
+        {
+        iSelectedImages->Close();
+        }
+
+    delete iSelectedImages;
+
+    if ( iSelectedMusic )
+        {
+        iSelectedMusic->Close();
+        }
+
+    delete iSelectedMusic;
+    delete iPlIdArray;
+    delete iCollIdArray;
+    delete iPlaylistNames;
+    delete iImageContainers;
+    delete iCollectionNames;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::IsItemSharedL()
+// Checks if album is shared earlier
+// --------------------------------------------------------------------------
+//
+TBool CUpnpSelectionReader::IsItemShared(
+            const TDesC& aItemName,
+            const CDesCArray& aIDArray ) const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt pos;
+    TBool retVal = !aIDArray.Find( aItemName, pos );
+
+    __LOG1( "CUpnpSelectionReader::IsItemSharedL returns %d",
+        retVal );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::FetchCollectionsL()
+// Fetch albums from Media Gallery for the listbox
+// --------------------------------------------------------------------------
+//
+void CUpnpSelectionReader::FetchCollectionsL( CDesCArray* 
+                                              aSettingsTextArray )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    if ( !aSettingsTextArray )
+        {
+        User::Leave( KErrGeneral );
+        }
+    // This is for IsItemSharedL
+    iMediaType = EImageAndVideo;
+
+    if( iSelectedImages )
+        {
+        iSelectedImages->Reset();
+        }
+    if( iCollIdArray )
+        {
+        iCollIdArray->Reset();
+        }
+    if( iCollectionNames )
+        {
+        iCollectionNames->Reset();
+        }
+
+    // Read shared albums
+    CDesCArray* sharedStuff = new (ELeave) CDesCArrayFlat( 
+        KDefaultStringArrGranularity );
+    CleanupStack::PushL( sharedStuff );
+
+    ReadSharedContainerIDsL( sharedStuff,
+                             EImageAndVideo );
+
+    // fill iCollIdArray
+    SearchCollectionsL();
+
+    // cycle trough albums to collect names to the listbox
+    for (TInt index = 0; index < iCollIdArray->MdcaCount(); index++)
+        {
+        HBufC16* albumName = HBufC16::NewL(KMaxFileName);
+        CleanupStack::PushL( albumName );
+
+        // create item string for listbox (icon + album name)
+        TPtrC16 collectionName = iCollectionNames->MdcaPoint( index );
+        albumName->Des().Format( KItemFormatString, &collectionName ); 
+
+        // append album name to the listbox
+        aSettingsTextArray->AppendL( albumName->Des() );
+
+        // check if album is shared earlier
+        if ( IsItemShared( iCollIdArray->MdcaPoint( index ), *sharedStuff ) )
+            {
+            //Index can't be '0' or '1' because there are predefined 
+            //selections such as "share nothing" and "share all" first.
+            iSelectedImages->AppendL( index + KPredefinedSelections );
+            }
+
+
+        CleanupStack::PopAndDestroy( albumName );
+        albumName = NULL;
+        }
+
+    GetVisualSharingStateL( iVisualSharingSelection );
+
+    if ( iVisualSharingSelection == EShareAll )
+       {
+        iSelectedImages->Reset();
+        // if all albums were shared mark only "share all"
+        iSelectedImages->AppendL( KShareAllIndex );
+        }
+    else if ( iVisualSharingSelection == EShareNone )
+        {
+        iSelectedImages->Reset();
+        // if no albums were shared mark only "share nothing"
+        iSelectedImages->AppendL( KShareNoneIndex );
+        }
+
+    iContainerCount = aSettingsTextArray->MdcaCount();
+
+    CleanupStack::PopAndDestroy( sharedStuff );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::FetchPlaylistsL()
+// Fetch playlists from Media Gallery for the listbox.
+// --------------------------------------------------------------------------
+//
+void CUpnpSelectionReader::FetchPlaylistsL( CDesCArray* aSettingsTextArray )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    if ( !aSettingsTextArray )
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    // This is for IsItemSharedL
+    iMediaType = EPlaylist;
+
+    if ( iSelectedMusic )
+        {
+        iSelectedMusic->Reset();
+        }
+
+    if ( iPlIdArray )
+        {
+        iPlIdArray->Reset();
+        }
+
+    if( iPlaylistNames )
+        {
+        iPlaylistNames->Reset();
+        }
+
+    // container where items will be added
+    CDesCArray* sharedStuff = new (ELeave) CDesCArrayFlat( 
+        KDefaultStringArrGranularity );
+    CleanupStack::PushL( sharedStuff );
+
+    // Read previously shared playlist ids for calculating indexes
+    ReadSharedContainerIDsL( sharedStuff,
+                             EPlaylist );
+
+    // search .m3u files put them to iPlIdArray
+    SearchPlaylistFilesL();
+
+    for ( TInt fileIndex = 0; 
+          fileIndex < iPlIdArray->MdcaCount(); fileIndex++ )
+        {
+        HBufC16* listboxItem = HBufC16::NewL(KMaxFileName);
+        CleanupStack::PushL(listboxItem);
+
+        TPtrC itemName( iPlaylistNames->MdcaPoint( fileIndex ) );
+
+        TBuf<KMaxFileName> nameBuf;
+        nameBuf.Copy( itemName );
+        listboxItem->Des().Format(KItemFormatString, &nameBuf );
+        aSettingsTextArray->AppendL( listboxItem->Des() );
+
+        if ( IsItemShared( iPlIdArray->MdcaPoint( fileIndex ),
+                           *sharedStuff ) )
+            {
+            //Index can't be '0' or '1' because there are predefined 
+            //selections such as "share nothing" and "share all" first.
+            iSelectedMusic->AppendL( fileIndex + KPredefinedSelections );
+            }
+
+        CleanupStack::PopAndDestroy( listboxItem );
+        listboxItem = NULL;
+        }
+
+    GetMusicSharingStateL( iMusicSharingSelection );
+
+    if ( iMusicSharingSelection == EShareAll )
+        {
+        iSelectedMusic->Reset();
+        // if all albums were shared mark only "share all"
+        iSelectedMusic->AppendL( KShareAllIndex );
+        }
+    else if ( iMusicSharingSelection == EShareNone )
+        {
+        iSelectedMusic->Reset();
+        // if no albums were shared mark only "share nothing"
+        iSelectedMusic->AppendL( KShareNoneIndex );
+        }
+    iContainerCount = aSettingsTextArray->MdcaCount();
+    CleanupStack::PopAndDestroy( sharedStuff );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::SearchPlaylistFilesL()
+// Search playlist files
+// --------------------------------------------------------------------------
+//
+TBool CUpnpSelectionReader::SearchPlaylistFilesL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    CUPnPPlaylistServices* playlists = CUPnPPlaylistServices::NewL();
+    CleanupStack::PushL( playlists );
+    
+    playlists->ListPlaylistsL( *iPlIdArray, *iPlaylistNames );
+    // for debugging
+
+#ifdef _DEBUG
+    __LOG("CUpnpSelectionReader: Checking playlist validity.");
+    for ( TInt i(0); i<iPlIdArray->MdcaCount(); i++ )
+        {
+        TBool valid(EFalse);
+        TRAPD( err, valid = playlists->IsValidPlaylistL( 
+                   iPlaylistNames->MdcaPoint(i) ));
+        if ( !err )
+            {
+            TPtrC id( iPlIdArray->MdcaPoint(i) );
+            __LOG3("Playlist[%d] %S IsValid: %d",
+                i, &id, valid );
+            }
+        }
+#endif
+    CleanupStack::PopAndDestroy( playlists );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return ETrue;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::SearchCollectionsL
+// fill iCollIdArray
+// --------------------------------------------------------------------------
+//
+TBool CUpnpSelectionReader::SearchCollectionsL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    CUPnPAlbumServices* albums = CUPnPAlbumServices::NewL();
+    CleanupStack::PushL( albums );
+    
+    albums->ListAlbumsL( *iCollIdArray, *iCollectionNames );
+
+#ifdef _DEBUG
+    __LOG("CUpnpSelectionReader: Checking album validity.");
+    for ( TInt i(0); i<iCollIdArray->MdcaCount(); i++ )
+        {
+        TBool valid(EFalse);
+        TRAPD( err, valid = albums->IsValidAlbumL( 
+                   iCollectionNames->MdcaPoint(i) ));
+        if ( !err )
+            {
+            TPtrC id( iCollIdArray->MdcaPoint(i) );
+            __LOG3("Album[%d] %S IsValid: %d",
+                i, &id, valid );
+            }
+        }
+#endif
+    CleanupStack::PopAndDestroy( albums );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return ETrue;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::ReadSharedContainerIDsL
+// Reads shared container IDs from file
+// --------------------------------------------------------------------------
+//
+TInt CUpnpSelectionReader::ReadSharedContainerIDsL(
+    CDesCArray* aArray,
+    const TUpnpMediaType& aContainerType ) const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    // Leave if NULL
+    if ( !aArray )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    RFs fs;
+    RFile file;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL(fs);
+
+    TInt error = KErrNone;
+
+    if ( aContainerType == EImageAndVideo )
+        {
+        error = file.Open(fs, KVisualFile, EFileRead );
+        }
+    else if ( aContainerType == EPlaylist )
+        {
+        error = file.Open(fs, KMusicFile, EFileRead );
+        }
+    else
+        {
+        // Not valid container type
+        error = KErrNotFound;
+        }
+
+    if ( error == KErrNone )
+        {
+        CleanupClosePushL( file );
+        RFileReadStream readStream( file );
+        CleanupClosePushL( readStream );
+
+        HBufC* collectionName = HBufC::NewL(KMaxFileName);
+        CleanupStack::PushL( collectionName );
+        TPtr collection = collectionName->Des();
+
+        do
+            {
+            TRAPD(err, readStream >> collection); //leaves when eof
+            if (err)
+                {
+                error = err;
+                }
+            else
+                {
+                aArray->AppendL(collection);
+                }
+
+            }  while(error == KErrNone); // end of file
+
+        CleanupStack::PopAndDestroy( collectionName );
+        CleanupStack::PopAndDestroy( &readStream ); // Close readStream
+        CleanupStack::PopAndDestroy( &file ); // Close file
+        }
+
+     CleanupStack::PopAndDestroy( &fs );
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return error;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::GetSelectionIndexesL
+// Reads shared container IDs from file
+// --------------------------------------------------------------------------
+//
+void CUpnpSelectionReader::GetSelectionIndexesL(
+    RArray<TInt>& aSelections,
+    const TUpnpMediaType& aType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    RArray<TInt>* list( NULL );
+    if ( aType == EImageAndVideo )
+        {
+        if ( !iSelectedImages )
+            {
+
+            iImageContainers->Reset();
+            FetchCollectionsL( iImageContainers );
+            iImageContainers->Reset();
+            }
+        else if ( !iImageContainers )
+            {
+            iImageContainers = new (ELeave) CDesCArrayFlat( 
+                KDefaultStringArrGranularity );
+            FetchCollectionsL( iImageContainers );
+            }
+        else 
+            {
+            FetchCollectionsL( iImageContainers );
+            }
+            
+        list = iSelectedImages;
+        }
+    else
+        {
+        if ( !iSelectedMusic )
+            {
+            iPlaylistNames->Reset();
+            FetchPlaylistsL( iPlaylistNames );
+            iPlaylistNames->Reset();
+            }
+        else if ( iPlaylistNames )
+            {
+            iPlaylistNames = new (ELeave) 
+                CDesCArrayFlat( KDefaultStringArrGranularity );
+            FetchPlaylistsL( iPlaylistNames );
+            }
+        else 
+            {
+            FetchPlaylistsL( iPlaylistNames );
+            }
+        
+        list = iSelectedMusic;
+        }
+
+    for ( TInt i(0); i< list->Count(); i++ )
+        {
+        aSelections.AppendL( list->operator[]( i ) );
+        }
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::GetVisualSharingStateL
+// (other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpSelectionReader::GetVisualSharingStateL( TInt& aShareAllState )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CRepository* rep = CRepository::NewL( KCrUidUpnpContentserver );
+    CleanupStack::PushL( rep );
+    TInt err( rep->Get( KUPnPAppShareAllVisualFiles, aShareAllState ));
+    CleanupStack::PopAndDestroy( rep );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::GetMusicSharingStateL
+// (other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpSelectionReader::GetMusicSharingStateL( TInt& aShareAllState )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CRepository* rep = CRepository::NewL( KCrUidUpnpContentserver );
+    CleanupStack::PushL( rep );
+    TInt err( rep->Get( KUPnPAppShareAllMusicFiles, aShareAllState ));
+    CleanupStack::PopAndDestroy( rep );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::GetContainerCount
+// (other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpSelectionReader::GetContainerCount() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return iContainerCount;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::PlayListIdsL
+// (other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpSelectionReader::PlayListIdsL( CDesCArray& aPlaylistIds, 
+                                        CDesCArray& aPlaylistNames )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt err( KErrNone );
+    if ( iPlIdArray && iPlaylistNames )
+        {
+        for ( TInt i(0); i < iPlIdArray->MdcaCount(); i++ )
+            {
+            aPlaylistIds.AppendL( iPlIdArray->MdcaPoint( i ) );
+            aPlaylistNames.AppendL( iPlaylistNames->MdcaPoint( i ) );
+            }
+        }
+    else
+        {
+        err = KErrGeneral;
+        }
+    
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::CollectionIdsL
+// (other items are commented in header )
+// --------------------------------------------------------------------------
+//
+TInt CUpnpSelectionReader::CollectionIdsL( CDesCArray& aCollectionIds,
+                                             CDesCArray& aCollectionNames )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt err( KErrNone );
+    if ( iCollIdArray && iCollectionNames )
+        {
+        for ( TInt i(0); i < iCollIdArray->MdcaCount(); i++ )
+            {
+            aCollectionIds.AppendL( iCollIdArray->MdcaPoint( i ) );
+            aCollectionNames.AppendL( iCollectionNames->MdcaPoint( i ) );
+            }
+        }
+    else
+        {
+        err = KErrGeneral;
+        }
+    
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionReader::SetMetadata
+// (other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpSelectionReader::SetMetadata( CUpnpContentMetadataUtility*
+    aMetaData )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iMetadataUtility = aMetaData;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpselectionwriter.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpSelectionWriter class implementation
+ *
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+
+#include <upnpstring.h>
+#include <centralrepository.h>
+#include <s32file.h>
+
+#include "upnpselectionwriter.h"
+#include "upnpcontentservercrkeys.h"
+#include "upnpcontentserverdefs.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+using namespace UpnpContentServer;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionWriter::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpSelectionWriter* CUpnpSelectionWriter::NewL(
+    TUpnpMediaType aMediaType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    CUpnpSelectionWriter* self =
+        new(ELeave) CUpnpSelectionWriter();
+
+    CleanupStack::PushL(self);
+    self->ConstructL( aMediaType );
+    CleanupStack::Pop(self);
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionWriter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUpnpSelectionWriter::ConstructL(
+    TUpnpMediaType aMediaType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iMediaType = aMediaType;
+
+    iFileArray = new (ELeave) CDesCArrayFlat(4);
+    iOkItems.Reset();
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionWriter::CUpnpSelectionWriter
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpSelectionWriter::CUpnpSelectionWriter()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionWriter::CUpnpSelectionWriter
+// C++ default destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpSelectionWriter::~CUpnpSelectionWriter()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    delete iFileArray;
+    iOkItems.Reset();
+    delete iRepository;
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionWriter::AppendItemL
+// ( other items were commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpSelectionWriter::AppendItemL( const TPtrC aNewObject)
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iFileArray->AppendL( aNewObject  );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionWriter::AppendStatusL
+// ( other items were commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpSelectionWriter::AppendStatusL( TInt aIndex )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iOkItems.AppendL( aIndex  );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSelectionWriter::SaveSharingState
+// Saves sharing state to central repository
+// --------------------------------------------------------------------------
+//
+TInt CUpnpSelectionWriter::SaveSharingStateL( TInt aShareAllSelection )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt status = KErrNone;
+    iRepository = CRepository::NewL( KCrUidUpnpContentserver );
+    switch ( iMediaType )
+        {
+    case EImageAndVideo:
+        {
+        if (aShareAllSelection == EShareAll ||
+            aShareAllSelection == EShareNone ||
+            aShareAllSelection == EShareMany )
+            {
+            status = iRepository->Set( KUPnPAppShareAllVisualFiles,
+                                       aShareAllSelection);
+            }
+        break;
+        }
+    case EPlaylist:
+        {
+        if (aShareAllSelection == EShareAll ||
+            aShareAllSelection == EShareNone ||
+            aShareAllSelection == EShareMany )
+            {
+            status = iRepository->Set( KUPnPAppShareAllMusicFiles,
+                                       aShareAllSelection);
+            }
+        break;
+        }
+    default:
+        {
+        __LOG( "SaveSharingStateL - default");
+        break;
+        }
+        }
+
+    delete iRepository;
+    iRepository = NULL;
+
+    // Store the item array
+    if ( aShareAllSelection == EShareMany )
+        {
+        StoreSharedContainerIDsL();
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return status;
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPFileSharingEngine::StoreSharedContainerIDsL
+// Creates main containers and starts sharing them
+// --------------------------------------------------------------------------
+//
+TInt CUpnpSelectionWriter::StoreSharedContainerIDsL() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    // Leave if aIdArray = NULL
+    if ( !iFileArray )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    RFs fs;
+    RFile file;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL(fs);
+
+    TFileName directory;
+
+    // Get private directory path
+    fs.SessionPath(directory);
+
+    // Try to create directory
+    TInt error = fs.MkDir(directory);
+    // it's ok if directory already exists
+    if (!(error != KErrNone && error != KErrAlreadyExists))
+        {
+
+        // Add file name
+        if ( iMediaType == EImageAndVideo )
+            {
+            directory.Append( KVisualFile );
+            }
+        else if ( iMediaType == EPlaylist )
+            {
+            directory.Append( KMusicFile );
+            }
+
+        error = file.Replace(fs, directory, EFileWrite );
+        if ( !error )
+            {
+            CleanupClosePushL( file );
+            RFileWriteStream writeStream(file);
+            CleanupClosePushL( writeStream );
+
+            for (TInt index = 0; index < iFileArray->Count(); index++)
+                {
+                // check that sharing of the container was succesful
+                if ( iOkItems.Find( index ) != KErrNotFound )
+                    {
+                    // Write identifiers to the file
+                    writeStream << iFileArray->MdcaPoint(index);
+                    }
+                }
+
+            // Clean up
+            CleanupStack::PopAndDestroy(&writeStream); // Close writeStream
+            CleanupStack::PopAndDestroy(&file); // Close file
+            }
+        }
+    CleanupStack::PopAndDestroy(&fs);
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return error;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpsharingrequest.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpSharingRequest class implementation
+*
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpsharingrequest.h"
+#include "upnpcontentserverdefs.h"
+
+const TInt KDefaultItemCount = 2^32; //4294967296
+
+using namespace UpnpContentServer;
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// CUpnpSharingRequest::CUpnpSharingRequest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+
+CUpnpSharingRequest::CUpnpSharingRequest( TInt aKind )
+    {
+    iKind = aKind;
+    iItemCount = KDefaultItemCount;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSharingRequest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// --------------------------------------------------------------------------
+//
+void CUpnpSharingRequest::ConstructL( const RArray<TInt>& aArr, 
+                                      CDesCArray* aIdArray,
+                                      CDesCArray* aNameArray )
+    {
+    for ( TInt i(0); i<aArr.Count();i++ )
+        {
+        iSelections.AppendL( aArr[ i ] );
+        }
+    iObjectIds = aIdArray; // transfer ownership
+    iObjectNames = aNameArray;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSharingRequest::NewL
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+//
+CUpnpSharingRequest* CUpnpSharingRequest::NewL(
+    TInt aKind,
+    const RArray<TInt>& aArr,
+    CDesCArray* aIdArray,
+    CDesCArray* aNameArray )
+    {
+    CUpnpSharingRequest* self = new (ELeave) CUpnpSharingRequest( aKind );
+    CleanupStack::PushL( self );
+    self->ConstructL( aArr,
+                      aIdArray,
+                      aNameArray );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpSharingRequest::NewL
+// Destructor
+// --------------------------------------------------------------------------
+// 
+CUpnpSharingRequest::~CUpnpSharingRequest()
+    {
+    iSelections.Close();
+    delete iObjectIds;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpcontentserver/src/upnpunsharerao.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,669 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      CUpnpUnsharerAo class implementation
+ *
+*/
+
+
+
+
+
+
+
+// INCLUDE FILES
+#include "upnpdlnaprofiler.h"
+#include "upnpcdsreselementutility.h"
+#include "upnpcommonutils.h"
+#include <upnpelement.h>
+
+#include "upnpunsharerao.h"
+
+_LIT( KComponentLogfile, "contentserver.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+const TInt KDefaultBrowseReqCount( 20 );
+const TInt KDefaultBrowseStartingInd( 0 );
+
+using namespace UpnpContentServer;
+
+// ============================ MEMBER FUNCTIONS ============================
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::CUpnpUnsharerAo
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// --------------------------------------------------------------------------
+//
+CUpnpUnsharerAo::CUpnpUnsharerAo( MUpnpSharingCallback* aCallback,
+                                  TInt aPriority )
+    : CActive( aPriority ),
+      iCallback( aCallback )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iTotalItems = KErrNotFound;
+    iAllTotalItems = 0;
+    CActiveScheduler::Add( this );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::~CUpnpUnsharerAo()
+// C++ destructor.
+// --------------------------------------------------------------------------
+//
+CUpnpUnsharerAo::~CUpnpUnsharerAo()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    delete iFileSharing;
+    iFileSharing = NULL;
+    iMediaServer.Close();
+
+    if ( IsActive() )
+        {
+        __LOG1("IsActive: true  iCurrentOperation: %d", iCurrentOperation );
+        iCurrentOperation = ENotActive;
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, KErrNone );
+        }
+
+    Cancel();
+
+    Cleanup();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::RunL
+// Called when asyncronous request is ready
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::RunL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( iStatus.Int() == KErrCorrupt ||
+        iStatus.Int() == KErrNoMemory ||
+        iStatus.Int() == KErrDiskFull )
+        {
+        iCurrentOperation = ENotActive;
+        }
+
+    if ( iStopRequested == MUpnpSharingCallback::ESharingPause )
+        {
+        delete iFileSharing;
+        iFileSharing = NULL;
+        iFileSharing = CUpnpFileSharing::NewL();
+        iStopRequested = MUpnpSharingCallback::ESharingNoStop;
+        }
+
+    switch ( iCurrentOperation )
+        {
+    case EInitialize :
+        {
+        TInt err( InitializeL( iUpContainer ) );
+        if ( !err )
+            {
+            QueryContainersFromMediaServerL( iUpContainer );
+            }
+        else
+            {
+            iCurrentOperation = ENotActive;
+            SelfComplete( KErrNone );
+            }
+        }
+        break;
+    case EQueryContainersFromMediaServer :
+        {
+        QueryContainersFromMediaServerL( iCurrentContainerId );
+        }
+        break;
+    case EQueryContainersFromMediaServerResult :
+        {
+        QueryContainersFromMediaServerResultL();
+        }
+        break;
+    case EQueryItemsFromMediaServer :
+        {
+        QueryContainerItemsL( iCurrentContainerId );
+        }
+        break;
+    case EUnshareItemList:
+        {
+        UnshareItemListL();
+        }
+        break;
+    case EQueryItemsFromMediaServerResult :
+        {
+        QueryContainerItemsResultL();
+        }
+        break;
+    case EUnshareContainer :
+        {
+        UnshareContainerL();
+        }
+        break;
+    case EUnshareContainerResult :
+        {
+        UnshareContainerResultL();
+        }
+        break;
+    case ENotActive :
+        {
+        Cleanup();
+        if ( iCallback )
+            {
+            iCallback->CompleteSharingOperationL( iStatus.Int(), 0 );
+            }
+        }
+        break;
+    default :
+        break;
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::DoCancel
+// Cancels active object
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::DoCancel()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // NOTE: The cancelling of mediaserver request must be made in destructor
+    // because there is no cancel in CUpnpFileSharing
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::RunError
+// Handle leaves
+// --------------------------------------------------------------------------
+//
+TInt CUpnpUnsharerAo::RunError( TInt aError )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    TInt ret( KErrNone );
+    if ( aError == KErrNoMemory ||
+         aError == KErrDiskFull ||
+         aError == KErrCorrupt )
+        {
+        iCurrentOperation = ENotActive;
+        SelfComplete( aError );
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::QueryContainersFromMediaServerL
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::QueryContainersFromMediaServerL( TInt aId )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC();
+    browseCriteria->SetStartingIndex( iContainerBrowsePosition );
+
+    if ( iContainerList )
+        {
+        delete iContainerList;
+        iContainerList = NULL;
+        }
+    iContainerList = CUpnpContainerList::NewL();
+
+    // Get shared containers to iContainerList
+    iFileSharing->GetSharedContainerListL( aId,
+                                           *browseCriteria,
+                                           *iContainerList,
+                                           iTotalContainers,
+                                           iStatus );
+    iCurrentOperation = EQueryContainersFromMediaServerResult;
+    CleanupStack::PopAndDestroy( browseCriteria );
+    SetActive();
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::QueryContainersFromMediaServerResultL
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::QueryContainersFromMediaServerResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpContainer* nextContainer( NULL );
+    TInt containerCount( iContainerList->ObjectCount() );
+    if ( containerCount )
+        {
+        // there are subcontainers -> store them and query if they
+        // have subcontainers
+        iContainerLists.AppendL( iContainerList ); //Transfer ownership
+        // check if we neet to get containers in segments
+
+        if ( iContainerBrowsePosition + containerCount 
+             >= iTotalContainers )
+            {
+            // all segments queried
+            // next container under processing is always last in the list
+            nextContainer =
+                static_cast< CUpnpContainer* >(
+                    iContainerList->operator[](
+                        containerCount - 1 ) );
+            iCurrentContainerId = UPnPCommonUtils::DesC8ToInt(
+                nextContainer->Id());
+            iContainerList = NULL;
+            iContainerBrowsePosition = 0;
+            }
+        else
+            {
+            __LOG("CUpnpUnsharerAo: retrieving next segment");
+            // set the starting position for retrieving next segment
+            iContainerBrowsePosition += KDefaultBrowseReqCount;
+            iContainerList = NULL;
+            }
+
+        iCurrentOperation = EQueryContainersFromMediaServer;
+        }
+    else
+        {
+        // no subcontainers -> query the items
+        if ( iContainerLists.Count() )
+            {
+            CUpnpContainerList* contList =
+                iContainerLists[ iContainerLists.Count()-1 ];
+            nextContainer =
+                static_cast< CUpnpContainer* >(
+                    contList->operator[](
+                        contList->ObjectCount() - 1 ) );
+            iCurrentContainerId = UPnPCommonUtils::DesC8ToInt(
+                nextContainer->Id() );
+            // there should be at least the initial container
+            iCurrentOperation = EQueryItemsFromMediaServer;
+
+            delete iContainerList;
+            iContainerList = NULL;
+
+            iCurrentOperation  = EQueryItemsFromMediaServer;
+
+            }
+        else
+            {
+            // error: no initial container
+            iCurrentOperation  = ENotActive;
+
+            }
+        }
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::QueryContainerItemsL
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::QueryContainerItemsL( TInt aId )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    delete iItemList;
+    iItemList = NULL;
+    iItemList = CUpnpItemList::NewL();
+    if ( !iFileSharing )
+        {
+        User::Leave( KErrGeneral );
+        }
+    CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC();
+    if ( iTotalItems == KErrNotFound )
+        {
+        iFileSharing->GetSharedItemListL (
+            aId, *browseCriteria,
+            *iItemList, iTotalItems, iStatus );
+
+        if ( iTotalItems > 0 )
+            {
+            iAllTotalItems += iTotalItems;
+            }
+        }
+    else
+        {
+        TInt tmp( 0 );
+        iFileSharing->GetSharedItemListL (
+            aId, *browseCriteria,
+            *iItemList, tmp, iStatus );
+
+        if ( tmp > 0 )
+            {
+            iAllTotalItems += tmp;
+            }
+        }
+    iCurrentOperation = EQueryItemsFromMediaServerResult;
+    CleanupStack::PopAndDestroy( browseCriteria );
+    SetActive();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::QueryContainerItemsResultL
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::QueryContainerItemsResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    if ( !iItemList )
+        {
+        User::Leave( KErrGeneral );
+        }
+    TInt objCount( iItemList->ObjectCount() );
+    if ( objCount && ( iExecStatus < iTotalItems ) )
+        {
+        // unshare the items in parts
+        iCurrentOperation = EUnshareItemList;
+        
+        }
+    else
+        {
+        // the container iCurrentContainerId is empty -> unshare it unless it
+        // is the container received at the start
+
+        if ( iContainerLists.Count() > 1 )
+            {
+            iCurrentOperation = EUnshareContainer;
+            }
+        else
+            {
+            // all done
+            iCurrentOperation = ENotActive;
+            }
+        }
+
+    if ( iExecStatus > 0  )
+        {
+        iCallback->SetProgressL( iExecStatus );
+        }
+
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::UnshareItemListL
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::UnshareItemListL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    iExecStatus += iItemList->ObjectCount();
+    iFileSharing->UnshareItemListL( *iItemList, iUnsharePosition, iStatus );
+
+    delete iItemList;
+    iItemList = NULL;
+    iCurrentOperation = EQueryItemsFromMediaServer;
+    SetActive();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::UnshareContainerL
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::UnshareContainerL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iFileSharing->UnshareContainerL( iCurrentContainerId, iStatus );
+    iCurrentOperation = EUnshareContainerResult;
+    iExecStatus = 0;
+    iTotalItems = KErrNotFound;
+    SetActive();
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::UnshareContainerResultL
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::UnshareContainerResultL()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    if ( iContainerLists.Count() )
+        {
+        // one container is now fully handled -> remove from list of
+        // containers
+        CUpnpContainerList* contList =
+            iContainerLists[ iContainerLists.Count()-1 ];
+        // note: iCurrentContainerId is always last in the list
+        contList->RemoveAndDestroy( *UPnPCommonUtils::IntToDesC8LC(
+            iCurrentContainerId ) );
+        CleanupStack::PopAndDestroy(); // UPnPCommonUtils::IntToDesC8LC
+        if ( contList->ObjectCount() )
+            {
+            // get the next container ( last of the list ) to process
+            TInt nextPos = contList->ObjectCount() - 1;
+            CUpnpContainer* nextContainer = static_cast< CUpnpContainer* >(
+                contList->operator[]( nextPos ));
+            iCurrentContainerId = UPnPCommonUtils::DesC8ToInt(
+                nextContainer->Id());
+            // Restart cycle: query if it has subcontainers
+            iCurrentOperation = EQueryContainersFromMediaServer;
+
+            }
+        else
+            {
+            // one directory hierarchy is empty
+            CUpnpContainerList* removeList = iContainerLists[
+                iContainerLists.Count()-1 ];
+            iContainerLists.Remove( iContainerLists.Count()-1 );
+            delete removeList;
+            if ( iContainerLists.Count() )
+                {
+                // go back in containerlists
+                contList =
+                    iContainerLists[ iContainerLists.Count()-1 ];
+                TInt backPos( contList->ObjectCount() - 1 );
+                CUpnpContainer* nextContainer =
+                    static_cast< CUpnpContainer* >(
+                        contList->operator[]( backPos ));
+                iCurrentContainerId = UPnPCommonUtils::DesC8ToInt(
+                    nextContainer->Id() );
+                // Restart cycle: query if it has items
+                // no need to query containers
+                iCurrentOperation = EQueryItemsFromMediaServer;
+
+                }
+            else
+                {
+                // all done
+                iCurrentOperation = ENotActive;
+                }
+            }
+        }
+    else
+        {
+        // all done
+        iCurrentOperation = ENotActive;
+        }
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::EmptyContainer
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+TInt CUpnpUnsharerAo::EmptyContainer( TInt& aContainerId )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+
+    TInt err( KErrNotFound );
+
+    iUpContainer = aContainerId;
+    iCurrentContainerId = aContainerId;
+    iCurrentOperation = EInitialize;
+    SelfComplete( KErrNone );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return err;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::RequestStop
+// ( other items are commented in header )
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::RequestStop(
+    MUpnpSharingCallback::TSharingStopType aStopType )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iStopRequested = aStopType;
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::InitializeL
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+TInt CUpnpUnsharerAo::InitializeL( TInt& aContainerId )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    // First initialize resources
+    iFileSharing = CUpnpFileSharing::NewL();
+    TInt error( iMediaServer.Connect() );
+    if ( !error )
+        {
+        // start offline if not started
+        TInt status( RUpnpMediaServerClient::EStopped );
+        iMediaServer.Status( status );
+        if ( status == RUpnpMediaServerClient::EStopped )
+            {
+            error = iMediaServer.StartOffline();
+            }
+        if ( !error )
+            {
+            CUpnpContainerList* beginList = CUpnpContainerList::NewLC();
+            CUpnpContainer* beginContainer = CUpnpContainer::NewL();
+            CleanupStack::PushL( beginContainer );
+            beginContainer->SetIdL(
+                *UPnPCommonUtils::IntToDesC8LC( aContainerId ) );
+            CleanupStack::PopAndDestroy(); // IntToDesC8LC
+            beginList->AppendObjectL( *beginContainer ); //Transfer ownership
+            CleanupStack::Pop( beginContainer );
+            iContainerLists.AppendL( beginList ); //Transfer ownership
+            CleanupStack::Pop( beginList );
+            }
+        }
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return error;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::CreateBrowseCriteriaLC
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+CUpnpBrowseCriteria* CUpnpUnsharerAo::CreateBrowseCriteriaLC() const
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    CUpnpBrowseCriteria* browseCriteria = CUpnpBrowseCriteria::NewLC();
+    browseCriteria->SetRequestedCount( KDefaultBrowseReqCount );
+    browseCriteria->SetStartingIndex( KDefaultBrowseStartingInd );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    return browseCriteria;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::SelfComplete
+// Complete own request
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::SelfComplete( TInt aError )
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    SetActive();
+    TRequestStatus* stat = &iStatus;
+    User::RequestComplete( stat, aError );
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::Cleanup
+// (other items are commented in header)
+// --------------------------------------------------------------------------
+//
+void CUpnpUnsharerAo::Cleanup()
+    {
+    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
+    iExecStatus = 0;
+    iTotalItems = KErrNotFound;
+    iTotalContainers = KErrNotFound;
+    iContainerBrowsePosition = 0;
+
+    iCurrentContainerId = KErrNotFound;
+    iUpContainer = KErrNotFound;
+    iStopRequested = MUpnpSharingCallback::ESharingNoStop;
+
+    delete iItemList;
+    iItemList = NULL;
+    delete iContainerList;
+    iContainerList = NULL;
+
+    iContainerLists.ResetAndDestroy();
+
+    iCurrentOperation = ENotActive;
+
+    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::UnSharingProgress
+// (the usage in header)
+// --------------------------------------------------------------------------
+//
+TInt CUpnpUnsharerAo::UnSharingProgress( ) 
+    { 
+    TInt progress( 0 );
+    if ( iExecStatus >= 0 )
+        {
+        progress = iExecStatus;
+        }
+    return progress;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpUnsharerAo::TotalItemsForUnShare
+// (the usage in header)
+// --------------------------------------------------------------------------
+//
+TInt CUpnpUnsharerAo::TotalItemsForUnShare( ) 
+    {
+    TInt items( 0 );
+    if ( iTotalItems >= 0 )
+        {
+        items = iTotalItems;
+        }
+    return items;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/bwins/dlnaprofilerU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,18 @@
+EXPORTS
+	?DurationL@CUpnpResParameters@@QBEPAVHBufC8@@XZ @ 1 NONAME ; class HBufC8 * CUpnpResParameters::DurationL(void) const
+	?FileSizeL@CUpnpResParameters@@QBEPAVHBufC8@@XZ @ 2 NONAME ; class HBufC8 * CUpnpResParameters::FileSizeL(void) const
+	?GetResParametersL@CUpnpResResolver@@QAEPAVCUpnpResParameters@@ABVTDesC16@@@Z @ 3 NONAME ; class CUpnpResParameters * CUpnpResResolver::GetResParametersL(class TDesC16 const &)
+	?IsAudioOrVideoFile@CUpnpResParameters@@QBEHXZ @ 4 NONAME ; int CUpnpResParameters::IsAudioOrVideoFile(void) const
+	?IsImageFile@CUpnpResParameters@@QBEHXZ @ 5 NONAME ; int CUpnpResParameters::IsImageFile(void) const
+	?NewL@CUpnpDlnaProfiler@@SAPAV1@XZ @ 6 NONAME ; class CUpnpDlnaProfiler * CUpnpDlnaProfiler::NewL(void)
+	?NewL@CUpnpResParameters@@SAPAV1@XZ @ 7 NONAME ; class CUpnpResParameters * CUpnpResParameters::NewL(void)
+	?NewL@CUpnpResResolver@@SAPAV1@XZ @ 8 NONAME ; class CUpnpResResolver * CUpnpResResolver::NewL(void)
+	?NewLC@CUpnpDlnaProfiler@@SAPAV1@XZ @ 9 NONAME ; class CUpnpDlnaProfiler * CUpnpDlnaProfiler::NewLC(void)
+	?NewLC@CUpnpResParameters@@SAPAV1@XZ @ 10 NONAME ; class CUpnpResParameters * CUpnpResParameters::NewLC(void)
+	?NewLC@CUpnpResResolver@@SAPAV1@XZ @ 11 NONAME ; class CUpnpResResolver * CUpnpResResolver::NewLC(void)
+	?ProfileForFileL@CUpnpDlnaProfiler@@QAEPAVHBufC16@@ABVTDesC16@@@Z @ 12 NONAME ; class HBufC16 * CUpnpDlnaProfiler::ProfileForFileL(class TDesC16 const &)
+	?ProfileForFileL@CUpnpDlnaProfiler@@QAEPAVHBufC16@@ABVTDesC16@@AAVRFile@@AAVCUpnpResParameters@@@Z @ 13 NONAME ; class HBufC16 * CUpnpDlnaProfiler::ProfileForFileL(class TDesC16 const &, class RFile &, class CUpnpResParameters &)
+	?ProtocolInfo@CUpnpResParameters@@QBEABVTDesC8@@XZ @ 14 NONAME ; class TDesC8 const & CUpnpResParameters::ProtocolInfo(void) const
+	?ResolutionL@CUpnpResParameters@@QBEPAVHBufC8@@XZ @ 15 NONAME ; class HBufC8 * CUpnpResParameters::ResolutionL(void) const
+	?SupportedProfilesL@CUpnpDlnaProfiler@@QBEHPAVCDesC16ArrayFlat@@@Z @ 16 NONAME ; int CUpnpDlnaProfiler::SupportedProfilesL(class CDesC16ArrayFlat *) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/eabi/dlnaprofilerU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,24 @@
+EXPORTS
+	_ZN16CUpnpResResolver17GetResParametersLERK7TDesC16 @ 1 NONAME
+	_ZN16CUpnpResResolver4NewLEv @ 2 NONAME
+	_ZN16CUpnpResResolver5NewLCEv @ 3 NONAME
+	_ZN17CUpnpDlnaProfiler15ProfileForFileLERK7TDesC16 @ 4 NONAME
+	_ZN17CUpnpDlnaProfiler4NewLEv @ 5 NONAME
+	_ZN17CUpnpDlnaProfiler5NewLCEv @ 6 NONAME
+	_ZN18CUpnpResParameters4NewLEv @ 7 NONAME
+	_ZN18CUpnpResParameters5NewLCEv @ 8 NONAME
+	_ZNK17CUpnpDlnaProfiler18SupportedProfilesLEP16CDesC16ArrayFlat @ 9 NONAME
+	_ZNK18CUpnpResParameters11IsImageFileEv @ 10 NONAME
+	_ZNK18CUpnpResParameters11ResolutionLEv @ 11 NONAME
+	_ZNK18CUpnpResParameters12ProtocolInfoEv @ 12 NONAME
+	_ZNK18CUpnpResParameters18IsAudioOrVideoFileEv @ 13 NONAME
+	_ZNK18CUpnpResParameters9DurationLEv @ 14 NONAME
+	_ZNK18CUpnpResParameters9FileSizeLEv @ 15 NONAME
+	_ZTI16CUpnpResResolver @ 16 NONAME ; #<TI>#
+	_ZTI17CUpnpDlnaProfiler @ 17 NONAME ; #<TI>#
+	_ZTI18CUpnpResParameters @ 18 NONAME ; #<TI>#
+	_ZTV16CUpnpResResolver @ 19 NONAME ; #<VT>#
+	_ZTV17CUpnpDlnaProfiler @ 20 NONAME ; #<VT>#
+	_ZTV18CUpnpResParameters @ 21 NONAME ; #<VT>#
+	_ZN17CUpnpDlnaProfiler15ProfileForFileLERK7TDesC16R5RFileR18CUpnpResParameters @ 22 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Build information file for project upnpdlnaprofiler
+*
+*/
+
+
+
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/upnpresresolver.h       |../../../inc/upnpresresolver.h
+../inc/upnpdlnaprofiler.h      |../../../inc/upnpdlnaprofiler.h
+../inc/upnpresparameters.h     |../../../inc/upnpresparameters.h
+
+PRJ_MMPFILES
+dlnaprofiler.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/group/dlnaprofiler.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Project definition file for project DlnaProfiler
+*
+*/
+
+
+
+
+
+
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+#include "../../../inc/upnpframeworkfeatures_mmp.hrh"
+
+TARGET                  dlnaprofiler.dll
+TARGETTYPE              DLL
+UID                     0x1000008d 0x20007560
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+SOURCEPATH              ../src
+SOURCE                  upnpdlnaprofiler.cpp
+SOURCE                  upnpaudiosolverbase.cpp
+SOURCE                  upnpavsolverbase.cpp
+SOURCE                  upnpimagesolverbase.cpp
+SOURCE                  upnpresresolver.cpp
+SOURCE                  upnpresparameters.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 euser.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 apgrfx.lib 
+LIBRARY                 mediaclientaudio.lib
+LIBRARY                 apmime.lib
+LIBRARY                 imageconversion.lib // CImageDecoder
+LIBRARY                 bafl.lib // CDesC16ArrayFlat
+LIBRARY                 3gpmp4lib.lib
+LIBRARY                 inetprotutil.lib // EscapeUtils::ConvertFromUnicodeToUtf8L
+
+// From UPnP Stack
+LIBRARY                 upnpavobjects.lib // CUpnpDlnaProtocolInfo for S60 3.1. Not needed in S60 3.2 platform.
+LIBRARY                 upnpipserversutils.lib // CUpnpDlnaProtocolInfo for S60 3.2. Not needed in S60 3.1 platform.
+
+DEBUGLIBRARY            flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/inc/upnpaudiosolverbase.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Base DLNA profile resolver class for audio files.
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAUDIOSOLVERBASE_H
+#define C_UPNPAUDIOSOLVERBASE_H
+
+
+// system includes
+#include <mda/client/utility.h> // MMdaObjectStateChangeObserver
+#include <mda/common/audio.h> // TMdaFileClipLocation
+#include <mmf/common/mmfutilities.h> // TFourCC
+
+// user includes
+#include "upnpprofiler.h"
+
+// forward declarations
+class CMdaAudioConvertUtility;
+class TMdaFileClipLocation;
+
+// constants
+// NONE
+
+/**
+ *  Audio file DLNA profile base resolver class.
+ *
+ *  This class is the base class for resolving DLNA profile of audio files.
+ *  It contains methods for querying the profiles supported by this solver 
+ *  and for resolving a DLNA profile of a given audio file.
+ *
+ *
+ *  @lib dlnaprofiler.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CUpnpAudioSolverBase ) : 
+                                        public CBase,
+                                        public MUpnpProfiler, 
+                                        public MMdaObjectStateChangeObserver
+    {
+
+public:
+
+    static CUpnpAudioSolverBase* NewL();
+
+    static CUpnpAudioSolverBase* NewLC();
+
+    virtual ~CUpnpAudioSolverBase();
+
+// from base class MUpnpProfiler
+
+    /**
+     * From MUpnpProfiler.
+     * SupportedProfilesL returns DLNA profiles that are currently supported.
+     *
+     * @since S60 v3.1
+     * @param aProfiles Descriptor array where supported DLNA profiles are 
+     *                  added.
+     * @return TInt Error code, KErrNone if successfull.
+     */
+    TInt SupportedProfilesL( CDesC16ArrayFlat* aProfiles ) const;
+
+    /**
+     * From MUpnpProfiler.
+     * ProfileForFileL is for resolving a DLNA profile of a given file.
+     * Besides of file name, also mime type of the file is passed as a 
+     * parameter in order to avoid re-opening of the file.
+     *
+     * @since S60 v3.1
+     * @param aFileName Filename of the file which is to be resolved.
+     * @param aMimeType Mime type of the file which is to be resolved.
+     * @param aFile Handle to opened file specified by aFilename.
+     * @return DLNA profile of the file as a HBufC*, 
+     *         NULL if could not be resolved
+     */
+    HBufC* ProfileForFileL( const TDesC& aFilename, 
+                            const TDesC8& aMimetype, 
+                            RFile& aFile );
+
+private:
+
+    CUpnpAudioSolverBase();
+
+    void ConstructL();
+
+    /**
+     * GetAudioFileInformationL
+     *
+     * @since S60 v3.1
+     * @param aFileName Filename of the file which is to be resolved.
+     * @return Error code. KErrNone if successfull.
+     */
+    TInt GetAudioFileInformationL( const TDesC& aFilename );
+
+    
+// from base class MMdaObjectStateChangeObserver
+
+    /**
+     * From MMdaObjectStateChangeObserver.
+     * MoscoStateChangeEvent 
+     *
+     * @since S60 v3.1
+     * @param aObject
+     * @param aPreviousState
+     * @param aCurrentState
+     * @param aErrorCode
+     */
+    void MoscoStateChangeEvent( CBase *aObject, TInt aPreviousState, 
+                                TInt aCurrentState, TInt aErrorCode );
+
+    /**
+     * Determine3GppProfileL chooses the correct profile among supported 3gpp 
+     * profiles. The decision is made based on audio file attributes that 
+     * are stored in member variables of this class. 
+     *
+     * @since S60 v3.1
+     * @return HBufC*. Pointer to string descriptor containing the profile.
+     */
+    HBufC* Determine3GppProfileL() const;
+
+    /**
+     * DetermineWmaProfileL chooses the correct profile among supported wma 
+     * profiles. The decision is made based on audio file attributes that 
+     * are stored in member variables of this class. 
+     *
+     * @since S60 v3.1
+     * @return HBufC*. Ponter to string descriptor containing the profile.
+     */
+    HBufC* DetermineWmaProfileL() const;
+
+    /**
+     * DetermineMp4ProfileL chooses the correct profile among supported mp4 
+     * profiles. The decision is made based on audio file attributes that 
+     * are stored in member variables of this class. 
+     *
+     * @since S60 v3.1
+     * @return HBufC*. Pointer to string descriptor containing the profile.
+     */
+    HBufC* DetermineMp4ProfileL() const;
+
+private: // data
+    CMdaAudioConvertUtility*    iAudioconverter; // owned
+    CActiveSchedulerWait*       iWait; // owned
+    
+    // attributes related to audio file attributes. 
+    TUint iChannelCount;
+    TUint iSampleRate;
+    TUint iBitrate;
+    };
+
+#endif // C_UPNPAUDIOSOLVERBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/inc/upnpavsolverbase.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Base DLNA profile resolver class for av files.
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPAVSOLVERBASE_H
+#define C_UPNPAVSOLVERBASE_H
+
+
+// system includes
+#include <3gplibrary/mp4lib.h>
+
+// user includes
+#include "upnpprofiler.h"
+
+// forward declarations
+class CVideoRecorderUtility;
+
+// constants
+const TInt TMP4DecoderSpecificInfoSize = 16;
+
+// NONE
+
+/**
+ *  Av file DLNA profile base resolver class.
+ *
+ *  This class is the base class for resolving DLNA profile of av files.
+ *  It contains methods for querying the profiles supported by this solver 
+ *  and for resolving a DLNA profile of a given av file.
+ *
+ *
+ *  @lib dlnaprofiler.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CUpnpAvSolverBase ) : public CBase,
+                                         public MUpnpProfiler
+    {
+
+public:
+
+    static CUpnpAvSolverBase* NewL();
+
+    static CUpnpAvSolverBase* NewLC();
+
+    virtual ~CUpnpAvSolverBase();
+
+// from base class MUpnpProfiler
+
+    /**
+     * From MUpnpProfiler.
+     * SupportedProfilesL returns DLNA profiles that are currently supported.
+     *
+     * @since S60 v3.1
+     * @param aProfiles Descriptor array where supported DLNA profiles are 
+     *                  added.
+     * @return TInt Error code, KErrNone if successfull.
+     */
+    TInt SupportedProfilesL( CDesC16ArrayFlat* aProfiles ) const;
+
+    /**
+     * From MUpnpProfiler.
+     * ProfileForFileL is for resolving a DLNA profile of a given file.
+     * Besides of file name, also mime type of the file is passed as a 
+     * parameter in order to avoid re-opening of the file.
+     *
+     * @since S60 v3.1
+     * @param aFileName Filename of the file which is to be resolved.
+     * @param aMimeType Mime type of the file which is to be resolved.
+     * @param aFile Handle to opened file specified by aFilename
+     * @return DLNA profile of the file as a HBufC*, 
+     *         NULL if could not be resolved
+     */
+    HBufC* ProfileForFileL( const TDesC& aFilename, 
+                            const TDesC8& aMimetype,
+                            RFile& aFile );
+
+
+private:
+
+    CUpnpAvSolverBase();
+
+    void ConstructL();
+
+    /**
+     * GetVideoFileInformationL
+     *
+     * @since S60 v3.1
+     * @param aFileName Filename of the file which is to be resolved.
+     * @return Error code. KErrNone if successfull.
+     */
+    TInt GetVideoFileInformationL( RFile& aFile );
+
+    /**
+     * A generic data container to be used in parsing different
+     * MPEG4 codec headers
+     */
+    class TMP4DecoderSpecificInfo
+        {
+        public:
+            TUint32 iData[TMP4DecoderSpecificInfoSize];
+        };
+
+
+private: // data
+
+    // Type of video codec within the AV file
+    mp4_u32 iVideoType;
+
+    // Video resolution X size
+    mp4_u32 iVideoResolutionX;
+
+    // Video resolution Y size
+    mp4_u32 iVideoResolutionY;
+
+    mp4_double iVideoFramerate;
+
+    // Type of audio codec within the AV file
+    mp4_u32 iAudioType;
+
+    // stream bitrate
+    mp4_u32 iStreamAverageBitrate;
+
+    // codec-specific details
+    TMP4DecoderSpecificInfo iCodecInfo;
+
+    };
+
+#endif // C_UPNPAVSOLVERBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/inc/upnpdlnaprofiler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Header file of CUpnpDlnaProfiler class. CUpnpDlnaProfiler is 
+*                a class used for resolving a DLNA profile of a given file.
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPDLNAPROFILER_H
+#define C_UPNPDLNAPROFILER_H
+
+// system includes
+#include <e32base.h>
+
+// user includes
+// NONE
+
+// forward declarations
+class MUpnpProfiler;
+class RFile;
+class CDesC16ArrayFlat;
+class CUpnpResParameters;
+
+// data types
+// NONE
+
+// constants
+const TInt KMimeStartLength = 5;
+_LIT8( KAudio, "audio" );
+_LIT8( KImage, "image" );
+_LIT8( KVideo, "video" );
+
+/**
+ *  CUpnpDlnaProfiler is a class for resolving DLNA profile for a given file.
+ *
+ *  CUpnpDlnaProfiler class can be used to resolve a DLNA profile for a media 
+ *  file (image, AV, video). User of this class can also query for a list of 
+ *  currently supported DLNA profiles.
+ *
+ *  @lib dlnaprofiler.lib
+ *  @since S60 v3.1
+ */
+class CUpnpDlnaProfiler: public CBase
+    {
+public:
+
+    IMPORT_C static CUpnpDlnaProfiler* NewL();
+
+    IMPORT_C static CUpnpDlnaProfiler* NewLC();
+
+    virtual ~CUpnpDlnaProfiler();
+
+    /**
+     * SupportedProfilesL returns DLNA profiles that are currently supported.
+     *
+     * @since S60 v3.1
+     * @param aProfiles Descriptor array where supported DLNA profiles are 
+     *                  added.
+     * @return TInt Error code, KErrNone if successfull.
+     */
+    IMPORT_C TInt SupportedProfilesL( CDesC16ArrayFlat* aProfiles ) const;
+
+    /**
+     * ProfileForFileL is for resolving a DLNA profile of a given file.
+     *
+     * @since S60 v3.1
+     * @param aFileName Filename of the file which is to be resolved.
+     *        Filename must contain full path (drive+path+filename).
+     * @return DLNA profile of the file as a HBufC*, 
+     *         NULL if could not be resolved
+     */
+    IMPORT_C HBufC* ProfileForFileL( const TDesC& aFilename );
+    
+    /**
+     * ProfileForFileL is for resolving a DLNA profile of a given file.
+     * Takes RFile and CUpnpResParameters parameters in order to minimize 
+     * the amount of file opening.
+     * @since S60 v3.1
+     * @param aFileName Filename of the file which is to be resolved.
+     *        Filename must contain full path (drive+path+filename).
+     * @param aFile Handle to opened file specified by aFilename.
+     * @param aParameters Res parameters that are already known.
+     * @return DLNA profile of the file as a HBufC*, 
+     *         NULL if could not be resolved
+     */
+    IMPORT_C HBufC* ProfileForFileL( const TDesC& aFilename, 
+                                     RFile& aFile,
+                                     CUpnpResParameters& aParameters );
+    
+private:
+
+    CUpnpDlnaProfiler();
+
+    void ConstructL();
+
+    /**
+     * DlnaProfileFromSolversL checks the mime type given as parameter and
+     * forwards the recognition task to solver plugins corresponding the
+     * mimetype.
+     * @param aFileName Filename of the file which is to be resolved.
+     *        Filename must contain full path (drive+path+filename).
+     * @param aMimeType Mime type of file specified by aFilename.
+     * @param aFile Handle to opened file specified by aFilename.
+     * @return pointer to descriptor containing resolved DLNA profile
+     * @since S60 v3.1
+     */
+    HBufC* DlnaProfileFromSolversL( const TDesC& aFilename, 
+                                    const TDesC8& aMimetype, 
+                                    RFile& aFile );
+
+private: // data
+
+    /**
+     * iAudioSolvers is a list of audio solver plugins. Base solver plugin is 
+     * the first one on the list and the rest are product specific solvers.
+     * These are used for resolving a DLNA profile of an audio file.
+     */
+    RPointerArray<MUpnpProfiler> iAudioSolvers; // elements owned
+
+    /**
+     * iAvSolvers is a list of AV solver plugins. Base solver plugin is 
+     * the first one on the list and the rest are product specific solvers.
+     * These are used for resolving a DLNA profile of an AV (video) file.
+     */
+    RPointerArray<MUpnpProfiler> iAvSolvers; // elements owned
+    
+    /**
+     * iImageSolvers is a list of image solver plugins. Base solver plugin is 
+     * the first one on the list and the rest are product specific solvers.
+     * These are used for resolving a DLNA profile of an image file.
+     */
+    RPointerArray<MUpnpProfiler> iImageSolvers; // elements owned
+
+    };
+
+
+#endif // C_UPNPDLNAPROFILER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/inc/upnpimagesolverbase.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Base DLNA profile resolver class for image files.
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPIMAGESOLVERBASE_H
+#define C_UPNPIMAGESOLVERBASE_H
+
+
+// system includes
+// NONE
+
+// user includes
+#include "upnpprofiler.h"
+
+// forward declarations
+// NONE
+
+// constants
+// NONE
+
+/**
+ *  Image file DLNA profile base resolver class.
+ *
+ *  This class is the base class for resolving DLNA profile of image files.
+ *  It contains methods for querying the profiles supported by this solver 
+ *  and for resolving a DLNA profile of a given image file.
+ *
+ *
+ *  @lib dlnaprofiler.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CUpnpImageSolverBase ) : public CBase,
+                                            public MUpnpProfiler
+    {
+public:
+
+    static CUpnpImageSolverBase* NewL();
+
+    static CUpnpImageSolverBase* NewLC();
+
+    virtual ~CUpnpImageSolverBase();
+
+// from base class MUpnpProfiler
+
+    /**
+     * From MUpnpProfiler.
+     * SupportedProfilesL returns DLNA profiles that are currently supported.
+     *
+     * @since S60 v3.1
+     * @param aProfiles Descriptor array where supported DLNA profiles are 
+     *                  added.
+     * @return TInt Error code, KErrNone if successfull.
+     */
+    TInt SupportedProfilesL( CDesC16ArrayFlat* aProfiles ) const;
+
+    /**
+     * From MUpnpProfiler.
+     * ProfileForFileL is for resolving a DLNA profile of a given file.
+     * Besides of file name, also mime type of the file is passed as a 
+     * parameter in order to avoid re-opening of the file.
+     *
+     * @since S60 v3.1
+     * @param aFileName Filename of the file which is to be resolved.
+     * @param aMimeType Mime type of the file which is to be resolved.
+     * @param aFile Handle to opened file specified by aFilename.
+     * @return DLNA profile of the file as a HBufC*, 
+     *         NULL if could not be resolved
+     */
+    HBufC* ProfileForFileL( const TDesC& aFilename, 
+                            const TDesC8& aMimetype, 
+                            RFile& aFile );
+                            
+private:
+
+    CUpnpImageSolverBase();
+
+    void ConstructL();
+    };
+
+#endif // C_UPNPIMAGESOLVERBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/inc/upnpprofiler.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Definition of a MUpnpProfiler interface class.
+*
+*/
+
+
+
+
+
+
+#ifndef M_UPNPPROFILER_H
+#define M_UPNPPROFILER_H
+
+
+// system includes
+#include <e32base.h>
+
+// user includes
+// NONE
+
+// forward declarations
+class CDesC16ArrayFlat;
+
+// constants
+// NONE
+
+/**
+ *  MUpnpProfiler interface class
+ *
+ *  MUpnpProfiler defines an interface for media solver plugins. It contains
+ *  methods for querying the profiles supported by this solver plugin and
+ *  for resolving a DLNA profile of a given file.
+ *
+ *  @lib dlnaprofiler.lib
+ *  @since S60 v3.1
+ */
+class MUpnpProfiler
+    {
+
+public:
+
+    virtual ~MUpnpProfiler() {};
+    
+    /**
+     * SupportedProfilesL returns DLNA profiles that are currently supported.
+     *
+     * @since S60 v3.1
+     * @param aProfiles Descriptor array where supported DLNA profiles are 
+     *                  added.
+     * @return TInt Error code, KErrNone if successfull.
+     */
+    virtual IMPORT_C TInt SupportedProfilesL( 
+                                    CDesC16ArrayFlat* aProfiles ) const = 0;
+
+    /**
+     * ProfileForFileL is for resolving a DLNA profile of a given file.
+     * Besides of file name, also mime type of the file is passed as a 
+     * parameter in order to avoid re-opening of the file.
+     *
+     * @since S60 v3.1
+     * @param aFileName Filename of the file which is to be resolved.
+     * @param aMimeType Mime type of the file which is to be resolved.
+     * @param aFile Handle to opened file specified by aFilename
+     * @return DLNA profile of the file as a HBufC*, 
+     *         NULL if could not be resolved
+     */
+    virtual IMPORT_C HBufC* ProfileForFileL( const TDesC& aFilename, 
+                                             const TDesC8& aMimetype, 
+                                             RFile& aFile 
+                                           ) = 0;
+
+    };
+
+
+#endif // M_UPNPPROFILER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/inc/upnpresparameters.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Header file of CUpnpResParameters class. CUpnpResParameters 
+*                is created to encapsulate information that is needed in a 
+*                contentdirectory res element.
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPRESPARAMETERS_H
+#define C_UPNPRESPARAMETERS_H
+
+// system includes
+#include <e32base.h>
+
+// user includes
+// NONE
+
+// forward declarations
+// NONE
+
+// data types
+// NONE
+
+// constants
+// NONE
+
+/**
+ *  CUpnpResParameters is created to encapsulate information that is needed
+ *  in a contentdirectory res element.
+ *
+ *  @lib dlnaprofiler.lib
+ *  @since S60 v3.1
+ */
+class CUpnpResParameters: public CBase
+    {
+public:
+
+    IMPORT_C static CUpnpResParameters* NewL();
+
+    IMPORT_C static CUpnpResParameters* NewLC();
+
+    virtual ~CUpnpResParameters();
+
+    // getters
+
+    /**
+     * ProtocolInfo returns the protocolinfo string.
+     *
+     * @since S60 v3.1
+     * @return HBufC8* Protocolinfo
+     */  
+    IMPORT_C const TDesC8& ProtocolInfo() const;
+
+    /**
+     * FileSizeL returns the size of the file in bytes as descriptor.
+     *
+     * @since S60 v3.1
+     * @return HBufC8* File Size
+     */  
+    IMPORT_C HBufC8* FileSizeL() const;
+
+    /**
+     * DurationL returns the duration in the following form:
+     *     duration = hours ":" minutes ":" seconds
+     *     hours = 1*5 DIGIT; 0-99999
+     *     minutes = 2 DIGIT ; 00-59
+     *     seconds = 2 DIGIT ["." 3 DIGIT] ; 00-59 (.000-.999) 
+     *
+     * @since S60 v3.1
+     * @return HBufC8* Duration
+     */  
+    IMPORT_C HBufC8* DurationL() const;
+
+    /**
+     * ResolutionL returns the resolution in form widthXheight.
+     *
+     * @since S60 v3.1
+     * @return HBufC8* Resolution
+     */  
+    IMPORT_C HBufC8* ResolutionL() const;
+
+    /**
+     * MimeType is a getter for mime type.
+     *
+     * @since S60 v3.1
+     * @return HBufC8* Mime type
+     */  
+    const TDesC8& MimeType();
+    
+    // Methods for querying file type
+
+    /**
+     * IsImageFile returns true if file is image file, false otherwise.
+     *
+     * @since S60 v3.1
+     * @return TBool
+     */  
+    IMPORT_C TBool IsImageFile() const ;
+
+    /**
+     * IsAudioOrVideoFile returns true if file is audio or video file, 
+     * false otherwise.
+     *
+     * @since S60 v3.1
+     * @return TBool 
+     */  
+    IMPORT_C TBool IsAudioOrVideoFile() const;
+
+    // setters
+
+    /**
+     * SetProtocolInfoL sets the protocolinfo attribute.
+     *
+     * @since S60 v3.1
+     * @param const TDesC8& Protocolinfo
+     */  
+    void SetProtocolInfoL( const TDesC8& aProtocolInfo );
+
+    /**
+     * SetMimetypeL sets the mime type attribute.
+     *
+     * @since S60 v3.1
+     * @param const TDesC8& Mime type
+     */  
+    void SetMimetypeL( const TDesC8& aMimetype );
+
+    /**
+     * SetFileSize sets the file size attribute.
+     *
+     * @since S60 v3.1
+     * @param const TInt File size
+     */  
+    void SetFileSize( const TInt aFileSize );
+
+    /**
+     * SetResolution sets the resolution attribute.
+     *
+     * @since S60 v3.1
+     * @param const TSize Resolution
+     */  
+    void SetResolution( const TSize aResolution );
+
+    /**
+     * SetDurationInSeconds sets the duration attribute.
+     *
+     * @since S60 v3.1
+     * @param const TInt64 Duration
+     */  
+    void SetDurationInSeconds( const TInt64 aDuration );
+
+
+private:
+
+    CUpnpResParameters();
+
+    void ConstructL();
+
+private: // data
+    HBufC8* iProtocolInfo;   // owned
+    HBufC8* iMimetype;       // owned
+    TInt iFileSize;
+    TSize iResolution;
+    TInt64 iDurationInSeconds;
+    
+    };
+
+
+#endif // C_UPNPRESPARAMETERS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/inc/upnpresresolver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Header file of CUpnpResResolver class. CUpnpResResolver is 
+*                a class used for resolving res field attributes for a given 
+*                file.
+*
+*/
+
+
+
+
+
+
+#ifndef C_UPNPRESRESOLVER_H
+#define C_UPNPRESRESOLVER_H
+
+// system includes
+#include <e32base.h>
+#include <mdaaudiosampleplayer.h> // CMdaAudioPlayerUtility
+
+// user includes
+// NONE
+
+// forward declarations
+class RFile;
+class CUpnpResParameters;
+
+// data types
+// NONE
+
+// constants
+// NONE
+
+/**
+ *  CUpnpResResolver is a class for resolving res field attributes for a 
+ *  given file.
+ *
+ *  CUpnpResResolver class can be used to resolve a res field attributes for 
+ *  a media file (image, AV, video). Attributes resolved for media files are:
+ *     - Protocolinfo for all files.
+ *     - Resolution and size for images.
+ *     - Duration and size for videos.
+ *     - Duration and size for music.
+ *
+ *  @lib dlnaprofiler.lib
+ *  @since S60 v3.1
+ */
+class CUpnpResResolver: public CBase, 
+                        public MMdaAudioPlayerCallback
+    {
+public:
+
+    IMPORT_C static CUpnpResResolver* NewL();
+
+    IMPORT_C static CUpnpResResolver* NewLC();
+
+    virtual ~CUpnpResResolver();
+
+    /**
+     * GetResParametersL resolves parameters that will be needed in 
+     * res-element attributes.
+     *
+     * @since S60 v3.1
+     * @param const TDesC& File for which to obtain res parameters.
+     * @return CUpnpResParameters* Parameters needed for res-element.
+     */  
+    IMPORT_C CUpnpResParameters* GetResParametersL( const TDesC& aFilename );
+    
+private:
+
+    CUpnpResResolver();
+
+    void ConstructL();
+
+    /**
+     * GetMimetypeL returns the mime type of the file.
+     *
+     * @since S60 v3.1
+     * @param RFile& File for which to obtain mime.
+     * @return HBufC8* Mime type of the file.
+     */  
+    HBufC8* GetMimetypeL( RFile& aFile );
+    
+    /**
+     * GetAudioDurationL obtains the duration of a audio file.
+     * After call the duration is in iDuration member variable.
+     *
+     * @since S60 v3.1
+     * @param const TDesC& The audio file for which to obtain duration.
+     */  
+    void GetAudioDurationL( const TDesC& aFilename );
+
+    /**
+     * GetVideoDurationL obtains the duration of a video file.
+     * After call the duration is in iDuration member variable.
+     *
+     * @since S60 v3.1
+     * @param RFile& The video file for which to obtain duration.
+     */  
+    void GetVideoDurationL( RFile& aFile );
+
+    /**
+     * GetFileSizeL returns the size of file in bytes.
+     *
+     * @since S60 v3.1
+     * @param RFile& The file for which to obtain size
+     * @return TInt File size.
+     */  
+    TInt GetFileSizeL( RFile& aFile );
+
+    /**
+     * GetImageResolutionL returns the resolution of the image.
+     *
+     * @since S60 v3.1
+     * @param RFile& File for which to obtain resolution.
+     * @param const TDesC8& Mime type of the file.
+     * @return TSize The resolution of the image. 
+     */  
+    TSize GetImageResolutionL( RFile& aFile, const TDesC8& aMimetype );
+
+// from base class MMdaAudioPlayerCallback
+
+    /**
+     * From MMdaAudioPlayerCallback.
+     * MapcPlayComplete 
+     *
+     * @since S60 v3.1
+     * @param aError error code
+     */
+    void MapcPlayComplete( TInt aError );
+
+    /**
+     * From MMdaAudioPlayerCallback.
+     * MapcInitComplete 
+     *
+     * @since S60 v3.1
+     * @param aError error code
+     * @param aDuration duration of the file
+     */
+    void MapcInitComplete( TInt aError, 
+                           const TTimeIntervalMicroSeconds& aDuration );
+           
+private: // data
+    // attributes related to CMdaAudioPlayerUtility usage
+    CActiveSchedulerWait*       iWait; // owned
+    CMdaAudioPlayerUtility*     iAudioplayer; // owned. 
+    
+    // duration of the media file (video or audio)
+    TTimeIntervalMicroSeconds   iDuration;
+    };
+
+
+#endif // C_UPNPRESRESOLVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/src/upnpaudiosolverbase.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,429 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implementation of base DLNA profile resolver class for audio 
+*                files.
+*
+*/
+
+
+
+
+
+
+// system includes
+// NONE
+
+// includes
+#include <mdaaudiosampleeditor.h> // CMdaAudioConvertUtility
+#include <badesca.h> // CDesC16ArrayFlat
+#include "upnpaudiosolverbase.h"
+
+_LIT( KComponentLogfile, "dlnaprofiler.txt");
+#include "upnplog.h"
+
+// constants
+_LIT( KTargetAudioFile, "c:\\unnecessary.txt" );
+
+// audio mime types
+_LIT8( KAudioMpeg, "audio/mpeg" );
+_LIT8( KAudio3gpp, "audio/3gpp" );
+_LIT8( KAudioMp4, "audio/mp4" );
+_LIT8( KAudioL16, "audio/L16" );
+_LIT8( KAudioAdts, "audio/vnd.dlna.adts" );
+_LIT8( KAudioWma, "audio/x-ms-wma" );
+
+// audio profiles
+_LIT( KLpcm, "LPCM" );
+_LIT( KMp3, "MP3" );
+_LIT( KAac_iso, "AAC_ISO" );
+_LIT( KAac_iso_320, "AAC_ISO_320" );
+_LIT( KAac_mult5_iso, "AAC_MULT5_ISO" );
+_LIT( KWmabase, "WMABASE" );
+_LIT( KWmafull, "WMAFULL" );
+_LIT( KWmapro, "WMAPRO" );
+
+const TInt KAac_iso_320_max_bitrate = 320000;
+const TInt KAac_iso_max_samplerate = 48000;
+const TInt KAac_iso_max_bitrate = 576000;
+
+const TInt KWmabase_max_bitrate = 192999;
+const TInt KWmafull_max_bitrate = 385000;
+const TInt KWmapro_max_bitrate = 1500000;
+
+const TInt KWmabase_max_samplerate = 48000;
+const TInt KWmafull_max_samplerate = 48000;
+const TInt KWmapro_max_samplerate = 96000;
+
+const TInt KTwo_Channels = 2;
+const TInt KSix_Channels = 6;
+const TInt KEight_Channels = 8;
+
+// ======== LOCAL FUNCTIONS ========
+// NONE
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUpnpAudioSolverBase C++ constructor
+// --------------------------------------------------------------------------
+//
+CUpnpAudioSolverBase::CUpnpAudioSolverBase()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase Constructor" );
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpAudioSolverBase::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUpnpAudioSolverBase::ConstructL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::ConstructL" );
+    iWait = new( ELeave ) CActiveSchedulerWait;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAudioSolverBase::NewL
+// --------------------------------------------------------------------------
+//
+CUpnpAudioSolverBase* CUpnpAudioSolverBase::NewL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::NewL" );
+    CUpnpAudioSolverBase* self = CUpnpAudioSolverBase::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAudioSolverBase::NewLC
+// --------------------------------------------------------------------------
+//
+CUpnpAudioSolverBase* CUpnpAudioSolverBase::NewLC()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::NewLC" );
+    CUpnpAudioSolverBase* self = new( ELeave ) CUpnpAudioSolverBase;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAudioSolverBase destructor
+// --------------------------------------------------------------------------
+//
+CUpnpAudioSolverBase::~CUpnpAudioSolverBase()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::Destructor" );
+    delete iAudioconverter;
+    delete iWait;
+    }
+
+// --------------------------------------------------------------------------
+// From class MUpnpProfiler.
+// SupportedProfilesL returns DLNA profiles that are currently supported.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpAudioSolverBase::SupportedProfilesL( 
+                                          CDesC16ArrayFlat* aProfiles ) const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::\
+SupportedProfilesL" );
+    TInt retval = KErrNone;
+    
+    if ( !aProfiles ) 
+        {
+        // Invalid parameter
+        retval = KErrArgument;
+        }
+    else 
+        {
+        // append all new profiles recognized by this solver
+        // do not allow duplicates
+        TInt tempPos = KErrNotFound;
+        
+        if ( aProfiles->Find( KLpcm(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KLpcm() );
+            }
+        if ( aProfiles->Find( KMp3(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KMp3() );
+            }
+        if ( aProfiles->Find( KAac_iso(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KAac_iso() );
+            }
+        if ( aProfiles->Find( KAac_iso_320(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KAac_iso_320() );
+            }
+        if ( aProfiles->Find( KAac_mult5_iso(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KAac_mult5_iso() );
+            }
+        if ( aProfiles->Find( KWmabase(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KWmabase() );
+            }
+        if ( aProfiles->Find( KWmafull(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KWmafull() );
+            }
+        if ( aProfiles->Find( KWmapro(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KWmapro() );
+            }
+        }
+        
+    return retval;
+    }
+    
+// --------------------------------------------------------------------------
+// From class MUpnpProfiler.
+// ProfileForFileL is for resolving a DLNA profile of a given file. Besides 
+// of file name, also mime type of the file is passed as a parameter in 
+// order to avoid re-opening the file.
+// --------------------------------------------------------------------------
+//
+HBufC* CUpnpAudioSolverBase::ProfileForFileL( const TDesC& aFilename,
+                                              const TDesC8& aMimetype, 
+                                              RFile& /*aFile*/ ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::ProfileForFileL" );
+    HBufC* retval = NULL;
+    
+    if ( aMimetype.Compare( KAudioMpeg() ) == 0 ) 
+        {
+        // Note that MP3X profile is currently not supported.
+        retval = HBufC::NewL( KMp3().Length() );
+        retval->Des().Append( KMp3() );
+        }
+    else if ( aMimetype.Compare( KAudioMp4() ) == 0 ) 
+        {
+        // obtain bitrate and channel count information from the file
+        GetAudioFileInformationL( aFilename );
+
+        retval = DetermineMp4ProfileL();
+        }
+    else if ( aMimetype.Compare( KAudio3gpp() ) == 0 ) 
+        {
+        // obtain bitrate and channel count information from the file
+        GetAudioFileInformationL( aFilename );
+        
+        retval = Determine3GppProfileL();
+        }
+    else if ( aMimetype.Left( KAudioL16().Length() ).Compare( 
+                                                     KAudioL16() ) == 0 ) 
+        {
+        retval = HBufC::NewL( KLpcm().Length() );
+        retval->Des().Append( KLpcm() );
+        }
+    else if ( aMimetype.Compare( KAudioWma() ) == 0 ) 
+        {
+        // obtain bitrate and channel count information from the file
+        GetAudioFileInformationL( aFilename );
+
+        retval = DetermineWmaProfileL();
+        }
+    else if ( aMimetype.Compare( KAudioAdts() ) == 0 ) 
+        {
+        // no audio/vnd.dlna.adts profiles currently supported
+        // obtain bitrate and channel count information from the file
+        //GetAudioFileInformationL( aFilename );
+        //retval = DetermineAdtsProfileL();
+        }
+        
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// From class MMdaObjectStateChangeObserver.
+// MoscoStateChangeEvent callback is called after a call to 
+// CMdaAudioConvertUtility::OpenL has completed.
+// --------------------------------------------------------------------------
+//
+void CUpnpAudioSolverBase::MoscoStateChangeEvent( CBase */*aObject*/, 
+                                                  TInt /*aPreviousState*/, 
+                                                  TInt /*aCurrentState*/, 
+                                                  TInt aErrorCode ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::\
+MoscoStateChangeEvent" );
+    if( KErrNone == aErrorCode )
+        {
+            // get bit rate and channel count of the file. Trap because this 
+            // method may not leave. TRAP_IGNORE because there is nothing we
+            // can do in case of leave.
+            TRAP_IGNORE( iBitrate = iAudioconverter->SourceBitRateL() );
+            TRAP_IGNORE( iChannelCount = 
+                            iAudioconverter->SourceNumberOfChannelsL() );
+            TRAP_IGNORE( iSampleRate = 
+                            iAudioconverter->SourceSampleRateL() );
+        }
+        
+    // continue execution in ProfileForFileL-method by stopping 
+    // ActiveSchedulerWait
+    iWait->AsyncStop();
+    }
+
+// --------------------------------------------------------------------------
+// GetAudioFileInformationL is for resolving audio file attributes by using 
+// CMdaAudioConvertUtility. 
+// --------------------------------------------------------------------------
+//
+TInt CUpnpAudioSolverBase::GetAudioFileInformationL( const TDesC& aFilename )
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::\
+GetAudioFileInformationL" );
+    TInt retval = KErrNone;
+    
+    // create audioconverter if it does not exist
+    if ( !iAudioconverter ) 
+        {
+        iAudioconverter = CMdaAudioConvertUtility::NewL( *this );
+        }
+    
+    // Create iWait if it does not exist. Create it here rather than after 
+    // OpenL-call so that there will be no problems if somehow OpenL calls 
+    // MoscoStateChangeEvent-callback before iWait is created and started.
+    if ( !iWait ) 
+        {
+        iWait = new( ELeave ) CActiveSchedulerWait;
+        }
+
+    // Open file specified in aFilename. This is an asynchronic operation. 
+    // Calls MoscoStateChangeEvent callback after completed.
+    TMdaFileClipLocation sinkFile( KTargetAudioFile() );
+    TMdaRawAudioClipFormat  sinkformat;
+    iAudioconverter->OpenL( aFilename, &sinkFile, &sinkformat );
+
+    // start CActiveSchedulerWait which is completed in MoscoStateChangeEvent
+    iWait->Start();
+
+    // openL + MoscoStateChangeEvent callback executed now
+    delete iAudioconverter;
+    iAudioconverter = NULL;
+    delete iWait;
+    iWait = NULL;
+
+    // delete temporary file
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    User::LeaveIfError( fs.Delete( KTargetAudioFile() ) );
+    fs.Close();
+    
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// Determine3GppProfileL is for determining profile for 3gpp audio files
+// --------------------------------------------------------------------------
+//
+HBufC* CUpnpAudioSolverBase::Determine3GppProfileL() const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::\
+Determine3GppProfileL" );
+    HBufC* retval = NULL;
+    
+    if ( iBitrate <= KAac_iso_320_max_bitrate && 
+         iSampleRate <= KAac_iso_max_samplerate && 
+         iChannelCount <= KTwo_Channels ) 
+        {
+        retval = HBufC::NewL( KAac_iso_320().Length() );
+        retval->Des().Append( KAac_iso_320() );
+        }
+    else if ( iSampleRate <= KAac_iso_max_samplerate && 
+              iChannelCount <= KTwo_Channels )
+        {
+        retval = HBufC::NewL( KAac_iso().Length() );
+        retval->Des().Append( KAac_iso() ); 
+        }
+    else if ( iSampleRate <= KAac_iso_max_samplerate && 
+              iChannelCount <= KSix_Channels )
+        {
+        retval = HBufC::NewL( KAac_mult5_iso().Length() );
+        retval->Des().Append( KAac_mult5_iso() ); 
+        }    
+    
+    return retval;
+    }
+
+
+
+// --------------------------------------------------------------------------
+// DetermineWmaProfileL is for determining profile for wma files
+// --------------------------------------------------------------------------
+//
+HBufC* CUpnpAudioSolverBase::DetermineWmaProfileL() const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::\
+DetermineWmaProfileL" );
+    HBufC* retval = NULL;
+
+    if ( iBitrate <= KWmabase_max_bitrate && 
+         iSampleRate <= KWmabase_max_samplerate && 
+         iChannelCount <= KTwo_Channels )
+        {
+        retval = HBufC::NewL( KWmabase().Length() );
+        retval->Des().Append( KWmabase() );   
+        }
+    else if ( iBitrate <= KWmafull_max_bitrate && 
+              iSampleRate <= KWmafull_max_samplerate && 
+              iChannelCount <= KTwo_Channels ) 
+        {
+        retval = HBufC::NewL( KWmafull().Length() );
+        retval->Des().Append( KWmafull() );
+        }
+    else if ( iBitrate <= KWmapro_max_bitrate && 
+              iSampleRate <= KWmapro_max_samplerate && 
+              iChannelCount <= KEight_Channels ) 
+        {
+        retval = HBufC::NewL( KWmapro().Length() );
+        retval->Des().Append( KWmapro() );
+        }
+        
+    return retval;
+}
+
+// --------------------------------------------------------------------------
+// DetermineMp4ProfileL is for determining profile for mp4 audio files
+// --------------------------------------------------------------------------
+//
+HBufC* CUpnpAudioSolverBase::DetermineMp4ProfileL() const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAudioSolverBase::\
+DetermineMp4ProfileL" );
+    HBufC* retval = NULL;
+    
+    if ( iBitrate <= KAac_iso_320_max_bitrate && 
+         iChannelCount <= KTwo_Channels ) 
+        {
+        retval = HBufC::NewL( KAac_iso_320().Length() );
+        retval->Des().Append( KAac_iso_320() );            
+        }
+    else if ( iBitrate <= KAac_iso_max_bitrate && 
+              iChannelCount <= KTwo_Channels )
+        {
+        retval = HBufC::NewL( KAac_iso().Length() );
+        retval->Des().Append( KAac_iso() ); 
+        }
+        
+    return retval;
+}
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/src/upnpavsolverbase.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,448 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implementation of base DLNA profile resolver class for av 
+*                files.
+*
+*/
+
+
+
+
+
+
+// includes
+#include <badesca.h> // CDesC16ArrayFlat
+#include <3gplibrary/mp4lib.h>
+#include "upnpavsolverbase.h"
+
+_LIT( KComponentLogfile, "dlnaprofiler.txt");
+#include "upnplog.h"
+
+// constants
+_LIT8( KVideoMp4, "video/mp4" );
+
+_LIT( KMpeg4_p2_mp4_sp_l2_aac,      "MPEG4_P2_MP4_SP_L2_AAC" );
+_LIT( KMpeg4_p2_mp4_sp_aac,         "MPEG4_P2_MP4_SP_AAC" );
+_LIT( KMpeg4_p2_mp4_sp_vga_aac,     "MPEG4_P2_MP4_SP_VGA_AAC" );
+_LIT( KMpeg4_p2_mp4_sp_l5_aac,      "MPEG4_P2_MP4_SP_L5_AAC" );
+
+_LIT( KAvc_mp4_bl_cif15_aac,        "AVC_MP4_BL_CIF15_AAC" );
+_LIT( KAvc_mp4_bl_cif15_aac_520,    "AVC_MP4_BL_CIF15_AAC_520" );
+
+const TUint32 KSimpleProfileLevel2 = 0x02;
+const TUint32 KSimpleProfileLevel3 = 0x03;
+const TUint32 KSimpleProfileLevel4 = 0x04;
+const TUint32 KSimpleProfileLevel5 = 0x05;
+
+
+const mp4_u32 KMaxXResolutionCif = 352;
+const mp4_u32 KMaxYResolutionCif = 288;
+const mp4_u32 KMaxXResolutionVga = 640;
+const mp4_u32 KMaxYResolutionVga = 480;
+
+//const TInt  KBitrateAverageToMaxFactor = 20;
+//const mp4_u32 KMaxBitrateCif520 = 520;
+//const mp4_u32 KMaxBitrateCif = 384;
+//const TUint32 KAdvancedSimpleProfileLevel1 = 0x91;
+//const TUint32 KAdvancedSimpleProfileLevel2 = 0x92;
+//const TUint32 KAdvancedSimpleProfileLevel3 = 0x93;
+//const TUint32 KAdvancedSimpleProfileLevel4 = 0x94;
+//const TUint32 KAvcBaseline1_2 = 12;
+
+/*
+===========================================================================
+Codec-specific details are explained here
+(for the part that is currently required by upnp framework)
+
+MPEG4 part2
+------------
+see ISO/IEC 14496-2, chapter 6.2.2 and annex G
+(http://akuvian.org/src/x264/ISO-IEC-14496-2_2001_MPEG4_Visual.pdf.gz)
+
+32 bit: visual_object_sequence_start_code (not interesting)
+8 bit: profile_and_level_indication, where:
+   0x02 = simple profile, level 2
+   0x03 = simple profile, level 3
+
+   0x04 = simple profile, level 4a
+   0x05 = simple profile, level 5
+   
+   0x91 = advanced simple profile, level 1
+   0x92 = advanced simple profile, level 2
+   0x93 = advanced simple profile, level 3
+   0x94 = advanced simple profile, level 4
+   
+...
+
+MPEG4 part 10 (AVC)
+-------------------
+see ISO/IEC 14496-15, chapter 5.2.4.1.1
+(http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=43178)
+
+8 bit: version (not interesting)
+8 bit: AVC profile indication, where
+   0x42 = AVC baseline
+   0x4D = AVC main
+   0x58 = AVC extended
+8 bit: compatibility flags (not interesting)
+8 bit: AVC level indication, where
+   10 = baseline level 1.0
+   11 = baseline level 1.1
+   12 = baseline level 1.2
+   13 = baseline level 1.3
+   20 = baseline level 2.0
+   21 = baseline level 2.1
+   22 = baseline level 2.2
+   30 = baseline level 3.0
+...
+
+===========================================================================
+*/
+
+
+// --------------------------------------------------------------------------
+// CUpnpAvSolverBase C++ constructor
+// --------------------------------------------------------------------------
+//
+CUpnpAvSolverBase::CUpnpAvSolverBase()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAvSolverBase constructor" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpAvSolverBase::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUpnpAvSolverBase::ConstructL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAvSolverBase::ConstructL" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAvSolverBase::NewL
+// --------------------------------------------------------------------------
+//
+CUpnpAvSolverBase* CUpnpAvSolverBase::NewL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAvSolverBase::NewL" );
+    CUpnpAvSolverBase* self = CUpnpAvSolverBase::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAvSolverBase::NewLC
+// --------------------------------------------------------------------------
+//
+CUpnpAvSolverBase* CUpnpAvSolverBase::NewLC()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAvSolverBase::NewLC" );
+    CUpnpAvSolverBase* self = new( ELeave ) CUpnpAvSolverBase;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpAvSolverBase destructor
+// --------------------------------------------------------------------------
+//
+CUpnpAvSolverBase::~CUpnpAvSolverBase()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAvSolverBase destructor" );
+    }
+
+// --------------------------------------------------------------------------
+// From class MUpnpProfiler.
+// SupportedProfilesL returns DLNA profiles that are currently supported.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpAvSolverBase::SupportedProfilesL( 
+                                        CDesC16ArrayFlat* aProfiles ) const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAvSolverBase::SupportedProfilesL" );
+    TInt retval = KErrNone;
+    
+        if ( !aProfiles ) 
+        {
+        // Invalid parameter
+        retval = KErrArgument;
+        }
+    else 
+        {
+        // append all new profiles recognized by this solver
+        // do not allow duplicates
+        TInt tempPos = KErrNotFound;
+
+        if ( aProfiles->Find( KMpeg4_p2_mp4_sp_l2_aac(), 
+                              tempPos, 
+                              ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KMpeg4_p2_mp4_sp_l2_aac() );
+            }
+        if ( aProfiles->Find( KMpeg4_p2_mp4_sp_aac(), 
+                              tempPos, 
+                              ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KMpeg4_p2_mp4_sp_aac() );
+            }
+        if ( aProfiles->Find( KMpeg4_p2_mp4_sp_vga_aac(), 
+                              tempPos, 
+                              ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KMpeg4_p2_mp4_sp_vga_aac() );
+            }
+        if ( aProfiles->Find( KMpeg4_p2_mp4_sp_l5_aac(), 
+                              tempPos, 
+                              ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KMpeg4_p2_mp4_sp_l5_aac() );
+            }
+        if ( aProfiles->Find( KAvc_mp4_bl_cif15_aac(), 
+                              tempPos, 
+                              ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KAvc_mp4_bl_cif15_aac() );
+            }
+        if ( aProfiles->Find( KAvc_mp4_bl_cif15_aac_520(), 
+                              tempPos, 
+                              ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KAvc_mp4_bl_cif15_aac_520() );
+            }
+        }
+
+    return retval;
+    }
+    
+// --------------------------------------------------------------------------
+// From class MUpnpProfiler.
+// ProfileForFileL is for resolving a DLNA profile of a given file. Besides 
+// of file name, also mime type of the file is passed as a parameter in order
+// to avoid re-opening the file.
+// --------------------------------------------------------------------------
+//
+HBufC* CUpnpAvSolverBase::ProfileForFileL( const TDesC& /*aFilename*/,
+                                           const TDesC8& aMimetype, 
+                                           RFile& aFile )
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAvSolverBase::\
+ProfileForFileL" );
+    HBufC* retval = NULL;
+
+
+    
+    if ( aMimetype.Compare( KVideoMp4() ) == 0 ) 
+        {
+        GetVideoFileInformationL( aFile );
+
+
+
+        if ( iVideoType == MP4_TYPE_MPEG4_VIDEO &&
+             iAudioType == MP4_TYPE_MPEG4_AUDIO )
+            {
+            // MPEG4 level 2
+
+            TUint32 level = iCodecInfo.iData[1] & 0x000000FF;
+            
+            __LOG1( "[CUpnpAvSolverBase] CUpnpAvSolverBase::\
+            GetVideoFileInformationL level %d", level );
+
+            if ( level == KSimpleProfileLevel2 )
+                {
+                // Simple profile level 2
+                retval = HBufC::NewL( KMpeg4_p2_mp4_sp_l2_aac().Length() );
+                retval->Des().Append( KMpeg4_p2_mp4_sp_l2_aac() ); 
+                }
+            else if ( level == KSimpleProfileLevel3 )
+                {
+                // Simple profile level 3
+                if ( iVideoResolutionX <= KMaxXResolutionCif &&
+                    iVideoResolutionY <= KMaxYResolutionCif )
+                    {
+                    // resolution below CIF standard
+                    retval = HBufC::NewL( KMpeg4_p2_mp4_sp_aac().Length() );
+                    retval->Des().Append( KMpeg4_p2_mp4_sp_aac() ); 
+                    }
+                else if ( iVideoResolutionX <= KMaxXResolutionVga &&
+                    iVideoResolutionY <= KMaxYResolutionVga )
+                    {
+                    // resolution below VGA standard
+                    retval = HBufC::NewL(
+                        KMpeg4_p2_mp4_sp_vga_aac().Length() );
+                    retval->Des().Append( KMpeg4_p2_mp4_sp_vga_aac() ); 
+                    }
+                }
+
+            else if ( level == KSimpleProfileLevel4 )
+                {
+                // Simple profile level 4a
+                retval = HBufC::NewL( KMpeg4_p2_mp4_sp_vga_aac().Length() );
+                retval->Des().Append( KMpeg4_p2_mp4_sp_vga_aac() ); 
+                }
+            
+            else if ( level == KSimpleProfileLevel5 )
+                {
+                // Simple profile level 5
+                retval = HBufC::NewL( KMpeg4_p2_mp4_sp_l5_aac().Length() );
+                retval->Des().Append( KMpeg4_p2_mp4_sp_l5_aac() ); 
+                }                
+                
+/*
+
+Not needed yet:
+
+            else if ( level == KAdvancedSimpleProfileLevel1 ||
+                level == KAdvancedSimpleProfileLevel2 ||
+                level == KAdvancedSimpleProfileLevel3 ||
+                level == KAdvancedSimpleProfileLevel4 )
+                {
+                // Advanced simple profile (levels 1-4)
+                retval = HBufC::NewL( KMpeg4_p2_mp4_sp_l5_aac().Length() );
+                retval->Des().Append( KMpeg4_p2_mp4_sp_l5_aac() ); 
+                }
+*/
+                
+            }
+            
+
+/*
+  Temporary solution, based on AVC video resolution. 
+  iLevel should be used instead, see above Mp4 P2.
+*/
+        else if ( iVideoType == MP4_TYPE_AVC_PROFILE_BASELINE &&
+            iAudioType == MP4_TYPE_MPEG4_AUDIO )
+            {
+            // MPEG4 part 10 (AVC)
+            
+            	if (iVideoResolutionX <= KMaxXResolutionCif && 
+            		iVideoResolutionY <= KMaxYResolutionCif )
+            	{
+                    retval = HBufC::NewL( KAvc_mp4_bl_cif15_aac_520().Length() );
+                    retval->Des().Append( KAvc_mp4_bl_cif15_aac_520() );            		
+            	}
+        	
+            }
+            
+            
+
+        }
+           
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// GetVideoFileInformationL is for resolving audio file attributes by using 
+// CMdaAudioConvertUtility. 
+// --------------------------------------------------------------------------
+//
+TInt CUpnpAvSolverBase::GetVideoFileInformationL( RFile& aFile )
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpAvSolverBase::\
+GetVideoFileInformationL" );
+    TInt retval = KErrNone;
+
+    // video description
+    mp4_u32 videolength;
+    mp4_u32 videotimescale;
+    // audio params
+    mp4_u32 audiolength = 0;
+    mp4_u8 audioframes = 0;
+    mp4_u32 audiotimescale = 0;
+    mp4_u32 audiobitrate = 0;
+    // stream params
+    mp4_u32 streamsize = 0;
+
+    // reset old values 
+    iStreamAverageBitrate = 0;
+
+    MP4Handle myMp4Handle;
+    
+    // try open mp4 file handle
+    MP4Err openerr = MP4ParseOpenFileHandle( &myMp4Handle, &aFile );
+    if ( openerr == MP4_OK )
+        {
+        MP4Err requesterr = MP4ParseRequestVideoDescription(
+                                            myMp4Handle,
+                                            &videolength,
+                                            &iVideoFramerate,
+                                            &iVideoType,
+                                            &iVideoResolutionX,
+                                            &iVideoResolutionY,
+                                            &videotimescale );
+        if ( requesterr != MP4_OK )
+            {
+            MP4ParseClose( myMp4Handle );
+            User::Leave( KErrGeneral );
+            }
+
+
+        requesterr = MP4ParseRequestAudioDescription( 
+                                            myMp4Handle, 
+                                            &audiolength, 
+                                            &iAudioType,
+                                            &audioframes, 
+                                            &audiotimescale, 
+                                            &audiobitrate );
+        if ( requesterr != MP4_OK )
+            {
+            MP4ParseClose( myMp4Handle );
+            User::Leave( KErrGeneral );
+            }
+
+        requesterr = MP4ParseRequestStreamDescription(
+                                            myMp4Handle, 
+                                            &streamsize, 
+                                            &iStreamAverageBitrate );
+
+
+        if ( requesterr != MP4_OK )
+            {
+            MP4ParseClose( myMp4Handle );
+            User::Leave( KErrGeneral );
+            }
+
+        TMP4DecoderSpecificInfo iDecoderInfo;
+        mp4_u32 decoderInfoSize;
+
+        requesterr = MP4ParseReadVideoDecoderSpecificInfo(
+                                            myMp4Handle,
+                                            (mp4_u8*)&iDecoderInfo,
+                                            sizeof( iDecoderInfo ),
+                                            &decoderInfoSize );
+       
+
+		iCodecInfo = iDecoderInfo;
+        // close mp4 file handle
+        MP4Err closeerr = MP4ParseClose( myMp4Handle );
+        if ( closeerr ) 
+            {
+            User::Leave( KErrGeneral );
+            }
+        }
+    else 
+        {
+        // can not open file
+        User::Leave( KErrBadHandle );
+        }
+    
+    return retval;
+    }
+
+    
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/src/upnpdlnaprofiler.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,305 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implementation file of CUpnpDlnaProfiler class that is used
+*                for resolving a DLNA profile of a given file.
+*
+*/
+
+
+
+
+
+
+// system includes
+#include <f32file.h>     // RFile
+#include <apgcli.h>      // RApaLsSession
+
+// user includes
+#include "upnpdlnaprofiler.h"
+#include "upnpprofiler.h"
+#include "upnpaudiosolverbase.h"
+#include "upnpavsolverbase.h"
+#include "upnpimagesolverbase.h"
+#include "upnpresparameters.h"
+
+_LIT( KComponentLogfile, "dlnaprofiler.txt");
+#include "upnplog.h"
+
+// constants
+// NONE
+
+// ======== LOCAL FUNCTIONS ========
+// NONE
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUpnpDlnaProfiler C++ constructor
+// --------------------------------------------------------------------------
+//
+CUpnpDlnaProfiler::CUpnpDlnaProfiler()
+    {
+    __LOG( "[UPnPDlnaProfiler] Constructor" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpDlnaProfiler::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUpnpDlnaProfiler::ConstructL()
+    {
+    __LOG( "[UPnPDlnaProfiler] ConstructL" );
+    CUpnpAudioSolverBase* baseAudioSolver = CUpnpAudioSolverBase::NewL();
+    iAudioSolvers.AppendL( baseAudioSolver );
+    
+    CUpnpAvSolverBase* baseAvSolver = CUpnpAvSolverBase::NewL();
+    iAvSolvers.AppendL( baseAvSolver );
+    
+    CUpnpImageSolverBase* baseImageSolver = CUpnpImageSolverBase::NewL();
+    iImageSolvers.AppendL( baseImageSolver );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpDlnaProfiler::NewL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpDlnaProfiler* CUpnpDlnaProfiler::NewL()
+    {
+    __LOG( "[UPnPDlnaProfiler] NewL" );
+    CUpnpDlnaProfiler* self = CUpnpDlnaProfiler::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpDlnaProfiler::NewLC
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpDlnaProfiler* CUpnpDlnaProfiler::NewLC()
+    {
+    __LOG( "[UPnPDlnaProfiler] NewLC" );
+    CUpnpDlnaProfiler* self = new( ELeave ) CUpnpDlnaProfiler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpDlnaProfiler destructor
+// --------------------------------------------------------------------------
+//
+CUpnpDlnaProfiler::~CUpnpDlnaProfiler()
+    {
+    __LOG( "[UPnPDlnaProfiler] Destructor" );
+    iAudioSolvers.ResetAndDestroy();
+    iAudioSolvers.Close();
+    
+    iAvSolvers.ResetAndDestroy();
+    iAvSolvers.Close();
+    
+    iImageSolvers.ResetAndDestroy();
+    iImageSolvers.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDlnaProfiler::SupportedProfilesL
+// Returns DlnaProfiles that are supported with currently loaded solver 
+// plugins.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpDlnaProfiler::SupportedProfilesL( 
+                                          CDesC16ArrayFlat* aProfiles ) const
+    {
+    __LOG( "[UPnPDlnaProfiler] SupportedProfilesL" );
+    TInt retval = KErrNone;
+
+    if ( !aProfiles ) 
+        {
+        // Invalid parameter
+        retval = KErrArgument;
+        }
+    else 
+        {
+        // append all audio profiles recognized 
+        for ( TInt i( iAudioSolvers.Count() - 1 ); i >= 0 ; i-- ) 
+            {
+            MUpnpProfiler* currentProfiler = iAudioSolvers[i];
+            currentProfiler->SupportedProfilesL( aProfiles );
+            }
+        // append all av profiles recognized 
+        for ( TInt i( iAvSolvers.Count() - 1 ); i >= 0 ; i-- ) 
+            {
+            MUpnpProfiler* currentProfiler = iAvSolvers[i];
+            currentProfiler->SupportedProfilesL( aProfiles );
+            }
+        // append all image profiles recognized 
+        for ( TInt i( iImageSolvers.Count() - 1 ); i >= 0 ; i-- ) 
+            {
+            MUpnpProfiler* currentProfiler = iImageSolvers[i];
+            currentProfiler->SupportedProfilesL( aProfiles );
+            }
+        }
+        
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpDlnaProfiler::ProfileForFileL
+// Resolves the DLNA profile for a file given in aFileName parameter.
+// Returns NULL if DLNA profile could not be recognized with currently loaded
+// solver plugins.
+// --------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CUpnpDlnaProfiler::ProfileForFileL( const TDesC& aFilename )
+    {
+    __LOG( "[UPnPDlnaProfiler] ProfileForFileL" );
+    // check that aFileName is reasonable
+    if ( aFilename.Length() <= 0 ) 
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    HBufC* retval = NULL;
+    
+    // try to open file specified by aFileName
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() ); // connect session
+    CleanupClosePushL( fsSession );
+    // without calling ShareProtected() RApaLsSession::RecognizeData 
+    // does not work (leaves with KErrBadHandle).
+    fsSession.ShareProtected();
+    
+    RFile file;  
+    User::LeaveIfError( file.Open( fsSession, 
+                                   aFilename, 
+                                   EFileShareReadersOrWriters|EFileRead ) );
+    CleanupClosePushL( file );
+    
+    // Create an AppArc server session for mime type recognition 
+    RApaLsSession sess;
+    User::LeaveIfError( sess.Connect() );
+    CleanupClosePushL( sess );
+
+    // Try to get mime type from AppArc server
+    TDataRecognitionResult mimeResult;
+    User::LeaveIfError( sess.RecognizeData( file, mimeResult ) );
+    
+    // close session handle
+    CleanupStack::PopAndDestroy( &sess );
+
+    // Data recognition done. Check results.
+    HBufC8* mimetype = HBufC8::NewL( mimeResult.iDataType.Des8().Length() );
+    mimetype->Des().Append( mimeResult.iDataType.Des8() );
+        
+    if ( mimetype && mimetype->Length() > 0 ) 
+        {
+        CleanupStack::PushL( mimetype );
+        retval = DlnaProfileFromSolversL( aFilename, *mimetype, file );
+        CleanupStack::PopAndDestroy( mimetype );
+        }
+
+    // close file and filesession handles
+    CleanupStack::PopAndDestroy( &file );
+    CleanupStack::PopAndDestroy( &fsSession );
+            
+    return retval;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpDlnaProfiler::ProfileForFileL
+// Resolves the DLNA profile for a file given in aFileName parameter.
+// Returns NULL if DLNA profile could not be recognized with currently loaded
+// solver plugins. Takes RFile and CUpnpResParameters parameters in order to 
+// minimize the amount of file opening.
+// --------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CUpnpDlnaProfiler::ProfileForFileL( 
+                                        const TDesC& aFilename, 
+                                        RFile& aFile,
+                                        CUpnpResParameters& aParameters ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] ProfileForFileL" );
+    // check that aFileName is reasonable
+    if ( aFilename.Length() <= 0 || aParameters.MimeType().Length() <= 0 ) 
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    HBufC* retval = NULL;
+
+    retval = DlnaProfileFromSolversL( aFilename, 
+                                      aParameters.MimeType(), 
+                                      aFile );
+            
+    return retval;    
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpDlnaProfiler::DlnaProfileFromSolversL
+// Checks the mime type given as parameter and forwards the recognition task 
+// to solver plugins corresponding the mimetype.
+// --------------------------------------------------------------------------
+//
+HBufC* CUpnpDlnaProfiler::DlnaProfileFromSolversL( 
+                                const TDesC& aFilename, 
+                                const TDesC8& aMimetype, 
+                                RFile& aFile )
+    {
+    __LOG( "[UPnPDlnaProfiler] DlnaProfileFromSolversL" );
+    HBufC* retval = NULL;
+
+    TPtrC8 mediatype = aMimetype.Left( KMimeStartLength );
+    if ( mediatype.Compare( KAudio() ) == 0 ) 
+        {
+        for ( TInt i( iAudioSolvers.Count() - 1 ); i >= 0 && !retval ; i-- ) 
+            {
+            MUpnpProfiler* currentProfiler = iAudioSolvers[i];
+            retval = currentProfiler->ProfileForFileL( aFilename, 
+                                                       aMimetype, 
+                                                       aFile );
+            }
+        }
+    else if ( mediatype.Compare( KVideo() ) == 0 ) 
+        {
+        for ( TInt i( iAvSolvers.Count() - 1 ); i >= 0 && !retval ; i-- ) 
+            {
+            MUpnpProfiler* currentProfiler = iAvSolvers[i];
+            retval = currentProfiler->ProfileForFileL( aFilename, 
+                                                       aMimetype, 
+                                                       aFile );
+            }
+        }
+    else if ( mediatype.Compare( KImage() ) == 0 ) 
+        {
+        for ( TInt i( iImageSolvers.Count() - 1 ); i >= 0 && !retval ; i-- ) 
+            {
+            MUpnpProfiler* currentProfiler = iImageSolvers[i];
+            retval = currentProfiler->ProfileForFileL( aFilename, 
+                                                       aMimetype, 
+                                                       aFile );
+            }
+        }
+    else 
+        {
+        retval = NULL;
+        }
+        
+    return retval;
+    }
+    
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/src/upnpimagesolverbase.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,262 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implementation of base DLNA profile resolver class for image 
+*                files.
+*
+*/
+
+
+
+
+
+
+// system includes
+#include <imageconversion.h>
+#include <caf/caftypes.h> // ContentAccess
+#include <badesca.h> // CDesC16ArrayFlat
+
+// user includes
+#include "upnpimagesolverbase.h"
+
+_LIT( KComponentLogfile, "dlnaprofiler.txt");
+#include "upnplog.h"
+
+// constants
+_LIT8( KImageJpeg, "image/jpeg" );
+_LIT( KJpeg_sm, "JPEG_SM" );
+_LIT( KJpeg_med, "JPEG_MED" );
+_LIT( KJpeg_lrg, "JPEG_LRG" );
+
+_LIT( KJpeg_tn, "JPEG_TN" );
+_LIT( KJpeg_lrg_ico, "JPEG_LRG_ICO" );
+_LIT( KJpeg_sm_ico, "JPEG_SM_ICO" );
+
+_LIT8( KImagePng, "image/png" );
+_LIT( KPngLrg, "PNG_LRG" );
+
+
+const TInt KJpeg_smico_max_width = 48;
+const TInt KJpeg_smico_max_height = 48;
+const TInt KJpeg_lrgico_max_width = 120;
+const TInt KJpeg_lrgico_max_height = 120;
+const TInt KJpeg_sm_max_width = 640;
+const TInt KJpeg_sm_max_height = 480;
+const TInt KJpeg_med_max_width = 1024;
+const TInt KJpeg_med_max_height = 768;
+const TInt KJpeg_lrg_max_width = 4096;
+const TInt KJpeg_lrg_max_height = 4096;
+const TInt KPng_lrg_max_width = 4096;
+const TInt KPng_lrg_max_height = 4096;
+
+// ======== LOCAL FUNCTIONS ========
+// NONE
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUpnpImageSolverBase C++ constructor
+// --------------------------------------------------------------------------
+//
+CUpnpImageSolverBase::CUpnpImageSolverBase()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpImageSolverBase constructor" );
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpImageSolverBase::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUpnpImageSolverBase::ConstructL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpImageSolverBase::ConstructL" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpImageSolverBase::NewL
+// --------------------------------------------------------------------------
+//
+CUpnpImageSolverBase* CUpnpImageSolverBase::NewL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpImageSolverBase::NewL" );
+    CUpnpImageSolverBase* self = CUpnpImageSolverBase::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpImageSolverBase::NewLC
+// --------------------------------------------------------------------------
+//
+CUpnpImageSolverBase* CUpnpImageSolverBase::NewLC()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpImageSolverBase::NewLC" );
+    CUpnpImageSolverBase* self = new( ELeave ) CUpnpImageSolverBase;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpImageSolverBase destructor
+// --------------------------------------------------------------------------
+//
+CUpnpImageSolverBase::~CUpnpImageSolverBase()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpImageSolverBase destructor" );
+    }
+
+// --------------------------------------------------------------------------
+// From class MUpnpProfiler.
+// SupportedProfilesL returns DLNA profiles that are currently supported.
+// --------------------------------------------------------------------------
+//
+TInt CUpnpImageSolverBase::SupportedProfilesL( 
+                                        CDesC16ArrayFlat* aProfiles ) const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpImageSolverBase::\
+SupportedProfilesL" );
+    TInt retval = KErrNone;
+    
+    if ( !aProfiles ) 
+        {
+        // Invalid parameter
+        retval = KErrArgument;
+        }
+    else 
+        {
+        // append all new profiles recognized by this solver
+        // do not allow duplicates
+        TInt tempPos = KErrNotFound;
+        
+        if ( aProfiles->Find( KJpeg_sm(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KJpeg_sm() );
+            }
+        if ( aProfiles->Find( KJpeg_med(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KJpeg_med() );
+            }
+        if ( aProfiles->Find( KJpeg_lrg(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KJpeg_lrg() );
+            }
+        if ( aProfiles->Find( KPngLrg(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KPngLrg() );
+            }
+        if ( aProfiles->Find( KJpeg_tn(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KJpeg_tn() );
+            }            
+        if ( aProfiles->Find( KJpeg_lrg_ico(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KJpeg_lrg_ico() );
+            }            
+        if ( aProfiles->Find( KJpeg_sm_ico(), tempPos, ECmpFolded ) ) 
+            {
+            aProfiles->AppendL( KJpeg_sm_ico() );
+            }            
+
+
+        }    
+
+    return retval;
+    }
+    
+// --------------------------------------------------------------------------
+// From class MUpnpProfiler.
+// ProfileForFileL is for resolving a DLNA profile of a given file. Besides 
+// of file name, also mime type of the file is passed as a parameter in order 
+// to avoid re-opening the file.
+// --------------------------------------------------------------------------
+//
+HBufC* CUpnpImageSolverBase::ProfileForFileL( const TDesC& /*aFilename*/, 
+                                              const TDesC8& aMimetype, 
+                                              RFile& aFile )
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpImageSolverBase::ProfileForFileL" );
+    HBufC* retval = NULL;
+       
+
+    CImageDecoder* imageDecoder = CImageDecoder::FileNewL(
+                                                    aFile,
+                                                    aMimetype,
+                                                    ContentAccess::EPeek );
+    
+    CleanupStack::PushL( imageDecoder );
+
+    TSize imageResolution = imageDecoder->FrameInfo().iOverallSizeInPixels;
+
+    if ( aMimetype.Compare( KImageJpeg() ) == 0 ) 
+        {        
+        // assuming here that thumbnails are not supported and that we do 
+        // not use device icons or at least we do not resolve DLNA profile 
+        // of device icons with this component.
+
+        if ( imageResolution.iWidth <= KJpeg_smico_max_width && 
+             imageResolution.iHeight <= KJpeg_smico_max_height ) 
+            {
+            retval = HBufC::NewL( KJpeg_sm_ico().Length() );
+            retval->Des().Append( KJpeg_sm_ico() );
+            }
+        else if ( imageResolution.iWidth <= KJpeg_lrgico_max_width && 
+             imageResolution.iHeight <= KJpeg_lrgico_max_height ) 
+            {
+            retval = HBufC::NewL( KJpeg_lrg_ico().Length() );
+            retval->Des().Append( KJpeg_lrg_ico() );
+            }
+        else if ( imageResolution.iWidth <= KJpeg_sm_max_width && 
+             imageResolution.iHeight <= KJpeg_sm_max_height ) 
+            {
+            retval = HBufC::NewL( KJpeg_sm().Length() );
+            retval->Des().Append( KJpeg_sm() );
+            }
+        else if ( imageResolution.iWidth <= KJpeg_med_max_width && 
+                  imageResolution.iHeight <= KJpeg_med_max_height )
+            {
+            retval = HBufC::NewL( KJpeg_med().Length() );
+            retval->Des().Append( KJpeg_med() );
+            }
+        else if ( imageResolution.iWidth <= KJpeg_lrg_max_width && 
+                  imageResolution.iHeight <= KJpeg_lrg_max_height )
+            {
+            retval = HBufC::NewL( KJpeg_lrg().Length() );
+            retval->Des().Append( KJpeg_lrg() );
+            }
+
+        }
+    else if ( aMimetype.Compare( KImagePng() ) == 0 ) 
+        {
+        // assuming here that thumbnails are not supported and that we do 
+        // not use device icons or at least we do not resolve DLNA profile 
+        // of device icons with this component. This leads to profiling all
+        // png-files as PNG_LRG in case their size is less than 4096x4096.
+        if ( imageResolution.iWidth <= KPng_lrg_max_width && 
+             imageResolution.iHeight <= KPng_lrg_max_height )
+            {
+            retval = HBufC::NewL( KPngLrg().Length() );
+            retval->Des().Append( KPngLrg() );
+            }
+        }
+        
+    // clean up
+    CleanupStack::PopAndDestroy( imageDecoder );
+      
+    return retval;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/src/upnpresparameters.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,337 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implementation file of CUpnpResParameters class. 
+*                CUpnpResParameters is created to encapsulate information  
+*                that is needed in a contentdirectory res element.
+*
+*/
+
+
+
+
+
+
+// system includes
+
+// user includes
+#include "upnpresparameters.h"
+#include "upnpdlnaprofiler.h"
+
+_LIT( KComponentLogfile, "dlnaprofiler.txt");
+#include "upnplog.h"
+
+
+// constants
+const TInt KMaxTintLength = 20; // max. TInt string representation length.
+const TInt KMinutesInHour = 60;
+const TInt KSecondsInMinute = 60;
+const TInt KSecondsInHour = KMinutesInHour * KSecondsInMinute;
+
+const TInt KHourMaxLength = 5;
+const TInt KMinutesLength = 2;
+const TInt KSecondsLength = 2;
+
+_LIT( KResolutionDivider, "x" );
+_LIT( KTimeDivider, ":" );
+_LIT( KZero, "0" );
+
+    
+// ======== LOCAL FUNCTIONS ========
+// NONE
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters C++ constructor
+// --------------------------------------------------------------------------
+//
+CUpnpResParameters::CUpnpResParameters()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters constructor" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUpnpResParameters::ConstructL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::ConstructL" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::NewL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpResParameters* CUpnpResParameters::NewL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::NewL" );
+    CUpnpResParameters* self = CUpnpResParameters::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::NewLC
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpResParameters* CUpnpResParameters::NewLC()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::NewLC" );
+    CUpnpResParameters* self = new( ELeave ) CUpnpResParameters;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters destructor
+// --------------------------------------------------------------------------
+//
+CUpnpResParameters::~CUpnpResParameters()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters destructor" );
+    delete iProtocolInfo;
+    delete iMimetype;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::ProtocolInfo
+// --------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CUpnpResParameters::ProtocolInfo() const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::ProtocolInfo" );
+
+    if ( iProtocolInfo ) 
+        {
+        return *iProtocolInfo;
+        }
+
+    return KNullDesC8();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::FileSizeL
+// --------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CUpnpResParameters::FileSizeL() const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::FileSizeL" );
+    HBufC8* retval = NULL;
+    
+    TBuf<KMaxTintLength> sizeOfFile;
+    sizeOfFile.Num( iFileSize );
+    
+    retval = HBufC8::NewL( sizeOfFile.Length() );
+    retval->Des().Append( sizeOfFile );
+    
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::DurationL
+//
+//   Requirement [7.3.22.1]: The syntax of the res@duration must be 
+//   compliant to the following definition:
+//     duration = hours ":" minutes ":" seconds
+//     hours = 1*5 DIGIT; 0-99999
+//     minutes = 2 DIGIT ; 00-59
+//     seconds = 2 DIGIT ["." 3 DIGIT] ; 00-59 (.000-.999) 
+// --------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CUpnpResParameters::DurationL() const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::DurationL" );
+    HBufC8* retval = NULL;
+
+    // Leave if the duration has invalid value
+    if( iDurationInSeconds < 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TInt hour = iDurationInSeconds / KSecondsInHour;
+    TInt min = (iDurationInSeconds % KSecondsInHour) / KSecondsInMinute;
+    TInt sec = (iDurationInSeconds % KSecondsInHour) % KSecondsInMinute;
+
+    // Leave if the duration is longer than allowed (99999h 99min 99sec)
+    if( hour >= 100000 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Convert TInt to TBuf
+    TBuf<KHourMaxLength> hours;
+    hours.Num( hour );
+    hours.Trim();
+
+    TBuf<2> minutes;
+    minutes.Num( min );
+
+    TBuf<2> seconds;
+    seconds.Num( sec );
+
+    retval = HBufC8::NewL( hours.Length() + 
+                           KTimeDivider().Length() + 
+                           KMinutesLength +
+                           KTimeDivider().Length() + 
+                           KSecondsLength );
+
+    retval->Des().Append( hours );
+    retval->Des().Append( KTimeDivider() );
+    if( min < 10 )
+        {
+        retval->Des().Append( KZero() );
+        }
+    retval->Des().Append( minutes );
+    retval->Des().Append( KTimeDivider() );
+    if( sec < 10 )
+        {
+        retval->Des().Append( KZero() );
+        }
+    retval->Des().Append( seconds );
+
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::ResolutionL
+// --------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CUpnpResParameters::ResolutionL() const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::ResolutionL" );
+    HBufC8* retval = NULL;
+    
+    TBuf<KMaxTintLength> width;
+    width.Num( iResolution.iWidth );
+
+    TBuf<KMaxTintLength> height;
+    height.Num( iResolution.iHeight );
+
+    retval = HBufC8::NewL( width.Length() + 
+                          KResolutionDivider().Length() + 
+                          height.Length() );
+                          
+    retval->Des().Append( width );
+    retval->Des().Append( KResolutionDivider() );
+    retval->Des().Append( height );
+    
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::IsImageFile
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpResParameters::IsImageFile() const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::IsImageFile" );
+    TBool retval = EFalse;
+
+    if ( iMimetype->Left( KMimeStartLength ).Compare( KImage() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::IsAudioOrVideoFile
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpResParameters::IsAudioOrVideoFile() const
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::IsAudioOrVideoFile" );
+    TBool retval = EFalse;
+
+    if ( iMimetype->Left( KMimeStartLength ).Compare( KVideo() ) == 0 ||
+         iMimetype->Left( KMimeStartLength ).Compare( KAudio() ) == 0 ) 
+        {
+        retval = ETrue;
+        }
+
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::SetProtocolInfoL
+// --------------------------------------------------------------------------
+//
+void CUpnpResParameters::SetProtocolInfoL( const TDesC8& aProtocolInfo ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::SetProtocolInfoL" );
+    iProtocolInfo = aProtocolInfo.AllocL();    
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::SetMimetypeL
+// --------------------------------------------------------------------------
+//  
+void CUpnpResParameters::SetMimetypeL( const TDesC8& aMimetype )
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::SetMimetypeL" );
+    iMimetype = aMimetype.AllocL();
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::SetFileSize
+// --------------------------------------------------------------------------
+//
+void CUpnpResParameters::SetFileSize( TInt aFileSize )
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::SetFileSize" );
+    iFileSize = aFileSize;
+    }
+// --------------------------------------------------------------------------
+// CUpnpResParameters::SetResolution
+// --------------------------------------------------------------------------
+//
+void CUpnpResParameters::SetResolution( TSize aResolution ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::SetResolution" );
+    iResolution = aResolution;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::SetDurationInSeconds
+// --------------------------------------------------------------------------
+//
+void CUpnpResParameters::SetDurationInSeconds( TInt64 aDuration ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResParameters::\
+SetDurationInSeconds" );
+    iDurationInSeconds = aDuration;
+    }
+
+// --------------------------------------------------------------------------
+// CUpnpResParameters::MimeType
+// --------------------------------------------------------------------------
+//    
+const TDesC8& CUpnpResParameters::MimeType() 
+    {
+    if ( iMimetype ) 
+        {
+        return *iMimetype;
+        }
+    
+    return KNullDesC8();
+    }
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpdlnaprofiler/src/upnpresresolver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,440 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:      Implementation file of CUpnpResResolver class. 
+*                CUpnpResResolver is a class used for resolving res field 
+*                attributes for a given file.
+*
+*/
+
+
+
+
+
+
+// system includes
+#include <f32file.h> // RFile
+#include <apgcli.h> // RApaLsSession
+#include <upnpdlnaprotocolinfo.h> // CUpnpDlnaProtocolInfo
+#include <imageconversion.h> // CImageDecoder
+#include <caf/caftypes.h> // ContentAccess
+#include <3gplibrary/mp4lib.h> // MP4ParseRequestAudioDescription
+#include <escapeutils.h> // EscapeUtils::ConvertFromUnicodeToUtf8L
+
+// user includes
+#include "upnpresresolver.h"
+#include "upnpdlnaprofiler.h"
+#include "upnpresparameters.h"
+
+_LIT( KComponentLogfile, "dlnaprofiler.txt");
+#include "upnplog.h"
+
+// constants
+_LIT8( KHttpGet8, "http-get" );
+_LIT8( KStar8, "*" );
+
+const TInt KMicrosecondsInSecond = 1000000;
+const TInt KMilliSecondsInSecond = 1000;
+
+// ======== LOCAL FUNCTIONS ========
+// NONE
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver C++ constructor
+// --------------------------------------------------------------------------
+//
+CUpnpResResolver::CUpnpResResolver() : iDuration(0)
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver constructor" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver::ConstructL
+// --------------------------------------------------------------------------
+//
+void CUpnpResResolver::ConstructL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::ConstructL" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver::NewL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpResResolver* CUpnpResResolver::NewL()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::NewL" );
+    CUpnpResResolver* self = CUpnpResResolver::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver::NewLC
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpResResolver* CUpnpResResolver::NewLC()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::NewLC" );
+    CUpnpResResolver* self = new( ELeave ) CUpnpResResolver;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver destructor
+// --------------------------------------------------------------------------
+//
+CUpnpResResolver::~CUpnpResResolver()
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver destructor" );
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver::GetResParametersL
+// --------------------------------------------------------------------------
+//
+EXPORT_C CUpnpResParameters* CUpnpResResolver::GetResParametersL( 
+                                                    const TDesC& aFilename ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::GetResParametersL" );
+    // check that aFileName is reasonable
+    if ( aFilename.Length() <= 0 ) 
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    // Create object that will be returned.
+    CUpnpResParameters* retval = CUpnpResParameters::NewLC();
+
+    // try to open file specified by aFileName
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() ); // connect session
+    CleanupClosePushL( fsSession );
+    // without calling ShareProtected() RApaLsSession::RecognizeData 
+    // does not work (leaves with KErrBadHandle).
+    fsSession.ShareProtected();
+
+    RFile file;
+    User::LeaveIfError( file.Open( fsSession, 
+                                   aFilename, 
+                                   EFileShareReadersOrWriters|EFileRead ) );
+    CleanupClosePushL( file );
+    
+    // Obtain mimetype of the file
+    HBufC8* mimetype = GetMimetypeL( file );
+    CleanupStack::PushL( mimetype );
+    retval->SetMimetypeL( *mimetype );
+
+    // Obtain file size
+    TInt filesize = GetFileSizeL( file );
+    retval->SetFileSize( filesize );
+
+    // Obtain duration for video&audio files and resolution for images.
+    TSize imageResolution( KErrNotFound, KErrNotFound );
+    if ( mimetype->Left( KMimeStartLength ).Compare( KVideo() ) == 0 ) 
+        {
+        GetVideoDurationL( file );
+        retval->SetDurationInSeconds( iDuration.Int64() );
+        }
+    else if ( mimetype->Left( KMimeStartLength ).Compare( KAudio() ) == 0 ) 
+        {
+        GetAudioDurationL( aFilename );
+        retval->SetDurationInSeconds( 
+                                iDuration.Int64() / KMicrosecondsInSecond );
+        }
+    else if ( mimetype->Left( KMimeStartLength ).Compare( KImage() ) == 0 ) 
+        {
+        TRAPD( err, imageResolution = GetImageResolutionL( file, 
+                                                           *mimetype ) );
+        if ( !err ) 
+            {
+            retval->SetResolution( imageResolution );
+            }
+        }
+
+    // Construct CUpnpDlnaProtocolInfo object.
+    CUpnpDlnaProtocolInfo* protocolInfo = CUpnpDlnaProtocolInfo::NewL(); 
+    CleanupStack::PushL( protocolInfo ); 
+    protocolInfo->SetFirstFieldL( KHttpGet8() ); 
+    protocolInfo->SetSecondFieldL( KStar8() ); 
+    protocolInfo->SetThirdFieldL( *mimetype ); 
+        
+    // Obtain DLNA Profile ID
+    CUpnpDlnaProfiler* profiler = CUpnpDlnaProfiler::NewLC();
+    HBufC* PnParameter = NULL;
+    TRAPD( profileErr, 
+           PnParameter = profiler->ProfileForFileL( aFilename,
+                                                    file,
+                                                    *retval ) );
+    CleanupStack::PopAndDestroy( profiler );
+    
+    if ( PnParameter && !profileErr ) 
+        {
+        // Set DLNA Profile name (PN parameter)
+        CleanupStack::PushL( PnParameter );
+        HBufC8* profileName8bit = 
+            EscapeUtils::ConvertFromUnicodeToUtf8L( *PnParameter );
+        CleanupStack::PushL( profileName8bit );
+        protocolInfo->SetPnParameterL( *profileName8bit );
+        CleanupStack::PopAndDestroy( profileName8bit );
+
+        // OP parameter is always the same in our CDS.
+        protocolInfo->SetOpParameterL( 
+                                   UpnpDlnaProtocolInfo::KDEFAULT_DLNA_OP ); 
+
+        // Set Flags according to file type.
+        if ( mimetype->Left( KMimeStartLength ).Compare( KVideo() ) == 0 ) 
+            {
+            protocolInfo->SetFlagsParameterL( 
+                           UpnpDlnaProtocolInfo::KDEFAULT_DLNA_FLAGS_AV );
+            }
+        else if 
+           ( mimetype->Left( KMimeStartLength ).Compare( KAudio() ) == 0 ) 
+            {
+            protocolInfo->SetFlagsParameterL( 
+                           UpnpDlnaProtocolInfo::KDEFAULT_DLNA_FLAGS_AUDIO );
+            }
+        else if 
+           ( mimetype->Left( KMimeStartLength ).Compare( KImage() ) == 0 ) 
+            {
+            protocolInfo->SetFlagsParameterL( 
+                           UpnpDlnaProtocolInfo::KDEFAULT_DLNA_FLAGS_IMAGE );
+            }
+                            
+        CleanupStack::PopAndDestroy( PnParameter );
+        }
+
+    retval->SetProtocolInfoL( protocolInfo->ProtocolInfoL() );
+
+    // clean up
+    CleanupStack::PopAndDestroy( protocolInfo );
+    CleanupStack::PopAndDestroy( mimetype );
+    CleanupStack::PopAndDestroy( &file );
+    CleanupStack::PopAndDestroy( &fsSession );
+    CleanupStack::Pop( retval );
+    return retval;
+
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver::GetMimetypeL
+// --------------------------------------------------------------------------
+//
+HBufC8* CUpnpResResolver::GetMimetypeL( RFile& aFile ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::GetMimetypeL" );
+    HBufC8* retval = NULL;
+    // Create an AppArc server session for mime type recognition 
+    RApaLsSession sess;
+    User::LeaveIfError( sess.Connect() );
+    CleanupClosePushL( sess );
+
+    // Try to get mime type from AppArc server
+    TDataRecognitionResult mimeResult;
+    User::LeaveIfError( sess.RecognizeData( aFile, mimeResult ) );
+    
+    // close session handle
+    CleanupStack::PopAndDestroy( &sess );
+
+    // Data recognition done. Check results.
+    retval = mimeResult.iDataType.Des8().AllocL();
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver::GetVideoDurationL
+// --------------------------------------------------------------------------
+//
+void CUpnpResResolver::GetVideoDurationL( RFile& aFile )  
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::GetVideoDurationL" );
+    mp4_u32 videolength = 0;  
+    mp4_double framerate = 0; 
+    mp4_u32 videotype = 0;    
+    mp4_u32 videowidth = 0;   
+    mp4_u32 videoheight = 0;  
+    mp4_u32 timescale = 0; 
+
+    MP4Handle myMp4Handle;
+    
+    // try open mp4 file handle
+    MP4Err openerr = MP4ParseOpenFileHandle( &myMp4Handle, &aFile );
+    switch ( openerr )
+        {
+        case MP4_OK :
+        	{
+        	// obtain necessary information from file
+            MP4Err requesterr = MP4ParseRequestVideoDescription( 
+                                                myMp4Handle, 
+                                                &videolength,   
+                                                &framerate,     
+                                                &videotype,     
+                                                &videowidth,    
+                                                &videoheight,   
+                                                &timescale );
+               
+            // close mp4 file handle
+            MP4Err closeerr = MP4ParseClose( myMp4Handle );
+            if ( closeerr || requesterr ) 
+                {
+                User::Leave( KErrGeneral );
+                }
+        	}
+        	break;
+        case MP4_ERROR :
+        	{
+        	User::Leave( KErrGeneral );
+        	}
+        	break;
+        case MP4_OUT_OF_MEMORY :
+        	{
+        	User::Leave( KErrNoMemory );
+        	}
+        	break;
+        case MP4_FILE_ERROR :
+        	{
+        	User::Leave( KErrAccessDenied );
+        	}
+        	break;
+        default :
+            User::Leave( KErrGeneral );
+            break;
+        }
+    // videolength in milliseconds
+    iDuration = videolength/KMilliSecondsInSecond;
+    }
+    
+// --------------------------------------------------------------------------
+// CUpnpResResolver::GetAudioDurationL
+// --------------------------------------------------------------------------
+//
+void CUpnpResResolver::GetAudioDurationL( const TDesC& aFilename ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::GetAudioDurationL" );
+
+    // create audioplayer if it does not exist
+    if ( !iAudioplayer ) 
+        {
+        iAudioplayer = CMdaAudioPlayerUtility::NewL( *this );
+        }
+
+    // Create iWait if it does not exist. Create it here rather than after 
+    // OpenL-call so that there will be no problems if somehow OpenFileL 
+    // calls MapcInitComplete-callback before iWait is created and started.
+    if ( !iWait ) 
+        {
+        iWait = new( ELeave ) CActiveSchedulerWait;
+        }
+
+    // Open file specified in aFilename. This is an asynchronic operation. 
+    // Calls MapcInitComplete callback after completed.
+    iAudioplayer->OpenFileL( aFilename );
+    
+    // start CActiveSchedulerWait which is completed in MapcInitComplete
+    iWait->Start();
+
+    // clean up
+    delete iAudioplayer;
+    iAudioplayer = NULL;
+    
+    delete iWait;
+    iWait = NULL;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver::GetFileSizeL
+// --------------------------------------------------------------------------
+//
+TInt CUpnpResResolver::GetFileSizeL( RFile& aFile ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::GetFileSizeL" );
+    TInt retval = KErrNone;
+    User::LeaveIfError( aFile.Size( retval ) );
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// CUpnpResResolver::GetImageResolutionL
+// --------------------------------------------------------------------------
+//  
+TSize CUpnpResResolver::GetImageResolutionL( RFile& aFile, 
+                                             const TDesC8& aMimetype )
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::GetImageResolutionL" );
+    CImageDecoder* imageDecoder = NULL;
+    TRAPD( createError, imageDecoder = CImageDecoder::FileNewL(
+                                                    aFile,
+                                                    aMimetype, 
+                                                    ContentAccess::EPeek ) );
+
+    if ( createError ) 
+        {
+        __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::GetImageResolutionL \
+CreateError" );
+        User::Leave( createError );
+        }
+                                                              
+    CleanupStack::PushL( imageDecoder );
+    TSize imageResolution = imageDecoder->FrameInfo().iOverallSizeInPixels;
+    CleanupStack::PopAndDestroy( imageDecoder );
+    
+    return imageResolution;
+    }
+    
+// --------------------------------------------------------------------------
+// From class MMdaAudioPlayerCallback.
+// MapcPlayComplete callback (not used)
+// --------------------------------------------------------------------------
+//
+void CUpnpResResolver::MapcPlayComplete( TInt /*aError*/ ) 
+    {
+    //this callback is not needed
+    }
+
+// --------------------------------------------------------------------------
+// From class MMdaAudioPlayerCallback.
+// MapcInitComplete callback is called after a call to 
+// CMdaAudioConvertUtility::OpenL has completed.
+// --------------------------------------------------------------------------
+//
+void CUpnpResResolver::MapcInitComplete( 
+                                TInt aError, 
+                                const TTimeIntervalMicroSeconds& aDuration ) 
+    {
+    __LOG( "[UPnPDlnaProfiler] CUpnpResResolver::MapcInitComplete" );
+ 
+    // if opening was successful, save duration to member variable
+    if( KErrNone == aError )
+        {
+        iDuration = aDuration;
+        }
+
+    // continue execution in GetAudioDurationL-method by stopping 
+    // ActiveSchedulerWait
+    iWait->AsyncStop();
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/bwins/upnpsecurityU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,15 @@
+EXPORTS
+	??1CUpnpSecAccessController@@UAE@XZ @ 1 NONAME ; CUpnpSecAccessController::~CUpnpSecAccessController(void)
+	?AddAllowedAddress@CUpnpSecAccessController@@QAEHABVTInetAddr@@@Z @ 2 NONAME ; int CUpnpSecAccessController::AddAllowedAddress(class TInetAddr const &)
+	?AddAllowedFile@CUpnpSecAccessController@@QAEHABVTDesC16@@@Z @ 3 NONAME ; int CUpnpSecAccessController::AddAllowedFile(class TDesC16 const &)
+	?CheckAuthorizationL@CUpnpSecAccessController@@QAEXABVTInetAddr@@ABVTDesC16@@ABVTDesC8@@@Z @ 4 NONAME ; void CUpnpSecAccessController::CheckAuthorizationL(class TInetAddr const &, class TDesC16 const &, class TDesC8 const &)
+	?DisableMediaServerSecurityL@CUpnpSecAccessController@@SAXXZ @ 5 NONAME ; void CUpnpSecAccessController::DisableMediaServerSecurityL(void)
+	?EnableMediaServerSecurityL@CUpnpSecAccessController@@SAXXZ @ 6 NONAME ; void CUpnpSecAccessController::EnableMediaServerSecurityL(void)
+	?IsMediaServerSecurityEnabledL@CUpnpSecAccessController@@SAHXZ @ 7 NONAME ; int CUpnpSecAccessController::IsMediaServerSecurityEnabledL(void)
+	?NewL@CUpnpSecAccessController@@SAPAV1@XZ @ 8 NONAME ; class CUpnpSecAccessController * CUpnpSecAccessController::NewL(void)
+	?QueryAuthorizationL@CUpnpSecAccessController@@QAEXABVTInetAddr@@@Z @ 9 NONAME ; void CUpnpSecAccessController::QueryAuthorizationL(class TInetAddr const &)
+	?RemoveAllowedAddress@CUpnpSecAccessController@@QAEHABVTInetAddr@@@Z @ 10 NONAME ; int CUpnpSecAccessController::RemoveAllowedAddress(class TInetAddr const &)
+	?RemoveAllowedFile@CUpnpSecAccessController@@QAEHABVTDesC16@@@Z @ 11 NONAME ; int CUpnpSecAccessController::RemoveAllowedFile(class TDesC16 const &)
+	?ResetAddressList@CUpnpSecAccessController@@QAEHXZ @ 12 NONAME ; int CUpnpSecAccessController::ResetAddressList(void)
+	?ResetFileList@CUpnpSecAccessController@@QAEHXZ @ 13 NONAME ; int CUpnpSecAccessController::ResetFileList(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/bwins/upnpsecuritymanagerclientu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,12 @@
+EXPORTS
+	??0RUpnpSecurityManagerClientSession@@QAE@XZ @ 1 NONAME ; RUpnpSecurityManagerClientSession::RUpnpSecurityManagerClientSession(void)
+	?AddAddressL@RUpnpSecurityManagerClientSession@@QAEXABVTInetAddr@@@Z @ 2 NONAME ; void RUpnpSecurityManagerClientSession::AddAddressL(class TInetAddr const &)
+	?AddFileL@RUpnpSecurityManagerClientSession@@QAEXABVTDesC16@@@Z @ 3 NONAME ; void RUpnpSecurityManagerClientSession::AddFileL(class TDesC16 const &)
+	?CheckAuthorizationL@RUpnpSecurityManagerClientSession@@QAE?AW4TAccessType@@ABVTInetAddr@@ABVTDesC16@@@Z @ 4 NONAME ; enum TAccessType RUpnpSecurityManagerClientSession::CheckAuthorizationL(class TInetAddr const &, class TDesC16 const &)
+	?Connect@RUpnpSecurityManagerClientSession@@QAEHXZ @ 5 NONAME ; int RUpnpSecurityManagerClientSession::Connect(void)
+	?QueryAuthorisationL@RUpnpSecurityManagerClientSession@@QAE?AW4TAccessType@@ABVTInetAddr@@@Z @ 6 NONAME ; enum TAccessType RUpnpSecurityManagerClientSession::QueryAuthorisationL(class TInetAddr const &)
+	?RemoveAddressL@RUpnpSecurityManagerClientSession@@QAEXABVTInetAddr@@@Z @ 7 NONAME ; void RUpnpSecurityManagerClientSession::RemoveAddressL(class TInetAddr const &)
+	?RemoveFileL@RUpnpSecurityManagerClientSession@@QAEXABVTDesC16@@@Z @ 8 NONAME ; void RUpnpSecurityManagerClientSession::RemoveFileL(class TDesC16 const &)
+	?ResetAddressListL@RUpnpSecurityManagerClientSession@@QAEXXZ @ 9 NONAME ; void RUpnpSecurityManagerClientSession::ResetAddressListL(void)
+	?ResetFileListL@RUpnpSecurityManagerClientSession@@QAEXXZ @ 10 NONAME ; void RUpnpSecurityManagerClientSession::ResetFileListL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/data/101F977E.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions for project UpnpSecurityManager plugin
+*
+*/
+
+// INCLUDES
+#include "upnpsecurityuids.h"
+#include "ecom/registryinfo.rh"
+
+// RESOURCE DEFINITIONS
+
+// --------------------------------------------------------------------------
+// theInfo
+// ECom interface definition for UPnP Security Manager plugin.
+// --------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = KUpnpSecurityManagerPluginDllUid;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KUpnpSecurityManagerPluginInterfaceUid;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUpnpSecurityManagerPluginImplementationUid;
+                    version_no = 2;
+                    display_name       = "Upnp Security Manager Plugin";
+                    default_data       = "UpnpSecurityManager";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/data/upnpnotifier.rss	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource file for UpnpAccessController
+*
+*/
+
+// INCLUDE
+#include <eikon.rh>
+#include <eikon.rsg>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <upnpsharing.loc>
+
+NAME UNOT
+
+RESOURCE RSS_SIGNATURE { }
+
+STRUCT STRING { LTEXT buf; }
+
+//  RESOURCE DEFINITIONS 
+
+
+// --------------------------------------------------------------------------
+//
+//  r_upnpnotifier_incoming_device_text
+//
+//  UPnP authorization query, second version
+//
+// --------------------------------------------------------------------------
+//
+RESOURCE STRING r_upnpnotifier_incoming_device_text
+    {
+    buf = qtn_iupnp_incoming_device;
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/eabi/upnpsecurityU.DEF	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,20 @@
+EXPORTS
+	_ZN24CUpnpSecAccessController13ResetFileListEv @ 1 NONAME
+	_ZN24CUpnpSecAccessController14AddAllowedFileERK7TDesC16 @ 2 NONAME
+	_ZN24CUpnpSecAccessController16ResetAddressListEv @ 3 NONAME
+	_ZN24CUpnpSecAccessController17AddAllowedAddressERK9TInetAddr @ 4 NONAME
+	_ZN24CUpnpSecAccessController17RemoveAllowedFileERK7TDesC16 @ 5 NONAME
+	_ZN24CUpnpSecAccessController19CheckAuthorizationLERK9TInetAddrRK7TDesC16RK6TDesC8 @ 6 NONAME
+	_ZN24CUpnpSecAccessController19QueryAuthorizationLERK9TInetAddr @ 7 NONAME
+	_ZN24CUpnpSecAccessController20RemoveAllowedAddressERK9TInetAddr @ 8 NONAME
+	_ZN24CUpnpSecAccessController26EnableMediaServerSecurityLEv @ 9 NONAME
+	_ZN24CUpnpSecAccessController27DisableMediaServerSecurityLEv @ 10 NONAME
+	_ZN24CUpnpSecAccessController29IsMediaServerSecurityEnabledLEv @ 11 NONAME
+	_ZN24CUpnpSecAccessController4NewLEv @ 12 NONAME
+	_ZN24CUpnpSecAccessControllerD0Ev @ 13 NONAME
+	_ZN24CUpnpSecAccessControllerD1Ev @ 14 NONAME
+	_ZN24CUpnpSecAccessControllerD2Ev @ 15 NONAME
+	_ZTI24CUpnpSecAccessController @ 16 NONAME ; #<TI>#
+	_ZTV24CUpnpSecAccessController @ 17 NONAME ; #<VT>#
+	_ZN24CUpnpSecAccessController27DebugSimulateNextUserAnswerEi @ 18 NONAME ABSENT
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/eabi/upnpsecuritymanagerclientu.def	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	_ZN33RUpnpSecurityManagerClientSession11AddAddressLERK9TInetAddr @ 1 NONAME
+	_ZN33RUpnpSecurityManagerClientSession11RemoveFileLERK7TDesC16 @ 2 NONAME
+	_ZN33RUpnpSecurityManagerClientSession14RemoveAddressLERK9TInetAddr @ 3 NONAME
+	_ZN33RUpnpSecurityManagerClientSession14ResetFileListLEv @ 4 NONAME
+	_ZN33RUpnpSecurityManagerClientSession17ResetAddressListLEv @ 5 NONAME
+	_ZN33RUpnpSecurityManagerClientSession19CheckAuthorizationLERK9TInetAddrRK7TDesC16 @ 6 NONAME
+	_ZN33RUpnpSecurityManagerClientSession19QueryAuthorisationLERK9TInetAddr @ 7 NONAME
+	_ZN33RUpnpSecurityManagerClientSession7ConnectEv @ 8 NONAME
+	_ZN33RUpnpSecurityManagerClientSession8AddFileLERK7TDesC16 @ 9 NONAME
+	_ZN33RUpnpSecurityManagerClientSessionC1Ev @ 10 NONAME
+	_ZN33RUpnpSecurityManagerClientSessionC2Ev @ 11 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/group/bld.inf	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for UpnpSecurity
+*
+*/
+
+PRJ_EXPORTS
+../inc/upnpsecaccesscontroller.h       |../../../inc/upnpsecaccesscontroller.h
+
+PRJ_MMPFILES
+upnpsecuritymanagerserver.mmp
+upnpsecuritymanagerclient.mmp
+upnpsecurity.mmp
+upnpsecuritymanagerplugin.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/group/upnpsecurity.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for UpnpSecurity implementation
+*
+*/
+
+#include "../../../group/upnpplatformvar.hrh"
+#include "upnpsecurityuids.h"
+#include <data_caging_paths.hrh>
+
+// Build target
+TARGET          upnpsecurity.dll
+TARGETTYPE      DLL
+UID             KGenericDllUid2 KUpnpSecurityDllUid3
+
+// Platform security
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+// Include paths
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../inc/client
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Sources
+SOURCEPATH      ../src
+SOURCE          upnpsecaccesscontroller.cpp
+
+// General Libraries
+LIBRARY         euser.lib
+
+// S60 UPnP libraries
+LIBRARY         upnpsecuritymanagerclient.lib
+LIBRARY         avmediaserverclient.lib 
+
+// Logging
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/group/upnpsecuritymanagerclient.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,44 @@
+/** @file
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project upnpsecuritymanagerclient
+*
+*/
+
+#include <platform_paths.hrh>
+#include <bldvariant.hrh>
+
+CAPABILITY      CAP_GENERAL_DLL
+
+TARGETTYPE        dll
+
+TARGET          upnpsecuritymanagerclient.dll
+UID 0x1000008d 0x2001B2BF
+
+VERSION 10.1
+PAGED
+
+SOURCEPATH      ../src/client
+SOURCE          upnpsecuritymanagerclientsession.cpp
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../inc/client
+
+LIBRARY         euser.lib
+LIBRARY         upnpipserversutils.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/group/upnpsecuritymanagerplugin.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for UpnpSecurityManager implement.
+*
+*/
+
+#include "upnpsecurityuids.h"
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include <bldvariant.hrh>
+
+
+// Build target
+TARGET          upnpsecuritymanagerplugin.dll
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+TARGETTYPE      PLUGIN
+UID             KGenericPluginUid2 KUpnpSecurityManagerPluginDllUid
+
+// SIS installation + IAD support
+VERSION 10.1
+paged
+
+START RESOURCE  ../data/101F977E.rss
+TARGET          upnpsecuritymanagerplugin.rsc
+TARGETPATH      resource/plugins
+END
+
+// Include paths
+USERINCLUDE     .
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Sources
+SOURCEPATH      ../src
+SOURCE          upnpsecuritymanagerplugin.cpp
+SOURCE          upnpsecuritymanagerpluginproxy.cpp
+
+// Libraries
+LIBRARY         euser.lib
+
+// Upnp stack
+LIBRARY         upnpserviceframework.lib
+LIBRARY         upnpipserversutils.lib
+LIBRARY         avmediaserverclient.lib
+
+// Upnp security
+LIBRARY         upnpsecurity.lib
+
+// Logging
+DEBUGLIBRARY    flogger.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/group/upnpsecuritymanagerserver.mmp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,71 @@
+/** @file
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies  this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*     This is the project specification file for Upnp.
+*
+*/
+
+#include "../../../group/upnpplatformvar.hrh"
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include <bldvariant.hrh>
+
+TARGETTYPE      exe
+
+TARGET             upnpsecuritymanagerserver.exe
+UID 0 0x2001B2BE
+
+CAPABILITY      CAP_SERVER
+
+VENDORID        VID_DEFAULT
+VERSION 10.1
+PAGED
+
+START RESOURCE  ../data/upnpnotifier.rss
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+SOURCEPATH      ../src/server
+SOURCE              upnpsecuritymanagerengine.cpp
+SOURCE              upnpsecuritymanagersession.cpp
+SOURCE              upnpsecuritymanagerserver.cpp
+SOURCE              upnpsecuritydbconnection.cpp
+SOURCE              upnpauthorizationnote.cpp
+
+
+MW_LAYER_SYSTEMINCLUDE
+UPNP_LOC_INCLUDE_PATH_COMPONENT
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../inc/server
+USERINCLUDE     ../inc/client
+
+// General Libraries
+LIBRARY         euser.lib
+LIBRARY         insock.lib
+LIBRARY         efsrv.lib
+LIBRARY         aknnotify.lib   
+LIBRARY         bafl.lib 
+LIBRARY         sqldb.lib
+LIBRARY         sysutil.lib
+
+LIBRARY         upnpipserversutils.lib
+// Logging
+DEBUGLIBRARY    flogger.lib
+
+//end of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/group/upnpsecurityuids.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: UID definitions for UpnpSecurity components MMP and code
+*
+*/
+
+#ifndef UPNPSECURITYUIDS_H
+#define UPNPSECURITYUIDS_H
+
+// Module UIDs
+#define KUpnpSecurityDllUid3            0x10208A48
+
+// Generic Symbian UID definitions 
+#define KGenericDllUid2                 0x1000008D  // For normal DLLs
+#define KGenericPluginUid2              0x10009D8D  // For ECom plugins
+
+// UPnP Security Manager interface UUID from upnpsecuritymanager.h
+#define KUpnpSecurityManagerPluginInterfaceUid          0x101F977E
+
+// UPnP Security Manager DLL and implementation UUIDs
+#define KUpnpSecurityManagerPluginDllUid                0x200075D5
+#define KUpnpSecurityManagerPluginImplementationUid     0x200075D6
+
+#endif // UPNPSECURITYUIDS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/client/upnpsecuritymanagerclientsession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,103 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  upnpsecuritymanager / client side interface
+ *
+ */
+
+#ifndef R_UPNPSECURITYMANAGERCLIENTSESSION_H
+#define R_UPNPSECURITYMANAGERCLIENTSESSION_H
+
+#include "upnpsessionbase.h"
+#include "upnpsecaccesscontroller.h"    //TAccessType
+#include <in_sock.h>
+
+/**
+ *  Client session to UPnP Security Manager
+ *
+ *  @lib upnpsecuritymanagerclient
+ */
+NONSHARABLE_CLASS( RUpnpSecurityManagerClientSession ) : public RUpnpSessionBase
+    {
+public:
+
+    /**
+     * Constructor.
+     */
+    IMPORT_C RUpnpSecurityManagerClientSession();
+
+    /**
+     * Establish connection with server
+     */
+    IMPORT_C TInt Connect();
+
+    /**
+     * Adds new file to allowed file array, if not existing yet
+     *
+     * @param aFileName file path+name to new allowed file
+     */
+    IMPORT_C void AddFileL( const TDesC& aFileName );
+
+    /**
+     * Removes file from allowed array
+     *
+     * @param aFileName File path+name to file to be removed
+     */
+    IMPORT_C void RemoveFileL( const TDesC& aFileName );
+
+    /**
+     * Adds new address to allowed address array, if not existing yet
+     *
+     * @param aIpAddress containing IP Address of the remote party
+     */
+    IMPORT_C void AddAddressL( const TInetAddr& aIpAddress );
+
+    /**
+     * Removes address from allowed array
+     *
+     * @param aIpAddress containing IP Address to be removed
+     */
+    IMPORT_C void RemoveAddressL( const TInetAddr& aIpAddress );
+
+    /**
+     * Resets file access list
+     */
+    IMPORT_C void ResetFileListL();
+
+    /**
+     * Resets address access list
+     */
+    IMPORT_C void ResetAddressListL();
+
+    /**
+     * Checks if ipAddress and file exist on access list
+     *
+     * @param aIpAddress  IP Address 
+     * @param aFileName path+name to file 
+     */
+    IMPORT_C TAccessType CheckAuthorizationL(
+            const TInetAddr& aIpAddress,
+            const TDesC& aFileName );
+
+    /**
+     * Checks if ipAddress and file exist on access list
+     *
+     * @param  aIpAddress containing IP Address to be
+     *        removed
+     */
+    IMPORT_C TAccessType QueryAuthorisationL( const TInetAddr& aIpAdress );
+
+    };
+
+#endif // R_UPNPSECURITYMANAGERCLIENTSESSION_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/server/upnpauthorizationnote.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,96 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *  Description : Authorization query dialog
+ *
+ */
+
+#ifndef UPNPAUTHORISATIONNOTE_H
+#define UPNPAUTHORISATIONNOTE_H
+
+// INCLUDES
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include "upnpnotifytimer.h"
+
+// FORWARD DECLARATIONS
+class CAknGlobalNote;
+// CONSTANTS
+#define KResourcePath KDC_RESOURCE_FILES_DIR
+_LIT( KResourceFileName, "upnpnotifier.rsc" );
+const TInt KAuthorizationNoteTimeout = 15;
+
+// CLASS DECLARATION
+
+/**
+ * Observer of CUpnpAuthorizationNote results
+ */
+class MUpnpAuthorizationNoteObserver
+    {
+public:
+
+    /**
+     * A callback function.
+     * @param aAuthorized The result of authorization.
+     */
+    virtual void NoteResponseL( TBool aAuthorized ) = 0;
+    };
+
+/**
+ * Active wrapper of CAknGlobalNote YES/NO query dialog
+ */
+class CUpnpAuthorizationNote : public CActive,
+        public MUpnpNotifyTimerObserver
+    {
+public:
+    /**
+     * Destructor.
+     */
+    ~CUpnpAuthorizationNote();
+
+    /**
+     * A two-phased constructor functions.
+     */
+    static CUpnpAuthorizationNote* NewL();
+    static CUpnpAuthorizationNote* NewLC();
+
+    /** 
+     * Creates CAknGlobalNote dialog and performs
+     * ShowNoteL() on it. The dialog is destroyed after user 
+     * confirmation or 15 second timeout.
+     *
+     * @param aObserver ShowNoteL results observer
+     */
+    void ShowNoteL( MUpnpAuthorizationNoteObserver* aObserver );
+private:
+    // from MUpnpNotifyTimerObserver
+    virtual void TimerEventL( CUpnpNotifyTimer* aTimer );
+    // from CActive
+    void RunL();
+    void DoCancel();
+    TInt RunError( TInt aError );
+    // other
+    CUpnpAuthorizationNote();
+    void ConstructL();
+    void CancelNoteL();
+    void GetResourceFilePathLC( RBuf& aPath );
+    void ReadAuthorisationStringL( const TDesC& aFilename );
+private:
+    CUpnpNotifyTimer* iTimer;
+    MUpnpAuthorizationNoteObserver* iObserver;
+    CAknGlobalNote* iNote;
+    TInt iNoteId;
+    HBufC* iAuthorizationString;
+    };
+
+#endif // UPNPAUTHORISATIONNOTE_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/server/upnpsecuritydbconnection.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,203 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *  Description : SQLite Connection class
+ *
+ */
+
+#ifndef UPNPSECURITYDBCONNECTION_H
+#define UPNPSECURITYDBCONNECTION_H
+
+// INCLUDES
+#include <e32base.h>
+#include <sqldb.h>
+#include <f32file.h> //TDriveNumber
+
+class TInetAddr;
+
+// CLASS DECLARATION
+
+/**
+ * 
+ */
+class CUpnpSecurityDbConnection : public CBase
+    {
+    
+public:
+
+    /* Constructors and destructor. */
+
+    /**
+     * Creates new CUpnpSecurityDbConnection class and initializes 
+     * connection to SQLite.
+     * @return  pointer to CUpnpSecurityDbConnection class
+     */
+    static CUpnpSecurityDbConnection* NewL();
+
+    /**
+     * Creates new CUpnpSecurityDbConnection class and initializes 
+     * connection to SQLite and 
+     * leaves the instance in the cleanup stack.
+     * @return  pointer to CUpnpSecurityDbConnection class
+     */
+    static CUpnpSecurityDbConnection* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpSecurityDbConnection();
+
+public:
+    /**
+     * Open database.
+     */
+    TInt OpenDb( const TDesC& aDb );
+
+    /**
+     * Close opened database
+     */
+    void CloseDb();
+
+    /**
+     * Creates db file.
+     * @param aDb, Database filename and path
+     * @return error code
+     */
+    TInt CreateDbFile( const TDesC& aDb );
+
+    /**
+     * Validates database existence and format.
+     *
+     * @return ETrue if db valid
+     */
+    TBool Validate();
+
+    /**
+     * Executes sql command.
+     *
+     * @param aCommand, command to be executed
+     */
+    void ExecuteL( const TDesC8& aCommand );
+
+    /**
+     * Create tables.
+     */
+    void CreateTablesL();
+
+    /**
+     * Add item (IP address) to DB.
+     */
+    void AddIpAddressL( const TInetAddr& aIpAddress );
+
+    /**
+     * Add item (file name) to DB.
+     */
+    void AddFilenameL( const TDesC& aFilename );
+
+    /**
+     * Delete item (IP address) from DB.
+     */
+    void DeleteIpAddressL( const TInetAddr& aIpAddress );
+
+    /**
+     * Delete item (file name) from DB.
+     */
+    void DeleteFilenameL( const TDesC& aFilename );
+
+    /**
+     * Delete all items (IP addresses) from DB.
+     */
+    void DeleteAllIpAddressesL();
+
+    /**
+     * Delete all items (file names) from DB.
+     */
+    void DeleteAllFilenamesL();
+
+    /**
+     * Retreive data from DB.
+     */
+    void GetAllIpAddressesL( RArray<TInetAddr>& aAddressArray );
+
+    /**
+     * Retreive data from DB.
+     */
+    void GetAllFilenamesL( RPointerArray<HBufC>& aFilenameArray );
+
+    /**
+     * Prepare database for use, create new if not exist.
+     */
+    void OpenDatabaseL();
+
+private:
+
+    /**
+     * Constructor.
+     */
+    CUpnpSecurityDbConnection();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+    
+    /**
+     * Leaves if there is not enough disk space 
+     */
+    void EnsureDiskSpaceL();
+
+    /**
+     * Returns drive where db files are stored
+     */
+    TDriveNumber DatabaseDrive();
+    
+    /**
+     * Execute given db command
+     * 
+     * @param aCommand command do execute
+     * @param aType type of statement
+     */
+    void ExecStatementL( const TDesC8& aCommand );
+
+    /**
+     * Execute given db command
+     * 
+     * @param aCommand command do execute
+     * @param aTextToBind command text argument
+     */
+    void ExecStatementL( const TDesC8& aCommand, const TDesC& aTextToBind );
+    
+    /**
+     * Execute given db command
+     *
+     * @param aCommand command do execute
+     * @param aType command int argument 
+     */
+    void ExecStatementL( const TDesC8& aCommand, const TInt aIntToBind );
+    
+private:
+    // data
+
+    // iDatabase, interface to Sqlite database
+    RSqlDatabase iDatabase;
+
+    // database file name
+    TFileName iDbFileName;
+
+    //
+    RFs iFs;
+    
+    };
+
+#endif //  UPNPSECURITYDBCONNECTION
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/server/upnpsecuritymanagerengine.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,151 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpSecurityManagerEngine
+ *
+ */
+
+#ifndef C_CUPNPSECURITYMANAGERENGINE_H
+#define C_CUPNPSECURITYMANAGERENGINE_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpsecuritymanagerclientsession.h"
+
+// ENUMS
+// Properties keys
+enum TUPnPSecurityManagerProperties
+    {
+    EUPnPSecManFirstRun
+    };
+
+// FORWARD DECLARATIONS
+class CUpnpSecurityDbConnection;
+
+// CLASS DECLARATION
+
+/**
+ * 
+ */
+class CUpnpSecurityManagerEngine : public CBase
+    {
+public:
+
+    /**
+     * A two-phased constructor function.
+     * @result A new instance of CUpnpSecurityManagerEngine
+     */
+    static CUpnpSecurityManagerEngine* NewL();
+
+    /**
+     * Destructor function.
+     */
+    virtual ~CUpnpSecurityManagerEngine();
+
+public:
+    /**
+     * Adds new file to allowed file array, if not existing yet.
+     * @param aFileName (const TDesC&) file path+name to new allowed file
+     */
+    void AddNewFileL( const TDesC& aFileName );
+
+    /**
+     * Removes file from allowed array.
+     * @param aFileName (const TDesC&) File path+name to file to be removed
+     */
+    void RemoveFileL( const TDesC& aFileName );
+
+    /**
+     * Adds new address to allowed address array, if not existing yet.
+     * @param aIpAddress (const TInetAddr&) containing IP Address of the
+     *        remote party
+     */
+    void AddNewAddressL( const TInetAddr& aIpAddress );
+
+    /**
+     * Removes address from allowed array.
+     * @param (const TInetAddr&) aIpAddress containing IP Address to be
+     *        removed
+     */
+    void RemoveAddressL( const TInetAddr& aIpAddress );
+
+    /**
+     * Remove all files from allowed array
+     */
+    void ResetFileListL();
+
+    /**
+     * Remove all addresses from allowed array
+     */
+    void ResetAddressListL();
+
+    /**
+     * Check if ipaddress and filename is on allowed list
+     */
+    TAccessType CheckAuthorization( const TInetAddr& aIpAddress,
+        const TDesC& aFileName );
+
+    /**
+     * Shows authorisation query to end user, and add address to allowed list
+     * if user accepted it
+     */
+    TAccessType ShowAuthorisationQueryL( const TInetAddr& aIpAdress );
+
+private:
+    /**
+     * Default constructor.
+     */
+    CUpnpSecurityManagerEngine();
+
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * 
+     */
+    void ResetListsOnFirstRunL();
+
+private:
+
+    /**
+     * Finds file from allowed array
+     * @param (const TDesC&) aFileName File path+name to file to search
+     * @return TInt, index to array. KErrNotFound, if file cannot be found.
+     */
+    TInt FindFileFromArray( const TDesC& aFileName );
+
+    /**
+     * Finds address from array
+     * @param aIpAddress (const TInetAddr&) containing IP Address to be
+     *        searched
+     * @return TInt, index to array. KErrNotFound, if file cannot be found.
+     */
+    TInt FindAddressFromArray( const TInetAddr& aIpAddress );
+
+private:
+    // Member variables
+
+    // Array for allowed files. Owned.
+    RPointerArray<HBufC> iAllowedFiles;
+
+    // Array for allowed IP addresses. Owned.
+    RArray<TInetAddr> iAllowedAddresses;
+
+    // Sqlite connection wrapper.
+    CUpnpSecurityDbConnection* iDbConnection;
+    };
+
+#endif // C_CUPNPSECURITYMANAGERENGINE_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/server/upnpsecuritymanagerserver.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,89 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  CUpnpSecurityManagerServer
+ *
+ */
+
+#ifndef C_CUPNPSECURITYMANAGERSERVER_H
+#define C_CUPNPSECURITYMANAGERSERVER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpsecuritymanagerclientservercommon.h"
+#include "upnpsymbianserverbase.h"
+
+// FORWARD DECLARATIONS
+class CUpnpSecurityManagerEngine;
+
+// CLASS DECLARATION
+
+/**
+ * 
+ */
+class CUpnpSecurityManagerServer : public CUpnpSymbianServerBase
+    {
+public:
+    /**
+     * Create a CUpnpSecurityManagerServer object using two phase construction,
+     * and return a pointer to the created object, leaving a pointer to the
+     * object on the cleanup stack.
+     * @result pointer to created CUpnpSecurityManagerServer object
+     */
+    static CUpnpSymbianServerBase* NewLC();
+
+    /**
+     * Destroy the object and release all memory objects.
+     */
+    ~CUpnpSecurityManagerServer();
+
+private:
+    // from CUpnpSymbianServerBase
+
+    /**
+     * 
+     */
+    const TDesC& ServerName() const;
+
+private:
+    /**
+     * Perform the first phase of two phase construction.
+     */
+    CUpnpSecurityManagerServer();
+
+    /**
+     * Perform the second phase construction of a CUpnpSecurityManagerServer object.
+     */
+    void ConstructL();
+
+private:
+    // From CUpnpSymbianServer
+
+    /**
+     * Create a time server session, and return a pointer to the created object.
+     * @result pointer to new session
+     */
+    CSession2* NewSessionL( const RMessage2& aMessage ) const;
+
+    /**
+     * Returns version that is supported by this server.
+     */
+    virtual TVersion SupportedVersion() const;
+
+private:
+    //
+    CUpnpSecurityManagerEngine* iEngine;
+    };
+
+#endif // C_CUPNPSECURITYMANAGERSERVER_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/server/upnpsecuritymanagersession.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,156 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  defines CUpnpSecurityManagerSession
+ *
+ */
+
+#ifndef C_CUPNPSECURITYMANAGERSESSION_H
+#define C_CUPNPSECURITYMANAGERSESSION_H
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpauthorizationnote.h"
+
+// FORWARD DECLARATIONS
+class CUpnpSecurityManagerEngine;
+
+// CLASS DECLARATION
+
+/**
+ * An instance of class CUpnpSecurityManagerSession is created for each client
+ */
+class CUpnpSecurityManagerSession : public CSession2,
+    public MUpnpAuthorizationNoteObserver
+    {
+
+public:
+    /**
+     * Create a CUpnpSecurityManagerSession object using two phase construction,
+     * and return a pointer to the created object.
+     * @param aEngine the message handler engine
+     * @result pointer to new session
+     */
+    static CUpnpSecurityManagerSession* NewL( CUpnpSecurityManagerEngine& aEngine );
+
+    /**
+     * Create a CUpnpSecurityManagerSession object using two phase construction,
+     * and return a pointer to the created object
+     * (leaving a pointer to the object on the cleanup stack).
+     * @param anEngine the message handler engine
+     * @result pointer to new session
+     */
+    static CUpnpSecurityManagerSession* NewLC( CUpnpSecurityManagerEngine& aEngine );
+
+    /**
+     * Destroy the object and release all memory objects.
+     */
+    virtual ~CUpnpSecurityManagerSession();
+
+public:
+    // From CSession
+
+    /**
+     * Called after a service request from client; from class CSession.
+     * @param aMessage message from client (containing requested operation and any data)
+     */
+    void ServiceL( const RMessage2& aMessage );
+
+private:
+    /**
+     * Perform the first phase of two phase construction.
+     * @param aServer the message handler server
+     * @param aEngine the message handler engine
+     */
+    CUpnpSecurityManagerSession( CUpnpSecurityManagerEngine& aEngine );
+
+    /**
+     * Causes the client thread to panic.
+     * @param panic code
+     */
+    void PanicClient( const RMessage2& aMessage, TInt aPanic ) const;
+
+    /**
+     * Second phase constructor
+     */
+    void ConstructL();
+    
+public:
+    // MUpnpAuthorizationNoteObserver methods
+
+    /**
+     * NoteResponseL
+     * A callback function.
+     * @param aAuthorized The result of authorization.
+     */
+    virtual void NoteResponseL( TBool aAuthorized );    
+    
+private:
+    /**
+     * 
+     */
+    void EventAddFileL( const RMessage2& aMessage );
+
+    /**
+     * 
+     */
+    void EventRemoveFileL( const RMessage2& aMessage );
+
+    /**
+     * 
+     */
+    void EventAddAddressL( const RMessage2& aMessage );
+
+    /**
+     * 
+     */
+    void EventRemoveAddressL( const RMessage2& aMessage );
+
+    /**
+     * 
+     */
+    void EventResetFileListL( const RMessage2& aMessage );
+
+    /**
+     * 
+     */
+    void EventResetAddressListL( const RMessage2& aMessage );
+
+    /**
+     * 
+     */
+    void EventCheckAuthorizationL( const RMessage2& aMessage );
+
+    /**
+     * 
+     */
+    void EventQueryAuthorisationL( const RMessage2& aMessage );
+
+    /**
+     * 
+     */
+    void EventDebugSimulateNextUserAnswerL( const RMessage2& aMessage );
+
+private:
+
+    /* @var iEngine Reference to the engine */
+    CUpnpSecurityManagerEngine& iEngine;
+    
+    //accept/disallow connection window
+    CUpnpAuthorizationNote* iAuthorizationNote;
+    
+    RMessage2 iQueryAuthMessage;
+    };
+
+#endif // C_CUPNPSECURITYMANAHERSESSION_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/server/upnpsecuritysqlclausedef.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,102 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *  Description : SQL clause definitions
+ *
+ */
+
+#ifndef __UPNPSECSQLCLAUSEDEF_H__
+#define __UPNPSECSQLCLAUSEDEF_H__
+
+// CONSTANTS
+
+///////////////////////////////////////////////////////////////////
+// DROP CLAUSES
+///////////////////////////////////////////////////////////////////
+_LIT8( KUpnpSecSqlDropAddressList, "DROP TABLE IF EXISTS AddressList;");
+_LIT8( KUpnpSecSqlDropFileList, "DROP TABLE IF EXISTS FileList;" );
+
+///////////////////////////////////////////////////////////////////
+// CREATE CLAUSES FOR TABLES
+///////////////////////////////////////////////////////////////////
+_LIT8( KUpnpSecSqlCreateAddressList, 
+    "CREATE TABLE IF NOT EXISTS AddressList("
+        "Ip                 INTEGER PRIMARY KEY);"
+        );
+
+_LIT8( KUpnpSecSqlCreateFileList, 
+    "CREATE TABLE IF NOT EXISTS FileList("
+        "Filename          TEXT PRIMARY KEY);"
+        );
+
+///////////////////////////////////////////////////////////////////
+// INSERT STATEMENTS
+///////////////////////////////////////////////////////////////////
+//
+// Inserting ip address into AddressList table
+_LIT8( KUpnpSecSqlInsertIpAddress,
+    "INSERT INTO AddressList( " 
+    "Ip ) "
+    "VALUES( ? );"
+    );
+// Inserting filename into FileList table
+_LIT8( KUpnpSecSqlInsertFile,
+    "INSERT INTO FileList( " 
+    "Filename ) "
+    "VALUES( ? );"
+    );
+
+///////////////////////////////////////////////////////////////////
+// SELECT STATEMENTS
+///////////////////////////////////////////////////////////////////
+//
+// Select all ip addresses from AddressList table
+_LIT8( KUpnpSecSqlSelectAllIpAddresses,
+    "SELECT Ip FROM AddressList "
+    );
+
+// Select all filenames from FileList table
+_LIT8( KUpnpSecSqlSelectAllFiles, "SELECT Filename FROM FileList " 
+    );
+
+_LIT8( KUpnpSecSqlValidateTableExistence, "SELECT count(*) FROM AddressList, FileList;" );
+
+// ---------------------------------------------------------------------------
+// DELETE STATEMENTS
+// ---------------------------------------------------------------------------
+//
+_LIT8( KUpnpSecSqlDeleteIpAddress, 
+    "DELETE FROM AddressList "
+    "WHERE Ip = ? ;"
+    );
+_LIT8( KUpnpSecSqlDeleteAllIpAddresses, 
+    "DELETE FROM AddressList;"
+    );
+    
+_LIT8( KUpnpSecSqlDeleteFile, 
+    "DELETE FROM FileList "
+    "WHERE Filename = ? ;"
+    );
+_LIT8( KUpnpSecSqlDeleteAllFiles, 
+    "DELETE FROM FileList;"
+    );
+
+///////////////////////////////////////////////////////////////////
+// MISC DEFINITIONS
+///////////////////////////////////////////////////////////////////
+//
+_LIT16( KUpnpSecSqlIp, "Ip" );
+_LIT16( KUpnpSecSqlFilename, "Filename" );
+
+#endif // __UPNPSECSQLCLAUSEDEF_H__
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/upnpsecaccesscontroller.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,212 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *  Description : Access control interface
+ *
+ */
+
+#ifndef UPNPSECACCESSCONTROLLER_H
+#define UPNPSECACCESSCONTROLLER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RUpnpSecurityManagerClientSession;
+class TInetAddr;
+
+// ENUMS
+enum TAccessType
+    {
+    ENoneAllowed,
+    EAddressAllowed,
+    EFileAllowed,
+    EFileAndAddressAllowed
+    };
+
+/**
+ *  Access controller class
+ *
+ *  @lib upnpsecurity.lib
+ *  @since S60 3.0
+ */
+class CUpnpSecAccessController : public CBase
+    {
+
+public:
+    // Constructors and destructor.
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CUpnpSecAccessController* NewL();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CUpnpSecAccessController();
+
+public:
+    // S60 UpnpMediaServer security manager activation methods.
+
+    /**
+     * Enables the security plugin in Media Server.
+     *
+     * @since S60 3.1
+     */
+    IMPORT_C static void EnableMediaServerSecurityL();
+
+    /**
+     * Disables the security plugin in Media Server.
+     *
+     * @since S60 3.1
+     */
+    IMPORT_C static void DisableMediaServerSecurityL();
+
+    /**
+     * Returns the status of the Media Server security plugin.
+     *
+     * @since S60 3.1
+     * @return TBool indicating the current status of the MS security
+     */
+    IMPORT_C static TBool IsMediaServerSecurityEnabledL();
+
+public:
+    // Business logic methods for handling the whitelists.
+
+    /**
+     * Adds allowed file, so that no authorization is requested when
+     * client gets this file.
+     * @since S60 3.0
+     * @param aFileName reference to allowed file
+     * @return TInt indicating the status of operation
+     */
+    IMPORT_C TInt AddAllowedFile( const TDesC& aFileName );
+
+    /**
+     * Removes file from white list.
+     * @since S60 3.0
+     * @param aFileName reference to file to be removed
+     * @return TInt indicating the status of operation
+     */
+    IMPORT_C TInt RemoveAllowedFile( const TDesC& aFileName );
+
+    /**
+     * Adds allowed IP address, so that no authorization is requested 
+     * when client with that IP address makes connection request.
+     * @since S60 3.0
+     * @param aIpAddress reference to allowed IP address
+     * @return TInt indicating the status of operation
+     */
+    IMPORT_C TInt AddAllowedAddress( const TInetAddr& aIpAddress );
+
+    /**
+     * Removes allowed IP address.
+     * @since S60 3.0
+     * @param aIpAddress reference to IP address to be removed
+     * @return TInt indicating the status of operation
+     */
+    IMPORT_C TInt RemoveAllowedAddress( const TInetAddr& aIpAddress );
+
+    /**
+     * Removes all allowed files from white list.
+     * @since S60 3.0
+     * @return TInt indicating the status of operation
+     */
+    IMPORT_C TInt ResetFileList();
+
+    /**
+     * Removes all allowed IP Addresses from white list.
+     * @since S60 3.0
+     * @return TInt indicating the status of operation
+     */
+    IMPORT_C TInt ResetAddressList();
+
+public:
+    // Business logic methods.
+
+    /**
+     * Checks if the given IP-address/action/file is authorized. Null
+     * parameters (filename and/or action name) are allowed.
+     *
+     * Leaves with standard e32err error code in case of an error, or
+     * with KErrAccessDenied if access is not authorized.
+     *
+     * @since S60 3.1
+     * @param aIpAddress (const TInetAddr&) IP address
+     * @param aFileName (const TDesC&) filename
+     * @param aActionName (const TDesC8&) action name
+     */
+    IMPORT_C void CheckAuthorizationL( const TInetAddr& aIpAddress,
+            const TDesC& aFileName,
+            const TDesC8& aActionName );
+
+    /**
+     * Query user to authorize connection from an IP-address.
+     *
+     * Leaves with standard e32err error code in case of an error, or
+     * with KErrAccessDenied if access is not authorized. 
+     *
+     * @since S60 3.1
+     * @param aIpAddress (const TInetAddr&) reference to IP Address
+     */
+    IMPORT_C void QueryAuthorizationL( const TInetAddr& aIpAddress );
+
+private:
+    // Business logic methods.
+
+    /**
+     * Set securitymanagersetting to given value
+     * 
+     * @param aSettingToSet value to set
+     */
+    static void SetSecurityManagerSettingL( const TDesC8& aSettingToSet );    
+    
+    /**
+     * Checks if the requested file is automatically allowed.
+     *
+     * @since S60 3.1
+     * @param aFileName (const TDesC&) the file that request concerns
+     * @return TBool access request status
+     */
+    TBool IsAllowedFile( const TDesC& aFileName );
+
+    /**
+     * Checks if the requested action is automatically allowed.
+     *
+     * @since S60 3.1
+     * @param aActionName (const TDesC8&) action name that request concerns
+     * @return TBool access request status
+     */
+    TBool IsAllowedAction( const TDesC8& aActionName );
+
+private:
+    // Constructors
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * C++ default constructor.
+     */
+    CUpnpSecAccessController();
+
+private:
+    // Member variables
+    RUpnpSecurityManagerClientSession* iSecurityManagerClientSession;
+    };
+
+#endif // UPNPSECACCESSCONTROLLER_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/upnpsecuritymanagerclientservercommon.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,55 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Security manager server / common definitions for cliet and server
+ *
+ */
+
+#ifndef UPNPSECURITYMANAGERCLIENTSERVERCOMMON_H
+#define UPNPSECURITYMANAGERCLIENTSERVERCOMMON_H
+
+// CONSTANTS
+// the name of the server, used by client
+_LIT( KUpnpSecurityManagerFilename, "upnpsecuritymanagerserver");
+
+//server's name
+_LIT( KUpnpSecurityManagerName, "upnpsecuritymanager");
+_LIT( KUpnpSecurityManagerThreadName, "upnpsecuritymanager_MainThread");
+
+const TUid KServerUid3 =
+    {
+    0x2001B2BE
+    };
+
+// the server version
+// A version must be specified when creating a session with the server
+const TUint KUpnpSecurityManagerMajorVersionNumber = 0;
+const TUint KUpnpSecurityManagerMinorVersionNumber = 1;
+const TUint KUpnpSecurityManagerBuildVersionNumber = 1;
+
+// ENUMS
+// opcodes used in message passing between client and server
+enum TUpnpSecManagerRqst
+    {
+    EAddFile = 1,
+    ERemoveFile,
+    EAddAddress,
+    ERemoveAddress,
+    EResetFileList,
+    EResetAddressList,
+    ECheckAuthorization,
+    EQueryAuthorisation
+    };
+
+#endif  // UPNPSECURITYMANAGERCLIENTSERVERCOMMON_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/inc/upnpsecuritymanagerplugin.h	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,92 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *  Description : Access control interface
+ *
+ */
+
+#ifndef UPNPSECURITYMANAGERPLUGIN_H
+#define UPNPSECURITYMANAGERPLUGIN_H
+
+// INCLUDES
+#include <e32base.h>
+#include <upnpsecuritymanager.h>
+#include "upnpsecaccesscontroller.h"
+
+// CLASS DECLARATION
+
+/**
+ *  Upnp Security Manager Plugin class
+ *  @since S60 3.1
+ */
+class CUpnpSecurityManagerPlugin : public CUpnpSecurityManager
+    {
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUpnpSecurityManagerPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUpnpSecurityManagerPlugin();
+
+public:
+    // From UpnpSecurityManager
+
+    /** 
+     * Authorize HTTP message.
+     *
+     * @since S60 3.1
+     * @param aMessage (CUpnpHttpMessage*) HTTP message
+     * @param aRequestedFile (TFileName&) requested file location
+     * @return authorization result (KErrNone if ok, KErrAccessDenied if
+     *         not)
+     */
+    TInt AuthorizeMessage( CUpnpHttpMessage* aMessage,
+        TFileName& aRequestedFile );
+
+    /** 
+     * Authorize SOAP action
+     *
+     * @since S60 3.1
+     * @param aAction (CUpnpAction*) SOAP action   
+     * @return authorization result (KErrNone if ok, KErrAccessDenied if
+     *         not)
+     */
+    TInt AuthorizeAction( CUpnpAction* aAction );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUpnpSecurityManagerPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private:
+    // Member variables
+
+    //
+    CUpnpSecAccessController* iAccessController; // owned
+    };
+
+#endif // UPNPSECURITYMANAGERPLUGIN_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/src/client/upnpsecuritymanagerclientsession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,153 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  upnpsecuritymanager / client side
+ *
+ */
+
+// INCLUDES
+#include <e32base.h>
+#include "upnpsecuritymanagerclientservercommon.h"
+#include "upnpsecuritymanagerclientsession.h"
+
+// CONSTANTS
+const TInt KServerMessageSlots = 1; //Number of message slots available per session.
+const TInt KServerRetryCount = 2;
+
+// ============================= MEMBER FUNCTIONS ==============================
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::RUpnpSecurityManagerClientSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RUpnpSecurityManagerClientSession::RUpnpSecurityManagerClientSession() :
+RUpnpSessionBase()
+    {
+    // No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::Connect
+// Establish connection to server.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RUpnpSecurityManagerClientSession::Connect()
+    {
+    return RUpnpSessionBase::Connect( KUpnpSecurityManagerName, TVersion(
+                    KUpnpSecurityManagerMajorVersionNumber,
+                    KUpnpSecurityManagerMinorVersionNumber,
+                    KUpnpSecurityManagerBuildVersionNumber ), KServerMessageSlots,
+            KServerRetryCount, KUpnpSecurityManagerFilename, KServerUid3 );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::AddFileL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpSecurityManagerClientSession::AddFileL(
+        const TDesC& aFileName )
+    {
+    User::LeaveIfError( SendReceive( EAddFile, TIpcArgs( &aFileName ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::RemoveFileL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpSecurityManagerClientSession::RemoveFileL(
+        const TDesC& aFileName )
+    {
+    User::LeaveIfError( SendReceive( ERemoveFile, TIpcArgs( &aFileName ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::AddAddressL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpSecurityManagerClientSession::AddAddressL(
+        const TInetAddr& aIpAddress )
+    {
+    TPckg<TInetAddr> addressPck( aIpAddress );
+    User::LeaveIfError( SendReceive( EAddAddress, TIpcArgs( &addressPck ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::RemoveAddressL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpSecurityManagerClientSession::RemoveAddressL(
+        const TInetAddr& aIpAddress )
+    {
+    TPckg<TInetAddr> addressPck( aIpAddress );
+    User::LeaveIfError( SendReceive( ERemoveAddress, TIpcArgs( &addressPck ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::ResetFileListL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RUpnpSecurityManagerClientSession::ResetFileListL()
+    {
+    User::LeaveIfError( SendReceive( EResetFileList ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::ResetAddressListL
+// -----------------------------------------------------------------------------
+//
+
+EXPORT_C void RUpnpSecurityManagerClientSession::ResetAddressListL()
+    {
+    User::LeaveIfError( SendReceive( EResetAddressList ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::CheckAuthorizationL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TAccessType RUpnpSecurityManagerClientSession::CheckAuthorizationL(
+        const TInetAddr& aIpAddress, const TDesC& aFileName )
+    {
+    TAccessType accessType = ENoneAllowed;
+    TPckg<TAccessType> accessTypeBuf( accessType );
+    TPckg<TInetAddr> addressPck( aIpAddress );
+    User::LeaveIfError( SendReceive( ECheckAuthorization, TIpcArgs( &addressPck,
+                            &aFileName, &accessTypeBuf ) ) );
+
+    return accessType;
+    }
+
+// -----------------------------------------------------------------------------
+// RUpnpSecurityManagerClientSession::QueryAuthorisationL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TAccessType RUpnpSecurityManagerClientSession::QueryAuthorisationL(
+        const TInetAddr& aIpAddress )
+    {
+    TAccessType accessType = ENoneAllowed;
+    TPckg<TAccessType> accessTypeBuf(accessType);
+    TPckg<TInetAddr> addressPck( aIpAddress );
+    User::LeaveIfError( SendReceive( EQueryAuthorisation, TIpcArgs( &addressPck,
+                            &accessTypeBuf ) ) );
+
+    if ( accessType == ENoneAllowed )
+        {
+        User::Leave( KErrAccessDenied );
+        }
+
+    return accessType;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/src/server/upnpauthorizationnote.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,257 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *  Description : UpnpAuthorizationNote implementation
+ *
+ */
+
+// INCLUDES
+#include <AknGlobalNote.h>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <barsread.h>
+#include <barsc.h>
+#include <upnpnotifier.rsg>
+#include <data_caging_path_literals.hrh>
+#include <bautils.h>
+
+#include "upnpauthorizationnote.h"
+
+_LIT( KComponentLogfile, "upnpsecurity.txt" );
+#include "upnplog.h"
+
+// ============================= MEMBER FUNCTIONS ==============================
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::CUpnpAuthorizationNote
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAuthorizationNote::CUpnpAuthorizationNote() :
+    CActive(EPriorityStandard) // Standard priority
+    {
+    // Add to scheduler
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAuthorizationNote* CUpnpAuthorizationNote::NewLC()
+    {
+    CUpnpAuthorizationNote* self = new ( ELeave ) CUpnpAuthorizationNote();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAuthorizationNote* CUpnpAuthorizationNote::NewL()
+    {
+    CUpnpAuthorizationNote* self = CUpnpAuthorizationNote::NewLC( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAuthorizationNote::ConstructL()
+    {
+    iTimer = CUpnpNotifyTimer::NewL( this );
+    RBuf filename;
+    GetResourceFilePathLC( filename );
+    ReadAuthorisationStringL(filename);
+    CleanupStack::PopAndDestroy( &filename );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::ResourceFilePathLC
+// Construct path of resource file
+// -----------------------------------------------------------------------------
+//
+void CUpnpAuthorizationNote::GetResourceFilePathLC( RBuf& aResultFilePath )
+    {
+    const TInt KDrivePrefixLength(2);
+    const TInt KPathLength( 
+        KDrivePrefixLength + KResourcePath().Length() + KResourceFileName().Length() );
+    aResultFilePath.CreateL( KPathLength );
+    CleanupClosePushL( aResultFilePath );
+    aResultFilePath.Append( RProcess().FileName().Left(KDrivePrefixLength) );
+    aResultFilePath.Append( KResourcePath );
+    aResultFilePath.Append( KResourceFileName );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::ReadAuthorisationStringL
+// Read authorisation string from given resource file
+// -----------------------------------------------------------------------------
+//
+void CUpnpAuthorizationNote::ReadAuthorisationStringL( const TDesC& aFilename )
+    {
+    ASSERT( NULL == iAuthorizationString );
+    
+    // open file server session
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+    
+    // Get the exact filename of the resource file
+    TFileName rscFileName;
+    rscFileName.Copy( aFilename );
+    BaflUtils::NearestLanguageFile( fs, rscFileName );
+    
+    // open resource file
+    RResourceFile resourceFile;
+    resourceFile.OpenL( fs, rscFileName );
+    CleanupClosePushL( resourceFile );
+    resourceFile.ConfirmSignatureL();
+
+    // read authorization string
+    HBufC8* resourceBuffer =
+            resourceFile.AllocReadLC( R_UPNPNOTIFIER_INCOMING_DEVICE_TEXT );
+    TResourceReader resourceReader;
+    resourceReader.SetBuffer( resourceBuffer );
+    TPtrC textdata = resourceReader.ReadTPtrC();
+    iAuthorizationString = textdata.AllocL();
+
+    // cleanup
+    CleanupStack::PopAndDestroy( resourceBuffer );
+    CleanupStack::PopAndDestroy( &resourceFile );
+    CleanupStack::PopAndDestroy( &fs );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::~CUpnpAuthorizationNote
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpAuthorizationNote::~CUpnpAuthorizationNote()
+    {
+    Cancel(); // Cancel any request, if outstanding
+    delete iTimer;
+    delete iAuthorizationString;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::DoCancel
+// How to cancel me.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAuthorizationNote::DoCancel()
+    {
+    iTimer->Cancel( );
+    TRAP_IGNORE( CancelNoteL( ));
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::CancelNoteL
+// -----------------------------------------------------------------------------
+//
+void CUpnpAuthorizationNote::CancelNoteL()
+    {
+    if ( iNote )
+        {
+        iNote->CancelNoteL( iNoteId );
+        delete iNote;
+        iNote = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::ShowNoteL
+// Function for making the request.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAuthorizationNote::ShowNoteL(
+    MUpnpAuthorizationNoteObserver* aObserver )
+    {
+    ASSERT( !iNote && aObserver );
+    iObserver = aObserver;
+
+    iNote = CAknGlobalNote::NewL();
+    iNote->SetSoftkeys( R_AVKON_SOFTKEYS_YES_NO );
+    iNote->SetGraphic( EMbmAvkonQgn_note_query, EMbmAvkonQgn_note_query_mask );
+
+    iNoteId = iNote->ShowNoteL( iStatus, EAknGlobalInformationNote,
+        *iAuthorizationString );
+
+    Cancel(); // Cancel any request, just to be sure
+    iTimer->AfterSeconds( KAuthorizationNoteTimeout ); // Set for later
+    SetActive(); // Tell scheduler a request is active
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::TimerEventL
+// From MUpnpNotifyTimerObserver.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAuthorizationNote::TimerEventL( CUpnpNotifyTimer* /*aTimer*/)
+    {
+    if ( IsActive() )
+        {
+        // cancelling note will complete outstanding request with EEikBidCancel
+        CancelNoteL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::RunL
+// From CActive - handle completion.
+// -----------------------------------------------------------------------------
+//
+void CUpnpAuthorizationNote::RunL()
+    {
+    iTimer->Cancel();
+
+    // always delete the note
+    CancelNoteL();
+
+    // handle the result
+    if ( iStatus == EAknSoftkeyYes )
+        {
+        __LOG( "[UpnpSecurity]\t CUpnpAuthorisationNotifier, \
+        used authorized the access." );
+        iObserver->NoteResponseL( ETrue );
+        }
+    else
+        {
+        __LOG( "[UpnpSecurity]\t CUpnpAuthorisationNotifier, \
+        used denied the access." );
+        iObserver->NoteResponseL( EFalse );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAuthorizationNote::RunError
+// Override to handle leaves from RunL().
+// Default implementation causes the active scheduler to panic.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpAuthorizationNote::RunError( TInt aError )
+    {
+    __LOG1( "[UpnpSecurity]\t CUpnpAuthorizationNote::RunError %d", aError );
+    TRAP_IGNORE( iObserver->NoteResponseL( EFalse ) );
+    return KErrNone;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/src/server/upnpsecuritydbconnection.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,388 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *  Description : SQLite Connection class
+ *
+ */
+// INCLUDES
+#include <e32base.h>
+#include <bautils.h>
+#include <sysutil.h>
+#include <in_sock.h>
+#include "upnpsecuritydbconnection.h"
+#include "upnpsecuritysqlclausedef.h"
+// CONSTANTS
+_LIT( KUpnpSecurityDbFileName, "upnpsec.sq" );
+_LIT8( KUpnpSecuritySqlPragmaCacheSize,
+        "PRAGMA cache_size=1024;PRAGMA page_size=4096;" );
+
+const TInt KDatabaseMinDiskSpace = 20000;
+
+// ============================= MEMBER FUNCTIONS ==============================
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::NewL
+// Second phase constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityDbConnection* CUpnpSecurityDbConnection::NewL()
+    {
+    CUpnpSecurityDbConnection* self = CUpnpSecurityDbConnection::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::NewLC
+// Second phase constructor.
+// -----------------------------------------------------------------------------
+//    
+CUpnpSecurityDbConnection* CUpnpSecurityDbConnection::NewLC()
+    {
+    CUpnpSecurityDbConnection* self =
+            new (ELeave) CUpnpSecurityDbConnection();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::~CUpnpSecurityDbConnection
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityDbConnection::~CUpnpSecurityDbConnection()
+    {
+    CloseDb();
+    iFs.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::CUpnpSecurityDbConnection
+// Default constructor.
+// -----------------------------------------------------------------------------
+//    
+CUpnpSecurityDbConnection::CUpnpSecurityDbConnection()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::ConstructL
+// -----------------------------------------------------------------------------
+//   
+void CUpnpSecurityDbConnection::ConstructL()
+    {
+    User::LeaveIfError( iFs.Connect() );
+    const TInt driveLetterPrefixLength( 2 );//letter + ':'
+    TBuf<driveLetterPrefixLength> driveLetterPrefix;
+    
+    TChar driveLetter;
+    RFs::DriveToChar( DatabaseDrive(), driveLetter );
+    const TChar KColon( ':' );
+    driveLetterPrefix.Append( driveLetter );
+    driveLetterPrefix.Append( KColon );
+
+    iFs.CreatePrivatePath( DatabaseDrive() );
+    User::LeaveIfError( iFs.PrivatePath( iDbFileName ) );
+    iDbFileName.Insert( 0, driveLetterPrefix );
+    iDbFileName.Append( KUpnpSecurityDbFileName );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::OpenDb
+// Opens database connection and sets Cache size. 
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpSecurityDbConnection::OpenDb( const TDesC& aDb )
+    {
+    CloseDb();
+    return iDatabase.Open( aDb, &KUpnpSecuritySqlPragmaCacheSize );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::ExecuteL
+// ExecuteL, execute SQL command.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::ExecuteL( const TDesC8& aCommand )
+    {
+    TInt err( iDatabase.Exec( aCommand ) );
+    if ( KErrNone > err )
+        {
+        User::Leave( err );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::CloseDb
+// Close database connection.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::CloseDb()
+    {
+    iDatabase.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::CreateDbFile
+// Creates db file.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpSecurityDbConnection::CreateDbFile( const TDesC& aDb )
+    {
+    return iDatabase.Create( aDb, &KUpnpSecuritySqlPragmaCacheSize );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::Validate
+// Check validity of database.
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpSecurityDbConnection::Validate()
+    {
+    TBool result = EFalse;
+    RSqlStatement statement;
+    TInt err = statement.Prepare( iDatabase, KUpnpSecSqlValidateTableExistence );
+    result = !err && (statement.Next() == KSqlAtRow);
+    statement.Close();
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::CreateTablesL
+// Create tables.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::CreateTablesL()
+    {
+    ExecuteL( KUpnpSecSqlDropAddressList );
+    ExecuteL( KUpnpSecSqlDropFileList );
+
+    ExecuteL( KUpnpSecSqlCreateAddressList );
+    ExecuteL( KUpnpSecSqlCreateFileList );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::OpenDatabaseL
+// Prepare database for use, create new if not exist.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::OpenDatabaseL()
+    {
+    EnsureDiskSpaceL();
+
+    if ( OpenDb( iDbFileName ) != KErrNone )
+        {
+        User::LeaveIfError( CreateDbFile( iDbFileName ) );
+        }
+
+    if ( !Validate() )
+        {
+        CreateTablesL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::AddIpAddressL
+// Add ip address to DB.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::AddIpAddressL( const TInetAddr& aIpAddress )
+    {
+    EnsureDiskSpaceL();
+    ExecStatementL( KUpnpSecSqlInsertIpAddress, aIpAddress.Address() );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::AddFilenameL
+// Add filename to DB.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::AddFilenameL( const TDesC& aFilename )
+    {
+    EnsureDiskSpaceL();
+    ExecStatementL( KUpnpSecSqlInsertFile, aFilename );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::DeleteIpAddressL
+// Delete ip address to DB.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::DeleteIpAddressL( const TInetAddr& aIpAddress )
+    {
+    ExecStatementL( KUpnpSecSqlDeleteIpAddress, aIpAddress.Address() );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::DeleteFilenameL
+// Delete filename to DB.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::DeleteFilenameL( const TDesC& aFilename )
+    {
+    ExecStatementL( KUpnpSecSqlDeleteFile, aFilename );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::DeleteAllIpAddressesL
+// Delete all ip addresses to DB.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::DeleteAllIpAddressesL()
+    {
+    ExecStatementL( KUpnpSecSqlDeleteAllIpAddresses );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::DeleteAllFilenamesL
+// Delete all filenames to DB.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::DeleteAllFilenamesL()
+    {
+    ExecStatementL( KUpnpSecSqlDeleteAllFiles );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::ExecStatementL
+// Execute given db command
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::ExecStatementL( const TDesC8& aCommand )
+    {
+    RSqlStatement statement;
+    User::LeaveIfError( statement.Prepare( iDatabase, aCommand ) );
+    CleanupClosePushL( statement );
+    User::LeaveIfError( statement.Exec() );
+    CleanupStack::PopAndDestroy( &statement );    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::ExecStatementL
+// Execute given db command
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::ExecStatementL( const TDesC8& aCommand,
+    const TDesC& aTextToBind )
+    {
+    RSqlStatement statement;
+    User::LeaveIfError( statement.Prepare( iDatabase, aCommand ) );
+    CleanupClosePushL( statement );
+    User::LeaveIfError( statement.BindText( 0, aTextToBind ) );
+    User::LeaveIfError( statement.Exec() );
+    CleanupStack::PopAndDestroy( &statement );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::ExecStatementL
+// Execute given db command
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::ExecStatementL( const TDesC8& aCommand,
+    TInt aIntToBind )
+    {
+    RSqlStatement statement;
+    User::LeaveIfError( statement.Prepare( iDatabase, aCommand ) );
+    CleanupClosePushL( statement );    
+    User::LeaveIfError( statement.BindInt( 0, aIntToBind ) );
+    User::LeaveIfError( statement.Exec() );
+    CleanupStack::PopAndDestroy( &statement );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::GetAllIpAddressesL
+// Get all ips.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::GetAllIpAddressesL(
+    RArray<TInetAddr>& aAddressArray )
+    {
+    TInt err;
+    RSqlStatement statement;
+    User::LeaveIfError( statement.Prepare( iDatabase,
+        KUpnpSecSqlSelectAllIpAddresses ) );
+    CleanupClosePushL( statement );
+    TInt columnIndex = statement.ColumnIndex( KUpnpSecSqlIp );
+
+    while ( (err = statement.Next()) == KSqlAtRow )
+        {
+        TUint32 data = statement.ColumnInt( columnIndex );
+        aAddressArray.AppendL( TInetAddr( data, 0 ) );
+        }
+
+    if ( err != KSqlAtEnd )
+        {
+        User::LeaveIfError( err );
+        }
+
+    CleanupStack::PopAndDestroy( &statement );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::GetAllFilenamesL
+// Get all filenames. 
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::GetAllFilenamesL(
+    RPointerArray<HBufC>& aFilenameArray )
+    {
+    TInt err;
+    RSqlStatement statement;
+    User::LeaveIfError( statement.Prepare( iDatabase, KUpnpSecSqlSelectAllFiles ) );
+    CleanupClosePushL( statement );
+
+    TInt columnIndex = statement.ColumnIndex( KUpnpSecSqlFilename );
+
+    while ( (err = statement.Next()) == KSqlAtRow )
+        {
+        TPtrC data = statement.ColumnTextL( columnIndex );
+        HBufC* filename = data.AllocLC();
+        aFilenameArray.AppendL( filename );
+        CleanupStack::Pop( filename );
+        }
+
+    if ( err != KSqlAtEnd )
+        {
+        User::LeaveIfError( err );
+        }
+
+    CleanupStack::PopAndDestroy( &statement );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::EnsureDiskSpaceL
+// Leaves if there is not enough disk space 
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityDbConnection::EnsureDiskSpaceL()
+    {
+    if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, KDatabaseMinDiskSpace,
+         DatabaseDrive()) )
+        {
+        User::Leave( KErrDiskFull );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityDbConnection::DatabaseDrive()
+// Return drive on which database file is kept  
+// -----------------------------------------------------------------------------
+//
+TDriveNumber CUpnpSecurityDbConnection::DatabaseDrive()
+    {
+    return RFs::GetSystemDrive();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/src/server/upnpsecuritymanagerengine.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,323 @@
+/** @file   
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Defines CUpnpSecurityManagerEngine
+ *
+ */
+// INCLUDES
+#include <e32property.h> 
+#include "upnpsecuritymanagerengine.h"
+#include "upnpsecuritydbconnection.h"
+_LIT( KComponentLogfile, "upnpsecurityserver.txt");
+#include "upnplog.h"
+
+// ============================= MEMBER FUNCTIONS ==============================
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::CUpnpSecurityManagerEngine
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerEngine::CUpnpSecurityManagerEngine()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::\
+CUpnpSecurityManagerEngine" );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerEngine::ConstructL()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::ConstructL" );
+
+    // create database connection object
+    iDbConnection = CUpnpSecurityDbConnection::NewL();
+    iDbConnection->OpenDatabaseL();
+
+    // Clean the access lists after phone reboot 
+    ResetListsOnFirstRunL();
+
+    // load lists from database
+    iDbConnection->GetAllFilenamesL( iAllowedFiles );
+    iDbConnection->GetAllIpAddressesL( iAllowedAddresses );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::ResetListsOnFirstRunL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerEngine::ResetListsOnFirstRunL()
+    {
+    // create RProperty used as reboot marker
+    TInt err = RProperty::Define( RProcess().SecureId(), EUPnPSecManFirstRun,
+        RProperty::EInt );
+    if ( err != KErrAlreadyExists )
+        {
+        // property wasn't defined, so it's the first run and we clear lists
+        User::LeaveIfError( err ); // other errors may occur
+
+        // clear lists
+        ResetFileListL();
+        ResetAddressListL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerEngine* CUpnpSecurityManagerEngine::NewL()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::NewL" );
+
+    CUpnpSecurityManagerEngine* self =
+            new (ELeave) CUpnpSecurityManagerEngine();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::CUpnpSecurityManagerEngine
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerEngine::~CUpnpSecurityManagerEngine()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::\
+~CUpnpAuthorisationNotifier" );
+
+    // Reset whitelists
+    iAllowedFiles.ResetAndDestroy();
+    iAllowedAddresses.Reset();
+
+    delete iDbConnection;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::ResetFileListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerEngine::ResetFileListL()
+    {
+    iAllowedFiles.ResetAndDestroy();
+    iDbConnection->DeleteAllFilenamesL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::ResetAddressListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerEngine::ResetAddressListL()
+    {
+    iAllowedAddresses.Reset();
+    iDbConnection->DeleteAllIpAddressesL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::CheckAuthorizationL
+// -----------------------------------------------------------------------------
+//
+TAccessType CUpnpSecurityManagerEngine::CheckAuthorization(
+    const TInetAddr& aIpAddress, const TDesC& aFileName )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::CheckAuthorization" );
+
+    TAccessType accessType = ENoneAllowed;
+
+    // Check the lists 
+    TInt addressFound = KErrNotFound;
+    if ( aIpAddress != TInetAddr( KInetAddrNone ) )
+        {
+        addressFound = FindAddressFromArray( aIpAddress );
+        }
+    TInt fileFound = KErrNotFound;
+    if ( aFileName.Length() > 0 )
+        {
+        fileFound = FindFileFromArray( aFileName );
+        }
+
+    // Neither address or file was not
+    if ( (addressFound == KErrNotFound) && (fileFound == KErrNotFound) )
+        {
+        accessType = ENoneAllowed;
+        }
+    // Address could be found but file not
+    else if ( (addressFound >= 0) && (fileFound == KErrNotFound) )
+        {
+        accessType = EAddressAllowed;
+        }
+    // File could be found but not address
+    else if ( (addressFound == KErrNotFound) && (fileFound >= 0) )
+        {
+        accessType = EFileAllowed;
+        }
+    // Both were in the white lists
+    else
+        {
+        accessType = EFileAndAddressAllowed;
+        }
+
+    return accessType;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::AddNewFileL
+// Adds new file to allowed file array, if not existing yet.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerEngine::AddNewFileL( const TDesC& aFileName )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::AddNewFileL" );
+
+    if ( FindFileFromArray( aFileName ) == KErrNotFound )
+        {
+        HBufC* tmpBuffer = aFileName.AllocLC();
+        iAllowedFiles.AppendL( tmpBuffer );
+        CleanupStack::Pop( tmpBuffer );
+        iDbConnection->AddFilenameL( aFileName );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::RemoveFileL
+// Removes file from allowed array.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerEngine::RemoveFileL( const TDesC& aFileName )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::RemoveFileL" );
+
+    TInt index = FindFileFromArray( aFileName );
+    if ( index != KErrNotFound )
+        {
+        __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine, \
+file removed from whitelist." );
+        delete iAllowedFiles[index];
+        iAllowedFiles.Remove( index );
+        iDbConnection->DeleteFilenameL( aFileName );
+        }
+    else
+        {
+        __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine, \
+FILE NOT FOUND!" );
+        User::Leave( KErrNotFound );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::FindFileFromArray
+// Finds file from array and returns the index.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpSecurityManagerEngine::FindFileFromArray( const TDesC& aFileName )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::\
+FindFileFromArray" );
+
+    TInt retVal = KErrNotFound;
+    for ( TInt index = 0; index < iAllowedFiles.Count(); ++index )
+        {
+        // Check if file names are the same
+        // Use folding to remove case sensitiveness
+        if ( aFileName.CompareF( *iAllowedFiles[index] ) == 0 )
+            {
+            retVal = index;
+            break;
+            }
+        }
+
+    __LOG2( "CUpnpSecurityManagerEngine::FindFileFromArray(%S) retVal=%d",
+            &aFileName, retVal );
+
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::AddNewAddressL
+// Adds new address to allowed address array, if not existing yet.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerEngine::AddNewAddressL( const TInetAddr& aIpAddress )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::AddNewAddressL" );
+
+    if ( FindAddressFromArray( aIpAddress ) == KErrNotFound )
+        {
+        iAllowedAddresses.AppendL( aIpAddress );
+        iDbConnection->AddIpAddressL( aIpAddress );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::RemoveAddressL
+// Removes existing address from IP address array.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerEngine::RemoveAddressL( const TInetAddr& aIpAddress )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::RemoveAddressL" );
+
+    TInt index = FindAddressFromArray( aIpAddress );
+    if ( index != KErrNotFound )
+        {
+        iAllowedAddresses.Remove( index );
+        iDbConnection->DeleteIpAddressL( aIpAddress );
+        __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine, \
+address remove from array." );
+        }
+    else
+        {
+        __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine, \
+address NOT found from the array!" );
+        User::Leave( KErrNotFound );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::FindAddressFromArray
+// Finds file from array and returns the index.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpSecurityManagerEngine::FindAddressFromArray(
+    const TInetAddr& aIpAddress )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerEngine::\
+FindAddressFromArray" );
+
+    TInt retVal = KErrNotFound;
+    for ( TInt index = 0; index < iAllowedAddresses.Count(); ++index )
+        {
+        // Compare only IP Address
+        if ( iAllowedAddresses[index].Address() == aIpAddress.Address() )
+            {
+            retVal = index;
+            break;
+            }
+        }
+
+    TFileName ipAddress;
+    aIpAddress.Output( ipAddress );
+    __LOG2( "CUpnpSecurityManagerEngine::FindAddressFromArray(%S) retVal=%d",
+            &ipAddress, retVal );
+
+    return retVal;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/src/server/upnpsecuritymanagerserver.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,118 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  class CUpnpSecurityManagerServer
+ *
+ */
+
+// INCLUDES
+#include "upnpsecuritymanagerserver.h"
+#include "upnpsecuritymanagerengine.h"
+#include "upnpsecuritymanagersession.h"
+
+// CONSTANTS
+const TVersion KServerSupportedVersion(
+    KUpnpSecurityManagerMajorVersionNumber,
+    KUpnpSecurityManagerMinorVersionNumber,
+    KUpnpSecurityManagerBuildVersionNumber );
+
+// ============================= MEMBER FUNCTIONS ==============================
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerServer::CUpnpSecurityManagerServer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerServer::CUpnpSecurityManagerServer()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerServer::~CUpnpSecurityManagerServer
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerServer::~CUpnpSecurityManagerServer()
+    {
+    delete iEngine;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerServer::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSymbianServerBase* CUpnpSecurityManagerServer::NewLC()
+    {
+    CUpnpSecurityManagerServer* connManager =
+            new (ELeave) CUpnpSecurityManagerServer();
+    CleanupStack::PushL( connManager );
+    connManager->ConstructL();
+    return connManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerServer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerServer::ConstructL()
+    {
+    BaseConstructL();
+    iEngine = CUpnpSecurityManagerEngine::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerServer::NewSessionL
+// Create new session.
+// -----------------------------------------------------------------------------
+//
+CSession2* CUpnpSecurityManagerServer::NewSessionL( const RMessage2& /*aMsg*/) const
+    {
+    return CUpnpSecurityManagerSession::NewL( *iEngine );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerServer::SupportedVersion
+// Gets server supported version.
+// -----------------------------------------------------------------------------
+//
+TVersion CUpnpSecurityManagerServer::SupportedVersion() const
+    {
+    return KServerSupportedVersion;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerServer::ServerName
+// Gets server supported version.
+// -----------------------------------------------------------------------------
+//
+const TDesC& CUpnpSecurityManagerServer::ServerName() const
+    {
+    return KUpnpSecurityManagerName;
+    }
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// E32Main entry point.
+// -----------------------------------------------------------------------------
+//
+TInt E32Main()
+    {
+    return CUpnpSecurityManagerServer::StartServer(
+        KUpnpSecurityManagerThreadName, CUpnpSecurityManagerServer::NewLC );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/src/server/upnpsecuritymanagersession.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,309 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Defines the CUpnpSecurityManagerSession class
+ *
+ */
+
+// INCLUDES
+#include "upnpsecuritymanagersession.h"
+#include "upnpsecuritymanagerengine.h"
+#include "upnpsecuritymanagerserver.h"
+#include "upnpsymbianserverbase.h"
+#include "upnpsecuritymanagerclientsession.h"
+
+// ============================= MEMBER FUNCTIONS ==============================
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerSession* CUpnpSecurityManagerSession::NewL(
+    CUpnpSecurityManagerEngine& aEngine )
+    {
+    CUpnpSecurityManagerSession* self =
+            CUpnpSecurityManagerSession::NewLC( aEngine );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerSession* CUpnpSecurityManagerSession::NewLC(
+    CUpnpSecurityManagerEngine& aEngine )
+    {
+    CUpnpSecurityManagerSession* self =
+            new (ELeave) CUpnpSecurityManagerSession( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::CUpnpSecurityManagerSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerSession::CUpnpSecurityManagerSession(
+    CUpnpSecurityManagerEngine& aEngine ) :
+    CSession2(), iEngine( aEngine )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::~CUpnpSecurityManagerSession
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerSession::~CUpnpSecurityManagerSession()
+    {
+    delete iAuthorizationNote;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::ConstructL
+// Second phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::ConstructL()
+    {
+    // Create object responsible for authorisation dialog 
+    iAuthorizationNote = CUpnpAuthorizationNote::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::ServiceL
+// Handle client requests.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::ServiceL( const RMessage2& aMessage )
+    {
+    switch ( aMessage.Function() )
+        {
+        case EAddFile:
+            {
+            EventAddFileL( aMessage );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+        case ERemoveFile:
+            {
+            EventRemoveFileL( aMessage );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+        case EAddAddress:
+            {
+            EventAddAddressL( aMessage );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+        case ERemoveAddress:
+            {
+            EventRemoveAddressL( aMessage );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+        case EResetFileList:
+            {
+            EventResetFileListL( aMessage );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+        case EResetAddressList:
+            {
+            EventResetAddressListL( aMessage );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+        case ECheckAuthorization:
+            {
+            EventCheckAuthorizationL( aMessage );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+        case EQueryAuthorisation:
+            {
+            EventQueryAuthorisationL( aMessage );
+            //won't complete message as we have to wait for user response
+            break;
+            }
+        default:
+            PanicClient( aMessage, CUpnpSymbianServerBase::EBadRequest );
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::PanicClient
+// Panic client.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::PanicClient( const RMessage2& aMessage,
+    TInt aPanic ) const
+    {
+    static_cast<const CUpnpSymbianServerBase*> ( Server() )->PanicClient(
+        aMessage, aPanic );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::EventAddFileL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::EventAddFileL( const RMessage2& aMessage )
+    {
+    TInt length = aMessage.GetDesLength( 0 );
+    RBuf fileName;
+    fileName.CreateL( length );
+    CleanupClosePushL( fileName );
+    aMessage.ReadL( 0, fileName );
+
+    iEngine.AddNewFileL( fileName );
+
+    CleanupStack::PopAndDestroy( &fileName );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::EventRemoveFileL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::EventRemoveFileL( const RMessage2& aMessage )
+    {
+    TInt length = aMessage.GetDesLength( 0 );
+    RBuf fileName;
+    fileName.CreateL( length );
+    CleanupClosePushL( fileName );
+    aMessage.ReadL( 0, fileName );
+
+    iEngine.RemoveFileL( fileName );
+
+    CleanupStack::PopAndDestroy( &fileName );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::EventAddAddressL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::EventAddAddressL( const RMessage2& aMessage )
+    {
+    TInetAddr addr;
+    TPtr8 ptr( reinterpret_cast<TUint8*> ( &addr ), sizeof(addr),
+        sizeof(addr) );
+    aMessage.ReadL( 0, ptr );
+
+    iEngine.AddNewAddressL( addr );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::EventRemoveAddressL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::EventRemoveAddressL(
+    const RMessage2& aMessage )
+    {
+    TInetAddr addr;
+    TPtr8 ptr( reinterpret_cast<TUint8*> ( &addr ), sizeof(addr),
+        sizeof(addr) );
+    aMessage.ReadL( 0, ptr );
+
+    iEngine.RemoveAddressL( addr );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::EventResetFileListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::EventResetFileListL( const RMessage2& /*aMessage*/)
+    {
+    iEngine.ResetFileListL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::EventResetAddressListL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::EventResetAddressListL( const RMessage2& /*aMessage*/)
+    {
+    iEngine.ResetAddressListL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::EventCheckAuthorizationL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::EventCheckAuthorizationL(
+    const RMessage2& aMessage )
+    {
+    TInetAddr addr;
+    TPtr8 ptr( reinterpret_cast<TUint8*> ( &addr ), sizeof(addr),
+        sizeof(addr) );
+    aMessage.ReadL( 0, ptr );
+
+    TInt length = aMessage.GetDesLength( 1 );
+    RBuf fileName;
+    fileName.CreateL( length );
+    CleanupClosePushL( fileName );
+    aMessage.ReadL( 1, fileName );
+
+    TAccessType at = iEngine.CheckAuthorization( addr, fileName );
+
+    TPckg<TAccessType> atPtr( at );
+    aMessage.WriteL( 2, atPtr );
+
+    CleanupStack::PopAndDestroy( &fileName );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerSession::EventQueryAuthorisationL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::EventQueryAuthorisationL(
+    const RMessage2& aMessage )
+    {
+    iAuthorizationNote->ShowNoteL( this );
+    iQueryAuthMessage = aMessage; //copy message as we can't complete it now
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerEngine::NoteResponseL
+// Callback from CUpnpAuthorizationNote.
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerSession::NoteResponseL( TBool aAuthorized )
+    {
+    TInetAddr addr;
+    TPtr8 ptr( reinterpret_cast<TUint8*> ( &addr ), sizeof(addr),
+        sizeof(addr) );
+    iQueryAuthMessage.ReadL( 0, ptr );
+
+    TAccessType noteResult;
+    if ( aAuthorized )
+        {
+        noteResult = EAddressAllowed;
+        iEngine.AddNewAddressL( addr );
+        }
+    else
+        {
+        noteResult = ENoneAllowed;
+        }
+    TPckg<TAccessType> resPtr( noteResult );
+    iQueryAuthMessage.WriteL( 1, resPtr );
+    iQueryAuthMessage.Complete( KErrNone );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/src/upnpsecaccesscontroller.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,362 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Defines the CUpnpSecAccessController class
+ *
+ */
+
+// INCLUDES
+#include <e32base.h>
+#include <upnpmediaserversettings.h>
+#include "upnpsecaccesscontroller.h"
+#include "upnpsecuritymanagerclientsession.h"
+
+_LIT( KComponentLogfile, "upnpsecurity.txt");
+#include "upnplog.h"
+
+// CONSTANTS
+
+_LIT8( KSecurityPluginName, "UpnpSecurityManager" );
+_LIT( KMediaServerXMLFile, "MediaServer1\\MediaServer1.xml" );
+_LIT( KConnectionManagerXMLFile, "MediaServer1\\ConnectionManager1.xml" );
+_LIT( KContentDirectoryXMLFile, "MediaServer1\\ContentDirectory1.xml" );
+_LIT( KIconFile0, "MediaServer1\\icon\\0" );
+_LIT( KIconFile1, "MediaServer1\\icon\\1" );
+_LIT( KIconFile2, "MediaServer1\\icon\\2" );
+_LIT( KIconFile3, "MediaServer1\\icon\\3" );
+_LIT8( KGetProtocolInfo, "GetProtocolInfo" );
+
+// ============================= MEMBER FUNCTIONS ==============================
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpSecAccessController* CUpnpSecAccessController::NewL()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::NewL" );
+
+    CUpnpSecAccessController* self = new (ELeave) CUpnpSecAccessController;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecAccessController::ConstructL()
+    {
+    iSecurityManagerClientSession = new (ELeave) RUpnpSecurityManagerClientSession();
+    User::LeaveIfError( iSecurityManagerClientSession->Connect( ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::CUpnpSecAccessController
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecAccessController::CUpnpSecAccessController()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::\
+CUpnpSecAccessController" );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::~CUpnpSecAccessController
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CUpnpSecAccessController::~CUpnpSecAccessController()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::\
+~CUpnpSecAccessController" );
+    if ( iSecurityManagerClientSession )
+        {
+        iSecurityManagerClientSession->Close();
+        delete iSecurityManagerClientSession;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::EnableMediaServerSecurityL
+// Enables the security plugin in Media Server.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpSecAccessController::EnableMediaServerSecurityL()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::\
+EnableMediaServerSecurityL" );
+    SetSecurityManagerSettingL( KSecurityPluginName );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::DisableMediaServerSecurityL
+// Disables the security plugin in Media Server.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpSecAccessController::DisableMediaServerSecurityL()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::\
+DisableMediaServerSecurityL" );
+    SetSecurityManagerSettingL( KNullDesC8 );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::SetSecurityManagerSettingL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecAccessController::SetSecurityManagerSettingL( const TDesC8& aSettingToSet )
+    {
+    CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( settings );
+    User::LeaveIfError( settings->SetL(
+                    UpnpMediaServerSettings::ESecurityManager, aSettingToSet ) );
+    // Clean up
+    CleanupStack::PopAndDestroy( settings );    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::IsMediaServerSecurityEnabledL
+// Returns the status of the Media Server security plugin.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CUpnpSecAccessController::IsMediaServerSecurityEnabledL()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::\
+IsMediaServerSecurityEnabledL" );
+
+    TBool returnValue = EFalse;
+    CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
+    CleanupStack::PushL( settings );
+    HBufC8* value =
+    settings->GetL( UpnpMediaServerSettings::ESecurityManager );
+    CleanupStack::PushL( value );
+    if ( value && value->Des() != KNullDesC8 )
+        {
+        returnValue = ETrue;
+        }
+    // Clean up
+    CleanupStack::PopAndDestroy( value );
+    value = NULL;
+    CleanupStack::PopAndDestroy( settings );
+    settings = NULL;
+    return returnValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::AddAllowedFile
+// Adds file to notifier allowed list.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpSecAccessController::AddAllowedFile(
+        const TDesC& aFileName )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::AddAllowedFile" );
+
+    TInt error = KErrNone;
+    if ( !IsAllowedFile( aFileName ) )
+        {
+        TRAP(error, iSecurityManagerClientSession->AddFileL( aFileName ));
+        }
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::RemoveAllowedFile
+// Removes file from notifier allowed list.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpSecAccessController::RemoveAllowedFile(
+        const TDesC& aFileName )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::RemoveAllowedFile" );
+
+    TInt error = KErrNone;
+    if ( !IsAllowedFile( aFileName ) )
+        {
+        // We're not expecting an answer...
+        TRAP(error, iSecurityManagerClientSession->RemoveFileL( aFileName ));
+        }
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::AddAllowedAddress
+// Adds IP Address to notifier allowed list.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpSecAccessController::AddAllowedAddress(
+        const TInetAddr& aIpAddress )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::AddAllowedAddress" );
+    TInt error = KErrNone;
+    TRAP( error, iSecurityManagerClientSession->AddAddressL( aIpAddress ));
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::RemoveAllowedAddress
+// Removes IP address from notifier allowed list.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpSecAccessController::RemoveAllowedAddress(
+        const TInetAddr& aIpAddress )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::AddAllowedAddress" );
+    TInt error = KErrNone;
+    TRAP( error, iSecurityManagerClientSession->RemoveAddressL( aIpAddress ));
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::ResetFileList
+// Resets allowed files list.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpSecAccessController::ResetFileList()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::ResetFileList" );
+
+    TInt error = KErrNone;
+    TRAP( error, iSecurityManagerClientSession->ResetFileListL() );
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::ResetAddressList
+// Resets allowed addresses list.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpSecAccessController::ResetAddressList()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::ResetAddressList" );
+
+    TInt error = KErrNone;
+    TRAP( error, iSecurityManagerClientSession->ResetAddressListL());
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::QueryAuthorizationL
+// Query user to authorize connection from an IP-address.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpSecAccessController::QueryAuthorizationL(
+        const TInetAddr& aIpAddress )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController:: QueryAuthorizationL" );
+
+    iSecurityManagerClientSession->QueryAuthorisationL( aIpAddress );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::CheckAuthorizationL
+// Checks if the given IP-address/action/file is authorized.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpSecAccessController::CheckAuthorizationL(
+        const TInetAddr& aIpAddress, const TDesC& aFileName,
+        const TDesC8& aActionName )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::\
+CheckAuthorizationL" );
+
+    TBool authorized = EFalse;
+
+    // First, check if the access to the file can be automatically authorized
+    if ( aFileName != KNullDesC )
+        {
+        authorized = IsAllowedFile( aFileName );
+        }
+
+    // If file was not authorized, check the action
+    if ( !authorized && aActionName != KNullDesC8 )
+        {
+        authorized = IsAllowedAction( aActionName );
+        }
+
+    // If neither file or action were authorized, query the authorization
+    // from the notifier
+    if ( !authorized )
+        {
+        TAccessType accessType = iSecurityManagerClientSession->CheckAuthorizationL(
+                aIpAddress, aFileName );
+
+        // If the address, file or both are allowed, authorize the access
+        if ( accessType == EAddressAllowed || accessType == EFileAllowed
+                || accessType == EFileAndAddressAllowed )
+            {
+            authorized = ETrue;
+            }
+        }
+
+    // Leave if not authorized
+    if ( !authorized )
+        {
+        User::Leave( KErrAccessDenied );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::IsAllowedFile
+// Checks if the requested file is automatically allowed.
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpSecAccessController::IsAllowedFile( const TDesC& aFileName )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::IsAllowedFile" );
+
+    TBool returnValue = EFalse;
+    if ( aFileName.Length( ) > 0 )
+        {
+        // Do folded find (non-case-sensitive)
+        if ( aFileName.FindF( KMediaServerXMLFile ) != KErrNotFound
+                || aFileName.FindF( KConnectionManagerXMLFile )
+                    != KErrNotFound
+                || aFileName.FindF( KContentDirectoryXMLFile )
+                    != KErrNotFound
+                || aFileName.FindF( KIconFile0 ) != KErrNotFound
+                || aFileName.FindF( KIconFile1 ) != KErrNotFound
+                || aFileName.FindF( KIconFile2 ) != KErrNotFound
+                || aFileName.FindF( KIconFile3 ) != KErrNotFound )
+            {
+            returnValue = ETrue;
+            }
+        }
+    return returnValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecAccessController::IsAllowedAction
+// Checks if the requested action is automatically allowed.
+// -----------------------------------------------------------------------------
+//
+TBool CUpnpSecAccessController::IsAllowedAction( const TDesC8& aActionName )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecAccessController::IsAllowedAction" );
+
+    TBool returnValue = EFalse;
+    if ( aActionName.Length( ) > 0 )
+        {
+        if ( aActionName.CompareF( KGetProtocolInfo ) == 0 )
+            {
+            returnValue = ETrue;
+            }
+        }
+    return returnValue;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/src/upnpsecuritymanagerplugin.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,148 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *  Description : Implementation for UpnpSecurityManager ECom plugin.
+ *
+ */
+
+// INCLUDES
+#include <e32base.h>
+#include <upnpaction.h>
+#include <upnphttpmessage.h>
+#include "upnpsecaccesscontroller.h"
+#include "upnpsecuritymanagerplugin.h"
+
+_LIT( KComponentLogfile, "upnpsecurity.txt");
+#include "upnplog.h"
+
+// ============================= MEMBER FUNCTIONS ==============================
+
+CUpnpSecurityManagerPlugin* CUpnpSecurityManagerPlugin::NewL()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerPlugin::NewL" );
+
+    CUpnpSecurityManagerPlugin* self= NULL;
+    self = new( ELeave ) CUpnpSecurityManagerPlugin;
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerPlugin::CUpnpSecurityManagerPlugin
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerPlugin::CUpnpSecurityManagerPlugin()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerPlugin::\
+CUpnpSecurityManagerPlugin" );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerPlugin::~CUpnpSecurityManagerPlugin
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CUpnpSecurityManagerPlugin::~CUpnpSecurityManagerPlugin()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerPlugin::\
+~CUpnpSecurityManagerPlugin" );
+
+    delete iAccessController;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerPlugin::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CUpnpSecurityManagerPlugin::ConstructL()
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerPlugin::ConstructL" );
+
+    iAccessController = CUpnpSecAccessController::NewL( );
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerPlugin::AuthorizeMessage
+// Authorize HTTP message.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpSecurityManagerPlugin::AuthorizeMessage(
+    CUpnpHttpMessage* aMessage, TFileName& aRequestedFile )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerPlugin::AuthorizeMessage" );
+
+    TInt returnValue = KErrAccessDenied;
+    if ( aMessage )
+        {
+        // Check if the access to the given file is granted already
+        TRAP( returnValue,
+                iAccessController->CheckAuthorizationL( aMessage->Sender(),
+                        aRequestedFile,
+                        KNullDesC8 ) );
+
+        // If the access was not authorized, query authorization from user
+        if ( returnValue != KErrNone )
+            {
+            TRAP( returnValue,
+                    iAccessController->QueryAuthorizationL(
+                            aMessage->Sender() ) );
+            }
+        }
+
+    // Convert the returnvalue to either "KErrNone" or "KErrAccessDenied"
+    if ( returnValue != KErrNone )
+        {
+        returnValue = KErrAccessDenied;
+        }
+    return returnValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpSecurityManagerPlugin::AuthorizeAction
+// Authorize SOAP action.
+// -----------------------------------------------------------------------------
+//
+TInt CUpnpSecurityManagerPlugin::AuthorizeAction( CUpnpAction* aAction )
+    {
+    __LOG( "[UpnpSecurity]\t CUpnpSecurityManagerPlugin::AuthorizeAction" );
+
+    TInt returnValue = KErrAccessDenied;
+    if ( aAction )
+        {
+        // Check if the access to the given file is granted already
+        TRAP( returnValue,
+                iAccessController->CheckAuthorizationL( aAction->Sender(),
+                        KNullDesC,
+                        aAction->Name() ) );
+
+        // If the access was not authorized, query authorization from user
+        if ( returnValue != KErrNone )
+            {
+            TRAP( returnValue,
+                    iAccessController->QueryAuthorizationL(
+                            aAction->Sender() ) );
+            }
+        }
+
+    // Convert the returnvalue to either "KErrNone" or "KErrAccessDenied"
+    if ( returnValue != KErrNone )
+        {
+        returnValue = KErrAccessDenied;
+        }
+    return returnValue;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upnpsharing/upnpsecurity/src/upnpsecuritymanagerpluginproxy.cpp	Thu Dec 17 08:52:00 2009 +0200
@@ -0,0 +1,43 @@
+/** @file
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies  this distribution, and is available 
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *  Description : Source file for UpnpSecurityManager plugin proxy
+ *
+ */
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <ecom/implementationproxy.h>
+#include "upnpsecuritymanagerplugin.h"
+#include "upnpsecurityuids.h"
+
+// CONSTANTS
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KUpnpSecurityManagerPluginImplementationUid,
+            CUpnpSecurityManagerPlugin::NewL )
+    };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+        TInt& aTableCount )
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of File